From ff4de386a71ca1693bf1837f80e49e6485ce9812 Mon Sep 17 00:00:00 2001 From: Ahmad Alahrashi Date: Mon, 30 Jan 2023 13:21:46 +0100 Subject: [PATCH 01/50] chore (refs T31116): Add Routes Props for DpDashboardTaskCard. --- src/components/core/DpDashboardTaskCard.vue | 23 +++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/src/components/core/DpDashboardTaskCard.vue b/src/components/core/DpDashboardTaskCard.vue index 7ce55b00c..2a9d4748c 100644 --- a/src/components/core/DpDashboardTaskCard.vue +++ b/src/components/core/DpDashboardTaskCard.vue @@ -41,6 +41,21 @@ export default { procedureId: { type: String, required: true + }, + + resourceListRoute: { + type: String, + required: true + }, + + segmentListHashUpdateRoute: { + type: String, + required: true + }, + + segmentsListRoute: { + type: String, + required: true } }, @@ -53,7 +68,7 @@ export default { computed: { userFilteredSegmentUrl () { - return Routing.generate('dplan_segments_list', { procedureId: this.procedureId }) + '/' + this.userHash + return Routing.generate(this.segmentsListRoute, { procedureId: this.procedureId }) + '/' + this.userHash } }, @@ -75,7 +90,7 @@ export default { } // Get count of segments assigned to the current user - const segmentUrl = Routing.generate('api_resource_list', { resourceType: 'StatementSegment' }) + const segmentUrl = Routing.generate(this.resourceListRoute, { resourceType: 'StatementSegment' }) dpApi.get(segmentUrl, { filter: filterQuery }, { serialize: true }).then(response => { this.assignedSegmentCount = response.data.data.length }) @@ -87,7 +102,7 @@ export default { * redirected response. The redirected response will contain the default filter hash, which can then be extracted * and used to obtain an updated filter hash. */ - dpApi.get(Routing.generate('dplan_segments_list', { procedureId: this.procedureId })) + dpApi.get(Routing.generate(this.segmentsListRoute, { procedureId: this.procedureId })) .then(response => { const redirectUrl = response.request.responseURL const splitUrl = redirectUrl.split('/') @@ -100,7 +115,7 @@ export default { } // Get the actual filter hash - const url = Routing.generate('dplan_rpc_segment_list_query_update', { queryHash }) + const url = Routing.generate(this.segmentListHashUpdateRoute, { queryHash }) dpApi.patch(url, {}, filterData) .then(response => checkResponse(response)) .then(response => { From d7329b8f2e9944051abc5f1d6cda878054c9bec4 Mon Sep 17 00:00:00 2001 From: Ahmad Alahrashi Date: Mon, 30 Jan 2023 16:02:22 +0100 Subject: [PATCH 02/50] chore (refs T31116): Add fileRoute Props instead of string. - insert value in core. --- src/components/core/DpUpload/DpUploadFiles.vue | 6 ++++++ src/components/core/DpUpload/DpUploadedFile.vue | 7 ++++++- src/components/core/DpUpload/DpUploadedFileList.vue | 6 ++++++ 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/components/core/DpUpload/DpUploadFiles.vue b/src/components/core/DpUpload/DpUploadFiles.vue index a5256a18e..199697f3b 100644 --- a/src/components/core/DpUpload/DpUploadFiles.vue +++ b/src/components/core/DpUpload/DpUploadFiles.vue @@ -22,6 +22,7 @@ --> @@ -88,6 +89,11 @@ export default { default: false }, + fileRoute: { + type: String, + required: true + }, + id: { type: String, required: false, diff --git a/src/components/core/DpUpload/DpUploadedFile.vue b/src/components/core/DpUpload/DpUploadedFile.vue index 42e07cb35..92ba69cbb 100644 --- a/src/components/core/DpUpload/DpUploadedFile.vue +++ b/src/components/core/DpUpload/DpUploadedFile.vue @@ -8,7 +8,7 @@ @@ -43,6 +43,11 @@ export default { fileString: { type: String, required: true + }, + + fileRoute: { + type: String, + required: true } }, diff --git a/src/components/core/DpUpload/DpUploadedFileList.vue b/src/components/core/DpUpload/DpUploadedFileList.vue index 2c086d7d9..cd1c9b5c9 100644 --- a/src/components/core/DpUpload/DpUploadedFileList.vue +++ b/src/components/core/DpUpload/DpUploadedFileList.vue @@ -7,6 +7,7 @@ @@ -31,6 +32,11 @@ export default { type: Array, required: false, default: () => ([]) + }, + + fileRoute: { + type: String, + required: true } }, From bb3ff53127ee4b07e1521d72d12790769e89dd83 Mon Sep 17 00:00:00 2001 From: Ahmad Alahrashi Date: Mon, 30 Jan 2023 16:02:30 +0100 Subject: [PATCH 03/50] chore (refs T31116): Add fileRoute Props instead of string. - insert value in core. --- src/components/core/DpEditor/DpEditor.vue | 10 ++++++++++ src/components/core/DpEditor/DpUploadModal.vue | 8 ++++++++ 2 files changed, 18 insertions(+) diff --git a/src/components/core/DpEditor/DpEditor.vue b/src/components/core/DpEditor/DpEditor.vue index c1a696f88..f666ae330 100644 --- a/src/components/core/DpEditor/DpEditor.vue +++ b/src/components/core/DpEditor/DpEditor.vue @@ -18,6 +18,7 @@ @@ -416,6 +417,15 @@ export default { default: '' }, + /** + * Needed to get the core_file Route, when DpEditor has imageButton attr. + */ + fileRoute: { + type: String, + required: false, + default: '' + }, + /** * Array with numbers 1-6 defining which heading-buttons we want to show * diff --git a/src/components/core/DpEditor/DpUploadModal.vue b/src/components/core/DpEditor/DpUploadModal.vue index 692dd5dd1..3bbc60752 100644 --- a/src/components/core/DpEditor/DpUploadModal.vue +++ b/src/components/core/DpEditor/DpUploadModal.vue @@ -17,6 +17,7 @@ Date: Mon, 30 Jan 2023 16:48:38 +0100 Subject: [PATCH 04/50] chore (refs T31116): Add fileRoute Props instead of string. --- src/components/core/DpEditor/DpUploadModal.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/core/DpEditor/DpUploadModal.vue b/src/components/core/DpEditor/DpUploadModal.vue index 3bbc60752..903f39aa8 100644 --- a/src/components/core/DpEditor/DpUploadModal.vue +++ b/src/components/core/DpEditor/DpUploadModal.vue @@ -98,7 +98,7 @@ export default { }, setFile ({ hash }) { - this.fileUrl = Routing.generate('core_file', { hash: hash }) + this.fileUrl = Routing.generate(this.fileRoute, { hash: hash }) // Force-update the component so that DpModal updates and therefore check for new focusable elements this.$forceUpdate() }, From 395a417834e3607615a7a3147a3dced1c83da4eb Mon Sep 17 00:00:00 2001 From: Ahmad Alahrashi Date: Mon, 30 Jan 2023 16:49:58 +0100 Subject: [PATCH 05/50] chore (refs T31116): Add fileRoute Props instead of string. --- src/components/core/DpEditor/DpEditor.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/core/DpEditor/DpEditor.vue b/src/components/core/DpEditor/DpEditor.vue index f666ae330..010501985 100644 --- a/src/components/core/DpEditor/DpEditor.vue +++ b/src/components/core/DpEditor/DpEditor.vue @@ -916,7 +916,7 @@ export default { const imageHash = placeholder.substr(7, 36) const imageWidth = placeholder.match(/width=(\d*?)&/)[1] const imageHeight = placeholder.match(/height=(\d*?)$/)[1] - return `${altText}` + return `${altText}` }) } catch (e) { return text From 25f8d2ac3de151370c89ecbff4aebc5a5cd3bd15 Mon Sep 17 00:00:00 2001 From: Ahmad Alahrashi Date: Mon, 30 Jan 2023 16:55:57 +0100 Subject: [PATCH 06/50] chore (refs T31116): Add Routes Props instead of string. --- src/components/core/DpRegisterFlyout.vue | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/components/core/DpRegisterFlyout.vue b/src/components/core/DpRegisterFlyout.vue index 391fb43d4..c520582a7 100644 --- a/src/components/core/DpRegisterFlyout.vue +++ b/src/components/core/DpRegisterFlyout.vue @@ -15,11 +15,11 @@ @@ -35,6 +35,18 @@ export default { DpFlyout }, + props: { + citizenRegisterFormRoute: { + type: String, + required: true + }, + + orgaRegisterFormRoute: { + type: String, + required: true + } + }, + mounted () { /* * The placeholder element is shown until all javascript has been loaded From cab5e33e7923828ad4756bbdd382090b126f00a0 Mon Sep 17 00:00:00 2001 From: Ahmad Alahrashi Date: Tue, 31 Jan 2023 09:45:50 +0100 Subject: [PATCH 07/50] chore (refs T31116): Add param instead of route string. --- src/components/core/DpUpload/utils/GetFileIdsByHash.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/core/DpUpload/utils/GetFileIdsByHash.js b/src/components/core/DpUpload/utils/GetFileIdsByHash.js index ab78108df..a35aaf79b 100644 --- a/src/components/core/DpUpload/utils/GetFileIdsByHash.js +++ b/src/components/core/DpUpload/utils/GetFileIdsByHash.js @@ -7,9 +7,9 @@ import { dpApi } from '../../../../lib' * * @returns {Array} */ -function getFileIdsByHash (hashes) { +function getFileIdsByHash (hashes, route) { return dpApi.get( - Routing.generate('api_resource_list', { resourceType: 'File' }), + Routing.generate(route, { resourceType: 'File' }), { filter: { hasHash: { From 1095c03c281d7f68db33d34ca93c7e5333ad4a0e Mon Sep 17 00:00:00 2001 From: Ahmad Alahrashi Date: Tue, 31 Jan 2023 10:35:24 +0100 Subject: [PATCH 08/50] chore (refs T31116): Add boilerplateListRoute Prop for Editor instead of string value. --- src/components/core/DpEditor/DpBoilerPlateModal.vue | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/components/core/DpEditor/DpBoilerPlateModal.vue b/src/components/core/DpEditor/DpBoilerPlateModal.vue index 4b8601ba1..c0db7c9b9 100644 --- a/src/components/core/DpEditor/DpBoilerPlateModal.vue +++ b/src/components/core/DpEditor/DpBoilerPlateModal.vue @@ -15,7 +15,7 @@
+ :href="Routing.generate(boilerplateListRoute, { procedure: procedureId })"> {{ Translator.trans('boilerplates.edit') }} ({{ Translator.trans('view.leave.hint') }}) Date: Tue, 31 Jan 2023 10:35:33 +0100 Subject: [PATCH 09/50] chore (refs T31116): Add boilerplateListRoute Prop for Editor instead of string value. --- src/components/core/DpEditor/DpEditor.vue | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/components/core/DpEditor/DpEditor.vue b/src/components/core/DpEditor/DpEditor.vue index 010501985..701eee075 100644 --- a/src/components/core/DpEditor/DpEditor.vue +++ b/src/components/core/DpEditor/DpEditor.vue @@ -8,6 +8,7 @@ v-if="toolbar.boilerPlate && boilerPlateEnabled" ref="boilerPlateModal" :editor-id="editorId" + :boilerplate-list-route="boilerplateListRoute" :procedure-id="procedureId" :boiler-plate-type="toolbar.boilerPlate" @insertBoilerPlate="text => handleInsertText(text)" /> @@ -565,6 +566,12 @@ export default { default: false }, + boilerplateListRoute: { + type: String, + required: false, + default: '' + }, + /** * ProcedureId is required if we want to enable boilerplates */ From c85527749bd4abad226f3035bae19da7f7277738 Mon Sep 17 00:00:00 2001 From: Ahmad Alahrashi Date: Tue, 31 Jan 2023 10:56:23 +0100 Subject: [PATCH 10/50] chore (refs T31116): Add similarRecommendationsRoute Prop for Editor instead of string value. --- src/components/core/DpEditor/DpRecommendationModal.vue | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/components/core/DpEditor/DpRecommendationModal.vue b/src/components/core/DpEditor/DpRecommendationModal.vue index 840628b76..da3fc5a0b 100644 --- a/src/components/core/DpEditor/DpRecommendationModal.vue +++ b/src/components/core/DpEditor/DpRecommendationModal.vue @@ -89,6 +89,11 @@ export default { segmentId: { type: String, required: true + }, + + similarRecommendationsRoute: { + type: String, + required: true } }, @@ -212,7 +217,7 @@ export default { }, fetchSimilarRecommendations () { - const url = Routing.generate('api_resource_list', { resourceType: 'StatementSegment' }) + const url = Routing.generate(this.similarRecommendationsRoute, { resourceType: 'StatementSegment' }) const params = { include: 'parentStatement,parentStatement.procedure', fields: { From 104e2b553fe137c42755e9f700150f3dd00d40e5 Mon Sep 17 00:00:00 2001 From: Ahmad Alahrashi Date: Tue, 31 Jan 2023 10:56:31 +0100 Subject: [PATCH 11/50] chore (refs T31116): Add similarRecommendationsRoute Prop for Editor instead of string value. --- src/components/core/DpEditor/DpEditor.vue | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/components/core/DpEditor/DpEditor.vue b/src/components/core/DpEditor/DpEditor.vue index 701eee075..588311f16 100644 --- a/src/components/core/DpEditor/DpEditor.vue +++ b/src/components/core/DpEditor/DpEditor.vue @@ -28,7 +28,8 @@ ref="recommendationModal" @insert-recommendation="text => appendText(text)" :procedure-id="procedureId" - :segment-id="segmentId" /> + :segment-id="segmentId" + :similar-recommendations-route="similarRecommendationsRoute" />
Date: Tue, 31 Jan 2023 13:49:44 +0100 Subject: [PATCH 12/50] chore (refs T31116): Add route param for dpRpc. --- src/lib/DpApi.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib/DpApi.js b/src/lib/DpApi.js index 0083098dc..3bbed17cf 100644 --- a/src/lib/DpApi.js +++ b/src/lib/DpApi.js @@ -73,7 +73,7 @@ dpApi.delete = (url, params = {}, data = {}, options = {}) => doRequest({ method * @param {string} id * @return {Promise} */ -const dpRpc = function (method, parameters, id = null) { +const dpRpc = function (method, parameters, route, id = null) { const data = { jsonrpc: '2.0', method: method, @@ -83,7 +83,7 @@ const dpRpc = function (method, parameters, id = null) { return doRequest({ method: 'post', - url: Routing.generate('rpc_generic_post'), + url: Routing.generate(route), data }) } From ad1afe6b79581b0b0349773cfb2059ebc9083027 Mon Sep 17 00:00:00 2001 From: Ahmad Alahrashi Date: Wed, 1 Feb 2023 10:30:56 +0100 Subject: [PATCH 13/50] chore (refs T31116): move all Routing.generate to core. - change props names. --- src/components/core/DpDashboardTaskCard.vue | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/components/core/DpDashboardTaskCard.vue b/src/components/core/DpDashboardTaskCard.vue index 2a9d4748c..2ace479c8 100644 --- a/src/components/core/DpDashboardTaskCard.vue +++ b/src/components/core/DpDashboardTaskCard.vue @@ -38,22 +38,22 @@ export default { required: true }, - procedureId: { + filterHashUpdatedRoute: { type: String, required: true }, - resourceListRoute: { + procedureId: { type: String, required: true }, - segmentListHashUpdateRoute: { + resourceListRoute: { type: String, required: true }, - segmentsListRoute: { + userFilteredRoute: { type: String, required: true } @@ -68,7 +68,7 @@ export default { computed: { userFilteredSegmentUrl () { - return Routing.generate(this.segmentsListRoute, { procedureId: this.procedureId }) + '/' + this.userHash + return this.userFilteredRoute + '/' + this.userHash } }, @@ -90,7 +90,7 @@ export default { } // Get count of segments assigned to the current user - const segmentUrl = Routing.generate(this.resourceListRoute, { resourceType: 'StatementSegment' }) + const segmentUrl = this.resourceListRoute dpApi.get(segmentUrl, { filter: filterQuery }, { serialize: true }).then(response => { this.assignedSegmentCount = response.data.data.length }) @@ -102,7 +102,7 @@ export default { * redirected response. The redirected response will contain the default filter hash, which can then be extracted * and used to obtain an updated filter hash. */ - dpApi.get(Routing.generate(this.segmentsListRoute, { procedureId: this.procedureId })) + dpApi.get(this.userFilteredRoute) .then(response => { const redirectUrl = response.request.responseURL const splitUrl = redirectUrl.split('/') @@ -115,7 +115,7 @@ export default { } // Get the actual filter hash - const url = Routing.generate(this.segmentListHashUpdateRoute, { queryHash }) + const url = Routing.generate(this.filterHashUpdatedRoute, { queryHash }) dpApi.patch(url, {}, filterData) .then(response => checkResponse(response)) .then(response => { From b6404ac222dd512d2e45ca628642358a3dafc7fc Mon Sep 17 00:00:00 2001 From: Ahmad Alahrashi Date: Wed, 1 Feb 2023 10:34:56 +0100 Subject: [PATCH 14/50] chore (refs T31116): revert changes for dpRpc. - we need to rebuild this function. --- src/lib/DpApi.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib/DpApi.js b/src/lib/DpApi.js index 3bbed17cf..0083098dc 100644 --- a/src/lib/DpApi.js +++ b/src/lib/DpApi.js @@ -73,7 +73,7 @@ dpApi.delete = (url, params = {}, data = {}, options = {}) => doRequest({ method * @param {string} id * @return {Promise} */ -const dpRpc = function (method, parameters, route, id = null) { +const dpRpc = function (method, parameters, id = null) { const data = { jsonrpc: '2.0', method: method, @@ -83,7 +83,7 @@ const dpRpc = function (method, parameters, route, id = null) { return doRequest({ method: 'post', - url: Routing.generate(route), + url: Routing.generate('rpc_generic_post'), data }) } From 0b6cba144685212f64ba963630ca58f01fb75b5d Mon Sep 17 00:00:00 2001 From: Ahmad Alahrashi Date: Wed, 1 Feb 2023 11:33:25 +0100 Subject: [PATCH 15/50] chore (refs T31116): move Routing.generate to core. --- src/components/core/DpRegisterFlyout.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/core/DpRegisterFlyout.vue b/src/components/core/DpRegisterFlyout.vue index c520582a7..0de4a6cc1 100644 --- a/src/components/core/DpRegisterFlyout.vue +++ b/src/components/core/DpRegisterFlyout.vue @@ -15,11 +15,11 @@ From 98fdabd29aad178197656bf276779bc1aff9a054 Mon Sep 17 00:00:00 2001 From: Ahmad Alahrashi Date: Wed, 1 Feb 2023 12:09:09 +0100 Subject: [PATCH 16/50] chore (refs T31116): move Routing.generate to core. --- src/components/core/DpUpload/utils/GetFileIdsByHash.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/core/DpUpload/utils/GetFileIdsByHash.js b/src/components/core/DpUpload/utils/GetFileIdsByHash.js index a35aaf79b..ad05cd589 100644 --- a/src/components/core/DpUpload/utils/GetFileIdsByHash.js +++ b/src/components/core/DpUpload/utils/GetFileIdsByHash.js @@ -9,7 +9,7 @@ import { dpApi } from '../../../../lib' */ function getFileIdsByHash (hashes, route) { return dpApi.get( - Routing.generate(route, { resourceType: 'File' }), + route, { filter: { hasHash: { From ca229db34574c1c29c8598516864b40053468186 Mon Sep 17 00:00:00 2001 From: Ahmad Alahrashi Date: Wed, 1 Feb 2023 12:47:12 +0100 Subject: [PATCH 17/50] chore (refs T31116): move Routing.generate to core. --- src/components/core/DpEditor/DpBoilerPlateModal.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/core/DpEditor/DpBoilerPlateModal.vue b/src/components/core/DpEditor/DpBoilerPlateModal.vue index c0db7c9b9..853414a8c 100644 --- a/src/components/core/DpEditor/DpBoilerPlateModal.vue +++ b/src/components/core/DpEditor/DpBoilerPlateModal.vue @@ -15,7 +15,7 @@
+ :href="boilerplateListRoute"> {{ Translator.trans('boilerplates.edit') }} ({{ Translator.trans('view.leave.hint') }}) Date: Wed, 1 Feb 2023 13:28:05 +0100 Subject: [PATCH 18/50] chore (refs T31116): move Routing.generate to core. --- src/components/core/DpEditor/DpRecommendationModal.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/core/DpEditor/DpRecommendationModal.vue b/src/components/core/DpEditor/DpRecommendationModal.vue index da3fc5a0b..9f0b7be45 100644 --- a/src/components/core/DpEditor/DpRecommendationModal.vue +++ b/src/components/core/DpEditor/DpRecommendationModal.vue @@ -217,7 +217,7 @@ export default { }, fetchSimilarRecommendations () { - const url = Routing.generate(this.similarRecommendationsRoute, { resourceType: 'StatementSegment' }) + const url = this.similarRecommendationsRoute const params = { include: 'parentStatement,parentStatement.procedure', fields: { From d7d1be9918dbce8d6eb8dbf2a90682df845a9850 Mon Sep 17 00:00:00 2001 From: Ahmad Alahrashi Date: Wed, 1 Feb 2023 15:43:07 +0100 Subject: [PATCH 19/50] chore (refs T31116): Add routes prop that contains all routes. --- src/components/core/DpDashboardTaskCard.vue | 27 ++++++++------------- 1 file changed, 10 insertions(+), 17 deletions(-) diff --git a/src/components/core/DpDashboardTaskCard.vue b/src/components/core/DpDashboardTaskCard.vue index 2ace479c8..32e177d98 100644 --- a/src/components/core/DpDashboardTaskCard.vue +++ b/src/components/core/DpDashboardTaskCard.vue @@ -38,24 +38,17 @@ export default { required: true }, - filterHashUpdatedRoute: { - type: String, - required: true + routes: { + type: Object, + required: true, + validator: (prop) => { + return Object.keys(prop).every(key => ['filterHashUpdatedRoute', 'resourceListRoute', 'userFilteredRoute'].includes(key)) + } }, procedureId: { type: String, required: true - }, - - resourceListRoute: { - type: String, - required: true - }, - - userFilteredRoute: { - type: String, - required: true } }, @@ -68,7 +61,7 @@ export default { computed: { userFilteredSegmentUrl () { - return this.userFilteredRoute + '/' + this.userHash + return this.routes.userFilteredRoute + '/' + this.userHash } }, @@ -90,7 +83,7 @@ export default { } // Get count of segments assigned to the current user - const segmentUrl = this.resourceListRoute + const segmentUrl = this.routes.resourceListRoute dpApi.get(segmentUrl, { filter: filterQuery }, { serialize: true }).then(response => { this.assignedSegmentCount = response.data.data.length }) @@ -102,7 +95,7 @@ export default { * redirected response. The redirected response will contain the default filter hash, which can then be extracted * and used to obtain an updated filter hash. */ - dpApi.get(this.userFilteredRoute) + dpApi.get(this.routes.userFilteredRoute) .then(response => { const redirectUrl = response.request.responseURL const splitUrl = redirectUrl.split('/') @@ -115,7 +108,7 @@ export default { } // Get the actual filter hash - const url = Routing.generate(this.filterHashUpdatedRoute, { queryHash }) + const url = Routing.generate(this.routes.filterHashUpdatedRoute, { queryHash }) dpApi.patch(url, {}, filterData) .then(response => checkResponse(response)) .then(response => { From 54d9444421d71c0b47b2410d54e7a6c675323fe6 Mon Sep 17 00:00:00 2001 From: Ahmad Alahrashi Date: Wed, 1 Feb 2023 16:11:01 +0100 Subject: [PATCH 20/50] chore (refs T31116): revert all the changes for DpDashboardTaskCard. - we should move the component to demosplan-core and give it a more specific name, too. --- src/components/core/DpDashboardTaskCard.vue | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/src/components/core/DpDashboardTaskCard.vue b/src/components/core/DpDashboardTaskCard.vue index 32e177d98..7ce55b00c 100644 --- a/src/components/core/DpDashboardTaskCard.vue +++ b/src/components/core/DpDashboardTaskCard.vue @@ -38,14 +38,6 @@ export default { required: true }, - routes: { - type: Object, - required: true, - validator: (prop) => { - return Object.keys(prop).every(key => ['filterHashUpdatedRoute', 'resourceListRoute', 'userFilteredRoute'].includes(key)) - } - }, - procedureId: { type: String, required: true @@ -61,7 +53,7 @@ export default { computed: { userFilteredSegmentUrl () { - return this.routes.userFilteredRoute + '/' + this.userHash + return Routing.generate('dplan_segments_list', { procedureId: this.procedureId }) + '/' + this.userHash } }, @@ -83,7 +75,7 @@ export default { } // Get count of segments assigned to the current user - const segmentUrl = this.routes.resourceListRoute + const segmentUrl = Routing.generate('api_resource_list', { resourceType: 'StatementSegment' }) dpApi.get(segmentUrl, { filter: filterQuery }, { serialize: true }).then(response => { this.assignedSegmentCount = response.data.data.length }) @@ -95,7 +87,7 @@ export default { * redirected response. The redirected response will contain the default filter hash, which can then be extracted * and used to obtain an updated filter hash. */ - dpApi.get(this.routes.userFilteredRoute) + dpApi.get(Routing.generate('dplan_segments_list', { procedureId: this.procedureId })) .then(response => { const redirectUrl = response.request.responseURL const splitUrl = redirectUrl.split('/') @@ -108,7 +100,7 @@ export default { } // Get the actual filter hash - const url = Routing.generate(this.routes.filterHashUpdatedRoute, { queryHash }) + const url = Routing.generate('dplan_rpc_segment_list_query_update', { queryHash }) dpApi.patch(url, {}, filterData) .then(response => checkResponse(response)) .then(response => { From 3784acc6e88264c1de833a9e795db4f7dd0408b7 Mon Sep 17 00:00:00 2001 From: Ahmad Alahrashi Date: Fri, 3 Feb 2023 10:10:23 +0100 Subject: [PATCH 21/50] chore (refs T31116): Change Prop name for edit boilerplate route. - make this prop optional and add condition. --- src/components/core/DpEditor/DpBoilerPlateModal.vue | 13 +++++++++---- src/components/core/DpEditor/DpEditor.vue | 4 ++-- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/components/core/DpEditor/DpBoilerPlateModal.vue b/src/components/core/DpEditor/DpBoilerPlateModal.vue index 853414a8c..c736878d9 100644 --- a/src/components/core/DpEditor/DpBoilerPlateModal.vue +++ b/src/components/core/DpEditor/DpBoilerPlateModal.vue @@ -14,8 +14,9 @@ @boilerplate-text-added="addBoilerplateText" />
+ v-if="boilerplateEditViewRoute" + class="weight--bold font-size-small" + :href="boilerplateEditViewRoute"> {{ Translator.trans('boilerplates.edit') }} ({{ Translator.trans('view.leave.hint') }}) @@ -568,7 +568,7 @@ export default { }, /** - * Needed to get the 'DemosPlan_procedure_boilerplate_list' Route, when DpEditor has boilerPlate attr. + * Needed to get the Route, when DpEditor has boilerPlate attr. */ boilerplateListRoute: { type: String, From 4c1705776448178222bcf3e849148583d3150023 Mon Sep 17 00:00:00 2001 From: Ahmad Alahrashi Date: Fri, 3 Feb 2023 12:11:26 +0100 Subject: [PATCH 22/50] chore (refs T31116): add separate props to parent prop (routes). --- src/components/core/DpEditor/DpEditor.vue | 50 +++++++++-------------- 1 file changed, 19 insertions(+), 31 deletions(-) diff --git a/src/components/core/DpEditor/DpEditor.vue b/src/components/core/DpEditor/DpEditor.vue index f23fd843d..d5f7e6617 100644 --- a/src/components/core/DpEditor/DpEditor.vue +++ b/src/components/core/DpEditor/DpEditor.vue @@ -8,7 +8,7 @@ v-if="toolbar.boilerPlate && boilerPlateEnabled" ref="boilerPlateModal" :editor-id="editorId" - :boilerplate-edit-view-route="boilerplateListRoute" + :boilerplate-edit-view-route="routes.boilerplateListRoute" :procedure-id="procedureId" :boiler-plate-type="toolbar.boilerPlate" @insertBoilerPlate="text => handleInsertText(text)" /> @@ -19,7 +19,7 @@ @@ -29,7 +29,7 @@ @insert-recommendation="text => appendText(text)" :procedure-id="procedureId" :segment-id="segmentId" - :similar-recommendations-route="similarRecommendationsRoute" /> + :similar-recommendations-route="routes.similarRecommendationsRoute" />
{ + return Object.keys(prop).every(key => [ + 'boilerplateListRoute', + 'fileRoute', + 'similarRecommendationsRoute' + ].includes(key)) + } + }, + segmentId: { type: String, required: false, @@ -616,15 +613,6 @@ export default { default: false }, - /** - * Needed to get the 'api_resource_list' Route, when DpEditor has recommendationButton attr. - */ - similarRecommendationsRoute: { - type: String, - required: false, - default: '' - }, - /** * Pass in an Array of suggestions if you would like to use the suggestion plugin in tiptap. */ @@ -936,7 +924,7 @@ export default { const imageHash = placeholder.substr(7, 36) const imageWidth = placeholder.match(/width=(\d*?)&/)[1] const imageHeight = placeholder.match(/height=(\d*?)$/)[1] - return `${altText}` + return `${altText}` }) } catch (e) { return text From 2783e7d3955aa18d70de0d0bcaa38d941639aacf Mon Sep 17 00:00:00 2001 From: Ahmad Alahrashi Date: Fri, 3 Feb 2023 12:48:12 +0100 Subject: [PATCH 23/50] chore (refs T31116): Add parent prop (routes) for separate props. --- src/components/core/DpRegisterFlyout.vue | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/src/components/core/DpRegisterFlyout.vue b/src/components/core/DpRegisterFlyout.vue index 0de4a6cc1..66e99d385 100644 --- a/src/components/core/DpRegisterFlyout.vue +++ b/src/components/core/DpRegisterFlyout.vue @@ -15,11 +15,11 @@ @@ -36,14 +36,15 @@ export default { }, props: { - citizenRegisterFormRoute: { - type: String, - required: true - }, - - orgaRegisterFormRoute: { - type: String, - required: true + routes: { + type: Object, + required: true, + validator: (prop) => { + return Object.keys(prop).every(key => [ + 'citizenRegisterFormRoute', + 'orgaRegisterFormRoute' + ].includes(key)) + } } }, From f99884798ab653af69d4bee4c12cfdfe54cd489e Mon Sep 17 00:00:00 2001 From: Ahmad Alahrashi Date: Wed, 8 Feb 2023 09:04:23 +0100 Subject: [PATCH 24/50] chore (refs T31116): WIP: minor improvements JS code, add provide inject function. --- src/components/core/DpEditor/DpUploadModal.vue | 5 +++-- src/components/core/DpUpload/DpUploadFiles.vue | 16 +++++++++++++--- src/components/core/DpUpload/DpUploadedFile.vue | 9 +++------ .../core/DpUpload/DpUploadedFileList.vue | 6 ------ 4 files changed, 19 insertions(+), 17 deletions(-) diff --git a/src/components/core/DpEditor/DpUploadModal.vue b/src/components/core/DpEditor/DpUploadModal.vue index 903f39aa8..ec7d670c7 100644 --- a/src/components/core/DpEditor/DpUploadModal.vue +++ b/src/components/core/DpEditor/DpUploadModal.vue @@ -66,8 +66,9 @@ export default { props: { fileRoute: { - type: String, - required: true + type: Object, + required: true, + default: () => ({}) } }, diff --git a/src/components/core/DpUpload/DpUploadFiles.vue b/src/components/core/DpUpload/DpUploadFiles.vue index 199697f3b..1f59161d1 100644 --- a/src/components/core/DpUpload/DpUploadFiles.vue +++ b/src/components/core/DpUpload/DpUploadFiles.vue @@ -22,7 +22,6 @@ --> @@ -59,6 +58,12 @@ export default { mixins: [prefixClassMixin], + provide () { + return { + getFile: this.getFile + } + }, + props: { /** * Array of mimeTypes or a defined preset as String @@ -90,8 +95,9 @@ export default { }, fileRoute: { - type: String, - required: true + type: Object, + required: true, + default: () => ({}) }, id: { @@ -228,6 +234,10 @@ export default { }) }, + getFile (fileHash) { + return this.fileRoute.router(this.fileRoute.path, { hash: fileHash }) + }, + handleRemove (file) { this.removeFile(file) this.$emit('file-remove', file) diff --git a/src/components/core/DpUpload/DpUploadedFile.vue b/src/components/core/DpUpload/DpUploadedFile.vue index 92ba69cbb..55a4db81c 100644 --- a/src/components/core/DpUpload/DpUploadedFile.vue +++ b/src/components/core/DpUpload/DpUploadedFile.vue @@ -8,7 +8,7 @@ @@ -37,17 +37,14 @@ import { prefixClassMixin } from '../../../mixins' export default { name: 'DpUploadedFile', + inject: ['getFile'], + mixins: [prefixClassMixin], props: { fileString: { type: String, required: true - }, - - fileRoute: { - type: String, - required: true } }, diff --git a/src/components/core/DpUpload/DpUploadedFileList.vue b/src/components/core/DpUpload/DpUploadedFileList.vue index cd1c9b5c9..2c086d7d9 100644 --- a/src/components/core/DpUpload/DpUploadedFileList.vue +++ b/src/components/core/DpUpload/DpUploadedFileList.vue @@ -7,7 +7,6 @@ @@ -32,11 +31,6 @@ export default { type: Array, required: false, default: () => ([]) - }, - - fileRoute: { - type: String, - required: true } }, From 551eeab94c653ad95534344dd7214cb4f6f1267d Mon Sep 17 00:00:00 2001 From: Ahmad Alahrashi Date: Wed, 8 Feb 2023 11:58:30 +0100 Subject: [PATCH 25/50] chore (refs T31116): Changes in package.json --- package.json | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index a113a6f2f..d2ac9a85a 100644 --- a/package.json +++ b/package.json @@ -29,7 +29,10 @@ "vue-omnibox": "^0.3.7", "vue-sliding-pagination": "^1.3.2", "vuedraggable": "^2.24.3", - "vuex": "^3.6.2" + "vuex": "^3.6.2", + "webpack": "^5.75.0", + "webpack-cli": "^5.0.0", + "style-dictionary": "^3.7.1" }, "devDependencies": { "@babel/core": "^7.20.2", @@ -52,14 +55,11 @@ "path": "^0.12.7", "postcss": "^8.4.19", "postcss-loader": "^7.0.1", - "style-dictionary": "^3.7.1", "style-loader": "^3.3.1", "tailwindcss": "^3.2.1", "vue-loader": "^15", "vue-template-compiler": "^2.7.14", - "webpack": "^5.75.0", - "webpack-bundle-analyzer": "^4.7.0", - "webpack-cli": "^5.0.0" + "webpack-bundle-analyzer": "^4.7.0" }, "peerDependencies": { "vue": "^2.7.14" @@ -68,7 +68,7 @@ "build-css": "tailwindcss -i ./style/index.css -o ./style/style.css", "build-storybook": "build-storybook", "build-tokens": "node buildTokens.js", - "prepack": "yarn build && yarn build-tokens", + "postinstall": "yarn build && yarn build-tokens", "storybook": "start-storybook -p 6006", "build": "yarn build:prod", "build:dev": "webpack --mode=development", From 3a516709fe553557bf5f50e0595d13f66207f537 Mon Sep 17 00:00:00 2001 From: Ahmad Alahrashi Date: Wed, 8 Feb 2023 12:16:08 +0100 Subject: [PATCH 26/50] chore (refs T31116): minor improvements JS. --- src/components/core/DpEditor/DpEditor.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/core/DpEditor/DpEditor.vue b/src/components/core/DpEditor/DpEditor.vue index 8d2ce679b..959e44a87 100644 --- a/src/components/core/DpEditor/DpEditor.vue +++ b/src/components/core/DpEditor/DpEditor.vue @@ -585,7 +585,7 @@ export default { */ routes: { type: Object, - required: true, + default: () => ({}), validator: (prop) => { return Object.keys(prop).every(key => [ 'boilerplateListRoute', From 462e0e5bea3da4d37244963a829fc4ed8853ca8e Mon Sep 17 00:00:00 2001 From: Ahmad Alahrashi Date: Wed, 8 Feb 2023 12:23:41 +0100 Subject: [PATCH 27/50] chore (refs T31116): minor improvements JS. --- src/components/core/DpEditor/DpEditor.vue | 1 + 1 file changed, 1 insertion(+) diff --git a/src/components/core/DpEditor/DpEditor.vue b/src/components/core/DpEditor/DpEditor.vue index 959e44a87..d7fa69c0d 100644 --- a/src/components/core/DpEditor/DpEditor.vue +++ b/src/components/core/DpEditor/DpEditor.vue @@ -585,6 +585,7 @@ export default { */ routes: { type: Object, + required: false, default: () => ({}), validator: (prop) => { return Object.keys(prop).every(key => [ From 1bb59b6d7d06ab02b03b886a6f6cda661e657c48 Mon Sep 17 00:00:00 2001 From: Ahmad Alahrashi Date: Wed, 8 Feb 2023 15:47:43 +0100 Subject: [PATCH 28/50] chore (refs T31116): minor improvements JS. --- src/components/core/DpUpload/DpUploadFiles.vue | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/components/core/DpUpload/DpUploadFiles.vue b/src/components/core/DpUpload/DpUploadFiles.vue index 1f59161d1..9a4c18958 100644 --- a/src/components/core/DpUpload/DpUploadFiles.vue +++ b/src/components/core/DpUpload/DpUploadFiles.vue @@ -60,7 +60,7 @@ export default { provide () { return { - getFile: this.getFile + getFile: this.fileRoute } }, @@ -95,7 +95,7 @@ export default { }, fileRoute: { - type: Object, + type: Function, required: true, default: () => ({}) }, @@ -234,10 +234,6 @@ export default { }) }, - getFile (fileHash) { - return this.fileRoute.router(this.fileRoute.path, { hash: fileHash }) - }, - handleRemove (file) { this.removeFile(file) this.$emit('file-remove', file) From 7fb3fad809c853346049f7f34129690289e68ddf Mon Sep 17 00:00:00 2001 From: Ahmad Alahrashi Date: Wed, 8 Feb 2023 16:14:11 +0100 Subject: [PATCH 29/50] chore (refs T31116): rename prop for upload file & minor improvements JS. --- src/components/core/DpEditor/DpEditor.vue | 6 +++--- src/components/core/DpEditor/DpUploadModal.vue | 8 ++++---- src/components/core/DpUpload/DpUploadFiles.vue | 4 ++-- src/components/core/DpUpload/DpUploadedFile.vue | 4 ++-- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/components/core/DpEditor/DpEditor.vue b/src/components/core/DpEditor/DpEditor.vue index d7fa69c0d..47dbfc22e 100644 --- a/src/components/core/DpEditor/DpEditor.vue +++ b/src/components/core/DpEditor/DpEditor.vue @@ -19,7 +19,7 @@ @@ -590,7 +590,7 @@ export default { validator: (prop) => { return Object.keys(prop).every(key => [ 'boilerplateListRoute', - 'fileRoute', + 'getFileByHash', 'similarRecommendationsRoute' ].includes(key)) } @@ -926,7 +926,7 @@ export default { const imageHash = placeholder.substr(7, 36) const imageWidth = placeholder.match(/width=(\d*?)&/)[1] const imageHeight = placeholder.match(/height=(\d*?)$/)[1] - return `${altText}` + return `${altText}` }) } catch (e) { return text diff --git a/src/components/core/DpEditor/DpUploadModal.vue b/src/components/core/DpEditor/DpUploadModal.vue index ec7d670c7..fe15d8689 100644 --- a/src/components/core/DpEditor/DpUploadModal.vue +++ b/src/components/core/DpEditor/DpUploadModal.vue @@ -17,7 +17,7 @@ ({}) } @@ -99,7 +99,7 @@ export default { }, setFile ({ hash }) { - this.fileUrl = Routing.generate(this.fileRoute, { hash: hash }) + this.fileUrl = this.getFileByHash(hash) // Force-update the component so that DpModal updates and therefore check for new focusable elements this.$forceUpdate() }, diff --git a/src/components/core/DpUpload/DpUploadFiles.vue b/src/components/core/DpUpload/DpUploadFiles.vue index 9a4c18958..22b5f6ae4 100644 --- a/src/components/core/DpUpload/DpUploadFiles.vue +++ b/src/components/core/DpUpload/DpUploadFiles.vue @@ -60,7 +60,7 @@ export default { provide () { return { - getFile: this.fileRoute + getFileByHash: this.getFileByHash } }, @@ -94,7 +94,7 @@ export default { default: false }, - fileRoute: { + getFileByHash: { type: Function, required: true, default: () => ({}) diff --git a/src/components/core/DpUpload/DpUploadedFile.vue b/src/components/core/DpUpload/DpUploadedFile.vue index 55a4db81c..c3589e006 100644 --- a/src/components/core/DpUpload/DpUploadedFile.vue +++ b/src/components/core/DpUpload/DpUploadedFile.vue @@ -8,7 +8,7 @@ @@ -37,7 +37,7 @@ import { prefixClassMixin } from '../../../mixins' export default { name: 'DpUploadedFile', - inject: ['getFile'], + inject: ['getFileByHash'], mixins: [prefixClassMixin], From 82e69eca061c74b790061675ec04627fcee39ebe Mon Sep 17 00:00:00 2001 From: Ahmad Alahrashi Date: Thu, 9 Feb 2023 09:22:24 +0100 Subject: [PATCH 30/50] chore (refs T31116): WIP: minor improvements in route for DpAutocomplete. --- src/components/core/DpAutocomplete.vue | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/components/core/DpAutocomplete.vue b/src/components/core/DpAutocomplete.vue index 7f7c6cf5c..95a675669 100644 --- a/src/components/core/DpAutocomplete.vue +++ b/src/components/core/DpAutocomplete.vue @@ -70,8 +70,9 @@ export default { }, route: { - type: String, - required: true + type: Function, + required: true, + default: () => ({}) }, value: { @@ -110,7 +111,7 @@ export default { async fetchOptions (searchString) { this.isLoading = true try { - const response = await dpApi.get(Routing.generate(this.route, { ...this.additionalRouteParams, [this.queryParam]: searchString })) + const response = await dpApi.get(this.route({ ...this.additionalRouteParams, [this.queryParam]: searchString })) // Only emit results that match the current search -> prevents race conditions if (this.currentQuerry === searchString) this.$emit('search-changed', response) this.isLoading = false From ed7308be381b01738fca4d4d24a4df696e6d1a61 Mon Sep 17 00:00:00 2001 From: Ahmad Alahrashi Date: Thu, 9 Feb 2023 14:05:33 +0100 Subject: [PATCH 31/50] chore (refs T31116): minor improvements in route for DpAutocomplete. --- src/components/core/DpAutocomplete.vue | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/components/core/DpAutocomplete.vue b/src/components/core/DpAutocomplete.vue index 95a675669..29cb83022 100644 --- a/src/components/core/DpAutocomplete.vue +++ b/src/components/core/DpAutocomplete.vue @@ -63,12 +63,6 @@ export default { default: () => Translator.trans('search') }, - queryParam: { - type: String, - required: false, - default: 'query' - }, - route: { type: Function, required: true, @@ -111,7 +105,8 @@ export default { async fetchOptions (searchString) { this.isLoading = true try { - const response = await dpApi.get(this.route({ ...this.additionalRouteParams, [this.queryParam]: searchString })) + const route = this.route(searchString) + const response = await dpApi.get(route) // Only emit results that match the current search -> prevents race conditions if (this.currentQuerry === searchString) this.$emit('search-changed', response) this.isLoading = false From d20932a02eaae5ea6e43ff75590f4a45bff25d8d Mon Sep 17 00:00:00 2001 From: ahmad-demos <59571234+ahmad-demos@users.noreply.github.com> Date: Fri, 10 Feb 2023 09:13:06 +0100 Subject: [PATCH 32/50] Update src/components/core/DpEditor/DpBoilerPlateModal.vue Co-authored-by: hwiem <40487668+hwiem@users.noreply.github.com> --- src/components/core/DpEditor/DpBoilerPlateModal.vue | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/components/core/DpEditor/DpBoilerPlateModal.vue b/src/components/core/DpEditor/DpBoilerPlateModal.vue index c736878d9..b9d074ba3 100644 --- a/src/components/core/DpEditor/DpBoilerPlateModal.vue +++ b/src/components/core/DpEditor/DpBoilerPlateModal.vue @@ -61,7 +61,8 @@ export default { }, /** - * Needed to get the Route, when DpEditor has boilerPlate attr. + * Route to a view that allows editing the available boilerplates + * Displayed as a link at the bottom of the modal */ boilerplateEditViewRoute: { required: false, From 9fcdfbcee03490641392247f6cbe596b75efa7b8 Mon Sep 17 00:00:00 2001 From: ahmad-demos <59571234+ahmad-demos@users.noreply.github.com> Date: Fri, 10 Feb 2023 09:13:22 +0100 Subject: [PATCH 33/50] Update src/components/core/DpEditor/DpEditor.vue Co-authored-by: hwiem <40487668+hwiem@users.noreply.github.com> --- src/components/core/DpEditor/DpEditor.vue | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/components/core/DpEditor/DpEditor.vue b/src/components/core/DpEditor/DpEditor.vue index 47dbfc22e..c775ce274 100644 --- a/src/components/core/DpEditor/DpEditor.vue +++ b/src/components/core/DpEditor/DpEditor.vue @@ -581,7 +581,14 @@ export default { }, /** - * Needed to get the Route, when any of these Props are enabled in the DpEditor + * boilerplateEditViewRoute: (Optional) route to a view that allows editing + * boilerplates. Displayed as a link at the bottom of the boilerplate modal, if + * toolbar.boilerplate is set + * getFileByHash: (Required) function that receives a file hash as parameter + * and returns a route to that file. Used for displaying images. + * similarRecommendationsRoute: (Optional) route to fetch similar + * recommendations (needed if toolbar.recommendationButton is set to + * true) */ routes: { type: Object, From cd139e8dfdd2aa5790caa722af1f2e11d3bde19c Mon Sep 17 00:00:00 2001 From: ahmad-demos <59571234+ahmad-demos@users.noreply.github.com> Date: Fri, 10 Feb 2023 09:15:40 +0100 Subject: [PATCH 34/50] Update src/components/core/DpEditor/DpEditor.vue Co-authored-by: salisdemos <40487461+salisdemos@users.noreply.github.com> --- src/components/core/DpEditor/DpEditor.vue | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/components/core/DpEditor/DpEditor.vue b/src/components/core/DpEditor/DpEditor.vue index c775ce274..acfb009ef 100644 --- a/src/components/core/DpEditor/DpEditor.vue +++ b/src/components/core/DpEditor/DpEditor.vue @@ -595,11 +595,10 @@ export default { required: false, default: () => ({}), validator: (prop) => { - return Object.keys(prop).every(key => [ - 'boilerplateListRoute', - 'getFileByHash', - 'similarRecommendationsRoute' - ].includes(key)) + return typeof prop.boilerplateListRoute === 'string' + && typeof prop.getFileByHash === 'function' + && typeof prop.similarRecommendationsRoute === 'string' + } } }, From ecb50ceb746dc5321dbb0b288a5fd6cb52642848 Mon Sep 17 00:00:00 2001 From: Ahmad Alahrashi Date: Fri, 10 Feb 2023 09:41:42 +0100 Subject: [PATCH 35/50] chore (refs T31116): rename prop to make that clear, because prop as function. --- src/components/core/DpAutocomplete.vue | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/components/core/DpAutocomplete.vue b/src/components/core/DpAutocomplete.vue index 29cb83022..0fffb974f 100644 --- a/src/components/core/DpAutocomplete.vue +++ b/src/components/core/DpAutocomplete.vue @@ -63,10 +63,9 @@ export default { default: () => Translator.trans('search') }, - route: { + routeGenerator: { type: Function, - required: true, - default: () => ({}) + required: true }, value: { @@ -105,7 +104,7 @@ export default { async fetchOptions (searchString) { this.isLoading = true try { - const route = this.route(searchString) + const route = this.routeGenerator(searchString) const response = await dpApi.get(route) // Only emit results that match the current search -> prevents race conditions if (this.currentQuerry === searchString) this.$emit('search-changed', response) From 9c74850fed83b906efbf4365208d9e22f7a5c61b Mon Sep 17 00:00:00 2001 From: Ahmad Alahrashi Date: Fri, 10 Feb 2023 09:45:14 +0100 Subject: [PATCH 36/50] chore (refs T31116): remove default value, when prop required is true. --- src/components/core/DpEditor/DpUploadModal.vue | 3 +-- src/components/core/DpUpload/DpUploadFiles.vue | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/components/core/DpEditor/DpUploadModal.vue b/src/components/core/DpEditor/DpUploadModal.vue index fe15d8689..ace544463 100644 --- a/src/components/core/DpEditor/DpUploadModal.vue +++ b/src/components/core/DpEditor/DpUploadModal.vue @@ -67,8 +67,7 @@ export default { props: { getFileByHash: { type: Function, - required: true, - default: () => ({}) + required: true } }, diff --git a/src/components/core/DpUpload/DpUploadFiles.vue b/src/components/core/DpUpload/DpUploadFiles.vue index 22b5f6ae4..656609586 100644 --- a/src/components/core/DpUpload/DpUploadFiles.vue +++ b/src/components/core/DpUpload/DpUploadFiles.vue @@ -96,8 +96,7 @@ export default { getFileByHash: { type: Function, - required: true, - default: () => ({}) + required: true }, id: { From 8f7bf809676f0677c97b2d000480d1009597c881 Mon Sep 17 00:00:00 2001 From: Ahmad Alahrashi Date: Fri, 10 Feb 2023 10:02:53 +0100 Subject: [PATCH 37/50] chore (refs T31116): rename boilerplate route prop. --- src/components/core/DpEditor/DpEditor.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/core/DpEditor/DpEditor.vue b/src/components/core/DpEditor/DpEditor.vue index acfb009ef..72a003b31 100644 --- a/src/components/core/DpEditor/DpEditor.vue +++ b/src/components/core/DpEditor/DpEditor.vue @@ -8,7 +8,7 @@ v-if="toolbar.boilerPlate && boilerPlateEnabled" ref="boilerPlateModal" :editor-id="editorId" - :boilerplate-edit-view-route="routes.boilerplateListRoute" + :boilerplate-edit-view-route="routes.boilerplateEditViewRoute" :procedure-id="procedureId" :boiler-plate-type="toolbar.boilerPlate" @insertBoilerPlate="text => handleInsertText(text)" /> @@ -595,7 +595,7 @@ export default { required: false, default: () => ({}), validator: (prop) => { - return typeof prop.boilerplateListRoute === 'string' + return typeof prop.boilerplateEditViewRoute === 'string' && typeof prop.getFileByHash === 'function' && typeof prop.similarRecommendationsRoute === 'string' } From 031f9e69bd8f952d615f8270755abb6dcefa813c Mon Sep 17 00:00:00 2001 From: Ahmad Alahrashi Date: Fri, 10 Feb 2023 10:06:45 +0100 Subject: [PATCH 38/50] chore (refs T31116): remove unused prop. - use this prop value in routeGenerator function as params. --- src/components/core/DpAutocomplete.vue | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/components/core/DpAutocomplete.vue b/src/components/core/DpAutocomplete.vue index 0fffb974f..eea1f5b22 100644 --- a/src/components/core/DpAutocomplete.vue +++ b/src/components/core/DpAutocomplete.vue @@ -33,12 +33,6 @@ export default { mixins: [prefixClassMixin], props: { - additionalRouteParams: { - type: Object, - required: false, - default: () => ({}) - }, - height: { type: String, required: false, From 39b6d093e7a3df509d3f87cee5888bac691456e0 Mon Sep 17 00:00:00 2001 From: Ahmad Alahrashi Date: Fri, 10 Feb 2023 10:12:28 +0100 Subject: [PATCH 39/50] chore (refs T31116): add required true to route prop. --- src/components/core/DpEditor/DpEditor.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/core/DpEditor/DpEditor.vue b/src/components/core/DpEditor/DpEditor.vue index 72a003b31..a42ad2444 100644 --- a/src/components/core/DpEditor/DpEditor.vue +++ b/src/components/core/DpEditor/DpEditor.vue @@ -592,7 +592,7 @@ export default { */ routes: { type: Object, - required: false, + required: true, default: () => ({}), validator: (prop) => { return typeof prop.boilerplateEditViewRoute === 'string' From db654ecf07ac1e708303ad7c9e37f5d912ddb016 Mon Sep 17 00:00:00 2001 From: Ahmad Alahrashi Date: Fri, 10 Feb 2023 10:19:39 +0100 Subject: [PATCH 40/50] chore (refs T31116): WIP: revert changes in validator. --- src/components/core/DpEditor/DpEditor.vue | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/components/core/DpEditor/DpEditor.vue b/src/components/core/DpEditor/DpEditor.vue index a42ad2444..687107a5a 100644 --- a/src/components/core/DpEditor/DpEditor.vue +++ b/src/components/core/DpEditor/DpEditor.vue @@ -595,10 +595,11 @@ export default { required: true, default: () => ({}), validator: (prop) => { - return typeof prop.boilerplateEditViewRoute === 'string' - && typeof prop.getFileByHash === 'function' - && typeof prop.similarRecommendationsRoute === 'string' - } + return Object.keys(prop).every(key => [ + 'boilerplateEditViewRoute', + 'getFileByHash', + 'similarRecommendationsRoute' + ].includes(key)) } }, From 391f33bcc367c31bd0208663b2f5fe4b8831af71 Mon Sep 17 00:00:00 2001 From: Ahmad Alahrashi Date: Fri, 10 Feb 2023 10:22:47 +0100 Subject: [PATCH 41/50] chore (refs T31116): WIP: revert changes in required. --- src/components/core/DpEditor/DpEditor.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/core/DpEditor/DpEditor.vue b/src/components/core/DpEditor/DpEditor.vue index 687107a5a..9ad418242 100644 --- a/src/components/core/DpEditor/DpEditor.vue +++ b/src/components/core/DpEditor/DpEditor.vue @@ -592,7 +592,7 @@ export default { */ routes: { type: Object, - required: true, + required: false, default: () => ({}), validator: (prop) => { return Object.keys(prop).every(key => [ From 57ffba68cc397f7514cc6717b85044fc8c7f0fb9 Mon Sep 17 00:00:00 2001 From: Ahmad Alahrashi Date: Fri, 10 Feb 2023 11:30:02 +0100 Subject: [PATCH 42/50] chore (refs T31116): update Changelog. --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index f7a9962e7..ad61bfcef 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,9 @@ # Changelog ## UNRELEASED +### changed +- ([#91](https://github.com/demos-europe/demosplan-ui/pull/91)) Pass routes as props ([@ahmad-demos](https://github.com/ahmad-demos)) + ## v0.0.9 - 2023-01-23 From e96471b409aa90b0ddfbf9c04354f315950bd8fc Mon Sep 17 00:00:00 2001 From: ahmad-demos <59571234+ahmad-demos@users.noreply.github.com> Date: Fri, 10 Feb 2023 11:37:24 +0100 Subject: [PATCH 43/50] Update CHANGELOG.md Co-authored-by: hwiem <40487668+hwiem@users.noreply.github.com> --- CHANGELOG.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ad61bfcef..636bece49 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,8 @@ # Changelog ## UNRELEASED -### changed + +### Changed - ([#91](https://github.com/demos-europe/demosplan-ui/pull/91)) Pass routes as props ([@ahmad-demos](https://github.com/ahmad-demos)) From 61dec86956bb8021364a51e32d6df0d9f7e672c0 Mon Sep 17 00:00:00 2001 From: Ahmad Alahrashi Date: Fri, 10 Feb 2023 11:42:20 +0100 Subject: [PATCH 44/50] chore (refs T31116): revert all changes in DpRegisterFlyout. - because we move this component to core. --- src/components/core/DpRegisterFlyout.vue | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/src/components/core/DpRegisterFlyout.vue b/src/components/core/DpRegisterFlyout.vue index 66e99d385..391fb43d4 100644 --- a/src/components/core/DpRegisterFlyout.vue +++ b/src/components/core/DpRegisterFlyout.vue @@ -15,11 +15,11 @@ @@ -35,19 +35,6 @@ export default { DpFlyout }, - props: { - routes: { - type: Object, - required: true, - validator: (prop) => { - return Object.keys(prop).every(key => [ - 'citizenRegisterFormRoute', - 'orgaRegisterFormRoute' - ].includes(key)) - } - } - }, - mounted () { /* * The placeholder element is shown until all javascript has been loaded From 587338020d7c3175e3ba8f092362f5343bb07f18 Mon Sep 17 00:00:00 2001 From: Ahmad Alahrashi Date: Fri, 10 Feb 2023 12:41:50 +0100 Subject: [PATCH 45/50] chore (refs T31116): revert all changes in package.json --- package.json | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index d2ac9a85a..a113a6f2f 100644 --- a/package.json +++ b/package.json @@ -29,10 +29,7 @@ "vue-omnibox": "^0.3.7", "vue-sliding-pagination": "^1.3.2", "vuedraggable": "^2.24.3", - "vuex": "^3.6.2", - "webpack": "^5.75.0", - "webpack-cli": "^5.0.0", - "style-dictionary": "^3.7.1" + "vuex": "^3.6.2" }, "devDependencies": { "@babel/core": "^7.20.2", @@ -55,11 +52,14 @@ "path": "^0.12.7", "postcss": "^8.4.19", "postcss-loader": "^7.0.1", + "style-dictionary": "^3.7.1", "style-loader": "^3.3.1", "tailwindcss": "^3.2.1", "vue-loader": "^15", "vue-template-compiler": "^2.7.14", - "webpack-bundle-analyzer": "^4.7.0" + "webpack": "^5.75.0", + "webpack-bundle-analyzer": "^4.7.0", + "webpack-cli": "^5.0.0" }, "peerDependencies": { "vue": "^2.7.14" @@ -68,7 +68,7 @@ "build-css": "tailwindcss -i ./style/index.css -o ./style/style.css", "build-storybook": "build-storybook", "build-tokens": "node buildTokens.js", - "postinstall": "yarn build && yarn build-tokens", + "prepack": "yarn build && yarn build-tokens", "storybook": "start-storybook -p 6006", "build": "yarn build:prod", "build:dev": "webpack --mode=development", From 3f860883448a07a6d8a41c4c6f163e9f7e35cedf Mon Sep 17 00:00:00 2001 From: Ahmad Alahrashi Date: Fri, 10 Feb 2023 13:27:06 +0100 Subject: [PATCH 46/50] chore (refs T31116): WIP: make routes required as true. - edit in package.json to test the changes in core. --- package.json | 12 ++++++------ src/components/core/DpEditor/DpEditor.vue | 3 +-- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/package.json b/package.json index a113a6f2f..d2ac9a85a 100644 --- a/package.json +++ b/package.json @@ -29,7 +29,10 @@ "vue-omnibox": "^0.3.7", "vue-sliding-pagination": "^1.3.2", "vuedraggable": "^2.24.3", - "vuex": "^3.6.2" + "vuex": "^3.6.2", + "webpack": "^5.75.0", + "webpack-cli": "^5.0.0", + "style-dictionary": "^3.7.1" }, "devDependencies": { "@babel/core": "^7.20.2", @@ -52,14 +55,11 @@ "path": "^0.12.7", "postcss": "^8.4.19", "postcss-loader": "^7.0.1", - "style-dictionary": "^3.7.1", "style-loader": "^3.3.1", "tailwindcss": "^3.2.1", "vue-loader": "^15", "vue-template-compiler": "^2.7.14", - "webpack": "^5.75.0", - "webpack-bundle-analyzer": "^4.7.0", - "webpack-cli": "^5.0.0" + "webpack-bundle-analyzer": "^4.7.0" }, "peerDependencies": { "vue": "^2.7.14" @@ -68,7 +68,7 @@ "build-css": "tailwindcss -i ./style/index.css -o ./style/style.css", "build-storybook": "build-storybook", "build-tokens": "node buildTokens.js", - "prepack": "yarn build && yarn build-tokens", + "postinstall": "yarn build && yarn build-tokens", "storybook": "start-storybook -p 6006", "build": "yarn build:prod", "build:dev": "webpack --mode=development", diff --git a/src/components/core/DpEditor/DpEditor.vue b/src/components/core/DpEditor/DpEditor.vue index 9ad418242..bbb74a33b 100644 --- a/src/components/core/DpEditor/DpEditor.vue +++ b/src/components/core/DpEditor/DpEditor.vue @@ -592,8 +592,7 @@ export default { */ routes: { type: Object, - required: false, - default: () => ({}), + required: true, validator: (prop) => { return Object.keys(prop).every(key => [ 'boilerplateEditViewRoute', From 8c7cfabf663ff18854d886582b5b03ff9cf2a2e7 Mon Sep 17 00:00:00 2001 From: Ahmad Alahrashi Date: Fri, 10 Feb 2023 14:05:23 +0100 Subject: [PATCH 47/50] chore (refs T31116): minor improvements in routes prop condition. --- src/components/core/DpEditor/DpEditor.vue | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/core/DpEditor/DpEditor.vue b/src/components/core/DpEditor/DpEditor.vue index bbb74a33b..2bf7f8308 100644 --- a/src/components/core/DpEditor/DpEditor.vue +++ b/src/components/core/DpEditor/DpEditor.vue @@ -5,7 +5,7 @@ :class="prefixClass('lbl__hint')" v-cleanhtml="counterText" /> Date: Fri, 10 Feb 2023 15:32:40 +0100 Subject: [PATCH 48/50] chore (refs T31116): revert required false for routes prop. --- src/components/core/DpEditor/DpEditor.vue | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/components/core/DpEditor/DpEditor.vue b/src/components/core/DpEditor/DpEditor.vue index 2bf7f8308..9ad418242 100644 --- a/src/components/core/DpEditor/DpEditor.vue +++ b/src/components/core/DpEditor/DpEditor.vue @@ -5,7 +5,7 @@ :class="prefixClass('lbl__hint')" v-cleanhtml="counterText" /> ({}), validator: (prop) => { return Object.keys(prop).every(key => [ 'boilerplateEditViewRoute', From a4221b334ca9d377eb1728c3aad8a9463c86349e Mon Sep 17 00:00:00 2001 From: Ahmad Alahrashi Date: Mon, 13 Feb 2023 09:56:36 +0100 Subject: [PATCH 49/50] chore (refs T31116): revert package.json --- package.json | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index d2ac9a85a..a113a6f2f 100644 --- a/package.json +++ b/package.json @@ -29,10 +29,7 @@ "vue-omnibox": "^0.3.7", "vue-sliding-pagination": "^1.3.2", "vuedraggable": "^2.24.3", - "vuex": "^3.6.2", - "webpack": "^5.75.0", - "webpack-cli": "^5.0.0", - "style-dictionary": "^3.7.1" + "vuex": "^3.6.2" }, "devDependencies": { "@babel/core": "^7.20.2", @@ -55,11 +52,14 @@ "path": "^0.12.7", "postcss": "^8.4.19", "postcss-loader": "^7.0.1", + "style-dictionary": "^3.7.1", "style-loader": "^3.3.1", "tailwindcss": "^3.2.1", "vue-loader": "^15", "vue-template-compiler": "^2.7.14", - "webpack-bundle-analyzer": "^4.7.0" + "webpack": "^5.75.0", + "webpack-bundle-analyzer": "^4.7.0", + "webpack-cli": "^5.0.0" }, "peerDependencies": { "vue": "^2.7.14" @@ -68,7 +68,7 @@ "build-css": "tailwindcss -i ./style/index.css -o ./style/style.css", "build-storybook": "build-storybook", "build-tokens": "node buildTokens.js", - "postinstall": "yarn build && yarn build-tokens", + "prepack": "yarn build && yarn build-tokens", "storybook": "start-storybook -p 6006", "build": "yarn build:prod", "build:dev": "webpack --mode=development", From 8d194ed3817d99b3f40a750f8b328590f7956696 Mon Sep 17 00:00:00 2001 From: Ahmad Alahrashi Date: Tue, 21 Feb 2023 10:55:01 +0100 Subject: [PATCH 50/50] chore (refs T31116): edit comment. --- src/components/core/DpEditor/DpEditor.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/core/DpEditor/DpEditor.vue b/src/components/core/DpEditor/DpEditor.vue index 9ad418242..d1b42c7c8 100644 --- a/src/components/core/DpEditor/DpEditor.vue +++ b/src/components/core/DpEditor/DpEditor.vue @@ -584,7 +584,7 @@ export default { * boilerplateEditViewRoute: (Optional) route to a view that allows editing * boilerplates. Displayed as a link at the bottom of the boilerplate modal, if * toolbar.boilerplate is set - * getFileByHash: (Required) function that receives a file hash as parameter + * getFileByHash: (Optional) function that receives a file hash as parameter * and returns a route to that file. Used for displaying images. * similarRecommendationsRoute: (Optional) route to fetch similar * recommendations (needed if toolbar.recommendationButton is set to