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

content-configuration-parameter.mapper.ts should use configuration parameter type for file reference mappings #385

Closed
shauke opened this issue Sep 24, 2020 · 0 comments · Fixed by #1223
Labels
enhancement Enhancement to an existing feature
Milestone

Comments

@shauke
Copy link
Member

shauke commented Sep 24, 2020

The current ICM CMS REST API provides Configuration Parameter type information now that can be used to identify file reference parameters (e.g. bc_pmc:types.pagelet2-ImageFileRef) that need to have a specific handling. This is currently handled based on Configuration Parameter naming (e.g. Image or Video) which is not very flexible. See

* TODO: make this dependant on the type of the configuration parameter once the CMS REST API provides this information
* for now filter all configuration parameters that start with 'Image' or 'Video'
* and where the value does not start with 'http' but contains ':/'
+ if the filter matches convert the CMS REST API value in a full server URL to the configured file
*/
postProcessFileReferences(data: ContentConfigurationParameters): ContentConfigurationParameters {
Object.keys(data)
.filter(
key =>
(key.startsWith('Image') || key.startsWith('Video')) &&

It should be changed to make the mapping for specific types (ImageFileRef, FileRef) instead of names.

CMS REST response example for configuration parameters with type information

"configurationParameters": {
    "ImageXS": {
        "value": "inSPIRED-inTRONICS-rest:/pwa/pwa_home_teaser_1_767.jpg",
        "type": "bc_pmc:types.pagelet2-ImageFileRef",
        "definitionQualifiedName": "app_sf_base_cm:component.common.imageEnhanced.pagelet2-Component-ImageXS"
    },
    "Image": {
        "value": "inSPIRED-inTRONICS-rest:/pwa/pwa_home_teaser_1.jpg",
        "type": "bc_pmc:types.pagelet2-ImageFileRef",
        "definitionQualifiedName": "app_sf_base_cm:component.common.imageEnhanced.pagelet2-Component-Image"
    },
    "Link": {
        "value": "product://201807195@inSPIRED-inTRONICS",
        "type": "sld_mcm:parametertype.link.pagelet2-Link",
        "definitionQualifiedName": "app_sf_base_cm:component.common.imageEnhanced.pagelet2-Component-Link"
    }
},

AB#78582

@shauke shauke added the enhancement Enhancement to an existing feature label Sep 24, 2020
@shauke shauke added this to the 3.0 milestone Jul 21, 2022
jometzner added a commit that referenced this issue Aug 1, 2022
…1223)

* translate ICM shared file system reference to URL in configuration parameter based on parameter type ("ImageFileRef" and "FileRef") instead of naming convention

Co-authored-by: Johannes Metzner <jm@jometzner.de>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Enhancement to an existing feature
Projects
None yet
2 participants