fix(task_params): remove extra params

This commit is contained in:
fiftin 2024-07-15 14:10:12 +05:00
parent 3b3b29ee88
commit c0491e7aed
No known key found for this signature in database
GPG Key ID: 044381366A5D4731

View File

@ -46,6 +46,15 @@
<div class="text-no-wrap">{{ $t('Plan') }}</div>
</template>
</v-checkbox>
<v-checkbox
class="mt-0"
:input-value="value.auto_approve"
@change="updateValue('auto_approve', $event)"
>
<template v-slot:label>
<div class="text-no-wrap">{{ $t('Auto Approve') }} <code>-auto-approve</code></div>
</template>
</v-checkbox>
</div>
<div v-else></div>
</template>
@ -55,6 +64,13 @@
</style>
<script>
const APP_PARAMS = {
ansible: ['debug', 'dry_run', 'diff'],
terraform: ['plan', 'auto_approve'],
tofu: ['plan', 'auto_approve'],
};
export default {
props: {
value: Object,
@ -63,7 +79,14 @@ export default {
methods: {
updateValue(prop, value) {
this.$emit('input', { ...this.value, [prop]: value });
let input = { ...this.value, [prop]: value };
input = (APP_PARAMS[this.app] || []).reduce((res, param) => ({
...res,
[param]: input[param],
}), {});
this.$emit('input', input);
},
},
};