修改和新建文件branch

This commit is contained in:
caishi 2020-11-27 11:59:21 +08:00
parent a38b74041e
commit 89b78bc046
4 changed files with 14 additions and 15 deletions

View File

@ -406,6 +406,7 @@ class CoderRootDirectory extends Component {
let branch = branchName || defaultBranch;
const columns = [
{
key:"name",
dataIndex: 'name',
width:"30%",
render: (text,item) => (
@ -415,7 +416,8 @@ class CoderRootDirectory extends Component {
),
},
{
dataIndex: "commit",
key:"message",
dataIndex: "message",
width: "60%",
render: (text, item) =>
item.commit && item.commit.message ?
@ -425,7 +427,8 @@ class CoderRootDirectory extends Component {
: ""
},
{
dataIndex: "commit",
key:"time_from_now",
dataIndex: "time_from_now",
width: "10%",
className: "edu-txt-right",
render: (text, item) =>

View File

@ -54,9 +54,7 @@ class UserSubmitComponent extends Component {
const { getTopCount } = this.props;
getTopCount && getTopCount(values.branchname);
}
let url = values.branchname
? `/projects/${owner}/${projectsId}/branch/${values.branchname}`
: `/projects/${owner}/${projectsId}`;
let url = `/projects/${owner}/${projectsId}${values.branchname ? `/branch/${values.branchname}`: (branch ? `/branch/${branch}` : "")}`;
this.props.history.push(url);
}
})
@ -73,7 +71,7 @@ class UserSubmitComponent extends Component {
// 确认修改文件
UpdateFile = () => {
this.setState({ isSpin: true });
const { branch, detail, content, filepath } = this.props;
const { branch, detail, content , currentBranch } = this.props;
const { projectsId , owner } = this.props.match.params;
const { submitType } = this.state;
const url = `/${owner}/${projectsId}/update_file.json`;
@ -82,7 +80,7 @@ class UserSubmitComponent extends Component {
axios
.put(url, {
filepath: detail.path,
branch: branch,
branch: submitType === "1" ? undefined : (currentBranch || branch),
new_branch: submitType === "1" ? values.branchname : undefined,
content: content,
sha: detail.sha,
@ -91,12 +89,10 @@ class UserSubmitComponent extends Component {
.then((result) => {
this.setState({ isSpin: false });
if (result.data && result.data.status === 1) {
let url = values.branchname
? `/projects/${owner}/${projectsId}/branch/${values.branchname}`
: `/projects/${owner}/${projectsId}`;
debugger;
let url = `/projects/${owner}/${projectsId}${(values.branchname ? `/branch/${values.branchname}` : ((currentBranch || branch) ? `/branch/${currentBranch || branch}`:""))}`;
this.props.history.push(url);
this.props.showNotification("修改成功!");
this.props.showNotification("文件修改成功!");
}
})
.catch((error) => {

View File

@ -64,7 +64,7 @@ export default ((props)=>{
<Blueline onClick={()=>settingRule()}>+&nbsp;新建规则</Blueline>
</FlexAJ>
<NumUl>
<li>限制分支的推送合并强制推送相关请去<GreenUnder>仓库设置</GreenUnder></li>
<li>限制分支的推送合并强制推送相关请去<GreenUnder onClick={()=>{props.history.push(`/projects/${owner}/${projectsId}/setting`)}}>仓库设置</GreenUnder></li>
<li>一个分支同时只能有一个保护分支规则生效越早创建的规则优先级越高</li>
<li>保护分支规则只影响状态是保护分支的分支常规分支只读分支都不影响</li>
</NumUl>

View File

@ -65,7 +65,7 @@ class Index extends Component {
</Link>
</p>
</li>
{/* <li
<li
className={
pathname.indexOf("setting/branch") > -1 ? "active" : ""
}
@ -76,7 +76,7 @@ class Index extends Component {
分支设置
</Link>
</p>
</li> */}
</li>
<li
className={pathname.indexOf("setting/tags") > -1 ? "active" : ""}
>