Commit Graph

887 Commits

Author SHA1 Message Date
Azri Kahar
8080e87d46 Minor codestyle tweaks to datetime display & interface (#16678)
* Minor codestyle tweaks to datetime display

* tweak datetime interface

* use all instead of each
2022-12-23 11:49:18 -05:00
ian
f1a8e0446f Fix duplicated results and functions in nested filters (#14798)
* Speed query up by reusing existing aliases which reduces table joins

* Use subquery in top level m2o to remove duplicates

* Fix linting

* Apply distinct on primary key field in subqueries

* Use distinct instead as there are only primary keys

* Apply subquery on top level

* Try remove sub sub query

* Test if working for all vendors

* Add support for _none and _some

* Use subquery only when field depth > 1

* Add tests

* Use original table names for columns with functions (#14690)

* Use original table names for columns with functions

* Extract filter function path parsing as shared util

* Fix filter function path when adding node

* Pass the originalCollectionName into filter functions

* Update unit test

* Replace functions within deep GraphQL

* Fix invalid operator error for _none and _some

* Add filter function tests

* Revert triggering for all vendors

* Simplify aliasMap

* Replace functions in filter within GraphQL aggregate query

* Add API support for filtering of alias field

* Mark schema as optional

* Shift logical operators upwards

* Separate recursive parseFilter

* Rework shifting of logical operators

* Error on invalid usage of _none and _some

* Use inner join to preserve sort order

* Run tests for all vendors

* Reuse aliasMap for sort and filter

* Sort on top level query

* Remove unnecessary limit on wrapper query

* Refactor applyQuery options

* Remove duplicates from nested multi relational sort

* Fix offset in MSSQL requiring OrderBy

* Disable schema cache

* Use inner query only for nested sort or multi relational filter

* Fix MSSQL duplicate order column

* Use inner query only for multi relational

* Additional integration tests

* Order within partition for multi relational sorts

* Rename to directus_row_number

* Fix unit test

* Add base sort and filter tests

* Fix Oracle uppercased rowNumber column

* Fix unit test

* Fix top level query sort with function

* Parse functions in inner query

* Increase clarity with knex.ref()

* Remove sort filter for top level primary key

* Fix unit test

* Bypass queries with groupBy

* Add collection to aliasMap to fix functions in nested sort

* Fix multi relational sort with functions

* Add tests for filter and sort with functions

* Fix accidental deletion of brackets

* Fix top level alias filter node interface

* Update M2M sort tests

* Add M2A tests

* Cast m2a primary key as varchar2 for oracle

* Enable filtering tests for M2A

* Fix prototype polluting assignment in aliasMap

* Remove unnecessary currentKey

* Simplify code to increase readability

Co-authored-by: Brainslug <br41nslug@users.noreply.github.com>

* Fix linting and missing 'this' error

* Revert optional chaining

* Add mysql5 to tests

* Fix mysql5 missing rowNumber()

* Overcome indexing delays in MySQL5

* Verify MySQL5 sorting is in order as the result count varies between runs

* Skip joining when sorting field already exists

* Simplify variable assignment

Co-authored-by: Azri Kahar <42867097+azrikahar@users.noreply.github.com>

* Fix linting

* Reduce duplicate logic with vars

* Transform _func fields in GraphQL only for valid functions

* Fix unit test

* Fix unsupported date_part() in CrDB

Co-authored-by: Brainslug <br41nslug@users.noreply.github.com>
Co-authored-by: Roger Stringer <roger@directus.io>
Co-authored-by: Azri Kahar <42867097+azrikahar@users.noreply.github.com>
Co-authored-by: Rijk van Zanten <rijkvanzanten@me.com>
2022-12-21 11:56:18 -05:00
Brainslug
7ae8441214 fixed comma separated input for filters (#16618) 2022-12-19 10:21:20 +01:00
Azri Kahar
1c93cc661e Reduce translate function calls in the App (#16038)
* translate fields during hydration

* patch untranslated raw values on field edit

* simplify/remove existing translate usages

* minor codestyle

* translate field note and validation_message

* stub api call in fleld-detail store test

* skip fields translation before user locale sets in

* optimize hydration calls

* use translateLiteral for note & validation_message

* cherry pick field meta properties to patch

* reduce setLanguage calls & settings requests

* settings store test & type update

* tweak variable casing

* test server store & fix existing type/ref issues

* update fields store test for skipTranslation

* fix render-display merge

* await field update before opening drawer

* fetch meta at the end to load relationships first

* add loading state to prevent editing some fields

Co-authored-by: Rijk van Zanten <rijkvanzanten@me.com>
Co-authored-by: Brainslug <br41nslug@users.noreply.github.com>
2022-11-30 13:33:31 +01:00
Azri Kahar
d1483b15b4 improve v-icon performance (#16511) 2022-11-28 14:39:38 -05:00
Azri Kahar
2f5640d383 fix missing collection after sorting M2A (#16570) 2022-11-28 14:38:58 -05:00
Nicola Krumschmidt
7bf90efa62 Add support for a package extension bundle type (#15672)
* Add bundle type to constants and types

* Add support for API bundle extensions

* Rename generateExtensionsEntry to generateExtensionsEntrypoint

* Add support for App bundle extensions

* Refactor App extension registration

* Replace extensions inject with useExtensions()

* Replace getInterfaces() with useExtensions()

* Replace getDisplays() with useExtensions()

* Replace getLayouts() with useExtensions()

* Replace getModules() with useExtensions()

* Replace getPanels() with useExtensions()

* Replace getOperations() with useExtensions()

* Add useExtension() composable

* Replace useExtensions() with useExtension() where applicable

* Remove interface getters

* Remove display getters

* Remove layout getters

* Remove module getter

* Remove panel getters

* Remove operation getters

* Rename extension register.ts files to index.ts

* Perform module pre register check in parallel

* Remove Refs from AppExtensionConfigs type

* Remove old extension shims

* Ensure registration of modules is awaited when hydrating

* Add support for scaffolding package extensions

* Add support for building bundle extensions

* Add JsonValue type

* Use json for complex command line flags

* Load internal extensions if custom ones are not available

* Fix extension manifest validation for pack extensions

* Fix tests in shared

* Add SplitEntrypoint type

* Move command specific utils to helpers

* Add SDK version getter

* Move extension dev deps generation to helpers

* Move template path to getter util

* Move template copying to a helper

* Only rename copied template files

* Add directus-extension add command

* Convert provided extension source path to url

* Replace deprecated import.meta.globEager

* Mock URL.createObjectURL to make App unit tests pass

* Update rollup-plugin-typescript2

* indentation

* sort vite glob imported modules

* fix unintentional wrong commit

* Simplify app extension import logic

* reinstall @rollup/plugin-virtual

* add test for getInterfaces() expected sort order

Co-authored-by: Rijk van Zanten <rijkvanzanten@me.com>
Co-authored-by: Azri Kahar <42867097+azrikahar@users.noreply.github.com>
2022-11-16 11:28:52 -05:00
Nitwel
7248d36940 Only pass needed values when sorting (#16283)
* only pass needed values when sorting

* fix sort for files

Co-authored-by: Brainslug <br41nslug@users.noreply.github.com>
Co-authored-by: Rijk van Zanten <rijkvanzanten@me.com>
2022-11-16 10:23:40 -05:00
Nitwel
32a363b803 Reset page when changing pageSize (#16412) 2022-11-11 17:45:23 -08:00
Pascal Jufer
20a06a6c0e Clean-up lint / format set-up (#16380)
* Format json & all yaml files and update ignore files

* Fix resulting formatting issues
2022-11-09 07:26:54 -08:00
ian
12a425a90b Set readonly value during initialisation of raw editor (#16163) 2022-10-25 22:02:29 +08:00
Azri Kahar
175c7ab556 Add try/catch block to Users Module navigation and system-scope interface (#16037)
* add try/catch to users navigation

* add try/catch to system-scope interface
2022-10-18 10:34:46 -04:00
Brainslug
43578424a4 split items on paste for _in and _nin (#15701)
Co-authored-by: Rijk van Zanten <rijkvanzanten@me.com>
2022-10-17 10:40:57 +02:00
Azri Kahar
7fc4613379 use singular/plural translation in M2A interface (#15681) 2022-10-14 23:15:39 -04:00
Nitwel
64901d736c Fix scrolling on dialog (#15823)
* fix scrolling on dialog

* Update app/src/interfaces/input-rich-text-html/input-rich-text-html.vue

Co-authored-by: Rijk van Zanten <rijkvanzanten@me.com>
2022-10-15 02:36:01 +00:00
Nitwel
990b26cb78 fix non viewable items (#15824) 2022-10-14 22:27:27 -04:00
Nitwel
a0e2801501 Fix empty form info on translations (#15757)
* fix empty form info

* hide circle

* Allow setting prop icon to false in v-info

* Add inline prop to v-form to disable info icon

Co-authored-by: Rijk van Zanten <rijkvanzanten@me.com>
2022-10-14 19:18:06 -04:00
Nitwel
64f60a007a use right collection for filter (#16002) 2022-10-14 14:33:24 -04:00
Vincent Kempers
03d65e8363 Fix and improve raw value editor (#15868)
* this works in the form-field setting up for refactor

* refactored the useRaw and made form-field-raw-editor

* add defaults

* add tests for render submitting and cancelling

* add isNil

* delete the comment

* add a cancel button

* change let to const

* add the if statement when it's not a object

* delete the .raw-value and place it in the raw-editor form field

* rename submit to setRawValue

* change submit to set-raw-value

* add a possibility to add a placeholder to the system-raw-editor

* implement the system-raw-editor to the form-field-raw-editor

* update the snapshot and fix the emitted tests

* found out we can disable the gutter and line-numbers

* add a language prop to the system when it's not defined it should default to mustache

* delete style; add language and add type

* update the html in tests

* add input-code for the extended validation

* add default value

* Update form-field-raw-editor.vue language to plaintext

Co-authored-by: Rijk van Zanten <rijkvanzanten@me.com>

* update test

Co-authored-by: Vincent Kempers <vincentkempers@vincents-mbp.lan>
Co-authored-by: Rijk van Zanten <rijkvanzanten@me.com>
2022-10-14 14:17:24 -04:00
Azri Kahar
b99e8f02d4 Allow removing existing link by clearing URL (#15880) 2022-10-12 16:13:16 -04:00
Nitwel
d1b3bdee3d Add missing adjustFieldsForDisplays (#15959)
* add missing adjustFieldsForDisplays

* Fix linter warning

Co-authored-by: rijkvanzanten <rijkvanzanten@me.com>
2022-10-12 16:56:54 +00:00
Nitwel
324b549d9d fix image alt being null (#15709) 2022-09-22 23:23:48 -04:00
Jonathan Schneider
212481ff07 Add missing download and token parameter in File interface (#14871)
* add missing download and token parameter

* add download name

* update all file download links (:download and :href), update icon, add single file drawer download

* add filename_download to adjustFieldsForDisplays

* add new computed use asset url logic

* switch composable to utility function

* switch to new URL and add tests

* add getAssetUrl to file-image

* Update app/src/interfaces/files/files.vue

Co-authored-by: Nitwel <mail@nitwel.de>

* update code style error

* add download to drawer of file-image, fix wrong css selector and update preview download icon

* Remove debugging database

Co-authored-by: Rijk van Zanten <rijkvanzanten@me.com>
Co-authored-by: Brainslug <br41nslug@users.noreply.github.com>
Co-authored-by: ian <licitdev@gmail.com>
Co-authored-by: Nitwel <mail@nitwel.de>
2022-09-12 16:30:43 -04:00
GBSTR
213de3f5c6 fix divider not showing/ showing when not needed (drawer-item) (#14605)
* fix form divider when opened from drawer item

* remove redundant functions

* change back the form order to what is was

* add the option to swap between relation fields and junction fields

* fix language

* added m2m options as dropdown with more abilities

* remove the hide options and put off instead

* remove the off option from m2m junctionFieldLocation

Co-authored-by: Gabriel Shtenberg <gabriels@brainpop.com>
Co-authored-by: dev name <devn@brainpop.com>
2022-09-05 16:23:44 +02:00
Brainslug
0d56357475 Sort is set to NULL for new items (#15241)
* Fix sort field assignment in relationships

* fixed a merge error

* add sort logic to API

* using isNil for a more concise condition expression

* Removed the custom getSortMax function in favor of Math.max

* increment sort value accordingly for bulk creates

* make reordering sort start with 1 instead of 0

* account for bulk create in API side

* removed the redundant frontend sorting code

* reverted change from pr #14987

* updated selectedOnPage to support both item duplication and sorting

* Revert "account for bulk create in API side"

This reverts commit b37ed207f3.

* re-add bulk create increment sort logic

* prevent sending "+" as primary key for newly created relational items (#15353)

* re-add the removed new line as it felt odd

* ensure sql query fires once only

* fix return value

* use `.max()`

Co-authored-by: André Gaul <andre@gaul.io>
Co-authored-by: Azri Kahar <42867097+azrikahar@users.noreply.github.com>
Co-authored-by: Rijk van Zanten <rijkvanzanten@me.com>
2022-09-02 15:58:30 -04:00
Roger Stringer
07135d7250 check that collection exists and not a singleton on panels (#15355)
* check that collection exists and not a singleton on panels

* add a prop to includeSingleton
2022-09-02 15:52:08 -04:00
Nitwel
791f739b66 Reset value when no changes (#15366)
* initial fix

* change fetching

* finish fix

* clean up useRelationMultiple

* fix for m2a
2022-09-02 10:14:11 -04:00
Nitwel
5fe28db539 Add Components Package (#15094)
* move components without dependencies to packages

* make every components use vue script setup

* move components and utils from shared to @directus/components

* fix imports

* move over some more components

* get rid of unnecessary isEmpty and notEmpty

* move pagination

* fix missing !

* move groupable components

* move text-overflow and useElementSize

* fix icons not being shown

* add first unit tests

* remove capitalizeFirst

* simple cleanup

* add css-var unit test

* move over most other components

* make every component use script setup

* add some more unit tests

* add more tests and burn v-switch to the ground. 🔥

* add checkbox tests

* start with next test

* add storybook

* add more pages to storybook

* add final stories

* fix stories actions

* improve action fix

* cleaning props and adding tests

* unit tests -.-

* add some documentation to components

* Add docs to each prop

* clean storybook paths

* add more unit tests

* apply v-select fix

* update lock file

* small tweaks

* move back to shared

* fix imports

* fix imports

* cleaning

* stories to typescript

* Fix version number

Co-authored-by: Rijk van Zanten <rijkvanzanten@me.com>
2022-09-01 16:07:31 -04:00
Nitwel
f0fdd463a0 Fix drawer (#15336)
* start fixing the drawer

* debug

* fix drawer-item

* finish fixing all interfaces
2022-08-31 13:49:25 -04:00
Azri Kahar
4e1fbbf629 Fix pagination on disabled o2m and m2m fields (#15304)
* fix pagination on disabled o2m and m2m

* alternative fix and hide per-page

Co-authored-by: Rijk van Zanten <rijkvanzanten@me.com>
2022-08-30 14:55:24 -04:00
Azri Kahar
08105d0ed2 Revert list style for O2M and M2M interfaces (#15267)
* revert list style for list-o2m

* revert list style for list-m2m
2022-08-25 17:19:18 -04:00
Nitwel
f91247260a fix and clean up m2m & o2m (#15220) 2022-08-24 17:52:04 -04:00
Gerard Lamusse
ef939072cc Fix displaying values from deeper relationships in table (#15155) 2022-08-19 10:42:57 -04:00
Gerard Lamusse
9c104519f0 Initial interface of O2M & M2M Table View (#12820)
* Fix lint issues
Merge in main

* Add support for resizing columns.
Disable sorting on json columns

* Replaced static text with translations

* remove unused variables

* add no collection/fields states to system-fields

* turn columns to notice when creating list-m2m

* tweak system-fields no fields background color

* add danger styling for deselect in table layout

* add tooltips

* prevent linking to items without ID yet

* fix launch icon for list layout

* tweak padding for per page

* Update missing types

* resolve ::v-deep to :deep warning

* minor style tweaks

* fix search

* fix destructuring crashing when no permissions

* remove unused variables

Co-authored-by: Azri Kahar <42867097+azrikahar@users.noreply.github.com>
2022-08-19 03:16:20 +08:00
Lukas Schätzle
a803331b4a Unify download icon (#15132) 2022-08-17 16:44:41 -04:00
ian
122f8cfed0 Fix URL for subfolder assets (#15126)
* Prevent duplicate rootPath for image in file-preview

* Add rootPath to file and file-image for downloading

* Revert change to v-image

* Patch rootPaths accordingly

* Fix missing file name on download
2022-08-17 14:03:29 -04:00
Azri Kahar
5297c56422 Fix translations interface and use-relation-multiple empty edits (#15111)
* fix translations interface empty edits

* fix use-relation-multiple empty edits
2022-08-17 11:35:09 -04:00
Azri Kahar
608596f382 Fix margin for tree view buttons (#15117) 2022-08-17 10:14:26 -04:00
Anh Le
9c0f806ed8 Add allow duplicates option to M2A and M2M interfaces (#14987)
* Add allow duplicates option to M2A and M2M interfaces

* add allow duplicates translation

Co-authored-by: Anh Le <anh.le@hybridheroes.de>
2022-08-16 21:19:55 +08:00
Brainslug
bd55ebcc83 Workaround preventing the drawer to render with an empty collection (#14824) 2022-08-15 09:40:15 -04:00
Azri Kahar
edc431764e fix filter by folder for file and files interface (#15073) 2022-08-15 09:38:41 -04:00
Azri Kahar
50963747f1 fix map interface for non-native geometry types (#15008) 2022-08-10 10:20:09 -04:00
Ramon van Bezouw
df054f294d RTL support in translation interface (#14665)
* first draft for translations rtl implementation

* make direction field dybamic

* Fixed default direction field

* added directionality to: tags, input-multiline, repeater (list)

* added directionality for wysiwyg, input-autocomplete, groups

* reverted directionality in wysiwyg-editor

* removed hardcoded rtl, ltr buttons from wysiwyg toolbar

* working directionality in wysiwyg editor

* also add v-if to await language for second language (split-view) in translations.vue

* added watcher for changing wysiwyg directionality on language change

Co-authored-by: Rijk van Zanten <rijkvanzanten@me.com>
Co-authored-by: Martijn de Voogd <devoogd@kissthefrog.nl>
Co-authored-by: Martijn <73393707+martijn-dev@users.noreply.github.com>
Co-authored-by: Brainslug <br41nslug@users.noreply.github.com>
2022-08-09 15:23:05 +02:00
Azri Kahar
f611bfe3a8 fix checkboxes and radio buttons overflow (#14841) 2022-08-05 16:49:21 -04:00
Jonathan Schneider
479b65526c Remove disabled propertie from presentation links #14735 (#14867) 2022-08-05 14:53:13 -04:00
Gerard Lamusse
0f64c76d0d Only show search if there are more than 10 choices (#14663) 2022-08-03 17:02:58 -04:00
Gerard Lamusse
9508ed4f7a Exclude relationship fields on field validation (#14818)
* Exclude relationship fields on field validation

* Refactor to includeRelations. Also add to conditions
2022-08-03 15:20:13 -04:00
Rijk van Zanten
628dae7d2e Add configuration for "Add New"/"Select Existing" buttons in M2O interface (#14745)
Co-authored-by: Patrik Szkandera <patrik@laposa.ie>
2022-07-29 11:14:34 -04:00
Brainslug
8740f5e044 fixes interface "trim" defaults (#14709) 2022-07-28 17:41:33 -04:00
Azri Kahar
0f394d90d8 fix files interface's drawer download button (#14688) 2022-07-27 12:35:37 -04:00