Closes #14591: Saved table configurations (#19101)

* Add SavedTableConfig

* Update table configuration logic to support TableConfigs

* Update table config link when updating table

* Correct docstring

* Misc cleanup

* Use multi-select widgets for column selection

* Return null config params for tables with no model

* Fix auto-selection of selected columns

* Update migration

* Clean up template

* Enforce enabled/shared flags

* Search/filter by table name

* Misc cleanup

* Fix population of selected columns

* Ordering field should not be required

* Enable cloning for TableConfig

* Misc cleanup

* Add model documentation for TableConfig

* Drop slug field from TableConfig

* Improve TableConfig validation

* Remove add button from TableConfig list view

* Fix ordering validation to account for leading hyphens
This commit is contained in:
Jeremy Stretch
2025-04-10 16:48:02 -04:00
committed by GitHub
parent f8f2ad1d14
commit bb5057c063
32 changed files with 856 additions and 102 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -1,6 +1,12 @@
import { getElements, scrollTo } from '../util';
function handleFormSubmit(event: Event, form: HTMLFormElement): void {
// Automatically select all options in any <select> with the "select-all" class. This is useful for
// multi-select fields that are used to add/remove choices.
for (const element of getElements<HTMLOptionElement>('select.select-all option')) {
element.selected = true;
}
// Track the names of each invalid field.
const invalids = new Set<string>();

View File

@@ -1,16 +1,6 @@
import { createToast } from './bs';
import { getElements, apiPatch, hasError, getSelectedOptions } from './util';
/**
* Mark each option element in the selected columns element as 'selected' so they are submitted to
* the API.
*/
function saveTableConfig(): void {
for (const element of getElements<HTMLOptionElement>('select[name="columns"] option')) {
element.selected = true;
}
}
/**
* Add columns to the table config select element.
*/
@@ -124,9 +114,6 @@ function handleSubmit(event: Event): void {
* Initialize table configuration elements.
*/
export function initTableConfig(): void {
for (const element of getElements<HTMLButtonElement>('#save_tableconfig')) {
element.addEventListener('click', saveTableConfig);
}
for (const element of getElements<HTMLButtonElement>('#add_columns')) {
element.addEventListener('click', addColumns);
}