分支设置

This commit is contained in:
caishi 2020-11-24 18:00:34 +08:00
parent 5827e96a53
commit 92699347ec
8 changed files with 31 additions and 16 deletions

View File

@ -28,7 +28,7 @@ if (isDev) {
debugType = window.location.search.indexOf('debug=t') !== -1 ? 'teacher' :
window.location.search.indexOf('debug=s') !== -1 ? 'student' :
window.location.search.indexOf('debug=a') !== -1 ? 'admin' : parsed.debug || 'admin'
}
}
function clearAllCookie() {
cookie.remove('_educoder_session', { path: '/' });
cookie.remove('autologin_trustie', { path: '/' });

View File

@ -55,8 +55,9 @@ function Dispose(props){
//
function submit(){
let url = '';
const { defaultBranch } = props;
let params = {
branch: "master",
branch: defaultBranch,
content:ymlValue,
filepath:info,
message:''

View File

@ -98,9 +98,9 @@ class CoderRootCommit extends Component{
}
render(){
const { commitDatas , dataCount , limit , page , isSpining } = this.state;
const { projectDetail, commit_class } = this.props;
const { projectDetail, commit_class , defaultBranch } = this.props;
const { projectsId , owner , branchName } = this.props.match.params;
let branch = branchName || "master";
let branch = branchName || defaultBranch;
return(
<React.Fragment>
<div className={commit_class}>

View File

@ -15,7 +15,6 @@ import Nodata from '../Nodata';
import axios from "axios";
/**
* address:http和SSHhttp_url(对应git地址)
* branch:当前分支
* filePath:点击目录时当前目录的路径
* subfileType:保存当前点击目录的文件类型显示目录列表时才显示新建文件如果点击的是文件就不显示新建文件按钮
* readMeContent:根目录下面的readme文件内容
@ -34,7 +33,6 @@ class CoderRootDirectory extends Component {
super(props);
this.state = {
address: "http",
branch: props.match.params.branchName || "master",
filePath: undefined,
subFileType: undefined,
readMeContent: undefined,
@ -80,7 +78,8 @@ class CoderRootDirectory extends Component {
Init = () => {
let { search } = this.props.history.location;
const { branchName } = this.props.match.params;
let branch = branchName || "master";
const { defaultBranch } = this.props;
let branch = branchName || defaultBranch;
if (search && (search.indexOf("?url=") > -1 || search.indexOf("&url=") > -1)) {
let url = search.split("url=")[1];
if(url && decodeURI(url).indexOf("&")){
@ -410,10 +409,10 @@ class CoderRootDirectory extends Component {
render(){
const { branchLastCommit , lastCommitAuthor , rootList ,filePath , fileDetail , subFileType , readMeContent, isSpin , zip_url , tar_url} = this.state;
const { isManager , isDeveloper , projectDetail , platform } = this.props;
const { isManager , isDeveloper , projectDetail , platform , defaultBranch } = this.props;
const { projectsId , owner , branchName } = this.props.match.params;
let branch = branchName || "master";
let branch = branchName || defaultBranch;
const columns = [
{
dataIndex: 'name',

View File

@ -67,7 +67,8 @@ class CoderRootIndex extends Component{
Init=()=>{
const { branchName } = this.props.match.params;
this.getTopCount(branchName || "master");
const { defaultBranch } = this.props;
this.getTopCount(branchName || defaultBranch);
}
getTopCount=(branch)=>{

View File

@ -168,6 +168,8 @@ class Detail extends Component {
firstSync:false,
secondSync:false,
open_devops:false,
// 默认分支
defaultBranch:undefined,
// 非本平台项目
platform:false
@ -281,6 +283,7 @@ class Detail extends Component {
watchers_count: result.data.watchers_count,
praises_count: result.data.praises_count,
forked_count: result.data.forked_count,
defaultBranch:result.data.default_branch
})
}
}).catch((error) => { })
@ -381,7 +384,7 @@ class Detail extends Component {
const { projectDetail, watchers_count, praises_count,
forked_count, firstSync , secondSync ,
isManager, watched, praised,
project , open_devops , platform } = this.state;
project , open_devops , platform , defaultBranch } = this.state;
const url = this.props.history.location.pathname;
const urlArr = url.split("/");
const urlFlag = (urlArr.length === 3);
@ -403,7 +406,8 @@ class Detail extends Component {
const common = {
getDetail: this.getDetail,
changeOpenDevops:this.changeOpenDevops
changeOpenDevops:this.changeOpenDevops,
defaultBranch
}
return (
<div>

View File

@ -3,7 +3,7 @@ import SelectBranch from '../Branch/Select';
import Title from '../Component/Title';
import styled from 'styled-components';
import { Blueline , FlexAJ , NumUl , GreenUnder , AlignCenter , WhiteBack } from '../Component/layout';
import axios from 'axios';
const Div = styled.div`{
padding:20px 30px;
min-height:500px;
@ -15,7 +15,18 @@ export default ((props)=>{
const projectDetail = props.projectDetail;
function resetSetting(){
const url = `/${owner}/${projectsId}.json`;
axios.put(url, {
default_branch:branch
})
.then((result) => {
if (result) {
this.props.showNotification(`分支设置成功!`);
}
})
.catch((error) => {
console.log(error);
});
}
function settingRule(){
props.history.push(`/projects/${owner}/${projectsId}/setting/branch/new`);
@ -36,7 +47,7 @@ export default ((props)=>{
owner={owner}
history={props.history}
/>
<a className="color-blue ml20" onClick={resetSetting()}>设为默认分支</a>
<a className="color-blue ml20" onClick={()=>resetSetting()}>设为默认分支</a>
</AlignCenter>
</div>
<div>

View File

@ -144,7 +144,6 @@ class Setting extends Component {
});
};
changePrivate = (e) => {
console.log(e);
this.setState({
private_check: e.target.checked,
});