Skip to content

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

chore: ui update (#10055)

ecmadaoa14a16272bdf
diff --git a/frontend/src/bbkit/BBSpin.vue b/frontend/src/bbkit/BBSpin.vue
index 4fe2af3862..73d5ae59f4 100644
--- a/frontend/src/bbkit/BBSpin.vue
+++ b/frontend/src/bbkit/BBSpin.vue
@@ -1,7 +1,21 @@
<template>
- <NSpin v-bind="$attrs" :size="'small'" :stroke-width="25" class="w-5 h-5" />
+ <NSpin
+ v-bind="$attrs"
+ :size="size"
+ :stroke-width="25"
+ :class="size === 'small' && 'w-5 h-5'"
+ />
</template>
<script lang="ts" setup>
import { NSpin } from "naive-ui";
+
+withDefaults(
+ defineProps<{
+ size?: "small" | "medium" | "large";
+ }>(),
+ {
+ size: "small",
+ }
+);
</script>
diff --git a/frontend/src/components/AlterSchemaPrepForm/AlterSchemaPrepForm.vue b/frontend/src/components/AlterSchemaPrepForm/AlterSchemaPrepForm.vue
index 01b4f4d9dd..f281979c71 100644
--- a/frontend/src/components/AlterSchemaPrepForm/AlterSchemaPrepForm.vue
+++ b/frontend/src/components/AlterSchemaPrepForm/AlterSchemaPrepForm.vue
@@ -167,28 +167,26 @@
<template
#selection-all="{ databaseList: selectedDatabaseList }"
>
- <input
+ <NCheckbox
v-if="selectedDatabaseList.length > 0"
- type="checkbox"
class="h-4 w-4 text-accent rounded disabled:cursor-not-allowed border-control-border focus:ring-accent"
- v-bind="getAllSelectionState(selectedDatabaseList as ComposedDatabase[])"
- @input="
+ :checked="getAllSelectionState(selectedDatabaseList as ComposedDatabase[]).checked"
+ :indeterminate="getAllSelectionState(selectedDatabaseList as ComposedDatabase[]).indeterminate"
+ @update:checked="
toggleDatabasesSelection(
selectedDatabaseList as ComposedDatabase[],
- ($event.target as HTMLInputElement).checked
+ $event
)
"
/>
</template>
<template #selection="{ database }">
- <input
- type="checkbox"
- class="h-4 w-4 text-accent rounded disabled:cursor-not-allowed border-control-border focus:ring-accent"
+ <NCheckbox
:checked="isDatabaseSelected(database as ComposedDatabase)"
- @click.stop="
+ @update:checked="
toggleDatabasesSelection(
[database as ComposedDatabase],
- ($event.target as HTMLInputElement).checked
+ $event
)
"
/>
@@ -309,6 +307,7 @@ import {
NRadio,
NInputGroup,
NInputGroupLabel,
+ NCheckbox,
} from "naive-ui";
import { computed, reactive, PropType, ref, watch } from "vue";
import { watchEffect } from "vue";
diff --git a/frontend/src/components/AlterSchemaPrepForm/ProjectStandardView.vue b/frontend/src/components/AlterSchemaPrepForm/ProjectStandardView.vue
index 7eaf0c5467..7102e59bd2 100644
--- a/frontend/src/components/AlterSchemaPrepForm/ProjectStandardView.vue
+++ b/frontend/src/components/AlterSchemaPrepForm/ProjectStandardView.vue
@@ -28,21 +28,24 @@
>
<template #header>
<label class="flex items-center gap-x-2" @click.stop="">
- <input
- type="checkbox"
- class="h-4 w-4 text-accent rounded disabled:cursor-not-allowed border-control-border focus:ring-accent ml-0.5"
- v-bind="
+ <NCheckbox
+ :checked="
getAllSelectionStateForEnvironment(
environment,
databaseListInEnvironment
- )
+ ).checked
+ "
+ :indeterminate="
+ getAllSelectionStateForEnvironment(
+ environment,
+ databaseListInEnvironment
+ ).indeterminate
"
- @click.stop=""
- @input="
+ @update:checked="
toggleAllDatabasesSelectionForEnvironment(
environment,
databaseListInEnvironment,
- ($event.target as HTMLInputElement).checked
+ $event
)
"
/>
@@ -78,16 +81,21 @@
"
>
<div class="radio text-sm flex justify-start md:flex-1">
- <input
- type="checkbox"
- class="h-4 w-4 text-accent rounded disabled:cursor-not-allowed border-control-border focus:ring-accent"
+ <NCheckbox
:checked="
isDatabaseSelectedForEnvironment(
database.uid,
environment.uid
)
"
- @input="(e: any) => toggleDatabaseUidForEnvironment(database.uid, environment.uid, e.target.checked)"
+ @update:checked="
+ (checked) =>
+ toggleDatabaseUidForEnvironment(
+ database.uid,
+ environment.uid,
+ checked
+ )
+ "
/>
<span
class="font-medium ml-2 text-main"
@@ -112,7 +120,7 @@
<script lang="ts" setup>
/* eslint-disable vue/no-mutating-props */
-import { NCollapse, NCollapseItem } from "naive-ui";
+import { NCollapse, NCollapseItem, NCheckbox } from "naive-ui";
import { reactive, computed, watch } from "vue";
import { EnvironmentV1Name, InstanceV1EngineIcon } from "@/components/v2";
import { ComposedDatabase } from "@/types";
diff --git a/frontend/src/components/DatabasesSelectPanel.vue b/frontend/src/components/DatabasesSelectPanel.vue
deleted file mode 100644
index 332b3b08a1..0000000000
--- a/frontend/src/components/DatabasesSelectPanel.vue
+++ /dev/null
@@ -1,258 +0,0 @@
-<template>
- <Drawer
- :show="true"
- width="auto"
- @update:show="(show: boolean) => !show && $emit('close')"
- >
- <DrawerContent
- :title="$t('common.database')"
- :closable="true"
- class="w-[30rem] max-w-[100vw] relative"
- >
- <div class="flex items-center justify-end mx-2 mb-2">
- <BBTableSearch
- class="m-px"
- :placeholder="$t('database.filter-database')"
- @change-text="(text: string) => (state.searchText = text)"
- />
- </div>
- <NCollapse
- class="overflow-y-auto"
- arrow-placement="left"
- :default-expanded-names="
- databaseListGroupByEnvironment.map((group) => group.environment.uid)
- "
- >
- <NCollapseItem
- v-for="{
- environment,
- databaseList: databaseListInEnvironment,
- } in databaseListGroupByEnvironment"
- :key="environment.uid"
- :name="environment.uid"
- >
- <template #header>
- <label class="flex items-center gap-x-2" @click.stop="">
- <input
- type="checkbox"
- class="h-4 w-4 text-accent rounded disabled:cursor-not-allowed border-control-border focus:ring-accent ml-0.5"
- v-bind="
- getAllSelectionStateForEnvironment(
- environment,
- databaseListInEnvironment
- )
- "
- @click.stop=""
- @input="
- toggleAllDatabasesSelectionForEnvironment(
- environment,
- databaseListInEnvironment,
- ($event.target as HTMLInputElement).checked
- )
- "
- />
- <EnvironmentV1Name :environment="environment" :link="false" />
- </label>
- </template>
-
- <template #header-extra>
- <div class="flex items-center text-xs text-gray-500 mr-2">
- {{
- $t(
- "database.n-selected-m-in-total",
- getSelectionStateSummaryForEnvironment(
- environment,
- databaseListInEnvironment
- )
- )
- }}
- </div>
- </template>
-
- <div class="relative bg-white rounded-md -space-y-px px-2">
- <template
- v-for="(database, dbIndex) in databaseListInEnvironment"
- :key="dbIndex"
- >
- <label
- class="border-control-border relative border p-3 flex flex-col gap-y-2 md:flex-row md:pl-4 md:pr-6"
- :class="
- database.syncState === State.ACTIVE
- ? 'cursor-pointer'
- : 'cursor-not-allowed'
- "
- >
- <div class="radio text-sm flex justify-start md:flex-1">
- <input
- type="checkbox"
- class="h-4 w-4 text-accent rounded disabled:cursor-not-allowed border-control-border focus:ring-accent"
- :checked="isDatabaseSelected(database.uid)"
- @input="(e: any) => toggleDatabaseSelected(database.uid, e.target.checked)"
- />
- <span
- class="font-medium ml-2 text-main"
- :class="database.syncState !== State.ACTIVE && 'opacity-40'"
- >{{ database.name }}</span
- >
- </div>
- <div
- class="flex items-center gap-x-1 textinfolabel ml-6 pl-0 md:ml-0 md:pl-0 md:justify-end"
- >
- <InstanceV1Name
- :instance="database.instanceEntity"
- :link="false"
- />
- </div>
- </label>
- </template>
- </div>
- </NCollapseItem>
- </NCollapse>
-
- <template #footer>
- <div class="flex items-center justify-end gap-x-2">
- <NButton @click="$emit('close')">{{ $t("common.cancel") }}</NButton>
- <NButton type="primary" @click="handleConfirm">
- {{ $t("common.select") }}
- </NButton>
- </div>
- </template>
- </DrawerContent>
- </Drawer>
-</template>
-
-<script setup lang="ts">
-import { NCollapse, NCollapseItem, NButton } from "naive-ui";
-import { computed, reactive, PropType } from "vue";
-import { Drawer, DrawerContent, InstanceV1Name } from "@/components/v2";
-import {
- useDatabaseV1Store,
- useEnvironmentV1Store,
- useProjectV1Store,
-} from "@/store";
-import { ComposedDatabase } from "@/types";
-import { State } from "@/types/proto/v1/common";
-import { Environment } from "@/types/proto/v1/environment_service";
-
-type LocalState = {
- searchText: string;
- selectedDatabaseList: ComposedDatabase[];
-};
-
-const props = defineProps({
- projectId: {
- type: String,
- required: true,
- },
- selectedDatabaseIdList: {
- type: Array as PropType<string[]>,
- required: true,
- },
-});
-
-const emit = defineEmits<{
- (event: "close"): void;
- (event: "update", databaseIdList: string[]): void;
-}>();
-
-const environmentV1Store = useEnvironmentV1Store();
-const databaseStore = useDatabaseV1Store();
-const state = reactive<LocalState>({
- searchText: "",
- selectedDatabaseList: props.selectedDatabaseIdList.map((id) => {
- return databaseStore.getDatabaseByUID(id);
- }),
-});
-
-const databaseListGroupByEnvironment = computed(() => {
- const project = useProjectV1Store().getProjectByUID(props.projectId);
- const databaseList = databaseStore
- .databaseListByProject(project.name)
- .filter((db) => db.databaseName.includes(state.searchText));
- const listByEnv = environmentV1Store.environmentList.map((environment) => {
- const list = databaseList.filter(
- (db) => db.effectiveEnvironment === environment.name
- );
- return {
- environment,
- databaseList: list,
- };
- });
-
- return listByEnv.filter((group) => group.databaseList.length > 0);
-});
-
-const isDatabaseSelected = (databaseId: string) => {
- const idList = state.selectedDatabaseList.map((db) => db.uid);
- return idList.includes(databaseId);
-};
-
-const toggleDatabaseSelected = (databaseId: string, selected: boolean) => {
- const index = state.selectedDatabaseList.findIndex(
- (db) => db.uid === databaseId
- );
- if (selected) {
- if (index < 0) {
- state.selectedDatabaseList.push(
- databaseStore.getDatabaseByUID(databaseId)
- );
- }
- } else {
- if (index >= 0) {
- state.selectedDatabaseList.splice(index, 1);
- }
- }
-};
-
-const toggleAllDatabasesSelectionForEnvironment = (
- environment: Environment,
- databaseList: ComposedDatabase[],
- on: boolean
-) => {
- databaseList
- .filter((db) => db.effectiveEnvironment === environment.name)
- .forEach((db) => toggleDatabaseSelected(db.uid, on));
-};
-
-const getAllSelectionStateForEnvironment = (
- environment: Environment,
- databaseList: ComposedDatabase[]
-): { checked: boolean; indeterminate: boolean } => {
- const set = new Set(
- state.selectedDatabaseList
- .filter((db) => db.effectiveEnvironment === environment.name)
- .map((db) => db.uid)
- );
- const checked =
- state.selectedDatabaseList.length > 0 &&
- databaseList.every((db) => set.has(db.uid));
- const indeterminate = !checked && databaseList.some((db) => set.has(db.uid));
-
- return {
- checked,
- indeterminate,
- };
-};
-
-const getSelectionStateSummaryForEnvironment = (
- environment: Environment,
- databaseList: ComposedDatabase[]
-) => {
- const set = new Set(
- state.selectedDatabaseList
- .filter((db) => db.effectiveEnvironment === environment.name)
- .map((db) => db.uid)
- );
- const selected = databaseList.filter((db) => set.has(db.uid)).length;
- const total = databaseList.length;
-
- return { selected, total };
-};
-
-const handleConfirm = async () => {
- const databaseIdList = state.selectedDatabaseList
- .filter((db) => db.name.includes(state.searchText))
- .map((db) => db.uid);
- emit("update", databaseIdList);
-};
-</script>
diff --git a/frontend/src/components/InstanceAssignment.vue b/frontend/src/components/InstanceAssignment.vue
index 6f24701d30..75903ee7d6 100644
--- a/frontend/src/components/InstanceAssignment.vue
+++ b/frontend/src/components/InstanceAssignment.vue
@@ -40,21 +40,15 @@
:class="[column.class]"
>
<template v-if="index === 0 && canManageSubscription">
- <input
+ <NCheckbox
v-if="instanceList.length > 0"
- type="checkbox"
- class="h-4 w-4 text-accent rounded disabled:cursor-not-allowed border-control-border focus:ring-accent"
:checked="allSelectionState.checked"
:indeterminate="allSelectionState.indeterminate"
:disabled="
!allSelectionState.checked &&
instanceList.length > instanceLicenseCount
"
- @input="
- selectAllInstances(
- ($event.target as HTMLInputElement).checked
- )
- "
+ @update:checked="selectAllInstances($event)"
/>
</template>
<template v-else>{{ column.title }}</template>
@@ -63,17 +57,13 @@
</template>
<template #item="{ item: instance }: { item: ComposedInstance }">
<div v-if="canManageSubscription" class="bb-grid-cell">
- <input
- type="checkbox"
- class="h-4 w-4 text-accent rounded disabled:cursor-not-allowed border-control-border focus:ring-accent"
+ <NCheckbox
:checked="isInstanceSelected(instance)"
:disabled="
!isInstanceSelected(instance) &&
state.selectedInstance.size == instanceLicenseCount
"
- @click.stop="
- toggleSelectInstance(instance, !isInstanceSelected(instance))
- "
+ @update:checked="toggleSelectInstance(instance, $event)"
/>
</div>
<div class="bb-grid-cell">
@@ -130,6 +120,7 @@
</template>
<script lang="ts" setup>
+import { NCheckbox } from "naive-ui";
import { storeToRefs } from "pinia";
import { reactive, computed, watchEffect } from "vue";
import { useI18n } from "vue-i18n";
diff --git a/frontend/src/components/Issue/panel/RequestExportPanel/ExportResourceForm/DatabaseResourceSelector.vue b/frontend/src/components/Issue/panel/RequestExportPanel/ExportResourceForm/DatabaseResourceSelector.vue
index ec801701f6..1a38184da3 100644
--- a/frontend/src/components/Issue/panel/RequestExportPanel/ExportResourceForm/DatabaseResourceSelector.vue
+++ b/frontend/src/components/Issue/panel/RequestExportPanel/ExportResourceForm/DatabaseResourceSelector.vue
@@ -10,6 +10,13 @@
:source-filterable="true"
:source-filter-placeholder="$t('common.filter-by-name')"
/>
+ <div
+ v-else
+ style="height: 512px"
+ class="border flex items-center justify-center"
+ >
+ <BBSpin size="large" />
+ </div>
</div>
</template>
@@ -21,7 +28,7 @@ import {
NTree,
TreeOption,
} from "naive-ui";
-import { computed, h, onMounted, ref, watch } from "vue";
+import { computed, h, ref, watch } from "vue";
import {
useDatabaseV1Store,
useDBSchemaV1Store,
@@ -62,43 +69,49 @@ const selectedValueList = ref<string[]>(
.filter((item) => item !== "")
);
const databaseResourceMap = ref<Map<string, DatabaseResource>>(new Map());
-const loading = ref(false);
+const loading = ref(true);
-onMounted(async () => {
- const project = await useProjectV1Store().getOrFetchProjectByUID(
- props.projectId
- );
- const databaseList = await databaseStore.fetchDatabaseList({
- parent: "instances/-",
- filter: `project == "${project.name}"`,
- });
+watch(
+ () => props.projectId,
+ async (projectId) => {
+ loading.value = true;
- for (const database of databaseList) {
- const databaseMetadata = await dbSchemaStore.getOrFetchDatabaseMetadata({
- database: database.name,
- });
- databaseResourceMap.value.set(`d-${database.uid}`, {
- databaseName: database.name,
+ const project = await useProjectV1Store().getOrFetchProjectByUID(projectId);
+ const databaseList = await databaseStore.fetchDatabaseList({
+ parent: "instances/-",
+ filter: `project == "${project.name}"`,
});
- for (const schema of databaseMetadata.schemas) {
- databaseResourceMap.value.set(`s-${database.uid}-${schema.name}`, {
+
+ for (const database of databaseList) {
+ const databaseMetadata = await dbSchemaStore.getOrFetchDatabaseMetadata({
+ database: database.name,
+ });
+ databaseResourceMap.value.set(`d-${database.uid}`, {
databaseName: database.name,
- schema: schema.name,
});
- for (const table of schema.tables) {
- databaseResourceMap.value.set(
- `t-${database.uid}-${schema.name}-${table.name}`,
- {
- databaseName: database.name,
- schema: schema.name,
- table: table.name,
- }
- );
+ for (const schema of databaseMetadata.schemas) {
+ databaseResourceMap.value.set(`s-${database.uid}-${schema.name}`, {
+ databaseName: database.name,
+ schema: schema.name,
+ });
+ for (const table of schema.tables) {
+ databaseResourceMap.value.set(
+ `t-${database.uid}-${schema.name}-${table.name}`,
+ {
+ databaseName: database.name,
+ schema: schema.name,
+ table: table.name,
+ }
+ );
+ }
}
}
+ loading.value = false;
+ },
+ {
+ immediate: true,
}
- loading.value = false;
-});
+);
const databaseList = computed(() => {
const project = useProjectV1Store().getProjectByUID(props.projectId);
diff --git a/frontend/src/components/Issue/panel/RequestQueryPanel/DatabaseResourceForm/DatabaseResourceSelector.vue b/frontend/src/components/Issue/panel/RequestQueryPanel/DatabaseResourceForm/DatabaseResourceSelector.vue
index e7d0c2778f..921b44b560 100644
--- a/frontend/src/components/Issue/panel/RequestQueryPanel/DatabaseResourceForm/DatabaseResourceSelector.vue
+++ b/frontend/src/components/Issue/panel/RequestQueryPanel/DatabaseResourceForm/DatabaseResourceSelector.vue
@@ -10,6 +10,13 @@
:source-filterable="true"
:source-filter-placeholder="$t('common.filter-by-name')"
/>
+ <div
+ v-else
+ style="height: 512px"
+ class="border flex items-center justify-center"
+ >
+ <BBSpin size="large" />
+ </div>
</div>
</template>
diff --git a/frontend/src/components/ProjectDatabasesPanel.vue b/frontend/src/components/ProjectDatabasesPanel.vue
index b283efe3f2..986325d973 100644
--- a/frontend/src/components/ProjectDatabasesPanel.vue
+++ b/frontend/src/components/ProjectDatabasesPanel.vue
@@ -31,29 +31,23 @@
:database-list="filteredDatabaseList"
>
<template #selection-all="{ databaseList: selectedDatabaseList }">
- <input
+ <NCheckbox
v-if="selectedDatabaseList.length > 0"
- type="checkbox"
- class="h-4 w-4 text-accent rounded disabled:cursor-not-allowed border-control-border focus:ring-accent"
- v-bind="getAllSelectionState(selectedDatabaseList as ComposedDatabase[])"
- @input="
+ :checked="getAllSelectionState(selectedDatabaseList as ComposedDatabase[]).checked"
+ :indeterminate="getAllSelectionState(selectedDatabaseList as ComposedDatabase[]).indeterminate"
+ @update:checked="
toggleDatabasesSelection(
selectedDatabaseList as ComposedDatabase[],
- ($event.target as HTMLInputElement).checked
+ $event
)
"
/>
</template>
<template #selection="{ database }">
- <input
- type="checkbox"
- class="h-4 w-4 text-accent rounded disabled:cursor-not-allowed border-control-border focus:ring-accent"
+ <NCheckbox
:checked="isDatabaseSelected(database as ComposedDatabase)"
- @click.stop="
- toggleDatabasesSelection(
- [database as ComposedDatabase],
- ($event.target as HTMLInputElement).checked
- )
+ @update:checked="
+ toggleDatabasesSelection([database as ComposedDatabase], $event)
"
/>
</template>
@@ -84,6 +78,7 @@
</template>
<script lang="ts" setup>
+import { NCheckbox } from "naive-ui";
import { reactive, computed, ref, watchEffect } from "vue";
import { usePageMode, usePolicyV1Store } from "@/store";
import { ComposedDatabase, ComposedProject, UNKNOWN_ID } from "@/types";
diff --git a/frontend/src/components/ProjectMember/ProjectMemberPanel.vue b/frontend/src/components/ProjectMember/ProjectMemberPanel.vue
index 0c4d8dcf48..ddcfb608f7 100644
--- a/frontend/src/components/ProjectMember/ProjectMemberPanel.vue
+++ b/frontend/src/components/ProjectMember/ProjectMemberPanel.vue
@@ -46,25 +46,19 @@
:show-selection-column="allowAdmin"
>
<template #selection-all="{ memberList }">
- <input
+ <NCheckbox
v-if="renderedComposedMemberList.length > 0"
- type="checkbox"
- class="h-4 w-4 text-accent rounded disabled:cursor-not-allowed border-control-border focus:ring-accent"
- v-bind="getAllSelectionState(memberList)"
- @input="
- toggleAllMembersSelection(
- memberList,
- ($event.target as HTMLInputElement).checked
- )
- "
+ :checked="getAllSelectionState(memberList).checked"
+ :indeterminate="getAllSelectionState(memberList).indeterminate"
+ @update:checked="toggleAllMembersSelection(memberList, $event)"
/>
</template>
<template #selection="{ member }">
- <input
- type="checkbox"
- class="h-4 w-4 text-accent rounded disabled:cursor-not-allowed border-control-border focus:ring-accent"
+ <NCheckbox
:checked="isMemeberSelected(member)"
- @input="(e: any) => toggleMemberSelection(member, e.target.checked)"
+ @update:checked="
+ (checked) => toggleMemberSelection(member, checked)
+ "
/>
</template>
</ProjectMemberTable>
diff --git a/frontend/src/components/RepositoryForm.vue b/frontend/src/components/RepositoryForm.vue
index 1ffaeb839a..2cad4a1c72 100644
--- a/frontend/src/components/RepositoryForm.vue
+++ b/frontend/src/components/RepositoryForm.vue
@@ -19,12 +19,11 @@
</label>
<VCSIcon :type="vcsType" />
</div>
- <input
+ <BBTextField
id="gitprovider"
name="gitprovider"
- type="text"
- class="textfield mt-1 w-full"
- disabled="true"
+ class="mt-2 w-full"
+ :disabled="true"
:value="vcsName"
/>
</div>
@@ -41,12 +40,11 @@
{{ $t("common.change") }}
</div>
</div>
- <input
+ <BBTextField
id="repository"
name="repository"
- type="text"
- class="textfield mt-1 w-full"
- disabled="true"
+ class="mt-2 w-full"
+ :disabled="true"
:value="repositoryInfo.fullPath"
/>
</div>
@@ -57,12 +55,11 @@
<div class="mt-1 textinfolabel">
{{ $t("repository.branch-observe-file-change") }}
</div>
- <input
+ <BBTextField
id="branch"
- v-model="repositoryConfig.branchFilter"
+ v-model:value="repositoryConfig.branchFilter"
name="branch"
- type="text"
- class="textfield mt-2 w-full"
+ class="mt-2 w-full"
placeholder="e.g. main"
:disabled="!allowEdit"
/>
@@ -72,12 +69,11 @@
<div class="mt-1 textinfolabel">
{{ $t("repository.base-directory-description") }}
</div>
- <input
+ <BBTextField
id="basedirectory"
- v-model="repositoryConfig.baseDirectory"
+ v-model:value="repositoryConfig.baseDirectory"
name="basedirectory"
- type="text"
- class="textfield mt-2 w-full"
+ class="mt-2 w-full"
:disabled="!allowEdit"
/>
</div>
@@ -111,12 +107,11 @@
class="ml-1"
/>
</div>
- <input
+ <BBTextField
id="filepathtemplate"
- v-model="repositoryConfig.filePathTemplate"
+ v-model:value="repositoryConfig.filePathTemplate"
name="filepathtemplate"
- type="text"
- class="textfield mt-2 w-full"
+ class="mt-2 w-full"
:disabled="!allowEdit"
/>
<div class="mt-2 textinfolabel capitalize">
@@ -200,28 +195,25 @@
:action-text="$t('subscription.instance-assignment.assign-license')"
@click="state.showInstanceAssignmentDrawer = true"
/>
- <input
+ <BBTextField
v-if="hasFeature('bb.feature.vcs-schema-write-back')"
id="schemapathtemplate"
- v-model="repositoryConfig.schemaPathTemplate"
+ v-model:value="repositoryConfig.schemaPathTemplate"
name="schemapathtemplate"
- type="text"
- class="textfield mt-2 w-full"
+ class="mt-2 w-full"
:disabled="!allowEdit"
/>
- <input
+ <BBTextField
v-else-if="isProjectSchemaChangeTypeSDL"
id="schemapathtemplate"
- v-model="repositoryConfig.schemaPathTemplate"
+ v-model:value="repositoryConfig.schemaPathTemplate"
name="schemapathtemplate"
- type="text"
- class="textfield mt-2 w-full"
+ class="mt-2 w-full"
:disabled="!allowEdit"
/>
- <input
+ <BBTextField
v-else-if="isProjectSchemaChangeTypeDDL"
- type="text"
- class="textfield mt-2 w-full"
+ class="mt-2 w-full"
:value="
subscriptionStore.getRquiredPlanString(
'bb.feature.vcs-schema-write-back'
@@ -313,7 +305,7 @@
<script lang="ts" setup>
import { NCheckbox, NSelect, SelectOption } from "naive-ui";
import { storeToRefs } from "pinia";
-import { reactive, PropType, computed, h } from "vue";
+import { reactive, computed, h } from "vue";
import { useI18n } from "vue-i18n";
import { BBBetaBadge } from "@/bbkit";
import {
@@ -348,40 +340,22 @@ defineEmits<{
(event: "change-schema-change-type", changeType: SchemaChange): void;
}>();
-const props = defineProps({
- allowEdit: {
- default: true,
- type: Boolean,
- },
- create: {
- type: Boolean,
- default: false,
- },
- vcsType: {
- required: true,
- type: Object as PropType<ExternalVersionControl_Type>,
- },
- vcsName: {
- required: true,
- type: String,
- },
- repositoryInfo: {
- required: true,
- type: Object as PropType<ExternalRepositoryInfo>,
- },
- repositoryConfig: {
- required: true,
- type: Object as PropType<RepositoryConfig>,
- },
- project: {
- required: true,
- type: Object as PropType<Project>,
- },
- schemaChangeType: {
- required: true,
- type: Object as PropType<SchemaChange>,
- },
-});
+const props = withDefaults(
+ defineProps<{
+ allowEdit?: boolean;
+ create?: boolean;
+ vcsType: ExternalVersionControl_Type;
+ vcsName: string;
+ repositoryInfo: ExternalRepositoryInfo;
+ repositoryConfig: RepositoryConfig;
+ project: Project;
+ schemaChangeType: SchemaChange;
+ }>(),
+ {
+ allowEdit: true,
+ create: false,
+ }
+);
const { t } = useI18n();
diff --git a/frontend/src/components/SQLReview/components/SQLReviewCategorySummaryFilter.vue b/frontend/src/components/SQLReview/components/SQLReviewCategorySummaryFilter.vue
index 26464553b9..5fb6aba0e1 100644
--- a/frontend/src/components/SQLReview/components/SQLReviewCategorySummaryFilter.vue
+++ b/frontend/src/components/SQLReview/components/SQLReviewCategorySummaryFilter.vue
@@ -8,13 +8,12 @@
:key="stats.engine"
class="flex items-center gap-x-1 text-sm text-gray-600"
>
- <input
+ <NCheckbox
:id="engineToJSON(stats.engine)"
- type="checkbox"
- :value="stats.engine"
:checked="isCheckedEngine(stats.engine)"
- class="h-4 w-4 border-gray-300 rounded text-indigo-600 focus:ring-indigo-500"
- @input="e => emit('toggle-checked-engine', stats.engine, (e.target as HTMLInputElement).checked)"
+ @update:checked="
+ (checked) => emit('toggle-checked-engine', stats.engine, checked)
+ "
/>
<EngineIcon
:engine="engineFromJSON(stats.engine)"
@@ -34,13 +33,12 @@
:key="stats.level"
class="flex items-center gap-x-2 text-sm text-gray-600"
>
- <input
+ <NCheckbox
:id="sQLReviewRuleLevelToJSON(stats.level)"
- type="checkbox"
- :value="stats.level"
:checked="isCheckedLevel(stats.level)"
- class="h-4 w-4 border-gray-300 rounded text-indigo-600 focus:ring-indigo-500"
- @input="e =>$emit('toggle-checked-level', stats.level, (e.target as HTMLInputElement).checked)"
+ @update:checked="
+ (checked) => $emit('toggle-checked-level', stats.level, checked)
+ "
/>
<SQLRuleLevelBadge :level="stats.level" :suffix="`(${stats.count})`" />
</label>
@@ -49,6 +47,7 @@
</template>
<script lang="ts" setup>
+import { NCheckbox } from "naive-ui";
import { computed } from "vue";
import { LEVEL_LIST, RuleTemplate } from "@/types";
import { engineFromJSON, Engine, engineToJSON } from "@/types/proto/v1/common";
diff --git a/frontend/src/components/SyncDatabaseSchema/TargetDatabasesSelectPanel.vue b/frontend/src/components/SyncDatabaseSchema/TargetDatabasesSelectPanel.vue
index 9456c3d7b7..e824640344 100644
--- a/frontend/src/components/SyncDatabaseSchema/TargetDatabasesSelectPanel.vue
+++ b/frontend/src/components/SyncDatabaseSchema/TargetDatabasesSelectPanel.vue
@@ -35,21 +35,24 @@
>
<template #header>
<label class="flex items-center gap-x-2" @click.stop="">
- <input
- type="checkbox"
- class="h-4 w-4 text-accent rounded disabled:cursor-not-allowed border-control-border focus:ring-accent ml-0.5"
- v-bind="
+ <NCheckbox
+ :checked="
getAllSelectionStateForEnvironment(
environment,
databaseListInEnvironment
- )
+ ).checked
+ "
+ :indeterminate="
+ getAllSelectionStateForEnvironment(
+ environment,
+ databaseListInEnvironment
+ ).indeterminate
"
- @click.stop=""
- @input="
+ @update:checked="
toggleAllDatabasesSelectionForEnvironment(
environment,
databaseListInEnvironment,
- ($event.target as HTMLInputElement).checked
+ $event
)
"
/>
@@ -85,11 +88,11 @@
"
>
<div class="radio text-sm flex justify-start md:flex-1">
- <input
- type="checkbox"
- class="h-4 w-4 text-accent rounded disabled:cursor-not-allowed border-control-border focus:ring-accent"
+ <NCheckbox
:checked="isDatabaseSelected(database.uid)"
- @input="(e: any) => toggleDatabaseSelected(database.uid, e.target.checked)"
+ @update:checked="
+ (checked) => toggleDatabaseSelected(database.uid, checked)
+ "
/>
<span
class="font-medium ml-2 text-main"
@@ -129,7 +132,7 @@
</template>
<script setup lang="ts">
-import { NCollapse, NCollapseItem, NButton } from "naive-ui";
+import { NCollapse, NCollapseItem, NButton, NCheckbox } from "naive-ui";
import { computed, reactive } from "vue";
import {
Drawer,
diff --git a/frontend/src/components/TransferDatabaseForm/MultipleDatabaseSelector.vue b/frontend/src/components/TransferDatabaseForm/MultipleDatabaseSelector.vue
index b4914d9436..385a559809 100644
--- a/frontend/src/components/TransferDatabaseForm/MultipleDatabaseSelector.vue
+++ b/frontend/src/components/TransferDatabaseForm/MultipleDatabaseSelector.vue
@@ -15,21 +15,24 @@
>
<template #header>
<label class="flex items-center gap-x-2" @click.stop="">
- <input
- type="checkbox"
- class="h-4 w-4 text-accent rounded disabled:cursor-not-allowed focus:ring-accent ml-0.5"
- v-bind="
+ <NCheckbox
+ :checked="
getAllSelectionStateForEnvironment(
environment,
databaseListInEnvironment
- )
+ ).checked
+ "
+ :indeterminate="
+ getAllSelectionStateForEnvironment(
+ environment,
+ databaseListInEnvironment
+ ).indeterminate
"
- @click.stop=""
- @input="
+ @update:checked="
toggleAllDatabasesSelectionForEnvironment(
environment,
databaseListInEnvironment,
- ($event.target as HTMLInputElement).checked
+ $event
)
"
/>
@@ -62,17 +65,21 @@
>
<template #item="{ item: database }: { item: ComposedDatabase }">
<div class="bb-grid-cell gap-x-2 !pl-[23px]">
- <input
- type="checkbox"
- class="h-4 w-4 text-accent rounded disabled:cursor-not-allowed focus:ring-accent"
+ <NCheckbox
:checked="
isDatabaseSelectedForEnvironment(
database.uid,
environment.uid
)
"
- @input="(e: any) => toggleDatabaseIdForEnvironment(database.uid, environment.uid, e.target.checked)"
- @click.stop=""
+ @update:checked="
+ (checked) =>
+ toggleDatabaseIdForEnvironment(
+ database.uid,
+ environment.uid,
+ checked
+ )
+ "
/>
<span
class="font-medium text-main"
@@ -101,7 +108,7 @@
</template>
<script lang="ts" setup>
-import { NCollapse, NCollapseItem } from "naive-ui";
+import { NCollapse, NCollapseItem, NCheckbox } from "naive-ui";
import { computed, reactive, watch } from "vue";
import { type BBGridColumn, BBGrid } from "@/bbkit";
import { useEnvironmentV1List } from "@/store";
diff --git a/frontend/src/components/v2/Model/Instance/InstanceV1Table/InstanceV1Table.vue b/frontend/src/components/v2/Model/Instance/InstanceV1Table/InstanceV1Table.vue
index cf5b2eaebb..b101a1930d 100644
--- a/frontend/src/components/v2/Model/Instance/InstanceV1Table/InstanceV1Table.vue
+++ b/frontend/src/components/v2/Model/Instance/InstanceV1Table/InstanceV1Table.vue
@@ -21,16 +21,10 @@
<template
v-if="index === 0 && allowSelection && instanceList.length > 0"
>
- <input
- type="checkbox"
- class="h-4 w-4 text-accent rounded disabled:cursor-not-allowed border-control-border focus:ring-accent"
+ <NCheckbox
:checked="allSelectionState.checked"
:indeterminate="allSelectionState.indeterminate"
- @input="
- selectAllInstances(
- ($event.target as HTMLInputElement).checked
- )
- "
+ @update:checked="selectAllInstances($event)"
/>
</template>
<template v-else>{{ column.title }}</template>
@@ -39,13 +33,9 @@
</template>
<template #item="{ item: instance }: InstanceRow">
<div v-if="allowSelection" class="bb-grid-cell">
- <input
- type="checkbox"
- class="h-4 w-4 text-accent rounded disabled:cursor-not-allowed border-control-border focus:ring-accent"
+ <NCheckbox
:checked="isInstanceSelected(instance)"
- @click.stop="
- toggleSelectInstance(instance, !isInstanceSelected(instance))
- "
+ @update:checked="toggleSelectInstance(instance, $event)"
/>
</div>
<div class="bb-grid-cell">
@@ -78,6 +68,7 @@
</template>
<script lang="ts" setup>
+import { NCheckbox } from "naive-ui";
import { computed, reactive } from "vue";
import { useI18n } from "vue-i18n";
import { useRouter } from "vue-router";
diff --git a/frontend/src/views/DatabaseDashboard.vue b/frontend/src/views/DatabaseDashboard.vue
index 892e67ebd4..2ab055f3f4 100644
--- a/frontend/src/views/DatabaseDashboard.vue
+++ b/frontend/src/views/DatabaseDashboard.vue
@@ -30,31 +30,18 @@
toggleDatabasesSelection([db as ComposedDatabase], !isDatabaseSelected(db))"
>
<template #selection-all="{ databaseList }">
- <input
+ <NCheckbox
v-if="databaseList.length > 0"
- type="checkbox"
- class="h-4 w-4 text-accent rounded disabled:cursor-not-allowed border-control-border focus:ring-accent"
- v-bind="getAllSelectionState(databaseList)"
- @input="
- toggleDatabasesSelection(
- databaseList,
- ($event.target as HTMLInputElement).checked
- )
- "
+ :checked="getAllSelectionState(databaseList).checked"
+ :indeterminate="getAllSelectionState(databaseList).indeterminate"
+ @update:checked="toggleDatabasesSelection(databaseList, $event)"
/>
</template>
<template #selection="{ database }">
- <input
+ <NCheckbox
v-if="isDatabase(database)"
- type="checkbox"
- class="h-4 w-4 text-accent rounded disabled:cursor-not-allowed border-control-border focus:ring-accent"
:checked="isDatabaseSelected(database as ComposedDatabase)"
- @click.stop="
- toggleDatabasesSelection(
- [database],
- ($event.target as HTMLInputElement).checked
- )
- "
+ @update:checked="toggleDatabasesSelection([database], $event)"
/>
<div v-else class="text-control-light cursor-not-allowed ml-auto">
-
@@ -73,6 +60,7 @@
</template>
<script lang="ts" setup>
+import { NCheckbox } from "naive-ui";
import { computed, watchEffect, onMounted, reactive, ref } from "vue";
import { DatabaseV1Table } from "@/components/v2";
import { isDatabase } from "@/components/v2/Model/DatabaseV1Table/utils";