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(frontend): remove unused issue types (#11337)
boojack6c9d9a20b169
diff --git a/.github/workflows/frontend-tests-default.yml b/.github/workflows/frontend-tests-default.ymlindex 7358b04062..d99242077e 100644--- a/.github/workflows/frontend-tests-default.yml+++ b/.github/workflows/frontend-tests-default.yml@@ -10,7 +10,7 @@ on:- "frontend/**"jobs:- eslint-checks:+ static-checks:runs-on: ubuntu-lateststeps:- run: 'echo "Not required"'diff --git a/.github/workflows/frontend-tests.yml b/.github/workflows/frontend-tests.ymlindex d03a9a422f..7345c2082c 100644--- a/.github/workflows/frontend-tests.yml+++ b/.github/workflows/frontend-tests.yml@@ -13,7 +13,7 @@ concurrency:cancel-in-progress: truejobs:- eslint-checks:+ static-checks:runs-on: ubuntu-lateststeps:- uses: actions/checkout@v4@@ -30,6 +30,9 @@ jobs:- name: Run pnpm lintrun: pnpm lintworking-directory: frontend+ - name: Run pnpm type-check+ run: pnpm type-check+ working-directory: frontendfrontend-tests:runs-on: ubuntu-latestdiff --git a/frontend/src/components/Issue/panel/RequestQueryPanel/index.vue b/frontend/src/components/Issue/panel/RequestQueryPanel/index.vueindex 2e73a8a3ce..f4eefc6d4d 100644--- a/frontend/src/components/Issue/panel/RequestQueryPanel/index.vue+++ b/frontend/src/components/Issue/panel/RequestQueryPanel/index.vue@@ -208,15 +208,6 @@ const doCreateIssue = async () => {return;}- // const newIssue: IssueCreate = {- // name: generateIssueName(),- // type: "bb.issue.grant.request",- // description: state.description,- // projectId: Number(state.projectId),- // assigneeId: SYSTEM_BOT_ID,- // createContext: {},- // payload: {},- // };const newIssue = Issue.fromPartial({title: generateIssueName(),description: state.description,diff --git a/frontend/src/components/Project/ProjectIssuesPanel.vue b/frontend/src/components/Project/ProjectIssuesPanel.vueindex cac1b54ead..bb1a178440 100644--- a/frontend/src/components/Project/ProjectIssuesPanel.vue+++ b/frontend/src/components/Project/ProjectIssuesPanel.vue@@ -76,7 +76,7 @@</template><script lang="ts" setup>-import { useLocalStorage } from "@vueuse/core";+import { useLocalStorage, type UseStorageOptions } from "@vueuse/core";import { cloneDeep } from "lodash-es";import { ChevronDownIcon, SearchIcon } from "lucide-vue-next";import { NButton, NTooltip } from "naive-ui";@@ -147,7 +147,7 @@ const storedTab = useLocalStorage<TabValue>(return value;},},- }+ } as UseStorageOptions<TabValue>);const keyForTab = (tab: TabValue) => {diff --git a/frontend/src/plugins/types.ts b/frontend/src/plugins/types.tsindex b67fb59ee4..dfab37d8c9 100644--- a/frontend/src/plugins/types.ts+++ b/frontend/src/plugins/types.ts@@ -1,12 +1,3 @@-import type { Policy } from "@/types/proto/v1/org_policy_service";-import type {- Database,- Environment,- Issue,- IssueCreate,- Principal,-} from "../types";-// Issue// It has to be string type because the id for stage field contain multiple parts.export type FieldId = string;@@ -20,86 +11,3 @@ export enum IssueBuiltinFieldId {SUBSCRIBER_LIST = "6",SQL = "7",}--export const INPUT_CUSTOM_FIELD_ID_BEGIN = "100";-export const OUTPUT_CUSTOM_FIELD_ID_BEGIN = "200";--export type InputFieldType = "Boolean" | "String";--export type OutputFieldType = "String" | "Database";--export type IssueContext = {- currentUser: Principal;- create: boolean;- issue: Issue | IssueCreate;-};--export type FieldInfo = {- name: string;- type: InputFieldType | OutputFieldType;-};--export type InputField = {- // Used as the key to store the data. This must NOT be changed after- // in use, otherwise, it will cause data loss/corruption. Its design- // is very similar to the message field id in Protocol Buffers.- id: FieldId;- // Used as the key to generate UI artifacts (e.g. query parameter).- // Though changing it won't have catastrophic consequence such as changing- // id, we strongly recommend NOT to change it as well, otherwise, previous- // generated artifacts based on this info such as URL would become invalid.- slug: string;- // The display name. OK to change.- name: string;- // Field type. This must NOT be changed after in use. Similar to id field.- type: InputFieldType;- // Whether to allow edit after creation.- allowEditAfterCreation: boolean;- required?: boolean;- // Whether the field is resolved.- // One use case is together with "required" field to validate whether it's ready to submit the data.- // For OUTPUT, one use case is to validate whether the field is filled properly according to the issue.- resolved: (ctx: IssueContext) => boolean;- // Placeholder displayed on UI.- placeholder?: string;-};--export type OutputField = {- // Same as InputField.id- id: FieldId;- // Same as InputField.name- name: string;- // Same as InputField.type- type: OutputFieldType;- // Whether the field is resolved.- // One use case is to validate whether the field is filled properly according to the issue.- resolved: (ctx: IssueContext) => boolean;- // Same as InputField.placeholder- placeholder?: string;- // Link text- actionText: string;- // Link to the place fulfilling this field resource- actionLink: (ctx: IssueContext) => string;- // Link to view the field resource- viewLink: (ctx: IssueContext) => string;- // Corresponding text based on whether the field is resolved- resolveStatusText: (resolved: boolean) => string;-};--// Template-export type TemplateContext = {- databaseList: Database[];- environmentList: Environment[];- approvalPolicyList: Policy[];- currentUser: Principal;- statementList?: string[];-};--export type IssueTemplate = {- type: string;- buildIssue: (- ctx: TemplateContext- ) => Omit<IssueCreate, "projectId" | "creatorId">;- inputFieldList: InputField[];- outputFieldList: OutputField[];-};diff --git a/frontend/src/router/dashboard/workspace.ts b/frontend/src/router/dashboard/workspace.tsindex 36fbe15345..149eb19321 100644--- a/frontend/src/router/dashboard/workspace.ts+++ b/frontend/src/router/dashboard/workspace.ts@@ -110,7 +110,6 @@ const workspaceRoutes: RouteRecordRaw[] = [name: WORKSPACE_ROUTE_EXPORT_CENTER,meta: {title: () => startCase(t("export-center.self")),- requiredWorkspacePermissionList: () => ["bb.projects.getIamPolicy"],},components: {content: () => import("@/views/ExportCenter/index.vue"),diff --git a/frontend/src/types/issue.ts b/frontend/src/types/issue.tsindex 56312fb1a5..34f0966201 100644--- a/frontend/src/types/issue.ts+++ b/frontend/src/types/issue.ts@@ -1,18 +1,7 @@-import type { DatabaseResource } from "@/types";-import type {- DatabaseId,- InstanceId,- IssueId,- PrincipalId,- ProjectId,- SheetId,- TaskId,-} from "./id";-import type { MigrationType } from "./instance";-import type { Pipeline, PipelineCreate } from "./pipeline";+import type { IssueId, TaskId } from "./id";+import type { Pipeline } from "./pipeline";import type { Principal } from "./principal";import type { Project } from "./project";-import type { Expr } from "./proto/google/type/expr";import type { IssuePayload as IssueProtoPayload } from "./proto/store/issue";type IssueTypeGeneral = "bb.issue.general";@@ -38,35 +27,6 @@ export type IssueType =export type IssueStatus = "OPEN" | "DONE" | "CANCELED";-export type CreateDatabaseContext = {- instanceId: InstanceId;- databaseName: string;- tableName: string;- // Only applicable to PostgreSQL for "WITH OWNER <<owner>>"- owner: string;- characterSet: string;- collation: string;- cluster: string;- labels?: string; // JSON encoded-};--export type MigrationDetail = {- migrationType: MigrationType;- statement: string;- sheetId: SheetId;- earliestAllowedTs: number;- databaseId?: DatabaseId;- databaseGroupName?: string;- schemaGroupName?: string;- rollbackEnabled?: boolean;- rollbackDetail?: RollbackDetail;-};--export type UpdateSchemaGhostDetail = MigrationDetail & {- // empty by now- // more input parameters in the future-};-// RollbackDetail is the detail for rolling back a task.export type RollbackDetail = {// IssueID is the id of the issue to rollback.@@ -75,38 +35,6 @@ export type RollbackDetail = {taskId: TaskId;};-export type MigrationContext = {- detailList: MigrationDetail[];-};--// eslint-disable-next-line @typescript-eslint/ban-types-export type EmptyContext = {};--export interface GrantRequestContext {- role: "EXPORTER" | "QUERIER";- // Conditions in CEL expression.- databaseResources: DatabaseResource[];- expireDays: number;- maxRowCount: number;- statement: string;- exportFormat: "CSV" | "JSON";-}--export type IssueCreateContext =- | CreateDatabaseContext- | MigrationContext- | GrantRequestContext- | EmptyContext;--export interface GrantRequestPayload {- // The requested role, e.g. PresetRoleType.PROJECT_EXPORTER- role: string;- // The requested user, e.g. users/[email protected]- user: string;- // IAM binding condition in expr.- condition: Expr;-}-export type IssuePayload = IssueProtoPayload | { [key: string]: any };export type Issue = {@@ -133,50 +61,6 @@ export type Issue = {payload: IssuePayload;};-export type IssueCreate = {- // Related fields- projectId: number;- pipeline?: PipelineCreate;-- // Domain specific fields- name: string;- type: IssueType;- description: string;- assigneeId: PrincipalId;- createContext: IssueCreateContext;- payload: IssuePayload;-};--export type IssueFind = {- projectId?: ProjectId;- principalId?: PrincipalId;- creatorId?: PrincipalId;- assigneeId?: PrincipalId;- subscriberId?: PrincipalId;- statusList?: IssueStatus[];- limit?: number;-- // defined in Go but not used yet- // id?: IssueId;- // pipelineId?: PipelineId;- // maxId?: IssueId;-};--export type IssuePatch = {- // Domain specific fields- name?: string;- description?: string;- assigneeId?: PrincipalId;- assigneeNeedAttention?: boolean;- payload?: IssuePayload;-};--export type IssueStatusPatch = {- // Domain specific fields- status: IssueStatus;- comment?: string;-};-export type IssueStatusTransitionType = "RESOLVE" | "CANCEL" | "REOPEN";export interface IssueStatusTransition {@@ -218,14 +102,3 @@ export const ISSUE_STATUS_TRANSITION_LIST: Map<},],]);--// The first transition in the list is the primary action and the rests are-// the normal action. For now there are at most 1 primary 1 normal action.-export const APPLICABLE_ISSUE_ACTION_LIST: Map<- IssueStatus,- IssueStatusTransitionType[]-> = new Map([- ["OPEN", ["RESOLVE", "CANCEL"]],- ["DONE", ["REOPEN"]],- ["CANCELED", ["REOPEN"]],-]);diff --git a/frontend/src/utils/issue/index.ts b/frontend/src/utils/issue/index.tsindex 09e42f1776..c36728ed5d 100644--- a/frontend/src/utils/issue/index.ts+++ b/frontend/src/utils/issue/index.ts@@ -1,30 +1,4 @@import dayjs from "dayjs";-import type { Issue, IssueType, StageId } from "@/types";--export function stageName(issue: Issue, stageId: StageId): string {- for (const stage of issue.pipeline?.stageList ?? []) {- if (stage.id == stageId) {- return stage.name;- }- }- return "<<Unknown stage>>";-}--export function isGrantRequestIssueType(issueType: IssueType): boolean {- return issueType === "bb.issue.grant.request";-}--export function isDatabaseRelatedIssueType(issueType: IssueType): boolean {- return [- "bb.issue.database.general",- "bb.issue.database.create",- "bb.issue.database.grant",- "bb.issue.database.schema.update",- "bb.issue.database.data.update",- "bb.issue.database.rollback",- "bb.issue.database.schema.update.ghost",- ].includes(issueType);-}export const generateIssueName = (type: "bb.issue.database.schema.update" | "bb.issue.database.data.update",diff --git a/frontend/src/views/Home.vue b/frontend/src/views/Home.vueindex 247311f534..60211c99ff 100644--- a/frontend/src/views/Home.vue+++ b/frontend/src/views/Home.vue@@ -140,7 +140,7 @@</template><script lang="ts" setup>-import { useLocalStorage } from "@vueuse/core";+import { useLocalStorage, type UseStorageOptions } from "@vueuse/core";import { cloneDeep } from "lodash-es";import { ChevronDownIcon, SearchIcon } from "lucide-vue-next";import { NButton, NTooltip } from "naive-ui";@@ -236,7 +236,7 @@ const storedTab = useLocalStorage<TabValue>(return value;},},- }+ } as UseStorageOptions<TabValue>);const keyForTab = (tab: TabValue) => {if (tab === "CREATED") return "my-issues-created";