Skip to content

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

chore: use NButton in most cases (#10037)

ecmadaob7aff66359c5
diff --git a/frontend/src/bbkit/BBModal.vue b/frontend/src/bbkit/BBModal.vue
index c0bd5878bb..0e83d61780 100644
--- a/frontend/src/bbkit/BBModal.vue
+++ b/frontend/src/bbkit/BBModal.vue
@@ -18,16 +18,17 @@
<slot name="title"><component :is="renderTitle" /></slot>
<slot name="subtitle"><component :is="renderSubtitle" /></slot>
</div>
- <button
+ <NButton
v-if="showClose"
- class="text-control-light"
+ quaternary
+ size="small"
aria-label="close"
@click.prevent="tryClose()"
>
<span class="sr-only">Close</span>
<!-- Heroicons name: x -->
<X class="w-5 h-auto hover:opacity-80" />
- </button>
+ </NButton>
</div>
<div class="modal-container" :class="containerClass">
diff --git a/frontend/src/components/AlterSchemaPrepForm/SchemaEditorModal.vue b/frontend/src/components/AlterSchemaPrepForm/SchemaEditorModal.vue
index 6638076116..529e16c8f1 100644
--- a/frontend/src/components/AlterSchemaPrepForm/SchemaEditorModal.vue
+++ b/frontend/src/components/AlterSchemaPrepForm/SchemaEditorModal.vue
@@ -71,31 +71,30 @@
>
<div>{{ $t("sql-editor.self") }}</div>
<div class="flex flex-row justify-end items-center space-x-3">
- <label
- for="sql-file-input"
- class="text-sm border px-3 leading-8 flex items-center rounded cursor-pointer hover:opacity-80 disabled:cursor-not-allowed disabled:opacity-60"
- >
- <heroicons-outline:arrow-up-tray
- class="w-4 h-auto mr-1 text-gray-500"
- />
+ <NButton @click="onUploaderClick">
+ <template #icon>
+ <heroicons-outline:arrow-up-tray
+ class="w-4 h-auto text-gray-500"
+ />
+ </template>
{{ $t("issue.upload-sql") }}
<input
id="sql-file-input"
+ ref="sqlFileUploader"
type="file"
accept=".sql,.txt,application/sql,text/plain"
class="hidden"
@change="handleUploadFile"
/>
- </label>
- <button
- class="text-sm border px-3 leading-8 flex items-center rounded cursor-pointer hover:opacity-80 disabled:cursor-not-allowed disabled:opacity-60"
- @click="handleSyncSQLFromSchemaEditor"
- >
- <heroicons-outline:arrow-path
- class="w-4 h-auto mr-1 text-gray-500"
- />
+ </NButton>
+ <NButton @click="handleSyncSQLFromSchemaEditor">
+ <template #icon>
+ <heroicons-outline:arrow-path
+ class="w-4 h-auto text-gray-500"
+ />
+ </template>
{{ $t("schema-editor.sync-sql-from-schema-editor") }}
- </button>
+ </NButton>
</div>
</div>
<MonacoEditor
@@ -118,16 +117,16 @@
</div>
</div>
<div class="flex justify-end items-center space-x-3">
- <button type="button" class="btn-normal" @click="dismissModal">
+ <NButton @click="dismissModal">
{{ $t("common.cancel") }}
- </button>
- <button
- class="btn-primary whitespace-nowrap"
+ </NButton>
+ <NButton
+ type="primary"
:disabled="!allowPreviewIssue"
@click="handlePreviewIssue"
>
{{ $t("schema-editor.preview-issue") }}
- </button>
+ </NButton>
</div>
</div>
</BBModal>
@@ -211,6 +210,7 @@ const emit = defineEmits<{
}>();
const schemaEditorRef = ref<InstanceType<typeof SchemaEditorLite>>();
+const sqlFileUploader = ref<HTMLInputElement | null>(null);
const { t } = useI18n();
const router = useRouter();
const state = reactive<LocalState>({
@@ -226,6 +226,10 @@ const databaseV1Store = useDatabaseV1Store();
const notificationStore = useNotificationStore();
const { runSQLCheck } = provideSQLCheckContext();
+const onUploaderClick = () => {
+ sqlFileUploader.value?.click();
+};
+
const allowPreviewIssue = computed(() => {
if (state.selectedTab === "schema-editor") {
// Always return true for schema editor to prevent huge calculation from schema editor.
diff --git a/frontend/src/components/AnomalyCenter/AnomalyTable.vue b/frontend/src/components/AnomalyCenter/AnomalyTable.vue
index e4f032862b..7d0e269107 100644
--- a/frontend/src/components/AnomalyCenter/AnomalyTable.vue
+++ b/frontend/src/components/AnomalyCenter/AnomalyTable.vue
@@ -67,9 +67,9 @@
:readonly="true"
/>
<div class="flex justify-end">
- <button type="button" class="btn-primary" @click.prevent="dismissModal">
+ <NButton type="primary" @click.prevent="dismissModal">
{{ $t("common.close") }}
- </button>
+ </NButton>
</div>
</div>
</BBModal>
diff --git a/frontend/src/components/Branch/SchemaDesignEditor.vue b/frontend/src/components/Branch/SchemaDesignEditor.vue
deleted file mode 100644
index 3f8d2354fb..0000000000
--- a/frontend/src/components/Branch/SchemaDesignEditor.vue
+++ /dev/null
@@ -1,181 +0,0 @@
-<template>
- <div class="w-full h-full flex flex-col justify-start items-start">
- <div
- class="w-full flex flex-row justify-between items-center border-b pl-1 border-b-gray-300"
- >
- <div class="flex items-center flex-start">
- <button
- class="-mb-px px-3 leading-9 rounded-t-md flex items-center text-sm text-gray-500 border border-b-0 border-transparent cursor-pointer select-none outline-none"
- :class="
- state.selectedTab === 'schema-editor' &&
- 'bg-white !border-gray-300 text-gray-800'
- "
- @click="handleChangeTab('schema-editor')"
- >
- {{ $t("schema-editor.self") }}
- </button>
- <button
- class="-mb-px px-3 leading-9 rounded-t-md text-sm text-gray-500 border border-b-0 border-transparent cursor-pointer select-none outline-none"
- :class="
- state.selectedTab === 'raw-sql-preview' &&
- 'bg-white !border-gray-300 text-gray-800'
- "
- @click="handleChangeTab('raw-sql-preview')"
- >
- {{ $t("schema-designer.raw-sql-preview") }}
- </button>
- </div>
- <div v-if="!hideSQLCheckButton" class="flex items-center flex-end">
- <BranchSQLCheckButton class="justify-end" :branch="branch" />
- </div>
- </div>
- <div class="grow w-full h-auto overflow-auto">
- <div
- v-show="state.selectedTab === 'schema-editor'"
- class="w-full h-full pt-2"
- >
- <SchemaEditorV1
- :project="project"
- :readonly="readonly"
- :resource-type="'branch'"
- :branches="branches"
- />
- </div>
- <div
- v-show="state.selectedTab === 'raw-sql-preview'"
- class="w-full h-full pt-2 overflow-y-auto"
- >
- <MonacoEditor
- class="w-full h-full border rounded-lg overflow-auto"
- data-label="bb-schema-editor-sql-editor"
- :content="rawSQLPreviewState.value"
- :readonly="true"
- :auto-focus="false"
- />
- </div>
- </div>
- </div>
-</template>
-
-<script lang="ts" setup>
-import { cloneDeep } from "lodash-es";
-import { computed, reactive } from "vue";
-import { useI18n } from "vue-i18n";
-import { branchServiceClient } from "@/grpcweb";
-import {
- pushNotification,
- useDatabaseV1Store,
- useSchemaEditorV1Store,
-} from "@/store";
-import { ComposedProject } from "@/types";
-import { Branch } from "@/types/proto/v1/branch_service";
-import { DatabaseMetadata } from "@/types/proto/v1/database_service";
-import { MonacoEditor } from "../MonacoEditor";
-import {
- mergeSchemaEditToMetadata,
- validateDatabaseMetadata,
-} from "../SchemaEditorV1/utils";
-
-type TabType = "schema-editor" | "raw-sql-preview";
-
-interface LocalState {
- selectedTab: TabType;
-}
-
-const props = defineProps<{
- project: ComposedProject;
- branch: Branch;
- readonly?: boolean;
- hideSQLCheckButton?: boolean;
-}>();
-
-const { t } = useI18n();
-const state = reactive<LocalState>({
- selectedTab: "schema-editor",
-});
-const databaseStore = useDatabaseV1Store();
-const schemaEditorV1Store = useSchemaEditorV1Store();
-const rawSQLPreviewState = reactive({
- value: "",
- isFetching: false,
-});
-
-const baselineDatabase = computed(() => {
- return databaseStore.getDatabaseByName(props.branch.baselineDatabase);
-});
-
-// Avoid to create array or object literals in template to improve performance
-const branches = computed(() => [props.branch]);
-
-const handleChangeTab = async (tab: TabType) => {
- state.selectedTab = tab;
- if (tab === "raw-sql-preview") {
- await fetchRawSQLPreview();
- }
-};
-
-const fetchRawSQLPreview = async () => {
- if (rawSQLPreviewState.isFetching) {
- return;
- }
-
- const branchSchema = schemaEditorV1Store.resourceMap["branch"].get(
- props.branch.name
- );
- if (!branchSchema) {
- return undefined;
- }
-
- const sourceMetadata = props.branch.baselineSchemaMetadata;
- const baselineMetadata =
- branchSchema.branch.baselineSchemaMetadata ||
- DatabaseMetadata.fromPartial({});
- const metadata = mergeSchemaEditToMetadata(
- branchSchema.schemaList,
- cloneDeep(baselineMetadata)
- );
- if (!metadata) {
- rawSQLPreviewState.value = "";
- pushNotification({
- module: "bytebase",
- style: "CRITICAL",
- title: t("schema-editor.message.invalid-schema"),
- });
- return;
- }
- const validationMessages = validateDatabaseMetadata(metadata);
- if (validationMessages.length > 0) {
- rawSQLPreviewState.value = "";
- pushNotification({
- module: "bytebase",
- style: "WARN",
- title: "Invalid schema structure",
- description: validationMessages.join("\n"),
- });
- return;
- }
-
- try {
- rawSQLPreviewState.isFetching = true;
- const diffResponse = await branchServiceClient.diffMetadata(
- {
- sourceMetadata,
- targetMetadata: metadata,
- engine: baselineDatabase.value.instanceEntity.engine,
- },
- {
- silent: true,
- }
- );
- rawSQLPreviewState.value = diffResponse.diff;
- } catch {
- pushNotification({
- module: "bytebase",
- style: "WARN",
- title: t("schema-editor.message.invalid-schema"),
- });
- rawSQLPreviewState.value = "";
- }
- rawSQLPreviewState.isFetching = false;
-};
-</script>
diff --git a/frontend/src/components/DatabaseBackup/DatabaseBackupSettingForm.vue b/frontend/src/components/DatabaseBackup/DatabaseBackupSettingForm.vue
index 4b323dbb41..46037b5877 100644
--- a/frontend/src/components/DatabaseBackup/DatabaseBackupSettingForm.vue
+++ b/frontend/src/components/DatabaseBackup/DatabaseBackupSettingForm.vue
@@ -131,22 +131,18 @@
</div>
<div
- class="w-full mt-4 pt-4 flex justify-end border-t border-block-border"
+ class="w-full mt-4 pt-4 flex justify-end border-t border-block-border space-x-3"
>
- <button
- type="button"
- class="btn-normal py-2 px-4"
- @click.prevent="$emit('cancel')"
- >
+ <NButton @click.prevent="$emit('cancel')">
{{ $t("common.cancel") }}
- </button>
- <button
- class="btn-primary ml-3 inline-flex justify-center py-2 px-4"
+ </NButton>
+ <NButton
+ type="primary"
:disabled="!isValid"
@click.prevent="handleSave"
>
{{ $t("common.save") }}
- </button>
+ </NButton>
</div>
<div
diff --git a/frontend/src/components/DatabaseBackupCreateForm.vue b/frontend/src/components/DatabaseBackupCreateForm.vue
index 37b628859f..0916030569 100644
--- a/frontend/src/components/DatabaseBackupCreateForm.vue
+++ b/frontend/src/components/DatabaseBackupCreateForm.vue
@@ -1,5 +1,5 @@
<template>
- <form
+ <div
class="space-y-6 divide-y divide-block-border"
@submit.prevent="$emit('create', state.backupName)"
>
@@ -9,35 +9,28 @@
<label for="name" class="textlabel">
{{ $t("database.backup-name") }} <span class="text-red-600">*</span>
</label>
- <input
- id="name"
- v-model="state.backupName"
+ <BBTextField
+ v-model:value="state.backupName"
required
- name="name"
- type="text"
- class="textfield mt-1 w-full"
+ class="mt-1 w-full"
/>
</div>
</div>
</div>
<!-- Create button group -->
- <div class="pt-4 flex justify-end">
- <button
- type="button"
- class="btn-normal py-2 px-4"
- @click.prevent="$emit('cancel')"
- >
+ <div class="pt-4 flex justify-end space-x-3">
+ <NButton @click.prevent="$emit('cancel')">
{{ $t("common.cancel") }}
- </button>
- <button
- type="submit"
- class="btn-primary ml-3 inline-flex justify-center py-2 px-4"
+ </NButton>
+ <NButton
+ type="primary"
:disabled="!allowCreate"
+ @click="$emit('create', state.backupName)"
>
{{ $t("database.create-backup") }}
- </button>
+ </NButton>
</div>
- </form>
+ </div>
</template>
<script lang="ts" setup>
diff --git a/frontend/src/components/DatabaseBackupPanel.vue b/frontend/src/components/DatabaseBackupPanel.vue
index d6261c415b..a50f2b1e7a 100644
--- a/frontend/src/components/DatabaseBackupPanel.vue
+++ b/frontend/src/components/DatabaseBackupPanel.vue
@@ -11,7 +11,7 @@
{{ $t("database.backup.enabled") }}
</span>
</div>
- <div class="flex items-center">
+ <div class="flex items-center space-x-3">
<router-link
v-if="hasBackupPolicyViolation"
class="flex items-center normal-link text-sm"
@@ -20,16 +20,14 @@
<heroicons-outline:exclamation-circle class="w-4 h-4 mr-1" />
<span>{{ $t("database.backup-policy-violation") }}</span>
</router-link>
- <button
+ <NButton
v-if="allowAdmin"
- type="button"
- class="ml-4 btn-normal"
@click.prevent="state.showBackupSettingModal = true"
>
{{
hasBackupPolicyViolation ? $t("common.fix") : $t("common.edit")
}}
- </button>
+ </NButton>
</div>
</div>
<div class="mt-2 text-control">
@@ -71,14 +69,17 @@
placeholder="https://betteruptime.com/api/v1/heartbeat/..."
:disabled="!allowEdit"
/>
- <button
- v-if="allowEdit"
- class="btn-primary mt-2"
- :disabled="!allowEdit || !urlChanged"
- @click.prevent="updateBackupHookUrl()"
- >
- {{ $t("common.update") }}
- </button>
+ <div class="mt-2">
+ <NButton
+ v-if="allowEdit"
+ type="primary"
+ class="mt-2"
+ :disabled="!allowEdit || !urlChanged"
+ @click.prevent="updateBackupHookUrl()"
+ >
+ {{ $t("common.update") }}
+ </NButton>
+ </div>
</div>
</div>
<div
diff --git a/frontend/src/components/DebugLog/DebugLogTable.vue b/frontend/src/components/DebugLog/DebugLogTable.vue
index 2330f0ab87..2feaeca103 100644
--- a/frontend/src/components/DebugLog/DebugLogTable.vue
+++ b/frontend/src/components/DebugLog/DebugLogTable.vue
@@ -29,9 +29,7 @@
<BBTableCell class="table-cell w-28">
<NTooltip>
<template #trigger>
- <button
- type="button"
- class="group btn-normal items-center !px-3 !text-accent hover:!bg-gray-50"
+ <NButton
@click.stop="
() => {
$emit('view-detail', debugLog);
@@ -39,7 +37,7 @@
"
>
<heroicons-outline:document-magnifying-glass class="h-5 w-5" />
- </button>
+ </NButton>
</template>
<span class="whitespace-nowrap">
{{ $t("debug-log.table.operation.view-details") }}
diff --git a/frontend/src/components/IssueV1/components/ActivitySection/ActivityList.vue b/frontend/src/components/IssueV1/components/ActivitySection/ActivityList.vue
index 2b157df9eb..63a1d80bcf 100644
--- a/frontend/src/components/IssueV1/components/ActivitySection/ActivityList.vue
+++ b/frontend/src/components/IssueV1/components/ActivitySection/ActivityList.vue
@@ -18,12 +18,13 @@
class="mr-2 flex items-center space-x-2"
>
<!-- Edit Comment Button-->
- <button
- class="btn-icon"
+ <NButton
+ quaternary
+ size="tiny"
@click.prevent="onUpdateComment(item.activity)"
>
<heroicons-outline:pencil class="w-4 h-4" />
- </button>
+ </NButton>
</div>
</div>
</template>
@@ -50,21 +51,15 @@
"
class="flex space-x-2 mt-4 items-center justify-end"
>
- <button
- type="button"
- class="btn-normal border-none"
- @click.prevent="cancelEditComment"
- >
+ <NButton quaternary @click.prevent="cancelEditComment">
{{ $t("common.cancel") }}
- </button>
- <button
- type="button"
- class="btn-normal"
+ </NButton>
+ <NButton
:disabled="!allowUpdateComment"
@click.prevent="doUpdateComment"
>
{{ $t("common.save") }}
- </button>
+ </NButton>
</div>
</template>
</ActivityItem>
@@ -95,17 +90,13 @@
@change="(val: string) => state.newComment = val"
@submit="doCreateComment(state.newComment)"
/>
- <div class="mt-4 flex items-center justify-between space-x-4">
- <div>
- <button
- type="button"
- class="btn-normal"
- :disabled="state.newComment.length == 0"
- @click.prevent="doCreateComment(state.newComment)"
- >
- {{ $t("common.comment") }}
- </button>
- </div>
+ <div class="my-4 flex items-center justify-between">
+ <NButton
+ :disabled="state.newComment.length == 0"
+ @click.prevent="doCreateComment(state.newComment)"
+ >
+ {{ $t("common.comment") }}
+ </NButton>
</div>
</div>
</div>
diff --git a/frontend/src/components/IssueV1/components/PlanCheckSection/PlanCheckBar/PlanCheckResultDefinitionModal.vue b/frontend/src/components/IssueV1/components/PlanCheckSection/PlanCheckBar/PlanCheckResultDefinitionModal.vue
index 12c79a14dc..9dd9277c4b 100644
--- a/frontend/src/components/IssueV1/components/PlanCheckSection/PlanCheckBar/PlanCheckResultDefinitionModal.vue
+++ b/frontend/src/components/IssueV1/components/PlanCheckSection/PlanCheckBar/PlanCheckResultDefinitionModal.vue
@@ -7,13 +7,9 @@
</div>
</div>
<div class="mt-4 pt-2 border-t flex justify-end">
- <button
- type="button"
- class="btn-normal py-2 px-4"
- @click.prevent="emit('cancel')"
- >
+ <NButton @click.prevent="emit('cancel')">
{{ $t("common.cancel") }}
- </button>
+ </NButton>
</div>
</div>
</BBModal>
diff --git a/frontend/src/components/IssueV1/components/StatementSection/SDLView/SDLView.vue b/frontend/src/components/IssueV1/components/StatementSection/SDLView/SDLView.vue
index ec5a207072..14f765140a 100644
--- a/frontend/src/components/IssueV1/components/StatementSection/SDLView/SDLView.vue
+++ b/frontend/src/components/IssueV1/components/StatementSection/SDLView/SDLView.vue
@@ -2,13 +2,9 @@
<div class="flex flex-col gap-y-2">
<div v-if="!hasFeature('bb.feature.sql-review')">
<div class="flex space-x-4 flex-1">
- <button
- type="button"
- class="btn-small py-0.5 inline-flex items-center text-accent"
- @click.prevent="state.showFeatureModal = true"
- >
+ <NButton size="small" @click.prevent="state.showFeatureModal = true">
🎈{{ $t("sql-review.unlock-full-feature") }}
- </button>
+ </NButton>
</div>
</div>
diff --git a/frontend/src/components/MarkdownEditor.vue b/frontend/src/components/MarkdownEditor.vue
index 674df7fc1f..88b9a4cf7d 100644
--- a/frontend/src/components/MarkdownEditor.vue
+++ b/frontend/src/components/MarkdownEditor.vue
@@ -26,7 +26,7 @@
<div v-for="(toolbar, i) in toolbarItems" :key="i">
<NTooltip :show-arrow="true">
<template #trigger>
- <button class="hover:bg-gray-100 p-2" @click="toolbar.action">
+ <NButton quaternary size="small" @click="toolbar.action">
<template v-if="toolbar.text">
<span class="font-bold">{{ toolbar.text }}</span>
</template>
@@ -44,7 +44,7 @@
class="w-4 h-4"
/>
</template>
- </button>
+ </NButton>
</template>
<span class="w-56 text-sm">
{{ toolbar.tooltip }}
diff --git a/frontend/src/components/ProjectVersionControlPanel.vue b/frontend/src/components/ProjectVersionControlPanel.vue
index 7da648c56a..9d07c2aad9 100644
--- a/frontend/src/components/ProjectVersionControlPanel.vue
+++ b/frontend/src/components/ProjectVersionControlPanel.vue
@@ -61,14 +61,12 @@
</div>
<template v-if="allowEdit && state.workflowType == Workflow.VCS">
<div class="mt-4 flex items-center justify-end">
- <button
- type="button"
- class="btn-primary inline-flex justify-center py-2 px-2"
- @click.prevent="enterWizard(true)"
- >
+ <NButton type="primary" @click.prevent="enterWizard(true)">
{{ $t("workflow.configure-gitops") }}
- <heroicons-outline:chevron-right class="ml-1 w-5 h-5" />
- </button>
+ <template #icon>
+ <heroicons-outline:chevron-right class="w-5 h-5" />
+ </template>
+ </NButton>
</div>
</template>
</template>
diff --git a/frontend/src/components/ProjectWebhookCard.vue b/frontend/src/components/ProjectWebhookCard.vue
index c4913849f9..58567adb28 100644
--- a/frontend/src/components/ProjectWebhookCard.vue
+++ b/frontend/src/components/ProjectWebhookCard.vue
@@ -30,13 +30,9 @@
{{ projectWebhook.title }}
</h3>
</div>
- <button
- type="button"
- class="btn-normal py-2 px-4"
- @click.prevent="viewProjectWebhook"
- >
+ <NButton @click.prevent="viewProjectWebhook">
{{ $t("common.view") }}
- </button>
+ </NButton>
</div>
<div class="border-t border-block-border">
<dl class="divide-y divide-block-border">
diff --git a/frontend/src/components/ReleaseRemindModal.vue b/frontend/src/components/ReleaseRemindModal.vue
index 987e40fc33..2a5e269128 100644
--- a/frontend/src/components/ReleaseRemindModal.vue
+++ b/frontend/src/components/ReleaseRemindModal.vue
@@ -29,22 +29,12 @@
/>
</div>
<div class="mt-7 flex justify-end space-x-2">
- <button
- type="button"
- class="btn-normal"
- @click.prevent="$emit('cancel')"
- >
+ <NButton @click="$emit('cancel')">
{{ $t("common.dismiss") }}
- </button>
- <a
- type="button"
- class="btn-primary"
- target="_blank"
- :href="link"
- @click="$emit('cancel')"
- >
+ </NButton>
+ <NButton type="primary" @click="onClick">
{{ $t("common.learn-more") }}
- </a>
+ </NButton>
</div>
</div>
</BBModal>
@@ -55,7 +45,7 @@ import { NCheckbox } from "naive-ui";
import { computed } from "vue";
import { useActuatorV1Store, useSubscriptionV1Store } from "@/store";
-defineEmits(["cancel"]);
+const emit = defineEmits(["cancel"]);
const actuatorStore = useActuatorV1Store();
const subscriptionStore = useSubscriptionV1Store();
@@ -66,4 +56,9 @@ const link = computed(() => {
}
return subscriptionStore.purchaseLicenseUrl;
});
+
+const onClick = () => {
+ window.open(link.value, "_blank");
+ emit("cancel");
+};
</script>
diff --git a/frontend/src/components/RepositoryPanel.vue b/frontend/src/components/RepositoryPanel.vue
index 894a276d64..46bf4758ca 100644
--- a/frontend/src/components/RepositoryPanel.vue
+++ b/frontend/src/components/RepositoryPanel.vue
@@ -105,15 +105,14 @@
:confirm-description="$t('repository.restore-ui-workflow-description')"
@confirm="() => restoreToUIWorkflowType(true)"
/>
- <div>
- <button
- type="button"
- class="btn-primary ml-3 inline-flex justify-center py-2 px-4"
+ <div class="ml-3">
+ <NButton
+ type="primary"
:disabled="!allowUpdate"
@click.prevent="doUpdate"
>
{{ $t("common.update") }}
- </button>
+ </NButton>
</div>
</div>
<BBModal
@@ -216,13 +215,9 @@
</div>
<div class="flex justify-end pt-4 gap-x-2">
- <button
- type="button"
- class="btn-normal"
- @click.prevent="onSQLReviewCIModalClose"
- >
+ <NButton @click.prevent="onSQLReviewCIModalClose">
{{ $t("common.close") }}
- </button>
+ </NButton>
</div>
</div>
</BBModal>
@@ -251,13 +246,9 @@
</div>
<div class="flex justify-end pt-4 gap-x-2">
- <button
- type="button"
- class="btn-normal"
- @click.prevent="state.showDisableSQLReviewCIModal = false"
- >
+ <NButton @click.prevent="state.showDisableSQLReviewCIModal = false">
{{ $t("common.close") }}
- </button>
+ </NButton>
</div>
</div>
</BBModal>
diff --git a/frontend/src/components/SQLReview/components/SQLRuleTable.vue b/frontend/src/components/SQLReview/components/SQLRuleTable.vue
index 35af408b58..2203277ffd 100644
--- a/frontend/src/components/SQLReview/components/SQLRuleTable.vue
+++ b/frontend/src/components/SQLReview/components/SQLRuleTable.vue
@@ -70,13 +70,12 @@
/>
</div>
<div class="bb-grid-cell justify-center">
- <button
- class="btn-normal !px-3 !py-1"
+ <NButton
:disabled="!isRuleAvailable(rule)"
@click="setActiveRule(rule)"
>
{{ editable ? $t("common.edit") : $t("common.view") }}
- </button>
+ </NButton>
</div>
<div
v-if="rule.comment || getRuleLocalization(rule.type).description"
diff --git a/frontend/src/components/TrialModal.vue b/frontend/src/components/TrialModal.vue
index 965ed4148a..49ae8958c6 100644
--- a/frontend/src/components/TrialModal.vue
+++ b/frontend/src/components/TrialModal.vue
@@ -26,11 +26,10 @@
</template>
</i18n-t>
</p>
- <div class="mt-7 flex justify-end space-x-2">
- <button
+ <div class="mt-7 flex justify-end">
+ <NButton
v-if="subscriptionStore.canTrial"
- type="button"
- class="btn-primary"
+ type="primary"
@click.prevent="trialSubscription"
>
{{
@@ -38,15 +37,10 @@
days: subscriptionStore.trialingDays,
})
}}
- </button>
- <button
- v-else
- type="button"
- class="btn-primary"
- @click.prevent="learnMore"
- >
+ </NButton>
+ <NButton v-else type="primary" @click.prevent="learnMore">
{{ $t("common.learn-more") }}
- </button>
+ </NButton>
</div>
</div>
</BBModal>
diff --git a/frontend/src/components/UpgradeSubscriptionButton.vue b/frontend/src/components/UpgradeSubscriptionButton.vue
index 44cd0a0b4c..c25cb6a18b 100644
--- a/frontend/src/components/UpgradeSubscriptionButton.vue
+++ b/frontend/src/components/UpgradeSubscriptionButton.vue
@@ -3,13 +3,9 @@
v-if="actionText != ''"
class="flex items-center justify-end mt-2 md:mt-0 md:ml-2"
>
- <button
- type="button"
- class="btn-primary whitespace-nowrap"
- @click.prevent="onClick"
- >
+ <NButton type="primary" class="whitespace-nowrap" @click.prevent="onClick">
{{ $t(actionText) }}
- </button>
+ </NButton>
</div>
<WeChatQRModal
diff --git a/frontend/src/components/User/Settings/UserTable.vue b/frontend/src/components/User/Settings/UserTable.vue
index cf876be014..7eae53054a 100644
--- a/frontend/src/components/User/Settings/UserTable.vue
+++ b/frontend/src/components/User/Settings/UserTable.vue
@@ -51,7 +51,7 @@
<template v-else>
<UserAvatar :user="user" />
- <div class="flex flex-row">
+ <div class="flex flex-row items-center">
<div class="flex flex-col">
<div class="flex flex-row items-center space-x-2">
<router-link :to="`/users/${user.email}`" class="normal-link">
@@ -83,26 +83,33 @@
{{ user.email }}
</span>
</div>
- <template
+ <div
v-if="user.userType === UserType.SERVICE_ACCOUNT && allowEdit"
+ class="ml-3 text-xs"
>
- <button
+ <NButton
v-if="user.serviceKey"
- class="inline-flex gap-x-1 text-xs ml-3 my-1 px-2 rounded bg-gray-100 text-gray-500 hover:text-gray-700 hover:bg-gray-200 items-center"
+ tertiary
+ size="small"
@click.prevent="() => copyServiceKey(user.serviceKey)"
>
- <heroicons-outline:clipboard class="w-4 h-4" />
+ <template #icon>
+ <heroicons-outline:clipboard class="w-4 h-4" />
+ </template>
{{ $t("settings.members.copy-service-key") }}
- </button>
- <button
+ </NButton>
+ <NButton
v-else
- class="inline-flex gap-x-1 text-xs ml-3 my-1 px-2 rounded bg-gray-100 text-gray-500 hover:text-gray-700 hover:bg-gray-200 items-center"
+ tertiary
+ size="small"
@click.prevent="() => tryResetServiceKey(user)"
>
- <heroicons-outline:reply class="w-4 h-4" />
+ <template #icon>
+ <heroicons-outline:reply class="w-4 h-4" />
+ </template>
{{ $t("settings.members.reset-service-key") }}
- </button>
- </template>
+ </NButton>
+ </div>
</div>
</template>
</div>
diff --git a/frontend/src/components/VCS/VCSCard.vue b/frontend/src/components/VCS/VCSCard.vue
index baeebf56b0..23a39bf70f 100644
--- a/frontend/src/components/VCS/VCSCard.vue
+++ b/frontend/src/components/VCS/VCSCard.vue
@@ -9,13 +9,9 @@
{{ vcs.title }}
</h3>
</div>
- <button
- type="button"
- class="btn-normal py-2 px-4"
- @click.prevent="editVCS"
- >
+ <NButton @click.prevent="editVCS">
{{ $t("common.edit") }}
- </button>
+ </NButton>
</div>
<div class="border-t border-block-border">
<dl class="divide-y divide-block-border">
diff --git a/frontend/src/components/v2/Model/DatabaseV1Table/DatabaseV1Table.vue b/frontend/src/components/v2/Model/DatabaseV1Table/DatabaseV1Table.vue
index 8d15dcca19..b4e4e59e8a 100644
--- a/frontend/src/components/v2/Model/DatabaseV1Table/DatabaseV1Table.vue
+++ b/frontend/src/components/v2/Model/DatabaseV1Table/DatabaseV1Table.vue
@@ -115,21 +115,16 @@
<div class="col-span-1 w-96">
{{ $t("database.incorrect-project-warning") }}
</div>
- <div class="pt-6 flex justify-end">
- <button
- type="button"
- class="btn-normal py-2 px-4"
- @click.prevent="handleIncorrectProjectModalCancel"
- >
+ <div class="pt-6 flex justify-end space-x-3">
+ <NButton @click.prevent="handleIncorrectProjectModalCancel">
{{ $t("common.cancel") }}
- </button>
- <button
- type="button"
- class="btn-primary ml-3 inline-flex justify-center py-2 px-4"
+ </NButton>
+ <NButton
+ type="primary"
@click.prevent="handleIncorrectProjectModalConfirm"
>
{{ $t("database.go-to-transfer") }}
- </button>
+ </NButton>
</div>
</BBModal>
</template>
diff --git a/frontend/src/views/BannerDemo.vue b/frontend/src/views/BannerDemo.vue
index c079bb2269..16425925b5 100644
--- a/frontend/src/views/BannerDemo.vue
+++ b/frontend/src/views/BannerDemo.vue
@@ -34,16 +34,13 @@
<heroicons-outline:cloud class="ml-1 w-6 h-6" />
</a>
</div>
- <div class="order-2 flex-shrink-0 sm:order-3 sm:ml-3">
- <button
- type="button"
- class="-mr-1 flex p-2 rounded-md hover:bg-accent-hover focus:outline-none focus:ring-2 focus:ring-white sm:-mr-2"
- @click.prevent="show = false"
- >
+
+ <div class="order-2 flex-shrink-0 sm:order-3 sm:ml-3 -mr-1">
+ <NButton quaternary @click.prevent="show = false">
<span class="sr-only">{{ $t("common.dismiss") }}</span>
<!-- Heroicon name: outline/x -->
<heroicons-outline:x class="h-6 w-6 text-white" />
- </button>
+ </NButton>
</div>
</div>
</div>
diff --git a/frontend/src/views/BannerExternalUrl.vue b/frontend/src/views/BannerExternalUrl.vue
index 3bcea1ba6d..799e8a0b9f 100644
--- a/frontend/src/views/BannerExternalUrl.vue
+++ b/frontend/src/views/BannerExternalUrl.vue
@@ -20,16 +20,12 @@
<heroicons-outline:wrench-screwdriver class="ml-1 w-5 h-5" />
</router-link>
</div>
- <div class="order-2 flex-shrink-0 sm:order-3 sm:ml-3">
- <button
- type="button"
- class="-mr-1 flex p-2 rounded-md hover:bg-accent-hover focus:outline-none focus:ring-2 focus:ring-white sm:-mr-2"
- @click.prevent="show = false"
- >
+ <div class="order-2 flex-shrink-0 sm:order-3 sm:ml-3 -mr-1">
+ <NButton @click.prevent="show = false">
<span class="sr-only">{{ $t("common.dismiss") }}</span>
<!-- Heroicon name: outline/x -->
<heroicons-outline:x class="h-6 w-6 text-white" />
- </button>
+ </NButton>
</div>
</div>
</div>
diff --git a/frontend/src/views/BannerUpgradeSubscription.vue b/frontend/src/views/BannerUpgradeSubscription.vue
index 268382a385..da48069e24 100644
--- a/frontend/src/views/BannerUpgradeSubscription.vue
+++ b/frontend/src/views/BannerUpgradeSubscription.vue
@@ -27,13 +27,12 @@
</template>
</i18n-t>
</div>
- <button
- class="btn btn-normal btn-small flex flex-row justify-center items-center ml-2 !py-1 px-2"
- @click="gotoSubscriptionPage"
- >
- {{ $t("subscription.button.upgrade") }}
- <heroicons-outline:sparkles class="w-4 h-auto text-accent ml-1" />
- </button>
+ <div class="ml-2">
+ <NButton size="small" @click="gotoSubscriptionPage">
+ {{ $t("subscription.button.upgrade") }}
+ <heroicons-outline:sparkles class="w-4 h-auto text-accent ml-1" />
+ </NButton>
+ </div>
</div>
</div>
</div>
@@ -63,14 +62,11 @@
</li>
</ul>
</div>
- <button
- class="mt-3 mb-4 w-full btn btn-primary"
- @click="gotoSubscriptionPage"
- >
- <span class="w-full text-center">{{
- $t("subscription.upgrade-now")
- }}</span>
- </button>
+ <div class="mt-3 mb-4 w-full">
+ <NButton type="primary" style="width: 100%" @click="gotoSubscriptionPage">
+ {{ $t("subscription.upgrade-now") }}
+ </NButton>
+ </div>
</BBModal>
</template>
diff --git a/frontend/src/views/ChangeHistoryDetail.vue b/frontend/src/views/ChangeHistoryDetail.vue
index 086a655c07..bcfacc50e2 100644
--- a/frontend/src/views/ChangeHistoryDetail.vue
+++ b/frontend/src/views/ChangeHistoryDetail.vue
@@ -259,13 +259,9 @@
:readonly="true"
/>
<div class="flex justify-end">
- <button
- type="button"
- class="btn-primary"
- @click.prevent="state.viewDrift = false"
- >
+ <NButton type="primary" @click.prevent="state.viewDrift = false">
{{ $t("common.close") }}
- </button>
+ </NButton>
</div>
</div>
</BBModal>
diff --git a/frontend/src/views/Inbox.vue b/frontend/src/views/Inbox.vue
index 1bc575d6d8..1c5ec2089a 100644
--- a/frontend/src/views/Inbox.vue
+++ b/frontend/src/views/Inbox.vue
@@ -22,9 +22,9 @@
</div>
<InboxList class="opacity-70" :inbox-list="state.readList" />
<div class="mt-2 flex justify-end">
- <button type="button" class="normal-link" @click.prevent="viewOlder">
+ <NButton quaternary type="primary" @click.prevent="viewOlder">
{{ $t("inbox.view-older") }}
- </button>
+ </NButton>
</div>
</div>
</div>
diff --git a/frontend/src/views/OAuthCallback.vue b/frontend/src/views/OAuthCallback.vue
index 1536ff80e3..591c4abc7c 100644
--- a/frontend/src/views/OAuthCallback.vue
+++ b/frontend/src/views/OAuthCallback.vue
@@ -2,17 +2,12 @@
<div class="p-4">
<div v-if="state.hasError" class="mt-2">
<div>{{ state.message }}</div>
- <button
- v-if="state.oAuthState?.popup"
- type="button"
- class="btn-normal"
- @click="window.close()"
- >
+ <NButton v-if="state.oAuthState?.popup" @click="window.close()">
Close
- </button>
- <router-link v-else to="/auth" class="btn-normal"
- >Back to Sign in</router-link
- >
+ </NButton>
+ <router-link v-else to="/auth" class="btn-normal">
+ Back to Sign in
+ </router-link>
</div>
</div>
</template>
diff --git a/frontend/src/views/SchemaGroupDetail.vue b/frontend/src/views/SchemaGroupDetail.vue
index ee57cd1fd4..3212bd9264 100644
--- a/frontend/src/views/SchemaGroupDetail.vue
+++ b/frontend/src/views/SchemaGroupDetail.vue
@@ -49,13 +49,9 @@
<div
class="flex flex-row justify-end items-center flex-wrap shrink gap-x-2 gap-y-2"
>
- <button
- type="button"
- class="btn-normal"
- @click.prevent="state.showConfigurePanel = true"
- >
+ <NButton @click.prevent="state.showConfigurePanel = true">
{{ $t("common.configure") }}
- </button>
+ </NButton>
</div>
</div>
diff --git a/frontend/src/views/SchemaTemplate/ColumnTypesUpdateFailedModal.vue b/frontend/src/views/SchemaTemplate/ColumnTypesUpdateFailedModal.vue
index af7b5b4ace..b622746088 100644
--- a/frontend/src/views/SchemaTemplate/ColumnTypesUpdateFailedModal.vue
+++ b/frontend/src/views/SchemaTemplate/ColumnTypesUpdateFailedModal.vue
@@ -29,16 +29,12 @@
</div>
</div>
<div class="mt-7 flex justify-end space-x-2">
- <button type="button" class="btn-normal" @click.prevent="$emit('close')">
+ <NButton @click.prevent="$emit('close')">
{{ $t("schema-template.column-type-restriction.back-to-edit") }}
- </button>
- <button
- type="button"
- class="btn-primary"
- @click="$emit('save-all', props.fieldTemplates)"
- >
+ </NButton>
+ <NButton type="primary" @click="$emit('save-all', props.fieldTemplates)">
{{ $t("schema-template.column-type-restriction.add-and-save") }}
- </button>
+ </NButton>
</div>
</BBModal>
</template>
diff --git a/frontend/src/views/auth/Activate.vue b/frontend/src/views/auth/Activate.vue
index 7f93032df2..622190d0bf 100644
--- a/frontend/src/views/auth/Activate.vue
+++ b/frontend/src/views/auth/Activate.vue
@@ -70,15 +70,10 @@
</div>
</div>
- <div>
- <span class="block w-full rounded-md shadow-sm">
- <button
- type="submit"
- class="btn-success w-full flex justify-center py-2 px-4"
- >
- {{ $t("common.activate") }}
- </button>
- </span>
+ <div class="w-full">
+ <NButton attr-type="submit" type="primary" style="width: 100%">
+ {{ $t("common.activate") }}
+ </NButton>
</div>
</form>
</div>
diff --git a/frontend/src/views/auth/MultiFactor.vue b/frontend/src/views/auth/MultiFactor.vue
index a1b65ac144..47d49b0077 100644
--- a/frontend/src/views/auth/MultiFactor.vue
+++ b/frontend/src/views/auth/MultiFactor.vue
@@ -34,9 +34,11 @@
type="text"
/>
</template>
- <button type="submit" class="btn-success w-full mt-4">
- <span class="w-full text-center">{{ $t("common.verify") }}</span>
- </button>
+ <div class="w-full mt-4">
+ <NButton attr-type="submit" type="primary">
+ {{ $t("common.verify") }}
+ </NButton>
+ </div>
<p class="textinfolabel mt-2">
{{ challengeDescription }}
</p>
diff --git a/frontend/src/views/auth/PasswordReset.vue b/frontend/src/views/auth/PasswordReset.vue
index 1ece3aba8c..2a332d1e01 100644
--- a/frontend/src/views/auth/PasswordReset.vue
+++ b/frontend/src/views/auth/PasswordReset.vue
@@ -33,16 +33,15 @@
</div>
</div>
- <div>
- <span class="block w-full rounded-md shadow-sm">
- <button
- type="submit"
- :disabled="!allowReset"
- class="btn-primary w-full flex justify-center py-2 px-4"
- >
- {{ $t("auth.password-reset.send-reset-link") }}
- </button>
- </span>
+ <div class="w-full">
+ <NButton
+ attr-type="submit"
+ type="primary"
+ :disabled="!allowReset"
+ style="width: 100%"
+ >
+ {{ $t("auth.password-reset.send-reset-link") }}
+ </NButton>
</div>
</form>
</div>
diff --git a/frontend/src/views/auth/Signin.vue b/frontend/src/views/auth/Signin.vue
index aad6353c96..7f1cb4481e 100644
--- a/frontend/src/views/auth/Signin.vue
+++ b/frontend/src/views/auth/Signin.vue
@@ -87,16 +87,15 @@
</div>
</div>
- <div>
- <span class="flex w-full rounded-md items-center">
- <button
- type="submit"
- :disabled="!allowSignin()"
- class="btn-primary justify-center flex-grow py-2 px-4"
- >
- {{ $t("common.sign-in") }}
- </button>
- </span>
+ <div class="w-full">
+ <NButton
+ attr-type="submit"
+ type="primary"
+ :disabled="!allowSignin()"
+ style="width: 100%"
+ >
+ {{ $t("common.sign-in") }}
+ </NButton>
</div>
</form>
@@ -197,16 +196,15 @@
</div>
</div>
- <div>
- <span class="flex w-full rounded-md items-center">
- <button
- type="submit"
- :disabled="!allowSignin(identityProvider.name)"
- class="btn-primary justify-center flex-grow py-2 px-4"
- >
- {{ $t("common.sign-in") }}
- </button>
- </span>
+ <div class="w-full">
+ <NButton
+ attr-type="submit"
+ type="primary"
+ :disabled="!allowSignin(identityProvider.name)"
+ style="width: 100%"
+ >
+ {{ $t("common.sign-in") }}
+ </NButton>
</div>
</form>
</n-tab-pane>
@@ -228,19 +226,18 @@
v-for="identityProvider in separatedIdentityProviderList"
:key="identityProvider.name"
>
- <button
- type="button"
- class="btn-normal flex justify-center w-full h-10 mb-2"
- @click.prevent="trySigninWithIdentityProvider(identityProvider)"
- >
- <span class="text-center align-middle">
+ <div class="w-full mb-2">
+ <NButton
+ style="width: 100%"
+ @click.prevent="trySigninWithIdentityProvider(identityProvider)"
+ >
{{
$t("auth.sign-in.sign-in-with-idp", {
idp: identityProvider.title,
})
}}
- </span>
- </button>
+ </NButton>
+ </div>
</template>
</div>
</div>
diff --git a/frontend/src/views/auth/Signup.vue b/frontend/src/views/auth/Signup.vue
index 4901c9bbe7..b9e5ddbbd4 100644
--- a/frontend/src/views/auth/Signup.vue
+++ b/frontend/src/views/auth/Signup.vue
@@ -181,20 +181,19 @@
</i18n-t>
</div>
- <div>
- <span class="block w-full rounded-md shadow-sm">
- <button
- type="submit"
- :disabled="!allowSignup"
- class="btn-primary w-full flex justify-center py-2 px-4"
- >
- {{
- needAdminSetup
- ? $t("auth.sign-up.create-admin-account")
- : $t("common.sign-up")
- }}
- </button>
- </span>
+ <div class="w-full">
+ <NButton
+ attr-type="submit"
+ type="primary"
+ :disabled="!allowSignup"
+ style="width: 100%"
+ >
+ {{
+ needAdminSetup
+ ? $t("auth.sign-up.create-admin-account")
+ : $t("common.sign-up")
+ }}
+ </NButton>
</div>
</form>
</div>