-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #17424 from jmchilton/more_structured_dialogs
Fixes for mapping workflow labels to markdown dialogs.
- Loading branch information
Showing
5 changed files
with
182 additions
and
115 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<script setup lang="ts"> | ||
import { WorkflowLabel } from "./labels"; | ||
interface LabelSelectorProps { | ||
hasLabels: boolean; | ||
labels: WorkflowLabel[]; | ||
value?: WorkflowLabel; | ||
labelTitle: string; | ||
} | ||
const props = withDefaults(defineProps<LabelSelectorProps>(), { | ||
value: undefined, | ||
}); | ||
const emit = defineEmits<{ | ||
(e: "input", value: WorkflowLabel | undefined): void; | ||
}>(); | ||
function update(index: number) { | ||
const label: WorkflowLabel | undefined = props.labels[index] || undefined; | ||
emit("input", label); | ||
} | ||
</script> | ||
|
||
<template> | ||
<div> | ||
<h2 class="mb-3 h-text">Select {{ labelTitle }} Label:</h2> | ||
<div v-if="hasLabels"> | ||
<b-form-radio | ||
v-for="(label, index) in labels" | ||
:key="index" | ||
class="my-2" | ||
name="labels" | ||
:value="index" | ||
@change="update"> | ||
{{ label.label }} | ||
</b-form-radio> | ||
</div> | ||
<b-alert v-else show variant="info"> No labels found. Please specify labels in the Workflow Editor. </b-alert> | ||
<p class="mt-3 text-muted"> | ||
You may add new labels by selecting a step in the workflow editor and then editing the corresponding label | ||
field in the step form. | ||
</p> | ||
</div> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,79 +1,51 @@ | ||
<template> | ||
<span> | ||
<b-modal | ||
v-model="modalShow" | ||
:title="title" | ||
ok-title="Continue" | ||
@ok="onOk" | ||
@cancel="onCancel" | ||
@hidden="onCancel"> | ||
<div class="ml-2"> | ||
<h2 class="mb-3 h-text">Select {{ labelTitle }} Label:</h2> | ||
<div v-if="hasLabels"> | ||
<b-form-radio | ||
v-for="(label, index) in labels" | ||
:key="index" | ||
v-model="selectedValue" | ||
class="my-2" | ||
name="labels" | ||
:value="index"> | ||
{{ label }} | ||
</b-form-radio> | ||
</div> | ||
<b-alert v-else show variant="info"> | ||
No labels found. Please specify labels in the Workflow Editor. | ||
</b-alert> | ||
<p class="mt-3 text-muted"> | ||
You may add new labels by selecting a step in the workflow editor and then editing the corresponding | ||
label field in the step form. | ||
</p> | ||
</div> | ||
</b-modal> | ||
</span> | ||
</template> | ||
<script setup lang="ts"> | ||
import { BModal } from "bootstrap-vue"; | ||
import { computed, ref } from "vue"; | ||
import { WorkflowLabel } from "./labels"; | ||
import LabelSelector from "./LabelSelector.vue"; | ||
interface MarkdownSelectorProps { | ||
labelTitle?: string; | ||
labels: WorkflowLabel[]; | ||
argumentName?: string; | ||
} | ||
<script> | ||
import BootstrapVue from "bootstrap-vue"; | ||
import Vue from "vue"; | ||
const props = defineProps<MarkdownSelectorProps>(); | ||
const selectedValue = ref<WorkflowLabel | undefined>(undefined); | ||
const modalShow = ref(true); | ||
Vue.use(BootstrapVue); | ||
const title = computed(() => { | ||
return `Insert '${props.argumentName}'`; | ||
}); | ||
const hasLabels = computed(() => { | ||
return props.labels && props.labels.length > 0; | ||
}); | ||
export default { | ||
props: { | ||
labelTitle: { | ||
type: String, | ||
default: "", | ||
}, | ||
labels: { | ||
type: Array, | ||
default: null, | ||
}, | ||
argumentName: { | ||
type: String, | ||
default: null, | ||
}, | ||
}, | ||
data() { | ||
return { | ||
selectedValue: 0, | ||
modalShow: true, | ||
}; | ||
}, | ||
computed: { | ||
title() { | ||
return `Insert '${this.argumentName}'`; | ||
}, | ||
hasLabels() { | ||
return this.labels && this.labels.length > 0; | ||
}, | ||
}, | ||
methods: { | ||
onOk() { | ||
this.$emit("onOk", this.labels[this.selectedValue]); | ||
}, | ||
onCancel() { | ||
this.$emit("onCancel"); | ||
}, | ||
}, | ||
}; | ||
const emit = defineEmits<{ | ||
(e: "onOk", value: WorkflowLabel | undefined): void; | ||
(e: "onCancel"): void; | ||
}>(); | ||
function onOk() { | ||
emit("onOk", selectedValue.value); | ||
} | ||
function onCancel() { | ||
emit("onCancel"); | ||
} | ||
</script> | ||
|
||
<template> | ||
<span> | ||
<BModal v-model="modalShow" :title="title" ok-title="Continue" @ok="onOk" @cancel="onCancel" @hidden="onCancel"> | ||
<LabelSelector | ||
v-model="selectedValue" | ||
class="ml-2" | ||
:has-labels="hasLabels" | ||
:label-title="labelTitle" | ||
:labels="labels" /> | ||
</BModal> | ||
</span> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.