diff --git a/core/examples/luigi-sample-angular/e2e/tests/product-switcher.spec.js b/core/examples/luigi-sample-angular/e2e/tests/product-switcher.spec.js new file mode 100644 index 0000000000..93a3cf33ee --- /dev/null +++ b/core/examples/luigi-sample-angular/e2e/tests/product-switcher.spec.js @@ -0,0 +1,22 @@ +describe('ProductSwitcher', () => { + beforeEach(() => { + cy.visit('http://localhost:4200'); + cy.login('tets@email.com', 'tets'); + }); + + it('Clicking around the product switcher', () => { + //check if hybris is there + cy.get('.fd-product-switcher') + .click() + .contains('hybris'); + + //check if internal link is there + cy.get('.fd-product-switcher .fd-product-switcher__body') + .contains('Project 1') + .click(); + + cy.location().should(loc => { + expect(loc.pathname).to.eq('/projects/pr1'); + }); + }); +}); diff --git a/core/examples/luigi-sample-angular/package-lock.json b/core/examples/luigi-sample-angular/package-lock.json index 13180a49dd..5984ffdf40 100644 --- a/core/examples/luigi-sample-angular/package-lock.json +++ b/core/examples/luigi-sample-angular/package-lock.json @@ -1836,16 +1836,6 @@ } } }, - "@kyma-project/luigi-client": { - "version": "0.4.5", - "resolved": "https://registry.npmjs.org/@kyma-project/luigi-client/-/luigi-client-0.4.5.tgz", - "integrity": "sha512-RawxNK+buZT9kTvHCznD51jq+iqqfBBBGE5Lag9plz+5eavqSp8xs8B/h+5QKJ+IWJOf/jf/b8QFPjTQqK4bCg==" - }, - "@kyma-project/luigi-core": { - "version": "0.4.5", - "resolved": "https://registry.npmjs.org/@kyma-project/luigi-core/-/luigi-core-0.4.5.tgz", - "integrity": "sha512-WGdGltltV3lhvh8LXs0jqRn7YYbD4R67A23+XSUQ3foVtd6+5azJkQtZmlKt+HGHQDl45di/o6feFr0+K7iOkA==" - }, "@ngtools/webpack": { "version": "6.1.5", "resolved": "https://registry.npmjs.org/@ngtools/webpack/-/webpack-6.1.5.tgz", diff --git a/core/examples/luigi-sample-angular/src/assets/404.html b/core/examples/luigi-sample-angular/src/assets/404.html index 42dacfcdb9..0b4e6d5291 100644 --- a/core/examples/luigi-sample-angular/src/assets/404.html +++ b/core/examples/luigi-sample-angular/src/assets/404.html @@ -68,14 +68,11 @@
-

- Ooooooooops :( -

+

Ooooooooops :(

Yes, you guessed right, it's a 404 - 404 - error + 404 error

diff --git a/core/examples/luigi-sample-angular/src/luigi-config/extended/navigation.js b/core/examples/luigi-sample-angular/src/luigi-config/extended/navigation.js index 3f55214396..616c0b9bf5 100644 --- a/core/examples/luigi-sample-angular/src/luigi-config/extended/navigation.js +++ b/core/examples/luigi-sample-angular/src/luigi-config/extended/navigation.js @@ -147,6 +147,34 @@ class Navigation { */ fallbackLabelResolver: id => id.replace(/\b\w/g, l => l.toUpperCase()) }; + // The following configuration will be used to render a product switcher component + productSwitcher = { + items: [ + { + icon: 'https://sap.github.io/fundamental/images/products/06.png', + label: 'hybris', + externalLink: { + url: 'https://www.hybris.com', + sameWindow: false + } + }, + { + icon: 'https://sap.github.io/fundamental/images/products/06.png', + label: 'Project 1', + link: '/projects/pr1' + }, + { + icon: 'https://sap.github.io/fundamental/images/products/06.png', + label: 'Project 2', + link: '/projects/pr2' + }, + { + icon: 'https://sap.github.io/fundamental/images/products/06.png', + label: 'Project 3', + link: '/projects/pr3' + } + ] + }; } export const navigation = new Navigation( diff --git a/core/src/Backdrop.html b/core/src/Backdrop.html index 533544d3fe..7f5d860d92 100644 --- a/core/src/Backdrop.html +++ b/core/src/Backdrop.html @@ -1,6 +1,4 @@ -
- -
+
+ diff --git a/core/src/navigation/TopNav.html b/core/src/navigation/TopNav.html index a0e20d2590..072fe0e1e0 100644 --- a/core/src/navigation/TopNav.html +++ b/core/src/navigation/TopNav.html @@ -1,9 +1,7 @@
-
- -
+
{#if !authorizationEnabled || isLoggedIn} @@ -28,11 +26,10 @@ class="fd-top-nav__icon sap-icon--{node.icon} sap-icon--m" > {:else} - - {/if} {:else} {node.label} {/if} {#if node.externalLink && + {/if} + {:else} {node.label} {/if} {#if node.externalLink && node.externalLink.url} - - {/if} + {/if}
{/if} {/each} @@ -93,8 +90,7 @@ /> {/if} {:else} {node.label} {/if} {#if node.externalLink && node.externalLink.url} - - {/if} + {/if} {/if} {/each} @@ -109,7 +105,7 @@
+ {/if} {#if isProductSwitcherAvailable} + {/if} @@ -135,6 +134,7 @@ import ContextSwitcher from './ContextSwitcher.html'; import LogoTitle from './LogoTitle.html'; import Authorization from '../Authorization.html'; + import ProductSwitcher from './ProductSwitcher.html'; import { LuigiConfig } from '../services/config.js'; import * as Routing from '../services/routing'; import * as Navigation from './services/navigation.js'; @@ -176,6 +176,9 @@ oncreate() { this.set({ authorizationEnabled: LuigiConfig.isAuthorizationEnabled(), + isProductSwitcherAvailable: LuigiConfig.getConfigValue( + 'navigation.productSwitcher' + ), hideNavComponent: LuigiConfig.getConfigBooleanValue( 'settings.hideNavigation' ) @@ -228,7 +231,8 @@ components: { Authorization, ContextSwitcher, - LogoTitle + LogoTitle, + ProductSwitcher } };