Skip to content

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

chore: tweak description section styles (#17262)

boojack946faaae4ab1
diff --git a/frontend/src/components/MarkdownEditor/MarkdownEditor.vue b/frontend/src/components/MarkdownEditor/MarkdownEditor.vue
index 7049dd7ca2..db12f6f6bb 100644
--- a/frontend/src/components/MarkdownEditor/MarkdownEditor.vue
+++ b/frontend/src/components/MarkdownEditor/MarkdownEditor.vue
@@ -56,7 +56,7 @@
v-model="state.content"
rows="4"
class="block w-full px-4 py-3 resize-none whitespace-pre-wrap rounded-lg border border-gray-300 focus:border-blue-500 focus:ring-1 focus:ring-blue-500 focus:outline-none transition-colors text-sm"
- :placeholder="$t('issue.leave-a-comment')"
+ :placeholder="placeholder || $t('issue.leave-a-comment')"
@mousedown="clearIssuePanel"
@input="(e: any) => sizeToFit(e.target)"
@keyup="adjustIssuePanelWithPosition"
@@ -135,6 +135,7 @@ const props = defineProps<{
mode: EditorMode;
project?: ComposedProject;
issueList: ComposedIssue[];
+ placeholder?: string;
}>();
const emit = defineEmits<{
(event: "change", value: string): void;
diff --git a/frontend/src/components/Plan/components/Configuration/Configuration.vue b/frontend/src/components/Plan/components/Configuration/Configuration.vue
index 5fa0e3b3d3..d76aeb83b9 100644
--- a/frontend/src/components/Plan/components/Configuration/Configuration.vue
+++ b/frontend/src/components/Plan/components/Configuration/Configuration.vue
@@ -1,5 +1,5 @@
<template>
- <div v-if="shouldShow" class="flex flex-col px-4 gap-2">
+ <div v-if="shouldShow" class="flex flex-col gap-2">
<p class="text-base font-medium">
{{ $t("plan.options.self") }}
</p>
diff --git a/frontend/src/components/Plan/components/HeaderSection/DescriptionInput.vue b/frontend/src/components/Plan/components/HeaderSection/DescriptionInput.vue
index a273a100bd..8fda401a93 100644
--- a/frontend/src/components/Plan/components/HeaderSection/DescriptionInput.vue
+++ b/frontend/src/components/Plan/components/HeaderSection/DescriptionInput.vue
@@ -1,27 +1,21 @@
<template>
<div class="flex-1">
- <NInput
- v-model:value="state.description"
- :placeholder="$t('issue.add-some-description')"
- :disabled="!allowEdit || state.isUpdating"
- :loading="state.isUpdating"
- :style="style"
- size="tiny"
- type="textarea"
- :autosize="{ minRows: 1, maxRows: 3 }"
- @focus="state.isFocused = true"
- @blur="onBlur"
- @update:value="onUpdateValue"
+ <MarkdownEditor
+ :content="state.description"
+ mode="editor"
+ :project="project"
+ :placeholder="$t('plan.description.placeholder')"
+ :issue-list="[]"
+ @change="onUpdateValue"
/>
</div>
</template>
<script setup lang="ts">
import { create } from "@bufbuild/protobuf";
-import { NInput } from "naive-ui";
-import type { CSSProperties } from "vue";
-import { computed, reactive } from "vue";
+import { computed, reactive, watch } from "vue";
import { useI18n } from "vue-i18n";
+import MarkdownEditor from "@/components/MarkdownEditor";
import { planServiceClientConnect } from "@/grpcweb";
import {
pushNotification,
@@ -40,7 +34,6 @@ const { project } = useCurrentProjectV1();
const { isCreating, plan, readonly } = usePlanContext();
const state = reactive({
- isFocused: false,
isUpdating: false,
description: plan.value.description,
});
@@ -61,55 +54,62 @@ const allowEdit = computed(() => {
return false;
});
-const style = computed(() => {
- const style: CSSProperties = {
- "--n-color-disabled": "transparent",
- };
- const border = state.isFocused
- ? "1px solid rgb(var(--color-control-border))"
- : "none";
- style["--n-border"] = border;
- style["--n-border-disabled"] = border;
-
- return style;
-});
-
-const onBlur = async () => {
- state.isFocused = false;
+const onUpdateValue = (value: string) => {
+ state.description = value;
if (isCreating.value) {
- return;
+ plan.value.description = value;
}
+};
- if (state.description === plan.value.description) {
- return;
- }
+let debounceTimer: NodeJS.Timeout | null = null;
- try {
- state.isUpdating = true;
- const planPatch = create(PlanSchema, {
- ...plan.value,
- description: state.description,
- });
- const request = create(UpdatePlanRequestSchema, {
- plan: planPatch,
- updateMask: { paths: ["description"] },
- });
- const response = await planServiceClientConnect.updatePlan(request);
- Object.assign(plan.value, response);
- pushNotification({
- module: "bytebase",
- style: "SUCCESS",
- title: t("common.updated"),
- });
- } finally {
- state.isUpdating = false;
- }
-};
+watch(
+ () => state.description,
+ (newValue) => {
+ if (isCreating.value || !allowEdit.value) {
+ return;
+ }
-const onUpdateValue = (value: string) => {
- if (!isCreating.value) {
- return;
+ if (newValue === plan.value.description) {
+ return;
+ }
+
+ if (debounceTimer) {
+ clearTimeout(debounceTimer);
+ }
+
+ debounceTimer = setTimeout(async () => {
+ try {
+ state.isUpdating = true;
+ const planPatch = create(PlanSchema, {
+ ...plan.value,
+ description: state.description,
+ });
+ const request = create(UpdatePlanRequestSchema, {
+ plan: planPatch,
+ updateMask: { paths: ["description"] },
+ });
+ const response = await planServiceClientConnect.updatePlan(request);
+ Object.assign(plan.value, response);
+ pushNotification({
+ module: "bytebase",
+ style: "SUCCESS",
+ title: t("common.updated"),
+ });
+ } finally {
+ state.isUpdating = false;
+ }
+ }, 1000);
}
- plan.value.description = value;
-};
+);
+
+watch(
+ () => plan.value.description,
+ (newValue) => {
+ if (state.description !== newValue) {
+ state.description = newValue;
+ }
+ },
+ { immediate: true }
+);
</script>
diff --git a/frontend/src/components/Plan/components/HeaderSection/HeaderSection.vue b/frontend/src/components/Plan/components/HeaderSection/HeaderSection.vue
index d063b0d2ea..4103616203 100644
--- a/frontend/src/components/Plan/components/HeaderSection/HeaderSection.vue
+++ b/frontend/src/components/Plan/components/HeaderSection/HeaderSection.vue
@@ -1,22 +1,22 @@
<template>
<div class="py-2 px-2 sm:px-4">
<div class="flex flex-row items-center justify-between gap-2">
- <TitleInput />
- <div class="flex flex-row items-center justify-end">
- <Actions />
- </div>
- </div>
- <div
- v-if="showDraftTag || showDescriptionInput"
- class="flex flex-row items-start justify-start gap-x-1 mt-0.5"
- >
- <NTag v-if="showDraftTag" round size="small">
+ <NTag v-if="showDraftTag" round>
<template #icon>
<CircleDotDashedIcon class="w-4 h-4" />
</template>
{{ $t("common.draft") }}
</NTag>
- <DescriptionInput v-if="showDescriptionInput" />
+ <TitleInput />
+ <div class="flex flex-row items-center justify-end">
+ <Actions />
+ </div>
+ </div>
+ <div v-if="showDescriptionInput" class="flex flex-col mt-2">
+ <label class="block text-sm text-control mb-1">
+ {{ $t("plan.description.add-a-description") }}
+ </label>
+ <DescriptionInput />
</div>
</div>
</template>
diff --git a/frontend/src/components/Plan/components/PlanCheckSection/PlanCheckSection.vue b/frontend/src/components/Plan/components/PlanCheckSection/PlanCheckSection.vue
index 9c323e2509..9cb66fab3a 100644
--- a/frontend/src/components/Plan/components/PlanCheckSection/PlanCheckSection.vue
+++ b/frontend/src/components/Plan/components/PlanCheckSection/PlanCheckSection.vue
@@ -1,8 +1,5 @@
<template>
- <div
- v-if="shouldShow"
- class="px-4 pt-3 flex flex-col gap-y-1 overflow-hidden"
- >
+ <div v-if="shouldShow" class="pt-3 flex flex-col gap-y-1 overflow-hidden">
<div class="flex items-center justify-between gap-2">
<div class="flex items-center gap-2">
<h3 class="text-base font-medium">{{ $t("plan.checks.self") }}</h3>
diff --git a/frontend/src/components/Plan/components/SQLCheckV1Section/SQLCheckV1Section.vue b/frontend/src/components/Plan/components/SQLCheckV1Section/SQLCheckV1Section.vue
index 52f19588ca..5ca16cc95b 100644
--- a/frontend/src/components/Plan/components/SQLCheckV1Section/SQLCheckV1Section.vue
+++ b/frontend/src/components/Plan/components/SQLCheckV1Section/SQLCheckV1Section.vue
@@ -1,5 +1,5 @@
<template>
- <div v-if="show" class="px-4 pt-3 flex flex-col gap-y-1 overflow-hidden">
+ <div v-if="show" class="pt-3 flex flex-col gap-y-1 overflow-hidden">
<div class="flex items-center justify-between gap-2">
<div class="flex items-center gap-2">
<h3 class="text-base font-medium">{{ $t("plan.checks.self") }}</h3>
diff --git a/frontend/src/components/Plan/components/SpecDetailView/FailedTaskRunsSection.vue b/frontend/src/components/Plan/components/SpecDetailView/FailedTaskRunsSection.vue
index 500938325a..b7784c46ed 100644
--- a/frontend/src/components/Plan/components/SpecDetailView/FailedTaskRunsSection.vue
+++ b/frontend/src/components/Plan/components/SpecDetailView/FailedTaskRunsSection.vue
@@ -1,5 +1,5 @@
<template>
- <div v-if="shouldShowSection" class="w-full space-y-2 pt-3 px-4">
+ <div v-if="shouldShowSection" class="w-full space-y-2 pt-3">
<div class="text-sm text-control">
{{ $t("task-run.failed-runs") }}
</div>
diff --git a/frontend/src/components/Plan/components/SpecDetailView/SpecDetailView.vue b/frontend/src/components/Plan/components/SpecDetailView/SpecDetailView.vue
index 6690d2c420..ec8055550b 100644
--- a/frontend/src/components/Plan/components/SpecDetailView/SpecDetailView.vue
+++ b/frontend/src/components/Plan/components/SpecDetailView/SpecDetailView.vue
@@ -1,19 +1,17 @@
<template>
- <div
- class="flex-1 flex flex-col hide-scrollbar gap-3 divide-y overflow-x-hidden"
- >
- <div class="w-full flex flex-col">
- <SpecListSection v-if="shouldShowSpecList" />
+ <div class="flex-1 flex flex-col">
+ <SpecListSection v-if="shouldShowSpecList" />
+ <div class="w-full flex flex-col gap-3 px-4 divide-y overflow-x-hidden">
<TargetListSection />
<FailedTaskRunsSection v-if="!isCreating && rollout" />
- </div>
- <template v-if="!specHasRelease">
- <SQLCheckV1Section v-if="isCreating" />
- <PlanCheckSection v-else />
- </template>
- <div class="w-full space-y-3 pt-3">
- <StatementSection />
- <Configuration />
+ <template v-if="!specHasRelease">
+ <SQLCheckV1Section v-if="isCreating" />
+ <PlanCheckSection v-else />
+ </template>
+ <div class="w-full space-y-3 pt-3">
+ <StatementSection />
+ <Configuration />
+ </div>
</div>
</div>
</template>
diff --git a/frontend/src/components/Plan/components/SpecDetailView/SpecListSection.vue b/frontend/src/components/Plan/components/SpecDetailView/SpecListSection.vue
index 140c9402b8..fd69aab15f 100644
--- a/frontend/src/components/Plan/components/SpecDetailView/SpecListSection.vue
+++ b/frontend/src/components/Plan/components/SpecDetailView/SpecListSection.vue
@@ -3,12 +3,18 @@
<NTabs
:key="`${plan.specs.length}-${selectedSpec.id}`"
:value="selectedSpec.id"
- type="line"
+ type="card"
size="small"
class="flex-1"
- tab-class="first:ml-4"
@update:value="handleTabChange"
>
+ <template #prefix>
+ <div class=""></div>
+ <div v-if="!plan.issue" class="pl-4 text-base font-medium">
+ {{ $t("plan.navigator.changes") }}
+ </div>
+ </template>
+
<NTab v-for="(spec, index) in plan.specs" :key="spec.id" :name="spec.id">
<div class="flex items-center gap-1">
<span v-if="plan.specs.length > 1" class="opacity-80"
diff --git a/frontend/src/components/Plan/components/SpecDetailView/TargetListSection.vue b/frontend/src/components/Plan/components/SpecDetailView/TargetListSection.vue
index 0ddf6a6a37..e495e0550b 100644
--- a/frontend/src/components/Plan/components/SpecDetailView/TargetListSection.vue
+++ b/frontend/src/components/Plan/components/SpecDetailView/TargetListSection.vue
@@ -1,5 +1,5 @@
<template>
- <div class="flex flex-col gap-y-2 pt-2 px-4">
+ <div class="flex flex-col gap-y-2 pt-2">
<div class="flex items-center justify-between gap-2">
<div class="flex items-center gap-1">
<h3 class="text-base font-medium">{{ $t("plan.targets.title") }}</h3>
diff --git a/frontend/src/components/Plan/components/StatementSection/StatementSection.vue b/frontend/src/components/Plan/components/StatementSection/StatementSection.vue
index cc482d78fb..0eb13324cf 100644
--- a/frontend/src/components/Plan/components/StatementSection/StatementSection.vue
+++ b/frontend/src/components/Plan/components/StatementSection/StatementSection.vue
@@ -1,5 +1,5 @@
<template>
- <div v-show="viewMode !== 'NONE'" class="px-4 flex flex-col gap-y-2">
+ <div v-show="viewMode !== 'NONE'" class="flex flex-col gap-y-2">
<EditorView v-if="viewMode === 'EDITOR'" :key="selectedSpec.id" />
<ReleaseView v-else-if="viewMode === 'RELEASE'" />
</div>
diff --git a/frontend/src/locales/dynamic/es-ES.json b/frontend/src/locales/dynamic/es-ES.json
index 7a87f921d6..bfc5017440 100644
--- a/frontend/src/locales/dynamic/es-ES.json
+++ b/frontend/src/locales/dynamic/es-ES.json
@@ -373,4 +373,4 @@
"review-config": "Revisar configuración",
"role": "Rol"
}
-}
+}
\ No newline at end of file
diff --git a/frontend/src/locales/dynamic/ja-JP.json b/frontend/src/locales/dynamic/ja-JP.json
index f0d9b944dd..8b89ba2be6 100644
--- a/frontend/src/locales/dynamic/ja-JP.json
+++ b/frontend/src/locales/dynamic/ja-JP.json
@@ -373,4 +373,4 @@
"review-config": "設定を確認する",
"role": "役割"
}
-}
+}
\ No newline at end of file
diff --git a/frontend/src/locales/dynamic/vi-VN.json b/frontend/src/locales/dynamic/vi-VN.json
index be72063193..9ee3bf1c6c 100644
--- a/frontend/src/locales/dynamic/vi-VN.json
+++ b/frontend/src/locales/dynamic/vi-VN.json
@@ -373,4 +373,4 @@
"review-config": "Cấu hình đánh giá",
"role": "Vai trò"
}
-}
+}
\ No newline at end of file
diff --git a/frontend/src/locales/dynamic/zh-CN.json b/frontend/src/locales/dynamic/zh-CN.json
index 4c37aa022f..076fd7c71e 100644
--- a/frontend/src/locales/dynamic/zh-CN.json
+++ b/frontend/src/locales/dynamic/zh-CN.json
@@ -373,4 +373,4 @@
"review-config": "审查配置",
"role": "角色"
}
-}
+}
\ No newline at end of file
diff --git a/frontend/src/locales/en-US.json b/frontend/src/locales/en-US.json
index 0d1f5f10d7..816aa31f9d 100644
--- a/frontend/src/locales/en-US.json
+++ b/frontend/src/locales/en-US.json
@@ -1172,6 +1172,10 @@
"description": "Filter plans by their state",
"close-confirm": "Are you sure to close this plan?",
"reopen-confirm": "Are you sure to reopen this plan?"
+ },
+ "description": {
+ "add-a-description": "Add a description",
+ "placeholder": "Add your description here for this plan..."
}
},
"rollout": {
diff --git a/frontend/src/locales/es-ES.json b/frontend/src/locales/es-ES.json
index 2fbc6468bf..8497c88a99 100644
--- a/frontend/src/locales/es-ES.json
+++ b/frontend/src/locales/es-ES.json
@@ -1172,6 +1172,10 @@
"description": "Filtrar planes por estado",
"close-confirm": "¿Estás seguro de que deseas cerrar este plan?",
"reopen-confirm": "¿Estás seguro de que deseas reabrir este plan?"
+ },
+ "description": {
+ "add-a-description": "Añadir una descripción",
+ "placeholder": "Añade tu descripción aquí para este plan..."
}
},
"rollout": {
@@ -2904,4 +2908,4 @@
"last-visit": "Última visita",
"changelog-for-version": "Registro de cambios para {version}"
}
-}
+}
\ No newline at end of file
diff --git a/frontend/src/locales/ja-JP.json b/frontend/src/locales/ja-JP.json
index 1e6b260d06..cca422f022 100644
--- a/frontend/src/locales/ja-JP.json
+++ b/frontend/src/locales/ja-JP.json
@@ -1172,6 +1172,10 @@
"description": "州別にプランをフィルタリング",
"close-confirm": "このプランを閉じてもよろしいですか?",
"reopen-confirm": "このプランを再開してもよろしいですか?"
+ },
+ "description": {
+ "add-a-description": "説明を追加する",
+ "placeholder": "このプランの説明をここに追加してください..."
}
},
"rollout": {
@@ -2904,4 +2908,4 @@
"last-visit": "最終訪問",
"changelog-for-version": "{version} の変更履歴"
}
-}
+}
\ No newline at end of file
diff --git a/frontend/src/locales/sql-review/es-ES.json b/frontend/src/locales/sql-review/es-ES.json
index aa5c4e8b2f..d1f8636bce 100644
--- a/frontend/src/locales/sql-review/es-ES.json
+++ b/frontend/src/locales/sql-review/es-ES.json
@@ -729,4 +729,4 @@
"warning": "Advertencia",
"disabled": "Deshabilitado"
}
-}
+}
\ No newline at end of file
diff --git a/frontend/src/locales/sql-review/ja-JP.json b/frontend/src/locales/sql-review/ja-JP.json
index e9cab59d42..cf9e653471 100644
--- a/frontend/src/locales/sql-review/ja-JP.json
+++ b/frontend/src/locales/sql-review/ja-JP.json
@@ -729,4 +729,4 @@
"warning": "警告",
"disabled": "無効化"
}
-}
+}
\ No newline at end of file
diff --git a/frontend/src/locales/sql-review/vi-VN.json b/frontend/src/locales/sql-review/vi-VN.json
index bbb389bc80..7c5e7f93cd 100644
--- a/frontend/src/locales/sql-review/vi-VN.json
+++ b/frontend/src/locales/sql-review/vi-VN.json
@@ -729,4 +729,4 @@
"warning": "Cảnh báo",
"disabled": "Đã tắt"
}
-}
+}
\ No newline at end of file
diff --git a/frontend/src/locales/sql-review/zh-CN.json b/frontend/src/locales/sql-review/zh-CN.json
index d29cfab788..0f54205287 100644
--- a/frontend/src/locales/sql-review/zh-CN.json
+++ b/frontend/src/locales/sql-review/zh-CN.json
@@ -729,4 +729,4 @@
"warning": "警告",
"disabled": "禁用"
}
-}
+}
\ No newline at end of file
diff --git a/frontend/src/locales/subscription/es-ES.json b/frontend/src/locales/subscription/es-ES.json
index be64d71833..b5755b1b0e 100644
--- a/frontend/src/locales/subscription/es-ES.json
+++ b/frontend/src/locales/subscription/es-ES.json
@@ -50,4 +50,4 @@
"desc": "Funciones adicionales de seguridad, cumplimiento y permisos. Soporte dedicado con SLA."
}
}
-}
+}
\ No newline at end of file
diff --git a/frontend/src/locales/subscription/ja-JP.json b/frontend/src/locales/subscription/ja-JP.json
index 62d3438003..b1ed8fc667 100644
--- a/frontend/src/locales/subscription/ja-JP.json
+++ b/frontend/src/locales/subscription/ja-JP.json
@@ -50,4 +50,4 @@
"desc": "追加のセキュリティ、コンプライアンス、および権限機能。SLA付きの専任サポート。"
}
}
-}
+}
\ No newline at end of file
diff --git a/frontend/src/locales/subscription/vi-VN.json b/frontend/src/locales/subscription/vi-VN.json
index c93bc6ad92..4c29d445fb 100644
--- a/frontend/src/locales/subscription/vi-VN.json
+++ b/frontend/src/locales/subscription/vi-VN.json
@@ -50,4 +50,4 @@
"desc": "Các tính năng bảo mật, tuân thủ và quyền bổ sung. Hỗ trợ chuyên dụng với SLA."
}
}
-}
+}
\ No newline at end of file
diff --git a/frontend/src/locales/subscription/zh-CN.json b/frontend/src/locales/subscription/zh-CN.json
index dbbbd429b1..19ed30a59d 100644
--- a/frontend/src/locales/subscription/zh-CN.json
+++ b/frontend/src/locales/subscription/zh-CN.json
@@ -50,4 +50,4 @@
"desc": "额外的安全,合规,权限功能,SLA 支持。"
}
}
-}
+}
\ No newline at end of file
diff --git a/frontend/src/locales/vi-VN.json b/frontend/src/locales/vi-VN.json
index 2843b2007a..bd2329e561 100644
--- a/frontend/src/locales/vi-VN.json
+++ b/frontend/src/locales/vi-VN.json
@@ -1172,6 +1172,10 @@
"description": "Lọc các kế hoạch theo trạng thái của chúng",
"close-confirm": "Bạn có chắc chắn muốn đóng kế hoạch này không?",
"reopen-confirm": "Bạn có chắc chắn muốn mở lại kế hoạch này không?"
+ },
+ "description": {
+ "add-a-description": "Thêm mô tả",
+ "placeholder": "Thêm mô tả của bạn vào đây cho kế hoạch này..."
}
},
"rollout": {
@@ -2904,4 +2908,4 @@
"last-visit": "Lần truy cập cuối",
"changelog-for-version": "Nhật ký thay đổi cho phiên bản {version}"
}
-}
+}
\ No newline at end of file
diff --git a/frontend/src/locales/zh-CN.json b/frontend/src/locales/zh-CN.json
index 10851cb65e..8e3a132bf9 100644
--- a/frontend/src/locales/zh-CN.json
+++ b/frontend/src/locales/zh-CN.json
@@ -1172,6 +1172,10 @@
"description": "按状态过滤",
"close-confirm": "确定关闭该变更计划?",
"reopen-confirm": "确定重新开启该变更计划?"
+ },
+ "description": {
+ "add-a-description": "添加描述",
+ "placeholder": "在此添加该更变计划的描述..."
}
},
"rollout": {
@@ -2904,4 +2908,4 @@
"last-visit": "上次访问",
"changelog-for-version": "{version} 的更新日志"
}
-}
+}
\ No newline at end of file