Skip to content

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

refactor: ui layout (#14282)

ecmadao5f2033c393aa
diff --git a/frontend/src/components/DatabaseGroup/DatabaseGroupForm.vue b/frontend/src/components/DatabaseGroup/DatabaseGroupForm.vue
index c5cc3611fd..54ced3322b 100644
--- a/frontend/src/components/DatabaseGroup/DatabaseGroupForm.vue
+++ b/frontend/src/components/DatabaseGroup/DatabaseGroupForm.vue
@@ -1,83 +1,83 @@
<template>
- <div class="w-full h-full flex flex-col">
- <div class="flex-1">
- <FeatureAttentionForInstanceLicense
- v-if="existMatchedUnactivateInstance"
- custom-class="mb-4"
- type="warning"
- feature="bb.feature.database-grouping"
- />
- <div class="w-full grid grid-cols-3 gap-x-6">
- <div>
- <p class="font-medium text-main mb-2">{{ $t("common.name") }}</p>
- <NInput v-model:value="state.placeholder" />
- <div class="mt-2">
- <ResourceIdField
- ref="resourceIdField"
- editing-class="mt-4"
- resource-type="database-group"
- :readonly="!isCreating"
- :value="state.resourceId"
- :resource-title="state.placeholder"
- :validate="validateResourceId"
+ <FormLayout :title="title">
+ <template #body>
+ <div>
+ <FeatureAttentionForInstanceLicense
+ v-if="existMatchedUnactivateInstance"
+ custom-class="mb-4"
+ type="warning"
+ feature="bb.feature.database-grouping"
+ />
+ <div class="w-full grid grid-cols-3 gap-x-6">
+ <div>
+ <p class="font-medium text-main mb-2">{{ $t("common.name") }}</p>
+ <NInput v-model:value="state.placeholder" />
+ <div class="mt-2">
+ <ResourceIdField
+ ref="resourceIdField"
+ editing-class="mt-4"
+ resource-type="database-group"
+ :readonly="!isCreating"
+ :value="state.resourceId"
+ :resource-title="state.placeholder"
+ :validate="validateResourceId"
+ />
+ </div>
+ </div>
+ </div>
+ <NDivider />
+ <div class="w-full grid grid-cols-5 gap-x-6">
+ <div class="col-span-3">
+ <p class="pl-1 font-medium text-main mb-2">
+ {{ $t("database-group.condition.self") }}
+ </p>
+ <ExprEditor
+ :expr="state.expr"
+ :allow-admin="true"
+ :enable-raw-expression="true"
+ :factor-list="FactorList"
+ :factor-support-dropdown="factorSupportDropdown"
+ :factor-options-map="DatabaseGroupFactorOptionsMap(project)"
+ />
+ <p
+ v-if="matchingError"
+ class="mt-2 text-sm border border-red-600 px-2 py-1 rounded-lg bg-red-50 text-red-600"
+ >
+ {{ matchingError }}
+ </p>
+ </div>
+ <div class="col-span-2">
+ <MatchedDatabaseView
+ :loading="state.isRequesting"
+ :matched-database-list="matchedDatabaseList"
+ :unmatched-database-list="unmatchedDatabaseList"
/>
</div>
</div>
- </div>
- <NDivider />
- <div class="w-full grid grid-cols-5 gap-x-6">
- <div class="col-span-3">
- <p class="pl-1 font-medium text-main mb-2">
- {{ $t("database-group.condition.self") }}
- </p>
- <ExprEditor
- :expr="state.expr"
- :allow-admin="true"
- :enable-raw-expression="true"
- :factor-list="FactorList"
- :factor-support-dropdown="factorSupportDropdown"
- :factor-options-map="DatabaseGroupFactorOptionsMap(project)"
- />
- <p
- v-if="matchingError"
- class="mt-2 text-sm border border-red-600 px-2 py-1 rounded-lg bg-red-50 text-red-600"
- >
- {{ matchingError }}
+ <NDivider />
+ <div class="w-full pl-1">
+ <p class="font-medium text-main mb-2">
+ {{ $t("common.options") }}
</p>
- </div>
- <div class="col-span-2">
- <MatchedDatabaseView
- :loading="state.isRequesting"
- :matched-database-list="matchedDatabaseList"
- :unmatched-database-list="unmatchedDatabaseList"
- />
- </div>
- </div>
- <NDivider />
- <div class="w-full pl-1">
- <p class="font-medium text-main mb-2">
- {{ $t("common.options") }}
- </p>
- <div>
- <NCheckbox
- v-model:checked="state.multitenancy"
- size="medium"
- :label="$t('database-group.multitenancy.self')"
- />
- <p class="text-sm text-gray-400 pl-6 ml-0.5">
- {{ $t("database-group.multitenancy.description") }}
- <LearnMoreLink
- url="https://www.bytebase.com/docs/change-database/batch-change/?source=console#multitenancy"
- class="text-sm"
+ <div>
+ <NCheckbox
+ v-model:checked="state.multitenancy"
+ size="medium"
+ :label="$t('database-group.multitenancy.self')"
/>
- </p>
+ <p class="text-sm text-gray-400 pl-6 ml-0.5">
+ {{ $t("database-group.multitenancy.description") }}
+ <LearnMoreLink
+ url="https://www.bytebase.com/docs/change-database/batch-change/?source=console#multitenancy"
+ class="text-sm"
+ />
+ </p>
+ </div>
</div>
</div>
- </div>
-
- <div class="w-full sticky bottom-0 bg-white">
- <NDivider />
- <div class="w-full flex justify-between items-center pb-2">
+ </template>
+ <template #footer>
+ <div class="w-full flex justify-between items-center">
<div>
<NButton v-if="!isCreating" text @click="doDelete">
<template #icon>
@@ -93,8 +93,8 @@
</NButton>
</div>
</div>
- </div>
- </div>
+ </template>
+ </FormLayout>
</template>
<script lang="ts" setup>
@@ -108,6 +108,7 @@ import { useI18n } from "vue-i18n";
import { useRouter } from "vue-router";
import ExprEditor from "@/components/ExprEditor";
import LearnMoreLink from "@/components/LearnMoreLink.vue";
+import FormLayout from "@/components/v2/Form/FormLayout.vue";
import type { ConditionGroupExpr } from "@/plugins/cel";
import {
emptySimpleExpr,
@@ -149,6 +150,7 @@ import { FactorList } from "./utils";
const props = defineProps<{
project: ComposedProject;
databaseGroup?: DatabaseGroup;
+ title?: string;
}>();
const emit = defineEmits<{
diff --git a/frontend/src/components/ProjectMember/ProjectMemberPanel.vue b/frontend/src/components/ProjectMember/ProjectMemberPanel.vue
index 428272d8ce..4f599021e4 100644
--- a/frontend/src/components/ProjectMember/ProjectMemberPanel.vue
+++ b/frontend/src/components/ProjectMember/ProjectMemberPanel.vue
@@ -1,23 +1,5 @@
<template>
<div class="w-full mx-auto space-y-4">
- <FeatureAttention feature="bb.feature.rbac" />
-
- <div v-if="allowEdit" class="flex justify-end gap-x-3">
- <NButton
- v-if="state.selectedTab === 'users'"
- :disabled="state.selectedMembers.length === 0"
- @click="handleRevokeSelectedMembers"
- >
- {{ $t("settings.members.revoke-access") }}
- </NButton>
- <NButton type="primary" @click="state.showAddMemberPanel = true">
- <template #icon>
- <heroicons-outline:user-add class="w-4 h-4" />
- </template>
- {{ $t("settings.members.grant-access") }}
- </NButton>
- </div>
-
<div class="textinfolabel">
{{ $t("project.members.description") }}
<a
@@ -30,14 +12,40 @@
</a>
</div>
+ <FeatureAttention feature="bb.feature.rbac" />
+
<NTabs v-model:value="state.selectedTab" type="bar" animated>
<template #suffix>
- <SearchBox
- v-model:value="state.searchText"
- :placeholder="$t('settings.members.search-member')"
- />
+ <div class="flex justify-end gap-x-2">
+ <SearchBox
+ v-model:value="state.searchText"
+ :placeholder="$t('settings.members.search-member')"
+ />
+ <NButton
+ v-if="state.selectedTab === 'users' && allowEdit"
+ :disabled="state.selectedMembers.length === 0"
+ @click="handleRevokeSelectedMembers"
+ >
+ {{ $t("settings.members.revoke-access") }}
+ </NButton>
+ <NButton
+ v-if="allowEdit"
+ type="primary"
+ @click="state.showAddMemberPanel = true"
+ >
+ <template #icon>
+ <heroicons-outline:user-add class="w-4 h-4" />
+ </template>
+ {{ $t("settings.members.grant-access") }}
+ </NButton>
+ </div>
</template>
- <NTabPane name="users" :tab="$t('project.members.view-by-members')">
+ <NTabPane name="users">
+ <template #tab>
+ <p class="text-base font-medium leading-7 text-main">
+ {{ $t("project.members.view-by-members") }}
+ </p>
+ </template>
<MemberDataTable
:allow-edit="allowEdit"
:bindings="memberBindings"
@@ -49,7 +57,12 @@
@update-selected-bindings="state.selectedMembers = $event"
/>
</NTabPane>
- <NTabPane name="roles" :tab="$t('project.members.view-by-roles')">
+ <NTabPane name="roles">
+ <template #tab>
+ <p class="text-base font-medium leading-7 text-main">
+ {{ $t("project.members.view-by-roles") }}
+ </p>
+ </template>
<MemberDataTableByRole
:allow-edit="allowEdit"
:bindings-by-role="memberBindingsByRole"
diff --git a/frontend/src/components/ProjectWebhookForm.vue b/frontend/src/components/ProjectWebhookForm.vue
index 2210e6bc6f..903508af13 100644
--- a/frontend/src/components/ProjectWebhookForm.vue
+++ b/frontend/src/components/ProjectWebhookForm.vue
@@ -1,6 +1,15 @@
<template>
- <div class="w-full h-full flex flex-col">
- <div class="flex-1 pb-4">
+ <FormLayout :title="create ? $t('project.webhook.creation.title') : ''">
+ <template v-if="!create" #title>
+ <div class="flex flex-row space-x-2 items-center">
+ <WebhookTypeIcon :type="props.webhook.type" class="h-6 w-6" />
+ <h3 class="text-lg leading-6 font-medium text-main">
+ {{ props.webhook.title }}
+ </h3>
+ </div>
+ <NDivider />
+ </template>
+ <template #body>
<div class="flex flex-col gap-y-4">
<div v-if="create">
<div>
@@ -150,11 +159,10 @@
</div>
</div>
</div>
- </div>
- <div class="w-full sticky bottom-0 bg-white">
- <NDivider />
+ </template>
+ <template #footer>
<div
- class="flex pb-2"
+ class="flex"
:class="!create && allowEdit ? 'justify-between' : 'justify-end'"
>
<BBButtonConfirm
@@ -200,8 +208,8 @@
</template>
</div>
</div>
- </div>
- </div>
+ </template>
+ </FormLayout>
</template>
<script lang="ts" setup>
@@ -220,6 +228,7 @@ import { reactive, computed, watch } from "vue";
import { useI18n } from "vue-i18n";
import { useRouter } from "vue-router";
import { BBAttention, BBButtonConfirm } from "@/bbkit";
+import FormLayout from "@/components/v2/Form/FormLayout.vue";
import {
PROJECT_V1_ROUTE_WEBHOOKS,
PROJECT_V1_ROUTE_WEBHOOK_DETAIL,
diff --git a/frontend/src/components/SensitiveData/GrantAccessForm.vue b/frontend/src/components/SensitiveData/GrantAccessForm.vue
index 2b111be600..dc407f700a 100644
--- a/frontend/src/components/SensitiveData/GrantAccessForm.vue
+++ b/frontend/src/components/SensitiveData/GrantAccessForm.vue
@@ -1,88 +1,88 @@
<template>
- <div class="h-full flex flex-col">
- <div class="space-y-8 flex-1">
- <div class="w-full">
- <div class="flex items-center gap-x-1 mb-2">
- <span class="font-medium text-main">
- {{ $t("common.resources") }}
- </span>
- <span class="text-red-600">*</span>
+ <FormLayout :title="title">
+ <template #body>
+ <div class="space-y-8">
+ <div class="w-full">
+ <div class="flex items-center gap-x-1 mb-2">
+ <span class="font-medium text-main">
+ {{ $t("common.resources") }}
+ </span>
+ <span class="text-red-600">*</span>
+ </div>
+ <DatabaseResourceForm
+ v-model:database-resources="state.databaseResources"
+ :project-name="projectName"
+ :required-feature="'bb.feature.sensitive-data'"
+ :include-cloumn="true"
+ />
</div>
- <DatabaseResourceForm
- v-model:database-resources="state.databaseResources"
- :project-name="projectName"
- :required-feature="'bb.feature.sensitive-data'"
- :include-cloumn="true"
- />
- </div>
- <div class="w-full">
- <div class="flex items-center gap-x-1 mb-2">
- <span class="font-medium text-main">
- {{ $t("settings.sensitive-data.action.self") }}
- </span>
- <span class="text-red-600">*</span>
+ <div class="w-full">
+ <div class="flex items-center gap-x-1 mb-2">
+ <span class="font-medium text-main">
+ {{ $t("settings.sensitive-data.action.self") }}
+ </span>
+ <span class="text-red-600">*</span>
+ </div>
+ <div class="flex space-x-4">
+ <NCheckbox
+ v-for="action in ACTIONS"
+ :key="action"
+ :checked="state.supportActions.has(action)"
+ @update:checked="toggleAction(action, $event)"
+ >
+ {{
+ $t(
+ `settings.sensitive-data.action.${maskingExceptionPolicy_MaskingException_ActionToJSON(
+ action
+ ).toLowerCase()}`
+ )
+ }}
+ </NCheckbox>
+ </div>
</div>
- <div class="flex space-x-4">
- <NCheckbox
- v-for="action in ACTIONS"
- :key="action"
- :checked="state.supportActions.has(action)"
- @update:checked="toggleAction(action, $event)"
- >
- {{
- $t(
- `settings.sensitive-data.action.${maskingExceptionPolicy_MaskingException_ActionToJSON(
- action
- ).toLowerCase()}`
- )
- }}
- </NCheckbox>
+
+ <div class="w-full">
+ <div class="flex items-center gap-x-1 mb-2">
+ <span class="font-medium text-main">
+ {{ $t("settings.sensitive-data.masking-level.self") }}
+ </span>
+ <span class="text-red-600">*</span>
+ </div>
+ <MaskingLevelRadioGroup
+ :level="state.maskingLevel"
+ :level-list="MASKING_LEVELS"
+ @update:level="state.maskingLevel = $event"
+ />
</div>
- </div>
- <div class="w-full">
- <div class="flex items-center gap-x-1 mb-2">
- <span class="font-medium text-main">
- {{ $t("settings.sensitive-data.masking-level.self") }}
- </span>
- <span class="text-red-600">*</span>
+ <div class="w-full">
+ <p class="mb-2 font-medium text-main">
+ {{ $t("common.expiration") }}
+ </p>
+ <NDatePicker
+ v-model:value="state.expirationTimestamp"
+ style="width: 100%"
+ type="datetime"
+ :is-date-disabled="(date: number) => date < Date.now()"
+ clearable
+ />
+ <span v-if="!state.expirationTimestamp" class="textinfolabel">{{
+ $t("settings.sensitive-data.never-expires")
+ }}</span>
</div>
- <MaskingLevelRadioGroup
- :level="state.maskingLevel"
- :level-list="MASKING_LEVELS"
- @update:level="state.maskingLevel = $event"
- />
- </div>
- <div class="w-full">
- <p class="mb-2 font-medium text-main">
- {{ $t("common.expiration") }}
- </p>
- <NDatePicker
- v-model:value="state.expirationTimestamp"
- style="width: 100%"
- type="datetime"
- :is-date-disabled="(date: number) => date < Date.now()"
- clearable
+ <MembersBindingSelect
+ v-model:value="state.memberList"
+ :required="true"
+ :project-name="projectName"
+ :include-all-users="false"
+ :include-service-account="false"
/>
- <span v-if="!state.expirationTimestamp" class="textinfolabel">{{
- $t("settings.sensitive-data.never-expires")
- }}</span>
</div>
-
- <MembersBindingSelect
- v-model:value="state.memberList"
- :required="true"
- :project-name="projectName"
- :include-all-users="false"
- :include-service-account="false"
- />
- </div>
-
- <div class="w-full sticky bottom-0 bg-white">
- <NDivider />
- <div class="flex justify-end items-center pb-2">
+ </template>
+ <template #footer>
+ <div class="flex justify-end items-center">
<div class="flex items-center gap-x-3">
<NButton @click.prevent="onDismiss">
{{ $t("common.cancel") }}
@@ -96,17 +96,18 @@
</NButton>
</div>
</div>
- </div>
- </div>
+ </template>
+ </FormLayout>
</template>
<script lang="tsx" setup>
import { isUndefined } from "lodash-es";
-import { NButton, NCheckbox, NDivider, NDatePicker } from "naive-ui";
+import { NButton, NCheckbox, NDatePicker } from "naive-ui";
import { computed, reactive } from "vue";
import { useI18n } from "vue-i18n";
import DatabaseResourceForm from "@/components/GrantRequestPanel/DatabaseResourceForm/index.vue";
import MembersBindingSelect from "@/components/Member/MembersBindingSelect.vue";
+import FormLayout from "@/components/v2/Form/FormLayout.vue";
import { usePolicyV1Store, pushNotification } from "@/store";
import type { DatabaseResource } from "@/types";
import { Expr } from "@/types/proto/google/type/expr";
@@ -131,6 +132,7 @@ import {
const props = defineProps<{
columnList: SensitiveColumn[];
projectName: string;
+ title?: string;
}>();
const emit = defineEmits(["dismiss"]);
@@ -186,7 +188,7 @@ const submitDisabled = computed(() => {
}
if (
!isUndefined(state.databaseResources) &&
- state.databaseResources.length === 0
+ state.databaseResources?.length === 0
) {
return true;
}
diff --git a/frontend/src/components/SensitiveData/SensitiveColumnView.vue b/frontend/src/components/SensitiveData/SensitiveColumnView.vue
index 7c49ec210d..229c7e1819 100644
--- a/frontend/src/components/SensitiveData/SensitiveColumnView.vue
+++ b/frontend/src/components/SensitiveData/SensitiveColumnView.vue
@@ -47,11 +47,18 @@
:disabled="
state.pendingGrantAccessColumn.length === 0 ||
!hasPermission ||
- !hasSensitiveDataFeature ||
selectedProjects.size !== 1
"
@click="onGrantAccessButtonClick"
>
+ <template #icon>
+ <ShieldCheckIcon v-if="hasSensitiveDataFeature" class="w-4" />
+ <FeatureBadge
+ v-else
+ feature="bb.feature.sensitive-data"
+ custom-class="text-white"
+ />
+ </template>
{{ $t("settings.sensitive-data.grant-access") }}
</NButton>
</template>
@@ -130,10 +137,16 @@
<script lang="ts" setup>
import { uniq } from "lodash-es";
+import { ShieldCheckIcon } from "lucide-vue-next";
import { NButton, NInputGroup, NTooltip } from "naive-ui";
import { computed, reactive, watch } from "vue";
import { useI18n } from "vue-i18n";
import { useRouter } from "vue-router";
+import {
+ FeatureModal,
+ FeatureBadge,
+ FeatureAttentionForInstanceLicense,
+} from "@/components/FeatureGuard";
import {
ProjectSelect,
InstanceSelect,
@@ -170,8 +183,6 @@ import {
PolicyResourceType,
} from "@/types/proto/v1/org_policy_service";
import { autoDatabaseRoute, hasWorkspacePermissionV2 } from "@/utils";
-import { FeatureAttentionForInstanceLicense } from "../FeatureGuard";
-import FeatureModal from "../FeatureGuard/FeatureModal.vue";
import NoDataPlaceholder from "../misc/NoDataPlaceholder.vue";
import { EnvironmentTabFilter } from "../v2";
import GrantAccessDrawer from "./GrantAccessDrawer.vue";
@@ -231,7 +242,7 @@ const selectedProjects = computed(() => {
const updateList = async () => {
state.isLoading = true;
- const distinctDatabaseNameList = uniq(
+ const distinctDatabaseNameList: string[] = uniq(
policyList.value.map((policy) => {
const [databaseName, _] = getPolicyResourceNameAndType(policy.name);
return databaseName;
@@ -440,6 +451,10 @@ const onDatabaseSelect = (name: string | undefined) => {
};
const onGrantAccessButtonClick = () => {
+ if (!hasSensitiveDataFeature.value) {
+ state.showFeatureModal = true;
+ return;
+ }
const instance = findInstanceWithoutLicense(state.pendingGrantAccessColumn);
if (instance) {
state.showFeatureModal = true;
diff --git a/frontend/src/components/VCS/VCSSetupWizard.vue b/frontend/src/components/VCS/VCSSetupWizard.vue
index e0c9a16340..e3d87955c6 100644
--- a/frontend/src/components/VCS/VCSSetupWizard.vue
+++ b/frontend/src/components/VCS/VCSSetupWizard.vue
@@ -1,11 +1,10 @@
<template>
- <div class="flex flex-col">
- <div class="flex-1">
+ <FormLayout>
+ <template #body>
<VCSProviderBasicInfoPanel :create="true" :config="state.config" />
- </div>
- <div class="w-full sticky bottom-0 bg-white">
- <NDivider />
- <div class="flex justify-end items-center pb-2">
+ </template>
+ <template #footer>
+ <div class="flex justify-end items-center">
<div class="space-x-3">
<NButton v-if="showCancel" @click.prevent="cancelSetup">
{{ $t("common.cancel") }}
@@ -19,15 +18,16 @@
</NButton>
</div>
</div>
- </div>
- </div>
+ </template>
+ </FormLayout>
</template>
<script lang="ts" setup>
-import { NButton, NDivider } from "naive-ui";
+import { NButton } from "naive-ui";
import { reactive, computed } from "vue";
import { useI18n } from "vue-i18n";
import { useRouter } from "vue-router";
+import FormLayout from "@/components/v2/Form/FormLayout.vue";
import { WORKSPACE_ROUTE_GITOPS } from "@/router/dashboard/workspaceRoutes";
import { pushNotification, useVCSProviderStore } from "@/store";
import type { VCSConfig } from "@/types";
diff --git a/frontend/src/components/v2/Form/FormLayout.vue b/frontend/src/components/v2/Form/FormLayout.vue
new file mode 100644
index 0000000000..91108b9a45
--- /dev/null
+++ b/frontend/src/components/v2/Form/FormLayout.vue
@@ -0,0 +1,25 @@
+<template>
+ <div class="h-full flex flex-col">
+ <div class="flex-1 pb-4">
+ <slot name="title">
+ <div v-if="title" class="text-lg leading-6 font-medium text-main">
+ {{ title }}
+ </div>
+ <NDivider v-if="title" />
+ </slot>
+ <slot name="body" />
+ </div>
+ <div class="w-full sticky bottom-0 pb-2 bg-white">
+ <NDivider />
+ <slot name="footer" />
+ </div>
+ </div>
+</template>
+
+<script setup lang="tsx">
+import { NDivider } from "naive-ui";
+
+defineProps<{
+ title?: string;
+}>();
+</script>
diff --git a/frontend/src/router/dashboard/projectV1.ts b/frontend/src/router/dashboard/projectV1.ts
index 9311a98a50..a014b76a84 100644
--- a/frontend/src/router/dashboard/projectV1.ts
+++ b/frontend/src/router/dashboard/projectV1.ts
@@ -134,7 +134,8 @@ const projectV1Routes: RouteRecordRaw[] = [
{
path: ":databaseGroupName",
name: PROJECT_V1_ROUTE_DATABASE_GROUP_DETAIL,
- component: () => import("@/views/DatabaseGroupDetail.vue"),
+ component: () =>
+ import("@/views/project/ProjectDatabaseGroupDetail.vue"),
props: true,
},
],
diff --git a/frontend/src/views/ExportCenter/index.vue b/frontend/src/views/ExportCenter/index.vue
index fc0b263af4..2bc8db969c 100644
--- a/frontend/src/views/ExportCenter/index.vue
+++ b/frontend/src/views/ExportCenter/index.vue
@@ -1,5 +1,5 @@
<template>
- <div class="w-full px-4">
+ <div class="w-full">
<div
class="w-full flex flex-col lg:flex-row items-start lg:items-center justify-between gap-2"
>
diff --git a/frontend/src/views/SettingWorkspaceMailDelivery.vue b/frontend/src/views/SettingWorkspaceMailDelivery.vue
index a19f452612..a8bd7eedc4 100644
--- a/frontend/src/views/SettingWorkspaceMailDelivery.vue
+++ b/frontend/src/views/SettingWorkspaceMailDelivery.vue
@@ -1,168 +1,169 @@
<template>
- <div class="h-full flex flex-col">
- <div class="w-full space-y-4 flex-1">
- <div class="textinfolabel">
- {{ $t("settings.mail-delivery.description") }}
- <a
- class="normal-link inline-flex items-center"
- href="https://www.bytebase.com/docs/administration/mail-delivery?source=console"
- target="__BLANK"
- >
- {{ $t("common.learn-more") }}
- <heroicons-outline:external-link class="w-4 h-4 ml-1" />
- </a>
- </div>
- <div class="w-full flex flex-col gap-y-6">
- <!-- Host and Port -->
- <div class="w-full flex flex-row gap-4">
- <div class="min-w-max w-80">
- <div class="textlabel pl-1">
- {{ $t("settings.mail-delivery.field.smtp-server-host") }}
- <span class="text-red-600">*</span>
- </div>
- <NInput
- v-model:value="state.mailDeliverySetting.server"
- class="text-main w-full h-max mt-2"
- :placeholder="'smtp.gmail.com'"
- />
- </div>
- <div class="min-w-max w-48">
- <div class="textlabel pl-1">
- {{ $t("settings.mail-delivery.field.smtp-server-port") }}
- <span class="text-red-600">*</span>
- </div>
- <NInputNumber
- id="port"
- v-model:value="state.mailDeliverySetting.port"
- :show-button="false"
- :placeholder="'587'"
- :required="true"
- name="port"
- class="text-main w-full h-max mt-2 rounded-md border-control-border focus:ring-control focus:border-control disabled:bg-gray-50"
- />
- </div>
- </div>
- <div class="w-full flex flex-row gap-4">
- <div class="min-w-max w-80">
- <div class="textlabel pl-1">
- {{ $t("settings.mail-delivery.field.from") }}
- <span class="text-red-600">*</span>
- </div>
- <NInput
- v-model:value="state.mailDeliverySetting.from"
- class="text-main w-full h-max mt-2"
- :placeholder="'[email protected]'"
- />
- </div>
- </div>
- <!-- Authentication Related -->
- <div class="w-full gap-4">
- <div class="min-w-max w-80">
- <div class="textlabel pl-1">
- {{ $t("settings.mail-delivery.field.authentication-method") }}
- </div>
- <NSelect
- class="mt-2"
- :value="getSelectedAuthenticationTypeItem"
- :options="authenticationTypeOptions"
- :virtual-scroll="true"
- :fallback-option="false"
- @update:value="handleSelectAuthenticationType"
- />
- </div>
+ <FormLayout>
+ <template #body>
+ <div class="w-full space-y-4">
+ <div class="textinfolabel">
+ {{ $t("settings.mail-delivery.description") }}
+ <a
+ class="normal-link inline-flex items-center"
+ href="https://www.bytebase.com/docs/administration/mail-delivery?source=console"
+ target="__BLANK"
+ >
+ {{ $t("common.learn-more") }}
+ <heroicons-outline:external-link class="w-4 h-4 ml-1" />
+ </a>
</div>
- <!-- Not NONE Authentication-->
- <template
- v-if="
- state.mailDeliverySetting.authentication !==
- SMTPMailDeliverySettingValue_Authentication.AUTHENTICATION_NONE
- "
- >
+ <div class="w-full flex flex-col gap-y-6">
+ <!-- Host and Port -->
<div class="w-full flex flex-row gap-4">
<div class="min-w-max w-80">
- <div class="flex flex-row">
- <label class="textlabel pl-1">
- {{ $t("settings.mail-delivery.field.smtp-username") }}
- <span class="text-red-600">*</span>
- </label>
+ <div class="textlabel pl-1">
+ {{ $t("settings.mail-delivery.field.smtp-server-host") }}
+ <span class="text-red-600">*</span>
</div>
<NInput
- v-model:value="state.mailDeliverySetting.username"
+ v-model:value="state.mailDeliverySetting.server"
class="text-main w-full h-max mt-2"
- :placeholder="'[email protected]'"
+ :placeholder="'smtp.gmail.com'"
/>
</div>
+ <div class="min-w-max w-48">
+ <div class="textlabel pl-1">
+ {{ $t("settings.mail-delivery.field.smtp-server-port") }}
+ <span class="text-red-600">*</span>
+ </div>
+ <NInputNumber
+ id="port"
+ v-model:value="state.mailDeliverySetting.port"
+ :show-button="false"
+ :placeholder="'587'"
+ :required="true"
+ name="port"
+ class="text-main w-full h-max mt-2 rounded-md border-control-border focus:ring-control focus:border-control disabled:bg-gray-50"
+ />
+ </div>
+ </div>
+ <div class="w-full flex flex-row gap-4">
<div class="min-w-max w-80">
- <div class="flex flex-row space-x-2">
- <label class="textlabel pl-1">
- {{ $t("settings.mail-delivery.field.smtp-password") }}
- <span class="text-red-600">*</span>
- </label>
- <NCheckbox
- :label="$t('common.empty')"
- :checked="state.useEmptyPassword"
- @update:checked="handleToggleUseEmptyPassword"
- />
+ <div class="textlabel pl-1">
+ {{ $t("settings.mail-delivery.field.from") }}
+ <span class="text-red-600">*</span>
</div>
- <BBTextField
- v-model:value="state.mailDeliverySetting.password"
+ <NInput
+ v-model:value="state.mailDeliverySetting.from"
class="text-main w-full h-max mt-2"
- :disabled="state.useEmptyPassword"
- :required="isCreating"
- :placeholder="'PASSWORD - INPUT_ONLY'"
+ :placeholder="'[email protected]'"
/>
</div>
</div>
- </template>
- <!-- Encryption Related -->
- <div class="w-full gap-4">
- <div class="min-w-max w-80">
- <div class="textlabel pl-1">
- {{ $t("settings.mail-delivery.field.encryption") }}
+ <!-- Authentication Related -->
+ <div class="w-full gap-4">
+ <div class="min-w-max w-80">
+ <div class="textlabel pl-1">
+ {{ $t("settings.mail-delivery.field.authentication-method") }}
+ </div>
+ <NSelect
+ class="mt-2"
+ :value="getSelectedAuthenticationTypeItem"
+ :options="authenticationTypeOptions"
+ :virtual-scroll="true"
+ :fallback-option="false"
+ @update:value="handleSelectAuthenticationType"
+ />
</div>
- <NSelect
- class="mt-2"
- :value="getSelectedEncryptionTypeItem"
- :options="encryptionTypeOptions"
- :virtual-scroll="true"
- :fallback-option="false"
- @update:value="handleSelectEncryptionType"
- />
</div>
- </div>
- <!-- Test Send Email To Someone -->
- <div class="w-full gap-4 flex flex-row">
- <div class="min-w-max w-160">
- <div class="textlabel pl-1">
- {{ $t("settings.mail-delivery.field.send-test-email-to") }}
+ <!-- Not NONE Authentication-->
+ <template
+ v-if="
+ state.mailDeliverySetting.authentication !==
+ SMTPMailDeliverySettingValue_Authentication.AUTHENTICATION_NONE
+ "
+ >
+ <div class="w-full flex flex-row gap-4">
+ <div class="min-w-max w-80">
+ <div class="flex flex-row">
+ <label class="textlabel pl-1">
+ {{ $t("settings.mail-delivery.field.smtp-username") }}
+ <span class="text-red-600">*</span>
+ </label>
+ </div>
+ <NInput
+ v-model:value="state.mailDeliverySetting.username"
+ class="text-main w-full h-max mt-2"
+ :placeholder="'[email protected]'"
+ />
+ </div>
+ <div class="min-w-max w-80">
+ <div class="flex flex-row space-x-2">
+ <label class="textlabel pl-1">
+ {{ $t("settings.mail-delivery.field.smtp-password") }}
+ <span class="text-red-600">*</span>
+ </label>
+ <NCheckbox
+ :label="$t('common.empty')"
+ :checked="state.useEmptyPassword"
+ @update:checked="handleToggleUseEmptyPassword"
+ />
+ </div>
+ <BBTextField
+ v-model:value="state.mailDeliverySetting.password"
+ class="text-main w-full h-max mt-2"
+ :disabled="state.useEmptyPassword"
+ :required="isCreating"
+ :placeholder="'PASSWORD - INPUT_ONLY'"
+ />
+ </div>
</div>
- <div
- class="flex flex-row justify-start items-center mt-2 space-x-4"
- >
- <NInput
- v-model:value="state.testMailTo"
- class="text-main h-max w-80"
- :placeholder="'[email protected]'"
+ </template>
+ <!-- Encryption Related -->
+ <div class="w-full gap-4">
+ <div class="min-w-max w-80">
+ <div class="textlabel pl-1">
+ {{ $t("settings.mail-delivery.field.encryption") }}
+ </div>
+ <NSelect
+ class="mt-2"
+ :value="getSelectedEncryptionTypeItem"
+ :options="encryptionTypeOptions"
+ :virtual-scroll="true"
+ :fallback-option="false"
+ @update:value="handleSelectEncryptionType"
/>
- <NButton
- type="primary"
- :disabled="
- state.testMailTo === '' || state.isCreateOrUpdateLoading
- "
- :loading="state.isSendLoading"
- @click.prevent="testMailDeliverySetting"
+ </div>
+ </div>
+ <!-- Test Send Email To Someone -->
+ <div class="w-full gap-4 flex flex-row">
+ <div class="min-w-max w-160">
+ <div class="textlabel pl-1">
+ {{ $t("settings.mail-delivery.field.send-test-email-to") }}
+ </div>
+ <div
+ class="flex flex-row justify-start items-center mt-2 space-x-4"
>
- {{ $t("settings.mail-delivery.field.send") }}
- </NButton>
- <BBSpin v-if="state.isSendLoading" class="ml-2" />
+ <NInput
+ v-model:value="state.testMailTo"
+ class="text-main h-max w-80"
+ :placeholder="'[email protected]'"
+ />
+ <NButton
+ type="primary"
+ :disabled="
+ state.testMailTo === '' || state.isCreateOrUpdateLoading
+ "
+ :loading="state.isSendLoading"
+ @click.prevent="testMailDeliverySetting"
+ >
+ {{ $t("settings.mail-delivery.field.send") }}
+ </NButton>
+ <BBSpin v-if="state.isSendLoading" class="ml-2" />
+ </div>
</div>
</div>
</div>
</div>
- </div>
- <div class="space-y-6 w-full sticky bottom-0 bg-white">
- <NDivider />
- <div class="flex justify-end items-center pb-2">
+ </template>
+ <template #footer>
+ <div class="flex justify-end items-center">
<NButton
v-if="
!isCreating &&
@@ -181,25 +182,19 @@
{{ mailDeliverySettingButtonText }}
</NButton>
</div>
- </div>
- </div>
+ </template>
+ </FormLayout>
</template>
<script lang="ts" setup>
import { cloneDeep, isEqual } from "lodash-es";
import type { SelectOption } from "naive-ui";
-import {
- NButton,
- NCheckbox,
- NInput,
- NInputNumber,
- NSelect,
- NDivider,
-} from "naive-ui";
+import { NButton, NCheckbox, NInput, NInputNumber, NSelect } from "naive-ui";
import type { ClientError } from "nice-grpc-web";
import { computed, onMounted, reactive } from "vue";
import { useI18n } from "vue-i18n";
import { BBSpin, BBTextField } from "@/bbkit";
+import FormLayout from "@/components/v2/Form/FormLayout.vue";
import { pushNotification } from "@/store";
import { useWorkspaceMailDeliverySettingStore } from "@/store/modules/workspaceMailDeliverySetting";
import type { SMTPMailDeliverySettingValue } from "@/types/proto/v1/setting_service";
diff --git a/frontend/src/views/SettingWorkspaceMembers.vue b/frontend/src/views/SettingWorkspaceMembers.vue
index dd6bf1eb54..84bfc1207a 100644
--- a/frontend/src/views/SettingWorkspaceMembers.vue
+++ b/frontend/src/views/SettingWorkspaceMembers.vue
@@ -6,7 +6,7 @@
<NTabs v-else v-model:value="state.selectedTab" type="line" animated>
<NTabPane name="MEMBERS">
<template #tab>
- <p class="text-lg font-medium leading-7 text-main">
+ <p class="text-base font-medium leading-7 text-main">
{{ $t("settings.members.view-by-members") }}
</p>
</template>
@@ -25,7 +25,7 @@
</NTabPane>
<NTabPane name="ROLES">
<template #tab>
- <p class="text-lg font-medium leading-7 text-main">
+ <p class="text-base font-medium leading-7 text-main">
{{ $t("settings.members.view-by-roles") }}
</p>
</template>
diff --git a/frontend/src/views/SettingWorkspaceUsers.vue b/frontend/src/views/SettingWorkspaceUsers.vue
index 7bb8db2d33..13643039ef 100644
--- a/frontend/src/views/SettingWorkspaceUsers.vue
+++ b/frontend/src/views/SettingWorkspaceUsers.vue
@@ -10,7 +10,7 @@
<NTabPane name="USERS">
<template #tab>
<div class="flex-1 flex space-x-2">
- <p class="text-lg font-medium leading-7 text-main">
+ <p class="text-base font-medium leading-7 text-main">
<span>{{ $t("common.users") }}</span>
<span class="ml-1 font-normal text-control-light">
({{ userStore.activeUserList.length }})
@@ -31,7 +31,7 @@
<NTabPane name="GROUPS">
<template #tab>
<div>
- <p class="text-lg font-medium leading-7 text-main">
+ <p class="text-base font-medium leading-7 text-main">
<span>{{ $t("settings.members.groups.self") }}</span>
<span class="ml-1 font-normal text-control-light">
({{ groupStore.groupList.length }})
diff --git a/frontend/src/views/project/ProjectDatabaseGroupCreate.vue b/frontend/src/views/project/ProjectDatabaseGroupCreate.vue
index 75e0c441ba..012df9cedf 100644
--- a/frontend/src/views/project/ProjectDatabaseGroupCreate.vue
+++ b/frontend/src/views/project/ProjectDatabaseGroupCreate.vue
@@ -1,27 +1,21 @@
<template>
- <div class="h-full flex flex-col">
- <div class="text-lg leading-6 font-medium text-main">
- {{ $t("database-group.create") }}
- </div>
- <NDivider />
- <DatabaseGroupForm
- class="flex-1"
- :project="project"
- @dismiss="() => router.back()"
- @created="(databaseGroupName: string) => {
- router.push({
- name: PROJECT_V1_ROUTE_DATABASE_GROUP_DETAIL,
- params: {
- databaseGroupName,
- },
- });
- }"
- />
- </div>
+ <DatabaseGroupForm
+ class="flex-1"
+ :project="project"
+ :title="$t('database-group.create')"
+ @dismiss="() => router.back()"
+ @created="(databaseGroupName: string) => {
+ router.push({
+ name: PROJECT_V1_ROUTE_DATABASE_GROUP_DETAIL,
+ params: {
+ databaseGroupName,
+ },
+ });
+ }"
+ />
</template>
<script lang="tsx" setup>
-import { NDivider } from "naive-ui";
import { computed } from "vue";
import { useRouter } from "vue-router";
import DatabaseGroupForm from "@/components/DatabaseGroup/DatabaseGroupForm.vue";
diff --git a/frontend/src/views/DatabaseGroupDetail.vue b/frontend/src/views/project/ProjectDatabaseGroupDetail.vue
similarity index 100%
rename from frontend/src/views/DatabaseGroupDetail.vue
rename to frontend/src/views/project/ProjectDatabaseGroupDetail.vue
diff --git a/frontend/src/views/project/ProjectDatabaseMaskingAccessCreate.vue b/frontend/src/views/project/ProjectDatabaseMaskingAccessCreate.vue
index 453e113535..cc1b2a7551 100644
--- a/frontend/src/views/project/ProjectDatabaseMaskingAccessCreate.vue
+++ b/frontend/src/views/project/ProjectDatabaseMaskingAccessCreate.vue
@@ -1,20 +1,13 @@
<template>
- <div class="h-full flex flex-col">
- <div class="text-lg leading-6 font-medium text-main">
- {{ $t("project.masking-access.grant-access") }}
- </div>
- <NDivider />
- <GrantAccessForm
- class="flex-1"
- :column-list="[]"
- :project-name="project.name"
- @dismiss="() => router.back()"
- />
- </div>
+ <GrantAccessForm
+ :title="$t('project.masking-access.grant-access')"
+ :column-list="[]"
+ :project-name="project.name"
+ @dismiss="() => router.back()"
+ />
</template>
<script lang="tsx" setup>
-import { NDivider } from "naive-ui";
import { computed } from "vue";
import { useRouter } from "vue-router";
import GrantAccessForm from "@/components/SensitiveData/GrantAccessForm.vue";
diff --git a/frontend/src/views/project/ProjectWebhookCreate.vue b/frontend/src/views/project/ProjectWebhookCreate.vue
index b02ae4f65b..40c0defcb7 100644
--- a/frontend/src/views/project/ProjectWebhookCreate.vue
+++ b/frontend/src/views/project/ProjectWebhookCreate.vue
@@ -1,20 +1,12 @@
<template>
- <div class="h-full flex flex-col">
- <div class="text-lg leading-6 font-medium text-main">
- {{ $t("project.webhook.creation.title") }}
- </div>
- <NDivider />
- <ProjectWebhookForm
- class="flex-1"
- :create="true"
- :project="project"
- :webhook="defaultNewWebhook"
- />
- </div>
+ <ProjectWebhookForm
+ :create="true"
+ :project="project"
+ :webhook="defaultNewWebhook"
+ />
</template>
<script lang="ts" setup>
-import { NDivider } from "naive-ui";
import { computed } from "vue";
import ProjectWebhookForm from "@/components/ProjectWebhookForm.vue";
import { useProjectByName } from "@/store";
diff --git a/frontend/src/views/project/ProjectWebhookDetail.vue b/frontend/src/views/project/ProjectWebhookDetail.vue
index 8469c4f419..f128afbd47 100644
--- a/frontend/src/views/project/ProjectWebhookDetail.vue
+++ b/frontend/src/views/project/ProjectWebhookDetail.vue
@@ -1,26 +1,14 @@
<template>
- <div class="space-y-4 divide-y divide-block-border">
- <div class="flex justify-between">
- <div class="flex flex-row space-x-2 items-center">
- <WebhookTypeIcon :type="projectWebhook.type" class="h-6 w-6" />
- <h3 class="text-xl leading-6 font-medium text-main">
- {{ projectWebhook.title }}
- </h3>
- </div>
- </div>
- <ProjectWebhookForm
- class="pt-4"
- :allow-edit="allowEdit"
- :create="false"
- :project="project"
- :webhook="projectWebhook"
- />
- </div>
+ <ProjectWebhookForm
+ :allow-edit="allowEdit"
+ :create="false"
+ :project="project"
+ :webhook="projectWebhook"
+ />
</template>
<script lang="ts" setup>
import { computed } from "vue";
-import WebhookTypeIcon from "@/components/Project/WebhookTypeIcon.vue";
import ProjectWebhookForm from "@/components/ProjectWebhookForm.vue";
import { useProjectByName, useProjectWebhookV1Store } from "@/store";
import { projectNamePrefix } from "@/store/modules/v1/common";