Skip to content

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

Convert AnomalyTable to use section table

天舟c70dc6b09e3e
diff --git a/frontend/src/components/AnomalyTable.vue b/frontend/src/components/AnomalyTable.vue
index 89f5c7886d..1d24feb637 100644
--- a/frontend/src/components/AnomalyTable.vue
+++ b/frontend/src/components/AnomalyTable.vue
@@ -1,13 +1,25 @@
<template>
<BBTable
:columnList="COLUMN_LIST"
- :dataSource="anomalyList"
+ :sectionDataSource="anomalySectionList"
+ :compactSection="true"
:showHeader="true"
:leftBordered="true"
:rightBordered="true"
>
+ <template v-slot:header>
+ <BBTableHeaderCell
+ :leftPadding="4"
+ class="w-4"
+ :title="COLUMN_LIST[0].title"
+ />
+ <BBTableHeaderCell :title="COLUMN_LIST[1].title" />
+ <BBTableHeaderCell :title="COLUMN_LIST[2].title" />
+ <BBTableHeaderCell :title="COLUMN_LIST[3].title" />
+ <BBTableHeaderCell :title="COLUMN_LIST[4].title" />
+ </template>
<template v-slot:body="{ rowData: anomaly }">
- <BBTableCell :leftPadding="4" class="w-4">
+ <BBTableCell :leftPadding="4">
<svg
v-if="severity(anomaly) == 'MEDIUM'"
class="w-6 h-6 text-info"
@@ -54,19 +66,19 @@
></path>
</svg>
</BBTableCell>
- <BBTableCell class="">
+ <BBTableCell>
{{ typeName(anomaly.type) }}
</BBTableCell>
- <BBTableCell class="">
+ <BBTableCell>
{{ detail(anomaly) }}
<span class="normal-link" @click.prevent="action(anomaly).onClick">
{{ action(anomaly).title }}
</span>
</BBTableCell>
- <BBTableCell class="">
+ <BBTableCell>
{{ humanizeTs(anomaly.updatedTs) }}
</BBTableCell>
- <BBTableCell class="">
+ <BBTableCell>
{{ humanizeTs(anomaly.createdTs) }}
</BBTableCell>
</template>
@@ -94,9 +106,9 @@
</template>
<script lang="ts">
-import { PropType, reactive } from "vue";
+import { computed, PropType, reactive } from "vue";
import { CodeDiff } from "v-code-diff";
-import { BBTableColumn } from "../bbkit/types";
+import { BBTableColumn, BBTableSectionDataSource } from "../bbkit/types";
import {
Anomaly,
AnomalyDatabaseBackupMissingPayload,
@@ -145,12 +157,12 @@ export default {
components: { CodeDiff },
props: {
mode: {
- default: "NORMAL",
+ required: true,
type: String as PropType<"INSTANCE" | "DATABASE">,
},
- anomalyList: {
+ anomalySectionList: {
required: true,
- type: Object as PropType<Anomaly[]>,
+ type: Object as PropType<BBTableSectionDataSource<Anomaly>[]>,
},
},
setup(props, ctx) {
diff --git a/frontend/src/components/DatabaseOverviewPanel.vue b/frontend/src/components/DatabaseOverviewPanel.vue
index 3df467d8c1..0978e7bbe5 100644
--- a/frontend/src/components/DatabaseOverviewPanel.vue
+++ b/frontend/src/components/DatabaseOverviewPanel.vue
@@ -1,10 +1,13 @@
<template>
<div class="space-y-6 divide-y divide-block-border">
- <div v-if="database.anomalyList.length > 0">
+ <div v-if="anomalySectionList.length > 0">
<div class="text-lg leading-6 font-medium text-main mb-4 flex flex-row">
Anomalies
</div>
- <AnomalyTable :mode="'DATABASE'" :anomalyList="database.anomalyList" />
+ <AnomalyTable
+ :mode="'DATABASE'"
+ :anomalySectionList="anomalySectionList"
+ />
</div>
<div
v-else
@@ -202,8 +205,9 @@ import DataSourceTable from "../components/DataSourceTable.vue";
import DataSourceConnectionPanel from "../components/DataSourceConnectionPanel.vue";
import TableTable from "../components/TableTable.vue";
import { timezoneString, instanceSlug, isDBAOrOwner } from "../utils";
-import { Database, DataSource, DataSourcePatch } from "../types";
+import { Anomaly, Database, DataSource, DataSourcePatch } from "../types";
import { cloneDeep, isEqual } from "lodash";
+import { BBTableSectionDataSource } from "../bbkit/types";
interface LocalState {
editingDataSource?: DataSource;
@@ -237,6 +241,17 @@ export default {
watchEffect(prepareTableList);
+ const anomalySectionList = computed(
+ (): BBTableSectionDataSource<Anomaly>[] => {
+ const list: BBTableSectionDataSource<Anomaly>[] = [];
+ list.push({
+ title: props.database.name,
+ list: props.database.anomalyList,
+ });
+ return list;
+ }
+ );
+
const hasDataSourceFeature = computed(() =>
store.getters["plan/feature"]("bb.data-source")
);
@@ -333,6 +348,7 @@ export default {
return {
timezoneString,
state,
+ anomalySectionList,
tableList,
hasDataSourceFeature,
allowConfigInstance,
diff --git a/frontend/src/views/InstanceDetail.vue b/frontend/src/views/InstanceDetail.vue
index 2b158f8e05..fb4730e797 100644
--- a/frontend/src/views/InstanceDetail.vue
+++ b/frontend/src/views/InstanceDetail.vue
@@ -11,13 +11,16 @@
/>
<div class="px-6 space-y-6">
<div
- v-if="instance.anomalyList.length > 0"
+ v-if="anomalySectionList.length > 0"
class="border-b divide-block-border pb-6"
>
<div class="text-lg leading-6 font-medium text-main mb-4 flex flex-row">
Anomalies
</div>
- <AnomalyTable :mode="'INSTANCE'" :anomalyList="instance.anomalyList" />
+ <AnomalyTable
+ :mode="'INSTANCE'"
+ :anomalySectionList="anomalySectionList"
+ />
</div>
<InstanceForm :create="false" :instance="instance" />
<div
@@ -111,13 +114,14 @@ import DataSourceTable from "../components/DataSourceTable.vue";
import InstanceUserTable from "../components/InstanceUserTable.vue";
import InstanceForm from "../components/InstanceForm.vue";
import {
+ Anomaly,
Database,
Instance,
InstanceMigration,
MigrationSchemaStatus,
SqlResultSet,
} from "../types";
-import { BBTabFilterItem } from "../bbkit/types";
+import { BBTabFilterItem, BBTableSectionDataSource } from "../bbkit/types";
const DATABASE_TAB = 0;
const USER_TAB = 1;
@@ -176,6 +180,17 @@ export default {
};
watchEffect(prepareMigrationSchemaStatus);
+ const anomalySectionList = computed(
+ (): BBTableSectionDataSource<Anomaly>[] => {
+ const list: BBTableSectionDataSource<Anomaly>[] = [];
+ list.push({
+ title: instance.value.name,
+ list: instance.value.anomalyList,
+ });
+ return list;
+ }
+ );
+
const attentionTitle = computed((): string => {
if (state.migrationSetupStatus == "NOT_EXIST") {
return "Missing migration schema";
@@ -341,6 +356,7 @@ export default {
DATABASE_TAB,
USER_TAB,
state,
+ anomalySectionList,
attentionTitle,
attentionText,
attentionActionText,