diff --git a/src/docs/asciidoc/docs/release_notes.adoc b/src/docs/asciidoc/docs/release_notes.adoc
index 84c024b555..061002e533 100644
--- a/src/docs/asciidoc/docs/release_notes.adoc
+++ b/src/docs/asciidoc/docs/release_notes.adoc
@@ -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]
@@ -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]
@@ -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
+
+
+
+
diff --git a/ui/main/src/app/app.component.html b/ui/main/src/app/app.component.html
index b7a2846521..84c16e1d26 100644
--- a/ui/main/src/app/app.component.html
+++ b/ui/main/src/app/app.component.html
@@ -9,7 +9,7 @@
-
+
Application is loading ...
diff --git a/ui/main/src/app/app.component.spec.ts b/ui/main/src/app/app.component.spec.ts
deleted file mode 100644
index 579ed3f83c..0000000000
--- a/ui/main/src/app/app.component.spec.ts
+++ /dev/null
@@ -1,178 +0,0 @@
-/* Copyright (c) 2020, RTE (http://www.rte-france.com)
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- */
-
-
-import {async, TestBed} from '@angular/core/testing';
-import {AppComponent} from './app.component';
-import {RouterTestingModule} from '@angular/router/testing';
-import {Store, StoreModule} from '@ngrx/store';
-import {appReducer, AppState} from '@ofStore/index';
-import {BrowserDynamicTestingModule, platformBrowserDynamicTesting} from '@angular/platform-browser-dynamic/testing';
-import {of} from 'rxjs';
-import {NavbarComponent} from './components/navbar/navbar.component';
-import {NgbModule} from '@ng-bootstrap/ng-bootstrap';
-import {selectCurrentUrl} from '@ofSelectors/router.selectors';
-import {IconComponent} from './components/navbar/icon/icon.component';
-import {TranslateModule} from '@ngx-translate/core';
-import {NO_ERRORS_SCHEMA} from '@angular/core';
-import {I18nService} from '@ofServices/i18n.service';
-import {Title} from '@angular/platform-browser';
-import {MockStore, provideMockStore} from '@ngrx/store/testing';
-import {emptyAppState4Test} from '@tests/helpers';
-import {AuthenticationImportHelperForSpecs} from '@ofServices/authentication/authentication.service.spec';
-import {HttpClientTestingModule} from '@angular/common/http/testing';
-import createSpyObj = jasmine.createSpyObj;
-import {AuthenticationService} from '@ofServices/authentication/authentication.service';
-
-
-describe('AppComponent', () => {
-
- let store: Store;
- let fixture;
-
- beforeEach(async(() => {
- TestBed.resetTestEnvironment();
- TestBed.initTestEnvironment(BrowserDynamicTestingModule,
- platformBrowserDynamicTesting());
- TestBed.configureTestingModule({
- imports: [
- NgbModule.forRoot(),
- StoreModule.forRoot(appReducer),
- TranslateModule.forRoot(),
- // solution 4 RouterTestingModule: https://github.com/coreui/coreui-free-bootstrap-admin-template/issues/202
- RouterTestingModule,
- HttpClientTestingModule
- ],
- declarations: [AppComponent, NavbarComponent, IconComponent],
- providers: [{provide: store, useClass: Store}, I18nService, AuthenticationImportHelperForSpecs],
- schemas: [ NO_ERRORS_SCHEMA ]
- }).compileComponents();
- store = TestBed.get(Store);
- spyOn(store, 'dispatch').and.callThrough();
- // avoid exceptions during construction and init of the component
- spyOn(store, 'select').and.callFake((obj) => {
- if (obj === selectCurrentUrl) {
- // called in ngOnInit and passed to mat-tab-url
- return of('/test/url');
- }
- return of(null);
- }
- );
- fixture = TestBed.createComponent(AppComponent);
- }));
-
- it('should create the app', async(() => {
- const app = fixture.debugElement.componentInstance;
- expect(app).toBeTruthy();
- }));
-
- it(`should have the title 'OperatorFabric' by default`, async(() => {
- const app = fixture.debugElement.componentInstance;
- expect(app.title).toEqual('OperatorFabric');
- }));
-
- it('should init the app', async(() => {
- const app = fixture.debugElement.componentInstance;
- app.ngOnInit();
- fixture.detectChanges();
- expect(app).toBeTruthy();
- }));
-
-});
-
-describe('AppComponent', () => {
-
- let store: MockStore;
- let fixture;
- const i18nServiceSpy = createSpyObj('i18NService', ['changeLocale']);
- const authServiceSpy = createSpyObj('AuthenticationService', ['initializeAuthentication',
- 'linkAuthenticationStatus']);
-
- let titleService: Title;
-
- const initialState = {
- ...emptyAppState4Test
- , authentication: { expirationDate: null}
- } as AppState;
- /* Using authInitialState to declare expirationDate (required) caused an error because it is not
- * defined in this scope.*/
-
- beforeEach(async(() => {
- TestBed.resetTestEnvironment();
- TestBed.initTestEnvironment(BrowserDynamicTestingModule, platformBrowserDynamicTesting());
-
- TestBed.configureTestingModule({
- imports: [
- NgbModule.forRoot(),
- // solution 4 RouterTestingModule: https://github.com/coreui/coreui-free-bootstrap-admin-template/issues/202
- RouterTestingModule
- ],
-
- declarations: [AppComponent],
- providers: [
- provideMockStore({initialState}),
- {provide: I18nService, useValue: i18nServiceSpy},
- Title,
- {provide: AuthenticationService, useValue: authServiceSpy}],
- schemas: [NO_ERRORS_SCHEMA]
- }).compileComponents();
- store = TestBed.get(Store);
- fixture = TestBed.createComponent(AppComponent);
- titleService = TestBed.get(Title);
- }));
-
- it(`should have the title 'toto' as set in Config service`, async(() => {
-
- store.setState({
- ...initialState
- , config: {
- loading: false,
- loaded: false,
- error: null,
- retry: 0,
- config: {title: 'toto'}
- }
- });
- fixture.detectChanges();
- expect(titleService.getTitle()).toEqual('toto');
- }));
-
- it(`should have the default title 'OperatorFabric' when title is set to '' in Config service`,
- async(() => {
-
- store.setState({
- ...initialState
- , config: {
- loading: false,
- loaded: false,
- error: null,
- retry: 0,
- config: {title: ''}
- }
- });
- fixture.detectChanges();
- expect(titleService.getTitle()).toEqual('OperatorFabric');
- }));
-
- it(`should have the default title 'OperatorFabric' when title parameter not present in Config service`,
- async(() => {
-
- store.setState({
- ...initialState
- , config: {
- loading: false,
- loaded: false,
- error: null,
- retry: 0,
- config: {}
- }
- });
- fixture.detectChanges();
- expect(titleService.getTitle()).toEqual('OperatorFabric');
- }));
-});
-
diff --git a/ui/main/src/app/app.component.ts b/ui/main/src/app/app.component.ts
index c975abd650..b6e7dc4e14 100644
--- a/ui/main/src/app/app.component.ts
+++ b/ui/main/src/app/app.component.ts
@@ -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',
@@ -24,54 +23,60 @@ import {I18nService} from '@ofServices/i18n.service';
})
export class AppComponent implements OnInit {
readonly title = 'OperatorFabric';
- getRoutePE: Observable;
- 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,
- 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);
+ });
}
}
diff --git a/ui/main/src/app/components/login/login.component.html b/ui/main/src/app/components/login/login.component.html
index e8f71f481c..aca3aa3c24 100644
--- a/ui/main/src/app/components/login/login.component.html
+++ b/ui/main/src/app/components/login/login.component.html
@@ -9,7 +9,7 @@