Skip to content

Commit 116a914

Browse files
committed
Small changes and fix bug with prepCommandList v-model
1 parent ab064a5 commit 116a914

3 files changed

Lines changed: 53 additions & 64 deletions

File tree

src_assets/common/assets/web/src/components/PrepCommandList.vue

Lines changed: 52 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<template>
2-
<div class="mb-3">
3-
<label class="form-label">{{ label }}</label>
2+
<fieldset class="mb-3">
3+
<legend class="form-label h6">{{ label }}</legend>
44
<div class="form-text">{{ description }}</div>
55

66
<!-- Column headers (only once there's at least one row) -->
@@ -66,10 +66,11 @@
6666

6767
<FileBrowserModal v-model:open="browserOpen" type="executable" :title="$t('file_browser.select_executable')"
6868
:start-path="browserStartPath" @confirm="onBrowserConfirm" />
69-
</div>
69+
</fieldset>
7070
</template>
7171

72-
<script>
72+
<script setup>
73+
import { computed, ref } from 'vue'
7374
import Checkbox from '@/components/Checkbox.vue'
7475
import FileBrowserModal from '@/components/FileBrowserModal.vue'
7576
import {
@@ -81,63 +82,53 @@ import {
8182
Trash2,
8283
} from '@lucide/vue'
8384
84-
export default {
85-
components: {
86-
Checkbox,
87-
FileBrowserModal,
88-
FolderOpen,
89-
Play,
90-
Plus,
91-
RotateCcw,
92-
Shield,
93-
Trash2,
94-
},
95-
props: {
96-
modelValue: { type: Array, default: () => [] },
97-
platform: String,
98-
label: String,
99-
description: String,
100-
addLabel: String,
101-
},
102-
emits: ['update:modelValue'],
103-
data() {
104-
return {
105-
browserOpen: false,
106-
browserTargetIndex: null,
107-
browserTargetField: null,
108-
};
109-
},
110-
computed: {
111-
browserStartPath() {
112-
if (this.browserTargetIndex === null) {
113-
return '';
114-
}
115-
return this.modelValue[this.browserTargetIndex][this.browserTargetField] || '';
116-
},
117-
},
118-
methods: {
119-
addCmd() {
120-
let template = {
121-
do: "",
122-
undo: "",
123-
};
85+
const props = defineProps({
86+
platform: String,
87+
label: String,
88+
description: String,
89+
addLabel: String,
90+
})
12491
125-
if (this.platform === 'windows') {
126-
template = { ...template, elevated: false };
127-
}
128-
this.modelValue.push(template);
129-
},
130-
removeCmd(index) {
131-
this.modelValue.splice(index, 1);
132-
},
133-
browse(index, field) {
134-
this.browserTargetIndex = index;
135-
this.browserTargetField = field;
136-
this.browserOpen = true;
137-
},
138-
onBrowserConfirm(path) {
139-
this.modelValue[this.browserTargetIndex][this.browserTargetField] = path;
140-
},
141-
},
92+
const modelValue = defineModel({ type: Array, default: () => [] })
93+
94+
const browserOpen = ref(false)
95+
const browserTargetIndex = ref(null)
96+
const browserTargetField = ref(null)
97+
98+
const browserStartPath = computed(() => {
99+
if (browserTargetIndex.value === null) {
100+
return '';
101+
}
102+
return modelValue.value[browserTargetIndex.value][browserTargetField.value] || '';
103+
})
104+
105+
function addCmd() {
106+
let template = {
107+
do: "",
108+
undo: "",
109+
};
110+
111+
if (props.platform === 'windows') {
112+
template = { ...template, elevated: false };
113+
}
114+
modelValue.value = [...modelValue.value, template];
115+
}
116+
117+
function removeCmd(index) {
118+
const updated = [...modelValue.value];
119+
updated.splice(index, 1);
120+
modelValue.value = updated;
121+
}
122+
123+
function browse(index, field) {
124+
browserTargetIndex.value = index;
125+
browserTargetField.value = field;
126+
browserOpen.value = true;
127+
}
128+
129+
function onBrowserConfirm(path) {
130+
const updated = [...modelValue.value];
131+
updated[browserTargetIndex.value] = { ...updated[browserTargetIndex.value], [browserTargetField.value]: path };
132+
modelValue.value = updated;
142133
}
143134
</script>

src_assets/common/assets/web/src/components/Select.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ const props = defineProps({
2626
options: { type: [Array, Object], required: true },
2727
})
2828
29-
const model = defineModel()
29+
const model = defineModel({ type: [String, Number] })
3030
3131
// Normalizes to { slotName: options[] } for PlatformLayout.
3232
const optionsBySlot = computed(() => Array.isArray(props.options) ? { default: props.options } : props.options)

src_assets/common/assets/web/src/components/configs/tabs/ContainerEncoders.vue

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,5 +76,3 @@ defineExpose({ getOptions, getOptionsById })
7676
<SoftwareEncoder ref="sw" v-show="currentTab === 'sw'" :platform="platform" :config="config" />
7777

7878
</template>
79-
80-
<style scoped></style>

0 commit comments

Comments
 (0)