Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
chore: show environment color (#17302)
ecmadao4e9b457fed44
diff --git a/frontend/src/components/CustomApproval/Settings/components/common/utils.ts b/frontend/src/components/CustomApproval/Settings/components/common/utils.tsindex a7c4d29f0b..2e3969f2f7 100644--- a/frontend/src/components/CustomApproval/Settings/components/common/utils.ts+++ b/frontend/src/components/CustomApproval/Settings/components/common/utils.ts@@ -1,7 +1,9 @@import { CheckIcon } from "lucide-vue-next";import type { SelectOption } from "naive-ui";-import { h, type VNode } from "vue";+import { h } from "vue";+import type { VNode } from "vue";import { type OptionConfig } from "@/components/ExprEditor/context";+import { EnvironmentV1Name } from "@/components/v2";import { SQLTypeList, type Factor } from "@/plugins/cel";import { t } from "@/plugins/i18n";import {@@ -126,7 +128,7 @@ export const getFactorList = (source: Risk_Source) => {};export const getRenderOptionFunc = (resource: {- title: string;+ title: string | (() => VNode);name: string;}): ((info: { node: VNode; selected: boolean }) => VNode) => {return (info: { node: VNode; selected: boolean }) => {@@ -135,11 +137,13 @@ export const getRenderOptionFunc = (resource: {{ class: "flex items-center justify-between space-x-4" },[h("div", { class: "flex flex-col px-1 py-1 z-10" }, [- h(- "div",- { class: `textlabel ${info.selected ? "!text-accent" : ""}` },- resource.title- ),+ typeof resource.title === "string"+ ? h(+ "div",+ { class: `textlabel ${info.selected ? "!text-accent" : ""}` },+ resource.title+ )+ : resource.title(),h("div", { class: "opacity-60 textinfolabel" }, resource.name),]),info.selected ? h(CheckIcon, { class: "w-4 z-10" }) : undefined,@@ -157,7 +161,12 @@ export const getEnvironmentIdOptions = () => {value: environmentId,render: getRenderOptionFunc({name: `${environmentNamePrefix}${env.id}`,- title: env.title,+ title: () =>+ h(EnvironmentV1Name, {+ environment: env,+ link: false,+ showColor: true,+ }),}),};});diff --git a/frontend/src/components/v2/Model/DatabaseV1Table/DatabaseV1Table.vue b/frontend/src/components/v2/Model/DatabaseV1Table/DatabaseV1Table.vueindex 5efaa0d363..8efa9f15e2 100644--- a/frontend/src/components/v2/Model/DatabaseV1Table/DatabaseV1Table.vue+++ b/frontend/src/components/v2/Model/DatabaseV1Table/DatabaseV1Table.vue@@ -108,6 +108,7 @@ const columnList = computed((): DatabaseDataTableColumn[] => {<EnvironmentV1Nameenvironment={data.effectiveEnvironmentEntity}link={false}+ showColor={true}keyword={props.keyword}nullEnvironmentPlaceholder="Null"/>diff --git a/frontend/src/components/v2/Model/EnvironmentV1Name.vue b/frontend/src/components/v2/Model/EnvironmentV1Name.vueindex 5b3aa6f6a4..21a03baa43 100644--- a/frontend/src/components/v2/Model/EnvironmentV1Name.vue+++ b/frontend/src/components/v2/Model/EnvironmentV1Name.vue@@ -4,6 +4,17 @@v-bind="bindings"class="inline-flex items-center gap-x-1":class="[isLink && !plain && 'normal-link', isLink && 'hover:underline']"+ :style="+ showColor && backgroundColorRgb+ ? {+ backgroundColor: `rgba(${backgroundColorRgb}, 0.1)`,+ borderTopColor: `rgb(${backgroundColorRgb})`,+ color: `rgb(${backgroundColorRgb})`,+ padding: '0 6px',+ borderRadius: '4px',+ }+ : {}+ "><span class="select-none inline-block truncate" :class="textClass"><span v-if="isUnknown" class="text-gray-400 italic">@@ -29,7 +40,7 @@ import { useRouter } from "vue-router";import { UNKNOWN_ENVIRONMENT_NAME, NULL_ENVIRONMENT_NAME } from "@/types";import type { Environment } from "@/types/v1/environment";import type { VueClass } from "@/utils";-import { autoEnvironmentRoute } from "@/utils";+import { autoEnvironmentRoute, hexToRgb } from "@/utils";import HighlightLabelText from "./HighlightLabelText.vue";import ProductionEnvironmentV1Icon from "./ProductionEnvironmentV1Icon.vue";@@ -45,6 +56,7 @@ const props = withDefaults(showIcon?: boolean;textClass?: string;keyword?: string;+ showColor?: boolean;nullEnvironmentPlaceholder?: string; // Placeholder for null/unknown environment.}>(),{@@ -58,6 +70,7 @@ const props = withDefaults(showIcon: true,textClass: "",keyword: "",+ showColor: true,nullEnvironmentPlaceholder: "NULL ENVIRONMENT",});@@ -87,4 +100,11 @@ const bindings = computed(() => {}return {};});++const backgroundColorRgb = computed(() => {+ if (!props.environment.color) {+ return "";+ }+ return hexToRgb(props.environment.color).join(", ");+});</script>diff --git a/frontend/src/components/v2/Model/Instance/InstanceV1Table/InstanceV1Table.vue b/frontend/src/components/v2/Model/Instance/InstanceV1Table/InstanceV1Table.vueindex 273b365f53..5a6f2b55d9 100644--- a/frontend/src/components/v2/Model/Instance/InstanceV1Table/InstanceV1Table.vue+++ b/frontend/src/components/v2/Model/Instance/InstanceV1Table/InstanceV1Table.vue@@ -124,6 +124,7 @@ const columnList = computed((): InstanceDataTableColumn[] => {instance.environment || NULL_ENVIRONMENT_NAME)}link={false}+ showColor={true}nullEnvironmentPlaceholder="Null"/>),