Skip to content

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

feat(frontend): add title column to approval rules table (#18214)

p0nyfba6d8e256a4
diff --git a/frontend/src/components/CustomApproval/Settings/components/CustomApproval/RulesPanel/RuleEditModal.vue b/frontend/src/components/CustomApproval/Settings/components/CustomApproval/RulesPanel/RuleEditModal.vue
index 9931bf894b..53b752e198 100644
--- a/frontend/src/components/CustomApproval/Settings/components/CustomApproval/RulesPanel/RuleEditModal.vue
+++ b/frontend/src/components/CustomApproval/Settings/components/CustomApproval/RulesPanel/RuleEditModal.vue
@@ -19,6 +19,17 @@
</div>
<div class="flex-1 flex flex-col px-6 py-4 overflow-hidden gap-y-4">
+ <div class="flex flex-col gap-y-2">
+ <h3 class="font-medium text-sm text-control">
+ {{ $t("common.title") }}
+ </h3>
+ <NInput
+ v-model:value="state.title"
+ :placeholder="$t('common.title')"
+ :disabled="!allowAdmin"
+ />
+ </div>
+
<div class="flex-1 flex flex-col gap-y-2 overflow-y-auto">
<h3 class="font-medium text-sm text-control">
{{ $t("cel.condition.self") }}
@@ -72,7 +83,7 @@
<script lang="ts" setup>
import { create as createProto } from "@bufbuild/protobuf";
import { cloneDeep, head } from "lodash-es";
-import { NButton, NModal } from "naive-ui";
+import { NButton, NInput, NModal } from "naive-ui";
import { computed, reactive, watch } from "vue";
import ExprEditor from "@/components/ExprEditor";
import type { ConditionGroupExpr } from "@/plugins/cel";
@@ -99,6 +110,7 @@ import { StepsTable } from "../common";
import { useCustomApprovalContext } from "../context";
type LocalState = {
+ title: string;
conditionExpr: ConditionGroupExpr;
flow: ApprovalFlow;
};
@@ -119,6 +131,7 @@ const context = useCustomApprovalContext();
const { allowAdmin } = context;
const state = reactive<LocalState>({
+ title: "",
conditionExpr: wrapAsGroup(emptySimpleExpr()),
flow: createProto(ApprovalFlowSchema, { roles: [] }),
});
@@ -139,10 +152,12 @@ const resolveLocalState = async () => {
// Reset to empty state immediately to unmount old Condition components.
// This prevents component reuse issues when switching between rules,
// where the ValueInput watch would reset values when factor/operator changes.
+ state.title = "";
state.conditionExpr = wrapAsGroup(emptySimpleExpr());
state.flow = createProto(ApprovalFlowSchema, { roles: [] });
if (props.rule) {
+ state.title = props.rule.title || "";
if (props.rule.condition) {
const parsedExprs = await batchConvertCELStringToParsedExpr([
props.rule.condition,
@@ -175,6 +190,7 @@ const handleSave = async () => {
const condition = expressions[0];
const ruleData: Partial<LocalApprovalRule> = {
+ title: state.title,
condition,
conditionExpr: cloneDeep(state.conditionExpr),
flow: cloneDeep(state.flow),
diff --git a/frontend/src/components/CustomApproval/Settings/components/CustomApproval/RulesPanel/RulesSection.vue b/frontend/src/components/CustomApproval/Settings/components/CustomApproval/RulesPanel/RulesSection.vue
index f4c026247f..6929c8e252 100644
--- a/frontend/src/components/CustomApproval/Settings/components/CustomApproval/RulesPanel/RulesSection.vue
+++ b/frontend/src/components/CustomApproval/Settings/components/CustomApproval/RulesPanel/RulesSection.vue
@@ -75,6 +75,13 @@ const rules = computed(() => store.getRulesBySource(props.source));
const sourceDisplayText = computed(() => approvalSourceText(props.source));
const columns = computed((): DataTableColumn<LocalApprovalRule>[] => [
+ {
+ title: t("common.title"),
+ key: "title",
+ width: 150,
+ ellipsis: { tooltip: true },
+ render: (row) => row.title || "-",
+ },
{
title: t("cel.condition.self"),
key: "condition",
diff --git a/frontend/src/components/CustomApproval/Settings/components/CustomApproval/logic/utils.ts b/frontend/src/components/CustomApproval/Settings/components/CustomApproval/logic/utils.ts
index e96807d8ca..c79d772991 100644
--- a/frontend/src/components/CustomApproval/Settings/components/CustomApproval/logic/utils.ts
+++ b/frontend/src/components/CustomApproval/Settings/components/CustomApproval/logic/utils.ts
@@ -8,6 +8,7 @@ export const emptyLocalApprovalRule = (): LocalApprovalRule => {
return {
uid: uuidv4(),
source: WorkspaceApprovalSetting_Rule_Source.SOURCE_UNSPECIFIED,
+ title: "",
condition: "",
flow: createProto(ApprovalFlowSchema, { roles: [] }),
};
diff --git a/frontend/src/types/workspaceApprovalSetting.ts b/frontend/src/types/workspaceApprovalSetting.ts
index 7a0cda8407..14695a284d 100644
--- a/frontend/src/types/workspaceApprovalSetting.ts
+++ b/frontend/src/types/workspaceApprovalSetting.ts
@@ -6,6 +6,7 @@ import type { WorkspaceApprovalSetting_Rule_Source } from "@/types/proto-es/v1/s
export type LocalApprovalRule = {
uid: string; // Local unique identifier for UI tracking
source: WorkspaceApprovalSetting_Rule_Source;
+ title: string; // Human-readable title
condition: string; // CEL expression string
conditionExpr?: ConditionGroupExpr; // Parsed CEL for editor
flow: ApprovalFlow; // Inline approval flow (roles array)
diff --git a/frontend/src/utils/workspaceApprovalSetting.ts b/frontend/src/utils/workspaceApprovalSetting.ts
index 4aacc0fc60..4030f5c5f6 100644
--- a/frontend/src/utils/workspaceApprovalSetting.ts
+++ b/frontend/src/utils/workspaceApprovalSetting.ts
@@ -36,6 +36,7 @@ export const resolveLocalApprovalConfig = async (
source:
protoRule.source ||
WorkspaceApprovalSetting_Rule_Source.SOURCE_UNSPECIFIED,
+ title: protoRule.template?.title || "",
condition,
flow:
protoRule.template?.flow || create(ApprovalFlowSchema, { roles: [] }),
@@ -77,6 +78,7 @@ export const buildWorkspaceApprovalSetting = async (
condition: create(ExprSchema, { expression: rule.condition }),
template: {
flow: rule.flow,
+ title: rule.title,
},
});
protoRules.push(protoRule);