Skip to content

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

chore: use table for vcs list (#11361)

ecmadao145acb6aa075
diff --git a/frontend/src/components/IssueV1/components/IssueTableV1.vue b/frontend/src/components/IssueV1/components/IssueTableV1.vue
index 88c1448524..b734e067d5 100644
--- a/frontend/src/components/IssueV1/components/IssueTableV1.vue
+++ b/frontend/src/components/IssueV1/components/IssueTableV1.vue
@@ -11,7 +11,7 @@
:columns="columnList"
:data="issueList"
:striped="true"
- :bordered="true"
+ :bordered="bordered"
:loading="loading"
:row-key="(issue: ComposedIssue) => issue.uid"
:default-expand-all="true"
@@ -31,7 +31,7 @@
<div
v-if="isTableInViewport && selectedIssueList.length > 0"
class="sticky bottom-0 w-full bg-white flex items-center gap-x-2 px-4 py-2 border-b"
- :class="isGridXBordered && 'border-x'"
+ :class="bordered && 'border-x'"
>
<BatchIssueActionsV1 :issue-list="selectedIssueList" />
</div>
@@ -194,12 +194,14 @@ const props = withDefaults(
mode?: Mode;
highlightText?: string;
loading?: boolean;
+ bordered: boolean;
}>(),
{
title: "",
mode: "ALL",
highlightText: "",
loading: true,
+ bordered: false,
}
);
@@ -217,11 +219,6 @@ const { width: tableWidth } = useElementSize(tableRef);
const showExtendedColumns = computed(() => {
return tableWidth.value > 800;
});
-const isGridXBordered = computed(() => {
- const grid = tableRef.value?.querySelector(".bb-grid");
- if (!grid) return false;
- return parseInt(getComputedStyle(grid).borderLeftWidth, 10) > 0;
-});
const selectedIssueList = computed(() => {
return props.issueList.filter((issue) =>
diff --git a/frontend/src/components/Project/ProjectIssuesPanel.vue b/frontend/src/components/Project/ProjectIssuesPanel.vue
index bb1a178440..df6b62b82a 100644
--- a/frontend/src/components/Project/ProjectIssuesPanel.vue
+++ b/frontend/src/components/Project/ProjectIssuesPanel.vue
@@ -65,6 +65,7 @@
<template #table="{ issueList, loading }">
<IssueTableV1
mode="PROJECT"
+ :bordered="true"
:loading="loading"
:issue-list="issueList"
:highlight-text="state.params.query"
diff --git a/frontend/src/components/SensitiveData/components/ClassificationExampleModal.vue b/frontend/src/components/SensitiveData/components/ClassificationExampleModal.vue
index 8c7bca5378..ed926647be 100644
--- a/frontend/src/components/SensitiveData/components/ClassificationExampleModal.vue
+++ b/frontend/src/components/SensitiveData/components/ClassificationExampleModal.vue
@@ -25,13 +25,10 @@
<script lang="ts" setup>
import { useClipboard } from "@vueuse/core";
import hljs from "highlight.js/lib/core";
-import json from "highlight.js/lib/languages/json";
import { NCode, NConfigProvider } from "naive-ui";
import { useI18n } from "vue-i18n";
import { pushNotification } from "@/store";
-hljs.registerLanguage("json", json);
-
defineEmits<{
(event: "dismiss"): void;
}>();
diff --git a/frontend/src/components/SensitiveData/index.ts b/frontend/src/components/SensitiveData/index.ts
index ea29ef52db..eb77ad6fce 100644
--- a/frontend/src/components/SensitiveData/index.ts
+++ b/frontend/src/components/SensitiveData/index.ts
@@ -1,5 +1,11 @@
+import ClassificationView from "./ClassificationView.vue";
import GlobalMaskingRulesView from "./GlobalMaskingRulesView.vue";
import SemanticTypesView from "./SemanticTypesView.vue";
import SensitiveColumnView from "./SensitiveColumnView.vue";
-export { SensitiveColumnView, GlobalMaskingRulesView, SemanticTypesView };
+export {
+ SensitiveColumnView,
+ GlobalMaskingRulesView,
+ SemanticTypesView,
+ ClassificationView,
+};
diff --git a/frontend/src/components/VCS/VCSCard.vue b/frontend/src/components/VCS/VCSCard.vue
deleted file mode 100644
index df139bef72..0000000000
--- a/frontend/src/components/VCS/VCSCard.vue
+++ /dev/null
@@ -1,64 +0,0 @@
-<template>
- <div
- class="divide-y divide-block-border border border-block-border rounded-sm"
- >
- <div class="flex py-2 px-4 justify-between">
- <div class="flex flex-row space-x-2 items-center">
- <VCSIcon custom-class="h-6" :type="vcs.type" />
- <h3 class="text-lg leading-6 font-medium text-main">
- {{ vcs.title }}
- </h3>
- </div>
- <NButton :disabled="!hasUpdateVCSPermission" @click.prevent="editVCS">
- {{ $t("common.edit") }}
- </NButton>
- </div>
- <div class="border-t border-block-border">
- <dl class="divide-y divide-block-border">
- <div class="grid grid-cols-4 gap-4 px-4 py-2 items-center">
- <dt class="text-sm font-medium text-control-light">
- {{ $t("common.instance") }} URL
- </dt>
- <dd class="mt-1 flex text-sm text-main col-span-2">
- {{ vcs.url }}
- </dd>
- </div>
- </dl>
- </div>
- </div>
-</template>
-
-<script lang="ts" setup>
-import { NButton } from "naive-ui";
-import type { PropType } from "vue";
-import { computed } from "vue";
-import { useRouter } from "vue-router";
-import { WORKSPACE_ROUTE_GITOPS_DETAIL } from "@/router/dashboard/workspaceRoutes";
-import { useCurrentUserV1 } from "@/store";
-import { getVCSId } from "@/store/modules/v1/common";
-import type { VCSProvider } from "@/types/proto/v1/vcs_provider_service";
-import { hasWorkspacePermissionV2 } from "@/utils";
-
-const props = defineProps({
- vcs: {
- required: true,
- type: Object as PropType<VCSProvider>,
- },
-});
-
-const router = useRouter();
-const currentUser = useCurrentUserV1();
-
-const hasUpdateVCSPermission = computed(() => {
- return hasWorkspacePermissionV2(currentUser.value, "bb.vcsProviders.update");
-});
-
-const editVCS = () => {
- router.push({
- name: WORKSPACE_ROUTE_GITOPS_DETAIL,
- params: {
- vcsResourceId: getVCSId(props.vcs.name),
- },
- });
-};
-</script>
diff --git a/frontend/src/views/SettingWorkspaceSensitiveData.vue b/frontend/src/views/SettingWorkspaceSensitiveData.vue
index 6e41740214..34b71e71d4 100644
--- a/frontend/src/views/SettingWorkspaceSensitiveData.vue
+++ b/frontend/src/views/SettingWorkspaceSensitiveData.vue
@@ -47,6 +47,7 @@ import {
SensitiveColumnView,
GlobalMaskingRulesView,
SemanticTypesView,
+ ClassificationView,
} from "@/components/SensitiveData";
import { featureToRef } from "@/store";
diff --git a/frontend/src/views/SettingWorkspaceVCS.vue b/frontend/src/views/SettingWorkspaceVCS.vue
index 13bf5f35f8..f6517271ff 100644
--- a/frontend/src/views/SettingWorkspaceVCS.vue
+++ b/frontend/src/views/SettingWorkspaceVCS.vue
@@ -14,30 +14,39 @@
</NButton>
</div>
- <div v-if="vcsList.length > 0" class="space-y-6">
- <template v-for="(vcs, index) in vcsList" :key="index">
- <VCSCard :vcs="vcs" />
- </template>
- </div>
- <template v-else>
- <VCSSetupWizard :show-cancel="false" />
- </template>
+ <NDataTable
+ v-if="vcsList.length > 0"
+ :data="vcsList"
+ :columns="columnList"
+ :striped="true"
+ :bordered="true"
+ class="vcs-table-list"
+ />
+ <VCSSetupWizard v-else :show-cancel="false" />
</div>
</template>
<script lang="ts" setup>
-import { NButton } from "naive-ui";
-import { computed, watchEffect } from "vue";
+import { NButton, NDataTable } from "naive-ui";
+import type { DataTableColumn } from "naive-ui";
+import { computed, watchEffect, h } from "vue";
+import { useI18n } from "vue-i18n";
import { useRouter } from "vue-router";
-import VCSCard from "@/components/VCS/VCSCard.vue";
+import VCSIcon from "@/components/VCS/VCSIcon.vue";
import VCSSetupWizard from "@/components/VCS/VCSSetupWizard.vue";
-import { WORKSPACE_ROUTE_GITOPS_CREATE } from "@/router/dashboard/workspaceRoutes";
+import {
+ WORKSPACE_ROUTE_GITOPS_CREATE,
+ WORKSPACE_ROUTE_GITOPS_DETAIL,
+} from "@/router/dashboard/workspaceRoutes";
import { useCurrentUserV1, useVCSV1Store } from "@/store";
+import { getVCSId } from "@/store/modules/v1/common";
+import type { VCSProvider } from "@/types/proto/v1/vcs_provider_service";
import { hasWorkspacePermissionV2 } from "@/utils";
const currentUser = useCurrentUserV1();
const vcsV1Store = useVCSV1Store();
const router = useRouter();
+const { t } = useI18n();
const hasCreateVCSPermission = computed(() => {
return hasWorkspacePermissionV2(currentUser.value, "bb.vcsProviders.create");
@@ -58,4 +67,54 @@ const addVCSProvider = () => {
name: WORKSPACE_ROUTE_GITOPS_CREATE,
});
};
+
+const columnList = computed((): DataTableColumn<VCSProvider>[] => {
+ return [
+ {
+ key: "title",
+ title: t("common.name"),
+ render: (vcs) =>
+ h("div", { class: "flex items-center gap-x-2" }, [
+ h(VCSIcon, { type: vcs.type, customClass: "h-6" }),
+ vcs.title,
+ ]),
+ },
+ {
+ key: "instance_url",
+ title: `${t("common.instance")} URL`,
+ render: (vcs) => vcs.url,
+ },
+ {
+ key: "view",
+ title: "",
+ render: (vcs) =>
+ h(
+ "div",
+ { class: "flex justify-end" },
+ h(
+ NButton,
+ {
+ size: "small",
+ onClick: () => {
+ router.push({
+ name: WORKSPACE_ROUTE_GITOPS_DETAIL,
+ params: {
+ vcsResourceId: getVCSId(vcs.name),
+ },
+ });
+ },
+ },
+ t("common.view")
+ )
+ ),
+ },
+ ];
+});
</script>
+
+<style lang="postcss" scoped>
+.vcs-table-list :deep(.n-data-table-td),
+.vcs-table-list :deep(.n-data-table-th) {
+ @apply !py-1.5;
+}
+</style>
diff --git a/frontend/src/views/SettingWorkspaceVCSDetail.vue b/frontend/src/views/SettingWorkspaceVCSDetail.vue
index 98805a18b0..932ae5909c 100644
--- a/frontend/src/views/SettingWorkspaceVCSDetail.vue
+++ b/frontend/src/views/SettingWorkspaceVCSDetail.vue
@@ -216,6 +216,7 @@ const doUpdate = () => {
if (!updatedVCS) {
return;
}
+ resetState();
pushNotification({
module: "bytebase",
style: "SUCCESS",