Skip to content

Commit 3333890

Browse files
disable delete if instance is running (#38)
1 parent 42294b2 commit 3333890

1 file changed

Lines changed: 16 additions & 2 deletions

File tree

src/components/tables/InstancesTable.vue

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,10 +149,17 @@
149149
class="q-ml-sm"
150150
flat
151151
dense
152+
:disable="props.row.enabled"
152153
>
153154
<q-tooltip class="bg-indigo" :offset="[10, 10]">
154-
Destroy: destroying will delete your instance and every bit of
155-
data.
155+
<span v-if="props.row.enabled">
156+
Destroy: you can only destroy a disabled instance. Please
157+
disable it first.
158+
</span>
159+
<span v-else>
160+
Destroy: destroying will delete your instance and every bit of
161+
data.</span
162+
>
156163
</q-tooltip>
157164
</q-btn>
158165
</q-td>
@@ -1074,6 +1081,13 @@ export default defineComponent({
10741081
)
10751082
},
10761083
destroyInstance: function (id) {
1084+
if (this.data.find(i => i.id === id)?.enabled) {
1085+
return this.q.notify({
1086+
message:
1087+
'You can only destroy a disabled instance. Please disable it first.',
1088+
color: 'warning'
1089+
})
1090+
}
10771091
this.confirm(
10781092
`Destroy ${id}`,
10791093
'Are you sure you want to destroy?' +

0 commit comments

Comments
 (0)