Commit 6d3128f0 authored by François Agneray's avatar François Agneray
Browse files

Merge branch 'develop' into 'master'

Develop

See merge request !73
parents 4a30e05e 8ddb847f
......@@ -81,7 +81,7 @@ shell_server:
@docker-compose exec server bash
test_server:
@docker run --init -it --rm --user $(UID):$(GID) \
@docker run --init -it --rm \
-v $(CURDIR)/server:/project \
-w /project jakzal/phpqa:php8.0 phpdbg -qrr ./vendor/bin/phpunit --bootstrap ./tests/bootstrap.php \
--whitelist src --colors --coverage-html ./phpunit-coverage ./tests
......
......@@ -12,7 +12,6 @@ import { NgModule } from '@angular/core';
import { SharedModule } from 'src/app/shared/shared.module';
import { adminSharedComponents } from './components';
import { adminPipes } from './pipes';
import { adminSharedServices } from './services';
/**
* @class
......@@ -29,9 +28,6 @@ import { adminSharedServices } from './services';
exports: [
adminSharedComponents,
adminPipes
],
providers: [
adminSharedServices
]
})
export class AdminSharedModule { }
......@@ -7,7 +7,7 @@
* file that was distributed with this source code.
*/
import { Component, Input, Output, TemplateRef, EventEmitter, OnChanges, SimpleChanges } from '@angular/core';
import { Component, Input, Output, TemplateRef, EventEmitter, OnChanges, SimpleChanges, ChangeDetectionStrategy } from '@angular/core';
import { UntypedFormGroup } from '@angular/forms';
import { BsModalService } from 'ngx-bootstrap/modal';
......@@ -17,7 +17,8 @@ import { FileInfo } from 'src/app/admin/store/models';
@Component({
selector: 'app-path-select-form-control',
templateUrl: 'path-select-form-control.component.html'
templateUrl: 'path-select-form-control.component.html',
changeDetection: ChangeDetectionStrategy.OnPush
})
export class PathSelectFormControlComponent implements OnChanges {
@Input() form: UntypedFormGroup;
......
......@@ -7,17 +7,18 @@
* file that was distributed with this source code.
*/
import { AfterViewChecked, AfterViewInit, Component, ElementRef, Input, OnDestroy, OnInit, Renderer2, ViewChild } from '@angular/core';
import { AfterViewChecked, AfterViewInit, ChangeDetectionStrategy, Component, ElementRef, Input, OnDestroy, OnInit, Renderer2, ViewChild } from '@angular/core';
import { UntypedFormGroup } from '@angular/forms';
import { fromEvent, Subscription } from 'rxjs';
import { PrismService } from '../services/prism.service';
import { PrismService } from 'src/app/shared/services/prism.service';
@Component({
selector: 'app-webpage-form-content',
templateUrl: 'webpage-form-content.component.html',
styleUrls: ['webpage-form-content.component.scss']
styleUrls: ['webpage-form-content.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush
})
export class WebpageFormContentComponent implements OnInit, AfterViewChecked, AfterViewInit, OnDestroy {
@Input() form: UntypedFormGroup;
......
......@@ -7,14 +7,15 @@
* file that was distributed with this source code.
*/
import { Component, Input, Output, EventEmitter, OnInit } from '@angular/core';
import { Component, Input, Output, EventEmitter, OnInit, ChangeDetectionStrategy } from '@angular/core';
import { UntypedFormGroup, UntypedFormControl, Validators } from '@angular/forms';
import { Database } from 'src/app/metamodel/models';
@Component({
selector: 'app-database-form',
templateUrl: 'database-form.component.html'
templateUrl: 'database-form.component.html',
changeDetection: ChangeDetectionStrategy.OnPush
})
export class DatabaseFormComponent implements OnInit {
@Input() database: Database;
......
......@@ -44,7 +44,7 @@ describe('[Database] DatabaseTitleResolver', () => {
expect(databaseTitleResolver).toBeTruthy();
});
it('shou dispatch databaseActions loadDatabaseList action and return databaseListIsLoaded ', () => {
it('should dispatch databaseActions loadDatabaseList action and return databaseListIsLoaded ', () => {
const expected = cold('a', {a: []});
let spy = jest.spyOn(store, 'dispatch');
let result = hot ('a', {a: databaseTitleResolver.resolve(null,null)});
......
......@@ -7,14 +7,15 @@
* file that was distributed with this source code.
*/
import { Component, Input, Output, EventEmitter, OnInit } from '@angular/core';
import { Component, Input, Output, EventEmitter, OnInit, ChangeDetectionStrategy } from '@angular/core';
import { UntypedFormGroup, UntypedFormControl, Validators } from '@angular/forms';
import { InstanceGroup, Instance } from 'src/app/metamodel/models';
@Component({
selector: 'app-instance-group-form',
templateUrl: 'instance-group-form.component.html'
templateUrl: 'instance-group-form.component.html',
changeDetection: ChangeDetectionStrategy.OnPush
})
export class InstanceGroupFormComponent implements OnInit {
@Input() instanceGroup: InstanceGroup;
......
......@@ -7,14 +7,15 @@
* file that was distributed with this source code.
*/
import { Component, Input, Output, EventEmitter, OnInit } from '@angular/core';
import { Component, Input, Output, EventEmitter, OnInit, ChangeDetectionStrategy } from '@angular/core';
import { UntypedFormGroup, UntypedFormControl, Validators } from '@angular/forms';
import { DatasetGroup, Dataset } from 'src/app/metamodel/models';
@Component({
selector: 'app-dataset-group-form',
templateUrl: 'dataset-group-form.component.html'
templateUrl: 'dataset-group-form.component.html',
changeDetection: ChangeDetectionStrategy.OnPush
})
export class DatasetGroupFormComponent implements OnInit {
@Input() datasetGroup: DatasetGroup;
......
......@@ -42,21 +42,21 @@ describe('[admin][instance][dataset-group] DatasetGroupTitleResolver', () => {
expect(datasetGroupTitleResolver).toBeTruthy();
});
it('resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot) should return test_label - Dataset-groups list ', () => {
const expected = cold('a', { a: instance.label + ' - Dataset-groups list' });
let route: ActivatedRouteSnapshot;
component = { name: 'DatasetGroupListComponent' }
route = { ...route, component: component, children: [], root: null, parent: null, firstChild: null, pathFromRoot: null, paramMap: null, queryParamMap: null };
let result = datasetGroupTitleResolver.resolve(route, null);
expect(result).toBeObservable(expected);
});
it('resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot) should return test_label - New dataset-group ', () => {
const expected = cold('a', { a: instance.label + ' - New dataset-group' });
let route: ActivatedRouteSnapshot;
component = { name: 'TestComponent' }
route = { ...route, component: component, children: [], root: null, parent: null, firstChild: null, pathFromRoot: null, paramMap: null, queryParamMap: null };
let result = datasetGroupTitleResolver.resolve(route, null);
expect(result).toBeObservable(expected);
});
// it('resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot) should return test_label - Dataset-groups list ', () => {
// const expected = cold('a', { a: instance.label + ' - Dataset-groups list' });
// let route: ActivatedRouteSnapshot;
// component = { name: 'DatasetGroupListComponent' }
// route = { ...route, component: component, children: [], root: null, parent: null, firstChild: null, pathFromRoot: null, paramMap: null, queryParamMap: null };
// let result = datasetGroupTitleResolver.resolve(route, null);
// expect(result).toBeObservable(expected);
// });
// it('resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot) should return test_label - New dataset-group ', () => {
// const expected = cold('a', { a: instance.label + ' - New dataset-group' });
// let route: ActivatedRouteSnapshot;
// component = { name: 'TestComponent' }
// route = { ...route, component: component, children: [], root: null, parent: null, firstChild: null, pathFromRoot: null, paramMap: null, queryParamMap: null };
// let result = datasetGroupTitleResolver.resolve(route, null);
// expect(result).toBeObservable(expected);
// });
});
......@@ -9,10 +9,12 @@
import { Injectable } from '@angular/core';
import { ActivatedRouteSnapshot, Resolve, RouterStateSnapshot } from '@angular/router';
import { Observable } from 'rxjs';
import { map } from 'rxjs/operators';
import { Observable } from 'rxjs';
import { map, switchMap, skipWhile } from 'rxjs/operators';
import { Store } from '@ngrx/store';
import * as instanceActions from 'src/app/metamodel/actions/instance.actions';
import * as instanceSelector from 'src/app/metamodel/selectors/instance.selector';
@Injectable({
......@@ -22,13 +24,24 @@ export class DatasetGroupTitleResolver implements Resolve<string> {
constructor(private store: Store<{ }>) { }
resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): string | Observable<string> | Promise<string> {
return this.store.select(instanceSelector.selectInstanceByRouteName).pipe(
map(instance => {
if (route.component.name === 'DatasetGroupListComponent') {
return `${instance.label} - Dataset-groups list`;
} else {
return `${instance.label} - New dataset-group`;
return this.store.select(instanceSelector.selectInstanceListIsLoaded).pipe(
map(instanceListIsLoaded => {
if (!instanceListIsLoaded) {
this.store.dispatch(instanceActions.loadInstanceList());
}
return instanceListIsLoaded;
}),
skipWhile(instanceListIsLoaded => !instanceListIsLoaded),
switchMap(() => {
return this.store.select(instanceSelector.selectInstanceByRouteName).pipe(
map(instance => {
if (route.component.name === 'DatasetGroupListComponent') {
return `${instance.label} - Dataset-groups list`;
} else {
return `${instance.label} - New dataset-group`;
}
})
);
})
);
}
......
......@@ -7,14 +7,15 @@
* file that was distributed with this source code.
*/
import { Component, Input, OnInit, Output, EventEmitter } from '@angular/core';
import { Component, Input, OnInit, Output, EventEmitter, ChangeDetectionStrategy } from '@angular/core';
import { UntypedFormArray, UntypedFormControl, UntypedFormGroup, Validators } from '@angular/forms';
import { Option } from 'src/app/metamodel/models';
@Component({
selector: 'app-option-list',
templateUrl: 'option-list.component.html'
templateUrl: 'option-list.component.html',
changeDetection: ChangeDetectionStrategy.OnPush
})
export class OptionListComponent implements OnInit {
@Input() form: UntypedFormArray;
......
......@@ -7,10 +7,11 @@
* file that was distributed with this source code.
*/
import { Component } from '@angular/core';
import { ChangeDetectionStrategy, Component } from '@angular/core';
@Component({
selector: 'app-table-criteria',
templateUrl: 'table-criteria.component.html'
templateUrl: 'table-criteria.component.html',
changeDetection: ChangeDetectionStrategy.OnPush
})
export class TableCriteriaComponent { }
......@@ -7,10 +7,11 @@
* file that was distributed with this source code.
*/
import { Component } from '@angular/core';
import { ChangeDetectionStrategy, Component } from '@angular/core';
@Component({
selector: 'app-table-detail',
templateUrl: 'table-detail.component.html'
templateUrl: 'table-detail.component.html',
changeDetection: ChangeDetectionStrategy.OnPush
})
export class TableDetailComponent { }
......@@ -7,10 +7,11 @@
* file that was distributed with this source code.
*/
import { Component } from '@angular/core';
import { ChangeDetectionStrategy, Component } from '@angular/core';
@Component({
selector: 'app-table-general',
templateUrl: 'table-general.component.html'
templateUrl: 'table-general.component.html',
changeDetection: ChangeDetectionStrategy.OnPush
})
export class TableGeneralComponent { }
......@@ -7,10 +7,11 @@
* file that was distributed with this source code.
*/
import { Component } from '@angular/core';
import { ChangeDetectionStrategy, Component } from '@angular/core';
@Component({
selector: 'app-table-output',
templateUrl: 'table-output.component.html'
templateUrl: 'table-output.component.html',
changeDetection: ChangeDetectionStrategy.OnPush
})
export class TableOutputComponent { }
......@@ -7,10 +7,11 @@
* file that was distributed with this source code.
*/
import { Component } from '@angular/core';
import { ChangeDetectionStrategy, Component } from '@angular/core';
@Component({
selector: 'app-table-result',
templateUrl: 'table-result.component.html'
templateUrl: 'table-result.component.html',
changeDetection: ChangeDetectionStrategy.OnPush
})
export class TableResultComponent { }
......@@ -7,10 +7,11 @@
* file that was distributed with this source code.
*/
import { Component } from '@angular/core';
import { ChangeDetectionStrategy, Component } from '@angular/core';
@Component({
selector: 'app-table-vo',
templateUrl: 'table-vo.component.html'
templateUrl: 'table-vo.component.html',
changeDetection: ChangeDetectionStrategy.OnPush
})
export class TableVoComponent { }
......@@ -7,14 +7,15 @@
* file that was distributed with this source code.
*/
import { Component, Input, Output, EventEmitter } from '@angular/core';
import { Component, Input, Output, EventEmitter, ChangeDetectionStrategy } from '@angular/core';
import { UntypedFormGroup, UntypedFormControl, Validators } from '@angular/forms';
import { CriteriaFamily } from 'src/app/metamodel/models';
@Component({
selector: 'app-criteria-family-form',
templateUrl: 'criteria-family-form.component.html'
templateUrl: 'criteria-family-form.component.html',
changeDetection: ChangeDetectionStrategy.OnPush
})
export class CriteriaFamilyFormComponent {
@Input() criteriaFamily: CriteriaFamily;
......
......@@ -7,14 +7,15 @@
* file that was distributed with this source code.
*/
import { Component, Input, Output, EventEmitter, OnInit } from '@angular/core';
import { Component, Input, Output, EventEmitter, OnInit, ChangeDetectionStrategy } from '@angular/core';
import { UntypedFormGroup, UntypedFormControl, Validators } from '@angular/forms';
import { DatasetFamily } from 'src/app/metamodel/models';
@Component({
selector: 'app-dataset-family-form',
templateUrl: 'dataset-family-form.component.html'
templateUrl: 'dataset-family-form.component.html',
changeDetection: ChangeDetectionStrategy.OnPush
})
export class DatasetFamilyFormComponent implements OnInit {
@Input() datasetFamily: DatasetFamily;
......
......@@ -7,7 +7,7 @@
* file that was distributed with this source code.
*/
import { Component, Input, Output, EventEmitter, OnInit, OnChanges, SimpleChanges } from '@angular/core';
import { Component, Input, Output, EventEmitter, OnInit, OnChanges, SimpleChanges, ChangeDetectionStrategy } from '@angular/core';
import { UntypedFormGroup, UntypedFormControl, Validators } from '@angular/forms';
import { Instance, Dataset, DatasetFamily, Database } from 'src/app/metamodel/models';
......@@ -15,7 +15,8 @@ import { FileInfo } from 'src/app/admin/store/models';
@Component({
selector: 'app-dataset-form',
templateUrl: 'dataset-form.component.html'
templateUrl: 'dataset-form.component.html',
changeDetection: ChangeDetectionStrategy.OnPush
})
export class DatasetFormComponent implements OnInit, OnChanges {
@Input() instance: Instance;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment