Skip to content

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

chore: unify check's status icons (#15318)

boojackd73e2c95ad19
diff --git a/frontend/src/components/IssueV1/components/SQLCheckSection/SQLCheckBadge.vue b/frontend/src/components/IssueV1/components/SQLCheckSection/SQLCheckBadge.vue
index 70cac146b8..3d03e089da 100644
--- a/frontend/src/components/IssueV1/components/SQLCheckSection/SQLCheckBadge.vue
+++ b/frontend/src/components/IssueV1/components/SQLCheckSection/SQLCheckBadge.vue
@@ -2,7 +2,6 @@
<NTag
:class="[clickable && 'cursor-pointer']"
:type="tagType"
- :size="'small'"
round
@click="handleClick"
>
@@ -11,13 +10,13 @@
<TaskSpinner class="h-4 w-4 text-info" />
</template>
<template v-else-if="status === 'SUCCESS'">
- <CheckIcon :size="16" />
+ <CheckIcon :size="16" class="text-success" />
</template>
<template v-else-if="status === 'WARNING'">
- <CircleAlertIcon :size="16" />
+ <TriangleAlertIcon :size="16" />
</template>
<template v-else-if="status === 'ERROR'">
- <ShieldXIcon :size="16" />
+ <CircleAlertIcon :size="16" />
</template>
</template>
<span>{{ $t("task.check-type.sql-review") }}</span>
@@ -32,7 +31,7 @@
</template>
<script setup lang="ts">
-import { CheckIcon, CircleAlertIcon, ShieldXIcon } from "lucide-vue-next";
+import { CheckIcon, TriangleAlertIcon, CircleAlertIcon } from "lucide-vue-next";
import { NTag } from "naive-ui";
import { computed, ref } from "vue";
import { SQLCheckPanel } from "@/components/SQLCheck";
@@ -77,10 +76,10 @@ const clickable = computed(() => {
const tagType = computed(() => {
switch (status.value) {
+ case "SUCCESS":
+ return "default";
case "RUNNING":
return "info";
- case "SUCCESS":
- return "success";
case "WARNING":
return "warning";
case "ERROR":
diff --git a/frontend/src/components/IssueV1/components/SQLCheckSection/SQLCheckSection.vue b/frontend/src/components/IssueV1/components/SQLCheckSection/SQLCheckSection.vue
index 849ac94cba..63dbd3a874 100644
--- a/frontend/src/components/IssueV1/components/SQLCheckSection/SQLCheckSection.vue
+++ b/frontend/src/components/IssueV1/components/SQLCheckSection/SQLCheckSection.vue
@@ -11,7 +11,7 @@
:database="database"
:change-type="changeType"
:button-props="{
- size: 'tiny',
+ size: 'small',
}"
button-style="--n-padding: 0 8px 0 6px; --n-icon-margin: 3px;"
class="justify-between flex-1"
@@ -26,7 +26,7 @@
<SQLCheckBadge :is-running="isRunning" :advices="advices" />
<NTooltip v-if="affectedRows && affectedRows > 0">
<template #trigger>
- <NTag :size="'small'" round>
+ <NTag round>
<span class="opacity-80"
>{{ $t("task.check-type.affected-rows.self") }}:
</span>
diff --git a/frontend/src/components/IssueV1/components/TaskStatusIcon.vue b/frontend/src/components/IssueV1/components/TaskStatusIcon.vue
index 59a6a4966d..da1b9429fa 100644
--- a/frontend/src/components/IssueV1/components/TaskStatusIcon.vue
+++ b/frontend/src/components/IssueV1/components/TaskStatusIcon.vue
@@ -4,12 +4,12 @@
:class="classes"
>
<template v-if="planCheckStatus === PlanCheckRun_Result_Status.ERROR">
- <heroicons:exclamation-circle class="w-7 h-7 text-error" />
+ <CircleAlertIcon class="text-error" />
</template>
<template
v-else-if="planCheckStatus === PlanCheckRun_Result_Status.WARNING"
>
- <heroicons:exclamation-triangle class="w-7 h-7 text-warning" />
+ <TriangleAlertIcon class="text-warning" />
</template>
<template
v-else-if="
@@ -57,6 +57,7 @@
</template>
<script lang="ts" setup>
+import { CircleAlertIcon, TriangleAlertIcon } from "lucide-vue-next";
import { computed } from "vue";
import { SkipIcon } from "@/components/Icon";
import { PlanCheckRun_Result_Status } from "@/types/proto/v1/plan_service";
@@ -81,11 +82,8 @@ const planCheckStatus = computed(() => {
});
const classes = computed((): string => {
- if (planCheckStatus.value === PlanCheckRun_Result_Status.ERROR) {
- return "bg-white text-error !w-7";
- }
- if (planCheckStatus.value === PlanCheckRun_Result_Status.WARNING) {
- return "bg-white text-warning !w-7";
+ if (Boolean(planCheckStatus.value)) {
+ return "";
}
switch (props.status) {
diff --git a/frontend/src/components/PlanCheckRun/PlanCheckRunBadge.vue b/frontend/src/components/PlanCheckRun/PlanCheckRunBadge.vue
index 7222b90f2f..12072b1399 100644
--- a/frontend/src/components/PlanCheckRun/PlanCheckRunBadge.vue
+++ b/frontend/src/components/PlanCheckRun/PlanCheckRunBadge.vue
@@ -1,42 +1,45 @@
<template>
- <button
- class="inline-flex items-center px-3 leading-6 rounded-full text-sm border"
- :class="buttonClasses"
+ <NTag
+ :class="[selected && 'shadow']"
+ :type="tagType"
+ round
+ :bordered="selected"
@click="clickable && $emit('click')"
>
- <template v-if="status === PlanCheckRun_Status.RUNNING">
- <TaskSpinner class="-ml-1 mr-1.5 h-4 w-4 text-info" />
- </template>
- <template v-else-if="status === PlanCheckRun_Status.DONE">
- <template v-if="resultStatus === PlanCheckRun_Result_Status.SUCCESS">
- <heroicons-outline:check
- class="-ml-1 mr-1.5 mt-0.5 h-4 w-4 text-success"
- />
+ <template #icon>
+ <template v-if="status === PlanCheckRun_Status.RUNNING">
+ <TaskSpinner class="h-4 w-4 text-info" />
</template>
- <template v-else-if="resultStatus === PlanCheckRun_Result_Status.WARNING">
- <heroicons-outline:exclamation
- class="-ml-1 mr-1.5 mt-0.5 h-4 w-4 text-warning"
+ <template v-else-if="status === PlanCheckRun_Status.DONE">
+ <CheckIcon
+ v-if="resultStatus === PlanCheckRun_Result_Status.SUCCESS"
+ class="text-success"
+ :size="16"
+ />
+ <TriangleAlertIcon
+ v-else-if="resultStatus === PlanCheckRun_Result_Status.WARNING"
+ :size="16"
+ />
+ <CircleAlertIcon
+ v-else-if="resultStatus === PlanCheckRun_Result_Status.ERROR"
+ :size="16"
/>
</template>
- <template v-else-if="resultStatus === PlanCheckRun_Result_Status.ERROR">
- <span class="mr-1.5 font-medium text-error" aria-hidden="true">
- !
- </span>
+ <template v-else-if="status === PlanCheckRun_Status.FAILED">
+ <CircleAlertIcon :size="16" />
+ </template>
+ <template v-else-if="status === PlanCheckRun_Status.CANCELED">
+ <TriangleAlertIcon :size="16" />
</template>
</template>
- <template v-else-if="status === PlanCheckRun_Status.FAILED">
- <span class="mr-1.5 font-medium text-error" aria-hidden="true"> ! </span>
- </template>
- <template v-else-if="status === PlanCheckRun_Status.CANCELED">
- <heroicons-outline:ban class="-ml-1 mr-1.5 mt-0.5 h-4 w-4 text-control" />
- </template>
-
- <span>{{ name }}</span>
- </button>
+ <span>{{ title }}</span>
+ </NTag>
</template>
<script setup lang="ts">
import { maxBy } from "lodash-es";
+import { CheckIcon, TriangleAlertIcon, CircleAlertIcon } from "lucide-vue-next";
+import { NTag } from "naive-ui";
import { computed } from "vue";
import { useI18n } from "vue-i18n";
import { TaskSpinner } from "@/components/IssueV1/components/common";
@@ -73,82 +76,50 @@ const status = computed(() => {
return latestPlanCheckRun.value.status;
});
-const resultStatus = computed(() => {
- return planCheckRunResultStatus(latestPlanCheckRun.value);
-});
-
-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 = "border-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;
+const tagType = computed(() => {
+ if (latestPlanCheckRun.value.status === PlanCheckRun_Status.FAILED) {
+ return "error";
+ }
+ if (latestPlanCheckRun.value.status === PlanCheckRun_Status.CANCELED) {
+ return "warning";
+ }
+ if (latestPlanCheckRun.value.status === PlanCheckRun_Status.RUNNING) {
+ return "info";
+ }
+ if (latestPlanCheckRun.value.status !== PlanCheckRun_Status.DONE) {
+ // Should not reach here.
+ return "default";
}
- const styleList: string[] = [textColor];
- if (props.clickable) {
- styleList.push("cursor-pointer");
- if (props.selected) {
- styleList.push("font-medium", borderColor);
- } else {
- styleList.push(bgColor, "hover:opacity-80", "border-transparent");
- }
- } else {
- styleList.push(bgColor);
- styleList.push("cursor-default");
+ switch (planCheckRunResultStatus(latestPlanCheckRun.value)) {
+ case PlanCheckRun_Result_Status.SUCCESS:
+ return "default";
+ case PlanCheckRun_Result_Status.WARNING:
+ return "warning";
+ case PlanCheckRun_Result_Status.ERROR:
+ return "error";
}
- styleList.push("cursor-pointer");
- styleList.push(bgColor);
+ // Should not reach here.
+ return "default";
+});
- return styleList.join(" ");
+const resultStatus = computed(() => {
+ return planCheckRunResultStatus(latestPlanCheckRun.value);
});
-const name = computed(() => {
+const title = computed(() => {
const { type } = latestPlanCheckRun.value;
switch (type) {
case PlanCheckRun_Type.DATABASE_STATEMENT_FAKE_ADVISE:
- return t('task.check-type.fake');
+ return t("task.check-type.fake");
case PlanCheckRun_Type.DATABASE_STATEMENT_ADVISE:
- return t('task.check-type.sql-review');
+ return t("task.check-type.sql-review");
case PlanCheckRun_Type.DATABASE_CONNECT:
- return t('task.check-type.connection');
+ return t("task.check-type.connection");
case PlanCheckRun_Type.DATABASE_GHOST_SYNC:
- return t('task.check-type.ghost-sync');
+ return t("task.check-type.ghost-sync");
case PlanCheckRun_Type.DATABASE_STATEMENT_SUMMARY_REPORT:
- return t('task.check-type.summary-report');
+ return t("task.check-type.summary-report");
default:
console.assert(false, `Missing PlanCheckType name of "${type}"`);
return type;
diff --git a/frontend/src/components/PlanCheckRun/PlanCheckRunBadgeBar.vue b/frontend/src/components/PlanCheckRun/PlanCheckRunBadgeBar.vue
index 11c24cf805..91891f3f86 100644
--- a/frontend/src/components/PlanCheckRun/PlanCheckRunBadgeBar.vue
+++ b/frontend/src/components/PlanCheckRun/PlanCheckRunBadgeBar.vue
@@ -15,8 +15,10 @@
<script lang="ts" setup>
import { orderBy } from "lodash-es";
import { computed } from "vue";
-import type { PlanCheckRun } from "@/types/proto/v1/plan_service";
-import { PlanCheckRun_Type } from "@/types/proto/v1/plan_service";
+import {
+ PlanCheckRun_Type,
+ type PlanCheckRun,
+} from "@/types/proto/v1/plan_service";
import { groupBy } from "@/utils/collections";
import PlanCheckRunBadge from "./PlanCheckRunBadge.vue";
diff --git a/frontend/src/components/PlanCheckRun/PlanCheckRunButton.vue b/frontend/src/components/PlanCheckRun/PlanCheckRunButton.vue
index 382edc7300..840a2a8ef0 100644
--- a/frontend/src/components/PlanCheckRun/PlanCheckRunButton.vue
+++ b/frontend/src/components/PlanCheckRun/PlanCheckRunButton.vue
@@ -1,34 +1,16 @@
<template>
- <ContextMenuButton
- v-if="actionList.length > 0"
- :action-list="actionList"
- :disabled="hasRunningPlanCheck"
- preference-key="issue.task.run-checks"
- default-action-key="RUN-CHECKS"
- @click="handleRunChecks"
- >
+ <NButton size="small" :loading="hasRunningPlanCheck" @click="handleRunChecks">
<template #icon>
- <BBSpin v-if="hasRunningPlanCheck" :size="16" />
- <PlayIcon v-else class="w-4 h-4" />
+ <PlayIcon />
</template>
- <template #default="{ action }">
- <template v-if="hasRunningPlanCheck">
- {{ $t("task.checking") }}
- </template>
- <template v-else>
- {{ action.text }}
- </template>
- </template>
- </ContextMenuButton>
+ {{ hasRunningPlanCheck ? $t("task.checking") : $t("task.run-checks") }}
+ </NButton>
</template>
<script setup lang="ts">
import { PlayIcon } from "lucide-vue-next";
+import { NButton } from "naive-ui";
import { computed } from "vue";
-import { useI18n } from "vue-i18n";
-import { BBSpin } from "@/bbkit";
-import type { ContextMenuButtonAction } from "@/components/v2";
-import { ContextMenuButton } from "@/components/v2";
import {
PlanCheckRun,
PlanCheckRun_Status,
@@ -42,18 +24,6 @@ const emit = defineEmits<{
(event: "run-checks"): void;
}>();
-const { t } = useI18n();
-
-const actionList = computed(() => {
- const actionList: ContextMenuButtonAction[] = [];
- actionList.push({
- key: "RUN-CHECKS",
- text: t("task.run-checks"),
- params: {},
- });
- return actionList;
-});
-
const hasRunningPlanCheck = computed((): boolean => {
return props.planCheckRunList.some(
(checkRun) => checkRun.status === PlanCheckRun_Status.RUNNING
diff --git a/frontend/src/components/WorkspaceInstanceLicenseStats.vue b/frontend/src/components/WorkspaceInstanceLicenseStats.vue
index 54d095ae52..124609e3ec 100644
--- a/frontend/src/components/WorkspaceInstanceLicenseStats.vue
+++ b/frontend/src/components/WorkspaceInstanceLicenseStats.vue
@@ -1,27 +1,32 @@
<template>
- <div v-if="subscriptionStore.currentPlan === PlanType.FREE" class="my-3">
+ <div class="my-3">
<dt class="text-main">
- {{ $t("subscription.max-instance-count") }}
+ {{
+ subscriptionStore.currentPlan === PlanType.FREE
+ ? $t("subscription.max-instance-count")
+ : $t("subscription.instance-assignment.used-and-total-license")
+ }}
</dt>
- <dd class="mt-1 text-4xl flex items-center gap-x-2 cursor-pointer group">
- <span class="group-hover:underline">
+ <div class="mt-1 text-4xl flex items-center gap-2">
+ <span v-if="subscriptionStore.currentPlan === PlanType.FREE">
{{ subscriptionStore.instanceCountLimit }}
</span>
- </dd>
- </div>
- <div v-else class="my-3">
- <dt class="text-main">
- {{ $t("subscription.instance-assignment.used-and-total-license") }}
- </dt>
- <dd
- class="mt-1 text-4xl flex items-center gap-x-2 cursor-pointer group"
- @click="state.showInstanceAssignmentDrawer = true"
- >
- <span class="group-hover:underline">{{ activateLicenseCount }}</span>
- <span class="text-xl">/</span>
- <span class="group-hover:underline">{{ totalLicenseCount }}</span>
- <heroicons-outline:pencil class="h-6 w-6" />
- </dd>
+ <template v-else>
+ <span
+ >{{ activateLicenseCount }}
+ <span class="font-mono text-gray-500">/</span>
+ {{ totalLicenseCount }}</span
+ >
+ <NButton text size="large">
+ <template #icon>
+ <PencilIcon
+ class="h-8 w-8"
+ @click="state.showInstanceAssignmentDrawer = true"
+ />
+ </template>
+ </NButton>
+ </template>
+ </div>
</div>
<InstanceAssignment
@@ -31,6 +36,8 @@
</template>
<script lang="ts" setup>
+import { PencilIcon } from "lucide-vue-next";
+import { NButton } from "naive-ui";
import { storeToRefs } from "pinia";
import { computed, reactive } from "vue";
import { useI18n } from "vue-i18n";
diff --git a/frontend/src/views/DashboardHeader.vue b/frontend/src/views/DashboardHeader.vue
index 2191bc27c0..a174101d6a 100644
--- a/frontend/src/views/DashboardHeader.vue
+++ b/frontend/src/views/DashboardHeader.vue
@@ -6,19 +6,6 @@
:redirect="WORKSPACE_ROUTE_LANDING"
/>
<ProjectSwitchPopover />
- <router-link
- :to="sqlEditorLink"
- class="flex flex-row justify-center items-center"
- exact-active-class=""
- target="_blank"
- >
- <NButton size="small">
- <template #icon>
- <SquareTerminalIcon class="w-4 h-auto" />
- </template>
- <span class="whitespace-nowrap">{{ $t("sql-editor.self") }}</span>
- </NButton>
- </router-link>
<div class="flex-1 flex justify-end items-center space-x-3">
<NButton
@@ -33,6 +20,20 @@
<span class="hidden lg:block">{{ $t("common.want-help") }}</span>
</NButton>
+ <router-link
+ :to="sqlEditorLink"
+ class="flex flex-row justify-center items-center"
+ exact-active-class=""
+ target="_blank"
+ >
+ <NButton size="small">
+ <template #icon>
+ <SquareTerminalIcon class="w-4 h-auto" />
+ </template>
+ <span class="whitespace-nowrap">{{ $t("sql-editor.self") }}</span>
+ </NButton>
+ </router-link>
+
<NTooltip :disabled="windowWidth >= 640">
<template #trigger>
<router-link :to="myIssueLink" class="flex">
diff --git a/frontend/src/views/SettingWorkspaceSubscription.vue b/frontend/src/views/SettingWorkspaceSubscription.vue
index a79150bfe2..e9f83405b1 100644
--- a/frontend/src/views/SettingWorkspaceSubscription.vue
+++ b/frontend/src/views/SettingWorkspaceSubscription.vue
@@ -1,7 +1,7 @@
<template>
- <div class="mx-auto">
- <dl class="text-left grid grid-cols-2 gap-x-6 my-4 xl:grid-cols-4">
- <div class="my-3">
+ <div class="w-full mx-auto">
+ <div class="w-full grid grid-cols-2 gap-x-6 lg:grid-cols-3 my-4">
+ <dl class="flex flex-col text-left">
<dt class="flex text-main">
{{ $t("subscription.current") }}
<span
@@ -17,28 +17,26 @@
{{ $t("subscription.trialing") }}
</span>
</dt>
- <dd class="text-indigo-600 mt-1 text-4xl">
- <div>
- {{ currentPlan }}
- </div>
+ <dd class="text-indigo-600 mt-1 text-3xl lg:text-4xl">
+ {{ currentPlan }}
</dd>
- </div>
- </dl>
- <dl class="text-left grid grid-cols-2 gap-x-6 my-4 xl:grid-cols-4">
- <WorkspaceInstanceLicenseStats v-if="allowManageInstanceLicenses" />
- <div v-if="!subscriptionStore.isFreePlan" class="my-3">
+ </dl>
+ <dl v-if="!subscriptionStore.isFreePlan" class="my-3">
<dt class="text-main">
{{ $t("subscription.expires-at") }}
</dt>
- <dd class="mt-1 text-4xl">{{ expireAt || "n/a" }}</dd>
- </div>
- <div v-if="subscriptionStore.canTrial && allowEdit" class="my-3">
+ <dd class="mt-1 text-3xl lg:text-4xl">{{ expireAt || "N/A" }}</dd>
+ </dl>
+ <dl v-if="subscriptionStore.canTrial && allowEdit" class="my-3">
<dt class="text-main">
{{ $t("subscription.try-for-free") }}
</dt>
-
<dd class="mt-1">
- <NButton type="primary" @click="state.showTrialModal = true">
+ <NButton
+ type="primary"
+ size="large"
+ @click="state.showTrialModal = true"
+ >
{{
$t("subscription.enterprise-free-trial", {
days: subscriptionStore.trialingDays,
@@ -46,8 +44,8 @@
}}
</NButton>
</dd>
- </div>
- <div
+ </dl>
+ <dl
v-if="
subscriptionStore.isTrialing &&
subscriptionStore.currentPlan == PlanType.ENTERPRISE
@@ -57,14 +55,16 @@
<dt class="text-main">
{{ $t("subscription.inquire-enterprise-plan") }}
</dt>
-
<dd class="mt-1 ml-auto">
- <NButton type="primary" @click="inquireEnterprise">
+ <NButton type="primary" size="large" @click="inquireEnterprise">
{{ $t("subscription.contact-us") }}
</NButton>
</dd>
- </div>
- </dl>
+ </dl>
+ </div>
+ <div class="text-left grid grid-cols-2 gap-x-6 my-4 xl:grid-cols-3">
+ <WorkspaceInstanceLicenseStats v-if="allowManageInstanceLicenses" />
+ </div>
<NDivider />
<div>
<label class="flex items-center gap-x-2">