Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

InstanceSelect

天舟2a5644ebc14a
diff --git a/frontend/src/components/InstanceSelect.vue b/frontend/src/components/InstanceSelect.vue
new file mode 100644
index 0000000000..ca45601a8f
--- /dev/null
+++ b/frontend/src/components/InstanceSelect.vue
@@ -0,0 +1,57 @@
+<template>
+ <select
+ class="btn-select w-full"
+ @change="
+ (e) => {
+ $emit('select-instance-id', e.target.value);
+ }
+ "
+ >
+ <option disabled :selected="undefined === state.selectedId">
+ Not selected
+ </option>
+ <option
+ v-for="(instance, index) in instanceList"
+ :key="index"
+ :value="instance.id"
+ :selected="instance.id == state.selectedId"
+ >
+ {{ instance.name }}
+ </option>
+ </select>
+</template>
+
+<script lang="ts">
+import { computed, reactive } from "vue";
+import { useStore } from "vuex";
+
+interface LocalState {
+ selectedId?: string;
+}
+
+export default {
+ name: "InstanceSelect",
+ emits: ["select-instance-id"],
+ components: {},
+ props: {
+ selectedId: {
+ type: String,
+ },
+ },
+ setup(props, { emit }) {
+ const store = useStore();
+ const state = reactive<LocalState>({
+ selectedId: props.selectedId,
+ });
+
+ const instanceList = computed(() => {
+ return store.getters["instance/instanceList"]();
+ });
+
+ return {
+ state,
+ instanceList,
+ };
+ },
+};
+</script>