From c4ae4b66ccf0c51886372d277d6c5ce481bfbfb0 Mon Sep 17 00:00:00 2001 From: Rijk van Zanten Date: Thu, 6 May 2021 16:49:32 -0400 Subject: [PATCH] Finalize interface names (#5521) * Rename button-links->presentation-links * Rename checkboxes->select-multiple-checkbox * Rename code->input-code * Rename checkboxes files * Rename color->select-color * Rename divider->presentation-divider * Rename dropdown-multiselect->select-multiple-dropdown * Rename hash->input-hash * Rename icon->select-icon * Rename image->file-image * Rename m2a-builder->list-m2a * Rename many-to-many->list-m2m * Rename many-to-one->select-dropdown-m2o * Rename markdown->input-rich-text-md * Rename notice->presentation-notice * Rename one-to-many->list-o2m * Rename radio-buttons->select-radio * Rename repeater->list * Rename text-input->input * Rename textarea->input-multiline * Rename toggle->boolean * Rename tree-view->list-o2m-tree-view * Rename wysiwyg->input-rich-text-html * Use correct interfaces in system defaults * Rename collection->system-collection * Rename collections->system-collections * Rename display-template->system-display-template * Rename field->system-field * Rename interface->system-interface * Rename interface-options->system-interface-options * Rename scope->interface-scope * Rename tfa-setup->system-mfa-setup * Fix oversights * Remove old todo * Some more tweaks * Add migration, fix dropdown name in system use * Merge numeric + input * Replace dropdown->select-dropdown in app use * Merge slug->input, user->select-dropdown-m2o * Fix type issue * Fix seeder field name --- .../migrations/20210506A-rename-interfaces.ts | 76 ++++ .../database/system-data/fields/activity.yaml | 2 +- .../system-data/fields/collections.yaml | 40 +- .../database/system-data/fields/files.yaml | 20 +- .../database/system-data/fields/folders.yaml | 3 +- .../database/system-data/fields/roles.yaml | 32 +- .../database/system-data/fields/settings.yaml | 37 +- .../database/system-data/fields/users.yaml | 28 +- .../database/system-data/fields/webhooks.yaml | 16 +- api/src/services/collections.ts | 8 +- .../v-form/form-field-interface.vue | 4 +- app/src/displays/boolean/index.ts | 12 +- app/src/displays/collection/index.ts | 2 +- app/src/displays/color/index.ts | 2 +- app/src/displays/datetime/index.ts | 4 +- .../displays/formatted-json-value/index.ts | 2 +- app/src/displays/formatted-value/index.ts | 8 +- app/src/displays/icon/index.ts | 4 +- app/src/displays/image/image.vue | 1 - app/src/displays/image/index.ts | 2 +- app/src/displays/labels/index.ts | 18 +- app/src/displays/mime-type/index.ts | 2 +- app/src/displays/rating/index.ts | 2 +- app/src/displays/related-values/options.vue | 2 +- app/src/displays/user/index.ts | 4 +- .../_system/display-template/index.ts | 26 -- .../_system/interface-options/index.ts | 13 - app/src/interfaces/_system/interface/index.ts | 13 - .../index.ts | 14 +- .../system-collection.vue} | 0 .../index.ts | 14 +- .../system-collections.vue} | 8 +- .../_system/system-display-template/index.ts | 26 ++ .../system-display-template.vue} | 4 +- .../_system/{field => system-field}/index.ts | 6 +- .../system-field.vue} | 0 .../_system/system-interface-options/index.ts | 13 + .../system-interface-options.vue} | 0 .../_system/system-interface/index.ts | 13 + .../system-interface.vue} | 2 +- .../{tfa-setup => system-mfa-setup}/index.ts | 8 +- .../system-mfa-setup.vue} | 0 .../_system/{scope => system-scope}/index.ts | 6 +- .../system-scope.vue} | 0 .../toggle.vue => boolean/boolean.vue} | 0 .../interfaces/{toggle => boolean}/index.ts | 22 +- app/src/interfaces/datetime/index.ts | 4 +- .../image.vue => file-image/file-image.vue} | 0 .../interfaces/{image => file-image}/index.ts | 10 +- app/src/interfaces/icon/index.ts | 13 - .../interfaces/{code => input-code}/index.ts | 18 +- .../code.vue => input-code/input-code.vue} | 4 +- .../interfaces/{hash => input-hash}/index.ts | 18 +- .../hash.vue => input-hash/input-hash.vue} | 0 .../{textarea => input-multiline}/index.ts | 26 +- .../input-multiline.vue} | 0 .../get-editor-styles.ts | 0 .../index.ts | 24 +- .../input-rich-text-html.vue} | 2 +- .../tinymce-overrides.css | 0 .../useImage.ts | 0 .../useLink.ts | 0 .../useMedia.ts | 0 .../useSourceCode.ts | 0 .../composables/use-edit.ts | 0 .../{markdown => input-rich-text-md}/demo.md | 0 .../{markdown => input-rich-text-md}/index.ts | 38 +- .../input-rich-text-md.vue} | 8 +- app/src/interfaces/input/index.ts | 13 + .../text-input.vue => input/input.vue} | 19 +- app/src/interfaces/input/options.vue | 234 ++++++++++++ .../{m2a-builder => list-m2a}/index.ts | 8 +- .../m2a-builder.vue => list-m2a/list-m2a.vue} | 0 .../{many-to-many => list-m2m}/index.ts | 10 +- .../list-m2m.vue} | 0 .../{many-to-many => list-m2m}/options.vue | 2 +- .../{many-to-many => list-m2m}/use-actions.ts | 0 .../{many-to-many => list-m2m}/use-edit.ts | 0 .../{many-to-many => list-m2m}/use-preview.ts | 0 .../use-relation.ts | 0 .../use-selection.ts | 0 .../{many-to-many => list-m2m}/use-sort.ts | 0 .../index.ts | 8 +- .../item-preview.vue | 0 .../list-o2m-tree-view.vue} | 2 +- .../nested-draggable.vue | 0 .../options.vue | 4 +- .../{one-to-many => list-o2m}/index.ts | 10 +- .../one-to-many.vue => list-o2m/list-o2m.vue} | 0 .../{one-to-many => list-o2m}/options.vue | 2 +- .../interfaces/{repeater => list}/index.ts | 10 +- .../{repeater/repeater.vue => list/list.vue} | 0 .../interfaces/{repeater => list}/options.vue | 22 +- app/src/interfaces/numeric/index.ts | 92 ----- app/src/interfaces/numeric/numeric.vue | 81 ---- .../index.ts | 30 +- .../presentation-divider.vue} | 0 .../index.ts | 22 +- .../presentation-links.vue} | 4 +- .../{notice => presentation-notice}/index.ts | 18 +- .../presentation-notice.vue} | 0 app/src/interfaces/readme.md | 4 +- .../{color => select-color}/index.ts | 20 +- .../select-color.vue} | 0 .../index.ts | 10 +- .../options.vue | 4 +- .../select-dropdown-m2o.vue} | 7 +- .../{dropdown => select-dropdown}/index.ts | 36 +- .../select-dropdown.vue} | 0 .../{icon => select-icon}/icons.json | 0 app/src/interfaces/select-icon/index.ts | 13 + .../icon.vue => select-icon/select-icon.vue} | 2 +- .../index.ts | 34 +- .../select-multiple-checkbox.vue} | 2 +- .../index.ts | 38 +- .../select-multiple-dropdown.vue} | 0 .../{radio-buttons => select-radio}/index.ts | 28 +- .../select-radio.vue} | 0 app/src/interfaces/slider/index.ts | 14 +- app/src/interfaces/slug/index.ts | 42 -- app/src/interfaces/slug/slug.vue | 49 --- app/src/interfaces/tags/index.ts | 18 +- app/src/interfaces/text-input/index.ts | 106 ------ app/src/interfaces/user/index.ts | 34 -- app/src/interfaces/user/user.vue | 359 ------------------ app/src/lang/translations/af-ZA.yaml | 9 +- app/src/lang/translations/ar-SA.yaml | 45 ++- app/src/lang/translations/bg-BG.yaml | 111 +++--- app/src/lang/translations/ca-ES.yaml | 24 +- app/src/lang/translations/cs-CZ.yaml | 9 +- app/src/lang/translations/da-DK.yaml | 26 +- app/src/lang/translations/de-DE.yaml | 109 +++--- app/src/lang/translations/el-GR.yaml | 10 +- app/src/lang/translations/en-US.yaml | 76 ++-- app/src/lang/translations/es-419.yaml | 101 +++-- app/src/lang/translations/es-CL.yaml | 98 +++-- app/src/lang/translations/es-ES.yaml | 101 +++-- app/src/lang/translations/et-EE.yaml | 48 +-- app/src/lang/translations/fi-FI.yaml | 101 +++-- app/src/lang/translations/fr-FR.yaml | 108 +++--- app/src/lang/translations/hu-HU.yaml | 57 +-- app/src/lang/translations/id-ID.yaml | 45 ++- app/src/lang/translations/it-IT.yaml | 73 ++-- app/src/lang/translations/ja-JP.yaml | 21 +- app/src/lang/translations/lt-LT.yaml | 81 ++-- app/src/lang/translations/ms-MY.yaml | 7 +- app/src/lang/translations/nl-NL.yaml | 97 +++-- app/src/lang/translations/no-NO.yaml | 31 +- app/src/lang/translations/pl-PL.yaml | 99 +++-- app/src/lang/translations/pt-BR.yaml | 102 +++-- app/src/lang/translations/pt-PT.yaml | 34 +- app/src/lang/translations/ro-RO.yaml | 8 +- app/src/lang/translations/ru-RU.yaml | 89 +++-- app/src/lang/translations/sr-SP.yaml | 7 +- app/src/lang/translations/sv-SE.yaml | 100 +++-- app/src/lang/translations/th-TH.yaml | 86 +++-- app/src/lang/translations/tr-TR.yaml | 54 +-- app/src/lang/translations/uk-UA.yaml | 17 +- app/src/lang/translations/vi-VN.yaml | 55 +-- app/src/lang/translations/zh-CN.yaml | 42 +- app/src/lang/translations/zh-TW.yaml | 44 +-- app/src/layouts/cards/cards.vue | 2 +- .../field-detail/components/field.vue | 4 +- .../field-detail/components/interface.vue | 16 +- .../components/relationship-m2m.vue | 2 +- .../components/relationship-m2o.vue | 2 +- .../components/relationship-o2m.vue | 4 +- .../routes/data-model/field-detail/store.ts | 4 +- .../routes/data-model/new-collection.vue | 18 +- .../modules/settings/routes/presets/item.vue | 10 +- .../permissions-detail/components/fields.vue | 2 +- .../components/permissions.vue | 2 +- .../permissions-detail/components/presets.vue | 2 +- .../components/validation.vue | 2 +- .../get-default-interface-for-type.ts | 30 +- packages/specs/src/components/field.yaml | 21 +- packages/specs/src/components/webhook.yaml | 2 +- .../src/paths/fields/collection-field.yaml | 56 ++- .../src/paths/fields/collection-fields.yaml | 48 +-- .../specs/src/paths/webhooks/webhook.yaml | 42 +- .../specs/src/paths/webhooks/webhooks.yaml | 30 +- 181 files changed, 2191 insertions(+), 2328 deletions(-) create mode 100644 api/src/database/migrations/20210506A-rename-interfaces.ts delete mode 100644 app/src/interfaces/_system/display-template/index.ts delete mode 100644 app/src/interfaces/_system/interface-options/index.ts delete mode 100644 app/src/interfaces/_system/interface/index.ts rename app/src/interfaces/_system/{collection => system-collection}/index.ts (53%) rename app/src/interfaces/_system/{collection/collection.vue => system-collection/system-collection.vue} (100%) rename app/src/interfaces/_system/{collections => system-collections}/index.ts (52%) rename app/src/interfaces/_system/{collections/collections.vue => system-collections/system-collections.vue} (87%) create mode 100644 app/src/interfaces/_system/system-display-template/index.ts rename app/src/interfaces/_system/{display-template/display-template.vue => system-display-template/system-display-template.vue} (89%) rename app/src/interfaces/_system/{field => system-field}/index.ts (61%) rename app/src/interfaces/_system/{field/field.vue => system-field/system-field.vue} (100%) create mode 100644 app/src/interfaces/_system/system-interface-options/index.ts rename app/src/interfaces/_system/{interface-options/interface-options.vue => system-interface-options/system-interface-options.vue} (100%) create mode 100644 app/src/interfaces/_system/system-interface/index.ts rename app/src/interfaces/_system/{interface/interface.vue => system-interface/system-interface.vue} (95%) rename app/src/interfaces/_system/{tfa-setup => system-mfa-setup}/index.ts (51%) rename app/src/interfaces/_system/{tfa-setup/tfa-setup.vue => system-mfa-setup/system-mfa-setup.vue} (100%) rename app/src/interfaces/_system/{scope => system-scope}/index.ts (61%) rename app/src/interfaces/_system/{scope/scope.vue => system-scope/system-scope.vue} (100%) rename app/src/interfaces/{toggle/toggle.vue => boolean/boolean.vue} (100%) rename app/src/interfaces/{toggle => boolean}/index.ts (66%) rename app/src/interfaces/{image/image.vue => file-image/file-image.vue} (100%) rename app/src/interfaces/{image => file-image}/index.ts (52%) delete mode 100644 app/src/interfaces/icon/index.ts rename app/src/interfaces/{code => input-code}/index.ts (77%) rename app/src/interfaces/{code/code.vue => input-code/input-code.vue} (98%) rename app/src/interfaces/{hash => input-hash}/index.ts (58%) rename app/src/interfaces/{hash/hash.vue => input-hash/input-hash.vue} (100%) rename app/src/interfaces/{textarea => input-multiline}/index.ts (65%) rename app/src/interfaces/{textarea/textarea.vue => input-multiline/input-multiline.vue} (100%) rename app/src/interfaces/{wysiwyg => input-rich-text-html}/get-editor-styles.ts (100%) rename app/src/interfaces/{wysiwyg => input-rich-text-html}/index.ts (89%) rename app/src/interfaces/{wysiwyg/wysiwyg.vue => input-rich-text-html/input-rich-text-html.vue} (99%) rename app/src/interfaces/{wysiwyg => input-rich-text-html}/tinymce-overrides.css (100%) rename app/src/interfaces/{wysiwyg => input-rich-text-html}/useImage.ts (100%) rename app/src/interfaces/{wysiwyg => input-rich-text-html}/useLink.ts (100%) rename app/src/interfaces/{wysiwyg => input-rich-text-html}/useMedia.ts (100%) rename app/src/interfaces/{wysiwyg => input-rich-text-html}/useSourceCode.ts (100%) rename app/src/interfaces/{markdown => input-rich-text-md}/composables/use-edit.ts (100%) rename app/src/interfaces/{markdown => input-rich-text-md}/demo.md (100%) rename app/src/interfaces/{markdown => input-rich-text-md}/index.ts (64%) rename app/src/interfaces/{markdown/markdown.vue => input-rich-text-md/input-rich-text-md.vue} (98%) create mode 100644 app/src/interfaces/input/index.ts rename app/src/interfaces/{text-input/text-input.vue => input/input.vue} (86%) create mode 100644 app/src/interfaces/input/options.vue rename app/src/interfaces/{m2a-builder => list-m2a}/index.ts (57%) rename app/src/interfaces/{m2a-builder/m2a-builder.vue => list-m2a/list-m2a.vue} (100%) rename app/src/interfaces/{many-to-many => list-m2m}/index.ts (55%) rename app/src/interfaces/{many-to-many/many-to-many.vue => list-m2m/list-m2m.vue} (100%) rename app/src/interfaces/{many-to-many => list-m2m}/options.vue (98%) rename app/src/interfaces/{many-to-many => list-m2m}/use-actions.ts (100%) rename app/src/interfaces/{many-to-many => list-m2m}/use-edit.ts (100%) rename app/src/interfaces/{many-to-many => list-m2m}/use-preview.ts (100%) rename app/src/interfaces/{many-to-many => list-m2m}/use-relation.ts (100%) rename app/src/interfaces/{many-to-many => list-m2m}/use-selection.ts (100%) rename app/src/interfaces/{many-to-many => list-m2m}/use-sort.ts (100%) rename app/src/interfaces/{tree-view => list-o2m-tree-view}/index.ts (55%) rename app/src/interfaces/{tree-view => list-o2m-tree-view}/item-preview.vue (100%) rename app/src/interfaces/{tree-view/tree-view.vue => list-o2m-tree-view/list-o2m-tree-view.vue} (99%) rename app/src/interfaces/{tree-view => list-o2m-tree-view}/nested-draggable.vue (100%) rename app/src/interfaces/{tree-view => list-o2m-tree-view}/options.vue (93%) rename app/src/interfaces/{one-to-many => list-o2m}/index.ts (55%) rename app/src/interfaces/{one-to-many/one-to-many.vue => list-o2m/list-o2m.vue} (100%) rename app/src/interfaces/{one-to-many => list-o2m}/options.vue (98%) rename app/src/interfaces/{repeater => list}/index.ts (50%) rename app/src/interfaces/{repeater/repeater.vue => list/list.vue} (100%) rename app/src/interfaces/{repeater => list}/options.vue (87%) delete mode 100644 app/src/interfaces/numeric/index.ts delete mode 100644 app/src/interfaces/numeric/numeric.vue rename app/src/interfaces/{divider => presentation-divider}/index.ts (54%) rename app/src/interfaces/{divider/divider.vue => presentation-divider/presentation-divider.vue} (100%) rename app/src/interfaces/{button-links => presentation-links}/index.ts (77%) rename app/src/interfaces/{button-links/button-links.vue => presentation-links/presentation-links.vue} (97%) rename app/src/interfaces/{notice => presentation-notice}/index.ts (67%) rename app/src/interfaces/{notice/notice.vue => presentation-notice/presentation-notice.vue} (100%) rename app/src/interfaces/{color => select-color}/index.ts (60%) rename app/src/interfaces/{color/color.vue => select-color/select-color.vue} (100%) rename app/src/interfaces/{many-to-one => select-dropdown-m2o}/index.ts (54%) rename app/src/interfaces/{many-to-one => select-dropdown-m2o}/options.vue (91%) rename app/src/interfaces/{many-to-one/many-to-one.vue => select-dropdown-m2o/select-dropdown-m2o.vue} (98%) rename app/src/interfaces/{dropdown => select-dropdown}/index.ts (61%) rename app/src/interfaces/{dropdown/dropdown.vue => select-dropdown/select-dropdown.vue} (100%) rename app/src/interfaces/{icon => select-icon}/icons.json (100%) create mode 100644 app/src/interfaces/select-icon/index.ts rename app/src/interfaces/{icon/icon.vue => select-icon/select-icon.vue} (96%) rename app/src/interfaces/{checkboxes => select-multiple-checkbox}/index.ts (65%) rename app/src/interfaces/{checkboxes/checkboxes.vue => select-multiple-checkbox/select-multiple-checkbox.vue} (98%) rename app/src/interfaces/{dropdown-multiselect => select-multiple-dropdown}/index.ts (58%) rename app/src/interfaces/{dropdown-multiselect/dropdown-multiselect.vue => select-multiple-dropdown/select-multiple-dropdown.vue} (100%) rename app/src/interfaces/{radio-buttons => select-radio}/index.ts (71%) rename app/src/interfaces/{radio-buttons/radio-buttons.vue => select-radio/select-radio.vue} (100%) delete mode 100644 app/src/interfaces/slug/index.ts delete mode 100644 app/src/interfaces/slug/slug.vue delete mode 100644 app/src/interfaces/text-input/index.ts delete mode 100644 app/src/interfaces/user/index.ts delete mode 100644 app/src/interfaces/user/user.vue diff --git a/api/src/database/migrations/20210506A-rename-interfaces.ts b/api/src/database/migrations/20210506A-rename-interfaces.ts new file mode 100644 index 0000000000..b83fe151d5 --- /dev/null +++ b/api/src/database/migrations/20210506A-rename-interfaces.ts @@ -0,0 +1,76 @@ +import { Knex } from 'knex'; + +// [before, after, after-option additions] +const changes: [string, string, Record?][] = [ + ['button-links', 'presentation-links'], + ['checkboxes', 'select-multiple-checkbox'], + ['code', 'input-code'], + ['color', 'select-color'], + ['datetime', 'datetime'], + ['divider', 'presentation-divider'], + ['dropdown', 'select-dropdown'], + ['dropdown-multiselect', 'select-multiple-dropdown'], + ['file', 'file'], + ['hash', 'input-hash'], + ['icon', 'select-icon'], + ['image', 'file-image'], + ['m2a-builder', 'list-m2a'], + ['many-to-many', 'list-m2m'], + ['many-to-one', 'select-dropdown-m2o'], + ['markdown', 'input-rich-text-md'], + ['notice', 'presentation-notice'], + ['numeric', 'input'], + ['one-to-many', 'list-o2m'], + ['radio-buttons', 'select-radio'], + ['repeater', 'list'], + ['slider', 'slider'], + ['slug', 'input', { slug: true }], + ['tags', 'tags'], + ['text-input', 'input'], + ['textarea', 'input-multiline'], + ['toggle', 'boolean'], + ['translations', 'translations'], + ['tree-view', 'list-o2m-tree-view'], + ['user', 'select-dropdown-m2o', { template: '{{avatar.$thumbnail}} {{first_name}} {{last_name}}' }], + ['wysiwyg', 'input-rich-text-html'], + + // System: + ['collection', 'system-collection'], + ['collections', 'system-collection-multiple'], + ['display-template', 'system-display-template'], + ['field', 'system-field'], + ['interface', 'system-interface'], + ['interface-options', 'system-interface-options'], + ['scope', 'system-scope'], + ['system-language', 'system-language'], + ['tfa-setup', 'system-mfa-setup'], +]; + +export async function up(knex: Knex): Promise { + for (const [before, after, options] of changes) { + // If any options need to be added, update the fields one by one in order to update the pre-existing field options + if (options) { + const fields = await knex + .select<{ id: number; options: Record }[]>('id', 'options') + .from('directus_fields') + .where({ interface: before }); + + for (const { id, options: existingOptions } of fields) { + const newOptions = { + ...(existingOptions || {}), + ...options, + }; + + await knex('directus_fields').update({ interface: after, options: newOptions }).where({ id }); + } + } else { + await knex('directus_fields').update({ interface: after }).where({ interface: before }); + } + } +} + +export async function down(knex: Knex): Promise { + for (const [before, after] of changes) { + await knex('directus_fields').update({ interface: before }).where({ interface: after }); + } +} diff --git a/api/src/database/system-data/fields/activity.yaml b/api/src/database/system-data/fields/activity.yaml index 44e6450fef..3e759a6ac5 100644 --- a/api/src/database/system-data/fields/activity.yaml +++ b/api/src/database/system-data/fields/activity.yaml @@ -66,7 +66,7 @@ fields: width: half - field: revisions - interface: one-to-many + interface: list-o2m special: o2m options: fields: diff --git a/api/src/database/system-data/fields/collections.yaml b/api/src/database/system-data/fields/collections.yaml index 637ac47a54..8c8c5a3fb9 100644 --- a/api/src/database/system-data/fields/collections.yaml +++ b/api/src/database/system-data/fields/collections.yaml @@ -5,53 +5,53 @@ fields: special: - alias - no-data - interface: divider + interface: presentation-divider options: icon: box title: Collection Setup width: full - field: collection - interface: text-input + interface: input options: font: monospace readonly: true width: half - field: icon - interface: icon + interface: select-icon options: width: half - field: note - interface: text-input + interface: input options: placeholder: A description of this collection... width: full - field: display_template - interface: display-template + interface: system-display-template options: collectionField: collection width: full - field: hidden special: boolean - interface: toggle + interface: boolean options: label: Hide within the App width: half - field: singleton special: boolean - interface: toggle + interface: boolean options: label: Treat as single object width: half - field: translations special: json - interface: repeater + interface: list options: template: '{{ translation }} ({{ language }})' fields: @@ -67,7 +67,7 @@ fields: name: Collection Name type: string meta: - interface: text-input + interface: input width: half options: placeholder: Enter a translation... @@ -75,7 +75,7 @@ fields: name: Singular Unit type: string meta: - interface: text-input + interface: input width: half options: placeholder: Enter a translation... @@ -83,7 +83,7 @@ fields: name: Plural Unit type: string meta: - interface: text-input + interface: input width: half options: placeholder: Enter a translation... @@ -93,14 +93,14 @@ fields: special: - alias - no-data - interface: divider + interface: presentation-divider options: icon: archive title: Archive width: full - field: archive_field - interface: field + interface: system-field options: collectionField: collection allowNone: true @@ -108,14 +108,14 @@ fields: width: half - field: archive_app_filter - interface: toggle + interface: boolean special: boolean options: label: Enable App Archive Filter width: half - field: archive_value - interface: text-input + interface: input options: font: monospace iconRight: archive @@ -123,7 +123,7 @@ fields: width: half - field: unarchive_value - interface: text-input + interface: input options: font: monospace iconRight: unarchive @@ -134,14 +134,14 @@ fields: special: - alias - no-data - interface: divider + interface: presentation-divider options: icon: sort title: Sort width: full - field: sort_field - interface: field + interface: system-field options: collectionField: collection placeholder: Choose a field... @@ -156,14 +156,14 @@ fields: special: - alias - no-data - interface: divider + interface: presentation-divider options: icon: admin_panel_settings title: Accountability width: full - field: accountability - interface: dropdown + interface: select-dropdown options: choices: - text: '$t:field_options.directus_collections.track_activity_revisions' diff --git a/api/src/database/system-data/fields/files.yaml b/api/src/database/system-data/fields/files.yaml index 2244ec7893..b0733daaea 100644 --- a/api/src/database/system-data/fields/files.yaml +++ b/api/src/database/system-data/fields/files.yaml @@ -3,18 +3,18 @@ table: directus_files fields: - field: id hidden: true - interface: text-input + interface: input special: uuid - field: title - interface: text-input + interface: input options: iconRight: title placeholder: A unique title... width: full - field: description - interface: textarea + interface: input-multiline width: full options: placeholder: An optional description... @@ -32,21 +32,21 @@ fields: format: false - field: location - interface: text-input + interface: input options: iconRight: place placeholder: An optional location... width: half - field: storage - interface: text-input + interface: input options: iconRight: storage width: half readonly: true - field: storage_divider - interface: divider + interface: presentation-divider options: icon: insert_drive_file title: File Naming @@ -56,7 +56,7 @@ fields: width: full - field: filename_disk - interface: text-input + interface: input options: iconRight: publish placeholder: Name on disk storage... @@ -64,7 +64,7 @@ fields: width: half - field: filename_download - interface: text-input + interface: input options: iconRight: get_app placeholder: Name when downloading... @@ -83,11 +83,13 @@ fields: readonly: true - field: modified_by - interface: user + interface: select-dropdown-m2o special: user-updated width: half display: user readonly: true + options: + template: '{{avatar.$thumbnail}} {{first_name}} {{last_name}}' - field: modified_on interface: datetime diff --git a/api/src/database/system-data/fields/folders.yaml b/api/src/database/system-data/fields/folders.yaml index 15ac834515..ae2a9806c2 100644 --- a/api/src/database/system-data/fields/folders.yaml +++ b/api/src/database/system-data/fields/folders.yaml @@ -2,7 +2,7 @@ table: directus_folders fields: - field: id - interface: text-input + interface: input special: uuid width: half @@ -11,4 +11,3 @@ fields: - field: name width: full - diff --git a/api/src/database/system-data/fields/roles.yaml b/api/src/database/system-data/fields/roles.yaml index 164efe152e..8cb3296965 100644 --- a/api/src/database/system-data/fields/roles.yaml +++ b/api/src/database/system-data/fields/roles.yaml @@ -3,33 +3,33 @@ table: directus_roles fields: - field: id hidden: true - interface: text-input + interface: input special: uuid - field: name - interface: text-input + interface: input options: placeholder: The unique name for this role... width: half - field: icon - interface: icon + interface: select-icon display: icon width: half - field: description - interface: text-input + interface: input options: placeholder: A description of this role... width: full - field: app_access - interface: toggle + interface: boolean special: boolean width: half - field: admin_access - interface: toggle + interface: boolean special: boolean width: half @@ -41,12 +41,12 @@ fields: width: full - field: enforce_tfa - interface: toggle + interface: boolean special: boolean width: half - field: users - interface: one-to-many + interface: list-o2m special: o2m options: fields: @@ -55,7 +55,7 @@ fields: width: full - field: module_list - interface: repeater + interface: list options: template: '{{ name }}' addLabel: Add New Module... @@ -64,13 +64,13 @@ fields: field: icon type: string meta: - interface: icon + interface: select-icon width: half - name: Name field: name type: string meta: - interface: text-input + interface: input width: half options: iconRight: title @@ -79,7 +79,7 @@ fields: field: link type: string meta: - interface: text-input + interface: input width: full options: iconRight: link @@ -88,7 +88,7 @@ fields: width: full - field: collection_list - interface: repeater + interface: list options: template: '{{ group_name }}' addLabel: Add New Group... @@ -98,7 +98,7 @@ fields: type: string meta: width: half - interface: text-input + interface: input options: iconRight: title placeholder: Label this group... @@ -111,7 +111,7 @@ fields: default_value: always_open meta: width: half - interface: dropdown + interface: select-dropdown options: choices: - value: always_open @@ -124,7 +124,7 @@ fields: field: collections type: JSON meta: - interface: repeater + interface: list options: addLabel: Add New Collection... template: '{{ collection }}' diff --git a/api/src/database/system-data/fields/settings.yaml b/api/src/database/system-data/fields/settings.yaml index 4613b7e99f..12f5f99944 100644 --- a/api/src/database/system-data/fields/settings.yaml +++ b/api/src/database/system-data/fields/settings.yaml @@ -5,7 +5,7 @@ fields: hidden: true - field: project_name - interface: text-input + interface: input options: iconRight: title placeholder: My project... @@ -15,7 +15,7 @@ fields: width: half - field: project_url - interface: text-input + interface: input options: iconRight: link placeholder: https://example.com @@ -25,7 +25,7 @@ fields: width: half - field: project_color - interface: color + interface: select-color note: Login & Logo Background translations: language: en-US @@ -41,7 +41,7 @@ fields: width: half - field: public_divider - interface: divider + interface: presentation-divider options: icon: public title: Public Pages @@ -65,13 +65,13 @@ fields: width: half - field: public_note - interface: textarea + interface: input-multiline options: placeholder: A short, public message that supports markdown formatting... width: full - field: security_divider - interface: divider + interface: presentation-divider options: icon: security title: Security @@ -81,7 +81,7 @@ fields: width: full - field: auth_password_policy - interface: dropdown + interface: select-dropdown options: choices: - value: null @@ -94,14 +94,14 @@ fields: width: half - field: auth_login_attempts - interface: numeric + interface: input options: iconRight: lock placeholder: $t:unlimited width: half - field: files_divider - interface: divider + interface: presentation-divider options: icon: storage title: Files & Thumbnails @@ -111,7 +111,7 @@ fields: width: full - field: storage_asset_presets - interface: repeater + interface: list options: fields: - field: key @@ -120,8 +120,9 @@ fields: schema: is_nullable: false meta: - interface: slug + interface: input options: + slug: true onlyOnCreate: false width: half - field: fit @@ -130,7 +131,7 @@ fields: schema: is_nullable: false meta: - interface: dropdown + interface: select-dropdown options: choices: - value: contain @@ -148,7 +149,7 @@ fields: schema: is_nullable: false meta: - interface: numeric + interface: input width: half - field: height name: Height @@ -156,7 +157,7 @@ fields: schema: is_nullable: false meta: - interface: numeric + interface: input width: half - field: quality type: integer @@ -176,7 +177,7 @@ fields: schema: default_value: false meta: - interface: toggle + interface: boolean width: half options: label: Don't upscale images @@ -185,7 +186,7 @@ fields: width: full - field: storage_asset_transform - interface: dropdown + interface: select-dropdown options: choices: - value: all @@ -197,7 +198,7 @@ fields: width: half - field: overrides_divider - interface: divider + interface: presentation-divider options: icon: brush title: App Overrides @@ -207,7 +208,7 @@ fields: width: full - field: custom_css - interface: code + interface: input-code options: language: css lineNumber: true diff --git a/api/src/database/system-data/fields/users.yaml b/api/src/database/system-data/fields/users.yaml index c1d15122c0..cc7be1ec9b 100644 --- a/api/src/database/system-data/fields/users.yaml +++ b/api/src/database/system-data/fields/users.yaml @@ -2,26 +2,26 @@ table: directus_users fields: - field: first_name - interface: text-input + interface: input options: iconRight: account_circle width: half - field: last_name - interface: text-input + interface: input options: iconRight: account_circle width: half - field: email - interface: text-input + interface: input options: iconRight: email width: half - field: password special: hash,conceal - interface: hash + interface: input-hash options: iconRight: lock masked: true @@ -33,19 +33,19 @@ fields: display: image - field: location - interface: text-input + interface: input options: iconRight: place width: half - field: title - interface: text-input + interface: input options: iconRight: work width: half - field: description - interface: textarea + interface: input-multiline width: full - field: tags @@ -61,7 +61,7 @@ fields: format: false - field: preferences_divider - interface: divider + interface: presentation-divider options: icon: face title: User Preferences @@ -75,7 +75,7 @@ fields: width: half - field: theme - interface: dropdown + interface: select-dropdown options: choices: - value: auto @@ -87,12 +87,12 @@ fields: width: half - field: tfa_secret - interface: tfa-setup + interface: mfa-setup special: conceal width: half - field: admin_divider - interface: divider + interface: presentation-divider options: icon: verified_user title: Admin Options @@ -103,7 +103,7 @@ fields: width: full - field: status - interface: dropdown + interface: select-dropdown options: choices: - text: Draft @@ -119,7 +119,7 @@ fields: width: half - field: role - interface: many-to-one + interface: select-dropdown-m2o options: template: '{{ name }}' special: m2o @@ -137,7 +137,7 @@ fields: - field: id special: uuid - interface: text-input + interface: input options: iconRight: vpn_key width: full diff --git a/api/src/database/system-data/fields/webhooks.yaml b/api/src/database/system-data/fields/webhooks.yaml index 99d0be0887..82ae7c3f27 100644 --- a/api/src/database/system-data/fields/webhooks.yaml +++ b/api/src/database/system-data/fields/webhooks.yaml @@ -5,13 +5,13 @@ fields: hidden: true - field: name - interface: text-input + interface: input options: iconRight: title width: full - field: method - interface: dropdown + interface: select-dropdown display: labels display_options: defaultForeground: 'var(--foreground-normal)' @@ -25,13 +25,13 @@ fields: width: half - field: url - interface: text-input + interface: input options: iconRight: link width: half - field: status - interface: dropdown + interface: select-dropdown display: labels display_options: defaultForeground: 'var(--foreground-normal)' @@ -55,7 +55,7 @@ fields: width: half - field: data - interface: toggle + interface: boolean options: label: Send Event Data special: boolean @@ -63,7 +63,7 @@ fields: display: boolean - field: triggers_divider - interface: divider + interface: presentation-divider options: icon: api title: Triggers @@ -73,7 +73,7 @@ fields: width: full - field: actions - interface: checkboxes + interface: select-multiple-checkbox options: choices: - text: Create @@ -107,7 +107,7 @@ fields: background: 'var(--purple-25)' - field: collections - interface: collections + interface: system-collections special: csv width: full display: labels diff --git a/api/src/services/collections.ts b/api/src/services/collections.ts index 86b31a8228..5cda70bbd2 100644 --- a/api/src/services/collections.ts +++ b/api/src/services/collections.ts @@ -425,11 +425,9 @@ export class CollectionsService { /** * @deprecated Use `createOne` or `createMany` instead */ - create(data: (Partial & { collection: string })[]): Promise; - create(data: Partial & { collection: string }): Promise; - async create( - data: (Partial & { collection: string }) | (Partial & { collection: string })[] - ): Promise { + create(data: RawCollection[]): Promise; + create(data: RawCollection): Promise; + async create(data: RawCollection | RawCollection[]): Promise { logger.warn( 'CollectionsService.create is deprecated and will be removed before v9.0.0. Use createOne or createMany instead.' ); diff --git a/app/src/components/v-form/form-field-interface.vue b/app/src/components/v-form/form-field-interface.vue index 26d1a83bfe..6be2a2dc55 100644 --- a/app/src/components/v-form/form-field-interface.vue +++ b/app/src/components/v-form/form-field-interface.vue @@ -80,9 +80,7 @@ export default defineComponent({ const { interfaces } = getInterfaces(); const interfaceExists = computed(() => { - return !!interfaces.value.find( - (inter: InterfaceConfig) => inter.id === props.field?.meta?.interface || 'text-input' - ); + return !!interfaces.value.find((inter: InterfaceConfig) => inter.id === props.field?.meta?.interface || 'input'); }); return { interfaceExists, getDefaultInterfaceForType }; diff --git a/app/src/displays/boolean/index.ts b/app/src/displays/boolean/index.ts index 7b2abc5dcf..621cb04f29 100644 --- a/app/src/displays/boolean/index.ts +++ b/app/src/displays/boolean/index.ts @@ -14,7 +14,7 @@ export default defineDisplay({ name: '$t:displays.boolean.label_on', type: 'string', meta: { - interface: 'text-input', + interface: 'input', width: 'half', options: { placeholder: '$t:displays.boolean.label_on_placeholder', @@ -26,7 +26,7 @@ export default defineDisplay({ name: '$t:displays.boolean.label_off', type: 'string', meta: { - interface: 'text-input', + interface: 'input', width: 'half', options: { placeholder: '$t:displays.boolean.label_off_placeholder', @@ -38,7 +38,7 @@ export default defineDisplay({ name: '$t:displays.boolean.icon_on', type: 'string', meta: { - interface: 'icon', + interface: 'select-icon', width: 'half', }, schema: { @@ -50,7 +50,7 @@ export default defineDisplay({ name: '$t:displays.boolean.icon_off', type: 'string', meta: { - interface: 'icon', + interface: 'select-icon', width: 'half', }, schema: { @@ -62,7 +62,7 @@ export default defineDisplay({ name: '$t:displays.boolean.color_on', type: 'string', meta: { - interface: 'color', + interface: 'select-color', width: 'half', }, schema: { @@ -74,7 +74,7 @@ export default defineDisplay({ name: '$t:displays.boolean.color_off', type: 'string', meta: { - interface: 'color', + interface: 'select-color', width: 'half', }, schema: { diff --git a/app/src/displays/collection/index.ts b/app/src/displays/collection/index.ts index ea0e90614b..a314a2d96e 100644 --- a/app/src/displays/collection/index.ts +++ b/app/src/displays/collection/index.ts @@ -14,7 +14,7 @@ export default defineDisplay({ name: '$t:icon', type: 'boolean', meta: { - interface: 'toggle', + interface: 'boolean', options: { label: '$t:displays.collection.icon_label', }, diff --git a/app/src/displays/color/index.ts b/app/src/displays/color/index.ts index 83c847f120..14bd3b6b38 100644 --- a/app/src/displays/color/index.ts +++ b/app/src/displays/color/index.ts @@ -14,7 +14,7 @@ export default defineDisplay({ name: '$t:displays.color.default_color', type: 'string', meta: { - interface: 'color', + interface: 'select-color', width: 'half', }, schema: { diff --git a/app/src/displays/datetime/index.ts b/app/src/displays/datetime/index.ts index 6e162503db..c13af8f460 100644 --- a/app/src/displays/datetime/index.ts +++ b/app/src/displays/datetime/index.ts @@ -13,7 +13,7 @@ export default defineDisplay({ name: '$t:displays.datetime.format', type: 'string', meta: { - interface: 'dropdown', + interface: 'select-dropdown', width: 'half', options: { choices: [ @@ -34,7 +34,7 @@ export default defineDisplay({ type: 'boolean', meta: { width: 'half', - interface: 'toggle', + interface: 'boolean', options: { label: '$t:displays.datetime.relative_label', }, diff --git a/app/src/displays/formatted-json-value/index.ts b/app/src/displays/formatted-json-value/index.ts index 31cc8488bb..248c59eeb5 100644 --- a/app/src/displays/formatted-json-value/index.ts +++ b/app/src/displays/formatted-json-value/index.ts @@ -15,7 +15,7 @@ export default defineDisplay({ type: 'string', meta: { width: 'full', - interface: 'text-input', + interface: 'input', options: { placeholder: '{{ field }}', }, diff --git a/app/src/displays/formatted-value/index.ts b/app/src/displays/formatted-value/index.ts index 6081c281d7..49c21aa5bd 100644 --- a/app/src/displays/formatted-value/index.ts +++ b/app/src/displays/formatted-value/index.ts @@ -15,7 +15,7 @@ export default defineDisplay({ type: 'boolean', meta: { width: 'half', - interface: 'toggle', + interface: 'boolean', options: { label: '$t:displays.formatted-value.format_title_label', }, @@ -30,7 +30,7 @@ export default defineDisplay({ type: 'boolean', meta: { width: 'half', - interface: 'toggle', + interface: 'boolean', options: { label: '$t:displays.formatted-value.bold_label', }, @@ -44,7 +44,7 @@ export default defineDisplay({ name: '$t:color', meta: { width: 'half', - interface: 'color', + interface: 'select-color', }, }, { @@ -52,7 +52,7 @@ export default defineDisplay({ name: '$t:font', meta: { width: 'half', - interface: 'dropdown', + interface: 'select-dropdown', options: { choices: [ { text: '$t:sans_serif', value: 'sans-serif' }, diff --git a/app/src/displays/icon/index.ts b/app/src/displays/icon/index.ts index 73ee88d70b..9abf06e30d 100644 --- a/app/src/displays/icon/index.ts +++ b/app/src/displays/icon/index.ts @@ -13,7 +13,7 @@ export default defineDisplay({ name: '$t:displays.icon.filled', type: 'boolean', meta: { - interface: 'toggle', + interface: 'boolean', width: 'half', options: { label: '$t:displays.icon.filled_label', @@ -28,7 +28,7 @@ export default defineDisplay({ name: '$t:color', type: 'string', meta: { - interface: 'color', + interface: 'select-color', width: 'half', }, }, diff --git a/app/src/displays/image/image.vue b/app/src/displays/image/image.vue index 08d4d71729..87d275e061 100644 --- a/app/src/displays/image/image.vue +++ b/app/src/displays/image/image.vue @@ -31,7 +31,6 @@ export default defineComponent({ const src = computed(() => { if (props.value === null) return null; const url = getRootPath() + `assets/${props.value.id}?key=system-small-cover`; - return addTokenToURL(url); }); diff --git a/app/src/displays/image/index.ts b/app/src/displays/image/index.ts index 38a3af5129..32c6764d46 100644 --- a/app/src/displays/image/index.ts +++ b/app/src/displays/image/index.ts @@ -15,7 +15,7 @@ export default defineDisplay({ type: 'boolean', meta: { width: 'half', - interface: 'toggle', + interface: 'boolean', options: { label: '$t:displays.image.circle_label', }, diff --git a/app/src/displays/labels/index.ts b/app/src/displays/labels/index.ts index a04442cfb6..905b88645c 100644 --- a/app/src/displays/labels/index.ts +++ b/app/src/displays/labels/index.ts @@ -14,7 +14,7 @@ export default defineDisplay({ name: '$t:displays.labels.default_foreground', type: 'string', meta: { - interface: 'color', + interface: 'select-color', width: 'half', }, schema: { @@ -26,7 +26,7 @@ export default defineDisplay({ name: '$t:displays.labels.default_background', type: 'string', meta: { - interface: 'color', + interface: 'select-color', width: 'half', }, schema: { @@ -39,7 +39,7 @@ export default defineDisplay({ type: 'boolean', meta: { width: 'half', - interface: 'toggle', + interface: 'boolean', options: { label: '$t:displays.labels.format_label', }, @@ -54,7 +54,7 @@ export default defineDisplay({ type: 'boolean', meta: { width: 'half', - interface: 'toggle', + interface: 'boolean', }, schema: { default_value: false, @@ -65,7 +65,7 @@ export default defineDisplay({ name: '$t:choices', type: 'json', meta: { - interface: 'repeater', + interface: 'list', options: { template: '{{text}}', fields: [ @@ -74,7 +74,7 @@ export default defineDisplay({ name: '$t:text', type: 'string', meta: { - interface: 'text-input', + interface: 'input', width: 'half', options: { placeholder: '$t:displays.labels.choices_text_placeholder', @@ -86,7 +86,7 @@ export default defineDisplay({ name: '$t:value', type: 'string', meta: { - interface: 'text-input', + interface: 'input', options: { font: 'monospace', placeholder: '$t:displays.labels.choices_value_placeholder', @@ -99,7 +99,7 @@ export default defineDisplay({ name: '$t:foreground_color', type: 'string', meta: { - interface: 'color', + interface: 'select-color', width: 'half', }, }, @@ -108,7 +108,7 @@ export default defineDisplay({ name: '$t:background_color', type: 'string', meta: { - interface: 'color', + interface: 'select-color', width: 'half', }, }, diff --git a/app/src/displays/mime-type/index.ts b/app/src/displays/mime-type/index.ts index 4f476a5526..45b66b3643 100644 --- a/app/src/displays/mime-type/index.ts +++ b/app/src/displays/mime-type/index.ts @@ -13,7 +13,7 @@ export default defineDisplay({ name: '$t:displays.mime-type.extension_only', type: 'boolean', meta: { - interface: 'toggle', + interface: 'boolean', options: { label: '$t:displays.mime-type.extension_only_label', }, diff --git a/app/src/displays/rating/index.ts b/app/src/displays/rating/index.ts index 11fd20da65..ebb7c83c3d 100644 --- a/app/src/displays/rating/index.ts +++ b/app/src/displays/rating/index.ts @@ -13,7 +13,7 @@ export default defineDisplay({ name: '$t:displays.rating.simple', type: 'boolean', meta: { - interface: 'toggle', + interface: 'boolean', width: 'half', options: { label: '$t:displays.rating.simple_label', diff --git a/app/src/displays/related-values/options.vue b/app/src/displays/related-values/options.vue index 8c005bfa84..095afd10b2 100644 --- a/app/src/displays/related-values/options.vue +++ b/app/src/displays/related-values/options.vue @@ -1,6 +1,6 @@ diff --git a/app/src/interfaces/input/options.vue b/app/src/interfaces/input/options.vue new file mode 100644 index 0000000000..d7183c032d --- /dev/null +++ b/app/src/interfaces/input/options.vue @@ -0,0 +1,234 @@ + + + diff --git a/app/src/interfaces/m2a-builder/index.ts b/app/src/interfaces/list-m2a/index.ts similarity index 57% rename from app/src/interfaces/m2a-builder/index.ts rename to app/src/interfaces/list-m2a/index.ts index cecb13ce99..41a6f2e107 100644 --- a/app/src/interfaces/m2a-builder/index.ts +++ b/app/src/interfaces/list-m2a/index.ts @@ -1,11 +1,11 @@ import { defineInterface } from '../define'; -import InterfaceManyToAny from './m2a-builder.vue'; +import InterfaceListM2A from './list-m2a.vue'; export default defineInterface({ - id: 'm2a-builder', - name: '$t:m2a_builder', + id: 'list-m2a', + name: '$t:list-m2a', icon: 'note_add', - component: InterfaceManyToAny, + component: InterfaceListM2A, relational: true, types: ['alias'], groups: ['m2a'], diff --git a/app/src/interfaces/m2a-builder/m2a-builder.vue b/app/src/interfaces/list-m2a/list-m2a.vue similarity index 100% rename from app/src/interfaces/m2a-builder/m2a-builder.vue rename to app/src/interfaces/list-m2a/list-m2a.vue diff --git a/app/src/interfaces/many-to-many/index.ts b/app/src/interfaces/list-m2m/index.ts similarity index 55% rename from app/src/interfaces/many-to-many/index.ts rename to app/src/interfaces/list-m2m/index.ts index d166337214..0d38c8e5f1 100644 --- a/app/src/interfaces/many-to-many/index.ts +++ b/app/src/interfaces/list-m2m/index.ts @@ -1,13 +1,13 @@ import { defineInterface } from '../define'; -import InterfaceManyToMany from './many-to-many.vue'; +import InterfaceListM2M from './list-m2m.vue'; import Options from './options.vue'; export default defineInterface({ - id: 'many-to-many', - name: '$t:interfaces.many-to-many.many-to-many', - description: '$t:interfaces.many-to-many.description', + id: 'list-m2m', + name: '$t:interfaces.list-m2m.many-to-many', + description: '$t:interfaces.list-m2m.description', icon: 'note_add', - component: InterfaceManyToMany, + component: InterfaceListM2M, relational: true, types: ['alias'], groups: ['m2m', 'files'], diff --git a/app/src/interfaces/many-to-many/many-to-many.vue b/app/src/interfaces/list-m2m/list-m2m.vue similarity index 100% rename from app/src/interfaces/many-to-many/many-to-many.vue rename to app/src/interfaces/list-m2m/list-m2m.vue diff --git a/app/src/interfaces/many-to-many/options.vue b/app/src/interfaces/list-m2m/options.vue similarity index 98% rename from app/src/interfaces/many-to-many/options.vue rename to app/src/interfaces/list-m2m/options.vue index 671ef0d922..6be3432486 100644 --- a/app/src/interfaces/many-to-many/options.vue +++ b/app/src/interfaces/list-m2m/options.vue @@ -1,6 +1,6 @@