diff --git a/api/src/database/migrations/20210910A-move-module-setup.ts b/api/src/database/migrations/20210910A-move-module-setup.ts new file mode 100644 index 0000000000..774430cbcc --- /dev/null +++ b/api/src/database/migrations/20210910A-move-module-setup.ts @@ -0,0 +1,55 @@ +import { Knex } from 'knex'; + +export async function up(knex: Knex): Promise { + await knex.schema.alterTable('directus_roles', (table) => { + table.dropColumn('module_list'); + }); + + await knex.schema.alterTable('directus_settings', (table) => { + table.json('module_bar').defaultTo( + JSON.stringify([ + { + type: 'module', + id: 'collections', + enabled: true, + }, + { + type: 'module', + id: 'users', + enabled: true, + }, + { + type: 'module', + id: 'files', + enabled: true, + }, + { + type: 'module', + id: 'insights', + enabled: false, + }, + { + type: 'module', + id: 'docs', + enabled: true, + }, + { + type: 'module', + id: 'settings', + enabled: true, + locked: true, + }, + ]) + ); + }); +} + +export async function down(knex: Knex): Promise { + await knex.schema.alterTable('directus_roles', (table) => { + table.json('module_list'); + }); + + await knex.schema.alterTable('directus_settings', (table) => { + table.dropColumn('module_bar'); + }); +} diff --git a/api/src/database/system-data/fields/roles.yaml b/api/src/database/system-data/fields/roles.yaml index 85880b0956..bb820c8be6 100644 --- a/api/src/database/system-data/fields/roles.yaml +++ b/api/src/database/system-data/fields/roles.yaml @@ -54,39 +54,6 @@ fields: - last_name width: full - - field: module_list - interface: list - options: - template: '{{ name }}' - addLabel: Add New Module... - fields: - - name: $t:field_options.directus_roles.fields.icon_name - field: icon - type: string - meta: - interface: select-icon - width: half - - name: $t:field_options.directus_roles.fields.name_name - field: name - type: string - meta: - interface: input - width: half - options: - iconRight: title - placeholder: - - name: $t:field_options.directus_roles.fields.link_name - field: link - type: string - meta: - interface: input - width: full - options: - iconRight: link - placeholder: $t:field_options.directus_roles.fields.link_placeholder - special: json - width: full - - field: collection_list interface: list options: diff --git a/api/src/database/system-data/fields/settings.yaml b/api/src/database/system-data/fields/settings.yaml index 442cf0df05..88b2cdd7a5 100644 --- a/api/src/database/system-data/fields/settings.yaml +++ b/api/src/database/system-data/fields/settings.yaml @@ -332,3 +332,7 @@ fields: type: _neq: 'raster' hidden: true + + - field: module_bar + interface: system-modules + special: json diff --git a/app/src/components/v-list/v-list-item.vue b/app/src/components/v-list/v-list-item.vue index 8908c4cc89..dcdbf90996 100644 --- a/app/src/components/v-list/v-list-item.vue +++ b/app/src/components/v-list/v-list-item.vue @@ -138,6 +138,8 @@ body { --v-list-item-min-height: 32px; --v-list-item-max-height: auto; --v-list-item-border-radius: var(--border-radius); + --v-list-item-border-color: var(--border-subdued); + --v-list-item-border-color-hover: var(--border-normal); --v-list-item-color: var(--v-list-color, var(--foreground-normal)); --v-list-item-color-hover: var(--v-list-color-hover, var(--foreground-normal)); --v-list-item-color-active: var(--v-list-color-active, var(--foreground-normal)); @@ -223,26 +225,27 @@ body { } &.block { + --v-list-item-border-color: var(--border-subdued); + --v-list-item-background-color: var(--background-subdued); + --v-list-item-background-color-hover: var(--background-subdued); + --v-icon-color: var(--foreground-subdued); + position: relative; display: flex; height: var(--input-height); margin: 0; padding: 8px; - background-color: var(--background-subdued); - border: var(--border-width) solid var(--border-subdued); + background-color: var(--v-list-item-background-color); + border: var(--border-width) solid var(--v-list-item-border-color); border-radius: var(--border-radius); transition: border-color var(--fast) var(--transition); - :slotted(.v-icon) { - color: var(--foreground-subdued); - - &:hover { - color: var(--foreground-normal); - } - } - :slotted(.drag-handle) { cursor: grab; + + &:hover { + color: var(--foreground-color); + } } :slotted(.drag-handle:active) { @@ -254,8 +257,8 @@ body { } &:hover { - background-color: var(--background-subdued); - border: var(--border-width) solid var(--border-normal); + background-color: var(--v-list-item-background-color-hover); + border: var(--border-width) solid var(--v-list-item-border-color-hover); } &.sortable-chosen { diff --git a/app/src/interfaces/_system/system-modules/index.ts b/app/src/interfaces/_system/system-modules/index.ts new file mode 100644 index 0000000000..e0f9904bb3 --- /dev/null +++ b/app/src/interfaces/_system/system-modules/index.ts @@ -0,0 +1,12 @@ +import { defineInterface } from '@directus/shared/utils'; +import InterfaceSystemModules from './system-modules.vue'; + +export default defineInterface({ + id: 'system-modules', + name: '$t:module_bar', + icon: 'arrow_drop_down_circle', + component: InterfaceSystemModules, + types: ['json'], + options: [], + system: true, +}); diff --git a/app/src/interfaces/_system/system-modules/system-modules.vue b/app/src/interfaces/_system/system-modules/system-modules.vue new file mode 100644 index 0000000000..04dbb97801 --- /dev/null +++ b/app/src/interfaces/_system/system-modules/system-modules.vue @@ -0,0 +1,307 @@ + + + + + diff --git a/app/src/lang/translations/en-US.yaml b/app/src/lang/translations/en-US.yaml index 07c0ffb751..20125929b3 100644 --- a/app/src/lang/translations/en-US.yaml +++ b/app/src/lang/translations/en-US.yaml @@ -23,10 +23,13 @@ published: Published draft: Draft archived: Archived +module_bar: Module Bar +tile_size: Tile Size edit_field: Edit Field conditions: Conditions maps: Maps item_revision: Item Revision +enter_a_name: Enter a Name... duplicate_field: Duplicate Field half_width: Half Width full_width: Full Width @@ -57,6 +60,7 @@ create_user: Create User create_webhook: Create Webhook invite_users: Invite Users email_examples: "admin{'@'}example.com, user{'@'}example.com..." +url_example: "https://example.com" invite: Invite email_already_invited: Email "{email}" has already been invited emails: Emails @@ -220,6 +224,8 @@ add_m2m_to_collection: 'Add Many-to-Many to "{collection}"' choose_a_type: Choose a Type... determined_by_relationship: Determined by Relationship add_note: Add a helpful note for users... +add_link: Add Link +custom_link: Custom Link default_value: Default Value standard_field: Standard Field single_file: Single File diff --git a/app/src/stores/settings.ts b/app/src/stores/settings.ts index 6f467d1c40..ad05ada36c 100644 --- a/app/src/stores/settings.ts +++ b/app/src/stores/settings.ts @@ -4,11 +4,12 @@ import { notify } from '@/utils/notify'; import { unexpectedError } from '@/utils/unexpected-error'; import { merge } from 'lodash'; import { defineStore } from 'pinia'; +import { Settings } from '@directus/shared/types'; export const useSettingsStore = defineStore({ id: 'settingsStore', state: () => ({ - settings: null as null | Record, + settings: null as null | Settings, }), actions: { async hydrate() { diff --git a/app/src/styles/_variables.scss b/app/src/styles/_variables.scss index 7d5bf464fe..4fb49f0f38 100644 --- a/app/src/styles/_variables.scss +++ b/app/src/styles/_variables.scss @@ -1,5 +1,5 @@ :root { - --brand: var(--primary); // will be overriden with directus_settings.project_color + --brand: var(--primary); // will be overridden with directus_settings.project_color --white: #fff; --black: #090c0d; --transition: cubic-bezier(0.4, 0, 0.2, 1); diff --git a/app/src/views/private/components/module-bar.vue b/app/src/views/private/components/module-bar.vue new file mode 100644 index 0000000000..f6401ba9d2 --- /dev/null +++ b/app/src/views/private/components/module-bar.vue @@ -0,0 +1,109 @@ + + + + + + + diff --git a/app/src/views/private/components/module-bar/index.ts b/app/src/views/private/components/module-bar/index.ts deleted file mode 100644 index 32b98805b4..0000000000 --- a/app/src/views/private/components/module-bar/index.ts +++ /dev/null @@ -1,4 +0,0 @@ -import ModuleBar from './module-bar.vue'; - -export { ModuleBar }; -export default ModuleBar; diff --git a/app/src/views/private/components/module-bar/module-bar.vue b/app/src/views/private/components/module-bar/module-bar.vue deleted file mode 100644 index 5bd856bc3f..0000000000 --- a/app/src/views/private/components/module-bar/module-bar.vue +++ /dev/null @@ -1,125 +0,0 @@ - - - - - - - diff --git a/app/src/views/private/components/module-bar/readme.md b/app/src/views/private/components/module-bar/readme.md deleted file mode 100644 index 2e9272f6e1..0000000000 --- a/app/src/views/private/components/module-bar/readme.md +++ /dev/null @@ -1,25 +0,0 @@ -# Module bar - -The left most sidebar that holds the module navigation. - -## Usage - -```html - -``` - -## Props - -n/a - -## Slots - -n/a - -## Events - -n/a - -## CSS Variables - -n/a diff --git a/app/src/views/private/private-view.vue b/app/src/views/private/private-view.vue index da3b25192e..00c8fcba42 100644 --- a/app/src/views/private/private-view.vue +++ b/app/src/views/private/private-view.vue @@ -64,7 +64,7 @@