Skip to content

Commit d1deddb

Browse files
Merge pull request #753 from bruin-data/patch/add-variant-selection-dropdown
add-variant-selection-dropdown
2 parents da64ba4 + 1ffe699 commit d1deddb

4 files changed

Lines changed: 93 additions & 4 deletions

File tree

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
# Changelog
2+
## [0.80.0] - [2026-05-11]
3+
- Added variant selector to the asset panel for pipelines that declare variants. The selected variant is passed to `bruin run` as `--variant <name>`.
4+
25
## [0.79.9] - [2026-04-29]
36
- Improved Ingestr asset display with edit/view mode toggle using "Edit"/"Done" text link for cleaner UI.
47

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "bruin",
33
"displayName": "Bruin",
44
"description": "Manage your Bruin data assets from within VS Code.",
5-
"version": "0.79.9",
5+
"version": "0.80.0",
66
"engines": {
77
"vscode": "^1.87.0"
88
},

webview-ui/src/components/asset/AssetGeneral.vue

Lines changed: 39 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,14 @@
55
<div class="flex flex-col space-y-3">
66
<div class="flex flex-col">
77
<!-- 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">
99
<EnvSelectMenu :options="environments" @selected-env="setSelectedEnv"
1010
:selectedEnvironment="selectedEnvironment" class="flex-shrink-0" />
11+
<VariantSelectMenu v-if="hasVariants" :options="variantNames"
12+
:selectedVariant="selectedVariant" @selectedVariant="onVariantSelect" class="flex-shrink-0"/>
1113
<!-- 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">
1416
<DateInput label="Start Date" v-model="startDate" />
1517
<DateInput label="End Date" v-model="endDate" />
1618
<div class="flex items-center gap-1 self-start xs:self-end">
@@ -395,6 +397,7 @@ import SqlEditor from "@/components/asset/SqlEditor.vue";
395397
import IngestrAssetDisplay from "@/components/asset/IngestrAssetDisplay.vue";
396398
import CheckboxGroup from "@/components/ui/checkbox-group/CheckboxGroup.vue";
397399
import EnvSelectMenu from "@/components/ui/select-menu/EnvSelectMenu.vue";
400+
import VariantSelectMenu from "@/components/ui/select-menu/VariantSelectMenu.vue";
398401
import AssetVariablesPanel from "@/components/ui/variables-panel/AssetVariablesPanel.vue";
399402
import ButtonGroup from "@/components/ui/buttons/ButtonGroup.vue";
400403
import { updateValue, resetStates, determineValidationStatus } from "@/utilities/helper";
@@ -747,6 +750,34 @@ const pipelineInfo = computed(() => {
747750
return props.pipeline?.raw || props.pipeline || {};
748751
});
749752
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+
750781
const fetchedVariables = ref({});
751782
752783
const pipelineVariables = computed(() => {
@@ -1412,6 +1443,11 @@ function buildCommandPayload(
14121443
payload += " --environment " + selectedEnv.value;
14131444
}
14141445
1446+
if (hasVariants.value && selectedVariant.value && selectedVariant.value.trim() !== "") {
1447+
const safeVariant = selectedVariant.value.replace(/"/g, '\\"');
1448+
payload += ` --variant "${safeVariant}"`;
1449+
}
1450+
14151451
return payload;
14161452
}
14171453
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
<template>
2+
<div class="flex flex-col w-36">
3+
<span class="text-xs mb-1 font-medium text-editor-fg">Variant</span>
4+
<div class="relative">
5+
<vscode-dropdown
6+
@change="handleSelect"
7+
class="w-full"
8+
:value="selectedVariant"
9+
>
10+
<vscode-option
11+
v-for="option in options"
12+
:key="option"
13+
:value="option"
14+
>
15+
{{ option }}
16+
</vscode-option>
17+
</vscode-dropdown>
18+
</div>
19+
</div>
20+
</template>
21+
22+
<script setup lang="ts">
23+
import { defineProps, defineEmits } from 'vue';
24+
25+
defineProps<{
26+
options: string[];
27+
selectedVariant: string;
28+
}>();
29+
30+
const emit = defineEmits(['selectedVariant']);
31+
32+
function handleSelect(event: Event) {
33+
const value = (event.target as HTMLSelectElement).value;
34+
emit('selectedVariant', value);
35+
}
36+
</script>
37+
38+
<style scoped>
39+
vscode-dropdown {
40+
@apply h-5 rounded-none;
41+
}
42+
vscode-dropdown::part(control) {
43+
@apply px-1 py-0.5 text-2xs border-0;
44+
}
45+
vscode-dropdown::part(listbox) {
46+
bottom: auto!important;
47+
top: 100%!important;
48+
left: 0!important;
49+
}
50+
</style>

0 commit comments

Comments
 (0)