Skip to content

Commit

Permalink
Merge pull request #294 from opfab/OC-748
Browse files Browse the repository at this point in the history
[OC-748] Remove button log in using keyCloak
  • Loading branch information
AlexGuironnetRTE authored May 13, 2020
2 parents f0adcfd + 5e8aea9 commit 41dd2cb
Show file tree
Hide file tree
Showing 26 changed files with 247 additions and 1,093 deletions.
48 changes: 28 additions & 20 deletions src/docs/asciidoc/docs/release_notes.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,9 @@
= Version 1.3.0.RELEASE

== Issue

== Bug

* [OC-414] Issue with using user data in templates
* [OC-857] Users - PUT /groups/{id}/users doesn't delete former group members
* [OC-883] Need a click on button "log in using keyCloak" after login in implicit mode

== Task
* [OC-844] Add a UI style for day and a UI style for night with a button to permute. +
This functionality is optional and can be activate/desactivate via configuration +
https://opfab.github.io/documentation/current/deployment/#_web_ui
* [OC-846] Update documentation for "OC-737 : Add an object entity in the user service"
* [OC-737] Add an object entity in the user service +
Below, you will find information about our new object "Entity" and its endpoints : +
https://opfab.github.io/documentation/current/api/users/#/entities
* [OC-736] Add a field "name" to the object Group

[WARNING]
Expand All @@ -41,9 +29,10 @@ Group{
Please, in the config service, make sure to modify the file users.yml, replacing the field "name" by "id", so that the
Groups objects contain the mandatory field id.
====
* [OC-858] Refactoring UI Timeline code for circle content and position computing
* [OC-870] Refactoring cardWriteSerice class in cardPublication service
* [OC-869] Small improvements in karate test
* [OC-737] Add an object entity in the user service +
Below, you will find information about our new object "Entity" and its endpoints : +
https://opfab.github.io/documentation/current/api/users/#/entities

* [OC-744] Replace web-ui spring component with Nginx

[NOTE]
Expand All @@ -64,20 +53,39 @@ cf Web-ui README.adoc, or the chapter link:https://opfab.github.io/documentation
of Setting up your development environment within Development Environment documentation,
or the entry about [OC-744] of this current file.
====
* [OC-658] gradle assemble shouldn't run the ui unit tests
* [OC-748] Remove button "log in using keyCloak", go directly to login page
* [OC-738] Add a group perimeter object in the user service

[NOTE]
====
Work is still in progress. The object is not usable at the moment.
====
* [OC-878] remove unnecessary utilities time classes
* [OC-547] remove unnecessary UI test
* [OC-880] modify KeyCloak configuration to facilitate dev
* [OC-882] Remove unused publishTestData method in cardConsultation service

* [OC-877] User Service : Implement endpoint GET /CurrentUserWithPerimeters

[NOTE]
====
Work is still in progress. The endpoint is not usable at the moment.
====

== Bug

* [OC-414] Issue with using user data in templates
* [OC-857] Users - PUT /groups/{id}/users doesn't delete former group members
* [OC-883] Need a click on button "log in using keyCloak" after login in implicit mode

== Task

* [OC-846] Update documentation for "OC-737 : Add an object entity in the user service"
* [OC-858] Refactoring UI Timeline code for circle content and position computing
* [OC-870] Refactoring cardWriteSerice class in cardPublication service
* [OC-869] Small improvements in karate test
* [OC-658] gradle assemble shouldn't run the ui unit tests
* [OC-878] remove unnecessary utilities time classes
* [OC-547] remove unnecessary UI test
* [OC-880] modify KeyCloak configuration to facilitate dev
* [OC-882] Remove unused publishTestData method in cardConsultation service




2 changes: 1 addition & 1 deletion ui/main/src/app/app.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<div class="app-content opfab-bgcolor" calcHeightDirective fixedHeightClass="fixed-height-main-layout" calcHeightClass="calc-height-main-layout" >
<of-navbar *ngIf="isAuthenticated$"></of-navbar>
<router-outlet *ngIf="isAuthenticated$ && configLoaded" ></router-outlet>
<of-login *ngIf="!isAuthenticated$ && configLoaded"></of-login>
<of-login *ngIf="!isAuthenticated$ && !useCodeOrImplicitFlow"></of-login>
<div *ngIf="!configLoaded">
<span *ngIf="!maxedRetries">
Application is loading ...
Expand Down
178 changes: 0 additions & 178 deletions ui/main/src/app/app.component.spec.ts

This file was deleted.

83 changes: 44 additions & 39 deletions ui/main/src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,15 @@
*/


import {Component, OnInit} from '@angular/core';
import {Title} from '@angular/platform-browser';
import {select, Store} from '@ngrx/store';
import {Observable} from 'rxjs';
import {AppState} from '@ofStore/index';
import {selectCurrentUrl, selectRouterState} from '@ofSelectors/router.selectors';
import {AuthenticationService} from '@ofServices/authentication/authentication.service';
import {LoadConfig} from '@ofActions/config.actions';
import {buildConfigSelector, selectConfigLoaded, selectMaxedRetries} from '@ofSelectors/config.selectors';
import {I18nService} from '@ofServices/i18n.service';
import { Component, OnInit } from '@angular/core';
import { Title } from '@angular/platform-browser';
import { Store } from '@ngrx/store';
import { AppState } from '@ofStore/index';
import { AuthenticationService } from '@ofServices/authentication/authentication.service';
import { LoadConfig } from '@ofActions/config.actions';
import { buildConfigSelector, selectConfigLoaded, selectMaxedRetries } from '@ofSelectors/config.selectors';
import { selectIdentifier } from '@ofSelectors/authentication.selectors';
import { I18nService } from '@ofServices/i18n.service';

@Component({
selector: 'of-root',
Expand All @@ -24,54 +23,60 @@ import {I18nService} from '@ofServices/i18n.service';
})
export class AppComponent implements OnInit {
readonly title = 'OperatorFabric';
getRoutePE: Observable<any>;
currentPath: any;
isAuthenticated$ = false;
configLoaded = false;
useCodeOrImplicitFlow = true;
private maxedRetries = false;

/**
* NB: I18nService is injected to trigger its constructor at application startup
* @param store
* @param i18nService
*/
constructor(private store: Store<AppState>,
private i18nService: I18nService,
private titleService: Title
private i18nService: I18nService,
private titleService: Title
, private authenticationService: AuthenticationService) {
this.getRoutePE = this.store.pipe(select(selectRouterState));
}

public setTitle(newTitle: string) {
this.titleService.setTitle(newTitle);
}

/**
* On Init the app take trace of the current url and of the authentication status
* Once the subscription done, send an Action to Check the current authentication status.
*/
ngOnInit() {

this.store.pipe(select(selectCurrentUrl)).subscribe(url => this.currentPath = url);
this.loadConfiguration();
this.launchAuthenticationProcessWhenConfigurationLoaded();
this.waitForUserTobeAuthenticated();
this.setTitle();
}

private loadConfiguration() {
this.store.dispatch(new LoadConfig());
this.store
.select(selectMaxedRetries)
.subscribe((maxedRetries => this.maxedRetries = maxedRetries));
}

private launchAuthenticationProcessWhenConfigurationLoaded() {
this.store
.select(selectConfigLoaded)
.subscribe(loaded => {
this.authenticationService.initializeAuthentication();
this.authenticationService.linkAuthenticationStatus(
(isAuthenticated: boolean) => {
this.isAuthenticated$ = isAuthenticated;
if (loaded) {
this.authenticationService.initializeAuthentication();
this.useCodeOrImplicitFlow = this.authenticationService.isAuthModeCodeOrImplicitFlow();
}
this.configLoaded = loaded;
});
this.configLoaded = loaded
});
}

private waitForUserTobeAuthenticated() {
this.store
.select(selectMaxedRetries)
.subscribe((maxedRetries => this.maxedRetries = maxedRetries));
this.store.dispatch(new LoadConfig());
.select(selectIdentifier)
.subscribe(identifier => {
if (identifier) this.isAuthenticated$ = true;
});
}

const sTitle = this.store.select(buildConfigSelector('title', this.title));
sTitle.subscribe(data => {
this.setTitle(data);
});
private setTitle() {
this.store
.select(buildConfigSelector('title', this.title))
.subscribe(data => {
this.titleService.setTitle(data);
});
}
}
Loading

0 comments on commit 41dd2cb

Please sign in to comment.