Commit Graph

277 Commits

Author SHA1 Message Date
Rijk van Zanten
bc8370d084 Add item duplicate fields configuration option to directus_collections (#6140)
* Add item_duplication_fields field

* Add types for item duplicate fields
2021-06-08 17:57:28 -04:00
Rijk van Zanten
babe6cdc08 Fixed issue that would prevent usage of limit -1 on deep limit (#6054)
Fixes #5960
2021-06-03 21:47:58 -04:00
Rijk van Zanten
2270d870f9 Prevent foreign key constraint names from exceeding 64 characters (#6043)
* Add index name generator function

* Ensure foreign keys are 64 chars or less
2021-06-03 17:31:58 -04:00
Rijk van Zanten
1cdbc91593 Handle illegal/corrupt relational rows better (#6040)
Fixes #6013
2021-06-03 15:26:02 -04:00
Oreille
22f2e4662f Add support for adding a collection accent color (#5818)
* Added icon_color to directus_collections
Added migrations
Added color property to select-icon
Fixed select-icon placeholder

* Use icon color in collection header bar.

* Set `collection` and `note` fields to hald witdh

* Rename icon_color->color

Co-authored-by: rijkvanzanten <rijkvanzanten@me.com>
2021-06-03 13:04:19 -04:00
Rijk van Zanten
45730c6860 Resolve linter warnings (#6008) 2021-06-02 13:21:13 -04:00
Rijk van Zanten
77e00b7db4 Don't initialize database on file require (#6003) 2021-06-02 11:41:42 -04:00
Rijk van Zanten
02fc696c53 Fix env var validation in database loading step (#6002)
Fixes #5980
2021-06-02 11:17:50 -04:00
rijkvanzanten
c4b4e3586f Cleanup FK indexes in MySQL uses 2021-06-01 18:49:52 -04:00
rijkvanzanten
65240fff3b Make DB migrations for FK constraints safer 2021-06-01 16:44:10 -04:00
Rijk van Zanten
9335372400 Foreign Key Constraints (#5615)
* Bump knex-schema-inspector

* Fix cli role name attr

* Update relation type

* Restructure relations

* Restructure relations table

* Update api type for relation record

* Fetch relations in new structure

* Update schema-inspector

* Use new relations schema structure in api

* Update relations GETters

* Add default value to one deselect

* Add create relationship on existing field

* Add updating existing relationship

* Add delete relations

* Add relations query resolver

* Add graphql mutations for relations

* Fix reading from wrong name

* Fix wrong method name

* No idea why this flip flops every install

* Update relation type

* Accept null in use-collection composable

* Use new relations structure in translations

* Use new relations structure in new-collection

* Start updating field detail store

* Renames for new relations structure

* Silently ignore passed collection/field in relation update

* Fix setting pk field in m2o relational setup

* Small tweaks in o2m setup

* Fix m2m setup

* Tweak m2o setup

* Fix m2a setup

* Allow null for related collection (m2a)

* Fix languages code name

* Fix migration default value

* Fix relational cleanup in collections/fields

* Fix transaction problem in field delete

* Fix inserting relational o2m items

* Don't execute updateByQuery on empty item set

Fixes #5710, fixes #5070

* Show referential action input on m2o

* Finish language for m2o

* Show triggers config on o2m

* Delete items on one_deselect_item delete

* Fix naming, show relational trigger config on m2m

* Tweak language, add setup to m2a

* Fix linter warnings

* Add trigger setup for translations

* fix Edit non-schema relationship issue

* Sync existing on_delete triggers in o2m setup

* Add migration to setup foreign key constraints

* Update illegal FK values before setting constraint

* Fix MySQL unsigned vs not-unsigned in FK creation

* Use pretty names for labels in relational triggers

* Prefix auto-junction when system table

Fixes #5493

* Add system foreign key triggers

Fixes #5749

* Update docs
2021-05-19 12:29:16 -04:00
rijkvanzanten
7b6bff1692 Use correct interface for collection module nav setup 2021-05-14 16:26:45 -04:00
rijkvanzanten
1ea544b261 Fix mfa-setup interface name 2021-05-14 16:10:19 -04:00
Aiden Foxx
e8e295ef6a Fix string to text migrations for Oracle (#5462)
* Disabled string to text migrations for Oracle

* Added oracle specific alter table migrations

* Added notNull parameter to Oracle alter function

* Wrapped notNull in if

* Removed public oracle column alter function
2021-05-14 12:30:17 -04:00
Robert Gieseke
61761135ee Sort custom and internal migrations by version prefix (#5685)
See discussion #5675
2021-05-14 15:34:53 +00:00
rijkvanzanten
be20fafb8b Fix migration on MySQL 5
Fixes #5545
2021-05-07 16:36:01 -04:00
rijkvanzanten
fa86a06a7a Stringify json options 2021-05-07 11:48:36 -04:00
Rijk van Zanten
c4ae4b66cc 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
2021-05-06 16:49:32 -04:00
rijkvanzanten
74861e6f81 Add default display template for directus_files
Fixes #5364
2021-04-29 20:40:52 -04:00
rijkvanzanten
801e868554 Fix remaining eslint errors
h/t @paescuj
2021-04-29 15:55:12 -04:00
Pascal Jufer
acd41eb0be Syntax fixes (#5367)
* Declare return types on functions

And a very few other type related minor fixes

* Minor syntax fixes

* Remove unnecessary escape chars in regexes
* Remove unnecessary awaits
* Replace deprecated req.connection with req.socket
* Replace deprecated upload with uploadOne
* Remove unnecessary eslint-disable-next-line comments
* Comment empty functions / catch or finally clauses
* Fix irregular whitespaces
* Add missing returns (null)
* Remove unreachable code
* A few logical fixes
* Remove / Handle non-null assertions which are certainly unnecessary (e.g. in
tests)
2021-04-29 12:11:43 -04:00
Rijk van Zanten
84f4a1da01 Add singular/plural collection name translations (#5302)
* Add singular/plural options to collection translations

* Use singular/plural item names in related values

* Use singular / plural names on item detail

* Use singular/plural for drawer item

* Fix translation
2021-04-27 16:22:52 -04:00
rijkvanzanten
4a942067fc Make migration logs more explicit 2021-04-23 18:04:59 -04:00
Rijk van Zanten
f1e2338142 Add auth password policy / login attempts support (#5225)
* Check auth password policy on user modifications

* Show validation errors in drawer-batch

* Allow custom password policy, add placeholder

* Add UserSuspended exception

* Add user suspended error translation

* Move rate limiter creation into root helper

* Add login attempts support to authentication service

* Don't authenticate into settings service when checking password policy
2021-04-23 17:42:46 -04:00
rijkvanzanten
cb4bf88e66 Tweak relational interfaces
Squashed commit of the following:

commit ade7ce72e7dac9908504eacf420875baaae1cc47
Author: rijkvanzanten <rijkvanzanten@me.com>
Date:   Thu Apr 22 13:16:03 2021 -0400

    Add no-items notice

commit e47dd5ac1f28300a33478a2be3c50496859b09fc
Author: rijkvanzanten <rijkvanzanten@me.com>
Date:   Thu Apr 22 13:13:58 2021 -0400

    Remove files interface

commit 2925fb9c86719c48006f7b2619df7fd26bf7b523
Author: rijkvanzanten <rijkvanzanten@me.com>
Date:   Thu Apr 22 13:10:44 2021 -0400

    Fix sort field in m2m

commit 009e2b1fd99f7a31f20fba04cd9980eaa3566ac8
Author: rijkvanzanten <rijkvanzanten@me.com>
Date:   Thu Apr 22 13:06:45 2021 -0400

    Add dense at item count

commit 83b088f4da3ea4a1d7e030f34a07aa1cb2235b43
Author: rijkvanzanten <rijkvanzanten@me.com>
Date:   Thu Apr 22 12:05:40 2021 -0400

    Tweak rendering of thumbnails inside relational interfaces

commit 06770a0f16e344ab62c0228b87824a6c00ad39bc
Author: rijkvanzanten <rijkvanzanten@me.com>
Date:   Thu Apr 22 11:36:07 2021 -0400

    Rename $file->$thumbnail, render properly in render-template

commit 954fd725629ce055459a7925be4aaddf3fb723c2
Author: rijkvanzanten <rijkvanzanten@me.com>
Date:   Thu Apr 22 11:35:53 2021 -0400

    Fix injection on v-field-select

commit 83073dea2fc26af61a5155adddd5d4e3afa5cb14
Author: rijkvanzanten <rijkvanzanten@me.com>
Date:   Thu Apr 22 11:35:39 2021 -0400

    Adjust for virtual $thumbnail field on files

commit ee57b8316479204c0a5c931c86807afde55423a1
Author: rijkvanzanten <rijkvanzanten@me.com>
Date:   Thu Apr 22 10:49:35 2021 -0400

    Don't hardcode file/user relations

commit 31ed92c5a785f20b7dc58bb62f35f6e31c95cfc6
Author: rijkvanzanten <rijkvanzanten@me.com>
Date:   Thu Apr 22 10:49:22 2021 -0400

    Allow injecting temporary fields in field template

commit 9d98d4fe4def7bdba12d1613bd08bdb9bd9e1431
Author: rijkvanzanten <rijkvanzanten@me.com>
Date:   Thu Apr 22 10:36:53 2021 -0400

    Render collection level template in placeholder

commit 0e0dda1e9f5a930ce3c73c2f8003d98853d58bc0
Merge: 65fa8084f 1e3b64bf9
Author: rijkvanzanten <rijkvanzanten@me.com>
Date:   Thu Apr 22 10:35:21 2021 -0400

    Merge branch 'main' into relational-tweaks

commit 65fa8084f84aa1a90686fe6407a6d54ca47d1371
Author: rijkvanzanten <rijkvanzanten@me.com>
Date:   Thu Apr 22 10:29:03 2021 -0400

    Make input container relative

commit 0674a0a00faa5df2208b466114721ba5d5116bf7
Author: rijkvanzanten <rijkvanzanten@me.com>
Date:   Thu Apr 22 10:28:44 2021 -0400

    Add placeholder option to v-field-template
2021-04-22 13:16:20 -04:00
Rijk van Zanten
3b05372713 Finalize services API (#5170)
* Start the xOne/xMany work

* Update update/upsert

* Finish updating itemsservice

* Add comments, add nested revisions on update

* Use new internal api

* Update collectionService to one/many structure

* Move files to one/many structure

* Move permissions to one/many structure

* Move relations service to one/many structure

* Move roles to one/many structure

* Move users service over

* Move webhooks to updated structure

* Move deprecated methods to the bottom

* Replace deprecated uses

* Use new methods in controllers, add batch update/delete by query

* Use updated methods in API

* Fix email being required

* Remove unnecessary DB call

* Fix batch update/delete validation
2021-04-20 18:06:27 -04:00
Rijk van Zanten
40b9fb0fe6 Allow disabling activity/revisions (#5112)
* Add accountability column

* Add field info for accountability

* Add accountability to collection type

* Fetch accountability info from collection meta

* Add field name translation for accountability field

* Hide revisions drawer detail if revisions aren't available

* Only save activity where accountability flag matches

* Disable revisions for directus_presets

Fixes #3767

* Tweak field option naming
2021-04-16 16:26:18 -04:00
rijkvanzanten
05841c8c3b Remove filesize nullable constraint
Fixes #5075
2021-04-15 10:36:12 -04:00
rijkvanzanten
c4e1e40279 Fix @directus/schema not reading Oracle overview correctly
Fixes #4735
2021-04-09 19:28:00 -04:00
Nitwel
44091e6f41 Add option to auto refresh collections (#4777)
* add auto refresh

* add refresh_interval to DB

* remove refresh_interval template

* set refresh interval default to null

* Fix typo in filename

* Rename sidebar-auto-refresh to refresh-sidebar-detail

* Rename import

* Add badge on active refresh, change options

* Fix refresh not working on refresh

Co-authored-by: rijkvanzanten <rijkvanzanten@me.com>
2021-04-09 17:24:40 -04:00
Rijk van Zanten
dd551f3571 Add non-items system Resolvers (#4863)
* Add auth resolvers

* Add password request/reset

* Add up until file import

* Make revisions read only

* Add server resolvers

* Add utils

* Add schema resolvers for schema manipulation
2021-04-06 18:04:35 -04:00
rijkvanzanten
9859212253 Fix o2m fields missing by default 2021-04-05 16:39:30 -04:00
Rijk van Zanten
f90c31b798 GraphQL 2.0 (#4625)
* Start on GraphQL "2.0", add methodnotallowed exceptoin

* Fix relative file pointer in peer dep

* [WIP] Add pre-filtered schema to SchemaOverview

* Use root schema as is, add reduce-schema util

* Use reduceSchema in the wild

* Base schema on local reduced schema

* Remove todo

* Use graphql-compose to build out schema

* Start restructuring resolvers

* Add create mutation

* Return boolean true for empty create mutation selections

* Add update mutation

* Add delete mutation

* Add system/items scoping

* Fix merge conflicts for real now

* Use system services, rename ids->keys

* Start on docs on mutations

* Updates to match main

* Add fetch-by-id

* Add one/many resolvers for mutations

* Check system collection rows for singleton

* Fix resolver extraction for single read

* Share delete return type

* Add comments

* Use collection root name for readable type

* Add specs endpoint for GraphQL SDL

* Update docs

* Add note on SDL spec

* Fix delete single example

* Remove package-lock

* Fix collection read scoping in non-read
2021-03-30 17:06:35 -04:00
Rijk van Zanten
b562ceeb0c Add Tree-View Interface (#4602)
* Fix local type extraction

* Render basic tree in tree-view

* Render drawer-item in tree-view-group

* Retrieve nested draggable changes

* Default sort query to configured sortField

* Store nested group / sort to API

* Allow updating item values

* Figure out a dropzone approach on preview

* Finish editable tree view

* Set sort value based on sort field in relation

* Add create-new / add-existing

* Respect previously made nested edits

* Add description in setup

* Fix fetching level of o2m sort field

* Remove min height on empty root

* Remove unused types

* Add notice for invalid relationship type

* Allow recursive o2m in setup

* Styling tweak

* Revert changes in v-list

* Revert changes in groupable
2021-03-26 17:12:55 -04:00
Rijk van Zanten
c310afa846 Rely on npm Workspaces for module resolving (#4656)
* Move devDeps to API

* Move app to npm workspaces

* Tweaks / add lockfiles

* Add locks, fix devdeps across packages

* Move eslint config rootlevel

* Use eslint fix for vue files instead of vue-cli-service

* Add global prettier format option

* Create lockfiles for all packages

* Replace husky with simple-git-hooks
2021-03-24 16:01:49 -04:00
rijkvanzanten
eb941046a0 Use TEXT for webhooks collections CSV
Fixes #4506
2021-03-12 17:42:04 -05:00
rijkvanzanten
8f048a8c32 Remove unnecessary migration
Got confused by Knex no longer executing dropForeign on SQLite :C

Fixes #4470
2021-03-11 07:37:43 -05:00
Rijk van Zanten
971a18c219 Database Error Abstraction (#4465)
* Start on database-error abstraction layer

* Add SQLite error abstraction

* Enable SQLite foreign key support

* Cleanup sqlite dialect slightly

Does it matter? Not really!

* Add MySQL error abstraction

* WIP Almost done with MSSQL

* Add correct error handling for MS SQL

* Fix mysql errors by not relying on value order

* Don't rely on sql in postgres exception translation

* Fix sqlite error parsing

* Remove foreign key constraint from activity to collections

A collection can be DB-only, but we still want to track activity for non-meta collections

* Translate error on update as well
2021-03-10 17:16:15 -05:00
Rijk van Zanten
97dcdad847 OracleDB baby steps (#4464)
* Allow external connections in oracle debug

* Fix oracle overview query

* Use correct alive check for oracle

* Remove unused import

* Validate correct env vars for oracle
2021-03-10 16:58:49 -05:00
Rijk van Zanten
291643e0b4 Fix installing on MS SQL (#4455)
Fixes #3158, fixes #3608
2021-03-09 18:43:03 -05:00
Ben Haynes
a769711772 default color 2021-03-08 15:12:58 -05:00
rijkvanzanten
fa7daa1f86 Revert seeds change 2021-03-05 10:32:56 -05:00
Ben Haynes
ccf885f950 dynamic colors for system activity displays 2021-03-04 20:13:47 -05:00
Ben Haynes
275b9521f2 webhooks dynamic seed colors 2021-03-04 19:46:56 -05:00
Ben Haynes
7599e0a7aa primary color and various design updates 2021-03-04 18:50:47 -05:00
rijkvanzanten
1e89c25872 Remove "locked" field from directus_fields
Closes #3925
2021-03-04 18:41:59 -05:00
Martijn Boland
bed7890a6b Filter O2M collections with a subquery instead of joins to prevent cartesian products (#4278)
* Cherry-picked fix for 4078 from mssql-to-success branch

* Only use o2m joins in subqueries

* Allow more array nesting in query params

* Clarify naming

* Return empty nested o2m sets as array

Co-authored-by: Martijn Boland <martijn@taiga.nl>
Co-authored-by: rijkvanzanten <rijkvanzanten@me.com>
2021-03-04 16:58:13 -05:00
rijkvanzanten
31b5dbfe66 Fix validation error on preset creation with app access
Fixes #4369
2021-03-03 19:57:04 -05:00
Nicola Krumschmidt
08293b8570 Update Knex to version 0.95.0 (#4374)
* Update Knex to version 0.95.0

* Fix formatting in schema dialects

* Fix Knex imports

* Update package-lock

Co-authored-by: rijkvanzanten <rijkvanzanten@me.com>
2021-03-03 19:37:44 -05:00
reolat
24548680d5 Create allow list for custom migration file extensions (#4358) 2021-03-03 12:24:04 -05:00