mirror of https://github.com/openspug/spug
U 新建常规发布申请默认最近一次发布所选择的分支
parent
8e15ea847f
commit
1408c4ea35
|
@ -43,13 +43,28 @@ class Ext1Form extends React.Component {
|
||||||
.finally(() => this.setState({fetching: false}))
|
.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 = () => {
|
_initExtra1 = () => {
|
||||||
if (this.isReady === true || this.state.extra1 === undefined) {
|
if (this.isReady === true || this.state.extra1 === undefined) {
|
||||||
const {git_type, versions: {branches, tags}} = this.state;
|
const {git_type, versions: {branches, tags}} = this.state;
|
||||||
let [extra1, extra2] = [undefined, undefined];
|
let [extra1, extra2] = [undefined, undefined];
|
||||||
if (git_type === 'branch') {
|
if (git_type === 'branch') {
|
||||||
if (branches) {
|
if (branches) {
|
||||||
extra1 = lds.get(Object.keys(branches), 0);
|
extra1 = this._getDefaultBranch(branches);
|
||||||
extra2 = lds.get(branches[extra1], '0.id')
|
extra2 = lds.get(branches[extra1], '0.id')
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue