feat(structure): remove dynamic yes/no labels from editor checkboxes
This commit is contained in:
1 parent
0fce8f445f
commit
7e324bdd01
2 files changed
+44
-23
No files matched your search
@@ -5669,7 +5669,7 @@ watch(
|
|||||||
<th
|
<th
|
||||||
v-for="(columnLabel, i) in colLabels"
|
v-for="(columnLabel, i) in colLabels"
|
||||||
:key="columnLabel.key"
|
:key="columnLabel.key"
|
||||||
:class="[structureHeaderCellClass, 'bg-background select-none', { 'text-center': columnLabel.key === 'primaryKey' }]"
|
:class="[structureHeaderCellClass, 'bg-background select-none', { 'text-center': columnLabel.key === 'primaryKey' || columnLabel.key === 'nullable' }]"
|
||||||
:data-column-selected="columnLabel.key === 'actions' ? undefined : selectedStructureColumnKeys.has(columnLabel.key)"
|
:data-column-selected="columnLabel.key === 'actions' ? undefined : selectedStructureColumnKeys.has(columnLabel.key)"
|
||||||
:style="{
|
:style="{
|
||||||
width: visibleColWidths[i] + 'px',
|
width: visibleColWidths[i] + 'px',
|
||||||
@@ -5881,11 +5881,8 @@ watch(
|
|||||||
</Select>
|
</Select>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td v-if="columnEditorControls.nullable" :class="[structureCellClass, structureColumnSelectionClass('nullable')]">
|
<td v-if="columnEditorControls.nullable" :class="[structureCellClass, 'text-center', structureColumnSelectionClass('nullable')]">
|
||||||
<label class="flex items-center gap-1.5">
|
<input v-model="column.isNullable" type="checkbox" :class="structureCheckboxClass" :disabled="isColumnNullableDisabled(column)" :aria-label="t('structureEditor.nullable')" />
|
||||||
<input v-model="column.isNullable" type="checkbox" :class="structureCheckboxClass" :disabled="isColumnNullableDisabled(column)" />
|
|
||||||
<span>{{ column.isNullable ? t("structureEditor.yes") : t("structureEditor.no") }}</span>
|
|
||||||
</label>
|
|
||||||
</td>
|
</td>
|
||||||
<td v-if="columnEditorControls.primaryKey" :class="[structureCellClass, 'text-center', structureColumnSelectionClass('primaryKey')]">
|
<td v-if="columnEditorControls.primaryKey" :class="[structureCellClass, 'text-center', structureColumnSelectionClass('primaryKey')]">
|
||||||
<input
|
<input
|
||||||
@@ -5893,6 +5890,7 @@ watch(
|
|||||||
type="checkbox"
|
type="checkbox"
|
||||||
:class="structureCheckboxClass"
|
:class="structureCheckboxClass"
|
||||||
:disabled="isPrimaryKeyDisabled(column)"
|
:disabled="isPrimaryKeyDisabled(column)"
|
||||||
|
:aria-label="t('structureEditor.primaryKey')"
|
||||||
@change="
|
@change="
|
||||||
() => {
|
() => {
|
||||||
if (column.isPrimaryKey) column.isNullable = false;
|
if (column.isPrimaryKey) column.isNullable = false;
|
||||||
@@ -6183,7 +6181,7 @@ watch(
|
|||||||
<th
|
<th
|
||||||
v-for="(label, i) in indexColLabels"
|
v-for="(label, i) in indexColLabels"
|
||||||
:key="i"
|
:key="i"
|
||||||
:class="structureHeaderCellClass"
|
:class="[structureHeaderCellClass, { 'text-center': i === 2 || i === 7 }]"
|
||||||
:style="{
|
:style="{
|
||||||
width: indexColWidths[i] + 'px',
|
width: indexColWidths[i] + 'px',
|
||||||
minWidth: indexColWidths[i] + 'px',
|
minWidth: indexColWidths[i] + 'px',
|
||||||
@@ -6231,18 +6229,16 @@ watch(
|
|||||||
</StructureIndexColumnPicker>
|
</StructureIndexColumnPicker>
|
||||||
<span v-else class="font-mono text-[length:var(--structure-font-size)] text-muted-foreground">{{ toColumnNames(index.columns) }}</span>
|
<span v-else class="font-mono text-[length:var(--structure-font-size)] text-muted-foreground">{{ toColumnNames(index.columns) }}</span>
|
||||||
</td>
|
</td>
|
||||||
<td :class="structureCellClass">
|
<td :class="[structureCellClass, 'text-center']">
|
||||||
<label class="flex items-center gap-1.5">
|
<input
|
||||||
<input
|
:checked="index.isUnique"
|
||||||
:checked="index.isUnique"
|
type="checkbox"
|
||||||
type="checkbox"
|
:class="structureCheckboxClass"
|
||||||
:class="structureCheckboxClass"
|
:disabled="!canEditIndexDraft(index) || !!indexColumnsIssue(index, index.columns, index.indexType, true)"
|
||||||
:disabled="!canEditIndexDraft(index) || !!indexColumnsIssue(index, index.columns, index.indexType, true)"
|
data-index-unique
|
||||||
data-index-unique
|
:aria-label="t('structureEditor.unique')"
|
||||||
@change="onIndexUniqueChange(index, ($event.target as HTMLInputElement).checked)"
|
@change="onIndexUniqueChange(index, ($event.target as HTMLInputElement).checked)"
|
||||||
/>
|
/>
|
||||||
<span>{{ index.isUnique ? t("structureEditor.yes") : t("structureEditor.no") }}</span>
|
|
||||||
</label>
|
|
||||||
</td>
|
</td>
|
||||||
<td :class="structureCellClass">
|
<td :class="structureCellClass">
|
||||||
<Select v-if="indexTypeOptions.length > 0" :model-value="index.indexType || 'BTREE'" :disabled="!canEditIndexDraft(index)" data-index-type @update:model-value="(value: unknown) => onIndexTypeChange(index, value)">
|
<Select v-if="indexTypeOptions.length > 0" :model-value="index.indexType || 'BTREE'" :disabled="!canEditIndexDraft(index)" data-index-type @update:model-value="(value: unknown) => onIndexTypeChange(index, value)">
|
||||||
@@ -6276,10 +6272,9 @@ watch(
|
|||||||
<td :class="structureCellClass">
|
<td :class="structureCellClass">
|
||||||
<Input v-model="index.comment" :class="[structureControlClass, indexSearchFieldClass(index, index.comment)]" :disabled="!canEditIndexComment(index)" />
|
<Input v-model="index.comment" :class="[structureControlClass, indexSearchFieldClass(index, index.comment)]" :disabled="!canEditIndexComment(index)" />
|
||||||
</td>
|
</td>
|
||||||
<td :class="structureCellClass">
|
<td :class="[structureCellClass, 'text-center']">
|
||||||
<label v-if="structureCapabilities.indexConcurrent" class="flex items-center gap-1.5" :title="concurrentIndexCellTitle(index)">
|
<label v-if="structureCapabilities.indexConcurrent" class="inline-flex items-center justify-center" :title="concurrentIndexCellTitle(index)">
|
||||||
<input v-model="index.concurrently" type="checkbox" :class="structureCheckboxClass" :disabled="!canEditIndexConcurrent(index)" />
|
<input v-model="index.concurrently" type="checkbox" :class="structureCheckboxClass" :disabled="!canEditIndexConcurrent(index)" :aria-label="t('structureEditor.concurrent')" />
|
||||||
<span>{{ index.concurrently ? t("structureEditor.yes") : t("structureEditor.no") }}</span>
|
|
||||||
</label>
|
</label>
|
||||||
<span v-else class="text-[length:var(--structure-font-size)] text-muted-foreground">—</span>
|
<span v-else class="text-[length:var(--structure-font-size)] text-muted-foreground">—</span>
|
||||||
</td>
|
</td>
|
||||||
|
|||||||
Vendored
+26
@@ -745,6 +745,32 @@ describe("TableStructureEditor column index actions", () => {
|
|||||||
await vi.waitFor(() => expect(root.textContent).toContain("structureEditor.spatialIndexNullable"));
|
await vi.waitFor(() => expect(root.textContent).toContain("structureEditor.spatialIndexNullable"));
|
||||||
expect(mocks.executeBatch).not.toHaveBeenCalled();
|
expect(mocks.executeBatch).not.toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("renders checkboxes without dynamic yes/no toggle text (#8148)", async () => {
|
||||||
|
loadMetadata();
|
||||||
|
const root = await mountStructureEditor();
|
||||||
|
await openSubmenu(fieldRow(root, "email"), "structureEditor.createColumnIndex");
|
||||||
|
menuButton("structureEditor.createNormalIndex").click();
|
||||||
|
await expectIndexName(root, "idx_email");
|
||||||
|
|
||||||
|
const unique = indexRow(root).querySelector<HTMLInputElement>("[data-index-unique]")!;
|
||||||
|
const uniqueCell = unique.closest("td")!;
|
||||||
|
expect(uniqueCell.textContent?.trim()).toBe("");
|
||||||
|
|
||||||
|
unique.checked = true;
|
||||||
|
unique.dispatchEvent(new Event("change"));
|
||||||
|
await settle();
|
||||||
|
expect(uniqueCell.textContent?.trim()).toBe("");
|
||||||
|
|
||||||
|
const nullable = fieldRow(root, "location").querySelector<HTMLInputElement>('input[aria-label="structureEditor.nullable"]')!;
|
||||||
|
const nullableCell = nullable.closest("td")!;
|
||||||
|
expect(nullableCell.textContent?.trim()).toBe("");
|
||||||
|
|
||||||
|
nullable.checked = true;
|
||||||
|
nullable.dispatchEvent(new Event("change"));
|
||||||
|
await settle();
|
||||||
|
expect(nullableCell.textContent?.trim()).toBe("");
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
|
|||||||
Reference in new issue
Block a user