Skip to content

Commit 5d123ef

Browse files
committed
Disable add button on empty tag list in TagsSelectionDialog
1 parent 9f229b4 commit 5d123ef

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

client/src/components/Common/TagsSelectionDialog.vue

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<script setup lang="ts">
2-
import { ref } from "vue";
2+
import { computed, ref } from "vue";
33
44
import GModal from "@/components/BaseComponents/GModal.vue";
55
import StatelessTags from "@/components/TagsMultiselect/StatelessTags.vue";
@@ -17,6 +17,10 @@ const props = withDefaults(defineProps<Props>(), {
1717
1818
const tags = ref(props.initialTags);
1919
20+
const emptyTagList = computed(() => {
21+
return tags.value.length === 0;
22+
});
23+
2024
const emit = defineEmits<{
2125
(e: "cancel"): void;
2226
(e: "ok", tags: string[]): void;
@@ -42,7 +46,16 @@ function resetTags() {
4246
</script>
4347

4448
<template>
45-
<GModal :show="show" ok-text="Add" :confirm="true" size="small" :title="title" @ok="onOk" @cancel="onCancel">
49+
<GModal
50+
:show="show"
51+
ok-text="Add"
52+
:confirm="true"
53+
size="small"
54+
:title="title"
55+
:ok-disabled="emptyTagList"
56+
ok-disabled-title="Please select at least one tag"
57+
@ok="onOk"
58+
@cancel="onCancel">
4659
<StatelessTags :value="tags" @input="onTagsChange($event)" />
4760
</GModal>
4861
</template>

0 commit comments

Comments
 (0)