Skip to content

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

chore: deprecate BBCheckbox (#10025)

ecmadaoadbb8b1aa868
diff --git a/frontend/src/bbkit/BBAttention.vue b/frontend/src/bbkit/BBAttention.vue
index 2db213418b..9c0509863c 100644
--- a/frontend/src/bbkit/BBAttention.vue
+++ b/frontend/src/bbkit/BBAttention.vue
@@ -59,8 +59,6 @@ const displayTitle = computed(() => {
const buttonType = computed(() => {
switch (props.type) {
- case "warning":
- return "warning";
case "error":
return "default";
default:
diff --git a/frontend/src/bbkit/BBCheckbox.vue b/frontend/src/bbkit/BBCheckbox.vue
deleted file mode 100644
index 552ab628e2..0000000000
--- a/frontend/src/bbkit/BBCheckbox.vue
+++ /dev/null
@@ -1,64 +0,0 @@
-<template>
- <div class="relative flex items-start">
- <div class="flex items-center h-5 cursor-pointer">
- <input
- type="checkbox"
- class="h-4 w-4 text-accent rounded cursor-pointer disabled:cursor-not-allowed border-control-border focus:ring-accent"
- :class="[disabled && !value && 'bg-control-bg']"
- :disabled="disabled"
- :checked="value"
- @input="
- () => {
- on = !on;
- $emit('toggle', on);
- }
- "
- />
- </div>
- <div v-if="title" class="flex flex-col ml-2 text-sm">
- <label
- class="font-medium"
- :class="disabled ? 'text-gray-400' : 'text-main'"
- >{{ title }}</label
- >
- <template v-if="label">
- <label
- class="mt-1 font-normal"
- :class="disabled ? 'text-gray-400' : 'text-gray-500'"
- >{{ label }}</label
- >
- </template>
- </div>
- </div>
-</template>
-
-<script lang="ts" setup>
-import { ref, watch, withDefaults } from "vue";
-
-const props = withDefaults(
- defineProps<{
- title?: string;
- label?: string;
- value?: boolean;
- disabled?: boolean;
- }>(),
- {
- title: "",
- label: "",
- value: false,
- disabled: false,
- }
-);
-
-defineEmits<{
- (event: "toggle", on: boolean): void;
-}>();
-
-const on = ref(props.value);
-watch(
- () => props.value,
- (cur) => {
- on.value = cur;
- }
-);
-</script>
diff --git a/frontend/src/bbkit/index.ts b/frontend/src/bbkit/index.ts
index 4c7cae7d3d..e3642dd973 100644
--- a/frontend/src/bbkit/index.ts
+++ b/frontend/src/bbkit/index.ts
@@ -3,7 +3,6 @@ import BBAttention from "./BBAttention.vue";
import BBAvatar from "./BBAvatar.vue";
import BBBetaBadge from "./BBBetaBadge.vue";
import BBButtonConfirm from "./BBButtonConfirm.vue";
-import BBCheckbox from "./BBCheckbox.vue";
import BBContextMenu from "./BBContextMenu.vue";
import BBDialog from "./BBDialog.vue";
import { BBGrid } from "./BBGrid";
@@ -26,7 +25,6 @@ export {
BBAttention,
BBAvatar,
BBButtonConfirm,
- BBCheckbox,
BBContextMenu,
BBModal,
BBDialog,
diff --git a/frontend/src/components/AuditLog/AuditLogTable.vue b/frontend/src/components/AuditLog/AuditLogTable.vue
index b651b436c0..4170ce985e 100644
--- a/frontend/src/components/AuditLog/AuditLogTable.vue
+++ b/frontend/src/components/AuditLog/AuditLogTable.vue
@@ -37,9 +37,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', auditLog);
@@ -47,7 +45,7 @@
"
>
<heroicons-outline:document-magnifying-glass class="h-5 w-5" />
- </button>
+ </NButton>
</template>
<span class="whitespace-nowrap">
{{ $t("audit-log.table.view-details") }}
diff --git a/frontend/src/components/FeatureGuard/FeatureModal.vue b/frontend/src/components/FeatureGuard/FeatureModal.vue
index c3095a4f04..a37e2091d0 100644
--- a/frontend/src/components/FeatureGuard/FeatureModal.vue
+++ b/frontend/src/components/FeatureGuard/FeatureModal.vue
@@ -77,34 +77,29 @@
</p>
</div>
<div class="mt-7 flex justify-end space-x-2">
- <button
+ <NButton
v-if="!hasPermission"
- type="button"
- class="btn-primary"
+ type="primary"
@click.prevent="$emit('cancel')"
>
{{ $t("common.ok") }}
- </button>
+ </NButton>
<template v-else-if="subscriptionStore.canTrial">
- <button
- type="button"
- class="btn-primary"
- @click.prevent="trialSubscription"
- >
+ <NButton type="primary" @click.prevent="trialSubscription">
{{
$t("subscription.request-n-days-trial", {
days: subscriptionStore.trialingDays,
})
}}
- </button>
+ </NButton>
</template>
- <button v-else type="button" class="btn-primary" @click.prevent="ok">
+ <NButton v-else type="primary" @click.prevent="ok">
{{
instanceMissingLicense
? $t("subscription.instance-assignment.assign-license")
: $t("common.learn-more")
}}
- </button>
+ </NButton>
</div>
</div>
</BBModal>
diff --git a/frontend/src/components/GeneralSetting/BrandingSetting.vue b/frontend/src/components/GeneralSetting/BrandingSetting.vue
index 3035eda712..ca2b59065f 100644
--- a/frontend/src/components/GeneralSetting/BrandingSetting.vue
+++ b/frontend/src/components/GeneralSetting/BrandingSetting.vue
@@ -81,9 +81,9 @@
<div class="flex justify-end gap-x-3">
<NPopconfirm v-if="allowDelete" @positive-click="deleteLogo">
<template #trigger>
- <button type="button" class="btn-normal" :disabled="!allowEdit">
+ <NButton :disabled="!allowEdit">
{{ $t("common.delete") }}
- </button>
+ </NButton>
</template>
<template #default>
{{ t("settings.general.workspace.confirm-delete-custom-logo") }}
diff --git a/frontend/src/components/IdentityProviderCreateForm.vue b/frontend/src/components/IdentityProviderCreateForm.vue
index 041c0612dd..5b6df51d1b 100644
--- a/frontend/src/components/IdentityProviderCreateForm.vue
+++ b/frontend/src/components/IdentityProviderCreateForm.vue
@@ -263,14 +263,10 @@
{{ $t("settings.sso.form.connection-security") }}
</p>
<p class="textinfolabel mt-1">
- <BBCheckbox
- :title="$t('settings.sso.form.connection-security-skip-tls-verify')"
- :v-model="configForOAuth2.skipTlsVerify"
+ <NCheckbox
+ v-model:checked="configForOAuth2.skipTlsVerify"
+ :label="$t('settings.sso.form.connection-security-skip-tls-verify')"
:disabled="!allowEdit"
- @toggle="
- () =>
- (configForOAuth2.skipTlsVerify = !configForOAuth2.skipTlsVerify)
- "
/>
</p>
</div>
@@ -461,13 +457,10 @@
{{ $t("settings.sso.form.connection-security") }}
</p>
<p class="textinfolabel mt-1">
- <BBCheckbox
- :title="$t('settings.sso.form.connection-security-skip-tls-verify')"
- :value="configForOIDC.skipTlsVerify"
+ <NCheckbox
+ v-model:checked="configForOIDC.skipTlsVerify"
+ :label="$t('settings.sso.form.connection-security-skip-tls-verify')"
:disabled="!allowEdit"
- @toggle="
- () => (configForOIDC.skipTlsVerify = !configForOIDC.skipTlsVerify)
- "
/>
</p>
</div>
@@ -663,13 +656,10 @@
{{ $t("settings.sso.form.connection-security") }}
</p>
<p class="textinfolabel mt-1">
- <BBCheckbox
- :title="$t('settings.sso.form.connection-security-skip-tls-verify')"
- :value="configForLDAP.skipTlsVerify"
+ <NCheckbox
+ v-model:checked="configForLDAP.skipTlsVerify"
+ :label="$t('settings.sso.form.connection-security-skip-tls-verify')"
:disabled="!allowEdit"
- @toggle="
- () => (configForLDAP.skipTlsVerify = !configForLDAP.skipTlsVerify)
- "
/>
</p>
</div>
@@ -760,14 +750,13 @@
class="mt-4 space-x-4 w-full flex flex-row justify-between items-center"
>
<div class="space-x-4 flex flex-row justify-start items-center">
- <button
+ <NButton
v-if="!isDeleted"
:disabled="!allowTestConnection"
- class="btn-normal"
@click="testConnection"
>
{{ $t("identity-provider.test-connection") }}
- </button>
+ </NButton>
<template v-if="!isCreating">
<BBButtonConfirm
v-if="!isDeleted"
@@ -796,32 +785,31 @@
class="space-x-4 flex flex-row justify-end items-center"
>
<template v-if="isCreating">
- <button class="btn-normal" @click="handleCancelButtonClick">
+ <NButton @click="handleCancelButtonClick">
{{ $t("common.cancel") }}
- </button>
- <button
- class="btn-primary"
+ </NButton>
+ <NButton
+ type="primary"
:disabled="!allowCreate"
@click="handleCreateButtonClick"
>
{{ $t("common.create") }}
- </button>
+ </NButton>
</template>
<template v-else>
- <button
- class="btn-normal"
+ <NButton
:disabled="!allowUpdate"
@click="handleDiscardChangesButtonClick"
>
{{ $t("common.discard-changes") }}
- </button>
- <button
- class="btn-primary"
+ </NButton>
+ <NButton
+ class="primary"
:disabled="!allowUpdate"
@click="handleUpdateButtonClick"
>
{{ $t("common.update") }}
- </button>
+ </NButton>
</template>
</div>
</div>
@@ -830,7 +818,7 @@
<script lang="ts" setup>
import { cloneDeep, head, isEqual } from "lodash-es";
-import { NRadioGroup, NRadio, NTooltip } from "naive-ui";
+import { NRadioGroup, NCheckbox, NRadio, NTooltip } from "naive-ui";
import { ClientError, Status } from "nice-grpc-common";
import { computed, reactive, ref, onMounted, watch } from "vue";
import { useI18n } from "vue-i18n";
diff --git a/frontend/src/components/ProjectWebhookForm.vue b/frontend/src/components/ProjectWebhookForm.vue
index 1fca41ea55..7eecd34aed 100644
--- a/frontend/src/components/ProjectWebhookForm.vue
+++ b/frontend/src/components/ProjectWebhookForm.vue
@@ -215,16 +215,18 @@
:key="index"
class="mt-4 space-y-4"
>
- <BBCheckbox
- :title="item.title"
- :label="item.label"
- :value="isEventOn(item.activity)"
- @toggle="
+ <div>
+ <NCheckbox
+ :label="item.title"
+ :checked="isEventOn(item.activity)"
+ @update:checked="
(on: boolean) => {
toggleEvent(item.activity, on);
}
"
- />
+ />
+ <div class="textinfolabel">{{ item.label }}</div>
+ </div>
</div>
</div>
<NButton @click.prevent="testWebhook">
@@ -246,31 +248,29 @@
:require-confirm="true"
@confirm="deleteWebhook"
/>
- <div>
- <button type="button" class="btn-normal" @click.prevent="cancel">
+ <div class="space-x-3">
+ <NButton @click.prevent="cancel">
{{ allowEdit ? $t("common.cancel") : $t("common.back") }}
- </button>
+ </NButton>
<template v-if="allowEdit">
- <button
+ <NButton
v-if="create"
- type="submit"
- class="btn-primary ml-3"
+ type="primary"
:disabled="!allowCreate"
@click.prevent="createWebhook"
>
{{ $t("common.create") }}
- </button>
- <button
+ </NButton>
+ <NButton
v-else
- type="submit"
- class="btn-primary ml-3"
+ type="primary"
:disabled="
!valueChanged || state.webhook.notificationTypes.length === 0
"
@click.prevent="updateWebhook"
>
{{ $t("common.update") }}
- </button>
+ </NButton>
</template>
</div>
</div>
@@ -279,6 +279,7 @@
<script lang="ts" setup>
import { cloneDeep, isEmpty, isEqual } from "lodash-es";
+import { NCheckbox } from "naive-ui";
import { reactive, computed, PropType, watch } from "vue";
import { useI18n } from "vue-i18n";
import { useRouter } from "vue-router";
@@ -390,7 +391,7 @@ const allowCreate = computed(() => {
});
const isEventOn = (type: Activity_Type) => {
- return props.webhook.notificationTypes.includes(type);
+ return state.webhook.notificationTypes.includes(type);
};
const toggleEvent = (type: Activity_Type, on: boolean) => {
diff --git a/frontend/src/components/ReleaseRemindModal.vue b/frontend/src/components/ReleaseRemindModal.vue
index 40d3e116ae..987e40fc33 100644
--- a/frontend/src/components/ReleaseRemindModal.vue
+++ b/frontend/src/components/ReleaseRemindModal.vue
@@ -18,11 +18,11 @@
</template>
</i18n-t>
</p>
- <BBCheckbox
+ <NCheckbox
class="mt-3 ml-1"
- :title="$t('settings.release.not-show-till-next-release')"
- :value="actuatorStore.releaseInfo.ignoreRemindModalTillNextRelease"
- @toggle="
+ :label="$t('settings.release.not-show-till-next-release')"
+ :checked="actuatorStore.releaseInfo.ignoreRemindModalTillNextRelease"
+ @update:checked="
(on: boolean) =>
(actuatorStore.releaseInfo.ignoreRemindModalTillNextRelease = on)
"
@@ -51,6 +51,7 @@
</template>
<script lang="ts" setup>
+import { NCheckbox } from "naive-ui";
import { computed } from "vue";
import { useActuatorV1Store, useSubscriptionV1Store } from "@/store";
diff --git a/frontend/src/components/RepositoryForm.vue b/frontend/src/components/RepositoryForm.vue
index 2d4dcf70b5..2fe8598fed 100644
--- a/frontend/src/components/RepositoryForm.vue
+++ b/frontend/src/components/RepositoryForm.vue
@@ -305,11 +305,11 @@
@click="state.showInstanceAssignmentDrawer = true"
/>
<div class="flex space-x-4 mt-2">
- <BBCheckbox
+ <NCheckbox
:disabled="!allowEdit"
- :title="enableSQLReviewTitle"
- :value="repositoryConfig.enableSQLReviewCI"
- @toggle="(on: boolean) => {
+ :label="enableSQLReviewTitle"
+ :checked="repositoryConfig.enableSQLReviewCI"
+ @update:checked="(on: boolean) => {
repositoryConfig.enableSQLReviewCI = on;
onSQLReviewCIToggle(on);
}"
@@ -329,6 +329,7 @@
</template>
<script lang="ts" setup>
+import { NCheckbox } from "naive-ui";
import { storeToRefs } from "pinia";
import { reactive, PropType, computed } from "vue";
import { useI18n } from "vue-i18n";
diff --git a/frontend/src/components/SQLReview/SQLReviewPolicyTable.vue b/frontend/src/components/SQLReview/SQLReviewPolicyTable.vue
index db8ada833c..f20b7412e8 100644
--- a/frontend/src/components/SQLReview/SQLReviewPolicyTable.vue
+++ b/frontend/src/components/SQLReview/SQLReviewPolicyTable.vue
@@ -29,10 +29,10 @@
</span>
</div>
<div class="bb-grid-cell justify-center">
- <BBCheckbox
+ <NCheckbox
:disabled="!review || !hasPermission"
- :value="review?.enforce"
- @toggle="toggleReviewEnabled(review!, $event)"
+ :checked="review?.enforce"
+ @update:checked="toggleReviewEnabled(review!, $event)"
/>
</div>
<div class="bb-grid-cell gap-x-2 !pr-[3rem]">
@@ -99,23 +99,17 @@
</div>
<div class="flex items-center gap-x-2">
<template v-if="!policy.review">
- <button
- type="button"
- class="btn-normal flex justify-center !py-1 !px-3"
+ <NButton
:disabled="!hasPermission"
@click.prevent="handleClickCreate(policy.environment)"
>
{{ $t("sql-review.configure-policy") }}
- </button>
+ </NButton>
</template>
<template v-else>
- <button
- type="button"
- class="btn-normal flex justify-center !py-1 !px-3"
- @click.prevent="handleClickEdit(policy.review)"
- >
+ <NButton @click.prevent="handleClickEdit(policy.review)">
{{ hasPermission ? $t("common.edit") : $t("common.view") }}
- </button>
+ </NButton>
<BBButtonConfirm
type="default"
@@ -136,10 +130,11 @@
</template>
<script lang="ts" setup>
+import { NCheckbox } from "naive-ui";
import { computed, onMounted } from "vue";
import { useI18n } from "vue-i18n";
import { useRouter } from "vue-router";
-import { BBButtonConfirm, BBCheckbox, BBGrid, BBGridColumn } from "@/bbkit";
+import { BBButtonConfirm, BBGrid, BBGridColumn } from "@/bbkit";
import { EnvironmentV1Name } from "@/components/v2";
import {
pushNotification,
diff --git a/frontend/src/components/SQLReview/components/RuleConfigComponents/BooleanComponent.vue b/frontend/src/components/SQLReview/components/RuleConfigComponents/BooleanComponent.vue
index d4a776d223..ab16c7f75a 100644
--- a/frontend/src/components/SQLReview/components/RuleConfigComponents/BooleanComponent.vue
+++ b/frontend/src/components/SQLReview/components/RuleConfigComponents/BooleanComponent.vue
@@ -1,16 +1,16 @@
<template>
- <BBCheckbox
- :title="title"
- :value="value"
+ <NCheckbox
+ :label="title"
+ :checked="value"
:disabled="disabled"
- @toggle="$emit('update:value', $event)"
+ @update:checked="$emit('update:value', $event)"
/>
</template>
<script lang="ts" setup>
+import { NCheckbox } from "naive-ui";
import { computed } from "vue";
import { useI18n } from "vue-i18n";
-import { BBCheckbox } from "@/bbkit";
import type { RuleConfigComponent, RuleTemplate } from "@/types";
import { getRuleLocalizationKey } from "@/types/sqlReview";
diff --git a/frontend/src/components/SQLReview/components/SQLRuleEditDialog.vue b/frontend/src/components/SQLReview/components/SQLRuleEditDialog.vue
index 78884e281b..d81e8b1c31 100644
--- a/frontend/src/components/SQLReview/components/SQLRuleEditDialog.vue
+++ b/frontend/src/components/SQLReview/components/SQLRuleEditDialog.vue
@@ -141,21 +141,16 @@
"
/>
</div>
- <div v-if="editable" class="mt-4 pt-2 border-t flex justify-end">
- <button
- type="button"
- class="btn-normal py-2 px-4"
- @click.prevent="$emit('cancel')"
- >
+ <div
+ v-if="editable"
+ class="mt-4 pt-2 border-t flex justify-end space-x-3"
+ >
+ <NButton @click.prevent="$emit('cancel')">
{{ $t("common.cancel") }}
- </button>
- <button
- class="btn-primary ml-3 inline-flex justify-center py-2 px-4"
- :disabled="disabled"
- @click.prevent="confirm"
- >
+ </NButton>
+ <NButton type="primary" :disabled="disabled" @click.prevent="confirm">
{{ $t("common.confirm") }}
- </button>
+ </NButton>
</div>
</div>
</BBModal>
diff --git a/frontend/src/views/DatabaseDetail.vue b/frontend/src/views/DatabaseDetail.vue
index 5bc67f8aad..a067301d1b 100644
--- a/frontend/src/views/DatabaseDetail.vue
+++ b/frontend/src/views/DatabaseDetail.vue
@@ -183,24 +183,19 @@
<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="state.showIncorrectProjectModal = false"
- >
+ <div class="pt-6 flex justify-end space-x-3">
+ <NButton @click.prevent="state.showIncorrectProjectModal = false">
{{ $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="
state.showIncorrectProjectModal = false;
state.showTransferDatabaseModal = true;
"
>
{{ $t("database.go-to-transfer") }}
- </button>
+ </NButton>
</div>
</BBModal>
</div>
diff --git a/frontend/src/views/Home.vue b/frontend/src/views/Home.vue
index b6b2061c82..6e2bf71972 100644
--- a/frontend/src/views/Home.vue
+++ b/frontend/src/views/Home.vue
@@ -131,13 +131,9 @@
</div>
</div>
<div class="flex justify-end space-x-2 pb-4">
- <button
- type="button"
- class="btn-primary"
- @click.prevent="onTrialingModalClose"
- >
+ <NButton type="primary" @click.prevent="onTrialingModalClose">
{{ $t("subscription.trial-start-modal.button") }}
- </button>
+ </NButton>
</div>
</div>
</BBModal>
diff --git a/frontend/src/views/Page403.vue b/frontend/src/views/Page403.vue
index 8528ee557f..488b3e0f93 100644
--- a/frontend/src/views/Page403.vue
+++ b/frontend/src/views/Page403.vue
@@ -7,9 +7,9 @@
<div
class="mt-6 flex space-x-3 sm:border-l sm:border-transparent sm:pl-6"
>
- <button class="btn-primary" @click.prevent="goHome">
+ <NButton type="primary" @click.prevent="goHome">
{{ $t("error-page.go-back-home") }}
- </button>
+ </NButton>
</div>
</div>
</main>
diff --git a/frontend/src/views/Page404.vue b/frontend/src/views/Page404.vue
index 037a19b9dc..079fe40666 100644
--- a/frontend/src/views/Page404.vue
+++ b/frontend/src/views/Page404.vue
@@ -7,9 +7,9 @@
<div
class="mt-6 flex space-x-3 sm:border-l sm:border-transparent sm:pl-6"
>
- <button class="btn-primary" @click.prevent="goHome">
+ <NButton type="primary" @click.prevent="goHome">
{{ $t("error-page.go-back-home") }}
- </button>
+ </NButton>
</div>
</div>
</main>
diff --git a/frontend/src/views/SettingWorkspaceDebugLog.vue b/frontend/src/views/SettingWorkspaceDebugLog.vue
index fe45ba42dc..a6ad193ec0 100644
--- a/frontend/src/views/SettingWorkspaceDebugLog.vue
+++ b/frontend/src/views/SettingWorkspaceDebugLog.vue
@@ -7,13 +7,10 @@
count: debugLogList.length,
})
}}
- <button
- class="group btn-normal items-center !border-0 !bg-accent !text-white hover:!bg-indigo-500"
- @click="handleExport"
- >
+ <NButton type="primary" @click="handleExport">
<heroicons-outline:document-arrow-down class="h-4 w-4 mr-1" />
{{ $t("debug-log.table.operation.export") }}
- </button>
+ </NButton>
</div>
<DebugLogTable
:debug-log-list="
diff --git a/frontend/src/views/SettingWorkspaceMailDelivery.vue b/frontend/src/views/SettingWorkspaceMailDelivery.vue
index 677c9739ca..72f588f2da 100644
--- a/frontend/src/views/SettingWorkspaceMailDelivery.vue
+++ b/frontend/src/views/SettingWorkspaceMailDelivery.vue
@@ -98,10 +98,10 @@
{{ $t("settings.mail-delivery.field.smtp-password") }}
<span class="text-red-600">*</span>
</label>
- <BBCheckbox
- :title="$t('common.empty')"
- :value="state.useEmptyPassword"
- @toggle="handleToggleUseEmptyPassword"
+ <NCheckbox
+ :label="$t('common.empty')"
+ :checked="state.useEmptyPassword"
+ @update:checked="handleToggleUseEmptyPassword"
/>
</div>
<NInput
@@ -178,11 +178,10 @@
</template>
<script lang="ts" setup>
import { cloneDeep, isEqual } from "lodash-es";
-import { SelectOption } from "naive-ui";
+import { SelectOption, NCheckbox } from "naive-ui";
import { ClientError } from "nice-grpc-web";
import { computed, onMounted, reactive } from "vue";
import { useI18n } from "vue-i18n";
-import { BBCheckbox } from "@/bbkit";
import { pushNotification } from "@/store";
import { useWorkspaceMailDeliverySettingStore } from "@/store/modules/workspaceMailDeliverySetting";
import {
diff --git a/frontend/src/views/SettingWorkspaceSSO.vue b/frontend/src/views/SettingWorkspaceSSO.vue
index f0d51356da..c0365e76c3 100644
--- a/frontend/src/views/SettingWorkspaceSSO.vue
+++ b/frontend/src/views/SettingWorkspaceSSO.vue
@@ -13,15 +13,14 @@
</a>
</div>
<div>
- <button
+ <NButton
v-if="identityProviderList.length > 0"
- type="button"
- class="btn-primary"
+ type="primary"
@click="handleCreateSSO"
>
{{ $t("common.create") }}
<FeatureBadge :feature="'bb.feature.sso'" custom-class="ml-2" />
- </button>
+ </NButton>
</div>
</div>
<NoDataPlaceholder v-if="identityProviderList.length === 0">
@@ -45,9 +44,9 @@
>
<div class="w-full flex flex-row justify-between items-center">
<span class="truncate">{{ identityProvider.title }}</span>
- <button class="btn-normal" @click="handleViewSSO(identityProvider)">
+ <NButton @click="handleViewSSO(identityProvider)">
{{ $t("common.view") }}
- </button>
+ </NButton>
</div>
<div
diff --git a/frontend/src/views/SettingWorkspaceSubscription.vue b/frontend/src/views/SettingWorkspaceSubscription.vue
index a714ca7063..321ba497fe 100644
--- a/frontend/src/views/SettingWorkspaceSubscription.vue
+++ b/frontend/src/views/SettingWorkspaceSubscription.vue
@@ -81,17 +81,13 @@
</dt>
<dd class="mt-1">
- <button
- type="button"
- class="btn-primary inline-flex justify-center ml-auto"
- @click="state.showTrialModal = true"
- >
+ <NButton type="primary" @click="state.showTrialModal = true">
{{
$t("subscription.enterprise-free-trial", {
days: subscriptionStore.trialingDays,
})
}}
- </button>
+ </NButton>
</dd>
</div>
<div
@@ -105,14 +101,10 @@
{{ $t("subscription.inquire-enterprise-plan") }}
</dt>
- <dd class="mt-1">
- <button
- type="button"
- class="btn-primary inline-flex justify-center ml-auto"
- @click="inquireEnterprise"
- >
+ <dd class="mt-1 ml-auto">
+ <NButton type="primary" @click="inquireEnterprise">
{{ $t("subscription.contact-us") }}
- </button>
+ </NButton>
</dd>
</div>
</dl>
@@ -128,15 +120,11 @@
:placeholder="$t('subscription.sensitive-placeholder')"
class="shadow-sm focus:ring-indigo-500 focus:border-indigo-500 block w-full sm:text-sm border-gray-300 rounded-md"
/>
- <button
- type="button"
- class="btn-primary inline-flex justify-center ml-auto mt-3"
- :disabled="disabled"
- target="_blank"
- @click="uploadLicense"
- >
- {{ $t("subscription.upload-license") }}
- </button>
+ <div class="ml-auto mt-3">
+ <NButton type="primary" :disabled="disabled" @click="uploadLicense">
+ {{ $t("subscription.upload-license") }}
+ </NButton>
+ </div>
</div>
<div class="sm:flex sm:flex-col sm:align-center pt-5 mt-4 border-t">
<div class="textinfolabel">
diff --git a/frontend/src/views/SettingWorkspaceVCS.vue b/frontend/src/views/SettingWorkspaceVCS.vue
index d7ac086b48..34a2a01997 100644
--- a/frontend/src/views/SettingWorkspaceVCS.vue
+++ b/frontend/src/views/SettingWorkspaceVCS.vue
@@ -8,14 +8,10 @@
>{{ $t("gitops.setting.description-highlight") }}</a
>
</div>
- <div v-if="vcsList.length > 0" class="flex items-center justify-end">
- <button
- type="button"
- class="btn-primary ml-3 inline-flex justify-center py-2 px-4"
- @click.prevent="addVCSProvider"
- >
+ <div v-if="vcsList.length > 0" class="ml-3">
+ <NButton type="primary" @click.prevent="addVCSProvider">
{{ $t("gitops.setting.add-git-provider.self") }}
- </button>
+ </NButton>
</div>
<div v-if="vcsList.length > 0" class="space-y-6">
diff --git a/frontend/src/views/SettingWorkspaceVCSDetail.vue b/frontend/src/views/SettingWorkspaceVCSDetail.vue
index db469a81e6..da0651e37d 100644
--- a/frontend/src/views/SettingWorkspaceVCSDetail.vue
+++ b/frontend/src/views/SettingWorkspaceVCSDetail.vue
@@ -129,22 +129,17 @@
{{ $t("gitops.setting.git-provider.delete-forbidden") }}
</div>
</template>
- <div>
- <button
- type="button"
- class="btn-normal py-2 px-4"
- @click.prevent="cancel"
- >
+ <div class="space-x-3">
+ <NButton @click.prevent="cancel">
{{ $t("common.cancel") }}
- </button>
- <button
- type="button"
- class="btn-primary ml-3 inline-flex justify-center py-2 px-4"
+ </NButton>
+ <NButton
+ type="primary"
:disabled="!allowUpdate"
@click.prevent="doUpdate"
>
{{ $t("common.update") }}
- </button>
+ </NButton>
</div>
</div>
</div>
diff --git a/frontend/src/views/auth/Signup.vue b/frontend/src/views/auth/Signup.vue
index 9dab599c2f..4901c9bbe7 100644
--- a/frontend/src/views/auth/Signup.vue
+++ b/frontend/src/views/auth/Signup.vue
@@ -152,16 +152,17 @@
v-if="needAdminSetup"
class="w-full flex flex-row justify-start items-start"
>
- <BBCheckbox
- :value="state.acceptTermsAndPolicy"
+ <NCheckbox
+ v-model:checked="state.acceptTermsAndPolicy"
class="mt-0.5"
- @toggle="onToggleAcceptTermsAndPolicyCheckbox"
/>
<i18n-t
tag="span"
keypath="auth.sign-up.accept-terms-and-policy"
class="ml-1 select-none"
- @click="onToggleAcceptTermsAndPolicyCheckbox"
+ @click="
+ () => (state.acceptTermsAndPolicy = !state.acceptTermsAndPolicy)
+ "
>
<template #terms>
<a
@@ -217,15 +218,10 @@
<AuthFooter />
</template>
-<script lang="ts">
+<script lang="ts" setup>
+import { NCheckbox } from "naive-ui";
import { storeToRefs } from "pinia";
-import {
- computed,
- defineComponent,
- onMounted,
- onUnmounted,
- reactive,
-} from "vue";
+import { computed, onMounted, onUnmounted, reactive } from "vue";
import { useRouter } from "vue-router";
import {
useActuatorV1Store,
@@ -248,138 +244,117 @@ interface LocalState {
showPassword: boolean;
}
-export default defineComponent({
- name: "SignupPage",
- components: { AuthFooter },
- setup() {
- const actuatorStore = useActuatorV1Store();
- const router = useRouter();
+const actuatorStore = useActuatorV1Store();
+const router = useRouter();
- const state = reactive<LocalState>({
- email: "",
- password: "",
- passwordConfirm: "",
- showPasswordMismatchError: false,
- name: "",
- nameManuallyEdited: false,
- acceptTermsAndPolicy: true,
- showPassword: false,
- });
+const state = reactive<LocalState>({
+ email: "",
+ password: "",
+ passwordConfirm: "",
+ showPasswordMismatchError: false,
+ name: "",
+ nameManuallyEdited: false,
+ acceptTermsAndPolicy: true,
+ showPassword: false,
+});
- onUnmounted(() => {
- if (state.passwordValidationTimer) {
- clearInterval(state.passwordValidationTimer);
- }
- });
+onUnmounted(() => {
+ if (state.passwordValidationTimer) {
+ clearInterval(state.passwordValidationTimer);
+ }
+});
- const { needAdminSetup, disallowSignup } = storeToRefs(actuatorStore);
+const { needAdminSetup, disallowSignup } = storeToRefs(actuatorStore);
- const allowSignup = computed(() => {
- return (
- isValidEmail(state.email) &&
- state.password &&
- !state.showPasswordMismatchError &&
- state.acceptTermsAndPolicy &&
- !disallowSignup.value
- );
- });
+const allowSignup = computed(() => {
+ return (
+ isValidEmail(state.email) &&
+ state.password &&
+ !state.showPasswordMismatchError &&
+ state.acceptTermsAndPolicy &&
+ !disallowSignup.value
+ );
+});
- const passwordMatch = computed(() => {
- return state.password == state.passwordConfirm;
- });
+const passwordMatch = computed(() => {
+ return state.password == state.passwordConfirm;
+});
- onMounted(() => {
- if (needAdminSetup.value) {
- state.acceptTermsAndPolicy = false;
- }
- });
+onMounted(() => {
+ if (needAdminSetup.value) {
+ state.acceptTermsAndPolicy = false;
+ }
+});
- const refreshPasswordValidation = () => {
- if (state.passwordValidationTimer) {
- clearInterval(state.passwordValidationTimer);
- }
+const refreshPasswordValidation = () => {
+ if (state.passwordValidationTimer) {
+ clearInterval(state.passwordValidationTimer);
+ }
- if (passwordMatch.value) {
- state.showPasswordMismatchError = false;
+ if (passwordMatch.value) {
+ state.showPasswordMismatchError = false;
+ } else {
+ state.passwordValidationTimer = setTimeout(() => {
+ // If error is already displayed, we hide the error only if there is valid input.
+ // Otherwise, we hide the error if input is either empty or valid.
+ if (state.showPasswordMismatchError) {
+ state.showPasswordMismatchError = !passwordMatch.value;
} else {
- state.passwordValidationTimer = setTimeout(() => {
- // If error is already displayed, we hide the error only if there is valid input.
- // Otherwise, we hide the error if input is either empty or valid.
- if (state.showPasswordMismatchError) {
- state.showPasswordMismatchError = !passwordMatch.value;
- } else {
- state.showPasswordMismatchError =
- state.password != "" &&
- state.passwordConfirm != "" &&
- !passwordMatch.value;
- }
- }, TEXT_VALIDATION_DELAY);
+ state.showPasswordMismatchError =
+ state.password != "" &&
+ state.passwordConfirm != "" &&
+ !passwordMatch.value;
}
- };
+ }, TEXT_VALIDATION_DELAY);
+ }
+};
- const onTextEmail = () => {
- const email = state.email.trim().toLowerCase();
- state.email = email;
- if (!state.nameManuallyEdited) {
- const emailParts = email.split("@");
- if (emailParts.length > 0) {
- if (emailParts[0].length > 0) {
- const name = emailParts[0].replace("_", ".");
- const nameParts = name.split(".");
- if (nameParts.length >= 2) {
- state.name = [
- nameParts[0].charAt(0).toUpperCase() + nameParts[0].slice(1),
- nameParts[1].charAt(0).toUpperCase() + nameParts[1].slice(1),
- ].join(" ");
- } else {
- state.name = name.charAt(0).toUpperCase() + name.slice(1);
- }
- }
+const onTextEmail = () => {
+ const email = state.email.trim().toLowerCase();
+ state.email = email;
+ if (!state.nameManuallyEdited) {
+ const emailParts = email.split("@");
+ if (emailParts.length > 0) {
+ if (emailParts[0].length > 0) {
+ const name = emailParts[0].replace("_", ".");
+ const nameParts = name.split(".");
+ if (nameParts.length >= 2) {
+ state.name = [
+ nameParts[0].charAt(0).toUpperCase() + nameParts[0].slice(1),
+ nameParts[1].charAt(0).toUpperCase() + nameParts[1].slice(1),
+ ].join(" ");
+ } else {
+ state.name = name.charAt(0).toUpperCase() + name.slice(1);
}
}
- };
-
- const onTextName = () => {
- const name = state.name.trim();
- state.nameManuallyEdited = name.length > 0;
- };
-
- const onToggleAcceptTermsAndPolicyCheckbox = () => {
- state.acceptTermsAndPolicy = !state.acceptTermsAndPolicy;
- };
+ }
+ }
+};
- const trySignup = async () => {
- if (!passwordMatch.value) {
- state.showPasswordMismatchError = true;
- } else {
- const signupInfo: SignupInfo = {
- email: state.email,
- password: state.password,
- name: state.name,
- };
- await useAuthStore().signup(signupInfo);
- if (needAdminSetup.value) {
- await actuatorStore.fetchServerInfo();
- // When the first time we created an end user, the server-side will
- // generate onboarding data.
- // We write a flag here to indicate that the workspace is just created
- // and we can consume this flag somewhere else if needed.
- useOnboardingStateStore().initialize();
- }
- router.replace("/");
- }
- };
+const onTextName = () => {
+ const name = state.name.trim();
+ state.nameManuallyEdited = name.length > 0;
+};
- return {
- state,
- needAdminSetup,
- allowSignup,
- onTextEmail,
- onTextName,
- onToggleAcceptTermsAndPolicyCheckbox,
- trySignup,
- refreshPasswordValidation,
+const trySignup = async () => {
+ if (!passwordMatch.value) {
+ state.showPasswordMismatchError = true;
+ } else {
+ const signupInfo: SignupInfo = {
+ email: state.email,
+ password: state.password,
+ name: state.name,
};
- },
-});
+ await useAuthStore().signup(signupInfo);
+ if (needAdminSetup.value) {
+ await actuatorStore.fetchServerInfo();
+ // When the first time we created an end user, the server-side will
+ // generate onboarding data.
+ // We write a flag here to indicate that the workspace is just created
+ // and we can consume this flag somewhere else if needed.
+ useOnboardingStateStore().initialize();
+ }
+ router.replace("/");
+ }
+};
</script>