Skip to content

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

chore: update checks in creating issue panel (#16809)

boojackb53809ead1d9
diff --git a/frontend/src/components/AlterSchemaPrepForm/SchemaEditorModal.vue b/frontend/src/components/AlterSchemaPrepForm/SchemaEditorModal.vue
index 191fb5844f..042f42c080 100644
--- a/frontend/src/components/AlterSchemaPrepForm/SchemaEditorModal.vue
+++ b/frontend/src/components/AlterSchemaPrepForm/SchemaEditorModal.vue
@@ -93,12 +93,6 @@
<div class="w-full flex flex-row justify-between items-center">
<div class="flex flex-row items-center text-sm text-gray-500"></div>
<div class="flex justify-end items-center space-x-3">
- <NCheckbox
- v-if="databaseChangeMode === DatabaseChangeMode.PIPELINE"
- v-model:checked="state.planOnly"
- >
- {{ $t("issue.sql-review-only") }}
- </NCheckbox>
<NButton @click="dismissModal">
{{ $t("common.cancel") }}
</NButton>
@@ -124,7 +118,7 @@
<script lang="tsx" setup>
import { cloneDeep, head, uniq } from "lodash-es";
-import { NTabs, NCheckbox, NButton, NTabPane, useDialog } from "naive-ui";
+import { NTabs, NButton, NTabPane, useDialog } from "naive-ui";
import { v4 as uuidv4 } from "uuid";
import type { PropType } from "vue";
import { computed, onMounted, h, reactive, ref, watch, watchEffect } from "vue";
@@ -133,16 +127,12 @@ import { useRouter, type LocationQuery } from "vue-router";
import { BBModal } from "@/bbkit";
import { ActionConfirmModal } from "@/components/SchemaEditorLite";
import SQLUploadButton from "@/components/misc/SQLUploadButton.vue";
-import {
- PROJECT_V1_ROUTE_ISSUE_DETAIL,
- PROJECT_V1_ROUTE_PLAN_DETAIL_SPEC_DETAIL,
-} from "@/router/dashboard/projectV1";
+import { PROJECT_V1_ROUTE_ISSUE_DETAIL } from "@/router/dashboard/projectV1";
import {
pushNotification,
useDatabaseV1Store,
useNotificationStore,
useDBSchemaV1Store,
- useAppFeature,
useStorageStore,
useDatabaseCatalogV1Store,
batchGetOrFetchDatabases,
@@ -152,7 +142,6 @@ import { dialectOfEngineV1, isValidProjectName, unknownProject } from "@/types";
import { Engine } from "@/types/proto-es/v1/common_pb";
import type { DatabaseCatalog } from "@/types/proto-es/v1/database_catalog_service_pb";
import type { DatabaseMetadata } from "@/types/proto-es/v1/database_service_pb";
-import { DatabaseChangeMode } from "@/types/proto-es/v1/setting_service_pb";
import {
TinyTimer,
defer,
@@ -179,8 +168,6 @@ interface LocalState {
previewStatus: string;
targets: EditTarget[];
isUploadingFile: boolean;
- // planOnly is used to indicate whether only to create plan.
- planOnly: boolean;
}
const props = defineProps({
@@ -196,10 +183,6 @@ const props = defineProps({
type: Boolean,
default: false,
},
- planOnly: {
- type: Boolean,
- default: false,
- },
});
const emit = defineEmits<{
@@ -218,7 +201,6 @@ const state = reactive<LocalState>({
previewStatus: "",
targets: [],
isUploadingFile: false,
- planOnly: props.planOnly,
});
const databaseV1Store = useDatabaseV1Store();
const dbCatalogStore = useDatabaseCatalogV1Store();
@@ -226,7 +208,6 @@ const notificationStore = useNotificationStore();
const dbSchemaStore = useDBSchemaV1Store();
const { runSQLCheck } = provideSQLCheckContext();
const $dialog = useDialog();
-const databaseChangeMode = useAppFeature("bb.feature.database-change-mode");
const allowPreviewIssue = computed(() => {
if (state.selectedTab === "schema-editor") {
@@ -500,9 +481,7 @@ const handlePreviewIssue = async () => {
}
const routeInfo = {
- name: state.planOnly
- ? PROJECT_V1_ROUTE_PLAN_DETAIL_SPEC_DETAIL
- : PROJECT_V1_ROUTE_ISSUE_DETAIL,
+ name: PROJECT_V1_ROUTE_ISSUE_DETAIL,
params: {
projectId: extractProjectResourceName(project.value.name),
issueSlug: "create",
diff --git a/frontend/src/components/IssueV1/components/Panel/CommonDrawer.vue b/frontend/src/components/IssueV1/components/Panel/CommonDrawer.vue
index 808e13ea74..8eb50b21c1 100644
--- a/frontend/src/components/IssueV1/components/Panel/CommonDrawer.vue
+++ b/frontend/src/components/IssueV1/components/Panel/CommonDrawer.vue
@@ -2,7 +2,7 @@
<Drawer :show="show" :mask-closable="true" @close="$emit('close')">
<DrawerContent
:title="title"
- class="relative overflow-hidden w-[30rem] max-w-[100vw]"
+ class="relative overflow-hidden w-128 max-w-[100vw]"
>
<template #default>
<slot />
diff --git a/frontend/src/components/Plan/components/ChecksView/ChecksView.vue b/frontend/src/components/Plan/components/ChecksView/ChecksView.vue
index c9f076fdff..da9803237e 100644
--- a/frontend/src/components/Plan/components/ChecksView/ChecksView.vue
+++ b/frontend/src/components/Plan/components/ChecksView/ChecksView.vue
@@ -68,8 +68,16 @@
<!-- Results List -->
<div class="flex-1 overflow-y-auto">
+ <!-- Loading state -->
<div
- v-if="filteredResults.length === 0"
+ v-if="!hasCompletedInitialFetch"
+ class="flex items-center justify-center py-12"
+ >
+ <BBSpin />
+ </div>
+ <!-- Empty state -->
+ <div
+ v-else-if="filteredCheckRuns.length === 0"
class="flex flex-col items-center justify-center py-12"
>
<CheckCircleIcon class="w-12 h-12 text-control-light opacity-50 mb-4" />
@@ -79,7 +87,6 @@
}}
</div>
</div>
-
<div v-else class="divide-y">
<!-- Group by check run -->
<div
@@ -161,6 +168,7 @@ import {
} from "lucide-vue-next";
import { computed, ref } from "vue";
import { useI18n } from "vue-i18n";
+import { BBSpin } from "@/bbkit";
import { getRuleLocalization } from "@/types";
import {
PlanCheckRun_Result_Status,
@@ -170,6 +178,7 @@ import {
} from "@/types/proto-es/v1/plan_service_pb";
import { humanizeTs } from "@/utils";
import { usePlanContext } from "../../logic/context";
+import { useResourcePoller } from "../../logic/poller";
import DatabaseDisplay from "../common/DatabaseDisplay.vue";
const props = defineProps<{
@@ -178,6 +187,7 @@ const props = defineProps<{
const { t } = useI18n();
const { planCheckRuns } = usePlanContext();
+const { hasCompletedInitialFetch } = useResourcePoller();
const selectedStatus = ref<PlanCheckRun_Result_Status | undefined>(
props.defaultStatus
@@ -198,28 +208,10 @@ const filteredCheckRuns = computed(() => {
return false;
}
}
-
return true;
});
});
-const filteredResults = computed(() => {
- const results = [];
-
- for (const checkRun of filteredCheckRuns.value) {
- for (const result of checkRun.results) {
- if (
- selectedStatus.value === undefined ||
- result.status === selectedStatus.value
- ) {
- results.push({ checkRun, result });
- }
- }
- }
-
- return results;
-});
-
const statusCounts = computed(() => {
const counts = {
success: 0,
diff --git a/frontend/src/components/Plan/components/HeaderSection/Actions/Actions.vue b/frontend/src/components/Plan/components/HeaderSection/Actions/Actions.vue
index 88fa00bd69..65c20b96b0 100644
--- a/frontend/src/components/Plan/components/HeaderSection/Actions/Actions.vue
+++ b/frontend/src/components/Plan/components/HeaderSection/Actions/Actions.vue
@@ -10,7 +10,7 @@
<!-- Panels -->
<IssueCreationActionPanel
- :action="pendingIssueCreationAction"
+ :show="pendingIssueCreationAction !== undefined"
@close="pendingIssueCreationAction = undefined"
/>
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 fe0e3e5ec2..d0dda351bc 100644
--- a/frontend/src/components/Plan/components/HeaderSection/Actions/panels/IssueCreationActionPanel.vue
+++ b/frontend/src/components/Plan/components/HeaderSection/Actions/panels/IssueCreationActionPanel.vue
@@ -1,37 +1,94 @@
<template>
<CommonDrawer
- :show="action !== undefined"
+ :show="props.show"
:title="title"
- :loading="state.loading"
+ :loading="loading"
@close="$emit('close')"
>
<template #default>
- <div v-if="action" class="flex flex-col gap-y-4 px-1">
+ <div class="flex flex-col gap-y-4 px-1">
+ <!-- Plan Check Status -->
+ <div v-if="planCheckStatus.total > 0" class="flex items-center gap-3">
+ <span class="text-control shrink-0">{{
+ $t("plan.navigator.checks")
+ }}</span>
+ <div class="flex items-center gap-3">
+ <div
+ v-if="planCheckStatus.error > 0"
+ class="flex items-center gap-1"
+ >
+ <XCircleIcon class="w-5 h-5 text-error" />
+ <span class="text-base font-semibold text-error">{{
+ planCheckStatus.error
+ }}</span>
+ </div>
+ <div
+ v-if="planCheckStatus.warning > 0"
+ class="flex items-center gap-1"
+ >
+ <AlertCircleIcon class="w-5 h-5 text-warning" />
+ <span class="text-base font-semibold text-warning">{{
+ planCheckStatus.warning
+ }}</span>
+ </div>
+ <div
+ v-if="planCheckStatus.success > 0"
+ class="flex items-center gap-1"
+ >
+ <CheckCircleIcon class="w-5 h-5 text-success" />
+ <span class="text-base font-semibold text-success">{{
+ planCheckStatus.success
+ }}</span>
+ </div>
+ </div>
+ </div>
+
<div class="flex flex-col gap-y-1">
- <div class="text-control">{{ $t("plan.self") }}</div>
- <div class="font-medium">
- {{ plan.title }}
+ <div class="text-control">
+ {{ $t("common.title") }}
+ <span class="text-red-600">*</span>
</div>
+ <NInput
+ v-model:value="state.title"
+ :placeholder="$t('common.title')"
+ />
</div>
<div class="flex flex-col gap-y-1">
<div class="text-control">
{{ $t("common.description") }}
</div>
- <div class="textlabel">
- {{ plan.description || "No description" }}
+ <NInput
+ v-model:value="state.description"
+ type="textarea"
+ :placeholder="$t('issue.add-some-description')"
+ :autosize="{
+ minRows: 3,
+ maxRows: 10,
+ }"
+ />
+ </div>
+
+ <div class="flex flex-col gap-y-1">
+ <div class="text-control">
+ {{ $t("common.labels") }}
+ <span v-if="project.forceIssueLabels" class="text-red-600">*</span>
</div>
+ <IssueLabelSelector
+ :disabled="false"
+ :selected="state.labels"
+ :project="project"
+ :size="'medium'"
+ @update:selected="state.labels = $event"
+ />
</div>
</div>
</template>
<template #footer>
- <div
- v-if="action"
- class="w-full flex flex-row justify-end items-center gap-2"
- >
+ <div class="w-full flex flex-row justify-end items-center gap-2">
<div class="flex justify-end gap-x-3">
<NButton @click="$emit('close')" quaternary>
- {{ $t("common.cancel") }}
+ {{ $t("common.close") }}
</NButton>
<NTooltip :disabled="confirmErrors.length === 0" placement="top">
@@ -56,18 +113,15 @@
<script setup lang="ts">
import { create } from "@bufbuild/protobuf";
-import { uniqBy } from "lodash-es";
-import { NButton, NTooltip } from "naive-ui";
+import { CheckCircleIcon, XCircleIcon, AlertCircleIcon } from "lucide-vue-next";
+import { NButton, NInput, NTooltip } from "naive-ui";
import { computed, nextTick, reactive, ref, watchEffect } from "vue";
import { useI18n } from "vue-i18n";
import { useRouter } from "vue-router";
+import IssueLabelSelector from "@/components/IssueV1/components/IssueLabelSelector.vue";
import CommonDrawer from "@/components/IssueV1/components/Panel/CommonDrawer.vue";
import { ErrorList } from "@/components/Plan/components/common";
-import {
- planCheckRunListForSpec,
- usePlanContext,
-} from "@/components/Plan/logic";
-import { planCheckRunSummaryForCheckRunList } from "@/components/PlanCheckRun/common";
+import { usePlanContext } from "@/components/Plan/logic";
import {
issueServiceClientConnect,
rolloutServiceClientConnect,
@@ -83,9 +137,9 @@ import {
} from "@/store";
import { CreateIssueRequestSchema } from "@/types/proto-es/v1/issue_service_pb";
import {
- IssueSchema,
IssueStatus,
Issue_Type,
+ type Issue,
} from "@/types/proto-es/v1/issue_service_pb";
import { PolicyType } from "@/types/proto-es/v1/org_policy_service_pb";
import { PlanCheckRun_Result_Status } from "@/types/proto-es/v1/plan_service_pb";
@@ -98,53 +152,71 @@ import {
issueV1Slug,
} from "@/utils";
-type IssueCreationAction = "CREATE";
-
-type LocalState = {
- loading: boolean;
-};
-
const props = defineProps<{
- action?: IssueCreationAction;
+ show: boolean;
}>();
+
const emit = defineEmits<{
(event: "close"): void;
}>();
const { t } = useI18n();
const router = useRouter();
-const state = reactive<LocalState>({
- loading: false,
+const loading = ref(false);
+const state = reactive<Pick<Issue, "title" | "description" | "labels">>({
+ title: "",
+ description: "",
+ labels: [],
});
const { project } = useCurrentProjectV1();
const currentUser = useCurrentUserV1();
const policyV1Store = usePolicyV1Store();
-const { plan, planCheckRuns, events } = usePlanContext();
+const { plan, events } = usePlanContext();
const restrictIssueCreationForSqlReviewPolicy = ref(false);
+// Initialize issue title and description from plan
+watchEffect(() => {
+ state.title = plan.value.title;
+ state.description = plan.value.description;
+});
+
const title = computed(() => {
- switch (props.action) {
- case "CREATE":
- return t("plan.ready-for-review");
- }
- return ""; // Make linter happy
+ return t("plan.ready-for-review");
});
-const planCheckStatus = computed((): PlanCheckRun_Result_Status => {
- const planCheckList = uniqBy(
- plan.value.specs.flatMap((spec) =>
- planCheckRunListForSpec(planCheckRuns.value, spec)
- ),
- (checkRun) => checkRun.name
- );
- const summary = planCheckRunSummaryForCheckRunList(planCheckList);
- if (summary.errorCount > 0) {
+const planCheckStatus = computed(() => {
+ const statusCount = plan.value.planCheckRunStatusCount || {};
+ const success =
+ statusCount[
+ PlanCheckRun_Result_Status[PlanCheckRun_Result_Status.SUCCESS]
+ ] || 0;
+ const warning =
+ statusCount[
+ PlanCheckRun_Result_Status[PlanCheckRun_Result_Status.WARNING]
+ ] || 0;
+ const error =
+ statusCount[PlanCheckRun_Result_Status[PlanCheckRun_Result_Status.ERROR]] ||
+ 0;
+
+ return {
+ total: success + warning + error,
+ success,
+ warning,
+ error,
+ };
+});
+
+const planCheckSummaryStatus = computed((): PlanCheckRun_Result_Status => {
+ if (planCheckStatus.value.error > 0) {
return PlanCheckRun_Result_Status.ERROR;
}
- if (summary.warnCount > 0) {
+ if (planCheckStatus.value.warning > 0) {
return PlanCheckRun_Result_Status.WARNING;
}
- return PlanCheckRun_Result_Status.SUCCESS;
+ if (planCheckStatus.value.success > 0) {
+ return PlanCheckRun_Result_Status.SUCCESS;
+ }
+ return PlanCheckRun_Result_Status.STATUS_UNSPECIFIED;
});
const confirmErrors = computed(() => {
@@ -154,12 +226,12 @@ const confirmErrors = computed(() => {
errors.push(t("common.missing-required-permission"));
}
- if (!plan.value.title.trim()) {
+ if (!state.title.trim()) {
errors.push("Missing issue title");
}
if (
- planCheckStatus.value === PlanCheckRun_Result_Status.ERROR &&
+ planCheckSummaryStatus.value === PlanCheckRun_Result_Status.ERROR &&
restrictIssueCreationForSqlReviewPolicy.value
) {
errors.push(
@@ -169,6 +241,12 @@ const confirmErrors = computed(() => {
);
}
+ if (project.value.forceIssueLabels && state.labels.length === 0) {
+ errors.push(
+ t("project.settings.issue-related.labels.force-issue-labels.warning")
+ );
+ }
+
return errors;
});
@@ -210,20 +288,24 @@ const handleConfirm = async () => {
};
const doCreateIssue = async () => {
- state.loading = true;
+ loading.value = true;
try {
const issueToCreate = {
- ...buildIssue(),
- rollout: "",
+ creator: `users/${currentUser.value.email}`,
+ title: state.title,
+ description: state.description,
+ labels: state.labels,
plan: plan.value.name,
+ status: IssueStatus.OPEN,
+ type: Issue_Type.DATABASE_CHANGE,
+ rollout: "",
};
- const issueRequest = create(CreateIssueRequestSchema, {
+ const request = create(CreateIssueRequestSchema, {
parent: project.value.name,
issue: issueToCreate,
});
- const createdIssue =
- await issueServiceClientConnect.createIssue(issueRequest);
+ const createdIssue = await issueServiceClientConnect.createIssue(request);
// Then create the rollout from the plan
const rolloutRequest = create(CreateRolloutRequestSchema, {
@@ -259,20 +341,8 @@ const doCreateIssue = async () => {
}
});
} finally {
- state.loading = false;
+ loading.value = false;
emit("close");
}
};
-
-const buildIssue = () => {
- 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/IssueReviewView/Sidebar/Sidebar.vue b/frontend/src/components/Plan/components/IssueReviewView/Sidebar/Sidebar.vue
index b8f0abf836..012826ec8e 100644
--- a/frontend/src/components/Plan/components/IssueReviewView/Sidebar/Sidebar.vue
+++ b/frontend/src/components/Plan/components/IssueReviewView/Sidebar/Sidebar.vue
@@ -14,7 +14,6 @@
@update:value="onIssueLabelsUpdate"
/>
- <!-- Description Section -->
<div class="w-full flex flex-col">
<h3 class="textlabel mb-1">
{{ $t("common.description") }}
@@ -34,11 +33,11 @@
<script setup lang="ts">
import { create } from "@bufbuild/protobuf";
-import { isEqual } from "lodash-es";
import { NInput } from "naive-ui";
import { computed } from "vue";
import { useI18n } from "vue-i18n";
import IssueLabels from "@/components/IssueV1/components/Sidebar/IssueLabels.vue";
+import { useResourcePoller } from "@/components/Plan/logic/poller";
import { issueServiceClientConnect } from "@/grpcweb";
import {
extractUserId,
@@ -59,6 +58,7 @@ const { t } = useI18n();
const { issue } = usePlanContextWithIssue();
const currentUser = useCurrentUserV1();
const { project } = useCurrentProjectV1();
+const { requestEnhancedPolling } = useResourcePoller();
const allowChange = computed(() => {
if (issue.value.status !== IssueStatus.OPEN) {
@@ -74,10 +74,6 @@ const allowChange = computed(() => {
});
const onIssueLabelsUpdate = async (labels: string[]) => {
- if (isEqual(labels, issue.value.labels)) {
- return; // No change, do nothing.
- }
-
const issuePatch = {
...issue.value,
labels,
@@ -87,7 +83,7 @@ const onIssueLabelsUpdate = async (labels: string[]) => {
updateMask: { paths: ["labels"] },
});
await issueServiceClientConnect.updateIssue(request);
- // TODO(claude): trigger re-fetch of issue if needed.
+ requestEnhancedPolling(["issue"], true /** once */);
pushNotification({
module: "bytebase",
style: "SUCCESS",
@@ -96,10 +92,6 @@ const onIssueLabelsUpdate = async (labels: string[]) => {
};
const onIssueDescriptionUpdate = async (description: string) => {
- if (issue.value.description === description) {
- return; // No change, do nothing.
- }
-
const issuePatch = {
...issue.value,
description,
@@ -109,7 +101,8 @@ const onIssueDescriptionUpdate = async (description: string) => {
updateMask: { paths: ["description"] },
});
await issueServiceClientConnect.updateIssue(request);
- // TODO(claude): trigger re-fetch of issue if needed.
+ // After running checks, we need to refresh the plan and plan check runs.
+ requestEnhancedPolling(["issue"], true /** once */);
pushNotification({
module: "bytebase",
style: "SUCCESS",
diff --git a/frontend/src/components/Plan/components/Overview.vue b/frontend/src/components/Plan/components/Overview.vue
index 8b54d7861e..4e5142d182 100644
--- a/frontend/src/components/Plan/components/Overview.vue
+++ b/frontend/src/components/Plan/components/Overview.vue
@@ -19,7 +19,7 @@
<p class="text-sm text-control-light">
{{ $t("plan.overview.total-specs") }}
</p>
- <p class="text-xl font-semibold mt-1">
+ <p class="text-xl font-medium mt-1">
{{ statistics.totalSpecs }}
</p>
</div>
@@ -33,7 +33,7 @@
<p class="text-sm text-control-light">
{{ $t("plan.overview.total-targets") }}
</p>
- <p class="text-xl font-semibold mt-1">
+ <p class="text-xl font-medium mt-1">
{{ statistics.totalTargets }}
</p>
</div>
@@ -53,7 +53,7 @@
class="flex items-center gap-1"
>
<XCircleIcon class="w-5 h-5 text-error" />
- <span class="text-xl font-semibold text-error">{{
+ <span class="text-xl font-medium text-error">{{
statistics.checkStatus.error
}}</span>
</div>
@@ -62,7 +62,7 @@
class="flex items-center gap-1"
>
<AlertCircleIcon class="w-5 h-5 text-warning" />
- <span class="text-xl font-semibold text-warning">{{
+ <span class="text-xl font-medium text-warning">{{
statistics.checkStatus.warning
}}</span>
</div>
@@ -71,7 +71,7 @@
class="flex items-center gap-1"
>
<CheckCircleIcon class="w-5 h-5 text-success" />
- <span class="text-xl font-semibold text-success">{{
+ <span class="text-xl font-medium text-success">{{
statistics.checkStatus.success
}}</span>
</div>
@@ -119,7 +119,7 @@
>
({{ resource.instance.environmentEntity.title }})
</span>
- <span class="font-medium truncate">
+ <span class="truncate">
{{
resource.instance
? instanceV1Name(resource.instance)
diff --git a/frontend/src/components/Plan/components/PlanDataTable/PlanDataTable.vue b/frontend/src/components/Plan/components/PlanDataTable/PlanDataTable.vue
index 6b9c1ffedf..c92876c505 100644
--- a/frontend/src/components/Plan/components/PlanDataTable/PlanDataTable.vue
+++ b/frontend/src/components/Plan/components/PlanDataTable/PlanDataTable.vue
@@ -60,16 +60,20 @@ const columnList = computed((): DataTableColumn<Plan>[] => {
<div class="whitespace-nowrap text-control opacity-60">
{extractPlanUID(plan.name)}
</div>
- <NPerformantEllipsis class="flex-1 truncate">
- {{
- default: () => <span>{plan.title}</span>,
- tooltip: () => (
- <div class="whitespace-pre-wrap break-words break-all">
- {plan.title}
- </div>
- ),
- }}
- </NPerformantEllipsis>
+ {plan.title ? (
+ <NPerformantEllipsis class="flex-1 truncate">
+ {{
+ default: () => <span>{plan.title}</span>,
+ tooltip: () => (
+ <div class="whitespace-pre-wrap break-words break-all">
+ {plan.title}
+ </div>
+ ),
+ }}
+ </NPerformantEllipsis>
+ ) : (
+ <span class="opacity-60 italic">{t("common.untitled")}</span>
+ )}
</div>
);
},
diff --git a/frontend/src/components/Plan/components/RolloutView/RolloutView.vue b/frontend/src/components/Plan/components/RolloutView/RolloutView.vue
index 6075902945..8b2096a0c8 100644
--- a/frontend/src/components/Plan/components/RolloutView/RolloutView.vue
+++ b/frontend/src/components/Plan/components/RolloutView/RolloutView.vue
@@ -29,28 +29,103 @@
<!-- Content area -->
<div class="flex-1 overflow-hidden">
- <StagesView
- v-if="!isTableView"
- :merged-stages="mergedStages"
- :task-status-filter="taskStatusFilter"
- />
+ <div v-if="!isTableView" class="w-full p-4">
+ <div class="w-full overflow-scroll border rounded-lg p-6 bg-zinc-50">
+ <StagesView
+ :rollout="rollout"
+ :merged-stages="mergedStages"
+ :task-status-filter="taskStatusFilter"
+ @run-tasks="handleRunTasks"
+ @create-rollout-to-stage="handleCreateRolloutToStage"
+ />
+ </div>
+ </div>
<TaskTableView v-else :task-status-filter="taskStatusFilter" />
</div>
+
+ <!-- Task Rollout Action Panel -->
+ <TaskRolloutActionPanel
+ v-if="runTasksPanel.show && runTasksPanel.target"
+ :show="runTasksPanel.show"
+ action="RUN"
+ :target="runTasksPanel.target"
+ @close="handlePanelClose"
+ />
</div>
</template>
<script setup lang="ts">
+import { create } from "@bufbuild/protobuf";
import { ListIcon, Columns3Icon } from "lucide-vue-next";
import { NButton, NButtonGroup } from "naive-ui";
import { ref } from "vue";
+import { useI18n } from "vue-i18n";
+import { rolloutServiceClientConnect } from "@/grpcweb";
+import { pushNotification, useCurrentProjectV1 } from "@/store";
+import { CreateRolloutRequestSchema } from "@/types/proto-es/v1/rollout_service_pb";
+import type { Stage, Task } from "@/types/proto-es/v1/rollout_service_pb";
import { Task_Status } from "@/types/proto-es/v1/rollout_service_pb";
+import { usePlanContextWithRollout } from "../../logic";
import StagesView from "./StagesView.vue";
import TaskFilter from "./TaskFilter.vue";
+import TaskRolloutActionPanel from "./TaskRolloutActionPanel.vue";
import TaskTableView from "./TaskTableView.vue";
import { useRolloutViewContext } from "./context";
+const { t } = useI18n();
+const { project } = useCurrentProjectV1();
+const { events } = usePlanContextWithRollout();
const { rollout, mergedStages } = useRolloutViewContext();
const isTableView = ref(false);
const taskStatusFilter = ref<Task_Status[]>([]);
+const runTasksPanel = ref<{
+ show: boolean;
+ target?: { type: "tasks"; stage: Stage; tasks: Task[] };
+}>({
+ show: false,
+});
+
+const handleRunTasks = (stage: Stage, tasks: Task[]) => {
+ runTasksPanel.value = {
+ show: true,
+ target: { type: "tasks", stage, tasks },
+ };
+};
+
+const handleCreateRolloutToStage = async (stage: Stage) => {
+ try {
+ const request = create(CreateRolloutRequestSchema, {
+ parent: project.value.name,
+ rollout: {
+ plan: rollout.value.plan,
+ },
+ target: stage.environment,
+ });
+ await rolloutServiceClientConnect.createRollout(request);
+
+ pushNotification({
+ module: "bytebase",
+ style: "SUCCESS",
+ title: t("common.success"),
+ description: t("common.created"),
+ });
+
+ // Trigger immediate refresh of rollout data
+ events.emit("status-changed", { eager: true });
+ } catch (error) {
+ pushNotification({
+ module: "bytebase",
+ style: "CRITICAL",
+ title: t("common.error"),
+ description: String(error),
+ });
+ }
+};
+
+const handlePanelClose = () => {
+ runTasksPanel.value = {
+ show: false,
+ };
+};
</script>
diff --git a/frontend/src/components/Plan/components/RolloutView/StageCard.vue b/frontend/src/components/Plan/components/RolloutView/StageCard.vue
index c55c751d08..007f9ef140 100644
--- a/frontend/src/components/Plan/components/RolloutView/StageCard.vue
+++ b/frontend/src/components/Plan/components/RolloutView/StageCard.vue
@@ -1,6 +1,6 @@
<template>
<div
- class="!w-80 bg-white z-[1] rounded-lg p-1"
+ class="!w-72 shrink-0 bg-white z-[1] rounded-lg p-1"
:class="
twMerge(
isCreated ? 'bg-white shadow' : 'bg-zinc-50 border-2 border-dashed'
@@ -13,8 +13,8 @@
<div class="flex items-center space-x-1">
<span
class="text-base font-medium"
- :class="[isCreated && 'cursor-pointer hover:underline']"
- @click="handleClickStageTitle"
+ :class="[isCreated && !readonly && 'cursor-pointer hover:underline']"
+ @click="!readonly && handleClickStageTitle()"
>
{{ environmentStore.getEnvironmentByName(stage.environment).title }}
</span>
@@ -22,7 +22,7 @@
$t("common.preview")
}}</NTag>
</div>
- <div class="flex justify-end items-center">
+ <div v-if="!readonly" class="flex justify-end items-center">
<RunTasksButton
v-if="isCreated"
:stage="stage"
@@ -62,8 +62,9 @@
<template #default="{ item: task }: { item: Task }">
<div
:key="task.name"
- class="w-full border-t border-zinc-50 flex items-center justify-start truncate px-2 py-2 h-10 cursor-pointer hover:bg-zinc-50 transition-colors"
- @click="handleTaskClick(task)"
+ class="w-full border-t border-zinc-50 flex items-center justify-start truncate px-2 py-2 h-10 transition-colors"
+ :class="[!readonly && 'cursor-pointer hover:bg-zinc-50']"
+ @click="!readonly && handleTaskClick(task)"
>
<TaskStatus :status="task.status" size="small" class="shrink-0" />
<TaskDatabaseName :task="task" class="ml-2 flex-1" />
@@ -85,76 +86,63 @@
<div v-else class="text-center text-zinc-500 py-2 text-sm leading-6">
{{ $t("task.no-tasks") }}
</div>
-
- <!-- Task Rollout Action Panel -->
- <TaskRolloutActionPanel
- :show="showRunTasksPanel"
- action="RUN"
- :target="{ type: 'tasks', stage, tasks: runableTasks }"
- @close="handlePanelClose"
- />
</div>
</template>
<script setup lang="ts">
-import { create } from "@bufbuild/protobuf";
import { CircleFadingPlusIcon } from "lucide-vue-next";
import { NTag, NTooltip, NVirtualList, NButton, NPopconfirm } from "naive-ui";
import { twMerge } from "tailwind-merge";
-import { computed, ref } from "vue";
-import { useI18n } from "vue-i18n";
+import { computed } from "vue";
import { useRouter } from "vue-router";
import { semanticTaskType } from "@/components/IssueV1";
import TaskStatus from "@/components/Rollout/kits/TaskStatus.vue";
-import { rolloutServiceClientConnect } from "@/grpcweb";
import {
PROJECT_V1_ROUTE_ROLLOUT_DETAIL_TASK_DETAIL,
PROJECT_V1_ROUTE_ROLLOUT_DETAIL_STAGE_DETAIL,
} from "@/router/dashboard/projectV1";
-import {
- useCurrentProjectV1,
- useEnvironmentV1Store,
- pushNotification,
-} from "@/store";
-import { CreateRolloutRequestSchema } from "@/types/proto-es/v1/rollout_service_pb";
-import type { Stage, Task } from "@/types/proto-es/v1/rollout_service_pb";
+import { useCurrentProjectV1, useEnvironmentV1Store } from "@/store";
+import type {
+ Stage,
+ Task,
+ Rollout,
+} from "@/types/proto-es/v1/rollout_service_pb";
import { Task_Status } from "@/types/proto-es/v1/rollout_service_pb";
import { extractProjectResourceName } from "@/utils";
import { extractSchemaVersionFromTask } from "@/utils";
-import { usePlanContextWithRollout } from "../../logic";
import RunTasksButton from "./RunTasksButton.vue";
import TaskDatabaseName from "./TaskDatabaseName.vue";
-import TaskRolloutActionPanel from "./TaskRolloutActionPanel.vue";
-import { useRolloutViewContext } from "./context";
import { useTaskActionPermissions } from "./taskPermissions";
const props = defineProps<{
+ rollout: Rollout;
stage: Stage;
- taskStatusFilter: Task_Status[];
+ taskStatusFilter?: Task_Status[];
+ readonly?: boolean;
}>();
-const { t: $t } = useI18n();
const router = useRouter();
const { project } = useCurrentProjectV1();
const environmentStore = useEnvironmentV1Store();
-const { events } = usePlanContextWithRollout();
-const { rollout } = useRolloutViewContext();
-const { canPerformTaskAction } = useTaskActionPermissions();
+const emit = defineEmits<{
+ (event: "run-tasks", stage: Stage, tasks: Task[]): void;
+ (event: "create-rollout-to-stage", stage: Stage): void;
+}>();
-const showRunTasksPanel = ref(false);
+const { canPerformTaskAction } = useTaskActionPermissions();
const isCreated = computed(() => {
- return rollout.value.stages.some(
+ return props.rollout.stages.some(
(stage) => stage.environment === props.stage.environment
);
});
const filteredTasks = computed(() => {
- if (props.taskStatusFilter.length === 0) {
+ if (!props.taskStatusFilter || props.taskStatusFilter.length === 0) {
return props.stage.tasks;
}
return props.stage.tasks.filter((task) =>
- props.taskStatusFilter.includes(task.status)
+ props.taskStatusFilter!.includes(task.status)
);
});
@@ -171,7 +159,7 @@ const runableTasks = computed(() => {
const canRunTasks = computed(() => {
return canPerformTaskAction(
filteredTasks.value,
- rollout.value,
+ props.rollout,
project.value
);
});
@@ -182,7 +170,7 @@ const canCreateRollout = computed(() => {
// Helper function to extract IDs from task and stage names
const getTaskRouteParams = (task: Task) => {
- const rolloutId = rollout.value.name.split("/").pop();
+ const rolloutId = props.rollout.name.split("/").pop();
const stageId = props.stage.name.split("/").pop();
const taskId = task.name.split("/").pop();
@@ -206,48 +194,18 @@ const handleTaskClick = (task: Task) => {
};
const handleRunAllTasks = () => {
- showRunTasksPanel.value = true;
-};
-
-const handlePanelClose = () => {
- showRunTasksPanel.value = false;
+ emit("run-tasks", props.stage, runableTasks.value);
};
-const createRolloutToStage = async () => {
- try {
- const request = create(CreateRolloutRequestSchema, {
- parent: project.value.name,
- rollout: {
- plan: rollout.value.plan,
- },
- target: props.stage.environment,
- });
- await rolloutServiceClientConnect.createRollout(request);
-
- pushNotification({
- module: "bytebase",
- style: "SUCCESS",
- title: $t("common.success"),
- description: $t("common.created"),
- });
-
- // Trigger immediate refresh of rollout data
- events.emit("status-changed", { eager: true });
- } catch (error) {
- pushNotification({
- module: "bytebase",
- style: "CRITICAL",
- title: $t("common.error"),
- description: String(error),
- });
- }
+const createRolloutToStage = () => {
+ emit("create-rollout-to-stage", props.stage);
};
const handleClickStageTitle = () => {
// Only navigate if the stage is created
if (!isCreated.value) return;
- const rolloutId = rollout.value.name.split("/").pop();
+ const rolloutId = props.rollout.name.split("/").pop();
const stageId = props.stage.name.split("/").pop();
if (!rolloutId || !stageId) return;
diff --git a/frontend/src/components/Plan/components/RolloutView/StagesView.vue b/frontend/src/components/Plan/components/RolloutView/StagesView.vue
index 91946f2bfb..567d53b2d2 100644
--- a/frontend/src/components/Plan/components/RolloutView/StagesView.vue
+++ b/frontend/src/components/Plan/components/RolloutView/StagesView.vue
@@ -1,32 +1,41 @@
<template>
- <div class="w-full h-full flex flex-col p-4">
- <div class="w-full flex grow overflow-auto bg-zinc-50 p-6 rounded-lg">
- <div
- class="relative w-auto flex flex-row items-start justify-start gap-8"
- >
- <!-- Connecting line -->
- <div class="absolute top-5 border-t-2 border-gray-200 w-full z-0"></div>
+ <div class="relative w-fit flex flex-row items-start justify-start gap-8">
+ <!-- Connecting line -->
+ <div class="absolute top-5 border-t-2 border-gray-200 w-full z-0"></div>
- <StageCard
- v-for="stage in mergedStages"
- :key="stage.name"
- :stage="stage"
- :task-status-filter="taskStatusFilter"
- />
- </div>
- </div>
+ <StageCard
+ v-for="stage in mergedStages"
+ :key="stage.name"
+ :rollout="rollout"
+ :stage="stage"
+ :task-status-filter="taskStatusFilter"
+ :readonly="readonly"
+ @run-tasks="(stage, tasks) => $emit('run-tasks', stage, tasks)"
+ @create-rollout-to-stage="
+ (stage) => $emit('create-rollout-to-stage', stage)
+ "
+ />
</div>
</template>
<script setup lang="ts">
import type {
Stage,
+ Task,
Task_Status,
+ Rollout,
} from "@/types/proto-es/v1/rollout_service_pb";
import StageCard from "./StageCard.vue";
defineProps<{
+ rollout: Rollout;
mergedStages: Stage[];
- taskStatusFilter: Task_Status[];
+ taskStatusFilter?: Task_Status[];
+ readonly?: boolean;
+}>();
+
+defineEmits<{
+ (event: "run-tasks", stage: Stage, tasks: Task[]): void;
+ (event: "create-rollout-to-stage", stage: Stage): void;
}>();
</script>
diff --git a/frontend/src/components/Plan/logic/poller/poller.ts b/frontend/src/components/Plan/logic/poller/poller.ts
index 92b109ef65..fcfb7ec607 100644
--- a/frontend/src/components/Plan/logic/poller/poller.ts
+++ b/frontend/src/components/Plan/logic/poller/poller.ts
@@ -215,6 +215,7 @@ export const provideResourcePoller = () => {
// Track if we've done initial refresh to avoid duplicate calls
let hasInitialRefresh = false;
+ const hasCompletedInitialFetch = ref(false);
// Track which pollers are currently running to avoid unnecessary restarts
const pollerStates = {
plan: false,
@@ -245,6 +246,7 @@ export const provideResourcePoller = () => {
pollerStates.issueComments = false;
pollerStates.rollout = false;
hasInitialRefresh = false;
+ hasCompletedInitialFetch.value = false;
// Restart active ones (this will reset the progressive intervals)
if (activeResources.includes("plan")) {
@@ -403,7 +405,10 @@ export const provideResourcePoller = () => {
if (!hasInitialRefresh && activeResources.length > 0) {
hasInitialRefresh = true;
// Small delay to avoid race conditions with component initialization
- setTimeout(() => refreshAll(), 100);
+ setTimeout(async () => {
+ await refreshAll();
+ hasCompletedInitialFetch.value = true;
+ }, 100);
}
} else {
// Stop all pollers when creating
@@ -418,6 +423,7 @@ export const provideResourcePoller = () => {
pollerStates.issue = false;
pollerStates.issueComments = false;
pollerStates.rollout = false;
+ hasCompletedInitialFetch.value = false;
}
});
@@ -427,6 +433,7 @@ export const provideResourcePoller = () => {
restartActivePollers,
isRefreshing: computed(() => isRefreshing.value),
activeResources: resourcesToPolled,
+ hasCompletedInitialFetch: computed(() => hasCompletedInitialFetch.value),
};
provide(KEY, poller);
diff --git a/frontend/src/components/Release/ReleaseDataTable.vue b/frontend/src/components/Release/ReleaseDataTable.vue
index 5ba259f950..6057c34161 100644
--- a/frontend/src/components/Release/ReleaseDataTable.vue
+++ b/frontend/src/components/Release/ReleaseDataTable.vue
@@ -61,7 +61,13 @@ const columnList = computed(
render: (release) => {
return (
<p class="inline-flex w-full">
- <span class="shrink truncate">{release.title}</span>
+ {release.title ? (
+ <span class="shrink truncate">{release.title}</span>
+ ) : (
+ <span class="shrink truncate italic opacity-60">
+ {t("common.untitled")}
+ </span>
+ )}
{release.state === State.DELETED && (
<NTag class="shrink-0" type="warning" size="small" round>
{t("common.archived")}
diff --git a/frontend/src/components/Rollout/kits/TaskStatus.vue b/frontend/src/components/Rollout/kits/TaskStatus.vue
index f371c8b4d8..ba25cea282 100644
--- a/frontend/src/components/Rollout/kits/TaskStatus.vue
+++ b/frontend/src/components/Rollout/kits/TaskStatus.vue
@@ -56,7 +56,7 @@
</template>
</div>
</template>
- {{ status }}
+ {{ Task_Status[status] }}
</NTooltip>
</template>
diff --git a/frontend/src/locales/en-US.json b/frontend/src/locales/en-US.json
index 6368fbc329..7bd7423e1d 100644
--- a/frontend/src/locales/en-US.json
+++ b/frontend/src/locales/en-US.json
@@ -1021,7 +1021,6 @@
"no-session-found": "No session found."
}
},
- "sql-review-only": "SQL Review Only",
"title": {
"edit-schema": "Edit schema",
"change-data": "Change data",
diff --git a/frontend/src/locales/es-ES.json b/frontend/src/locales/es-ES.json
index 79854df847..f420dcea0e 100644
--- a/frontend/src/locales/es-ES.json
+++ b/frontend/src/locales/es-ES.json
@@ -1021,7 +1021,6 @@
"no-session-found": "No se encontró ninguna sesión."
}
},
- "sql-review-only": "Sólo revisión de SQL",
"title": {
"edit-schema": "Editar esquema",
"change-data": "Cambiar datos",
diff --git a/frontend/src/locales/ja-JP.json b/frontend/src/locales/ja-JP.json
index 4933bc6998..06cab9097d 100644
--- a/frontend/src/locales/ja-JP.json
+++ b/frontend/src/locales/ja-JP.json
@@ -1021,7 +1021,6 @@
"no-session-found": "セッションが見つかりません。"
}
},
- "sql-review-only": "SQLレビューのみ",
"title": {
"edit-schema": "スキーマを編集",
"change-data": "データの変更",
diff --git a/frontend/src/locales/vi-VN.json b/frontend/src/locales/vi-VN.json
index 84a8a1d63b..2bb525724f 100644
--- a/frontend/src/locales/vi-VN.json
+++ b/frontend/src/locales/vi-VN.json
@@ -1021,7 +1021,6 @@
"no-session-found": "Không tìm thấy phiên."
}
},
- "sql-review-only": "Chỉ đánh giá SQL",
"title": {
"edit-schema": "Chỉnh sửa lược đồ",
"change-data": "Thay đổi dữ liệu",
diff --git a/frontend/src/locales/zh-CN.json b/frontend/src/locales/zh-CN.json
index f7614a937a..df239b480f 100644
--- a/frontend/src/locales/zh-CN.json
+++ b/frontend/src/locales/zh-CN.json
@@ -1021,7 +1021,6 @@
"no-session-found": "未找到会话。"
}
},
- "sql-review-only": "仅 SQL 审核",
"title": {
"edit-schema": "变更 Schema",
"change-data": "变更数据",
diff --git a/frontend/src/utils/databaseGroup/issue.ts b/frontend/src/utils/databaseGroup/issue.ts
index b48bb1faef..1ceed607d2 100644
--- a/frontend/src/utils/databaseGroup/issue.ts
+++ b/frontend/src/utils/databaseGroup/issue.ts
@@ -1,17 +1,13 @@
import dayjs from "dayjs";
import type { LocationQueryRaw } from "vue-router";
-import {
- PROJECT_V1_ROUTE_ISSUE_DETAIL,
- PROJECT_V1_ROUTE_PLAN_DETAIL,
-} from "@/router/dashboard/projectV1";
+import { PROJECT_V1_ROUTE_ISSUE_DETAIL } from "@/router/dashboard/projectV1";
import type { ComposedDatabaseGroup } from "@/types";
import { extractProjectResourceName } from "../v1";
export const generateDatabaseGroupIssueRoute = (
type: "bb.issue.database.schema.update" | "bb.issue.database.data.update",
databaseGroup: ComposedDatabaseGroup,
- sql = "",
- planOnly = false
+ sql = ""
) => {
const issueNameParts: string[] = [];
issueNameParts.push(`[${databaseGroup.title}]`);
@@ -30,9 +26,7 @@ export const generateDatabaseGroupIssueRoute = (
};
return {
- name: planOnly
- ? PROJECT_V1_ROUTE_PLAN_DETAIL
- : PROJECT_V1_ROUTE_ISSUE_DETAIL,
+ name: PROJECT_V1_ROUTE_ISSUE_DETAIL,
params: {
projectId: extractProjectResourceName(databaseGroup.name),
issueSlug: "create",
diff --git a/frontend/src/views/project/ProjectPlanDashboard.vue b/frontend/src/views/project/ProjectPlanDashboard.vue
index 879c9aea38..af5cbc7b20 100644
--- a/frontend/src/views/project/ProjectPlanDashboard.vue
+++ b/frontend/src/views/project/ProjectPlanDashboard.vue
@@ -55,6 +55,7 @@ import { targetsForSpec } from "@/components/Plan";
import AddSpecDrawer from "@/components/Plan/components/AddSpecDrawer.vue";
import PlanDataTable from "@/components/Plan/components/PlanDataTable";
import PagedTable from "@/components/v2/Model/PagedTable.vue";
+import { useIssueLayoutVersion } from "@/composables/useIssueLayoutVersion";
import { PROJECT_V1_ROUTE_PLAN_DETAIL_SPEC_DETAIL } from "@/router/dashboard/projectV1";
import { useCurrentProjectV1, useCurrentUserV1 } from "@/store";
import { usePlanStore } from "@/store/modules/v1/plan";
@@ -78,11 +79,9 @@ import {
interface LocalState {
params: SearchParams;
- selectedPlanOnlyType?:
- | "bb.issue.database.schema.update"
- | "bb.issue.database.data.update";
}
+const { enabledNewLayout } = useIssueLayoutVersion();
const { project, ready } = useCurrentProjectV1();
const showAddSpecDrawer = ref(false);
@@ -138,10 +137,14 @@ const planSearchParams = computed(() => {
});
const mergedPlanFind = computed(() => {
- return buildPlanFindBySearchParams(planSearchParams.value, {
- hasIssue: false,
- hasPipeline: false,
- });
+ const defaultFind = enabledNewLayout.value
+ ? undefined
+ : // Default find for legacy layout.
+ {
+ hasIssue: false,
+ hasPipeline: false,
+ };
+ return buildPlanFindBySearchParams(planSearchParams.value, defaultFind);
});
const fetchPlanList = async ({