Skip to content

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

chore: fix and unify ui (#17840)

ecmadao98ba6ec50fbd
diff --git a/frontend/src/bbkit/BBAttention.vue b/frontend/src/bbkit/BBAttention.vue
index ce1931fa25..290918185a 100644
--- a/frontend/src/bbkit/BBAttention.vue
+++ b/frontend/src/bbkit/BBAttention.vue
@@ -7,7 +7,7 @@
<div v-if="description" class="text-sm">
<p class="whitespace-pre-wrap">
{{ $te(description) ? $t(description) : description }}
- <LearnMoreLink v-if="link" :url="link" class="ml-1 text-sm" />
+ <LearnMoreLink :url="link" class="ml-1 text-sm" />
</p>
</div>
</slot>
diff --git a/frontend/src/components/Changelist/ChangelistDetail/DeleteChangelistButton.vue b/frontend/src/components/Changelist/ChangelistDetail/DeleteChangelistButton.vue
index bd6690e8e5..d1e8a358a8 100644
--- a/frontend/src/components/Changelist/ChangelistDetail/DeleteChangelistButton.vue
+++ b/frontend/src/components/Changelist/ChangelistDetail/DeleteChangelistButton.vue
@@ -6,6 +6,7 @@
<NButton
quaternary
size="small"
+ type="error"
style="--n-padding: 0 6px"
:disabled="errors.length > 0"
@click.stop
diff --git a/frontend/src/components/CustomApproval/Settings/components/CustomApproval/FlowsPanel/FlowTable.vue b/frontend/src/components/CustomApproval/Settings/components/CustomApproval/FlowsPanel/FlowTable.vue
index 0ce02a58d7..ee9634d7c0 100644
--- a/frontend/src/components/CustomApproval/Settings/components/CustomApproval/FlowsPanel/FlowTable.vue
+++ b/frontend/src/components/CustomApproval/Settings/components/CustomApproval/FlowsPanel/FlowTable.vue
@@ -2,12 +2,12 @@
<div class="space-y-6">
<!-- Built-in Flows Section -->
<div class="space-y-2">
- <div class="flex items-center justify-between">
+ <div>
<h3 class="text-base font-medium">
{{ $t("custom-approval.approval-flow.built-in") }}
</h3>
- <span class="text-sm text-control-light">
- {{ $t("common.read-only") }}
+ <span class="textinfolabel">
+ {{ $t("custom-approval.approval-flow.built-in-description") }}
</span>
</div>
<NDataTable
@@ -198,6 +198,7 @@ const customColumns = computed((): DataTableColumn<LocalApprovalRule>[] => {
{allowAdmin.value && (
<SpinnerButton
size="small"
+ type="error"
tooltip={t("custom-approval.approval-flow.delete")}
onConfirm={() => deleteRule(rule)}
>
diff --git a/frontend/src/components/CustomApproval/Settings/components/RiskCenter/RiskTable.vue b/frontend/src/components/CustomApproval/Settings/components/RiskCenter/RiskTable.vue
index 5b1cccd8eb..72684f5589 100644
--- a/frontend/src/components/CustomApproval/Settings/components/RiskCenter/RiskTable.vue
+++ b/frontend/src/components/CustomApproval/Settings/components/RiskCenter/RiskTable.vue
@@ -65,6 +65,7 @@ const columns = computed((): DataTableColumn<Risk>[] => {
</NButton>
{allowDeleteRisk.value && (
<SpinnerButton
+ type="error"
size="small"
tooltip={t("custom-approval.risk-rule.delete")}
onConfirm={() => deleteRisk(risk)}
diff --git a/frontend/src/components/DatabaseGroup/DatabaseGroupForm.vue b/frontend/src/components/DatabaseGroup/DatabaseGroupForm.vue
index 9e4f7df866..2cfcd41c1a 100644
--- a/frontend/src/components/DatabaseGroup/DatabaseGroupForm.vue
+++ b/frontend/src/components/DatabaseGroup/DatabaseGroupForm.vue
@@ -44,7 +44,7 @@
<div
class="flex justify-between w-full pt-4 border-t border-block-border bg-white"
>
- <NButton v-if="!isCreating" text @click="doDelete">
+ <NButton v-if="!isCreating" type="error" text @click="doDelete">
<template #icon>
<Trash2Icon class="w-4 h-auto" />
</template>
diff --git a/frontend/src/components/EnvironmentForm/EnvironmentForm.vue b/frontend/src/components/EnvironmentForm/EnvironmentForm.vue
index 8b17a664e7..93c7012412 100644
--- a/frontend/src/components/EnvironmentForm/EnvironmentForm.vue
+++ b/frontend/src/components/EnvironmentForm/EnvironmentForm.vue
@@ -10,7 +10,7 @@
<script lang="ts" setup>
import { useEventListener } from "@vueuse/core";
-import { toRef } from "vue";
+import { toRef, computed } from "vue";
import { useI18n } from "vue-i18n";
import { onBeforeRouteLeave } from "vue-router";
import { useEmitteryEventListener } from "@/composables/useEmitteryEventListener";
@@ -62,8 +62,12 @@ const context = provideEnvironmentFormContext({
});
const { valueChanged, events, missingFeature } = context;
+const isEditing = computed(() => {
+ return !props.create && valueChanged();
+});
+
useEventListener("beforeunload", (e) => {
- if (props.create || !valueChanged()) {
+ if (!isEditing.value) {
return;
}
e.returnValue = t("common.leave-without-saving");
@@ -71,7 +75,7 @@ useEventListener("beforeunload", (e) => {
});
onBeforeRouteLeave((to, from, next) => {
- if (!props.create && valueChanged()) {
+ if (isEditing.value) {
if (!window.confirm(t("common.leave-without-saving"))) {
return;
}
@@ -110,4 +114,8 @@ useEmitteryEventListener(events, "delete", (environment) => {
useEmitteryEventListener(events, "cancel", () => {
emit("cancel");
});
+
+defineExpose({
+ isEditing,
+});
</script>
diff --git a/frontend/src/components/GeneralSetting/BrandingSetting.vue b/frontend/src/components/GeneralSetting/BrandingSetting.vue
index b04ff66ec0..0f3f024682 100644
--- a/frontend/src/components/GeneralSetting/BrandingSetting.vue
+++ b/frontend/src/components/GeneralSetting/BrandingSetting.vue
@@ -46,6 +46,8 @@
<div class="flex justify-end gap-x-3">
<NButton
v-if="allowEdit && !!state.logoUrl"
+ secondary
+ type="error"
@click="() => (state.logoUrl = '')"
>
{{ $t("common.delete") }}
diff --git a/frontend/src/components/IdentityProvider/IdentityProviderEditForm.vue b/frontend/src/components/IdentityProvider/IdentityProviderEditForm.vue
index 5f92a92b09..ff0c88ce12 100644
--- a/frontend/src/components/IdentityProvider/IdentityProviderEditForm.vue
+++ b/frontend/src/components/IdentityProvider/IdentityProviderEditForm.vue
@@ -200,7 +200,7 @@
<div class="flex flex-row justify-between items-center">
<div class="space-x-4 flex flex-row justify-start items-center">
<BBButtonConfirm
- :type="'ARCHIVE'"
+ :type="'DELETE'"
:button-text="$t('settings.sso.delete')"
:ok-text="$t('common.delete')"
:confirm-title="$t('settings.sso.delete')"
diff --git a/frontend/src/components/InstanceForm/DataSourceSection/CredentialSourceForm.vue b/frontend/src/components/InstanceForm/DataSourceSection/CredentialSourceForm.vue
index 3d07d537cd..797d937d9e 100644
--- a/frontend/src/components/InstanceForm/DataSourceSection/CredentialSourceForm.vue
+++ b/frontend/src/components/InstanceForm/DataSourceSection/CredentialSourceForm.vue
@@ -123,7 +123,7 @@
"
class="mt-2 w-full"
:disabled="!allowEdit"
- :placeholder="$t('common.write-only')"
+ :placeholder="$t('common.sensitive-placeholder')"
@update:value="
(val) => {
if (dataSource.iamExtension?.case === 'awsCredential') {
@@ -142,7 +142,7 @@
"
class="mt-2 w-full"
:disabled="!allowEdit"
- :placeholder="$t('common.write-only')"
+ :placeholder="$t('common.sensitive-placeholder')"
@update:value="
(val) => {
if (dataSource.iamExtension?.case === 'awsCredential') {
@@ -161,7 +161,7 @@
"
class="mt-2 w-full"
:disabled="!allowEdit"
- :placeholder="$t('common.write-only')"
+ :placeholder="$t('common.sensitive-placeholder')"
@update:value="
(val) => {
if (dataSource.iamExtension?.case === 'awsCredential') {
diff --git a/frontend/src/components/InstanceForm/DataSourceSection/SshConnectionForm.vue b/frontend/src/components/InstanceForm/DataSourceSection/SshConnectionForm.vue
index 07db51ccb9..fa5e3b9c93 100644
--- a/frontend/src/components/InstanceForm/DataSourceSection/SshConnectionForm.vue
+++ b/frontend/src/components/InstanceForm/DataSourceSection/SshConnectionForm.vue
@@ -78,7 +78,7 @@
v-model:value="state.value.sshPrivateKey"
:resizable="false"
:disabled="disabled"
- :placeholder="$t('common.write-only')"
+ :placeholder="$t('common.sensitive-placeholder')"
class="w-full h-24 mt-2 whitespace-pre-wrap"
/>
</div>
diff --git a/frontend/src/components/LearnMoreLink.vue b/frontend/src/components/LearnMoreLink.vue
index eadfa55528..9aeb8d2b96 100644
--- a/frontend/src/components/LearnMoreLink.vue
+++ b/frontend/src/components/LearnMoreLink.vue
@@ -1,27 +1,32 @@
<template>
<a
+ v-if="url"
class="inline-flex items-center"
:class="[color === 'normal' ? 'normal-link' : 'light-link']"
:href="url"
:target="external ? '__BLANK' : ''"
>
- {{ $t("common.learn-more") }}
+ {{ text }}
<ExternalLinkIcon v-if="external" class="w-4 h-4 ml-1" />
</a>
</template>
<script lang="ts" setup>
import { ExternalLinkIcon } from "lucide-vue-next";
+import { computed } from "vue";
+import { t } from "@/plugins/i18n";
-withDefaults(
+const props = withDefaults(
defineProps<{
url: string;
- external?: boolean;
+ text?: string;
color?: "normal" | "light";
}>(),
{
color: "normal",
- external: true,
+ text: () => t("common.learn-more"),
}
);
+
+const external = computed(() => props.url.startsWith("http"));
</script>
diff --git a/frontend/src/components/ProjectMember/ProjectMemberRolePanel/index.vue b/frontend/src/components/ProjectMember/ProjectMemberRolePanel/index.vue
index 349d444c57..6ef0c6b2e2 100644
--- a/frontend/src/components/ProjectMember/ProjectMemberRolePanel/index.vue
+++ b/frontend/src/components/ProjectMember/ProjectMemberRolePanel/index.vue
@@ -397,6 +397,7 @@ const handleDeleteRole = (role: string) => {
user: props.binding.title,
});
dialog.create({
+ type: "error",
title: title,
content: t("common.cannot-undo-this-action"),
positiveText: t("common.revoke"),
@@ -450,6 +451,7 @@ const handleDeleteCondition = async (
dialog.create({
title: title,
+ type: "error",
content: t("common.cannot-undo-this-action"),
positiveText: t("common.revoke"),
negativeText: t("common.cancel"),
diff --git a/frontend/src/components/Revision/RevisionDataTable.vue b/frontend/src/components/Revision/RevisionDataTable.vue
index 032c348f35..cd329e37d6 100644
--- a/frontend/src/components/Revision/RevisionDataTable.vue
+++ b/frontend/src/components/Revision/RevisionDataTable.vue
@@ -17,7 +17,7 @@
v-if="state.selectedRevisionNameList.size > 0"
class="sticky w-full flex items-center gap-x-2"
>
- <NButton size="small" quaternary @click="onDelete">
+ <NButton size="small" type="error" quaternary @click="onDelete">
<template #icon>
<TrashIcon class="w-4 h-auto" />
</template>
diff --git a/frontend/src/components/Role/Setting/components/RoleDataTable/cells/RoleOperationsCell.vue b/frontend/src/components/Role/Setting/components/RoleDataTable/cells/RoleOperationsCell.vue
index e2ae87b7d6..aa1bdb6df6 100644
--- a/frontend/src/components/Role/Setting/components/RoleDataTable/cells/RoleOperationsCell.vue
+++ b/frontend/src/components/Role/Setting/components/RoleDataTable/cells/RoleOperationsCell.vue
@@ -4,7 +4,12 @@
{{ $t("common.edit") }}
</NButton>
- <NButton v-if="allowDelete" size="tiny" @click="handleDeleteRole">
+ <NButton
+ v-if="allowDelete"
+ size="tiny"
+ type="error"
+ @click="handleDeleteRole"
+ >
{{ $t("common.delete") }}
</NButton>
</div>
diff --git a/frontend/src/components/SQLReview/components/SQLReviewPolicyTable.vue b/frontend/src/components/SQLReview/components/SQLReviewPolicyTable.vue
index 13ffe2672f..9e609559d7 100644
--- a/frontend/src/components/SQLReview/components/SQLReviewPolicyTable.vue
+++ b/frontend/src/components/SQLReview/components/SQLReviewPolicyTable.vue
@@ -1,6 +1,6 @@
<template>
<div>
- <div class="hidden md:grid">
+ <div class="hidden lg:grid">
<SQLReviewPolicyDataTable
:review-list="reviewList"
:filter="filter"
@@ -11,7 +11,7 @@
</div>
<div
- class="flex flex-col md:hidden border px-2 pb-4 divide-y space-y-4 divide-block-border"
+ class="flex flex-col lg:hidden border px-2 pb-4 divide-y space-y-4 divide-block-border"
>
<div
v-for="(review, i) in reviewList"
diff --git a/frontend/src/components/SchemaTemplate/FieldTemplateTable.vue b/frontend/src/components/SchemaTemplate/FieldTemplateTable.vue
index 2d8f23638f..3d2c62d4b4 100644
--- a/frontend/src/components/SchemaTemplate/FieldTemplateTable.vue
+++ b/frontend/src/components/SchemaTemplate/FieldTemplateTable.vue
@@ -134,6 +134,7 @@ const columns = computed(
{{
trigger: () => (
<MiniActionButton
+ type="error"
onClick={(e: MouseEvent) => e.stopPropagation()}
>
<TrashIcon class="w-4 h-4" />
diff --git a/frontend/src/components/SchemaTemplate/TableTemplateTable.vue b/frontend/src/components/SchemaTemplate/TableTemplateTable.vue
index 8262568c8c..5e6830843b 100644
--- a/frontend/src/components/SchemaTemplate/TableTemplateTable.vue
+++ b/frontend/src/components/SchemaTemplate/TableTemplateTable.vue
@@ -102,6 +102,7 @@ const columns = computed(
{{
trigger: () => (
<MiniActionButton
+ type="error"
onClick={(e: MouseEvent) => e.stopPropagation()}
>
<TrashIcon class="w-4 h-4" />
diff --git a/frontend/src/components/SensitiveData/components/MaskingRuleConfig.vue b/frontend/src/components/SensitiveData/components/MaskingRuleConfig.vue
index 91920a2c2d..f447c7123d 100644
--- a/frontend/src/components/SensitiveData/components/MaskingRuleConfig.vue
+++ b/frontend/src/components/SensitiveData/components/MaskingRuleConfig.vue
@@ -50,6 +50,7 @@
<template #trigger>
<NButton
quaternary
+ type="error"
tag="div"
style="--n-padding: 0 6px; --n-icon-margin: 4px"
:disabled="disabled"
diff --git a/frontend/src/components/SensitiveData/components/SemanticTypesTable.vue b/frontend/src/components/SensitiveData/components/SemanticTypesTable.vue
index bdb12fd13a..f2562bbe36 100644
--- a/frontend/src/components/SensitiveData/components/SemanticTypesTable.vue
+++ b/frontend/src/components/SensitiveData/components/SemanticTypesTable.vue
@@ -34,7 +34,7 @@ import {
Undo2Icon,
InfoIcon,
} from "lucide-vue-next";
-import { NPopconfirm, NInput, NDataTable, NTooltip, NEllipsis } from "naive-ui";
+import { NPopconfirm, NInput, NDataTable, NTooltip } from "naive-ui";
import type { DataTableColumn } from "naive-ui";
import { computed, reactive } from "vue";
import { useI18n } from "vue-i18n";
@@ -151,11 +151,11 @@ const columnList = computed(() => {
{
key: "id",
title: "ID",
- ellipsis: true,
resizable: true,
- render: (item) => {
- return <NEllipsis class="break-normal">{item.item.id}</NEllipsis>;
+ ellipsis: {
+ tooltip: true,
},
+ render: (item) => item.item.id,
},
{
key: "title",
@@ -185,10 +185,13 @@ const columnList = computed(() => {
key: "description",
title: t("settings.sensitive-data.semantic-types.table.description"),
resizable: true,
+ ellipsis: {
+ tooltip: true,
+ },
width: "minmax(min-content, auto)",
render: (item, row) => {
if (item.mode === "NORMAL") {
- return <h3>{item.item.description}</h3>;
+ return item.item.description;
}
return (
<NInput
@@ -271,7 +274,7 @@ const columnList = computed(() => {
{{
trigger: () => {
return (
- <MiniActionButton>
+ <MiniActionButton type="error">
<TrashIcon class="w-4 h-4" />
</MiniActionButton>
);
@@ -287,13 +290,18 @@ const columnList = computed(() => {
}
return (
- <div>
+ <div class="flex gap-x-2">
+ {item.mode !== "NORMAL" && (
+ <MiniActionButton onClick={() => emit("cancel", row)}>
+ <Undo2Icon class="w-4 h-4" />
+ </MiniActionButton>
+ )}
{item.mode === "EDIT" && (
<NPopconfirm onPositiveClick={() => emit("remove", row)}>
{{
trigger: () => {
return (
- <MiniActionButton>
+ <MiniActionButton type="error">
<TrashIcon class="w-4 h-4" />
</MiniActionButton>
);
@@ -306,11 +314,6 @@ const columnList = computed(() => {
}}
</NPopconfirm>
)}
- {item.mode !== "NORMAL" && (
- <MiniActionButton onClick={() => emit("cancel", row)}>
- <Undo2Icon class="w-4 h-4" />
- </MiniActionButton>
- )}
{item.mode !== "NORMAL" && (
<MiniActionButton
type={"primary"}
diff --git a/frontend/src/components/User/Settings/AADSyncDrawer.vue b/frontend/src/components/User/Settings/AADSyncDrawer.vue
index 8d2860c711..fc719b8ea3 100644
--- a/frontend/src/components/User/Settings/AADSyncDrawer.vue
+++ b/frontend/src/components/User/Settings/AADSyncDrawer.vue
@@ -37,6 +37,10 @@
</div>
<div class="text-sm text-gray-400">
{{ $t(`settings.members.entra-sync.endpoint-tip`) }}
+ <LearnMoreLink
+ url="https://aka.ms/MSEntraPortal"
+ :text="$t('settings.members.entra-sync.goto-entra-dashboard')"
+ />
</div>
</div>
<div class="flex space-x-2">
@@ -45,6 +49,7 @@
class="w-full"
readonly
:value="scimUrl"
+ :placeholder="$t('banner.external-url')"
@click="handleSelect(scimUrlFieldRef)"
/>
<CopyButton
@@ -65,6 +70,10 @@
</div>
<div class="text-sm text-gray-400">
{{ $t("settings.members.entra-sync.secret-token-tip") }}
+ <LearnMoreLink
+ url="https://aka.ms/MSEntraPortal"
+ :text="$t('settings.members.entra-sync.goto-entra-dashboard')"
+ />
</div>
</div>
<div class="flex space-x-2">
diff --git a/frontend/src/components/User/Settings/RemoveGroupButton.vue b/frontend/src/components/User/Settings/RemoveGroupButton.vue
index 7de4371ad3..a6dc8de3a1 100644
--- a/frontend/src/components/User/Settings/RemoveGroupButton.vue
+++ b/frontend/src/components/User/Settings/RemoveGroupButton.vue
@@ -3,6 +3,7 @@
v-if="allowDelete"
quaternary
size="small"
+ type="error"
@click="handleDeleteGroup"
>
<template #icon>
diff --git a/frontend/src/components/v2/Button/CopyButton.vue b/frontend/src/components/v2/Button/CopyButton.vue
index 28bbd34f33..dd8858b4f6 100644
--- a/frontend/src/components/v2/Button/CopyButton.vue
+++ b/frontend/src/components/v2/Button/CopyButton.vue
@@ -1,10 +1,10 @@
<template>
<NButton
- v-if="isSupported && !isEmpty"
+ v-if="isSupported"
v-bind="$attrs"
:text="text"
:size="size"
- :disabled="disabled"
+ :disabled="disabled || isEmpty"
@click="handleCopy"
>
<template #icon>
diff --git a/frontend/src/components/v2/Button/DeleteConfirmButton.vue b/frontend/src/components/v2/Button/DeleteConfirmButton.vue
index 7c7511cc86..aa3197bfe3 100644
--- a/frontend/src/components/v2/Button/DeleteConfirmButton.vue
+++ b/frontend/src/components/v2/Button/DeleteConfirmButton.vue
@@ -1,7 +1,13 @@
<template>
<NPopconfirm @positive-click="handleDelete">
<template #trigger>
- <NButton quaternary size="small" style="--n-padding: 0 6px" @click.stop>
+ <NButton
+ type="error"
+ quaternary
+ size="small"
+ style="--n-padding: 0 6px"
+ @click.stop
+ >
<template #icon>
<heroicons:trash />
</template>
diff --git a/frontend/src/components/v2/Model/DatabaseV1Table/DatabaseV1Table.vue b/frontend/src/components/v2/Model/DatabaseV1Table/DatabaseV1Table.vue
index 51a46b6547..b5ad050a4f 100644
--- a/frontend/src/components/v2/Model/DatabaseV1Table/DatabaseV1Table.vue
+++ b/frontend/src/components/v2/Model/DatabaseV1Table/DatabaseV1Table.vue
@@ -130,6 +130,7 @@ const columnList = computed((): DatabaseDataTableColumn[] => {
key: "project",
title: t("common.project"),
resizable: true,
+ ellipsis: true,
render: (data) => (
<ProjectNameCell
project={data.projectEntity}
@@ -150,6 +151,9 @@ const columnList = computed((): DatabaseDataTableColumn[] => {
key: "address",
title: t("common.address"),
resizable: true,
+ ellipsis: {
+ tooltip: true,
+ },
render: (data) => hostPortOfInstanceV1(data.instanceResource),
};
const DATABASE_LABELS: DatabaseDataTableColumn = {
diff --git a/frontend/src/components/v2/Model/ProjectV1Table.vue b/frontend/src/components/v2/Model/ProjectV1Table.vue
index 85ecaa683e..a3926a0782 100644
--- a/frontend/src/components/v2/Model/ProjectV1Table.vue
+++ b/frontend/src/components/v2/Model/ProjectV1Table.vue
@@ -118,7 +118,9 @@ const columnList = computed((): ProjectDataTableColumn[] => {
title: t("common.id"),
width: 128,
resizable: true,
- ellipsis: true,
+ ellipsis: {
+ tooltip: true,
+ },
render: (project) => {
return (
<HighlightLabelText
@@ -133,11 +135,7 @@ const columnList = computed((): ProjectDataTableColumn[] => {
resizable: true,
title: t("project.table.name"),
render: (project) => (
- <ProjectNameCell
- mode="ALL_SHORT"
- project={project}
- keyword={props.keyword}
- />
+ <ProjectNameCell project={project} keyword={props.keyword} />
),
},
{
diff --git a/frontend/src/components/v2/Model/cells/ProjectNameCell.vue b/frontend/src/components/v2/Model/cells/ProjectNameCell.vue
index b1f3e0ccf8..a3769ad48f 100644
--- a/frontend/src/components/v2/Model/cells/ProjectNameCell.vue
+++ b/frontend/src/components/v2/Model/cells/ProjectNameCell.vue
@@ -1,6 +1,7 @@
<template>
<div class="flex flex-row space-x-2 items-center">
<ProjectV1Name
+ class="flex-1 max-w-full"
:project="project"
:link="link"
tag="div"
diff --git a/frontend/src/locales/en-US.json b/frontend/src/locales/en-US.json
index af26163fad..2032da5d3c 100644
--- a/frontend/src/locales/en-US.json
+++ b/frontend/src/locales/en-US.json
@@ -449,11 +449,12 @@
"self": "Sync from Entra ID (Azure AD)",
"description": "Sync users and groups from Entra ID (formerly Azure AD) to your Bytebase instance.",
"endpoint": "Endpoint",
- "endpoint-tip": "Paste this to the \"Tenant URL\" field in Entra. Entra will sync users and groups to Bytebase via this endpoint.",
+ "endpoint-tip": "Entra will sync users and groups to Bytebase via this endpoint. Paste this to the \"Tenant URL\" field in Entra.",
"secret-token": "Secret Token",
"secret-token-tip": "Paste this to the \"Secret Token\" field in Entra.",
"reset-token": "Reset token",
- "reset-token-warning": "You need to update the Entra application provisioning config."
+ "reset-token-warning": "You need to update the Entra application provisioning config.",
+ "goto-entra-dashboard": "Go to Entra Dashboard"
},
"all-users": "All users",
"search-member": "Search member",
@@ -2616,6 +2617,7 @@
"create-approval-flow": "Create approval flow",
"edit-approval-flow": "Edit approval flow",
"built-in": "Built-in Flows",
+ "built-in-description": "Built-in flows are read-only and cannot be deleted.",
"custom": "Custom Flows",
"no-custom-flows": "No custom approval flows created yet. Click 'Create Flow' to add one.",
"node": {
diff --git a/frontend/src/locales/es-ES.json b/frontend/src/locales/es-ES.json
index c9af629fe8..d0d3c23d18 100644
--- a/frontend/src/locales/es-ES.json
+++ b/frontend/src/locales/es-ES.json
@@ -453,7 +453,8 @@
"secret-token": "Secret Token",
"secret-token-tip": "Pegue esto en el campo \"Secret Token\" en Entra.",
"reset-token": "Restablecer token",
- "reset-token-warning": "Debe actualizar la configuración de aprovisionamiento de aplicaciones de Entra."
+ "reset-token-warning": "Debe actualizar la configuración de aprovisionamiento de aplicaciones de Entra.",
+ "goto-entra-dashboard": "Ir al panel de control de Entra"
},
"all-users": "Todos los usuarios",
"search-member": "Buscar miembro",
@@ -2616,6 +2617,7 @@
"create-approval-flow": "Crear flujo de aprobación",
"edit-approval-flow": "Editar flujo de aprobación",
"built-in": "Flujos Integrados",
+ "built-in-description": "Los flujos integrados son de solo lectura y no se pueden eliminar.",
"custom": "Flujos Personalizados",
"no-custom-flows": "Aún no se han creado flujos de aprobación personalizados. Haga clic en 'Crear Flujo' para agregar uno.",
"node": {
diff --git a/frontend/src/locales/ja-JP.json b/frontend/src/locales/ja-JP.json
index 4a0bd4eaf1..dc02bfaef9 100644
--- a/frontend/src/locales/ja-JP.json
+++ b/frontend/src/locales/ja-JP.json
@@ -453,7 +453,8 @@
"secret-token": "Secret Token",
"secret-token-tip": "これを Entra の「Secret Token」フィールドに貼り付けます。",
"reset-token": "トークンをリセット",
- "reset-token-warning": "Entra アプリケーションのプロビジョニング設定を更新する必要があります。"
+ "reset-token-warning": "Entra アプリケーションのプロビジョニング設定を更新する必要があります。",
+ "goto-entra-dashboard": "Entraダッシュボードへ"
},
"all-users": "すべてのユーザー",
"search-member": "メンバーを検索",
@@ -2616,6 +2617,7 @@
"create-approval-flow": "承認フローの作成",
"edit-approval-flow": "承認フローの編集",
"built-in": "組み込み承認フロー",
+ "built-in-description": "組み込みフローは読み取り専用であり、削除できません。",
"custom": "カスタム承認フロー",
"no-custom-flows": "カスタム承認フローがまだ作成されていません。「承認フローを作成」をクリックして追加してください。",
"node": {
diff --git a/frontend/src/locales/vi-VN.json b/frontend/src/locales/vi-VN.json
index ccd83af8c5..d2f7b9c1b0 100644
--- a/frontend/src/locales/vi-VN.json
+++ b/frontend/src/locales/vi-VN.json
@@ -453,7 +453,8 @@
"secret-token": "Mã thông báo bí mật",
"secret-token-tip": "Dán vào trường \"Secret Token\" trong Entra.",
"reset-token": "Đặt lại mã thông báo",
- "reset-token-warning": "Bạn cần cập nhật cấu hình cung cấp ứng dụng Entra."
+ "reset-token-warning": "Bạn cần cập nhật cấu hình cung cấp ứng dụng Entra.",
+ "goto-entra-dashboard": "Đi tới Bảng điều khiển Entra"
},
"all-users": "Tất cả người dùng",
"search-member": "Tìm kiếm thành viên",
@@ -2616,6 +2617,7 @@
"create-approval-flow": "Tạo quy trình phê duyệt",
"edit-approval-flow": "Chỉnh sửa quy trình phê duyệt",
"built-in": "Quy trình Tích hợp sẵn",
+ "built-in-description": "Các luồng tích hợp chỉ có thể đọc và không thể xóa.",
"custom": "Quy trình Tùy chỉnh",
"no-custom-flows": "Chưa có quy trình phê duyệt tùy chỉnh nào được tạo. Nhấp vào 'Tạo Quy trình' để thêm.",
"node": {
diff --git a/frontend/src/locales/zh-CN.json b/frontend/src/locales/zh-CN.json
index 54f1a0c028..cbb409b510 100644
--- a/frontend/src/locales/zh-CN.json
+++ b/frontend/src/locales/zh-CN.json
@@ -453,7 +453,8 @@
"secret-token": "Secret Token",
"secret-token-tip": "将其粘贴到 Entra 中的「Secret Token」字段。",
"reset-token": "重置密钥",
- "reset-token-warning": "您需要更新 Entra 应用程序配置。"
+ "reset-token-warning": "您需要更新 Entra 应用程序配置。",
+ "goto-entra-dashboard": "前往 Entra 配置"
},
"all-users": "全部用户",
"search-member": "搜索成员",
@@ -2616,6 +2617,7 @@
"create-approval-flow": "创建审批流",
"edit-approval-flow": "编辑审批流",
"built-in": "内置审批流",
+ "built-in-description": "内置审批流是只读的,不能删除。",
"custom": "自定义审批流",
"no-custom-flows": "尚未创建自定义审批流。点击\"创建审批流\"添加。",
"node": {
diff --git a/frontend/src/views/EnvironmentDashboard.vue b/frontend/src/views/EnvironmentDashboard.vue
index 5dd3a45529..991b85a068 100644
--- a/frontend/src/views/EnvironmentDashboard.vue
+++ b/frontend/src/views/EnvironmentDashboard.vue
@@ -16,6 +16,7 @@
:tab="() => renderTab(item.data, index)"
>
<EnvironmentDetail
+ ref="environmentDetailRefs"
:environment-name="item.id"
:buttons-class="buttonsClass"
@delete="doDelete"
@@ -114,7 +115,7 @@
import { create } from "@bufbuild/protobuf";
import { PlusIcon, ListOrderedIcon, GripVerticalIcon } from "lucide-vue-next";
import { NTabs, NTabPane, NButton } from "naive-ui";
-import { onMounted, computed, reactive, watch, h } from "vue";
+import { onMounted, computed, reactive, watch, h, ref } from "vue";
import { useI18n } from "vue-i18n";
import { useRouter } from "vue-router";
import Draggable from "vuedraggable";
@@ -167,6 +168,8 @@ const environmentV1Store = useEnvironmentV1Store();
const uiStateStore = useUIStateStore();
const policyV1Store = usePolicyV1Store();
const router = useRouter();
+const environmentList = useEnvironmentV1List();
+const environmentDetailRefs = ref<InstanceType<typeof EnvironmentDetail>[]>([]);
const state = reactive<LocalState>({
selectedId: "",
@@ -175,24 +178,38 @@ const state = reactive<LocalState>({
reorder: false,
});
-const selectEnvironmentOnHash = () => {
- if (environmentList.value.length <= 0) {
- return;
- }
- const target = router.currentRoute.value.hash.slice(1);
- for (let i = 0; i < environmentList.value.length; i++) {
- const id = environmentList.value[i].id;
- if (id === target) {
- selectEnvironment(i);
+const selectEnvironment = (index: number) => {
+ const id = environmentList.value[index].id;
+ onTabChange(id);
+};
+
+const onTabChange = (id: string) => {
+ // The NTabPane only render the selected environment,
+ // so we only need to check the 1st environmentDetailRefs
+ if (environmentDetailRefs.value[0]?.isEditing) {
+ if (!window.confirm(t("common.leave-without-saving"))) {
return;
}
}
- selectEnvironment(0);
+ state.selectedId = id;
+ router.replace({
+ name: router.currentRoute.value.name,
+ hash: "#" + id,
+ });
};
-onMounted(() => {
- selectEnvironmentOnHash();
+const selectEnvironmentOnHash = (target: string) => {
+ if (environmentList.value.length <= 0) {
+ return;
+ }
+ const index = Math.max(
+ 0,
+ environmentList.value.findIndex((env) => env.id === target)
+ );
+ selectEnvironment(index);
+};
+onMounted(() => {
if (!uiStateStore.getIntroStateByKey("environment.visit")) {
uiStateStore.saveIntroStateByKey({
key: "environment.visit",
@@ -203,13 +220,12 @@ onMounted(() => {
watch(
() => router.currentRoute.value.hash,
- () => {
- selectEnvironmentOnHash();
- }
+ (hash) => {
+ selectEnvironmentOnHash(hash.slice(1));
+ },
+ { immediate: true }
);
-const environmentList = useEnvironmentV1List();
-
const tabItemList = computed((): BBTabItem[] => {
return environmentList.value.map((item, index: number): BBTabItem => {
const title = `${index + 1}. ${item.title}`;
@@ -303,19 +319,6 @@ const doDelete = async (environment: Environment) => {
}
};
-const selectEnvironment = (index: number) => {
- const id = environmentList.value[index].id;
- onTabChange(id);
-};
-
-const onTabChange = (id: string) => {
- state.selectedId = id;
- router.replace({
- name: router.currentRoute.value.name,
- hash: "#" + id,
- });
-};
-
const renderTab = (env: Environment, index: number) => {
return h("div", { class: "flex items-center space-x-2 py-1" }, [
h("span", { class: "text-opacity-60" }, `${index + 1}.`),
diff --git a/frontend/src/views/EnvironmentDetail.vue b/frontend/src/views/EnvironmentDetail.vue
index edbb001084..8a8b2902b0 100644
--- a/frontend/src/views/EnvironmentDetail.vue
+++ b/frontend/src/views/EnvironmentDetail.vue
@@ -1,6 +1,7 @@
<template>
<EnvironmentForm
v-if="state.rolloutPolicy"
+ ref="environmentFormRef"
:environment="state.environment"
:rollout-policy="state.rolloutPolicy"
@update="doUpdate"
@@ -17,7 +18,7 @@
<script lang="ts" setup>
import { cloneDeep, isEqual } from "lodash-es";
-import { computed, reactive, watch, watchEffect } from "vue";
+import { computed, reactive, watch, watchEffect, ref } from "vue";
import {
EnvironmentForm,
Form as EnvironmentFormBody,
@@ -40,7 +41,6 @@ import { type VueClass } from "@/utils";
interface LocalState {
environment: Environment;
- showArchiveModal: boolean;
rolloutPolicy?: Policy;
}
@@ -56,12 +56,12 @@ const emit = defineEmits<{
const environmentV1Store = useEnvironmentV1Store();
const policyV1Store = usePolicyV1Store();
+const environmentFormRef = ref<InstanceType<typeof EnvironmentForm>>();
const state = reactive<LocalState>({
environment: environmentV1Store.getEnvironmentByName(
`${environmentNamePrefix}${props.environmentName}`
),
- showArchiveModal: false,
});
const stateEnvironmentName = computed(() => {
@@ -141,4 +141,8 @@ const updatePolicy = async (params: {
break;
}
};
+
+defineExpose({
+ isEditing: computed(() => environmentFormRef.value?.isEditing ?? false),
+});
</script>
diff --git a/frontend/src/views/ProfileDashboard.vue b/frontend/src/views/ProfileDashboard.vue
index 8cb6381255..51ffddb8d3 100644
--- a/frontend/src/views/ProfileDashboard.vue
+++ b/frontend/src/views/ProfileDashboard.vue
@@ -223,12 +223,14 @@ import { create } from "@bufbuild/protobuf";
import { FieldMaskSchema } from "@bufbuild/protobuf/wkt";
import type { ConnectError } from "@connectrpc/connect";
import { computedAsync, useTitle } from "@vueuse/core";
+import { useEventListener } from "@vueuse/core";
import { cloneDeep, isEqual } from "lodash-es";
import type { DropdownOption } from "naive-ui";
import { NButton, NDropdown, NInput, NTag } from "naive-ui";
import { computed, nextTick, onMounted, onUnmounted, reactive, ref } from "vue";
import { useI18n } from "vue-i18n";
import { useRouter } from "vue-router";
+import { onBeforeRouteLeave } from "vue-router";
import EmailInput from "@/components/EmailInput.vue";
import { FeatureModal } from "@/components/FeatureGuard";
import FeatureBadge from "@/components/FeatureGuard/FeatureBadge.vue";
@@ -374,6 +376,23 @@ const allowSaveEdit = computed(() => {
);
});
+useEventListener("beforeunload", (e) => {
+ if (!state.editing || !allowSaveEdit.value) {
+ return;
+ }
+ e.returnValue = t("common.leave-without-saving");
+ return e.returnValue;
+});
+
+onBeforeRouteLeave((to, from, next) => {
+ if (state.editing && allowSaveEdit.value) {
+ if (!window.confirm(t("common.leave-without-saving"))) {
+ return;
+ }
+ }
+ next();
+});
+
const updateUser = <K extends keyof User>(field: K, value: User[K]) => {
if (!state.editingUser) return;
diff --git a/frontend/src/views/SettingWorkspaceIM.vue b/frontend/src/views/SettingWorkspaceIM.vue
index 6a9c364700..e6c3203571 100644
--- a/frontend/src/views/SettingWorkspaceIM.vue
+++ b/frontend/src/views/SettingWorkspaceIM.vue
@@ -148,7 +148,7 @@ const imList = computed(() => {
<div class="textlabel">Token</div>
<BBTextField
class="mt-2"
- placeholder={t("common.write-only")}
+ placeholder={t("common.sensitive-placeholder")}
value={state.setting.slack?.token ?? ""}
onUpdate:value={(val: string) => {
state.setting.slack!.token = val;
@@ -169,7 +169,7 @@ const imList = computed(() => {
<div class="textlabel">App ID</div>
<BBTextField
class="mt-2"
- placeholder={t("common.write-only")}
+ placeholder={t("common.sensitive-placeholder")}
value={state.setting.feishu?.appId ?? ""}
onUpdate:value={(val: string) => {
state.setting.feishu!.appId = val;
@@ -180,7 +180,7 @@ const imList = computed(() => {
<div class="textlabel">App Secret</div>
<BBTextField
class="mt-2"
- placeholder={t("common.write-only")}
+ placeholder={t("common.sensitive-placeholder")}
value={state.setting.feishu?.appSecret ?? ""}
onUpdate:value={(val: string) => {
state.setting.feishu!.appSecret = val;
@@ -202,7 +202,7 @@ const imList = computed(() => {
<div class="textlabel">App ID</div>
<BBTextField
class="mt-2"
- placeholder={t("common.write-only")}
+ placeholder={t("common.sensitive-placeholder")}
value={state.setting.lark?.appId ?? ""}
onUpdate:value={(val: string) => {
state.setting.lark!.appId = val;
@@ -213,7 +213,7 @@ const imList = computed(() => {
<div class="textlabel">App Secret</div>
<BBTextField
class="mt-2"
- placeholder={t("common.write-only")}
+ placeholder={t("common.sensitive-placeholder")}
value={state.setting.lark?.appSecret ?? ""}
onUpdate:value={(val: string) => {
state.setting.lark!.appSecret = val;
@@ -235,7 +235,7 @@ const imList = computed(() => {
<div class="textlabel">Corp ID</div>
<BBTextField
class="mt-2"
- placeholder={t("common.write-only")}
+ placeholder={t("common.sensitive-placeholder")}
value={state.setting.wecom?.corpId ?? ""}
onUpdate:value={(val: string) => {
state.setting.wecom!.corpId = val;
@@ -246,7 +246,7 @@ const imList = computed(() => {
<div class="textlabel">Agent ID</div>
<BBTextField
class="mt-2"
- placeholder={t("common.write-only")}
+ placeholder={t("common.sensitive-placeholder")}
value={state.setting.wecom?.agentId ?? ""}
onUpdate:value={(val: string) => {
state.setting.wecom!.agentId = val;
@@ -257,7 +257,7 @@ const imList = computed(() => {
<div class="textlabel">Secret</div>
<BBTextField
class="mt-2"
- placeholder={t("common.write-only")}
+ placeholder={t("common.sensitive-placeholder")}
value={state.setting.wecom?.secret ?? ""}
onUpdate:value={(val: string) => {
state.setting.wecom!.secret = val;
@@ -279,7 +279,7 @@ const imList = computed(() => {
<div class="textlabel">Client ID</div>
<BBTextField
class="mt-2"
- placeholder={t("common.write-only")}
+ placeholder={t("common.sensitive-placeholder")}
value={state.setting.dingtalk?.clientId ?? ""}
onUpdate:value={(val: string) => {
state.setting.dingtalk!.clientId = val;
@@ -290,7 +290,7 @@ const imList = computed(() => {
<div class="textlabel">Client Secret</div>
<BBTextField
class="mt-2"
- placeholder={t("common.write-only")}
+ placeholder={t("common.sensitive-placeholder")}
value={state.setting.dingtalk?.clientSecret ?? ""}
onUpdate:value={(val: string) => {
state.setting.dingtalk!.clientSecret = val;
@@ -301,7 +301,7 @@ const imList = computed(() => {
<div class="textlabel">Robot Code</div>
<BBTextField
class="mt-2"
- placeholder={t("common.write-only")}
+ placeholder={t("common.sensitive-placeholder")}
value={state.setting.dingtalk?.robotCode ?? ""}
onUpdate:value={(val: string) => {
state.setting.dingtalk!.robotCode = val;