Skip to content

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

chore: optimize review ux (#12763)

ecmadao41a2d6659342
diff --git a/frontend/src/components/DatabaseDetail/Settings/DatabaseSettingsPanel.vue b/frontend/src/components/DatabaseDetail/Settings/DatabaseSettingsPanel.vue
index 2f6d629028..4757d5e692 100644
--- a/frontend/src/components/DatabaseDetail/Settings/DatabaseSettingsPanel.vue
+++ b/frontend/src/components/DatabaseDetail/Settings/DatabaseSettingsPanel.vue
@@ -9,7 +9,12 @@
class="mt-1 max-w-md"
:environment="environment?.uid"
:disabled="!allowUpdateDatabase"
- :default-environment-name="database.instanceResource.environment"
+ :render-suffix="
+ (env: string) =>
+ database.instanceResource.environment === env
+ ? `(${$t('common.default')})`
+ : ''
+ "
@update:environment="handleSelectEnvironmentUID"
/>
</div>
diff --git a/frontend/src/components/SQLReview/components/SQLReviewAttachResourcesPanel.vue b/frontend/src/components/SQLReview/components/SQLReviewAttachResourcesPanel.vue
index 97ed4336c8..43919fe310 100644
--- a/frontend/src/components/SQLReview/components/SQLReviewAttachResourcesPanel.vue
+++ b/frontend/src/components/SQLReview/components/SQLReviewAttachResourcesPanel.vue
@@ -22,6 +22,7 @@
:environments="environments"
:use-resource-id="true"
:multiple="true"
+ :render-suffix="getResourceAttachedConfigName"
@update:environments="onResourcesChange($event, projects)"
/>
</div>
@@ -43,6 +44,7 @@
:projects="projects"
:use-resource-id="true"
:multiple="true"
+ :render-suffix="getResourceAttachedConfigName"
@update:projects="onResourcesChange($event, environments)"
/>
</div>
@@ -110,6 +112,7 @@ const environments = computed(() =>
resource.startsWith(environmentNamePrefix)
)
);
+
const projects = computed(() =>
resources.value.filter((resource) => resource.startsWith(projectNamePrefix))
);
@@ -134,4 +137,9 @@ const upsertReviewResource = async () => {
});
emit("close");
};
+
+const getResourceAttachedConfigName = (resource: string) => {
+ const config = sqlReviewStore.getReviewPolicyByResouce(resource)?.name;
+ return config ? `(${config})` : "";
+};
</script>
diff --git a/frontend/src/components/SQLReview/components/SQLReviewRulesSelectPanel.vue b/frontend/src/components/SQLReview/components/SQLReviewRulesSelectPanel.vue
index 4e5a0d2a57..f3c44a75b0 100644
--- a/frontend/src/components/SQLReview/components/SQLReviewRulesSelectPanel.vue
+++ b/frontend/src/components/SQLReview/components/SQLReviewRulesSelectPanel.vue
@@ -21,6 +21,7 @@
:editable="false"
:hide-level="true"
:select-rule="true"
+ :size="'small'"
:selected-rule-keys="selectedRuleKeys"
@update:selected-rule-keys="onSelectedRuleKeysUpdate"
/>
@@ -30,7 +31,7 @@
<template #footer>
<div class="flex items-center justify-end gap-x-3">
<NButton @click="$emit('close')">
- {{ $t("common.cancel") }}
+ {{ $t("common.close") }}
</NButton>
</div>
</template>
diff --git a/frontend/src/components/SQLReview/components/SQLRuleTable.vue b/frontend/src/components/SQLReview/components/SQLRuleTable.vue
index bee0b2562e..020f46a465 100644
--- a/frontend/src/components/SQLReview/components/SQLRuleTable.vue
+++ b/frontend/src/components/SQLReview/components/SQLRuleTable.vue
@@ -11,6 +11,7 @@
</div>
<div class="hidden lg:block">
<NDataTable
+ :size="size"
:striped="true"
:columns="columns"
:data="category.ruleList"
@@ -146,6 +147,7 @@ const props = withDefaults(
selectRule?: boolean;
hideLevel?: boolean;
selectedRuleKeys?: string[];
+ size?: "small" | "medium";
}>(),
{
ruleList: () => [],
@@ -153,6 +155,7 @@ const props = withDefaults(
selectRule: false,
hideLevel: false,
selectedRuleKeys: () => [],
+ size: "medium",
}
);
@@ -194,6 +197,13 @@ const columns = computed(() => {
rule.comment || getRuleLocalization(rule.type).description;
return <p class="w-full text-left pl-10 text-gray-500">{comment}</p>;
},
+ cellProps: (rule: RuleTemplateV2) => {
+ return {
+ onClick: (e: MouseEvent) => {
+ e.stopPropagation();
+ },
+ };
+ },
},
{
title: t("sql-review.rule.active"),
diff --git a/frontend/src/components/SQLReview/components/SQLRuleTableWithFilter.vue b/frontend/src/components/SQLReview/components/SQLRuleTableWithFilter.vue
index 9b0bbd53ef..8d8f558a7c 100644
--- a/frontend/src/components/SQLReview/components/SQLRuleTableWithFilter.vue
+++ b/frontend/src/components/SQLReview/components/SQLRuleTableWithFilter.vue
@@ -19,6 +19,7 @@
:hide-level="hideLevel"
:select-rule="selectRule"
:selected-rule-keys="selectedRuleKeys"
+ :size="size"
@rule-upsert="onRuleChange"
@update:selected-rule-keys="$emit('update:selectedRuleKeys', $event)"
/>
@@ -46,11 +47,13 @@ const props = withDefaults(
hideLevel?: boolean;
selectRule?: boolean;
selectedRuleKeys?: string[];
+ size?: "small" | "medium";
}>(),
{
selectRule: false,
hideLevel: false,
selectedRuleKeys: () => [],
+ size: "medium",
}
);
diff --git a/frontend/src/components/v2/Model/DatabaseV1Table/cells/ProjectNameCell.vue b/frontend/src/components/v2/Model/DatabaseV1Table/cells/ProjectNameCell.vue
index 606eb9abd4..68fa1f651a 100644
--- a/frontend/src/components/v2/Model/DatabaseV1Table/cells/ProjectNameCell.vue
+++ b/frontend/src/components/v2/Model/DatabaseV1Table/cells/ProjectNameCell.vue
@@ -7,6 +7,10 @@
:keyword="keyword"
/>
+ <span v-if="suffix">
+ {{ suffix }}
+ </span>
+
<NTooltip v-if="project.workflow === Workflow.VCS">
<template #trigger>
<GitIcon class="w-4 h-4 text-control" />
@@ -44,11 +48,13 @@ withDefaults(
mode?: Mode;
link?: boolean;
keyword?: string;
+ suffix?: string;
}>(),
{
mode: "ALL",
link: false,
keyword: undefined,
+ suffix: "",
}
);
</script>
diff --git a/frontend/src/components/v2/Select/EnvironmentSelect.vue b/frontend/src/components/v2/Select/EnvironmentSelect.vue
index 25aabfb0c1..0f4eb8e304 100644
--- a/frontend/src/components/v2/Select/EnvironmentSelect.vue
+++ b/frontend/src/components/v2/Select/EnvironmentSelect.vue
@@ -13,11 +13,10 @@
/>
</template>
-<script lang="ts" setup>
+<script lang="tsx" setup>
import type { SelectOption } from "naive-ui";
import { NSelect } from "naive-ui";
import { computed, h, watchEffect } from "vue";
-import { useI18n } from "vue-i18n";
import { useEnvironmentV1Store, useProjectV1Store } from "@/store";
import { State } from "@/types/proto/v1/common";
import type { Environment } from "@/types/proto/v1/environment_service";
@@ -38,6 +37,7 @@ const props = withDefaults(
useResourceId?: boolean;
multiple?: boolean;
filter?: (environment: Environment, index: number) => boolean;
+ renderSuffix?: (environment: string) => string;
}>(),
{
environment: undefined,
@@ -48,6 +48,7 @@ const props = withDefaults(
useResourceId: false,
multiple: false,
filter: () => true,
+ renderSuffix: (environment: string) => "",
}
);
@@ -56,7 +57,6 @@ const emit = defineEmits<{
(event: "update:environments", id: string[]): void;
}>();
-const { t } = useI18n();
const projectV1Store = useProjectV1Store();
const environmentV1Store = useEnvironmentV1Store();
@@ -131,10 +131,7 @@ const renderLabel = (option: SelectOption) => {
environment,
showIcon: props.showProductionIcon,
link: false,
- suffix:
- props.defaultEnvironmentName === environment.name
- ? `(${t("common.default")})`
- : "",
+ suffix: props.renderSuffix(environment.name),
});
};
diff --git a/frontend/src/components/v2/Select/ProjectSelect.vue b/frontend/src/components/v2/Select/ProjectSelect.vue
index bee70c1214..585e1b7152 100644
--- a/frontend/src/components/v2/Select/ProjectSelect.vue
+++ b/frontend/src/components/v2/Select/ProjectSelect.vue
@@ -57,6 +57,7 @@ const props = withDefaults(
includeArchived?: boolean;
useResourceId?: boolean;
multiple?: boolean;
+ renderSuffix?: (project: string) => string;
filter?: (project: ComposedProject, index: number) => boolean;
}>(),
{
@@ -71,6 +72,7 @@ const props = withDefaults(
useResourceId: false,
multiple: false,
filter: () => true,
+ renderSuffix: (project: string) => "",
}
);
@@ -229,6 +231,12 @@ watchEffect(prepare);
const renderLabel = (option: SelectOption) => {
const { project } = option as ProjectSelectOption;
- return <ProjectNameCell project={project} mode="ALL_SHORT" />;
+ return (
+ <ProjectNameCell
+ project={project}
+ mode="ALL_SHORT"
+ suffix={props.renderSuffix(project.name)}
+ />
+ );
};
</script>