TSK-625 Angular update from 5 to 6
Update from angular 5.2 to 6.0.9
This commit is contained in:
parent
f755b7736a
commit
b1d0f4acdd
|
@ -18,7 +18,7 @@ stages:
|
|||
|
||||
env:
|
||||
global:
|
||||
- NODE_VERSION=6
|
||||
- NODE_VERSION=8
|
||||
matrix:
|
||||
- DB=H2
|
||||
- DB=DB2_10_5
|
||||
|
@ -39,7 +39,7 @@ jobs:
|
|||
- stage: Build
|
||||
install:
|
||||
- nvm install $NODE_VERSION
|
||||
&& (cd web && npm install)
|
||||
&& (cd web && npm install && npm rebuild node-sass)
|
||||
&& ci/change_version.sh -m "lib/ rest/" -swarm lib/taskana-cdi/src/test/java/pro/taskana/TaskanaProducersTest.java
|
||||
script:
|
||||
- (cd web && npm run build:prod)
|
||||
|
|
|
@ -1,52 +0,0 @@
|
|||
{
|
||||
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
|
||||
"project": {
|
||||
"name": "admin"
|
||||
},
|
||||
"apps": [
|
||||
{
|
||||
"root": "src",
|
||||
"outDir": "dist",
|
||||
"assets": [
|
||||
"assets",
|
||||
"environments/data-sources"
|
||||
],
|
||||
"index": "index.html",
|
||||
"main": "main.ts",
|
||||
"polyfills": "polyfills.ts",
|
||||
"test": "test.ts",
|
||||
"tsconfig": "tsconfig.app.json",
|
||||
"testTsconfig": "tsconfig.spec.json",
|
||||
"prefix": "app",
|
||||
"styles": [
|
||||
"./assets/_styles.scss"
|
||||
],
|
||||
"scripts": [
|
||||
"../node_modules/jquery/dist/jquery.min.js",
|
||||
"../node_modules/bootstrap/dist/js/bootstrap.min.js"
|
||||
],
|
||||
"environmentSource": "environments/environment.ts",
|
||||
"environments": {
|
||||
"dev": "environments/environment.ts",
|
||||
"prod": "environments/environment.prod.ts"
|
||||
}
|
||||
}
|
||||
],
|
||||
"lint": [
|
||||
{
|
||||
"project": "src/tsconfig.app.json"
|
||||
},
|
||||
{
|
||||
"project": "src/tsconfig.spec.json"
|
||||
}
|
||||
],
|
||||
"test": {
|
||||
"karma": {
|
||||
"config": "./karma.conf.js"
|
||||
}
|
||||
},
|
||||
"defaults": {
|
||||
"styleExt": "scss",
|
||||
"component": {}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,117 @@
|
|||
{
|
||||
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
|
||||
"version": 1,
|
||||
"newProjectRoot": "projects",
|
||||
"projects": {
|
||||
"admin": {
|
||||
"root": "",
|
||||
"sourceRoot": "src",
|
||||
"projectType": "application",
|
||||
"architect": {
|
||||
"build": {
|
||||
"builder": "@angular-devkit/build-angular:browser",
|
||||
"options": {
|
||||
"outputPath": "dist",
|
||||
"index": "src/index.html",
|
||||
"main": "src/main.ts",
|
||||
"tsConfig": "src/tsconfig.app.json",
|
||||
"polyfills": "src/polyfills.ts",
|
||||
"assets": [
|
||||
"src/assets",
|
||||
"src/environments/data-sources"
|
||||
],
|
||||
"styles": [
|
||||
"src/assets/_styles.scss"
|
||||
],
|
||||
"scripts": [
|
||||
"node_modules/jquery/dist/jquery.min.js",
|
||||
"node_modules/bootstrap/dist/js/bootstrap.min.js"
|
||||
]
|
||||
},
|
||||
"configurations": {
|
||||
"production": {
|
||||
"optimization": true,
|
||||
"outputHashing": "all",
|
||||
"sourceMap": false,
|
||||
"extractCss": true,
|
||||
"namedChunks": false,
|
||||
"aot": true,
|
||||
"extractLicenses": true,
|
||||
"vendorChunk": false,
|
||||
"buildOptimizer": true,
|
||||
"progress": true,
|
||||
"fileReplacements": [
|
||||
{
|
||||
"replace": "src/environments/environment.ts",
|
||||
"with": "src/environments/environment.prod.ts"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"serve": {
|
||||
"builder": "@angular-devkit/build-angular:dev-server",
|
||||
"options": {
|
||||
"browserTarget": "admin:build"
|
||||
},
|
||||
"configurations": {
|
||||
"production": {
|
||||
"browserTarget": "admin:build:production"
|
||||
}
|
||||
}
|
||||
},
|
||||
"extract-i18n": {
|
||||
"builder": "@angular-devkit/build-angular:extract-i18n",
|
||||
"options": {
|
||||
"browserTarget": "admin: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": [
|
||||
"node_modules/jquery/dist/jquery.min.js",
|
||||
"node_modules/bootstrap/dist/js/bootstrap.min.js"
|
||||
],
|
||||
"styles": [
|
||||
"src/assets/_styles.scss"
|
||||
],
|
||||
"assets": [
|
||||
"src/assets",
|
||||
"src/environments/data-sources"
|
||||
]
|
||||
}
|
||||
},
|
||||
"lint": {
|
||||
"builder": "@angular-devkit/build-angular:tslint",
|
||||
"options": {
|
||||
"tsConfig": [
|
||||
"src/tsconfig.app.json",
|
||||
"src/tsconfig.spec.json"
|
||||
],
|
||||
"exclude": []
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"admin-e2e": {
|
||||
"root": "",
|
||||
"sourceRoot": "e2e",
|
||||
"projectType": "application"
|
||||
}
|
||||
},
|
||||
"defaultProject": "admin",
|
||||
"schematics": {
|
||||
"@schematics/angular:component": {
|
||||
"prefix": "app",
|
||||
"styleext": "scss"
|
||||
},
|
||||
"@schematics/angular:directive": {
|
||||
"prefix": "app"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -4,36 +4,32 @@
|
|||
module.exports = function (config) {
|
||||
config.set({
|
||||
basePath: '',
|
||||
frameworks: ['jasmine', '@angular/cli'],
|
||||
frameworks: ['jasmine', '@angular-devkit/build-angular'],
|
||||
plugins: [
|
||||
require('karma-jasmine'),
|
||||
require('karma-chrome-launcher'),
|
||||
require('karma-jasmine-html-reporter'),
|
||||
require('karma-coverage-istanbul-reporter'),
|
||||
require('@angular/cli/plugins/karma'),
|
||||
require('karma-firefox-launcher'),
|
||||
require('karma-phantomjs-launcher')
|
||||
require('@angular-devkit/build-angular/plugins/karma'),
|
||||
require('karma-firefox-launcher')
|
||||
],
|
||||
client: {
|
||||
clearContext: false // leave Jasmine Spec Runner output visible in browser
|
||||
},
|
||||
files: [
|
||||
{ pattern: './src/test.ts', watched: false }
|
||||
|
||||
],
|
||||
preprocessors: {
|
||||
'./src/test.ts': ['@angular/cli']
|
||||
|
||||
},
|
||||
mime: {
|
||||
'text/x-typescript': ['ts', 'tsx']
|
||||
},
|
||||
coverageIstanbulReporter: {
|
||||
reports: ['html', 'lcovonly'],
|
||||
dir: require('path').join(__dirname, 'coverage'), reports: ['html', 'lcovonly'],
|
||||
fixWebpackSourcePaths: true
|
||||
},
|
||||
angularCli: {
|
||||
environment: 'dev'
|
||||
//codeCoverage: true
|
||||
},
|
||||
|
||||
reporters: config.angularCli && config.angularCli.codeCoverage
|
||||
? ['progress', 'coverage-istanbul']
|
||||
: ['progress', 'kjhtml'],
|
||||
|
@ -41,7 +37,7 @@ module.exports = function (config) {
|
|||
colors: true,
|
||||
logLevel: config.LOG_INFO,
|
||||
autoWatch: true,
|
||||
browsers: ['Firefox', 'PhantomJS'],
|
||||
browsers: ['Firefox'],
|
||||
singleRun: false,
|
||||
browserNoActivityTimeout: 30000
|
||||
});
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -6,62 +6,61 @@
|
|||
"ng": "ng",
|
||||
"start": "ng serve",
|
||||
"build": " npm run lint && ng build --env=dev ",
|
||||
"build:prod": "npm run lint && ng build --target=production --environment=prod --no-progress",
|
||||
"test": "./node_modules/.bin/karma start --single-run --browsers Firefox",
|
||||
"test-phantom": "./node_modules/.bin/karma start --single-run --browsers PhantomJS",
|
||||
"test:watch": "./node_modules/.bin/karma start --browsers Chrome",
|
||||
"build:prod": "npm run lint && ng build --configuration=production",
|
||||
"test": "ng test --karma-config karma.conf.js --watch=false --browsers Firefox",
|
||||
"test:watch": "ng test --karma-config karma.conf.js --browsers Chrome",
|
||||
"lint": "ng lint"
|
||||
},
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"@angular/animations": "5.2.10",
|
||||
"@angular/common": "5.2.10",
|
||||
"@angular/compiler": "5.2.10",
|
||||
"@angular/core": "5.2.10",
|
||||
"@angular/forms": "5.2.10",
|
||||
"@angular/http": "5.2.10",
|
||||
"@angular/platform-browser": "5.2.10",
|
||||
"@angular/platform-browser-dynamic": "5.2.10",
|
||||
"@angular/router": "5.2.10",
|
||||
"angular-svg-icon": "5.0.0",
|
||||
"@angular/animations": "6.0.9",
|
||||
"@angular/common": "6.0.9",
|
||||
"@angular/compiler": "6.0.9",
|
||||
"@angular/core": "6.0.9",
|
||||
"@angular/forms": "6.0.9",
|
||||
"@angular/http": "6.0.9",
|
||||
"@angular/platform-browser": "6.0.9",
|
||||
"@angular/platform-browser-dynamic": "6.0.9",
|
||||
"@angular/router": "6.0.9",
|
||||
"ajv": "6.5.2",
|
||||
"angular-svg-icon": "6.0.0",
|
||||
"angular-tree-component": "7.1.0",
|
||||
"bootstrap": "3.3.7",
|
||||
"bootstrap-sass": "3.3.7",
|
||||
"chart.js": "2.7.1",
|
||||
"chart.js": "2.7.2",
|
||||
"core-js": "2.5.3",
|
||||
"file-saver": "1.3.3",
|
||||
"jquery": "3.3.1",
|
||||
"magic-string": "0.22.4",
|
||||
"ng2-auto-complete": "0.12.0",
|
||||
"ng2-charts": "1.6.0",
|
||||
"ngx-bootstrap": "2.0.1",
|
||||
"node-sass": "4.7.2",
|
||||
"rxjs": "5.5.9",
|
||||
"zone.js": "0.8.20"
|
||||
"ngx-bootstrap": "3.0.1",
|
||||
"node-sass": "4.9.2",
|
||||
"rxjs": "^6.2.2",
|
||||
"zone.js": "0.8.26"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@angular/cli": "1.7.3",
|
||||
"@angular/compiler-cli": "5.2.10",
|
||||
"@angular-devkit/build-angular": "0.6.8",
|
||||
"@angular/cli": "6.0.8",
|
||||
"@angular/compiler-cli": "6.0.9",
|
||||
"@types/jasmine": "2.8.4",
|
||||
"@types/node": "9.3.0",
|
||||
"codelyzer": "4.1.0",
|
||||
"codelyzer": "4.4.2",
|
||||
"hoek": "5.0.3",
|
||||
"jasmine-core": "2.9.1",
|
||||
"jasmine-spec-reporter": "4.2.1",
|
||||
"karma": "2.0.0",
|
||||
"karma": "2.0.4",
|
||||
"karma-chrome-launcher": "2.2.0",
|
||||
"karma-cli": "1.0.1",
|
||||
"karma-coverage-istanbul-reporter": "1.3.3",
|
||||
"karma-firefox-launcher": "1.1.0",
|
||||
"karma-jasmine": "1.1.1",
|
||||
"karma-jasmine-html-reporter": "0.2.2",
|
||||
"karma-phantomjs-launcher": "1.0.4",
|
||||
"moment": "2.22.1",
|
||||
"hoek": "5.0.3",
|
||||
"ng2-mock-component": "^0.1.1",
|
||||
"protractor": "5.2.2",
|
||||
"ts-mockito": "^2.3.0",
|
||||
"ng2-mock-component": "0.1.1",
|
||||
"protractor": "5.3.2",
|
||||
"ts-mockito": "2.3.0",
|
||||
"ts-node": "4.1.0",
|
||||
"tslint": "5.9.1",
|
||||
"typescript": "2.5.3"
|
||||
"typescript": "2.7.2"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
import {CommonModule} from '@angular/common';
|
||||
import {NgModule} from '@angular/core';
|
||||
import {FormsModule, ReactiveFormsModule} from '@angular/forms';
|
||||
import {Ng2AutoCompleteModule} from 'ng2-auto-complete';
|
||||
import {AngularSvgIconModule} from 'angular-svg-icon';
|
||||
import {AlertModule, TypeaheadModule} from 'ngx-bootstrap';
|
||||
import {SharedModule} from 'app/shared/shared.module';
|
||||
|
@ -38,7 +37,6 @@ const MODULES = [
|
|||
CommonModule,
|
||||
FormsModule,
|
||||
ReactiveFormsModule,
|
||||
Ng2AutoCompleteModule,
|
||||
AngularSvgIconModule,
|
||||
AlertModule,
|
||||
SharedModule,
|
||||
|
|
|
@ -4,7 +4,7 @@ import { HttpClient, HttpClientModule } from '@angular/common/http';
|
|||
import { Routes } from '@angular/router';
|
||||
import { RouterTestingModule } from '@angular/router/testing';
|
||||
import { Component } from '@angular/core';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
import { of } from 'rxjs';
|
||||
import { AngularSvgIconModule } from 'angular-svg-icon';
|
||||
import { configureTests } from 'app/app.test.configuration';
|
||||
|
||||
|
@ -66,10 +66,10 @@ describe('ClassificationDetailsComponent', () => {
|
|||
classificationCategoriesService = TestBed.get(ClassificationCategoriesService);
|
||||
classificationsService = TestBed.get(ClassificationsService);
|
||||
removeConfirmationService = TestBed.get(RemoveConfirmationService);
|
||||
spyOn(classificationsService, 'getClassifications').and.returnValue(Observable.of(treeNodes));
|
||||
spyOn(classificationTypesService, 'getClassificationTypes').and.returnValue(Observable.of([]));
|
||||
spyOn(classificationCategoriesService, 'getCategories').and.returnValue(Observable.of(['firstCategory', 'secondCategory']));
|
||||
spyOn(classificationsService, 'deleteClassification').and.returnValue(Observable.of(true));
|
||||
spyOn(classificationsService, 'getClassifications').and.returnValue(of(treeNodes));
|
||||
spyOn(classificationTypesService, 'getClassificationTypes').and.returnValue(of([]));
|
||||
spyOn(classificationCategoriesService, 'getCategories').and.returnValue(of(['firstCategory', 'secondCategory']));
|
||||
spyOn(classificationsService, 'deleteClassification').and.returnValue(of(true));
|
||||
spyOn(classificationCategoriesService, 'getCategoryIcon').and.returnValue(new Pair('assets/icons/categories/external.svg'));
|
||||
component.classification = new ClassificationDefinition('id1', undefined, undefined, undefined, undefined, undefined, undefined,
|
||||
undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined,
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { Component, OnInit, OnDestroy, ViewChild } from '@angular/core';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { Subscription } from 'rxjs/Subscription';
|
||||
import { Subscription } from 'rxjs';
|
||||
|
||||
import { ClassificationDefinition } from 'app/models/classification-definition';
|
||||
import { ACTION } from 'app/models/action';
|
||||
|
|
|
@ -2,11 +2,10 @@ import { Component } from '@angular/core';
|
|||
import { FormsModule } from '@angular/forms';
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { HttpClient, HttpClientModule } from '@angular/common/http';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
import { of } from 'rxjs';
|
||||
import { Routes } from '@angular/router';
|
||||
import { RouterTestingModule } from '@angular/router/testing';
|
||||
import { AngularSvgIconModule } from 'angular-svg-icon';
|
||||
import { HttpModule } from '@angular/http';
|
||||
|
||||
import { TreeNodeModel } from 'app/models/tree-node';
|
||||
|
||||
|
@ -53,7 +52,7 @@ describe('ClassificationListComponent', () => {
|
|||
testBed.configureTestingModule({
|
||||
declarations: [ClassificationListComponent, ImportExportComponent, ClassificationTypesSelectorComponent,
|
||||
DummyDetailComponent],
|
||||
imports: [HttpClientModule, RouterTestingModule.withRoutes(routes), FormsModule, AngularSvgIconModule, HttpModule],
|
||||
imports: [HttpClientModule, RouterTestingModule.withRoutes(routes), FormsModule, AngularSvgIconModule],
|
||||
providers: [
|
||||
HttpClient, WorkbasketDefinitionService, AlertService, ClassificationsService, DomainService, ClassificationDefinitionService,
|
||||
ErrorModalService, ClassificationTypesService, RequestInProgressService, ClassificationCategoriesService, TreeService
|
||||
|
@ -67,10 +66,10 @@ describe('ClassificationListComponent', () => {
|
|||
classificationsService = testBed.get(ClassificationsService);
|
||||
classificationTypesService = testBed.get(ClassificationTypesService);
|
||||
classificationCategoriesService = testBed.get(ClassificationCategoriesService);
|
||||
spyOn(classificationsService, 'getClassifications').and.returnValue(Observable.of(treeNodes));
|
||||
spyOn(classificationsService, 'getClassifications').and.returnValue(of(treeNodes));
|
||||
spyOn(classificationTypesService, 'getClassificationTypes')
|
||||
.and.returnValue(Observable.of(classificationTypes));
|
||||
spyOn(classificationCategoriesService, 'getCategories').and.returnValue(Observable.of(new Array<string>('cat1', 'cat2')));
|
||||
.and.returnValue(of(classificationTypes));
|
||||
spyOn(classificationCategoriesService, 'getCategories').and.returnValue(of(new Array<string>('cat1', 'cat2')));
|
||||
spyOn(classificationCategoriesService, 'getCategoryIcon').and.returnValue(new Pair('assets/icons/categories/external.svg'));
|
||||
fixture.detectChanges();
|
||||
done();
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { Component, OnInit, OnDestroy } from '@angular/core';
|
||||
import { Subscription } from 'rxjs/Subscription';
|
||||
import { Subscription } from 'rxjs';
|
||||
import { Router, ActivatedRoute } from '@angular/router';
|
||||
|
||||
import { TaskanaType } from 'app/models/taskana-type';
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { ImportExportComponent } from './import-export.component';
|
||||
import { WorkbasketService } from 'app/services/workbasket/workbasket.service';
|
||||
|
@ -7,10 +7,9 @@ import { WorkbasketDefinitionService } from '../../services/workbasket-definitio
|
|||
import { AlertService } from 'app/services/alert/alert.service';
|
||||
import { HttpClientModule } from '@angular/common/http';
|
||||
import { DomainService } from 'app/services/domain/domain.service';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
import { of } from 'rxjs';
|
||||
import { ErrorModalService } from 'app/services/errorModal/error-modal.service';
|
||||
import { AngularSvgIconModule } from 'angular-svg-icon';
|
||||
import { HttpModule } from '@angular/http';
|
||||
import { configureTests } from 'app/app.test.configuration';
|
||||
|
||||
describe('ImportExportComponent', () => {
|
||||
|
@ -23,7 +22,7 @@ describe('ImportExportComponent', () => {
|
|||
const configure = (testBed: TestBed) => {
|
||||
testBed.configureTestingModule({
|
||||
declarations: [ImportExportComponent],
|
||||
imports: [HttpClientModule, AngularSvgIconModule, HttpModule],
|
||||
imports: [HttpClientModule, AngularSvgIconModule],
|
||||
providers: [WorkbasketService, ClassificationDefinitionService, WorkbasketDefinitionService, AlertService,
|
||||
ErrorModalService]
|
||||
})
|
||||
|
@ -47,7 +46,7 @@ describe('ImportExportComponent', () => {
|
|||
|
||||
it('should update domains', () => {
|
||||
domainService = TestBed.get(DomainService);
|
||||
spyOn(domainService, 'getDomains').and.returnValue(Observable.of(['A', 'B']));
|
||||
spyOn(domainService, 'getDomains').and.returnValue(of(['A', 'B']));
|
||||
component.updateDomains();
|
||||
expect(domainService.getDomains).toHaveBeenCalled();
|
||||
});
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { AngularSvgIconModule } from 'angular-svg-icon';
|
||||
import { HttpClientModule } from '@angular/common/http';
|
||||
import { HttpModule } from '@angular/http';
|
||||
import { IconTypeComponent } from './icon-type.component';
|
||||
import { configureTests } from 'app/app.test.configuration';
|
||||
|
||||
|
@ -13,7 +12,7 @@ describe('IconTypeComponent', () => {
|
|||
beforeEach(done => {
|
||||
const configure = (testBed: TestBed) => {
|
||||
testBed.configureTestingModule({
|
||||
imports: [AngularSvgIconModule, HttpClientModule, HttpModule]
|
||||
imports: [AngularSvgIconModule, HttpClientModule]
|
||||
})
|
||||
};
|
||||
configureTests(configure).then(testBed => {
|
||||
|
|
|
@ -2,8 +2,7 @@ import { HttpClient } from '@angular/common/http';
|
|||
|
||||
import { Injectable } from '@angular/core';
|
||||
import { environment } from 'environments/environment';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
import { ReplaySubject } from 'rxjs/ReplaySubject';
|
||||
import { Observable , ReplaySubject } from 'rxjs';
|
||||
import { CustomFieldsService } from 'app/services/custom-fields/custom-fields.service';
|
||||
import { Pair } from 'app/models/pair';
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { Injectable } from '@angular/core';
|
||||
import { HttpClient, HttpHeaders } from '@angular/common/http';
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { environment } from 'app/../environments/environment';
|
||||
import { AlertService } from 'app/services/alert/alert.service';
|
||||
import { ClassificationDefinition } from 'app/models/classification-definition';
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
import { TestBed, inject } from '@angular/core/testing';
|
||||
import { HttpClient, HttpClientModule } from '@angular/common/http';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
|
||||
import { ClassificationTypesService } from './classification-types.service';
|
||||
|
||||
|
|
|
@ -1,10 +1,7 @@
|
|||
import { Injectable } from '@angular/core';
|
||||
import { HttpClient, HttpHeaders } from '@angular/common/http';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
import { Subject } from 'rxjs/Subject';
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { Observable, BehaviorSubject, ReplaySubject } from 'rxjs';
|
||||
import { environment } from 'environments/environment';
|
||||
import { BehaviorSubject } from 'rxjs/BehaviorSubject';
|
||||
import { ReplaySubject } from 'rxjs/ReplaySubject';
|
||||
|
||||
@Injectable()
|
||||
export class ClassificationTypesService {
|
||||
|
|
|
@ -1,10 +1,8 @@
|
|||
import { Injectable } from '@angular/core';
|
||||
import { HttpClient, HttpHeaders } from '@angular/common/http';
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { environment } from 'environments/environment';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
import { Subject } from 'rxjs/Subject';
|
||||
import 'rxjs/add/observable/combineLatest';
|
||||
import 'rxjs/add/operator/map'
|
||||
import { Observable, Subject, combineLatest } from 'rxjs';
|
||||
import { mergeMap, tap } from 'rxjs/operators';
|
||||
|
||||
import { Classification } from 'app/models/classification';
|
||||
import { ClassificationDefinition } from 'app/models/classification-definition';
|
||||
|
@ -41,27 +39,28 @@ export class ClassificationsService {
|
|||
keyLike: string = undefined,
|
||||
requiredPermission: string = undefined,
|
||||
allPages: boolean = true): Observable<Array<Classification>> {
|
||||
return this.domainService.getSelectedDomain().mergeMap(domain => {
|
||||
return this.getClassificationObservable(this.httpClient.get<ClassificationResource>(
|
||||
`${this.url}${TaskanaQueryParameters.getQueryParameters(
|
||||
sortBy, order, name,
|
||||
nameLike, descLike, owner, ownerLike, type, key, keyLike, requiredPermission,
|
||||
!allPages ? TaskanaQueryParameters.page : undefined, !allPages ? TaskanaQueryParameters.pageSize : undefined, domain)}`));
|
||||
return this.domainService.getSelectedDomain().pipe(
|
||||
mergeMap(domain => {
|
||||
return this.getClassificationObservable(this.httpClient.get<ClassificationResource>(
|
||||
`${environment.taskanaRestUrl}/v1/classifications/${TaskanaQueryParameters.getQueryParameters(
|
||||
sortBy, order, name,
|
||||
nameLike, descLike, owner, ownerLike, type, key, keyLike, requiredPermission,
|
||||
!allPages ? TaskanaQueryParameters.page : undefined, !allPages ? TaskanaQueryParameters.pageSize : undefined, domain)}`));
|
||||
|
||||
}).do(() => {
|
||||
this.domainService.domainChangedComplete();
|
||||
});
|
||||
}),
|
||||
tap(() => { this.domainService.domainChangedComplete(); })
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
// GET
|
||||
getClassification(id: string): Observable<ClassificationDefinition> {
|
||||
return this.httpClient.get<ClassificationDefinition>(`${this.url}${id}`)
|
||||
.do((classification: ClassificationDefinition) => {
|
||||
return this.httpClient.get<ClassificationDefinition>(`${environment.taskanaRestUrl}/v1/classifications/${id}`)
|
||||
.pipe(tap((classification: ClassificationDefinition) => {
|
||||
if (classification) {
|
||||
this.classificationTypeService.selectClassificationType(classification.type);
|
||||
}
|
||||
});
|
||||
}));
|
||||
}
|
||||
|
||||
|
||||
|
@ -100,18 +99,18 @@ export class ClassificationsService {
|
|||
|
||||
// #endregion
|
||||
|
||||
private getClassificationObservable(clasisficationRef: Observable<any>): Observable<any> {
|
||||
private getClassificationObservable(classificationRef: Observable<any>): Observable<any> {
|
||||
const classificationTypes = this.classificationTypeService.getSelectedClassificationType();
|
||||
return Observable.combineLatest(
|
||||
clasisficationRef,
|
||||
classificationTypes
|
||||
|
||||
).map((data: any[]) => {
|
||||
if (!data[0]._embedded) {
|
||||
return [];
|
||||
return combineLatest(
|
||||
classificationRef,
|
||||
classificationTypes,
|
||||
(classification: any, classificationType) => {
|
||||
if (!classification._embedded) {
|
||||
return [];
|
||||
}
|
||||
return this.buildHierarchy(classification._embedded.classificationSummaryResourceList, classificationType);
|
||||
}
|
||||
return this.buildHierarchy(data[0]._embedded.classificationSummaryResourceList, data[1]);
|
||||
})
|
||||
)
|
||||
}
|
||||
|
||||
private buildHierarchy(classifications: Array<Classification>, type: string) {
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
import { Injectable } from '@angular/core';
|
||||
import { Subject } from 'rxjs/Subject';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
import { Subject , Observable } from 'rxjs';
|
||||
|
||||
export class SavingInformation {
|
||||
constructor(public url: string,
|
||||
|
|
|
@ -50,7 +50,7 @@
|
|||
<td *ngIf="accessIdField.lookupField else accessIdInput" class="input-group text-align text-width taskana-type-ahead" [ngClass]="{
|
||||
'has-warning': (accessItemsClone[index].accessId !== accessItem.value.accessId),
|
||||
'has-error': !accessItem.value.accessId }">
|
||||
<taskana-type-ahead [(ngModel)]="accessItem.value.accessId" formControlName="accessId" placeHolderMessage="* Access id is required"
|
||||
<taskana-type-ahead formControlName="accessId" placeHolderMessage="* Access id is required"
|
||||
[validationValue]="toogleValidationAccessIdMap.get(index)" [displayError]="!isFieldValid('accessItem.value.accessId', index)"></taskana-type-ahead>
|
||||
</td>
|
||||
<ng-template #accessIdInput>
|
||||
|
|
|
@ -2,9 +2,8 @@ import { SimpleChange } from '@angular/core';
|
|||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
|
||||
import { HttpClientModule } from '@angular/common/http';
|
||||
import { HttpModule } from '@angular/http';
|
||||
import { AngularSvgIconModule } from 'angular-svg-icon';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
import { of } from 'rxjs';
|
||||
import { configureTests } from 'app/app.test.configuration';
|
||||
|
||||
import { Workbasket } from 'app/models/workbasket';
|
||||
|
@ -34,7 +33,7 @@ describe('AccessItemsComponent', () => {
|
|||
const configure = (testBed: TestBed) => {
|
||||
testBed.configureTestingModule({
|
||||
declarations: [AccessItemsComponent],
|
||||
imports: [FormsModule, AngularSvgIconModule, HttpClientModule, HttpModule, ReactiveFormsModule],
|
||||
imports: [FormsModule, AngularSvgIconModule, HttpClientModule, ReactiveFormsModule],
|
||||
providers: [WorkbasketService, AlertService, ErrorModalService, SavingWorkbasketService, RequestInProgressService,
|
||||
CustomFieldsService]
|
||||
|
||||
|
@ -47,7 +46,7 @@ describe('AccessItemsComponent', () => {
|
|||
new Links(undefined, undefined, { 'href': 'someurl' }));
|
||||
workbasketService = TestBed.get(WorkbasketService);
|
||||
alertService = TestBed.get(AlertService);
|
||||
spyOn(workbasketService, 'getWorkBasketAccessItems').and.returnValue(Observable.of(new WorkbasketAccessItemsResource(
|
||||
spyOn(workbasketService, 'getWorkBasketAccessItems').and.returnValue(of(new WorkbasketAccessItemsResource(
|
||||
{
|
||||
'accessItems': new Array<WorkbasketAccessItems>(
|
||||
new WorkbasketAccessItems('id1', '1', 'accessID1', false, false, false, false, false, false, false, false,
|
||||
|
@ -55,8 +54,8 @@ describe('AccessItemsComponent', () => {
|
|||
new WorkbasketAccessItems('id2', '1', 'accessID2'))
|
||||
}, new Links({ 'href': 'someurl' })
|
||||
)));
|
||||
spyOn(workbasketService, 'updateWorkBasketAccessItem').and.returnValue(Observable.of(true)),
|
||||
spyOn(alertService, 'triggerAlert').and.returnValue(Observable.of(true)),
|
||||
spyOn(workbasketService, 'updateWorkBasketAccessItem').and.returnValue(of(true)),
|
||||
spyOn(alertService, 'triggerAlert').and.returnValue(of(true)),
|
||||
debugElement = fixture.debugElement.nativeElement;
|
||||
component.ngOnChanges({
|
||||
active: new SimpleChange(undefined, 'accessItems', true)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { Component, Input, OnDestroy, OnChanges, SimpleChanges } from '@angular/core';
|
||||
import { Subscription } from 'rxjs/Subscription';
|
||||
import { Subscription } from 'rxjs';
|
||||
import { FormBuilder, Validators, FormArray } from '@angular/forms';
|
||||
|
||||
import { Workbasket } from 'app/models/workbasket';
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
import { Input, Component, SimpleChange } from '@angular/core';
|
||||
import { SimpleChange } from '@angular/core';
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
import { of } from 'rxjs';
|
||||
import { AngularSvgIconModule } from 'angular-svg-icon';
|
||||
import { HttpClientModule } from '@angular/common/http';
|
||||
import { HttpModule, JsonpModule } from '@angular/http';
|
||||
|
||||
import { WorkbasketSummaryResource } from 'app/models/workbasket-summary-resource';
|
||||
import { WorkbasketSummary } from 'app/models/workbasket-summary';
|
||||
|
@ -34,7 +33,7 @@ describe('DistributionTargetsComponent', () => {
|
|||
beforeEach(done => {
|
||||
const configure = (testBed: TestBed) => {
|
||||
testBed.configureTestingModule({
|
||||
imports: [AngularSvgIconModule, HttpClientModule, HttpModule, JsonpModule],
|
||||
imports: [AngularSvgIconModule, HttpClientModule],
|
||||
declarations: [DistributionTargetsComponent, DualListComponent],
|
||||
providers: [WorkbasketService, AlertService, SavingWorkbasketService, ErrorModalService, RequestInProgressService,
|
||||
]
|
||||
|
@ -46,7 +45,7 @@ describe('DistributionTargetsComponent', () => {
|
|||
component.workbasket = workbasket;
|
||||
workbasketService = TestBed.get(WorkbasketService);
|
||||
spyOn(workbasketService, 'getWorkBasketsSummary').and.callFake(() => {
|
||||
return Observable.of(new WorkbasketSummaryResource(
|
||||
return of(new WorkbasketSummaryResource(
|
||||
{
|
||||
'workbaskets': new Array<WorkbasketSummary>(
|
||||
new WorkbasketSummary('id1', '', '', '', '', '', '', '', '', '', '', '', new Links({ 'href': 'someurl' })),
|
||||
|
@ -55,7 +54,7 @@ describe('DistributionTargetsComponent', () => {
|
|||
}, new LinksWorkbasketSummary({ 'href': 'someurl' })))
|
||||
})
|
||||
spyOn(workbasketService, 'getWorkBasketsDistributionTargets').and.callFake(() => {
|
||||
return Observable.of(new WorkbasketDistributionTargetsResource(
|
||||
return of(new WorkbasketDistributionTargetsResource(
|
||||
{
|
||||
'distributionTargets': new Array<WorkbasketSummary>(
|
||||
new WorkbasketSummary('id2', '', '', '', '', '', '', '', '', '', '', '', new Links({ 'href': 'someurl' })))
|
||||
|
@ -122,7 +121,7 @@ describe('DistributionTargetsComponent', () => {
|
|||
expect(component.distributionTargetsSelected.length).toBe(1);
|
||||
expect(component.distributionTargetsSelectedClone.length).toBe(1);
|
||||
spyOn(workbasketService, 'updateWorkBasketsDistributionTargets').and.callFake(() => {
|
||||
return Observable.of(new WorkbasketDistributionTargetsResource(
|
||||
return of(new WorkbasketDistributionTargetsResource(
|
||||
{
|
||||
'distributionTargets': new Array<WorkbasketSummary>(
|
||||
new WorkbasketSummary('id2', '', '', '', '', '', '', '', '', '', '', '', new Links({ 'href': 'someurl' })),
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { Component, OnInit, Input, OnDestroy, SimpleChanges, OnChanges } from '@angular/core';
|
||||
import { Subscription } from 'rxjs/Subscription';
|
||||
import { Subscription } from 'rxjs';
|
||||
|
||||
import { Workbasket } from 'app/models/workbasket';
|
||||
import { WorkbasketSummary } from 'app/models/workbasket-summary';
|
||||
|
|
|
@ -4,9 +4,8 @@ import { WorkbasketInformationComponent } from './workbasket-information.compone
|
|||
import { FormsModule } from '@angular/forms';
|
||||
import { AngularSvgIconModule } from 'angular-svg-icon';
|
||||
import { HttpClientModule } from '@angular/common/http';
|
||||
import { HttpModule } from '@angular/http';
|
||||
import { RouterTestingModule } from '@angular/router/testing';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
import { of } from 'rxjs';
|
||||
import { Component } from '@angular/core';
|
||||
import { Routes } from '@angular/router';
|
||||
|
||||
|
@ -46,7 +45,6 @@ describe('WorkbasketInformationComponent', () => {
|
|||
imports: [FormsModule,
|
||||
AngularSvgIconModule,
|
||||
HttpClientModule,
|
||||
HttpModule,
|
||||
RouterTestingModule.withRoutes(routes)],
|
||||
providers: [WorkbasketService, AlertService, SavingWorkbasketService, ErrorModalService, RequestInProgressService,
|
||||
CustomFieldsService]
|
||||
|
@ -113,8 +111,8 @@ describe('WorkbasketInformationComponent', () => {
|
|||
component.workbasket = new Workbasket('id', 'created', 'keyModified', 'domain', ICONTYPES.TOPIC, 'modified', 'name', 'description',
|
||||
'owner', 'custom1', 'custom2', 'custom3', 'custom4', 'orgLevel1', 'orgLevel2',
|
||||
'orgLevel3', 'orgLevel4', new Links({ 'href': 'someUrl' }));
|
||||
spyOn(workbasketService, 'updateWorkbasket').and.returnValue(Observable.of(component.workbasket));
|
||||
spyOn(workbasketService, 'triggerWorkBasketSaved').and.returnValue(Observable.of(component.workbasket));
|
||||
spyOn(workbasketService, 'updateWorkbasket').and.returnValue(of(component.workbasket));
|
||||
spyOn(workbasketService, 'triggerWorkBasketSaved').and.returnValue(of(component.workbasket));
|
||||
component.onSubmit();
|
||||
expect(component.requestInProgress).toBeFalsy();
|
||||
|
||||
|
@ -124,8 +122,8 @@ describe('WorkbasketInformationComponent', () => {
|
|||
component.workbasket = new Workbasket('id', 'created', 'keyModified', 'domain', ICONTYPES.TOPIC, 'modified', 'name', 'description',
|
||||
'owner', 'custom1', 'custom2', 'custom3', 'custom4', 'orgLevel1', 'orgLevel2',
|
||||
'orgLevel3', 'orgLevel4', new Links({ 'href': 'someUrl' }));
|
||||
spyOn(workbasketService, 'updateWorkbasket').and.returnValue(Observable.of(component.workbasket));
|
||||
spyOn(workbasketService, 'triggerWorkBasketSaved').and.returnValue(Observable.of(component.workbasket));
|
||||
spyOn(workbasketService, 'updateWorkbasket').and.returnValue(of(component.workbasket));
|
||||
spyOn(workbasketService, 'triggerWorkBasketSaved').and.returnValue(of(component.workbasket));
|
||||
fixture.detectChanges();
|
||||
component.onSubmit();
|
||||
expect(workbasketService.triggerWorkBasketSaved).toHaveBeenCalled();
|
||||
|
@ -136,7 +134,7 @@ describe('WorkbasketInformationComponent', () => {
|
|||
'owner', 'custom1', 'custom2', 'custom3', 'custom4', 'orgLevel1', 'orgLevel2',
|
||||
'orgLevel3', 'orgLevel4', new Links({ 'href': 'someUrl' }));
|
||||
component.workbasket = workbasket
|
||||
spyOn(workbasketService, 'createWorkbasket').and.returnValue(Observable.of(
|
||||
spyOn(workbasketService, 'createWorkbasket').and.returnValue(of(
|
||||
new Workbasket('someNewId', 'created', 'keyModified', 'domain', ICONTYPES.TOPIC, 'modified', 'name', 'description',
|
||||
'owner', 'custom1', 'custom2', 'custom3', 'custom4', 'orgLevel1', 'orgLevel2',
|
||||
'orgLevel3', 'orgLevel4', new Links({ 'href': 'someUrl' }))));
|
||||
|
@ -155,7 +153,7 @@ describe('WorkbasketInformationComponent', () => {
|
|||
component.workbasket = workbasket
|
||||
component.action = ACTION.COPY;
|
||||
|
||||
spyOn(workbasketService, 'createWorkbasket').and.returnValue(Observable.of(
|
||||
spyOn(workbasketService, 'createWorkbasket').and.returnValue(of(
|
||||
new Workbasket('someNewId', 'created', 'keyModified', 'domain', ICONTYPES.TOPIC, 'modified', 'name', 'description',
|
||||
'owner', 'custom1', 'custom2', 'custom3', 'custom4', 'orgLevel1', 'orgLevel2',
|
||||
'orgLevel3', 'orgLevel4', new Links({ 'href': 'someUrl' }, { 'href': 'someUrl' }, { 'href': 'someUrl' }))));
|
||||
|
@ -176,7 +174,7 @@ describe('WorkbasketInformationComponent', () => {
|
|||
'custom3', 'custom4', 'orgLevel1', 'orgLevel2',
|
||||
'orgLevel3', 'orgLevel4', new Links({ 'href': 'someUrl' }, undefined, undefined, undefined, { 'href': 'someUrl' }));
|
||||
component.workbasket = workbasket;
|
||||
spyOn(workbasketService, 'removeDistributionTarget').and.returnValue(Observable.of(''));
|
||||
spyOn(workbasketService, 'removeDistributionTarget').and.returnValue(of(''));
|
||||
const requestInProgressServiceSpy = spyOn(requestInProgressService, 'setRequestInProgress');
|
||||
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { Component, OnInit, Input, OnDestroy, OnChanges, SimpleChanges, ViewChild } from '@angular/core';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { Subscription } from 'rxjs/Subscription';
|
||||
import { Subscription } from 'rxjs';
|
||||
import { NgForm } from '@angular/forms';
|
||||
|
||||
import { ICONTYPES } from 'app/models/type';
|
||||
|
|
|
@ -5,8 +5,7 @@ import { Router, Routes } from '@angular/router';
|
|||
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
|
||||
import { AngularSvgIconModule } from 'angular-svg-icon';
|
||||
import { HttpClientModule } from '@angular/common/http';
|
||||
import { HttpModule } from '@angular/http';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
import { of } from 'rxjs';
|
||||
|
||||
import { Workbasket } from 'app/models/workbasket';
|
||||
import { WorkbasketSummary } from 'app/models/workbasket-summary';
|
||||
|
@ -56,7 +55,7 @@ describe('WorkbasketDetailsComponent', () => {
|
|||
beforeEach(done => {
|
||||
const configure = (testBed: TestBed) => {
|
||||
testBed.configureTestingModule({
|
||||
imports: [RouterTestingModule.withRoutes(routes), FormsModule, AngularSvgIconModule, HttpClientModule, HttpModule, ReactiveFormsModule],
|
||||
imports: [RouterTestingModule.withRoutes(routes), FormsModule, AngularSvgIconModule, HttpClientModule, ReactiveFormsModule],
|
||||
declarations: [WorkbasketDetailsComponent, WorkbasketInformationComponent,
|
||||
AccessItemsComponent,
|
||||
DistributionTargetsComponent, DualListComponent, DummyDetailComponent],
|
||||
|
@ -73,10 +72,10 @@ describe('WorkbasketDetailsComponent', () => {
|
|||
fixture.detectChanges();
|
||||
masterAndDetailService = TestBed.get(MasterAndDetailService);
|
||||
workbasketService = TestBed.get(WorkbasketService);
|
||||
spyOn(masterAndDetailService, 'getShowDetail').and.callFake(() => { return Observable.of(true) })
|
||||
spyOn(workbasketService, 'getSelectedWorkBasket').and.callFake(() => { return Observable.of('id1') })
|
||||
spyOn(masterAndDetailService, 'getShowDetail').and.callFake(() => { return of(true) })
|
||||
spyOn(workbasketService, 'getSelectedWorkBasket').and.callFake(() => { return of('id1') })
|
||||
spyOn(workbasketService, 'getWorkBasketsSummary').and.callFake(() => {
|
||||
return Observable.of(new WorkbasketSummaryResource(
|
||||
return of(new WorkbasketSummaryResource(
|
||||
{
|
||||
'workbaskets': new Array<WorkbasketSummary>(
|
||||
new WorkbasketSummary('id1', '', '', '', '', '', '', '', '', '', '', '',
|
||||
|
@ -84,13 +83,13 @@ describe('WorkbasketDetailsComponent', () => {
|
|||
}, new LinksWorkbasketSummary({ 'href': 'someurl' })))
|
||||
})
|
||||
|
||||
spyOn(workbasketService, 'getWorkBasket').and.callFake(() => { return Observable.of(workbasket) })
|
||||
spyOn(workbasketService, 'getWorkBasket').and.callFake(() => { return of(workbasket) })
|
||||
spyOn(workbasketService, 'getWorkBasketAccessItems').and.callFake(() => {
|
||||
return Observable.of(new WorkbasketAccessItemsResource(
|
||||
return of(new WorkbasketAccessItemsResource(
|
||||
{ 'accessItems': new Array<WorkbasketAccessItems>() }, new Links({ 'href': 'url' })))
|
||||
})
|
||||
spyOn(workbasketService, 'getWorkBasketsDistributionTargets').and.callFake(() => {
|
||||
return Observable.of(new WorkbasketSummaryResource(
|
||||
return of(new WorkbasketSummaryResource(
|
||||
{ 'workbaskets': new Array<WorkbasketSummary>() }, new LinksWorkbasketSummary({ 'href': 'url' })))
|
||||
})
|
||||
done();
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { Component, OnInit, OnDestroy } from '@angular/core';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { Subscription } from 'rxjs/Subscription';
|
||||
import { Subscription } from 'rxjs';
|
||||
|
||||
import { Workbasket } from 'app/models/workbasket';
|
||||
import { ACTION } from 'app/models/action';
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
import { Component } from '@angular/core';
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { of } from 'rxjs';
|
||||
import { Router, Routes } from '@angular/router';
|
||||
|
||||
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
|
||||
import { AngularSvgIconModule } from 'angular-svg-icon';
|
||||
import { HttpModule } from '@angular/http';
|
||||
import { HttpClientModule } from '@angular/common/http';
|
||||
import { RouterTestingModule } from '@angular/router/testing';
|
||||
import { SharedModule } from 'app/shared/shared.module';
|
||||
|
@ -16,8 +15,6 @@ import { Links } from 'app/models/links';
|
|||
import { FilterModel } from 'app/models/filter';
|
||||
import { SortingModel } from 'app/models/sorting';
|
||||
|
||||
import { FilterComponent } from 'app/shared/filter/filter.component';
|
||||
import { IconTypeComponent } from 'app/administration/components/type-icon/icon-type.component';
|
||||
import { WorkbasketListToolbarComponent } from './workbasket-list-toolbar.component';
|
||||
import { ImportExportComponent } from 'app/administration/components/import-export/import-export.component';
|
||||
|
||||
|
@ -46,7 +43,7 @@ describe('WorkbasketListToolbarComponent', () => {
|
|||
beforeEach(done => {
|
||||
const configure = (testBed: TestBed) => {
|
||||
testBed.configureTestingModule({
|
||||
imports: [FormsModule, ReactiveFormsModule, AngularSvgIconModule, HttpModule,
|
||||
imports: [FormsModule, ReactiveFormsModule, AngularSvgIconModule,
|
||||
HttpClientModule, RouterTestingModule.withRoutes(routes), SharedModule, AppModule],
|
||||
declarations: [WorkbasketListToolbarComponent, DummyDetailComponent, ImportExportComponent],
|
||||
providers: [
|
||||
|
@ -60,7 +57,7 @@ describe('WorkbasketListToolbarComponent', () => {
|
|||
fixture = TestBed.createComponent(WorkbasketListToolbarComponent);
|
||||
workbasketService = TestBed.get(WorkbasketService);
|
||||
router = TestBed.get(Router);
|
||||
spyOn(workbasketService, 'deleteWorkbasket').and.returnValue(Observable.of(''));
|
||||
spyOn(workbasketService, 'deleteWorkbasket').and.returnValue(of(''));
|
||||
spyOn(workbasketService, 'triggerWorkBasketSaved');
|
||||
|
||||
debugElement = fixture.debugElement.nativeElement;
|
||||
|
|
|
@ -4,7 +4,7 @@ import {ActivatedRoute, Router} from '@angular/router';
|
|||
|
||||
import {SortingModel} from 'app/models/sorting';
|
||||
import {FilterModel} from 'app/models/filter';
|
||||
import {Subscription} from 'rxjs/Subscription';
|
||||
import {Subscription} from 'rxjs';
|
||||
import {WorkbasketSummary} from 'app/models/workbasket-summary';
|
||||
|
||||
import {ErrorModalService} from 'app/services/errorModal/error-modal.service';
|
||||
|
|
|
@ -1,30 +1,29 @@
|
|||
import {Component, EventEmitter, Input, Output} from '@angular/core';
|
||||
import {ComponentFixture, TestBed} from '@angular/core/testing';
|
||||
import {Observable} from 'rxjs/Observable';
|
||||
import { Component, EventEmitter, Input, Output } from '@angular/core';
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { of } from 'rxjs';
|
||||
|
||||
import {AngularSvgIconModule} from 'angular-svg-icon';
|
||||
import {HttpClientModule} from '@angular/common/http';
|
||||
import {HttpModule} from '@angular/http';
|
||||
import {Routes} from '@angular/router';
|
||||
import {RouterTestingModule} from '@angular/router/testing';
|
||||
import {SharedModule} from 'app/shared/shared.module';
|
||||
import {AppModule} from 'app/app.module';
|
||||
import { AngularSvgIconModule } from 'angular-svg-icon';
|
||||
import { HttpClientModule } from '@angular/common/http';
|
||||
import { Routes } from '@angular/router';
|
||||
import { RouterTestingModule } from '@angular/router/testing';
|
||||
import { SharedModule } from 'app/shared/shared.module';
|
||||
import { AppModule } from 'app/app.module';
|
||||
|
||||
import {WorkbasketSummary} from 'app/models/workbasket-summary';
|
||||
import {WorkbasketSummaryResource} from 'app/models/workbasket-summary-resource';
|
||||
import {FilterModel} from 'app/models/filter';
|
||||
import {LinksWorkbasketSummary} from 'app/models/links-workbasket-summary';
|
||||
import { WorkbasketSummary } from 'app/models/workbasket-summary';
|
||||
import { WorkbasketSummaryResource } from 'app/models/workbasket-summary-resource';
|
||||
import { FilterModel } from 'app/models/filter';
|
||||
import { LinksWorkbasketSummary } from 'app/models/links-workbasket-summary';
|
||||
|
||||
|
||||
import {WorkbasketListComponent} from './workbasket-list.component';
|
||||
import {WorkbasketListToolbarComponent} from './workbasket-list-toolbar/workbasket-list-toolbar.component';
|
||||
import {ImportExportComponent} from 'app/administration/components/import-export/import-export.component';
|
||||
import { WorkbasketListComponent } from './workbasket-list.component';
|
||||
import { WorkbasketListToolbarComponent } from './workbasket-list-toolbar/workbasket-list-toolbar.component';
|
||||
import { ImportExportComponent } from 'app/administration/components/import-export/import-export.component';
|
||||
|
||||
import {WorkbasketDefinitionService} from 'app/administration/services/workbasket-definition/workbasket-definition.service';
|
||||
import {ClassificationDefinitionService} from 'app/administration/services/classification-definition/classification-definition.service';
|
||||
import {WorkbasketService} from 'app/services/workbasket/workbasket.service';
|
||||
import {OrientationService} from 'app/services/orientation/orientation.service';
|
||||
import {configureTests} from 'app/app.test.configuration';
|
||||
import { WorkbasketDefinitionService } from 'app/administration/services/workbasket-definition/workbasket-definition.service';
|
||||
import { ClassificationDefinitionService } from 'app/administration/services/classification-definition/classification-definition.service';
|
||||
import { WorkbasketService } from 'app/services/workbasket/workbasket.service';
|
||||
import { OrientationService } from 'app/services/orientation/orientation.service';
|
||||
import { configureTests } from 'app/app.test.configuration';
|
||||
|
||||
@Component({
|
||||
selector: 'taskana-dummy-detail',
|
||||
|
@ -57,7 +56,7 @@ const workbasketSummaryResource: WorkbasketSummaryResource = new WorkbasketSumma
|
|||
'workbaskets': new Array<WorkbasketSummary>(
|
||||
new WorkbasketSummary('1', 'key1', 'NAME1', 'description 1', 'owner 1', '', '', 'PERSONAL', '', '', '', ''),
|
||||
new WorkbasketSummary('2', 'key2', 'NAME2', 'description 2', 'owner 2', '', '', 'GROUP', '', '', '', ''))
|
||||
}, new LinksWorkbasketSummary({'href': 'url'}));
|
||||
}, new LinksWorkbasketSummary({ 'href': 'url' }));
|
||||
|
||||
|
||||
describe('WorkbasketListComponent', () => {
|
||||
|
@ -68,8 +67,8 @@ describe('WorkbasketListComponent', () => {
|
|||
let workbasketSummarySpy;
|
||||
|
||||
const routes: Routes = [
|
||||
{path: ':id', component: DummyDetailComponent, outlet: 'detail'},
|
||||
{path: 'workbaskets', component: DummyDetailComponent}
|
||||
{ path: ':id', component: DummyDetailComponent, outlet: 'detail' },
|
||||
{ path: 'workbaskets', component: DummyDetailComponent }
|
||||
];
|
||||
|
||||
|
||||
|
@ -80,7 +79,6 @@ describe('WorkbasketListComponent', () => {
|
|||
PaginationComponent, ImportExportComponent],
|
||||
imports: [
|
||||
AngularSvgIconModule,
|
||||
HttpModule,
|
||||
HttpClientModule,
|
||||
RouterTestingModule.withRoutes(routes),
|
||||
SharedModule,
|
||||
|
@ -100,9 +98,9 @@ describe('WorkbasketListComponent', () => {
|
|||
debugElement = fixture.debugElement.nativeElement;
|
||||
workbasketService = TestBed.get(WorkbasketService);
|
||||
const orientationService = TestBed.get(OrientationService);
|
||||
workbasketSummarySpy = spyOn(workbasketService, 'getWorkBasketsSummary').and.returnValue(Observable.of(workbasketSummaryResource));
|
||||
spyOn(workbasketService, 'getSelectedWorkBasket').and.returnValue(Observable.of('2'));
|
||||
spyOn(orientationService, 'getOrientation').and.returnValue(Observable.of(undefined));
|
||||
workbasketSummarySpy = spyOn(workbasketService, 'getWorkBasketsSummary').and.returnValue(of(workbasketSummaryResource));
|
||||
spyOn(workbasketService, 'getSelectedWorkBasket').and.returnValue(of('2'));
|
||||
spyOn(orientationService, 'getOrientation').and.returnValue(of(undefined));
|
||||
|
||||
fixture.detectChanges();
|
||||
done();
|
||||
|
@ -129,14 +127,14 @@ describe('WorkbasketListComponent', () => {
|
|||
|
||||
it('should have wb-action-toolbar, wb-search-bar, wb-list-container, wb-pagination,' +
|
||||
' collapsedMenufilterWb and taskana-filter created in the html', () => {
|
||||
expect(debugElement.querySelector('#wb-action-toolbar')).toBeDefined();
|
||||
expect(debugElement.querySelector('#wb-search-bar')).toBeDefined();
|
||||
expect(debugElement.querySelector('#wb-pagination')).toBeDefined();
|
||||
expect(debugElement.querySelector('#wb-list-container')).toBeDefined();
|
||||
expect(debugElement.querySelector('#collapsedMenufilterWb')).toBeDefined();
|
||||
expect(debugElement.querySelector('taskana-filter')).toBeDefined();
|
||||
expect(debugElement.querySelectorAll('#wb-list-container > li').length).toBe(3);
|
||||
});
|
||||
expect(debugElement.querySelector('#wb-action-toolbar')).toBeDefined();
|
||||
expect(debugElement.querySelector('#wb-search-bar')).toBeDefined();
|
||||
expect(debugElement.querySelector('#wb-pagination')).toBeDefined();
|
||||
expect(debugElement.querySelector('#wb-list-container')).toBeDefined();
|
||||
expect(debugElement.querySelector('#collapsedMenufilterWb')).toBeDefined();
|
||||
expect(debugElement.querySelector('taskana-filter')).toBeDefined();
|
||||
expect(debugElement.querySelectorAll('#wb-list-container > li').length).toBe(3);
|
||||
});
|
||||
|
||||
// it('should have two workbasketsummary rows created with the second one selected.', fakeAsync(() => {
|
||||
// tick(0);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import {ChangeDetectorRef, Component, ElementRef, OnDestroy, OnInit, ViewChild} from '@angular/core';
|
||||
import {ActivatedRoute, Router} from '@angular/router';
|
||||
import {Subscription} from 'rxjs/Subscription';
|
||||
import {Subscription} from 'rxjs';
|
||||
|
||||
import {WorkbasketSummaryResource} from 'app/models/workbasket-summary-resource';
|
||||
import {WorkbasketSummary} from 'app/models/workbasket-summary';
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { Component, OnInit, HostListener, OnDestroy } from '@angular/core';
|
||||
import { Router, NavigationStart } from '@angular/router';
|
||||
import { Subscription } from 'rxjs/Subscription';
|
||||
import { Subscription } from 'rxjs';
|
||||
|
||||
import { ErrorModel } from './models/modal-error';
|
||||
|
||||
|
@ -50,10 +50,13 @@ export class AppComponent implements OnInit, OnDestroy {
|
|||
this.selectedRouteService.selectRoute(event);
|
||||
this.formsValidatorService.formSubmitAttempt = false;
|
||||
}
|
||||
});
|
||||
})
|
||||
|
||||
this.errorModalSubscription = this.errorModalService.getError().subscribe((error: ErrorModel) => {
|
||||
if (typeof error.message === 'string') {
|
||||
this.modalErrorMessage = error.message
|
||||
} else if (error.message.error instanceof ProgressEvent) {
|
||||
this.modalErrorMessage = error.message.message;
|
||||
} else {
|
||||
this.modalErrorMessage = error.message.error ? (error.message.error.error + ' ' + error.message.error.message) : error.message.message;
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { Component, OnInit, OnDestroy } from '@angular/core';
|
||||
import { environment } from 'environments/environment';
|
||||
import { SelectedRouteService } from 'app/services/selected-route/selected-route';
|
||||
import { Subscription } from 'rxjs/Subscription';
|
||||
import { Subscription } from 'rxjs';
|
||||
import { DomainService } from 'app/services/domain/domain.service';
|
||||
import { BusinessAdminGuard } from 'app/guards/business-admin-guard';
|
||||
import { MonitorGuard } from 'app/guards/monitor-guard';
|
||||
|
|
|
@ -1,10 +1,8 @@
|
|||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { NoAccessComponent } from './no-access.component';
|
||||
import { Router, Routes, ActivatedRoute, NavigationStart, RouterEvent } from '@angular/router';
|
||||
import { RouterTestingModule } from '@angular/router/testing';
|
||||
import { AngularSvgIconModule } from 'angular-svg-icon';
|
||||
import { HttpModule } from '@angular/http';
|
||||
import { HttpClientModule } from '@angular/common/http';
|
||||
import { configureTests } from 'app/app.test.configuration';
|
||||
|
||||
|
@ -17,7 +15,7 @@ describe('NoAccessComponent', () => {
|
|||
beforeEach(done => {
|
||||
const configure = (testBed: TestBed) => {
|
||||
testBed.configureTestingModule({
|
||||
imports: [RouterTestingModule, AngularSvgIconModule, HttpModule, HttpClientModule],
|
||||
imports: [RouterTestingModule, AngularSvgIconModule, HttpClientModule],
|
||||
declarations: [NoAccessComponent]
|
||||
})
|
||||
};
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { AngularSvgIconModule } from 'angular-svg-icon';
|
||||
import { HttpClientModule } from '@angular/common/http';
|
||||
import { HttpModule } from '@angular/http';
|
||||
|
||||
import { UserInformationComponent } from './user-information.component';
|
||||
|
||||
|
@ -17,7 +16,7 @@ describe('UserInformationComponent', () => {
|
|||
const configure = (testBed: TestBed) => {
|
||||
testBed.configureTestingModule({
|
||||
imports: [AngularSvgIconModule,
|
||||
HttpClientModule, HttpModule],
|
||||
HttpClientModule],
|
||||
declarations: [UserInformationComponent],
|
||||
})
|
||||
};
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { Observable } from 'rxjs/Observable';
|
||||
import { Observable } from 'rxjs';
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { CanActivate, Router } from '@angular/router';
|
||||
import { Injectable } from '@angular/core';
|
||||
|
|
|
@ -1,22 +1,25 @@
|
|||
import { Observable } from 'rxjs/Observable';
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { of } from 'rxjs';
|
||||
import { CanActivate } from '@angular/router';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { DomainService } from 'app/services/domain/domain.service';
|
||||
import { ErrorModalService } from 'app/services/errorModal/error-modal.service';
|
||||
import { ErrorModel } from 'app/models/modal-error';
|
||||
import { map, catchError } from 'rxjs/operators';
|
||||
|
||||
@Injectable()
|
||||
export class DomainGuard implements CanActivate {
|
||||
constructor(private domainService: DomainService, private errorModalService: ErrorModalService) { }
|
||||
|
||||
canActivate() {
|
||||
return this.domainService.getDomains().map(domain => {
|
||||
return true;
|
||||
}).catch(() => {
|
||||
this.errorModalService.triggerError(new ErrorModel(
|
||||
'There was an error, please contact with your administrator', 'There was an error getting Domains'))
|
||||
return Observable.of(false)
|
||||
});
|
||||
return this.domainService.getDomains().pipe(
|
||||
map(domain => {
|
||||
return true;
|
||||
}),
|
||||
catchError(() => {
|
||||
this.errorModalService.triggerError(new ErrorModel(
|
||||
'There was an error, please contact with your administrator', 'There was an error getting Domains'))
|
||||
return of(false)
|
||||
})
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { Observable } from 'rxjs/Observable';
|
||||
import { Observable } from 'rxjs';
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { CanActivate, Router } from '@angular/router';
|
||||
import { Injectable } from '@angular/core';
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { Observable } from 'rxjs/Observable';
|
||||
import { Observable } from 'rxjs';
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { CanActivate, Router } from '@angular/router';
|
||||
import { Injectable } from '@angular/core';
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
import { CommonModule } from '@angular/common';
|
||||
import { NgModule } from '@angular/core';
|
||||
import { FormsModule } from '@angular/forms';
|
||||
import { HttpModule } from '@angular/http';
|
||||
import { AlertModule } from 'ngx-bootstrap';
|
||||
import { ChartsModule } from 'ng2-charts';
|
||||
import { TabsModule } from 'ngx-bootstrap/tabs';
|
||||
|
@ -21,7 +20,6 @@ const MODULES = [
|
|||
CommonModule,
|
||||
MonitorRoutingModule,
|
||||
FormsModule,
|
||||
HttpModule,
|
||||
AlertModule.forRoot(),
|
||||
ChartsModule,
|
||||
TabsModule.forRoot(),
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { Injectable } from '@angular/core';
|
||||
import { HttpClient, HttpHeaders } from '@angular/common/http';
|
||||
import { environment } from '../../../../environments/environment';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
import { Observable } from 'rxjs';
|
||||
import { State } from 'app/models/state';
|
||||
import { WorkbasketCounter } from 'app/monitor/models/workbasket-counter';
|
||||
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
import { Injectable } from '@angular/core';
|
||||
import { Subject } from 'rxjs/Subject';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
import { Subject , Observable } from 'rxjs';
|
||||
import { AlertModel } from 'app/models/alert';
|
||||
|
||||
@Injectable()
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
import { Injectable } from '@angular/core';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
import { BehaviorSubject } from 'rxjs/BehaviorSubject';
|
||||
import { Subject } from 'rxjs/Subject';
|
||||
import { Observable, BehaviorSubject, of } from 'rxjs';
|
||||
|
||||
@Injectable()
|
||||
export class DomainServiceMock {
|
||||
|
@ -15,7 +13,7 @@ export class DomainServiceMock {
|
|||
|
||||
// GET
|
||||
getDomains(): Observable<string[]> {
|
||||
return Observable.of<string[]>([]);
|
||||
return of<string[]>([]);
|
||||
}
|
||||
|
||||
getSelectedDomain(): Observable<string> {
|
||||
|
|
|
@ -1,11 +1,9 @@
|
|||
import { Injectable } from '@angular/core';
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
import { Observable , BehaviorSubject , ReplaySubject } from 'rxjs';
|
||||
import { environment } from '../../../environments/environment';
|
||||
import { Router } from '@angular/router';
|
||||
import { BehaviorSubject } from 'rxjs/BehaviorSubject';
|
||||
import { RequestInProgressService } from '../requestInProgress/request-in-progress.service';
|
||||
import { ReplaySubject } from 'rxjs/ReplaySubject';
|
||||
import { SelectedRouteService } from '../selected-route/selected-route';
|
||||
|
||||
@Injectable()
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
import { Injectable } from '@angular/core';
|
||||
import { Subject } from 'rxjs/Subject';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
import { Subject , Observable } from 'rxjs';
|
||||
import { ErrorModel } from 'app/models/modal-error';
|
||||
|
||||
@Injectable()
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
import { Injectable } from '@angular/core';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
import { BehaviorSubject } from 'rxjs/BehaviorSubject';
|
||||
import { Observable , BehaviorSubject } from 'rxjs';
|
||||
|
||||
@Injectable()
|
||||
export class MasterAndDetailService {
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
import { Injectable, HostListener } from '@angular/core';
|
||||
import { Orientation } from 'app/models/orientation';
|
||||
import { BehaviorSubject } from 'rxjs/BehaviorSubject';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
import { BehaviorSubject , Observable } from 'rxjs';
|
||||
|
||||
@Injectable()
|
||||
export class OrientationService {
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
import { Injectable } from '@angular/core';
|
||||
import { Subject } from 'rxjs/Subject';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
import { Subject , Observable } from 'rxjs';
|
||||
|
||||
@Injectable()
|
||||
export class RemoveConfirmationService {
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
import { Injectable } from '@angular/core';
|
||||
import { Subject } from 'rxjs/Subject';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
import { Subject , Observable } from 'rxjs';
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
import { Injectable, OnInit } from '@angular/core';
|
||||
import { Subject } from 'rxjs/Subject';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
import { Subject , Observable } from 'rxjs';
|
||||
import { Router, ActivatedRoute, NavigationStart } from '@angular/router';
|
||||
|
||||
@Injectable()
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
import { Observable } from 'rxjs/Observable';
|
||||
import { of } from 'rxjs';
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { Router } from '@angular/router';
|
||||
import { environment } from 'app/../environments/environment';
|
||||
import { Injectable, Inject, Injector } from '@angular/core';
|
||||
import { Injectable, Injector } from '@angular/core';
|
||||
import { TitlesService } from 'app/services/titles/titles.service';
|
||||
import { CustomFieldsService } from 'app/services/custom-fields/custom-fields.service';
|
||||
import { TaskanaEngineService } from 'app/services/taskana-engine/taskana-engine.service';
|
||||
import { map } from 'rxjs/operators';
|
||||
|
||||
@Injectable()
|
||||
export class StartupService {
|
||||
|
@ -27,32 +28,32 @@ export class StartupService {
|
|||
() => this.geCustomizedFieldsFilePromise()
|
||||
).then(
|
||||
() => this.taskanaEngineService.getUserInformation()
|
||||
).catch(error => {
|
||||
this.router.navigate(['no-role']);
|
||||
});
|
||||
).catch(error => {
|
||||
this.router.navigate(['no-role']);
|
||||
});
|
||||
}
|
||||
|
||||
getEnvironmentFilePromise() {
|
||||
return this.httpClient.get<any>('environments/data-sources/environment-information.json').map(jsonFile => {
|
||||
return this.httpClient.get<any>('environments/data-sources/environment-information.json').pipe(map(jsonFile => {
|
||||
if (jsonFile) {
|
||||
environment.taskanaRestUrl = jsonFile.taskanaRestUrl === '' ?
|
||||
environment.taskanaRestUrl : jsonFile.taskanaRestUrl;
|
||||
this.customFieldsService.initCustomFields('EN', jsonFile);
|
||||
}
|
||||
}).toPromise()
|
||||
})).toPromise()
|
||||
.catch(() => {
|
||||
return Observable.of(true)
|
||||
return of(true)
|
||||
});
|
||||
}
|
||||
|
||||
geCustomizedFieldsFilePromise() {
|
||||
return this.httpClient.get<any>('environments/data-sources/taskana-customization.json').map(jsonFile => {
|
||||
return this.httpClient.get<any>('environments/data-sources/taskana-customization.json').pipe(map(jsonFile => {
|
||||
if (jsonFile) {
|
||||
this.customFieldsService.initCustomFields('EN', jsonFile);
|
||||
}
|
||||
}).toPromise()
|
||||
})).toPromise()
|
||||
.catch(() => {
|
||||
return Observable.of(true)
|
||||
return of(true)
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { Injectable } from '@angular/core';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
import { of } from 'rxjs';
|
||||
import { UserInfoModel } from 'app/models/user-info';
|
||||
|
||||
@Injectable()
|
||||
|
@ -15,7 +15,7 @@ export class TaskanaEngineServiceMock {
|
|||
// GET
|
||||
getUserInformation(): Promise<any> {
|
||||
this.currentUserInfo = new UserInfoModel('userid', [''], ['admin']);
|
||||
return Observable.of().toPromise();
|
||||
return of(undefined).toPromise();
|
||||
}
|
||||
|
||||
hasRole(roles2Find: Array<string>): boolean {
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
import { Injectable } from '@angular/core';
|
||||
import { HttpClient, HttpHeaders } from '@angular/common/http';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { environment } from 'environments/environment';
|
||||
import { UserInfoModel } from 'app/models/user-info';
|
||||
import { ReplaySubject } from 'rxjs/ReplaySubject';
|
||||
import { map } from 'rxjs/operators';
|
||||
|
||||
|
||||
@Injectable()
|
||||
|
@ -17,11 +16,10 @@ export class TaskanaEngineService {
|
|||
|
||||
// GET
|
||||
getUserInformation(): Promise<any> {
|
||||
return this.httpClient.get<any>(`${environment.taskanaRestUrl}/v1/current-user-info`).map(
|
||||
return this.httpClient.get<any>(`${environment.taskanaRestUrl}/v1/current-user-info`).pipe(map(
|
||||
data => {
|
||||
this.currentUserInfo = data
|
||||
}
|
||||
).toPromise();
|
||||
})).toPromise();
|
||||
}
|
||||
|
||||
hasRole(roles2Find: Array<string>): boolean {
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
import { Injectable } from '@angular/core';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
import { Subject } from 'rxjs/Subject';
|
||||
import { Observable , Subject } from 'rxjs';
|
||||
|
||||
@Injectable()
|
||||
export class TreeService {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
import { throwError as observableThrowError, Observable, Subject } from 'rxjs';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
import { Subject } from 'rxjs/Subject';
|
||||
import { environment } from 'environments/environment';
|
||||
import { Workbasket } from 'app/models/workbasket';
|
||||
import { WorkbasketAccessItems } from 'app/models/workbasket-access-items';
|
||||
|
@ -13,6 +13,7 @@ import { Direction } from 'app/models/sorting';
|
|||
import { DomainService } from 'app/services/domain/domain.service';
|
||||
import { WorkbasketResource } from '../../models/workbasket-resource';
|
||||
import { TaskanaQueryParameters } from 'app/shared/util/query-parameters';
|
||||
import { mergeMap, tap, catchError } from 'rxjs/operators';
|
||||
|
||||
@Injectable()
|
||||
export class WorkbasketService {
|
||||
|
@ -46,18 +47,19 @@ export class WorkbasketService {
|
|||
return this.workbasketSummaryRef;
|
||||
}
|
||||
|
||||
return this.domainService.getSelectedDomain().mergeMap(domain => {
|
||||
return this.domainService.getSelectedDomain().pipe(mergeMap(domain => {
|
||||
return this.workbasketSummaryRef = this.httpClient.get<WorkbasketSummaryResource>(
|
||||
`${environment.taskanaRestUrl}/v1/workbaskets/${TaskanaQueryParameters.getQueryParameters(
|
||||
sortBy, order, name,
|
||||
nameLike, descLike, owner, ownerLike, type, key, keyLike, requiredPermission,
|
||||
!allPages ? TaskanaQueryParameters.page : undefined, !allPages ? TaskanaQueryParameters.pageSize : undefined, domain)}`)
|
||||
.do(workbaskets => {
|
||||
.pipe(tap((workbaskets => {
|
||||
return workbaskets;
|
||||
});
|
||||
}).do(() => {
|
||||
})))
|
||||
}), tap(() => {
|
||||
this.domainService.domainChangedComplete();
|
||||
});
|
||||
}));
|
||||
|
||||
}
|
||||
// GET
|
||||
getWorkBasket(id: string): Observable<Workbasket> {
|
||||
|
@ -78,8 +80,9 @@ export class WorkbasketService {
|
|||
// PUT
|
||||
updateWorkbasket(url: string, workbasket: Workbasket): Observable<Workbasket> {
|
||||
return this.httpClient
|
||||
.put<Workbasket>(url, workbasket)
|
||||
.catch(this.handleError);
|
||||
.put<Workbasket>(url, workbasket).pipe(
|
||||
catchError(this.handleError)
|
||||
);
|
||||
}
|
||||
// DELETE
|
||||
deleteWorkbasket(url: string) {
|
||||
|
@ -146,7 +149,7 @@ export class WorkbasketService {
|
|||
errMsg = error.message ? error.message : error.toString();
|
||||
}
|
||||
console.error(errMsg);
|
||||
return Observable.throw(errMsg);
|
||||
return observableThrowError(errMsg);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { trigger, style, transition, animate, keyframes, state } from '@angular/core';
|
||||
import { trigger, style, transition, animate, keyframes, state } from '@angular/animations';
|
||||
|
||||
export const expandDown =
|
||||
trigger('toggleDown', [
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { trigger, style, transition, animate, keyframes } from '@angular/core';
|
||||
import { trigger, style, transition, animate, keyframes } from '@angular/animations';
|
||||
|
||||
export const highlight = trigger('validation', [
|
||||
transition('true => false, false => true, * => true', animate('1500ms', keyframes([
|
||||
|
|
|
@ -2,7 +2,6 @@ import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|||
import { FormsModule } from '@angular/forms';
|
||||
import { AngularSvgIconModule } from 'angular-svg-icon';
|
||||
import { HttpClientModule } from '@angular/common/http';
|
||||
import { HttpModule } from '@angular/http';
|
||||
|
||||
import { FilterComponent } from './filter.component';
|
||||
import { configureTests } from 'app/app.test.configuration';
|
||||
|
@ -17,7 +16,7 @@ describe('FilterComponent', () => {
|
|||
const configure = (testBed: TestBed) => {
|
||||
testBed.configureTestingModule({
|
||||
declarations: [],
|
||||
imports: [AngularSvgIconModule, FormsModule, HttpClientModule, HttpModule]
|
||||
imports: [AngularSvgIconModule, FormsModule, HttpClientModule]
|
||||
})
|
||||
};
|
||||
configureTests(configure).then(testBed => {
|
||||
|
|
|
@ -2,12 +2,11 @@ import { TestBed, inject } from '@angular/core/testing';
|
|||
|
||||
import { AccessIdsService } from './access-ids.service';
|
||||
import { HttpClientModule } from '@angular/common/http';
|
||||
import { HttpModule } from '@angular/http';
|
||||
|
||||
describe('ValidateAccessItemsService', () => {
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [HttpClientModule, HttpModule],
|
||||
imports: [HttpClientModule],
|
||||
providers: [AccessIdsService]
|
||||
});
|
||||
});
|
||||
|
|
|
@ -4,7 +4,7 @@ import { environment } from 'environments/environment';
|
|||
|
||||
|
||||
import { AccessIdDefinition } from 'app/models/access-id';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
import { Observable, of } from 'rxjs';
|
||||
|
||||
@Injectable()
|
||||
export class AccessIdsService {
|
||||
|
@ -16,7 +16,7 @@ export class AccessIdsService {
|
|||
|
||||
getAccessItemsInformation(token: string): Observable<Array<AccessIdDefinition>> {
|
||||
if (!token || token.length < 3) {
|
||||
return Observable.of([]);
|
||||
return of([]);
|
||||
}
|
||||
return this.httpClient.get<Array<AccessIdDefinition>>(`${this.url}?searchFor=${token}`);
|
||||
};
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
import { TestBed, inject } from '@angular/core/testing';
|
||||
import { HttpClientModule } from '@angular/common/http';
|
||||
import { HttpModule } from '@angular/http';
|
||||
|
||||
import { HttpClientInterceptor } from './http-client-interceptor.service';
|
||||
import { ErrorModalService } from 'app/services/errorModal/error-modal.service';
|
||||
|
@ -9,7 +8,7 @@ import { RequestInProgressService } from 'app/services/requestInProgress/request
|
|||
describe('HttpExtensionService', () => {
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [HttpClientModule, HttpModule],
|
||||
imports: [HttpClientModule],
|
||||
providers: [HttpClientInterceptor, ErrorModalService, RequestInProgressService]
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,15 +1,13 @@
|
|||
import { Injectable } from '@angular/core';
|
||||
import { HttpEvent, HttpInterceptor, HttpHandler, HttpRequest, HttpErrorResponse, HttpHeaders } from '@angular/common/http';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
import 'rxjs/add/operator/catch';
|
||||
import 'rxjs/add/observable/throw';
|
||||
import { BehaviorSubject } from 'rxjs/BehaviorSubject';
|
||||
import { HttpEvent, HttpInterceptor, HttpHandler, HttpRequest, HttpErrorResponse } from '@angular/common/http';
|
||||
import { Observable } from 'rxjs';
|
||||
|
||||
import { ErrorModel } from 'app/models/modal-error';
|
||||
|
||||
import { ErrorModalService } from 'app/services/errorModal/error-modal.service';
|
||||
import { RequestInProgressService } from 'app/services/requestInProgress/request-in-progress.service';
|
||||
import { environment } from 'environments/environment';
|
||||
import { tap } from 'rxjs/operators';
|
||||
|
||||
@Injectable()
|
||||
export class HttpClientInterceptor implements HttpInterceptor {
|
||||
|
@ -25,19 +23,17 @@ export class HttpClientInterceptor implements HttpInterceptor {
|
|||
if (!environment.production) {
|
||||
req = req.clone({ headers: req.headers.set('Authorization', 'Basic YWRtaW46YWRtaW4=') });
|
||||
}
|
||||
return next.handle(req).do(event => {
|
||||
|
||||
}, err => {
|
||||
return next.handle(req).pipe(tap(() => { }, error => {
|
||||
this.requestInProgressService.setRequestInProgress(false);
|
||||
if (err instanceof HttpErrorResponse && (err.status === 401 || err.status === 403)) {
|
||||
if (error instanceof HttpErrorResponse && (error.status === 401 || error.status === 403)) {
|
||||
this.errorModalService.triggerError(
|
||||
new ErrorModel('You have no access to this resource ', err));
|
||||
} else if (err instanceof HttpErrorResponse && (err.status === 404) && err.url.indexOf('environment-information.json')) {
|
||||
new ErrorModel('You have no access to this resource ', error));
|
||||
} else if (error instanceof HttpErrorResponse && (error.status === 404) && error.url.indexOf('environment-information.json')) {
|
||||
// ignore this error message
|
||||
} else {
|
||||
this.errorModalService.triggerError(
|
||||
new ErrorModel('There was error, please contact with your administrator ', err))
|
||||
new ErrorModel('There was error, please contact with your administrator ', error))
|
||||
}
|
||||
});
|
||||
}))
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,7 +2,6 @@ import { Input, Component } from '@angular/core';
|
|||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { AngularSvgIconModule } from 'angular-svg-icon';
|
||||
import { HttpClientModule } from '@angular/common/http';
|
||||
import { HttpModule } from '@angular/http';
|
||||
|
||||
import { TaskanaTreeComponent } from './tree.component';
|
||||
|
||||
|
@ -37,7 +36,7 @@ describe('TaskanaTreeComponent', () => {
|
|||
beforeEach(done => {
|
||||
const configure = (testBed: TestBed) => {
|
||||
testBed.configureTestingModule({
|
||||
imports: [AngularSvgIconModule, HttpClientModule, HttpModule],
|
||||
imports: [AngularSvgIconModule, HttpClientModule],
|
||||
declarations: [TreeVendorComponent],
|
||||
providers: [TreeService, ClassificationCategoriesService]
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ import {
|
|||
ClassificationCategoriesService
|
||||
} from 'app/administration/services/classification-categories-service/classification-categories.service';
|
||||
import { Pair } from 'app/models/pair';
|
||||
import { Subscription } from 'rxjs/Subscription';
|
||||
import { Subscription } from 'rxjs';
|
||||
|
||||
@Component({
|
||||
selector: 'taskana-tree',
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
import { Component, OnInit, Input, ViewChild, forwardRef } from '@angular/core';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
import { Observable } from 'rxjs';
|
||||
import { TypeaheadMatch } from 'ngx-bootstrap/typeahead';
|
||||
|
||||
import { AccessIdsService } from 'app/shared/services/access-ids/access-ids.service';
|
||||
import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';
|
||||
import { highlight } from 'app/shared/animations/validation.animation';
|
||||
import { mergeMap } from 'rxjs/operators';
|
||||
|
||||
|
||||
@Component({
|
||||
|
@ -85,13 +86,12 @@ export class TypeAheadComponent implements OnInit, ControlValueAccessor {
|
|||
}
|
||||
|
||||
ngOnInit() {
|
||||
|
||||
}
|
||||
|
||||
initializeDataSource() {
|
||||
this.dataSource = Observable.create((observer: any) => {
|
||||
observer.next(this.value);
|
||||
}).mergeMap((token: string) => this.getUsersAsObservable(token));
|
||||
}).pipe(mergeMap((token: string) => this.getUsersAsObservable(token)));
|
||||
this.accessIdsService.getAccessItemsInformation(this.value).subscribe(items => {
|
||||
if (items.length > 0) {
|
||||
this.dataSource.selected = items.find(item => item.accessId === this.value);
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import { Component, OnInit, HostListener } from '@angular/core';
|
||||
import { trigger, transition, keyframes, style, animate, state } from '@angular/animations';
|
||||
import { opacity } from 'app/shared/animations/expand.animation';
|
||||
|
||||
@Component({
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { Injectable } from '@angular/core';
|
||||
import { HttpEvent, HttpInterceptor, HttpHandler, HttpRequest, HttpHeaders } from '@angular/common/http';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
import { Observable } from 'rxjs';
|
||||
|
||||
import { environment } from 'environments/environment';
|
||||
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
import {Task} from 'app/workplace/models/task';
|
||||
import {Observable} from 'rxjs/Observable';
|
||||
import {Observable, Subject} from 'rxjs';
|
||||
import {HttpClient} from '@angular/common/http';
|
||||
import {Injectable} from '@angular/core';
|
||||
import {environment} from 'environments/environment';
|
||||
import {TaskResource} from 'app/workplace/models/task-resource';
|
||||
import {Subject} from 'rxjs/Subject';
|
||||
import {Direction} from 'app/models/sorting';
|
||||
|
||||
@Injectable()
|
||||
|
|
|
@ -5,7 +5,7 @@ import {Workbasket} from 'app/models/workbasket';
|
|||
import {DomSanitizer, SafeResourceUrl} from '@angular/platform-browser';
|
||||
import {TaskService} from 'app/workplace/services/task.service';
|
||||
import {WorkbasketService} from 'app/services/workbasket/workbasket.service';
|
||||
import {Subscription} from 'rxjs/Subscription';
|
||||
import {Subscription} from 'rxjs';
|
||||
|
||||
|
||||
@Component({
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { Component, OnDestroy, OnInit } from '@angular/core';
|
||||
import { Subscription } from 'rxjs/Subscription';
|
||||
import { Subscription } from 'rxjs';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
|
||||
import { TaskService } from 'app/workplace/services/task.service';
|
||||
|
|
|
@ -2,7 +2,7 @@ import {Component, Input, OnDestroy, OnInit} from '@angular/core';
|
|||
import {Task} from 'app/workplace/models/task';
|
||||
import {ActivatedRoute, Router} from '@angular/router';
|
||||
import {TaskService} from 'app/workplace/services/task.service';
|
||||
import {Subscription} from 'rxjs/Subscription';
|
||||
import {Subscription} from 'rxjs';
|
||||
import {SortingModel} from 'app/models/sorting';
|
||||
import {Workbasket} from 'app/models/workbasket';
|
||||
import {FilterModel} from 'app/models/filter';
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// The file contents for the current environment will overwrite these during build.
|
||||
// The build system defaults to the dev environment which uses `environment.ts`, but if you do
|
||||
// `ng build --env=prod` then `environment.prod.ts` will be used instead.
|
||||
// `ng build --configuration=production` then `environment.prod.ts` will be used instead.
|
||||
// The list of which env maps to which file can be found in `.angular-cli.json`.
|
||||
|
||||
export const environment = {
|
||||
|
|
|
@ -11,7 +11,7 @@ import {
|
|||
BrowserDynamicTestingModule,
|
||||
platformBrowserDynamicTesting
|
||||
} from '@angular/platform-browser-dynamic/testing';
|
||||
import 'rxjs/Rx';
|
||||
import 'rxjs';
|
||||
|
||||
// Unfortunately there's no typing for the `__karma__` variable. Just declare it as any.
|
||||
declare var __karma__: any;
|
||||
|
|
|
@ -11,7 +11,8 @@
|
|||
]
|
||||
},
|
||||
"files": [
|
||||
"test.ts"
|
||||
"test.ts",
|
||||
"polyfills.ts"
|
||||
],
|
||||
"include": [
|
||||
"**/*.spec.ts",
|
||||
|
|
|
@ -13,8 +13,7 @@
|
|||
"eofline": true,
|
||||
"forin": true,
|
||||
"import-blacklist": [
|
||||
true,
|
||||
"rxjs"
|
||||
true
|
||||
],
|
||||
"import-spacing": true,
|
||||
"indent": [
|
||||
|
|
Loading…
Reference in New Issue