Skip to content

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

chore: issue detail page buttons improvements (#6775)

Liu Ji7f9d9d0bc840
diff --git a/frontend/src/components/Issue/IssueDescriptionPanel.vue b/frontend/src/components/Issue/IssueDescriptionPanel.vue
index 8e44cd58b0..88152e095a 100644
--- a/frontend/src/components/Issue/IssueDescriptionPanel.vue
+++ b/frontend/src/components/Issue/IssueDescriptionPanel.vue
@@ -3,31 +3,29 @@
<div class="flex justify-between items-center">
<div class="textlabel !leading-7">{{ descriptionTitle }}</div>
<div v-if="!create" class="space-x-2 mt-0.5">
- <button
+ <NButton
v-if="allowEditNameAndDescription && !state.editing"
- type="button"
- class="btn-icon"
+ size="tiny"
@click.prevent="beginEdit"
>
- <heroicons-solid:pencil class="h-5 w-5" />
- </button>
- <button
+ {{ $t("common.edit") }}
+ </NButton>
+ <NButton
v-if="state.editing"
- type="button"
- class="px-2 leading-6 rounded-sm text-control hover:bg-control-bg-hover disabled:bg-control-bg disabled:opacity-50 disabled:cursor-not-allowed text-sm font-normal focus:ring-control focus:outline-none focus-visible:ring-2 focus:ring-offset-2"
- @click.prevent="cancelEdit"
- >
- {{ $t("common.cancel") }}
- </button>
- <button
- v-if="state.editing"
- type="button"
- class="px-2 border leading-6 border-control-border rounded-sm text-control bg-control-bg hover:bg-control-bg-hover disabled:bg-control-bg disabled:opacity-50 disabled:cursor-not-allowed text-sm font-normal focus:ring-control focus:outline-none focus-visible:ring-2 focus:ring-offset-2"
+ size="tiny"
:disabled="state.editDescription == issue.description"
@click.prevent="saveEdit"
>
{{ $t("common.save") }}
- </button>
+ </NButton>
+ <NButton
+ v-if="state.editing"
+ size="tiny"
+ quaternary
+ @click.prevent="cancelEdit"
+ >
+ {{ $t("common.cancel") }}
+ </NButton>
</div>
</div>
<div class="mt-2 w-full px-[2px]">
@@ -73,6 +71,8 @@ import {
computed,
} from "vue";
import { useI18n } from "vue-i18n";
+import { NButton } from "naive-ui";
+
import type { Issue } from "@/types";
import { isGrantRequestIssueType, sizeToFit } from "@/utils";
import { useExtraIssueLogic, useIssueLogic } from "./logic";
diff --git a/frontend/src/components/Issue/IssueTaskStatementPanel.vue b/frontend/src/components/Issue/IssueTaskStatementPanel.vue
index 934fedf2fa..d4235178eb 100644
--- a/frontend/src/components/Issue/IssueTaskStatementPanel.vue
+++ b/frontend/src/components/Issue/IssueTaskStatementPanel.vue
@@ -2,87 +2,82 @@
<div
class="flex flex-col md:flex-row md:justify-between md:items-center gap-2 md:gap-4"
>
- <div class="flex space-x-4 flex-1">
- <div
- class="py-2 text-sm font-medium"
- :class="isEmpty(state.editStatement) ? 'text-red-600' : 'text-control'"
- >
- <template v-if="language === 'sql'">
- {{ $t("common.sql") }}
- </template>
- <template v-else>
- {{ $t("common.statement") }}
- </template>
- <span v-if="create" class="text-red-600 ml-1">*</span>
- <button
+ <div class="flex items-center space-x-4 flex-1">
+ <div class="flex items-center gap-x-1 text-sm font-medium">
+ <span
+ :class="
+ isEmpty(state.editStatement) ? 'text-red-600' : 'text-control'
+ "
+ >
+ <template v-if="language === 'sql'">
+ {{ $t("common.sql") }}
+ </template>
+ <template v-else>
+ {{ $t("common.statement") }}
+ </template>
+ </span>
+ <span v-if="create" class="text-red-600">*</span>
+ <NButton
v-if="!create && !hasFeature('bb.feature.sql-review')"
- type="button"
- class="ml-1 btn-small py-0.5 inline-flex items-center text-accent"
+ size="tiny"
@click.prevent="state.showFeatureModal = true"
>
🎈{{ $t("sql-review.unlock-full-feature") }}
- </button>
- <span v-if="sqlHint && !readonly" class="ml-1 text-accent">{{
+ </NButton>
+ <span v-if="sqlHint && !readonly" class="text-accent">{{
`(${sqlHint})`
}}</span>
</div>
- <button
+ <NButton
v-if="create && allowApplyTaskStateToOthers"
:disabled="isEmpty(state.editStatement)"
- type="button"
- class="btn-small py-1 px-3 my-auto"
+ size="tiny"
@click.prevent="applyTaskStateToOthers(selectedTask as TaskCreate)"
>
{{ $t("issue.apply-to-other-tasks") }}
- </button>
+ </NButton>
</div>
<div class="space-x-2 flex items-center">
<template v-if="(create || state.editing) && !readonly">
- <label
+ <NCheckbox
v-if="allowFormatOnSave"
- class="mt-0.5 mr-2 inline-flex items-center gap-1"
+ v-model:checked="formatOnSave"
+ size="small"
>
- <input
- v-model="formatOnSave"
- type="checkbox"
- class="h-4 w-4 text-accent rounded disabled:cursor-not-allowed border-control-border focus:ring-accent"
- />
- <span class="textlabel">{{ $t("issue.format-on-save") }}</span>
- </label>
-
- <UploadProgressButton :upload="handleUploadFile">
+ {{ $t("issue.format-on-save") }}
+ </NCheckbox>
+
+ <UploadProgressButton :upload="handleUploadFile" size="tiny">
{{ $t("issue.upload-sql") }}
</UploadProgressButton>
</template>
- <button
+ <NButton
v-if="shouldShowStatementEditButtonForUI"
- type="button"
- class="px-4 py-2 cursor-pointer border border-control-border rounded text-control hover:bg-control-bg-hover text-sm font-normal focus:ring-control focus:outline-none focus-visible:ring-2 focus:ring-offset-2 disabled:cursor-not-allowed"
+ size="tiny"
@click.prevent="beginEdit"
>
{{ $t("common.edit") }}
- </button>
+ </NButton>
<template v-else-if="!create">
- <button
+ <NButton
v-if="state.editing"
- type="button"
- class="px-4 py-2 cursor-pointer border border-control-border rounded text-control hover:bg-control-bg-hover text-sm font-normal focus:ring-control focus:outline-none focus-visible:ring-2 focus:ring-offset-2 disabled:cursor-not-allowed"
+ size="tiny"
:disabled="!allowSaveSQL"
@click.prevent="saveEdit"
>
{{ $t("common.save") }}
- </button>
- <button
+ </NButton>
+ <NButton
v-if="state.editing"
- type="button"
- class="px-4 py-2 cursor-pointer rounded text-control hover:bg-control-bg-hover text-sm font-normal focus:ring-control focus:outline-none focus-visible:ring-2 focus:ring-offset-2"
+ size="tiny"
+ quaternary
@click.prevent="cancelEdit"
>
{{ $t("common.cancel") }}
- </button>
+ </NButton>
</template>
</div>
</div>
@@ -120,7 +115,7 @@
</template>
<script lang="ts" setup>
-import { useDialog } from "naive-ui";
+import { useDialog, NButton, NCheckbox } from "naive-ui";
import { onMounted, reactive, watch, computed, ref, nextTick } from "vue";
import { useI18n } from "vue-i18n";
import {
diff --git a/frontend/src/components/misc/UploadProgressButton.vue b/frontend/src/components/misc/UploadProgressButton.vue
index dcdaf3e6a1..399e747a17 100644
--- a/frontend/src/components/misc/UploadProgressButton.vue
+++ b/frontend/src/components/misc/UploadProgressButton.vue
@@ -1,23 +1,25 @@
<template>
- <button
- class="select-none inline-flex items-center space-x-1 border border-control-border rounded-md text-control bg-white hover:bg-control-bg-hover disabled:bg-white disabled:opacity-50 disabled:cursor-not-allowed px-4 py-2 text-sm leading-5 font-medium focus:ring-control focus:outline-none focus-visible:ring-2 focus:ring-offset-2"
+ <NButton
:disabled="disabled"
+ style="--n-icon-margin: 3px"
@click="handleClick"
>
- <slot v-if="!uploading" name="icon">
- <heroicons-outline:arrow-up-tray class="w-4 h-auto mr-1" />
- </slot>
- <template v-else>
- <BBProgressPie
- v-if="percent > 0"
- :percent="percent"
- class="w-5 h-5 text-info"
- >
- <template #default="{ percent: displayPercent }">
- <span class="scale-[66%]">{{ displayPercent }}</span>
- </template>
- </BBProgressPie>
- <BBSpin v-else class="w-5 h-5" />
+ <template #icon>
+ <slot v-if="!uploading" name="icon">
+ <heroicons-outline:arrow-up-tray class="w-4 h-4" />
+ </slot>
+ <template v-else>
+ <BBProgressPie
+ v-if="percent > 0"
+ :percent="percent"
+ class="w-4 h-4 text-info"
+ >
+ <template #default="{ percent: displayPercent }">
+ <span class="scale-[66%]">{{ displayPercent }}</span>
+ </template>
+ </BBProgressPie>
+ <BBSpin v-else class="w-4 h-4" />
+ </template>
</template>
<span>
@@ -34,11 +36,13 @@
class="hidden"
@change="handleUpload"
/>
- </button>
+ </NButton>
</template>
<script lang="ts" setup>
import { computed, ref } from "vue";
+import { NButton } from "naive-ui";
+
import { BBProgressPie } from "@/bbkit";
type Tick = (p: number) => void;