937 Commits

Author SHA1 Message Date
rijkvanzanten
200c2dd2c7 v9.17.0 2022-09-02 16:17:56 -04:00
Rijk van Zanten
4eae2de686 Move updated components to app (#15374)
* Move updated components to app

* Make sure storybook is alive
2022-09-02 14:42:00 -04:00
Azri Kahar
73703641e3 Fix custom icons (#15361)
* fix custom icons

* swap signal wifi 2 and 3
2022-09-02 10:53:21 -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
Rijk van Zanten
f834605a13 Move get-with-arrays to shared (#15332)
* Move get-with-arrays to shared, add fallback

* Just fallback to undefineds, let the usage handle fallbacks
2022-08-30 17:21:07 -04:00
Gerard Lamusse
60c5f80dd6 Don't throw error if entry is null or undefined (#15276)
* Don't throw error if entry is null or undefined

* Rely on defaultValue rather than null

* Drop custom getter

Co-authored-by: rijkvanzanten <rijkvanzanten@me.com>
2022-08-30 16:35:22 -04:00
ian
a971455216 Add origin to accountability (#15273)
* Add origin to accountability

* Remove origin column from seeds
2022-08-30 14:15:44 -04:00
Nicola Krumschmidt
ef0a6eb965 Be smarter when scaffolding an extension and choosing the package name and target path based on the user-provided name (#15213)
* Only add extension name prefix if it is not present

* Strip package scope from extension name when used as target dir

* Check if extension target dir is empty

* Improve error message when build output file path is empty
2022-08-22 18:19:12 -04:00
rijkvanzanten
f21f8c4707 v9.16.1 2022-08-19 09:13:10 -04:00
rijkvanzanten
58f6a6fcde v9.16.0 2022-08-18 16:55:44 -04:00
Rijk van Zanten
a21b28b423 Add "Run Script" operation (#15101)
* [WIP] Start working on script operation

* WIP Remove npx-import experiment

* Don't break on string value in options scope

* WIP Add module whitelist

* Mission critical import cleanup work

* Add translated labels

* Use nodeVM for everything

Keeps the export function callback structure consistent

* Tweak wording

* WIP start on tests

* Improve typing in shared define types

* Add missing base reactive properties in server store

* Add tests for exec index in app

* Add tests

* Optimize error handling
2022-08-18 15:39:25 -04:00
Gerard Lamusse
1fedc5bdfd Fix validatePayload for _or containing _and (#14951)
* Fix validatePayload for _or containing _and

* Remove comment

* Update unit test

Co-authored-by: ian <licitdev@gmail.com>
2022-08-17 16:53:31 +08:00
Rijk van Zanten
6d08672c88 Update knex-schema-inspector to 2.0.4 (#15047) 2022-08-12 11:02:17 -04:00
Rijk van Zanten
42f5f61cd0 Fix decompression when floats are used, but no integers are present (#14985)
Fixes #14980
2022-08-09 12:10:21 -04:00
rijkvanzanten
1ebda96a69 v9.15.1 2022-08-05 14:50:06 -04:00
Thomas Vuillemin
78fcaf45a5 Set sourceMap to true on TS extension template (#14881) 2022-08-05 12:36:33 -04:00
rijkvanzanten
3270df00c1 9.15.0 2022-08-04 18:19:19 -04:00
José Varela
cc343fdf91 Improve cache performance by compressing records (#14833)
* Utils to compress/decompress data
Gzip was chosen because we want smaller data but quick algorithm since this will be ran for every request

* Compress system cache

* Decompress system cache

* Set/Get compressed cache for individual requests

* Switch from gzip to snappy, use json compression too

* Fix cache exp set/get

* Remove unused import

Co-authored-by: rijkvanzanten <rijkvanzanten@me.com>
2022-08-04 17:35:27 -04:00
Rijk van Zanten
1300f5c3de Add compress/decompress utility functions (#14855)
* install coverage tool

* Add compressor function

* 🧹

* Finish compressor/decompressor

* Finish tests
2022-08-04 15:36:34 -04:00
Rijk van Zanten
855db5638f Tests/shared (#14836)
* Move from jest to vitest

* Move test files, cleanup imports
2022-08-03 17:26:17 -04:00
ian
3dedf1cb3f Check for allowed filter operators when applying filter (#14829)
* Check for allowed filter operators when applying filter

* Add hash type to GraphQL

* Add tests

* Specify text type
2022-08-03 14:14:19 -04:00
Azri Kahar
5d96d752f4 Support custom aspect ratios in image editor (#14786)
* Support custom aspect ratios in image editor

* Add custom aspect ratios in file items as well

* Revert file item custom-aspect-ratio changes

* Use globally configured custom aspect ratios

* Remove previos custom-aspect-ratio logic

* code style tweak

* use migration instead of seed

* rename field to custom_aspect_ratios

* keep defaults + change icon

Co-authored-by: qborisb <boris@qdentity.nl>
Co-authored-by: Rijk van Zanten <rijkvanzanten@me.com>
2022-08-03 22:25:25 +08:00
Azri Kahar
c75ecc284f Fix typo for operation component in OAS (#14795) 2022-08-02 09:07:46 -04:00
Nicola Krumschmidt
a944452932 Fix building the extensions-sdk in dev mode (#14658) 2022-07-26 09:04:51 -04:00
Nicola Krumschmidt
717fce66ae Improve extension scaffolding log message (#14659) 2022-07-26 09:02:16 -04:00
Rijk van Zanten
88c5edf7a3 Add app unit tests using vitest (#14583)
* Install / bootstrap vitest

* Install c8

* Add tests for add-query-to-path

* Don't set global maplibre token on individual style

This feels wrong to me. We have a single global access token that should be used for these things. Overriding that with a token that's found for individual styles on top of the same global object in order of configured maps feels weird, as the latter tokens will override the earlier ones. Needs more research though

* Install testing libraries

* Use happy-dom as env in vitest

* Enable ts checking in tests

* Remove unused jest config

* Organize store imports

* Remove types from TSDoc in add-query-to-path

* Improve check in add-related-primary-key-to-fields

* Add reusable stub for anything touching nanoid

* Add tests for add-related-primary-key-to-fields

* Move adjust date to shared

* Remove arraysAreEqual util in favor of relying on lodash

* Fix add-related-primary-key-to-fields test

* Add test coverage for capitlize-first

* Add TSDoc/tests for extract-field-from-function

* Add test coverage for formatFieldFunction

* Add test coverage for format-filesize

* Add test coverage for get-groups

* Add tests for get-root-path

* cleanup imports

* Move tests to live next to source files

* Add tests for user-name

* Update type to match function behavior

* Add test coverage for point-on-line

* Add tests for is-empty

* Add test coverage for is-hex

* Remove getSetting util

Bit pointless to have a util function to just read a value from a store

* Add test coverage for get-related-collection

* Add test coverage for get-theme

* Add test coverage for get-with-arrays

* Add test coverage for hide-drag-image

* Add test coverage for is-permission-empty

* Remove unused import

* Add test for jwt-payload

* Add snapshot rendering test for v-sheet

* Add whitespace

* Rename __test_utils__ -> __utils__

* Add composable test

* Update app/tsconfig.json

Co-authored-by: Pascal Jufer <pascal-jufer@bluewin.ch>

Co-authored-by: Pascal Jufer <pascal-jufer@bluewin.ch>
2022-07-25 16:23:45 -04:00
Nicola Krumschmidt
81cd748c6d Add support for operation extensions to the Extensions SDK (#14410)
* Clean up extensions build logging

* Expose defineOperation* helpers through extensions-sdk

* Add support for scaffolding operation extensions

* Refactor extension type constants

* Improve extension-related tests in shared

* Improve wording when scaffolding extension fails due to wrong type

* Make spinner text bold when scaffolding extensions

* Add support for building operation extensions

* Fix operations tile name

* Make extension config type spacing consistent

Co-authored-by: Rijk van Zanten <rijkvanzanten@me.com>
2022-07-25 11:36:52 -04:00
rijkvanzanten
6e4738e4c0 v9.14.5 2022-07-22 14:45:15 -04:00
rijkvanzanten
aec37f6198 v9.14.4 2022-07-22 10:38:33 -04:00
rijkvanzanten
cf41b07100 v9.14.3 2022-07-21 16:16:14 -04:00
rijkvanzanten
6d1e5b3432 v9.14.2 2022-07-21 15:17:56 -04:00
Gerard Lamusse
7d71f1f693 Improve extension create onboarding (#14475)
* Improve extension create onboarding

* Remove proprietary message

* Undo dist change

Co-authored-by: rijkvanzanten <rijkvanzanten@me.com>
2022-07-20 16:06:48 -04:00
Christopher Kapic
090671ea1e Update Knex version to fix CockroachDB relationships showing multiple times (#14509)
* update knex version

* Update all knex uses

Co-authored-by: rijkvanzanten <rijkvanzanten@me.com>
2022-07-19 10:44:14 -04:00
Rijk van Zanten
27cc3e1bec Move repo to pnpm based workflow (#14350)
* Use pnpm instead of npm

* Setup workspace

* Replace scripts / lerna root stuff

* Add todo file

* Update lock, start updating packages

* Update todo

* [WIP] Keep going on module resolution in pnpm

* Fix final missing deps/types for complete build

* [WIP] Replace npm commands with pnpm alternatives

* Update jest config for v28

* Fix missing package under schema

* Update workflow

* Run CI on fork

* Use local reference

* Remove version from local workflow

* Add build to prepare

* Add Node's max old space size flag to linter

* Idemdito for codeql

* Hyphens? Underscores?

* Bang

* Only build one thing at a time

* Underscores after all?

* Match 7gb of GH

* Set env on prepare

* Jest is driving me nuts

* Downgrade jest

* Add root jest

* We'll get there, eventually.

* 🥳

* Het houdt niet op, niet vanzelf

* attempt to fix e2e

* fix unit test & shared import

* add `debug: true` to CodeQL action

* Fix dev call in shared

* Add missing cross-env

* Add missing geo-json dependency for app

* add flag to prepare action to skip build

* remove debug flag from codeql action

* fix invalid env syntax

* add tslib to app dependencies for tests

* another attempt

* Added missing rimraf dependency for the api prebuild/cleanup scripts

* Added missing ts-node dependency for the api cli script

* update E2E tests readme to use pnpm

* Undo move of extensions sdk

* Fixes nested groups in accordions not rendering fields (#14369)

* initial fix for nested groups in accordions

* removed debug code

* Fix strict relative dates showing "incorrect" (#14390)

* Set rounding method of relative formatted date to floor when strict option is selected

* Add round fn as an option

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

* Don't use locales in generated camelCased values from env (#14401)

Ref https://github.com/directus/directus/discussions/14122

* Fix list panel descending sort (#14396)

* fix list panel descending sort

* Handle missing or explicit desc value

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

* Fix query primary field for system tables (#14402)

* New Crowdin updates (#14403)

* Update source file en-US.yaml

* New translations en-US.yaml (Spanish, Chile)

* New translations en-US.yaml (Spanish, Latin America)

* New translations en-US.yaml (Greek)

* New translations en-US.yaml (Italian)

* New translations en-US.yaml (French, Canada)

* Fix/wysiwyg context menu (#14404)

* New translations en-US.yaml (Polish) (#14407)

* Encoded the url using encodeURIComponent, so that the url gets sanitzed and so, we did not get 404 error. (#14418)

* Encoded the url using encodeURIComponent, so that the url gets sanitized and we did not get 404 error.

* Added required changes as stated by the reviewer

* Used encodeURI instead of encodeURIComponent to encode the params only

* Solved linting error

* Solved linting errors

* checked with npm run lint, no linting errors found

* fix generateJoi error due to empty permissions when creating new role (#14416)

* fix empty permissions when creating new role

* basic test

* move logic up

* additional test

* Update api/tests/utils/filter-items.test.ts

Co-authored-by: ian <licitdev@gmail.com>

Co-authored-by: ian <licitdev@gmail.com>

* Recreate lockfile

* Fix build of extensions-sdk

* Add missing dependency

* Add some more missing deps

* Update blackbox to use pnpm

* Update workflow to use main

* Update pack to work with pnpm

* Simplify commands

* Remove todo file (completed)

* ADd missing types dep

* Use local test version

* Remove version from local reference

* Call super with context

* Add missing dep

* Simplify workflows

Ref https://github.com/directus/organization/issues/135

* Simplify some more

* Linter is on root

Co-authored-by: Azri Kahar <42867097+azrikahar@users.noreply.github.com>
Co-authored-by: brainslug <tim@brainslug.nl>
Co-authored-by: Brainslug <br41nslug@users.noreply.github.com>
Co-authored-by: Gerard Lamusse <gerardlamo@gmail.com>
Co-authored-by: José Varela <joselcvarela@gmail.com>
Co-authored-by: ian <licitdev@gmail.com>
Co-authored-by: Zeel Pathak <60271095+zeel-pathak@users.noreply.github.com>
2022-07-15 17:41:49 -04:00
Rijk van Zanten
47e660cb76 Update knex-schema-inspector to 2.0.3 (#14437) 2022-07-14 16:22:41 -04:00
rijkvanzanten
06014b85dd Undo move of extensions sdk 2022-07-12 15:18:50 +02:00
Jay Cammarano
d57ea95e52 Generate joi merge (#13596)
* branch init tests and stuff

* types changed

* added '@' to modules mapper

* removed unneeded dotenv import

* tests passing

* forgot to save before committing

* remove app/generate-joi

* Skip validation if permissions filter is empty

* Remove another generate-joi api util

* Default allowUnknown to true

* Remove wrapping nested filter as Joi.object()

* Remove duplicate nested field from unit test

* Fix between operator for float values

* Removed unused allowUnknown option

Co-authored-by: ian <licitdev@gmail.com>
Co-authored-by: rijkvanzanten <rijkvanzanten@me.com>
2022-07-11 19:09:47 +02:00
Rijk van Zanten
84e6277f87 Move external packages to separate repos (#14335)
* Move format title to dedicated repo

* Move CLI as well

* Move create-directus-extension

* Move create-directus-project

* Move extensions sdk

* Move gatsby-source-directus

* Move sdk

* Remove sdk from jest config

* Regen package-lock

* Add missing tmp types

* Fix test import names

* Missed one
2022-07-09 15:23:44 +02:00
brainslug
398839be6e v9.14.1 2022-07-08 11:13:22 +02:00
Addison Elliott
c28aadc9c3 Fix type for defaults in useCollection composable (#14254) 2022-07-02 15:35:15 -04:00
Rijk van Zanten
cef060a0fc Use string displays on the calendar layout (#14232) 2022-06-30 18:45:52 -04:00
rijkvanzanten
fd55233b11 v9.13.0 2022-06-28 15:52:31 -04:00
Rijk van Zanten
32dd709778 Insights 2.0 (#14096)
* query function added to list

* dashboard reading query, adding to object

* typecasting of filter vals needed still

* numbers accepting strings too

* json-to-graphql-query => devD

* fixed unneeded return in list index.ts

* stitching and calling but not actually calling

* calls on panel change

* query object += new panel before dashboard save

* uuid generated in app not api

* fixed panel ids in query

* fixed the tests I just wrote

* passing the query data down!

* list showing data

* objDiff test moved to test

* metric bug fixes + data

* dashboard logic

* time series conversion started

* timeseries GQL query almost there

* query querying

* chart loading

* aggregate handling improved

* error handling for aggregate+filter errors

* removed query on empty queryObj

* maybe more error handling

* more error handling working

* improvements to erorr handling

* stitchGQL() error return type corrected

* added string fields to COUNT

* pushing up but needs work

* not an endless recursion

* its not pretty but it works.

* throws an error

* system collections supported

* refactor to solve some errors

* loading correct

* metric function fixed

* data loading but not blocking rendering

* removed redundant code.

* relational fields

* deep nesting relations

* options.precision has a default

* relational fields fix. (thanks azri)

* the limit

* limit and time series

* range has a default

* datat to workspace

* v-if

* panels loading

* workspaces dont get data anymore

* package.json

* requested changes

* loading

* get groups util

* timeseries => script setup

* list => script setup

* metric => script setup

* label => script setup

* declare optional props

* loadingPanels: only loading spinner on loading panels

* remove unneeded parseDate!!

* applyDataToPanels tests

* -.only

* remove unneeded steps

* processQuery tests

* tests

* removed unused var

* jest.config and some queryCaller tests

* one more test

* query tests

* typo

* clean up

* fix some but not all bugs

* bugs from merge fixed

* Start cleaning up 🧹

* Refactor custom input type

* Small tweaks in list index

* Cleanup imports

* Require Query object to be returned from query prop

* Tweak return statement

* Fix imports

* Cleanup metric watch effect

* Tweaks tweaks tweaks

* Don't rely on options, simplify fetch logic

* Add paths to validation errors

* [WIP] Start handling things in the store

* Rework query fetching logic into store

* Clean up data passing

* Use composition setup for insights store

* Remove outdated

* Fix missing return

* Allow batch updating in REST API

Allows sending an array of partial items to the endpoints, updating all to their own values

* Add batch update to graphql

* Start integrating edits

* Readd clear

* Add deletion

* Add duplication

* Finish create flow

* Resolve cache refresh on panel config

* Prevent warnings about component name

* Improve loading state

* Finalize dashboard overhaul

* Add auto-refresh sidebar detail

* Add efficient panel reloading

* Set/remove errors on succeeded requests

* Move options rendering to shared

* Fix wrong imports, render options in app

* Selectively reload panels with changed variables

* Ensure newly added panels don't lose data

* Only refresh panel if data query changed

* Never use empty filter object in metric query

* Add default value support to variable panel

* Centralize no-data state

* Only reload data on var change when query is altered

* Fix build

* Fix time series order

* Remove unused utils

* Remove no-longer-used logic

* Mark batch update result as non-nullable in GraphQL schema

* Interim flows fix

* Skip parsing undefined keys

* Refresh insights dashboard when discarding changes

* Don't submit primary key when updating batch

* Handle null prop field better

* Tweak panel padding

Co-authored-by: jaycammarano <jay.cammarano@gmail.com>
Co-authored-by: Azri Kahar <42867097+azrikahar@users.noreply.github.com>
Co-authored-by: ian <licitdev@gmail.com>
2022-06-27 15:26:42 -04:00
Brainslug
03a73b84ba Added missing utility endpoint definitions (#14060) 2022-06-23 09:05:59 -04:00
ian
ed64c35af2 Fix linting of get-filter-operators-for-type.ts (#14003)
* Fix linting of get-filter-operators-for-type.ts

* Fix test
2022-06-20 11:43:11 -04:00
ian
a561dffc77 Update get-filter-operators-for-type.ts (#14001)
Remove the duplicated `null` and `nnull` for Datetime types. This results in duplicated tests run for the affected fields.
2022-06-20 11:24:35 -04:00
Azri Kahar
4111436999 prevent translations validation error match parent (#13930) 2022-06-17 17:49:25 -04:00
Nitwel
37762358fc Add tfa enforce flow (#7805)
* add tfa enforce flow

* add 'tfa-secret' to recommended permissions

* fix if theme if user has dark mode

* oas: rename 'enable-2fa' to 'enable-tfa'

* Add required user fields

* Uniformize styling

* Fix direct and invalid routing

* Add required permission docs

* Fix typescript warnings

* Fix typescript warnings 2

* Allow auto theme

* Nest duplicate condition check

* Fix routing for users without role

* Follow page redirects

* Reduce the use of redirect query

* Improve error UX

* Allow admins to disable 2FA

* Improve autofocus UX

* Override update permission for 'tfa_secret' when role enforces TFA

* Remove permission requirements from docs

Co-authored-by: Jose Varela <joselcvarela@gmail.com>
Co-authored-by: rijkvanzanten <rijkvanzanten@me.com>
Co-authored-by: ian <licitdev@gmail.com>
2022-06-16 01:27:59 +08:00
Rijk van Zanten
583a555b0b Upgrade gluegun (#13878) 2022-06-13 17:29:18 -04:00
Rijk van Zanten
558672a78f Prevent unknown knex methods from being used (#13877)
* Prevent unknown knex methods from being used

* Fix tests
2022-06-13 17:20:27 -04:00