Skip to content

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

chore: update ui style (#9545)

ecmadaodf739a16e0ff
diff --git a/frontend/src/components/AnomalyCenter/AnomalyCenterDashboard.vue b/frontend/src/components/AnomalyCenter/AnomalyCenterDashboard.vue
index c240a07d4b..dddef416b5 100644
--- a/frontend/src/components/AnomalyCenter/AnomalyCenterDashboard.vue
+++ b/frontend/src/components/AnomalyCenter/AnomalyCenterDashboard.vue
@@ -71,20 +71,7 @@
</div>
<div class="mt-4 py-2 flex justify-between items-center">
- <div>
- <BBTabFilter
- v-if="!project"
- :tab-item-list="tabItemList"
- :selected-index="
- tabItemList.findIndex((tab) => tab.id === state.selectedTab)
- "
- @select-index="
- (index: number) => {
- state.selectedTab = tabItemList[index].id;
- }
- "
- />
- </div>
+ <TabFilter v-model:value="state.selectedTab" :items="tabItemList" />
<SearchBox
ref="searchField"
@@ -134,7 +121,7 @@
<script lang="ts" setup>
import { computed, reactive, watchEffect } from "vue";
import { useI18n } from "vue-i18n";
-import { BBTabFilterItem, BBTableSectionDataSource } from "@/bbkit/types";
+import { BBTableSectionDataSource } from "@/bbkit/types";
import {
featureToRef,
useAnomalyV1List,
@@ -165,10 +152,6 @@ type Summary = {
export type AnomalyTabId = "database" | "instance";
-interface AnomalyTabFilterItem extends BBTabFilterItem {
- id: AnomalyTabId;
-}
-
interface LocalState {
selectedTab: AnomalyTabId;
searchText: string;
@@ -404,16 +387,16 @@ const anomalySummaryList = computed(() => {
return list;
});
-const tabItemList = computed((): AnomalyTabFilterItem[] => {
+const tabItemList = computed(() => {
return [
{
- id: "database",
- title: t("common.database"),
+ value: "database",
+ label: t("common.database"),
alert: databaseAnomalySectionList.value.length > 0,
},
{
- id: "instance",
- title: t("common.instance"),
+ value: "instance",
+ label: t("common.instance"),
alert: instanceAnomalySectionList.value.length > 0,
},
];
diff --git a/frontend/src/components/ArchiveBanner.vue b/frontend/src/components/ArchiveBanner.vue
index bf02e2b3f3..ffa911a07e 100644
--- a/frontend/src/components/ArchiveBanner.vue
+++ b/frontend/src/components/ArchiveBanner.vue
@@ -2,7 +2,7 @@
<div
class="h-8 w-full text-base font-medium bg-gray-700 text-white flex justify-center items-center"
>
- {{ $t("archive.archived") }}
+ {{ $t("common.archived") }}
</div>
</template>
diff --git a/frontend/src/components/CustomApproval/Settings/components/common/RiskFilter/SourceFilter.vue b/frontend/src/components/CustomApproval/Settings/components/common/RiskFilter/SourceFilter.vue
index 412023182b..1235680bce 100644
--- a/frontend/src/components/CustomApproval/Settings/components/common/RiskFilter/SourceFilter.vue
+++ b/frontend/src/components/CustomApproval/Settings/components/common/RiskFilter/SourceFilter.vue
@@ -1,18 +1,12 @@
<template>
- <BBTabFilter
- :tab-item-list="tabItemList"
- :selected-index="index"
- @select-index="index = $event"
- />
+ <TabFilter v-model:value="source" :items="filterItemList" />
</template>
<script lang="ts" setup>
import { computed } from "vue";
import { useI18n } from "vue-i18n";
-import { BBTabFilter, type BBTabFilterItem } from "@/bbkit";
import { SupportedSourceList } from "@/types";
import { Risk_Source } from "@/types/proto/v1/risk_service";
-import { minmax } from "@/utils";
import { sourceText } from "../../common";
import { useRiskFilter } from "./context";
@@ -25,7 +19,7 @@ const { t } = useI18n();
const { source } = useRiskFilter();
const filterItemList = computed(() => {
- const items: RiskSourceFilterItem[] = [
+ const items = [
{
value: Risk_Source.SOURCE_UNSPECIFIED,
label: t("common.all"),
@@ -39,25 +33,4 @@ const filterItemList = computed(() => {
});
return items;
});
-
-const index = computed({
- get() {
- const index = filterItemList.value.findIndex(
- (item) => item.value === source.value
- );
- if (index < 0) return 0;
- return index;
- },
- set(index) {
- index = minmax(index, 0, filterItemList.value.length - 1);
- source.value = filterItemList.value[index].value;
- },
-});
-
-const tabItemList = computed(() => {
- return filterItemList.value.map<BBTabFilterItem>((item) => ({
- title: item.label,
- alert: false,
- }));
-});
</script>
diff --git a/frontend/src/components/SQLReview/components/SQLReviewCategoryTabFilter.vue b/frontend/src/components/SQLReview/components/SQLReviewCategoryTabFilter.vue
index cd22302bcb..dcccb32d20 100644
--- a/frontend/src/components/SQLReview/components/SQLReviewCategoryTabFilter.vue
+++ b/frontend/src/components/SQLReview/components/SQLReviewCategoryTabFilter.vue
@@ -1,20 +1,19 @@
<template>
- <BBTabFilter
- :tab-item-list="tabItemList"
- :selected-index="state.selectedIndex"
- @select-index="
- (index) => {
- state.selectedIndex = index;
- $emit('select', index == 0 ? undefined : categoryList[index - 1].id);
+ <TabFilter
+ :value="state.selectedTab"
+ :items="tabItemList"
+ @update:value="
+ (val) => {
+ state.selectedTab = val as string;
+ $emit('update:value', val == 'all' ? undefined : state.selectedTab);
}
"
/>
</template>
<script lang="ts" setup>
-import { computed, reactive, PropType, watch } from "vue";
+import { computed, reactive, watch } from "vue";
import { useI18n } from "vue-i18n";
-import { BBTabFilter, type BBTabFilterItem } from "@/bbkit";
import { CategoryType } from "@/types/sqlReview";
export interface CategoryFilterItem {
@@ -23,53 +22,48 @@ export interface CategoryFilterItem {
}
interface LocalState {
- selectedIndex: number;
+ selectedTab: string;
}
-const props = defineProps({
- selected: {
- required: false,
- default: undefined,
- type: String,
- },
- categoryList: {
- required: true,
- type: Object as PropType<CategoryFilterItem[]>,
- },
-});
+const props = withDefaults(
+ defineProps<{
+ value?: string;
+ categoryList: CategoryFilterItem[];
+ }>(),
+ {
+ value: undefined,
+ }
+);
-defineEmits(["select"]);
+defineEmits<{
+ (event: "update:value", value: string | undefined): void;
+}>();
const { t } = useI18n();
-const getSelectedIndex = (): number => {
- return props.selected
- ? props.categoryList.findIndex((c) => c.id === props.selected) + 1
- : 0;
-};
const state = reactive<LocalState>({
- selectedIndex: getSelectedIndex(),
+ selectedTab: "all",
});
watch(
- () => props.selected,
- () => {
- state.selectedIndex = getSelectedIndex();
+ () => props.value,
+ (selected) => {
+ state.selectedTab = selected ?? "all";
}
);
-const tabItemList = computed((): BBTabFilterItem[] => {
- const list: BBTabFilterItem[] = [
+const tabItemList = computed(() => {
+ const list = [
{
- title: t("common.all"),
- alert: false,
+ value: "all",
+ label: t("common.all"),
},
];
list.push(
...props.categoryList.map((category) => {
return {
- title: category.name,
- alert: false,
+ value: category.id,
+ label: category.name,
};
})
);
diff --git a/frontend/src/components/SQLReview/components/SQLRuleFilter.vue b/frontend/src/components/SQLReview/components/SQLRuleFilter.vue
index 06b49d11d5..91f62728d1 100644
--- a/frontend/src/components/SQLReview/components/SQLRuleFilter.vue
+++ b/frontend/src/components/SQLReview/components/SQLRuleFilter.vue
@@ -12,15 +12,16 @@
class="flex flex-col lg:flex-row items-start justify-between gap-y-3 lg:items-center border-t border-control-border pt-4"
>
<SQLReviewCategoryTabFilter
- :selected="params.selectedCategory"
+ :value="params.selectedCategory"
:category-list="categoryFilterList"
- @select="$emit('change-category', $event)"
+ @update:value="$emit('change-category', $event)"
/>
- <BBTableSearch
+ <SearchBox
ref="searchField"
+ :value="params.searchText"
class="w-full lg:w-auto"
:placeholder="$t('common.filter-by-name')"
- @change-text="$emit('change-search-text', $event)"
+ @update:value="$emit('change-search-text', $event)"
/>
</div>
</div>
diff --git a/frontend/src/components/SyncDatabaseSchema/DatabaseSchemaSelector.vue b/frontend/src/components/SyncDatabaseSchema/DatabaseSchemaSelector.vue
index c086c85b18..b1500ad7b8 100644
--- a/frontend/src/components/SyncDatabaseSchema/DatabaseSchemaSelector.vue
+++ b/frontend/src/components/SyncDatabaseSchema/DatabaseSchemaSelector.vue
@@ -28,7 +28,7 @@
@update:environment="handleEnvironmentSelect"
/>
<DatabaseSelect
- class="!w-128"
+ class="!w-128 max-w-full"
:database="state.databaseId"
:environment="state.environmentId"
:project="state.projectId"
diff --git a/frontend/src/components/v2/Model/DatabaseV1Table/ProjectCol.vue b/frontend/src/components/v2/Model/DatabaseV1Table/ProjectCol.vue
index 27147f81a6..211e647e2e 100644
--- a/frontend/src/components/v2/Model/DatabaseV1Table/ProjectCol.vue
+++ b/frontend/src/components/v2/Model/DatabaseV1Table/ProjectCol.vue
@@ -40,7 +40,7 @@
<heroicons-outline:archive class="ml-1 w-4 h-4 text-control" />
</template>
<span class="whitespace-nowrap">
- {{ $t("archive.archived") }}
+ {{ $t("common.archived") }}
</span>
</NTooltip>
</div>
diff --git a/frontend/src/layouts/BodyLayout.vue b/frontend/src/layouts/BodyLayout.vue
index dda86ac1c1..65a3054fb3 100644
--- a/frontend/src/layouts/BodyLayout.vue
+++ b/frontend/src/layouts/BodyLayout.vue
@@ -218,7 +218,7 @@
</div>
</HideInStandaloneMode>
<!-- This area may scroll -->
- <div id="bb-layout-main" class="md:min-w-0 md:flex-1 overflow-y-auto">
+ <div id="bb-layout-main" class="md:min-w-0 flex-1 overflow-y-auto">
<!-- Start main area-->
<router-view name="content" />
<!-- End main area -->
diff --git a/frontend/src/locales/en-US.json b/frontend/src/locales/en-US.json
index 341ca955e3..1009952b9e 100644
--- a/frontend/src/locales/en-US.json
+++ b/frontend/src/locales/en-US.json
@@ -2031,13 +2031,6 @@
}
}
},
- "archive": {
- "archived": "Archived",
- "project-search-bar-placeholder": "Search @.lower:{'common.project'} name",
- "instance-search-bar-placeholder": "Search @.lower:{'common.instance'} name",
- "environment-search-bar-placeholder": "Search @.lower:{'common.environment'} name",
- "sso-search-bar-placeholder": "Search SSO name"
- },
"deployment-config": {
"stage-n": "Stage {n}",
"add-selector": "Add selector",
diff --git a/frontend/src/locales/es-ES.json b/frontend/src/locales/es-ES.json
index c7a4d997ad..e836234ec2 100644
--- a/frontend/src/locales/es-ES.json
+++ b/frontend/src/locales/es-ES.json
@@ -2027,13 +2027,6 @@
}
}
},
- "archive": {
- "archived": "Archivado",
- "project-search-bar-placeholder": "Buscar nombre de @.lower:{'common.project'}",
- "instance-search-bar-placeholder": "Buscar nombre de @.lower:{'common.instance'}",
- "environment-search-bar-placeholder": "Buscar nombre de @.lower:{'common.environment'}",
- "sso-search-bar-placeholder": "Buscar nombre de SSO"
- },
"deployment-config": {
"stage-n": "Etapa {n}",
"add-selector": "Agregar selector",
diff --git a/frontend/src/locales/zh-CN.json b/frontend/src/locales/zh-CN.json
index 236497442b..597fa4d2c8 100644
--- a/frontend/src/locales/zh-CN.json
+++ b/frontend/src/locales/zh-CN.json
@@ -2026,13 +2026,6 @@
}
}
},
- "archive": {
- "archived": "已归档",
- "project-search-bar-placeholder": "搜索@.lower:{'common.project'}的名称",
- "instance-search-bar-placeholder": "搜索@.lower:{'common.instance'}的名称",
- "environment-search-bar-placeholder": "搜索@.lower:{'common.environment'}的名称",
- "sso-search-bar-placeholder": "搜索 SSO 的名称"
- },
"deployment-config": {
"stage-n": "阶段 {n}",
"add-selector": "添加选择条件",
diff --git a/frontend/src/views/Archive.vue b/frontend/src/views/Archive.vue
index 5241ef26ec..5a374f0d60 100644
--- a/frontend/src/views/Archive.vue
+++ b/frontend/src/views/Archive.vue
@@ -1,38 +1,31 @@
<template>
<div class="flex flex-col space-y-4">
<div class="flex justify-between items-end">
- <BBTabFilter
- :tab-item-list="tabItemList"
- :selected-index="state.selectedIndex"
- @select-index="
- (index: number) => {
- state.selectedIndex = index;
- }
- "
- />
+ <TabFilter v-model:value="state.selectedTab" :items="tabItemList" />
+
<SearchBox
v-model:value="state.searchText"
- :placeholder="searchFieldPlaceholder"
+ :placeholder="$t('common.filter-by-name')"
/>
</div>
<div class="border-x">
<ProjectV1Table
- v-if="state.selectedIndex == PROJECT_TAB"
+ v-if="state.selectedTab == 'PROJECT'"
:project-list="filteredProjectList"
class="border-x-0"
/>
<InstanceV1Table
- v-else-if="state.selectedIndex == INSTANCE_TAB"
+ v-else-if="state.selectedTab == 'INSTANCE'"
:allow-selection="false"
:can-assign-license="false"
:instance-list="filteredInstanceList"
/>
<EnvironmentV1Table
- v-else-if="state.selectedIndex == ENVIRONMENT_TAB"
+ v-else-if="state.selectedTab == 'ENVIRONMENT'"
:environment-list="filteredEnvironmentList"
/>
<IdentityProviderTable
- v-else-if="state.selectedIndex == SSO_TAB"
+ v-else-if="state.selectedTab == 'SSO'"
:identity-provider-list="filteredSSOList(deletedSSOList)"
/>
</div>
@@ -42,7 +35,6 @@
<script lang="ts" setup>
import { computed, reactive, watchEffect } from "vue";
import { useI18n } from "vue-i18n";
-import { BBTabFilterItem } from "@/bbkit/types";
import IdentityProviderTable from "@/components/IdentityProviderTable.vue";
import {
EnvironmentV1Table,
@@ -63,13 +55,8 @@ import {
hasWorkspacePermissionV1,
} from "@/utils";
-const PROJECT_TAB = 0;
-const INSTANCE_TAB = 1;
-const ENVIRONMENT_TAB = 2;
-const SSO_TAB = 3;
-
interface LocalState {
- selectedIndex: number;
+ selectedTab: "PROJECT" | "INSTANCE" | "ENVIRONMENT" | "SSO";
searchText: string;
}
@@ -77,26 +64,12 @@ const { t } = useI18n();
const instanceStore = useInstanceV1Store();
const state = reactive<LocalState>({
- selectedIndex: PROJECT_TAB,
+ selectedTab: "PROJECT",
searchText: "",
});
const currentUserV1 = useCurrentUserV1();
-const searchFieldPlaceholder = computed(() => {
- if (state.selectedIndex == PROJECT_TAB) {
- return t("archive.project-search-bar-placeholder");
- } else if (state.selectedIndex == INSTANCE_TAB) {
- return t("archive.instance-search-bar-placeholder");
- } else if (state.selectedIndex == ENVIRONMENT_TAB) {
- return t("archive.environment-search-bar-placeholder");
- } else if (state.selectedIndex == SSO_TAB) {
- return t("archive.sso-search-bar-placeholder");
- } else {
- return "";
- }
-});
-
const { projectList } = useProjectV1ListByCurrentUser(true /* showDeleted */);
const prepareList = () => {
@@ -130,10 +103,8 @@ const deletedSSOList = computed(() => {
return useIdentityProviderStore().deletedIdentityProviderList;
});
-const tabItemList = computed((): BBTabFilterItem[] => {
- const list: BBTabFilterItem[] = [
- { title: t("common.project"), alert: false },
- ];
+const tabItemList = computed(() => {
+ const list = [{ value: "PROJECT", label: t("common.project") }];
if (
hasWorkspacePermissionV1(
@@ -141,7 +112,7 @@ const tabItemList = computed((): BBTabFilterItem[] => {
currentUserV1.value.userRole
)
) {
- list.push({ title: t("common.instance"), alert: false });
+ list.push({ value: "INSTANCE", label: t("common.instance") });
}
if (
@@ -150,7 +121,7 @@ const tabItemList = computed((): BBTabFilterItem[] => {
currentUserV1.value.userRole
)
) {
- list.push({ title: t("common.environment"), alert: false });
+ list.push({ value: "ENVIRONMENT", label: t("common.environment") });
}
if (
@@ -159,7 +130,7 @@ const tabItemList = computed((): BBTabFilterItem[] => {
currentUserV1.value.userRole
)
) {
- list.push({ title: t("settings.sidebar.sso"), alert: false });
+ list.push({ value: "SSO", label: t("settings.sidebar.sso") });
}
return list;
diff --git a/frontend/src/views/DatabaseDashboard.vue b/frontend/src/views/DatabaseDashboard.vue
index 957bfcb7d6..3781696432 100644
--- a/frontend/src/views/DatabaseDashboard.vue
+++ b/frontend/src/views/DatabaseDashboard.vue
@@ -46,10 +46,9 @@
"
/>
<SearchBox
- :value="state.searchText"
+ v-model:value="state.searchText"
:placeholder="$t('database.filter-database')"
:autofocus="true"
- @update:value="changeSearchText($event)"
/>
</NInputGroup>
</div>
@@ -269,10 +268,6 @@ const changeEnvironment = (environment: string | undefined) => {
}
};
-const changeSearchText = (searchText: string) => {
- state.searchText = searchText;
-};
-
const filteredDatabaseList = computed(() => {
let list = databaseV1List.value.filter((database) =>
isDatabaseV1Accessible(database, currentUserV1.value)
diff --git a/frontend/src/views/ProjectDashboard.vue b/frontend/src/views/ProjectDashboard.vue
index 10e89b4983..ec4cc26d77 100644
--- a/frontend/src/views/ProjectDashboard.vue
+++ b/frontend/src/views/ProjectDashboard.vue
@@ -2,11 +2,10 @@
<div class="flex flex-col space-y-4">
<div class="px-4 flex justify-end items-center">
<SearchBox
- :value="state.searchText"
+ v-model:value="state.searchText"
:placeholder="$t('common.filter-by-name')"
:autofocus="true"
style="width: 12rem"
- @update:value="changeSearchText($event)"
/>
</div>
<ProjectV1Table :project-list="filteredProjectList" class="border-x-0" />
@@ -34,10 +33,6 @@ const state = reactive<LocalState>({
const currentUserV1 = useCurrentUserV1();
const { projectList } = useProjectV1ListByCurrentUser();
-const changeSearchText = (searchText: string) => {
- state.searchText = searchText;
-};
-
const filteredProjectList = computed(() => {
const list = projectList.value.filter(
(project) =>
diff --git a/frontend/src/views/SettingSidebar.vue b/frontend/src/views/SettingSidebar.vue
index 48bc89a93b..473e9b0d5f 100644
--- a/frontend/src/views/SettingSidebar.vue
+++ b/frontend/src/views/SettingSidebar.vue
@@ -28,10 +28,18 @@ const currentUserV1 = useCurrentUserV1();
const getItemClass = (path: string | undefined) => {
const list = [];
- if (route.name === "workspace.profile") {
- if (path === "/setting/member") {
- list.push("router-link-active", "bg-link-hover");
- }
+ switch (route.name) {
+ case "setting.workspace.sso.detail":
+ case "setting.workspace.sso.create":
+ if (path === "/setting/sso") {
+ list.push("router-link-active", "bg-link-hover");
+ }
+ break;
+ case "workspace.profile":
+ if (path === "/setting/member") {
+ list.push("router-link-active", "bg-link-hover");
+ }
+ break;
}
return list;
};
diff --git a/frontend/src/views/SettingWorkspaceProject.vue b/frontend/src/views/SettingWorkspaceProject.vue
index 586522aa0c..48dbb60c9e 100644
--- a/frontend/src/views/SettingWorkspaceProject.vue
+++ b/frontend/src/views/SettingWorkspaceProject.vue
@@ -9,10 +9,9 @@
</span>
</NCheckbox>
<SearchBox
- :value="state.searchText"
+ v-model:value="state.searchText"
:placeholder="$t('common.filter-by-name')"
:autofocus="true"
- @update:value="changeSearchText($event)"
/>
</div>
@@ -41,10 +40,6 @@ const state = reactive<LocalState>({
includesArchived: false,
});
-const changeSearchText = (searchText: string) => {
- state.searchText = searchText;
-};
-
const filteredProjectList = computed(() => {
let list = [...projectList.value];
list = filterProjectV1ListByKeyword(list, state.searchText);
diff --git a/frontend/src/views/SettingWorkspaceSQLReviewDetail.vue b/frontend/src/views/SettingWorkspaceSQLReviewDetail.vue
index f81e78f5c8..665b39f140 100644
--- a/frontend/src/views/SettingWorkspaceSQLReviewDetail.vue
+++ b/frontend/src/views/SettingWorkspaceSQLReviewDetail.vue
@@ -43,25 +43,18 @@
/>
</div>
<div v-if="hasPermission" class="flex space-x-2">
- <button
+ <NButton
v-if="reviewPolicy.enforce"
- type="button"
- class="btn-normal py-2 px-4"
@click.prevent="state.showDisableModal = true"
>
{{ $t("common.disable") }}
- </button>
- <button
- v-else
- type="button"
- class="btn-normal py-2 px-4"
- @click.prevent="state.showEnableModal = true"
- >
+ </NButton>
+ <NButton v-else @click.prevent="state.showEnableModal = true">
{{ $t("common.enable") }}
- </button>
- <button type="button" class="btn-primary" @click="onEdit">
+ </NButton>
+ <NButton type="primary" @click="onEdit">
{{ $t("sql-review.create.configure-rule.change-template") }}
- </button>
+ </NButton>
</div>
</div>
<BBAttention
@@ -98,12 +91,12 @@
v-if="state.rulesUpdated"
class="w-full mt-4 py-4 border-t border-block-border flex justify-between bg-white sticky bottom-0 z-10"
>
- <button type="button" class="btn-normal" @click.prevent="onCancelChanges">
+ <NButton @click.prevent="onCancelChanges">
<span> {{ $t("common.cancel") }}</span>
- </button>
- <button type="button" class="btn-primary" @click.prevent="onApplyChanges">
+ </NButton>
+ <NButton type="primary" @click.prevent="onApplyChanges">
{{ $t("common.confirm-and-update") }}
- </button>
+ </NButton>
</div>
</div>
<BBAlert
diff --git a/frontend/src/views/SettingWorkspaceSSODetail.vue b/frontend/src/views/SettingWorkspaceSSODetail.vue
index aa5e3012d3..00cee6e896 100644
--- a/frontend/src/views/SettingWorkspaceSSODetail.vue
+++ b/frontend/src/views/SettingWorkspaceSSODetail.vue
@@ -1,8 +1,8 @@
<template>
- <div class="w-full sticky top-0">
- <ArchiveBanner v-if="isDeleted" />
+ <div v-if="isDeleted" class="w-full sticky top-0 mb-4">
+ <ArchiveBanner />
</div>
- <div class="w-full mt-4 space-y-4">
+ <div class="w-full space-y-4">
<div class="w-full flex flex-row justify-between items-center">
<div class="textinfolabel mr-4">
{{ $t("settings.sso.description") }}