Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bugfix: 修复代码合并导致的密码变量值无法保存的问题 #7068

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
121 changes: 0 additions & 121 deletions frontend/desktop/src/components/common/RenderForm/FormItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -413,127 +413,6 @@

return formValue
},
getDefaultValueFormat () {
let valueFormat
switch (this.scheme.type) {
case 'input':
case 'textarea':
case 'radio':
case 'text':
case 'datetime':
case 'memberSelector':
case 'logDisplay':
case 'code_editor':
case 'section':
valueFormat = {
type: ['String', 'Number', 'Boolean'],
value: ''
}
break
case 'checkbox':
case 'datatable':
case 'tree':
case 'upload':
case 'cascader':
valueFormat = {
type: 'Array',
value: []
}
break
case 'select':
if (this.scheme.attrs.multiple) {
valueFormat = {
type: 'Array',
value: []
}
} else {
valueFormat = {
type: ['String', 'Number', 'Boolean'],
value: ''
}
}
break
case 'time':
if (this.scheme.attrs.isRange) {
valueFormat = {
type: 'Array',
value: ['00:00:00', '23:59:59']
}
} else {
valueFormat = {
type: 'String',
value: ''
}
}
break
case 'int':
valueFormat = {
type: 'Number',
value: 0
}
break
case 'ip_selector':
valueFormat = {
type: 'Object',
value: {
static_ip_table_config: [],
selectors: [],
ip: [],
topo: [],
group: [],
filters: [],
excludes: []
}
}
break
case 'set_allocation':
valueFormat = {
type: 'Object',
value: {
config: {
set_count: 1,
set_template_id: '',
host_resources: [],
module_detail: []
},
data: [],
separator: ','
}
}
break
case 'host_allocation':
valueFormat = {
type: 'Object',
value: {
config: {
host_count: 0,
host_screen_value: '',
host_resources: [],
host_filter_detail: []
},
data: [],
separator: ','
}
}
break
case 'password':
valueFormat = {
type: ['String', 'Object'],
value: {
type: 'password_value',
tag: 'value',
value: ''
}
}
break
default:
valueFormat = {
type: 'String',
value: ''
}
}
return valueFormat
},
isRequired () {
let required = false
if (this.option.showRequired === true && 'validation' in this.scheme.attrs) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@
<bk-select v-else class="select-var" :value="localVal.value" @selected="handleSelectVariable">
<bk-option v-for="item in variables" :key="item.id" :id="item.id" :name="item.id"></bk-option>
</bk-select>
<span v-show="!validateInfo.valid" class="common-error-tip error-info">{{validateInfo.message}}</span>
</div>
<span v-else class="rf-view-value">{{(value.password === 'undefined' || value.password === '') ? '--' : '******'}}</span>
<div v-show="!validateInfo.valid" class="common-error-tip error-info">{{validateInfo.message}}</div>
</div>
</template>
<script>
Expand Down Expand Up @@ -130,6 +130,7 @@
this.localVal = { ...val }
} else {
this.localVal = {
type: 'password_value',
tag: 'value',
value: val
}
Expand Down
11 changes: 10 additions & 1 deletion frontend/desktop/src/utils/checkDataType.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ export const getDefaultValueFormat = (scheme) => {
case 'radio':
case 'text':
case 'datetime':
case 'password':
case 'memberSelector':
case 'logDisplay':
case 'code_editor':
Expand Down Expand Up @@ -118,6 +117,16 @@ export const getDefaultValueFormat = (scheme) => {
}
}
break
case 'password':
valueFormat = {
type: ['String', 'Object'],
value: {
type: 'password_value',
tag: 'value',
value: ''
}
}
break
default:
valueFormat = {
type: 'String',
Expand Down
Loading