mirror of
https://github.com/sky-systems/sky_phone.git
synced 2026-08-29 01:01:31 +00:00
FIX - hide fixed configurator add controls
This commit is contained in:
@@ -128,6 +128,11 @@ const canAddTableField = computed(() => {
|
||||
return false
|
||||
return !tableStructure.value?.mutableKeys || /^[a-z0-9_-]+$/.test(key)
|
||||
})
|
||||
const canExtendTable = computed(
|
||||
() =>
|
||||
!vectorType.value &&
|
||||
(!tableStructure.value || tableStructure.value.mutableKeys === true),
|
||||
)
|
||||
const tableEntries = computed(() =>
|
||||
Object.entries(tableValue.value).filter(
|
||||
([key]) => key !== '__skyType' && (!mapType.value || key !== 'entries'),
|
||||
@@ -821,7 +826,7 @@ function mapEntryStructure(
|
||||
</form>
|
||||
|
||||
<form
|
||||
v-else-if="!vectorType"
|
||||
v-else-if="canExtendTable"
|
||||
class="config-structured-editor__add-field"
|
||||
@submit.prevent="addTableField"
|
||||
>
|
||||
|
||||
@@ -277,6 +277,13 @@ describe('standalone admin panel contracts', () => {
|
||||
expect(source).toContain('<AdminConfigValueEditor')
|
||||
expect(configuratorValueEditor).toContain('function addListRow()')
|
||||
expect(configuratorValueEditor).toContain('function addTableField()')
|
||||
expect(configuratorValueEditor).toContain(
|
||||
'const canExtendTable = computed(',
|
||||
)
|
||||
expect(configuratorValueEditor).toContain(
|
||||
'tableStructure.value.mutableKeys === true',
|
||||
)
|
||||
expect(configuratorValueEditor).toContain('v-else-if="canExtendTable"')
|
||||
expect(configuratorValueEditor).toContain('function removeListRow(')
|
||||
expect(configuratorValueEditor).toContain('function removeTableField(')
|
||||
expect(configuratorValueEditor).toContain('function addMapEntry()')
|
||||
|
||||
Reference in New Issue
Block a user