Skip to content

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

feat(sql-editor): Use the same black background and green text for the admin Tab (#4616)

Liu Ji8b83faf32fe1
diff --git a/frontend/src/views/sql-editor/TabList/TabItem/AdminLabel.vue b/frontend/src/views/sql-editor/TabList/TabItem/AdminLabel.vue
index b34232e02a..c7a3b5c1a1 100644
--- a/frontend/src/views/sql-editor/TabList/TabItem/AdminLabel.vue
+++ b/frontend/src/views/sql-editor/TabList/TabItem/AdminLabel.vue
@@ -4,20 +4,15 @@
<span>{{ instance.environment.name }}</span>
<ProtectedEnvironmentIcon
:environment="instance.environment"
- class="w-4 h-4 ml-0.5"
- :class="isCurrentTab && '!text-accent'"
+ class="w-4 h-4 ml-0.5 !text-current"
/>
</template>
<template v-if="instance.id !== UNKNOWN_ID">
- <heroicons-solid:chevron-right
- class="flex-shrink-0 h-4 w-4 text-control-light"
- />
+ <heroicons-solid:chevron-right class="flex-shrink-0 h-4 w-4 opacity-70" />
<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"
- />
+ <heroicons-solid:chevron-right class="flex-shrink-0 h-4 w-4 opacity-70" />
<span>{{ database.name }}</span>
</template>
</label>
@@ -28,7 +23,7 @@ import { computed, PropType } from "vue";
import type { TabInfo } from "@/types";
import { UNKNOWN_ID } from "@/types";
-import { useDatabaseById, useInstanceById, useTabStore } from "@/store";
+import { useDatabaseById, useInstanceById } from "@/store";
import ProtectedEnvironmentIcon from "@/components/Environment/ProtectedEnvironmentIcon.vue";
const props = defineProps({
@@ -42,11 +37,8 @@ const props = defineProps({
},
});
-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/Suffix.vue b/frontend/src/views/sql-editor/TabList/TabItem/Suffix.vue
index 8b152a72e3..d2c125ecb5 100644
--- a/frontend/src/views/sql-editor/TabList/TabItem/Suffix.vue
+++ b/frontend/src/views/sql-editor/TabList/TabItem/Suffix.vue
@@ -1,6 +1,9 @@
<template>
<div
class="suffix"
+ :class="{
+ admin: tab.mode === TabMode.Admin,
+ }"
@mouseenter="state.hovering = true"
@mouseleave="state.hovering = false"
>
@@ -18,6 +21,7 @@
import { computed, PropType, reactive } from "vue";
import type { TabInfo } from "@/types";
+import { TabMode } from "@/types";
import { useTabStore } from "@/store";
type LocalState = {
@@ -56,7 +60,7 @@ const icon = computed((): IconType | undefined => {
return "close";
}
}
- if (!props.tab.isSaved) {
+ if (props.tab.mode === TabMode.ReadOnly && !props.tab.isSaved) {
return "unsaved";
}
return undefined;
@@ -70,6 +74,9 @@ const icon = computed((): IconType | undefined => {
.icon {
@apply block w-5 h-5 p-0.5 text-gray-300 hover:text-gray-500 hover:bg-gray-200 rounded;
}
+.suffix.admin .icon {
+ @apply text-gray-400 hover:text-gray-300 hover:bg-gray-400/30;
+}
.dummy {
@apply invisible;
}
diff --git a/frontend/src/views/sql-editor/TabList/TabItem/TabItem.vue b/frontend/src/views/sql-editor/TabList/TabItem/TabItem.vue
index 59d4d6084e..0672086eea 100644
--- a/frontend/src/views/sql-editor/TabList/TabItem/TabItem.vue
+++ b/frontend/src/views/sql-editor/TabList/TabItem/TabItem.vue
@@ -70,6 +70,9 @@ const isCurrentTab = computed(() => props.tab.id === currentTabId.value);
.hovering {
@apply bg-gray-50;
}
+.tab-item.admin {
+ @apply !bg-dark-bg;
+}
.body {
@apply flex items-center justify-between gap-x-1 pl-2 pr-1 py-1 border-t-2 border-t-transparent;
@@ -77,4 +80,11 @@ const isCurrentTab = computed(() => props.tab.id === currentTabId.value);
.current .body {
@apply relative bg-white text-accent border-t-accent;
}
+
+.tab-item.admin .body {
+ @apply text-[var(--color-matrix-green-hover)];
+}
+.tab-item.admin.current .body {
+ @apply !bg-dark-bg border-[var(--color-matrix-green-hover)];
+}
</style>