Skip to content

Commit

Permalink
Merge branch 'third-party-cookie-check' of github.com:JohannesDoberer…
Browse files Browse the repository at this point in the history
…/luigi into third-party-cookie-check

* 'third-party-cookie-check' of github.com:JohannesDoberer/luigi:
  FAQ Documentation (SAP#982)
  Docu links leftovers (SAP#974)
  Bugfix invalid initial root navnode (SAP#979)
  Leftover documentation fixes (SAP#978)
  Navigate with anchors (SAP#976)
  remove jesusreal from codeowners, thanks for your great work in this project (SAP#980)
  • Loading branch information
JohannesDoberer committed Nov 25, 2019
2 parents e134c5a + 366cda7 commit 2078d37
Show file tree
Hide file tree
Showing 44 changed files with 623 additions and 214 deletions.
2 changes: 1 addition & 1 deletion CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# For more details, read the following article on GitHub: https://help.github.com/articles/about-codeowners/.

# These are the default owners for the whole content of the `luigi` repository. The default owners are automatically added as reviewers when you open a pull request, unless different owners are specified in the file.
* @pekura @maxmarkus @jesusreal @hardl @antiheld @johannesdoberer @marynaKhromova @zarkosimic
* @pekura @maxmarkus @hardl @antiheld @johannesdoberer @marynaKhromova @zarkosimic

# Owners of all .md files in the repository
*.md @bszwarc @kazydek @klaudiagrz @tomekpapiernik @mmitoraj @alexandra-simeonova @majakurcius
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ import {
// } from '@kyma-project/luigi-client';
```

>**NOTE**: The angular example application is not fully compatible with IE11.
<!-- add-attribute:class:warning -->
> **NOTE**: The angular example application is not fully compatible with IE11.
## Development

Expand All @@ -71,8 +72,8 @@ For security reasons, follow these guidelines when developing a micro frontend:
- Maintain a whitelist with trusted domains and compare it with the origin of the Luigi Core application. The origin will be passed when you call the init listener in your micro frontend. Stop further processing if the origin does not match.


>**NOTE**: Luigi follows these [sandbox rules for iframes](https://github.com/SAP/luigi/blob/af1deebb392dcec6490f72576e32eb5853a894bc/core/src/utilities/helpers/iframe-helpers.js#L140).
<!-- add-attribute:class:success -->
> **NOTE**: Luigi follows these [sandbox rules for iframes](https://github.com/SAP/luigi/blob/af1deebb392dcec6490f72576e32eb5853a894bc/core/src/utilities/helpers/iframe-helpers.js#L140).

### Code formatting for contributors
Expand Down
6 changes: 4 additions & 2 deletions client/public/luigi-client.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,8 @@ export type getContext = () => Context;
/**
* Returns the node parameters of the active URL.
* Node parameters are defined like URL query parameters but with a specific prefix allowing Luigi to pass them to the micro frontend view. The default prefix is **~** and you can use it in the following way: `https://my.luigi.app/home/products?~sort=asc~page=3`.
* >**NOTE:** some special characters (`<`, `>`, `"`, `'`, `/`) in node parameters are HTML-encoded.
* <!-- add-attribute:class:warning -->
* > **NOTE:** some special characters (`<`, `>`, `"`, `'`, `/`) in node parameters are HTML-encoded.
* @returns {Object} node parameters, where the object property name is the node parameter name without the prefix, and its value is the value of the node parameter. For example `{sort: 'asc', page: 3}`.
* @memberof Lifecycle
*/
Expand All @@ -406,7 +407,8 @@ export type getNodeParams = () => NodeParams;
* Returns the dynamic path parameters of the active URL.
* Path parameters are defined by navigation nodes with a dynamic **pathSegment** value starting with **:**, such as **productId**.
* All path parameters in the current navigation path (as defined by the active URL) are returned.
* >**NOTE:** some special characters (`<`, `>`, `"`, `'`, `/`) in path parameters are HTML-encoded.
* <!-- add-attribute:class:warning -->
* > **NOTE:** some special characters (`<`, `>`, `"`, `'`, `/`) in path parameters are HTML-encoded.
* @returns {Object} path parameters, where the object property name is the path parameter name without the prefix, and its value is the actual value of the path parameter. For example ` {productId: 1234, ...}`.
* @memberof Lifecycle
*/
Expand Down
6 changes: 4 additions & 2 deletions client/src/lifecycleManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,8 @@ class LifecycleManager extends LuigiClientBase {
/**
* Returns the node parameters of the active URL.
* Node parameters are defined like URL query parameters but with a specific prefix allowing Luigi to pass them to the micro frontend view. The default prefix is **~** and you can use it in the following way: `https://my.luigi.app/home/products?~sort=asc~page=3`.
* >**NOTE:** some special characters (`<`, `>`, `"`, `'`, `/`) in node parameters are HTML-encoded.
* <!-- add-attribute:class:warning -->
* > **NOTE:** some special characters (`<`, `>`, `"`, `'`, `/`) in node parameters are HTML-encoded.
* @returns {Object} node parameters, where the object property name is the node parameter name without the prefix, and its value is the value of the node parameter. For example `{sort: 'asc', page: 3}`
* @memberof Lifecycle
*/
Expand All @@ -352,7 +353,8 @@ class LifecycleManager extends LuigiClientBase {
* Returns the dynamic path parameters of the active URL.
* Path parameters are defined by navigation nodes with a dynamic **pathSegment** value starting with **:**, such as **productId**.
* All path parameters in the current navigation path (as defined by the active URL) are returned.
* >**NOTE:** some special characters (`<`, `>`, `"`, `'`, `/`) in path parameters are HTML-encoded.
* <!-- add-attribute:class:warning -->
* > **NOTE:** some special characters (`<`, `>`, `"`, `'`, `/`) in path parameters are HTML-encoded.
* @returns {Object} path parameters, where the object property name is the path parameter name without the prefix, and its value is the actual value of the path parameter. For example ` {productId: 1234, ...}`
* @memberof Lifecycle
*/
Expand Down
4 changes: 2 additions & 2 deletions client/src/linkManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ export class linkManager extends LuigiClientBase {
* @example
* LuigiClient.linkManager().openAsModal('projects/pr1/users', {title:'Users', size:'m'});
*/
openAsModal(path, modalSettings) {
this.navigate(path, 0, true, modalSettings || {});
openAsModal(path, modalSettings = {}) {
this.navigate(path, 0, true, modalSettings);
}

/**
Expand Down
3 changes: 2 additions & 1 deletion core/examples/luigi-sample-angular/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@

This is the Angular-based sample application which runs with Luigi framework.

>**NOTE:** The authorization flow in this application is a mock implementation for local development. **DO NOT USE IN PRODUCTION!**
<!-- add-attribute:class:success -->
> **NOTE:** The authorization flow in this application is a mock implementation for local development. **DO NOT USE IN PRODUCTION!**
## Development

Expand Down
12 changes: 11 additions & 1 deletion core/src/utilities/helpers/routing-helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,17 @@ class RoutingHelpersClass {
return lastElement.defaultChildNode;
} else if (children && children.length) {
const rootPath = pathData.navigationPath.length === 1;
if (rootPath) return children[0].pathSegment;
if (rootPath) {
const firstNodeWithPathSegment = children.find(
child => child.pathSegment
);
return (
(firstNodeWithPathSegment && firstNodeWithPathSegment.pathSegment) ||
console.error(
'At least one navigation node in the root hierarchy must have a pathSegment.'
)
);
}
const validChild = children.find(
child =>
child.pathSegment &&
Expand Down
9 changes: 5 additions & 4 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ To configure your Luigi application, simply edit the files in the `luigi-config`

* [Navigation (basic)](navigation-configuration.md) - configure basic top and side navigation, links, and categories.
* [Navigation (advanced)](navigation-advanced.md) - create a dynamic path, reuse micro frontends with the same origin, and configure additional navigation elements. 
* [Routing](navigation-parameters-reference.md#routing) - define routing options for your application.
* [Full parameter reference](navigation-parameters-reference.md) - find all the parameters which you can use to configure Luigi navigation in one place.
* [Authorization](authorization-configuration.md) - configure login and security features for your application.
* [Authorization events](authorization-events.md) - define event configuration used to react to Luigi authorization events.
* [Authorization events](authorization-events.md) - define event configuration used to react to Luigi authorization events.
* [General settings](general-settings.md) - fully customize a micro frontend, define a header, make your application responsive, and more.
* [Lifecycle hooks](lifecycle-hooks.md) - execute custom logic on any of the Luigi lifecycle steps.

Expand All @@ -56,11 +56,12 @@ Read the Luigi Client API documentation to learn more about the functions and pa
* [UX Manager](luigi-client-api.md#uxmanager) - manage appearance options such as the behavior of backdrop or loading indicators.

## Advanced
* [Communication](communication.md) describes how to send custom messages between Luigi Core and Client.

[Communication](communication.md) describes how to send custom messages between Luigi Core and Client.

## Examples

Check the Luigi [application examples](../core/examples/README.md) for an in-depth look at Luigi capabilities.
Check the Luigi [application examples](../core/examples) for an in-depth look at Luigi capabilities.

## Development

Expand Down
20 changes: 12 additions & 8 deletions docs/application-setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ Prior to start developing with Luigi, you need to set up your application. This

Choose the framework to build your application:

[Application setup without a framework](#noframework)
[Angular 6](#angular6)
[SAPUI5/OpenUI5](#sapui5)
[VUE.JS](#vuejs)
[Application setup without a framework](#application-setup-for-an-application-not-using-a-framework)
[Angular 6](#application-setup-for-angular-6)
[SAPUI5/OpenUI5](#application-setup-for-sapui5openui5)
[VUE.JS](#application-setup-for-vuejs)

## Basic application setup

Expand All @@ -46,7 +46,8 @@ The examples on this page demonstrate commands that perform each of the necessar
<a name="noframework"></a>
### Application setup for an application not using a framework

>**NOTE:** You need a development server capable of hosting Single Page Applications. The recommended server is Live Server.
<!-- add-attribute:class:success -->
> **NOTE:** You need a development server capable of hosting Single Page Applications. The recommended server is Live Server.
1. If you do not have Live Server installed, use this command to install it.

Expand Down Expand Up @@ -83,7 +84,8 @@ live-server --entry-file=index.html public

### Application setup for Angular 6

>**NOTE:** The Angular CLI is a prerequisite for this example.
<!-- add-attribute:class:warning -->
> **NOTE:** The Angular CLI is a prerequisite for this example.
1. If you do not have the Angular CLI installed, download and install it from [this URL](https://cli.angular.io/).

Expand Down Expand Up @@ -115,7 +117,8 @@ npm run start

### Application setup for SAPUI5/OpenUI5

>**NOTE:** Live Server must be installed as your development server.
<!-- add-attribute:class:warning -->
> **NOTE:** Live Server must be installed as your development server.
1. If you do not have Live Server installed, use this command to install it.

Expand Down Expand Up @@ -148,7 +151,8 @@ $ live-server --entry-file=index.html public

### Application setup for VUE.JS

>**NOTE:** The VUE CLI is a prerequisite for this example.
<!-- add-attribute:class:warning -->
> **NOTE:** The VUE CLI is a prerequisite for this example.
1. If you do not have VUE CLI installed, use this command to install it.

Expand Down
4 changes: 2 additions & 2 deletions docs/authorization-configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ meta -->

# Authorization configuration

To configure authorization in Luigi, go to the `auth:` section of your project's `basicConfiguration.js` file. To see how authorization works, you can also go to the [Luigi Fiddle](https://fiddle.luigi-project.io) site and configure a sample application.
To configure authorization in Luigi, go to the `auth:` section of your Luigi configuration file. To see how authorization works, you can also go to the [Luigi Fiddle](https://fiddle.luigi-project.io) site and configure a sample application.

Luigi provides OpenID Connect and OAuth2 Implicit Grant authorization out of the box. The **use** key defines the active authorization provider and the **disableAutoLogin** key allows you to disable the automatic login flow that is provided by default.

Expand Down Expand Up @@ -46,7 +46,7 @@ auth: {
openIdConnect: {
authority: 'https://example.com',
client_id: 'client',
scope: 'audience:server:client_id:client openid profile email groups',
scope: 'audience:server:client_id:client openID profile email groups',
redirect_uri: '',
post_logout_redirect_uri: '/logout.html',
automaticSilentRenew: true,
Expand Down
7 changes: 4 additions & 3 deletions docs/authorization-events.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,15 @@ meta -->

# Authorization events

>**NOTE:** For learning and testing purposes, use the [Luigi Fiddle](https://fiddle.luigi-project.io) page where you can configure a sample Luigi application.
<!-- add-attribute:class:success -->
>**TIP:** For learning and testing purposes, use the [Luigi Fiddle](https://fiddle.luigi-project.io) page where you can configure a sample Luigi application.
Luigi provides life cycle events which it can trigger internally or by authorization providers.
Events are part of the **auth** configuration object and have to be functions. They can be executed asynchronously.

An example events configuration looks as follows:

```
```javascript
auth: {
events: {
onAuthSuccessful: (settings, authData) => {},
Expand All @@ -45,7 +46,7 @@ You can disable the default behavior of `onAuthExpired` and `onAuthError` by mak
- `onAuthSuccessful` **[function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** is executed after logging in with the **authData** object parameter. If valid authorization data was found in the local storage, the function is not executed.
- `onAuthError` **[function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** is executed:
- by Luigi **reason** URL parameter with optional **error** URL parameter for detailed description was found on Luigi initialization. The OAuth2Provider uses this approach by redirecting from the authorization provider to `luigi.domain/?reason=someError&error=Error detail describe`.
- by the OIDC provider if silent access token renewal fails
- by the OIDC provider if silent access token renewal fails

Return `false` to prevent redirecting to `logoutUrl` after executing this function. It goes to the Luigi main route `/` instead.
- `onAuthExpired` **[function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** is executed if the token expires during runtime, or if Luigi is opened with outdated authorization data in the local storage. Return `false` to prevent redirecting to `logoutUrl` after executing this function.
Expand Down
9 changes: 5 additions & 4 deletions docs/communication.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,16 @@ meta -->

# Communication

>**NOTE:** For learning and testing purposes, use the [Luigi Fiddle](https://fiddle.luigi-project.io) page where you can configure a sample Luigi application.
<!-- add-attribute:class:success -->
>**TIP:** For learning and testing purposes, use the [Luigi Fiddle](https://fiddle.luigi-project.io) page where you can configure a sample Luigi application.
## Custom messages

Luigi Core and Luigi Client can exchange custom messages in both directions.

### Luigi Client to Luigi Core

For Luigi Client to send messages to Luigi Core, use the [*sendCustomMessage*](luigi-client-api.md#sendCustomMessage) method from Client API.
For Luigi Client to send messages to Luigi Core, use the [sendCustomMessage](luigi-client-api.md#sendCustomMessage) method from Client API.

For Luigi Core to process custom messages, define a configuration similar to the following at the root level of your Luigi configuration object:

Expand All @@ -41,12 +42,12 @@ For Luigi Core to process custom messages, define a configuration similar to the
}
```
where the `my-custom-message.update-top-nav` key is the message id, and the value is the listener function for the custom message. The listener receives the following input parameters:
- **customMessage** the [*message*](luigi-client-api.md#sendCustomMessage) sent by Luigi Client.
- **customMessage** the [message](luigi-client-api.md#sendCustomMessage) sent by Luigi Client.
- **microfrontend** a micro frontend object as specified [here](luigi-core-api.md#getMicrofrontends).
- **navigation node** a [navigation node object](navigation-parameters-reference.md#Node-parameters).

### Luigi Core to Luigi Client

For Luigi Core to send messages, use the [*customMessages*](luigi-core-api.md#customMessages) section from Core API. You can send a custom message to all rendered micro frontends, or to a specific one. For the latter, use the Core API [*elements*](luigi-core-api.md#elements) methods to retrieve micro frontends and select the one you want to send the custom message to.
For Luigi Core to send messages, use the [customMessages](luigi-core-api.md#customMessages) section from Core API. You can send a custom message to all rendered micro frontends, or to a specific one. For the latter, use the Core API [elements](luigi-core-api.md#elements) methods to retrieve micro frontends and select the one you want to send the custom message to.

For Luigi Client to process the message, add and remove message listeners as described [here](luigi-client-api.md#addCustomMessageListener).
Loading

0 comments on commit 2078d37

Please sign in to comment.