Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

chore: remove task in plan check run related components (#11995)

boojack27a35d81ed22
diff --git a/frontend/src/components/IssueV1/components/Panel/IssueReviewActionPanel.vue b/frontend/src/components/IssueV1/components/Panel/IssueReviewActionPanel.vue
index 30495f6426..976598034b 100644
--- a/frontend/src/components/IssueV1/components/Panel/IssueReviewActionPanel.vue
+++ b/frontend/src/components/IssueV1/components/Panel/IssueReviewActionPanel.vue
@@ -19,9 +19,10 @@
<PlanCheckBar
v-if="issue.planCheckRunList.length > 0"
- :allow-run-checks="false"
class="shrink-0 flex-col gap-y-1"
label-class="!text-base"
+ :allow-run-checks="false"
+ :plan-check-run-list="issue.planCheckRunList"
/>
<div v-if="planCheckErrors.length > 0" class="flex flex-col">
diff --git a/frontend/src/components/IssueV1/components/Panel/TaskRolloutActionPanel.vue b/frontend/src/components/IssueV1/components/Panel/TaskRolloutActionPanel.vue
index 8002b952d2..d2a3d4b275 100644
--- a/frontend/src/components/IssueV1/components/Panel/TaskRolloutActionPanel.vue
+++ b/frontend/src/components/IssueV1/components/Panel/TaskRolloutActionPanel.vue
@@ -56,11 +56,14 @@
</div>
<PlanCheckBar
- v-if="action === 'ROLLOUT' || action === 'RETRY'"
- :allow-run-checks="false"
- :plan-check-run-list="planCheckRunList"
+ v-if="
+ (action === 'ROLLOUT' || action === 'RETRY') &&
+ planCheckRunList.length > 0
+ "
class="shrink-0 flex-col gap-y-1"
label-class="!text-base"
+ :allow-run-checks="false"
+ :plan-check-run-list="planCheckRunList"
/>
<div v-if="planCheckErrors.length > 0" class="flex flex-col">
@@ -109,7 +112,7 @@
<NButton
:disabled="confirmErrors.length > 0"
v-bind="taskRolloutActionButtonProps(action)"
- @click="handleConfirm(action, comment)"
+ @click="handleConfirm(action!, comment)"
>
{{ taskRolloutActionDialogButtonName(action, taskList) }}
</NButton>
diff --git a/frontend/src/components/IssueV1/components/PlanCheckSection/PlanCheckBar/PlanCheckBar.vue b/frontend/src/components/IssueV1/components/PlanCheckSection/PlanCheckBar/PlanCheckBar.vue
index 6c0a1dca5b..c70639df25 100644
--- a/frontend/src/components/IssueV1/components/PlanCheckSection/PlanCheckBar/PlanCheckBar.vue
+++ b/frontend/src/components/IssueV1/components/PlanCheckSection/PlanCheckBar/PlanCheckBar.vue
@@ -35,22 +35,17 @@
</div>
<div class="flex justify-end items-center shrink-0">
- <PlanCheckRunButton
- v-if="allowRunChecks && task"
- :task="task"
- @run-checks="runChecks"
- />
+ <PlanCheckRunButton v-if="allowRunChecks" @run-checks="runChecks" />
</div>
<div v-if="state.showPlanCheckDetail" class="w-full mt-2">
- <PlanCheckPanel :plan-check-run-list="planCheckRunList" :task="task" />
+ <PlanCheckPanel :plan-check-run-list="planCheckRunList" />
</div>
<PlanCheckModal
v-if="planCheckRunList.length > 0 && selectedType"
:selected-type="selectedType"
:plan-check-run-list="planCheckRunList"
- :task="task"
@close="selectedType = undefined"
/>
</div>
@@ -59,17 +54,15 @@
<script lang="ts" setup>
import { ChevronsUpDownIcon } from "lucide-vue-next";
import { NButton, NTooltip } from "naive-ui";
-import { computed, reactive, ref } from "vue";
+import { reactive, ref } from "vue";
import {
notifyNotEditableLegacyIssue,
- planCheckRunListForTask,
useIssueContext,
} from "@/components/IssueV1/logic";
import { rolloutServiceClient } from "@/grpcweb";
import type {
PlanCheckRun,
PlanCheckRun_Type,
- Task,
} from "@/types/proto/v1/rollout_service";
import type { VueClass } from "@/utils";
import PlanCheckBadgeBar from "./PlanCheckBadgeBar.vue";
@@ -81,12 +74,18 @@ interface LocalState {
showPlanCheckDetail: boolean;
}
-const props = defineProps<{
- allowRunChecks?: boolean;
- task?: Task;
- labelClass?: VueClass;
- planCheckRunList?: PlanCheckRun[];
-}>();
+withDefaults(
+ defineProps<{
+ allowRunChecks?: boolean;
+ labelClass?: VueClass;
+ planCheckRunList?: PlanCheckRun[];
+ }>(),
+ {
+ allowRunChecks: true,
+ labelClass: "",
+ planCheckRunList: () => [],
+ }
+);
const { issue, events } = useIssueContext();
const state = reactive<LocalState>({
@@ -94,14 +93,7 @@ const state = reactive<LocalState>({
});
const selectedType = ref<PlanCheckRun_Type>();
-const planCheckRunList = computed(() => {
- if (!props.task) {
- return props.planCheckRunList ?? issue.value.planCheckRunList;
- }
- return planCheckRunListForTask(issue.value, props.task);
-});
-
-const runChecks = (taskList: Task[]) => {
+const runChecks = () => {
const { plan } = issue.value;
if (!plan) {
notifyNotEditableLegacyIssue();
diff --git a/frontend/src/components/IssueV1/components/PlanCheckSection/PlanCheckBar/PlanCheckModal.vue b/frontend/src/components/IssueV1/components/PlanCheckSection/PlanCheckBar/PlanCheckModal.vue
index df59d9fd7e..57744031c3 100644
--- a/frontend/src/components/IssueV1/components/PlanCheckSection/PlanCheckBar/PlanCheckModal.vue
+++ b/frontend/src/components/IssueV1/components/PlanCheckSection/PlanCheckBar/PlanCheckModal.vue
@@ -1,10 +1,6 @@
<template>
<BBModal
- :title="
- task
- ? $t('task.check-result.title', { name: task.title })
- : $t('task.check-result.title-general')
- "
+ :title="$t('task.check-result.title-general')"
class="!w-[56rem]"
header-class="whitespace-pre-wrap break-all gap-x-1"
@close="$emit('close')"
@@ -12,7 +8,6 @@
<PlanCheckPanel
:plan-check-run-list="planCheckRunList"
:selected-type="selectedType"
- :task="task"
/>
</BBModal>
</template>
@@ -23,14 +18,12 @@ import { computed, ref, watch } from "vue";
import type {
PlanCheckRun,
PlanCheckRun_Type,
- Task,
} from "@/types/proto/v1/rollout_service";
import PlanCheckPanel from "./PlanCheckPanel.vue";
const props = defineProps<{
planCheckRunList: PlanCheckRun[];
selectedType: PlanCheckRun_Type;
- task?: Task;
}>();
defineEmits<{
diff --git a/frontend/src/components/IssueV1/components/PlanCheckSection/PlanCheckBar/PlanCheckPanel.vue b/frontend/src/components/IssueV1/components/PlanCheckSection/PlanCheckBar/PlanCheckPanel.vue
index 94d0263706..0de07b4c9f 100644
--- a/frontend/src/components/IssueV1/components/PlanCheckSection/PlanCheckBar/PlanCheckPanel.vue
+++ b/frontend/src/components/IssueV1/components/PlanCheckSection/PlanCheckBar/PlanCheckPanel.vue
@@ -26,14 +26,14 @@
import { first, orderBy } from "lodash-es";
import { computed, ref, watch } from "vue";
import { useI18n } from "vue-i18n";
-import { databaseForTask, useIssueContext } from "@/components/IssueV1/logic";
+import { databaseForSpec, useIssueContext } from "@/components/IssueV1/logic";
import type { TabFilterItem } from "@/components/v2";
import { TabFilter } from "@/components/v2";
+import { UNKNOWN_ID } from "@/types";
import {
PlanCheckRun_Result_Status,
PlanCheckRun_Type,
type PlanCheckRun,
- type Task,
} from "@/types/proto/v1/rollout_service";
import { humanizeDate } from "@/utils";
import PlanCheckBadgeBar from "./PlanCheckBadgeBar.vue";
@@ -42,7 +42,6 @@ import PlanCheckDetail from "./PlanCheckDetail.vue";
const props = defineProps<{
planCheckRunList: PlanCheckRun[];
selectedType?: PlanCheckRun_Type;
- task?: Task;
}>();
defineEmits<{
@@ -70,7 +69,7 @@ const getInitialSelectedType = () => {
};
const { t } = useI18n();
-const { issue } = useIssueContext();
+const { issue, selectedSpec } = useIssueContext();
const selectedTypeRef = ref<PlanCheckRun_Type>(getInitialSelectedType());
const selectedPlanCheckRunList = computed(() => {
@@ -121,11 +120,11 @@ watch(selectedPlanCheckRunList, (list) => {
});
const environment = computed(() => {
- const task = props.task;
- if (!task) {
+ const spec = selectedSpec.value;
+ if (!spec || spec.id === String(UNKNOWN_ID)) {
return;
}
- const database = databaseForTask(issue.value, task);
+ const database = databaseForSpec(issue.value, spec);
return database.effectiveEnvironmentEntity.name;
});
</script>
diff --git a/frontend/src/components/IssueV1/components/PlanCheckSection/PlanCheckBar/PlanCheckRunButton.vue b/frontend/src/components/IssueV1/components/PlanCheckSection/PlanCheckBar/PlanCheckRunButton.vue
index d24bd8c71a..5b2f7e9801 100644
--- a/frontend/src/components/IssueV1/components/PlanCheckSection/PlanCheckBar/PlanCheckRunButton.vue
+++ b/frontend/src/components/IssueV1/components/PlanCheckSection/PlanCheckBar/PlanCheckRunButton.vue
@@ -5,7 +5,7 @@
:disabled="hasRunningPlanCheck"
preference-key="issue.task.run-checks"
default-action-key="RUN-CHECKS"
- @click="$emit('run-checks', ($event as ButtonAction).params.taskList)"
+ @click="$emit('run-checks')"
>
<template #icon>
<BBSpin v-if="hasRunningPlanCheck" :size="20" />
@@ -26,32 +26,20 @@
import { computed } from "vue";
import { useI18n } from "vue-i18n";
import {
- planCheckRunListForTask,
+ planCheckRunListForSpec,
useIssueContext,
} from "@/components/IssueV1/logic";
import type { ContextMenuButtonAction } from "@/components/v2";
import { ContextMenuButton } from "@/components/v2";
import { IssueStatus } from "@/types/proto/v1/issue_service";
-import type { Task } from "@/types/proto/v1/rollout_service";
-import {
- PlanCheckRun_Status,
- Task_Status,
-} from "@/types/proto/v1/rollout_service";
-
-type ButtonAction = ContextMenuButtonAction<{
- taskList: Task[];
-}>;
-
-const props = defineProps<{
- task: Task;
-}>();
+import { PlanCheckRun_Status } from "@/types/proto/v1/rollout_service";
defineEmits<{
- (event: "run-checks", taskList: Task[]): void;
+ (event: "run-checks"): void;
}>();
const { t } = useI18n();
-const { isCreating, issue } = useIssueContext();
+const { isCreating, issue, selectedSpec } = useIssueContext();
const allowRunCheckForIssue = computed(() => {
if (isCreating.value) {
@@ -66,34 +54,24 @@ const allowRunCheckForIssue = computed(() => {
const actionList = computed(() => {
if (!allowRunCheckForIssue.value) return [];
- const actionList: ButtonAction[] = [];
- if (allowRunChecksForTask(props.task)) {
- actionList.push({
- key: "RUN-CHECKS",
- text: t("task.run-checks"),
- params: {
- taskList: [props.task],
- },
- });
- }
+ const actionList: ContextMenuButtonAction[] = [];
+ actionList.push({
+ key: "RUN-CHECKS",
+ text: t("task.run-checks"),
+ params: {},
+ });
return actionList;
});
const hasRunningPlanCheck = computed((): boolean => {
if (isCreating.value) return false;
- const planCheckRunList = planCheckRunListForTask(issue.value, props.task);
+ const planCheckRunList = planCheckRunListForSpec(
+ issue.value,
+ selectedSpec.value
+ );
return planCheckRunList.some(
(checkRun) => checkRun.status === PlanCheckRun_Status.RUNNING
);
});
-
-const allowRunChecksForTask = (task: Task) => {
- return (
- task.status === Task_Status.NOT_STARTED ||
- task.status === Task_Status.PENDING ||
- task.status === Task_Status.RUNNING ||
- task.status === Task_Status.FAILED
- );
-};
</script>
diff --git a/frontend/src/components/IssueV1/components/PlanCheckSection/PlanCheckSection.vue b/frontend/src/components/IssueV1/components/PlanCheckSection/PlanCheckSection.vue
index 3ddb97e6a1..e9bfa6c0f6 100644
--- a/frontend/src/components/IssueV1/components/PlanCheckSection/PlanCheckSection.vue
+++ b/frontend/src/components/IssueV1/components/PlanCheckSection/PlanCheckSection.vue
@@ -12,7 +12,7 @@
<PlanCheckBar
v-if="show"
:allow-run-checks="allowRunChecks"
- :task="selectedTask"
+ :plan-check-run-list="planCheckRunList"
class="px-4 py-2"
/>
</template>
@@ -21,27 +21,28 @@
import { NButton } from "naive-ui";
import { computed } from "vue";
import {
+ planCheckRunListForSpec,
+ planCheckRunListForTask,
planSpecHasPlanChecks,
- specForTask,
useIssueContext,
} from "@/components/IssueV1/logic";
import { rolloutServiceClient } from "@/grpcweb";
import { useCurrentUserV1 } from "@/store";
+import { UNKNOWN_ID } from "@/types";
import { extractUserResourceName, hasProjectPermissionV2 } from "@/utils";
import PlanCheckBar from "./PlanCheckBar";
const currentUser = useCurrentUserV1();
-const { isCreating, issue, selectedTask } = useIssueContext();
+const { isCreating, issue, selectedSpec, selectedTask } = useIssueContext();
const show = computed(() => {
if (isCreating.value) {
return false;
}
- const spec = specForTask(issue.value.planEntity, selectedTask.value);
- if (!spec) {
+ if (selectedSpec.value.id === String(UNKNOWN_ID)) {
return false;
}
- return planSpecHasPlanChecks(spec);
+ return planSpecHasPlanChecks(selectedSpec.value);
});
const allowRunChecks = computed(() => {
@@ -68,6 +69,19 @@ const allowRunChecks = computed(() => {
return false;
});
+const planCheckRunList = computed(() => {
+ // If a task is selected, show plan checks for the task.
+ if (selectedTask.value && selectedTask.value.uid !== String(UNKNOWN_ID)) {
+ return planCheckRunListForTask(issue.value, selectedTask.value);
+ }
+ // If a spec is selected, show plan checks for the spec.
+ if (selectedSpec.value && selectedSpec.value.id !== String(UNKNOWN_ID)) {
+ return planCheckRunListForSpec(issue.value, selectedSpec.value);
+ }
+ // Otherwise, show plan checks for the issue.
+ return issue.value.planCheckRunList;
+});
+
const runPlanChecks = async () => {
const plan = issue.value.planEntity;
if (!plan) return;
diff --git a/frontend/src/components/IssueV1/logic/base.ts b/frontend/src/components/IssueV1/logic/base.ts
index a5c3ba24bd..4b22e38c74 100644
--- a/frontend/src/components/IssueV1/logic/base.ts
+++ b/frontend/src/components/IssueV1/logic/base.ts
@@ -7,8 +7,9 @@ import { PROJECT_V1_ROUTE_ISSUE_DETAIL } from "@/router/dashboard/projectV1";
import { useUIStateStore } from "@/store";
import { emptyStage, emptyTask, TaskTypeListWithStatement } from "@/types";
import { TenantMode } from "@/types/proto/v1/project_service";
-import type { Stage, Task } from "@/types/proto/v1/rollout_service";
+import type { Plan_Spec, Stage, Task } from "@/types/proto/v1/rollout_service";
import { Task_Type } from "@/types/proto/v1/rollout_service";
+import { unknownPlanSpec } from "@/types/v1/issue/plan";
import {
activeStageInRollout,
activeTaskInRollout,
@@ -18,11 +19,12 @@ import {
indexOrUIDFromSlug,
stageV1Slug,
taskV1Slug,
+ flattenSpecList,
} from "@/utils";
import type { IssueContext, IssueEvents, IssuePhase } from "./context";
import { releaserCandidatesForIssue } from "./releaser";
import { extractReviewContext } from "./review";
-import { stageForTask } from "./utils";
+import { specForTask, stageForTask } from "./utils";
const state = {
uid: -101,
@@ -42,8 +44,10 @@ export const useBaseIssueContext = (
const events: IssueEvents = new Emittery();
+ const plan = computed(() => issue.value.planEntity);
const rollout = computed(() => issue.value.rolloutEntity);
const project = computed(() => issue.value.projectEntity);
+ const specs = computed(() => flattenSpecList(plan.value));
const activeStage = computed((): Stage => {
return activeStageInRollout(rollout.value);
@@ -52,6 +56,32 @@ export const useBaseIssueContext = (
return activeTaskInRollout(rollout.value);
});
+ const selectedSpec = computed((): Plan_Spec => {
+ // Check if spec is selected from URL. (Not use yet)
+ const specSlug = route.query.spec as string;
+ if (specSlug) {
+ const indexOrId = indexOrUIDFromSlug(specSlug);
+ if (isCreating.value) {
+ if (indexOrId < specs.value.length) {
+ return specs.value[indexOrId];
+ }
+ } else {
+ const specFound = specs.value.find(
+ (spec) => spec.id === String(indexOrId)
+ );
+ if (specFound) {
+ return specFound;
+ }
+ }
+ }
+
+ // Otherwise, fallback to selected task's spec.
+ if (selectedTask.value) {
+ return specForTask(plan.value, selectedTask.value) || unknownPlanSpec();
+ }
+ // Fallback to first spec.
+ return first(specs.value) || unknownPlanSpec();
+ });
const selectedStage = computed((): Stage => {
const stageSlug = route.query.stage as string;
const taskSlug = route.query.task as string;
@@ -190,6 +220,7 @@ export const useBaseIssueContext = (
activeTask,
selectedStage,
selectedTask,
+ selectedSpec,
formatOnSave,
dialog,
};
diff --git a/frontend/src/components/IssueV1/logic/context.ts b/frontend/src/components/IssueV1/logic/context.ts
index 8a1de84336..93c9c75288 100644
--- a/frontend/src/components/IssueV1/logic/context.ts
+++ b/frontend/src/components/IssueV1/logic/context.ts
@@ -6,7 +6,7 @@ import { inject, provide } from "vue";
import type { ComposedIssue, ReviewFlow } from "@/types";
import type { User } from "@/types/proto/v1/auth_service";
import type { Issue_Approver_Status } from "@/types/proto/v1/issue_service";
-import type { Stage, Task } from "@/types/proto/v1/rollout_service";
+import type { Plan_Spec, Stage, Task } from "@/types/proto/v1/rollout_service";
import type {
IssueReviewAction,
IssueStatusAction,
@@ -60,6 +60,7 @@ export type IssueContext = {
// UI status
selectedStage: Ref<Stage>;
selectedTask: Ref<Task>;
+ selectedSpec: Ref<Plan_Spec>;
formatOnSave: Ref<boolean>;
// UI events
diff --git a/frontend/src/components/IssueV1/logic/plan-check.ts b/frontend/src/components/IssueV1/logic/plan-check.ts
index 3f77210bff..a08f5af8c0 100644
--- a/frontend/src/components/IssueV1/logic/plan-check.ts
+++ b/frontend/src/components/IssueV1/logic/plan-check.ts
@@ -11,7 +11,12 @@ import {
PlanCheckRun_Type,
Task_Status,
} from "@/types/proto/v1/rollout_service";
-import { databaseForTask, sheetNameForSpec, specForTask } from ".";
+import {
+ databaseForTask,
+ sheetNameForSpec,
+ databaseForSpec,
+ specForTask,
+} from ".";
export const planSpecHasPlanChecks = (spec: Plan_Spec) => {
if (spec.createDatabaseConfig) {
@@ -41,6 +46,23 @@ export const planCheckRunListForTask = (issue: ComposedIssue, task: Task) => {
});
};
+export const planCheckRunListForSpec = (
+ issue: ComposedIssue,
+ spec: Plan_Spec
+) => {
+ const target = databaseForSpec(issue, spec).name;
+ const sheet = spec ? sheetNameForSpec(spec) : "";
+ return issue.planCheckRunList.filter((check) => {
+ if (sheet && check.sheet) {
+ // If both the task spec and the planCheckRun have `sheet`
+ // filter by sheet and target combination
+ return check.sheet === sheet && check.target === target;
+ }
+ // Otherwise filter by target only
+ return check.target === target;
+ });
+};
+
export const HiddenPlanCheckTypes = new Set<PlanCheckRun_Type>([
PlanCheckRun_Type.DATABASE_STATEMENT_SUMMARY_REPORT,
]);
diff --git a/frontend/src/components/IssueV1/logic/plan.ts b/frontend/src/components/IssueV1/logic/plan.ts
index 207c15ae28..65b3b0ca86 100644
--- a/frontend/src/components/IssueV1/logic/plan.ts
+++ b/frontend/src/components/IssueV1/logic/plan.ts
@@ -3,9 +3,16 @@ import {
useDatabaseV1Store,
useDBGroupStore,
useDeploymentConfigV1Store,
+ useInstanceV1Store,
} from "@/store";
-import { type ComposedProject, UNKNOWN_ID } from "@/types";
-import { Engine } from "@/types/proto/v1/common";
+import {
+ type ComposedProject,
+ UNKNOWN_ID,
+ type ComposedIssue,
+ unknownDatabase,
+} from "@/types";
+import { Engine, State } from "@/types/proto/v1/common";
+import { InstanceResource } from "@/types/proto/v1/instance_service";
import type { Plan_Spec } from "@/types/proto/v1/rollout_service";
import {
extractDatabaseResourceName,
@@ -14,6 +21,56 @@ import {
getPipelineFromDeploymentScheduleV1,
} from "@/utils";
+export const databaseForSpec = (issue: ComposedIssue, spec: Plan_Spec) => {
+ const { createDatabaseConfig, changeDatabaseConfig, exportDataConfig } = spec;
+ if (createDatabaseConfig !== undefined) {
+ const instance = createDatabaseConfig.target;
+ const databaseName = createDatabaseConfig.database;
+ const instanceEntity = useInstanceV1Store().getInstanceByName(instance);
+ return {
+ ...unknownDatabase(),
+ name: `${instance}/databases/${databaseName}`,
+ uid: String(UNKNOWN_ID),
+ databaseName,
+ instance,
+ instanceEntity,
+ project: issue.project,
+ projectEntity: issue.projectEntity,
+ effectiveEnvironment: instanceEntity.environment,
+ effectiveEnvironmentEntity: instanceEntity.environmentEntity,
+ };
+ } else if (
+ changeDatabaseConfig !== undefined ||
+ exportDataConfig !== undefined
+ ) {
+ // TODO(steven): handle db group and deployment config.
+ const target = (changeDatabaseConfig?.target ??
+ exportDataConfig?.target) as string;
+ const db = useDatabaseV1Store().getDatabaseByName(target);
+ if (db.uid === String(UNKNOWN_ID)) {
+ // Database not found, it's probably NOT_FOUND (maybe dropped actually)
+ // Mock a database using all known resources
+ db.project = issue.project;
+ db.projectEntity = issue.projectEntity;
+ db.name = target;
+ const { instance, databaseName } = extractDatabaseResourceName(db.name);
+ db.databaseName = databaseName;
+ db.instance = instance;
+ const instanceEntity = useInstanceV1Store().getInstanceByName(
+ db.instance
+ );
+ db.instanceEntity = instanceEntity;
+ db.instanceResource = InstanceResource.fromJSON(instanceEntity);
+ db.environment = instanceEntity.environment;
+ db.effectiveEnvironment = instanceEntity.environment;
+ db.effectiveEnvironmentEntity = instanceEntity.environmentEntity;
+ db.syncState = State.DELETED;
+ }
+ return db;
+ }
+ return unknownDatabase();
+};
+
/**
*
* @returns empty string if no sheet found
diff --git a/frontend/src/components/SQLCheck/SQLCheckPanel.vue b/frontend/src/components/SQLCheck/SQLCheckPanel.vue
index 7e492e243f..434310bfe9 100644
--- a/frontend/src/components/SQLCheck/SQLCheckPanel.vue
+++ b/frontend/src/components/SQLCheck/SQLCheckPanel.vue
@@ -22,13 +22,13 @@
v-if="confirm"
class="flex flex-row justify-end items-center gap-x-3 mt-4"
>
- <NButton @click="confirm.resolve(false)">
+ <NButton @click="confirm!.resolve(false)">
{{ $t("issue.sql-check.back-to-edit") }}
</NButton>
<NButton
v-if="!restrictIssueCreationForSQLReview"
type="primary"
- @click="confirm.resolve(true)"
+ @click="confirm!.resolve(true)"
>
{{ $t("issue.sql-check.continue-anyway") }}
</NButton>
diff --git a/frontend/src/types/v1/issue/plan.ts b/frontend/src/types/v1/issue/plan.ts
new file mode 100644
index 0000000000..9c66d29e5c
--- /dev/null
+++ b/frontend/src/types/v1/issue/plan.ts
@@ -0,0 +1,28 @@
+import { EMPTY_ID, UNKNOWN_ID } from "@/types/const";
+import { Plan, Plan_Spec } from "@/types/proto/v1/rollout_service";
+
+export const EMPTY_PLAN_NAME = `projects/${EMPTY_ID}/plans/${EMPTY_ID}`;
+export const UNKNOWN_PLAN_NAME = `projects/${UNKNOWN_ID}/plans/${UNKNOWN_ID}`;
+export const emptyPlan = () => {
+ return Plan.fromJSON({
+ name: EMPTY_PLAN_NAME,
+ uid: String(EMPTY_ID),
+ });
+};
+export const unknownPlan = () => {
+ return Plan.fromJSON({
+ name: UNKNOWN_PLAN_NAME,
+ uid: String(UNKNOWN_ID),
+ });
+};
+
+export const emptyPlanSpec = () => {
+ return Plan_Spec.fromJSON({
+ id: String(EMPTY_ID),
+ });
+};
+export const unknownPlanSpec = () => {
+ return Plan_Spec.fromJSON({
+ id: String(UNKNOWN_ID),
+ });
+};
diff --git a/frontend/src/utils/v1/issue/issue.ts b/frontend/src/utils/v1/issue/issue.ts
index 2e2a70ccb1..24488285ec 100644
--- a/frontend/src/utils/v1/issue/issue.ts
+++ b/frontend/src/utils/v1/issue/issue.ts
@@ -18,8 +18,8 @@ export const flattenTaskV1List = (rollout: Rollout | undefined) => {
return rollout?.stages.flatMap((stage) => stage.tasks) || [];
};
-export const flattenSpecList = (plan: Plan) => {
- return plan.steps.flatMap((step) => step.specs);
+export const flattenSpecList = (plan: Plan | undefined) => {
+ return plan?.steps.flatMap((step) => step.specs) || [];
};
export const isDatabaseChangeRelatedIssue = (issue: ComposedIssue): boolean => {