Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
feat(sql-editor): give the admin mode tabs a new style (#3746)
Liu Ji3ff408ff0825
diff --git a/frontend/src/components/Environment/ProtectedEnvironmentIcon.vue b/frontend/src/components/Environment/ProtectedEnvironmentIcon.vueindex 4001b61f35..b8f7291aa9 100644--- a/frontend/src/components/Environment/ProtectedEnvironmentIcon.vue+++ b/frontend/src/components/Environment/ProtectedEnvironmentIcon.vue@@ -10,6 +10,7 @@<template #trigger><heroicons-solid:shield-exclamationclass="text-control inline-block"+ :class="tooltip ? 'pointer-events-auto' : 'pointer-events-none'"v-bind="$attrs"/></template>diff --git a/frontend/src/views/sql-editor/TabList/TabItem/AdminLabel.vue b/frontend/src/views/sql-editor/TabList/TabItem/AdminLabel.vuenew file mode 100644index 0000000000..7b47526af6--- /dev/null+++ b/frontend/src/views/sql-editor/TabList/TabItem/AdminLabel.vue@@ -0,0 +1,52 @@+<template>+ <label class="flex items-center text-sm ml-0.5">+ <template v-if="instance.id !== UNKNOWN_ID">+ <span>{{ instance.environment.name }}</span>+ <ProtectedEnvironmentIcon+ :environment="instance.environment"+ class="w-4 h-4 ml-0.5"+ :class="isCurrentTab && '!text-accent'"+ />+ </template>+ <template v-if="instance.id !== UNKNOWN_ID">+ <heroicons-solid:chevron-right+ class="flex-shrink-0 h-4 w-4 text-control-light"+ />+ <span>{{ instance.name }}</span>+ </template>+ <template v-if="database.id !== UNKNOWN_ID">+ <heroicons-solid:chevron-right+ class="flex-shrink-0 h-4 w-4 text-control-light"+ />+ <span>{{ database.name }}</span>+ </template>+ </label>+</template>++<script lang="ts" setup>+import { computed, PropType } from "vue";++import type { TabInfo } from "@/types";+import { UNKNOWN_ID } from "@/types";+import { useDatabaseById, useInstanceById, useTabStore } from "@/store";+import ProtectedEnvironmentIcon from "@/components/Environment/ProtectedEnvironmentIcon.vue";++const props = defineProps({+ tab: {+ type: Object as PropType<TabInfo>,+ required: true,+ },+ index: {+ type: Number,+ required: true,+ },+});++const tabStore = useTabStore();+const connection = computed(() => props.tab.connection);++const instance = useInstanceById(computed(() => connection.value.instanceId));+const database = useDatabaseById(computed(() => connection.value.databaseId));++const isCurrentTab = computed(() => props.tab.id === tabStore.currentTabId);+</script>diff --git a/frontend/src/views/sql-editor/TabList/TabItem/Prefix.vue b/frontend/src/views/sql-editor/TabList/TabItem/Prefix.vueindex 6207e9c883..6aa511cbe5 100644--- a/frontend/src/views/sql-editor/TabList/TabItem/Prefix.vue+++ b/frontend/src/views/sql-editor/TabList/TabItem/Prefix.vue@@ -9,13 +9,16 @@class="w-4 h-4"/></template>+ <template v-if="tab.mode === TabMode.Admin">+ <heroicons-outline:wrench class="w-4 h-4" />+ </template></template><script lang="ts" setup>import { computed, PropType } from "vue";import type { TabInfo } from "@/types";-import { unknown, UNKNOWN_ID } from "@/types";+import { TabMode, unknown, UNKNOWN_ID } from "@/types";import { useSheetStore } from "@/store";const props = defineProps({diff --git a/frontend/src/views/sql-editor/TabList/TabItem/TabItem.vue b/frontend/src/views/sql-editor/TabList/TabItem/TabItem.vueindex 8d624811fe..59d4d6084e 100644--- a/frontend/src/views/sql-editor/TabList/TabItem/TabItem.vue+++ b/frontend/src/views/sql-editor/TabList/TabItem/TabItem.vue@@ -13,7 +13,8 @@><div class="body"><Prefix :tab="tab" :index="index" />- <Label :tab="tab" :index="index" />+ <Label v-if="tab.mode === TabMode.ReadOnly" :tab="tab" :index="index" />+ <AdminLabel v-else :tab="tab" :index="index" /><Suffix :tab="tab" :index="index" @close="$emit('close', tab, index)" /></div></div>@@ -30,6 +31,7 @@ import { useTabStore } from "@/store";import Prefix from "./Prefix.vue";import Label from "./Label.vue";import Suffix from "./Suffix.vue";+import AdminLabel from "./AdminLabel.vue";type LocalState = {hovering: boolean;diff --git a/frontend/src/views/sql-editor/TabList/TabList.vue b/frontend/src/views/sql-editor/TabList/TabList.vueindex cb77009db4..3555bf534a 100644--- a/frontend/src/views/sql-editor/TabList/TabList.vue+++ b/frontend/src/views/sql-editor/TabList/TabList.vue@@ -45,6 +45,7 @@ import Draggable from "vuedraggable";import scrollIntoView from "scroll-into-view-if-needed";import type { TabInfo } from "@/types";+import { TabMode } from "@/types";import { useTabStore } from "@/store";import TabItem from "./TabItem";import { useResizeObserver } from "@vueuse/core";@@ -81,7 +82,7 @@ const handleAddTab = () => {};const handleRemoveTab = async (tab: TabInfo, index: number) => {- if (!tab.isSaved) {+ if (tab.mode === TabMode.ReadOnly && !tab.isSaved) {const $dialog = dialog.create({title: t("sql-editor.hint-tips.confirm-to-close-unsaved-sheet.title"),content: t("sql-editor.hint-tips.confirm-to-close-unsaved-sheet.content"),