fix: dont show master sandbox base in list

This commit is contained in:
Ramesh Mane
2026-01-22 10:31:55 +00:00
parent 0336e06d24
commit 1562b862e7
4 changed files with 15 additions and 6 deletions

View File

@@ -474,6 +474,7 @@ watch(
<NcFormBuilderInputSelectBase
:value="deepReference(field.model)"
:disabled="disabled"
:filter-option="field.filterOption"
@update:value="setFormStateWithEmit(field.model, $event)"
/>
</template>

View File

@@ -4,6 +4,7 @@ const props = withDefaults(
value: string
disabled?: boolean
dropdownMatchSelectWidth?: boolean
filterOption?: (base: NcProject) => boolean
}>(),
{
dropdownMatchSelectWidth: true,
@@ -17,11 +18,13 @@ const vModel = useVModel(props, 'value', emits)
const basesStore = useBases()
const baseOptions = computed(() => {
return basesStore.basesList.map((base) => ({
label: base.title,
value: base.id,
meta: base.meta,
}))
return basesStore.basesList
.filter((base) => !props.filterOption || props.filterOption(base))
.map((base) => ({
label: base.title,
value: base.id,
meta: base.meta,
}))
})
</script>
@@ -31,10 +34,11 @@ const baseOptions = computed(() => {
:disabled="disabled"
:show-search="baseOptions.length > 4"
allow-clear
:filter-option="(input, option) => antSelectFilterOption(input, option, ['data-label'])"
placeholder="- Select base -"
:dropdown-match-select-width="dropdownMatchSelectWidth"
>
<a-select-option v-for="option of baseOptions" :key="option.value" :value="option.value">
<a-select-option v-for="option of baseOptions" :key="option.value" :value="option.value" :data-label="option.label">
<div class="w-full flex gap-2 items-center" :data-testid="option.value">
<div class="min-w-5 flex items-center justify-center">
<GeneralProjectIcon :color="parseProp(option.meta).iconColor" size="small" />

View File

@@ -149,6 +149,7 @@ const { formState, isLoading, submit } = useProvideFormBuilderHelper({
equal: 'existing',
},
defaultValue: undefined,
filterOption: (base) => base && !base?.sandbox_master,
},
{
type: FormBuilderInputType.Input,

View File

@@ -1,3 +1,5 @@
import { BaseType } from "../Api";
export enum FormBuilderInputType {
Input = 'input',
Textarea = 'textarea',
@@ -266,6 +268,7 @@ export interface FormBuilderSelectIntegrationElement
export interface FormBuilderSelectBaseElement extends FormBuilderElementBase {
type: FormBuilderInputType.SelectBase;
defaultValue?: string | null;
filterOption?: (base: BaseType) => boolean;
}
/**