|
5 | 5 | <div class="flex flex-col space-y-3"> |
6 | 6 | <div class="flex flex-col"> |
7 | 7 | <!-- Checkbox and Date Controls Row --> |
8 | | - <div class="flex flex-col xs:flex-row gap-1 w-full justify-between"> |
| 8 | + <div class="flex flex-col xs:flex-row flex-wrap gap-x-3 gap-y-2 w-full"> |
9 | 9 | <EnvSelectMenu :options="environments" @selected-env="setSelectedEnv" |
10 | 10 | :selectedEnvironment="selectedEnvironment" class="flex-shrink-0" /> |
| 11 | + <VariantSelectMenu v-if="hasVariants" :options="variantNames" |
| 12 | + :selectedVariant="selectedVariant" @selectedVariant="onVariantSelect" class="flex-shrink-0"/> |
11 | 13 | <!-- Date Controls and Checkbox Group --> |
12 | | - <div id="controls" class="flex flex-col xs:w-1/2"> |
13 | | - <div class="flex flex-col xs:flex-row gap-1 w-full justify-between xs:justify-end"> |
| 14 | + <div id="controls" class="flex flex-col flex-shrink-0"> |
| 15 | + <div class="flex flex-col xs:flex-row gap-1 w-full"> |
14 | 16 | <DateInput label="Start Date" v-model="startDate" /> |
15 | 17 | <DateInput label="End Date" v-model="endDate" /> |
16 | 18 | <div class="flex items-center gap-1 self-start xs:self-end"> |
@@ -395,6 +397,7 @@ import SqlEditor from "@/components/asset/SqlEditor.vue"; |
395 | 397 | import IngestrAssetDisplay from "@/components/asset/IngestrAssetDisplay.vue"; |
396 | 398 | import CheckboxGroup from "@/components/ui/checkbox-group/CheckboxGroup.vue"; |
397 | 399 | import EnvSelectMenu from "@/components/ui/select-menu/EnvSelectMenu.vue"; |
| 400 | +import VariantSelectMenu from "@/components/ui/select-menu/VariantSelectMenu.vue"; |
398 | 401 | import AssetVariablesPanel from "@/components/ui/variables-panel/AssetVariablesPanel.vue"; |
399 | 402 | import ButtonGroup from "@/components/ui/buttons/ButtonGroup.vue"; |
400 | 403 | import { updateValue, resetStates, determineValidationStatus } from "@/utilities/helper"; |
@@ -747,6 +750,34 @@ const pipelineInfo = computed(() => { |
747 | 750 | return props.pipeline?.raw || props.pipeline || {}; |
748 | 751 | }); |
749 | 752 |
|
| 753 | +// --- Variant selection (for variant-bearing pipelines) ------------------- |
| 754 | +const selectedVariant = ref<string>(""); |
| 755 | +const variantNames = computed<string[]>(() => { |
| 756 | + const variants = pipelineInfo.value?.variants; |
| 757 | + if (!variants || typeof variants !== "object") return []; |
| 758 | + return Object.keys(variants).sort(); |
| 759 | +}); |
| 760 | +const hasVariants = computed(() => variantNames.value.length > 0); |
| 761 | +
|
| 762 | +watch( |
| 763 | + variantNames, |
| 764 | + (names) => { |
| 765 | + if (names.length === 0) { |
| 766 | + selectedVariant.value = ""; |
| 767 | + return; |
| 768 | + } |
| 769 | + // Keep current selection if still valid; otherwise default to first. |
| 770 | + if (!names.includes(selectedVariant.value)) { |
| 771 | + selectedVariant.value = names[0]; |
| 772 | + } |
| 773 | + }, |
| 774 | + { immediate: true } |
| 775 | +); |
| 776 | +
|
| 777 | +function onVariantSelect(value: string) { |
| 778 | + selectedVariant.value = value; |
| 779 | +} |
| 780 | +
|
750 | 781 | const fetchedVariables = ref({}); |
751 | 782 |
|
752 | 783 | const pipelineVariables = computed(() => { |
@@ -1412,6 +1443,11 @@ function buildCommandPayload( |
1412 | 1443 | payload += " --environment " + selectedEnv.value; |
1413 | 1444 | } |
1414 | 1445 |
|
| 1446 | + if (hasVariants.value && selectedVariant.value && selectedVariant.value.trim() !== "") { |
| 1447 | + const safeVariant = selectedVariant.value.replace(/"/g, '\\"'); |
| 1448 | + payload += ` --variant "${safeVariant}"`; |
| 1449 | + } |
| 1450 | +
|
1415 | 1451 | return payload; |
1416 | 1452 | } |
1417 | 1453 |
|
|
0 commit comments