From 1408c4ea35b2f79172539f03162c53e674d59747 Mon Sep 17 00:00:00 2001 From: vapao Date: Mon, 20 Apr 2020 10:29:07 +0800 Subject: [PATCH] =?UTF-8?q?U=20=E6=96=B0=E5=BB=BA=E5=B8=B8=E8=A7=84?= =?UTF-8?q?=E5=8F=91=E5=B8=83=E7=94=B3=E8=AF=B7=E9=BB=98=E8=AE=A4=E6=9C=80?= =?UTF-8?q?=E8=BF=91=E4=B8=80=E6=AC=A1=E5=8F=91=E5=B8=83=E6=89=80=E9=80=89?= =?UTF-8?q?=E6=8B=A9=E7=9A=84=E5=88=86=E6=94=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- spug_web/src/pages/deploy/request/Ext1Form.js | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/spug_web/src/pages/deploy/request/Ext1Form.js b/spug_web/src/pages/deploy/request/Ext1Form.js index 2a48b702..42c7d8c3 100644 --- a/spug_web/src/pages/deploy/request/Ext1Form.js +++ b/spug_web/src/pages/deploy/request/Ext1Form.js @@ -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 {