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

Add docs and examples for anonymous content #343

Merged
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
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
10 changes: 10 additions & 0 deletions core/examples/luigi-sample-angular/e2e/tests/navigation.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,16 @@ describe('Navigation', () => {
.should('exist');
});

it('Anonymous content', () => {
cy.get('.fd-shellbar')
.contains('Visible for all users')
.should('exist');

cy.get('.fd-shellbar')
.contains('Visible for anonymous users only')
.should('not.exist');
});

describe('features', () => {
it('keepSelectedForChildren', () => {
// keep selected for children example
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<section class="fd-section">
<div class="fd-section__header">
<h1 class="fd-section__title">Anonymous content</h1>
</div>
<div class="fd-panel">
<div *ngIf="exclusive">
This page is visible <strong> only </strong> for users that are not logged in.
</div>
<div *ngIf="!exclusive">
This page is visible for all users, also those that are not logged in.
</div>
</div>
</section>
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { Component, OnInit } from '@angular/core';
import { Router, ActivatedRoute } from '@angular/router';

@Component({
selector: 'app-anonymous',
templateUrl: './anonymous.component.html',
styleUrls: ['./anonymous.component.css']
})
export class AnonymousComponent implements OnInit {
exclusive: false;

constructor(private route: ActivatedRoute) {
this.route.queryParams.subscribe(
params => {
this.exclusive = params.exclusive;
},
err => {}
);
}

ngOnInit() {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,13 @@ import { OverviewComponent } from './overview/overview.component';
import { RestrictedComponent } from './restricted/restricted.component';
import { DynamicComponent } from './project/dynamic/dynamic.component';
import { HideSideNavComponent } from './project/hideSideNav/hideSideNav.component';
import { AnonymousComponent } from './anonymous/anonymous.component';

const routes: Routes = [
{ path: 'overview', component: OverviewComponent },
{ path: 'settings', component: SettingsComponent },
{ path: 'restricted', component: RestrictedComponent },
{ path: 'anonymous', component: AnonymousComponent },
{ path: 'projects/:projectId', component: ProjectComponent },
{ path: 'projects/:projectId/users', component: UsersComponent },
{
Expand Down
4 changes: 3 additions & 1 deletion core/examples/luigi-sample-angular/src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import { LuigiContextService } from './services/luigi-context.service';
import { GroupSettingsComponent } from './project/users/groups/group-details/group-settings/group-settings.component';
import { DynamicComponent } from './project/dynamic/dynamic.component';
import { HideSideNavComponent } from './project/hideSideNav/hideSideNav.component';
import { AnonymousComponent } from './anonymous/anonymous.component';

@NgModule({
declarations: [
Expand All @@ -46,7 +47,8 @@ import { HideSideNavComponent } from './project/hideSideNav/hideSideNav.componen
RestrictedComponent,
GroupSettingsComponent,
DynamicComponent,
HideSideNavComponent
HideSideNavComponent,
AnonymousComponent
],
imports: [BrowserModule, FormsModule, AppRoutingModule],
providers: [LuigiContextService],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -495,6 +495,21 @@ Luigi.setConfig({
sameWindow: true
}
},
// showing an anonymous content is possible only with auto login disabled
{
pathSegment: 'all-users',
label: 'Visible for all users',
anonymousAccess: true,
viewUrl: '/sampleapp.html#/anonymous',
hideSideNav: true
},
{
pathSegment: 'anonymous',
label: 'Visible for anonymous users only',
anonymousAccess: 'exclusive',
viewUrl: '/sampleapp.html#/anonymous?exclusive=true',
hideSideNav: true
},
{
pathSegment: 'ext',
label: 'External Page',
Expand Down
1 change: 1 addition & 0 deletions docs/navigation-configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,7 @@ The node parameters are as follows:
- **loadingIndicator.hideAutomatically** disables the automatic hiding of the loading indicator once the micro front-end is loaded. It is only considered if the loading indicator is enabled. It does not apply if the loading indicator is activated manually with the `LuigiClient.uxManager().showLoadingIndicator()` function. If the loading indicator is enabled and automatic hiding is disabled, use `LuigiClient.uxManager().hideLoadingIndicator()` to hide it manually in your micro front-end during the startup. This parameter is enabled by default.
- **viewGroup** defines a group of views in the same domain sharing a common security context. This improves performance through reusing the frame. Use **viewGroup** only for the views that use path routing internally.
- **icon** is the name of an icon from the [OpenUI](https://openui5.hana.ondemand.com/1.40.10/iconExplorer.html) or a custom link (relative or absolute) to an image displayed next to the Node label in the side navigation or instead of the label in the top navigation.
- **anonymousAccess** defines if the node should be visible for the anonymous user. If set to `true`, all users see the node, while if set to `exclusive`, only the users that are not logged in can see it. The property is not propagated to the node's children and is disabled by default.


### Navigation configuration example
Expand Down