Skip to content

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

chore(frontend): online migration advise improvements (#12775)

Liu Ji72b0cc470495
diff --git a/frontend/src/components/AlterSchemaPrepForm/SchemaEditorModal.vue b/frontend/src/components/AlterSchemaPrepForm/SchemaEditorModal.vue
index 7f13064994..1e03ac9918 100644
--- a/frontend/src/components/AlterSchemaPrepForm/SchemaEditorModal.vue
+++ b/frontend/src/components/AlterSchemaPrepForm/SchemaEditorModal.vue
@@ -82,8 +82,8 @@
<SchemaEditorSQLCheckButton
:database-list="databaseList"
:get-statement="generateOrGetEditingDDL"
- :use-online-schema-change="state.useOnlineSchemaChange"
- @enable-online-schema-change="state.useOnlineSchemaChange = true"
+ :use-online-schema-migration="state.useOnlineSchemaMigration"
+ @toggle-online-schema-migration="state.useOnlineSchemaMigration = $event"
/>
</template>
</NTabs>
@@ -95,8 +95,8 @@
{{ $t("issue.sql-review-only") }}
</NCheckbox>
<NCheckbox
- v-if="allowUseOnlineSchemaChange"
- v-model:checked="state.useOnlineSchemaChange"
+ v-if="allowUseOnlineSchemaMigration"
+ v-model:checked="state.useOnlineSchemaMigration"
>
{{ $t("task.online-migration.enable") }}
</NCheckbox>
@@ -176,7 +176,7 @@ interface LocalState {
isUploadingFile: boolean;
// planOnly is used to indicate whether only to create plan.
planOnly: boolean;
- useOnlineSchemaChange: boolean;
+ useOnlineSchemaMigration: boolean;
}
const props = defineProps({
@@ -215,7 +215,7 @@ const state = reactive<LocalState>({
targets: [],
isUploadingFile: false,
planOnly: props.planOnly,
- useOnlineSchemaChange: false,
+ useOnlineSchemaMigration: false,
});
const databaseV1Store = useDatabaseV1Store();
const notificationStore = useNotificationStore();
@@ -257,7 +257,7 @@ const editTargetsKey = computed(() => {
});
});
-const allowUseOnlineSchemaChange = computed(() => {
+const allowUseOnlineSchemaMigration = computed(() => {
return databaseList.value.every((db) => allowGhostForDatabase(db));
});
@@ -435,7 +435,7 @@ const handlePreviewIssue = async () => {
template: "bb.issue.database.schema.update",
};
query.databaseList = databaseList.value.map((db) => db.name).join(",");
- if (state.useOnlineSchemaChange) {
+ if (state.useOnlineSchemaMigration) {
query.ghost = "1";
}
diff --git a/frontend/src/components/AlterSchemaPrepForm/SchemaEditorSQLCheckButton/OnlineMigrationAdviceExtra.vue b/frontend/src/components/AlterSchemaPrepForm/SchemaEditorSQLCheckButton/OnlineMigrationAdviceExtra.vue
new file mode 100644
index 0000000000..06be7ce0e7
--- /dev/null
+++ b/frontend/src/components/AlterSchemaPrepForm/SchemaEditorSQLCheckButton/OnlineMigrationAdviceExtra.vue
@@ -0,0 +1,53 @@
+<template>
+ <NButton
+ v-if="advise"
+ size="small"
+ type="primary"
+ @click="toggleGhost(advise.on)"
+ >
+ {{ advise.text() }}
+ </NButton>
+</template>
+
+<script setup lang="ts">
+import { computed } from "vue";
+import { useI18n } from "vue-i18n";
+import type { PlanCheckDetailTableRow } from "@/components/IssueV1/components/PlanCheckSection/PlanCheckBar/PlanCheckDetail.vue";
+
+const props = defineProps<{
+ row: PlanCheckDetailTableRow;
+}>();
+
+const emit = defineEmits<{
+ (event: "toggle", on: boolean): void;
+}>();
+
+const { t } = useI18n();
+
+const code = computed(() => {
+ return props.row.checkResult.sqlReviewReport?.code;
+});
+
+const advise = computed(() => {
+ if (!code.value) {
+ return undefined;
+ }
+ if (code.value === 1801) {
+ return {
+ text: () => t("task.online-migration.enable"),
+ on: true,
+ };
+ }
+ if (code.value === 1803) {
+ return {
+ text: () => t("task.online-migration.disable"),
+ on: false,
+ };
+ }
+ return undefined;
+});
+
+const toggleGhost = (on: boolean) => {
+ emit("toggle", on);
+};
+</script>
diff --git a/frontend/src/components/AlterSchemaPrepForm/SchemaEditorSQLCheckButton/SchemaEditorSQLCheckButton.vue b/frontend/src/components/AlterSchemaPrepForm/SchemaEditorSQLCheckButton/SchemaEditorSQLCheckButton.vue
index d8f13796bf..c9b5d18588 100644
--- a/frontend/src/components/AlterSchemaPrepForm/SchemaEditorSQLCheckButton/SchemaEditorSQLCheckButton.vue
+++ b/frontend/src/components/AlterSchemaPrepForm/SchemaEditorSQLCheckButton/SchemaEditorSQLCheckButton.vue
@@ -4,27 +4,22 @@
:database="database"
:get-statement="getStatement"
:change-type="
- useOnlineSchemaChange
+ useOnlineSchemaMigration
? CheckRequest_ChangeType.DDL_GHOST
: CheckRequest_ChangeType.DDL
"
:button-props="{
size: 'small',
}"
- :highlight-row-filter="
- (row) => row.checkResult.title === 'advice.online-migration'
- "
+ :show-code-location="false"
class="justify-end"
>
<template #row-title-extra="{ row, confirm }">
- <NButton
+ <OnlineMigrationAdviceExtra
v-if="row.checkResult.title === 'advice.online-migration'"
- size="small"
- type="primary"
- @click="handleEnableOnlineChange(confirm)"
- >
- {{ $t("task.online-migration.enable") }}
- </NButton>
+ :row="row"
+ @toggle="handleToggleOnlineMigration($event, confirm)"
+ />
</template>
</SQLCheckButton>
</template>
@@ -34,24 +29,28 @@ import { SQLCheckButton } from "@/components/SQLCheck";
import type { ComposedDatabase } from "@/types";
import { CheckRequest_ChangeType } from "@/types/proto/v1/sql_service";
import type { Defer } from "@/utils";
+import OnlineMigrationAdviceExtra from "./OnlineMigrationAdviceExtra.vue";
import { useSchemaEditorSQLCheck } from "./useSchemaEditorSQLCheck";
const props = defineProps<{
databaseList: ComposedDatabase[];
getStatement: () => Promise<{ statement: string; errors: string[] }>;
- useOnlineSchemaChange: boolean;
+ useOnlineSchemaMigration: boolean;
}>();
const emit = defineEmits<{
- (event: "enable-online-schema-change"): void;
+ (event: "toggle-online-schema-migration", on: boolean): void;
}>();
const { show, database } = useSchemaEditorSQLCheck({
databaseList: toRef(props, "databaseList"),
});
-const handleEnableOnlineChange = (confirm: Defer<boolean> | undefined) => {
- emit("enable-online-schema-change");
+const handleToggleOnlineMigration = (
+ on: boolean,
+ confirm: Defer<boolean> | undefined
+) => {
+ emit("toggle-online-schema-migration", on);
confirm?.resolve(false);
};
</script>
diff --git a/frontend/src/components/IssueV1/components/PlanCheckSection/PlanCheckBar/PlanCheckBadge.vue b/frontend/src/components/IssueV1/components/PlanCheckSection/PlanCheckBar/PlanCheckBadge.vue
index 87f7561f45..b20c806fc9 100644
--- a/frontend/src/components/IssueV1/components/PlanCheckSection/PlanCheckBar/PlanCheckBadge.vue
+++ b/frontend/src/components/IssueV1/components/PlanCheckSection/PlanCheckBar/PlanCheckBadge.vue
@@ -82,32 +82,39 @@ const resultStatus = computed(() => {
const buttonClasses = computed(() => {
let bgColor = "";
let textColor = "";
+ let borderColor = "";
switch (status.value) {
case PlanCheckRun_Status.RUNNING:
bgColor = "bg-blue-100";
textColor = "text-blue-800";
+ borderColor = "bg-blue-800";
break;
case PlanCheckRun_Status.FAILED:
bgColor = "bg-red-100";
textColor = "text-red-800";
+ borderColor = "border-red-800";
break;
case PlanCheckRun_Status.CANCELED:
bgColor = "bg-yellow-100";
textColor = "text-yellow-800";
+ borderColor = "border-yellow-800";
break;
case PlanCheckRun_Status.DONE:
switch (resultStatus.value) {
case PlanCheckRun_Result_Status.SUCCESS:
bgColor = "bg-gray-100";
textColor = "text-gray-800";
+ borderColor = "border-gray-800";
break;
case PlanCheckRun_Result_Status.WARNING:
bgColor = "bg-yellow-100";
textColor = "text-yellow-800";
+ borderColor = "border-yellow-800";
break;
case PlanCheckRun_Result_Status.ERROR:
bgColor = "bg-red-100";
textColor = "text-red-800";
+ borderColor = "border-red-800";
break;
}
break;
@@ -117,7 +124,7 @@ const buttonClasses = computed(() => {
if (props.clickable) {
styleList.push("cursor-pointer");
if (props.selected) {
- styleList.push("shadow", "font-medium", "border-control-border");
+ styleList.push("font-medium", borderColor);
} else {
styleList.push(bgColor, "hover:opacity-80", "border-transparent");
}
diff --git a/frontend/src/components/IssueV1/components/PlanCheckSection/PlanCheckBar/PlanCheckBar.vue b/frontend/src/components/IssueV1/components/PlanCheckSection/PlanCheckBar/PlanCheckBar.vue
index 821234e5f2..3d406c8239 100644
--- a/frontend/src/components/IssueV1/components/PlanCheckSection/PlanCheckBar/PlanCheckBar.vue
+++ b/frontend/src/components/IssueV1/components/PlanCheckSection/PlanCheckBar/PlanCheckBar.vue
@@ -9,7 +9,6 @@
<div class="flex-1">
<PlanCheckBadgeBar
- v-if="!state.showPlanCheckDetail"
:plan-check-run-list="planCheckRunList"
@select-type="selectedType = $event"
>
diff --git a/frontend/src/components/IssueV1/components/PlanCheckSection/PlanCheckBar/PlanCheckDetail.vue b/frontend/src/components/IssueV1/components/PlanCheckSection/PlanCheckBar/PlanCheckDetail.vue
index 8bc82c8242..aacd59fb34 100644
--- a/frontend/src/components/IssueV1/components/PlanCheckSection/PlanCheckBar/PlanCheckDetail.vue
+++ b/frontend/src/components/IssueV1/components/PlanCheckSection/PlanCheckBar/PlanCheckDetail.vue
@@ -1,9 +1,9 @@
<template>
- <div class="divide-y">
+ <div class="flex flex-col gap-y-0.5">
<div
v-for="(row, i) in highlightTableRows"
:key="i"
- class="py-3 px-2 first:pt-2 space-y-2"
+ class="py-2 px-2 space-y-2"
:class="[
row.checkResult.status === PlanCheckRun_Result_Status.ERROR &&
'border-error border rounded',
@@ -43,63 +43,80 @@
<slot name="row-title-extra" :row="row" />
</div>
- <div class="textinfolabel">
- <span>{{ row.checkResult.content }}</span>
- <template v-if="row.checkResult.sqlReviewReport?.detail">
- <span
- class="ml-1 normal-link"
- @click="
- state.activeResultDefinition =
- row.checkResult.sqlReviewReport!.detail
- "
- >{{ $t("sql-review.view-definition") }}</span
- >
- <span class="border-r border-control-border ml-1"></span>
- </template>
- <template
- v-if="
- row.checkResult.sqlReviewReport &&
- getActiveRule(row.checkResult.title)
- "
- >
- <span
- class="ml-1 normal-link"
- @click="setActiveRule(row.checkResult.title)"
- >{{ $t("sql-review.rule-detail") }}</span
- >
- <span class="border-r border-control-border ml-1"></span>
- </template>
- <template v-if="row.checkResult.sqlSummaryReport">
- {{ row.checkResult.sqlSummaryReport.affectedRows }}
- </template>
- <HideInStandaloneMode>
- <a
- v-if="row.link"
- class="ml-1 normal-link"
- :href="row.link.url"
- :target="row.link.target"
- >
- {{ row.link.title }}
- </a>
- </HideInStandaloneMode>
+ <div class="textinfolabel flex flex-col gap-y-0.5">
+ <div>{{ row.checkResult.content }}</div>
- <!-- Only show the error line for latest plan check run -->
- <template v-if="isLatest && row.checkResult.sqlReviewReport?.line">
- <span class="border-r border-control-border ml-1"></span>
- <span
- class="ml-1 normal-link"
- @click="
- handleClickPlanCheckDetailLine(
- row.checkResult.sqlReviewReport!.line
- )
+ <OnlineMigrationDetail
+ v-if="row.checkResult.title === 'advice.online-migration'"
+ :row="row"
+ />
+
+ <div
+ class="flex items-center justify-start space-x-2 divide-x divide-block-border"
+ >
+ <div
+ v-if="row.checkResult.sqlReviewReport?.detail"
+ class="pl-2 first:pl-0"
+ >
+ <span
+ class="normal-link"
+ @click="
+ state.activeResultDefinition =
+ row.checkResult.sqlReviewReport!.detail
+ "
+ >{{ $t("sql-review.view-definition") }}</span
+ >
+ </div>
+ <div
+ v-if="
+ row.checkResult.sqlReviewReport &&
+ getActiveRule(row.checkResult.title)
"
+ class="pl-2 first:pl-0"
>
- Line {{ row.checkResult.sqlReviewReport.line }}
- </span>
- </template>
-
- <slot name="row-extra" :row="row" />
+ <span
+ class="normal-link"
+ @click="setActiveRule(row.checkResult.title)"
+ >{{ $t("sql-review.rule-detail") }}</span
+ >
+ </div>
+ <div v-if="row.checkResult.sqlSummaryReport" class="pl-2 first:pl-0">
+ <span>
+ {{ row.checkResult.sqlSummaryReport.affectedRows }}
+ </span>
+ </div>
+
+ <HideInStandaloneMode>
+ <div class="pl-2 first:pl-0">
+ <a
+ v-if="row.link"
+ class="normal-link"
+ :href="row.link.url"
+ :target="row.link.target"
+ >
+ {{ row.link.title }}
+ </a>
+ </div>
+ </HideInStandaloneMode>
+
+ <!-- Only show the error line for latest plan check run -->
+ <div
+ v-if="showCodeLocation && row.checkResult.sqlReviewReport?.line"
+ class="pl-2 first:pl-0"
+ >
+ <span
+ class="normal-link"
+ @click="
+ handleClickPlanCheckDetailLine(
+ row.checkResult.sqlReviewReport!.line
+ )
+ "
+ >
+ Line {{ row.checkResult.sqlReviewReport.line }}
+ </span>
+ </div>
+ </div>
</div>
</div>
@@ -180,7 +197,9 @@
</HideInStandaloneMode>
<!-- Only show the error line for latest plan check run -->
- <template v-if="isLatest && row.checkResult.sqlReviewReport?.line">
+ <template
+ v-if="showCodeLocation && row.checkResult.sqlReviewReport?.line"
+ >
<span class="border-r border-control-border ml-1"></span>
<span
class="ml-1 normal-link"
@@ -193,8 +212,6 @@
Line {{ row.checkResult.sqlReviewReport.line }}
</span>
</template>
-
- <slot name="row-extra" :row="row" />
</div>
</div>
</div>
@@ -219,6 +236,7 @@ import { computed, reactive } from "vue";
import { useI18n } from "vue-i18n";
import { useRouter } from "vue-router";
import { SQLRuleEditDialog } from "@/components/SQLReview/components";
+import HideInStandaloneMode from "@/components/misc/HideInStandaloneMode.vue";
import { WORKSPACE_ROUTE_SQL_REVIEW } from "@/router/dashboard/workspaceRoutes";
import { useReviewPolicyForDatabase } from "@/store";
import type { RuleTemplateV2, ComposedDatabase } from "@/types";
@@ -236,6 +254,7 @@ import {
PlanCheckRun_Status,
} from "@/types/proto/v1/plan_service";
import PlanCheckResultDefinitionModal from "./PlanCheckResultDefinitionModal.vue";
+import { OnlineMigrationDetail } from "./detail";
interface ErrorCodeLink {
title: string;
@@ -257,9 +276,8 @@ type LocalState = {
const props = defineProps<{
planCheckRun: PlanCheckRun;
- isLatest?: boolean;
+ showCodeLocation?: boolean;
database?: ComposedDatabase;
- highlightRowFilter?: (row: PlanCheckDetailTableRow) => boolean;
}>();
const { t } = useI18n();
@@ -406,15 +424,15 @@ const tableRows = computed(() => {
});
});
+const highlightRowFilter = (row: PlanCheckDetailTableRow) => {
+ return row.checkResult.title === "advice.online-migration";
+};
+
const highlightTableRows = computed(() => {
- const { highlightRowFilter } = props;
- if (!highlightRowFilter) return [];
return tableRows.value.filter(highlightRowFilter);
});
const standardTableRows = computed(() => {
- const { highlightRowFilter } = props;
- if (!highlightRowFilter) return tableRows.value;
return tableRows.value.filter((row) => !highlightRowFilter(row));
});
diff --git a/frontend/src/components/IssueV1/components/PlanCheckSection/PlanCheckBar/PlanCheckPanel.vue b/frontend/src/components/IssueV1/components/PlanCheckSection/PlanCheckBar/PlanCheckPanel.vue
index c02816ab31..4db7d5a5d7 100644
--- a/frontend/src/components/IssueV1/components/PlanCheckSection/PlanCheckBar/PlanCheckPanel.vue
+++ b/frontend/src/components/IssueV1/components/PlanCheckSection/PlanCheckBar/PlanCheckPanel.vue
@@ -16,7 +16,7 @@
v-if="selectedPlanCheckRun"
:plan-check-run="selectedPlanCheckRun"
:database="database"
- :is-latest="isLatestPlanCheckRun"
+ :show-code-location="isLatestPlanCheckRun"
@close="$emit('close')"
/>
</div>
diff --git a/frontend/src/components/IssueV1/components/PlanCheckSection/PlanCheckBar/detail/OnlineMigrationDetail.vue b/frontend/src/components/IssueV1/components/PlanCheckSection/PlanCheckBar/detail/OnlineMigrationDetail.vue
new file mode 100644
index 0000000000..d7a209e2e4
--- /dev/null
+++ b/frontend/src/components/IssueV1/components/PlanCheckSection/PlanCheckBar/detail/OnlineMigrationDetail.vue
@@ -0,0 +1,22 @@
+<template>
+ <div v-if="code === 1802" class="textinfolabel">
+ {{
+ $t(
+ "task.online-migration.advice-split-statement-to-single-online-migration-issue"
+ )
+ }}
+ </div>
+</template>
+
+<script setup lang="ts">
+import { computed } from "vue";
+import type { PlanCheckDetailTableRow } from "../PlanCheckDetail.vue";
+
+const props = defineProps<{
+ row: PlanCheckDetailTableRow;
+}>();
+
+const code = computed(() => {
+ return props.row.checkResult.sqlReviewReport?.code;
+});
+</script>
diff --git a/frontend/src/components/IssueV1/components/PlanCheckSection/PlanCheckBar/detail/index.ts b/frontend/src/components/IssueV1/components/PlanCheckSection/PlanCheckBar/detail/index.ts
new file mode 100644
index 0000000000..e08b0139db
--- /dev/null
+++ b/frontend/src/components/IssueV1/components/PlanCheckSection/PlanCheckBar/detail/index.ts
@@ -0,0 +1,3 @@
+import OnlineMigrationDetail from "./OnlineMigrationDetail.vue";
+
+export { OnlineMigrationDetail };
diff --git a/frontend/src/components/IssueV1/components/SQLCheckSection/OnlineMigrationAdviceExtra.vue b/frontend/src/components/IssueV1/components/SQLCheckSection/OnlineMigrationAdviceExtra.vue
index eb889b8c86..28fbb62124 100644
--- a/frontend/src/components/IssueV1/components/SQLCheckSection/OnlineMigrationAdviceExtra.vue
+++ b/frontend/src/components/IssueV1/components/SQLCheckSection/OnlineMigrationAdviceExtra.vue
@@ -1,17 +1,18 @@
<template>
<NButton
- v-if="allowEnableGhost"
+ v-if="advise"
size="small"
type="primary"
- @click="enableGhost"
+ @click="toggleGhost(advise.on)"
>
- {{ $t("task.online-migration.enable") }}
+ {{ advise.text() }}
</NButton>
</template>
<script setup lang="ts">
import { NButton } from "naive-ui";
import { computed } from "vue";
+import { useI18n } from "vue-i18n";
import { isGroupingChangeTaskV1, useIssueContext } from "../../logic";
import { type PlanCheckDetailTableRow } from "../PlanCheckSection/PlanCheckBar/PlanCheckDetail.vue";
import { allowGhostForTask } from "../Sidebar/GhostSection/common";
@@ -20,28 +21,46 @@ const emit = defineEmits<{
(event: "toggle", on: boolean): void;
}>();
-defineProps<{
+const props = defineProps<{
row: PlanCheckDetailTableRow;
}>();
+const { t } = useI18n();
const { isCreating, issue, activeTask } = useIssueContext();
-const allowEnableGhost = computed(() => {
+const code = computed(() => {
+ return props.row.checkResult.sqlReviewReport?.code;
+});
+
+const advise = computed(() => {
if (!isCreating.value) {
- return false;
+ return undefined;
+ }
+ if (!code.value) {
+ return undefined;
}
if (isGroupingChangeTaskV1(issue.value, activeTask.value)) {
- return false;
+ return undefined;
}
-
if (!allowGhostForTask(issue.value, activeTask.value)) {
- return false;
+ return undefined;
}
-
- return true;
+ if (code.value === 1801) {
+ return {
+ text: () => t("task.online-migration.enable"),
+ on: true,
+ };
+ }
+ if (code.value === 1803) {
+ return {
+ text: () => t("task.online-migration.disable"),
+ on: false,
+ };
+ }
+ return undefined;
});
-const enableGhost = () => {
- emit("toggle", true);
+const toggleGhost = (on: boolean) => {
+ emit("toggle", on);
};
</script>
diff --git a/frontend/src/components/IssueV1/components/SQLCheckSection/SQLCheckBadge.vue b/frontend/src/components/IssueV1/components/SQLCheckSection/SQLCheckBadge.vue
index b933fd9cea..35ad0b4bc8 100644
--- a/frontend/src/components/IssueV1/components/SQLCheckSection/SQLCheckBadge.vue
+++ b/frontend/src/components/IssueV1/components/SQLCheckSection/SQLCheckBadge.vue
@@ -27,9 +27,6 @@
v-if="showDetailPanel"
:database="database"
:advices="advices"
- :highlight-row-filter="
- (row) => row.checkResult.title === 'advice.online-migration'
- "
@close="showDetailPanel = false"
>
<template #row-title-extra="{ row }">
@@ -131,11 +128,9 @@ const handleClick = () => {
};
const handleToggleOnlineMigration = (on: boolean) => {
- if (on) {
- events.emit("toggle-online-migration", {
- on: true,
- });
- showDetailPanel.value = true;
- }
+ events.emit("toggle-online-migration", {
+ on,
+ });
+ showDetailPanel.value = true;
};
</script>
diff --git a/frontend/src/components/IssueV1/components/SQLCheckSection/SQLCheckSection.vue b/frontend/src/components/IssueV1/components/SQLCheckSection/SQLCheckSection.vue
index 68ca54e790..f83b5dcc88 100644
--- a/frontend/src/components/IssueV1/components/SQLCheckSection/SQLCheckSection.vue
+++ b/frontend/src/components/IssueV1/components/SQLCheckSection/SQLCheckSection.vue
@@ -13,11 +13,9 @@
:button-props="{
size: 'tiny',
}"
- :highlight-row-filter="
- (row) => row.checkResult.title === 'advice.online-migration'
- "
button-style="--n-padding: 0 8px 0 6px; --n-icon-margin: 3px;"
class="justify-between flex-1"
+ :show-code-location="true"
@update:advices="$emit('update:advices', $event)"
>
<template #result="{ advices, isRunning }">
@@ -95,12 +93,10 @@ const handleToggleOnlineMigration = (
on: boolean,
confirm: Defer<boolean> | undefined
) => {
- if (on) {
- events.emit("toggle-online-migration", {
- on: true,
- });
- confirm?.resolve(false);
- }
+ events.emit("toggle-online-migration", {
+ on,
+ });
+ confirm?.resolve(false);
};
const changeType = computed((): CheckRequest_ChangeType | undefined => {
diff --git a/frontend/src/components/IssueV1/components/Sidebar/GhostSection/GhostSwitch.vue b/frontend/src/components/IssueV1/components/Sidebar/GhostSection/GhostSwitch.vue
index f58f09fa6e..389a9169b7 100644
--- a/frontend/src/components/IssueV1/components/Sidebar/GhostSection/GhostSwitch.vue
+++ b/frontend/src/components/IssueV1/components/Sidebar/GhostSection/GhostSwitch.vue
@@ -122,9 +122,7 @@ const toggleChecked = async (on: boolean) => {
};
events.on("toggle-online-migration", ({ on }) => {
- if (on) {
- toggleChecked(on);
- }
+ toggleChecked(on);
});
</script>
diff --git a/frontend/src/components/Plan/components/PlanCheckSection/PlanCheckBar/PlanCheckBadge.vue b/frontend/src/components/Plan/components/PlanCheckSection/PlanCheckBar/PlanCheckBadge.vue
index aabf458df4..5b250531a8 100644
--- a/frontend/src/components/Plan/components/PlanCheckSection/PlanCheckBar/PlanCheckBadge.vue
+++ b/frontend/src/components/Plan/components/PlanCheckSection/PlanCheckBar/PlanCheckBadge.vue
@@ -76,32 +76,39 @@ const resultStatus = computed(() => {
const buttonClasses = computed(() => {
let bgColor = "";
let textColor = "";
+ let borderColor = "";
switch (status.value) {
case PlanCheckRun_Status.RUNNING:
bgColor = "bg-blue-100";
textColor = "text-blue-800";
+ borderColor = "bg-blue-800";
break;
case PlanCheckRun_Status.FAILED:
bgColor = "bg-red-100";
textColor = "text-red-800";
+ borderColor = "border-red-800";
break;
case PlanCheckRun_Status.CANCELED:
bgColor = "bg-yellow-100";
textColor = "text-yellow-800";
+ borderColor = "border-yellow-800";
break;
case PlanCheckRun_Status.DONE:
switch (resultStatus.value) {
case PlanCheckRun_Result_Status.SUCCESS:
bgColor = "bg-gray-100";
textColor = "text-gray-800";
+ borderColor = "border-gray-800";
break;
case PlanCheckRun_Result_Status.WARNING:
bgColor = "bg-yellow-100";
textColor = "text-yellow-800";
+ borderColor = "border-yellow-800";
break;
case PlanCheckRun_Result_Status.ERROR:
bgColor = "bg-red-100";
textColor = "text-red-800";
+ borderColor = "border-red-800";
break;
}
break;
@@ -111,7 +118,7 @@ const buttonClasses = computed(() => {
if (props.clickable) {
styleList.push("cursor-pointer");
if (props.selected) {
- styleList.push("shadow", "font-medium", "border-control-border");
+ styleList.push("font-medium", borderColor);
} else {
styleList.push(bgColor, "hover:opacity-80", "border-transparent");
}
diff --git a/frontend/src/components/Plan/components/PlanCheckSection/PlanCheckBar/PlanCheckDetail.vue b/frontend/src/components/Plan/components/PlanCheckSection/PlanCheckBar/PlanCheckDetail.vue
index ee9f1dc351..7a943b293e 100644
--- a/frontend/src/components/Plan/components/PlanCheckSection/PlanCheckBar/PlanCheckDetail.vue
+++ b/frontend/src/components/Plan/components/PlanCheckSection/PlanCheckBar/PlanCheckDetail.vue
@@ -77,7 +77,7 @@
</HideInStandaloneMode>
<!-- Only show the error line for latest plan check run -->
- <template v-if="isLatest && row.checkResult.sqlReviewReport?.line">
+ <template v-if="showCodeLocation && row.checkResult.sqlReviewReport?.line">
<span class="border-r border-control-border ml-1"></span>
<span
class="ml-1 normal-link"
@@ -90,8 +90,6 @@
Line {{ row.checkResult.sqlReviewReport.line }}
</span>
</template>
-
- <slot name="row-extra" :row="row" />
</div>
</div>
</div>
@@ -155,7 +153,7 @@ type LocalState = {
const props = defineProps<{
planCheckRun: PlanCheckRun;
database?: ComposedDatabase;
- isLatest?: boolean;
+ showCodeLocation?: boolean;
}>();
const { t } = useI18n();
diff --git a/frontend/src/components/Plan/components/PlanCheckSection/PlanCheckBar/PlanCheckPanel.vue b/frontend/src/components/Plan/components/PlanCheckSection/PlanCheckBar/PlanCheckPanel.vue
index 3dedcecea5..264a71905c 100644
--- a/frontend/src/components/Plan/components/PlanCheckSection/PlanCheckBar/PlanCheckPanel.vue
+++ b/frontend/src/components/Plan/components/PlanCheckSection/PlanCheckBar/PlanCheckPanel.vue
@@ -16,7 +16,7 @@
v-if="selectedPlanCheckRun"
:plan-check-run="selectedPlanCheckRun"
:database="database"
- :is-latest="isLatestPlanCheckRun"
+ :show-code-location="isLatestPlanCheckRun"
@close="$emit('close')"
/>
</div>
diff --git a/frontend/src/components/Plan/components/SQLCheckSection/SQLCheckBadge.vue b/frontend/src/components/Plan/components/SQLCheckSection/SQLCheckBadge.vue
index 34d90f4dde..2ffc0de54e 100644
--- a/frontend/src/components/Plan/components/SQLCheckSection/SQLCheckBadge.vue
+++ b/frontend/src/components/Plan/components/SQLCheckSection/SQLCheckBadge.vue
@@ -1,6 +1,6 @@
<template>
<button
- class="inline-flex items-center px-3 py-0.5 rounded-full text-sm border border-control-border"
+ class="inline-flex items-center px-3 py-0.5 rounded-full text-sm border border-transparent"
:class="buttonClasses"
@click="handleClick"
>
@@ -78,32 +78,41 @@ const buttonClasses = computed(() => {
let bgColor = "";
let bgHoverColor = "";
let textColor = "";
+ let borderColor = "";
switch (status.value) {
case "RUNNING":
bgColor = "bg-blue-100";
bgHoverColor = "bg-blue-300";
textColor = "text-blue-800";
+ borderColor = "border-blue-800";
break;
case "SUCCESS":
bgColor = "bg-gray-100";
bgHoverColor = "bg-gray-300";
textColor = "text-gray-800";
+ borderColor = "border-gray-800";
break;
case "WARNING":
bgColor = "bg-yellow-100";
bgHoverColor = "bg-yellow-300";
textColor = "text-yellow-800";
+ borderColor = "border-yellow-800";
break;
case "ERROR":
bgColor = "bg-red-100";
bgHoverColor = "bg-red-300";
textColor = "text-red-800";
+ borderColor = "border-red-800";
break;
}
const styleList: string[] = [textColor, bgColor];
if (clickable.value) {
- styleList.push("cursor-pointer", `hover:${bgHoverColor}`);
+ styleList.push(
+ "cursor-pointer",
+ `hover:${bgHoverColor}`,
+ `hover:${borderColor}`
+ );
} else {
styleList.push("cursor-default");
}
diff --git a/frontend/src/components/SQLCheck/SQLCheckButton.vue b/frontend/src/components/SQLCheck/SQLCheckButton.vue
index 237da3ca56..15366c0afb 100644
--- a/frontend/src/components/SQLCheck/SQLCheckButton.vue
+++ b/frontend/src/components/SQLCheck/SQLCheckButton.vue
@@ -60,12 +60,9 @@
:advices="advices"
:confirm="confirmDialog"
:override-title="$t('issue.sql-check.sql-review-violations')"
- :highlight-row-filter="highlightRowFilter"
+ :show-code-location="showCodeLocation"
@close="onPanelClose"
>
- <template #row-extra="{ row }">
- <slot name="row-extra" :row="row" :confirm="confirmDialog" />
- </template>
<template #row-title-extra="{ row }">
<slot name="row-title-extra" :row="row" :confirm="confirmDialog" />
</template>
@@ -88,8 +85,8 @@ import type { CheckRequest_ChangeType } from "@/types/proto/v1/sql_service";
import { Advice, Advice_Status } from "@/types/proto/v1/sql_service";
import type { Defer, VueStyle } from "@/utils";
import { defer, hasWorkspacePermissionV2 } from "@/utils";
-import type { PlanCheckDetailTableRow } from "../IssueV1/components/PlanCheckSection/PlanCheckBar/PlanCheckDetail.vue";
import ErrorList from "../misc/ErrorList.vue";
+import SQLCheckPanel from "./SQLCheckPanel.vue";
import SQLCheckSummary from "./SQLCheckSummary.vue";
import { useSQLCheckContext } from "./context";
@@ -101,14 +98,14 @@ const props = withDefaults(
buttonProps?: ButtonProps;
buttonStyle?: VueStyle;
changeType?: CheckRequest_ChangeType;
- highlightRowFilter?: (row: PlanCheckDetailTableRow) => boolean;
+ showCodeLocation?: boolean;
}>(),
{
databaseMetadata: undefined,
buttonProps: undefined,
buttonStyle: undefined,
changeType: undefined,
- highlightRowFilter: undefined,
+ showCodeLocation: undefined,
}
);
diff --git a/frontend/src/components/SQLCheck/SQLCheckPanel.vue b/frontend/src/components/SQLCheck/SQLCheckPanel.vue
index c2f03f02c5..312efc8dc2 100644
--- a/frontend/src/components/SQLCheck/SQLCheckPanel.vue
+++ b/frontend/src/components/SQLCheck/SQLCheckPanel.vue
@@ -11,13 +11,9 @@
<PlanCheckDetail
:plan-check-run="planCheckRun"
:database="database"
- :is-latest="false"
- :highlight-row-filter="highlightRowFilter"
+ :show-code-location="showCodeLocation"
@close="$emit('close')"
>
- <template #row-extra="{ row }">
- <slot name="row-extra" :row="row" />
- </template>
<template #row-title-extra="{ row }">
<slot name="row-title-extra" :row="row" />
</template>
@@ -57,16 +53,14 @@ import {
import type { Advice } from "@/types/proto/v1/sql_service";
import { Advice_Status } from "@/types/proto/v1/sql_service";
import type { Defer } from "@/utils";
-import PlanCheckDetail, {
- type PlanCheckDetailTableRow,
-} from "../IssueV1/components/PlanCheckSection/PlanCheckBar/PlanCheckDetail.vue";
+import PlanCheckDetail from "../IssueV1/components/PlanCheckSection/PlanCheckBar/PlanCheckDetail.vue";
const { advices, database } = defineProps<{
database: ComposedDatabase;
advices: Advice[];
overrideTitle?: string;
confirm?: Defer<boolean>;
- highlightRowFilter?: (row: PlanCheckDetailTableRow) => boolean;
+ showCodeLocation?: boolean;
}>();
defineEmits<{
diff --git a/frontend/src/locales/en-US.json b/frontend/src/locales/en-US.json
index 90afcaa219..bd2063ef53 100644
--- a/frontend/src/locales/en-US.json
+++ b/frontend/src/locales/en-US.json
@@ -393,7 +393,9 @@
},
"show-default-parameters": "Show default parameters",
"hide-default-parameters": "Hide default parameters",
- "enable": "Enable online migration"
+ "enable": "Enable online migration",
+ "disable": "Disable online migration",
+ "advice-split-statement-to-single-online-migration-issue": "Advice splitting this statement to single online migration issue."
},
"prior-backup-tips": "Back up affected data ahead of time"
},
diff --git a/frontend/src/locales/es-ES.json b/frontend/src/locales/es-ES.json
index 8b43f5ff0c..e400a465d4 100644
--- a/frontend/src/locales/es-ES.json
+++ b/frontend/src/locales/es-ES.json
@@ -393,7 +393,9 @@
},
"show-default-parameters": "Mostrar parámetros predeterminados",
"hide-default-parameters": "Ocultar parámetros predeterminados",
- "enable": "Habilitar la migración en línea"
+ "enable": "Habilitar la migración en línea",
+ "disable": "Deshabilitar la migración en línea",
+ "advice-split-statement-to-single-online-migration-issue": "Se recomienda dividir esta declaración en un único problema de migración en línea."
},
"prior-backup-tips": "Haga una copia de seguridad de los datos afectados con anticipación"
},
diff --git a/frontend/src/locales/ja-JP.json b/frontend/src/locales/ja-JP.json
index 2c0350170c..adf958737d 100644
--- a/frontend/src/locales/ja-JP.json
+++ b/frontend/src/locales/ja-JP.json
@@ -393,7 +393,9 @@
},
"show-default-parameters": "デフォルトパラメータを表示",
"hide-default-parameters": "デフォルトパラメータを非表示にする",
- "enable": "オンラインでの大規模なテーブル変更を有効にする"
+ "enable": "オンラインでの大規模なテーブル変更を有効にする",
+ "disable": "オンライン移行を無効にする",
+ "advice-split-statement-to-single-online-migration-issue": "このステートメントを 1 つのオンライン移行の問題に分割することをアドバイスします。"
},
"prior-backup-tips": "影響を受けるデータを事前にバックアップする"
},
diff --git a/frontend/src/locales/sql-review/en-US.json b/frontend/src/locales/sql-review/en-US.json
index 0e79106fbb..8b0526c5c7 100644
--- a/frontend/src/locales/sql-review/en-US.json
+++ b/frontend/src/locales/sql-review/en-US.json
@@ -639,7 +639,7 @@
}
},
"advice-online-migration": {
- "title": "Advise enabling online migration",
+ "title": "Online migration",
"description": "Advise enabling online migration if the migrated table row count exceeds your setting. Suggested error level: Warning",
"component": {
"number": {
diff --git a/frontend/src/locales/sql-review/es-ES.json b/frontend/src/locales/sql-review/es-ES.json
index 8886b347db..dd04328d34 100644
--- a/frontend/src/locales/sql-review/es-ES.json
+++ b/frontend/src/locales/sql-review/es-ES.json
@@ -639,7 +639,7 @@
}
},
"advice-online-migration": {
- "title": "Se recomienda habilitar la migración en línea",
+ "title": "Migración en línea",
"description": "Se recomienda habilitar la migración en línea si el recuento de filas de la tabla migrada supera su configuración. Nivel de error sugerido: Advertencia",
"component": {
"number": {
diff --git a/frontend/src/locales/sql-review/ja-JP.json b/frontend/src/locales/sql-review/ja-JP.json
index d418faf007..9b5f48cb45 100644
--- a/frontend/src/locales/sql-review/ja-JP.json
+++ b/frontend/src/locales/sql-review/ja-JP.json
@@ -639,7 +639,7 @@
}
},
"advice-online-migration": {
- "title": "オンライン移行の有効化を推奨",
+ "title": "オンライン移行",
"description": "移行されたテーブル行数が設定値を超えた場合、オンライン移行の有効化を推奨します。推奨されるエラーレベル: 警告",
"component": {
"number": {
diff --git a/frontend/src/locales/sql-review/zh-CN.json b/frontend/src/locales/sql-review/zh-CN.json
index af06f4070a..00ff0c5ca9 100644
--- a/frontend/src/locales/sql-review/zh-CN.json
+++ b/frontend/src/locales/sql-review/zh-CN.json
@@ -639,7 +639,7 @@
}
},
"advice-online-migration": {
- "title": "建议启用在线大表变更",
+ "title": "在线大表变更",
"description": "如果迁移的表行数超过您的设置,建议启用在线迁移。建议的错误级别: 警告",
"component": {
"number": {
diff --git a/frontend/src/locales/zh-CN.json b/frontend/src/locales/zh-CN.json
index de246c8c9d..680c39fd9e 100644
--- a/frontend/src/locales/zh-CN.json
+++ b/frontend/src/locales/zh-CN.json
@@ -393,7 +393,9 @@
},
"show-default-parameters": "显示默认参数",
"hide-default-parameters": "隐藏默认参数",
- "enable": "启用在线大表变更"
+ "enable": "启用在线大表变更",
+ "disable": "关闭在线大表变更",
+ "advice-split-statement-to-single-online-migration-issue": "建议将该语句拆分成单独的在线大表变更工单。"
},
"prior-backup-tips": "提前备份受影响的数据"
},
diff --git a/frontend/tailwind.config.js b/frontend/tailwind.config.js
index ca4c454c09..71d4bf1a8c 100644
--- a/frontend/tailwind.config.js
+++ b/frontend/tailwind.config.js
@@ -11,15 +11,15 @@ module.exports = {
safelist: [
// "w-xxx" is used by BBTab
// "bg-xxx", "text-xxx" is used by BBAttention TaskCheckBadgeBar BBBadge
- // "hover:bg-xxx" is used by TaskCheckBadgeBar BBBadge
+ // "hover:bg-xxx", "hover:border-xxx" is used by TaskCheckBadgeBar BBBadge
// "grid-cols-xxx" is used by AnomalyCenterDashboard
{ pattern: /^w-/ },
{ pattern: /^pl-/ },
- { pattern: /^bg-gray-/, variants: ["hover"] },
- { pattern: /^bg-blue-/, variants: ["hover"] },
- { pattern: /^bg-yellow-/, variants: ["hover"] },
- { pattern: /^bg-red-/, variants: ["hover"] },
- { pattern: /^bg-indigo-/, variants: ["hover"] },
+ { pattern: /^(bg|border)-gray-/, variants: ["hover"] },
+ { pattern: /^(bg|border)-blue-/, variants: ["hover"] },
+ { pattern: /^(bg|border)-yellow-/, variants: ["hover"] },
+ { pattern: /^(bg|border)-red-/, variants: ["hover"] },
+ { pattern: /^(bg|border)-indigo-/, variants: ["hover"] },
{ pattern: /^text-indigo-/ },
{ pattern: /^text-gray-/ },
{ pattern: /^text-blue-/ },