From a1b5dca17ff6423b5df92a28ae70ceef40991867 Mon Sep 17 00:00:00 2001 From: rijkvanzanten Date: Fri, 7 Aug 2020 13:59:36 -0400 Subject: [PATCH 1/9] Reset page track if you navigate multiple times within 2.5s --- app/src/router.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/app/src/router.ts b/app/src/router.ts index 73200620a2..39778616c8 100644 --- a/app/src/router.ts +++ b/app/src/router.ts @@ -117,12 +117,20 @@ export const onBeforeEach: NavigationGuard = async (to, from, next) => { return next(); }; +let trackTimeout: number | null= null; + export const onAfterEach = (to: Route) => { const userStore = useUserStore(); if (to.meta.public !== true) { // The timeout gives the page some breathing room to load. No need to clog up the thread with // this call while more important things are loading + + if (trackTimeout) { + clearTimeout(trackTimeout); + trackTimeout = null; + } + setTimeout(() => { userStore.trackPage(to.fullPath); }, 2500); From 9fb4d0e8eb2cabee624189cc30486c08bb51dbf6 Mon Sep 17 00:00:00 2001 From: rijkvanzanten Date: Fri, 7 Aug 2020 15:46:40 -0400 Subject: [PATCH 2/9] Return correct fields on /fields/:collection --- api/src/routes/fields.ts | 4 ++-- api/src/routes/files.ts | 3 ++- api/src/services/fields.ts | 10 ++++++++-- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/api/src/routes/fields.ts b/api/src/routes/fields.ts index e0ac301dc7..45d9880f88 100644 --- a/api/src/routes/fields.ts +++ b/api/src/routes/fields.ts @@ -35,7 +35,7 @@ router.get( asyncHandler(async (req, res) => { const service = new FieldsService({ accountability: req.accountability }); - const fields = await service.readAll(req.collection); + const fields = await service.readAll(req.params.collection); return res.json({ data: fields || null }); }) ); @@ -50,7 +50,7 @@ router.get( const exists = await schemaInspector.hasColumn(req.collection, req.params.field); if (exists === false) throw new FieldNotFoundException(req.collection, req.params.field); - const field = await service.readOne(req.collection, req.params.field); + const field = await service.readOne(req.params.collection, req.params.field); return res.json({ data: field || null }); }) ); diff --git a/api/src/routes/files.ts b/api/src/routes/files.ts index 2c772dadb6..929feebd1a 100644 --- a/api/src/routes/files.ts +++ b/api/src/routes/files.ts @@ -100,7 +100,8 @@ router.post( } const record = await service.readByKey(keys as any, req.sanitizedQuery); - return res.json({ data: record || null }); + + return res.json({ data: res.locals.savedFiles.length === 1 ? record[0] : record || null }); }) ); diff --git a/api/src/services/fields.ts b/api/src/services/fields.ts index f5d23052a4..a26dc5bd0d 100644 --- a/api/src/services/fields.ts +++ b/api/src/services/fields.ts @@ -81,10 +81,16 @@ export default class FieldsService { return data as Field; }); - let aliasFields = await this.knex + const aliasQuery = this.knex .select('*') .from('directus_fields') - .whereIn('special', ['alias', 'o2m']); + .whereIn('special', ['alias', 'o2m', 'm2m']); + + if (collection) { + aliasQuery.andWhere('collection', collection); + } + + let aliasFields = await aliasQuery; aliasFields = (await this.payloadService.processValues('read', aliasFields)) as FieldMeta[]; From 6ea10375e91ec8dc93e426c72c2a6632956dc855 Mon Sep 17 00:00:00 2001 From: rijkvanzanten Date: Fri, 7 Aug 2020 15:47:35 -0400 Subject: [PATCH 3/9] Allow multiple in v-upload --- app/src/components/v-upload/v-upload.vue | 49 ++++-- app/src/displays/image/image.vue | 10 +- app/src/displays/image/index.ts | 2 +- app/src/interfaces/file/file.vue | 1 + app/src/interfaces/image/image.vue | 30 ++-- app/src/interfaces/image/index.ts | 3 +- .../modules/files/routes/add-new/add-new.vue | 8 +- .../collection-options/collection-options.vue | 2 +- .../field-detail/components/display.vue | 14 +- .../field-detail/components/interface.vue | 14 +- .../field-detail/components/schema.vue | 30 ++-- .../routes/data-model/field-detail/store.ts | 16 +- app/src/router.ts | 12 -- app/src/routes/install/index.ts | 4 - app/src/routes/install/install-database.vue | 87 ----------- app/src/routes/install/install-final.vue | 105 ------------- app/src/routes/install/install-project.vue | 91 ----------- .../routes/install/install-requirements.vue | 147 ------------------ app/src/routes/install/install-welcome.vue | 95 ----------- app/src/routes/install/install.vue | 131 ---------------- app/src/utils/upload-file/upload-file.ts | 6 +- app/src/utils/upload-files/upload-files.ts | 5 +- 22 files changed, 103 insertions(+), 759 deletions(-) delete mode 100644 app/src/routes/install/index.ts delete mode 100644 app/src/routes/install/install-database.vue delete mode 100644 app/src/routes/install/install-final.vue delete mode 100644 app/src/routes/install/install-project.vue delete mode 100644 app/src/routes/install/install-requirements.vue delete mode 100644 app/src/routes/install/install-welcome.vue delete mode 100644 app/src/routes/install/install.vue diff --git a/app/src/components/v-upload/v-upload.vue b/app/src/components/v-upload/v-upload.vue index f4b6315030..b70e4036d1 100644 --- a/app/src/components/v-upload/v-upload.vue +++ b/app/src/components/v-upload/v-upload.vue @@ -15,7 +15,7 @@ @@ -29,12 +29,17 @@ diff --git a/app/src/modules/settings/routes/data-model/collections/components/collection-options/collection-options.vue b/app/src/modules/settings/routes/data-model/collections/components/collection-options/collection-options.vue index 8a1ac2bae7..f204cf5bb9 100644 --- a/app/src/modules/settings/routes/data-model/collections/components/collection-options/collection-options.vue +++ b/app/src/modules/settings/routes/data-model/collections/components/collection-options/collection-options.vue @@ -1,6 +1,6 @@