Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
feat: implement grant request exporter issue (#5988)
boojacke4ff7b98d88f
diff --git a/frontend/src/components/Issue/GrantRequestIssueSidebar.vue b/frontend/src/components/Issue/GrantRequestIssueSidebar.vueindex 69210b33ce..7e286900ea 100644--- a/frontend/src/components/Issue/GrantRequestIssueSidebar.vue+++ b/frontend/src/components/Issue/GrantRequestIssueSidebar.vue@@ -19,31 +19,9 @@</div></template>- <h2 class="textlabel flex items-center col-span-1 col-start-1 gap-x-1">- <span>{{ $t("common.assignee") }}</span>- <span>- <NTooltip>- <template #trigger>- <heroicons-outline:question-mark-circle />- </template>- <div>{{ $t("issue.assignee-tooltip") }}</div>- </NTooltip>- </span>- </h2>-- <div class="col-span-2" data-label="bb-assignee-select-container">- <MemberSelect- class="w-full"- :disabled="true"- :selected-id="assigneeId as number"- data-label="bb-assignee-select"- @select-principal-id="- (principalId: number) => {- updateAssigneeId(principalId)- }- "- />- </div>+ <template v-if="!create">+ <IssueReviewSidebarSection />+ </template></div><div@@ -112,14 +90,14 @@import { computed, reactive } from "vue";import dayjs from "dayjs";import isSameOrAfter from "dayjs/plugin/isSameOrAfter";+import { Project, Issue, IssueCreate } from "@/types";+import { useProjectStore } from "@/store";+import { useExtraIssueLogic, useIssueLogic } from "./logic";+import { IssueReviewSidebarSection } from "./review";import IssueStatusIcon from "./IssueStatusIcon.vue";import IssueSubscriberPanel from "./IssueSubscriberPanel.vue";import PrincipalAvatar from "../PrincipalAvatar.vue";-import MemberSelect from "../MemberSelect.vue";import FeatureModal from "../FeatureModal.vue";-import { Project, Issue, IssueCreate } from "@/types";-import { useProjectStore } from "@/store";-import { useExtraIssueLogic, useIssueLogic } from "./logic";dayjs.extend(isSameOrAfter);@@ -130,8 +108,7 @@ interface LocalState {const projectStore = useProjectStore();const { create, issue } = useIssueLogic();-const { updateAssigneeId, addSubscriberId, removeSubscriberId } =- useExtraIssueLogic();+const { addSubscriberId, removeSubscriberId } = useExtraIssueLogic();const state = reactive<LocalState>({showFeatureModal: false,@@ -143,11 +120,4 @@ const project = computed((): Project => {}return (issue.value as Issue).project;});--const assigneeId = computed(() => {- if (create.value) {- return (issue.value as IssueCreate).assigneeId;- }- return (issue.value as Issue).assignee.id;-});</script>diff --git a/frontend/src/components/Issue/IssueBanner.vue b/frontend/src/components/Issue/IssueBanner.vueindex 3f3eee657d..e2f3a6c4ab 100644--- a/frontend/src/components/Issue/IssueBanner.vue+++ b/frontend/src/components/Issue/IssueBanner.vue@@ -41,7 +41,7 @@ import { computed, Ref } from "vue";import dayjs from "dayjs";import { Issue } from "@/types";-import { activeTask } from "@/utils";+import { activeTask, isDatabaseRelatedIssueType } from "@/utils";import { useIssueLogic } from "./logic";import { useIssueReviewContext } from "@/plugins/issue/logic/review/context";@@ -64,12 +64,20 @@ const showSuccessBanner = computed(() => {const showPendingRollout = computed(() => {if (issue.value.status !== "OPEN") return false;+ if (!isDatabaseRelatedIssueType(issue.value.type)) {+ return false;+ }+const task = activeTask(issue.value.pipeline);return task.status == "PENDING_APPROVAL";});const showEarliestAllowedTimeBanner = computed(() => {if (issue.value.status !== "OPEN") return false;+ if (!isDatabaseRelatedIssueType(issue.value.type)) {+ return false;+ }+const task = activeTask(issue.value.pipeline);if (task.status !== "PENDING") {diff --git a/frontend/src/components/Issue/IssueSidebar.vue b/frontend/src/components/Issue/IssueSidebar.vueindex bcbba19bf0..11eda095c9 100644--- a/frontend/src/components/Issue/IssueSidebar.vue+++ b/frontend/src/components/Issue/IssueSidebar.vue@@ -38,7 +38,6 @@</h2><!-- Only DBA can be assigned to the issue --><div class="col-span-2" data-label="bb-assignee-select-container">- <!-- eslint-disable vue/attribute-hyphenation --><MemberSelectclass="w-full":disabled="!allowEditAssignee"diff --git a/frontend/src/components/Issue/IssueStatusTransitionButtonGroup.vue b/frontend/src/components/Issue/IssueStatusTransitionButtonGroup.vueindex 23221ad729..75a12cc012 100644--- a/frontend/src/components/Issue/IssueStatusTransitionButtonGroup.vue+++ b/frontend/src/components/Issue/IssueStatusTransitionButtonGroup.vue@@ -48,7 +48,7 @@</div><template v-else><div- if="applicableIssueStatusTransitionList.length > 0"+ v-if="applicableIssueStatusTransitionList.length > 0"class="flex space-x-2"><template@@ -141,6 +141,7 @@ import { DropdownOption, NDropdown } from "naive-ui";import {activeStage,canSkipTask,+ isDatabaseRelatedIssueType,StageStatusTransition,taskCheckRunSummary,TaskStatusTransition,@@ -261,6 +262,7 @@ const {getApplicableTaskStatusTransitionList,} = useIssueTransitionLogic(issue as Ref<Issue>);+// TODO(steven): figure out how to show the dropdown for grant request issue.const issueStatusTransitionDropdownOptions = computed(() => {return applicableIssueStatusTransitionList.value.map<ExtraActionOption>((transition) => {@@ -282,6 +284,9 @@ const skippableTaskList = computed(() => {if (issueEntity.status !== "OPEN") {return [];}+ if (!isDatabaseRelatedIssueType(issueEntity.type)) {+ return [];+ }const currentStage = activeStage(issueEntity.pipeline);return currentStage.taskList.filter((task) =>diff --git a/frontend/src/components/Issue/form/GrantRequestExporterForm.vue b/frontend/src/components/Issue/form/GrantRequestExporterForm.vueindex ebb409e8e0..51fde49584 100644--- a/frontend/src/components/Issue/form/GrantRequestExporterForm.vue+++ b/frontend/src/components/Issue/form/GrantRequestExporterForm.vue@@ -1,6 +1,303 @@<template>- <div>- <!-- TODO(steven): implement request grant exporter form -->- <p class="py-4 italic">TODO</p>+ <div+ class="w-full mx-auto flex flex-col justify-start items-start space-y-4 my-8 gap-4"+ >+ <div v-if="create" class="w-full flex flex-row justify-start items-center">+ <span class="flex w-40 items-center">+ {{ $t("database.sync-schema.select-project") }}+ </span>+ <ProjectSelect+ class="!w-60 shrink-0"+ :selected-id="projectId"+ @select-project-id="handleSourceProjectSelect"+ />+ </div>+ <div class="w-full flex flex-row justify-start items-start">+ <span class="flex w-40 items-center">Databases</span>+ <div v-if="create">+ <EnvironmentSelect+ class="!w-60 mr-4 shrink-0"+ name="environment"+ :select-default="false"+ :selected-id="state.environmentId"+ @select-environment-id="(id) => (state.environmentId = id)"+ />+ <DatabaseSelect+ class="!w-128"+ :selected-id="(state.databaseId as DatabaseId)"+ :mode="'USER'"+ :environment-id="state.environmentId"+ :project-id="state.projectId"+ :sync-status="'OK'"+ :customize-item="true"+ @select-database-id="(id) => (state.databaseId = id)"+ >+ <template #customizeItem="{ database }">+ <div class="flex items-center">+ <InstanceEngineIcon :instance="database.instance" />+ <span class="mx-2">{{ database.name }}</span>+ <span class="text-gray-400">({{ database.instance.name }})</span>+ </div>+ </template>+ </DatabaseSelect>+ </div>+ <div+ v-else-if="selectedDatabase"+ class="flex flex-row justify-start items-center"+ >+ <InstanceEngineIcon+ class="mr-1"+ :instance="selectedDatabase.instance"+ />+ {{ selectedDatabase.name }}+ </div>+ </div>+ <div class="w-full flex flex-row justify-start items-center">+ <span class="flex w-40 items-center">Export rows</span>+ <input+ v-model="state.maxRowCount"+ required+ type="number"+ class="textfield"+ :readonly="!create"+ placeholder="Max row count"+ />+ </div>+ <div class="w-full flex flex-row justify-start items-start">+ <span class="flex w-40 items-center">Export format</span>+ <div v-if="create">+ <NRadioGroup+ v-model:value="state.exportFormat"+ class="w-full !flex flex-row justify-start items-center gap-4"+ name="radiogroup"+ >+ <NRadio :value="'CSV'" label="CSV" />+ <NRadio :value="'JSON'" label="JSON" />+ </NRadioGroup>+ </div>+ <div v-else class="flex flex-row justify-start items-start gap-4">+ {{ state.exportFormat }}+ </div>+ </div>+ <div class="w-full flex flex-row justify-start items-start">+ <span class="flex w-40 items-center">SQL</span>+ <div class="whitespace-pre-wrap mt-2 w-full overflow-hidden border">+ <MonacoEditor+ ref="editorRef"+ class="w-full h-[360px]"+ data-label="bb-issue-sql-editor"+ :value="state.statement"+ :auto-focus="false"+ :language="'sql'"+ :dialect="dialect"+ :readonly="!create"+ @change="handleStatementChange"+ @ready="handleMonacoEditorReady"+ />+ </div>+ </div></div></template>++<script lang="ts" setup>+import { head } from "lodash-es";+import { computed, onMounted, reactive, ref, watch } from "vue";+import { useIssueLogic } from "../logic";+import {+ Database,+ DatabaseId,+ EnvironmentId,+ GrantRequestContext,+ GrantRequestPayload,+ Issue,+ IssueCreate,+ ProjectId,+ SQLDialect,+ UNKNOWN_ID,+ dialectOfEngine,+} from "@/types";+import { getProjectMemberList } from "@/utils";+import { useDBSchemaStore, useDatabaseStore } from "@/store";+import MonacoEditor from "@/components/MonacoEditor";+import { TableMetadata } from "@/types/proto/store/database";+import { useInstanceV1Store } from "@/store/modules/v1/instance";+import {+ environmentNamePrefix,+ instanceNamePrefix,+} from "@/store/modules/v1/common";++interface LocalState {+ // For creating+ projectId?: ProjectId;+ environmentId?: EnvironmentId;+ databaseId?: DatabaseId;+ maxRowCount: number;+ exportFormat: "CSV" | "JSON";+ statement: string;+}++const { create, issue } = useIssueLogic();+const instanceV1Store = useInstanceV1Store();+const databaseStore = useDatabaseStore();+const dbSchemaStore = useDBSchemaStore();+const state = reactive<LocalState>({+ maxRowCount: 1000,+ exportFormat: "CSV",+ statement: "",+});+const editorRef = ref<InstanceType<typeof MonacoEditor>>();++const projectId = computed(() => {+ return create.value ? state.projectId : (issue.value as Issue).project.id;+});++const selectedDatabase = computed(() => {+ if (!state.databaseId || state.databaseId === UNKNOWN_ID) {+ return undefined;+ }+ return databaseStore.getDatabaseById(state.databaseId as DatabaseId);+});++const dialect = computed((): SQLDialect => {+ const db = selectedDatabase.value;+ return dialectOfEngine(db?.instance.engine || "MYSQL");+});++onMounted(() => {+ // do nth+});++const handleSourceProjectSelect = async (projectId: ProjectId) => {+ if (!create.value) {+ return;+ }++ state.projectId = projectId;+ (issue.value as IssueCreate).projectId = projectId;+ // update issue assignee+ const projectOwner = head(+ (await getProjectMemberList(projectId)).filter(+ (member) => !member.roleList.includes("OWNER")+ )+ );+ if (projectOwner) {+ (issue.value as IssueCreate).assigneeId = projectOwner.principal.id;+ }+};++const handleStatementChange = (value: string) => {+ state.statement = value;+};++watch(+ () => [+ state.databaseId,+ state.maxRowCount,+ state.exportFormat,+ state.statement,+ ],+ () => {+ if (create.value) {+ const context = (issue.value as IssueCreate)+ .createContext as GrantRequestContext;+ if (state.databaseId) {+ context.databases = [state.databaseId as string];+ }+ context.maxRowCount = state.maxRowCount;+ context.exportFormat = state.exportFormat;+ context.statement = state.statement;+ }+ }+);++// Handle and update monaco editor auto completion context.+const useDatabaseAndTableList = () => {+ const databaseList = computed(() => {+ if (selectedDatabase.value) return [selectedDatabase.value];+ return [];+ });++ watch(+ databaseList,+ (list) => {+ list.forEach((db) => {+ if (db.id && db.id !== UNKNOWN_ID) {+ dbSchemaStore.getOrFetchTableListByDatabaseId(db.id);+ }+ });+ },+ { immediate: true }+ );++ const tableList = computed(() => {+ return databaseList.value+ .map((item) => dbSchemaStore.getTableListByDatabaseId(item.id))+ .flat();+ });++ return { databaseList, tableList };+};++const { databaseList } = useDatabaseAndTableList();++const handleUpdateEditorAutoCompletionContext = async () => {+ const databaseMap: Map<Database, TableMetadata[]> = new Map();+ for (const database of databaseList.value) {+ const tableList = dbSchemaStore.getTableListByDatabaseId(database.id);+ databaseMap.set(database, tableList);+ }+ editorRef.value?.setEditorAutoCompletionContext(databaseMap);+};++const handleMonacoEditorReady = () => {+ handleUpdateEditorAutoCompletionContext();+};++watch(+ create,+ async () => {+ if (!create.value) {+ const payload = ((issue.value as Issue).payload as any)+ .grantRequest as GrantRequestPayload;+ if (payload.role !== "roles/EXPORTER") {+ throw "Only support EXPORTER role";+ }+ const expressionList = payload.condition.expression.split(" && ");+ for (const expression of expressionList) {+ const fields = expression.split(" ");+ if (fields[0] === "request.statement") {+ state.statement = atob(JSON.parse(fields[2]));+ } else if (fields[0] === "resource.database") {+ const databaseIdList = [];+ for (const url of JSON.parse(fields[2])) {+ const value = url.split("/");+ const instanceName = value[5] || "";+ const databaseName = value[7] || "";+ const instance = await instanceV1Store.getOrFetchInstanceByName(+ environmentNamePrefix + "-/" + instanceNamePrefix + instanceName+ );+ const databaseList =+ await databaseStore.getOrFetchDatabaseListByInstanceId(+ instance.uid+ );+ const database = databaseList.find(+ (db) => db.name === databaseName+ );+ if (database) {+ databaseIdList.push(database.id);+ }+ }+ state.databaseId = head(databaseIdList);+ } else if (fields[0] === "request.row_limit") {+ state.maxRowCount = Number(fields[2]);+ } else if (fields[0] === "request.export_format") {+ state.exportFormat = JSON.parse(fields[2]) as "CSV" | "JSON";+ }+ }+ }+ },+ {+ immediate: true,+ }+);+</script>diff --git a/frontend/src/components/Issue/form/GrantRequestQuerierForm.vue b/frontend/src/components/Issue/form/GrantRequestQuerierForm.vueindex 1ef6beb0f5..9b53b0a804 100644--- a/frontend/src/components/Issue/form/GrantRequestQuerierForm.vue+++ b/frontend/src/components/Issue/form/GrantRequestQuerierForm.vue@@ -96,7 +96,7 @@</template><script lang="ts" setup>-import { head, last } from "lodash-es";+import { head } from "lodash-es";import { NRadioGroup, NRadio, NInputNumber } from "naive-ui";import { computed, onMounted, reactive, watch } from "vue";import { useIssueLogic } from "../logic";@@ -111,6 +111,11 @@ import {import { getProjectMemberList, parseExpiredTimeString } from "@/utils";import DatabasesSelectPanel from "../../DatabasesSelectPanel.vue";import { useDatabaseStore } from "@/store";+import { useInstanceV1Store } from "@/store/modules/v1/instance";+import {+ environmentNamePrefix,+ instanceNamePrefix,+} from "@/store/modules/v1/common";interface LocalState {showSelectDatabasePanel: boolean;@@ -153,6 +158,7 @@ const expireDaysOptions = [const { create, issue } = useIssueLogic();const databaseStore = useDatabaseStore();+const instanceV1Store = useInstanceV1Store();const state = reactive<LocalState>({showSelectDatabasePanel: false,projectId: undefined,@@ -209,21 +215,23 @@ const handleSelectedDatabaseIdListChanged = (databaseIdList: DatabaseId[]) => {watch(() => [state.expireDays, state.customDays],() => {- if (state.expireDays === -1) {- (- (issue.value as IssueCreate).createContext as GrantRequestContext- ).expireDays = state.customDays;- } else {- (- (issue.value as IssueCreate).createContext as GrantRequestContext- ).expireDays = state.expireDays;+ if (create.value) {+ if (state.expireDays === -1) {+ (+ (issue.value as IssueCreate).createContext as GrantRequestContext+ ).expireDays = state.customDays;+ } else {+ (+ (issue.value as IssueCreate).createContext as GrantRequestContext+ ).expireDays = state.expireDays;+ }}});watch(create,- () => {+ async () => {if (!create.value) {const payload = ((issue.value as Issue).payload as any).grantRequest as GrantRequestPayload;@@ -233,12 +241,27 @@ watch(const expressionList = payload.condition.expression.split(" && ");for (const expression of expressionList) {const fields = expression.split(" ");- if (fields[0] === "expired_time") {+ if (fields[0] === "request.time") {state.expiredAt = parseExpiredTimeString(fields[2]).toLocaleString();- } else if (fields[0] === "databases") {+ } else if (fields[0] === "resource.database") {const databaseIdList = [];for (const url of JSON.parse(fields[2])) {- databaseIdList.push(Number(last(url.split("/"))));+ const value = url.split("/");+ const instanceName = value[5] || "";+ const databaseName = value[7] || "";+ const instance = await instanceV1Store.getOrFetchInstanceByName(+ environmentNamePrefix + "-/" + instanceNamePrefix + instanceName+ );+ const databaseList =+ await databaseStore.getOrFetchDatabaseListByInstanceId(+ instance.uid+ );+ const database = databaseList.find(+ (db) => db.name === databaseName+ );+ if (database) {+ databaseIdList.push(database.id);+ }}state.selectedDatabaseIdList = databaseIdList;}diff --git a/frontend/src/components/Issue/logic/GrantRequestModeProvider.ts b/frontend/src/components/Issue/logic/GrantRequestModeProvider.tsindex 84db0251da..9e7c2a22ca 100644--- a/frontend/src/components/Issue/logic/GrantRequestModeProvider.ts+++ b/frontend/src/components/Issue/logic/GrantRequestModeProvider.ts@@ -25,13 +25,15 @@ export default defineComponent({databaseId);databaseNames.push(- `/v1/environments/${database.instance.environment.resourceId}/instances/${database.instance.resourceId}/databases/${database.id}`+ `/v1/environments/${database.instance.environment.resourceId}/instances/${database.instance.resourceId}/databases/${database.name}`);}- expression.push(`databases in ${JSON.stringify(databaseNames)}`);+ expression.push(+ `resource.database in ${JSON.stringify(databaseNames)}`+ );}expression.push(- `expired_time < timestamp("${new Date(+ `request.time < timestamp("${new Date(Date.now() + context.expireDays * 1000 * 60 * 60 * 24).toISOString()}")`);@@ -46,12 +48,14 @@ export default defineComponent({const database = await databaseStore.getOrFetchDatabaseById(databaseId);const databaseNames = [];databaseNames.push(- `/v1/environments/${database.instance.environment.resourceId}/instances/${database.instance.resourceId}/databases/${database.id}`+ `/v1/environments/${database.instance.environment.resourceId}/instances/${database.instance.resourceId}/databases/${database.name}`);- expression.push(`databases in ${JSON.stringify(databaseNames)}`);- expression.push(`statement == '${btoa(context.statement)}'`);- expression.push(`max_row_count == ${context.maxRowCount}`);- expression.push(`export_format == '${context.exportFormat}'`);+ expression.push(+ `resource.database in ${JSON.stringify(databaseNames)}`+ );+ expression.push(`request.statement == "${btoa(context.statement)}"`);+ expression.push(`request.row_limit == ${context.maxRowCount}`);+ expression.push(`request.export_format == "${context.exportFormat}"`);} else {throw "Invalid role";}diff --git a/frontend/src/components/Issue/logic/transition.ts b/frontend/src/components/Issue/logic/transition.tsindex 4ead73fa64..316400fdfc 100644--- a/frontend/src/components/Issue/logic/transition.ts+++ b/frontend/src/components/Issue/logic/transition.ts@@ -15,6 +15,7 @@ import {StageStatusTransition,TaskStatusTransition,TASK_STATUS_TRANSITION_LIST,+ isDatabaseRelatedIssueType,} from "@/utils";import {allowUserToBeAssignee,@@ -33,6 +34,9 @@ export const useIssueTransitionLogic = (issue: Ref<Issue>) => {if (create.value) {return false;}+ if (!isDatabaseRelatedIssueType(issue.value.type)) {+ return false;+ }if (allowUserToBeAssignee(@@ -145,9 +149,6 @@ export const calcApplicableIssueStatusTransitionList = (issue: Issue): IssueStatusTransition[] => {const currentUser = useCurrentUser();- const currentTask = activeTask(issue.pipeline);- const flattenTaskList = allTaskList(issue.pipeline);-const issueEntity = issue as Issue;const transitionTypeList: IssueStatusTransitionType[] = [];@@ -168,21 +169,25 @@ export const calcApplicableIssueStatusTransitionList = (const transition = ISSUE_STATUS_TRANSITION_LIST.get(type);if (!transition) return;- if (flattenTaskList.some((task) => task.status === "RUNNING")) {- // Disallow any issue status transition if some of the tasks are in RUNNING state.- return;- }- if (type === "RESOLVE") {- if (transition.type === "RESOLVE" && flattenTaskList.length > 0) {- const lastTask = flattenTaskList[flattenTaskList.length - 1];- // Don't display the RESOLVE action if the pipeline doesn't reach the- // last task- if (lastTask.id !== currentTask.id) {- return;- }- // Don't display the RESOLVE action if the last task is not DONE.- if (currentTask.status !== "DONE") {- return;+ if (isDatabaseRelatedIssueType(issue.type)) {+ const currentTask = activeTask(issue.pipeline);+ const flattenTaskList = allTaskList(issue.pipeline);+ if (flattenTaskList.some((task) => task.status === "RUNNING")) {+ // Disallow any issue status transition if some of the tasks are in RUNNING state.+ return;+ }+ if (type === "RESOLVE") {+ if (transition.type === "RESOLVE" && flattenTaskList.length > 0) {+ const lastTask = flattenTaskList[flattenTaskList.length - 1];+ // Don't display the RESOLVE action if the pipeline doesn't reach the+ // last task+ if (lastTask.id !== currentTask.id) {+ return;+ }+ // Don't display the RESOLVE action if the last task is not DONE.+ if (currentTask.status !== "DONE") {+ return;+ }}}}diff --git a/frontend/src/components/QuickActionPanel.vue b/frontend/src/components/QuickActionPanel.vueindex 18ba7ff5cc..4caecff0db 100644--- a/frontend/src/components/QuickActionPanel.vue+++ b/frontend/src/components/QuickActionPanel.vue@@ -184,7 +184,7 @@</h3></div>- <template v-if="isDev()">+ <template v-if="isDev() && hasCustomRoleFeature"><divv-if="quickAction === 'quickaction.bb.issue.grant.request.querier'"class="flex flex-col items-center w-24"@@ -342,6 +342,9 @@ const router = useRouter();const route = useRoute();const commandStore = useCommandStore();const subscriptionStore = useSubscriptionStore();+const hasCustomRoleFeature = computed(() => {+ return subscriptionStore.hasFeature("bb.feature.custom-role");+});const state = reactive<LocalState>({showModal: false,@@ -452,7 +455,7 @@ const createExportDataIssue = () => {query: {template: "bb.issue.grant.request",role: "EXPORTER",- name: "New grant querier request",+ name: "New grant exporter request",},};router.push(routeInfo);diff --git a/frontend/src/plugins/issue/logic/review/index.ts b/frontend/src/plugins/issue/logic/review/index.tsindex 0c31657a51..97c7fa0fb9 100644--- a/frontend/src/plugins/issue/logic/review/index.ts+++ b/frontend/src/plugins/issue/logic/review/index.ts@@ -13,7 +13,6 @@ import {import { IssueReviewContext, provideIssueReviewContext } from "./context";import { ApprovalTemplate } from "@/types/proto/store/approval";import { useProgressivePoll } from "@/composables/useProgressivePoll";-import { isGrantRequestIssueType } from "@/utils";export type ReviewEvents = {"issue-status-changed": boolean;@@ -24,9 +23,6 @@ export const extractIssueReviewContext = (review: ComputedRef<Review>): IssueReviewContext => {const ready = computed(() => {- if (issue.value && isGrantRequestIssueType(issue.value?.type)) {- return true;- }return review.value.approvalFindingDone ?? false;});const flow = computed((): ReviewFlow => {@@ -42,9 +38,6 @@ export const extractIssueReviewContext = (const done = computed(() => {if (!ready.value) return false;if (review.value.approvalFindingError) return false;- if (issue.value && isGrantRequestIssueType(issue.value?.type)) {- return issue.value.status === "DONE";- }const { template, approvers } = flow.value;const steps = template.flow?.steps ?? [];diff --git a/frontend/src/store/modules/database.ts b/frontend/src/store/modules/database.tsindex 87ed08ca8b..30bceb8caa 100644--- a/frontend/src/store/modules/database.ts+++ b/frontend/src/store/modules/database.ts@@ -1,3 +1,4 @@+import { isUndefined } from "lodash-es";import { defineStore } from "pinia";import axios from "axios";import { computed, unref, watch, markRaw } from "vue";@@ -162,6 +163,15 @@ export const useDatabaseStore = defineStore("database", {getDatabaseListByInstanceId(instanceId: InstanceId): Database[] {return this.databaseListByInstanceId.get(instanceId) || [];},+ async getOrFetchDatabaseListByInstanceId(+ instanceId: InstanceId+ ): Promise<Database[]> {+ const databaseList = this.databaseListByInstanceId.get(instanceId);+ if (isUndefined(databaseList)) {+ await this.fetchDatabaseListByInstanceId(instanceId);+ }+ return this.databaseListByInstanceId.get(instanceId) || [];+ },getDatabaseListByPrincipalId(userId: PrincipalId): Database[] {const list: Database[] = [];for (const [_, databaseList] of this.databaseListByInstanceId) {@@ -294,7 +304,7 @@ export const useDatabaseStore = defineStore("database", {const databaseList = await this.fetchDatabaseList({instanceId,});-+ this.databaseListByInstanceId.set(instanceId, databaseList);return databaseList;},async fetchDatabaseByInstanceIdAndName({diff --git a/frontend/src/types/issue.ts b/frontend/src/types/issue.tsindex c12b856c76..5adf328bdd 100644--- a/frontend/src/types/issue.ts+++ b/frontend/src/types/issue.ts@@ -93,8 +93,8 @@ export interface GrantRequestContext {// Conditions in CEL expression.databases: string[];expireDays: number;- statement: string;maxRowCount: number;+ statement: string;exportFormat: "CSV" | "JSON";}