U 新建常规发布申请默认最近一次发布所选择的分支

pull/59/head
vapao 2020-04-20 10:29:07 +08:00
parent 8e15ea847f
commit 1408c4ea35
1 changed files with 16 additions and 1 deletions

View File

@ -43,13 +43,28 @@ class Ext1Form extends React.Component {
.finally(() => this.setState({fetching: false}))
};
_getDefaultBranch = (branches) => {
branches = Object.keys(branches);
let branch = branches[0];
for (let item of store.records) {
if (item['deploy_id'] === store.record['deploy_id']) {
const b = lds.get(item, 'extra.1');
if (branches.includes(b)) {
branch = b
}
break
}
}
return branch
};
_initExtra1 = () => {
if (this.isReady === true || this.state.extra1 === undefined) {
const {git_type, versions: {branches, tags}} = this.state;
let [extra1, extra2] = [undefined, undefined];
if (git_type === 'branch') {
if (branches) {
extra1 = lds.get(Object.keys(branches), 0);
extra1 = this._getDefaultBranch(branches);
extra2 = lds.get(branches[extra1], '0.id')
}
} else {