Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

F t31116 demosplan UI no longer use routing #91

Merged
merged 56 commits into from
Feb 21, 2023
Merged
Show file tree
Hide file tree
Changes from 12 commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
ff4de38
chore (refs T31116): Add Routes Props for DpDashboardTaskCard.
ahmad-demos Jan 30, 2023
d7329b8
chore (refs T31116): Add fileRoute Props instead of string.
ahmad-demos Jan 30, 2023
bb3ff53
chore (refs T31116): Add fileRoute Props instead of string.
ahmad-demos Jan 30, 2023
a6b53e3
chore (refs T31116): Add fileRoute Props instead of string.
ahmad-demos Jan 30, 2023
395a417
chore (refs T31116): Add fileRoute Props instead of string.
ahmad-demos Jan 30, 2023
25f8d2a
chore (refs T31116): Add Routes Props instead of string.
ahmad-demos Jan 30, 2023
cab5e33
chore (refs T31116): Add param instead of route string.
ahmad-demos Jan 31, 2023
1095c03
chore (refs T31116): Add boilerplateListRoute Prop for Editor instead…
ahmad-demos Jan 31, 2023
f3a4e1a
chore (refs T31116): Add boilerplateListRoute Prop for Editor instead…
ahmad-demos Jan 31, 2023
c855277
chore (refs T31116): Add similarRecommendationsRoute Prop for Editor …
ahmad-demos Jan 31, 2023
104e2b5
chore (refs T31116): Add similarRecommendationsRoute Prop for Editor …
ahmad-demos Jan 31, 2023
6f5b8b1
chore (refs T31116): Add route param for dpRpc.
ahmad-demos Jan 31, 2023
ad1afe6
chore (refs T31116): move all Routing.generate to core.
ahmad-demos Feb 1, 2023
b6404ac
chore (refs T31116): revert changes for dpRpc.
ahmad-demos Feb 1, 2023
0b6cba1
chore (refs T31116): move Routing.generate to core.
ahmad-demos Feb 1, 2023
98fdabd
chore (refs T31116): move Routing.generate to core.
ahmad-demos Feb 1, 2023
ca229db
chore (refs T31116): move Routing.generate to core.
ahmad-demos Feb 1, 2023
1c4e829
chore (refs T31116): move Routing.generate to core.
ahmad-demos Feb 1, 2023
d7d1be9
chore (refs T31116): Add routes prop that contains all routes.
ahmad-demos Feb 1, 2023
54d9444
chore (refs T31116): revert all the changes for DpDashboardTaskCard.
ahmad-demos Feb 1, 2023
3784acc
chore (refs T31116): Change Prop name for edit boilerplate route.
ahmad-demos Feb 3, 2023
4c17057
chore (refs T31116): add separate props to parent prop (routes).
ahmad-demos Feb 3, 2023
2783e7d
chore (refs T31116): Add parent prop (routes) for separate props.
ahmad-demos Feb 3, 2023
5855c9d
Merge branch 'main' into f_T31116_demosplan_ui_no_longer_use_routing
ahmad-demos Feb 7, 2023
f998847
chore (refs T31116): WIP: minor improvements JS code, add provide inj…
ahmad-demos Feb 8, 2023
551eeab
chore (refs T31116): Changes in package.json
ahmad-demos Feb 8, 2023
3a51670
chore (refs T31116): minor improvements JS.
ahmad-demos Feb 8, 2023
462e0e5
chore (refs T31116): minor improvements JS.
ahmad-demos Feb 8, 2023
1bb59b6
chore (refs T31116): minor improvements JS.
ahmad-demos Feb 8, 2023
7fb3fad
chore (refs T31116): rename prop for upload file & minor improvements…
ahmad-demos Feb 8, 2023
82e69ec
chore (refs T31116): WIP: minor improvements in route for DpAutocompl…
ahmad-demos Feb 9, 2023
ed7308b
chore (refs T31116): minor improvements in route for DpAutocomplete.
ahmad-demos Feb 9, 2023
d20932a
Update src/components/core/DpEditor/DpBoilerPlateModal.vue
ahmad-demos Feb 10, 2023
9fcdfbc
Update src/components/core/DpEditor/DpEditor.vue
ahmad-demos Feb 10, 2023
cd139e8
Update src/components/core/DpEditor/DpEditor.vue
ahmad-demos Feb 10, 2023
ecb50ce
chore (refs T31116): rename prop to make that clear, because prop as …
ahmad-demos Feb 10, 2023
9c74850
chore (refs T31116): remove default value, when prop required is true.
ahmad-demos Feb 10, 2023
8f7bf80
chore (refs T31116): rename boilerplate route prop.
ahmad-demos Feb 10, 2023
031f9e6
chore (refs T31116): remove unused prop.
ahmad-demos Feb 10, 2023
39b6d09
chore (refs T31116): add required true to route prop.
ahmad-demos Feb 10, 2023
db654ec
chore (refs T31116): WIP: revert changes in validator.
ahmad-demos Feb 10, 2023
391f33b
chore (refs T31116): WIP: revert changes in required.
ahmad-demos Feb 10, 2023
57ffba6
chore (refs T31116): update Changelog.
ahmad-demos Feb 10, 2023
e96471b
Update CHANGELOG.md
ahmad-demos Feb 10, 2023
61dec86
chore (refs T31116): revert all changes in DpRegisterFlyout.
ahmad-demos Feb 10, 2023
5873380
chore (refs T31116): revert all changes in package.json
ahmad-demos Feb 10, 2023
3f86088
chore (refs T31116): WIP: make routes required as true.
ahmad-demos Feb 10, 2023
8c7cfab
chore (refs T31116): minor improvements in routes prop condition.
ahmad-demos Feb 10, 2023
829f74b
chore (refs T31116): revert required false for routes prop.
ahmad-demos Feb 10, 2023
a4221b3
chore (refs T31116): revert package.json
ahmad-demos Feb 13, 2023
31890c2
Merge branch 'main' into f_T31116_demosplan_ui_no_longer_use_routing
ahmad-demos Feb 13, 2023
b0db63b
Merge branch 'main' into f_T31116_demosplan_ui_no_longer_use_routing
ahmad-demos Feb 13, 2023
2b50a4c
Merge branch 'main' into f_T31116_demosplan_ui_no_longer_use_routing
ahmad-demos Feb 20, 2023
fc401f5
Merge branch 'main' into f_T31116_demosplan_ui_no_longer_use_routing
ahmad-demos Feb 21, 2023
8d194ed
chore (refs T31116): edit comment.
ahmad-demos Feb 21, 2023
4e4acde
Merge remote-tracking branch 'origin/f_T31116_demosplan_ui_no_longer_…
ahmad-demos Feb 21, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 19 additions & 4 deletions src/components/core/DpDashboardTaskCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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
hwiem marked this conversation as resolved.
Show resolved Hide resolved
}
},

Expand All @@ -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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we want to pass the complete route - the result of Routing.generate - not just the String that has to be generated.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

}
},

Expand All @@ -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' })
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see above and all other changes

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dpApi.get(segmentUrl, { filter: filterQuery }, { serialize: true }).then(response => {
this.assignedSegmentCount = response.data.data.length
})
Expand All @@ -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('/')
Expand All @@ -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 => {
Expand Down
7 changes: 6 additions & 1 deletion src/components/core/DpEditor/DpBoilerPlateModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<div class="flex flex-items-center u-mt">
<a
class="weight--bold font-size-small"
:href="Routing.generate('DemosPlan_procedure_boilerplate_list', { procedure: procedureId })">
:href="Routing.generate(boilerplateListRoute, { procedure: procedureId })">
{{ Translator.trans('boilerplates.edit') }} ({{ Translator.trans('view.leave.hint') }})
</a>
<dp-button-row
Expand Down Expand Up @@ -59,6 +59,11 @@ export default {
default: ''
},

boilerplateListRoute: {
hwiem marked this conversation as resolved.
Show resolved Hide resolved
type: String,
required: true
},

editorId: {
required: false,
type: String,
Expand Down
34 changes: 32 additions & 2 deletions src/components/core/DpEditor/DpEditor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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)" />
Expand All @@ -18,6 +19,7 @@
<dp-upload-modal
v-if="toolbar.imageButton"
ref="uploadModal"
:file-route="fileRoute"
@insert-image="insertImage"
@add-alt="addAltTextToImage"
@close="resetEditingImage" />
Expand All @@ -26,7 +28,8 @@
ref="recommendationModal"
@insert-recommendation="text => appendText(text)"
:procedure-id="procedureId"
:segment-id="segmentId" />
:segment-id="segmentId"
:similar-recommendations-route="similarRecommendationsRoute" />
<div :class="prefixClass('row tiptap')">
<div :class="prefixClass('col')">
<div
Expand Down Expand Up @@ -416,6 +419,15 @@ export default {
default: ''
},

/**
hwiem marked this conversation as resolved.
Show resolved Hide resolved
* Needed to get the core_file Route, when DpEditor has imageButton attr.
hwiem marked this conversation as resolved.
Show resolved Hide resolved
*/
fileRoute: {
type: String,
required: false,
default: ''
},

/**
* Array with numbers 1-6 defining which heading-buttons we want to show
*
Expand Down Expand Up @@ -555,6 +567,15 @@ export default {
default: false
},

/**
* Needed to get the 'DemosPlan_procedure_boilerplate_list' Route, when DpEditor has boilerPlate attr.
*/
boilerplateListRoute: {
type: String,
required: false,
default: ''
},

/**
* ProcedureId is required if we want to enable boilerplates
*/
Expand Down Expand Up @@ -595,6 +616,15 @@ 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.
*/
Expand Down Expand Up @@ -906,7 +936,7 @@ export default {
const imageHash = placeholder.substr(7, 36)
const imageWidth = placeholder.match(/width=(\d*?)&/)[1]
const imageHeight = placeholder.match(/height=(\d*?)$/)[1]
return `<img src="${Routing.generate('core_file', { hash: imageHash })}" width="${imageWidth}" height="${imageHeight}" alt="${altText}">`
return `<img src="${Routing.generate(this.fileRoute, { hash: imageHash })}" width="${imageWidth}" height="${imageHeight}" alt="${altText}">`
})
} catch (e) {
return text
Expand Down
7 changes: 6 additions & 1 deletion src/components/core/DpEditor/DpRecommendationModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,11 @@ export default {
segmentId: {
type: String,
required: true
},

similarRecommendationsRoute: {
type: String,
required: true
}
},

Expand Down Expand Up @@ -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: {
Expand Down
10 changes: 9 additions & 1 deletion src/components/core/DpEditor/DpUploadModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
<dp-upload-files
allowed-file-types="img"
id="imageFile"
:file-route="fileRoute"
:max-file-size="20 * 1024 * 1024/* 20 MiB */"
:max-number-of-files="1"
ref="uploader"
Expand Down Expand Up @@ -63,6 +64,13 @@ export default {
DpUploadFiles
},

props: {
fileRoute: {
type: String,
required: true
}
},

data () {
return {
fileUrl: '',
Expand Down Expand Up @@ -90,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()
},
Expand Down
16 changes: 14 additions & 2 deletions src/components/core/DpRegisterFlyout.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
<div class="space-stack-s">
<a
class="display--block"
:href="Routing.generate('DemosPlan_citizen_registration_form')"
:href="Routing.generate(citizenRegisterFormRoute)"
v-text="Translator.trans('register')" />
<a
class="display--block"
:href="Routing.generate('DemosPlan_orga_register_form')"
:href="Routing.generate(orgaRegisterFormRoute)"
v-text="Translator.trans('register.orga')" />
</div>
</dp-flyout>
Expand All @@ -35,6 +35,18 @@ export default {
DpFlyout
},

props: {
hwiem marked this conversation as resolved.
Show resolved Hide resolved
citizenRegisterFormRoute: {
type: String,
required: true
},

orgaRegisterFormRoute: {
type: String,
required: true
}
},

mounted () {
/*
* The placeholder element is shown until all javascript has been loaded
Expand Down
6 changes: 6 additions & 0 deletions src/components/core/DpUpload/DpUploadFiles.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

--><dp-uploaded-file-list
v-if="uploadedFiles.length > 0"
:file-route="fileRoute"
@file-remove="handleRemove"
:class="[prefixClass('layout__item u-1-of-1-palm'), prefixClass(sideBySide ? 'u-1-of-2' : 'u-1-of-1 u-mt')]"
:files="uploadedFiles" />
Expand Down Expand Up @@ -88,6 +89,11 @@ export default {
default: false
},

fileRoute: {
type: String,
required: true
},

id: {
type: String,
required: false,
Expand Down
7 changes: 6 additions & 1 deletion src/components/core/DpUpload/DpUploadedFile.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
</span>
<span v-if="isImage">
<img
:src="Routing.generate('core_file', { hash: file.hash })"
:src="Routing.generate(fileRoute, { hash: file.hash })"
:aria-label="Translator.trans('image.preview')"
width="50px">
</span>
Expand Down Expand Up @@ -43,6 +43,11 @@ export default {
fileString: {
type: String,
required: true
},

fileRoute: {
type: String,
required: true
}
},

Expand Down
6 changes: 6 additions & 0 deletions src/components/core/DpUpload/DpUploadedFileList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<dp-uploaded-file
v-for="(fileString, idx) in fileStrings"
:file-string="fileString"
:file-route="fileRoute"
@file-remove="file => $emit('file-remove', file)"
:key="idx" />
</ul>
Expand All @@ -31,6 +32,11 @@ export default {
type: Array,
required: false,
default: () => ([])
},

fileRoute: {
type: String,
required: true
}
},

Expand Down
4 changes: 2 additions & 2 deletions src/components/core/DpUpload/utils/GetFileIdsByHash.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import { dpApi } from '../../../../lib'
*
* @returns {Array<Ids>}
*/
function getFileIdsByHash (hashes) {
function getFileIdsByHash (hashes, route) {
return dpApi.get(
Routing.generate('api_resource_list', { resourceType: 'File' }),
Routing.generate(route, { resourceType: 'File' }),
{
filter: {
hasHash: {
Expand Down
4 changes: 2 additions & 2 deletions src/lib/DpApi.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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
})
}
Expand Down