Skip to content

Commit

Permalink
U 新建常规发布申请默认最近一次发布所选择的分支
Browse files Browse the repository at this point in the history
  • Loading branch information
vapao committed Apr 20, 2020
1 parent 8e15ea8 commit 1408c4e
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion spug_web/src/pages/deploy/request/Ext1Form.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 1408c4e

Please sign in to comment.