Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
chore: show affected rows in sql check bar (#15310)
boojackfb5d612aa4e3
diff --git a/frontend/src/components/IssueV1/components/SQLCheckSection/SQLCheckBadge.vue b/frontend/src/components/IssueV1/components/SQLCheckSection/SQLCheckBadge.vueindex a5d028aa85..70cac146b8 100644--- a/frontend/src/components/IssueV1/components/SQLCheckSection/SQLCheckBadge.vue+++ b/frontend/src/components/IssueV1/components/SQLCheckSection/SQLCheckBadge.vue@@ -1,38 +1,39 @@<template>- <button- class="inline-flex items-center px-3 py-0.5 rounded-full text-sm border border-control-border"- :class="buttonClasses"+ <NTag+ :class="[clickable && 'cursor-pointer']"+ :type="tagType"+ :size="'small'"+ round@click="handleClick">- <template v-if="status === 'RUNNING'">- <TaskSpinner class="-ml-1 mr-1.5 h-4 w-4 text-info" />+ <template #icon>+ <template v-if="status === 'RUNNING'">+ <TaskSpinner class="h-4 w-4 text-info" />+ </template>+ <template v-else-if="status === 'SUCCESS'">+ <CheckIcon :size="16" />+ </template>+ <template v-else-if="status === 'WARNING'">+ <CircleAlertIcon :size="16" />+ </template>+ <template v-else-if="status === 'ERROR'">+ <ShieldXIcon :size="16" />+ </template></template>- <template v-else-if="status === 'SUCCESS'">- <heroicons-outline:check- class="-ml-1 mr-1.5 mt-0.5 h-4 w-4 text-success"- />- </template>- <template v-else-if="status === 'WARNING'">- <heroicons-outline:exclamation- class="-ml-1 mr-1.5 mt-0.5 h-4 w-4 text-warning"- />- </template>- <template v-else-if="status === 'ERROR'">- <span class="mr-1.5 font-medium text-error" aria-hidden="true"> ! </span>- </template>-<span>{{ $t("task.check-type.sql-review") }}</span>+ </NTag>- <SQLCheckPanel- v-if="showDetailPanel"- :database="database"- :advices="advices"- @close="showDetailPanel = false"- />- </button>+ <SQLCheckPanel+ v-if="showDetailPanel"+ :database="database"+ :advices="advices"+ @close="showDetailPanel = false"+ /></template><script setup lang="ts">+import { CheckIcon, CircleAlertIcon, ShieldXIcon } from "lucide-vue-next";+import { NTag } from "naive-ui";import { computed, ref } from "vue";import { SQLCheckPanel } from "@/components/SQLCheck";import type { Advice } from "@/types/proto/v1/sql_service";@@ -74,41 +75,19 @@ const clickable = computed(() => {return status.value === "ERROR" || status.value === "WARNING";});-const buttonClasses = computed(() => {- let bgColor = "";- let bgHoverColor = "";- let textColor = "";+const tagType = computed(() => {switch (status.value) {case "RUNNING":- bgColor = "bg-blue-100";- bgHoverColor = "bg-blue-300";- textColor = "text-blue-800";- break;+ return "info";case "SUCCESS":- bgColor = "bg-gray-100";- bgHoverColor = "bg-gray-300";- textColor = "text-gray-800";- break;+ return "success";case "WARNING":- bgColor = "bg-yellow-100";- bgHoverColor = "bg-yellow-300";- textColor = "text-yellow-800";- break;+ return "warning";case "ERROR":- bgColor = "bg-red-100";- bgHoverColor = "bg-red-300";- textColor = "text-red-800";- break;+ return "error";}-- const styleList: string[] = [textColor, bgColor];- if (clickable.value) {- styleList.push("cursor-pointer", `hover:${bgHoverColor}`);- } else {- styleList.push("cursor-default");- }-- return styleList.join(" ");+ // Should not reach here.+ return "default";});const handleClick = () => {diff --git a/frontend/src/components/IssueV1/components/SQLCheckSection/SQLCheckSection.vue b/frontend/src/components/IssueV1/components/SQLCheckSection/SQLCheckSection.vueindex c16a875c2d..849ac94cba 100644--- a/frontend/src/components/IssueV1/components/SQLCheckSection/SQLCheckSection.vue+++ b/frontend/src/components/IssueV1/components/SQLCheckSection/SQLCheckSection.vue@@ -18,19 +18,31 @@:show-code-location="true"@update:advices="$emit('update:advices', $event)">- <template #result="{ advices, isRunning }">- <template v-if="advices === undefined">- <span class="textinfolabel">- {{ $t("issue.sql-check.not-executed-yet") }}- </span>- </template>- <SQLCheckBadge v-else :is-running="isRunning" :advices="advices" />+ <template #result="{ affectedRows, advices, isRunning }">+ <span v-if="advices === undefined" class="textinfolabel">+ {{ $t("issue.sql-check.not-executed-yet") }}+ </span>+ <div v-else class="flex flex-row justify-start items-center gap-2">+ <SQLCheckBadge :is-running="isRunning" :advices="advices" />+ <NTooltip v-if="affectedRows && affectedRows > 0">+ <template #trigger>+ <NTag :size="'small'" round>+ <span class="opacity-80"+ >{{ $t("task.check-type.affected-rows.self") }}:+ </span>+ <span>{{ affectedRows }}</span>+ </NTag>+ </template>+ {{ $t("task.check-type.affected-rows.description") }}+ </NTooltip>+ </div></template></SQLCheckButton></div></template><script lang="ts" setup>+import { NTag, NTooltip } from "naive-ui";import { computed } from "vue";import {useIssueContext,diff --git a/frontend/src/components/IssueV1/components/Sidebar/GhostSection/GhostSection.vue b/frontend/src/components/IssueV1/components/Sidebar/GhostSection/GhostSection.vueindex eeb526d66a..d5b3c397ea 100644--- a/frontend/src/components/IssueV1/components/Sidebar/GhostSection/GhostSection.vue+++ b/frontend/src/components/IssueV1/components/Sidebar/GhostSection/GhostSection.vue@@ -64,7 +64,7 @@ import GhostFlagsPanel from "./GhostFlagsPanel.vue";import GhostSwitch from "./GhostSwitch.vue";import { allowGhostForTask, provideIssueGhostContext } from "./common";-const { isCreating, issue, selectedTask } = useIssueContext();+const { issue, selectedTask } = useIssueContext();const { viewType, showFeatureModal, showMissingInstanceLicense } =provideIssueGhostContext();@@ -80,11 +80,11 @@ const shouldShowGhostSection = computed(() => {return false;}- if (isCreating.value) {- return allowGhostForTask(issue.value, selectedTask.value);- } else {- return viewType.value !== "NONE";+ if (!allowGhostForTask(issue.value, selectedTask.value)) {+ return false;}++ return viewType.value !== "NONE";});const hasOnlineMigrationFeature = featureToRef("bb.feature.online-migration");diff --git a/frontend/src/components/SQLCheck/SQLCheckButton.vue b/frontend/src/components/SQLCheck/SQLCheckButton.vueindex b7a7d7a041..8cc318cbe5 100644--- a/frontend/src/components/SQLCheck/SQLCheckButton.vue+++ b/frontend/src/components/SQLCheck/SQLCheckButton.vue@@ -1,8 +1,14 @@<template><div class="flex flex-row items-center gap-2">- <slot name="result" :advices="filteredAdvices" :is-running="isRunning">+ <slot+ name="result"+ :is-running="isRunning"+ :advices="filteredAdvices"+ :affected-rows="checkResult?.affectedRows"+ :risk-level="checkResult?.riskLevel"+ ><SQLCheckSummary- v-if="filteredAdvices !== undefined && !isRunning"+ v-if="filteredAdvices && !isRunning":database="database":advices="filteredAdvices"@click="showDetailPanel = true"@@ -55,7 +61,7 @@</NPopover><SQLCheckPanel- v-if="filteredAdvices && showDetailPanel"+ v-if="checkResult && filteredAdvices && showDetailPanel":database="database":advices="filteredAdvices":affected-rows="checkResult.affectedRows"@@ -139,13 +145,11 @@ const showDetailPanel = ref(false);const allowForceContinue = ref(true);const context = useSQLCheckContext();const confirmDialog = ref<Defer<boolean>>();-const checkResult = ref<CheckReleaseResponse>(- CheckReleaseResponse.fromPartial({})-);+const checkResult = ref<CheckReleaseResponse | undefined>();const filteredAdvices = computed(() => {const { adviceFilter } = props;- const advices = checkResult.value.results.flatMap((r) => r.advices);+ const advices = checkResult.value?.results.flatMap((r) => r.advices);if (!adviceFilter) {return advices;}diff --git a/frontend/src/components/SQLCheck/SQLCheckPanel.vue b/frontend/src/components/SQLCheck/SQLCheckPanel.vueindex d836ca6b5e..9346d6125b 100644--- a/frontend/src/components/SQLCheck/SQLCheckPanel.vue+++ b/frontend/src/components/SQLCheck/SQLCheckPanel.vue@@ -4,6 +4,7 @@class="!w-[56rem]"header-class="whitespace-pre-wrap break-all gap-x-1"container-class="!pt-0 -mt-px"+ mask-closable@close="onClose"><div class="w-full flex flex-row gap-2 mb-2">