Skip to content

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

fix: default algorithm (#9467)

ecmadao130cb8e62a50
diff --git a/frontend/src/components/SensitiveData/MaskingAlgorithmsView.vue b/frontend/src/components/SensitiveData/MaskingAlgorithmsView.vue
index 61467d8d13..b8fe583299 100644
--- a/frontend/src/components/SensitiveData/MaskingAlgorithmsView.vue
+++ b/frontend/src/components/SensitiveData/MaskingAlgorithmsView.vue
@@ -4,7 +4,7 @@
<NButton
type="primary"
:disabled="!hasPermission || !hasSensitiveDataFeature"
- @click="state.showCreateDrawer = true"
+ @click="onCreate"
>
{{ $t("settings.sensitive-data.algorithms.add") }}
</NButton>
@@ -54,6 +54,13 @@ const hasPermission = computed(() => {
});
const hasSensitiveDataFeature = featureToRef("bb.feature.sensitive-data");
+const onCreate = () => {
+ state.pendingEditData = MaskingAlgorithmSetting_Algorithm.fromPartial({
+ id: uuidv4(),
+ });
+ state.showCreateDrawer = true;
+};
+
const onDrawerDismiss = () => {
state.showCreateDrawer = false;
};
diff --git a/frontend/src/components/SensitiveData/components/MaskingAlgorithmsCreateDrawer.vue b/frontend/src/components/SensitiveData/components/MaskingAlgorithmsCreateDrawer.vue
index eba43b00b2..c404b2afc3 100644
--- a/frontend/src/components/SensitiveData/components/MaskingAlgorithmsCreateDrawer.vue
+++ b/frontend/src/components/SensitiveData/components/MaskingAlgorithmsCreateDrawer.vue
@@ -451,7 +451,7 @@ const onUpsert = async () => {
state.processing = true;
const index = algorithmList.value.findIndex(
- (item) => item.id === props.algorithm.id
+ (item) => item.id === maskingAlgorithm.value.id
);
const newList = [...algorithmList.value];
if (index < 0) {
diff --git a/frontend/src/components/SensitiveData/components/MaskingAlgorithmsTable.vue b/frontend/src/components/SensitiveData/components/MaskingAlgorithmsTable.vue
index c4911c1be5..2674d86804 100644
--- a/frontend/src/components/SensitiveData/components/MaskingAlgorithmsTable.vue
+++ b/frontend/src/components/SensitiveData/components/MaskingAlgorithmsTable.vue
@@ -21,13 +21,7 @@
/>
</template>
<template
- #body="{
- rowData,
- row,
- }: {
- rowData: MaskingAlgorithmSetting_Algorithm,
- row: number,
- }"
+ #body="{ rowData }: { rowData: MaskingAlgorithmSetting_Algorithm }"
>
<BBTableCell class="bb-grid-cell">
<h3>
@@ -53,7 +47,7 @@
<heroicons-outline:pencil class="w-4 h-4" />
</button>
- <NPopconfirm v-if="!readonly" @positive-click="onRemove(row)">
+ <NPopconfirm v-if="!readonly" @positive-click="onRemove(rowData.id)">
<template #trigger>
<button
class="p-1 hover:bg-gray-300 rounded cursor-pointer disabled:cursor-not-allowed disabled:hover:bg-white disabled:text-gray-400"
@@ -121,18 +115,21 @@ const tableHeaderList = computed(() => {
return list;
});
-const algorithmList = computed((): MaskingAlgorithmSetting_Algorithm[] => {
- const list =
+const rawAlgorithmList = computed((): MaskingAlgorithmSetting_Algorithm[] => {
+ return (
settingStore.getSettingByName("bb.workspace.masking-algorithm")?.value
- ?.maskingAlgorithmSettingValue?.algorithms ?? [];
+ ?.maskingAlgorithmSettingValue?.algorithms ?? []
+ );
+});
+const algorithmList = computed((): MaskingAlgorithmSetting_Algorithm[] => {
return [
MaskingAlgorithmSetting_Algorithm.fromPartial({
title: t("settings.sensitive-data.algorithms.default"),
description: t("settings.sensitive-data.algorithms.default-desc"),
category: "MASK",
}),
- ...list,
+ ...rawAlgorithmList.value,
];
});
@@ -149,14 +146,14 @@ const getAlgorithmMaskingType = (
);
};
-const onRemove = async (index: number) => {
- const item = algorithmList.value[index];
- if (!item) {
+const onRemove = async (id: string) => {
+ const index = rawAlgorithmList.value.findIndex((item) => item.id === id);
+ if (index < 0) {
return;
}
const newList = [
- ...algorithmList.value.slice(0, index),
- ...algorithmList.value.slice(index + 1),
+ ...rawAlgorithmList.value.slice(0, index),
+ ...rawAlgorithmList.value.slice(index + 1),
];
await settingStore.upsertSetting({