Commit Graph

636 Commits

Author SHA1 Message Date
Rijk van Zanten
44b4863788 Require curly brackets in if statements when they're multi-line (#18387)
* Enable Curly rule

* Fix curly misuse
2023-05-02 16:02:43 -04:00
Brainslug
87f2edc735 Prevent nested ternary expressions (#18376)
Co-authored-by: Pascal Jufer <pascal-jufer@bluewin.ch>
2023-05-01 19:07:40 +00:00
Nitwel
871e7eb954 Improve Permissions in relational Interfaces (#16373)
* improve permissions check in m2m relations

* improve m2o relations

* More improvements

* finish relational permission rework

* fix field level permissions

* add tests to useRelationPermissions

* remove unused dependency

* fix rename

* fix permissions for translations

* fix disabled check

* ran linter and disabled "vue/one-component-per-file" for use-relation-permissions test

---------

Co-authored-by: Azri Kahar <42867097+azrikahar@users.noreply.github.com>
Co-authored-by: Pascal Jufer <pascal-jufer@bluewin.ch>
Co-authored-by: rijkvanzanten <rijkvanzanten@me.com>
Co-authored-by: Brainslug <br41nslug@users.noreply.github.com>
Co-authored-by: Brainslug <tim@brainslug.nl>
2023-04-24 16:33:28 +02:00
Hannes Küttner
7bf87f3df3 Fix a few dev mode warnings (#18249)
* `list-m2m` make layout optional

* Silence a few more warnings

* Properly type v-button `to`

* Make search prop in field-detail-simple not required

* Set undefined as default value for text in v-text-overflow

* Change initial search value to undefined in field-detail

* Rework field-detail and field-detail-simple to use script setup

* One less ctrl+z

* Remove unnecessary new line

---------

Co-authored-by: Rijk van Zanten <rijkvanzanten@me.com>
2023-04-19 17:13:20 +00:00
Azri Kahar
678c5f57af Use filled star for required asterisks & rating display (#18242) 2023-04-19 08:56:35 +02:00
Rijk van Zanten
c48309ab68 Last eslint tweak (#18198)
* Should be there now

* Format
2023-04-14 17:40:50 -04:00
rijkvanzanten
37658802b7 One more 2023-04-14 17:30:56 -04:00
Rijk van Zanten
bdb1a919e2 White space rules (#18197)
* White space rules

* Auto-fix whitespace linter warnings
2023-04-14 17:21:56 -04:00
Jan Arends
0e44ee5239 Add select all option for export (#18160)
* added select all option

* added default value

* removed space for linter

* refactoring: combined emits

* removed unnecessary prefix

* added option to remove all at once

* linter

* Drop support for deselect

* I HAVE OPINIONS

* Revert addition of remove event

* Some more opinions

* Refactor other uses of v-field-list

---------

Co-authored-by: Rijk van Zanten <rijkvanzanten@me.com>
2023-04-14 15:03:42 -04:00
Hannes Küttner
ebba7a68e7 Migrate to Material Symbols (#18004)
* Migrate to Material Symbols

* Fix lint issues

* Use canonical `bookmark` icon

* Update `copy` icon name

* Replace `highlight_alt` with `select` icon

* Add directus_presets default icon migration

* Fix lint (again)

* Add spaces around icon group names

* Replace missing _outline icons

* Replace `arrow_backward` with `arrow_back`

* Update migrations

* Sign CLA

* merge migrations

* Revert group name display tweak

* Fix hover color + grid centering

* Update app/src/interfaces/file-image/file-image.vue

---------

Co-authored-by: Pascal Jufer <pascal-jufer@bluewin.ch>
Co-authored-by: Rijk van Zanten <rijkvanzanten@me.com>
2023-04-12 13:12:37 -04:00
Joshua Bemenderfer
eea13b43e6 [Take 2] Register <drawer-collection> in Vue app for relational interface extensions (#18153) 2023-04-12 15:08:07 +02:00
Pascal Jufer
d8455c14e2 Clean-up after "Enhance bug reporting from within the app" (#18136)
* Remove duplicate v-menu._test.ts

* Making UsableProjectInfo private again
2023-04-11 15:49:51 -04:00
Pascal Jufer
f09f440146 Enhance bug reporting from within the app (#16566)
* Fix paths of imports

* Process not-found.vue as ts

To prevent the following error from 'vue-tsc':
  error TS6504: File '/Users/pascal/Development/directus/app/src/modules/insights/routes/not-found.vue.js' is a JavaScript file. Did you mean to enable the 'allowJs' option?

Note: We could also enable 'allowJS' but since this is the only js file
this seems to be a more fitting fix

* Drop hljs language definition for GraphQL (now in core)

* Enhance bug reporting from within the app

* Simplify simplify simplify

---------

Co-authored-by: rijkvanzanten <rijkvanzanten@me.com>
2023-04-11 15:04:26 -04:00
Brainslug
ab8446dd16 throw an error on invalid file upload (#18035)
* throw an error on invalid file upload

* include size check in file validation

* removed accidental import
2023-04-10 15:47:42 -04:00
Nitwel
8ea94c317b Fix sort icons (#17984)
* Fix sort icons

* Run linter

* Fix return value for unsorted headers

---------

Co-authored-by: Pascal Jufer <pascal-jufer@bluewin.ch>
Co-authored-by: Brainslug <br41nslug@users.noreply.github.com>
Co-authored-by: Rijk van Zanten <rijkvanzanten@me.com>
2023-04-10 14:27:12 +02:00
Nitwel
88a401ca20 Make headers sticky again (#17850)
Co-authored-by: Rijk van Zanten <rijkvanzanten@me.com>
Co-authored-by: Pascal Jufer <pascal-jufer@bluewin.ch>
2023-04-07 12:29:41 +02:00
Rijk van Zanten
2983e61870 The Great TypeScript Modernization Program Season 3 Episode 6: The Big One (#18014)
* Step 1

* Step 2

* False sense of confidence

* Couple more before dinner

* Update schema package

* Update format-title

* Upgrade specs file

* Close

* Replace ts-node-dev with tsx, and various others

* Replace lodash with lodash-es

* Add lodash-es types

* Update knex import

* More fun is had

* FSE

* Consolidate repos

* Various tweaks and fixes

* Fix specs

* Remove dependency on knex-schema-inspector

* Fix wrong imports of inspector

* Move shared exceptions to new package

* Move constants to separate module

* Move types to new types package

* Use directus/types

* I believe this is no longer needed

* [WIP] Start moving utils to esm

* ESMify Shared

* Move shared utils to  @directus/utils

* Use @directus/utils instead of @directus/shared/utils

* It runs!

* Use correct schemaoverview type

* Fix imports

* Fix the thing

* Start on new update-checker lib

* Use new update-check package

* Swap out directus/shared in app

* Pushing through the last bits now

* Dangerously make extensions SDK ESM

* Use @directus/types in tests

* Copy util function to test

* Fix linter config

* Add missing import

* Hot takes

* Fix build

* Curse these default exports

* No tests in constants

* Add tests

* Remove tests from types

* Add tests for exceptions

* Fix test

* Fix app tests

* Fix import in test

* Fix various tests

* Fix specs export

* Some more tests

* Remove broken integration tests

These were broken beyond repair.. They were also written before we really knew what we we're doing with tests, so I think it's better to say goodbye and start over with these

* Regenerate lockfile

* Fix imports from merge

* I create my own problems

* Make sharp play nice

* Add vitest config

* Install missing blackbox dep

* Consts shouldn't be in types

tsk tsk tsk tsk

* Fix type/const usage in extensions-sdk

* cursed.default

* Reduce circular deps

* Fix circular dep in items service

* vvv

* Trigger testing for all vendors

* Add workaround for rollup

* Prepend the file protocol for the ESM loader to be compatible with Windows
"WARN: Only URLs with a scheme in: file and data are supported by the default ESM loader. On Windows, absolute paths must be valid file:// URLs. Received protocol 'c:'"

* Fix postgres

* Schema package updates

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

* Resolve cjs/mjs extensions

* Clean-up eslint config

* fixed extension concatination

* using string interpolation for consistency

* Revert MySQL optimisation

* Revert testing for all vendors

* Replace tsx with esbuild-kit/esm-loader

Is a bit faster and we can rely on the built-in `watch` and `inspect`
functionalities of Node.js

Note: The possibility to watch other files (.env in our case) might be
added in the future, see https://github.com/nodejs/node/issues/45467

* Use exact version for esbuild-kit/esm-loader

* Fix import

---------

Co-authored-by: ian <licitdev@gmail.com>
Co-authored-by: Brainslug <tim@brainslug.nl>
Co-authored-by: Azri Kahar <42867097+azrikahar@users.noreply.github.com>
Co-authored-by: Pascal Jufer <pascal-jufer@bluewin.ch>
2023-04-04 17:41:56 -04:00
Nitwel
75ad4876bf only hide v-select options (#17953) 2023-03-27 10:12:17 -04:00
Pascal Jufer
7b34f05a2b Declare null as valid value type for v-radio (#17879) 2023-03-22 10:31:09 -04:00
Nitwel
6c9f9d3f16 Fix Storybook components (#17828)
* migrate to latest storybook and fix components

* run linter
2023-03-20 09:30:54 -04:00
Azri Kahar
eb65d60236 Improve error handling for app extensions (#17191)
* add util function to get vue component name

* add global error handler

* add v-error-boundary component

* use error boundary to wrap insights panels

* use error boundary to wrap form interfaces

* use error boundary in render display and template

* use error boundary in extension options

* use error boundary for flows operation overview

* extract default options-overview into a component

* add tests
2023-03-16 13:04:17 +01:00
José Varela
a29a664ae7 Allow to select checkbox entry when children is null (#17783) 2023-03-14 20:39:01 +08:00
Nitwel
9d1dd1ae52 Show validation errors in drawer-item (#17423)
Co-authored-by: Pascal Jufer <pascal-jufer@bluewin.ch>
2023-03-06 11:47:05 +01:00
Pascal Jufer
37faf3bd5d Patch Tuesday 🐸 (#17530)
* Update root deps

* Reformat files with new prettier version

* Update `directus` deps

* Update `@directus/app` deps

* Update `@directus/shared` deps

* Update components snapshots after updates

prop order has changed

* Update `extensions-sdk` deps

* pin version of zod in shared

* Update `@directus/storage` deps

* Update `@directus/storage-driver-azure` deps

* Update `storage-driver-cloudinary` deps

* Update `@directus/storage-driver-cloudinary` deps

* Update `@directus/storage-driver-local` deps

* Update `@directus/storage-driver-s3` deps

* Update `@directus/utils` deps

---------

Co-authored-by: Rijk van Zanten <rijkvanzanten@me.com>
2023-02-16 17:47:39 +08:00
Pascal Jufer
d5395ce72c Follow-up on "Drop inline rendering of docs" (#17449)
* Follow-up of "Drop inline rendering of docs"

* Remove docs hack

---------

Co-authored-by: rijkvanzanten <rijkvanzanten@me.com>
2023-02-08 11:25:32 -05:00
Nitwel
b136d7c30d Support selecting multiple files in v-upload (#17394)
* support multiple on selection in v-upload

* run linter
2023-02-08 10:27:45 -05:00
Nitwel
78bda5c763 Fix span with space in it (#17432)
* Fix span with space in it

* run linter

---------

Co-authored-by: Rijk van Zanten <rijkvanzanten@me.com>
2023-02-08 01:19:33 +08:00
Addison Elliott
d31e0011b8 Fix issue with v-detail transition not working on initial collapse (#17325)
Bug only occurred if v-detail started out expanded, which is not extremely common.

Co-authored-by: Addison Elliott <addisone@becs.com>
2023-02-07 10:09:18 -05:00
Nitwel
5157c44dd8 Fix checkbox flickering (#17411) 2023-02-06 15:08:56 -05:00
Addison Elliott
39a812b4f3 Fix bug with v-checkbox-tree where leaf nodes are treated like branch (#17323)
nodes with no children

Bug introduced here in #15094

Co-authored-by: Addison Elliott <addisone@becs.com>
2023-01-27 15:53:17 -05:00
Nitwel
276cc479ce Revert "Disable field selection for alias fields in the system-filter component when functions are used (#14314)" (#17182) 2023-01-19 08:18:35 -05:00
ian
025bb7c053 Fix insights filtering (#16139)
* Parse string filter as JSON

* Parse content as JSON when toggling raw editor

* Refactor missing Dashboard type

* Convert filter to gql format

* Disable alias field filter selection in insights

* Use parseJSON util

* Refactor to allow selectivity of relational field for GraphQL filters

* Emit variables

* Skip emitting invalid JSON

* Add unit tests
2023-01-18 14:31:59 -05:00
Azri Kahar
0122c4da4b Add bottom margin to Slider interface to account for field note (#17024)
* add margin when thumb label is always visible

* add z-index to thumb label for field note

Co-authored-by: Rijk van Zanten <rijkvanzanten@me.com>
2023-01-05 08:31:15 -05:00
Brainslug
9f60b0f31d Remove auto-increment primary key when saving as copy (#16966)
* check for auto increment when saving as copy

* updated check to cover uuid generated IDs

* attempt to test use-item composable

* updated test objects

* do not rely on is_generated

* fix readonly regression

Co-authored-by: Azri Kahar <42867097+azrikahar@users.noreply.github.com>
2023-01-05 19:07:11 +08:00
Brainslug
cbd2af050b Implements server sort in o2m table interface (#16897)
* implements server sort when dealing with multple relational pages

* always use server sort

* fixed unsetting sort

* removed frontend sorting

* make loading total count more accurate

* remove removed prop

Co-authored-by: Nitwel <mail@nitwel.de>
2023-01-04 16:32:05 +01:00
Gerard Lamusse
9f06c36e0d Disable field selection for alias fields in the system-filter component when functions are used (#14314)
* Disable selecting alias fields to filter on

* Only disable alias fields when in condition mode
2023-01-04 13:27:13 +01:00
Pascal Jufer
8f5a072352 Enhance loading logic in image component (#16538)
Co-authored-by: Brainslug <br41nslug@users.noreply.github.com>
2022-12-19 11:06:07 +01:00
Brainslug
511c8d368b Fix json serialization (#16558)
* fix copying json fields

* fixed preset filter type

* handling fallback in copyToClipboard function

* add test

* try parsing json content on paste

Co-authored-by: Azri Kahar <42867097+azrikahar@users.noreply.github.com>
2022-12-15 10:40:43 +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
ce8f571c72 Fix key combinations being prevented in dbSafe v-input when it's a leading number (#16668)
* Fix key combinations being prevented in v-input

* should normalize accented characters first

* add tests for processValue and emitValue

* export keyMap from use-shortcut to keep things DRY

* try to add test for use-shortcut composable

* move systemKeys to use-shortcut

* add "capslock" & "enter" to systemKeys
2022-11-30 19:56:44 +08:00
Azri Kahar
d1483b15b4 improve v-icon performance (#16511) 2022-11-28 14:39:38 -05:00
Azri Kahar
0a839b53b4 v-menu pointer event tweaks (#16512)
* v-menu pointer event tweaks

* apply tweak to .v-menu click & closeOnContentClick
2022-11-28 14:39:23 -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
Azri Kahar
b5b073b0cb Allow disabling same width for attached dropdown menu (#16365)
* allow configuring width for attached menu

* add prop to v-select

* simpler prop naming

* update test snapshot
2022-11-09 07:31:14 -08:00
Azri Kahar
efe7dce5bc Fix Paste Raw Value not staging field edit (#16132)
* fix Paste Raw Value not staging field edit

* use emitValue instead
2022-10-25 00:55:33 +08:00
Azri Kahar
8850aec88f Fix input-code height in form-field-raw-editor (#16135)
* Fix input-code height in form-field-raw-editor

* update test snapshot due to scoped css

Co-authored-by: Rijk van Zanten <rijkvanzanten@me.com>
2022-10-24 16:32:59 +00:00
Rijk van Zanten
2d104e933b Patch Tuesday 🐸 (#16052)
* Update API non-majors

* Update major changes

* Temp fix for type warning in sdk

* Resolve missing new keyword in GraphQLNonNull use

* Lock versions in api

* Update and lock versions in shared

* Update lockfile

* Fix build type errors in api

* Update app patches/minors

* Upgrade major versions

* Lock versions

* Upgrade root deps

* Update packages

* Switch from pino-colada to pino-pretty

* Update snapshots

* Fix globby sync usage

* Remove globals from jest config

* No ranges

* Revert "Remove globals from jest config"

This reverts commit e249e2c8fe.

* Revert "Upgrade root deps"

This reverts commit 62add28a85.

* Update non-jest stuff

* We'll keep trying

* Update globby to latest minor only

* Test on all vendors

* Revert test on all vendors

* Fix linting

* Preserve request log format

* Preserve existing timestamp format and allow configuration

* Use lodash merge to allow for nested objects

Co-authored-by: ian <licitdev@gmail.com>
2022-10-20 09:31:17 -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
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
027696dd65 fix workspace size logic (#15637) 2022-10-12 14:42:39 -04:00