Skip to content

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

refactor: consolidate create database prep form components (#17315)

boojacke5585da915ec
diff --git a/frontend/src/components/CreateDatabasePrepForm/CreateDatabasePrepButtonGroup.vue b/frontend/src/components/CreateDatabasePrepForm/CreateDatabasePrepButtonGroup.vue
deleted file mode 100644
index 9d915cf400..0000000000
--- a/frontend/src/components/CreateDatabasePrepForm/CreateDatabasePrepButtonGroup.vue
+++ /dev/null
@@ -1,23 +0,0 @@
-<template>
- <div v-if="form" class="flex justify-end gap-x-3">
- <NButton @click.prevent="form?.cancel">
- {{ $t("common.cancel") }}
- </NButton>
- <NButton
- type="primary"
- :disabled="!form?.allowCreate"
- @click.prevent="form?.create"
- >
- {{ $t("common.create") }}
- </NButton>
- </div>
-</template>
-
-<script setup lang="ts">
-import { NButton } from "naive-ui";
-import type CreateDatabasePrepForm from "./CreateDatabasePrepForm.vue";
-
-defineProps<{
- form?: InstanceType<typeof CreateDatabasePrepForm>;
-}>();
-</script>
diff --git a/frontend/src/components/CreateDatabasePrepForm/CreateDatabasePrepForm.vue b/frontend/src/components/CreateDatabasePrepForm/CreateDatabasePrepForm.vue
deleted file mode 100644
index 88a8555a9a..0000000000
--- a/frontend/src/components/CreateDatabasePrepForm/CreateDatabasePrepForm.vue
+++ /dev/null
@@ -1,406 +0,0 @@
-<template>
- <div class="w-72 mx-auto space-y-4">
- <div v-if="allowEditProject" class="w-full">
- <label for="project" class="textlabel">
- {{ $t("common.project") }}
- <RequiredStar />
- </label>
- <ProjectSelect
- class="mt-1 !w-full"
- required
- :project-name="state.projectName"
- @update:project-name="selectProject"
- />
- </div>
-
- <div class="w-full">
- <div class="flex flex-row items-center space-x-1">
- <label for="instance" class="textlabel">
- {{ $t("common.instance") }} <RequiredStar />
- </label>
- </div>
- <div class="flex flex-row space-x-2 items-center">
- <InstanceSelect
- class="mt-1"
- name="instance"
- required
- :disabled="!allowEditInstance"
- :instance-name="state.instanceName"
- :allowed-engine-list="supportedEngines"
- @update:instance-name="selectInstance"
- />
- </div>
- </div>
-
- <div class="w-full">
- <label for="name" class="textlabel">
- {{ $t("create-db.new-database-name") }}
- <RequiredStar />
- </label>
- <NInput
- v-model:value="state.databaseName"
- required
- name="databaseName"
- type="text"
- class="mt-1 w-full"
- :placeholder="$t('create-db.new-database-name')"
- />
- <span v-if="isReservedName" class="text-red-600">
- <i18n-t keypath="create-db.reserved-db-error">
- <template #databaseName>
- {{ state.databaseName }}
- </template>
- </i18n-t>
- </span>
- </div>
-
- <div v-if="selectedInstance.engine === Engine.MONGODB" class="w-full">
- <label for="name" class="textlabel">
- {{ $t("create-db.new-collection-name") }}
- <RequiredStar />
- </label>
- <NInput
- v-model:value="state.tableName"
- required
- name="tableName"
- type="text"
- class="mt-1 w-full"
- />
- </div>
-
- <div v-if="selectedInstance.engine === Engine.CLICKHOUSE" class="w-full">
- <label for="name" class="textlabel">
- {{ $t("create-db.cluster") }}
- </label>
- <NInput
- v-model:value="state.cluster"
- name="cluster"
- type="text"
- class="mt-1 w-full"
- />
- </div>
-
- <div class="w-full">
- <label for="environment" class="textlabel">
- {{ $t("common.environment") }}
- </label>
- <EnvironmentSelect
- v-model:environment-name="state.environmentName"
- class="mt-1"
- required
- name="environment"
- />
- </div>
-
- <div v-if="requireDatabaseOwnerName && state.instanceName" class="w-full">
- <label for="name" class="textlabel">
- {{ $t("create-db.database-owner-name") }}
- <RequiredStar />
- </label>
- <InstanceRoleSelect
- class="mt-1"
- name="instance-user"
- :instance-name="state.instanceName"
- :role="state.instanceRole?.name"
- :filter="filterInstanceRole"
- @update:instance-role="selectInstanceRole"
- />
- </div>
-
- <template v-if="showCollationAndCharacterSet">
- <div class="w-full">
- <label for="charset" class="textlabel">
- {{
- selectedInstance.engine === Engine.POSTGRES ||
- selectedInstance.engine === Engine.REDSHIFT
- ? $t("db.encoding")
- : $t("db.character-set")
- }}</label
- >
- <NInput
- v-model:value="state.characterSet"
- name="charset"
- type="text"
- class="mt-1 w-full"
- :placeholder="defaultCharsetOfEngineV1(selectedInstance.engine)"
- />
- </div>
-
- <div class="w-full">
- <label for="collation" class="textlabel">
- {{ $t("db.collation") }}
- </label>
- <NInput
- v-model:value="state.collation"
- name="collation"
- type="text"
- class="mt-1 w-full"
- :placeholder="
- defaultCollationOfEngineV1(selectedInstance.engine) || 'default'
- "
- />
- </div>
- </template>
- </div>
-
- <div
- v-if="state.creating"
- class="absolute inset-0 z-10 bg-white/70 flex items-center justify-center"
- >
- <BBSpin />
- </div>
-</template>
-
-<script lang="ts" setup>
-import { create as createProto } from "@bufbuild/protobuf";
-import { isEmpty } from "lodash-es";
-import { NInput } from "naive-ui";
-import { v4 as uuidv4 } from "uuid";
-import { computed, reactive } from "vue";
-import { useI18n } from "vue-i18n";
-import { useRouter } from "vue-router";
-import { BBSpin } from "@/bbkit";
-import InstanceRoleSelect from "@/components/InstanceRoleSelect.vue";
-import RequiredStar from "@/components/RequiredStar.vue";
-import {
- EnvironmentSelect,
- InstanceSelect,
- ProjectSelect,
-} from "@/components/v2";
-import { PROJECT_V1_ROUTE_ISSUE_DETAIL } from "@/router/dashboard/projectV1";
-import {
- experimentalCreateIssueByPlan,
- useCurrentUserV1,
- useInstanceResourceByName,
- useProjectByName,
-} from "@/store";
-import {
- defaultCharsetOfEngineV1,
- defaultCollationOfEngineV1,
- isValidInstanceName,
- isValidProjectName,
- UNKNOWN_PROJECT_NAME,
-} from "@/types";
-import { Engine } from "@/types/proto-es/v1/common_pb";
-import type { InstanceRole } from "@/types/proto-es/v1/instance_role_service_pb";
-import { IssueSchema, Issue_Type } from "@/types/proto-es/v1/issue_service_pb";
-import type { Plan_CreateDatabaseConfig } from "@/types/proto-es/v1/plan_service_pb";
-import {
- PlanSchema,
- Plan_SpecSchema,
- Plan_CreateDatabaseConfigSchema,
-} from "@/types/proto-es/v1/plan_service_pb";
-import type { Plan_Spec } from "@/types/proto-es/v1/plan_service_pb";
-import {
- enginesSupportCreateDatabase,
- extractProjectResourceName,
- instanceV1HasCollationAndCharacterSet,
- issueV1Slug,
-} from "@/utils";
-
-const INTERNAL_RDS_INSTANCE_USER_LIST = ["rds_ad", "rdsadmin", "rds_iam"];
-
-interface LocalState {
- projectName?: string;
- environmentName?: string;
- instanceName?: string;
- instanceRole?: InstanceRole;
- databaseName: string;
- tableName: string;
- characterSet: string;
- collation: string;
- cluster: string;
- creating: boolean;
-}
-
-const props = defineProps<{
- projectName?: string;
- environmentName?: string;
- instanceName?: string;
-}>();
-
-const emit = defineEmits<{
- (event: "dismiss"): void;
-}>();
-
-const { t } = useI18n();
-const router = useRouter();
-const currentUserV1 = useCurrentUserV1();
-
-const state = reactive<LocalState>({
- databaseName: "",
- projectName: props.projectName,
- environmentName: props.environmentName,
- instanceName: props.instanceName,
- tableName: "",
- characterSet: "",
- collation: "",
- cluster: "",
- creating: false,
-});
-const { project } = useProjectByName(
- computed(() => state.projectName ?? UNKNOWN_PROJECT_NAME)
-);
-
-const isReservedName = computed(() => {
- return state.databaseName.toLowerCase() == "bytebase";
-});
-
-const supportedEngines = computed(() => enginesSupportCreateDatabase());
-
-const allowCreate = computed(() => {
- return (
- !isEmpty(state.databaseName) &&
- validDatabaseOwnerName.value &&
- !isReservedName.value &&
- isValidProjectName(state.projectName) &&
- isValidInstanceName(state.instanceName)
- );
-});
-
-// If project has been specified, then we disallow changing it.
-const allowEditProject = computed(() => {
- return !props.projectName;
-});
-
-// If instance has been specified, then we disallow changing it.
-const allowEditInstance = computed(() => {
- return !props.instanceName;
-});
-
-const selectedInstance = computed(
- () => useInstanceResourceByName(state.instanceName ?? "").instance.value
-);
-
-const showCollationAndCharacterSet = computed((): boolean => {
- const instance = selectedInstance.value;
- return instanceV1HasCollationAndCharacterSet(instance);
-});
-
-const requireDatabaseOwnerName = computed((): boolean => {
- const instance = selectedInstance.value;
- if (!isValidInstanceName(instance.name)) {
- return false;
- }
- return [Engine.POSTGRES, Engine.REDSHIFT, Engine.COCKROACHDB].includes(
- instance.engine
- );
-});
-
-const validDatabaseOwnerName = computed((): boolean => {
- if (!requireDatabaseOwnerName.value) {
- return true;
- }
-
- return state.instanceRole !== undefined;
-});
-
-const selectProject = (name: string | undefined) => {
- state.projectName = name;
-};
-
-const selectInstance = (instanceName: string | undefined) => {
- state.instanceName = instanceName;
- state.environmentName = selectedInstance.value.environment;
-};
-
-const selectInstanceRole = (role?: InstanceRole) => {
- state.instanceRole = role;
-};
-
-const filterInstanceRole = (user: InstanceRole) => {
- if (INTERNAL_RDS_INSTANCE_USER_LIST.includes(user.roleName)) {
- return false;
- }
- return true;
-};
-
-const cancel = () => {
- emit("dismiss");
-};
-
-const createV1 = async () => {
- if (!allowCreate.value) {
- return;
- }
- if (!state.environmentName || !state.instanceName) {
- return;
- }
-
- const databaseName = state.databaseName;
- const tableName = state.tableName;
-
- let owner = "";
- if (requireDatabaseOwnerName.value && state.instanceRole) {
- owner = state.instanceRole.roleName;
- }
-
- const specs: Plan_Spec[] = [];
- const createDatabaseConfig: Plan_CreateDatabaseConfig = createProto(
- Plan_CreateDatabaseConfigSchema,
- {
- target: state.instanceName,
- database: databaseName,
- table: tableName,
- environment: state.environmentName,
-
- characterSet:
- state.characterSet ||
- defaultCharsetOfEngineV1(selectedInstance.value.engine),
- collation:
- state.collation ||
- defaultCollationOfEngineV1(selectedInstance.value.engine),
- cluster: state.cluster,
- owner,
- }
- );
- const spec = createProto(Plan_SpecSchema, {
- id: uuidv4(),
- });
- specs.push(spec);
-
- const issueCreate = createProto(IssueSchema, {
- type: Issue_Type.DATABASE_CHANGE,
- creator: `users/${currentUserV1.value.email}`,
- });
-
- spec.config = {
- case: "createDatabaseConfig",
- value: createDatabaseConfig,
- };
-
- const title = `${t("issue.title.create-database")} '${databaseName}'`;
- state.creating = true;
- try {
- const planCreate = createProto(PlanSchema, {
- title: title,
- specs: [spec],
- creator: currentUserV1.value.name,
- });
- const { createdIssue } = await experimentalCreateIssueByPlan(
- project.value,
- issueCreate,
- planCreate
- );
- router.push({
- name: PROJECT_V1_ROUTE_ISSUE_DETAIL,
- params: {
- projectId: extractProjectResourceName(createdIssue.name),
- issueSlug: issueV1Slug(createdIssue.name, createdIssue.title),
- },
- });
- } finally {
- state.creating = false;
- }
-};
-
-const create = async () => {
- await createV1();
-};
-
-defineExpose({
- allowCreate,
- cancel,
- create,
-});
-</script>
diff --git a/frontend/src/components/CreateDatabasePrepForm/CreateDatabasePrepPanel.vue b/frontend/src/components/CreateDatabasePrepForm/CreateDatabasePrepPanel.vue
index 25a3df8602..9f3087fa17 100644
--- a/frontend/src/components/CreateDatabasePrepForm/CreateDatabasePrepPanel.vue
+++ b/frontend/src/components/CreateDatabasePrepForm/CreateDatabasePrepPanel.vue
@@ -1,33 +1,407 @@
<template>
<DrawerContent :title="$t('quick-action.create-db')">
- <CreateDatabasePrepForm
- ref="form"
- :project-name="projectName"
- :environment-name="environmentName"
- :instance-name="instanceName"
- @dismiss="$emit('dismiss')"
- />
+ <div class="w-72 mx-auto space-y-4">
+ <div v-if="!isValidProjectName(project.name)" class="w-full">
+ <label for="project" class="textlabel">
+ {{ $t("common.project") }}
+ <RequiredStar />
+ </label>
+ <ProjectSelect
+ class="mt-1 !w-full"
+ required
+ :project-name="state.projectName"
+ @update:project-name="selectProject"
+ />
+ </div>
+
+ <div class="w-full">
+ <div class="flex flex-row items-center space-x-1">
+ <label for="instance" class="textlabel">
+ {{ $t("common.instance") }} <RequiredStar />
+ </label>
+ </div>
+ <div class="flex flex-row space-x-2 items-center">
+ <InstanceSelect
+ class="mt-1"
+ name="instance"
+ required
+ :disabled="!allowEditInstance"
+ :instance-name="state.instanceName"
+ :allowed-engine-list="supportedEngines"
+ @update:instance-name="selectInstance"
+ />
+ </div>
+ </div>
+
+ <div class="w-full">
+ <label for="name" class="textlabel">
+ {{ $t("create-db.new-database-name") }}
+ <RequiredStar />
+ </label>
+ <NInput
+ v-model:value="state.databaseName"
+ required
+ name="databaseName"
+ type="text"
+ class="mt-1 w-full"
+ :placeholder="$t('create-db.new-database-name')"
+ />
+ <span v-if="isReservedName" class="text-red-600">
+ <i18n-t keypath="create-db.reserved-db-error">
+ <template #databaseName>
+ {{ state.databaseName }}
+ </template>
+ </i18n-t>
+ </span>
+ </div>
+
+ <div v-if="selectedInstance.engine === Engine.MONGODB" class="w-full">
+ <label for="name" class="textlabel">
+ {{ $t("create-db.new-collection-name") }}
+ <RequiredStar />
+ </label>
+ <NInput
+ v-model:value="state.tableName"
+ required
+ name="tableName"
+ type="text"
+ class="mt-1 w-full"
+ />
+ </div>
+
+ <div v-if="selectedInstance.engine === Engine.CLICKHOUSE" class="w-full">
+ <label for="name" class="textlabel">
+ {{ $t("create-db.cluster") }}
+ </label>
+ <NInput
+ v-model:value="state.cluster"
+ name="cluster"
+ type="text"
+ class="mt-1 w-full"
+ />
+ </div>
+
+ <div class="w-full">
+ <label for="environment" class="textlabel">
+ {{ $t("common.environment") }}
+ </label>
+ <EnvironmentSelect
+ v-model:environment-name="state.environmentName"
+ class="mt-1"
+ required
+ name="environment"
+ />
+ </div>
+
+ <div v-if="requireDatabaseOwnerName && state.instanceName" class="w-full">
+ <label for="name" class="textlabel">
+ {{ $t("create-db.database-owner-name") }}
+ <RequiredStar />
+ </label>
+ <InstanceRoleSelect
+ class="mt-1"
+ name="instance-user"
+ :instance-name="state.instanceName"
+ :role="state.instanceRole?.name"
+ :filter="filterInstanceRole"
+ @update:instance-role="selectInstanceRole"
+ />
+ </div>
+
+ <template v-if="showCollationAndCharacterSet">
+ <div class="w-full">
+ <label for="charset" class="textlabel">
+ {{
+ selectedInstance.engine === Engine.POSTGRES ||
+ selectedInstance.engine === Engine.REDSHIFT
+ ? $t("db.encoding")
+ : $t("db.character-set")
+ }}</label
+ >
+ <NInput
+ v-model:value="state.characterSet"
+ name="charset"
+ type="text"
+ class="mt-1 w-full"
+ :placeholder="defaultCharsetOfEngineV1(selectedInstance.engine)"
+ />
+ </div>
+
+ <div class="w-full">
+ <label for="collation" class="textlabel">
+ {{ $t("db.collation") }}
+ </label>
+ <NInput
+ v-model:value="state.collation"
+ name="collation"
+ type="text"
+ class="mt-1 w-full"
+ :placeholder="
+ defaultCollationOfEngineV1(selectedInstance.engine) || 'default'
+ "
+ />
+ </div>
+ </template>
+ </div>
+
+ <div
+ v-if="state.creating"
+ class="absolute inset-0 z-10 bg-white/70 flex items-center justify-center"
+ >
+ <BBSpin />
+ </div>
<template #footer>
- <CreateDatabasePrepButtonGroup :form="form" />
+ <div class="flex justify-end gap-x-3">
+ <NButton quaternary @click.prevent="cancel">
+ {{ $t("common.cancel") }}
+ </NButton>
+ <NButton
+ type="primary"
+ :disabled="!allowCreate"
+ @click.prevent="create"
+ >
+ {{ $t("common.create") }}
+ </NButton>
+ </div>
</template>
</DrawerContent>
</template>
-<script setup lang="ts">
-import { ref } from "vue";
-import { DrawerContent } from "@/components/v2";
-import CreateDatabasePrepButtonGroup from "./CreateDatabasePrepButtonGroup.vue";
-import CreateDatabasePrepForm from "./CreateDatabasePrepForm.vue";
+<script lang="ts" setup>
+import { create as createProto } from "@bufbuild/protobuf";
+import { isEmpty } from "lodash-es";
+import { NButton, NInput } from "naive-ui";
+import { v4 as uuidv4 } from "uuid";
+import { computed, reactive } from "vue";
+import { useI18n } from "vue-i18n";
+import { useRouter } from "vue-router";
+import { BBSpin } from "@/bbkit";
+import InstanceRoleSelect from "@/components/InstanceRoleSelect.vue";
+import RequiredStar from "@/components/RequiredStar.vue";
+import {
+ DrawerContent,
+ EnvironmentSelect,
+ InstanceSelect,
+ ProjectSelect,
+} from "@/components/v2";
+import { PROJECT_V1_ROUTE_ISSUE_DETAIL } from "@/router/dashboard/projectV1";
+import {
+ experimentalCreateIssueByPlan,
+ useCurrentProjectV1,
+ useCurrentUserV1,
+ useInstanceResourceByName,
+} from "@/store";
+import {
+ defaultCharsetOfEngineV1,
+ defaultCollationOfEngineV1,
+ isValidInstanceName,
+ isValidProjectName,
+} from "@/types";
+import { Engine } from "@/types/proto-es/v1/common_pb";
+import type { InstanceRole } from "@/types/proto-es/v1/instance_role_service_pb";
+import { IssueSchema, Issue_Type } from "@/types/proto-es/v1/issue_service_pb";
+import type { Plan_CreateDatabaseConfig } from "@/types/proto-es/v1/plan_service_pb";
+import {
+ PlanSchema,
+ Plan_SpecSchema,
+ Plan_CreateDatabaseConfigSchema,
+} from "@/types/proto-es/v1/plan_service_pb";
+import type { Plan_Spec } from "@/types/proto-es/v1/plan_service_pb";
+import {
+ enginesSupportCreateDatabase,
+ extractProjectResourceName,
+ instanceV1HasCollationAndCharacterSet,
+ issueV1Slug,
+} from "@/utils";
+
+const INTERNAL_RDS_INSTANCE_USER_LIST = ["rds_ad", "rdsadmin", "rds_iam"];
-defineProps<{
+interface LocalState {
projectName?: string;
environmentName?: string;
instanceName?: string;
+ instanceRole?: InstanceRole;
+ databaseName: string;
+ tableName: string;
+ characterSet: string;
+ collation: string;
+ cluster: string;
+ creating: boolean;
+}
+
+const props = defineProps<{
+ environmentName?: string;
+ instanceName?: string;
}>();
-defineEmits<{
+const emit = defineEmits<{
(event: "dismiss"): void;
}>();
-const form = ref<InstanceType<typeof CreateDatabasePrepForm>>();
+const { t } = useI18n();
+const router = useRouter();
+const currentUserV1 = useCurrentUserV1();
+
+const { project } = useCurrentProjectV1();
+
+const state = reactive<LocalState>({
+ databaseName: "",
+ projectName: isValidProjectName(project.value.name)
+ ? project.value.name
+ : undefined,
+ environmentName: props.environmentName,
+ instanceName: props.instanceName,
+ tableName: "",
+ characterSet: "",
+ collation: "",
+ cluster: "",
+ creating: false,
+});
+
+const isReservedName = computed(() => {
+ return state.databaseName.toLowerCase() == "bytebase";
+});
+
+const supportedEngines = computed(() => enginesSupportCreateDatabase());
+
+const allowCreate = computed(() => {
+ return (
+ !isEmpty(state.databaseName) &&
+ validDatabaseOwnerName.value &&
+ !isReservedName.value &&
+ isValidProjectName(state.projectName) &&
+ isValidInstanceName(state.instanceName)
+ );
+});
+
+// If instance has been specified, then we disallow changing it.
+const allowEditInstance = computed(() => {
+ return !props.instanceName;
+});
+
+const selectedInstance = computed(
+ () => useInstanceResourceByName(state.instanceName ?? "").instance.value
+);
+
+const showCollationAndCharacterSet = computed((): boolean => {
+ const instance = selectedInstance.value;
+ return instanceV1HasCollationAndCharacterSet(instance);
+});
+
+const requireDatabaseOwnerName = computed((): boolean => {
+ const instance = selectedInstance.value;
+ if (!isValidInstanceName(instance.name)) {
+ return false;
+ }
+ return [Engine.POSTGRES, Engine.REDSHIFT, Engine.COCKROACHDB].includes(
+ instance.engine
+ );
+});
+
+const validDatabaseOwnerName = computed((): boolean => {
+ if (!requireDatabaseOwnerName.value) {
+ return true;
+ }
+
+ return state.instanceRole !== undefined;
+});
+
+const selectProject = (name: string | undefined) => {
+ state.projectName = name;
+};
+
+const selectInstance = (instanceName: string | undefined) => {
+ state.instanceName = instanceName;
+ state.environmentName = selectedInstance.value.environment;
+};
+
+const selectInstanceRole = (role?: InstanceRole) => {
+ state.instanceRole = role;
+};
+
+const filterInstanceRole = (user: InstanceRole) => {
+ if (INTERNAL_RDS_INSTANCE_USER_LIST.includes(user.roleName)) {
+ return false;
+ }
+ return true;
+};
+
+const cancel = () => {
+ emit("dismiss");
+};
+
+const create = async () => {
+ if (!allowCreate.value) {
+ return;
+ }
+ if (!state.environmentName || !state.instanceName) {
+ return;
+ }
+
+ const databaseName = state.databaseName;
+ const tableName = state.tableName;
+
+ let owner = "";
+ if (requireDatabaseOwnerName.value && state.instanceRole) {
+ owner = state.instanceRole.roleName;
+ }
+
+ const specs: Plan_Spec[] = [];
+ const createDatabaseConfig: Plan_CreateDatabaseConfig = createProto(
+ Plan_CreateDatabaseConfigSchema,
+ {
+ target: state.instanceName,
+ database: databaseName,
+ table: tableName,
+ environment: state.environmentName,
+
+ characterSet:
+ state.characterSet ||
+ defaultCharsetOfEngineV1(selectedInstance.value.engine),
+ collation:
+ state.collation ||
+ defaultCollationOfEngineV1(selectedInstance.value.engine),
+ cluster: state.cluster,
+ owner,
+ }
+ );
+ const spec = createProto(Plan_SpecSchema, {
+ id: uuidv4(),
+ });
+ specs.push(spec);
+
+ const issueCreate = createProto(IssueSchema, {
+ type: Issue_Type.DATABASE_CHANGE,
+ creator: `users/${currentUserV1.value.email}`,
+ });
+
+ spec.config = {
+ case: "createDatabaseConfig",
+ value: createDatabaseConfig,
+ };
+
+ const title = `${t("issue.title.create-database")} '${databaseName}'`;
+ state.creating = true;
+ try {
+ const planCreate = createProto(PlanSchema, {
+ title: title,
+ specs: [spec],
+ creator: currentUserV1.value.name,
+ });
+ const { createdIssue } = await experimentalCreateIssueByPlan(
+ project.value,
+ issueCreate,
+ planCreate
+ );
+ router.push({
+ name: PROJECT_V1_ROUTE_ISSUE_DETAIL,
+ params: {
+ projectId: extractProjectResourceName(createdIssue.name),
+ issueSlug: issueV1Slug(createdIssue.name, createdIssue.title),
+ },
+ });
+ } finally {
+ state.creating = false;
+ }
+};
</script>
diff --git a/frontend/src/components/CreateDatabasePrepForm/index.ts b/frontend/src/components/CreateDatabasePrepForm/index.ts
index c2298c2533..023aefe896 100644
--- a/frontend/src/components/CreateDatabasePrepForm/index.ts
+++ b/frontend/src/components/CreateDatabasePrepForm/index.ts
@@ -1,11 +1,3 @@
-import CreateDatabasePrepButtonGroup from "./CreateDatabasePrepButtonGroup.vue";
-import CreateDatabasePrepForm from "./CreateDatabasePrepForm.vue";
import CreateDatabasePrepPanel from "./CreateDatabasePrepPanel.vue";
-export {
- CreateDatabasePrepForm,
- CreateDatabasePrepPanel,
- CreateDatabasePrepButtonGroup,
-};
-
-export default CreateDatabasePrepForm;
+export { CreateDatabasePrepPanel };
diff --git a/frontend/src/components/InstanceForm/Buttons.vue b/frontend/src/components/InstanceForm/Buttons.vue
index 669b041abf..a35d1e4668 100644
--- a/frontend/src/components/InstanceForm/Buttons.vue
+++ b/frontend/src/components/InstanceForm/Buttons.vue
@@ -4,6 +4,7 @@
<div class="w-full flex justify-end items-center gap-x-3">
<NButton
v-if="allowCancel"
+ quaternary
:disabled="state.isRequesting || state.isTestingConnection"
@click.prevent="cancel"
>
diff --git a/frontend/src/components/IssueV1/IssueDetailPage.vue b/frontend/src/components/IssueV1/IssueDetailPage.vue
index d8ec9cbd25..bf02e62cb3 100644
--- a/frontend/src/components/IssueV1/IssueDetailPage.vue
+++ b/frontend/src/components/IssueV1/IssueDetailPage.vue
@@ -32,7 +32,7 @@
<div
v-if="sidebarMode == 'DESKTOP'"
- class="hide-scrollbar border-l border-gray-200 bg-gray-50"
+ class="hide-scrollbar border-l border-gray-200"
:style="{
width: `${desktopSidebarWidth}px`,
}"
diff --git a/frontend/src/components/Project/ProjectCreatePanel.vue b/frontend/src/components/Project/ProjectCreatePanel.vue
index 8f9137ff9d..fcc9567ecd 100644
--- a/frontend/src/components/Project/ProjectCreatePanel.vue
+++ b/frontend/src/components/Project/ProjectCreatePanel.vue
@@ -47,7 +47,7 @@
<template #footer>
<div class="flex justify-end items-center gap-x-3">
- <NButton @click.prevent="cancel">
+ <NButton quaternary @click.prevent="cancel">
{{ $t("common.cancel") }}
</NButton>
<NButton
diff --git a/frontend/src/components/ProjectDatabasesPanel.vue b/frontend/src/components/ProjectDatabasesPanel.vue
index c34775e4dc..5a33e0817b 100644
--- a/frontend/src/components/ProjectDatabasesPanel.vue
+++ b/frontend/src/components/ProjectDatabasesPanel.vue
@@ -42,10 +42,7 @@
:show="state.showCreateDrawer"
@close="state.showCreateDrawer = false"
>
- <CreateDatabasePrepPanel
- :project-name="project.name"
- @dismiss="state.showCreateDrawer = false"
- />
+ <CreateDatabasePrepPanel @dismiss="state.showCreateDrawer = false" />
</Drawer>
</template>
diff --git a/frontend/src/views/DatabaseDashboard.vue b/frontend/src/views/DatabaseDashboard.vue
index bf8c461084..79641800c5 100644
--- a/frontend/src/views/DatabaseDashboard.vue
+++ b/frontend/src/views/DatabaseDashboard.vue
@@ -23,7 +23,7 @@
</NButton>
</div>
- <div class="space-y-2">
+ <div>
<DatabaseOperations
:databases="selectedDatabases"
@refresh="() => pagedDatabaseTableRef?.refresh()"
diff --git a/frontend/src/views/InstanceDashboard.vue b/frontend/src/views/InstanceDashboard.vue
index a3db378706..3c78d69c53 100644
--- a/frontend/src/views/InstanceDashboard.vue
+++ b/frontend/src/views/InstanceDashboard.vue
@@ -24,7 +24,7 @@
{{ $t("quick-action.add-instance") }}
</NButton>
</div>
- <div class="space-y-2">
+ <div>
<InstanceOperations
:instance-list="selectedInstanceList"
@update="(instances) => pagedInstanceTableRef?.updateCache(instances)"
diff --git a/frontend/src/views/ProjectDashboard.vue b/frontend/src/views/ProjectDashboard.vue
index b10271d5f7..7b4b04de7c 100644
--- a/frontend/src/views/ProjectDashboard.vue
+++ b/frontend/src/views/ProjectDashboard.vue
@@ -17,7 +17,7 @@
{{ $t("quick-action.new-project") }}
</NButton>
</div>
- <div class="space-y-2">
+ <div>
<ProjectOperations
v-if="hasWorkspacePermissionV2('bb.projects.delete')"
:project-list="selectedProjectList"