fix: public playbook variables are not displayed by other users

This commit is contained in:
Bai
2024-11-21 17:45:48 +08:00
committed by Bryan
parent 772f40e13d
commit 5d1301c871
2 changed files with 11 additions and 4 deletions

View File

@@ -34,10 +34,10 @@
</el-tab-pane>
</el-tabs>
<div style="display: flex;margin-top:10px;justify-content: space-between" />
<el-form v-if="!disableEdit" ref="form" label-position="left" label-width="30px">
<el-form ref="form" label-position="left" label-width="30px">
<div class="form-content">
<el-form-item label="" prop="variable">
<Variable :value.sync="variables" @input="setVariable" />
<Variable :value.sync="variables" :disable-edit.sync="disableEdit" @input="setVariable" />
</el-form-item>
</div>
</el-form>
@@ -299,6 +299,9 @@ export default {
return editor.value !== editor.originValue
},
setVariable(variables) {
if (this.disableEdit) {
return
}
this.$axios.patch(`/api/v1/ops/playbooks/${this.object.id}/`,
{ variable: variables }).catch(err => {
this.$message.error(this.$tc('UpdateErrorMsg') + ' ' + err)

View File

@@ -5,7 +5,7 @@
<el-table-column show-overflow-tooltip :label="$tc('Name')" prop="name" />
<el-table-column show-overflow-tooltip :label="$tc('VariableName')" prop="var_name" />
<el-table-column show-overflow-tooltip :label="$tc('DefaultValue')" prop="default_value" />
<el-table-column :label="$tc('Actions')" align="center" class-name="buttons" fixed="right" width="135">
<el-table-column v-if="!disableEdit" :label="$tc('Actions')" align="center" class-name="buttons" fixed="right" width="135">
<template v-slot="scope">
<el-button icon="el-icon-minus" size="mini" type="danger" @click="removeVariable(scope.row)" />
<el-button
@@ -18,7 +18,7 @@
</template>
</el-table-column>
</el-table>
<div class="actions">
<div v-if="!disableEdit" class="actions">
<el-button size="mini" type="primary" @click="onAddClick">
{{ $t('Add') }}
</el-button>
@@ -44,6 +44,10 @@ export default {
value: {
type: [Array],
default: () => []
},
disableEdit: {
type: Boolean,
default: false
}
},
data() {