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: no deployment config UI (#15414)
Danny Xu767068202336
diff --git a/frontend/src/components/DeploymentConfigTool/DeploymentConfigTool.vue b/frontend/src/components/DeploymentConfigTool/DeploymentConfigTool.vuedeleted file mode 100644index 6aeb4a19bd..0000000000--- a/frontend/src/components/DeploymentConfigTool/DeploymentConfigTool.vue+++ /dev/null@@ -1,86 +0,0 @@-<template>- <div v-if="!!schedule" class="bb-deployment-config divide-y">- <DeploymentStage- v-for="(deployment, i) in schedule.deployments"- :key="getKey(deployment)"- :index="i"- :max="schedule.deployments.length"- :deployment="deployment"- :allow-edit="allowEdit"- :show-header="true"- :database-list="databaseList"- @remove="removeStage(deployment)"- @prev="reorder(i, -1)"- @next="reorder(i, 1)"- >- </DeploymentStage>- </div>-</template>--<script lang="ts">-import type { PropType } from "vue";-import { defineComponent } from "vue";-import type { ComposedDatabase } from "@/types";-import type {- Schedule,- ScheduleDeployment,-} from "@/types/proto/v1/project_service";-import DeploymentStage from "./DeploymentStage.vue";--export default defineComponent({- name: "DeploymentConfigTool",- components: { DeploymentStage },- props: {- allowEdit: {- type: Boolean,- default: false,- },- schedule: {- type: Object as PropType<Schedule>,- required: true,- },- databaseList: {- type: Array as PropType<ComposedDatabase[]>,- default: () => [],- },- },- setup(props) {- const keyMap = new WeakMap<ScheduleDeployment, number>();- // Map each Deployment object to an unique key to keep it being "moved"- // rather than "replaced" when re-ordering. (BYT-758)- const getKey = (dep: ScheduleDeployment): number => {- let key = keyMap.get(dep);- if (!key) {- key = Math.random();- keyMap.set(dep, key);- }- return key;- };-- const removeStage = (deployment: ScheduleDeployment) => {- const array = props.schedule.deployments;- const index = array.indexOf(deployment);- if (index >= 0) {- array.splice(index, 1);- }- };-- const reorder = (index: number, diff: number) => {- const swap = (i: number, j: number) => {- const array = props.schedule.deployments;- const tmp = array[i];- array[i] = array[j];- array[j] = tmp;- };- const target = index + diff;- swap(index, target);- };-- return {- removeStage,- reorder,- getKey,- };- },-});-</script>diff --git a/frontend/src/components/DeploymentConfigTool/DeploymentMatrix.vue b/frontend/src/components/DeploymentConfigTool/DeploymentMatrix.vuedeleted file mode 100644index c70a323df0..0000000000--- a/frontend/src/components/DeploymentConfigTool/DeploymentMatrix.vue+++ /dev/null@@ -1,72 +0,0 @@-<template>- <div class="space-y-4 w-192 px-1">- <div class="flex justify-end items-center">- <NInputGroup style="width: auto" class="py-0.5">- <NInputGroupLabel- :bordered="false"- style="--n-group-label-color: transparent"- >- Group by- </NInputGroupLabel>- <YAxisRadioGroup- v-model:label="state.label"- :database-list="databaseList"- />- <SearchBox- v-if="showSearchBox"- v-model:value="state.keyword"- :placeholder="$t('common.filter-by-name')"- />- </NInputGroup>- </div>- <div class="w-full overflow-x-auto">- <DeploymentMatrixDataTable- :database-list="filteredDatabaseList"- :label="state.label"- :environment-list="environmentList"- :deployment="deployment"- />- </div>- </div>-</template>--<script lang="ts" setup>-import { NInputGroup, NInputGroupLabel } from "naive-ui";-import { computed, reactive } from "vue";-import type { ComposedDatabase } from "@/types";-import type { Environment } from "@/types/proto/v1/environment_service";-import type { DeploymentConfig } from "@/types/proto/v1/project_service";-import { filterDatabaseV1ByKeyword } from "@/utils";-import {- YAxisRadioGroup,- DeploymentMatrixDataTable,-} from "../TenantDatabaseTable";-import { SearchBox } from "../v2";--const props = withDefaults(- defineProps<{- deployment: DeploymentConfig;- environmentList: Environment[];- databaseList: ComposedDatabase[];- showSearchBox: boolean;- }>(),- {- showSearchBox: false,- }-);--const state = reactive({- label: "environment",- keyword: "",-});--const filteredDatabaseList = computed(() => {- return props.databaseList.filter((db) => {- return filterDatabaseV1ByKeyword(db, state.keyword, [- "name",- "environment",- "instance",- ]);- });-});-</script>diff --git a/frontend/src/components/DeploymentConfigTool/DeploymentStage.vue b/frontend/src/components/DeploymentConfigTool/DeploymentStage.vuedeleted file mode 100644index 7ef8af265c..0000000000--- a/frontend/src/components/DeploymentConfigTool/DeploymentStage.vue+++ /dev/null@@ -1,149 +0,0 @@-<template>- <!-- eslint-disable vue/no-mutating-props -->- <div class="deployment-stage flex w-full relative">- <div- v-if="allowEdit"- class="reorder flex flex-col items-center justify-start pr-2 pb-4 pt-5"- >- <NButton v-if="index > 0" text @click="$emit('prev')">- <heroicons-solid:arrow-circle-up class="w-6 h-6" />- </NButton>- <NButton v-if="index < max - 1" text @click="$emit('next')">- <heroicons-solid:arrow-circle-down class="w-6 h-6" />- </NButton>- </div>- <div- class="main flex-1 flex flex-col gap-y-2 w-full overflow-x-hidden"- :class="[layout === 'compact' ? 'my-2' : 'my-4']"- >- <h3 v-if="showHeader">- <template v-if="allowEdit">- <NInput- v-model:value="deployment.title"- :placeholder="$t('deployment-config.name-placeholder')"- style="width: 14rem"- />- </template>- <template v-else>- {{ deployment.title }}- </template>- </h3>- <div class="flex flex-col gap-y-2 overflow-hidden">- <div- v-for="(selector, j) in selectors"- :key="j"- class="flex content-start overflow-hidden"- >- <SelectorItemV2- :editable="allowEdit"- :selector="selector"- :selectors="selectors"- :index="j"- :database-list="databaseList"- @remove="removeSelector(selector)"- />- </div>- </div>- <NButton v-if="allowEdit" class="self-start" @click="addSelector">- {{ $t("deployment-config.add-selector") }}- </NButton>- </div>-- <NButton- v-if="allowEdit"- class="absolute right-0 top-0"- quaternary- style="--n-padding: 10px"- @click="$emit('remove')"- >- <XIcon class="w-4 h-4" />- </NButton>- </div>-</template>--<script lang="ts" setup>-import { head, without } from "lodash-es";-import { XIcon } from "lucide-vue-next";-import { NButton, NInput } from "naive-ui";-import type { PropType } from "vue";-import { computed } from "vue";-import type { ComposedDatabase } from "@/types";-import type {- LabelSelectorRequirement,- ScheduleDeployment,-} from "@/types/proto/v1/project_service";-import { OperatorType } from "@/types/proto/v1/project_service";-import { getAvailableDeploymentConfigMatchSelectorKeyList } from "@/utils";-import SelectorItemV2 from "./SelectorItemV2.vue";--const props = defineProps({- deployment: {- type: Object as PropType<ScheduleDeployment>,- required: true,- },- index: {- type: Number,- default: -1,- },- max: {- type: Number,- default: -1,- },- allowEdit: {- type: Boolean,- default: false,- },- databaseList: {- type: Array as PropType<ComposedDatabase[]>,- default: () => [],- },- showHeader: {- type: Boolean,- default: true,- },- layout: {- type: String as PropType<"default" | "compact">,- default: "default",- },-});--defineEmits<{- (event: "remove"): void;- (event: "prev"): void;- (event: "next"): void;-}>();--const selectors = computed(() => {- return props.deployment.spec?.labelSelector?.matchExpressions ?? [];-});--const keys = computed(() => {- return getAvailableDeploymentConfigMatchSelectorKeyList(- props.databaseList,- true /* withVirtualLabelKeys */,- true /* sort */- );-});--const removeSelector = (selector: LabelSelectorRequirement) => {- const index = selectors.value.indexOf(selector);- if (index >= 0) {- selectors.value.splice(index, 1);- }-};--const addSelector = () => {- const usedKeys = selectors.value.map((s) => s.key);- const unusedKeys = without(keys.value, ...usedKeys);- const labelKeys = without(keys.value, "environment");- const suggestedNextKey =- head(unusedKeys) ?? head(labelKeys) ?? head(keys.value) ?? "";-- const rule: LabelSelectorRequirement = {- key: suggestedNextKey,- operator: OperatorType.OPERATOR_TYPE_IN,- values: [],- };- selectors.value.push(rule);-};-</script>diff --git a/frontend/src/components/DeploymentConfigTool/ResponsiveTags.vue b/frontend/src/components/DeploymentConfigTool/ResponsiveTags.vuedeleted file mode 100644index 8eb3c28ab9..0000000000--- a/frontend/src/components/DeploymentConfigTool/ResponsiveTags.vue+++ /dev/null@@ -1,139 +0,0 @@-<template>- <span ref="wrapper" class="tags">- <span v-for="(value, i) in visible" :key="i" class="tag">- {{ value }}- </span>- <span v-if="rest.length > 0" class="tag rest">- <span>+ {{ rest.length }} ...</span>- </span>- </span>-</template>--<script lang="ts">-import { useResizeObserver, useWindowSize } from "@vueuse/core";-import type { PropType } from "vue";-import {- computed,- defineComponent,- nextTick,- onMounted,- ref,- watch,-} from "vue";--export default defineComponent({- name: "ResponsiveTags",- props: {- tags: {- type: Array as PropType<string[]>,- default: () => [],- },- },- setup(props) {- const clip = ref(0);- const visible = computed(() => props.tags.slice(0, clip.value));- const rest = computed(() => props.tags.slice(clip.value));- const wrapper = ref<HTMLElement>();- const wrapperWidth = ref(0); // available after first render- const winWidth = useWindowSize().width;- const adjusting = ref(false);-- type Direction = "more" | "less";-- useResizeObserver(wrapper, (entries) => {- const elem = entries[0].target;- wrapperWidth.value = elem.clientWidth;- });-- function maybeLess() {- const elem = wrapper.value!;- // use the latest dom value- // because size ref maybe not flushed yet- const innerWidth = elem.scrollWidth;- const outerWidth = elem.clientWidth;- if (innerWidth > outerWidth) {- if (clip.value > 0) {- clip.value--;- return true;- }- }- return false;- }-- function maybeMore() {- const elem = wrapper.value!;- // use the latest dom value- // because size ref maybe not flushed yet- const innerWidth = elem.scrollWidth;- const outerWidth = elem.clientWidth;- if (innerWidth <= outerWidth) {- if (clip.value < props.tags.length) {- clip.value++;- return true;- }- }- return false;- }-- async function adjust(dir: Direction) {- if (adjusting.value) return;- adjusting.value = true;-- if (dir === "more") {- while (maybeMore()) {- await nextTick();- }- // the last `maybeMore` may cause overflow- // so call `maybeLess` to check it- maybeLess();- } else {- while (maybeLess()) {- await nextTick();- }- }-- adjusting.value = false;- }-- const onWidthChange = (newWidth: number, oldWidth: number) => {- if (oldWidth === 0) return;- const dir: Direction = newWidth > oldWidth ? "more" : "less";- adjust(dir);- };-- // debouncedWatch(wrapperWidth, onWidthChange, { debounce: 50 });- // debouncedWatch(winWidth, onWidthChange, { debounce: 50 });- watch(wrapperWidth, onWidthChange);- watch(winWidth, onWidthChange);-- onMounted(() => {- adjust("more");- });-- watch(- () => props.tags,- () => {- // reset when props changed- clip.value = 0;- nextTick(() => adjust("more"));- }- );-- return {- clip,- rest,- visible,- wrapper,- };- },-});-</script>--<style scoped lang="postcss">-.tags {- @apply flex flex-1 gap-1 overflow-hidden max-h-full;-}-.tag {- @apply inline-flex items-center bg-blue-100 border-blue-300 px-2 rounded whitespace-nowrap;-}-</style>diff --git a/frontend/src/components/DeploymentConfigTool/SelectorItemV2.vue b/frontend/src/components/DeploymentConfigTool/SelectorItemV2.vuedeleted file mode 100644index f259fef6d5..0000000000--- a/frontend/src/components/DeploymentConfigTool/SelectorItemV2.vue+++ /dev/null@@ -1,209 +0,0 @@-<template>- <!-- eslint-disable vue/no-mutating-props -->- <NInputGroup class="w-full flex items-center overflow-x-hidden">- <NSelect- v-model:value="selector.key"- :options="keyOptions"- v-bind="commonSelectProps"- style="width: auto"- />- <NSelect- v-model:value="selector.operator"- :options="operatorOptions"- v-bind="commonSelectProps"- style="width: auto"- />- <NSelect- v-if="selector.operator !== OperatorType.OPERATOR_TYPE_EXISTS"- v-bind="valueSelectProps"- @update:value="handleUpdateValues"- />- <ErrorTipsButton- v-if="editable"- :errors="- isRequiredEnvironmentSelector- ? [$t('deployment-config.error.env-in-selector-required')]- : []- "- style="--n-padding: 10px"- class="shrink-0"- @click="$emit('remove')"- >- <TrashIcon class="w-4 h-4" />- </ErrorTipsButton>- </NInputGroup>-</template>--<script lang="ts" setup>-/* eslint-disable vue/no-mutating-props */-import { TrashIcon } from "lucide-vue-next";-import type { SelectOption, SelectProps } from "naive-ui";-import { NInputGroup, NSelect } from "naive-ui";-import type { CSSProperties, PropType } from "vue";-import { computed, watch } from "vue";-import { useI18n } from "vue-i18n";-import type { ComposedDatabase } from "@/types";-import type { LabelSelectorRequirement } from "@/types/proto/v1/project_service";-import { OperatorType } from "@/types/proto/v1/project_service";-import {- displayDeploymentMatchSelectorKey,- getAvailableDeploymentConfigMatchSelectorKeyList,- getLabelValuesFromDatabaseV1List,- unwrapArray,- wrapArray,-} from "@/utils";-import { ErrorTipsButton } from "../v2";--const OPERATORS: OperatorType[] = [- OperatorType.OPERATOR_TYPE_IN,- OperatorType.OPERATOR_TYPE_NOT_IN,- OperatorType.OPERATOR_TYPE_EXISTS,-];--const props = defineProps({- selector: {- type: Object as PropType<LabelSelectorRequirement>,- required: true,- },- selectors: {- type: Array as PropType<LabelSelectorRequirement[]>,- default: () => [],- },- index: {- type: Number,- default: -1,- },- databaseList: {- type: Array as PropType<ComposedDatabase[]>,- default: () => [],- },- editable: {- type: Boolean,- default: false,- },-});--defineEmits<{- (event: "remove"): void;-}>();--const { t } = useI18n();--const isRequiredEnvironmentSelector = computed(() => {- return props.selector.key === "environment" && props.index === 0;-});--const commonSelectProps = computed((): SelectProps => {- return {- consistentMenuWidth: false,- disabled: !props.editable || isRequiredEnvironmentSelector.value,- showArrow: props.editable && !isRequiredEnvironmentSelector.value,- };-});--const operators = computed(() => {- return OPERATORS.filter((op) => {- if (- props.selector.key === "environment" &&- op === OperatorType.OPERATOR_TYPE_NOT_IN- ) {- return false;- }- return true;- });-});--const keys = computed(() => {- return getAvailableDeploymentConfigMatchSelectorKeyList(- props.databaseList,- true /* withVirtualLabelKeys */,- true /* sort */- );-});-const keyOptions = computed(() => {- return keys.value.map<SelectOption>((key) => {- return {- label: displayDeploymentMatchSelectorKey(key),- value: key,- };- });-});-const operatorOptions = computed(() => {- return operators.value.map<SelectOption>((op) => {- return {- label: operatorToText(op),- value: op,- };- });-});-const allowMultipleValues = computed(() => {- return props.selector.key !== "environment";-});-const values = computed(() => {- if (!props.selector.key) return [];- return getLabelValuesFromDatabaseV1List(- props.selector.key,- props.databaseList- );-});-const valueOptions = computed(() => {- return values.value.map<SelectOption>((value) => {- return {- label: value,- value,- };- });-});--const resetValues = () => {- props.selector.values = [];-};--const operatorToText = (op: OperatorType) => {- switch (op) {- case OperatorType.OPERATOR_TYPE_IN:- return allowMultipleValues.value ? "in" : "is";- case OperatorType.OPERATOR_TYPE_NOT_IN:- return "not in";- case OperatorType.OPERATOR_TYPE_EXISTS:- return "exists";- }- console.error("[operatorToText] should never reach this line", op);- return "";-};--const valueSelectProps = computed(() => {- const multiple = allowMultipleValues.value;- const { values } = props.selector;- const selectProps: SelectProps = {- ...commonSelectProps.value,- multiple,- value: multiple ? wrapArray(values) : unwrapArray(values),- options: valueOptions.value,- maxTagCount: "responsive",- disabled: !props.editable,- showArrow: props.editable,- placeholder: t("label.placeholder.select-values"),- };- const style: CSSProperties = {- "min-width": props.editable ? (multiple ? "12rem" : "8rem") : undefined,- width: "auto",- "overflow-x": "hidden",- };- return {- ...selectProps,- style,- };-});--const handleUpdateValues = (values: string | string[]) => {- if (allowMultipleValues.value) {- props.selector.values = wrapArray(values);- } else {- props.selector.values = [unwrapArray(values)];- }-};--watch(() => props.selector.key, resetValues);-watch(() => props.selector.operator, resetValues);-</script>diff --git a/frontend/src/components/DeploymentConfigTool/index.ts b/frontend/src/components/DeploymentConfigTool/index.tsdeleted file mode 100644index 0647c1f9c3..0000000000--- a/frontend/src/components/DeploymentConfigTool/index.ts+++ /dev/null@@ -1,7 +0,0 @@-import DeploymentConfigTool from "./DeploymentConfigTool.vue";-import DeploymentMatrix from "./DeploymentMatrix.vue";-import DeploymentStage from "./DeploymentStage.vue";--export default DeploymentConfigTool;--export { DeploymentConfigTool, DeploymentStage, DeploymentMatrix };diff --git a/frontend/src/components/Label/LabelListEditor.vue b/frontend/src/components/Label/LabelListEditor.vueindex dac6496804..3afa2801e3 100644--- a/frontend/src/components/Label/LabelListEditor.vue+++ b/frontend/src/components/Label/LabelListEditor.vue@@ -33,7 +33,7 @@ import { cloneDeep } from "lodash-es";import { NButton } from "naive-ui";import { computed } from "vue";import { useI18n } from "vue-i18n";-import { MAX_LABEL_VALUE_LENGTH, isVirtualLabelKey } from "@/utils";+import { MAX_LABEL_VALUE_LENGTH } from "@/utils";import LabelEditorRow from "./LabelEditorRow.vue";import type { Label } from "./types";@@ -63,9 +63,6 @@ const errorList = computed(() => {if (!key) {errors.key.push(t("label.error.key-necessary"));} else {- if (isVirtualLabelKey(key)) {- errors.key.push(t("label.error.x-is-reserved-key", { key }));- }if (kvList.filter((kv) => kv.key === key).length > 1) {errors.key.push(t("label.error.key-duplicated"));}diff --git a/frontend/src/components/Project/useProjectSidebar.ts b/frontend/src/components/Project/useProjectSidebar.tsindex 16bbafa539..5fe99190c5 100644--- a/frontend/src/components/Project/useProjectSidebar.ts+++ b/frontend/src/components/Project/useProjectSidebar.ts@@ -9,7 +9,6 @@ import {PencilRuler,SearchCodeIcon,DownloadIcon,- SquareGanttChartIcon,PackageIcon,} from "lucide-vue-next";import { computed, h, unref } from "vue";@@ -28,7 +27,6 @@ import projectV1Routes, {PROJECT_V1_ROUTE_WEBHOOKS,PROJECT_V1_ROUTE_CHANGELISTS,PROJECT_V1_ROUTE_DATABASE_GROUPS,- PROJECT_V1_ROUTE_DEPLOYMENT_CONFIG,PROJECT_V1_ROUTE_EXPORT_CENTER,PROJECT_V1_ROUTE_AUDIT_LOGS,PROJECT_V1_ROUTE_REVIEW_CENTER,@@ -242,15 +240,6 @@ export const useProjectSidebar = (},],},- {- title: t("common.deployment-config"),- icon: () => h(SquareGanttChartIcon),- path: PROJECT_V1_ROUTE_DEPLOYMENT_CONFIG,- type: "div",- hide:- isDefaultProject.value ||- databaseChangeMode.value === DatabaseChangeMode.EDITOR,- },{title: t("common.setting"),icon: () => h(Settings),diff --git a/frontend/src/components/ProjectDeploymentConfigPanel.vue b/frontend/src/components/ProjectDeploymentConfigPanel.vuedeleted file mode 100644index 78759e8888..0000000000--- a/frontend/src/components/ProjectDeploymentConfigPanel.vue+++ /dev/null@@ -1,251 +0,0 @@-<template>- <div v-if="state.ready" class="w-full space-y-6">- <DeploymentMatrix- v-if="state.deployment"- class="w-full !px-0 overflow-x-auto"- :project="project"- :deployment="state.deployment"- :database-list="databaseList"- :environment-list="environmentList"- show-search-box- />-- <div class="space-y-4">- <div class="w-full flex flex-row justify-between items-center gap-4">- <h3 class="text-lg font-medium leading-7 text-main">- {{ $t("common.deployment-config") }}- </h3>- <div>- <NButton v-if="allowEdit" @click="addStage">- <template #icon>- <PlusIcon class="w-4 h-auto" />- </template>- {{ $t("deployment-config.add-stage") }}- </NButton>- </div>- </div>-- <BBAttention- v-if="state.deployment === undefined"- type="warning"- :title="$t('common.deployment-config')"- :description="$t('deployment-config.this-is-example-deployment-config')"- >- </BBAttention>- <DeploymentConfigTool- v-else-if="state.deployment.schedule"- :schedule="state.deployment.schedule"- :allow-edit="allowEdit"- :database-list="databaseList"- />- </div>- <div v-if="isDeploymentConfigDirty" class="sticky bottom-0 z-10">- <div- class="flex justify-between w-full pt-4 border-t border-block-border bg-white"- >- <NButton @click.prevent="onCancel">- {{ $t("common.cancel") }}- </NButton>-- <NPopover :disabled="!state.error" trigger="hover">- <template #trigger>- <NButton- type="primary"- :disabled="!!state.error"- @click="updateDeploymentConfig"- >- {{ $t("common.confirm-and-update") }}- </NButton>- </template>-- <span v-if="state.error" class="text-error">- {{ $t(state.error) }}- </span>- </NPopover>- </div>- </div>- </div>- <div v-else class="flex justify-center items-center py-10">- <BBSpin />- </div>-</template>--<script lang="ts" setup>-import { useEventListener } from "@vueuse/core";-import { cloneDeep, isEqual } from "lodash-es";-import { PlusIcon } from "lucide-vue-next";-import { NButton, NPopover } from "naive-ui";-import type { PropType } from "vue";-import { computed, nextTick, reactive, watch, watchEffect } from "vue";-import { useI18n } from "vue-i18n";-import { onBeforeRouteLeave } from "vue-router";-import { BBAttention, BBSpin } from "@/bbkit";-import {- getDefaultDeploymentConfig,- pushNotification,- useDeploymentConfigV1Store,- useEnvironmentV1List,-} from "@/store";-import {- DeploymentConfig,- type LabelSelectorRequirement,- type Project,-} from "@/types/proto/v1/project_service";-import { OperatorType } from "@/types/proto/v1/project_service";-import type { ComposedDatabase } from "../types";-import {- extractEnvironmentResourceName,- validateDeploymentConfigV1,-} from "../utils";-import DeploymentConfigTool, { DeploymentMatrix } from "./DeploymentConfigTool";--type LocalState = {- ready: boolean;- deployment: DeploymentConfig | undefined;- originalDeployment: DeploymentConfig | undefined;- error: string | undefined;-};--const props = defineProps({- project: {- required: true,- type: Object as PropType<Project>,- },- databaseList: {- type: Array as PropType<ComposedDatabase[]>,- default: () => [],- },- allowEdit: {- default: true,- type: Boolean,- },-});--const { t } = useI18n();-const deploymentConfigV1Store = useDeploymentConfigV1Store();--const state = reactive<LocalState>({- ready: false,- deployment: undefined,- originalDeployment: undefined,- error: undefined,-});--const isDeploymentConfigDirty = computed((): boolean => {- return !isEqual(state.deployment, state.originalDeployment);-});--const allowUpdateDeploymentConfig = computed((): boolean => {- if (state.error) return false;- if (!isDeploymentConfigDirty.value) return false;- return true;-});--const environmentList = useEnvironmentV1List();--const resetStates = async () => {- await nextTick(); // Waiting for all watchers done- state.error = undefined;-};--watchEffect(async () => {- const deploymentConfig =- await deploymentConfigV1Store.fetchDeploymentConfigByProjectName(- props.project.name- );- // We clone the saved deployment-config- // <DeploymentConfigTool /> will mutate `state.deployment` directly- // when update button clicked, we save the draft to backend.- state.deployment = DeploymentConfig.fromPartial({- ...getDefaultDeploymentConfig(),- ...cloneDeep(deploymentConfig),- });- // clone the object to the backup- state.originalDeployment = cloneDeep(state.deployment);- // clean up error and dirty status- resetStates();- state.ready = true;-});--const addStage = () => {- if (!state.deployment) return;- const rule: LabelSelectorRequirement = {- key: "environment",- operator: OperatorType.OPERATOR_TYPE_IN,- values: [],- };- if (environmentList.value.length > 0) {- const name = extractEnvironmentResourceName(environmentList.value[0].name);- rule.values.push(name);- }-- state.deployment.schedule?.deployments.push({- title: "New Stage",- id: "",- spec: {- labelSelector: {- matchExpressions: [rule],- },- },- });-};--const validate = () => {- if (!state.deployment) return;- state.error = validateDeploymentConfigV1(state.deployment);-};--const onCancel = () => {- state.deployment = DeploymentConfig.fromPartial({- ...cloneDeep(state.originalDeployment),- });-};--const updateDeploymentConfig = async () => {- if (!state.deployment) return;- if (!allowUpdateDeploymentConfig.value) return;-- const updated =- await deploymentConfigV1Store.updatedDeploymentConfigByProjectName(- props.project.name,- state.deployment- );-- pushNotification({- module: "bytebase",- style: "SUCCESS",- title: t("deployment-config.update-success"),- });-- // clone the updated version to the backup- state.deployment = cloneDeep(updated);- state.originalDeployment = cloneDeep(updated);- // clean up error status- resetStates();-};--watch(- () => state.deployment,- () => {- validate();- },- { deep: true }-);--useEventListener("beforeunload", (e) => {- if (!isDeploymentConfigDirty.value) {- return;- }- e.returnValue = t("common.leave-without-saving");- return e.returnValue;-});--onBeforeRouteLeave((to, from, next) => {- if (isDeploymentConfigDirty.value) {- if (!window.confirm(t("common.leave-without-saving"))) {- return;- }- }- next();-});-</script>diff --git a/frontend/src/components/SyncDatabaseSchemaV1/index.vue b/frontend/src/components/SyncDatabaseSchemaV1/index.vueindex 5657bb2f3c..3125f2b447 100644--- a/frontend/src/components/SyncDatabaseSchemaV1/index.vue+++ b/frontend/src/components/SyncDatabaseSchemaV1/index.vue@@ -259,7 +259,7 @@ const tryChangeStep = async (nextStepIndex: number) => {dialog.create({positiveText: t("common.confirm"),negativeText: t("common.cancel"),- title: t("deployment-config.confirm-to-revert"),+ title: t("common.confirm-to-revert"),autoFocus: false,closable: false,maskClosable: false,diff --git a/frontend/src/components/TenantDatabaseTable/DatabaseMatrixGroup.vue b/frontend/src/components/TenantDatabaseTable/DatabaseMatrixGroup.vuedeleted file mode 100644index da276aa3dd..0000000000--- a/frontend/src/components/TenantDatabaseTable/DatabaseMatrixGroup.vue+++ /dev/null@@ -1,60 +0,0 @@-<template>- <div class="flex flex-col items-start w-max space-y-2">- <div class="space-y-1">- <DatabaseMatrixItem- v-for="item in shownDatabases"- :key="item.name"- :database="item"- />- </div>- <p v-if="showDisplayMore" class="textinfolabel space-x-1">- <span>{{- $t("deployment-config.matched-databases.n", { n: databases.length })- }}</span>- <NButton size="tiny" @click="() => (state.showAll = true)">{{- $t("deployment-config.matched-databases.show-more")- }}</NButton>- </p>- </div>-- <DatabaseMatrixGroupDrawer- v-if="state.showAll"- :databases="databases"- @dismiss="() => (state.showAll = false)"- />-</template>--<script lang="ts" setup>-import { NButton } from "naive-ui";-import type { PropType } from "vue";-import { computed, reactive } from "vue";-import type { ComposedDatabase } from "@/types";-import DatabaseMatrixGroupDrawer from "./DatabaseMatrixGroupDrawer.vue";-import DatabaseMatrixItem from "./DatabaseMatrixItem.vue";--interface LocalState {- showAll: boolean;-}--// Show databases with limit.-const MAX_DISPLAY_DATABASES = 10;--const props = defineProps({- databases: {- type: Object as PropType<ComposedDatabase[]>,- required: true,- },-});--const state = reactive<LocalState>({- showAll: false,-});--const shownDatabases = computed(() => {- return props.databases.slice(0, MAX_DISPLAY_DATABASES);-});--const showDisplayMore = computed(() => {- return props.databases.length > MAX_DISPLAY_DATABASES;-});-</script>diff --git a/frontend/src/components/TenantDatabaseTable/DatabaseMatrixGroupDrawer.vue b/frontend/src/components/TenantDatabaseTable/DatabaseMatrixGroupDrawer.vuedeleted file mode 100644index d845c70d27..0000000000--- a/frontend/src/components/TenantDatabaseTable/DatabaseMatrixGroupDrawer.vue+++ /dev/null@@ -1,36 +0,0 @@-<template>- <Drawer @close="$emit('dismiss')">- <DrawerContent- :title="$t('deployment-config.matched-databases.all')"- :content-props="{- bodyContentClass: 'relative',- }"- >- <div class="focus:outline-none w-auto" tabindex="0">- <div class="grid grid-cols-3 gap-3 border rounded-lg p-4">- <DatabaseMatrixItem- v-for="item in databases"- :key="item.name"- :database="item"- />- </div>- </div>- </DrawerContent>- </Drawer>-</template>--<script lang="ts" setup>-import type { PropType } from "vue";-import { Drawer, DrawerContent } from "@/components/v2";-import type { ComposedDatabase } from "@/types";-import DatabaseMatrixItem from "./DatabaseMatrixItem.vue";--defineProps({- databases: {- type: Object as PropType<ComposedDatabase[]>,- required: true,- },-});--defineEmits(["dismiss"]);-</script>diff --git a/frontend/src/components/TenantDatabaseTable/DatabaseMatrixItem.vue b/frontend/src/components/TenantDatabaseTable/DatabaseMatrixItem.vuedeleted file mode 100644index a815d9bc65..0000000000--- a/frontend/src/components/TenantDatabaseTable/DatabaseMatrixItem.vue+++ /dev/null@@ -1,117 +0,0 @@-<template>- <NPopover- trigger="hover"- placement="right"- :theme-overrides="{- borderRadius: '0.5rem',- padding: '0',- }"- >- <template #trigger>- <div class="flex items-center select-none space-x-1">- <div class="sync-status">- <heroicons-solid:check-circle- v-if="database.state === State.ACTIVE"- class="w-6 h-6 text-success"- />- <heroicons-solid:exclamation v-else class="w-6 h-6 text-warning" />- </div>- <div class="flex flex-col items-start">- <router-link- :to="databaseDetailUrl"- class="text-main whitespace-nowrap leading-snug hover:underline"- >- {{ database.databaseName }}- </router-link>-- <router-link- :to="schemaVersionUrl"- class="text-xs text-control hover:underline"- >- {{ database.schemaVersion }}- </router-link>- </div>- </div>- </template>-- <div class="rounded-md bg-white divide-y">- <div class="px-4 py-2 flex items-center whitespace-nowrap space-x-1">- <span>- <heroicons-solid:check- v-if="database.state === State.ACTIVE"- class="w-4 h-4 text-success"- />- <heroicons-outline:exclamation v-else class="w-4 h-4 text-warning" />- </span>- <span class="flex-1">- {{ database.state === State.ACTIVE ? "OK" : "NOT_FOUND" }}- </span>- </div>- <div class="px-4 py-2 flex items-center whitespace-pre-wrap space-x-1">- <InstanceV1Name :instance="database.instanceResource" :link="false" />- </div>-- <div class="px-4 py-2 flex items-center justify-between space-x-1">- <span>{{ $t("db.last-successful-sync") }}</span>- <span>{{- humanizeDate(getDateForPbTimestamp(database.successfulSyncTime))- }}</span>- </div>-- <div- v-if="displayLabelList.length > 0"- class="px-4 py-2 labels whitespace-nowrap flex-col items-start"- >- <div- v-for="label in displayLabelList"- :key="label.key"- class="flex items-center space-y-1"- >- <span class="text-left">- {{ displayDeploymentMatchSelectorKey(label.key) }}- </span>- <span- class="flex-1 h-px mx-2 border-b border-control-border border-dashed"- ></span>- <span class="text-right">{{ label.value }}</span>- </div>- </div>- </div>- </NPopover>-</template>--<script lang="ts" setup>-import { NPopover } from "naive-ui";-import type { PropType } from "vue";-import { computed } from "vue";-import { getDateForPbTimestamp, type ComposedDatabase } from "@/types";-import { State } from "@/types/proto/v1/common";-import {- convertLabelsToKVList,- isVirtualLabelKey,- displayDeploymentMatchSelectorKey,- databaseV1Url,-} from "@/utils";-import { InstanceV1Name } from "../v2";--const props = defineProps({- database: {- type: Object as PropType<ComposedDatabase>,- required: true,- },-});--const displayLabelList = computed(() => {- return convertLabelsToKVList(props.database.labels, true /* sort */)- .filter((kv) => !isVirtualLabelKey(kv.key))- .filter((kv) => kv.value !== "");-});--const databaseDetailUrl = computed((): string => {- return databaseV1Url(props.database);-});--const schemaVersionUrl = computed((): string => {- return `${databaseV1Url(props.database)}#changelog`;-});-</script>diff --git a/frontend/src/components/TenantDatabaseTable/DeploymentMatrixDataTable.vue b/frontend/src/components/TenantDatabaseTable/DeploymentMatrixDataTable.vuedeleted file mode 100644index 30e0e8ab0a..0000000000--- a/frontend/src/components/TenantDatabaseTable/DeploymentMatrixDataTable.vue+++ /dev/null@@ -1,166 +0,0 @@-<template>- <NDataTable- key="database-table"- size="small"- :columns="columnList"- :data="groupedStageList"- :bordered="bordered"- :row-key="(data: DeploymentMatrixRowData) => data.labelValue"- ></NDataTable>-</template>--<script lang="tsx" setup>-import { groupBy } from "lodash-es";-import { NDataTable, type DataTableColumn } from "naive-ui";-import { computed } from "vue";-import { useI18n } from "vue-i18n";-import type { ComposedDatabase } from "@/types";-import type { Environment } from "@/types/proto/v1/environment_service";-import type { DeploymentConfig } from "@/types/proto/v1/project_service";-import {- displayDeploymentMatchSelectorKey,- getLabelValuesFromDatabaseV1List,- getPipelineFromDeploymentScheduleV1,- getSemanticLabelValue,-} from "@/utils";-import DatabaseMatrixGroup from "./DatabaseMatrixGroup.vue";--type DeploymentMatrixRowData = {- labelValue: string;- stages: ComposedDatabase[][];- unmatched: ComposedDatabase[];-};--type DeploymentMatrixDataTableColumn =- DataTableColumn<DeploymentMatrixRowData> & {- hide?: boolean;- };--const props = withDefaults(- defineProps<{- databaseList: ComposedDatabase[];- label: string;- environmentList: Environment[];- deployment: DeploymentConfig;- bordered?: boolean;- showRest?: boolean;- }>(),- {- bordered: true,- showRest: true,- }-);--const { t } = useI18n();--const databaseGroupList = computed(() => {- const key = props.label;- const dict = groupBy(props.databaseList, (db) =>- getSemanticLabelValue(db, key)- );- const rows = getLabelValuesFromDatabaseV1List(- props.label,- props.databaseList- ).map((labelValue) => {- const databaseList = dict[labelValue] || [];- return {- labelValue,- databaseList,- };- });-- // Add the empty label value row only if it matches any db.- const emptyLabelDBList = dict[""] || [];- if (emptyLabelDBList.length > 0) {- rows.push({labelValue: "", databaseList: emptyLabelDBList})- }-- return rows;-});--const groupedStageList = computed(() => {- return databaseGroupList.value.map(({ labelValue, databaseList }) => {- const stages = getPipelineFromDeploymentScheduleV1(- databaseList,- props.deployment.schedule- );- const affectedNames = stages.flatMap((dbs) => dbs.map((db) => db.name));- const dict = new Set(affectedNames);- const unmatched = props.showRest- ? databaseList.filter((db) => !dict.has(db.name))- : [];-- return {- labelValue,- stages,- unmatched,- };- });-});--const hasRest = computed(() => {- return groupedStageList.value.some((group) => group.unmatched.length > 0);-});--const columnList = computed((): DeploymentMatrixDataTableColumn[] => {- const ENVIRONTMENT_ID: DeploymentMatrixDataTableColumn = {- key: "environment-id",- title: displayDeploymentMatchSelectorKey(props.label),- hide: !(props.label === "environment"),- width: 160,- render: (data) => {- return data.labelValue;- },- };- const DATABASE_UNIT: DeploymentMatrixDataTableColumn = {- key: "database-unit",- title: displayDeploymentMatchSelectorKey(props.label),- hide: props.label === "environment",- width: 160,- render: (data) => {- if (!data.labelValue) {- return <span class="text-opacity-70 italic">{t("common.empty")}</span>;- }- return data.labelValue;- },- };-- const deployments = props.deployment.schedule?.deployments ?? [];- const columnCount = hasRest.value- ? deployments.length + 1- : deployments.length;- const STAGE_LIST: DeploymentMatrixDataTableColumn[] = (deployments ?? []).map(- (dep, i) => ({- key: `stage-${i}`,- title: dep.title,- width: `${100 / columnCount}%`,- minWidth: 240,- render: (data) => {- const matched = data.stages[i];- if (matched.length === 0) {- return "-";- }- return <DatabaseMatrixGroup databases={matched} />;- },- })- );- const UNMATCHED_LIST: DeploymentMatrixDataTableColumn = {- key: `unmatched`,- title: "Unmatched",- width: `${100 / columnCount}%`,- minWidth: 240,- hide: !hasRest.value,- render: (data) => {- const unmatched = data.unmatched;- if (unmatched.length === 0) {- return "-";- }- return <DatabaseMatrixGroup databases={unmatched} />;- },- };-- return [ENVIRONTMENT_ID, DATABASE_UNIT, ...STAGE_LIST, UNMATCHED_LIST].filter(- (col) => !col.hide- );-});-</script>diff --git a/frontend/src/components/TenantDatabaseTable/YAxisRadioGroup.vue b/frontend/src/components/TenantDatabaseTable/YAxisRadioGroup.vuedeleted file mode 100644index a57e4cda56..0000000000--- a/frontend/src/components/TenantDatabaseTable/YAxisRadioGroup.vue+++ /dev/null@@ -1,57 +0,0 @@-<template>- <NSelect- v-if="visible"- :options="options"- :value="label"- style="width: 9rem"- v-bind="$attrs"- @update-value="$emit('update:label', $event)"- />-</template>--<script lang="ts" setup>-import type { SelectOption } from "naive-ui";-import { NSelect } from "naive-ui";-import { computed } from "vue";-import type { ComposedDatabase } from "@/types";-import {- displayDeploymentMatchSelectorKey,- getAvailableDeploymentConfigMatchSelectorKeyList,-} from "@/utils";--const props = withDefaults(- defineProps<{- databaseList: ComposedDatabase[];- label: string;- excludedKeyList?: string[];- }>(),- {- excludedKeyList: () => [],- }-);--defineEmits<{- (event: "update:label", label: string): void;-}>();--const labelKeyList = computed(() => {- return getAvailableDeploymentConfigMatchSelectorKeyList(- props.databaseList,- true /* withVirtualLabelKeys */,- true /* sort */- ).filter((key) => !props.excludedKeyList.includes(key));-});--const visible = computed(() => {- if (!props.label) return false;- return labelKeyList.value.includes(props.label);-});-const options = computed(() => {- return labelKeyList.value.map<SelectOption>((key) => {- return {- value: key,- label: displayDeploymentMatchSelectorKey(key),- };- });-});-</script>diff --git a/frontend/src/components/TenantDatabaseTable/index.ts b/frontend/src/components/TenantDatabaseTable/index.tsdeleted file mode 100644index 2692ba3eeb..0000000000--- a/frontend/src/components/TenantDatabaseTable/index.ts+++ /dev/null@@ -1,4 +0,0 @@-import DeploymentMatrixDataTable from "./DeploymentMatrixDataTable.vue";-import YAxisRadioGroup from "./YAxisRadioGroup.vue";--export { DeploymentMatrixDataTable, YAxisRadioGroup };diff --git a/frontend/src/locales/en-US.json b/frontend/src/locales/en-US.jsonindex d70c787388..c66d089b32 100644--- a/frontend/src/locales/en-US.json+++ b/frontend/src/locales/en-US.json@@ -65,6 +65,7 @@"self": "Role"},"revert": "Revert",+ "confirm-to-revert": "Confirm to revert your editing?","apply": "Apply","reorder": "Reorder","id": "ID",@@ -124,7 +125,6 @@"read-only": "Read-only","all": "All","recent": "Recent",- "deployment-config": "Deployment Config","ok": "OK","share": "Share","or": "or",@@ -1019,7 +1019,6 @@"streams": "Streams","tasks": "Tasks","labels-for-resource": "Labels for {resource}",- "last-successful-sync": "Last successful sync","failed-to-sync-schema-for-database-database-value-name": "Failed to sync schema for database '{0}'.","successfully-synced-schema-for-database-database-value-name": "Successfully synced schema for database '{0}'.","start-to-sync-schema": "Start to sync schema",@@ -1646,28 +1645,7 @@"revoke-exemption-title": "Remove both export and query masking exemptions for {member}?"}},- "deployment-config": {- "add-selector": "Add selector",- "update-success": "Successfully updated deployment config.",- "this-is-example-deployment-config": "This is the deployment config example. You need to edit and save it.",- "add-stage": "Add stage",- "confirm-to-revert": "Confirm to revert your editing?",- "name-placeholder": "Stage name...",- "error": {- "at-least-one-stage": "At least 1 stage",- "stage-name-required": "Stage name is required",- "at-least-one-selector": "At least 1 selector in each stage",- "env-in-selector-required": "\"Environment\" is required in each stage",- "env-selector-must-has-one-value": "\"Environment ID\" must has exactly one value",- "key-required": "Key is required",- "values-required": "Values are required"- },- "matched-databases": {- "all": "All matched databases",- "n": "{n} matched database | {n} matched databases",- "show-more": "Show more"- }- },+"data-source": {"snowflake-keypair-tip": "Key-pair authentication","ssl": {@@ -1953,11 +1931,7 @@"key-necessary": "Key is required","value-necessary": "Value is required","key-duplicated": "Duplicated keys",- "max-value-length-exceeded": "Value's length cannot exceed {length} characters",- "x-is-reserved-key": "\"{key}\" is a system reserved key"- },- "placeholder": {- "select-values": "Select values..."+ "max-value-length-exceeded": "Value's length cannot exceed {length} characters"},"add-label": "Add label","filter-by-label": "Filter by label"diff --git a/frontend/src/locales/es-ES.json b/frontend/src/locales/es-ES.jsonindex c81481ddc8..27b546638b 100644--- a/frontend/src/locales/es-ES.json+++ b/frontend/src/locales/es-ES.json@@ -65,6 +65,7 @@"self": "Rol"},"revert": "Revertir",+ "confirm-to-revert": "¿Confirmar para revertir la edición?","apply": "Aplicar","reorder": "Reordenar","id": "ID",@@ -124,7 +125,6 @@"read-only": "Solo lectura","all": "Todos","recent": "Reciente",- "deployment-config": "Configuración de Despliegue","ok": "OK","share": "Compartir","or": "o",@@ -1019,7 +1019,6 @@"streams": "Streams","tasks": "Tareas","labels-for-resource": "Etiquetas para {resource}",- "last-successful-sync": "Última sincronización exitosa","failed-to-sync-schema-for-database-database-value-name": "Error al sincronizar el esquema para la base de datos '{0}'.","successfully-synced-schema-for-database-database-value-name": "Esquema sincronizado correctamente para la base de datos '{0}'.","start-to-sync-schema": "Comenzar a sincronizar el esquema",@@ -1646,28 +1645,6 @@"revoke-exemption-title": "Eliminar tanto las exenciones de exportación como de consulta de enmascaramiento para {member}?"}},- "deployment-config": {- "add-selector": "Agregar selector",- "update-success": "Configuración de implementación actualizada con éxito.",- "this-is-example-deployment-config": "Este es un ejemplo de configuración de implementación. Debe editarla y guardarla.",- "add-stage": "Agregar etapa",- "confirm-to-revert": "¿Confirmar para revertir la edición?",- "name-placeholder": "Nombre de la etapa...",- "error": {- "at-least-one-stage": "Al menos 1 etapa",- "stage-name-required": "Se requiere el nombre de la etapa",- "at-least-one-selector": "Al menos 1 selector en cada etapa",- "env-in-selector-required": "Se requiere \"Entorno\" en cada etapa",- "env-selector-must-has-one-value": "\"Entorno ID\" debe tener exactamente un valor",- "key-required": "Se requiere una clave",- "values-required": "Se requieren valores"- },- "matched-databases": {- "all": "Todas las bases de datos coincidentes",- "n": "{n} base de datos coincidente | {n} bases de datos coincidentes",- "show-more": "Mostrar más"- }- },"data-source": {"snowflake-keypair-tip": "Autenticación de par de claves","ssl": {@@ -1953,11 +1930,7 @@"key-necessary": "Se requiere una clave","value-necessary": "Se requiere un valor","key-duplicated": "Claves duplicadas",- "max-value-length-exceeded": "La longitud del valor no puede exceder {longitud} caracteres",- "x-is-reserved-key": "\"{key}\" es una clave reservada del sistema"- },- "placeholder": {- "select-values": "Seleccionar valores..."+ "max-value-length-exceeded": "La longitud del valor no puede exceder {longitud} caracteres"},"add-label": "Agregar etiqueta","filter-by-label": "Filtrar por etiqueta"diff --git a/frontend/src/locales/ja-JP.json b/frontend/src/locales/ja-JP.jsonindex 3e31144283..b648bf58b9 100644--- a/frontend/src/locales/ja-JP.json+++ b/frontend/src/locales/ja-JP.json@@ -65,6 +65,7 @@"self": "役割"},"revert": "元に戻す",+ "confirm-to-revert": "編集を元に戻してもよろしいですか?","apply": "適用","reorder": "並び替え","id": "ID",@@ -124,7 +125,6 @@"read-only": "読み取り専用","all": "全て","recent": "最近",- "deployment-config": "デプロイ設定","ok": "わかりました","share": "共有","or": "または",@@ -1019,7 +1019,6 @@"streams": "ストリーム","tasks": "タスク","labels-for-resource": "{resource} のタグ",- "last-successful-sync": "最後に正常に同期された日","failed-to-sync-schema-for-database-database-value-name": "データベース '{0}' のスキーマを同期できませんでした。","successfully-synced-schema-for-database-database-value-name": "データベース '{0}' のスキーマが正常に同期されました。","start-to-sync-schema": "スキーマの同期を開始します",@@ -1646,28 +1645,6 @@"revoke-exemption-title": "{member} のエクスポートおよびクエリのマスキング免除を両方削除しますか?"}},- "deployment-config": {- "add-selector": "選択基準を追加する",- "update-success": "デプロイ設定が正常に更新されました",- "this-is-example-deployment-config": "これはサンプルのデプロイ設定であり、編集して保存する必要があります。",- "add-stage": "ステージを追加",- "confirm-to-revert": "編集を元に戻してもよろしいですか?",- "name-placeholder": "芸名…",- "error": {- "at-least-one-stage": "少なくとも 1 つのステージが必要です",- "stage-name-required": "ステージ名の指定が必要です",- "at-least-one-selector": "各ステージには少なくとも 1 つの選択基準が必要です",- "env-in-selector-required": "各ステージには「環境」の選択条件が必要です",- "env-selector-must-has-one-value": "「環境 ID」の値は 1 つだけでなければなりません",- "key-required": "キーを指定する必要があります",- "values-required": "値を指定する必要があります"- },- "matched-databases": {- "all": "一致したすべてのデータベース",- "n": "{n} 個の一致したデータベース | {n} 個の一致したデータベース",- "show-more": "もっと見る"- }- },"data-source": {"snowflake-keypair-tip": "キーペア認証","ssl": {@@ -1953,11 +1930,7 @@"key-necessary": "キーを指定する必要があります","value-necessary": "値を指定する必要があります","key-duplicated": "キーが繰り返されました",- "max-value-length-exceeded": "値は {length} 文字を超えることはできません",- "x-is-reserved-key": "「{key}」はシステムで予約されているキーです"- },- "placeholder": {- "select-values": "値を選択してください…"+ "max-value-length-exceeded": "値は {length} 文字を超えることはできません"},"add-label": "タグ付けする","filter-by-label": "タグでフィルタリングする"diff --git a/frontend/src/locales/vi-VN.json b/frontend/src/locales/vi-VN.jsonindex d9371f9345..09bd2e799b 100644--- a/frontend/src/locales/vi-VN.json+++ b/frontend/src/locales/vi-VN.json@@ -65,6 +65,7 @@"self": "Vai trò"},"revert": "Hoàn tác",+ "confirm-to-revert": "Xác nhận hoàn tác chỉnh sửa của bạn?","apply": "Áp dụng","reorder": "Sắp xếp lại","id": "ID",@@ -124,7 +125,6 @@"read-only": "Chỉ đọc","all": "Tất cả","recent": "Gần đây",- "deployment-config": "Cấu hình triển khai","ok": "OK","share": "Chia sẻ","or": "hoặc",@@ -1019,7 +1019,6 @@"streams": "Luồng","tasks": "Tác vụ","labels-for-resource": "Nhãn cho {resource}",- "last-successful-sync": "Đồng bộ thành công lần cuối","failed-to-sync-schema-for-database-database-value-name": "Không đồng bộ hóa được lược đồ cho cơ sở dữ liệu '{0}'.","successfully-synced-schema-for-database-database-value-name": "Đã đồng bộ hóa thành công lược đồ cho cơ sở dữ liệu '{0}'.","start-to-sync-schema": "Bắt đầu đồng bộ hóa lược đồ",@@ -1646,28 +1645,6 @@"revoke-exemption-title": "Xóa cả miễn trừ che giấu xuất và truy vấn cho {member}?"}},- "deployment-config": {- "add-selector": "Thêm bộ chọn",- "update-success": "Đã cập nhật thành công cấu hình triển khai.",- "this-is-example-deployment-config": "Đây là ví dụ cấu hình triển khai. Bạn cần chỉnh sửa và lưu nó.",- "add-stage": "Thêm giai đoạn",- "confirm-to-revert": "Xác nhận hoàn tác chỉnh sửa của bạn?",- "name-placeholder": "Tên giai đoạn...",- "error": {- "at-least-one-stage": "Ít nhất 1 giai đoạn",- "stage-name-required": "Tên sân khấu là bắt buộc",- "at-least-one-selector": "Ít nhất 1 bộ chọn ở mỗi giai đoạn",- "env-in-selector-required": "\"Môi trường\" là bắt buộc trong mỗi giai đoạn",- "env-selector-must-has-one-value": "\"ID môi trường\" phải có đúng một giá trị",- "key-required": "Chìa khóa là bắt buộc",- "values-required": "Các giá trị được yêu cầu"- },- "matched-databases": {- "all": "Tất cả cơ sở dữ liệu phù hợp",- "n": "{n} cơ sở dữ liệu phù hợp | {n} cơ sở dữ liệu phù hợp",- "show-more": "Hiển thị thêm"- }- },"data-source": {"snowflake-keypair-tip": "Xác thực cặp khóa","ssl": {@@ -1953,11 +1930,7 @@"key-necessary": "Khóa là bắt buộc","value-necessary": "Giá trị là bắt buộc","key-duplicated": "Khóa trùng lặp",- "max-value-length-exceeded": "Độ dài giá trị không được vượt quá {length} ký tự",- "x-is-reserved-key": "\"{key}\" là một khóa hệ thống dành riêng"- },- "placeholder": {- "select-values": "Chọn giá trị..."+ "max-value-length-exceeded": "Độ dài giá trị không được vượt quá {length} ký tự"},"add-label": "Thêm nhãn","filter-by-label": "Lọc theo nhãn"diff --git a/frontend/src/locales/zh-CN.json b/frontend/src/locales/zh-CN.jsonindex 0e5ab48172..fbbada9c5c 100644--- a/frontend/src/locales/zh-CN.json+++ b/frontend/src/locales/zh-CN.json@@ -65,6 +65,7 @@"self": "角色"},"revert": "恢复",+ "confirm-to-revert": "确定撤销编辑?","apply": "应用","reorder": "排序","id": "ID",@@ -124,7 +125,6 @@"read-only": "只读","all": "全部","recent": "最近访问",- "deployment-config": "部署配置","ok": "OK","share": "分享","or": "或者",@@ -1019,7 +1019,6 @@"streams": "Streams","tasks": "任务","labels-for-resource": "{resource}的标签",- "last-successful-sync": "上次成功同步于","failed-to-sync-schema-for-database-database-value-name": "为数据库'{0}'同步 schema 失败。","successfully-synced-schema-for-database-database-value-name": "成功为数据库'{0}'同步 schema 。","start-to-sync-schema": "开始同步 schema",@@ -1646,28 +1645,6 @@"revoke-exemption-title": "是否撤销 {member} 的导出和查询脱敏?"}},- "deployment-config": {- "add-selector": "添加选择条件",- "update-success": "成功更新部署配置",- "this-is-example-deployment-config": "这是部署配置的样例,您需要在此基础上编辑并保存。",- "add-stage": "添加阶段",- "confirm-to-revert": "确定撤销编辑?",- "name-placeholder": "阶段名称…",- "error": {- "at-least-one-stage": "至少需要 1 个阶段",- "stage-name-required": "需要指定阶段名称",- "at-least-one-selector": "每个阶段至少需要 1 个选择条件",- "env-in-selector-required": "每个阶段都需要有 \"Environment\" 选择条件",- "env-selector-must-has-one-value": "\"Environment ID\" 必须有且只有 1 个值",- "key-required": "需要指定 Key",- "values-required": "需要指定值"- },- "matched-databases": {- "all": "所有匹配的数据库",- "n": "{n} 个匹配的数据库 | {n} 个匹配的数据库",- "show-more": "显示更多"- }- },"data-source": {"snowflake-keypair-tip": "密钥对认证","ssl": {@@ -1953,11 +1930,7 @@"key-necessary": "需要指定 Key","value-necessary": "需要指定值","key-duplicated": "Key 重复了",- "max-value-length-exceeded": "值长的度不能超过 {length} 字符",- "x-is-reserved-key": "\"{key}\" 是系统保留 Key"- },- "placeholder": {- "select-values": "选择值…"+ "max-value-length-exceeded": "值长的度不能超过 {length} 字符"},"add-label": "添加标签","filter-by-label": "按标签过滤"diff --git a/frontend/src/router/dashboard/projectV1.ts b/frontend/src/router/dashboard/projectV1.tsindex e4d64f5e1a..3b8def621e 100644--- a/frontend/src/router/dashboard/projectV1.ts+++ b/frontend/src/router/dashboard/projectV1.ts@@ -13,7 +13,6 @@ export const PROJECT_V1_ROUTE_DATABASE_REVISION_DETAIL = `${PROJECT_V1_ROUTE_DASexport const PROJECT_V1_ROUTE_DATABASE_GROUPS = `${PROJECT_V1_ROUTE_DASHBOARD}.database-group`;export const PROJECT_V1_ROUTE_DATABASE_GROUPS_CREATE = `${PROJECT_V1_ROUTE_DASHBOARD}.database-group.create`;export const PROJECT_V1_ROUTE_DATABASE_GROUP_DETAIL = `${PROJECT_V1_ROUTE_DASHBOARD}.database-group.detail`;-export const PROJECT_V1_ROUTE_DEPLOYMENT_CONFIG = `${PROJECT_V1_ROUTE_DASHBOARD}.deployment-config`;export const PROJECT_V1_ROUTE_ISSUES = `${PROJECT_V1_ROUTE_DASHBOARD}.issue`;export const PROJECT_V1_ROUTE_ISSUE_DETAIL = `${PROJECT_V1_ROUTE_DASHBOARD}.issue.detail`;export const PROJECT_V1_ROUTE_PLAN_DETAIL = `${PROJECT_V1_ROUTE_DASHBOARD}.plan.detail`;@@ -135,17 +134,6 @@ const projectV1Routes: RouteRecordRaw[] = [},],},- {- path: "deployment-config",- name: PROJECT_V1_ROUTE_DEPLOYMENT_CONFIG,- meta: {- overrideTitle: true,- requiredProjectPermissionList: () => ["bb.projects.get"],- },- component: () =>- import("@/views/project/ProjectDeploymentConfigPanel.vue"),- props: true,- },{path: "issues",name: PROJECT_V1_ROUTE_ISSUES,diff --git a/frontend/src/store/modules/v1/deploymentConfig.ts b/frontend/src/store/modules/v1/deploymentConfig.tsdeleted file mode 100644index 15b9220baa..0000000000--- a/frontend/src/store/modules/v1/deploymentConfig.ts+++ /dev/null@@ -1,96 +0,0 @@-import { defineStore } from "pinia";-import { computed, reactive, ref, unref, watchEffect } from "vue";-import { projectServiceClient } from "@/grpcweb";-import type { MaybeRef, ResourceId } from "@/types";-import {- DeploymentConfig,- OperatorType,- ScheduleDeployment,-} from "@/types/proto/v1/project_service";-import { extractEnvironmentResourceName } from "@/utils";-import { useEnvironmentV1List } from "./environment";--export const useDeploymentConfigV1Store = defineStore(- "deploymentConfig_v1",- () => {- const deploymentConfigByProjectName = reactive(- new Map<ResourceId, DeploymentConfig>()- );-- const fetchDeploymentConfigByProjectName = async (project: ResourceId) => {- const name = `${project}/deploymentConfigs/default`;- try {- const deploymentConfig = await projectServiceClient.getDeploymentConfig(- {- name,- }- );- deploymentConfigByProjectName.set(project, deploymentConfig);- return deploymentConfig;- } catch {- return undefined;- }- };- const updatedDeploymentConfigByProjectName = async (- project: ResourceId,- config: DeploymentConfig- ) => {- const updated = await projectServiceClient.updateDeploymentConfig({- deploymentConfig: config,- });- deploymentConfigByProjectName.set(project, updated);- return updated;- };-- return {- deploymentConfigByProjectName,- fetchDeploymentConfigByProjectName,- updatedDeploymentConfigByProjectName,- };- }-);--export const useDeploymentConfigV1ByProject = (- project: MaybeRef<ResourceId>-) => {- const store = useDeploymentConfigV1Store();- const ready = ref(false);- watchEffect(() => {- ready.value = false;- store.fetchDeploymentConfigByProjectName(unref(project)).then(() => {- ready.value = true;- });- });- const deploymentConfig = computed(() => {- return store.deploymentConfigByProjectName.get(unref(project));- });- return { deploymentConfig, ready };-};--export const getDefaultDeploymentConfig = (): DeploymentConfig => {- const environmentList = useEnvironmentV1List();- const deployments: ScheduleDeployment[] = [];- for (const env of environmentList.value) {- deployments.push(- ScheduleDeployment.fromPartial({- title: `${env.title} Stage`,- spec: {- labelSelector: {- matchExpressions: [- {- key: "environment",- operator: OperatorType.OPERATOR_TYPE_IN,- values: [extractEnvironmentResourceName(env.name)],- },- ],- },- },- })- );- }- return DeploymentConfig.fromPartial({- schedule: {- deployments,- },- });-};diff --git a/frontend/src/store/modules/v1/index.ts b/frontend/src/store/modules/v1/index.tsindex 06124486a0..3d422f6d6e 100644--- a/frontend/src/store/modules/v1/index.ts+++ b/frontend/src/store/modules/v1/index.ts@@ -3,7 +3,6 @@ export * from "./database";export * from "./project";export * from "./projectIamPolicy";export * from "./projectWebhook";-export * from "./deploymentConfig";export * from "./databaseSecret";export * from "./sheet";export * from "./worksheet";diff --git a/frontend/src/utils/v1/deploymentConfig.ts b/frontend/src/utils/v1/deploymentConfig.tsdeleted file mode 100644index b296f5fb36..0000000000--- a/frontend/src/utils/v1/deploymentConfig.ts+++ /dev/null@@ -1,164 +0,0 @@-import { orderBy, uniq } from "lodash-es";-import { t } from "@/plugins/i18n";-import type { ComposedDatabase } from "@/types";-import type {- DeploymentConfig,- DeploymentSpec,- LabelSelector,- LabelSelectorRequirement,- Schedule,-} from "@/types/proto/v1/project_service";-import { OperatorType } from "@/types/proto/v1/project_service";-import { getSemanticLabelValue } from "../label";--export const VIRTUAL_LABEL_KEYS = ["environment"];--export const extractDeploymentConfigName = (name: string) => {- const pattern = /(?:^|\/)deploymentConfigs\/([^/]+)(?:$|\/)/;- const matches = name.match(pattern);- return matches?.[1] ?? "";-};--export const isVirtualLabelKey = (key: string) => {- return VIRTUAL_LABEL_KEYS.includes(key);-};--export const validateDeploymentConfigV1 = (- config: DeploymentConfig-): string | undefined => {- const deployments = config.schedule?.deployments ?? [];- if (deployments.length === 0) {- return t("deployment-config.error.at-least-one-stage");- }-- for (let i = 0; i < deployments.length; i++) {- const deployment = deployments[i];- if (!deployment.title.trim()) {- return t("deployment-config.error.stage-name-required");- }- const error = validateDeploymentSpecV1(deployment.spec);- if (error) return error;- }-- return undefined;-};--export const validateDeploymentSpecV1 = (- spec: DeploymentSpec | undefined-): string | undefined => {- const rules = spec?.labelSelector?.matchExpressions ?? [];- if (rules.length === 0) {- return t("deployment-config.error.at-least-one-selector");- }- const envRule = rules.find((rule) => rule.key === "environment");- if (!envRule || envRule.operator !== OperatorType.OPERATOR_TYPE_IN) {- return t("deployment-config.error.env-in-selector-required");- }- if (envRule.values.length !== 1) {- return t("deployment-config.error.env-selector-must-has-one-value");- }-- for (let i = 0; i < rules.length; i++) {- const rule = rules[i];- if (!rule.key) {- return t("deployment-config.error.key-required");- }- if (- (rule.operator === OperatorType.OPERATOR_TYPE_IN ||- rule.operator === OperatorType.OPERATOR_TYPE_NOT_IN) &&- rule.values.length === 0- ) {- return t("deployment-config.error.values-required");- }- }- return undefined;-};--export const getAvailableDeploymentConfigMatchSelectorKeyList = (- databaseList: ComposedDatabase[],- withVirtualLabelKeys: boolean,- sort = true-) => {- const keys = uniq(databaseList.flatMap((db) => Object.keys(db.labels)));- if (withVirtualLabelKeys) {- VIRTUAL_LABEL_KEYS.forEach((key) => {- if (!keys.includes(key)) keys.push(key);- });- }- if (sort) {- return orderBy(- keys,- [(key) => (isVirtualLabelKey(key) ? -1 : 1), (key) => key],- ["asc", "asc"]- );- }- return keys;-};--export const getPipelineFromDeploymentScheduleV1 = (- databaseList: ComposedDatabase[],- schedule: Schedule | undefined-): ComposedDatabase[][] => {- const stages: ComposedDatabase[][] = [];-- const collectedNames = new Set<string>();- schedule?.deployments.forEach((deployment) => {- const dbs: ComposedDatabase[] = [];- databaseList.forEach((db) => {- if (collectedNames.has(db.name)) return;- if (isDatabaseMatchesSelectorV1(db, deployment.spec?.labelSelector)) {- dbs.push(db);- collectedNames.add(db.name);- }- });- stages.push(dbs);- });-- return stages;-};--export const isDatabaseMatchesSelectorV1 = (- database: ComposedDatabase,- selector: LabelSelector | undefined-): boolean => {- const rules = selector?.matchExpressions ?? [];- return rules.every((rule) => {- switch (rule.operator) {- case OperatorType.OPERATOR_TYPE_IN:- return checkLabelIn(database, rule);- case OperatorType.OPERATOR_TYPE_NOT_IN:- return !checkLabelIn(database, rule);- case OperatorType.OPERATOR_TYPE_EXISTS:- return checkLabelExists(database, rule);- default:- // unknown operators are taken as mismatch- console.warn(`known operator "${rule.operator}"`);- return false;- }- });-};--export const displayDeploymentMatchSelectorKey = (key: string) => {- if (key === "environment") {- return "Environment ID";- }-- return key;-};--const checkLabelIn = (- db: ComposedDatabase,- rule: LabelSelectorRequirement-): boolean => {- const value = getSemanticLabelValue(db, rule.key);- if (!value) return false;-- return rule.values.includes(value);-};--const checkLabelExists = (- db: ComposedDatabase,- rule: LabelSelectorRequirement-): boolean => {- return !!getSemanticLabelValue(db, rule.key);-};diff --git a/frontend/src/utils/v1/index.ts b/frontend/src/utils/v1/index.tsindex ec348e45b8..9463e350e2 100644--- a/frontend/src/utils/v1/index.ts+++ b/frontend/src/utils/v1/index.ts@@ -5,7 +5,6 @@ export * from "./database";export * from "./databaseGroup";export * from "./project";export * from "./projectWebhook";-export * from "./deploymentConfig";export * from "./user";export * from "./instance";export * from "./sql";diff --git a/frontend/src/views/project/ProjectDeploymentConfigPanel.vue b/frontend/src/views/project/ProjectDeploymentConfigPanel.vuedeleted file mode 100644index fdd348e262..0000000000--- a/frontend/src/views/project/ProjectDeploymentConfigPanel.vue+++ /dev/null@@ -1,31 +0,0 @@-<template>- <ProjectDeploymentConfigPanel- id="deployment-config"- :project="project"- :database-list="databaseV1List"- :allow-edit="allowEdit"- />-</template>--<script setup lang="ts">-import { computed } from "vue";-import ProjectDeploymentConfigPanel from "@/components/ProjectDeploymentConfigPanel.vue";-import { useProjectByName } from "@/store";-import { useDatabaseV1Store } from "@/store";-import { projectNamePrefix } from "@/store/modules/v1/common";-import { sortDatabaseV1List } from "@/utils";--const props = defineProps<{- projectId: string;- allowEdit: boolean;-}>();--const { project } = useProjectByName(- computed(() => `${projectNamePrefix}${props.projectId}`)-);--const databaseV1List = computed(() => {- const list = useDatabaseV1Store().databaseListByProject(project.value.name);- return sortDatabaseV1List(list);-});-</script>