luigi icon indicating copy to clipboard operation
luigi copied to clipboard

apply context value replacement also to external links

Open hardl opened this issue 2 years ago • 1 comments

It is possible to inject context property and other (i18n) values to viewUrls to make them dynamic.

For external link urls, only i18n is working, but not context value replacement.

Fiddle for reproducing:

Luigi.setConfig({
    navigation: { 
            validWebcomponentUrls:['.*?'],
            nodes: [{ 
                pathSegment: 'home', 
                label: 'home', 
                context: {
                    someValue: 'random'
                },
                children: [{ 
                    pathSegment: 'overview', 
                    label: 'Overview', 
                    icon: 'home',
                    viewUrl: '/examples/microfrontends/multipurpose.html#/?foo={context.someValue}&lang={i18n.currentLocale}'
                },{ 
                    label: 'External link', 
                    externalLink: {
                        url: '/examples/microfrontends/multipurpose.html#/?foo={context.someValue}&lang={i18n.currentLocale}'
                    }
                }]
            }]
        }, 
        routing: { 
            useHashRouting: true 
        }
    });    

Current behaviour: when clicking on "External link", new tab is opened with url https://fiddle.luigi-project.io/examples/microfrontends/multipurpose.html#/?foo={context.someValue}&lang=en

Expected behaviour: when clicking on "External link", new tab is opened with url https://fiddle.luigi-project.io/examples/microfrontends/multipurpose.html#/?foo=random&lang=en

(jukebox - 985)

hardl avatar Jun 29 '22 08:06 hardl

approach done in draft PR https://github.com/SAP/luigi/pull/2804 seems to be working, needs to be finalized according to DOD

hardl avatar Jul 15 '22 14:07 hardl