Commit 93207518 authored by Tifenn Guillas's avatar Tifenn Guillas
Browse files

#7 => DONE, #27 => WIP: criteria DONE

parent e9bf0c3a
......@@ -2,26 +2,26 @@
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "projects",
"cli": {
"packageManager": "yarn"
},
"projects": {
"anis-v3-client": {
"toto": {
"projectType": "application",
"schematics": {},
"root": "",
"sourceRoot": "src",
"projectType": "application",
"prefix": "app",
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"outputPath": "dist",
"outputPath": "dist/toto",
"index": "src/index.html",
"main": "src/main.ts",
"tsConfig": "src/tsconfig.app.json",
"polyfills": "src/polyfills.ts",
"tsConfig": "tsconfig.app.json",
"aot": false,
"assets": [
"src/assets",
"src/favicon.ico"
"src/favicon.ico",
"src/assets"
],
"styles": [
"node_modules/bootstrap/dist/css/bootstrap.min.css",
......@@ -36,6 +36,12 @@
},
"configurations": {
"production": {
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
}
],
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
......@@ -45,10 +51,11 @@
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true,
"fileReplacements": [
"budgets": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
"type": "initial",
"maximumWarning": "2mb",
"maximumError": "5mb"
}
]
}
......@@ -57,86 +64,63 @@
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"options": {
"browserTarget": "anis-v3-client:build"
"browserTarget": "toto:build"
},
"configurations": {
"production": {
"browserTarget": "anis-v3-client:build:production"
"browserTarget": "toto:build:production"
}
}
},
"extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n",
"options": {
"browserTarget": "anis-v3-client:build"
"browserTarget": "toto:build"
}
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"main": "src/test.ts",
"karmaConfig": "./karma.conf.js",
"polyfills": "src/polyfills.ts",
"tsConfig": "src/tsconfig.spec.json",
"scripts": [],
"tsConfig": "tsconfig.spec.json",
"karmaConfig": "karma.conf.js",
"assets": [
"src/favicon.ico",
"src/assets"
],
"styles": [
"node_modules/bootstrap/dist/css/bootstrap.min.css",
"src/styles.css"
],
"assets": [
"src/assets",
"src/favicon.ico"
]
"scripts": []
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"src/tsconfig.app.json",
"src/tsconfig.spec.json"
"tsconfig.app.json",
"tsconfig.spec.json",
"e2e/tsconfig.json"
],
"exclude": [
"**/node_modules/**"
]
}
}
}
},
"anis-v3-client-e2e": {
"root": "e2e",
"sourceRoot": "e2e",
"projectType": "application",
"architect": {
},
"e2e": {
"builder": "@angular-devkit/build-angular:protractor",
"options": {
"protractorConfig": "./protractor.conf.js",
"devServerTarget": "anis-v3-client:serve"
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"e2e/tsconfig.e2e.json"
],
"exclude": [
"**/node_modules/**"
]
"protractorConfig": "e2e/protractor.conf.js",
"devServerTarget": "toto:serve"
},
"configurations": {
"production": {
"devServerTarget": "toto:serve:production"
}
}
}
}
}
},
"defaultProject": "anis-v3-client",
"schematics": {
"@schematics/angular:component": {
"prefix": "app",
"styleext": "css"
},
"@schematics/angular:directive": {
"prefix": "app"
}
}
}
\ No newline at end of file
}},
"defaultProject": "toto"
}
# This file is used by the build system to adjust CSS and JS output to support the specified browsers below.
# For additional information regarding the format and rule options, please see:
# https://github.com/browserslist/browserslist#queries
# You can see what browsers were selected by your queries by running:
# npx browserslist
> 0.5%
last 2 versions
Firefox ESR
not dead
not IE 9-11 # For IE 9-11 support, remove 'not'.
\ No newline at end of file
FROM node:11
RUN yarn global add @angular/cli
RUN ng config -g cli.packageManager yarn
CMD ["bash"]
import { AppPage } from './app.po';
import { browser, logging } from 'protractor';
describe('anis-v3-client App', () => {
describe('workspace-project App', () => {
let page: AppPage;
beforeEach(() => {
......@@ -9,6 +10,14 @@ describe('anis-v3-client App', () => {
it('should display welcome message', () => {
page.navigateTo();
expect(page.getParagraphText()).toEqual('Welcome to app!');
expect(page.getTitleText()).toEqual('Welcome to toto!');
});
afterEach(async () => {
// Assert that there are no errors emitted from the browser
const logs = await browser.manage().logs().get(logging.Type.BROWSER);
expect(logs).not.toContain(jasmine.objectContaining({
level: logging.Level.SEVERE,
} as logging.Entry));
});
});
......@@ -2,10 +2,10 @@ import { browser, by, element } from 'protractor';
export class AppPage {
navigateTo() {
return browser.get('/');
return browser.get(browser.baseUrl) as Promise<any>;
}
getParagraphText() {
return element(by.css('app-root h1')).getText();
getTitleText() {
return element(by.css('app-root h1')).getText() as Promise<string>;
}
}
......@@ -2,7 +2,6 @@
"extends": "../tsconfig.json",
"compilerOptions": {
"outDir": "../out-tsc/e2e",
"baseUrl": "./",
"module": "commonjs",
"target": "es5",
"types": [
......
......@@ -12,20 +12,21 @@ module.exports = function (config) {
require('karma-coverage-istanbul-reporter'),
require('@angular-devkit/build-angular/plugins/karma')
],
client:{
client: {
clearContext: false // leave Jasmine Spec Runner output visible in browser
},
coverageIstanbulReporter: {
dir: require('path').join(__dirname, 'coverage'), reports: [ 'html', 'lcovonly' ],
dir: require('path').join(__dirname, './coverage/toto'),
reports: ['html', 'lcovonly', 'text-summary'],
fixWebpackSourcePaths: true
},
reporters: ['progress', 'kjhtml'],
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
autoWatch: true,
browsers: ['Chrome'],
singleRun: false
singleRun: false,
restartOnFileChange: true
});
};
This diff is collapsed.
{
"name": "anis-v3-client",
"name": "toto",
"version": "0.0.0",
"license": "MIT",
"scripts": {
"ng": "ng",
"start": "ng serve",
......@@ -12,47 +11,46 @@
},
"private": true,
"dependencies": {
"@angular/animations": "^6.1.0",
"@angular/common": "^6.1.0",
"@angular/compiler": "^6.1.0",
"@angular/core": "^6.1.0",
"@angular/forms": "^6.1.0",
"@angular/http": "^6.1.0",
"@angular/platform-browser": "^6.1.0",
"@angular/platform-browser-dynamic": "^6.1.0",
"@angular/router": "^6.1.0",
"@fortawesome/fontawesome-free": "^5.3.1",
"@ng-select/ng-select": "^2.10.1",
"@ngrx/effects": "^6.1.0",
"@ngrx/router-store": "^6.1.0",
"@ngrx/store": "^6.1.0",
"@ngrx/store-devtools": "^6.1.0",
"bootstrap": "^4.1.3",
"core-js": "^2.5.4",
"ngx-bootstrap": "^3.0.1",
"ngx-toastr": "^9.0.2",
"rxjs": "^6.2.2",
"zone.js": "^0.8.26"
"@angular/animations": "~8.0.1",
"@angular/common": "~8.0.1",
"@angular/compiler": "~8.0.1",
"@angular/core": "~8.0.1",
"@angular/forms": "~8.0.1",
"@angular/platform-browser": "~8.0.1",
"@angular/platform-browser-dynamic": "~8.0.1",
"@angular/router": "~8.0.1",
"@fortawesome/fontawesome-free": "^5.9.0",
"@ng-select/ng-select": "^2.20.0",
"@ngrx/effects": "^8.0.1",
"@ngrx/router-store": "^8.0.1",
"@ngrx/store": "^8.0.1",
"@ngrx/store-devtools": "^8.0.1",
"bootstrap": "^4.3.1",
"ngx-bootstrap": "^4.3.0",
"ngx-toastr": "^10.0.4",
"rxjs": "~6.4.0",
"tslib": "^1.9.0",
"zone.js": "~0.9.1"
},
"devDependencies": {
"@angular-devkit/build-angular": "~0.7.0",
"@angular/cli": "^6.1.5",
"@angular/compiler-cli": "^6.1.0",
"@angular/language-service": "^6.1.0",
"@types/jasmine": "~2.8.6",
"@angular-devkit/build-angular": "~0.800.0",
"@angular/cli": "~8.0.3",
"@angular/compiler-cli": "~8.0.1",
"@angular/language-service": "~8.0.1",
"@types/jasmine": "~3.3.8",
"@types/jasminewd2": "~2.0.3",
"@types/node": "~8.9.4",
"codelyzer": "~4.2.1",
"jasmine-core": "~2.99.1",
"codelyzer": "^5.0.0",
"jasmine-core": "~3.4.0",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~1.7.1",
"karma": "~4.1.0",
"karma-chrome-launcher": "~2.2.0",
"karma-coverage-istanbul-reporter": "^2.0.0",
"karma-jasmine": "~1.1.1",
"karma-jasmine-html-reporter": "^0.2.2",
"karma-coverage-istanbul-reporter": "~2.0.1",
"karma-jasmine": "~2.0.1",
"karma-jasmine-html-reporter": "^1.4.0",
"protractor": "~5.4.0",
"ts-node": "~5.0.1",
"tslint": "~5.9.1",
"typescript": "~2.7.2"
"ts-node": "~7.0.0",
"tslint": "~5.15.0",
"typescript": "~3.4.3"
}
}
// Protractor configuration file, see link for more information
// https://github.com/angular/protractor/blob/master/lib/config.ts
const { SpecReporter } = require('jasmine-spec-reporter');
exports.config = {
allScriptsTimeout: 11000,
specs: [
'./e2e/**/*.e2e-spec.ts'
],
capabilities: {
'browserName': 'chrome'
},
directConnect: true,
baseUrl: 'http://localhost:4200/',
framework: 'jasmine',
jasmineNodeOpts: {
showColors: true,
defaultTimeoutInterval: 30000,
print: function() {}
},
onPrepare() {
require('ts-node').register({
project: 'e2e/tsconfig.e2e.json'
});
jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } }));
}
};
......@@ -24,7 +24,7 @@ import { environment } from '../environments/environment';
BrowserAnimationsModule,
HttpClientModule,
StoreModule.forRoot(reducers, { metaReducers }),
StoreRouterConnectingModule,
StoreRouterConnectingModule.forRoot(),
!environment.production ? StoreDevtoolsModule.instrument() : [],
EffectsModule.forRoot([]),
CoreModule,
......
import { Action } from '@ngrx/store';
import { CriteriaFamily, Attribute, DatasetCriteriaFamily, AttributeOption } from '../model';
import { Family, Attribute } from '../model';
export const LOAD_CRITERIA_FAMILY_LIST = 'Load Criteria Family List';
export const LOAD_CRITERIA_FAMILY_LIST_SUCCESS = 'Load Criteria Family List Success';
......@@ -24,7 +24,7 @@ export class LoadCriteriaFamilyListAction implements Action {
export class LoadCriteriaFamilyListSuccessAction implements Action {
type = LOAD_CRITERIA_FAMILY_LIST_SUCCESS;
constructor(public payload: CriteriaFamily[]) { }
constructor(public payload: Family[]) { }
}
export class LoadCriteriaFamilyListFailedAction implements Action {
......@@ -57,36 +57,12 @@ export class LoadDatasetCriteriaFamilyAction implements Action {
constructor(public payload: string) { }
}
export class LoadDatasetCriteriaFamilySuccessAction implements Action {
type = LOAD_DATASET_CRITERIA_FAMILY_SUCCESS;
constructor(public payload: DatasetCriteriaFamily[]) { }
}
export class LoadDatasetCriteriaFamilyFailedAction implements Action {
type = LOAD_DATASET_CRITERIA_FAMILY_FAILED;
constructor(public payload: {} = null) { }
}
export class LoadAttributeOptionListAction implements Action {
type = LOAD_ATTRIBUTE_OPTION_LIST;
constructor(public payload: string) { }
}
export class LoadAttributeOptionListSuccessAction implements Action {
type = LOAD_ATTRIBUTE_OPTION_LIST_SUCCESS;
constructor(public payload: AttributeOption[]) { }
}
export class LoadAttributeOptionListFailedAction implements Action {
type = LOAD_ATTRIBUTE_OPTION_LIST_FAILED;
constructor(public payload: {} = null) { }
}
export type Actions
= LoadCriteriaFamilyListAction
| LoadCriteriaFamilyListSuccessAction
......@@ -95,8 +71,4 @@ export type Actions
| LoadDatasetAttributeListSuccessAction
| LoadDatasetAttributeListFailedAction
| LoadDatasetCriteriaFamilyAction
| LoadDatasetCriteriaFamilySuccessAction
| LoadDatasetCriteriaFamilyFailedAction
| LoadAttributeOptionListAction
| LoadAttributeOptionListSuccessAction
| LoadAttributeOptionListFailedAction;
| LoadDatasetCriteriaFamilyFailedAction;
......@@ -34,4 +34,4 @@ export class LoadDatasetSearchMetaFailAction implements Action {
export type Actions
= LoadDatasetSearchMetaAction
| LoadDatasetSearchMetaSuccessAction
| LoadDatasetSearchMetaFailAction
| LoadDatasetSearchMetaFailAction;
......@@ -3,9 +3,9 @@ import { Injectable } from '@angular/core';
import { ToastrService } from 'ngx-toastr';
import { Effect, Actions, ofType } from '@ngrx/effects';
import { of } from 'rxjs';
import { switchMap, map, catchError} from 'rxjs/operators';
import { switchMap, map, tap, catchError } from 'rxjs/operators';
import { CriteriaFamily, Attribute, DatasetCriteriaFamily, AttributeOption } from '../model';
import { Family, Attribute } from '../model';
import { CriteriaService } from '../services/criteria.service';
import * as criteriaActions from '../action/criteria.action';
......@@ -22,16 +22,16 @@ export class CriteriaEffects {
ofType(criteriaActions.LOAD_CRITERIA_FAMILY_LIST),
switchMap(() =>
this.criteriaService.retrieveCriteriaFamilyList().pipe(
map((criteriaFamilyList: CriteriaFamily[]) => new criteriaActions.LoadCriteriaFamilyListSuccessAction(criteriaFamilyList)),
map((criteriaFamilyList: Family[]) => new criteriaActions.LoadCriteriaFamilyListSuccessAction(criteriaFamilyList)),
catchError(() => of(new criteriaActions.LoadCriteriaFamilyListFailedAction()))
)
)
);
@Effect({dispatch: false})
@Effect({ dispatch: false })
loadCriteriaFamilyListFailedAction$ = this.actions$.pipe(
ofType(criteriaActions.LOAD_CRITERIA_FAMILY_LIST_FAILED),
map(_ => this.toastr.error('Loading Failed!', 'The criteria family list loading failed'))
tap(_ => this.toastr.error('Loading Failed!', 'The criteria family list loading failed'))
);
@Effect()
......@@ -45,45 +45,21 @@ export class CriteriaEffects {
)
);
@Effect({dispatch: false})
@Effect({ dispatch: false })
loadDatasetAttributeListFailedAction$ = this.actions$.pipe(
ofType(criteriaActions.LOAD_DATASET_ATTRIBUTE_LIST_FAILED),
map(_ => this.toastr.error('Loading Failed!', 'The dataset attribute list loading failed'))
tap(_ => this.toastr.error('Loading Failed!', 'The dataset attribute list loading failed'))
);
@Effect()
loadDatasetCriteriaFamilyListAction$ = this.actions$.pipe(
ofType(criteriaActions.LOAD_DATASET_CRITERIA_FAMILY),
switchMap((action: criteriaActions.LoadDatasetCriteriaFamilyAction) =>
this.criteriaService.retrieveDatasetCriteriaFamilyList(action.payload).pipe(
map((datasetCriteriaFamily: DatasetCriteriaFamily[]) =>
new criteriaActions.LoadDatasetCriteriaFamilySuccessAction(datasetCriteriaFamily)),
catchError(() => of(new criteriaActions.LoadDatasetCriteriaFamilyFailedAction()))
)
)
);
@Effect({dispatch: false})
@Effect({ dispatch: false })
loadDatasetCriteriaFamilyListFailedAction$ = this.actions$.pipe(
ofType(criteriaActions.LOAD_DATASET_CRITERIA_FAMILY_FAILED),
map(_ => this.toastr.error('Loading Failed!', 'The dataset criteria family list loading failed'))
);
@Effect()
loadAttributeOptionListAction$ = this.actions$.pipe(
ofType(criteriaActions.LOAD_ATTRIBUTE_OPTION_LIST),
switchMap((action: criteriaActions.LoadAttributeOptionListAction) =>
this.criteriaService.retrieveAttributeOptionList(action.payload).pipe(
map((attributeOptionList: AttributeOption[]) =>
new criteriaActions.LoadAttributeOptionListSuccessAction(attributeOptionList)),
catchError(() => of(new criteriaActions.LoadAttributeOptionListFailedAction()))
)
)
tap(_ => this.toastr.error('Loading Failed!', 'The dataset criteria family list loading failed'))
);
@Effect({dispatch: false})
@Effect({ dispatch: false })
loadAttributeOptionListFailedAction$ = this.actions$.pipe(
ofType(criteriaActions.LOAD_ATTRIBUTE_OPTION_LIST_FAILED),
map(_ => this.toastr.error('Loading Failed!', 'The attribute option list loading failed'))
tap(_ => this.toastr.error('Loading Failed!', 'The attribute option list loading failed'))
);
}
......@@ -4,7 +4,7 @@ import { ToastrService } from 'ngx-toastr';
import { Effect, Actions, ofType } from '@ngrx/effects';
import { of } from 'rxjs';
import { Store } from '@ngrx/store';
import { withLatestFrom, switchMap, map, catchError} from 'rxjs/operators';
import { withLatestFrom, switchMap, map, catchError, tap } from 'rxjs/operators';
import { Project, Dataset, DatasetFamily } from '../model';
import * as datasetActions from '../action/dataset.action';
......@@ -13,41 +13,41 @@ import { DatasetService } from '../services/dataset.service';
@Injectable()
export class DatasetEffects {
constructor(
private actions$: Actions,
private datasetService: DatasetService,
private toastr: ToastrService,
private store$: Store<{metamodel: fromMetamodel.State}>
) { }
constructor(
private actions$: Actions,
private datasetService: DatasetService,
private toastr: ToastrService,
private store$: Store<{ metamodel: fromMetamodel.State }>
) { }
@Effect()
loadDatasetSearchMetaAction$ = this.actions$.pipe(
ofType(datasetActions.LOAD_DATASET_SEARCH_META),
withLatestFrom(this.store$),
switchMap(([action, state]) => {
if (state.metamodel.dataset.datasetSearchMetaIsLoaded) {
return of({type: 'Dataset search meta is already loaded'});
} else {
return of(new datasetActions.LoadDatasetSearchMetaWipAction())
}
})
);
@Effect()
loadDatasetSearchMetaAction$ = this.actions$.pipe(
ofType(datasetActions.LOAD_DATASET_SEARCH_META),
withLatestFrom(this.store$),
switchMap(([action, state]) => {
if (state.metamodel.dataset.datasetSearchMetaIsLoaded) {