Skip to content

Commit 6b62fb4

Browse files
authored
Merge pull request #20443 from davelopez/25.0_fix_workflow_list_add_empty_tag_list
[25.0] Fix add button is enabled when empty tag list
2 parents 193affd + 5d123ef commit 6b62fb4

File tree

2 files changed

+26
-3
lines changed

2 files changed

+26
-3
lines changed

client/src/components/BaseComponents/GModal.vue

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ const props = defineProps<{
3333
title?: string;
3434
/** Fixes the height of the modal to a pre-set height based on `size` */
3535
fixedHeight?: boolean;
36+
/** Disables the Ok button */
37+
okDisabled?: boolean;
38+
/** Title to show when the Ok button is disabled */
39+
okDisabledTitle?: string;
3640
}>();
3741
3842
const emit = defineEmits<{
@@ -170,7 +174,13 @@ defineExpose({ showModal, hideModal });
170174

171175
<div v-if="props.confirm" class="g-modal-confirm-buttons">
172176
<GButton @click="hideModal(false)"> {{ props.cancelText ?? "Cancel" }} </GButton>
173-
<GButton color="blue" @click="hideModal(true)"> {{ props.okText ?? "Ok" }} </GButton>
177+
<GButton
178+
:disabled="okDisabled"
179+
:disabled-title="okDisabledTitle"
180+
color="blue"
181+
@click="hideModal(true)">
182+
{{ props.okText ?? "Ok" }}
183+
</GButton>
174184
</div>
175185
</footer>
176186
</section>

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)