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 protection shield (#13194)
Danny Xu7ea431b8499f
diff --git a/frontend/src/components/Branch/BranchDataTable/cells/AsyncBranchNameCell.vue b/frontend/src/components/Branch/BranchDataTable/cells/AsyncBranchNameCell.vueindex a7a777f14f..bfd1c2bacd 100644--- a/frontend/src/components/Branch/BranchDataTable/cells/AsyncBranchNameCell.vue+++ b/frontend/src/components/Branch/BranchDataTable/cells/AsyncBranchNameCell.vue@@ -5,38 +5,24 @@@click.stop="handleBranchClick">{{ branchName }}</span>- <span v-if="isProtected">- <NTooltip trigger="hover">- <template #trigger>- <ShieldAlertIcon class="w-4 h-auto text-gray-500" />- </template>- {{ $t("branch.branch-is-protected") }}- </NTooltip>- </span></div></template><script lang="ts" setup>import { computedAsync } from "@vueuse/core";-import { ShieldAlertIcon } from "lucide-vue-next";-import { NTooltip } from "naive-ui";import { computed } from "vue";import { useRouter } from "vue-router";import { PROJECT_V1_ROUTE_BRANCH_DETAIL } from "@/router/dashboard/projectV1";-import { useBranchStore, useProjectV1Store } from "@/store";+import { useBranchStore } from "@/store";import {getProjectAndBranchId,- projectNamePrefix,} from "@/store/modules/v1/common";-import { useProjectBranchProtectionRules } from "@/store/modules/v1/projectProtectionRoles";-import { wildcardToRegex } from "../../utils";const props = defineProps<{name: string;}>();const router = useRouter();-const projectStore = useProjectV1Store();const branchStore = useBranchStore();const branch = computedAsync(async () => {@@ -47,25 +33,10 @@ const branch = computedAsync(async () => {return branchStore.fetchBranchByName(props.name);}, undefined);-const project = computed(() => {- const [projectId] = getProjectAndBranchId(props.name);- return projectStore.getProjectByName(`${projectNamePrefix}${projectId}`);-});--const branchProtectionRules = useProjectBranchProtectionRules(- project.value.name-);-const branchName = computed(() => {return branch.value?.branchId ?? getProjectAndBranchId(props.name)[1];});-const isProtected = computed(() => {- return branchProtectionRules.value.some((rule) => {- return wildcardToRegex(rule.nameFilter).test(props.name);- });-});-const handleBranchClick = async () => {const [_, branchId] = getProjectAndBranchId(props.name);router.push({diff --git a/frontend/src/components/Branch/BranchDataTable/cells/BranchNameCell.vue b/frontend/src/components/Branch/BranchDataTable/cells/BranchNameCell.vueindex 0264ddd6dd..4303fc853d 100644--- a/frontend/src/components/Branch/BranchDataTable/cells/BranchNameCell.vue+++ b/frontend/src/components/Branch/BranchDataTable/cells/BranchNameCell.vue@@ -5,58 +5,28 @@@click.stop="handleBranchClick">{{ branchName }}</span>- <span v-if="isProtected">- <NTooltip trigger="hover">- <template #trigger>- <ShieldAlertIcon class="w-4 h-auto text-gray-500" />- </template>- {{ $t("branch.branch-is-protected") }}- </NTooltip>- </span></div></template><script lang="ts" setup>-import { ShieldAlertIcon } from "lucide-vue-next";-import { NTooltip } from "naive-ui";import { computed } from "vue";import { useRouter } from "vue-router";import { PROJECT_V1_ROUTE_BRANCH_DETAIL } from "@/router/dashboard/projectV1";-import { useProjectV1Store } from "@/store";import {getProjectAndBranchId,- projectNamePrefix,} from "@/store/modules/v1/common";-import { useProjectBranchProtectionRules } from "@/store/modules/v1/projectProtectionRoles";import type { Branch } from "@/types/proto/v1/branch_service";-import { wildcardToRegex } from "../../utils";const props = defineProps<{branch: Branch;}>();const router = useRouter();-const projectStore = useProjectV1Store();--const project = computed(() => {- const [projectId] = getProjectAndBranchId(props.branch.name);- return projectStore.getProjectByName(`${projectNamePrefix}${projectId}`);-});--const branchProtectionRules = useProjectBranchProtectionRules(- project.value.name-);const branchName = computed(() => {return props.branch.branchId;});-const isProtected = computed(() => {- return branchProtectionRules.value.some((rule) => {- return wildcardToRegex(rule.nameFilter).test(props.branch.branchId);- });-});-const handleBranchClick = async () => {const [_, branchId] = getProjectAndBranchId(props.branch.name);router.push({diff --git a/frontend/src/store/modules/v1/projectProtectionRoles.ts b/frontend/src/store/modules/v1/projectProtectionRoles.tsdeleted file mode 100644index 6d4ec1276d..0000000000--- a/frontend/src/store/modules/v1/projectProtectionRoles.ts+++ /dev/null@@ -1,88 +0,0 @@-import { defineStore } from "pinia";-import { computed, watchEffect } from "vue";-import { projectServiceClient } from "@/grpcweb";-import { useCache } from "@/store/cache";-import type {- ProtectionRule,- ProtectionRules,-} from "@/types/proto/v1/project_service";-import { ProtectionRule_Target } from "@/types/proto/v1/project_service";-import { protectionRulesSuffix } from "./common";--type ProjectProtectionRuleCacheKey = [- string /* project protection rules resource name */,-];--export const useProjectProtectionRulesStore = defineStore(- "project_protection_rules",- () => {- const cacheByName = useCache<- ProjectProtectionRuleCacheKey,- ProtectionRule[]- >("bb.project-protection-rules.by-name");-- const reset = () => {- cacheByName.clear();- };-- // Actions- const fetchProjectProtectionRules = async (projectName: string) => {- const name = `${projectName}${protectionRulesSuffix}`;- const data = await projectServiceClient.getProjectProtectionRules({- name,- });- return data.rules;- };- const getProjectProtectionRules = (projectName: string) => {- const name = projectName + protectionRulesSuffix;- return cacheByName.getEntity([name]) ?? [];- };- const getOrFetchProjectProtectionRules = async (projectName: string) => {- const name = `${projectName}${protectionRulesSuffix}`;- const cachedRequest = cacheByName.getRequest([name]);- if (cachedRequest) {- return cachedRequest;- }- const cachedEntity = cacheByName.getEntity([name]);- if (cachedEntity) {- return cachedEntity;- }- const request = fetchProjectProtectionRules(projectName);- cacheByName.setRequest([name], request);- return request;- };- const updateProjectProtectionRules = async (- protectionRules: ProtectionRules- ) => {- const data = await projectServiceClient.updateProjectProtectionRules({- protectionRules,- });- cacheByName.setEntity([data.name], data.rules);- return data.rules;- };-- return {- reset,- fetchProjectProtectionRules,- getProjectProtectionRules,- getOrFetchProjectProtectionRules,- updateProjectProtectionRules,- };- }-);--export const useProjectBranchProtectionRules = (projectName: string) => {- const store = useProjectProtectionRulesStore();-- const branchProtectionRules = computed(() => {- return store- .getProjectProtectionRules(projectName)- .filter((rule) => rule.target === ProtectionRule_Target.BRANCH);- });-- watchEffect(() => {- store.getOrFetchProjectProtectionRules(projectName);- });-- return branchProtectionRules;-};