Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
chore: deprecate BBStepTab & update BBButtonConfirm (#10002)
ecmadao2a97c6c59c8d
diff --git a/frontend/src/bbkit/BBButtonConfirm.vue b/frontend/src/bbkit/BBButtonConfirm.vueindex 5d6b5ffa38..d61c9191fd 100644--- a/frontend/src/bbkit/BBButtonConfirm.vue+++ b/frontend/src/bbkit/BBButtonConfirm.vue@@ -1,7 +1,8 @@<template>- <button+ <NButtonv-bind="$attrs"class="text-sm"+ :type="type":class="[!state.hideIcon && 'btn-icon']"@click.prevent.stop="() => {@@ -36,7 +37,7 @@<span v-if="state.buttonText" :class="[!state.hideIcon && 'ml-1']">{{ state.buttonText }}</span>- </button>+ </NButton><BBAlertv-if="state.showModal":style="@@ -66,15 +67,28 @@ import { reactive } from "vue";import { useI18n } from "vue-i18n";import { BBButtonConfirmStyle } from "./types";-const props = defineProps<{- style?: BBButtonConfirmStyle;- buttonText?: string;- requireConfirm?: boolean;- okText?: string;- confirmTitle?: string;- confirmDescription?: string;- hideIcon?: boolean;-}>();+const props = withDefaults(+ defineProps<{+ type?: "text" | "default";+ style?: BBButtonConfirmStyle;+ buttonText?: string;+ requireConfirm?: boolean;+ okText?: string;+ confirmTitle?: string;+ confirmDescription?: string;+ hideIcon?: boolean;+ }>(),+ {+ type: "text",+ style: "DELETE",+ buttonText: "",+ requireConfirm: false,+ okText: "",+ confirmTitle: "",+ confirmDescription: "",+ hideIcon: false,+ }+);defineEmits<{(event: "confirm"): void;@@ -84,14 +98,14 @@ const { t } = useI18n();const state = reactive({// computed props with default i18n values.- style: props.style || "DELETE",- buttonText: props.buttonText || "",- requireConfirm: props.requireConfirm || false,+ style: props.style,+ buttonText: props.buttonText,+ requireConfirm: props.requireConfirm,okText: props.okText || t("common.delete"),confirmTitle: props.confirmTitle || t("bbkit.confirm-button.sure-to-delete"),confirmDescription:props.confirmDescription || t("bbkit.confirm-button.cannot-undo"),- hideIcon: props.hideIcon || false,+ hideIcon: props.hideIcon,// local state.showModal: false,});diff --git a/frontend/src/bbkit/BBStepTab.vue b/frontend/src/bbkit/BBStepTab.vuedeleted file mode 100644index 35ba67df47..0000000000--- a/frontend/src/bbkit/BBStepTab.vue+++ /dev/null@@ -1,175 +0,0 @@-<template>- <div>- <ol- class="flex space-y-0 space-x-8"- :class="[sticky && 'sticky top-0 bg-white z-10']"- >- <li v-for="(step, index) in stepItemList" :key="index" class="flex-1">- <div- class="group flex flex-col pt-4 border-t-4"- :class="- state.currentStep >= index- ? 'border-accent hover:border-accent-hover cursor-pointer'- : 'border-control-border'- "- @click.prevent="- () => {- if (state.currentStep >= index) {- changeStep(index);- }- }- "- >- <div class="flex items-center justify-between">- <div class="flex flex-col">- <span- class="text-xs font-semibold tracking-wide uppercase"- :class="- state.currentStep >= index- ? 'text-accent group-hover:text-accent-hover'- : 'text-control-light'- "- >{{ $t("bbkit.common.step") }} {{ index + 1 }}</span- >- <span class="text-sm font-medium">{{ step.title }}</span>- </div>- <div- v-if="state.currentStep > index || state.done"- class="flex items-center justify-center w-6 h-6 bg-accent text-white rounded-full select-none"- >- <heroicons-solid:check class="w-4 h-4" />- </div>- </div>- </div>- </li>- </ol>- <div class="mt-4 mb-4" :class="paneClass">- <template v-for="(step, index) in stepItemList" :key="index">- <slot- v-if="state.currentStep == index"- :name="index"- :next="- () => {- changeStep(state.currentStep + 1);- }- "- />- </template>- </div>- <div- class="pt-4 border-t border-block-border flex justify-between"- :class="[sticky && 'pb-4 bg-white sticky bottom-0 z-10']"- >- <div>- <button- v-if="showCancel"- type="button"- class="btn-normal"- @click.prevent="cancel"- >- {{ $t("bbkit.common.cancel") }}- </button>- </div>- <div class="flex flex-row space-x-2">- <button- v-if="state.currentStep != 0"- type="button"- class="btn-normal"- @click.prevent="changeStep(state.currentStep - 1)"- >- <heroicons-outline:chevron-left- class="-ml-1 mr-1 h-5 w-5 text-control-light"- />- <span> {{ $t("bbkit.common.back") }}</span>- </button>- <button- v-if="state.currentStep == stepItemList.length - 1"- :disabled="!allowNext"- type="button"- class="btn-primary"- @click.prevent="finish"- >- {{ $t(finishTitle) }}- </button>- <button- v-else-if="!stepItemList[state.currentStep].hideNext"- :disabled="!allowNext"- type="button"- class="btn-primary"- @click.prevent="changeStep(state.currentStep + 1)"- >- {{ $t("bbkit.common.next") }}- </button>- </div>- </div>- </div>-</template>--<script lang="ts" setup>-import { reactive, withDefaults } from "vue";-import { VueClass } from "@/utils/types";-import { BBStepTabItem } from "./types";--interface LocalState {- done: boolean;- currentStep: number;-}--withDefaults(- defineProps<{- stepItemList: BBStepTabItem[];- showCancel?: boolean;- allowNext?: boolean;- finishTitle?: string;- sticky?: boolean;- paneClass?: VueClass;- }>(),- {- showCancel: true,- allowNext: true,- finishTitle: "bbkit.common.finish",- sticky: false,- paneClass: undefined,- }-);--// For try-change-step and try-finish listener, it needs to call the callback if it determines we can change the step.-const emit = defineEmits<{- (- event: "try-change-step",- from: number,- to: number,- allowChangeCallback: () => void- ): void;- (event: "try-finish", finishCallback: () => void): void;- (event: "cancel"): void;-}>();--const state = reactive<LocalState>({- done: false,- currentStep: 0,-});--const changeStep = (step: number) => {- const changeStepCallback = () => {- state.done = false;- state.currentStep = step;- };- emit("try-change-step", state.currentStep, step, changeStepCallback);-};--const finish = () => {- const finishCallback = () => {- state.done = true;- };- emit("try-finish", finishCallback);-};--const cancel = () => {- emit("cancel");-};--defineExpose({- changeStep,-});-</script>diff --git a/frontend/src/bbkit/index.ts b/frontend/src/bbkit/index.tsindex bdd441add5..6e3690f7b0 100644--- a/frontend/src/bbkit/index.ts+++ b/frontend/src/bbkit/index.ts@@ -11,7 +11,6 @@ import BBModal from "./BBModal.vue";import BBNotification from "./BBNotification.vue";import BBSelect from "./BBSelect.vue";import BBSpin from "./BBSpin.vue";-import BBStepTab from "./BBStepTab.vue";import BBSwitch from "./BBSwitch.vue";import BBTab from "./BBTab.vue";import {@@ -36,7 +35,6 @@ export {BBNotification,BBSelect,BBSpin,- BBStepTab,BBSwitch,BBTab,BBTable,diff --git a/frontend/src/bbkit/types.ts b/frontend/src/bbkit/types.tsindex e42302c78a..99bbbabfb9 100644--- a/frontend/src/bbkit/types.ts+++ b/frontend/src/bbkit/types.ts@@ -47,28 +47,6 @@ export type BBTabItem<T = any> = {data?: T;};-export type BBStepStatus =- | "NOT_STARTED"- | "PENDING"- | "PENDING_ACTIVE"- | "PENDING_APPROVAL"- | "PENDING_APPROVAL_ACTIVE"- | "RUNNING"- | "DONE"- | "FAILED"- | "CANCELED"- | "SKIPPED";--export type BBStep = {- status: BBStepStatus;- payload: any;-};--export type BBStepTabItem = {- title: string;- hideNext?: boolean;-};-export type BBNotificationStyle = "INFO" | "SUCCESS" | "WARN" | "CRITICAL";export type BBNotificationPlacement =| "TOP_LEFT"diff --git a/frontend/src/components/InstanceForm/DataSourceSection/DataSourceTabs.vue b/frontend/src/components/InstanceForm/DataSourceSection/DataSourceTabs.vueindex b4b20fcfca..2d66773316 100644--- a/frontend/src/components/InstanceForm/DataSourceSection/DataSourceTabs.vue+++ b/frontend/src/components/InstanceForm/DataSourceSection/DataSourceTabs.vue@@ -14,7 +14,7 @@<span>{{ $t("common.read-only") }}</span><BBButtonConfirmv-if="hasReadOnlyDataSource"- class="ml-1"+ class="!ml-1":style="'DELETE'":disabled="!allowEdit":require-confirm="!ds.pendingCreate"diff --git a/frontend/src/components/RepositorySetupWizard.vue b/frontend/src/components/RepositorySetupWizard.vueindex 5fdf8ed58d..96c59c7c09 100644--- a/frontend/src/components/RepositorySetupWizard.vue+++ b/frontend/src/components/RepositorySetupWizard.vue@@ -13,12 +13,14 @@</template></i18n-t></div>- <BBStepTab++ <StepTabclass="mt-4 mb-8"- :step-item-list="stepList"+ :current-index="state.currentStep"+ :step-list="stepList":allow-next="allowNext"- @try-change-step="tryChangeStep"- @try-finish="tryFinishSetup"+ @update:current-index="tryChangeStep"+ @finish="tryFinishSetup"@cancel="cancel"><template #0="{ next }">@@ -43,7 +45,7 @@@change-schema-change-type="setSchemaChangeType"/></template>- </BBStepTab>+ </StepTab><BBModalv-if="state.showSetupSQLReviewCIModal"class="relative overflow-hidden"@@ -134,6 +136,7 @@ import isEmpty from "lodash-es/isEmpty";import { reactive, computed, PropType } from "vue";import { useI18n } from "vue-i18n";import { useRouter } from "vue-router";+import { StepTab } from "@/components/v2";import { useRepositoryV1Store, hasFeature, useProjectV1Store } from "@/store";import { getVCSUid } from "@/store/modules/v1/common";import {@@ -147,7 +150,6 @@ import {TenantMode,SchemaChange,} from "@/types/proto/v1/project_service";-import { BBStepTabItem } from "../bbkit/types";import { ExternalRepositoryInfo, ProjectRepositoryConfig } from "../types";import { projectSlugV1 } from "../utils";@@ -204,7 +206,7 @@ const router = useRouter();const repositoryV1Store = useRepositoryV1Store();const projectV1Store = useProjectV1Store();-const stepList: BBStepTabItem[] = [+const stepList = [{ title: t("repository.choose-git-provider"), hideNext: true },{ title: t("repository.select-repository"), hideNext: true },{ title: t("repository.configure-deploy") },@@ -264,16 +266,11 @@ const allowNext = computed((): boolean => {return true;});-const tryChangeStep = (- oldStep: number,- newStep: number,- allowChangeCallback: () => void-) => {+const tryChangeStep = (nextStepIndex: number) => {if (state.processing) {return;}- state.currentStep = newStep;- allowChangeCallback();+ state.currentStep = nextStepIndex;};const createSQLReviewCI = async () => {@@ -295,7 +292,7 @@ const createSQLReviewCI = async () => {}};-const tryFinishSetup = async (allowFinishCallback: () => void) => {+const tryFinishSetup = async () => {if (state.config.repositoryConfig.enableSQLReviewCI &&!hasFeature("bb.feature.vcs-sql-review")@@ -354,8 +351,6 @@ const tryFinishSetup = async (allowFinishCallback: () => void) => {} else {emit("finish");}-- allowFinishCallback();};try {diff --git a/frontend/src/components/SQLReview/SQLReviewCreation.vue b/frontend/src/components/SQLReview/SQLReviewCreation.vueindex 029343ce3e..a005cfb076 100644--- a/frontend/src/components/SQLReview/SQLReviewCreation.vue+++ b/frontend/src/components/SQLReview/SQLReviewCreation.vue@@ -1,13 +1,14 @@<template><div>- <BBStepTab+ <StepTab:sticky="true"- :step-item-list="STEP_LIST"+ :current-index="state.currentStep"+ :step-list="STEP_LIST":allow-next="allowNext":finish-title="$t(`common.confirm-and-${policy ? 'update' : 'add'}`)"- @try-change-step="tryChangeStep"- @try-finish="tryFinishSetup"+ @update:current-index="changeStepIndex"@cancel="onCancel"+ @finish="tryFinishSetup"><template #0><SQLReviewInfo@@ -30,7 +31,7 @@@comment-change="onCommentChange"/></template>- </BBStepTab>+ </StepTab></div></template>@@ -39,8 +40,7 @@ import { useDialog } from "naive-ui";import { reactive, computed, withDefaults } from "vue";import { useI18n } from "vue-i18n";import { useRouter } from "vue-router";-import { BBStepTab } from "@/bbkit";-import { BBStepTabItem } from "@/bbkit/types";+import { StepTab } from "@/components/v2";import {useCurrentUserV1,pushNotification,@@ -101,7 +101,7 @@ const CONFIGURE_RULE_STEP = 1;const PREVIEW_STEP = 2;const ROUTE_NAME = "setting.workspace.sql-review";-const STEP_LIST: BBStepTabItem[] = [+const STEP_LIST = [{ title: t("sql-review.create.basic-info.name") },{ title: t("sql-review.create.configure-rule.name") },];@@ -180,12 +180,8 @@ const allowNext = computed((): boolean => {return false;});-const tryChangeStep = (- oldStep: number,- newStep: number,- allowChangeCallback: () => void-) => {- if (oldStep === 0 && newStep === 1) {+const changeStepIndex = (nextIndex: number) => {+ if (state.currentStep === 0 && nextIndex === 1) {if (state.pendingApplyTemplate) {dialog.warning({title: t("sql-review.create.configure-rule.confirm-override-title"),@@ -195,17 +191,15 @@ const tryChangeStep = (positiveText: t("common.confirm"),onPositiveClick: (_: MouseEvent) => {onTemplateApply(state.pendingApplyTemplate);- allowChangeCallback();},});return;}}- state.currentStep = newStep;- allowChangeCallback();+ state.currentStep = nextIndex;};-const tryFinishSetup = (allowChangeCallback: () => void) => {+const tryFinishSetup = () => {if (!hasWorkspacePermissionV1("bb.permission.workspace.manage-sql-review-policy",@@ -260,7 +254,6 @@ const tryFinishSetup = (allowChangeCallback: () => void) => {});}- allowChangeCallback();onCancel();};diff --git a/frontend/src/components/SQLReview/SQLReviewPolicyTable.vue b/frontend/src/components/SQLReview/SQLReviewPolicyTable.vueindex dbc0861133..db8ada833c 100644--- a/frontend/src/components/SQLReview/SQLReviewPolicyTable.vue+++ b/frontend/src/components/SQLReview/SQLReviewPolicyTable.vue@@ -37,26 +37,20 @@</div><div class="bb-grid-cell gap-x-2 !pr-[3rem]"><template v-if="!review">- <button- type="button"- class="btn-normal flex justify-center !py-1 !px-3"+ <NButton:disabled="!hasPermission"@click.prevent="handleClickCreate(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(review)"- >+ <NButton @click.prevent="handleClickEdit(review)">{{ hasPermission ? $t("common.edit") : $t("common.view") }}- </button>+ </NButton><BBButtonConfirm- class="btn-normal flex justify-center !py-1 !px-3"+ type="default":disabled="!hasPermission":style="'DELETE'":hide-icon="true"@@ -124,7 +118,7 @@</button><BBButtonConfirm- class="btn-normal flex justify-center !py-1 !px-3"+ type="default":disabled="!hasPermission":style="'DELETE'":hide-icon="true"diff --git a/frontend/src/components/SyncDatabaseSchema/index.vue b/frontend/src/components/SyncDatabaseSchema/index.vueindex 606b53bc3d..2e63380081 100644--- a/frontend/src/components/SyncDatabaseSchema/index.vue+++ b/frontend/src/components/SyncDatabaseSchema/index.vue@@ -6,17 +6,17 @@url="https://www.bytebase.com/docs/change-database/synchronize-schema?source=console"/></p>- <BBStepTab- ref="bbStepTabRef"+ <StepTabclass="py-4 flex-1 overflow-hidden flex flex-col"- :step-item-list="stepTabList"+ :step-list="stepTabList"+ :current-index="state.currentStep":show-cancel="false":allow-next="allowNext":finish-title="$t('database.sync-schema.preview-issue')"pane-class="flex-1 overflow-y-auto"@cancel="cancelSetup"- @try-change-step="tryChangeStep"- @try-finish="tryFinishSetup"+ @update:current-index="tryChangeStep"+ @finish="tryFinishSetup"><template #0><div class="mb-4">@@ -53,7 +53,7 @@:raw-sql-state="rawSQLState"/></template>- </BBStepTab>+ </StepTab></div></template>@@ -64,7 +64,7 @@ import { NRadioGroup, NRadio, useDialog } from "naive-ui";import { computed, reactive, ref } from "vue";import { useI18n } from "vue-i18n";import { useRouter } from "vue-router";-import { BBStepTab } from "@/bbkit";+import { StepTab } from "@/components/v2";import { useProjectV1Store } from "@/store";import { UNKNOWN_ID, ComposedProject } from "@/types";import { Engine } from "@/types/proto/v1/common";@@ -95,7 +95,6 @@ const props = defineProps<{const { t } = useI18n();const router = useRouter();const dialog = useDialog();-const bbStepTabRef = ref<InstanceType<typeof BBStepTab>>();const projectStore = useProjectV1Store();const targetDatabaseViewRef =ref<InstanceType<typeof SelectTargetDatabasesView>>();@@ -179,12 +178,8 @@ const handleRawSQLStateChange = (state: RawSQLState) => {Object.assign(rawSQLState, state);};-const tryChangeStep = async (- oldStep: number,- newStep: number,- allowChangeCallback: () => void-) => {- if (oldStep === 1 && newStep === 0) {+const tryChangeStep = async (nextStepIndex: number) => {+ if (state.currentStep === 1 && nextStepIndex === 0) {const targetDatabaseList =targetDatabaseViewRef.value?.targetDatabaseList || [];if (targetDatabaseList.length > 0) {@@ -200,15 +195,13 @@ const tryChangeStep = async (// nothing to do},onPositiveClick: () => {- state.currentStep = newStep as Step;- allowChangeCallback();+ state.currentStep = nextStepIndex as Step;},});return;}}- state.currentStep = newStep as Step;- allowChangeCallback();+ state.currentStep = nextStepIndex as Step;};const tryFinishSetup = async () => {diff --git a/frontend/src/components/VCS/VCSSetupWizard.vue b/frontend/src/components/VCS/VCSSetupWizard.vueindex bc5b6dad40..775d073ab3 100644--- a/frontend/src/components/VCS/VCSSetupWizard.vue+++ b/frontend/src/components/VCS/VCSSetupWizard.vue@@ -5,13 +5,15 @@:description="attentionText":link="link"/>- <BBStepTab+ <StepTabclass="mt-4 mb-8"- :step-item-list="stepList"+ :current-index="state.currentStep"+ :step-list="stepList":allow-next="allowNext"+ :show-cancel="showCancel":finish-title="$t('common.confirm-and-add')"- @try-change-step="tryChangeStep"- @try-finish="tryFinishSetup"+ @update:current-index="tryChangeStep"+ @finish="tryFinishSetup"@cancel="cancelSetup"><template #0>@@ -23,7 +25,7 @@<template #2><VCSProviderConfirmPanel :config="state.config" /></template>- </BBStepTab>+ </StepTab></template><script lang="ts" setup>@@ -31,7 +33,7 @@ import isEmpty from "lodash-es/isEmpty";import { reactive, computed, onUnmounted, onMounted } from "vue";import { useI18n } from "vue-i18n";import { useRouter } from "vue-router";-import { BBStepTabItem } from "@/bbkit/types";+import { StepTab } from "@/components/v2";import { pushNotification, useVCSV1Store } from "@/store";import {isValidVCSApplicationIdOrSecret,@@ -49,6 +51,15 @@ import VCSProviderBasicInfoPanel from "./VCSProviderBasicInfoPanel.vue";import VCSProviderConfirmPanel from "./VCSProviderConfirmPanel.vue";import VCSProviderOAuthPanel from "./VCSProviderOAuthPanel.vue";+withDefaults(+ defineProps<{+ showCancel?: boolean;+ }>(),+ {+ showCancel: true,+ }+);+const BASIC_INFO_STEP = 0;const OAUTH_INFO_STEP = 1;const CONFIRM_STEP = 2;@@ -63,7 +74,7 @@ const { t } = useI18n();const router = useRouter();const vcsV1Store = useVCSV1Store();-const stepList: BBStepTabItem[] = [+const stepList = [{ title: t("gitops.setting.add-git-provider.basic-info.self") },{ title: t("gitops.setting.add-git-provider.oauth-info.self") },{ title: t("common.confirm") },@@ -174,16 +185,15 @@ const showAttention = computed((): boolean => {return state.currentStep != CONFIRM_STEP;});-const tryChangeStep = (- oldStep: number,- newStep: number,- allowChangeCallback: () => void-) => {+const tryChangeStep = (nextStepIndex: number) => {// If we are trying to move from OAuth step to Confirm step, we first verify// the OAuth info is correct. We achieve this by:// 1. Kicking of the OAuth workflow to verify the current user can login to the GitLab instance and the application id is correct.// 2. If step 1 succeeds, we will get a code, we use this code together with the secret to exchange for the access token. (see eventListener)- if (state.currentStep == OAUTH_INFO_STEP && newStep > oldStep) {+ if (+ state.currentStep == OAUTH_INFO_STEP &&+ nextStepIndex > state.currentStep+ ) {let authorizeUrl = `${state.config.instanceUrl}/oauth/authorize`;if (state.config.type === ExternalVersionControl_Type.GITHUB) {authorizeUrl = `${state.config.instanceUrl}/login/oauth/authorize`;@@ -201,8 +211,7 @@ const tryChangeStep = (if (newWindow) {state.oAuthResultCallback = (token: OAuthToken | undefined) => {if (token) {- state.currentStep = newStep;- allowChangeCallback();+ state.currentStep = nextStepIndex;pushNotification({module: "bytebase",style: "SUCCESS",@@ -228,12 +237,11 @@ const tryChangeStep = (};}} else {- state.currentStep = newStep;- allowChangeCallback();+ state.currentStep = nextStepIndex;}};-const tryFinishSetup = (allowChangeCallback: () => void) => {+const tryFinishSetup = () => {vcsV1Store.createVCS({name: "",@@ -245,7 +253,6 @@ const tryFinishSetup = (allowChangeCallback: () => void) => {apiUrl: "",}).then((vcs: ExternalVersionControl) => {- allowChangeCallback();router.push({name: "setting.workspace.gitops",});diff --git a/frontend/src/components/v2/Form/StepTab.vue b/frontend/src/components/v2/Form/StepTab.vuenew file mode 100644index 0000000000..f4afbb7144--- /dev/null+++ b/frontend/src/components/v2/Form/StepTab.vue@@ -0,0 +1,97 @@+<template>+ <div v-bind="$attrs" :class="[!sticky && 'space-y-8']">+ <div :class="['px-0.5', sticky && 'pt-2 pb-4 sticky top-0 bg-white z-10']">+ <NSteps :current="currentIndex + 1" :status="'process'">+ <NStep+ v-for="(step, i) in stepList"+ :key="i"+ :title="step.title"+ :description="step.description"+ />+ </NSteps>+ </div>++ <div :class="[sticky && 'mb-8', paneClass]">+ <template v-for="(step, index) in stepList" :key="index">+ <slot+ v-if="currentIndex == index"+ :name="index"+ :next="+ () => {+ $emit('update:currentIndex', currentIndex + 1);+ }+ "+ />+ </template>+ </div>++ <div+ class="pt-4 border-t border-block-border flex items-center space-x-2 justify-between"+ :class="[sticky && 'pb-4 bg-white sticky bottom-0 z-10']"+ >+ <div>+ <NButton v-if="showCancel" @click.prevent="$emit('cancel')">+ {{ $t("bbkit.common.cancel") }}+ </NButton>+ </div>++ <div class="flex items-center justify-between space-x-2">+ <NButton+ v-if="currentIndex != 0"+ @click.prevent="$emit('update:currentIndex', currentIndex - 1)"+ >+ <heroicons-outline:chevron-left+ class="-ml-1 mr-1 h-5 w-5 text-control-light"+ />+ <span> {{ $t("bbkit.common.back") }}</span>+ </NButton>+ <NButton+ v-if="currentIndex == stepList.length - 1"+ :disabled="!allowNext"+ type="primary"+ @click.prevent="$emit('finish')"+ >+ {{ $t(finishTitle) }}+ </NButton>+ <NButton+ v-else-if="!stepList[currentIndex].hideNext"+ :disabled="!allowNext"+ type="primary"+ @click.prevent="$emit('update:currentIndex', currentIndex + 1)"+ >+ {{ $t("bbkit.common.next") }}+ </NButton>+ </div>+ </div>+ </div>+</template>++<script lang="ts" setup>+import { NSteps, NStep, NButton } from "naive-ui";+import { VueClass } from "@/utils/types";++withDefaults(+ defineProps<{+ currentIndex: number;+ showCancel?: boolean;+ allowNext?: boolean;+ sticky?: boolean;+ finishTitle?: string;+ paneClass?: VueClass;+ stepList: { title: string; description?: string; hideNext?: boolean }[];+ }>(),+ {+ showCancel: true,+ allowNext: true,+ sticky: false,+ finishTitle: "bbkit.common.finish",+ paneClass: undefined,+ }+);++defineEmits<{+ (event: "cancel"): void;+ (event: "finish"): void;+ (event: "update:currentIndex", step: number): void;+}>();+</script>diff --git a/frontend/src/components/v2/Form/index.ts b/frontend/src/components/v2/Form/index.tsindex 8314d1ad62..9fa9c9b7d1 100644--- a/frontend/src/components/v2/Form/index.ts+++ b/frontend/src/components/v2/Form/index.ts@@ -5,6 +5,7 @@ import ResourceIdField from "./ResourceIdField.vue";import SearchBox from "./SearchBox.vue";import SpinnerButton from "./SpinnerButton.vue";import SpinnerSwitch from "./SpinnerSwitch.vue";+import StepTab from "./StepTab.vue";import Switch from "./Switch.vue";export * from "./types";@@ -17,4 +18,5 @@ export {SearchBox,ResourceIdField,Switch,+ StepTab,};diff --git a/frontend/src/views/SettingWorkspaceSQLReviewDetail.vue b/frontend/src/views/SettingWorkspaceSQLReviewDetail.vueindex ffac0fb7d3..107f066245 100644--- a/frontend/src/views/SettingWorkspaceSQLReviewDetail.vue+++ b/frontend/src/views/SettingWorkspaceSQLReviewDetail.vue@@ -79,7 +79,7 @@@comment-change="onCommentChange"/><BBButtonConfirm- class="my-4"+ class="!my-4":disabled="!hasPermission":style="'DELETE'":button-text="$t('sql-review.delete')"diff --git a/frontend/src/views/SettingWorkspaceVCS.vue b/frontend/src/views/SettingWorkspaceVCS.vueindex 7127cb5e62..d7ac086b48 100644--- a/frontend/src/views/SettingWorkspaceVCS.vue+++ b/frontend/src/views/SettingWorkspaceVCS.vue@@ -24,7 +24,7 @@</template></div><template v-else>- <VCSSetupWizard />+ <VCSSetupWizard :show-cancel="false" /></template></div></template>diff --git a/frontend/src/views/TwoFactorSetup.vue b/frontend/src/views/TwoFactorSetup.vueindex 20f600eca4..66e92be3f0 100644--- a/frontend/src/views/TwoFactorSetup.vue+++ b/frontend/src/views/TwoFactorSetup.vue@@ -5,15 +5,15 @@url="https://www.bytebase.com/docs/administration/2fa?source=console"/></p>- <BBStepTab+ <StepTabclass="mb-8"- :step-item-list="stepTabList"+ :step-list="stepTabList":allow-next="allowNext":finish-title="$t('two-factor.setup-steps.recovery-codes-saved')"- :current-step="state.currentStep"+ :current-index="state.currentStep"+ @update:current-index="tryChangeStep"+ @finish="tryFinishSetup"@cancel="cancelSetup"- @try-change-step="tryChangeStep"- @try-finish="tryFinishSetup"><template #0><div@@ -68,7 +68,7 @@@download="state.recoveryCodesDownloaded = true"/></template>- </BBStepTab>+ </StepTab><TwoFactorSecretModalv-if="state.showSecretModal"@@ -85,6 +85,7 @@ import { useRouter } from "vue-router";import LearnMoreLink from "@/components/LearnMoreLink.vue";import RecoveryCodesView from "@/components/RecoveryCodesView.vue";import TwoFactorSecretModal from "@/components/TwoFactorSecretModal.vue";+import { StepTab } from "@/components/v2";import { pushNotification, useAuthStore, useUserStore } from "@/store";import { UpdateUserRequest } from "@/types/proto/v1/auth_service";@@ -183,19 +184,14 @@ const cancelSetup = () => {}};-const tryChangeStep = async (- oldStep: number,- newStep: number,- allowChangeCallback: () => void-) => {- if (newStep === DOWNLOAD_RECOVERY_CODES_STEP) {+const tryChangeStep = async (nextStepIndex: number) => {+ if (nextStepIndex === DOWNLOAD_RECOVERY_CODES_STEP) {const result = await verifyTOPCode();if (!result) {return;}}- state.currentStep = newStep as Step;- allowChangeCallback();+ state.currentStep = nextStepIndex as Step;};const tryFinishSetup = async () => {