Skip to content

Commit

Permalink
Merge pull request #11128 from vhwweng/issue_10774
Browse files Browse the repository at this point in the history
feat:Git分支/Tag和Svn分支/Tag类型的变量优化 #10774
  • Loading branch information
bkci-bot authored Dec 10, 2024
2 parents dea10a3 + 412fd51 commit a17b8a9
Show file tree
Hide file tree
Showing 22 changed files with 766 additions and 197 deletions.
2 changes: 1 addition & 1 deletion src/frontend/devops-pipeline/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"private": true,
"author": "",
"scripts": {
"dev": "nx exec -- webpack-cli serve --mode development --progress",
"dev": "webpack-cli serve --mode development --progress",
"dll": "webpack --mode production --config webpack.dll.config.js",
"public": "npm run dll && webpack --mode production",
"public:dev": "cross-env NODE_ENV=dev npm run public --",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
:list-type="parameter.keyListType"
:url="parameter.keyUrl"
:list="parameter.keyList"
:title="parameter.key"
></parameter-input>
<span class="input-seg">=</span>
<parameter-input
Expand All @@ -34,6 +35,7 @@
:list-type="parameter.valueListType"
:url="parameter.valueUrl"
:list="parameter.valueList"
:title="parameter.value"
></parameter-input>
<bk-checkbox
@change="updateParameters"
Expand All @@ -49,6 +51,7 @@
<script>
import mixins from '../mixins'
import parameterInput from './parameterInput'
import { isObject } from '@/utils/util'
export default {
name: 'parameter',
Expand Down Expand Up @@ -141,7 +144,12 @@
this.isLoading = true
this.$ajax.get(url).then((res) => {
const data = res.data || []
const data = res.data.map(i => {
return {
...i,
value: isObject(i.value) ? JSON.stringify(i.value) : i.value
}
})
this.parameters = data
this.setValue()
}).catch(e => this.$showTips({ message: e.message, theme: 'error' })).finally(() => (this.isLoading = false))
Expand Down Expand Up @@ -169,6 +177,9 @@
if (Array.isArray(param.value)) { // 去掉空字符串, 空字符串无意义
param.value = param.value.filter(v => v !== '')
}
if (isObject(param.value)) {
param.value = JSON.stringify(param.value)
}
})
this.updateParameters()
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
<bk-input
class="input-com"
:disabled="disabled"
:title="parameter.value"
:value="parameter.value"
@change="(val) => handleChangeValue(val, index)"
/>
Expand All @@ -56,6 +57,7 @@

<script>
import mixins from '../mixins'
import { isObject } from '@/utils/util'
export default {
name: 'sub-parameter',
mixins: [mixins],
Expand Down Expand Up @@ -102,7 +104,12 @@
initData () {
let values = this.atomValue[this.name] || []
if (!Array.isArray(values)) values = JSON.parse(values)
this.parameters = values
this.parameters = values.map(i => {
return {
...i,
value: isObject(i.value) ? JSON.stringify(i.value) : i.value
}
})
},
addParam () {
this.parameters.push({
Expand All @@ -115,10 +122,14 @@
this.updateParameters()
},
handleChangeKey (val, index) {
this.parameters[index].key = val
const defaultValue = this.subParamsKeyList.find(i => i.key === val)?.value
if (defaultValue) this.parameters[index].value = defaultValue
handleChangeKey (key, index) {
this.parameters[index].key = isObject(key) ? JSON.stringify(key) : key
const defaultValue = this.subParamsKeyList.find(i => i.key === key)?.value
if (defaultValue) {
this.parameters[index].value = isObject(defaultValue) ? JSON.stringify(defaultValue) : defaultValue
} else {
this.parameters[index].value = ''
}
this.updateParameters()
},
Expand All @@ -130,7 +141,7 @@
updateParameters () {
const res = this.parameters.map((parameter) => {
const key = parameter.key
const value = parameter.value
const value = isObject(parameter.value) ? JSON.stringify(parameter.value) : parameter.value
return { key, value }
})
this.handleChange(this.name, String(JSON.stringify(res)))
Expand Down
Loading

0 comments on commit a17b8a9

Please sign in to comment.