Skip to content

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

feat: fe connect rpc migration (#16749)

p0ny69da07204b1b
diff --git a/frontend/src/components/CreateDatabasePrepForm/CreateDatabasePrepForm.vue b/frontend/src/components/CreateDatabasePrepForm/CreateDatabasePrepForm.vue
index 70ddd206fb..fc57eb00a7 100644
--- a/frontend/src/components/CreateDatabasePrepForm/CreateDatabasePrepForm.vue
+++ b/frontend/src/components/CreateDatabasePrepForm/CreateDatabasePrepForm.vue
@@ -151,6 +151,7 @@
</template>
<script lang="ts" setup>
+import { create as createProto } from "@bufbuild/protobuf";
import { BBSpin } from "@/bbkit";
import InstanceRoleSelect from "@/components/InstanceRoleSelect.vue";
import {
@@ -174,9 +175,10 @@ import {
} from "@/types";
import { Engine } from "@/types/proto-es/v1/common_pb";
import type { InstanceRole } from "@/types/proto-es/v1/instance_role_service_pb";
-import { Issue, Issue_Type } from "@/types/proto/v1/issue_service";
-import type { Plan_CreateDatabaseConfig } from "@/types/proto/v1/plan_service";
-import { Plan, Plan_Spec } from "@/types/proto/v1/plan_service";
+import { IssueSchema, Issue_Type } from "@/types/proto-es/v1/issue_service_pb";
+import type { Plan_CreateDatabaseConfig } from "@/types/proto-es/v1/plan_service_pb";
+import { PlanSchema, Plan_SpecSchema, Plan_CreateDatabaseConfigSchema } from "@/types/proto-es/v1/plan_service_pb";
+import type { Plan_Spec } from "@/types/proto-es/v1/plan_service_pb";
import {
enginesSupportCreateDatabase,
instanceV1HasCollationAndCharacterSet,
@@ -329,7 +331,7 @@ const createV1 = async () => {
}
const specs: Plan_Spec[] = [];
- const createDatabaseConfig: Plan_CreateDatabaseConfig = {
+ const createDatabaseConfig: Plan_CreateDatabaseConfig = createProto(Plan_CreateDatabaseConfigSchema, {
target: state.instanceName,
database: databaseName,
table: tableName,
@@ -343,23 +345,26 @@ const createV1 = async () => {
defaultCollationOfEngineV1(selectedInstance.value.engine),
cluster: state.cluster,
owner,
- };
- const spec = Plan_Spec.fromPartial({
+ });
+ const spec = createProto(Plan_SpecSchema, {
id: uuidv4(),
});
specs.push(spec);
- const issueCreate = Issue.fromPartial({
+ const issueCreate = createProto(IssueSchema, {
type: Issue_Type.DATABASE_CHANGE,
creator: `users/${currentUserV1.value.email}`,
});
issueCreate.title = `${t("issue.title.create-database")} '${databaseName}'`;
- spec.createDatabaseConfig = createDatabaseConfig;
+ spec.config = {
+ case: "createDatabaseConfig",
+ value: createDatabaseConfig,
+ };
state.creating = true;
try {
- const planCreate = Plan.fromPartial({
+ const planCreate = createProto(PlanSchema, {
specs: [spec],
creator: currentUserV1.value.name,
});
diff --git a/frontend/src/components/CustomApproval/Settings/components/CustomApproval/FlowsPanel/FlowTable.vue b/frontend/src/components/CustomApproval/Settings/components/CustomApproval/FlowsPanel/FlowTable.vue
index d6d4c77961..024da57b81 100644
--- a/frontend/src/components/CustomApproval/Settings/components/CustomApproval/FlowsPanel/FlowTable.vue
+++ b/frontend/src/components/CustomApproval/Settings/components/CustomApproval/FlowsPanel/FlowTable.vue
@@ -28,7 +28,7 @@ import { BBModal } from "@/bbkit";
import { SpinnerButton } from "@/components/v2/Form";
import { pushNotification, useWorkspaceApprovalSettingStore } from "@/store";
import type { LocalApprovalRule } from "@/types";
-import type { ApprovalFlow } from "@/types/proto/v1/issue_service";
+import type { ApprovalFlow } from "@/types/proto-es/v1/issue_service_pb";
import { StepsTable } from "../common";
import { useCustomApprovalContext } from "../context";
diff --git a/frontend/src/components/CustomApproval/Settings/components/CustomApproval/common/StepsTable.vue b/frontend/src/components/CustomApproval/Settings/components/CustomApproval/common/StepsTable.vue
index 89a2624c68..084aff9a2e 100644
--- a/frontend/src/components/CustomApproval/Settings/components/CustomApproval/common/StepsTable.vue
+++ b/frontend/src/components/CustomApproval/Settings/components/CustomApproval/common/StepsTable.vue
@@ -34,14 +34,15 @@ import { useI18n } from "vue-i18n";
import { RoleSelect } from "@/components/v2";
import { SpinnerButton } from "@/components/v2/Form";
import { PresetRoleType } from "@/types";
-import type { ApprovalFlow } from "@/types/proto/v1/issue_service";
+import type { ApprovalFlow, ApprovalStep } from "@/types/proto-es/v1/issue_service_pb";
import {
ApprovalNode_Type,
- ApprovalStep,
ApprovalStep_Type,
-} from "@/types/proto/v1/issue_service";
+ ApprovalNodeSchema,
+ ApprovalStepSchema,
+} from "@/types/proto-es/v1/issue_service_pb";
+import { create } from "@bufbuild/protobuf";
import { approvalNodeText } from "@/utils";
-import { convertOldApprovalNodeToNew } from "@/utils/workspaceApprovalSetting-conversions";
import { useCustomApprovalContext } from "../context";
const props = defineProps<{
@@ -79,16 +80,16 @@ const columns = computed((): DataTableColumn<ApprovalStep>[] => {
style="width: 80%"
onUpdate:value={(val: string | string[]) => {
const role = Array.isArray(val) ? val[0] : val;
- step.nodes[0] = {
+ step.nodes[0] = create(ApprovalNodeSchema, {
type: ApprovalNode_Type.ANY_IN_GROUP,
role: role,
- };
+ });
emit("update");
}}
/>
);
}
- return approvalNodeText(convertOldApprovalNodeToNew(step.nodes[0]));
+ return approvalNodeText(step.nodes[0]);
},
},
];
@@ -145,17 +146,15 @@ const reorder = (step: ApprovalStep, index: number, offset: -1 | 1) => {
emit("update");
};
const addStep = () => {
- steps.value.push(
- ApprovalStep.fromPartial({
- type: ApprovalStep_Type.ANY,
- nodes: [
- {
- type: ApprovalNode_Type.ANY_IN_GROUP,
- role: PresetRoleType.WORKSPACE_ADMIN,
- },
- ],
- })
- );
+ steps.value.push(create(ApprovalStepSchema, {
+ type: ApprovalStep_Type.ANY,
+ nodes: [
+ create(ApprovalNodeSchema, {
+ type: ApprovalNode_Type.ANY_IN_GROUP,
+ role: PresetRoleType.WORKSPACE_ADMIN,
+ }),
+ ],
+ }));
emit("update");
};
diff --git a/frontend/src/components/CustomApproval/Settings/components/CustomApproval/logic/utils.ts b/frontend/src/components/CustomApproval/Settings/components/CustomApproval/logic/utils.ts
index 41cc873a86..3d9eb3b60a 100644
--- a/frontend/src/components/CustomApproval/Settings/components/CustomApproval/logic/utils.ts
+++ b/frontend/src/components/CustomApproval/Settings/components/CustomApproval/logic/utils.ts
@@ -1,11 +1,12 @@
import { v4 as uuidv4 } from "uuid";
+import { create as createProto } from "@bufbuild/protobuf";
import type { LocalApprovalRule } from "@/types";
-import { ApprovalTemplate } from "@/types/proto/v1/issue_service";
+import { ApprovalTemplateSchema } from "@/types/proto-es/v1/issue_service_pb";
export const emptyLocalApprovalRule = (): LocalApprovalRule => {
return {
uid: uuidv4(),
- template: ApprovalTemplate.fromPartial({
+ template: createProto(ApprovalTemplateSchema, {
flow: {
steps: [],
},
diff --git a/frontend/src/components/CustomApproval/Settings/components/CustomApproval/logic/validate.ts b/frontend/src/components/CustomApproval/Settings/components/CustomApproval/logic/validate.ts
index df0dffdbaf..775e4aded3 100644
--- a/frontend/src/components/CustomApproval/Settings/components/CustomApproval/logic/validate.ts
+++ b/frontend/src/components/CustomApproval/Settings/components/CustomApproval/logic/validate.ts
@@ -1,11 +1,11 @@
import type {
ApprovalFlow,
ApprovalTemplate,
-} from "@/types/proto/v1/issue_service";
+} from "@/types/proto-es/v1/issue_service_pb";
import {
ApprovalNode_Type,
ApprovalStep_Type,
-} from "@/types/proto/v1/issue_service";
+} from "@/types/proto-es/v1/issue_service_pb";
const validateApprovalFlow = (flow: ApprovalFlow) => {
const SupportedStepTypes = new Set([
diff --git a/frontend/src/components/GrantRequestPanel/GrantRequestPanel.vue b/frontend/src/components/GrantRequestPanel/GrantRequestPanel.vue
index f69222fe81..0c9dd0a0e2 100644
--- a/frontend/src/components/GrantRequestPanel/GrantRequestPanel.vue
+++ b/frontend/src/components/GrantRequestPanel/GrantRequestPanel.vue
@@ -59,17 +59,11 @@ import {
CreateIssueRequestSchema,
IssueSchema,
Issue_Type as NewIssue_Type,
+ GrantRequestSchema,
} from "@/types/proto-es/v1/issue_service_pb";
import type { Binding } from "@/types/proto-es/v1/iam_policy_pb";
import { BindingSchema } from "@/types/proto-es/v1/iam_policy_pb";
-import {
- GrantRequest,
- Issue,
- Issue_Type,
-} from "@/types/proto/v1/issue_service";
import { generateIssueTitle, displayRoleTitle } from "@/utils";
-import { convertDurationToOld } from "@/utils/v1/common-conversions";
-import { convertNewIssueToOld } from "@/utils/v1/issue-conversions";
interface LocalState {
binding: Binding;
@@ -120,7 +114,20 @@ const doCreateIssue = async () => {
return;
}
- const newIssue = Issue.fromPartial({
+ const grantRequest = create(GrantRequestSchema, {
+ role: state.binding.role,
+ user: `users/${currentUser.value.email}`,
+ condition: state.binding.condition,
+ expiration: formRef.value?.expirationTimestampInMS
+ ? create(DurationSchema, {
+ seconds: BigInt(
+ dayjs(formRef.value.expirationTimestampInMS).unix() - dayjs().unix()
+ ),
+ })
+ : undefined,
+ });
+
+ const newIssue = create(IssueSchema, {
title: project.value.enforceIssueTitle
? `[${t("issue.title.request-role")}] ${formRef.value?.reason}`
: generateIssueTitle(
@@ -135,55 +142,18 @@ const doCreateIssue = async () => {
})
),
description: state.binding.condition?.description,
- type: Issue_Type.GRANT_REQUEST,
- grantRequest: {},
+ type: NewIssue_Type.GRANT_REQUEST,
+ grantRequest,
});
- newIssue.grantRequest = GrantRequest.fromPartial({
- role: state.binding.role,
- user: `users/${currentUser.value.email}`,
- });
- if (state.binding.condition) {
- newIssue.grantRequest.condition = state.binding.condition;
- }
- if (formRef.value?.expirationTimestampInMS) {
- newIssue.grantRequest.expiration = convertDurationToOld(
- create(DurationSchema, {
- seconds: BigInt(
- dayjs(formRef.value.expirationTimestampInMS).unix() - dayjs().unix()
- ),
- })
- );
- }
-
const request = create(CreateIssueRequestSchema, {
parent: props.projectName,
- issue: create(IssueSchema, {
- title: newIssue.title,
- description: newIssue.description,
- type: NewIssue_Type.DATABASE_CHANGE,
- grantRequest: newIssue.grantRequest
- ? {
- role: newIssue.grantRequest.role,
- user: newIssue.grantRequest.user,
- condition: newIssue.grantRequest.condition,
- expiration: newIssue.grantRequest.expiration
- ? {
- seconds: BigInt(
- newIssue.grantRequest.expiration.seconds.toString()
- ),
- nanos: newIssue.grantRequest.expiration.nanos,
- }
- : undefined,
- }
- : undefined,
- }),
+ issue: newIssue,
});
const response = await issueServiceClientConnect.createIssue(request);
- const createdIssue = convertNewIssueToOld(response);
// TODO(ed): handle no permission
- const path = `/${createdIssue.name}`;
+ const path = `/${response.name}`;
window.open(path, "_blank");
diff --git a/frontend/src/components/IssueV1/DataExportIssueDetailPage.vue b/frontend/src/components/IssueV1/DataExportIssueDetailPage.vue
index df297f5da0..7a3e9c1b4f 100644
--- a/frontend/src/components/IssueV1/DataExportIssueDetailPage.vue
+++ b/frontend/src/components/IssueV1/DataExportIssueDetailPage.vue
@@ -65,8 +65,8 @@ import { computed, ref } from "vue";
import { FeatureAttention } from "@/components/FeatureGuard";
import { useCurrentProjectV1 } from "@/store";
import { PlanFeature } from "@/types/proto-es/v1/subscription_service_pb";
-import type { Plan, Plan_Spec } from "@/types/proto/v1/plan_service";
-import type { Task } from "@/types/proto/v1/rollout_service";
+import type { Plan, Plan_Spec } from "@/types/proto-es/v1/plan_service_pb";
+import type { Task } from "@/types/proto-es/v1/rollout_service_pb";
import { SQLCheckSection } from "../Plan/components";
import { providePlanSQLCheckContext } from "../Plan/components/SQLCheckSection";
import { provideSidebarContext } from "../Plan/logic";
diff --git a/frontend/src/components/IssueV1/IssueDetailPage.vue b/frontend/src/components/IssueV1/IssueDetailPage.vue
index b9ec70430e..4eb86226ab 100644
--- a/frontend/src/components/IssueV1/IssueDetailPage.vue
+++ b/frontend/src/components/IssueV1/IssueDetailPage.vue
@@ -68,8 +68,8 @@
import { computed, ref } from "vue";
import { FeatureAttention } from "@/components/FeatureGuard";
import { useCurrentProjectV1 } from "@/store";
-import type { Plan, Plan_Spec } from "@/types/proto/v1/plan_service";
-import { type Task } from "@/types/proto/v1/rollout_service";
+import type { Plan, Plan_Spec } from "@/types/proto-es/v1/plan_service_pb";
+import { type Task } from "@/types/proto-es/v1/rollout_service_pb";
import { PlanFeature } from "@/types/proto-es/v1/subscription_service_pb";
import { SQLCheckSection } from "../Plan/components";
import { providePlanSQLCheckContext } from "../Plan/components/SQLCheckSection";
diff --git a/frontend/src/components/IssueV1/components/BannerSection.vue b/frontend/src/components/IssueV1/components/BannerSection.vue
index d03fa72385..7cfed4b26d 100644
--- a/frontend/src/components/IssueV1/components/BannerSection.vue
+++ b/frontend/src/components/IssueV1/components/BannerSection.vue
@@ -53,8 +53,8 @@ import { computed } from "vue";
import {
IssueStatus,
Issue_Approver_Status,
-} from "@/types/proto/v1/issue_service";
-import { Task_Status } from "@/types/proto/v1/rollout_service";
+} from "@/types/proto-es/v1/issue_service_pb";
+import { Task_Status } from "@/types/proto-es/v1/rollout_service_pb";
import {
activeTaskInRollout,
isDatabaseChangeRelatedIssue,
diff --git a/frontend/src/components/IssueV1/components/CurrentApproverV1.vue b/frontend/src/components/IssueV1/components/CurrentApproverV1.vue
index b9528ec319..cb7bdcaf44 100644
--- a/frontend/src/components/IssueV1/components/CurrentApproverV1.vue
+++ b/frontend/src/components/IssueV1/components/CurrentApproverV1.vue
@@ -51,7 +51,7 @@ import {
import { useCurrentUserV1, useUserStore } from "@/store";
import { userNamePrefix } from "@/store/modules/v1/common";
import { type ComposedIssue } from "@/types";
-import { IssueStatus } from "@/types/proto/v1/issue_service";
+import { IssueStatus } from "@/types/proto-es/v1/issue_service_pb";
const props = defineProps<{
issue: ComposedIssue;
diff --git a/frontend/src/components/IssueV1/components/DataExportSection/ExportOptionSection/ExportOptionSection.vue b/frontend/src/components/IssueV1/components/DataExportSection/ExportOptionSection/ExportOptionSection.vue
index d7b4097ccc..08b1dcc113 100644
--- a/frontend/src/components/IssueV1/components/DataExportSection/ExportOptionSection/ExportOptionSection.vue
+++ b/frontend/src/components/IssueV1/components/DataExportSection/ExportOptionSection/ExportOptionSection.vue
@@ -70,19 +70,18 @@ import ErrorList from "@/components/misc/ErrorList.vue";
import { create } from "@bufbuild/protobuf";
import { planServiceClientConnect } from "@/grpcweb";
import { UpdatePlanRequestSchema } from "@/types/proto-es/v1/plan_service_pb";
-import { convertOldPlanToNew, convertNewPlanToOld } from "@/utils/v1/plan-conversions";
import { convertExportFormatToNew, convertExportFormatToOld } from "@/utils/v1/common-conversions";
import { pushNotification } from "@/store";
-import { IssueStatus } from "@/types/proto/v1/issue_service";
+import { IssueStatus } from "@/types/proto-es/v1/issue_service_pb";
import {
- Plan_Spec,
- Plan_ExportDataConfig,
-} from "@/types/proto/v1/plan_service";
+ Plan_SpecSchema,
+ Plan_ExportDataConfigSchema,
+} from "@/types/proto-es/v1/plan_service_pb";
import ExportFormatSelector from "./ExportFormatSelector.vue";
import ExportPasswordInputer from "./ExportPasswordInputer.vue";
interface LocalState {
- config: Plan_ExportDataConfig;
+ config: any;
isEditing: boolean;
}
@@ -92,11 +91,16 @@ const { issue, isCreating, selectedTask, events } = context;
const refreshKey = ref(0);
const spec = computed(
- () => head(issue.value.planEntity?.specs) || Plan_Spec.fromPartial({})
+ () => head(issue.value.planEntity?.specs) || create(Plan_SpecSchema, {})
);
const state = reactive<LocalState>({
- config: Plan_ExportDataConfig.fromPartial({ ...spec.value.exportDataConfig }),
+ config: create(Plan_ExportDataConfigSchema, spec.value.config?.case === "exportDataConfig" ? {
+ targets: spec.value.config.value.targets,
+ sheet: spec.value.config.value.sheet,
+ format: spec.value.config.value.format,
+ password: spec.value.config.value.password,
+ } : {}),
isEditing: false,
});
@@ -124,9 +128,12 @@ const convertedFormat = computed({
const handleCancelEdit = () => {
state.isEditing = false;
- state.config = Plan_ExportDataConfig.fromPartial({
- ...spec.value.exportDataConfig,
- });
+ state.config = create(Plan_ExportDataConfigSchema, spec.value.config?.case === "exportDataConfig" ? {
+ targets: spec.value.config.value.targets,
+ sheet: spec.value.config.value.sheet,
+ format: spec.value.config.value.format,
+ password: spec.value.config.value.password,
+ } : {});
// Trigger a re-render of the child components.
refreshKey.value++;
};
@@ -144,20 +151,18 @@ const handleSaveEdit = async () => {
);
for (let i = 0; i < specsToPatch.length; i++) {
const spec = specsToPatch[i];
- const config = spec.exportDataConfig;
- if (!config) continue;
- config.format = state.config.format;
- config.password = state.config.password || undefined;
+ if (spec.config?.case === "exportDataConfig") {
+ spec.config.value.format = state.config.format;
+ spec.config.value.password = state.config.password || undefined;
+ }
}
- const newPlan = convertOldPlanToNew(planPatch);
const request = create(UpdatePlanRequestSchema, {
- plan: newPlan,
+ plan: planPatch,
updateMask: { paths: ["specs"] },
});
const response = await planServiceClientConnect.updatePlan(request);
- const updatedPlan = convertNewPlanToOld(response);
- issue.value.planEntity = updatedPlan;
+ issue.value.planEntity = response;
events.emit("status-changed", { eager: true });
pushNotification({
@@ -175,11 +180,13 @@ watch(
return;
}
for (const spec of issue.value.planEntity?.specs ?? []) {
- spec.exportDataConfig = Plan_ExportDataConfig.fromPartial({
- ...spec.exportDataConfig,
- format: state.config.format,
- password: state.config.password,
- });
+ if (spec.config?.case === "exportDataConfig") {
+ spec.config.value = create(Plan_ExportDataConfigSchema, {
+ ...spec.config.value,
+ format: state.config.format,
+ password: state.config.password,
+ });
+ }
}
},
{ deep: true }
diff --git a/frontend/src/components/IssueV1/components/HeaderSection/Actions/Actions.vue b/frontend/src/components/IssueV1/components/HeaderSection/Actions/Actions.vue
index afcbb8a2d0..7e51414c56 100644
--- a/frontend/src/components/IssueV1/components/HeaderSection/Actions/Actions.vue
+++ b/frontend/src/components/IssueV1/components/HeaderSection/Actions/Actions.vue
@@ -14,7 +14,7 @@
import { asyncComputed } from "@vueuse/core";
import { computed } from "vue";
import { extractUserId, useCurrentUserV1 } from "@/store";
-import { IssueStatus } from "@/types/proto/v1/issue_service";
+import { IssueStatus } from "@/types/proto-es/v1/issue_service_pb";
import { isGrantRequestIssue, checkRoleContainsAnyPermission } from "@/utils";
import { useIssueContext } from "../../../logic";
import { CreateButton } from "./create";
diff --git a/frontend/src/components/IssueV1/components/HeaderSection/Actions/common/IssueExtraActionButtonGroup.vue b/frontend/src/components/IssueV1/components/HeaderSection/Actions/common/IssueExtraActionButtonGroup.vue
index 34e5930590..ec8791dc48 100644
--- a/frontend/src/components/IssueV1/components/HeaderSection/Actions/common/IssueExtraActionButtonGroup.vue
+++ b/frontend/src/components/IssueV1/components/HeaderSection/Actions/common/IssueExtraActionButtonGroup.vue
@@ -13,7 +13,7 @@ import {
} from "@/components/IssueV1/logic";
import { useCurrentUserV1 } from "@/store";
import { userNamePrefix } from "@/store/modules/v1/common";
-import { IssueStatus } from "@/types/proto/v1/issue_service";
+import { IssueStatus } from "@/types/proto-es/v1/issue_service_pb";
import { isDatabaseDataExportIssue } from "@/utils";
import { ExportArchiveDownloadButton } from "../request";
diff --git a/frontend/src/components/IssueV1/components/HeaderSection/Actions/common/IssueStatusActionButtonGroup/IssueStatusActionButtonGroup.vue b/frontend/src/components/IssueV1/components/HeaderSection/Actions/common/IssueStatusActionButtonGroup/IssueStatusActionButtonGroup.vue
index dadcd9a12d..5d2c5097d9 100644
--- a/frontend/src/components/IssueV1/components/HeaderSection/Actions/common/IssueStatusActionButtonGroup/IssueStatusActionButtonGroup.vue
+++ b/frontend/src/components/IssueV1/components/HeaderSection/Actions/common/IssueStatusActionButtonGroup/IssueStatusActionButtonGroup.vue
@@ -52,7 +52,7 @@ import {
issueStatusActionDisplayName,
useIssueContext,
} from "@/components/IssueV1/logic";
-import type { Task } from "@/types/proto/v1/rollout_service";
+import type { Task } from "@/types/proto-es/v1/rollout_service_pb";
import type { ExtraActionOption } from "../types";
import IssueStatusActionButton from "./IssueStatusActionButton.vue";
diff --git a/frontend/src/components/IssueV1/components/HeaderSection/Actions/common/types.ts b/frontend/src/components/IssueV1/components/HeaderSection/Actions/common/types.ts
index b4cca57ed4..e94597994e 100644
--- a/frontend/src/components/IssueV1/components/HeaderSection/Actions/common/types.ts
+++ b/frontend/src/components/IssueV1/components/HeaderSection/Actions/common/types.ts
@@ -4,7 +4,7 @@ import type {
TaskRolloutAction,
} from "@/components/IssueV1/logic";
import type { ComposedIssue } from "@/types";
-import type { Task } from "@/types/proto/v1/rollout_service";
+import type { Task } from "@/types/proto-es/v1/rollout_service_pb";
export type ExtraAction<T extends "ISSUE" | "TASK" | "TASK-BATCH"> = {
type: T;
diff --git a/frontend/src/components/IssueV1/components/HeaderSection/Actions/create/CreateButton.vue b/frontend/src/components/IssueV1/components/HeaderSection/Actions/create/CreateButton.vue
index b0acb19aa7..e357c85d07 100644
--- a/frontend/src/components/IssueV1/components/HeaderSection/Actions/create/CreateButton.vue
+++ b/frontend/src/components/IssueV1/components/HeaderSection/Actions/create/CreateButton.vue
@@ -88,9 +88,10 @@ import {
import { CreateRolloutRequestSchema } from "@/types/proto-es/v1/rollout_service_pb";
import type { Sheet } from "@/types/proto-es/v1/sheet_service_pb";
import { Advice_Status } from "@/types/proto-es/v1/sql_service_pb";
-import { Issue, Issue_Type } from "@/types/proto/v1/issue_service";
-import type { Plan_ExportDataConfig } from "@/types/proto/v1/plan_service";
-import { type Plan_ChangeDatabaseConfig } from "@/types/proto/v1/plan_service";
+import type { Issue } from "@/types/proto-es/v1/issue_service_pb";
+import { IssueSchema, Issue_Type } from "@/types/proto-es/v1/issue_service_pb";
+import type { Plan_ExportDataConfig } from "@/types/proto-es/v1/plan_service_pb";
+import { type Plan_ChangeDatabaseConfig } from "@/types/proto-es/v1/plan_service_pb";
import { databaseForTask } from "@/utils";
import {
defer,
@@ -105,14 +106,6 @@ import {
sheetNameOfTaskV1,
type Defer,
} from "@/utils";
-import {
- convertOldIssueToNew,
- convertNewIssueToOld,
-} from "@/utils/v1/issue-conversions";
-import {
- convertOldPlanToNew,
- convertNewPlanToOld,
-} from "@/utils/v1/plan-conversions";
const MAX_FORMATTABLE_STATEMENT_SIZE = 10000; // 10K characters
@@ -181,16 +174,15 @@ const doCreateIssue = async () => {
issue.value.plan = createdPlan.name;
issue.value.planEntity = createdPlan;
- const issueCreate = {
- ...Issue.fromPartial(issue.value),
+ const issueCreate = create(IssueSchema, {
+ ...issue.value,
rollout: "",
- };
+ });
const request = create(CreateIssueRequestSchema, {
parent: issue.value.project,
- issue: convertOldIssueToNew(issueCreate),
+ issue: issueCreate,
});
- const response = await issueServiceClientConnect.createIssue(request);
- const createdIssue = convertNewIssueToOld(response);
+ const createdIssue = await issueServiceClientConnect.createIssue(request);
const rolloutRequest = create(CreateRolloutRequestSchema, {
parent: issue.value.project,
@@ -223,7 +215,8 @@ const createSheets = async () => {
const specList = issue.value.planEntity?.specs ?? [];
for (const spec of specList) {
- const config = spec.changeDatabaseConfig || spec.exportDataConfig;
+ const config = spec.config?.case === "changeDatabaseConfig" ? spec.config.value :
+ spec.config?.case === "exportDataConfig" ? spec.config.value : null;
if (!config) continue;
configWithSheetList.push(config);
if (pendingCreateSheetMap.has(config.sheet)) continue;
@@ -259,13 +252,12 @@ const createSheets = async () => {
const createPlan = async () => {
const plan = issue.value.planEntity;
if (!plan) return;
- const newPlan = convertOldPlanToNew(plan);
const request = create(CreatePlanRequestSchema, {
parent: issue.value.project,
- plan: newPlan,
+ plan: plan,
});
const response = await planServiceClientConnect.createPlan(request);
- return convertNewPlanToOld(response);
+ return response;
};
const maybeFormatSQL = async (sheet: Sheet, engine: Engine) => {
diff --git a/frontend/src/components/IssueV1/components/HeaderSection/Actions/request/ExportArchiveDownloadButton.vue b/frontend/src/components/IssueV1/components/HeaderSection/Actions/request/ExportArchiveDownloadButton.vue
index 67afc26104..afd70b834c 100644
--- a/frontend/src/components/IssueV1/components/HeaderSection/Actions/request/ExportArchiveDownloadButton.vue
+++ b/frontend/src/components/IssueV1/components/HeaderSection/Actions/request/ExportArchiveDownloadButton.vue
@@ -33,19 +33,19 @@ import { useIssueContext } from "@/components/IssueV1";
import { issueServiceClientConnect } from "@/grpcweb";
import { BatchUpdateIssuesStatusRequestSchema, IssueStatus as NewIssueStatus } from "@/types/proto-es/v1/issue_service_pb";
import { useSQLStore } from "@/store";
-import { IssueStatus } from "@/types/proto/v1/issue_service";
+import { IssueStatus } from "@/types/proto-es/v1/issue_service_pb";
import { ExportFormat } from "@/types/proto-es/v1/common_pb";
import {
- Plan_ExportDataConfig,
- Plan_Spec,
-} from "@/types/proto/v1/plan_service";
+ Plan_ExportDataConfigSchema,
+ Plan_SpecSchema,
+ type Plan_ExportDataConfig,
+} from "@/types/proto-es/v1/plan_service_pb";
import {
TaskRun_ExportArchiveStatus,
Task_Status,
-} from "@/types/proto/v1/rollout_service";
+} from "@/types/proto-es/v1/rollout_service_pb";
import { ExportRequestSchema } from "@/types/proto-es/v1/sql_service_pb";
import { flattenTaskV1List } from "@/utils";
-import { convertExportFormatToNew } from "@/utils/v1/common-conversions";
interface LocalState {
isExporting: boolean;
@@ -61,10 +61,8 @@ const taskRun = computed(() => {
});
const exportDataConfig = computed(() => {
- return (
- (head(issue.value.planEntity?.specs) || Plan_Spec.fromPartial({}))
- .exportDataConfig || Plan_ExportDataConfig.fromPartial({})
- );
+ const spec = head(issue.value.planEntity?.specs) || create(Plan_SpecSchema, {});
+ return spec.config?.value as Plan_ExportDataConfig || create(Plan_ExportDataConfigSchema, {});
});
watchEffect(async () => {
@@ -111,7 +109,7 @@ const getExportFileType = (exportDataConfig: Plan_ExportDataConfig) => {
if (exportDataConfig.password) {
return "application/zip";
}
- switch (convertExportFormatToNew(exportDataConfig.format)) {
+ switch (exportDataConfig.format) {
case ExportFormat.CSV:
return "text/csv";
case ExportFormat.JSON:
diff --git a/frontend/src/components/IssueV1/components/HeaderSection/Actions/review/IssueReviewButtonGroup.vue b/frontend/src/components/IssueV1/components/HeaderSection/Actions/review/IssueReviewButtonGroup.vue
index 1342e80add..51161d48d1 100644
--- a/frontend/src/components/IssueV1/components/HeaderSection/Actions/review/IssueReviewButtonGroup.vue
+++ b/frontend/src/components/IssueV1/components/HeaderSection/Actions/review/IssueReviewButtonGroup.vue
@@ -32,7 +32,7 @@ import { useCurrentUserV1, extractUserId, useCurrentProjectV1 } from "@/store";
import {
IssueStatus,
Issue_Approver_Status,
-} from "@/types/proto/v1/issue_service";
+} from "@/types/proto-es/v1/issue_service_pb";
import {
isDatabaseChangeRelatedIssue,
hasWorkspacePermissionV2,
diff --git a/frontend/src/components/IssueV1/components/HeaderSection/Actions/rollout/CombinedRolloutButtonGroup.vue b/frontend/src/components/IssueV1/components/HeaderSection/Actions/rollout/CombinedRolloutButtonGroup.vue
index a44de49af1..c1bee5eb8a 100644
--- a/frontend/src/components/IssueV1/components/HeaderSection/Actions/rollout/CombinedRolloutButtonGroup.vue
+++ b/frontend/src/components/IssueV1/components/HeaderSection/Actions/rollout/CombinedRolloutButtonGroup.vue
@@ -32,7 +32,7 @@ import {
getApplicableTaskRolloutActionList,
useIssueContext,
} from "@/components/IssueV1/logic";
-import type { Task } from "@/types/proto/v1/rollout_service";
+import type { Task } from "@/types/proto-es/v1/rollout_service_pb";
import { isDatabaseDataExportIssue } from "@/utils";
import type { ExtraActionOption } from "../common";
import {
diff --git a/frontend/src/components/IssueV1/components/HeaderSection/Actions/rollout/RolloutActionButton.vue b/frontend/src/components/IssueV1/components/HeaderSection/Actions/rollout/RolloutActionButton.vue
index 0bca637bd2..cefa6b3d09 100644
--- a/frontend/src/components/IssueV1/components/HeaderSection/Actions/rollout/RolloutActionButton.vue
+++ b/frontend/src/components/IssueV1/components/HeaderSection/Actions/rollout/RolloutActionButton.vue
@@ -93,7 +93,7 @@ const actionList = computed(() => {
tag: "div",
disabled: errors.value.length > 0,
};
- if (selectedTask.value.databaseDataExport) {
+ if (selectedTask.value.payload?.case === "databaseDataExport") {
return [
{
key: `${action}-STAGE`,
diff --git a/frontend/src/components/IssueV1/components/HeaderSection/HeaderSection.vue b/frontend/src/components/IssueV1/components/HeaderSection/HeaderSection.vue
index 75bd01281c..e7ea8a0855 100644
--- a/frontend/src/components/IssueV1/components/HeaderSection/HeaderSection.vue
+++ b/frontend/src/components/IssueV1/components/HeaderSection/HeaderSection.vue
@@ -35,7 +35,7 @@ import { MenuIcon } from "lucide-vue-next";
import { NButton } from "naive-ui";
import { computed } from "vue";
import { useSidebarContext } from "@/components/Plan";
-import { Task_Status } from "@/types/proto/v1/rollout_service";
+import { Task_Status } from "@/types/proto-es/v1/rollout_service_pb";
import { activeTaskInRollout, isDatabaseChangeRelatedIssue } from "@/utils";
import { useIssueContext } from "../../logic";
import IssueStatusIcon from "../IssueStatusIcon.vue";
diff --git a/frontend/src/components/IssueV1/components/IssueCommentSection/IssueCommentList.vue b/frontend/src/components/IssueV1/components/IssueCommentSection/IssueCommentList.vue
index f020ffd8fc..c23747e358 100644
--- a/frontend/src/components/IssueV1/components/IssueCommentSection/IssueCommentList.vue
+++ b/frontend/src/components/IssueV1/components/IssueCommentSection/IssueCommentList.vue
@@ -115,6 +115,7 @@ import { PencilIcon } from "lucide-vue-next";
import { NButton } from "naive-ui";
import { computed, onMounted, reactive, ref, watch, watchEffect } from "vue";
import { useRoute } from "vue-router";
+import { create } from "@bufbuild/protobuf";
import MarkdownEditor from "@/components/MarkdownEditor";
import UserAvatar from "@/components/User/UserAvatar.vue";
import {
@@ -127,7 +128,7 @@ import {
} from "@/store";
import { isValidProjectName } from "@/types";
import type { ComposedIssue } from "@/types";
-import { ListIssueCommentsRequest } from "@/types/proto/v1/issue_service";
+import { ListIssueCommentsRequestSchema } from "@/types/proto-es/v1/issue_service_pb";
import { hasProjectPermissionV2 } from "@/utils";
import { useIssueContext } from "../../logic";
import {
@@ -181,7 +182,7 @@ const prepareIssueListForMarkdownEditor = async () => {
const prepareIssueComments = async () => {
await issueCommentStore.listIssueComments(
- ListIssueCommentsRequest.fromPartial({
+ create(ListIssueCommentsRequestSchema, {
parent: issue.value.name,
// Try to get all comments at once with max page size.
pageSize: 1000,
diff --git a/frontend/src/components/IssueV1/components/IssueCommentSection/IssueCommentView/ActionIcon.vue b/frontend/src/components/IssueV1/components/IssueCommentSection/IssueCommentView/ActionIcon.vue
index c6c5d78a29..71f033668f 100644
--- a/frontend/src/components/IssueV1/components/IssueCommentSection/IssueCommentView/ActionIcon.vue
+++ b/frontend/src/components/IssueV1/components/IssueCommentSection/IssueCommentView/ActionIcon.vue
@@ -124,13 +124,9 @@ import {
} from "@/store";
import { extractUserId } from "@/store";
import {
- IssueComment_Approval,
IssueComment_Approval_Status,
- IssueComment_IssueUpdate,
- IssueComment_TaskPriorBackup,
- IssueComment_TaskUpdate,
IssueComment_TaskUpdate_Status,
-} from "@/types/proto/v1/issue_service";
+} from "@/types/proto-es/v1/issue_service_pb";
type ActionIconType =
| "avatar"
@@ -160,10 +156,8 @@ const user = computedAsync(() => {
const icon = computed((): ActionIconType => {
const { issueComment } = props;
- if (issueComment.type === IssueCommentType.APPROVAL) {
- const { status } = IssueComment_Approval.fromPartial(
- issueComment.approval || {}
- );
+ if (issueComment.type === IssueCommentType.APPROVAL && issueComment.event?.case === "approval") {
+ const { status } = issueComment.event.value;
switch (status) {
case IssueComment_Approval_Status.APPROVED:
return "approve-review";
@@ -174,10 +168,8 @@ const icon = computed((): ActionIconType => {
}
} else if (issueComment.type === IssueCommentType.STAGE_END) {
return "complete";
- } else if (issueComment.type === IssueCommentType.TASK_UPDATE) {
- const { toStatus } = IssueComment_TaskUpdate.fromPartial(
- issueComment.taskUpdate || {}
- );
+ } else if (issueComment.type === IssueCommentType.TASK_UPDATE && issueComment.event?.case === "taskUpdate") {
+ const { toStatus } = issueComment.event.value;
let action: ActionIconType = "update";
if (toStatus !== undefined) {
switch (toStatus) {
@@ -208,9 +200,8 @@ const icon = computed((): ActionIconType => {
}
}
return action;
- } else if (issueComment.type === IssueCommentType.ISSUE_UPDATE) {
- const { toTitle, toDescription, toLabels, fromLabels } =
- IssueComment_IssueUpdate.fromPartial(issueComment.issueUpdate || {});
+ } else if (issueComment.type === IssueCommentType.ISSUE_UPDATE && issueComment.event?.case === "issueUpdate") {
+ const { toTitle, toDescription, toLabels, fromLabels } = issueComment.event.value;
if (
toTitle !== undefined ||
toDescription !== undefined ||
@@ -220,10 +211,8 @@ const icon = computed((): ActionIconType => {
return "update";
}
// Otherwise, show avatar icon based on the creator.
- } else if (issueComment.type === IssueCommentType.TASK_PRIOR_BACKUP) {
- const taskPriorBackup = IssueComment_TaskPriorBackup.fromPartial(
- issueComment.taskPriorBackup || {}
- );
+ } else if (issueComment.type === IssueCommentType.TASK_PRIOR_BACKUP && issueComment.event?.case === "taskPriorBackup") {
+ const taskPriorBackup = issueComment.event.value;
if (taskPriorBackup.error !== "") {
return "fail";
} else {
diff --git a/frontend/src/components/IssueV1/components/IssueCommentSection/IssueCommentView/ActionSentence.vue b/frontend/src/components/IssueV1/components/IssueCommentSection/IssueCommentView/ActionSentence.vue
index 9d61efe41a..d86c2a158c 100644
--- a/frontend/src/components/IssueV1/components/IssueCommentSection/IssueCommentView/ActionSentence.vue
+++ b/frontend/src/components/IssueV1/components/IssueCommentSection/IssueCommentView/ActionSentence.vue
@@ -14,15 +14,10 @@ import {
import { extractUserId } from "@/store";
import { type ComposedIssue } from "@/types";
import {
- IssueComment_Approval,
IssueComment_Approval_Status,
- IssueComment_IssueUpdate,
- IssueComment_StageEnd,
- IssueComment_TaskPriorBackup,
- IssueComment_TaskUpdate,
IssueComment_TaskUpdate_Status,
IssueStatus,
-} from "@/types/proto/v1/issue_service";
+} from "@/types/proto-es/v1/issue_service_pb";
import { findStageByName, findTaskByName } from "@/utils";
import StageName from "./StageName.vue";
import StatementUpdate from "./StatementUpdate.vue";
@@ -40,10 +35,8 @@ const userStore = useUserStore();
const renderActionSentence = () => {
const { issueComment, issue } = props;
- if (issueComment.type === IssueCommentType.APPROVAL) {
- const { status } = IssueComment_Approval.fromPartial(
- issueComment.approval || {}
- );
+ if (issueComment.type === IssueCommentType.APPROVAL && issueComment.event?.case === "approval") {
+ const { status } = issueComment.event.value;
let verb = "";
if (status === IssueComment_Approval_Status.APPROVED) {
verb = t("custom-approval.issue-review.approved-issue");
@@ -55,7 +48,7 @@ const renderActionSentence = () => {
if (verb) {
return maybeAutomaticallyVerb(issueComment, verb);
}
- } else if (issueComment.type === IssueCommentType.ISSUE_UPDATE) {
+ } else if (issueComment.type === IssueCommentType.ISSUE_UPDATE && issueComment.event?.case === "issueUpdate") {
const {
fromTitle,
toTitle,
@@ -65,7 +58,7 @@ const renderActionSentence = () => {
toStatus,
fromLabels,
toLabels,
- } = IssueComment_IssueUpdate.fromPartial(issueComment.issueUpdate || {});
+ } = issueComment.event.value;
if (fromTitle !== undefined && toTitle !== undefined) {
return t("activity.sentence.changed-from-to", {
name: t("issue.issue-name").toLowerCase(),
@@ -86,10 +79,8 @@ const renderActionSentence = () => {
} else if (fromLabels.length !== 0 || toLabels.length !== 0) {
return t("activity.sentence.changed-labels");
}
- } else if (issueComment.type === IssueCommentType.STAGE_END) {
- const { stage } = IssueComment_StageEnd.fromPartial(
- issueComment.stageEnd || {}
- );
+ } else if (issueComment.type === IssueCommentType.STAGE_END && issueComment.event?.case === "stageEnd") {
+ const { stage } = issueComment.event.value;
const stageEntity = findStageByName(issue.rolloutEntity, stage);
const params: VerbTypeTarget = {
issueComment,
@@ -98,9 +89,8 @@ const renderActionSentence = () => {
verb: t("activity.sentence.completed"),
};
return renderVerbTypeTarget(params);
- } else if (issueComment.type === IssueCommentType.TASK_UPDATE) {
- const { tasks, fromSheet, toSheet, toStatus } =
- IssueComment_TaskUpdate.fromPartial(issueComment.taskUpdate || {});
+ } else if (issueComment.type === IssueCommentType.TASK_UPDATE && issueComment.event?.case === "taskUpdate") {
+ const { tasks, fromSheet, toSheet, toStatus } = issueComment.event.value;
if (toStatus !== undefined) {
const params: VerbTypeTarget = {
@@ -159,11 +149,8 @@ const renderActionSentence = () => {
</Translation>
);
}
- } else if (issueComment.type === IssueCommentType.TASK_PRIOR_BACKUP) {
- const { task, tables, originalLine, database, error } =
- IssueComment_TaskPriorBackup.fromPartial(
- issueComment.taskPriorBackup || {}
- );
+ } else if (issueComment.type === IssueCommentType.TASK_PRIOR_BACKUP && issueComment.event?.case === "taskPriorBackup") {
+ const { task, tables, originalLine, database, error } = issueComment.event.value;
if (error) {
return t("activity.sentence.failed-to-backup", { error });
}
diff --git a/frontend/src/components/IssueV1/components/IssueCommentSection/IssueCommentView/IssueCommentAction.vue b/frontend/src/components/IssueV1/components/IssueCommentSection/IssueCommentView/IssueCommentAction.vue
index 2edc3d4328..52a7a2c30f 100644
--- a/frontend/src/components/IssueV1/components/IssueCommentSection/IssueCommentView/IssueCommentAction.vue
+++ b/frontend/src/components/IssueV1/components/IssueCommentSection/IssueCommentView/IssueCommentAction.vue
@@ -14,20 +14,20 @@
<ActionSentence :issue="issue" :issue-comment="issueComment" />
<HumanizeTs
- :ts="getTimeForPbTimestamp(issueComment.createTime, 0) / 1000"
+ :ts="getTimeForPbTimestampProtoEs(issueComment.createTime, 0) / 1000"
class="ml-1 text-gray-400"
/>
<span
v-if="
- getTimeForPbTimestamp(issueComment.createTime) !==
- getTimeForPbTimestamp(issueComment.updateTime) &&
+ getTimeForPbTimestampProtoEs(issueComment.createTime) !==
+ getTimeForPbTimestampProtoEs(issueComment.updateTime) &&
issueComment.type === IssueCommentType.USER_COMMENT
"
>
<span class="opacity-80">({{ $t("common.edited") }}</span>
<HumanizeTs
- :ts="getTimeForPbTimestamp(issueComment.updateTime, 0) / 1000"
+ :ts="getTimeForPbTimestampProtoEs(issueComment.updateTime, 0) / 1000"
class="ml-1"
/>)
</span>
@@ -56,7 +56,7 @@
import HumanizeTs from "@/components/misc/HumanizeTs.vue";
import { IssueCommentType, type ComposedIssueComment } from "@/store";
import { useUserStore, extractUserId } from "@/store";
-import { getTimeForPbTimestamp, type ComposedIssue } from "@/types";
+import { getTimeForPbTimestampProtoEs, type ComposedIssue } from "@/types";
import ActionCreator from "./ActionCreator.vue";
import ActionSentence from "./ActionSentence.vue";
diff --git a/frontend/src/components/IssueV1/components/IssueCommentSection/IssueCommentView/IssueCreatedComment.vue b/frontend/src/components/IssueV1/components/IssueCommentSection/IssueCommentView/IssueCreatedComment.vue
index 6ec6214a1d..a4917e37c4 100644
--- a/frontend/src/components/IssueV1/components/IssueCommentSection/IssueCommentView/IssueCreatedComment.vue
+++ b/frontend/src/components/IssueV1/components/IssueCommentSection/IssueCommentView/IssueCreatedComment.vue
@@ -23,7 +23,7 @@
<ActionCreator :creator="issue.creator" />
<span>{{ $t("activity.sentence.created-issue") }}</span>
<HumanizeTs
- :ts="getTimeForPbTimestamp(issue.createTime, 0) / 1000"
+ :ts="getTimeForPbTimestampProtoEs(issue.createTime, 0) / 1000"
class="ml-1 text-gray-400"
/>
</div>
@@ -37,7 +37,7 @@
<script lang="ts" setup>
import { PlusIcon } from "lucide-vue-next";
import HumanizeTs from "@/components/misc/HumanizeTs.vue";
-import { getTimeForPbTimestamp, type ComposedIssue } from "@/types";
+import { getTimeForPbTimestampProtoEs, type ComposedIssue } from "@/types";
import ActionCreator from "./ActionCreator.vue";
import type { DistinctIssueComment } from "./common";
diff --git a/frontend/src/components/IssueV1/components/IssueCommentSection/IssueCommentView/StageName.vue b/frontend/src/components/IssueV1/components/IssueCommentSection/IssueCommentView/StageName.vue
index 0b00cd0b5e..ece2a0291b 100644
--- a/frontend/src/components/IssueV1/components/IssueCommentSection/IssueCommentView/StageName.vue
+++ b/frontend/src/components/IssueV1/components/IssueCommentSection/IssueCommentView/StageName.vue
@@ -8,7 +8,7 @@
import { computed } from "vue";
import { useEnvironmentV1Store } from "@/store";
import type { ComposedIssue } from "@/types";
-import type { Stage } from "@/types/proto/v1/rollout_service";
+import type { Stage } from "@/types/proto-es/v1/rollout_service_pb";
const props = defineProps<{
issue: ComposedIssue;
diff --git a/frontend/src/components/IssueV1/components/IssueCommentSection/IssueCommentView/TaskName.vue b/frontend/src/components/IssueV1/components/IssueCommentSection/IssueCommentView/TaskName.vue
index ccec005c14..871cd5f8b9 100644
--- a/frontend/src/components/IssueV1/components/IssueCommentSection/IssueCommentView/TaskName.vue
+++ b/frontend/src/components/IssueV1/components/IssueCommentSection/IssueCommentView/TaskName.vue
@@ -23,7 +23,7 @@ import { computed } from "vue";
import { stageForTask, projectOfIssue } from "@/components/IssueV1/logic";
import { PROJECT_V1_ROUTE_ISSUE_DETAIL } from "@/router/dashboard/projectV1";
import type { ComposedIssue } from "@/types";
-import type { Task } from "@/types/proto/v1/rollout_service";
+import type { Task } from "@/types/proto-es/v1/rollout_service_pb";
import { databaseForTask } from "@/utils";
import {
extractProjectResourceName,
diff --git a/frontend/src/components/IssueV1/components/IssueCommentSection/IssueCommentView/common.ts b/frontend/src/components/IssueV1/components/IssueCommentSection/IssueCommentView/common.ts
index 05dc3983f2..7f6faf33a1 100644
--- a/frontend/src/components/IssueV1/components/IssueCommentSection/IssueCommentView/common.ts
+++ b/frontend/src/components/IssueV1/components/IssueCommentSection/IssueCommentView/common.ts
@@ -15,8 +15,8 @@ export const isSimilarIssueComment = (
}
if (a.type === IssueCommentType.TASK_UPDATE) {
- const fromTaskUpdate = a.taskUpdate;
- const toTaskUpdate = b.taskUpdate;
+ const fromTaskUpdate = a.event?.case === "taskUpdate" ? a.event.value : null;
+ const toTaskUpdate = b.event?.case === "taskUpdate" ? b.event.value : null;
if (!fromTaskUpdate || !toTaskUpdate) {
return false;
}
@@ -34,21 +34,23 @@ export const isSimilarIssueComment = (
}
}
if (a.type === IssueCommentType.ISSUE_UPDATE) {
+ const aIssueUpdate = a.event?.case === "issueUpdate" ? a.event.value : null;
+ const bIssueUpdate = b.event?.case === "issueUpdate" ? b.event.value : null;
if (
- !isNullOrUndefined(a.issueUpdate?.toTitle) &&
- !isNullOrUndefined(b.issueUpdate?.toTitle)
+ !isNullOrUndefined(aIssueUpdate?.toTitle) &&
+ !isNullOrUndefined(bIssueUpdate?.toTitle)
) {
return true;
}
if (
- !isNullOrUndefined(a.issueUpdate?.toDescription) &&
- !isNullOrUndefined(b.issueUpdate?.toDescription)
+ !isNullOrUndefined(aIssueUpdate?.toDescription) &&
+ !isNullOrUndefined(bIssueUpdate?.toDescription)
) {
return true;
}
if (
- !isNullOrUndefined(a.issueUpdate?.toLabels) &&
- !isNullOrUndefined(b.issueUpdate?.toLabels)
+ !isNullOrUndefined(aIssueUpdate?.toLabels) &&
+ !isNullOrUndefined(bIssueUpdate?.toLabels)
) {
return true;
}
diff --git a/frontend/src/components/IssueV1/components/IssueStatusIcon.vue b/frontend/src/components/IssueV1/components/IssueStatusIcon.vue
index 8a9d42b0ff..0618840f73 100644
--- a/frontend/src/components/IssueV1/components/IssueStatusIcon.vue
+++ b/frontend/src/components/IssueV1/components/IssueStatusIcon.vue
@@ -48,7 +48,7 @@
isUnfinishedResolvedIssue
? $t("issue.unfinished-resolved-issue-tips")
: $t(
- `issue.status.${issueStatusToJSON(props.issueStatus).toLowerCase()}`
+ `issue.status.${IssueStatus[props.issueStatus].toLowerCase()}`
)
}}
</div>
@@ -61,8 +61,8 @@ import { NTooltip } from "naive-ui";
import type { PropType } from "vue";
import { computed } from "vue";
import type { ComposedIssue } from "@/types";
-import { IssueStatus, issueStatusToJSON } from "@/types/proto/v1/issue_service";
-import { Task_Status } from "@/types/proto/v1/rollout_service";
+import { IssueStatus } from "@/types/proto-es/v1/issue_service_pb";
+import { Task_Status } from "@/types/proto-es/v1/rollout_service_pb";
import { isUnfinishedResolvedTask as checkUnfinishedResolvedTask } from "../logic";
export type SizeType = "small" | "normal";
@@ -70,11 +70,11 @@ export type SizeType = "small" | "normal";
const props = defineProps({
issueStatus: {
required: true,
- type: String as PropType<IssueStatus>,
+ type: Number as PropType<IssueStatus>,
},
// Specify taskStatus if we want to show the task specific status when issueStatus is OPEN.
taskStatus: {
- type: String as PropType<Task_Status>,
+ type: Number as PropType<Task_Status>,
default: undefined,
},
size: {
diff --git a/frontend/src/components/IssueV1/components/IssueStatusIconWithTaskSummary.vue b/frontend/src/components/IssueV1/components/IssueStatusIconWithTaskSummary.vue
index f67c3e4600..7deeb0acdf 100644
--- a/frontend/src/components/IssueV1/components/IssueStatusIconWithTaskSummary.vue
+++ b/frontend/src/components/IssueV1/components/IssueStatusIconWithTaskSummary.vue
@@ -22,7 +22,7 @@ import { NTooltip } from "naive-ui";
import { computed } from "vue";
import { useI18n } from "vue-i18n";
import type { ComposedIssue } from "@/types";
-import { IssueStatus } from "@/types/proto/v1/issue_service";
+import { IssueStatus } from "@/types/proto-es/v1/issue_service_pb";
import IssueStatusIcon from "./IssueStatusIcon.vue";
const props = defineProps<{
diff --git a/frontend/src/components/IssueV1/components/IssueTableV1.vue b/frontend/src/components/IssueV1/components/IssueTableV1.vue
index eefd8ef50a..e7a9c8d19b 100644
--- a/frontend/src/components/IssueV1/components/IssueTableV1.vue
+++ b/frontend/src/components/IssueV1/components/IssueTableV1.vue
@@ -53,7 +53,7 @@ import { emitWindowEvent } from "@/plugins";
import { PROJECT_V1_ROUTE_ISSUE_DETAIL } from "@/router/dashboard/projectV1";
import { useUserStore } from "@/store";
import {
- getTimeForPbTimestamp,
+ getTimeForPbTimestampProtoEs,
unknownUser,
type ComposedIssue,
} from "@/types";
@@ -219,7 +219,7 @@ const columnList = computed((): DataTableColumn<ComposedIssue>[] => {
width: 150,
hide: !showExtendedColumns.value,
render: (issue) =>
- humanizeTs(getTimeForPbTimestamp(issue.updateTime, 0) / 1000),
+ humanizeTs(getTimeForPbTimestampProtoEs(issue.updateTime, 0) / 1000),
},
{
key: "approver",
diff --git a/frontend/src/components/IssueV1/components/Panel/IssueReviewActionPanel.vue b/frontend/src/components/IssueV1/components/Panel/IssueReviewActionPanel.vue
index d8d6189c39..3d7cbeec6b 100644
--- a/frontend/src/components/IssueV1/components/Panel/IssueReviewActionPanel.vue
+++ b/frontend/src/components/IssueV1/components/Panel/IssueReviewActionPanel.vue
@@ -118,7 +118,7 @@ import {
RejectIssueRequestSchema,
RequestIssueRequestSchema,
} from "@/types/proto-es/v1/issue_service_pb";
-import { Issue_Approver_Status } from "@/types/proto/v1/issue_service";
+import { Issue_Approver_Status } from "@/types/proto-es/v1/issue_service_pb";
import { databaseForTask } from "@/utils";
import { ErrorList } from "../common";
import CommonDrawer from "./CommonDrawer.vue";
diff --git a/frontend/src/components/IssueV1/components/Panel/IssueStatusActionPanel.vue b/frontend/src/components/IssueV1/components/Panel/IssueStatusActionPanel.vue
index e8c8cd300a..528893dddb 100644
--- a/frontend/src/components/IssueV1/components/Panel/IssueStatusActionPanel.vue
+++ b/frontend/src/components/IssueV1/components/Panel/IssueStatusActionPanel.vue
@@ -103,7 +103,7 @@ import { create } from "@bufbuild/protobuf";
import ErrorList from "@/components/misc/ErrorList.vue";
import { issueServiceClientConnect } from "@/grpcweb";
import { pushNotification } from "@/store";
-import { Task_Status } from "@/types/proto/v1/rollout_service";
+import { Task_Status } from "@/types/proto-es/v1/rollout_service_pb";
import { BatchUpdateIssuesStatusRequestSchema } from "@/types/proto-es/v1/issue_service_pb";
import { flattenTaskV1List } from "@/utils";
import CommonDrawer from "./CommonDrawer.vue";
diff --git a/frontend/src/components/IssueV1/components/Panel/RolloutTaskDatabaseName.vue b/frontend/src/components/IssueV1/components/Panel/RolloutTaskDatabaseName.vue
index f3f64dd2f2..8405158ee1 100644
--- a/frontend/src/components/IssueV1/components/Panel/RolloutTaskDatabaseName.vue
+++ b/frontend/src/components/IssueV1/components/Panel/RolloutTaskDatabaseName.vue
@@ -20,7 +20,7 @@ import { NPerformantEllipsis } from "naive-ui";
import { computed } from "vue";
import { InstanceV1Name } from "@/components/v2";
import { useCurrentProjectV1 } from "@/store";
-import type { Task } from "@/types/proto/v1/rollout_service";
+import type { Task } from "@/types/proto-es/v1/rollout_service_pb";
import { databaseForTask } from "@/utils";
const props = defineProps<{
diff --git a/frontend/src/components/IssueV1/components/Panel/TaskRolloutActionPanel.vue b/frontend/src/components/IssueV1/components/Panel/TaskRolloutActionPanel.vue
index dc67b5aabc..bccd7c488e 100644
--- a/frontend/src/components/IssueV1/components/Panel/TaskRolloutActionPanel.vue
+++ b/frontend/src/components/IssueV1/components/Panel/TaskRolloutActionPanel.vue
@@ -227,8 +227,8 @@ import {
BatchSkipTasksRequestSchema,
BatchCancelTaskRunsRequestSchema,
} from "@/types/proto-es/v1/rollout_service_pb";
-import type { Task, TaskRun } from "@/types/proto/v1/rollout_service";
-import { Task_Status, TaskRun_Status } from "@/types/proto/v1/rollout_service";
+import type { Task, TaskRun } from "@/types/proto-es/v1/rollout_service_pb";
+import { Task_Status, TaskRun_Status } from "@/types/proto-es/v1/rollout_service_pb";
import { databaseForTask } from "@/utils";
import { ErrorList } from "../common";
import CommonDrawer from "./CommonDrawer.vue";
diff --git a/frontend/src/components/IssueV1/components/Sidebar/PreBackupSection/PreBackupSection.vue b/frontend/src/components/IssueV1/components/Sidebar/PreBackupSection/PreBackupSection.vue
index 16358cfefa..e4a8eb8380 100644
--- a/frontend/src/components/IssueV1/components/Sidebar/PreBackupSection/PreBackupSection.vue
+++ b/frontend/src/components/IssueV1/components/Sidebar/PreBackupSection/PreBackupSection.vue
@@ -13,8 +13,8 @@ import {
import { PreBackupSection } from "@/components/Plan/components/Configuration";
import { providePreBackupSettingContext } from "@/components/Plan/components/Configuration/PreBackupSection/context";
import { useCurrentProjectV1 } from "@/store";
-import type { Plan } from "@/types/proto/v1/plan_service";
-import { TaskRun_Status } from "@/types/proto/v1/rollout_service";
+import type { Plan } from "@/types/proto-es/v1/plan_service_pb";
+import { TaskRun_Status } from "@/types/proto-es/v1/rollout_service_pb";
import { databaseForTask } from "@/utils";
import TaskRollbackSection from "./TaskRollbackSection.vue";
import { ROLLBACK_AVAILABLE_ENGINES } from "./common";
diff --git a/frontend/src/components/IssueV1/components/Sidebar/ReleaseInfo.vue b/frontend/src/components/IssueV1/components/Sidebar/ReleaseInfo.vue
index 7ff2339a70..785663c3af 100644
--- a/frontend/src/components/IssueV1/components/Sidebar/ReleaseInfo.vue
+++ b/frontend/src/components/IssueV1/components/Sidebar/ReleaseInfo.vue
@@ -27,11 +27,13 @@ import { State } from "@/types/proto-es/v1/common_pb";
const { issue, selectedTask } = useIssueContext();
-const releaseName = computed(
- () =>
- specForTask(issue.value.planEntity, selectedTask.value)
- ?.changeDatabaseConfig?.release
-);
+const releaseName = computed(() => {
+ const spec = specForTask(issue.value.planEntity, selectedTask.value);
+ if (spec?.config?.case === "changeDatabaseConfig") {
+ return spec.config.value.release;
+ }
+ return "";
+});
const { release, ready } = useReleaseByName(
computed(() => releaseName.value || "")
diff --git a/frontend/src/components/IssueV1/components/Sidebar/Sidebar.vue b/frontend/src/components/IssueV1/components/Sidebar/Sidebar.vue
index c6b6b77d89..938e9f553d 100644
--- a/frontend/src/components/IssueV1/components/Sidebar/Sidebar.vue
+++ b/frontend/src/components/IssueV1/components/Sidebar/Sidebar.vue
@@ -75,12 +75,8 @@ import { issueServiceClientConnect } from "@/grpcweb";
import { pushNotification, useCurrentProjectV1 } from "@/store";
import { UpdateIssueRequestSchema } from "@/types/proto-es/v1/issue_service_pb";
import { PlanFeature } from "@/types/proto-es/v1/subscription_service_pb";
-import { Issue } from "@/types/proto/v1/issue_service";
-import type { Plan } from "@/types/proto/v1/plan_service";
-import {
- convertNewIssueToOld,
- convertOldIssueToNew,
-} from "@/utils/v1/issue-conversions";
+import { IssueSchema } from "@/types/proto-es/v1/issue_service_pb";
+import type { Plan } from "@/types/proto-es/v1/plan_service_pb";
import { specForTask, useIssueContext } from "../../logic";
import IssueLabels from "./IssueLabels.vue";
import PreBackupSection from "./PreBackupSection";
@@ -123,17 +119,15 @@ const onIssueLabelsUpdate = async (labels: string[]) => {
if (isCreating.value) {
issue.value.labels = labels;
} else {
- const issuePatch = Issue.fromPartial({
+ const issuePatch = create(IssueSchema, {
...issue.value,
labels,
});
- const newIssuePatch = convertOldIssueToNew(issuePatch);
const request = create(UpdateIssueRequestSchema, {
- issue: newIssuePatch,
+ issue: issuePatch,
updateMask: { paths: ["labels"] },
});
- const newUpdated = await issueServiceClientConnect.updateIssue(request);
- const updated = convertNewIssueToOld(newUpdated);
+ const updated = await issueServiceClientConnect.updateIssue(request);
Object.assign(issue.value, updated);
pushNotification({
module: "bytebase",
diff --git a/frontend/src/components/IssueV1/components/Sidebar/TaskCheckSummarySection/AffectedRowsView.vue b/frontend/src/components/IssueV1/components/Sidebar/TaskCheckSummarySection/AffectedRowsView.vue
index b9088ee017..6583927b01 100644
--- a/frontend/src/components/IssueV1/components/Sidebar/TaskCheckSummarySection/AffectedRowsView.vue
+++ b/frontend/src/components/IssueV1/components/Sidebar/TaskCheckSummarySection/AffectedRowsView.vue
@@ -44,8 +44,8 @@
import { NTag, NPopover } from "naive-ui";
import { computed } from "vue";
import { useIssueContext, projectOfIssue } from "@/components/IssueV1/logic";
-import { type PlanCheckRun } from "@/types/proto/v1/plan_service";
-import type { Task } from "@/types/proto/v1/rollout_service";
+import { type PlanCheckRun } from "@/types/proto-es/v1/plan_service_pb";
+import type { Task } from "@/types/proto-es/v1/rollout_service_pb";
import { databaseForTask } from "@/utils";
import { flattenTaskV1List } from "@/utils";
@@ -62,14 +62,19 @@ const affectedTaskMap = computed(() => {
props.taskSummaryReportMap.forEach((planCheckRun, task) => {
if (
planCheckRun.results.every(
- (result) => result.sqlSummaryReport?.affectedRows === undefined
+ (result) => result.report?.case !== "sqlSummaryReport" || result.report.value.affectedRows === undefined
)
) {
return;
}
const count = planCheckRun.results.reduce(
- (acc, result) => acc + (result.sqlSummaryReport?.affectedRows || 0),
+ (acc, result) => {
+ if (result.report?.case === "sqlSummaryReport") {
+ return acc + (result.report.value.affectedRows || 0);
+ }
+ return acc;
+ },
0
);
tempMap.set(task, count);
@@ -92,14 +97,19 @@ const summaryReportResults = computed(() =>
const affectedRows = computed(() =>
summaryReportResults.value.reduce(
- (acc, result) => acc + (result.sqlSummaryReport?.affectedRows || 0),
+ (acc, result) => {
+ if (result.report?.case === "sqlSummaryReport") {
+ return acc + (result.report.value.affectedRows || 0);
+ }
+ return acc;
+ },
0
)
);
const shouldShow = computed(() =>
summaryReportResults.value.some(
- (result) => result.sqlSummaryReport?.affectedRows !== undefined
+ (result) => result.report?.case === "sqlSummaryReport" && result.report.value.affectedRows !== undefined
)
);
diff --git a/frontend/src/components/IssueV1/components/Sidebar/TaskCheckSummarySection/FailedTasksView.vue b/frontend/src/components/IssueV1/components/Sidebar/TaskCheckSummarySection/FailedTasksView.vue
index fa1d18c2cf..f1e847c7af 100644
--- a/frontend/src/components/IssueV1/components/Sidebar/TaskCheckSummarySection/FailedTasksView.vue
+++ b/frontend/src/components/IssueV1/components/Sidebar/TaskCheckSummarySection/FailedTasksView.vue
@@ -37,8 +37,8 @@ import { useIssueContext, projectOfIssue } from "@/components/IssueV1";
import {
PlanCheckRun_Result_Status,
type PlanCheckRun,
-} from "@/types/proto/v1/plan_service";
-import type { Task } from "@/types/proto/v1/rollout_service";
+} from "@/types/proto-es/v1/plan_service_pb";
+import type { Task } from "@/types/proto-es/v1/rollout_service_pb";
import { databaseForTask } from "@/utils";
import { flattenTaskV1List } from "@/utils";
diff --git a/frontend/src/components/IssueV1/components/Sidebar/TaskCheckSummarySection/TaskCheckSummarySection.vue b/frontend/src/components/IssueV1/components/Sidebar/TaskCheckSummarySection/TaskCheckSummarySection.vue
index 59b40f691d..37126518e0 100644
--- a/frontend/src/components/IssueV1/components/Sidebar/TaskCheckSummarySection/TaskCheckSummarySection.vue
+++ b/frontend/src/components/IssueV1/components/Sidebar/TaskCheckSummarySection/TaskCheckSummarySection.vue
@@ -24,7 +24,7 @@ import { useIssueContext } from "@/components/IssueV1";
import {
PlanCheckRun_Type,
type PlanCheckRun,
-} from "@/types/proto/v1/plan_service";
+} from "@/types/proto-es/v1/plan_service_pb";
import {
flattenTaskV1List,
isDatabaseChangeRelatedIssue,
diff --git a/frontend/src/components/IssueV1/components/StageSection/StageCard.vue b/frontend/src/components/IssueV1/components/StageSection/StageCard.vue
index 9b12479578..7c9a3158f5 100644
--- a/frontend/src/components/IssueV1/components/StageSection/StageCard.vue
+++ b/frontend/src/components/IssueV1/components/StageSection/StageCard.vue
@@ -72,9 +72,9 @@ import {
import { planCheckRunSummaryForCheckRunList } from "@/components/PlanCheckRun/common";
import { useEnvironmentV1Store } from "@/store";
import { EMPTY_TASK_NAME } from "@/types";
-import { PlanCheckRun_Result_Status } from "@/types/proto/v1/plan_service";
-import type { Stage } from "@/types/proto/v1/rollout_service";
-import { task_StatusToJSON } from "@/types/proto/v1/rollout_service";
+import { PlanCheckRun_Result_Status } from "@/types/proto-es/v1/plan_service_pb";
+import type { Stage } from "@/types/proto-es/v1/rollout_service_pb";
+import { Task_Status } from "@/types/proto-es/v1/rollout_service_pb";
import { activeTaskInStageV1 } from "@/utils";
import TaskStatusIcon from "../TaskStatusIcon.vue";
import StageSummary from "./StageSummary.vue";
@@ -132,7 +132,7 @@ const stageClass = computed(() => {
if (isSelectedStage.value) classList.push("selected");
if (isActiveStage.value) classList.push("active");
const task = activeTaskInStage.value;
- classList.push(`status_${task_StatusToJSON(task.status).toLowerCase()}`);
+ classList.push(`status_${Task_Status[task.status].toLowerCase()}`);
return classList;
});
@@ -148,7 +148,7 @@ const stageTitle = computed(() => {
});
const planCheckStatus = computed((): PlanCheckRun_Result_Status => {
- if (isCreating.value) return PlanCheckRun_Result_Status.UNRECOGNIZED;
+ if (isCreating.value) return PlanCheckRun_Result_Status.STATUS_UNSPECIFIED;
const planCheckList = uniqBy(
props.stage.tasks.flatMap(getPlanCheckRunsForTask),
(checkRun) => checkRun.name
diff --git a/frontend/src/components/IssueV1/components/StageSection/StageSummary.vue b/frontend/src/components/IssueV1/components/StageSection/StageSummary.vue
index 0ebca8e2f7..6946856df1 100644
--- a/frontend/src/components/IssueV1/components/StageSection/StageSummary.vue
+++ b/frontend/src/components/IssueV1/components/StageSection/StageSummary.vue
@@ -12,8 +12,8 @@
<script lang="ts" setup>
import { computed } from "vue";
-import type { Stage } from "@/types/proto/v1/rollout_service";
-import { Task_Status } from "@/types/proto/v1/rollout_service";
+import type { Stage } from "@/types/proto-es/v1/rollout_service_pb";
+import { Task_Status } from "@/types/proto-es/v1/rollout_service_pb";
import { useIssueContext } from "../../logic";
const props = defineProps<{
diff --git a/frontend/src/components/IssueV1/components/StatementSection/EditorView/EditorActionPopover.vue b/frontend/src/components/IssueV1/components/StatementSection/EditorView/EditorActionPopover.vue
index 095d183f1c..a5e7eb956d 100644
--- a/frontend/src/components/IssueV1/components/StatementSection/EditorView/EditorActionPopover.vue
+++ b/frontend/src/components/IssueV1/components/StatementSection/EditorView/EditorActionPopover.vue
@@ -25,7 +25,7 @@ import { computed } from "vue";
import { useIssueContext } from "@/components/IssueV1/logic";
import { useCurrentProjectV1 } from "@/store";
import { Engine } from "@/types/proto-es/v1/common_pb";
-import { Task_Type } from "@/types/proto/v1/rollout_service";
+import { Task_Type } from "@/types/proto-es/v1/rollout_service_pb";
import { databaseForTask } from "@/utils";
import { useInstanceV1EditorLanguage } from "@/utils";
import FormatOnSaveCheckbox from "./FormatOnSaveCheckbox.vue";
diff --git a/frontend/src/components/IssueV1/components/StatementSection/EditorView/EditorView.vue b/frontend/src/components/IssueV1/components/StatementSection/EditorView/EditorView.vue
index d4a872b4c8..321a6abf05 100644
--- a/frontend/src/components/IssueV1/components/StatementSection/EditorView/EditorView.vue
+++ b/frontend/src/components/IssueV1/components/StatementSection/EditorView/EditorView.vue
@@ -209,7 +209,7 @@ import { dialectOfEngineV1 } from "@/types";
import { UpdatePlanRequestSchema } from "@/types/proto-es/v1/plan_service_pb";
import { SheetSchema } from "@/types/proto-es/v1/sheet_service_pb";
import type { Advice } from "@/types/proto-es/v1/sql_service_pb";
-import { IssueStatus } from "@/types/proto/v1/issue_service";
+import { IssueStatus } from "@/types/proto-es/v1/issue_service_pb";
import { databaseForTask } from "@/utils";
import {
flattenTaskV1List,
@@ -218,10 +218,6 @@ import {
setSheetStatement,
useInstanceV1EditorLanguage,
} from "@/utils";
-import {
- convertOldPlanToNew,
- convertNewPlanToOld,
-} from "@/utils/v1/plan-conversions";
import { useSQLAdviceMarkers } from "../useSQLAdviceMarkers";
import EditorActionPopover from "./EditorActionPopover.vue";
import { provideEditorContext } from "./context";
@@ -287,7 +283,7 @@ const allowEditStatementWhenCreating = computed(() => {
if (
(
issue.value.planEntity?.specs?.filter(
- (spec) => spec.changeDatabaseConfig?.release
+ (spec) => spec.config?.case === "changeDatabaseConfig" && spec.config.value.release
) ?? []
).length > 0
) {
@@ -345,7 +341,7 @@ const shouldShowEditButton = computed(() => {
if (
(
issue.value.planEntity?.specs?.filter(
- (spec) => spec.changeDatabaseConfig?.release
+ (spec) => spec.config?.case === "changeDatabaseConfig" && spec.config.value.release
) ?? []
).length > 0
) {
@@ -469,25 +465,20 @@ const updateStatement = async (statement: string) => {
// Update all specs with the created sheet.
for (const spec of planPatch.specs) {
- let config = undefined;
- if (spec.changeDatabaseConfig) {
- config = spec.changeDatabaseConfig;
- } else if (spec.exportDataConfig) {
- config = spec.exportDataConfig;
+ if (spec.config?.case === "changeDatabaseConfig") {
+ spec.config.value.sheet = createdSheet.name;
+ } else if (spec.config?.case === "exportDataConfig") {
+ spec.config.value.sheet = createdSheet.name;
}
- if (!config) continue;
- config.sheet = createdSheet.name;
}
- const newPlan = convertOldPlanToNew(planPatch);
const request = create(UpdatePlanRequestSchema, {
- plan: newPlan,
+ plan: planPatch,
updateMask: { paths: ["specs"] },
});
const response = await planServiceClientConnect.updatePlan(request);
- const updatedPlan = convertNewPlanToOld(response);
- issue.value.planEntity = updatedPlan;
+ issue.value.planEntity = response;
events.emit("status-changed", { eager: true });
diff --git a/frontend/src/components/IssueV1/components/StatementSection/useSQLAdviceMarkers.ts b/frontend/src/components/IssueV1/components/StatementSection/useSQLAdviceMarkers.ts
index 3db8af21bd..753ae385de 100644
--- a/frontend/src/components/IssueV1/components/StatementSection/useSQLAdviceMarkers.ts
+++ b/frontend/src/components/IssueV1/components/StatementSection/useSQLAdviceMarkers.ts
@@ -8,7 +8,6 @@ import {
} from "@/types/proto-es/v1/plan_service_pb";
import { Advice_Status, type Advice } from "@/types/proto-es/v1/sql_service_pb";
import { extractPlanCheckRunUID } from "@/utils";
-import { convertOldPlanCheckRunToNew } from "@/utils/v1/plan-conversions";
import { type IssueContext } from "../../logic";
export const useSQLAdviceMarkers = (
@@ -36,10 +35,7 @@ export const useSQLAdviceMarkers = (
});
} else {
const { selectedTask, getPlanCheckRunsForTask } = context;
- const oldPlanCheckRunList = getPlanCheckRunsForTask(selectedTask.value);
-
- // Convert old proto types to proto-es types at the boundary
- const planCheckRunList = oldPlanCheckRunList.map(convertOldPlanCheckRunToNew);
+ const planCheckRunList = getPlanCheckRunsForTask(selectedTask.value);
const types: PlanCheckRun_Type[] = [
PlanCheckRun_Type.DATABASE_STATEMENT_ADVISE,
diff --git a/frontend/src/components/IssueV1/components/TaskListSection/CurrentTaskSection.vue b/frontend/src/components/IssueV1/components/TaskListSection/CurrentTaskSection.vue
index c1d5261d96..925efe67af 100644
--- a/frontend/src/components/IssueV1/components/TaskListSection/CurrentTaskSection.vue
+++ b/frontend/src/components/IssueV1/components/TaskListSection/CurrentTaskSection.vue
@@ -95,7 +95,7 @@ import {
isValidDatabaseName,
unknownEnvironment,
} from "@/types";
-import { Task_Status, Task_Type } from "@/types/proto/v1/rollout_service";
+import { Task_Status, Task_Type } from "@/types/proto-es/v1/rollout_service_pb";
import { databaseForTask } from "@/utils";
import { extractInstanceResourceName } from "@/utils";
diff --git a/frontend/src/components/IssueV1/components/TaskListSection/TaskCard.vue b/frontend/src/components/IssueV1/components/TaskListSection/TaskCard.vue
index ed8636ece8..d2d6125c87 100644
--- a/frontend/src/components/IssueV1/components/TaskListSection/TaskCard.vue
+++ b/frontend/src/components/IssueV1/components/TaskListSection/TaskCard.vue
@@ -59,9 +59,9 @@ import { computed } from "vue";
import { InstanceV1Name } from "@/components/v2";
import { useCurrentProjectV1 } from "@/store";
import { isValidDatabaseName } from "@/types";
-import { Plan_ChangeDatabaseConfig_Type } from "@/types/proto/v1/plan_service";
-import { Task } from "@/types/proto/v1/rollout_service";
-import { Task_Type, task_StatusToJSON } from "@/types/proto/v1/rollout_service";
+import { Plan_ChangeDatabaseConfig_Type } from "@/types/proto-es/v1/plan_service_pb";
+import type { Task } from "@/types/proto-es/v1/rollout_service_pb";
+import { Task_Type, Task_Status } from "@/types/proto-es/v1/rollout_service_pb";
import { databaseForTask } from "@/utils";
import { databaseV1Url, extractSchemaVersionFromTask, isDev } from "@/utils";
import { useInstanceForTask, specForTask, useIssueContext } from "../../logic";
@@ -87,7 +87,7 @@ const schemaVersion = computed(() => {
if (
(
issue.value.planEntity?.specs?.filter(
- (spec) => spec.changeDatabaseConfig?.release
+ (spec) => spec.config?.case === "changeDatabaseConfig" && spec.config.value?.release
) ?? []
).length > 0
) {
@@ -99,9 +99,10 @@ const schemaVersion = computed(() => {
const showGhostTag = computed(() => {
if (isCreating.value) {
+ const spec = specForTask(issue.value.planEntity, props.task);
return (
- specForTask(issue.value.planEntity, props.task)?.changeDatabaseConfig
- ?.type === Plan_ChangeDatabaseConfig_Type.MIGRATE_GHOST
+ spec?.config?.case === "changeDatabaseConfig" &&
+ spec.config.value?.type === Plan_ChangeDatabaseConfig_Type.MIGRATE_GHOST
);
}
return props.task.type === Task_Type.DATABASE_SCHEMA_UPDATE_GHOST;
@@ -112,7 +113,7 @@ const taskClass = computed(() => {
const classes: string[] = [];
if (selected.value) classes.push("selected");
if (isCreating.value) classes.push("create");
- classes.push(`status_${task_StatusToJSON(task.status).toLowerCase()}`);
+ classes.push(`status_${Task_Status[task.status].toLowerCase()}`);
return classes;
});
diff --git a/frontend/src/components/IssueV1/components/TaskListSection/TaskExtraActionsButton.vue b/frontend/src/components/IssueV1/components/TaskListSection/TaskExtraActionsButton.vue
index 176acb296a..7a32669da8 100644
--- a/frontend/src/components/IssueV1/components/TaskListSection/TaskExtraActionsButton.vue
+++ b/frontend/src/components/IssueV1/components/TaskListSection/TaskExtraActionsButton.vue
@@ -32,7 +32,7 @@ import {
getApplicableTaskRolloutActionList,
useIssueContext,
} from "@/components/IssueV1/logic";
-import type { Task } from "@/types/proto/v1/rollout_service";
+import type { Task } from "@/types/proto-es/v1/rollout_service_pb";
import { DropdownItemWithErrorList } from "../common";
type ExtraTaskRolloutActionDropdownOption = DropdownOption & {
diff --git a/frontend/src/components/IssueV1/components/TaskListSection/TaskFilter.vue b/frontend/src/components/IssueV1/components/TaskListSection/TaskFilter.vue
index f4634e40d1..fbf3b80a1c 100644
--- a/frontend/src/components/IssueV1/components/TaskListSection/TaskFilter.vue
+++ b/frontend/src/components/IssueV1/components/TaskListSection/TaskFilter.vue
@@ -83,7 +83,7 @@ import { NTag } from "naive-ui";
import { computed } from "vue";
import AdviceStatusIcon from "@/components/Plan/components/SQLCheckSection/AdviceStatusIcon.vue";
import { usePlanSQLCheckContext } from "@/components/Plan/components/SQLCheckSection/context";
-import { Task_Status } from "@/types/proto/v1/rollout_service";
+import { Task_Status } from "@/types/proto-es/v1/rollout_service_pb";
import { Advice_Status } from "@/types/proto-es/v1/sql_service_pb";
import { useIssueContext } from "../../logic";
import TaskStatusIconV1 from "../TaskStatusIconV1.vue";
diff --git a/frontend/src/components/IssueV1/components/TaskListSection/TaskListSection.vue b/frontend/src/components/IssueV1/components/TaskListSection/TaskListSection.vue
index 0c1174f613..efd3302504 100644
--- a/frontend/src/components/IssueV1/components/TaskListSection/TaskListSection.vue
+++ b/frontend/src/components/IssueV1/components/TaskListSection/TaskListSection.vue
@@ -69,7 +69,7 @@ import { useVerticalScrollState } from "@/composables/useScrollState";
import { batchGetOrFetchDatabases, useCurrentProjectV1 } from "@/store";
import { DEBOUNCE_SEARCH_DELAY } from "@/types";
import type { Advice_Status } from "@/types/proto-es/v1/sql_service_pb";
-import type { Task_Status } from "@/types/proto/v1/rollout_service";
+import type { Task_Status } from "@/types/proto-es/v1/rollout_service_pb";
import { databaseForTask } from "@/utils";
import { isDev } from "@/utils";
import { useIssueContext } from "../../logic";
diff --git a/frontend/src/components/IssueV1/components/TaskListSection/TaskProgress.vue b/frontend/src/components/IssueV1/components/TaskListSection/TaskProgress.vue
index d20096e10f..25ff1fa17c 100644
--- a/frontend/src/components/IssueV1/components/TaskListSection/TaskProgress.vue
+++ b/frontend/src/components/IssueV1/components/TaskListSection/TaskProgress.vue
@@ -14,8 +14,8 @@
<script setup lang="ts">
import { NProgress } from "naive-ui";
import { computed } from "vue";
-import type { Task } from "@/types/proto/v1/rollout_service";
-import { Task_Status } from "@/types/proto/v1/rollout_service";
+import type { Task } from "@/types/proto-es/v1/rollout_service_pb";
+import { Task_Status } from "@/types/proto-es/v1/rollout_service_pb";
defineProps<{
task: Task;
diff --git a/frontend/src/components/IssueV1/components/TaskListSection/filter.ts b/frontend/src/components/IssueV1/components/TaskListSection/filter.ts
index 6ae556f122..ae82f7407f 100644
--- a/frontend/src/components/IssueV1/components/TaskListSection/filter.ts
+++ b/frontend/src/components/IssueV1/components/TaskListSection/filter.ts
@@ -1,8 +1,8 @@
import { planCheckRunSummaryForCheckRunList } from "@/components/PlanCheckRun/common";
import type { CheckReleaseResponse_CheckResult } from "@/types/proto-es/v1/release_service_pb";
-import type { Task, Task_Status } from "@/types/proto/v1/rollout_service";
+import type { Task, Task_Status } from "@/types/proto-es/v1/rollout_service_pb";
import { Advice_Status } from "@/types/proto-es/v1/sql_service_pb";
-import { type IssueContext } from "../../logic";
+import type { IssueContext } from "../../logic";
export const filterTask = (
issueContext: IssueContext,
@@ -34,9 +34,8 @@ export const filterTask = (
result.advices.some((advice) => advice.status === adviceStatus)
);
} else {
- const summary = planCheckRunSummaryForCheckRunList(
- getPlanCheckRunsForTask(task)
- );
+ const checkRuns = getPlanCheckRunsForTask(task);
+ const summary = planCheckRunSummaryForCheckRunList(checkRuns);
if (summary.errorCount > 0) {
return adviceStatus === Advice_Status.ERROR;
} else if (summary.warnCount > 0) {
diff --git a/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunComment.vue b/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunComment.vue
index 2420f365c3..6e938f8360 100644
--- a/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunComment.vue
+++ b/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunComment.vue
@@ -34,10 +34,10 @@ import { getProjectIdRolloutUidStageUidTaskUid } from "@/store/modules/v1/common
import {
unknownTask,
type ComposedTaskRun,
- getTimeForPbTimestamp,
- getDateForPbTimestamp,
+ getTimeForPbTimestampProtoEs,
+ getDateForPbTimestampProtoEs,
} from "@/types";
-import { TaskRun_Status, Task_Type } from "@/types/proto/v1/rollout_service";
+import { TaskRun_Status, Task_Type } from "@/types/proto-es/v1/rollout_service_pb";
import { isPostgresFamily } from "@/types/v1/instance";
import { databaseForTask } from "@/utils";
import { databaseV1Url, extractTaskUID, flattenTaskV1List } from "@/utils";
@@ -60,7 +60,7 @@ const { t } = useI18n();
const earliestAllowedTime = computed(() => {
return props.taskRun.runTime
- ? getTimeForPbTimestamp(props.taskRun.runTime)
+ ? getTimeForPbTimestampProtoEs(props.taskRun.runTime)
: null;
});
@@ -74,9 +74,9 @@ const comment = computed(() => {
}
if (taskRun.schedulerInfo) {
const cause = taskRun.schedulerInfo.waitingCause;
- if (cause?.task) {
+ if (cause?.cause?.case === "task") {
return t("task-run.status.waiting-task", {
- time: getDateForPbTimestamp(
+ time: getDateForPbTimestampProtoEs(
taskRun.schedulerInfo.reportTime
)?.toLocaleString(),
});
@@ -86,23 +86,23 @@ const comment = computed(() => {
} else if (taskRun.status === TaskRun_Status.RUNNING) {
if (taskRun.schedulerInfo) {
const cause = taskRun.schedulerInfo.waitingCause;
- if (cause?.connectionLimit) {
+ if (cause?.cause?.case === "connectionLimit") {
return t("task-run.status.waiting-connection", {
- time: getDateForPbTimestamp(
+ time: getDateForPbTimestampProtoEs(
taskRun.schedulerInfo.reportTime
)?.toLocaleString(),
});
}
- if (cause?.task) {
+ if (cause?.cause?.case === "task") {
return t("task-run.status.waiting-task", {
- time: getDateForPbTimestamp(
+ time: getDateForPbTimestampProtoEs(
taskRun.schedulerInfo.reportTime
)?.toLocaleString(),
});
}
- if (cause?.parallelTasksLimit) {
+ if (cause?.cause?.case === "parallelTasksLimit") {
return t("task-run.status.waiting-max-tasks-per-rollout", {
- time: getDateForPbTimestamp(
+ time: getDateForPbTimestampProtoEs(
taskRun.schedulerInfo.reportTime
)?.toLocaleString(),
});
@@ -128,8 +128,9 @@ const commentLink = computed((): CommentLink => {
taskRun.status === TaskRun_Status.PENDING ||
taskRun.status === TaskRun_Status.RUNNING
) {
- const task = taskRun.schedulerInfo?.waitingCause?.task;
- if (task) {
+ const waitingCause = taskRun.schedulerInfo?.waitingCause;
+ if (waitingCause?.cause?.case === "task") {
+ const task = waitingCause.cause.value;
const [, , stageUid, taskUid] = getProjectIdRolloutUidStageUidTaskUid(
task.task
);
diff --git a/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunDetail.vue b/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunDetail.vue
index a2ef3edabc..95c8e7c9f4 100644
--- a/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunDetail.vue
+++ b/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunDetail.vue
@@ -30,7 +30,7 @@ import { computed, reactive, ref, watch } from "vue";
import { useSheetV1Store } from "@/store";
import { Engine } from "@/types/proto-es/v1/common_pb";
import type { Database } from "@/types/proto-es/v1/database_service_pb";
-import { TaskRun_Status, type TaskRun } from "@/types/proto/v1/rollout_service";
+import { TaskRun_Status, type TaskRun } from "@/types/proto-es/v1/rollout_service_pb";
import TaskRunLogTable from "./TaskRunLogTable";
import TaskRunSession from "./TaskRunSession";
diff --git a/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunLogTable/DetailCell/AffectedRowsCell.vue b/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunLogTable/DetailCell/AffectedRowsCell.vue
index 44ccc68168..7f8fbb170f 100644
--- a/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunLogTable/DetailCell/AffectedRowsCell.vue
+++ b/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunLogTable/DetailCell/AffectedRowsCell.vue
@@ -7,7 +7,7 @@
<script setup lang="ts">
import { computed } from "vue";
-import { TaskRunLogEntry_Type } from "@/types/proto/v1/rollout_service";
+import { TaskRunLogEntry_Type } from "@/types/proto-es/v1/rollout_service_pb";
import type { FlattenLogEntry } from "../common";
const props = defineProps<{
diff --git a/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunLogTable/DetailCell/DatabaseSyncCell.vue b/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunLogTable/DetailCell/DatabaseSyncCell.vue
index 0124156367..b866d542d6 100644
--- a/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunLogTable/DetailCell/DatabaseSyncCell.vue
+++ b/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunLogTable/DetailCell/DatabaseSyncCell.vue
@@ -5,7 +5,7 @@
<script setup lang="ts">
import { computed } from "vue";
-import { TaskRunLogEntry_Type } from "@/types/proto/v1/rollout_service";
+import { TaskRunLogEntry_Type } from "@/types/proto-es/v1/rollout_service_pb";
import type { FlattenLogEntry } from "../common";
const props = defineProps<{
diff --git a/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunLogTable/DetailCell/DetailCell.vue b/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunLogTable/DetailCell/DetailCell.vue
index b3ad6edbbf..1722e5c2b5 100644
--- a/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunLogTable/DetailCell/DetailCell.vue
+++ b/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunLogTable/DetailCell/DetailCell.vue
@@ -17,7 +17,7 @@
<script setup lang="ts">
import { NEllipsis } from "naive-ui";
import { computed } from "vue";
-import { TaskRunLogEntry_Type } from "@/types/proto/v1/rollout_service";
+import { TaskRunLogEntry_Type } from "@/types/proto-es/v1/rollout_service_pb";
import type { Sheet } from "@/types/proto-es/v1/sheet_service_pb";
import type { FlattenLogEntry } from "../common";
import AffectedRowsCell from "./AffectedRowsCell.vue";
diff --git a/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunLogTable/DetailCell/ErrorCell.vue b/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunLogTable/DetailCell/ErrorCell.vue
index 3fe690c55c..c92dccac05 100644
--- a/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunLogTable/DetailCell/ErrorCell.vue
+++ b/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunLogTable/DetailCell/ErrorCell.vue
@@ -5,7 +5,7 @@
<script setup lang="ts">
import { computed } from "vue";
-import { TaskRunLogEntry_Type } from "@/types/proto/v1/rollout_service";
+import { TaskRunLogEntry_Type } from "@/types/proto-es/v1/rollout_service_pb";
import type { FlattenLogEntry } from "../common";
const props = defineProps<{
diff --git a/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunLogTable/DetailCell/PriorBackupCell.vue b/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunLogTable/DetailCell/PriorBackupCell.vue
index 718f17c3b4..46813937de 100644
--- a/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunLogTable/DetailCell/PriorBackupCell.vue
+++ b/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunLogTable/DetailCell/PriorBackupCell.vue
@@ -17,10 +17,8 @@
<script setup lang="ts">
import { NEllipsis } from "naive-ui";
import { computed } from "vue";
-import {
- TaskRun_PriorBackupDetail_Item_Table,
- TaskRunLogEntry_Type,
-} from "@/types/proto/v1/rollout_service";
+import type { TaskRun_PriorBackupDetail_Item_Table } from "@/types/proto-es/v1/rollout_service_pb";
+import { TaskRunLogEntry_Type } from "@/types/proto-es/v1/rollout_service_pb";
import type { FlattenLogEntry } from "../common";
const props = defineProps<{
diff --git a/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunLogTable/DetailCell/RetryInfoCell.vue b/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunLogTable/DetailCell/RetryInfoCell.vue
index 7dab735d63..1cbfe84d90 100644
--- a/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunLogTable/DetailCell/RetryInfoCell.vue
+++ b/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunLogTable/DetailCell/RetryInfoCell.vue
@@ -7,7 +7,7 @@
<script setup lang="ts">
import { computed } from "vue";
-import { TaskRunLogEntry_Type } from "@/types/proto/v1/rollout_service";
+import { TaskRunLogEntry_Type } from "@/types/proto-es/v1/rollout_service_pb";
import type { FlattenLogEntry } from "../common";
const props = defineProps<{
diff --git a/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunLogTable/DetailCell/StatusUpdateCell.vue b/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunLogTable/DetailCell/StatusUpdateCell.vue
index 3f659d5e67..81aae46afa 100644
--- a/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunLogTable/DetailCell/StatusUpdateCell.vue
+++ b/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunLogTable/DetailCell/StatusUpdateCell.vue
@@ -9,7 +9,7 @@ import { useI18n } from "vue-i18n";
import {
TaskRunLogEntry_TaskRunStatusUpdate_Status,
TaskRunLogEntry_Type,
-} from "@/types/proto/v1/rollout_service";
+} from "@/types/proto-es/v1/rollout_service_pb";
import type { FlattenLogEntry } from "../common";
const props = defineProps<{
diff --git a/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunLogTable/DetailCell/TransactionControlCell.vue b/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunLogTable/DetailCell/TransactionControlCell.vue
index 3422eedbee..17a59db615 100644
--- a/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunLogTable/DetailCell/TransactionControlCell.vue
+++ b/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunLogTable/DetailCell/TransactionControlCell.vue
@@ -9,7 +9,7 @@ import { computed } from "vue";
import {
TaskRunLogEntry_TransactionControl_Type,
TaskRunLogEntry_Type,
-} from "@/types/proto/v1/rollout_service";
+} from "@/types/proto-es/v1/rollout_service_pb";
import type { FlattenLogEntry } from "../common";
const props = defineProps<{
diff --git a/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunLogTable/DetailCell/common.ts b/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunLogTable/DetailCell/common.ts
index c374e9cda1..f5be289ada 100644
--- a/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunLogTable/DetailCell/common.ts
+++ b/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunLogTable/DetailCell/common.ts
@@ -1,4 +1,4 @@
-import { TaskRunLogEntry_Type } from "@/types/proto/v1/rollout_service";
+import { TaskRunLogEntry_Type } from "@/types/proto-es/v1/rollout_service_pb";
import type { FlattenLogEntry } from "../common";
export const detailCellRowSpan = (entry: FlattenLogEntry) => {
diff --git a/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunLogTable/StatementCell.vue b/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunLogTable/StatementCell.vue
index e018f7255a..b8f43c8c5b 100644
--- a/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunLogTable/StatementCell.vue
+++ b/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunLogTable/StatementCell.vue
@@ -32,7 +32,7 @@
import { computed } from "vue";
import TextOverflowPopover from "@/components/misc/TextOverflowPopover.vue";
import { CopyButton } from "@/components/v2";
-import { TaskRunLogEntry_Type } from "@/types/proto/v1/rollout_service";
+import { TaskRunLogEntry_Type } from "@/types/proto-es/v1/rollout_service_pb";
import type { Sheet } from "@/types/proto-es/v1/sheet_service_pb";
import { extractSheetCommandByIndex } from "@/utils";
import type { FlattenLogEntry } from "./common";
diff --git a/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunLogTable/TaskRunLogTable.vue b/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunLogTable/TaskRunLogTable.vue
index 52a9bfc87b..a18ffc443a 100644
--- a/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunLogTable/TaskRunLogTable.vue
+++ b/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunLogTable/TaskRunLogTable.vue
@@ -16,13 +16,12 @@ import { NTooltip, NDataTable, type DataTableColumn } from "naive-ui";
import { computed, ref } from "vue";
import { create } from "@bufbuild/protobuf";
import { GetTaskRunLogRequestSchema } from "@/types/proto-es/v1/rollout_service_pb";
-import { convertNewTaskRunLogToOld } from "@/utils/v1/rollout-conversions";
import { useI18n } from "vue-i18n";
import { rolloutServiceClientConnect } from "@/grpcweb";
import {
type TaskRun,
TaskRunLogEntry_Type,
-} from "@/types/proto/v1/rollout_service";
+} from "@/types/proto-es/v1/rollout_service_pb";
import type { Sheet } from "@/types/proto-es/v1/sheet_service_pb";
import DetailCell, { detailCellRowSpan } from "./DetailCell";
import DurationCell from "./DurationCell.vue";
@@ -48,7 +47,7 @@ const taskRunLog = computedAsync(
parent: props.taskRun.name,
});
const response = await rolloutServiceClientConnect.getTaskRunLog(request);
- return convertNewTaskRunLogToOld(response);
+ return response;
},
undefined,
{
diff --git a/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunLogTable/common.ts b/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunLogTable/common.ts
index 16df4858b6..c185219b61 100644
--- a/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunLogTable/common.ts
+++ b/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunLogTable/common.ts
@@ -1,17 +1,16 @@
import { t } from "@/plugins/i18n";
-import { getDateForPbTimestamp } from "@/types";
+import { getDateForPbTimestampProtoEs } from "@/types";
import {
TaskRunLogEntry_Type,
- taskRunLogEntry_TypeToJSON,
type TaskRunLogEntry_CommandExecute,
type TaskRunLogEntry_SchemaDump,
type TaskRunLogEntry_TaskRunStatusUpdate,
type TaskRunLogEntry_TransactionControl,
type TaskRunLogEntry_DatabaseSync,
- TaskRunLogEntry,
- TaskRunLogEntry_PriorBackup,
- TaskRunLogEntry_RetryInfo,
-} from "@/types/proto/v1/rollout_service";
+ type TaskRunLogEntry,
+ type TaskRunLogEntry_PriorBackup,
+ type TaskRunLogEntry_RetryInfo,
+} from "@/types/proto-es/v1/rollout_service_pb";
export type FlattenLogEntry = {
batch: number;
@@ -57,7 +56,7 @@ export const displayTaskRunLogEntryType = (type: TaskRunLogEntry_Type) => {
}
console.warn(
- `[displayTaskRunLogEntryType] should never reach this line: type=${taskRunLogEntry_TypeToJSON(type)}`
+ `[displayTaskRunLogEntryType] should never reach this line: type=${TaskRunLogEntry_Type[type]}`
);
return "";
};
@@ -87,7 +86,7 @@ export const convertTaskRunLogEntryToFlattenLogEntries = (
deployId,
serial: 0,
type: TaskRunLogEntry_Type.TASK_RUN_STATUS_UPDATE,
- startTime: getDateForPbTimestamp(entry.logTime),
+ startTime: getDateForPbTimestampProtoEs(entry.logTime),
endTime: undefined,
taskRunStatusUpdate,
});
@@ -98,8 +97,8 @@ export const convertTaskRunLogEntryToFlattenLogEntries = (
deployId,
serial: 0,
type: TaskRunLogEntry_Type.DATABASE_SYNC,
- startTime: getDateForPbTimestamp(databaseSync.startTime),
- endTime: getDateForPbTimestamp(databaseSync.endTime),
+ startTime: getDateForPbTimestampProtoEs(databaseSync.startTime),
+ endTime: getDateForPbTimestampProtoEs(databaseSync.endTime),
databaseSync,
});
}
@@ -109,7 +108,7 @@ export const convertTaskRunLogEntryToFlattenLogEntries = (
deployId,
serial: 0,
type: TaskRunLogEntry_Type.TRANSACTION_CONTROL,
- startTime: getDateForPbTimestamp(entry.logTime),
+ startTime: getDateForPbTimestampProtoEs(entry.logTime),
endTime: undefined,
transactionControl,
});
@@ -120,8 +119,8 @@ export const convertTaskRunLogEntryToFlattenLogEntries = (
deployId,
serial: 0,
type: TaskRunLogEntry_Type.SCHEMA_DUMP,
- startTime: getDateForPbTimestamp(schemaDump.startTime),
- endTime: getDateForPbTimestamp(schemaDump.endTime),
+ startTime: getDateForPbTimestampProtoEs(schemaDump.startTime),
+ endTime: getDateForPbTimestampProtoEs(schemaDump.endTime),
schemaDump,
});
}
@@ -141,8 +140,8 @@ export const convertTaskRunLogEntryToFlattenLogEntries = (
deployId,
serial,
type: TaskRunLogEntry_Type.COMMAND_EXECUTE,
- startTime: getDateForPbTimestamp(startTime),
- endTime: getDateForPbTimestamp(endTime),
+ startTime: getDateForPbTimestampProtoEs(startTime),
+ endTime: getDateForPbTimestampProtoEs(endTime),
commandExecute: {
raw: commandExecute,
commandIndex,
@@ -157,8 +156,8 @@ export const convertTaskRunLogEntryToFlattenLogEntries = (
deployId,
serial: 0,
type: TaskRunLogEntry_Type.PRIOR_BACKUP,
- startTime: getDateForPbTimestamp(priorBackup.startTime),
- endTime: getDateForPbTimestamp(priorBackup.endTime),
+ startTime: getDateForPbTimestampProtoEs(priorBackup.startTime),
+ endTime: getDateForPbTimestampProtoEs(priorBackup.endTime),
priorBackup: priorBackup,
});
}
@@ -168,7 +167,7 @@ export const convertTaskRunLogEntryToFlattenLogEntries = (
deployId,
serial: 0,
type: TaskRunLogEntry_Type.RETRY_INFO,
- startTime: getDateForPbTimestamp(entry.logTime),
+ startTime: getDateForPbTimestampProtoEs(entry.logTime),
endTime: undefined,
retryInfo,
});
diff --git a/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunSection.vue b/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunSection.vue
index ef5e1b6f78..8fdb77ea0f 100644
--- a/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunSection.vue
+++ b/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunSection.vue
@@ -8,13 +8,12 @@
import { computed, watchEffect } from "vue";
import { create } from "@bufbuild/protobuf";
import { GetTaskRunLogRequestSchema } from "@/types/proto-es/v1/rollout_service_pb";
-import { convertNewTaskRunLogToOld } from "@/utils/v1/rollout-conversions";
import {
useIssueContext,
taskRunListForTask,
} from "@/components/IssueV1/logic";
import { rolloutServiceClientConnect } from "@/grpcweb";
-import { TaskRun_Status } from "@/types/proto/v1/rollout_service";
+import { TaskRun_Status } from "@/types/proto-es/v1/rollout_service_pb";
import TaskRunTable from "./TaskRunTable.vue";
const { issue, selectedTask } = useIssueContext();
@@ -31,8 +30,7 @@ watchEffect(async () => {
parent: taskRun.name,
});
const response = await rolloutServiceClientConnect.getTaskRunLog(request);
- const taskRunLog = convertNewTaskRunLogToOld(response);
- taskRun.taskRunLog = taskRunLog;
+ taskRun.taskRunLog = response;
}
}
});
diff --git a/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunSession/PostgresSessionTable.vue b/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunSession/PostgresSessionTable.vue
index 89c007d5a5..355270d381 100644
--- a/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunSession/PostgresSessionTable.vue
+++ b/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunSession/PostgresSessionTable.vue
@@ -51,11 +51,11 @@
import { AlignHorizontalJustifyStartIcon } from "lucide-vue-next";
import { NDataTable, type DataTableColumn } from "naive-ui";
import { computed } from "vue";
-import { getDateForPbTimestamp } from "@/types";
-import {
+import { getDateForPbTimestampProtoEs } from "@/types";
+import type {
TaskRunSession_Postgres,
TaskRunSession_Postgres_Session,
-} from "@/types/proto/v1/rollout_service";
+} from "@/types/proto-es/v1/rollout_service_pb";
import { StatementCell, TimeCell } from "./Cells";
const props = defineProps<{
@@ -171,7 +171,7 @@ const columns = computed(() => {
title: () => "backend_start",
width: 120,
render: (session) => {
- return <TimeCell date={getDateForPbTimestamp(session.backendStart)} />;
+ return <TimeCell date={getDateForPbTimestampProtoEs(session.backendStart)} />;
},
},
{
@@ -179,7 +179,7 @@ const columns = computed(() => {
title: () => "xact_start",
width: 120,
render: (session) => {
- return <TimeCell date={getDateForPbTimestamp(session.xactStart)} />;
+ return <TimeCell date={getDateForPbTimestampProtoEs(session.xactStart)} />;
},
},
{
@@ -187,7 +187,7 @@ const columns = computed(() => {
title: () => "query_start",
width: 120,
render: (session) => {
- return <TimeCell date={getDateForPbTimestamp(session.queryStart)} />;
+ return <TimeCell date={getDateForPbTimestampProtoEs(session.queryStart)} />;
},
},
];
diff --git a/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunSession/TaskRunSession.vue b/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunSession/TaskRunSession.vue
index 2b494eac11..458a176493 100644
--- a/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunSession/TaskRunSession.vue
+++ b/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunSession/TaskRunSession.vue
@@ -21,10 +21,9 @@ import { create } from "@bufbuild/protobuf";
import { createContextValues } from "@connectrpc/connect";
import { silentContextKey } from "@/grpcweb/context-key";
import { GetTaskRunSessionRequestSchema } from "@/types/proto-es/v1/rollout_service_pb";
-import { convertNewTaskRunSessionToOld } from "@/utils/v1/rollout-conversions";
import { BBSpin } from "@/bbkit";
import { rolloutServiceClientConnect } from "@/grpcweb";
-import { TaskRun_Status, type TaskRun } from "@/types/proto/v1/rollout_service";
+import { TaskRun_Status, type TaskRun } from "@/types/proto-es/v1/rollout_service_pb";
import PostgresSessionTable from "./PostgresSessionTable.vue";
const props = defineProps<{
@@ -51,7 +50,7 @@ const taskRunSession = computedAsync(
contextValues: createContextValues().set(silentContextKey, true),
}
);
- return convertNewTaskRunSessionToOld(response);
+ return response;
},
undefined,
{
@@ -59,5 +58,11 @@ const taskRunSession = computedAsync(
}
);
-const postgresSession = computed(() => taskRunSession.value?.postgres);
+const postgresSession = computed(() => {
+ const session = taskRunSession.value;
+ if (session?.session?.case === "postgres") {
+ return session.session.value;
+ }
+ return undefined;
+});
</script>
diff --git a/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunStatusIcon.vue b/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunStatusIcon.vue
index 0ffe691c7c..666a6d704e 100644
--- a/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunStatusIcon.vue
+++ b/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunStatusIcon.vue
@@ -32,10 +32,7 @@
<script setup lang="ts">
import { computed } from "vue";
-import {
- TaskRun_Status,
- taskRun_StatusToJSON,
-} from "@/types/proto/v1/rollout_service";
+import { TaskRun_Status } from "@/types/proto-es/v1/rollout_service_pb";
const props = defineProps<{
status: TaskRun_Status;
@@ -58,7 +55,7 @@ const classes = computed(() => {
false,
`should never reach this line. status=${
props.status
- } ${taskRun_StatusToJSON(props.status)}`
+ } ${TaskRun_Status[props.status]}`
);
return "";
});
diff --git a/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunTable.vue b/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunTable.vue
index 771650be6b..a2542fc08b 100644
--- a/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunTable.vue
+++ b/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunTable.vue
@@ -33,11 +33,11 @@ import HumanizeDate from "@/components/misc/HumanizeDate.vue";
import { Drawer, DrawerContent } from "@/components/v2";
import { useCurrentProjectV1, useSheetV1Store } from "@/store";
import {
- getDateForPbTimestamp,
- getTimeForPbTimestamp,
+ getDateForPbTimestampProtoEs,
+ getTimeForPbTimestampProtoEs,
type ComposedTaskRun,
} from "@/types";
-import { TaskRun_Status } from "@/types/proto/v1/rollout_service";
+import { TaskRun_Status } from "@/types/proto-es/v1/rollout_service_pb";
import { databaseForTask } from "@/utils";
import { humanizeDurationV1, sheetNameOfTaskV1 } from "@/utils";
import { useIssueContext } from "../../logic";
@@ -123,7 +123,7 @@ const columnList = computed((): DataTableColumn<ComposedTaskRun>[] => {
title: t("task.created"),
width: 100,
render: (taskRun: ComposedTaskRun) => (
- <HumanizeDate date={getDateForPbTimestamp(taskRun.createTime)} />
+ <HumanizeDate date={getDateForPbTimestampProtoEs(taskRun.createTime)} />
),
},
{
@@ -131,7 +131,7 @@ const columnList = computed((): DataTableColumn<ComposedTaskRun>[] => {
title: t("task.started"),
width: 100,
render: (taskRun: ComposedTaskRun) => (
- <HumanizeDate date={getDateForPbTimestamp(taskRun.startTime)} />
+ <HumanizeDate date={getDateForPbTimestampProtoEs(taskRun.startTime)} />
),
},
{
@@ -163,18 +163,18 @@ const executionDurationOfTaskRun = (
if (!startTime || !updateTime) {
return undefined;
}
- if (startTime.seconds.isZero()) {
+ if (startTime.seconds === 0n) {
return undefined;
}
if (taskRun.status === TaskRun_Status.RUNNING) {
- const elapsedMS = Date.now() - getTimeForPbTimestamp(startTime);
+ const elapsedMS = Date.now() - getTimeForPbTimestampProtoEs(startTime);
return create(DurationSchema, {
seconds: BigInt(Math.floor(elapsedMS / 1000)),
nanos: (elapsedMS % 1000) * 1e6,
});
}
- const startMS = getTimeForPbTimestamp(startTime);
- const updateMS = getTimeForPbTimestamp(updateTime);
+ const startMS = getTimeForPbTimestampProtoEs(startTime);
+ const updateMS = getTimeForPbTimestampProtoEs(updateTime);
const elapsedMS = updateMS - startMS;
return create(DurationSchema, {
seconds: BigInt(Math.floor(elapsedMS / 1000)),
diff --git a/frontend/src/components/IssueV1/components/TaskStatusIcon.vue b/frontend/src/components/IssueV1/components/TaskStatusIcon.vue
index b03be01f30..96e8e664f6 100644
--- a/frontend/src/components/IssueV1/components/TaskStatusIcon.vue
+++ b/frontend/src/components/IssueV1/components/TaskStatusIcon.vue
@@ -61,9 +61,9 @@ import { SkipIcon } from "@/components/Icon";
import { usePlanSQLCheckContext } from "@/components/Plan/components/SQLCheckSection/context";
import { useCurrentProjectV1 } from "@/store";
import { Advice_Status } from "@/types/proto-es/v1/sql_service_pb";
-import { PlanCheckRun_Result_Status } from "@/types/proto/v1/plan_service";
-import type { Task } from "@/types/proto/v1/rollout_service";
-import { Task_Status } from "@/types/proto/v1/rollout_service";
+import { PlanCheckRun_Result_Status } from "@/types/proto-es/v1/plan_service_pb";
+import type { Task } from "@/types/proto-es/v1/rollout_service_pb";
+import { Task_Status } from "@/types/proto-es/v1/rollout_service_pb";
import { databaseForTask } from "@/utils";
import { planCheckStatusForTask, useIssueContext } from "../logic";
diff --git a/frontend/src/components/IssueV1/components/TaskStatusIconV1.vue b/frontend/src/components/IssueV1/components/TaskStatusIconV1.vue
index bbfad7a1a3..e6d2421f98 100644
--- a/frontend/src/components/IssueV1/components/TaskStatusIconV1.vue
+++ b/frontend/src/components/IssueV1/components/TaskStatusIconV1.vue
@@ -61,7 +61,7 @@
import { NTooltip } from "naive-ui";
import { computed } from "vue";
import { SkipIcon } from "@/components/Icon";
-import { Task_Status } from "@/types/proto/v1/rollout_service";
+import { Task_Status } from "@/types/proto-es/v1/rollout_service_pb";
import { useIssueContext } from "../logic";
const props = withDefaults(
diff --git a/frontend/src/components/IssueV1/logic/action/issue.ts b/frontend/src/components/IssueV1/logic/action/issue.ts
index c8bc7b4424..b6bdf4a4fa 100644
--- a/frontend/src/components/IssueV1/logic/action/issue.ts
+++ b/frontend/src/components/IssueV1/logic/action/issue.ts
@@ -5,8 +5,8 @@ import type { ComposedIssue } from "@/types";
import {
IssueStatus,
Issue_Approver_Status,
-} from "@/types/proto/v1/issue_service";
-import { Task_Status } from "@/types/proto/v1/rollout_service";
+} from "@/types/proto-es/v1/issue_service_pb";
+import { Task_Status } from "@/types/proto-es/v1/rollout_service_pb";
import {
flattenTaskV1List,
hasProjectPermissionV2,
@@ -37,7 +37,6 @@ export const PossibleIssueStatusActionMap: Record<
// Only to make TypeScript compiler happy
[IssueStatus.ISSUE_STATUS_UNSPECIFIED]: [],
- [IssueStatus.UNRECOGNIZED]: [],
};
export const getApplicableIssueStatusActionList = (
diff --git a/frontend/src/components/IssueV1/logic/action/review.ts b/frontend/src/components/IssueV1/logic/action/review.ts
index 08c90763c0..683e7dbc26 100644
--- a/frontend/src/components/IssueV1/logic/action/review.ts
+++ b/frontend/src/components/IssueV1/logic/action/review.ts
@@ -9,7 +9,7 @@ import type { ComposedIssue } from "@/types";
import {
IssueStatus,
Issue_Approver_Status,
-} from "@/types/proto/v1/issue_service";
+} from "@/types/proto-es/v1/issue_service_pb";
import { isUserIncludedInList } from "@/utils";
import type { ReviewContext } from "../context";
diff --git a/frontend/src/components/IssueV1/logic/action/stage.ts b/frontend/src/components/IssueV1/logic/action/stage.ts
index 453d01eed4..23d18ba454 100644
--- a/frontend/src/components/IssueV1/logic/action/stage.ts
+++ b/frontend/src/components/IssueV1/logic/action/stage.ts
@@ -1,6 +1,6 @@
import type { ComposedIssue } from "@/types";
-import { IssueStatus } from "@/types/proto/v1/issue_service";
-import type { Stage, Task } from "@/types/proto/v1/rollout_service";
+import { IssueStatus } from "@/types/proto-es/v1/issue_service_pb";
+import type { Stage, Task } from "@/types/proto-es/v1/rollout_service_pb";
import type { TaskRolloutAction } from "./task";
import { getApplicableTaskRolloutActionList } from "./task";
diff --git a/frontend/src/components/IssueV1/logic/action/task.ts b/frontend/src/components/IssueV1/logic/action/task.ts
index 8e77dc9426..064b8c8f22 100644
--- a/frontend/src/components/IssueV1/logic/action/task.ts
+++ b/frontend/src/components/IssueV1/logic/action/task.ts
@@ -2,9 +2,9 @@ import { t } from "@/plugins/i18n";
import { useCurrentUserV1 } from "@/store";
import { userNamePrefix } from "@/store/modules/v1/common";
import type { ComposedIssue } from "@/types";
-import { IssueStatus, Issue_Type } from "@/types/proto/v1/issue_service";
-import type { Task } from "@/types/proto/v1/rollout_service";
-import { Task_Status, Task_Type } from "@/types/proto/v1/rollout_service";
+import { IssueStatus, Issue_Type } from "@/types/proto-es/v1/issue_service_pb";
+import type { Task } from "@/types/proto-es/v1/rollout_service_pb";
+import { Task_Status, Task_Type } from "@/types/proto-es/v1/rollout_service_pb";
import {
hasProjectPermissionV2,
hasWorkspacePermissionV2,
@@ -50,7 +50,6 @@ export const TaskRolloutActionMap: Record<Task_Status, TaskRolloutAction[]> = {
// Only to make TypeScript compiler happy
[Task_Status.STATUS_UNSPECIFIED]: [],
- [Task_Status.UNRECOGNIZED]: [],
};
export const getApplicableTaskRolloutActionList = (
diff --git a/frontend/src/components/IssueV1/logic/base.ts b/frontend/src/components/IssueV1/logic/base.ts
index 8fc161e757..7eead979b5 100644
--- a/frontend/src/components/IssueV1/logic/base.ts
+++ b/frontend/src/components/IssueV1/logic/base.ts
@@ -6,8 +6,8 @@ import { useRoute, useRouter } from "vue-router";
import { PROJECT_V1_ROUTE_ISSUE_DETAIL } from "@/router/dashboard/projectV1";
import { useUIStateStore } from "@/store";
import { emptyStage, emptyTask } from "@/types";
-import type { PlanCheckRun } from "@/types/proto/v1/plan_service";
-import { Stage, Task } from "@/types/proto/v1/rollout_service";
+import type { PlanCheckRun } from "@/types/proto-es/v1/plan_service_pb";
+import type { Stage, Task } from "@/types/proto-es/v1/rollout_service_pb";
import {
activeStageInRollout,
activeTaskInStageV1,
diff --git a/frontend/src/components/IssueV1/logic/context.ts b/frontend/src/components/IssueV1/logic/context.ts
index 42fd642372..f9488ee707 100644
--- a/frontend/src/components/IssueV1/logic/context.ts
+++ b/frontend/src/components/IssueV1/logic/context.ts
@@ -4,9 +4,9 @@ import { v4 as uuidv4 } from "uuid";
import type { InjectionKey, Ref, ComputedRef } from "vue";
import { inject, provide } from "vue";
import type { ComposedIssue, ReviewFlow } from "@/types";
-import type { Issue_Approver_Status } from "@/types/proto/v1/issue_service";
-import type { PlanCheckRun } from "@/types/proto/v1/plan_service";
-import type { Stage, Task } from "@/types/proto/v1/rollout_service";
+import type { Issue_Approver_Status } from "@/types/proto-es/v1/issue_service_pb";
+import type { PlanCheckRun } from "@/types/proto-es/v1/plan_service_pb";
+import type { Stage, Task } from "@/types/proto-es/v1/rollout_service_pb";
import type {
IssueReviewAction,
IssueStatusAction,
diff --git a/frontend/src/components/IssueV1/logic/initialize/create.ts b/frontend/src/components/IssueV1/logic/initialize/create.ts
index b194f75f86..a968fc4d2a 100644
--- a/frontend/src/components/IssueV1/logic/initialize/create.ts
+++ b/frontend/src/components/IssueV1/logic/initialize/create.ts
@@ -10,12 +10,11 @@ import { useCurrentUserV1, useProjectV1Store, useSheetV1Store } from "@/store";
import { projectNamePrefix } from "@/store/modules/v1/common";
import type { IssueType } from "@/types";
import { emptyIssue, TaskTypeListWithStatement } from "@/types";
-import { Issue_Type, IssueStatus } from "@/types/proto/v1/issue_service";
-import { Plan } from "@/types/proto/v1/plan_service";
-import type { Stage } from "@/types/proto/v1/rollout_service";
-import { Rollout } from "@/types/proto/v1/rollout_service";
+import { Issue_Type, IssueStatus } from "@/types/proto-es/v1/issue_service_pb";
+import type { Plan } from "@/types/proto-es/v1/plan_service_pb";
+import type { Stage, Rollout } from "@/types/proto-es/v1/rollout_service_pb";
+import { RolloutSchema } from "@/types/proto-es/v1/rollout_service_pb";
import { PreviewRolloutRequestSchema } from "@/types/proto-es/v1/rollout_service_pb";
-import { convertNewRolloutToOld, convertOldPlanToNew } from "@/utils/v1/rollout-conversions";
import {
extractProjectResourceName,
extractSheetUID,
@@ -96,14 +95,13 @@ const generateRolloutFromPlan = async (
const project = await useProjectV1Store().getOrFetchProjectByName(
`projects/${extractProjectResourceName(plan.name)}`
);
- let rollout: Rollout = Rollout.fromPartial({});
+ let rollout: Rollout = create(RolloutSchema, {});
if (hasProjectPermissionV2(project, "bb.rollouts.preview")) {
const request = create(PreviewRolloutRequestSchema, {
project: params.project.name,
- plan: convertOldPlanToNew(plan),
+ plan: plan,
});
- const rolloutNew = await rolloutServiceClientConnect.previewRollout(request);
- rollout = convertNewRolloutToOld(rolloutNew);
+ rollout = await rolloutServiceClientConnect.previewRollout(request);
}
// Touch UIDs for each object for local referencing
rollout.plan = plan.name;
diff --git a/frontend/src/components/IssueV1/logic/initialize/index.ts b/frontend/src/components/IssueV1/logic/initialize/index.ts
index 9a829cfefb..677d0228c6 100644
--- a/frontend/src/components/IssueV1/logic/initialize/index.ts
+++ b/frontend/src/components/IssueV1/logic/initialize/index.ts
@@ -9,7 +9,7 @@ import {
} from "@/store";
import type { ComposedIssue, ComposedProject } from "@/types";
import { emptyIssue, EMPTY_ID, UNKNOWN_ID } from "@/types";
-import { IssueStatus } from "@/types/proto/v1/issue_service";
+import { IssueStatus } from "@/types/proto-es/v1/issue_service_pb";
import { uidFromSlug, hasProjectPermissionV2 } from "@/utils";
import { createIssueSkeleton } from "./create";
diff --git a/frontend/src/components/IssueV1/logic/plan-check.ts b/frontend/src/components/IssueV1/logic/plan-check.ts
index 0c705374ba..a5d2bd2aba 100644
--- a/frontend/src/components/IssueV1/logic/plan-check.ts
+++ b/frontend/src/components/IssueV1/logic/plan-check.ts
@@ -4,20 +4,20 @@ import type { ComposedIssue } from "@/types";
import {
PlanCheckRun_Result_Status,
type Plan_Spec,
-} from "@/types/proto/v1/plan_service";
-import type { Task } from "@/types/proto/v1/rollout_service";
-import { Task_Status } from "@/types/proto/v1/rollout_service";
+} from "@/types/proto-es/v1/plan_service_pb";
+import type { Task } from "@/types/proto-es/v1/rollout_service_pb";
+import { Task_Status } from "@/types/proto-es/v1/rollout_service_pb";
import { databaseForTask } from "@/utils";
import { specForTask, useIssueContext, projectOfIssue } from ".";
export const planSpecHasPlanChecks = (spec: Plan_Spec) => {
- if (spec.createDatabaseConfig) {
+ if (spec.config?.case === "createDatabaseConfig") {
return false;
}
- if (spec.changeDatabaseConfig !== undefined) {
+ if (spec.config?.case === "changeDatabaseConfig") {
return true;
}
- if (spec.exportDataConfig !== undefined) {
+ if (spec.config?.case === "exportDataConfig") {
return true;
}
return false;
@@ -49,8 +49,8 @@ export const planCheckStatusForTask = (task: Task) => {
export const planCheckRunSummaryForIssue = (issue: ComposedIssue) => {
const sheets = issue.planEntity?.specs.reduce((acc, spec) => {
- if (spec.changeDatabaseConfig?.sheet) {
- acc.add(spec.changeDatabaseConfig.sheet);
+ if (spec.config?.case === "changeDatabaseConfig" && spec.config.value.sheet) {
+ acc.add(spec.config.value.sheet);
}
return acc;
}, new Set<string>());
diff --git a/frontend/src/components/IssueV1/logic/poll.ts b/frontend/src/components/IssueV1/logic/poll.ts
index 14d95dcd5f..7c5a84317e 100644
--- a/frontend/src/components/IssueV1/logic/poll.ts
+++ b/frontend/src/components/IssueV1/logic/poll.ts
@@ -9,8 +9,8 @@ import {
} from "@/store";
import { useListCache } from "@/store/modules/v1/cache";
import type { ComposedIssue } from "@/types";
-import { IssueStatus } from "@/types/proto/v1/issue_service";
-import { Task_Type } from "@/types/proto/v1/rollout_service";
+import { IssueStatus } from "@/types/proto-es/v1/issue_service_pb";
+import { Task_Type } from "@/types/proto-es/v1/rollout_service_pb";
import { databaseForTask } from "@/utils";
import { extractIssueUID, flattenTaskV1List } from "@/utils";
import { useIssueContext } from "./context";
@@ -33,7 +33,6 @@ const clearCache = (issue: ComposedIssue) => {
});
break;
case Task_Type.DATABASE_EXPORT:
- case Task_Type.UNRECOGNIZED:
case Task_Type.TYPE_UNSPECIFIED:
continue;
case Task_Type.DATABASE_DATA_UPDATE:
diff --git a/frontend/src/components/IssueV1/logic/review.ts b/frontend/src/components/IssueV1/logic/review.ts
index 84a778a17f..5f18d47982 100644
--- a/frontend/src/components/IssueV1/logic/review.ts
+++ b/frontend/src/components/IssueV1/logic/review.ts
@@ -16,11 +16,11 @@ import type {
ApprovalNode,
ApprovalStep,
Issue,
-} from "@/types/proto/v1/issue_service";
+} from "@/types/proto-es/v1/issue_service_pb";
import {
ApprovalNode_Type,
Issue_Approver_Status,
-} from "@/types/proto/v1/issue_service";
+} from "@/types/proto-es/v1/issue_service_pb";
import { displayRoleTitle } from "@/utils";
import { isUserIncludedInList } from "@/utils";
import type { ReviewContext } from "./context";
diff --git a/frontend/src/components/IssueV1/logic/rollout.ts b/frontend/src/components/IssueV1/logic/rollout.ts
index 65ac930b1b..bbd24c68d8 100644
--- a/frontend/src/components/IssueV1/logic/rollout.ts
+++ b/frontend/src/components/IssueV1/logic/rollout.ts
@@ -2,13 +2,12 @@ import { head, includes } from "lodash-es";
import { t } from "@/plugins/i18n";
import { extractUserId, useCurrentUserV1 } from "@/store";
import type { ComposedIssue } from "@/types";
-import { Issue_Type, IssueStatus } from "@/types/proto/v1/issue_service";
-import type { Task } from "@/types/proto/v1/rollout_service";
+import { Issue_Type, IssueStatus } from "@/types/proto-es/v1/issue_service_pb";
+import type { Task } from "@/types/proto-es/v1/rollout_service_pb";
import {
Task_Status,
- task_StatusToJSON,
Task_Type,
-} from "@/types/proto/v1/rollout_service";
+} from "@/types/proto-es/v1/rollout_service_pb";
import { extractDatabaseGroupName, hasProjectPermissionV2 } from "@/utils";
import { projectOfIssue, specForTask } from ".";
@@ -17,7 +16,9 @@ export const isGroupingChangeTaskV1 = (issue: ComposedIssue, task: Task) => {
if (!spec) {
return false;
}
- const target = head(spec.changeDatabaseConfig?.targets);
+ const target = spec.config?.case === "changeDatabaseConfig"
+ ? head(spec.config.value.targets)
+ : undefined;
const databaseGroup = extractDatabaseGroupName(target ?? "");
return databaseGroup !== "";
};
@@ -53,7 +54,7 @@ export const allowUserToEditStatementForTask = (
// - user is the creator
// - OR user has plans.update permission in the project
if (!isTaskEditable(task)) {
- denyReasons.push(`${task_StatusToJSON(task.status)} task is not editable`);
+ denyReasons.push(`${Task_Status[task.status]} task is not editable`);
}
if (extractUserId(issue.creator) !== user.value.email) {
diff --git a/frontend/src/components/IssueV1/logic/task-run.ts b/frontend/src/components/IssueV1/logic/task-run.ts
index efed69048b..8e1f993d5f 100644
--- a/frontend/src/components/IssueV1/logic/task-run.ts
+++ b/frontend/src/components/IssueV1/logic/task-run.ts
@@ -1,6 +1,6 @@
import { first, orderBy } from "lodash-es";
import type { ComposedIssue } from "@/types";
-import type { Task } from "@/types/proto/v1/rollout_service";
+import type { Task } from "@/types/proto-es/v1/rollout_service_pb";
import { extractTaskRunUID, extractTaskUID } from "@/utils";
export const taskRunListForTask = (issue: ComposedIssue, task: Task) => {
diff --git a/frontend/src/components/IssueV1/logic/utils.ts b/frontend/src/components/IssueV1/logic/utils.ts
index 3ab7d6ed7a..283dd5fb38 100644
--- a/frontend/src/components/IssueV1/logic/utils.ts
+++ b/frontend/src/components/IssueV1/logic/utils.ts
@@ -16,9 +16,10 @@ import {
import { State } from "@/types/proto-es/v1/common_pb";
import { create } from "@bufbuild/protobuf";
import { InstanceResourceSchema } from "@/types/proto-es/v1/instance_service_pb";
-import { IssueStatus } from "@/types/proto/v1/issue_service";
-import type { Plan } from "@/types/proto/v1/plan_service";
-import { Task, Task_Status, Task_Type } from "@/types/proto/v1/rollout_service";
+import { IssueStatus } from "@/types/proto-es/v1/issue_service_pb";
+import type { Plan } from "@/types/proto-es/v1/plan_service_pb";
+import type { Task } from "@/types/proto-es/v1/rollout_service_pb";
+import { Task_Status, Task_Type } from "@/types/proto-es/v1/rollout_service_pb";
import {
defer,
extractDatabaseResourceName,
@@ -139,8 +140,8 @@ export const extractCoreDatabaseInfoFromDatabaseCreateTask = (
};
};
- if (task.databaseCreate) {
- const databaseName = task.databaseCreate.database;
+ if (task.payload?.case === "databaseCreate") {
+ const databaseName = task.payload.value.database;
const instance = task.target;
return coreDatabaseInfo(instance, databaseName);
}
diff --git a/frontend/src/components/MarkdownEditor/MarkdownEditor.vue b/frontend/src/components/MarkdownEditor/MarkdownEditor.vue
index 42ad8d83af..7444c716bd 100644
--- a/frontend/src/components/MarkdownEditor/MarkdownEditor.vue
+++ b/frontend/src/components/MarkdownEditor/MarkdownEditor.vue
@@ -100,7 +100,7 @@ import { nextTick, ref, reactive, watch, toRef } from "vue";
import type { Component } from "vue";
import { useI18n } from "vue-i18n";
import type { ComposedIssue, ComposedProject } from "@/types";
-import { Task_Status } from "@/types/proto/v1/rollout_service";
+import { Task_Status } from "@/types/proto-es/v1/rollout_service_pb";
import {
activeTaskInRollout,
extractIssueUID,
@@ -439,7 +439,7 @@ const issueTaskStatus = (issue: ComposedIssue) => {
return Task_Status.NOT_STARTED;
}
- return activeTaskInRollout(issue.rolloutEntity).status;
+ return activeTaskInRollout(issue.rolloutEntity)?.status;
};
const adjustIssuePanelWithPosition = () => {
diff --git a/frontend/src/components/Plan/PlanDetailPage.vue b/frontend/src/components/Plan/PlanDetailPage.vue
index dcc475228c..727103ed1f 100644
--- a/frontend/src/components/Plan/PlanDetailPage.vue
+++ b/frontend/src/components/Plan/PlanDetailPage.vue
@@ -53,7 +53,6 @@ import {
extractIssueUID,
extractPlanUID,
extractRolloutUID,
- isNullOrUndefined,
} from "@/utils";
import { ChecksView, HeaderSection, Overview } from "./components";
import CurrentSpecSelector from "./components/CurrentSpecSelector.vue";
@@ -110,7 +109,7 @@ const availableTabs = computed<TabKey[]>(() => {
if (!isCreating.value) {
if (
plan.value.specs.some(
- (spec) => !isNullOrUndefined(spec.changeDatabaseConfig)
+ (spec) => spec.config?.case === "changeDatabaseConfig"
)
) {
tabs.push(TabKey.Checks);
diff --git a/frontend/src/components/Plan/components/AddSpecDrawer.vue b/frontend/src/components/Plan/components/AddSpecDrawer.vue
index 186d60eede..c34364471c 100644
--- a/frontend/src/components/Plan/components/AddSpecDrawer.vue
+++ b/frontend/src/components/Plan/components/AddSpecDrawer.vue
@@ -11,13 +11,7 @@
<!-- Steps indicator -->
<NSteps :current="currentStep">
<NStep
- :title="
- currentStep === 1
- ? $t('plan.change-type')
- : changeType === 'DATA'
- ? $t('plan.data-change')
- : $t('plan.schema-migration')
- "
+ :title="stepTitle"
/>
<NStep :title="$t('plan.select-targets')" />
</NSteps>
@@ -27,15 +21,14 @@
<!-- Step 1: Select Change Type -->
<template v-if="currentStep === 1">
<NRadioGroup
- v-model:value="changeType"
+ v-model:value="selectedChangeType"
size="large"
class="space-y-4 w-full"
>
<div
class="border border-gray-200 rounded-lg p-4 hover:border-gray-300 transition-colors"
:class="{
- 'border-blue-500 bg-blue-50':
- changeType === Plan_ChangeDatabaseConfig_Type.MIGRATE,
+ 'border-blue-500 bg-blue-50': isMigrateSelected,
}"
>
<NRadio
@@ -63,8 +56,7 @@
<div
class="border border-gray-200 rounded-lg p-4 hover:border-gray-300 transition-colors"
:class="{
- 'border-blue-500 bg-blue-50':
- changeType === Plan_ChangeDatabaseConfig_Type.DATA,
+ 'border-blue-500 bg-blue-50': isDataSelected,
}"
>
<NRadio
@@ -118,7 +110,7 @@
<NButton
v-if="currentStep === 1"
type="primary"
- :disabled="!changeType"
+ :disabled="!selectedChangeType"
@click="handleNextStep"
>
{{ $t("common.next") }}
@@ -143,7 +135,9 @@
import { FileDiffIcon, EditIcon } from "lucide-vue-next";
import { NButton, NRadio, NRadioGroup, NSteps, NStep } from "naive-ui";
import { v4 as uuidv4 } from "uuid";
+import type { Ref } from "vue";
import { computed, reactive, ref, watch } from "vue";
+import { useI18n } from "vue-i18n";
import DatabaseAndGroupSelector from "@/components/DatabaseAndGroupSelector";
import type { DatabaseSelectState } from "@/components/DatabaseAndGroupSelector";
import { getLocalSheetByName, getNextLocalSheetUID } from "@/components/Plan";
@@ -151,10 +145,10 @@ import { Drawer, DrawerContent } from "@/components/v2";
import { useCurrentProjectV1 } from "@/store";
import { create as createProto } from "@bufbuild/protobuf";
import {
- Plan_ChangeDatabaseConfig,
Plan_ChangeDatabaseConfig_Type,
-} from "@/types/proto/v1/plan_service";
-import type { Plan_Spec } from "@/types/proto/v1/plan_service";
+ Plan_ChangeDatabaseConfigSchema,
+} from "@/types/proto-es/v1/plan_service_pb";
+import { Plan_SpecSchema, type Plan_Spec } from "@/types/proto-es/v1/plan_service_pb";
import { SheetSchema } from "@/types/proto-es/v1/sheet_service_pb";
defineProps<{
@@ -166,9 +160,10 @@ const emit = defineEmits<{
}>();
const { project } = useCurrentProjectV1();
+const { t } = useI18n();
const show = defineModel<boolean>("show", { default: false });
-const changeType = ref<"MIGRATE" | "DATA">("MIGRATE");
+const selectedChangeType: Ref<Plan_ChangeDatabaseConfig_Type> = ref(Plan_ChangeDatabaseConfig_Type.MIGRATE);
const isCreating = ref(false);
const currentStep = ref(1);
@@ -186,14 +181,31 @@ const hasSelection = computed(() => {
});
const canSubmit = computed(() => {
- return hasSelection.value && changeType.value;
+ return hasSelection.value && selectedChangeType.value;
+});
+
+const stepTitle = computed(() => {
+ if (currentStep.value === 1) {
+ return t('plan.change-type');
+ }
+ return selectedChangeType.value === Plan_ChangeDatabaseConfig_Type.DATA
+ ? t('plan.data-change')
+ : t('plan.schema-migration');
+});
+
+const isMigrateSelected = computed(() => {
+ return selectedChangeType.value === Plan_ChangeDatabaseConfig_Type.MIGRATE;
+});
+
+const isDataSelected = computed(() => {
+ return selectedChangeType.value === Plan_ChangeDatabaseConfig_Type.DATA;
});
// Reset state when drawer opens
watch(show, (newVal) => {
if (newVal) {
currentStep.value = 1;
- changeType.value = "MIGRATE";
+ selectedChangeType.value = Plan_ChangeDatabaseConfig_Type.MIGRATE;
databaseSelectState.changeSource = "DATABASE";
databaseSelectState.selectedDatabaseNameList = [];
databaseSelectState.selectedDatabaseGroup = undefined;
@@ -210,7 +222,7 @@ const handleCancel = () => {
};
const handleNextStep = () => {
- if (currentStep.value === 1 && changeType.value) {
+ if (currentStep.value === 1 && selectedChangeType.value) {
currentStep.value = 2;
}
};
@@ -238,21 +250,21 @@ const handleConfirm = async () => {
const sheet = createProto(SheetSchema, {
...getLocalSheetByName(`${project.value.name}/sheets/${sheetUID}`),
title:
- changeType.value === "MIGRATE" ? "Schema Migration" : "Data Change",
+ selectedChangeType.value === Plan_ChangeDatabaseConfig_Type.MIGRATE ? "Schema Migration" : "Data Change",
});
// Create spec
- const spec: Plan_Spec = {
+ const spec = createProto(Plan_SpecSchema, {
id: uuidv4(),
- changeDatabaseConfig: Plan_ChangeDatabaseConfig.fromPartial({
- targets,
- type:
- changeType.value === "MIGRATE"
- ? Plan_ChangeDatabaseConfig_Type.MIGRATE
- : Plan_ChangeDatabaseConfig_Type.DATA,
- sheet: sheet.name,
- }),
- };
+ config: {
+ case: "changeDatabaseConfig",
+ value: createProto(Plan_ChangeDatabaseConfigSchema, {
+ targets,
+ type: selectedChangeType.value,
+ sheet: sheet.name,
+ }),
+ },
+ });
emit("created", spec);
show.value = false;
diff --git a/frontend/src/components/Plan/components/ChecksView/ChecksView.vue b/frontend/src/components/Plan/components/ChecksView/ChecksView.vue
index 7e39629229..110cd5c740 100644
--- a/frontend/src/components/Plan/components/ChecksView/ChecksView.vue
+++ b/frontend/src/components/Plan/components/ChecksView/ChecksView.vue
@@ -142,12 +142,12 @@
</div>
<div
v-if="
- result.sqlReviewReport && result.sqlReviewReport.line > 0
+ result.report?.case === 'sqlReviewReport' && result.report.value.line > 0
"
class="text-xs text-control-lighter mt-1"
>
- Line {{ result.sqlReviewReport.line }}, Column
- {{ result.sqlReviewReport.column }}
+ Line {{ result.report.value.line }}, Column
+ {{ result.report.value.column }}
</div>
</div>
</div>
@@ -176,7 +176,7 @@ import {
PlanCheckRun_Result_Status,
PlanCheckRun_Type,
type PlanCheckRun,
-} from "@/types/proto/v1/plan_service";
+} from "@/types/proto-es/v1/plan_service_pb";
import { humanizeTs } from "@/utils";
import { usePlanContext } from "../../logic/context";
import DatabaseDisplay from "../common/DatabaseDisplay.vue";
@@ -370,6 +370,6 @@ const getStatusLabel = (status: PlanCheckRun_Result_Status) => {
const formatTime = (timestamp: any): string => {
if (!timestamp) return "";
- return humanizeTs(new Date(timestamp.seconds * 1000).getTime() / 1000);
+ return humanizeTs(new Date(Number(timestamp.seconds) * 1000).getTime() / 1000);
};
</script>
diff --git a/frontend/src/components/Plan/components/Configuration/GhostSection/GhostFlagsPanel.vue b/frontend/src/components/Plan/components/Configuration/GhostSection/GhostFlagsPanel.vue
index a18b3d3438..5cf9780248 100644
--- a/frontend/src/components/Plan/components/Configuration/GhostSection/GhostFlagsPanel.vue
+++ b/frontend/src/components/Plan/components/Configuration/GhostSection/GhostFlagsPanel.vue
@@ -46,7 +46,6 @@ import { Drawer, DrawerContent } from "@/components/v2";
import { create } from "@bufbuild/protobuf";
import { planServiceClientConnect } from "@/grpcweb";
import { UpdatePlanRequestSchema } from "@/types/proto-es/v1/plan_service_pb";
-import { convertOldPlanToNew, convertNewPlanToOld } from "@/utils/v1/plan-conversions";
import { pushNotification } from "@/store";
import FlagsForm from "./FlagsForm";
import { useGhostSettingContext } from "./context";
@@ -67,7 +66,7 @@ const title = computed(() => {
return t("task.online-migration.configure-ghost-parameters");
});
const config = computed(() => {
- return selectedSpec.value?.changeDatabaseConfig;
+ return selectedSpec.value?.config?.case === "changeDatabaseConfig" ? selectedSpec.value.config.value : undefined;
});
const flags = ref<Record<string, string>>({});
@@ -98,29 +97,27 @@ const trySave = async () => {
}
if (isCreating.value) {
- if (!selectedSpec.value || !selectedSpec.value.changeDatabaseConfig) return;
- selectedSpec.value.changeDatabaseConfig.ghostFlags = cloneDeep(flags.value);
+ if (!selectedSpec.value || selectedSpec.value.config?.case !== "changeDatabaseConfig") return;
+ selectedSpec.value.config.value.ghostFlags = cloneDeep(flags.value);
} else {
const planPatch = cloneDeep(plan.value);
const spec = (planPatch?.specs || []).find((spec) => {
return spec.id === selectedSpec.value?.id;
});
- if (!planPatch || !spec || !spec.changeDatabaseConfig) {
+ if (!planPatch || !spec || spec.config?.case !== "changeDatabaseConfig") {
// Should not reach here.
throw new Error(
"Plan or spec is not defined. Cannot update gh-ost flags."
);
}
- spec.changeDatabaseConfig.ghostFlags = cloneDeep(flags.value);
- const newPlan = convertOldPlanToNew(planPatch);
+ spec.config.value.ghostFlags = cloneDeep(flags.value);
const request = create(UpdatePlanRequestSchema, {
- plan: newPlan,
+ plan: planPatch,
updateMask: { paths: ["specs"] },
});
const response = await planServiceClientConnect.updatePlan(request);
- const updated = convertNewPlanToOld(response);
- Object.assign(plan.value, updated);
+ Object.assign(plan.value, response);
pushNotification({
module: "bytebase",
diff --git a/frontend/src/components/Plan/components/Configuration/GhostSection/GhostSwitch.vue b/frontend/src/components/Plan/components/Configuration/GhostSection/GhostSwitch.vue
index d79421d0ea..5350f01ff5 100644
--- a/frontend/src/components/Plan/components/Configuration/GhostSection/GhostSwitch.vue
+++ b/frontend/src/components/Plan/components/Configuration/GhostSection/GhostSwitch.vue
@@ -26,9 +26,8 @@ import { default as ErrorList } from "@/components/misc/ErrorList.vue";
import { create } from "@bufbuild/protobuf";
import { planServiceClientConnect } from "@/grpcweb";
import { UpdatePlanRequestSchema } from "@/types/proto-es/v1/plan_service_pb";
-import { convertOldPlanToNew, convertNewPlanToOld } from "@/utils/v1/plan-conversions";
import { pushNotification } from "@/store";
-import { Plan_ChangeDatabaseConfig_Type } from "@/types/proto/v1/plan_service";
+import { Plan_ChangeDatabaseConfig_Type } from "@/types/proto-es/v1/plan_service_pb";
import { allowGhostForDatabase } from "./common";
import { useGhostSettingContext } from "./context";
@@ -129,8 +128,8 @@ const toggleChecked = async (on: boolean) => {
}
if (isCreating.value) {
- if (!selectedSpec.value || !selectedSpec.value.changeDatabaseConfig) return;
- selectedSpec.value.changeDatabaseConfig.type = on
+ if (!selectedSpec.value || selectedSpec.value.config?.case !== "changeDatabaseConfig") return;
+ selectedSpec.value.config.value.type = on
? Plan_ChangeDatabaseConfig_Type.MIGRATE_GHOST
: Plan_ChangeDatabaseConfig_Type.MIGRATE;
} else {
@@ -138,24 +137,22 @@ const toggleChecked = async (on: boolean) => {
const spec = (planPatch?.specs || []).find((spec) => {
return spec.id === selectedSpec.value?.id;
});
- if (!planPatch || !spec || !spec.changeDatabaseConfig) {
+ if (!planPatch || !spec || spec.config?.case !== "changeDatabaseConfig") {
// Should not reach here.
throw new Error(
"Plan or spec is not defined. Cannot update gh-ost setting."
);
}
- spec.changeDatabaseConfig.type = on
+ spec.config.value.type = on
? Plan_ChangeDatabaseConfig_Type.MIGRATE_GHOST
: Plan_ChangeDatabaseConfig_Type.MIGRATE;
- const newPlan = convertOldPlanToNew(planPatch);
const request = create(UpdatePlanRequestSchema, {
- plan: newPlan,
+ plan: planPatch,
updateMask: { paths: ["specs"] },
});
const response = await planServiceClientConnect.updatePlan(request);
- const updated = convertNewPlanToOld(response);
- Object.assign(plan.value, updated);
+ Object.assign(plan.value, response);
pushNotification({
module: "bytebase",
diff --git a/frontend/src/components/Plan/components/Configuration/GhostSection/common.ts b/frontend/src/components/Plan/components/Configuration/GhostSection/common.ts
index 93c3880f7d..d700ee9095 100644
--- a/frontend/src/components/Plan/components/Configuration/GhostSection/common.ts
+++ b/frontend/src/components/Plan/components/Configuration/GhostSection/common.ts
@@ -4,7 +4,7 @@ import { Engine } from "@/types/proto-es/v1/common_pb";
import {
Plan_ChangeDatabaseConfig_Type,
type Plan_Spec,
-} from "@/types/proto/v1/plan_service";
+} from "@/types/proto-es/v1/plan_service_pb";
import { semverCompare } from "@/utils";
export const GHOST_AVAILABLE_ENGINES = [Engine.MYSQL, Engine.MARIADB];
@@ -32,7 +32,7 @@ export const allowGhostForDatabase = (database: ComposedDatabase) => {
};
export const allowGhostForSpec = (spec: Plan_Spec | undefined) => {
- const config = spec?.changeDatabaseConfig;
+ const config = spec?.config?.case === "changeDatabaseConfig" ? spec.config.value : undefined;
if (!config) return false;
return [
@@ -47,7 +47,7 @@ export const getGhostEnabledForSpec = (
if (isDBGroupChangeSpec(spec)) {
return undefined;
}
- const config = spec?.changeDatabaseConfig;
+ const config = spec?.config?.case === "changeDatabaseConfig" ? spec.config.value : undefined;
if (!config) {
return undefined;
}
diff --git a/frontend/src/components/Plan/components/Configuration/GhostSection/context.ts b/frontend/src/components/Plan/components/Configuration/GhostSection/context.ts
index 633bfcad69..ede50c12c0 100644
--- a/frontend/src/components/Plan/components/Configuration/GhostSection/context.ts
+++ b/frontend/src/components/Plan/components/Configuration/GhostSection/context.ts
@@ -4,13 +4,11 @@ import { computed, inject, provide, unref } from "vue";
import { targetsForSpec } from "@/components/Plan/logic";
import { useCurrentUserV1, extractUserId, useDatabaseV1Store } from "@/store";
import { isValidDatabaseName, type ComposedProject } from "@/types";
-import { Issue, IssueStatus } from "@/types/proto/v1/issue_service";
-import type { Plan, Plan_Spec } from "@/types/proto/v1/plan_service";
-import {
- Task,
- Task_Status,
- type Rollout,
-} from "@/types/proto/v1/rollout_service";
+import type { Issue } from "@/types/proto-es/v1/issue_service_pb";
+import { IssueStatus } from "@/types/proto-es/v1/issue_service_pb";
+import type { Plan, Plan_Spec } from "@/types/proto-es/v1/plan_service_pb";
+import type { Task, Rollout } from "@/types/proto-es/v1/rollout_service_pb";
+import { Task_Status } from "@/types/proto-es/v1/rollout_service_pb";
import {
flattenTaskV1List,
hasProjectPermissionV2,
diff --git a/frontend/src/components/Plan/components/Configuration/PreBackupSection/context.ts b/frontend/src/components/Plan/components/Configuration/PreBackupSection/context.ts
index 6b8583f579..3f8575a4e0 100644
--- a/frontend/src/components/Plan/components/Configuration/PreBackupSection/context.ts
+++ b/frontend/src/components/Plan/components/Configuration/PreBackupSection/context.ts
@@ -12,21 +12,17 @@ import { isDatabaseChangeSpec, targetsForSpec } from "@/components/Plan/logic";
import { create } from "@bufbuild/protobuf";
import { planServiceClientConnect } from "@/grpcweb";
import { UpdatePlanRequestSchema } from "@/types/proto-es/v1/plan_service_pb";
-import { convertOldPlanToNew } from "@/utils/v1/plan-conversions";
import { useCurrentUserV1, extractUserId, useDatabaseV1Store } from "@/store";
import { isValidDatabaseName, type ComposedProject } from "@/types";
import { Engine } from "@/types/proto-es/v1/common_pb";
-import { IssueStatus, type Issue } from "@/types/proto/v1/issue_service";
+import { IssueStatus, type Issue } from "@/types/proto-es/v1/issue_service_pb";
import {
Plan_ChangeDatabaseConfig_Type,
type Plan,
type Plan_Spec,
-} from "@/types/proto/v1/plan_service";
-import {
- Task,
- Task_Status,
- type Rollout,
-} from "@/types/proto/v1/rollout_service";
+} from "@/types/proto-es/v1/plan_service_pb";
+import type { Task, Rollout } from "@/types/proto-es/v1/rollout_service_pb";
+import { Task_Status } from "@/types/proto-es/v1/rollout_service_pb";
import { flattenTaskV1List, hasProjectPermissionV2 } from "@/utils";
import { BACKUP_AVAILABLE_ENGINES } from "./common";
@@ -75,8 +71,8 @@ export const providePreBackupSettingContext = (refs: {
const shouldShow = computed((): boolean => {
if (
!selectedSpec.value ||
- selectedSpec.value.changeDatabaseConfig?.type !==
- Plan_ChangeDatabaseConfig_Type.DATA
+ selectedSpec.value.config?.case !== "changeDatabaseConfig" ||
+ selectedSpec.value.config.value.type !== Plan_ChangeDatabaseConfig_Type.DATA
) {
return false;
}
@@ -135,16 +131,21 @@ export const providePreBackupSettingContext = (refs: {
});
const enabled = computed((): boolean => {
- return Boolean(selectedSpec.value?.changeDatabaseConfig?.enablePriorBackup);
+ if (
+ selectedSpec.value?.config?.case === "changeDatabaseConfig"
+ ) {
+ return Boolean(selectedSpec.value.config.value.enablePriorBackup);
+ }
+ return false;
});
const toggle = async (on: boolean) => {
if (isCreating.value) {
- if (selectedSpec.value && selectedSpec.value.changeDatabaseConfig) {
+ if (selectedSpec.value?.config?.case === "changeDatabaseConfig") {
if (on) {
- selectedSpec.value.changeDatabaseConfig.enablePriorBackup = true;
+ selectedSpec.value.config.value.enablePriorBackup = true;
} else {
- selectedSpec.value.changeDatabaseConfig.enablePriorBackup = false;
+ selectedSpec.value.config.value.enablePriorBackup = false;
}
}
} else {
@@ -152,21 +153,20 @@ export const providePreBackupSettingContext = (refs: {
const spec = (planPatch?.specs || []).find((s) => {
return s.id === selectedSpec.value?.id;
});
- if (!planPatch || !spec || !spec.changeDatabaseConfig) {
+ if (!planPatch || !spec || spec.config?.case !== "changeDatabaseConfig") {
// Should not reach here.
throw new Error(
"Plan or spec is not defined. Cannot update pre-backup setting."
);
}
if (on) {
- spec.changeDatabaseConfig.enablePriorBackup = true;
+ spec.config.value.enablePriorBackup = true;
} else {
- spec.changeDatabaseConfig.enablePriorBackup = false;
+ spec.config.value.enablePriorBackup = false;
}
- const newPlan = convertOldPlanToNew(planPatch);
const request = create(UpdatePlanRequestSchema, {
- plan: newPlan,
+ plan: planPatch,
updateMask: { paths: ["specs"] },
});
await planServiceClientConnect.updatePlan(request);
diff --git a/frontend/src/components/Plan/components/CurrentSpecSelector.vue b/frontend/src/components/Plan/components/CurrentSpecSelector.vue
index ae50a0a6ed..4f6a10a002 100644
--- a/frontend/src/components/Plan/components/CurrentSpecSelector.vue
+++ b/frontend/src/components/Plan/components/CurrentSpecSelector.vue
@@ -37,7 +37,7 @@ import { useRoute, useRouter } from "vue-router";
import {
Plan_ChangeDatabaseConfig_Type,
type Plan_Spec,
-} from "@/types/proto/v1/plan_service";
+} from "@/types/proto-es/v1/plan_service_pb";
import { usePlanContext } from "../logic";
import AddSpecDrawer from "./AddSpecDrawer.vue";
import { gotoSpec } from "./common/utils";
@@ -84,10 +84,10 @@ const selectedSpec = computed(() => {
});
const getSpecTypeName = (spec: Plan_Spec): string => {
- if (spec.createDatabaseConfig) {
+ if (spec.config?.case === "createDatabaseConfig") {
return t("plan.spec.type.create-database");
- } else if (spec.changeDatabaseConfig) {
- const changeType = spec.changeDatabaseConfig.type;
+ } else if (spec.config?.case === "changeDatabaseConfig") {
+ const changeType = spec.config.value.type;
switch (changeType) {
case Plan_ChangeDatabaseConfig_Type.MIGRATE:
return t("plan.spec.type.schema-change");
@@ -98,7 +98,7 @@ const getSpecTypeName = (spec: Plan_Spec): string => {
default:
return t("plan.spec.type.database-change");
}
- } else if (spec.exportDataConfig) {
+ } else if (spec.config?.case === "exportDataConfig") {
return t("plan.spec.type.export-data");
}
return t("plan.spec.type.unknown");
diff --git a/frontend/src/components/Plan/components/DescriptionSection.vue b/frontend/src/components/Plan/components/DescriptionSection.vue
index ea68abf769..dba4ff520f 100644
--- a/frontend/src/components/Plan/components/DescriptionSection.vue
+++ b/frontend/src/components/Plan/components/DescriptionSection.vue
@@ -73,14 +73,13 @@ import { create } from "@bufbuild/protobuf";
import { useRenderMarkdown } from "@/components/MarkdownEditor";
import { planServiceClientConnect } from "@/grpcweb";
import { UpdatePlanRequestSchema } from "@/types/proto-es/v1/plan_service_pb";
-import { convertOldPlanToNew, convertNewPlanToOld } from "@/utils/v1/plan-conversions";
import {
pushNotification,
useCurrentUserV1,
extractUserId,
useCurrentProjectV1,
} from "@/store";
-import { Plan } from "@/types/proto/v1/plan_service";
+import { PlanSchema } from "@/types/proto-es/v1/plan_service_pb";
import { hasProjectPermissionV2 } from "@/utils";
import { usePlanContext } from "../logic";
@@ -138,18 +137,16 @@ const beginEdit = () => {
const saveEdit = async () => {
try {
state.isUpdating = true;
- const planPatch = Plan.fromPartial({
+ const planPatch = create(PlanSchema, {
...plan.value,
description: state.description,
});
- const newPlan = convertOldPlanToNew(planPatch);
const request = create(UpdatePlanRequestSchema, {
- plan: newPlan,
+ plan: planPatch,
updateMask: { paths: ["description"] },
});
const response = await planServiceClientConnect.updatePlan(request);
- const updated = convertNewPlanToOld(response);
- Object.assign(plan.value, updated);
+ Object.assign(plan.value, response);
pushNotification({
module: "bytebase",
style: "SUCCESS",
diff --git a/frontend/src/components/Plan/components/HeaderSection/Actions/Actions.vue b/frontend/src/components/Plan/components/HeaderSection/Actions/Actions.vue
index 72383a15d2..fed04f9e7e 100644
--- a/frontend/src/components/Plan/components/HeaderSection/Actions/Actions.vue
+++ b/frontend/src/components/Plan/components/HeaderSection/Actions/Actions.vue
@@ -41,7 +41,7 @@ import {
import {
IssueStatus,
Issue_Approver_Status,
-} from "@/types/proto/v1/issue_service";
+} from "@/types/proto-es/v1/issue_service_pb";
import { isUserIncludedInList, hasProjectPermissionV2 } from "@/utils";
import { CreateButton } from "./create";
import {
diff --git a/frontend/src/components/Plan/components/HeaderSection/Actions/create/CreateButton.vue b/frontend/src/components/Plan/components/HeaderSection/Actions/create/CreateButton.vue
index b97e78c697..5b8d84babe 100644
--- a/frontend/src/components/Plan/components/HeaderSection/Actions/create/CreateButton.vue
+++ b/frontend/src/components/Plan/components/HeaderSection/Actions/create/CreateButton.vue
@@ -47,7 +47,7 @@ import { planServiceClientConnect } from "@/grpcweb";
import { PROJECT_V1_ROUTE_PLAN_DETAIL } from "@/router/dashboard/projectV1";
import { useCurrentProjectV1, useSheetV1Store } from "@/store";
import { CreatePlanRequestSchema } from "@/types/proto-es/v1/plan_service_pb";
-import { type Plan_ChangeDatabaseConfig } from "@/types/proto/v1/plan_service";
+import { type Plan_ChangeDatabaseConfig } from "@/types/proto-es/v1/plan_service_pb";
import type { Sheet } from "@/types/proto-es/v1/sheet_service_pb";
import {
extractPlanUID,
@@ -55,10 +55,6 @@ import {
extractSheetUID,
hasProjectPermissionV2,
} from "@/utils";
-import {
- convertOldPlanToNew,
- convertNewPlanToOld,
-} from "@/utils/v1/plan-conversions";
const { t } = useI18n();
const router = useRouter();
@@ -89,13 +85,11 @@ const doCreatePlan = async () => {
try {
await createSheets();
- const newPlan = convertOldPlanToNew(plan.value);
const request = create(CreatePlanRequestSchema, {
parent: project.value.name,
- plan: newPlan,
+ plan: plan.value,
});
- const response = await planServiceClientConnect.createPlan(request);
- const createdPlan = convertNewPlanToOld(response);
+ const createdPlan = await planServiceClientConnect.createPlan(request);
if (!createdPlan) return;
nextTick(() => {
@@ -122,7 +116,7 @@ const createSheets = async () => {
for (let i = 0; i < specs.length; i++) {
const spec = specs[i];
- const config = spec.changeDatabaseConfig;
+ const config = spec.config?.case === "changeDatabaseConfig" ? spec.config.value : null;
if (!config) continue;
configWithSheetList.push(config);
if (pendingCreateSheetMap.has(config.sheet)) continue;
diff --git a/frontend/src/components/Plan/components/HeaderSection/Actions/panels/IssueCreationActionPanel.vue b/frontend/src/components/Plan/components/HeaderSection/Actions/panels/IssueCreationActionPanel.vue
index 9a609f7fe2..f4dc2c35e1 100644
--- a/frontend/src/components/Plan/components/HeaderSection/Actions/panels/IssueCreationActionPanel.vue
+++ b/frontend/src/components/Plan/components/HeaderSection/Actions/panels/IssueCreationActionPanel.vue
@@ -81,12 +81,11 @@ import {
useCurrentUserV1,
usePolicyV1Store,
} from "@/store";
-import { emptyIssue } from "@/types";
import { CreateIssueRequestSchema } from "@/types/proto-es/v1/issue_service_pb";
import { PolicyType } from "@/types/proto-es/v1/org_policy_service_pb";
import { CreateRolloutRequestSchema } from "@/types/proto-es/v1/rollout_service_pb";
-import { Issue, IssueStatus, Issue_Type } from "@/types/proto/v1/issue_service";
-import { PlanCheckRun_Result_Status } from "@/types/proto/v1/plan_service";
+import { IssueSchema, IssueStatus, Issue_Type } from "@/types/proto-es/v1/issue_service_pb";
+import { PlanCheckRun_Result_Status } from "@/types/proto-es/v1/plan_service_pb";
import {
extractProjectResourceName,
hasProjectPermissionV2,
@@ -94,10 +93,6 @@ import {
isDev,
issueV1Slug,
} from "@/utils";
-import {
- convertNewIssueToOld,
- convertOldIssueToNew,
-} from "@/utils/v1/issue-conversions";
type IssueCreationAction = "CREATE";
@@ -215,18 +210,16 @@ const doCreateIssue = async () => {
try {
const issueToCreate = {
- ...Issue.fromPartial(buildIssue()),
+ ...buildIssue(),
rollout: "",
plan: plan.value.name,
};
- const newIssue = convertOldIssueToNew(issueToCreate);
const issueRequest = create(CreateIssueRequestSchema, {
parent: project.value.name,
- issue: newIssue,
+ issue: issueToCreate,
});
const createdIssue =
await issueServiceClientConnect.createIssue(issueRequest);
- convertNewIssueToOld(createdIssue);
// Then create the rollout from the plan
const rolloutRequest = create(CreateRolloutRequestSchema, {
@@ -268,12 +261,14 @@ const doCreateIssue = async () => {
};
const buildIssue = () => {
- const issue = emptyIssue();
- issue.creator = `users/${currentUser.value.email}`;
- issue.title = plan.value.title;
- issue.description = plan.value.description;
- issue.status = IssueStatus.OPEN;
- issue.type = Issue_Type.DATABASE_CHANGE;
- return issue;
+ return create(IssueSchema, {
+ name: "",
+ rollout: "",
+ creator: `users/${currentUser.value.email}`,
+ title: plan.value.title,
+ description: plan.value.description,
+ status: IssueStatus.OPEN,
+ type: Issue_Type.DATABASE_CHANGE,
+ });
};
</script>
diff --git a/frontend/src/components/Plan/components/HeaderSection/Actions/panels/IssueReviewActionPanel.vue b/frontend/src/components/Plan/components/HeaderSection/Actions/panels/IssueReviewActionPanel.vue
index 22a89ae129..5b17225662 100644
--- a/frontend/src/components/Plan/components/HeaderSection/Actions/panels/IssueReviewActionPanel.vue
+++ b/frontend/src/components/Plan/components/HeaderSection/Actions/panels/IssueReviewActionPanel.vue
@@ -92,6 +92,7 @@ import {
RejectIssueRequestSchema,
RequestIssueRequestSchema,
} from "@/types/proto-es/v1/issue_service_pb";
+import { PlanCheckRun_Status } from "@/types/proto-es/v1/plan_service_pb";
import type { IssueReviewAction } from "../unified";
type LocalState = {
@@ -145,10 +146,10 @@ const planCheckErrors = computed(() => {
if (props.action === "APPROVE") {
// Check plan check runs for errors
const failedRuns = planCheckRuns.value.filter(
- (run) => run.status === "FAILED"
+ (run) => run.status === PlanCheckRun_Status.FAILED
);
const runningRuns = planCheckRuns.value.filter(
- (run) => run.status === "RUNNING"
+ (run) => run.status === PlanCheckRun_Status.RUNNING
);
if (failedRuns.length > 0) {
diff --git a/frontend/src/components/Plan/components/HeaderSection/Actions/panels/IssueStatusActionPanel.vue b/frontend/src/components/Plan/components/HeaderSection/Actions/panels/IssueStatusActionPanel.vue
index 50148c8055..b1b4f81f38 100644
--- a/frontend/src/components/Plan/components/HeaderSection/Actions/panels/IssueStatusActionPanel.vue
+++ b/frontend/src/components/Plan/components/HeaderSection/Actions/panels/IssueStatusActionPanel.vue
@@ -62,7 +62,7 @@ import { usePlanContextWithIssue } from "@/components/Plan/logic";
import { create } from "@bufbuild/protobuf";
import { issueServiceClientConnect } from "@/grpcweb";
import { useCurrentProjectV1 } from "@/store";
-import { IssueStatus } from "@/types/proto/v1/issue_service";
+import { IssueStatus } from "@/types/proto-es/v1/issue_service_pb";
import {
BatchUpdateIssuesStatusRequestSchema,
IssueStatus as NewIssueStatus
diff --git a/frontend/src/components/Plan/components/HeaderSection/TitleInput.vue b/frontend/src/components/Plan/components/HeaderSection/TitleInput.vue
index c164dd4e69..ea5c5164e7 100644
--- a/frontend/src/components/Plan/components/HeaderSection/TitleInput.vue
+++ b/frontend/src/components/Plan/components/HeaderSection/TitleInput.vue
@@ -25,15 +25,13 @@ import { create } from "@bufbuild/protobuf";
import { planServiceClientConnect, issueServiceClientConnect } from "@/grpcweb";
import { UpdatePlanRequestSchema } from "@/types/proto-es/v1/plan_service_pb";
import { IssueSchema, UpdateIssueRequestSchema } from "@/types/proto-es/v1/issue_service_pb";
-import { convertOldPlanToNew, convertNewPlanToOld } from "@/utils/v1/plan-conversions";
-import { convertNewIssueToOld } from "@/utils/v1/issue-conversions";
import {
pushNotification,
useCurrentUserV1,
extractUserId,
useCurrentProjectV1,
} from "@/store";
-import { Plan } from "@/types/proto/v1/plan_service";
+import { PlanSchema } from "@/types/proto-es/v1/plan_service_pb";
import { hasProjectPermissionV2 } from "@/utils";
import { usePlanContext } from "../../logic";
@@ -124,8 +122,7 @@ const onBlur = async () => {
updateMask: { paths: ["title"] },
});
const response = await issueServiceClientConnect.updateIssue(request);
- const updated = convertNewIssueToOld(response);
- Object.assign(issue.value, updated);
+ Object.assign(issue.value, response);
pushNotification({
module: "bytebase",
style: "SUCCESS",
@@ -142,18 +139,16 @@ const onBlur = async () => {
}
try {
state.isUpdating = true;
- const planPatch = Plan.fromPartial({
+ const planPatch = create(PlanSchema, {
...plan.value,
title: state.title,
});
- const newPlan = convertOldPlanToNew(planPatch);
const request = create(UpdatePlanRequestSchema, {
- plan: newPlan,
+ plan: planPatch,
updateMask: { paths: ["title"] },
});
const response = await planServiceClientConnect.updatePlan(request);
- const updated = convertNewPlanToOld(response);
- Object.assign(plan.value, updated);
+ Object.assign(plan.value, response);
pushNotification({
module: "bytebase",
style: "SUCCESS",
diff --git a/frontend/src/components/Plan/components/IssueReviewView/IssueReviewView.vue b/frontend/src/components/Plan/components/IssueReviewView/IssueReviewView.vue
index cd6e45206b..c5d6bc6f15 100644
--- a/frontend/src/components/Plan/components/IssueReviewView/IssueReviewView.vue
+++ b/frontend/src/components/Plan/components/IssueReviewView/IssueReviewView.vue
@@ -16,7 +16,7 @@ import { computed, unref } from "vue";
import { provideIssueContext, useBaseIssueContext } from "@/components/IssueV1";
import { extractUserId, useCurrentProjectV1, useCurrentUserV1 } from "@/store";
import type { ComposedIssue } from "@/types";
-import { IssueStatus } from "@/types/proto/v1/issue_service";
+import { IssueStatus } from "@/types/proto-es/v1/issue_service_pb";
import { hasProjectPermissionV2 } from "@/utils";
import { usePlanContextWithIssue } from "../..";
import { ActivitySection } from "./ActivitySection";
diff --git a/frontend/src/components/Plan/components/IssueReviewView/Sidebar/ApprovalFlowSection/ApprovalFlowSection.vue b/frontend/src/components/Plan/components/IssueReviewView/Sidebar/ApprovalFlowSection/ApprovalFlowSection.vue
index f6c42344e5..c5de819d44 100644
--- a/frontend/src/components/Plan/components/IssueReviewView/Sidebar/ApprovalFlowSection/ApprovalFlowSection.vue
+++ b/frontend/src/components/Plan/components/IssueReviewView/Sidebar/ApprovalFlowSection/ApprovalFlowSection.vue
@@ -59,7 +59,7 @@ import { BBSpin } from "@/bbkit";
import FeatureBadge from "@/components/FeatureGuard/FeatureBadge.vue";
import { useIssueV1Store } from "@/store";
import { PlanFeature } from "@/types/proto-es/v1/subscription_service_pb";
-import type { Issue } from "@/types/proto/v1/issue_service";
+import type { Issue } from "@/types/proto-es/v1/issue_service_pb";
import ApprovalStepItem from "./ApprovalStepItem.vue";
const props = defineProps<{
diff --git a/frontend/src/components/Plan/components/IssueReviewView/Sidebar/ApprovalFlowSection/ApprovalStepItem.vue b/frontend/src/components/Plan/components/IssueReviewView/Sidebar/ApprovalFlowSection/ApprovalStepItem.vue
index 12696a7ff0..a2482e6b73 100644
--- a/frontend/src/components/Plan/components/IssueReviewView/Sidebar/ApprovalFlowSection/ApprovalStepItem.vue
+++ b/frontend/src/components/Plan/components/IssueReviewView/Sidebar/ApprovalFlowSection/ApprovalStepItem.vue
@@ -78,12 +78,16 @@ import { useI18n } from "vue-i18n";
import { useCurrentUserV1, useUserStore, useCurrentProjectV1 } from "@/store";
import { userNamePrefix } from "@/store/modules/v1/common";
import { SYSTEM_BOT_EMAIL } from "@/types";
+import { ApprovalNode_Type } from "@/types/proto-es/v1/issue_service_pb";
import { State } from "@/types/proto-es/v1/common_pb";
+import {
+ Issue_Approver_Status,
+} from "@/types/proto-es/v1/issue_service_pb";
import type {
ApprovalStep,
Issue,
Issue_Approver,
-} from "@/types/proto/v1/issue_service";
+} from "@/types/proto-es/v1/issue_service_pb";
import type { User as UserType } from "@/types/proto-es/v1/user_service_pb";
import { memberMapToRolesInProjectIAM } from "@/utils";
import ApprovalUserView from "./ApprovalUserView.vue";
@@ -108,11 +112,11 @@ const stepApprover = computed(
);
const status = computed((): "approved" | "rejected" | "current" | "pending" => {
- if (stepApprover.value?.status === "APPROVED") {
+ if (stepApprover.value?.status === Issue_Approver_Status.APPROVED) {
return "approved";
}
- if (stepApprover.value?.status === "REJECTED") {
+ if (stepApprover.value?.status === Issue_Approver_Status.REJECTED) {
return "rejected";
}
@@ -121,12 +125,12 @@ const status = computed((): "approved" | "rejected" | "current" | "pending" => {
const prevApprover = props.issue.approvers[i];
if (
!prevApprover ||
- (prevApprover.status !== "APPROVED" && prevApprover.status !== "REJECTED")
+ (prevApprover.status !== Issue_Approver_Status.APPROVED && prevApprover.status !== Issue_Approver_Status.REJECTED)
) {
return "pending";
}
// If any previous step is rejected, subsequent steps are pending
- if (prevApprover.status === "REJECTED") {
+ if (prevApprover.status === Issue_Approver_Status.REJECTED) {
return "pending";
}
}
@@ -180,7 +184,7 @@ const candidateEmails = computed(() => {
const candidates: string[] = [];
for (const node of props.step.nodes) {
- if (node.type !== "ANY_IN_GROUP") continue;
+ if (node.type !== ApprovalNode_Type.ANY_IN_GROUP) continue;
const role = node.role;
if (!role) continue;
diff --git a/frontend/src/components/Plan/components/IssueReviewView/Sidebar/IssueStatusSection.vue b/frontend/src/components/Plan/components/IssueReviewView/Sidebar/IssueStatusSection.vue
index 82d0119aca..67bbd6528d 100644
--- a/frontend/src/components/Plan/components/IssueReviewView/Sidebar/IssueStatusSection.vue
+++ b/frontend/src/components/Plan/components/IssueReviewView/Sidebar/IssueStatusSection.vue
@@ -14,10 +14,10 @@ import { NTag } from "naive-ui";
import { computed } from "vue";
import { useI18n } from "vue-i18n";
import {
- Issue,
IssueStatus,
Issue_Approver_Status,
-} from "@/types/proto/v1/issue_service";
+} from "@/types/proto-es/v1/issue_service_pb";
+import type { Issue } from "@/types/proto-es/v1/issue_service_pb";
import { useIssueReviewContext } from "../../../logic/";
const props = defineProps<{
diff --git a/frontend/src/components/Plan/components/IssueReviewView/Sidebar/Sidebar.vue b/frontend/src/components/Plan/components/IssueReviewView/Sidebar/Sidebar.vue
index b9b2cc0cb7..3d00a83c1f 100644
--- a/frontend/src/components/Plan/components/IssueReviewView/Sidebar/Sidebar.vue
+++ b/frontend/src/components/Plan/components/IssueReviewView/Sidebar/Sidebar.vue
@@ -46,10 +46,8 @@ import {
useCurrentProjectV1,
useCurrentUserV1,
} from "@/store";
-import { UpdateIssueRequestSchema } from "@/types/proto-es/v1/issue_service_pb";
-import { Issue, IssueStatus } from "@/types/proto/v1/issue_service";
+import { UpdateIssueRequestSchema, IssueStatus } from "@/types/proto-es/v1/issue_service_pb";
import { hasProjectPermissionV2 } from "@/utils";
-import { convertOldIssueToNew } from "@/utils/v1/issue-conversions";
import { usePlanContextWithIssue } from "../../../logic/context";
import ApprovalFlowSection from "./ApprovalFlowSection/ApprovalFlowSection.vue";
import IssueStatusSection from "./IssueStatusSection.vue";
@@ -77,13 +75,12 @@ const onIssueLabelsUpdate = async (labels: string[]) => {
return; // No change, do nothing.
}
- const issuePatch = Issue.fromPartial({
+ const issuePatch = {
...issue.value,
labels,
- });
- const newIssuePatch = convertOldIssueToNew(issuePatch);
+ };
const request = create(UpdateIssueRequestSchema, {
- issue: newIssuePatch,
+ issue: issuePatch,
updateMask: { paths: ["labels"] },
});
await issueServiceClientConnect.updateIssue(request);
@@ -100,13 +97,12 @@ const onIssueDescriptionUpdate = async (description: string) => {
return; // No change, do nothing.
}
- const issuePatch = Issue.fromPartial({
+ const issuePatch = {
...issue.value,
description,
- });
- const newIssuePatch = convertOldIssueToNew(issuePatch);
+ };
const request = create(UpdateIssueRequestSchema, {
- issue: newIssuePatch,
+ issue: issuePatch,
updateMask: { paths: ["description"] },
});
await issueServiceClientConnect.updateIssue(request);
diff --git a/frontend/src/components/Plan/components/Overview.vue b/frontend/src/components/Plan/components/Overview.vue
index c8a09327fd..84c930af23 100644
--- a/frontend/src/components/Plan/components/Overview.vue
+++ b/frontend/src/components/Plan/components/Overview.vue
@@ -173,7 +173,7 @@ import { computed, watch } from "vue";
import { useI18n } from "vue-i18n";
import { InstanceV1EngineIcon } from "@/components/v2/Model/Instance";
import { useInstanceV1Store, useDBGroupStore } from "@/store";
-import { PlanCheckRun_Result_Status } from "@/types/proto/v1/plan_service";
+import { PlanCheckRun_Result_Status } from "@/types/proto-es/v1/plan_service_pb";
import { instanceV1Name, extractDatabaseResourceName } from "@/utils";
import { usePlanContext } from "../logic/context";
import { targetsForSpec } from "../logic/plan";
diff --git a/frontend/src/components/Plan/components/PlanCheckRunStatusIcon.vue b/frontend/src/components/Plan/components/PlanCheckRunStatusIcon.vue
index 411d68020a..bacb515569 100644
--- a/frontend/src/components/Plan/components/PlanCheckRunStatusIcon.vue
+++ b/frontend/src/components/Plan/components/PlanCheckRunStatusIcon.vue
@@ -32,7 +32,7 @@ import { computed } from "vue";
import {
PlanCheckRun_Result_Status,
type Plan,
-} from "@/types/proto/v1/plan_service";
+} from "@/types/proto-es/v1/plan_service_pb";
export type SizeType = "small" | "normal";
diff --git a/frontend/src/components/Plan/components/PlanCheckSection/PlanCheckSection.vue b/frontend/src/components/Plan/components/PlanCheckSection/PlanCheckSection.vue
index d847fe633f..c363ab4990 100644
--- a/frontend/src/components/Plan/components/PlanCheckSection/PlanCheckSection.vue
+++ b/frontend/src/components/Plan/components/PlanCheckSection/PlanCheckSection.vue
@@ -121,13 +121,13 @@
</div>
<div
v-if="
- result.sqlReviewReport &&
- result.sqlReviewReport.line > 0
+ (result as any).sqlReviewReport &&
+ (result as any).sqlReviewReport?.line > 0
"
class="text-xs text-control-lighter mt-0.5"
>
- Line {{ result.sqlReviewReport.line }}, Column
- {{ result.sqlReviewReport.column }}
+ Line {{ (result as any).sqlReviewReport?.line }}, Column
+ {{ (result as any).sqlReviewReport?.column }}
</div>
</div>
</div>
@@ -172,7 +172,7 @@ import { RunPlanChecksRequestSchema } from "@/types/proto-es/v1/plan_service_pb"
import {
PlanCheckRun_Result_Status,
type PlanCheckRun,
-} from "@/types/proto/v1/plan_service";
+} from "@/types/proto-es/v1/plan_service_pb";
import { hasProjectPermissionV2 } from "@/utils";
import { planCheckRunListForSpec, planSpecHasPlanChecks } from "../../logic";
import { usePlanContext } from "../../logic/context";
@@ -201,11 +201,11 @@ const summary = computed(() => {
const result = { success: 0, warning: 0, error: 0 };
for (const checkRun of checkRunsForSpec.value) {
const status = getCheckRunStatus(checkRun);
- if (status === "ERROR") {
+ if (status === PlanCheckRun_Result_Status.ERROR) {
result.error++;
- } else if (status === "WARNING") {
+ } else if (status === PlanCheckRun_Result_Status.WARNING) {
result.warning++;
- } else if (status === "SUCCESS") {
+ } else if (status === PlanCheckRun_Result_Status.SUCCESS) {
result.success++;
}
}
@@ -242,7 +242,7 @@ const drawerCheckRunsByType = computed(() => {
const groups = new Map<string, PlanCheckRun[]>();
for (const checkRun of drawerCheckRuns.value) {
- const type = checkRun.type;
+ const type = String(checkRun.type);
if (!groups.has(type)) {
groups.set(type, []);
}
@@ -268,9 +268,9 @@ const getCheckRunStatus = (
let hasWarning = false;
for (const result of checkRun.results) {
- if (result.status === "ERROR") {
+ if (result.status === PlanCheckRun_Result_Status.ERROR) {
hasError = true;
- } else if (result.status === "WARNING") {
+ } else if (result.status === PlanCheckRun_Result_Status.WARNING) {
hasWarning = true;
}
}
diff --git a/frontend/src/components/Plan/components/PlanDataTable/PlanDataTable.vue b/frontend/src/components/Plan/components/PlanDataTable/PlanDataTable.vue
index 9da375c4a0..6b9c1ffedf 100644
--- a/frontend/src/components/Plan/components/PlanDataTable/PlanDataTable.vue
+++ b/frontend/src/components/Plan/components/PlanDataTable/PlanDataTable.vue
@@ -21,8 +21,8 @@ import { useRouter } from "vue-router";
import { BBAvatar } from "@/bbkit";
import { PROJECT_V1_ROUTE_PLAN_DETAIL } from "@/router/dashboard/projectV1";
import { useUserStore } from "@/store";
-import { getTimeForPbTimestamp, unknownUser } from "@/types";
-import type { Plan } from "@/types/proto/v1/plan_service";
+import { getTimeForPbTimestampProtoEs, unknownUser } from "@/types";
+import type { Plan } from "@/types/proto-es/v1/plan_service_pb";
import {
extractPlanUID,
extractProjectResourceName,
@@ -79,7 +79,7 @@ const columnList = computed((): DataTableColumn<Plan>[] => {
title: t("issue.table.updated"),
width: 150,
render: (plan) =>
- humanizeTs(getTimeForPbTimestamp(plan.updateTime, 0) / 1000),
+ humanizeTs(getTimeForPbTimestampProtoEs(plan.updateTime, 0) / 1000),
},
{
key: "creator",
diff --git a/frontend/src/components/Plan/components/RolloutView/RolloutView.vue b/frontend/src/components/Plan/components/RolloutView/RolloutView.vue
index 8264508bfa..d466e9551d 100644
--- a/frontend/src/components/Plan/components/RolloutView/RolloutView.vue
+++ b/frontend/src/components/Plan/components/RolloutView/RolloutView.vue
@@ -43,7 +43,7 @@
import { ListIcon, Columns3Icon } from "lucide-vue-next";
import { NButton, NButtonGroup } from "naive-ui";
import { ref } from "vue";
-import { Task_Status } from "@/types/proto/v1/rollout_service";
+import { Task_Status } from "@/types/proto-es/v1/rollout_service_pb";
import StagesView from "./StagesView.vue";
import TaskFilter from "./TaskFilter.vue";
import TaskTableView from "./TaskTableView.vue";
diff --git a/frontend/src/components/Plan/components/RolloutView/RunTasksButton.vue b/frontend/src/components/Plan/components/RolloutView/RunTasksButton.vue
index ebeab6bfb7..43ff141179 100644
--- a/frontend/src/components/Plan/components/RolloutView/RunTasksButton.vue
+++ b/frontend/src/components/Plan/components/RolloutView/RunTasksButton.vue
@@ -17,8 +17,8 @@ import { PlayIcon } from "lucide-vue-next";
import { NButton } from "naive-ui";
import { computed } from "vue";
import { useCurrentProjectV1 } from "@/store";
-import type { Stage } from "@/types/proto/v1/rollout_service";
-import { Task_Status } from "@/types/proto/v1/rollout_service";
+import type { Stage } from "@/types/proto-es/v1/rollout_service_pb";
+import { Task_Status } from "@/types/proto-es/v1/rollout_service_pb";
import { useRolloutViewContext } from "./context";
import { useTaskActionPermissions } from "./taskPermissions";
diff --git a/frontend/src/components/Plan/components/RolloutView/StageCard.vue b/frontend/src/components/Plan/components/RolloutView/StageCard.vue
index 794b34bbd7..b8067d6e5f 100644
--- a/frontend/src/components/Plan/components/RolloutView/StageCard.vue
+++ b/frontend/src/components/Plan/components/RolloutView/StageCard.vue
@@ -110,11 +110,13 @@ import {
pushNotification,
} from "@/store";
import { CreateRolloutRequestSchema } from "@/types/proto-es/v1/rollout_service_pb";
-import {
+import type {
Stage,
+ Task,
+} from "@/types/proto-es/v1/rollout_service_pb";
+import {
Task_Status,
- type Task,
-} from "@/types/proto/v1/rollout_service";
+} from "@/types/proto-es/v1/rollout_service_pb";
import { extractProjectResourceName } from "@/utils";
import { extractSchemaVersionFromTask } from "@/utils";
import { usePlanContextWithRollout } from "../../logic";
diff --git a/frontend/src/components/Plan/components/RolloutView/StagesView.vue b/frontend/src/components/Plan/components/RolloutView/StagesView.vue
index 2e4da7bd02..c68f245a56 100644
--- a/frontend/src/components/Plan/components/RolloutView/StagesView.vue
+++ b/frontend/src/components/Plan/components/RolloutView/StagesView.vue
@@ -19,7 +19,7 @@
</template>
<script setup lang="ts">
-import type { Stage, Task_Status } from "@/types/proto/v1/rollout_service";
+import type { Stage, Task_Status } from "@/types/proto-es/v1/rollout_service_pb";
import StageCard from "./StageCard.vue";
defineProps<{
diff --git a/frontend/src/components/Plan/components/RolloutView/TaskDatabaseName.vue b/frontend/src/components/Plan/components/RolloutView/TaskDatabaseName.vue
index 67e2823154..3805be0492 100644
--- a/frontend/src/components/Plan/components/RolloutView/TaskDatabaseName.vue
+++ b/frontend/src/components/Plan/components/RolloutView/TaskDatabaseName.vue
@@ -3,7 +3,7 @@
</template>
<script setup lang="ts">
-import type { Task } from "@/types/proto/v1/rollout_service";
+import type { Task } from "@/types/proto-es/v1/rollout_service_pb";
import DatabaseDisplay from "../common/DatabaseDisplay.vue";
defineProps<{
diff --git a/frontend/src/components/Plan/components/RolloutView/TaskFilter.vue b/frontend/src/components/Plan/components/RolloutView/TaskFilter.vue
index 9fea00d6ba..155bed7f1c 100644
--- a/frontend/src/components/Plan/components/RolloutView/TaskFilter.vue
+++ b/frontend/src/components/Plan/components/RolloutView/TaskFilter.vue
@@ -45,8 +45,8 @@ import { flatten } from "lodash-es";
import { NTag } from "naive-ui";
import { computed } from "vue";
import TaskStatus from "@/components/Rollout/kits/TaskStatus.vue";
-import type { Rollout, Task_Status } from "@/types/proto/v1/rollout_service";
-import { Task_Status as TaskStatusEnum } from "@/types/proto/v1/rollout_service";
+import type { Rollout, Task_Status } from "@/types/proto-es/v1/rollout_service_pb";
+import { Task_Status as TaskStatusEnum } from "@/types/proto-es/v1/rollout_service_pb";
import { stringifyTaskStatus } from "@/utils";
import { useRolloutViewContext } from "./context";
diff --git a/frontend/src/components/Plan/components/RolloutView/TaskOperations.vue b/frontend/src/components/Plan/components/RolloutView/TaskOperations.vue
index e3ec0ab1cd..cff7fb32c1 100644
--- a/frontend/src/components/Plan/components/RolloutView/TaskOperations.vue
+++ b/frontend/src/components/Plan/components/RolloutView/TaskOperations.vue
@@ -55,8 +55,8 @@ import type { VNode } from "vue";
import { computed, h, reactive } from "vue";
import { useI18n } from "vue-i18n";
import { useCurrentProjectV1 } from "@/store";
-import { Task_Status } from "@/types/proto/v1/rollout_service";
-import type { Task, Rollout, Stage } from "@/types/proto/v1/rollout_service";
+import { Task_Status } from "@/types/proto-es/v1/rollout_service_pb";
+import type { Task, Rollout, Stage } from "@/types/proto-es/v1/rollout_service_pb";
import { usePlanContext } from "../../logic";
import TaskRolloutActionPanel from "./TaskRolloutActionPanel.vue";
import { useTaskActionPermissions } from "./taskPermissions";
diff --git a/frontend/src/components/Plan/components/RolloutView/TaskRolloutActionPanel.vue b/frontend/src/components/Plan/components/RolloutView/TaskRolloutActionPanel.vue
index 96f84eb368..9eea5fefb3 100644
--- a/frontend/src/components/Plan/components/RolloutView/TaskRolloutActionPanel.vue
+++ b/frontend/src/components/Plan/components/RolloutView/TaskRolloutActionPanel.vue
@@ -228,9 +228,9 @@ import {
BatchSkipTasksRequestSchema,
BatchCancelTaskRunsRequestSchema,
} from "@/types/proto-es/v1/rollout_service_pb";
-import { Issue_Approver_Status } from "@/types/proto/v1/issue_service";
-import type { Stage, Task, TaskRun } from "@/types/proto/v1/rollout_service";
-import { Task_Status } from "@/types/proto/v1/rollout_service";
+import { Issue_Approver_Status } from "@/types/proto-es/v1/issue_service_pb";
+import type { Stage, Task, TaskRun } from "@/types/proto-es/v1/rollout_service_pb";
+import { Task_Status } from "@/types/proto-es/v1/rollout_service_pb";
import { usePlanContext } from "../../logic";
import { useIssueReviewContext } from "../../logic/issue-review";
import TaskDatabaseName from "./TaskDatabaseName.vue";
diff --git a/frontend/src/components/Plan/components/RolloutView/TaskRunComment.vue b/frontend/src/components/Plan/components/RolloutView/TaskRunComment.vue
index 44f9e87ae5..9082779b09 100644
--- a/frontend/src/components/Plan/components/RolloutView/TaskRunComment.vue
+++ b/frontend/src/components/Plan/components/RolloutView/TaskRunComment.vue
@@ -28,9 +28,9 @@
import { NEllipsis } from "naive-ui";
import { computed } from "vue";
import { useI18n } from "vue-i18n";
-import { getTimeForPbTimestamp, getDateForPbTimestamp } from "@/types";
-import type { TaskRun } from "@/types/proto/v1/rollout_service";
-import { TaskRun_Status } from "@/types/proto/v1/rollout_service";
+import { getTimeForPbTimestampProtoEs, getDateForPbTimestampProtoEs } from "@/types";
+import type { TaskRun } from "@/types/proto-es/v1/rollout_service_pb";
+import { TaskRun_Status } from "@/types/proto-es/v1/rollout_service_pb";
export type CommentLink = {
title: string;
@@ -45,7 +45,7 @@ const { t } = useI18n();
const earliestAllowedTime = computed(() => {
return props.taskRun.runTime
- ? getTimeForPbTimestamp(props.taskRun.runTime)
+ ? getTimeForPbTimestampProtoEs(props.taskRun.runTime)
: null;
});
@@ -59,9 +59,9 @@ const comment = computed(() => {
}
if (taskRun.schedulerInfo) {
const cause = taskRun.schedulerInfo.waitingCause;
- if (cause?.task) {
+ if (cause?.cause?.case === "task") {
return t("task-run.status.waiting-task", {
- time: getDateForPbTimestamp(
+ time: getDateForPbTimestampProtoEs(
taskRun.schedulerInfo.reportTime
)?.toLocaleString(),
});
@@ -71,23 +71,23 @@ const comment = computed(() => {
} else if (taskRun.status === TaskRun_Status.RUNNING) {
if (taskRun.schedulerInfo) {
const cause = taskRun.schedulerInfo.waitingCause;
- if (cause?.connectionLimit) {
+ if (cause?.cause?.case === "connectionLimit") {
return t("task-run.status.waiting-connection", {
- time: getDateForPbTimestamp(
+ time: getDateForPbTimestampProtoEs(
taskRun.schedulerInfo.reportTime
)?.toLocaleString(),
});
}
- if (cause?.task) {
+ if (cause?.cause?.case === "task") {
return t("task-run.status.waiting-task", {
- time: getDateForPbTimestamp(
+ time: getDateForPbTimestampProtoEs(
taskRun.schedulerInfo.reportTime
)?.toLocaleString(),
});
}
- if (cause?.parallelTasksLimit) {
+ if (cause?.cause?.case === "parallelTasksLimit") {
return t("task-run.status.waiting-max-tasks-per-rollout", {
- time: getDateForPbTimestamp(
+ time: getDateForPbTimestampProtoEs(
taskRun.schedulerInfo.reportTime
)?.toLocaleString(),
});
@@ -103,7 +103,9 @@ const commentLink = computed((): CommentLink => {
taskRun.status === TaskRun_Status.PENDING ||
taskRun.status === TaskRun_Status.RUNNING
) {
- const task = taskRun.schedulerInfo?.waitingCause?.task?.task;
+ const task = taskRun.schedulerInfo?.waitingCause?.cause?.case === "task"
+ ? taskRun.schedulerInfo.waitingCause.cause.value.task
+ : undefined;
if (task) {
return {
title: t("common.blocking-task"),
diff --git a/frontend/src/components/Plan/components/RolloutView/TaskRunTable.vue b/frontend/src/components/Plan/components/RolloutView/TaskRunTable.vue
index 282d560298..8b98361ea6 100644
--- a/frontend/src/components/Plan/components/RolloutView/TaskRunTable.vue
+++ b/frontend/src/components/Plan/components/RolloutView/TaskRunTable.vue
@@ -32,13 +32,14 @@ import TaskRunDetail from "@/components/IssueV1/components/TaskRunSection/TaskRu
import HumanizeDate from "@/components/misc/HumanizeDate.vue";
import { Drawer, DrawerContent } from "@/components/v2";
import { useCurrentProjectV1 } from "@/store";
-import { getDateForPbTimestamp, getTimeForPbTimestamp } from "@/types";
-import { Duration } from "@/types/proto/google/protobuf/duration";
-import type { Task, TaskRun } from "@/types/proto/v1/rollout_service";
-import { TaskRun_Status } from "@/types/proto/v1/rollout_service";
+import { getDateForPbTimestampProtoEs, getTimeForPbTimestampProtoEs } from "@/types";
+import { create } from "@bufbuild/protobuf";
+import type { Duration } from "@bufbuild/protobuf/wkt";
+import { DurationSchema } from "@bufbuild/protobuf/wkt";
+import type { Task, TaskRun } from "@/types/proto-es/v1/rollout_service_pb";
+import { TaskRun_Status } from "@/types/proto-es/v1/rollout_service_pb";
import { databaseForTask } from "@/utils";
import { humanizeDurationV1 } from "@/utils";
-import { convertDurationToNew } from "@/utils/v1/common-conversions";
import TaskRunComment from "./TaskRunComment.vue";
defineProps<{
@@ -88,7 +89,7 @@ const columnList = computed((): DataTableColumn<TaskRun>[] => {
title: t("task.created"),
width: 140,
render: (taskRun: TaskRun) => (
- <HumanizeDate date={getDateForPbTimestamp(taskRun.createTime)} />
+ <HumanizeDate date={getDateForPbTimestampProtoEs(taskRun.createTime)} />
),
},
{
@@ -97,7 +98,7 @@ const columnList = computed((): DataTableColumn<TaskRun>[] => {
width: 140,
render: (taskRun: TaskRun) =>
taskRun.startTime ? (
- <HumanizeDate date={getDateForPbTimestamp(taskRun.startTime)} />
+ <HumanizeDate date={getDateForPbTimestampProtoEs(taskRun.startTime)} />
) : (
"-"
),
@@ -109,7 +110,7 @@ const columnList = computed((): DataTableColumn<TaskRun>[] => {
render: (taskRun: TaskRun) => {
const duration = executionDurationOfTaskRun(taskRun);
return duration
- ? humanizeDurationV1(convertDurationToNew(duration))
+ ? humanizeDurationV1(duration)
: "-";
},
},
@@ -144,7 +145,7 @@ const getStatusType = (status: TaskRun_Status) => {
};
const getStatusText = (status: TaskRun_Status) => {
- return status.replace("_", " ");
+ return TaskRun_Status[status].replace("_", " ");
};
const executionDurationOfTaskRun = (taskRun: TaskRun): Duration | undefined => {
@@ -152,21 +153,21 @@ const executionDurationOfTaskRun = (taskRun: TaskRun): Duration | undefined => {
if (!startTime || !updateTime) {
return undefined;
}
- if (startTime.seconds.toString() === "0") {
+ if (Number(startTime.seconds) === 0) {
return undefined;
}
if (taskRun.status === TaskRun_Status.RUNNING) {
- const elapsedMS = Date.now() - getTimeForPbTimestamp(startTime);
- return Duration.fromPartial({
- seconds: Math.floor(elapsedMS / 1000),
+ const elapsedMS = Date.now() - getTimeForPbTimestampProtoEs(startTime);
+ return create(DurationSchema, {
+ seconds: BigInt(Math.floor(elapsedMS / 1000)),
nanos: (elapsedMS % 1000) * 1e6,
});
}
- const startMS = getTimeForPbTimestamp(startTime);
- const updateMS = getTimeForPbTimestamp(updateTime);
+ const startMS = getTimeForPbTimestampProtoEs(startTime);
+ const updateMS = getTimeForPbTimestampProtoEs(updateTime);
const elapsedMS = updateMS - startMS;
- return Duration.fromPartial({
- seconds: Math.floor(elapsedMS / 1000),
+ return create(DurationSchema, {
+ seconds: BigInt(Math.floor(elapsedMS / 1000)),
nanos: (elapsedMS % 1000) * 1e6,
});
};
diff --git a/frontend/src/components/Plan/components/RolloutView/TaskStatusActions.vue b/frontend/src/components/Plan/components/RolloutView/TaskStatusActions.vue
index 118c4452cd..e1f55c0ad1 100644
--- a/frontend/src/components/Plan/components/RolloutView/TaskStatusActions.vue
+++ b/frontend/src/components/Plan/components/RolloutView/TaskStatusActions.vue
@@ -43,13 +43,13 @@ import { EllipsisVerticalIcon } from "lucide-vue-next";
import { NButton, NDropdown } from "naive-ui";
import { computed, ref } from "vue";
import { useI18n } from "vue-i18n";
-import { Task_Status } from "@/types/proto/v1/rollout_service";
+import { Task_Status } from "@/types/proto-es/v1/rollout_service_pb";
import type {
Task,
TaskRun,
Rollout,
Stage,
-} from "@/types/proto/v1/rollout_service";
+} from "@/types/proto-es/v1/rollout_service_pb";
import TaskRolloutActionPanel from "./TaskRolloutActionPanel.vue";
type TaskStatusAction =
@@ -134,7 +134,7 @@ const stage = computed((): Stage => {
name: "",
environment: "",
tasks: [],
- } as Stage;
+ } as unknown as Stage;
});
const primaryAction = computed((): TaskStatusAction | null => {
diff --git a/frontend/src/components/Plan/components/RolloutView/TaskTable.vue b/frontend/src/components/Plan/components/RolloutView/TaskTable.vue
index 285cf5696f..de772c1da6 100644
--- a/frontend/src/components/Plan/components/RolloutView/TaskTable.vue
+++ b/frontend/src/components/Plan/components/RolloutView/TaskTable.vue
@@ -28,7 +28,7 @@ import TaskStatus from "@/components/Rollout/kits/TaskStatus.vue";
import { InstanceV1EngineIcon } from "@/components/v2";
import { PROJECT_V1_ROUTE_ROLLOUT_DETAIL_TASK_DETAIL } from "@/router/dashboard/projectV1";
import { useCurrentProjectV1, useEnvironmentV1Store } from "@/store";
-import type { Task, Task_Status } from "@/types/proto/v1/rollout_service";
+import type { Task, Task_Status } from "@/types/proto-es/v1/rollout_service_pb";
import { databaseForTask } from "@/utils";
import {
extractProjectResourceName,
diff --git a/frontend/src/components/Plan/components/RolloutView/TaskTableView.vue b/frontend/src/components/Plan/components/RolloutView/TaskTableView.vue
index 78b1a6c451..d6101f352e 100644
--- a/frontend/src/components/Plan/components/RolloutView/TaskTableView.vue
+++ b/frontend/src/components/Plan/components/RolloutView/TaskTableView.vue
@@ -22,7 +22,7 @@
<script setup lang="ts">
import { ref } from "vue";
-import type { Task, Task_Status } from "@/types/proto/v1/rollout_service";
+import type { Task, Task_Status } from "@/types/proto-es/v1/rollout_service_pb";
import { usePlanContextWithRollout } from "../../logic";
import TaskOperations from "./TaskOperations.vue";
import TaskTable from "./TaskTable.vue";
diff --git a/frontend/src/components/Plan/components/RolloutView/TaskView.vue b/frontend/src/components/Plan/components/RolloutView/TaskView.vue
index 7838ef753a..cadc1bb169 100644
--- a/frontend/src/components/Plan/components/RolloutView/TaskView.vue
+++ b/frontend/src/components/Plan/components/RolloutView/TaskView.vue
@@ -81,12 +81,12 @@ import TaskStatus from "@/components/Rollout/kits/TaskStatus.vue";
import { InstanceV1EngineIcon, CopyButton } from "@/components/v2";
import { rolloutServiceClientConnect } from "@/grpcweb";
import { useCurrentProjectV1, useSheetV1Store } from "@/store";
-import { getDateForPbTimestamp, unknownTask } from "@/types";
+import { getDateForPbTimestampProtoEs, unknownTask } from "@/types";
+import type { Task, TaskRun, Rollout } from "@/types/proto-es/v1/rollout_service_pb";
import {
ListTaskRunsRequestSchema,
GetRolloutRequestSchema,
} from "@/types/proto-es/v1/rollout_service_pb";
-import type { Task, TaskRun, Rollout } from "@/types/proto/v1/rollout_service";
import { databaseForTask } from "@/utils";
import {
extractSchemaVersionFromTask,
@@ -94,10 +94,6 @@ import {
sheetNameOfTaskV1,
isValidTaskName,
} from "@/utils";
-import {
- convertNewTaskRunToOld,
- convertNewRolloutToOld,
-} from "@/utils/v1/rollout-conversions";
import TaskRunTable from "./TaskRunTable.vue";
import TaskStatusActions from "./TaskStatusActions.vue";
@@ -142,8 +138,7 @@ watchEffect(async () => {
try {
const rolloutName = `projects/${project.value.name.split("/")[1]}/rollouts/${rolloutId}`;
const request = create(GetRolloutRequestSchema, { name: rolloutName });
- const response = await rolloutServiceClientConnect.getRollout(request);
- const rollout = convertNewRolloutToOld(response);
+ const rollout = await rolloutServiceClientConnect.getRollout(request);
rolloutRef.value = rollout;
// Find the specific task
@@ -186,9 +181,9 @@ watchEffect(async () => {
parent: task.value.name,
});
const response = await rolloutServiceClientConnect.listTaskRuns(request);
- const taskRuns = response.taskRuns.map(convertNewTaskRunToOld);
+ const taskRuns = response.taskRuns;
const sorted = sortBy(taskRuns, (t) =>
- getDateForPbTimestamp(t.createTime)
+ getDateForPbTimestampProtoEs(t.createTime)
).reverse();
if (!isEqual(sorted, taskRunsRef.value)) {
taskRunsRef.value = sorted;
@@ -221,9 +216,9 @@ const handleTaskActionCompleted = async () => {
parent: task.value.name,
});
const response = await rolloutServiceClientConnect.listTaskRuns(request);
- const taskRuns = response.taskRuns.map(convertNewTaskRunToOld);
+ const taskRuns = response.taskRuns;
const sorted = sortBy(taskRuns, (t) =>
- getDateForPbTimestamp(t.createTime)
+ getDateForPbTimestampProtoEs(t.createTime)
).reverse();
taskRunsRef.value = sorted;
} catch (error) {
@@ -241,8 +236,7 @@ const handleTaskActionCompleted = async () => {
try {
const rolloutName = `projects/${project.value.name.split("/")[1]}/rollouts/${rolloutId}`;
const request = create(GetRolloutRequestSchema, { name: rolloutName });
- const response = await rolloutServiceClientConnect.getRollout(request);
- const rollout = convertNewRolloutToOld(response);
+ const rollout = await rolloutServiceClientConnect.getRollout(request);
rolloutRef.value = rollout;
// Update the task reference
diff --git a/frontend/src/components/Plan/components/RolloutView/context.ts b/frontend/src/components/Plan/components/RolloutView/context.ts
index 0e020f124d..bc442396c4 100644
--- a/frontend/src/components/Plan/components/RolloutView/context.ts
+++ b/frontend/src/components/Plan/components/RolloutView/context.ts
@@ -5,12 +5,8 @@ import { computed, inject, provide, ref, onUnmounted } from "vue";
import { rolloutServiceClientConnect } from "@/grpcweb";
import { silentContextKey } from "@/grpcweb/context-key";
import { useCurrentProjectV1 } from "@/store";
-import { PreviewRolloutRequestSchema } from "@/types/proto-es/v1/rollout_service_pb";
-import { Rollout, type Stage } from "@/types/proto/v1/rollout_service";
-import {
- convertNewRolloutToOld,
- convertOldPlanToNew,
-} from "@/utils/v1/rollout-conversions";
+import { PreviewRolloutRequestSchema, RolloutSchema } from "@/types/proto-es/v1/rollout_service_pb";
+import type { Rollout, Stage } from "@/types/proto-es/v1/rollout_service_pb";
import { usePlanContextWithRollout } from "../../logic";
export type RolloutViewContext = {
@@ -31,7 +27,7 @@ export const provideRolloutViewContext = () => {
const { events, plan, rollout } = usePlanContextWithRollout();
const { project } = useCurrentProjectV1();
- const rolloutPreview = ref<Rollout>(Rollout.fromPartial({}));
+ const rolloutPreview = ref<Rollout>(create(RolloutSchema, {}));
const mergedStages = computed(() => {
// Merge preview stages with created rollout stages
@@ -57,7 +53,7 @@ export const provideRolloutViewContext = () => {
const fetchRolloutPreview = async () => {
const request = create(PreviewRolloutRequestSchema, {
project: project.value.name,
- plan: convertOldPlanToNew(plan.value),
+ plan: plan.value,
});
try {
@@ -65,11 +61,11 @@ export const provideRolloutViewContext = () => {
await rolloutServiceClientConnect.previewRollout(request, {
contextValues: createContextValues().set(silentContextKey, true),
});
- rolloutPreview.value = convertNewRolloutToOld(rolloutPreviewNew);
+ rolloutPreview.value = rolloutPreviewNew;
} catch (error) {
// Handle preview errors gracefully
console.error("Failed to fetch rollout preview:", error);
- rolloutPreview.value = Rollout.fromPartial({});
+ rolloutPreview.value = create(RolloutSchema, {});
} finally {
}
};
diff --git a/frontend/src/components/Plan/components/RolloutView/taskPermissions.ts b/frontend/src/components/Plan/components/RolloutView/taskPermissions.ts
index aae60794cf..447db016c2 100644
--- a/frontend/src/components/Plan/components/RolloutView/taskPermissions.ts
+++ b/frontend/src/components/Plan/components/RolloutView/taskPermissions.ts
@@ -2,9 +2,9 @@ import { uniq } from "lodash-es";
import { useCurrentUserV1, useCurrentProjectV1 } from "@/store";
import { userNamePrefix, roleNamePrefix } from "@/store/modules/v1/common";
import type { ComposedProject } from "@/types";
-import { Issue_Type, type Issue } from "@/types/proto/v1/issue_service";
-import type { Task } from "@/types/proto/v1/rollout_service";
-import type { Rollout } from "@/types/proto/v1/rollout_service";
+import { Issue_Type, type Issue } from "@/types/proto-es/v1/issue_service_pb";
+import type { Task } from "@/types/proto-es/v1/rollout_service_pb";
+import type { Rollout } from "@/types/proto-es/v1/rollout_service_pb";
import {
hasWorkspacePermissionV2,
hasProjectPermissionV2,
diff --git a/frontend/src/components/Plan/components/SQLCheckSection/common.ts b/frontend/src/components/Plan/components/SQLCheckSection/common.ts
index 355c29c7f2..282ea3aa95 100644
--- a/frontend/src/components/Plan/components/SQLCheckSection/common.ts
+++ b/frontend/src/components/Plan/components/SQLCheckSection/common.ts
@@ -1,13 +1,14 @@
import {
Plan_ChangeDatabaseConfig_Type,
- Plan_Spec,
-} from "@/types/proto/v1/plan_service";
+} from "@/types/proto-es/v1/plan_service_pb";
+import type { Plan_Spec } from "@/types/proto-es/v1/plan_service_pb";
import { Release_File_ChangeType } from "@/types/proto-es/v1/release_service_pb";
export const getSpecChangeType = (
spec?: Plan_Spec
): Release_File_ChangeType => {
- switch (spec?.changeDatabaseConfig?.type) {
+ const changeDatabaseConfig = spec?.config?.case === "changeDatabaseConfig" ? spec.config.value : undefined;
+ switch (changeDatabaseConfig?.type) {
case Plan_ChangeDatabaseConfig_Type.MIGRATE:
return Release_File_ChangeType.DDL;
case Plan_ChangeDatabaseConfig_Type.MIGRATE_GHOST:
diff --git a/frontend/src/components/Plan/components/SQLCheckSection/context.ts b/frontend/src/components/Plan/components/SQLCheckSection/context.ts
index 8c3a0aca51..ef3972d87c 100644
--- a/frontend/src/components/Plan/components/SQLCheckSection/context.ts
+++ b/frontend/src/components/Plan/components/SQLCheckSection/context.ts
@@ -2,8 +2,8 @@ import type { InjectionKey, Ref } from "vue";
import { computed, inject, provide, ref } from "vue";
import { unknownDatabase, type ComposedProject } from "@/types";
import type { CheckReleaseResponse_CheckResult } from "@/types/proto-es/v1/release_service_pb";
-import type { Plan, Plan_Spec } from "@/types/proto/v1/plan_service";
-import type { Task } from "@/types/proto/v1/rollout_service";
+import type { Plan, Plan_Spec } from "@/types/proto-es/v1/plan_service_pb";
+import type { Task } from "@/types/proto-es/v1/rollout_service_pb";
import { databaseForTask } from "@/utils";
import { databaseForSpec } from "../../logic";
diff --git a/frontend/src/components/Plan/components/SQLCheckV1Section/SQLCheckV1Section.vue b/frontend/src/components/Plan/components/SQLCheckV1Section/SQLCheckV1Section.vue
index de3880d305..668ff149f6 100644
--- a/frontend/src/components/Plan/components/SQLCheckV1Section/SQLCheckV1Section.vue
+++ b/frontend/src/components/Plan/components/SQLCheckV1Section/SQLCheckV1Section.vue
@@ -138,7 +138,7 @@ import {
CheckReleaseRequestSchema,
ReleaseFileType,
} from "@/types/proto-es/v1/release_service_pb";
-import { Plan_ChangeDatabaseConfig_Type } from "@/types/proto/v1/plan_service";
+import { Plan_ChangeDatabaseConfig_Type } from "@/types/proto-es/v1/plan_service_pb";
import {
Release_File_ChangeType,
type CheckReleaseResponse_CheckResult,
@@ -162,7 +162,7 @@ const checkResults = ref<CheckReleaseResponse_CheckResult[] | undefined>(
const statement = computed(() => {
if (!selectedSpec.value) return "";
- const config = selectedSpec.value.changeDatabaseConfig;
+ const config = selectedSpec.value.config?.case === "changeDatabaseConfig" ? selectedSpec.value.config.value : undefined;
if (!config) return "";
const sheet = getLocalSheetByName(config.sheet);
return getSheetStatement(sheet);
@@ -173,7 +173,7 @@ const show = computed(() => {
return false;
}
// Show for change database configs
- return !!selectedSpec.value.changeDatabaseConfig;
+ return selectedSpec.value.config?.case === "changeDatabaseConfig";
});
// Enhanced advice type with target information
@@ -234,7 +234,7 @@ const drawerAdvices = computed(() => {
const runChecks = async () => {
if (!plan.value.name || !selectedSpec.value) return;
- const config = selectedSpec.value.changeDatabaseConfig;
+ const config = selectedSpec.value.config?.case === "changeDatabaseConfig" ? selectedSpec.value.config.value : undefined;
if (!config) return;
isRunningChecks.value = true;
diff --git a/frontend/src/components/Plan/components/SpecDetailView/TargetListSection.vue b/frontend/src/components/Plan/components/SpecDetailView/TargetListSection.vue
index c7f8551244..bee65f864b 100644
--- a/frontend/src/components/Plan/components/SpecDetailView/TargetListSection.vue
+++ b/frontend/src/components/Plan/components/SpecDetailView/TargetListSection.vue
@@ -132,10 +132,6 @@ import {
extractDatabaseGroupName,
extractProjectResourceName,
} from "@/utils";
-import {
- convertOldPlanToNew,
- convertNewPlanToOld,
-} from "@/utils/v1/plan-conversions";
import { usePlanContext } from "../../logic/context";
import { targetsForSpec } from "../../logic/plan";
import AllTargetsDrawer from "./AllTargetsDrawer.vue";
@@ -174,7 +170,7 @@ const targets = computed(() => {
});
const isCreateDatabaseSpec = computed(() => {
- return !!selectedSpec.value?.createDatabaseConfig;
+ return selectedSpec.value?.config?.case === "createDatabaseConfig";
});
const project = computed(() => {
@@ -274,22 +270,19 @@ const handleUpdateTargets = async (targets: string[]) => {
if (!selectedSpec.value) return;
// Update the targets in the spec.
- const config =
- selectedSpec.value.changeDatabaseConfig ||
- selectedSpec.value.exportDataConfig;
- if (config) {
- config.targets = targets;
+ if (selectedSpec.value.config?.case === "changeDatabaseConfig") {
+ selectedSpec.value.config.value.targets = targets;
+ } else if (selectedSpec.value.config?.case === "exportDataConfig") {
+ selectedSpec.value.config.value.targets = targets;
}
if (!isCreating.value) {
- const newPlan = convertOldPlanToNew(plan.value);
const request = create(UpdatePlanRequestSchema, {
- plan: newPlan,
+ plan: plan.value,
updateMask: { paths: ["specs"] },
});
const response = await planServiceClientConnect.updatePlan(request);
- const updated = convertNewPlanToOld(response);
- Object.assign(plan.value, updated);
+ Object.assign(plan.value, response);
events.emit("status-changed", {
eager: true,
});
diff --git a/frontend/src/components/Plan/components/SpecDetailView/context.ts b/frontend/src/components/Plan/components/SpecDetailView/context.ts
index 5b2c494275..1b482ce558 100644
--- a/frontend/src/components/Plan/components/SpecDetailView/context.ts
+++ b/frontend/src/components/Plan/components/SpecDetailView/context.ts
@@ -8,7 +8,7 @@ import {
type Ref,
} from "vue";
import { useRoute, useRouter } from "vue-router";
-import { type Plan } from "@/types/proto/v1/plan_service";
+import { type Plan } from "@/types/proto-es/v1/plan_service_pb";
import { gotoSpec } from "../common/utils";
const KEY = Symbol("bb.plan.spec.detail") as InjectionKey<PlanSpecContext>;
diff --git a/frontend/src/components/Plan/components/SpecsView.vue b/frontend/src/components/Plan/components/SpecsView.vue
index d0c08cd853..5245cba092 100644
--- a/frontend/src/components/Plan/components/SpecsView.vue
+++ b/frontend/src/components/Plan/components/SpecsView.vue
@@ -7,7 +7,7 @@
<script setup lang="ts">
import { type Ref } from "vue";
import { useCurrentProjectV1 } from "@/store";
-import { type Plan_Spec } from "@/types/proto/v1/plan_service";
+import { type Plan_Spec } from "@/types/proto-es/v1/plan_service_pb";
import { usePlanContext } from "../logic/context";
import { providePlanSQLCheckContext } from "./SQLCheckSection";
import SpecDetailView from "./SpecDetailView";
diff --git a/frontend/src/components/Plan/components/StatementSection/EditorView/EditorView.vue b/frontend/src/components/Plan/components/StatementSection/EditorView/EditorView.vue
index 71c0f581bb..20460c82a7 100644
--- a/frontend/src/components/Plan/components/StatementSection/EditorView/EditorView.vue
+++ b/frontend/src/components/Plan/components/StatementSection/EditorView/EditorView.vue
@@ -194,7 +194,7 @@ import {
import type { SQLDialect } from "@/types";
import { dialectOfEngineV1 } from "@/types";
import { UpdatePlanRequestSchema } from "@/types/proto-es/v1/plan_service_pb";
-import { Task_Status } from "@/types/proto/v1/rollout_service";
+import { Task_Status } from "@/types/proto-es/v1/rollout_service_pb";
import { SheetSchema } from "@/types/proto-es/v1/sheet_service_pb";
import {
getSheetStatement,
@@ -202,10 +202,6 @@ import {
setSheetStatement,
useInstanceV1EditorLanguage,
} from "@/utils";
-import {
- convertOldPlanToNew,
- convertNewPlanToOld,
-} from "@/utils/v1/plan-conversions";
import { usePlanSpecContext } from "../../SpecDetailView/context";
import { useSQLAdviceMarkers } from "../useSQLAdviceMarkers";
import type { EditState } from "./useTempEditState";
@@ -431,10 +427,10 @@ const updateStatement = async (statement: string) => {
);
for (const spec of specsToPatch) {
- if (spec.changeDatabaseConfig) {
- spec.changeDatabaseConfig.sheet = createdSheet.name;
- } else if (spec.exportDataConfig) {
- spec.exportDataConfig.sheet = createdSheet.name;
+ if (spec.config?.case === "changeDatabaseConfig") {
+ spec.config.value.sheet = createdSheet.name;
+ } else if (spec.config?.case === "exportDataConfig") {
+ spec.config.value.sheet = createdSheet.name;
} else {
throw new Error(
`Unsupported spec type for plan update ${JSON.stringify(spec)}`
@@ -442,15 +438,13 @@ const updateStatement = async (statement: string) => {
}
}
- const newPlan = convertOldPlanToNew(planPatch);
const request = create(UpdatePlanRequestSchema, {
- plan: newPlan,
+ plan: planPatch,
updateMask: { paths: ["specs"] },
});
const response = await planServiceClientConnect.updatePlan(request);
- const updatedPlan = convertNewPlanToOld(response);
- Object.assign(plan.value, updatedPlan);
+ Object.assign(plan.value, response);
events.emit("status-changed", { eager: true });
pushNotification({
module: "bytebase",
diff --git a/frontend/src/components/Plan/components/StatementSection/ReleaseView/ReleaseView.vue b/frontend/src/components/Plan/components/StatementSection/ReleaseView/ReleaseView.vue
index 651b1cd2fd..f9af073668 100644
--- a/frontend/src/components/Plan/components/StatementSection/ReleaseView/ReleaseView.vue
+++ b/frontend/src/components/Plan/components/StatementSection/ReleaseView/ReleaseView.vue
@@ -170,7 +170,10 @@ const { t } = useI18n();
const { selectedSpec } = usePlanSpecContext();
const releaseName = computed(() => {
- return selectedSpec.value?.changeDatabaseConfig?.release || "";
+ if (selectedSpec.value?.config?.case === "changeDatabaseConfig") {
+ return selectedSpec.value.config.value.release || "";
+ }
+ return "";
});
const { release, ready: loading } = useReleaseByName(releaseName);
diff --git a/frontend/src/components/Plan/components/StatementSection/StatementSection.vue b/frontend/src/components/Plan/components/StatementSection/StatementSection.vue
index eda5da3742..e70023a65b 100644
--- a/frontend/src/components/Plan/components/StatementSection/StatementSection.vue
+++ b/frontend/src/components/Plan/components/StatementSection/StatementSection.vue
@@ -18,8 +18,9 @@ const viewMode = computed((): "NONE" | "EDITOR" | "RELEASE" => {
const spec = selectedSpec.value;
// Check if this is a release-based spec (has release but no sheet)
if (
- spec.changeDatabaseConfig?.release &&
- !spec.changeDatabaseConfig?.sheet
+ spec.config?.case === "changeDatabaseConfig" &&
+ spec.config.value.release &&
+ !spec.config.value.sheet
) {
return "RELEASE";
}
diff --git a/frontend/src/components/Plan/components/StatementSection/useSQLAdviceMarkers.ts b/frontend/src/components/Plan/components/StatementSection/useSQLAdviceMarkers.ts
index b227a2a142..c8a1d33f9a 100644
--- a/frontend/src/components/Plan/components/StatementSection/useSQLAdviceMarkers.ts
+++ b/frontend/src/components/Plan/components/StatementSection/useSQLAdviceMarkers.ts
@@ -2,10 +2,10 @@ import { maxBy } from "lodash-es";
import { computed, type Ref } from "vue";
import type { AdviceOption } from "@/components/MonacoEditor";
import {
- PlanCheckRun,
PlanCheckRun_Result_Status,
PlanCheckRun_Type,
-} from "@/types/proto/v1/plan_service";
+} from "@/types/proto-es/v1/plan_service_pb";
+import type { PlanCheckRun } from "@/types/proto-es/v1/plan_service_pb";
import { Advice_Status, type Advice } from "@/types/proto-es/v1/sql_service_pb";
import { extractPlanCheckRunUID } from "@/utils";
@@ -62,10 +62,11 @@ const getLatestAdviceOptions = (planCheckRuns: PlanCheckRun[]) => {
result.status === PlanCheckRun_Result_Status.ERROR ||
result.status === PlanCheckRun_Result_Status.WARNING
)
- .filter((result) => result.sqlReviewReport?.line !== undefined)
+ .filter((result) => result.report?.case === "sqlReviewReport" && result.report.value.line !== undefined)
.map<AdviceOption>((result) => {
- const line = result.sqlReviewReport!.line;
- const column = result.sqlReviewReport?.column ?? Number.MAX_SAFE_INTEGER;
+ const sqlReviewReport = result.report?.case === "sqlReviewReport" ? result.report.value : undefined;
+ const line = sqlReviewReport!.line;
+ const column = sqlReviewReport?.column ?? Number.MAX_SAFE_INTEGER;
const code = result.code;
return {
severity:
diff --git a/frontend/src/components/Plan/components/StatementSection/useSpecSheet.ts b/frontend/src/components/Plan/components/StatementSection/useSpecSheet.ts
index 6bd1e79085..0f610b150c 100644
--- a/frontend/src/components/Plan/components/StatementSection/useSpecSheet.ts
+++ b/frontend/src/components/Plan/components/StatementSection/useSpecSheet.ts
@@ -2,7 +2,7 @@ import { computedAsync } from "@vueuse/core";
import { computed, ref } from "vue";
import { getLocalSheetByName } from "@/components/Plan";
import { useSheetV1Store } from "@/store";
-import type { Plan_Spec } from "@/types/proto/v1/plan_service";
+import type { Plan_Spec } from "@/types/proto-es/v1/plan_service_pb";
import {
extractSheetUID,
getSheetStatement,
diff --git a/frontend/src/components/Plan/components/common/validateSpec.ts b/frontend/src/components/Plan/components/common/validateSpec.ts
index 98815f9b62..41dc04720c 100644
--- a/frontend/src/components/Plan/components/common/validateSpec.ts
+++ b/frontend/src/components/Plan/components/common/validateSpec.ts
@@ -1,7 +1,7 @@
import { ref, watchEffect } from "vue";
import { getLocalSheetByName } from "@/components/Plan";
import { useSheetV1Store } from "@/store";
-import type { Plan_Spec } from "@/types/proto/v1/plan_service";
+import type { Plan_Spec } from "@/types/proto-es/v1/plan_service_pb";
import { extractSheetUID, getSheetStatement, sheetNameOfSpec } from "@/utils";
// Hook to validate all specs in a plan
@@ -11,7 +11,7 @@ export const useSpecsValidation = (specs: Plan_Spec[]) => {
const checkSpecStatement = async (spec: Plan_Spec): Promise<boolean> => {
// Only changeDatabaseConfig and exportDataConfig specs have statements
- if (!spec.changeDatabaseConfig && !spec.exportDataConfig) {
+ if (spec.config?.case !== "changeDatabaseConfig" && spec.config?.case !== "exportDataConfig") {
return false;
}
diff --git a/frontend/src/components/Plan/logic/context.ts b/frontend/src/components/Plan/logic/context.ts
index c338ef1820..6c046a0ea1 100644
--- a/frontend/src/components/Plan/logic/context.ts
+++ b/frontend/src/components/Plan/logic/context.ts
@@ -2,9 +2,9 @@ import type Emittery from "emittery";
import { v4 as uuidv4 } from "uuid";
import type { InjectionKey, Ref } from "vue";
import { inject, provide } from "vue";
-import type { Issue } from "@/types/proto/v1/issue_service";
-import type { Plan, PlanCheckRun } from "@/types/proto/v1/plan_service";
-import type { Rollout } from "@/types/proto/v1/rollout_service";
+import type { Issue } from "@/types/proto-es/v1/issue_service_pb";
+import type { Plan, PlanCheckRun } from "@/types/proto-es/v1/plan_service_pb";
+import type { Rollout } from "@/types/proto-es/v1/rollout_service_pb";
import type {
IssueReviewAction,
IssueStatusAction,
diff --git a/frontend/src/components/Plan/logic/initialize/create.ts b/frontend/src/components/Plan/logic/initialize/create.ts
index a325bde6fa..f7cd2f8da4 100644
--- a/frontend/src/components/Plan/logic/initialize/create.ts
+++ b/frontend/src/components/Plan/logic/initialize/create.ts
@@ -1,3 +1,4 @@
+import { create as createProto } from "@bufbuild/protobuf";
import { cloneDeep, head, includes } from "lodash-es";
import { v4 as uuidv4 } from "uuid";
import { useRoute } from "vue-router";
@@ -8,13 +9,16 @@ import {
} from "@/store";
import { projectNamePrefix } from "@/store/modules/v1/common";
import type { ComposedProject, IssueType } from "@/types";
+import type {
+ Plan_Spec,
+} from "@/types/proto-es/v1/plan_service_pb";
import {
- Plan,
- Plan_ChangeDatabaseConfig,
+ PlanSchema,
+ Plan_ChangeDatabaseConfigSchema,
Plan_ChangeDatabaseConfig_Type,
- Plan_ExportDataConfig,
- Plan_Spec,
-} from "@/types/proto/v1/plan_service";
+ Plan_ExportDataConfigSchema,
+ Plan_SpecSchema,
+} from "@/types/proto-es/v1/plan_service_pb";
import {
extractSheetUID,
generateSQLForChangeToDatabase,
@@ -86,7 +90,7 @@ export const buildPlan = async (params: CreatePlanParams) => {
const { project, query } = params;
const databaseNameList = (query.databaseList ?? "").split(",");
- const plan = Plan.fromPartial({
+ const plan = createProto(PlanSchema, {
name: `${project.name}/plans/${nextUID()}`,
title: query.name,
description: query.description,
@@ -146,27 +150,33 @@ const buildSpecForTargetsV1 = async (
}
}
- const spec = Plan_Spec.fromPartial({
+ const spec = createProto(Plan_SpecSchema, {
id: uuidv4(),
});
switch (template) {
case "bb.issue.database.data.update":
case "bb.issue.database.schema.update": {
- spec.changeDatabaseConfig = Plan_ChangeDatabaseConfig.fromPartial({
- targets,
- sheet,
- type:
- template === "bb.issue.database.data.update"
- ? Plan_ChangeDatabaseConfig_Type.DATA
- : Plan_ChangeDatabaseConfig_Type.MIGRATE,
- });
+ spec.config = {
+ case: "changeDatabaseConfig",
+ value: createProto(Plan_ChangeDatabaseConfigSchema, {
+ targets,
+ sheet,
+ type:
+ template === "bb.issue.database.data.update"
+ ? Plan_ChangeDatabaseConfig_Type.DATA
+ : Plan_ChangeDatabaseConfig_Type.MIGRATE,
+ }),
+ };
break;
}
case "bb.issue.database.data.export": {
- spec.exportDataConfig = Plan_ExportDataConfig.fromPartial({
- targets,
- sheet,
- });
+ spec.config = {
+ case: "exportDataConfig",
+ value: createProto(Plan_ExportDataConfigSchema, {
+ targets,
+ sheet,
+ }),
+ };
break;
}
}
diff --git a/frontend/src/components/Plan/logic/initialize/index.ts b/frontend/src/components/Plan/logic/initialize/index.ts
index ae05055160..4a1cf0736f 100644
--- a/frontend/src/components/Plan/logic/initialize/index.ts
+++ b/frontend/src/components/Plan/logic/initialize/index.ts
@@ -9,12 +9,10 @@ import { projectNamePrefix, usePlanStore } from "@/store";
import { EMPTY_ID, UNKNOWN_ID } from "@/types";
import { GetIssueRequestSchema } from "@/types/proto-es/v1/issue_service_pb";
import { GetRolloutRequestSchema } from "@/types/proto-es/v1/rollout_service_pb";
-import type { Issue } from "@/types/proto/v1/issue_service";
-import type { Plan, PlanCheckRun } from "@/types/proto/v1/plan_service";
-import type { Rollout } from "@/types/proto/v1/rollout_service";
+import type { Issue } from "@/types/proto-es/v1/issue_service_pb";
+import type { Plan, PlanCheckRun } from "@/types/proto-es/v1/plan_service_pb";
+import type { Rollout } from "@/types/proto-es/v1/rollout_service_pb";
import { emptyPlan } from "@/types/v1/issue/plan";
-import { convertNewIssueToOld } from "@/utils/v1/issue-conversions";
-import { convertNewRolloutToOld } from "@/utils/v1/rollout-conversions";
import { createPlanSkeleton } from "./create";
export * from "./create";
@@ -87,7 +85,7 @@ export function useInitializePlan(
});
const newRollout =
await rolloutServiceClientConnect.getRollout(rolloutRequest);
- rolloutResult = convertNewRolloutToOld(newRollout);
+ rolloutResult = newRollout;
if (!rolloutResult.plan) {
throw new Error(
@@ -106,7 +104,7 @@ export function useInitializePlan(
});
const newIssue =
await issueServiceClientConnect.getIssue(issueRequest);
- issueResult = convertNewIssueToOld(newIssue);
+ issueResult = newIssue;
} catch {
// Issue might not exist or we don't have permission, that's ok
}
@@ -118,7 +116,7 @@ export function useInitializePlan(
name: `${projectNamePrefix}${projectId}/issues/${issueUid}`,
});
const newIssue = await issueServiceClientConnect.getIssue(request);
- issueResult = convertNewIssueToOld(newIssue);
+ issueResult = newIssue;
if (!issueResult.plan) {
// Should not happen, but handle gracefully
@@ -140,7 +138,7 @@ export function useInitializePlan(
name: planResult.issue,
});
const newIssue = await issueServiceClientConnect.getIssue(request);
- issueResult = convertNewIssueToOld(newIssue);
+ issueResult = newIssue;
} catch {
// Issue might not exist or we don't have permission, that's ok
}
@@ -154,7 +152,7 @@ export function useInitializePlan(
});
const newRollout =
await rolloutServiceClientConnect.getRollout(rolloutRequest);
- rolloutResult = convertNewRolloutToOld(newRollout);
+ rolloutResult = newRollout;
} catch {
// Rollout might not exist or we don't have permission, that's ok
}
diff --git a/frontend/src/components/Plan/logic/initialize/util.ts b/frontend/src/components/Plan/logic/initialize/util.ts
index a3633067ef..814575112f 100644
--- a/frontend/src/components/Plan/logic/initialize/util.ts
+++ b/frontend/src/components/Plan/logic/initialize/util.ts
@@ -1,5 +1,5 @@
import { useSheetV1Store, useStorageStore } from "@/store";
-import type { Plan_Spec } from "@/types/proto/v1/plan_service";
+import type { Plan_Spec } from "@/types/proto-es/v1/plan_service_pb";
import { extractSheetUID, getSheetStatement } from "@/utils";
import { sheetNameForSpec } from "../plan";
import { getLocalSheetByName } from "../sheet";
@@ -32,7 +32,7 @@ export const extractInitialSQLFromQuery = async (
};
export const isValidSpec = (spec: Plan_Spec): boolean => {
- if (spec.changeDatabaseConfig) {
+ if (spec.config?.case === "changeDatabaseConfig") {
const sheetName = sheetNameForSpec(spec);
if (!sheetName) {
return false;
diff --git a/frontend/src/components/Plan/logic/issue-review.ts b/frontend/src/components/Plan/logic/issue-review.ts
index b63c7ad3a8..e37a8f651a 100644
--- a/frontend/src/components/Plan/logic/issue-review.ts
+++ b/frontend/src/components/Plan/logic/issue-review.ts
@@ -4,7 +4,7 @@ import { computed, inject, provide, unref } from "vue";
import {
Issue_Approver_Status,
type Issue,
-} from "@/types/proto/v1/issue_service";
+} from "@/types/proto-es/v1/issue_service_pb";
export const KEY = Symbol(
"bb.plan.issue.review.context"
diff --git a/frontend/src/components/Plan/logic/plan-check.ts b/frontend/src/components/Plan/logic/plan-check.ts
index 2719a2af88..e9e6f14636 100644
--- a/frontend/src/components/Plan/logic/plan-check.ts
+++ b/frontend/src/components/Plan/logic/plan-check.ts
@@ -1,8 +1,8 @@
-import type { Plan_Spec, PlanCheckRun } from "@/types/proto/v1/plan_service";
+import type { Plan_Spec, PlanCheckRun } from "@/types/proto-es/v1/plan_service_pb";
import { sheetNameForSpec, targetsForSpec } from "./plan";
export const planSpecHasPlanChecks = (spec: Plan_Spec) => {
- if (spec.changeDatabaseConfig !== undefined) {
+ if (spec.config?.case === "changeDatabaseConfig") {
return true;
}
return false;
diff --git a/frontend/src/components/Plan/logic/plan.ts b/frontend/src/components/Plan/logic/plan.ts
index f754d43be0..8c01e44f7f 100644
--- a/frontend/src/components/Plan/logic/plan.ts
+++ b/frontend/src/components/Plan/logic/plan.ts
@@ -8,7 +8,7 @@ import {
type ComposedProject,
} from "@/types";
import { Engine } from "@/types/proto-es/v1/common_pb";
-import type { Plan_Spec } from "@/types/proto/v1/plan_service";
+import type { Plan_Spec } from "@/types/proto-es/v1/plan_service_pb";
export const databaseForSpec = (project: ComposedProject, spec: Plan_Spec) => {
const targets = targetsForSpec(spec);
@@ -27,7 +27,13 @@ export const databaseForSpec = (project: ComposedProject, spec: Plan_Spec) => {
* @returns empty string if no sheet found
*/
export const sheetNameForSpec = (spec: Plan_Spec): string => {
- return spec.changeDatabaseConfig?.sheet ?? spec.exportDataConfig?.sheet ?? "";
+ if (spec.config?.case === "changeDatabaseConfig") {
+ return spec.config.value.sheet ?? "";
+ }
+ if (spec.config?.case === "exportDataConfig") {
+ return spec.config.value.sheet ?? "";
+ }
+ return "";
};
export const databaseEngineForSpec = async (
@@ -72,8 +78,7 @@ export const databaseEngineForSpec = async (
export const isDatabaseChangeSpec = (spec?: Plan_Spec) => {
if (!spec) return false;
- const config = spec.changeDatabaseConfig || spec.exportDataConfig;
- if (config) {
+ if (spec.config?.case === "changeDatabaseConfig" || spec.config?.case === "exportDataConfig") {
return targetsForSpec(spec).every(isValidDatabaseName);
}
return false;
@@ -81,17 +86,18 @@ export const isDatabaseChangeSpec = (spec?: Plan_Spec) => {
export const isDBGroupChangeSpec = (spec?: Plan_Spec) => {
if (!spec) return false;
- const config = spec.changeDatabaseConfig || spec.exportDataConfig;
- if (config) {
+ if (spec.config?.case === "changeDatabaseConfig" || spec.config?.case === "exportDataConfig") {
return targetsForSpec(spec).every(isValidDatabaseGroupName);
}
return false;
};
export const targetsForSpec = (spec: Plan_Spec): string[] => {
- const config = spec.changeDatabaseConfig || spec.exportDataConfig;
- if (config) {
- return config.targets || [];
+ if (spec.config?.case === "changeDatabaseConfig") {
+ return spec.config.value.targets || [];
+ }
+ if (spec.config?.case === "exportDataConfig") {
+ return spec.config.value.targets || [];
}
return [];
};
diff --git a/frontend/src/components/Plan/logic/poller/utils.ts b/frontend/src/components/Plan/logic/poller/utils.ts
index e834066669..8fe4bbdb4b 100644
--- a/frontend/src/components/Plan/logic/poller/utils.ts
+++ b/frontend/src/components/Plan/logic/poller/utils.ts
@@ -13,17 +13,11 @@ import {
ListPlanCheckRunsRequestSchema,
} from "@/types/proto-es/v1/plan_service_pb";
import { GetRolloutRequestSchema } from "@/types/proto-es/v1/rollout_service_pb";
-import { ListIssueCommentsRequest } from "@/types/proto/v1/issue_service";
-import type { Issue } from "@/types/proto/v1/issue_service";
-import type { Plan, PlanCheckRun } from "@/types/proto/v1/plan_service";
-import type { Rollout } from "@/types/proto/v1/rollout_service";
+import { ListIssueCommentsRequestSchema } from "@/types/proto-es/v1/issue_service_pb";
+import type { Issue } from "@/types/proto-es/v1/issue_service_pb";
+import type { Plan, PlanCheckRun } from "@/types/proto-es/v1/plan_service_pb";
+import type { Rollout } from "@/types/proto-es/v1/rollout_service_pb";
import { hasProjectPermissionV2 } from "@/utils";
-import { convertNewIssueToOld } from "@/utils/v1/issue-conversions";
-import {
- convertNewPlanCheckRunToOld,
- convertNewPlanToOld,
-} from "@/utils/v1/plan-conversions";
-import { convertNewRolloutToOld } from "@/utils/v1/rollout-conversions";
interface RefreshTimestamps {
plan?: number;
@@ -46,7 +40,7 @@ export const refreshPlan = async (plan: Ref<Plan>): Promise<void> => {
name: plan.value.name,
});
const response = await planServiceClientConnect.getPlan(request);
- plan.value = convertNewPlanToOld(response);
+ plan.value = response;
lastRefreshTime.plan = Date.now();
};
@@ -64,7 +58,7 @@ export const refreshPlanCheckRuns = async (
latestOnly: true,
});
const response = await planServiceClientConnect.listPlanCheckRuns(request);
- planCheckRuns.value = response.planCheckRuns.map(convertNewPlanCheckRunToOld);
+ planCheckRuns.value = response.planCheckRuns;
lastRefreshTime.planCheckRuns = Date.now();
};
@@ -82,7 +76,7 @@ export const refreshRollout = async (
});
const newRollout =
await rolloutServiceClientConnect.getRollout(rolloutRequest);
- rollout.value = convertNewRolloutToOld(newRollout);
+ rollout.value = newRollout;
lastRefreshTime.rollout = Date.now();
};
@@ -91,15 +85,14 @@ export const refreshIssue = async (issue: Ref<Issue>): Promise<void> => {
name: issue.value.name,
});
const newIssue = await issueServiceClientConnect.getIssue(request);
- const updatedIssue = convertNewIssueToOld(newIssue);
- issue.value = updatedIssue;
+ issue.value = newIssue;
lastRefreshTime.issue = Date.now();
};
export const refreshIssueComments = async (issue: Issue): Promise<void> => {
const issueCommentStore = useIssueCommentStore();
await issueCommentStore.listIssueComments(
- ListIssueCommentsRequest.fromPartial({
+ create(ListIssueCommentsRequestSchema, {
parent: issue.name,
pageSize: 100,
})
diff --git a/frontend/src/components/Plan/logic/utils.ts b/frontend/src/components/Plan/logic/utils.ts
index 26a223690c..0e149d0378 100644
--- a/frontend/src/components/Plan/logic/utils.ts
+++ b/frontend/src/components/Plan/logic/utils.ts
@@ -1,6 +1,6 @@
import { useProjectV1Store } from "@/store";
import type { ComposedProject } from "@/types";
-import type { Plan } from "@/types/proto/v1/plan_service";
+import type { Plan } from "@/types/proto-es/v1/plan_service_pb";
import { extractProjectResourceName } from "@/utils";
export const projectOfPlan = (plan: Plan): ComposedProject => {
diff --git a/frontend/src/components/PlanCheckRun/PlanCheckRunBadge.vue b/frontend/src/components/PlanCheckRun/PlanCheckRunBadge.vue
index 60e859b8d3..c0b4584c2c 100644
--- a/frontend/src/components/PlanCheckRun/PlanCheckRunBadge.vue
+++ b/frontend/src/components/PlanCheckRun/PlanCheckRunBadge.vue
@@ -43,12 +43,12 @@ import { NTag } from "naive-ui";
import { computed } from "vue";
import { useI18n } from "vue-i18n";
import { TaskSpinner } from "@/components/IssueV1/components/common";
-import type { PlanCheckRun } from "@/types/proto/v1/plan_service";
+import type { PlanCheckRun } from "@/types/proto-es/v1/plan_service_pb";
import {
PlanCheckRun_Result_Status,
PlanCheckRun_Status,
PlanCheckRun_Type,
-} from "@/types/proto/v1/plan_service";
+} from "@/types/proto-es/v1/plan_service_pb";
import { extractPlanCheckRunUID } from "@/utils";
import { planCheckRunResultStatus } from "./common";
diff --git a/frontend/src/components/PlanCheckRun/PlanCheckRunBadgeBar.vue b/frontend/src/components/PlanCheckRun/PlanCheckRunBadgeBar.vue
index 0ed8d5130a..f2f780908f 100644
--- a/frontend/src/components/PlanCheckRun/PlanCheckRunBadgeBar.vue
+++ b/frontend/src/components/PlanCheckRun/PlanCheckRunBadgeBar.vue
@@ -18,7 +18,7 @@ import { computed } from "vue";
import {
PlanCheckRun_Type,
type PlanCheckRun,
-} from "@/types/proto/v1/plan_service";
+} from "@/types/proto-es/v1/plan_service_pb";
import { groupBy } from "@/utils/collections";
import PlanCheckRunBadge from "./PlanCheckRunBadge.vue";
diff --git a/frontend/src/components/PlanCheckRun/PlanCheckRunBar.vue b/frontend/src/components/PlanCheckRun/PlanCheckRunBar.vue
index 9b6d826205..86a7a9528e 100644
--- a/frontend/src/components/PlanCheckRun/PlanCheckRunBar.vue
+++ b/frontend/src/components/PlanCheckRun/PlanCheckRunBar.vue
@@ -41,7 +41,7 @@ import type { ComposedDatabase } from "@/types";
import type {
PlanCheckRun,
PlanCheckRun_Type,
-} from "@/types/proto/v1/plan_service";
+} from "@/types/proto-es/v1/plan_service_pb";
import type { VueClass } from "@/utils";
import PlanCheckRunBadgeBar from "./PlanCheckRunBadgeBar.vue";
import PlanCheckRunButton from "./PlanCheckRunButton.vue";
diff --git a/frontend/src/components/PlanCheckRun/PlanCheckRunButton.vue b/frontend/src/components/PlanCheckRun/PlanCheckRunButton.vue
index 840a2a8ef0..8ef8ca7b30 100644
--- a/frontend/src/components/PlanCheckRun/PlanCheckRunButton.vue
+++ b/frontend/src/components/PlanCheckRun/PlanCheckRunButton.vue
@@ -11,10 +11,8 @@
import { PlayIcon } from "lucide-vue-next";
import { NButton } from "naive-ui";
import { computed } from "vue";
-import {
- PlanCheckRun,
- PlanCheckRun_Status,
-} from "@/types/proto/v1/plan_service";
+import type { PlanCheckRun } from "@/types/proto-es/v1/plan_service_pb";
+import { PlanCheckRun_Status } from "@/types/proto-es/v1/plan_service_pb";
const props = defineProps<{
planCheckRunList: PlanCheckRun[];
diff --git a/frontend/src/components/PlanCheckRun/PlanCheckRunDetail.vue b/frontend/src/components/PlanCheckRun/PlanCheckRunDetail.vue
index 321a13740d..b747118589 100644
--- a/frontend/src/components/PlanCheckRun/PlanCheckRunDetail.vue
+++ b/frontend/src/components/PlanCheckRun/PlanCheckRunDetail.vue
@@ -66,7 +66,7 @@
>
<div
v-if="
- row.checkResult.sqlReviewReport &&
+ (row.checkResult as any).sqlReviewReport &&
getActiveRule(row.checkResult.title)
"
class="pl-2 first:pl-0"
@@ -77,9 +77,9 @@
>{{ $t("sql-review.rule-detail") }}</span
>
</div>
- <div v-if="row.checkResult.sqlSummaryReport" class="pl-2 first:pl-0">
+ <div v-if="(row.checkResult as any).sqlSummaryReport" class="pl-2 first:pl-0">
<span>
- {{ row.checkResult.sqlSummaryReport.affectedRows }}
+ {{ (row.checkResult as any).sqlSummaryReport?.affectedRows }}
</span>
</div>
@@ -96,21 +96,21 @@
<!-- Only show the error line for latest plan check run -->
<div
- v-if="showCodeLocation && row.checkResult.sqlReviewReport?.line"
+ v-if="showCodeLocation && (row.checkResult as any).sqlReviewReport?.line"
class="pl-2 first:pl-0"
>
<span
class="normal-link"
@click="
convertPositionLineToMonacoLine(
- row.checkResult.sqlReviewReport!.line
+ (row.checkResult as any).sqlReviewReport!.line
)
"
>
Line
{{
convertPositionLineToMonacoLine(
- row.checkResult.sqlReviewReport.line
+ (row.checkResult as any).sqlReviewReport.line
)
}}
</span>
@@ -158,7 +158,7 @@
<span>{{ row.checkResult.content }}</span>
<template
v-if="
- row.checkResult.sqlReviewReport &&
+ (row.checkResult as any).sqlReviewReport &&
getActiveRule(row.checkResult.title)
"
>
@@ -169,8 +169,8 @@
>
<span class="border-r border-control-border ml-1"></span>
</template>
- <template v-if="row.checkResult.sqlSummaryReport">
- {{ row.checkResult.sqlSummaryReport.affectedRows }}
+ <template v-if="(row.checkResult as any).sqlSummaryReport">
+ {{ (row.checkResult as any).sqlSummaryReport?.affectedRows }}
</template>
<a
@@ -184,7 +184,7 @@
<!-- Only show the error line for latest plan check run -->
<template
- v-if="showCodeLocation && row.checkResult.sqlReviewReport?.line"
+ v-if="showCodeLocation && (row.checkResult as any).sqlReviewReport?.line"
>
<span class="border-r border-control-border ml-1"></span>
<span
@@ -192,7 +192,7 @@
@click="
handleClickPlanCheckDetailLine(
convertPositionLineToMonacoLine(
- row.checkResult.sqlReviewReport!.line
+ (row.checkResult as any).sqlReviewReport!.line
)
)
"
@@ -200,7 +200,7 @@
Line
{{
convertPositionLineToMonacoLine(
- row.checkResult.sqlReviewReport.line
+ (row.checkResult as any).sqlReviewReport.line
)
}}
</span>
@@ -260,12 +260,15 @@ import {
convertPolicyRuleToRuleTemplate,
} from "@/types";
import { SQLReviewRuleLevel } from "@/types/proto-es/v1/org_policy_service_pb";
-import {
+import type {
PlanCheckRun,
PlanCheckRun_Result,
+} from "@/types/proto-es/v1/plan_service_pb";
+import {
PlanCheckRun_Result_Status,
PlanCheckRun_Status,
-} from "@/types/proto/v1/plan_service";
+ PlanCheckRun_ResultSchema,
+} from "@/types/proto-es/v1/plan_service_pb";
import { convertPositionLineToMonacoLine } from "@/utils/v1/position";
import { usePlanCheckRunContext } from "./context";
import { OnlineMigrationDetail } from "./detail";
@@ -315,7 +318,7 @@ const checkResultList = computed((): PlanCheckRun_Result[] => {
return props.planCheckRun.results;
} else if (props.planCheckRun.status === PlanCheckRun_Status.FAILED) {
return [
- PlanCheckRun_Result.fromPartial({
+ create(PlanCheckRun_ResultSchema, {
status: PlanCheckRun_Result_Status.ERROR,
title: t("common.error"),
content: props.planCheckRun.error,
@@ -323,7 +326,7 @@ const checkResultList = computed((): PlanCheckRun_Result[] => {
];
} else if (props.planCheckRun.status === PlanCheckRun_Status.CANCELED) {
return [
- PlanCheckRun_Result.fromPartial({
+ create(PlanCheckRun_ResultSchema, {
status: PlanCheckRun_Result_Status.WARNING,
title: t("common.canceled"),
content: props.planCheckRun.error,
@@ -371,7 +374,7 @@ const builtinRuleLevel = (type: string): SQLReviewRuleLevel => {
const categoryAndTitle = (
checkResult: PlanCheckRun_Result
): [string, string] => {
- if (checkResult.sqlReviewReport) {
+ if ((checkResult as any).sqlReviewReport) {
const code = checkResult.code;
if (!code) {
return ["", checkResult.title];
@@ -395,8 +398,8 @@ const categoryAndTitle = (
}
return ["", messageWithCode(checkResult.title, code)];
}
- if (checkResult.sqlSummaryReport) {
- if (typeof checkResult.sqlSummaryReport.affectedRows === "number") {
+ if ((checkResult as any).sqlSummaryReport) {
+ if (typeof (checkResult as any).sqlSummaryReport?.affectedRows === "number") {
return [
"",
`${t("task.check-type.affected-rows.self")} (${t("task.check-type.affected-rows.description")})`,
@@ -431,7 +434,7 @@ const errorCodeLink = (
};
default: {
const errorCodeNamespace =
- checkResult.sqlReviewReport !== undefined ? "advisor" : "core";
+ (checkResult as any).sqlReviewReport !== undefined ? "advisor" : "core";
const domain = "https://www.bytebase.com";
const path = `/docs/reference/error-code/${errorCodeNamespace}/`;
const query = `source=console#${code}`;
diff --git a/frontend/src/components/PlanCheckRun/PlanCheckRunModal.vue b/frontend/src/components/PlanCheckRun/PlanCheckRunModal.vue
index e83272a260..b316fcc26b 100644
--- a/frontend/src/components/PlanCheckRun/PlanCheckRunModal.vue
+++ b/frontend/src/components/PlanCheckRun/PlanCheckRunModal.vue
@@ -21,7 +21,7 @@ import type { ComposedDatabase } from "@/types";
import type {
PlanCheckRun,
PlanCheckRun_Type,
-} from "@/types/proto/v1/plan_service";
+} from "@/types/proto-es/v1/plan_service_pb";
import PlanCheckRunPanel from "./PlanCheckRunPanel.vue";
defineProps<{
diff --git a/frontend/src/components/PlanCheckRun/PlanCheckRunPanel.vue b/frontend/src/components/PlanCheckRun/PlanCheckRunPanel.vue
index c7b374a85c..454aff9372 100644
--- a/frontend/src/components/PlanCheckRun/PlanCheckRunPanel.vue
+++ b/frontend/src/components/PlanCheckRun/PlanCheckRunPanel.vue
@@ -27,12 +27,12 @@ import { computed, ref } from "vue";
import { useI18n } from "vue-i18n";
import type { TabFilterItem } from "@/components/v2";
import { TabFilter } from "@/components/v2";
-import { getDateForPbTimestamp, type ComposedDatabase } from "@/types";
+import { getDateForPbTimestampProtoEs, type ComposedDatabase } from "@/types";
import {
PlanCheckRun_Result_Status,
PlanCheckRun_Type,
type PlanCheckRun,
-} from "@/types/proto/v1/plan_service";
+} from "@/types/proto-es/v1/plan_service_pb";
import { extractPlanCheckRunUID, humanizeDate } from "@/utils";
import PlanCheckRunBadgeBar from "./PlanCheckRunBadgeBar.vue";
import PlanCheckRunDetail from "./PlanCheckRunDetail.vue";
@@ -102,7 +102,7 @@ const tabItemList = computed(() => {
i === 0
? t("common.latest")
: planCheckRun.createTime
- ? humanizeDate(getDateForPbTimestamp(planCheckRun.createTime))
+ ? humanizeDate(getDateForPbTimestampProtoEs(planCheckRun.createTime))
: `UID(${extractPlanCheckRunUID(planCheckRun.name)})`;
return {
label,
diff --git a/frontend/src/components/PlanCheckRun/common.ts b/frontend/src/components/PlanCheckRun/common.ts
index e12fb4abad..31611180e7 100644
--- a/frontend/src/components/PlanCheckRun/common.ts
+++ b/frontend/src/components/PlanCheckRun/common.ts
@@ -4,7 +4,7 @@ import {
PlanCheckRun_Status,
PlanCheckRun_Type,
type PlanCheckRun,
-} from "@/types/proto/v1/plan_service";
+} from "@/types/proto-es/v1/plan_service_pb";
import { extractPlanCheckRunUID } from "@/utils";
export const planCheckRunResultStatus = (checkRun: PlanCheckRun) => {
diff --git a/frontend/src/components/Release/ReleaseDetail/NavBar/ApplyToDatabasePanel.vue b/frontend/src/components/Release/ReleaseDetail/NavBar/ApplyToDatabasePanel.vue
index 0c3ce875b2..b8c0606377 100644
--- a/frontend/src/components/Release/ReleaseDetail/NavBar/ApplyToDatabasePanel.vue
+++ b/frontend/src/components/Release/ReleaseDetail/NavBar/ApplyToDatabasePanel.vue
@@ -67,17 +67,13 @@ import { PROJECT_V1_ROUTE_ISSUE_DETAIL } from "@/router/dashboard/projectV1";
import { pushNotification, useDatabaseV1Store, useDBGroupStore } from "@/store";
import { CreatePlanRequestSchema } from "@/types/proto-es/v1/plan_service_pb";
import { PreviewRolloutRequestSchema } from "@/types/proto-es/v1/rollout_service_pb";
-import { Plan } from "@/types/proto/v1/plan_service";
+import { PlanSchema, Plan_ChangeDatabaseConfigSchema } from "@/types/proto-es/v1/plan_service_pb";
import { create } from "@bufbuild/protobuf";
import {
extractProjectResourceName,
generateIssueTitle,
issueV1Slug,
} from "@/utils";
-import {
- convertOldPlanToNew,
- convertNewPlanToOld,
-} from "@/utils/v1/plan-conversions";
import { useReleaseDetailContext } from "../context";
import { createIssueFromPlan } from "./utils";
import { DatabaseGroupSchema } from "@/types/proto-es/v1/database_group_service_pb";
@@ -122,23 +118,25 @@ const handleCreate = async () => {
const databaseGroup = create(DatabaseGroupSchema, dbGroupStore.getDBGroupByName(
state.targetSelectState.selectedDatabaseGroup || ""
));
- const planData = Plan.fromPartial({
+ const newPlan = create(PlanSchema, {
title: `Release "${release.value.title}"`,
description: `Apply release "${release.value.title}" to selected databases.`,
specs: [
{
id: crypto.randomUUID(),
- changeDatabaseConfig: {
- targets:
- (state.targetSelectState.changeSource === "DATABASE"
- ? state.targetSelectState.selectedDatabaseNameList
- : [state.targetSelectState.selectedDatabaseGroup!]) || [],
- release: release.value.name,
+ config: {
+ case: "changeDatabaseConfig",
+ value: create(Plan_ChangeDatabaseConfigSchema, {
+ targets:
+ (state.targetSelectState.changeSource === "DATABASE"
+ ? state.targetSelectState.selectedDatabaseNameList
+ : [state.targetSelectState.selectedDatabaseGroup!]) || [],
+ release: release.value.name,
+ }),
},
},
],
});
- const newPlan = convertOldPlanToNew(planData);
try {
const previewRolloutRequest = create(PreviewRolloutRequestSchema, {
project: project.value.name,
@@ -162,9 +160,8 @@ const handleCreate = async () => {
plan: newPlan,
});
const response = await planServiceClientConnect.createPlan(request);
- const createdPlan = convertNewPlanToOld(response);
const createdIssue = await createIssueFromPlan(project.value.name, {
- ...createdPlan,
+ ...response,
// Override title and description.
title: generateIssueTitle(
"bb.issue.database.schema.update",
diff --git a/frontend/src/components/Release/ReleaseDetail/NavBar/utils.ts b/frontend/src/components/Release/ReleaseDetail/NavBar/utils.ts
index c6256c31c2..54e7e681be 100644
--- a/frontend/src/components/Release/ReleaseDetail/NavBar/utils.ts
+++ b/frontend/src/components/Release/ReleaseDetail/NavBar/utils.ts
@@ -1,17 +1,15 @@
import { create } from "@bufbuild/protobuf";
import { issueServiceClientConnect, rolloutServiceClientConnect } from "@/grpcweb";
import { CreateIssueRequestSchema } from "@/types/proto-es/v1/issue_service_pb";
-import { convertNewIssueToOld, convertOldIssueToNew } from "@/utils/v1/issue-conversions";
import { useCurrentUserV1 } from "@/store";
import { emptyIssue, type ComposedIssue } from "@/types";
-import { Issue, Issue_Type, IssueStatus } from "@/types/proto/v1/issue_service";
-import type { Plan } from "@/types/proto/v1/plan_service";
+import { IssueSchema, Issue_Type, IssueStatus } from "@/types/proto-es/v1/issue_service_pb";
+import type { Plan } from "@/types/proto-es/v1/plan_service_pb";
import { CreateRolloutRequestSchema } from "@/types/proto-es/v1/rollout_service_pb";
-import { convertNewRolloutToOld } from "@/utils/v1/rollout-conversions";
export const createIssueFromPlan = async (project: string, plan: Plan) => {
const me = useCurrentUserV1();
- const issuePartial = Issue.fromPartial({
+ const issue = create(IssueSchema, {
plan: plan.name,
creator: `users/${me.value.email}`,
title: plan.title,
@@ -19,21 +17,18 @@ export const createIssueFromPlan = async (project: string, plan: Plan) => {
status: IssueStatus.OPEN,
type: Issue_Type.DATABASE_CHANGE,
});
- const newIssue = convertOldIssueToNew(issuePartial);
const request = create(CreateIssueRequestSchema, {
parent: project,
- issue: newIssue,
+ issue: issue,
});
- const newCreatedIssue = await issueServiceClientConnect.createIssue(request);
- const createdIssue = convertNewIssueToOld(newCreatedIssue);
+ const createdIssue = await issueServiceClientConnect.createIssue(request);
const rolloutRequest = create(CreateRolloutRequestSchema, {
parent: project,
rollout: {
plan: plan.name,
},
});
- const createdRolloutNew = await rolloutServiceClientConnect.createRollout(rolloutRequest);
- const createdRollout = convertNewRolloutToOld(createdRolloutNew);
+ const createdRollout = await rolloutServiceClientConnect.createRollout(rolloutRequest);
const composedIssue: ComposedIssue = {
...emptyIssue(),
...createdIssue,
diff --git a/frontend/src/components/Revision/RevisionDetailPanel.vue b/frontend/src/components/Revision/RevisionDetailPanel.vue
index 3202a2b2fc..51870bcab7 100644
--- a/frontend/src/components/Revision/RevisionDetailPanel.vue
+++ b/frontend/src/components/Revision/RevisionDetailPanel.vue
@@ -52,13 +52,12 @@ import { NDivider } from "naive-ui";
import { computed, reactive, ref, watch } from "vue";
import { create } from "@bufbuild/protobuf";
import { GetTaskRunRequestSchema } from "@/types/proto-es/v1/rollout_service_pb";
-import { convertNewTaskRunToOld } from "@/utils/v1/rollout-conversions";
import { MonacoEditor } from "@/components/MonacoEditor";
import { CopyButton } from "@/components/v2";
import { rolloutServiceClientConnect } from "@/grpcweb";
import { useRevisionStore, useSheetV1Store } from "@/store";
import { getDateForPbTimestampProtoEs, type ComposedDatabase } from "@/types";
-import type { TaskRun } from "@/types/proto/v1/rollout_service";
+import type { TaskRun } from "@/types/proto-es/v1/rollout_service_pb";
import { extractIssueUID, getSheetStatement } from "@/utils";
import TaskRunLogTable from "../IssueV1/components/TaskRunSection/TaskRunLogTable/TaskRunLogTable.vue";
import HumanizeDate from "../misc/HumanizeDate.vue";
@@ -94,11 +93,10 @@ watch(
name: revision.taskRun,
});
const response = await rolloutServiceClientConnect.getTaskRun(request);
- const taskRunData = convertNewTaskRunToOld(response);
- taskRun.value = taskRunData;
+ taskRun.value = response;
// Prepare the sheet data from task run.
- if (taskRunData.sheet) {
- await sheetStore.getOrFetchSheetByName(taskRunData.sheet, "FULL");
+ if (response.sheet) {
+ await sheetStore.getOrFetchSheetByName(response.sheet, "FULL");
}
}
state.loading = false;
diff --git a/frontend/src/components/Rollout/RolloutDataTable.vue b/frontend/src/components/Rollout/RolloutDataTable.vue
index f1e89c321e..fccee1801b 100644
--- a/frontend/src/components/Rollout/RolloutDataTable.vue
+++ b/frontend/src/components/Rollout/RolloutDataTable.vue
@@ -20,9 +20,9 @@ import { RouterLink, useRouter } from "vue-router";
import { BBAvatar } from "@/bbkit";
import TaskStatus from "@/components/Rollout/kits/TaskStatus.vue";
import { PROJECT_V1_ROUTE_PLAN_DETAIL } from "@/router/dashboard/projectV1";
-import { getTimeForPbTimestamp, type ComposedRollout } from "@/types";
-import { Task_Status as TaskStatusEnum } from "@/types/proto/v1/rollout_service";
-import type { Task_Status } from "@/types/proto/v1/rollout_service";
+import { getTimeForPbTimestampProtoEs, type ComposedRollout } from "@/types";
+import { Task_Status as TaskStatusEnum } from "@/types/proto-es/v1/rollout_service_pb";
+import type { Task_Status } from "@/types/proto-es/v1/rollout_service_pb";
import {
extractPlanUID,
extractProjectResourceName,
@@ -145,7 +145,7 @@ const columnList = computed(
title: t("common.created-at"),
width: 128,
render: (rollout) =>
- humanizeTs(getTimeForPbTimestamp(rollout.createTime, 0) / 1000),
+ humanizeTs(getTimeForPbTimestampProtoEs(rollout.createTime, 0) / 1000),
},
];
return columns.filter((column) => !column.hide);
diff --git a/frontend/src/components/Rollout/kits/TaskStatus.vue b/frontend/src/components/Rollout/kits/TaskStatus.vue
index 897d9e69ba..f371c8b4d8 100644
--- a/frontend/src/components/Rollout/kits/TaskStatus.vue
+++ b/frontend/src/components/Rollout/kits/TaskStatus.vue
@@ -65,7 +65,7 @@ import { FastForwardIcon, PauseIcon } from "lucide-vue-next";
import { NTooltip } from "naive-ui";
import { twMerge } from "tailwind-merge";
import { computed } from "vue";
-import { Task_Status } from "@/types/proto/v1/rollout_service";
+import { Task_Status } from "@/types/proto-es/v1/rollout_service_pb";
const props = defineProps<{
status: Task_Status;
diff --git a/frontend/src/components/SQLCheck/SQLCheckPanel.vue b/frontend/src/components/SQLCheck/SQLCheckPanel.vue
index b9d16e2332..8001f0ba87 100644
--- a/frontend/src/components/SQLCheck/SQLCheckPanel.vue
+++ b/frontend/src/components/SQLCheck/SQLCheckPanel.vue
@@ -54,6 +54,7 @@
</template>
<script setup lang="ts">
+import { create as createProto } from "@bufbuild/protobuf";
import { NButton, NTag } from "naive-ui";
import { computed, watchEffect, ref } from "vue";
import { useI18n } from "vue-i18n";
@@ -63,12 +64,13 @@ import { usePolicyV1Store } from "@/store";
import type { ComposedDatabase } from "@/types";
import { PolicyType } from "@/types/proto-es/v1/org_policy_service_pb";
import {
- PlanCheckRun,
- PlanCheckRun_Result,
+ PlanCheckRunSchema,
+ PlanCheckRun_ResultSchema,
PlanCheckRun_Result_Status,
- PlanCheckRun_Result_SqlReviewReport,
+ PlanCheckRun_Result_SqlReviewReportSchema,
PlanCheckRun_Status,
-} from "@/types/proto/v1/plan_service";
+} from "@/types/proto-es/v1/plan_service_pb";
+import type { PlanCheckRun } from "@/types/proto-es/v1/plan_service_pb";
import { CheckReleaseResponse_RiskLevel } from "@/types/proto-es/v1/release_service_pb";
import type { Advice } from "@/types/proto-es/v1/sql_service_pb";
import { Advice_Status } from "@/types/proto-es/v1/sql_service_pb";
@@ -150,7 +152,7 @@ watchEffect(async () => {
});
const planCheckRun = computed((): PlanCheckRun => {
- return PlanCheckRun.fromPartial({
+ return createProto(PlanCheckRunSchema, {
status: PlanCheckRun_Status.DONE,
results: props.advices.map((advice) => {
let status = PlanCheckRun_Result_Status.STATUS_UNSPECIFIED;
@@ -165,15 +167,18 @@ const planCheckRun = computed((): PlanCheckRun => {
status = PlanCheckRun_Result_Status.ERROR;
break;
}
- return PlanCheckRun_Result.fromPartial({
+ return createProto(PlanCheckRun_ResultSchema, {
status,
title: advice.title,
code: advice.code,
content: advice.content,
- sqlReviewReport: PlanCheckRun_Result_SqlReviewReport.fromPartial({
- line: advice.startPosition?.line ?? 0,
- column: advice.startPosition?.column ?? Number.MAX_SAFE_INTEGER,
- }),
+ report: {
+ case: "sqlReviewReport",
+ value: createProto(PlanCheckRun_Result_SqlReviewReportSchema, {
+ line: advice.startPosition?.line ?? 0,
+ column: advice.startPosition?.column ?? Number.MAX_SAFE_INTEGER,
+ }),
+ },
});
}),
});
diff --git a/frontend/src/store/modules/rollout.ts b/frontend/src/store/modules/rollout.ts
index 1e178bcb36..e3330b76db 100644
--- a/frontend/src/store/modules/rollout.ts
+++ b/frontend/src/store/modules/rollout.ts
@@ -7,12 +7,11 @@ import { rolloutServiceClientConnect } from "@/grpcweb";
import { silentContextKey } from "@/grpcweb/context-key";
import type { MaybeRef, Pagination, ComposedRollout } from "@/types";
import { isValidRolloutName, unknownRollout, unknownUser } from "@/types";
-import type { Rollout } from "@/types/proto/v1/rollout_service";
+import type { Rollout } from "@/types/proto-es/v1/rollout_service_pb";
import {
GetRolloutRequestSchema,
ListRolloutsRequestSchema
} from "@/types/proto-es/v1/rollout_service_pb";
-import { convertNewRolloutToOld } from "@/utils/v1/rollout-conversions";
import { DEFAULT_PAGE_SIZE } from "./common";
import { useUserStore } from "./user";
import { useProjectV1Store, batchGetOrFetchProjects } from "./v1";
@@ -35,8 +34,7 @@ export const useRolloutStore = defineStore("rollout", () => {
pageToken: pagination?.pageToken || "",
});
const resp = await rolloutServiceClientConnect.listRollouts(request);
- const oldRollouts = resp.rollouts.map(convertNewRolloutToOld);
- const composedRolloutList = await batchComposeRollout(oldRollouts);
+ const composedRolloutList = await batchComposeRollout(resp.rollouts);
composedRolloutList.forEach((rollout) => {
rolloutMapByName.set(rollout.name, rollout);
});
@@ -53,8 +51,7 @@ export const useRolloutStore = defineStore("rollout", () => {
const rollout = await rolloutServiceClientConnect.getRollout(request, {
contextValues: createContextValues().set(silentContextKey, silent),
});
- const oldRollout = convertNewRolloutToOld(rollout);
- const [composedRollout] = await batchComposeRollout([oldRollout]);
+ const [composedRollout] = await batchComposeRollout([rollout]);
rolloutMapByName.set(composedRollout.name, composedRollout);
return composedRollout;
};
diff --git a/frontend/src/store/modules/v1/experimental-issue.ts b/frontend/src/store/modules/v1/experimental-issue.ts
index 29da4dd978..637b9c3feb 100644
--- a/frontend/src/store/modules/v1/experimental-issue.ts
+++ b/frontend/src/store/modules/v1/experimental-issue.ts
@@ -28,23 +28,10 @@ import {
ListTaskRunsRequestSchema,
CreateRolloutRequestSchema,
} from "@/types/proto-es/v1/rollout_service_pb";
-import type { Issue } from "@/types/proto/v1/issue_service";
-import type { Plan } from "@/types/proto/v1/plan_service";
-import { TaskRunLog } from "@/types/proto/v1/rollout_service";
+import type { Issue } from "@/types/proto-es/v1/issue_service_pb";
+import type { Plan } from "@/types/proto-es/v1/plan_service_pb";
+import { TaskRunLogSchema } from "@/types/proto-es/v1/rollout_service_pb";
import { extractProjectResourceName, hasProjectPermissionV2 } from "@/utils";
-import {
- convertNewIssueToOld,
- convertOldIssueToNew,
-} from "@/utils/v1/issue-conversions";
-import {
- convertNewPlanToOld,
- convertNewPlanCheckRunToOld,
- convertOldPlanToNew,
-} from "@/utils/v1/plan-conversions";
-import {
- convertNewRolloutToOld,
- convertNewTaskRunToOld,
-} from "@/utils/v1/rollout-conversions";
import { DEFAULT_PAGE_SIZE } from "../common";
export interface ComposeIssueConfig {
@@ -75,7 +62,7 @@ export const composeIssue = async (
name: issue.plan,
});
const response = await planServiceClientConnect.getPlan(request);
- issue.planEntity = convertNewPlanToOld(response);
+ issue.planEntity = response;
}
if (hasProjectPermissionV2(projectEntity, "bb.planCheckRuns.list")) {
@@ -86,9 +73,7 @@ export const composeIssue = async (
});
const response =
await planServiceClientConnect.listPlanCheckRuns(request);
- const planCheckRuns = response.planCheckRuns.map(
- convertNewPlanCheckRunToOld
- );
+ const planCheckRuns = response.planCheckRuns;
issue.planCheckRunList = orderBy(planCheckRuns, "name", "desc");
}
}
@@ -98,7 +83,7 @@ export const composeIssue = async (
name: issue.rollout,
});
const response = await rolloutServiceClientConnect.getRollout(request);
- issue.rolloutEntity = convertNewRolloutToOld(response);
+ issue.rolloutEntity = response;
}
if (hasProjectPermissionV2(projectEntity, "bb.taskRuns.list")) {
@@ -107,12 +92,12 @@ export const composeIssue = async (
pageSize: DEFAULT_PAGE_SIZE,
});
const response = await rolloutServiceClientConnect.listTaskRuns(request);
- const taskRuns = response.taskRuns.map(convertNewTaskRunToOld);
+ const taskRuns = response.taskRuns;
const composedTaskRuns: ComposedTaskRun[] = [];
for (const taskRun of taskRuns) {
const composed: ComposedTaskRun = {
...taskRun,
- taskRunLog: TaskRunLog.fromPartial({}),
+ taskRunLog: create(TaskRunLogSchema, {}),
};
composedTaskRuns.push(composed);
}
@@ -149,7 +134,7 @@ export const experimentalFetchIssueByUID = async (
name: `${project}/issues/${uid}`,
});
const newIssue = await issueServiceClientConnect.getIssue(request);
- const rawIssue = convertNewIssueToOld(newIssue);
+ const rawIssue = newIssue;
return composeIssue(rawIssue);
};
@@ -159,22 +144,22 @@ export const experimentalCreateIssueByPlan = async (
issueCreate: Issue,
planCreate: Plan
) => {
- const newPlan = convertOldPlanToNew(planCreate);
+ const newPlan = planCreate;
const request = create(CreatePlanRequestSchema, {
parent: project.name,
plan: newPlan,
});
const response = await planServiceClientConnect.createPlan(request);
- const createdPlan = convertNewPlanToOld(response);
+ const createdPlan = response;
issueCreate.plan = createdPlan.name;
const issueRequest = create(CreateIssueRequestSchema, {
parent: project.name,
- issue: convertOldIssueToNew(issueCreate),
+ issue: issueCreate,
});
const newCreatedIssue =
await issueServiceClientConnect.createIssue(issueRequest);
- const createdIssue = convertNewIssueToOld(newCreatedIssue);
+ const createdIssue = newCreatedIssue;
const rolloutRequest = create(CreateRolloutRequestSchema, {
parent: project.name,
rollout: {
@@ -183,7 +168,7 @@ export const experimentalCreateIssueByPlan = async (
});
const rolloutResponse =
await rolloutServiceClientConnect.createRollout(rolloutRequest);
- const createdRollout = convertNewRolloutToOld(rolloutResponse);
+ const createdRollout = rolloutResponse;
createdIssue.rollout = createdRollout.name;
return { createdPlan, createdIssue, createdRollout };
diff --git a/frontend/src/store/modules/v1/issue.ts b/frontend/src/store/modules/v1/issue.ts
index 460dc37f12..daa7b46d6c 100644
--- a/frontend/src/store/modules/v1/issue.ts
+++ b/frontend/src/store/modules/v1/issue.ts
@@ -13,15 +13,12 @@ import {
SearchIssuesRequestSchema,
UpdateIssueRequestSchema,
} from "@/types/proto-es/v1/issue_service_pb";
-import {
- convertNewIssueToOld,
-} from "@/utils/v1/issue-conversions";
import { SYSTEM_BOT_EMAIL, type IssueFilter } from "@/types";
-import type { ApprovalStep, Issue } from "@/types/proto/v1/issue_service";
+import type { ApprovalStep, Issue } from "@/types/proto-es/v1/issue_service_pb";
import {
- issueStatusToJSON,
+ IssueStatus,
ApprovalNode_Type,
-} from "@/types/proto/v1/issue_service";
+} from "@/types/proto-es/v1/issue_service_pb";
import {
extractProjectResourceName,
memberMapToRolesInProjectIAM,
@@ -47,7 +44,7 @@ export const buildIssueFilter = (find: IssueFilter): string => {
}
if (find.statusList && find.statusList.length > 0) {
filter.push(
- `status in [${find.statusList.map((s) => `"${issueStatusToJSON(s)}"`).join(",")}]`
+ `status in [${find.statusList.map((s) => `"${IssueStatus[s]}"`).join(",")}]`
);
}
if (find.createdTsAfter) {
@@ -105,7 +102,7 @@ export const useIssueV1Store = defineStore("issue_v1", () => {
pageToken,
});
const resp = await issueServiceClientConnect.searchIssues(request);
- const issues = resp.issues.map((newIssue) => convertNewIssueToOld(newIssue));
+ const issues = resp.issues;
const composedIssues = await Promise.all(
issues.map((issue) => shallowComposeIssue(issue, composeIssueConfig))
);
@@ -127,7 +124,7 @@ export const useIssueV1Store = defineStore("issue_v1", () => {
const newIssue = await issueServiceClientConnect.getIssue(request, {
contextValues: createContextValues().set(silentContextKey, silent),
});
- const issue = convertNewIssueToOld(newIssue);
+ const issue = newIssue;
return shallowComposeIssue(issue, composeIssueConfig);
};
diff --git a/frontend/src/store/modules/v1/issueComment.ts b/frontend/src/store/modules/v1/issueComment.ts
index f76ee3da4e..40c2ca8074 100644
--- a/frontend/src/store/modules/v1/issueComment.ts
+++ b/frontend/src/store/modules/v1/issueComment.ts
@@ -11,10 +11,7 @@ import {
import type {
IssueComment,
ListIssueCommentsRequest,
-} from "@/types/proto/v1/issue_service";
-import {
- convertNewIssueCommentToOld,
-} from "@/utils/v1/issue-conversions";
+} from "@/types/proto-es/v1/issue_service_pb";
import {
getProjectIdIssueIdIssueCommentId,
issueNamePrefix,
@@ -38,15 +35,15 @@ const composeIssueComment = (
issueComment: IssueComment
): ComposedIssueComment => {
let type = IssueCommentType.USER_COMMENT;
- if (issueComment.approval !== undefined) {
+ if (issueComment.event?.case === "approval") {
type = IssueCommentType.APPROVAL;
- } else if (issueComment.issueUpdate !== undefined) {
+ } else if (issueComment.event?.case === "issueUpdate") {
type = IssueCommentType.ISSUE_UPDATE;
- } else if (issueComment.stageEnd !== undefined) {
+ } else if (issueComment.event?.case === "stageEnd") {
type = IssueCommentType.STAGE_END;
- } else if (issueComment.taskUpdate !== undefined) {
+ } else if (issueComment.event?.case === "taskUpdate") {
type = IssueCommentType.TASK_UPDATE;
- } else if (issueComment.taskPriorBackup !== undefined) {
+ } else if (issueComment.event?.case === "taskPriorBackup") {
type = IssueCommentType.TASK_PRIOR_BACKUP;
}
return {
@@ -66,9 +63,7 @@ export const useIssueCommentStore = defineStore("issue_comment", () => {
pageToken: request.pageToken,
});
const resp = await issueServiceClientConnect.listIssueComments(connectRequest);
- const issueComments = resp.issueComments.map((newComment) =>
- convertNewIssueCommentToOld(newComment)
- );
+ const issueComments = resp.issueComments;
issueCommentMap.set(
request.parent,
issueComments.map(composeIssueComment)
@@ -94,7 +89,7 @@ export const useIssueCommentStore = defineStore("issue_comment", () => {
}),
});
const newIssueComment = await issueServiceClientConnect.createIssueComment(request);
- const issueComment = convertNewIssueCommentToOld(newIssueComment);
+ const issueComment = newIssueComment;
issueCommentMap.set(issueName, [
...(issueCommentMap.get(issueName) ?? []),
composeIssueComment(issueComment),
diff --git a/frontend/src/store/modules/v1/plan.ts b/frontend/src/store/modules/v1/plan.ts
index 2c4277a37d..847a1116b4 100644
--- a/frontend/src/store/modules/v1/plan.ts
+++ b/frontend/src/store/modules/v1/plan.ts
@@ -7,8 +7,7 @@ import {
SearchPlansRequestSchema,
GetPlanRequestSchema,
} from "@/types/proto-es/v1/plan_service_pb";
-import type { Plan } from "@/types/proto/v1/plan_service";
-import { convertNewPlanToOld } from "@/utils/v1/plan-conversions";
+import type { Plan } from "@/types/proto-es/v1/plan_service_pb";
import {
getTsRangeFromSearchParams,
getValueFromSearchParams,
@@ -83,8 +82,7 @@ export const usePlanStore = defineStore("plan", () => {
pageToken,
});
const resp = await planServiceClientConnect.searchPlans(request);
- // Convert response to old proto format
- const plans = resp.plans.map((plan) => convertNewPlanToOld(plan));
+ const plans = resp.plans;
// Prepare creator for the plans.
const users = uniq(plans.map((plan) => plan.creator));
await useUserStore().batchGetUsers(users);
@@ -99,8 +97,7 @@ export const usePlanStore = defineStore("plan", () => {
name,
});
const response = await planServiceClientConnect.getPlan(request);
- // Convert response to old proto format
- return convertNewPlanToOld(response);
+ return response;
};
return {
diff --git a/frontend/src/types/review.ts b/frontend/src/types/review.ts
index ea64f5143c..49549f2d50 100644
--- a/frontend/src/types/review.ts
+++ b/frontend/src/types/review.ts
@@ -1,5 +1,6 @@
-import type { ApprovalStep, Issue_Approver } from "./proto/v1/issue_service";
-import { ApprovalTemplate } from "./proto/v1/issue_service";
+import { create as createProto } from "@bufbuild/protobuf";
+import type { ApprovalStep, Issue_Approver, ApprovalTemplate } from "./proto-es/v1/issue_service_pb";
+import { ApprovalTemplateSchema } from "./proto-es/v1/issue_service_pb";
export type ReviewFlow = {
template: ApprovalTemplate;
@@ -17,7 +18,7 @@ export type WrappedReviewStep = {
export const emptyFlow = (): ReviewFlow => {
return {
- template: ApprovalTemplate.fromPartial({}),
+ template: createProto(ApprovalTemplateSchema, {}),
approvers: [],
currentStepIndex: -1,
};
diff --git a/frontend/src/types/rollout.ts b/frontend/src/types/rollout.ts
index 7d09de240c..95f4ea6a5d 100644
--- a/frontend/src/types/rollout.ts
+++ b/frontend/src/types/rollout.ts
@@ -1,6 +1,8 @@
+import { create as createProto } from "@bufbuild/protobuf";
import { getProjectNameRolloutId } from "@/store/modules/v1/common";
import { EMPTY_ID, UNKNOWN_ID } from "./const";
-import { Rollout } from "./proto/v1/rollout_service";
+import type { Rollout } from "./proto-es/v1/rollout_service_pb";
+import { RolloutSchema } from "./proto-es/v1/rollout_service_pb";
import type { User } from "./proto-es/v1/user_service_pb";
import { emptyUser, unknownUser } from "./v1";
import {
@@ -23,7 +25,7 @@ export const UNKNOWN_ROLLOUT_NAME = `${UNKNOWN_PROJECT_NAME}/rollouts/${UNKNOWN_
export const emptyRollout = (): ComposedRollout => {
const projectEntity = emptyProject();
- const rollout = Rollout.fromPartial({
+ const rollout = createProto(RolloutSchema, {
name: `${projectEntity.name}/rollouts/${EMPTY_ID}`,
});
return {
@@ -36,7 +38,7 @@ export const emptyRollout = (): ComposedRollout => {
export const unknownRollout = (): ComposedRollout => {
const projectEntity = unknownProject();
- const rollout = Rollout.fromPartial({
+ const rollout = createProto(RolloutSchema, {
name: `${projectEntity.name}/rollouts/${UNKNOWN_ID}`,
});
return {
diff --git a/frontend/src/types/v1/issue/issue.ts b/frontend/src/types/v1/issue/issue.ts
index d0b5a9c8de..b0145794d7 100644
--- a/frontend/src/types/v1/issue/issue.ts
+++ b/frontend/src/types/v1/issue/issue.ts
@@ -1,3 +1,4 @@
+import { create as createProto } from "@bufbuild/protobuf";
import type { ComposedTaskRun } from "@/types";
import {
EMPTY_PROJECT_NAME,
@@ -5,9 +6,10 @@ import {
UNKNOWN_PROJECT_NAME,
UNKNOWN_ROLLOUT_NAME,
} from "@/types";
-import type { Rollout } from "@/types//proto/v1/rollout_service";
-import { Issue, IssueStatus, Issue_Type } from "@/types/proto/v1/issue_service";
-import type { Plan, PlanCheckRun } from "@/types/proto/v1/plan_service";
+import type { Rollout } from "@/types/proto-es/v1/rollout_service_pb";
+import type { Issue } from "@/types/proto-es/v1/issue_service_pb";
+import { IssueSchema, IssueStatus, Issue_Type } from "@/types/proto-es/v1/issue_service_pb";
+import type { Plan, PlanCheckRun } from "@/types/proto-es/v1/plan_service_pb";
import { EMPTY_ID, UNKNOWN_ID } from "../../const";
// For grant request issue, it has no plan and rollout.
@@ -25,7 +27,7 @@ export const UNKNOWN_ISSUE_NAME = `projects/${UNKNOWN_ID}/issues/${UNKNOWN_ID}`;
export const emptyIssue = (): ComposedIssue => {
return {
- ...Issue.fromPartial({
+ ...createProto(IssueSchema, {
name: EMPTY_ISSUE_NAME,
rollout: EMPTY_ROLLOUT_NAME,
type: Issue_Type.DATABASE_CHANGE,
@@ -40,7 +42,7 @@ export const emptyIssue = (): ComposedIssue => {
export const unknownIssue = (): ComposedIssue => {
return {
- ...Issue.fromPartial({
+ ...createProto(IssueSchema, {
name: UNKNOWN_ISSUE_NAME,
rollout: UNKNOWN_ROLLOUT_NAME,
type: Issue_Type.DATABASE_CHANGE,
diff --git a/frontend/src/types/v1/issue/plan.ts b/frontend/src/types/v1/issue/plan.ts
index 23e35bf01a..798a6c63b2 100644
--- a/frontend/src/types/v1/issue/plan.ts
+++ b/frontend/src/types/v1/issue/plan.ts
@@ -1,29 +1,30 @@
+import { create as createProto } from "@bufbuild/protobuf";
import { EMPTY_ID, UNKNOWN_ID } from "@/types/const";
-import {
+import type {
Plan,
- Plan_Spec,
-} from "@/types/proto/v1/plan_service";
+} from "@/types/proto-es/v1/plan_service_pb";
+import { PlanSchema, Plan_SpecSchema } from "@/types/proto-es/v1/plan_service_pb";
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 = (): Plan => {
- return Plan.fromPartial({
+ return createProto(PlanSchema, {
name: EMPTY_PLAN_NAME,
});
};
export const unknownPlan = (): Plan => {
- return Plan.fromPartial({
+ return createProto(PlanSchema, {
name: UNKNOWN_PLAN_NAME,
});
};
export const emptyPlanSpec = () => {
- return Plan_Spec.fromPartial({
+ return createProto(Plan_SpecSchema, {
id: String(EMPTY_ID),
});
};
export const unknownPlanSpec = () => {
- return Plan_Spec.fromPartial({
+ return createProto(Plan_SpecSchema, {
id: String(UNKNOWN_ID),
});
};
diff --git a/frontend/src/types/v1/issue/rollout.ts b/frontend/src/types/v1/issue/rollout.ts
index 1590693d0d..2d4ae1564b 100644
--- a/frontend/src/types/v1/issue/rollout.ts
+++ b/frontend/src/types/v1/issue/rollout.ts
@@ -1,28 +1,31 @@
import { EMPTY_ID, UNKNOWN_ID } from "@/types/const";
-import {
- Stage,
- Task,
- Task_Type,
+import type {
TaskRun,
TaskRunLog,
-} from "@/types/proto/v1/rollout_service";
+} from "@/types/proto-es/v1/rollout_service_pb";
+import {
+ StageSchema,
+ TaskSchema,
+ Task_Type,
+} from "@/types/proto-es/v1/rollout_service_pb";
import { EMPTY_ROLLOUT_NAME, UNKNOWN_ROLLOUT_NAME } from "@/types/rollout";
import {
EMPTY_ENVIRONMENT_NAME,
UNKNOWN_ENVIRONMENT_NAME,
} from "../environment";
+import { create } from "@bufbuild/protobuf";
export const EMPTY_STAGE_NAME = `${EMPTY_ROLLOUT_NAME}/stages/${EMPTY_ID}`;
export const UNKNOWN_STAGE_NAME = `${UNKNOWN_ROLLOUT_NAME}/stages/${UNKNOWN_ID}`;
export const emptyStage = () => {
- return Stage.fromPartial({
+ return create(StageSchema, {
name: EMPTY_STAGE_NAME,
environment: EMPTY_ENVIRONMENT_NAME,
});
};
export const unknownStage = () => {
- return Stage.fromPartial({
+ return create(StageSchema, {
name: UNKNOWN_STAGE_NAME,
environment: UNKNOWN_ENVIRONMENT_NAME,
});
@@ -31,12 +34,12 @@ export const unknownStage = () => {
export const EMPTY_TASK_NAME = `${EMPTY_STAGE_NAME}/tasks/${EMPTY_ID}`;
export const UNKNOWN_TASK_NAME = `${UNKNOWN_STAGE_NAME}/tasks/${UNKNOWN_ID}`;
export const emptyTask = () => {
- return Task.fromPartial({
+ return create(TaskSchema, {
name: EMPTY_TASK_NAME,
});
};
export const unknownTask = () => {
- return Task.fromPartial({
+ return create(TaskSchema, {
name: UNKNOWN_TASK_NAME,
});
};
diff --git a/frontend/src/types/workspaceApprovalSetting.ts b/frontend/src/types/workspaceApprovalSetting.ts
index c7de33e499..ccf853207b 100644
--- a/frontend/src/types/workspaceApprovalSetting.ts
+++ b/frontend/src/types/workspaceApprovalSetting.ts
@@ -1,5 +1,5 @@
import type { SimpleExpr } from "@/plugins/cel";
-import type { ApprovalTemplate } from "@/types/proto/v1/issue_service";
+import type { ApprovalTemplate } from "@/types/proto-es/v1/issue_service_pb";
import type { Risk_Source } from "@/types/proto-es/v1/risk_service_pb";
export type LocalApprovalRule = {
diff --git a/frontend/src/utils/v1/advanced-search/issue/ui-filter.ts b/frontend/src/utils/v1/advanced-search/issue/ui-filter.ts
index 5034b91437..706e60f2f0 100644
--- a/frontend/src/utils/v1/advanced-search/issue/ui-filter.ts
+++ b/frontend/src/utils/v1/advanced-search/issue/ui-filter.ts
@@ -4,7 +4,7 @@ import {
useWrappedReviewStepsV1,
} from "@/components/IssueV1/logic";
import type { ComposedIssue } from "@/types";
-import { Issue_Approver_Status } from "@/types/proto/v1/issue_service";
+import { Issue_Approver_Status } from "@/types/proto-es/v1/issue_service_pb";
import { isUserIncludedInList } from "@/utils";
import type { SearchParams } from "../common";
import { getValueFromSearchParams } from "../common";
diff --git a/frontend/src/utils/v1/advanced-search/issue/utils.ts b/frontend/src/utils/v1/advanced-search/issue/utils.ts
index 9530cb4dcd..9a4804d539 100644
--- a/frontend/src/utils/v1/advanced-search/issue/utils.ts
+++ b/frontend/src/utils/v1/advanced-search/issue/utils.ts
@@ -1,7 +1,7 @@
import { useDatabaseV1Store } from "@/store";
import type { IssueFilter } from "@/types";
import { unknownDatabase } from "@/types";
-import { IssueStatus } from "@/types/proto/v1/issue_service";
+import { IssueStatus } from "@/types/proto-es/v1/issue_service_pb";
import type { SearchParams, SemanticIssueStatus } from "../common";
import {
type SearchScopeId,
diff --git a/frontend/src/utils/v1/issue/issue.ts b/frontend/src/utils/v1/issue/issue.ts
index 368f3f599d..386ef3e0ec 100644
--- a/frontend/src/utils/v1/issue/issue.ts
+++ b/frontend/src/utils/v1/issue/issue.ts
@@ -2,9 +2,9 @@ import dayjs from "dayjs";
import slug from "slug";
import { t } from "@/plugins/i18n";
import { EMPTY_ID, UNKNOWN_ID, type ComposedIssue } from "@/types";
-import { Issue_Type } from "@/types/proto/v1/issue_service";
-import type { Rollout } from "@/types/proto/v1/rollout_service";
-import { Task_Type } from "@/types/proto/v1/rollout_service";
+import { Issue_Type } from "@/types/proto-es/v1/issue_service_pb";
+import type { Rollout } from "@/types/proto-es/v1/rollout_service_pb";
+import { Task_Type } from "@/types/proto-es/v1/rollout_service_pb";
export const issueV1Slug = (name: string, title: string = "issue") => {
return [slug(title), extractIssueUID(name)].join("-");
diff --git a/frontend/src/utils/v1/issue/plan.ts b/frontend/src/utils/v1/issue/plan.ts
index 261b65f6ef..cbea4b60ec 100644
--- a/frontend/src/utils/v1/issue/plan.ts
+++ b/frontend/src/utils/v1/issue/plan.ts
@@ -1,9 +1,15 @@
import slug from "slug";
import { EMPTY_ID, UNKNOWN_ID } from "@/types";
-import type { Plan, Plan_Spec } from "@/types/proto/v1/plan_service";
+import type { Plan, Plan_Spec } from "@/types/proto-es/v1/plan_service_pb";
export const sheetNameOfSpec = (spec: Plan_Spec): string => {
- return spec.changeDatabaseConfig?.sheet ?? spec.exportDataConfig?.sheet ?? "";
+ if (spec.config?.case === "changeDatabaseConfig") {
+ return spec.config.value.sheet ?? "";
+ }
+ if (spec.config?.case === "exportDataConfig") {
+ return spec.config.value.sheet ?? "";
+ }
+ return "";
};
export function planV1Slug(plan: Plan): string {
diff --git a/frontend/src/utils/v1/issue/rollout.ts b/frontend/src/utils/v1/issue/rollout.ts
index 33a8bc8b5d..81d439cc7a 100644
--- a/frontend/src/utils/v1/issue/rollout.ts
+++ b/frontend/src/utils/v1/issue/rollout.ts
@@ -24,8 +24,8 @@ import {
type Rollout,
type Stage,
type Task,
-} from "@/types/proto/v1/rollout_service";
-import { Task_Status } from "@/types/proto/v1/rollout_service";
+} from "@/types/proto-es/v1/rollout_service_pb";
+import { Task_Status } from "@/types/proto-es/v1/rollout_service_pb";
import { extractProjectResourceName } from "../project";
import { extractIssueUID, flattenTaskV1List, issueV1Slug } from "./issue";
@@ -158,32 +158,40 @@ export const extractSchemaVersionFromTask = (task: Task): string => {
// The schema version is specified in the filename
// parsed and stored to the payload.schemaVersion
// fallback to empty if we can't read the field.
- return (
- task.databaseDataUpdate?.schemaVersion ??
- task.databaseSchemaUpdate?.schemaVersion ??
- ""
- );
+ if (task.payload?.case === "databaseDataUpdate") {
+ return task.payload.value.schemaVersion ?? "";
+ }
+ if (task.payload?.case === "databaseSchemaUpdate") {
+ return task.payload.value.schemaVersion ?? "";
+ }
+ return "";
};
export const sheetNameOfTaskV1 = (task: Task): string => {
- return (
- task.databaseCreate?.sheet ??
- task.databaseDataUpdate?.sheet ??
- task.databaseSchemaUpdate?.sheet ??
- task.databaseDataExport?.sheet ??
- ""
- );
+ if (task.payload?.case === "databaseCreate") {
+ return task.payload.value.sheet ?? "";
+ }
+ if (task.payload?.case === "databaseDataUpdate") {
+ return task.payload.value.sheet ?? "";
+ }
+ if (task.payload?.case === "databaseSchemaUpdate") {
+ return task.payload.value.sheet ?? "";
+ }
+ if (task.payload?.case === "databaseDataExport") {
+ return task.payload.value.sheet ?? "";
+ }
+ return "";
};
export const setSheetNameForTask = (task: Task, sheetName: string) => {
- if (task.databaseCreate) {
- task.databaseCreate.sheet = sheetName;
- } else if (task.databaseDataUpdate) {
- task.databaseDataUpdate.sheet = sheetName;
- } else if (task.databaseSchemaUpdate) {
- task.databaseSchemaUpdate.sheet = sheetName;
- } else if (task.databaseDataExport) {
- task.databaseDataExport.sheet = sheetName;
+ if (task.payload?.case === "databaseCreate") {
+ task.payload.value.sheet = sheetName;
+ } else if (task.payload?.case === "databaseDataUpdate") {
+ task.payload.value.sheet = sheetName;
+ } else if (task.payload?.case === "databaseSchemaUpdate") {
+ task.payload.value.sheet = sheetName;
+ } else if (task.payload?.case === "databaseDataExport") {
+ task.payload.value.sheet = sheetName;
}
};
@@ -231,7 +239,7 @@ export const stringifyTaskStatus = (status: Task_Status): string => {
case Task_Status.SKIPPED:
return t("task.status.skipped");
default:
- return status;
+ return Task_Status[status] || String(status);
}
};
diff --git a/frontend/src/utils/workspaceApprovalSetting.ts b/frontend/src/utils/workspaceApprovalSetting.ts
index c63efc766b..c3f378ed8f 100644
--- a/frontend/src/utils/workspaceApprovalSetting.ts
+++ b/frontend/src/utils/workspaceApprovalSetting.ts
@@ -21,11 +21,11 @@ import { ExprSchema as CELExprSchema } from "@/types/proto-es/google/api/expr/v1
import type {
ApprovalNode as _ApprovalNode,
ApprovalStep as _ApprovalStep,
-} from "@/types/proto/v1/issue_service";
+} from "@/types/proto-es/v1/issue_service_pb";
import {
ApprovalNode_Type as _ApprovalNode_Type,
ApprovalStep_Type as _ApprovalStep_Type,
-} from "@/types/proto/v1/issue_service";
+} from "@/types/proto-es/v1/issue_service_pb";
import {
ApprovalNode_Type as ProtoEsApprovalNode_Type,
ApprovalStep_Type as ProtoEsApprovalStep_Type,
@@ -58,11 +58,6 @@ import {
batchConvertParsedExprToCELString,
} from "@/utils";
import { displayRoleTitle } from "./role";
-import {
- convertNewApprovalTemplateToOld,
- convertNewExprToOld as _convertNewExprToOld,
- convertOldApprovalTemplateToNew
-} from "./workspaceApprovalSetting-conversions";
export const approvalNodeRoleText = (role: string) => {
return displayRoleTitle(role);
@@ -103,7 +98,7 @@ export const resolveLocalApprovalConfig = async (
const localRule: LocalApprovalRule = {
uid: uuidv4(),
expr: resolveCELExpr(createProto(CELExprSchema, {})),
- template: cloneDeep(convertNewApprovalTemplateToOld(rule.template!)),
+ template: cloneDeep(rule.template!),
};
ruleMap.set(localRule.uid, localRule);
if (rule.condition?.expression) {
@@ -208,7 +203,7 @@ export const buildWorkspaceApprovalSetting = async (
const { uid, template } = rule;
const approvalRule = createProto(ApprovalRuleSchema, {
- template: convertOldApprovalTemplateToNew(template),
+ template: template,
condition: createProto(ExprSchema, { expression: "" }),
});
approvalRuleMap.set(i, approvalRule);
diff --git a/frontend/src/views/ExportCenter/DataExportIssueDataTable/DataExportIssueDataTable.vue b/frontend/src/views/ExportCenter/DataExportIssueDataTable/DataExportIssueDataTable.vue
index 1c9a44ee0b..817e54abed 100644
--- a/frontend/src/views/ExportCenter/DataExportIssueDataTable/DataExportIssueDataTable.vue
+++ b/frontend/src/views/ExportCenter/DataExportIssueDataTable/DataExportIssueDataTable.vue
@@ -30,7 +30,7 @@ import { projectOfIssue } from "@/components/IssueV1/logic";
import { emitWindowEvent } from "@/plugins";
import { PROJECT_V1_ROUTE_ISSUE_DETAIL } from "@/router/dashboard/projectV1";
import { useSheetV1Store } from "@/store";
-import { getTimeForPbTimestamp, type ComposedIssue } from "@/types";
+import { getTimeForPbTimestampProtoEs, type ComposedIssue } from "@/types";
import { databaseForTask } from "@/utils";
import {
extractProjectResourceName,
@@ -144,7 +144,7 @@ const columnList = computed((): DataTableColumn<ComposedIssue>[] => {
resizable: true,
hide: !showExtendedColumns.value,
render: (issue) =>
- humanizeTs(getTimeForPbTimestamp(issue.updateTime, 0) / 1000),
+ humanizeTs(getTimeForPbTimestampProtoEs(issue.updateTime, 0) / 1000),
},
];
return columns.filter((column) => !column.hide);
@@ -184,7 +184,7 @@ const issueRelatedDatabase = (issue: ComposedIssue) => {
const issueRelatedStatement = (issue: ComposedIssue) => {
const task = head(flattenTaskV1List(issue.rolloutEntity));
- const sheetName = task?.databaseDataExport?.sheet;
+ const sheetName = task?.payload?.case === "databaseDataExport" ? task.payload.value.sheet : undefined;
if (!task || !sheetName) {
return;
}
@@ -202,7 +202,7 @@ watch(
// Prepare the sheet for each issue.
for (const issue of list) {
const task = head(flattenTaskV1List(issue.rolloutEntity));
- const sheetName = task?.databaseDataExport?.sheet;
+ const sheetName = task?.payload?.case === "databaseDataExport" ? task.payload.value.sheet : undefined;
if (!task || !sheetName) {
continue;
}
diff --git a/frontend/src/views/ExportCenter/index.vue b/frontend/src/views/ExportCenter/index.vue
index 9292122c4a..9c49386daa 100644
--- a/frontend/src/views/ExportCenter/index.vue
+++ b/frontend/src/views/ExportCenter/index.vue
@@ -76,7 +76,7 @@ import {
} from "@/store";
import { projectNamePrefix } from "@/store/modules/v1/common";
import type { ComposedIssue } from "@/types";
-import { Issue_Type } from "@/types/proto/v1/issue_service";
+import { Issue_Type } from "@/types/proto-es/v1/issue_service_pb";
import {
buildIssueFilterBySearchParams,
extractProjectResourceName,
diff --git a/frontend/src/views/ReviewCenter/index.vue b/frontend/src/views/ReviewCenter/index.vue
index 5559fe44bf..c3d72577fd 100644
--- a/frontend/src/views/ReviewCenter/index.vue
+++ b/frontend/src/views/ReviewCenter/index.vue
@@ -64,7 +64,7 @@ import {
Plan_ChangeDatabaseConfig_Type,
type Plan,
type Plan_Spec,
-} from "@/types/proto/v1/plan_service";
+} from "@/types/proto-es/v1/plan_service_pb";
import {
extractDatabaseGroupName,
extractDatabaseResourceName,
@@ -174,7 +174,7 @@ const allowToCreatePlan = computed(() => {
const handleSpecCreated = async (spec: Plan_Spec) => {
const template =
- spec.changeDatabaseConfig?.type === Plan_ChangeDatabaseConfig_Type.DATA
+ spec.config?.case === "changeDatabaseConfig" && spec.config.value.type === Plan_ChangeDatabaseConfig_Type.DATA
? "bb.issue.database.data.update"
: "bb.issue.database.schema.update";
const targets = targetsForSpec(spec);
diff --git a/frontend/src/views/project/CICDLayout.vue b/frontend/src/views/project/CICDLayout.vue
index 1a5b2f6137..3c029b1da5 100644
--- a/frontend/src/views/project/CICDLayout.vue
+++ b/frontend/src/views/project/CICDLayout.vue
@@ -160,7 +160,7 @@ const availableTabs = computed<TabKey[]>(() => {
if (!isCreating.value) {
if (
plan.value.specs.some(
- (spec) => !isNullOrUndefined(spec.changeDatabaseConfig)
+ (spec) => !isNullOrUndefined(spec.config) && spec.config.case === "changeDatabaseConfig"
)
) {
tabs.push(TabKey.Checks);