TSK-997: Autofix linting errors

Executed linting with the --fix command and removed now unnecessary suppressing rules
This commit is contained in:
BVier 2020-01-13 11:05:54 +01:00
parent 7c3d7ef9fe
commit 0fa4b1d5df
179 changed files with 1030 additions and 1153 deletions

View File

@ -15,40 +15,28 @@ module.exports = {
"@typescript-eslint/tslint" "@typescript-eslint/tslint"
], ],
"rules": { "rules": {
"arrow-parens": ["off", "as-needed"], "arrow-parens": ["error", "as-needed"],
"@typescript-eslint/indent": ['off', 2], "@typescript-eslint/indent": ['off', 2],
"import/extensions": "off",
"import/no-unresolved": "off",
"max-classes-per-file": "off",
"max-len": ["off", { "code": 140, "ignorePattern": "import *" }], // smaller than 140? "max-len": ["off", { "code": 140, "ignorePattern": "import *" }], // smaller than 140?
"no-plusplus": "off", "object-curly-newline": ["error", { "ImportDeclaration": "never" }],
"object-curly-newline": ["off", { "ImportDeclaration": "never" }], "quote-props": ["error", "as-needed"],
"quote-props": ["warn", "as-needed"], "lines-between-class-members": ["error", "always", { "exceptAfterSingleLine": true }],
"comma-dangle": ["error", "only-multiline"],
// This rules shall be activated after they were corrected "no-underscore-dangle": ["off", { "allow": ["_links", "__karma__"] }],
//"lines-between-class-members": ["error", "always", { "exceptAfterSingleLine": true }], "no-param-reassign": ["off", { "props": false }],
//"comma-dangle": ["error", "only-multiline"],
//"function-paren-newline": ["error", "consistent"],
//"no-underscore-dangle": ["error", { "allow": ["_links", "__karma__"] }],
//"no-param-reassign": ["error", { "props": false }],
// all following rules SHOULD be removed // all following rules SHOULD be removed
"class-methods-use-this": "off", "class-methods-use-this": "off",
"import/order": "off", "import/extensions": "off",
"import/no-unresolved": "off",
"import/prefer-default-export": "off", "import/prefer-default-export": "off",
"no-underscore-dangle": "off", "max-classes-per-file": "off",
"no-useless-escape": "off", "no-useless-escape": "off",
"object-curly-spacing": "off",
"padded-blocks": "off",
"@typescript-eslint/no-unused-vars": "off", "@typescript-eslint/no-unused-vars": "off",
"@typescript-eslint/no-unused-expressions": "off", "@typescript-eslint/no-unused-expressions": "off",
"@typescript-eslint/semi": "off",
// all following rules MUST be removed (mostly autofix) // all following rules MUST be removed (mostly autofix)
"linebreak-style": ["off", "unix"], // own PR "linebreak-style": ["off", "unix"], // own PR
"comma-dangle": "off",
"function-paren-newline": "off",
"lines-between-class-members": "off",
"no-restricted-syntax": "off", "no-restricted-syntax": "off",
"consistent-return": "off", "consistent-return": "off",
"no-return-assign": "off", "no-return-assign": "off",
@ -58,8 +46,8 @@ module.exports = {
"@typescript-eslint/no-use-before-define": "off", "@typescript-eslint/no-use-before-define": "off",
"@typescript-eslint/camelcase": "off", "@typescript-eslint/camelcase": "off",
"no-multi-assign": "off", "no-multi-assign": "off",
"no-param-reassign": "off",
"no-new-object": "off", "no-new-object": "off",
"no-plusplus": "off",
"array-callback-return": "off", "array-callback-return": "off",
"no-mixed-operators": "off", "no-mixed-operators": "off",
"no-multi-str": "off", "no-multi-str": "off",
@ -69,37 +57,5 @@ module.exports = {
"no-self-assign": "off", "no-self-assign": "off",
"global-require": "off", "global-require": "off",
"no-prototype-builtins": "off", "no-prototype-builtins": "off",
"no-else-return": "off",
"prefer-template": "off",
"dot-notation": "off",
"quote-props": "off",
"comma-style": "off",
"@typescript-eslint/quotes": "off",
"array-bracket-spacing": "off",
"no-unexpected-multiline": "off",
"@typescript-eslint/func-call-spacing": "off",
"no-spaced-func": "off",
"no-multi-spaces": "off",
"prefer-arrow-callback": "off",
"func-names": "off",
"operator-linebreak": "off",
"no-extra-semi": "off",
"arrow-body-style": "off",
"no-var": "off",
"import/newline-after-import": 0,
"import/no-duplicates": 0,
"one-var": 0,
"one-var-declaration-per-line": 0,
"object-property-newline": 0,
"space-before-function-paren": 0,
"comma-spacing": 0,
"object-shorthand": 0,
"no-multiple-empty-lines": 0,
"space-in-parens": 0,
"prefer-object-spread": 0,
"operator-assignment": 0,
"import/no-useless-path-segments": 0,
"no-undef-init": 0,
"@typescript-eslint/no-array-constructor": 0,
} }
}; };

View File

@ -1,12 +1,12 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { AccessItemsManagementComponent } from './access-items-management.component';
import { configureTests } from 'app/app.test.configuration'; import { configureTests } from 'app/app.test.configuration';
import { AccessIdsService } from 'app/shared/services/access-ids/access-ids.service'; import { AccessIdsService } from 'app/shared/services/access-ids/access-ids.service';
import { FormsValidatorService } from 'app/shared/services/forms/forms-validator.service'; import { FormsValidatorService } from 'app/shared/services/forms/forms-validator.service';
import { AccessIdDefinition } from 'app/models/access-id'; import { AccessIdDefinition } from 'app/models/access-id';
import { AccessItemsWorkbasketResource } from 'app/models/access-item-workbasket-resource'; import { AccessItemsWorkbasketResource } from 'app/models/access-item-workbasket-resource';
import { of } from 'rxjs'; import { of } from 'rxjs';
import { AccessItemsManagementComponent } from './access-items-management.component';
describe('AccessItemsManagementComponent', () => { describe('AccessItemsManagementComponent', () => {
@ -20,8 +20,8 @@ describe('AccessItemsManagementComponent', () => {
testBed.configureTestingModule({ testBed.configureTestingModule({
imports: [], imports: [],
declarations: [AccessItemsManagementComponent], declarations: [AccessItemsManagementComponent],
providers: [ AccessIdsService, FormsValidatorService] providers: [AccessIdsService, FormsValidatorService]
}) });
}; };
configureTests(configure).then(testBed => { configureTests(configure).then(testBed => {

View File

@ -5,17 +5,17 @@ import { CustomFieldsService } from 'app/services/custom-fields/custom-fields.se
import { Subscription } from 'rxjs'; import { Subscription } from 'rxjs';
import { FormsValidatorService } from 'app/shared/services/forms/forms-validator.service'; import { FormsValidatorService } from 'app/shared/services/forms/forms-validator.service';
import { AccessIdDefinition } from '../../models/access-id';
import { AccessItemsWorkbasketResource } from 'app/models/access-item-workbasket-resource'; import { AccessItemsWorkbasketResource } from 'app/models/access-item-workbasket-resource';
import { AccessItemWorkbasket } from 'app/models/access-item-workbasket'; import { AccessItemWorkbasket } from 'app/models/access-item-workbasket';
import { AccessIdsService } from '../../shared/services/access-ids/access-ids.service';
import { SortingModel } from 'app/models/sorting'; import { SortingModel } from 'app/models/sorting';
import { RequestInProgressService } from '../../services/requestInProgress/request-in-progress.service';
import { GeneralModalService } from 'app/services/general-modal/general-modal.service'; import { GeneralModalService } from 'app/services/general-modal/general-modal.service';
import { MessageModal } from 'app/models/message-modal'; import { MessageModal } from 'app/models/message-modal';
import { RemoveConfirmationService } from 'app/services/remove-confirmation/remove-confirmation.service'; import { RemoveConfirmationService } from 'app/services/remove-confirmation/remove-confirmation.service';
import { AlertModel, AlertType } from 'app/models/alert'; import { AlertModel, AlertType } from 'app/models/alert';
import { AlertService } from 'app/services/alert/alert.service'; import { AlertService } from 'app/services/alert/alert.service';
import { RequestInProgressService } from '../../services/requestInProgress/request-in-progress.service';
import { AccessIdsService } from '../../shared/services/access-ids/access-ids.service';
import { AccessIdDefinition } from '../../models/access-id';
@Component({ @Component({
selector: 'taskana-access-items-management', selector: 'taskana-access-items-management',
@ -23,7 +23,6 @@ import { AlertService } from 'app/services/alert/alert.service';
styleUrls: ['./access-items-management.component.scss'] styleUrls: ['./access-items-management.component.scss']
}) })
export class AccessItemsManagementComponent implements OnInit, OnDestroy { export class AccessItemsManagementComponent implements OnInit, OnDestroy {
accessIdSelected; accessIdSelected;
accessIdPrevious; accessIdPrevious;
@ -55,7 +54,7 @@ export class AccessItemsManagementComponent implements OnInit, OnDestroy {
setAccessItemsGroups(accessItems: Array<AccessItemWorkbasket>) { setAccessItemsGroups(accessItems: Array<AccessItemWorkbasket>) {
const AccessItemsFormGroups = accessItems.map(accessItem => this.formBuilder.group(accessItem)); const AccessItemsFormGroups = accessItems.map(accessItem => this.formBuilder.group(accessItem));
AccessItemsFormGroups.map(accessItemGroup => { AccessItemsFormGroups.map(accessItemGroup => {
accessItemGroup.controls['accessId'].setValidators(Validators.required); accessItemGroup.controls.accessId.setValidators(Validators.required);
for (const key of Object.keys(accessItemGroup.controls)) { for (const key of Object.keys(accessItemGroup.controls)) {
accessItemGroup.controls[key].disable(); accessItemGroup.controls[key].disable();
} }
@ -63,13 +62,13 @@ export class AccessItemsManagementComponent implements OnInit, OnDestroy {
const AccessItemsFormArray = this.formBuilder.array(AccessItemsFormGroups); const AccessItemsFormArray = this.formBuilder.array(AccessItemsFormGroups);
if (!this.AccessItemsForm) { this.AccessItemsForm = this.formBuilder.group({}); } if (!this.AccessItemsForm) { this.AccessItemsForm = this.formBuilder.group({}); }
this.AccessItemsForm.setControl('accessItemsGroups', AccessItemsFormArray); this.AccessItemsForm.setControl('accessItemsGroups', AccessItemsFormArray);
if (!this.AccessItemsForm.value['workbasketKeyFilter']) { this.AccessItemsForm.addControl('workbasketKeyFilter', new FormControl()) } if (!this.AccessItemsForm.value.workbasketKeyFilter) { this.AccessItemsForm.addControl('workbasketKeyFilter', new FormControl()); }
if (!this.AccessItemsForm.value['accessIdFilter']) { this.AccessItemsForm.addControl('accessIdFilter', new FormControl()) } if (!this.AccessItemsForm.value.accessIdFilter) { this.AccessItemsForm.addControl('accessIdFilter', new FormControl()); }
}; }
get accessItemsGroups(): FormArray { get accessItemsGroups(): FormArray {
return this.AccessItemsForm ? this.AccessItemsForm.get('accessItemsGroups') as FormArray : null; return this.AccessItemsForm ? this.AccessItemsForm.get('accessItemsGroups') as FormArray : null;
}; }
constructor(private formBuilder: FormBuilder, constructor(private formBuilder: FormBuilder,
private customFieldsService: CustomFieldsService, private customFieldsService: CustomFieldsService,
@ -89,10 +88,10 @@ export class AccessItemsManagementComponent implements OnInit, OnDestroy {
return; return;
} }
if (!this.AccessItemsForm || this.accessIdPrevious !== selected.accessId) { if (!this.AccessItemsForm || this.accessIdPrevious !== selected.accessId) {
this.accessIdPrevious = selected.accessId this.accessIdPrevious = selected.accessId;
this.isGroup = selected.accessId.includes(this.groupsKey); this.isGroup = selected.accessId.includes(this.groupsKey);
this.unSubscribe(this.accessItemInformationsubscription) this.unSubscribe(this.accessItemInformationsubscription);
this.accessItemInformationsubscription = this.accessIdsService.getAccessItemsInformation(selected.accessId, true) this.accessItemInformationsubscription = this.accessIdsService.getAccessItemsInformation(selected.accessId, true)
.subscribe((accessIdsWithGroups: Array<AccessIdDefinition>) => { .subscribe((accessIdsWithGroups: Array<AccessIdDefinition>) => {
this.accessIdsWithGroups = accessIdsWithGroups; this.accessIdsWithGroups = accessIdsWithGroups;
@ -106,9 +105,8 @@ export class AccessItemsManagementComponent implements OnInit, OnDestroy {
'There was error while retrieving your access ids with groups', 'There was error while retrieving your access ids with groups',
error error
) )
) );
} });
)
} }
} }
@ -123,13 +121,14 @@ export class AccessItemsManagementComponent implements OnInit, OnDestroy {
searchForAccessItemsWorkbaskets() { searchForAccessItemsWorkbaskets() {
this.requestInProgressService.setRequestInProgress(true); this.requestInProgressService.setRequestInProgress(true);
this.unSubscribe(this.accessItemPermissionsSubscription) this.unSubscribe(this.accessItemPermissionsSubscription);
this.accessItemPermissionsSubscription = this.accessIdsService.getAccessItemsPermissions( this.accessItemPermissionsSubscription = this.accessIdsService.getAccessItemsPermissions(
this.accessIdsWithGroups, this.accessIdsWithGroups,
this.AccessItemsForm ? this.AccessItemsForm.value.accessIdFilter : undefined, this.AccessItemsForm ? this.AccessItemsForm.value.accessIdFilter : undefined,
this.AccessItemsForm ? this.AccessItemsForm.value.workbasketKeyFilter : undefined, this.AccessItemsForm ? this.AccessItemsForm.value.workbasketKeyFilter : undefined,
this.sortModel, this.sortModel,
true) true
)
.subscribe((accessItemsResource: AccessItemsWorkbasketResource) => { .subscribe((accessItemsResource: AccessItemsWorkbasketResource) => {
this.setAccessItemsGroups(accessItemsResource ? accessItemsResource.accessItems : []); this.setAccessItemsGroups(accessItemsResource ? accessItemsResource.accessItems : []);
this.requestInProgressService.setRequestInProgress(false); this.requestInProgressService.setRequestInProgress(false);
@ -142,8 +141,7 @@ export class AccessItemsManagementComponent implements OnInit, OnDestroy {
error error
) )
); );
}) });
} }
revokeAccess() { revokeAccess() {
@ -174,11 +172,12 @@ export class AccessItemsManagementComponent implements OnInit, OnDestroy {
this.requestInProgressService.setRequestInProgress(false); this.requestInProgressService.setRequestInProgress(false);
this.generalModalService.triggerMessage( this.generalModalService.triggerMessage(
new MessageModal( new MessageModal(
`You can't delete a group`, 'You can\'t delete a group',
error error
) )
); );
}); }
);
} }
private unSubscribe(subscription: Subscription): void { private unSubscribe(subscription: Subscription): void {
@ -186,7 +185,7 @@ export class AccessItemsManagementComponent implements OnInit, OnDestroy {
} }
ngOnDestroy(): void { ngOnDestroy(): void {
this.unSubscribe(this.accessItemPermissionsSubscription) this.unSubscribe(this.accessItemPermissionsSubscription);
this.unSubscribe(this.accessItemInformationsubscription) this.unSubscribe(this.accessItemInformationsubscription);
} }
} }

View File

@ -1,35 +1,35 @@
// tslint:enable:max-line-length // tslint:enable:max-line-length
import {CommonModule} from '@angular/common'; import { CommonModule } from '@angular/common';
import {NgModule} from '@angular/core'; import { NgModule } from '@angular/core';
import {FormsModule, ReactiveFormsModule} from '@angular/forms'; import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import {AngularSvgIconModule} from 'angular-svg-icon'; import { AngularSvgIconModule } from 'angular-svg-icon';
import {AlertModule, TypeaheadModule} from 'ngx-bootstrap'; import { AlertModule, TypeaheadModule } from 'ngx-bootstrap';
import {SharedModule} from 'app/shared/shared.module'; import { SharedModule } from 'app/shared/shared.module';
import {AdministrationRoutingModule} from './administration-routing.module'; import { InfiniteScrollModule } from 'ngx-infinite-scroll';
import {InfiniteScrollModule} from 'ngx-infinite-scroll'; import { ClassificationTypesSelectorComponent } from 'app/shared/classification-types-selector/classification-types-selector.component';
import { ClassificationCategoriesService } from 'app/shared/services/classifications/classification-categories.service';
import { AccessItemsManagementComponent } from 'app/administration/access-items-management/access-items-management.component';
import { AdministrationRoutingModule } from './administration-routing.module';
/** /**
* Components * Components
*/ */
import {WorkbasketListComponent} from './workbasket/master/workbasket-list.component'; import { WorkbasketListComponent } from './workbasket/master/workbasket-list.component';
import {WorkbasketListToolbarComponent} from './workbasket/master/workbasket-list-toolbar/workbasket-list-toolbar.component' import { WorkbasketListToolbarComponent } from './workbasket/master/workbasket-list-toolbar/workbasket-list-toolbar.component';
import {WorkbasketDetailsComponent} from './workbasket/details/workbasket-details.component'; import { WorkbasketDetailsComponent } from './workbasket/details/workbasket-details.component';
import {WorkbasketInformationComponent} from './workbasket/details/information/workbasket-information.component'; import { WorkbasketInformationComponent } from './workbasket/details/information/workbasket-information.component';
import {DistributionTargetsComponent} from './workbasket/details/distribution-targets/distribution-targets.component'; import { DistributionTargetsComponent } from './workbasket/details/distribution-targets/distribution-targets.component';
import {DualListComponent} from './workbasket/details/distribution-targets/dual-list/dual-list.component'; import { DualListComponent } from './workbasket/details/distribution-targets/dual-list/dual-list.component';
import {AccessItemsComponent} from './workbasket/details/access-items/access-items.component'; import { AccessItemsComponent } from './workbasket/details/access-items/access-items.component';
import {ClassificationListComponent} from './classification/master/list/classification-list.component'; import { ClassificationListComponent } from './classification/master/list/classification-list.component';
import {ClassificationDetailsComponent} from './classification/details/classification-details.component'; import { ClassificationDetailsComponent } from './classification/details/classification-details.component';
import {ImportExportComponent} from './components/import-export/import-export.component'; import { ImportExportComponent } from './components/import-export/import-export.component';
import {ClassificationTypesSelectorComponent} from 'app/shared/classification-types-selector/classification-types-selector.component';
/** /**
* Services * Services
*/ */
import {SavingWorkbasketService} from './services/saving-workbaskets/saving-workbaskets.service'; import { SavingWorkbasketService } from './services/saving-workbaskets/saving-workbaskets.service';
import {ClassificationDefinitionService} from './services/classification-definition/classification-definition.service'; import { ClassificationDefinitionService } from './services/classification-definition/classification-definition.service';
import {WorkbasketDefinitionService} from './services/workbasket-definition/workbasket-definition.service'; import { WorkbasketDefinitionService } from './services/workbasket-definition/workbasket-definition.service';
import {ClassificationCategoriesService} from 'app/shared/services/classifications/classification-categories.service'; import { ImportExportService } from './services/import-export/import-export.service';
import {ImportExportService} from './services/import-export/import-export.service';
import {AccessItemsManagementComponent} from 'app/administration/access-items-management/access-items-management.component';
const MODULES = [ const MODULES = [
CommonModule, CommonModule,

View File

@ -9,7 +9,6 @@ import { AngularSvgIconModule } from 'angular-svg-icon';
import { configureTests } from 'app/app.test.configuration'; import { configureTests } from 'app/app.test.configuration';
import { ClassificationDetailsComponent } from './classification-details.component';
import { ClassificationDefinition } from 'app/models/classification-definition'; import { ClassificationDefinition } from 'app/models/classification-definition';
import { LinksClassification } from 'app/models/links-classfication'; import { LinksClassification } from 'app/models/links-classfication';
import { Pair } from 'app/models/pair'; import { Pair } from 'app/models/pair';
@ -27,6 +26,7 @@ import { TreeService } from 'app/services/tree/tree.service';
import { CustomFieldsService } from 'app/services/custom-fields/custom-fields.service'; import { CustomFieldsService } from 'app/services/custom-fields/custom-fields.service';
import { RemoveConfirmationService } from 'app/services/remove-confirmation/remove-confirmation.service'; import { RemoveConfirmationService } from 'app/services/remove-confirmation/remove-confirmation.service';
import { ImportExportService } from 'app/administration/services/import-export/import-export.service'; import { ImportExportService } from 'app/administration/services/import-export/import-export.service';
import { ClassificationDetailsComponent } from './classification-details.component';
@Component({ @Component({
selector: 'taskana-dummy-detail', selector: 'taskana-dummy-detail',
@ -44,8 +44,9 @@ describe('ClassificationDetailsComponent', () => {
let fixture: ComponentFixture<ClassificationDetailsComponent>; let fixture: ComponentFixture<ClassificationDetailsComponent>;
const treeNodes: Array<TreeNodeModel> = new Array(new TreeNodeModel()); const treeNodes: Array<TreeNodeModel> = new Array(new TreeNodeModel());
let classificationsService, classificationCategoriesService, let classificationsService; let classificationCategoriesService;
treeService, removeConfirmationService; let treeService; let
removeConfirmationService;
beforeEach(done => { beforeEach(done => {
const configure = (testBed: TestBed) => { const configure = (testBed: TestBed) => {
@ -54,7 +55,7 @@ describe('ClassificationDetailsComponent', () => {
declarations: [ClassificationDetailsComponent, DummyDetailComponent], declarations: [ClassificationDetailsComponent, DummyDetailComponent],
providers: [MasterAndDetailService, RequestInProgressService, ClassificationsService, HttpClient, GeneralModalService, AlertService, providers: [MasterAndDetailService, RequestInProgressService, ClassificationsService, HttpClient, GeneralModalService, AlertService,
TreeService, ClassificationCategoriesService, CustomFieldsService, ImportExportService] TreeService, ClassificationCategoriesService, CustomFieldsService, ImportExportService]
}) });
}; };
configureTests(configure).then(testBed => { configureTests(configure).then(testBed => {
fixture = TestBed.createComponent(ClassificationDetailsComponent); fixture = TestBed.createComponent(ClassificationDetailsComponent);
@ -68,7 +69,7 @@ describe('ClassificationDetailsComponent', () => {
spyOn(classificationsService, 'deleteClassification').and.returnValue(of(true)); spyOn(classificationsService, 'deleteClassification').and.returnValue(of(true));
spyOn(classificationCategoriesService, 'getCategoryIcon').and.returnValue(new Pair('assets/icons/categories/external.svg')); spyOn(classificationCategoriesService, 'getCategoryIcon').and.returnValue(new Pair('assets/icons/categories/external.svg'));
component.classification = new ClassificationDefinition('id1'); component.classification = new ClassificationDefinition('id1');
component.classification._links = new LinksClassification({ 'self': '' }); component.classification._links = new LinksClassification({ self: '' });
treeService = TestBed.get(TreeService); treeService = TestBed.get(TreeService);
fixture.detectChanges(); fixture.detectChanges();
done(); done();

View File

@ -22,11 +22,11 @@ import { RemoveConfirmationService } from 'app/services/remove-confirmation/remo
import { ClassificationCategoriesService } from 'app/shared/services/classifications/classification-categories.service'; import { ClassificationCategoriesService } from 'app/shared/services/classifications/classification-categories.service';
// tslint:enable:max-line-length // tslint:enable:max-line-length
import { DomainService } from 'app/services/domain/domain.service'; import { DomainService } from 'app/services/domain/domain.service';
import { CustomFieldsService } from '../../../services/custom-fields/custom-fields.service';
import { Pair } from 'app/models/pair'; import { Pair } from 'app/models/pair';
import { NgForm } from '@angular/forms'; import { NgForm } from '@angular/forms';
import { FormsValidatorService } from 'app/shared/services/forms/forms-validator.service'; import { FormsValidatorService } from 'app/shared/services/forms/forms-validator.service';
import { ImportExportService } from 'app/administration/services/import-export/import-export.service'; import { ImportExportService } from 'app/administration/services/import-export/import-export.service';
import { CustomFieldsService } from '../../../services/custom-fields/custom-fields.service';
@Component({ @Component({
selector: 'taskana-classification-details', selector: 'taskana-classification-details',
@ -35,7 +35,6 @@ import { ImportExportService } from 'app/administration/services/import-export/i
styleUrls: ['./classification-details.component.scss'] styleUrls: ['./classification-details.component.scss']
}) })
export class ClassificationDetailsComponent implements OnInit, OnDestroy { export class ClassificationDetailsComponent implements OnInit, OnDestroy {
classification: ClassificationDefinition; classification: ClassificationDefinition;
classificationClone: ClassificationDefinition; classificationClone: ClassificationDefinition;
showDetail = false; showDetail = false;
@ -92,8 +91,8 @@ export class ClassificationDetailsComponent implements OnInit, OnDestroy {
}); });
this.classificationSelectedSubscription = this.classificationsService.getSelectedClassification() this.classificationSelectedSubscription = this.classificationsService.getSelectedClassification()
.subscribe(classificationSelected => { .subscribe(classificationSelected => {
if (classificationSelected && this.classification && if (classificationSelected && this.classification
this.classification.classificationId === classificationSelected.classificationId) { return; } && this.classification.classificationId === classificationSelected.classificationId) { return; }
this.initProperties(); this.initProperties();
if (classificationSelected) { if (classificationSelected) {
this.fillClassificationInformation(classificationSelected); this.fillClassificationInformation(classificationSelected);
@ -101,7 +100,7 @@ export class ClassificationDetailsComponent implements OnInit, OnDestroy {
}); });
this.routeSubscription = this.route.params.subscribe(params => { this.routeSubscription = this.route.params.subscribe(params => {
let id = params['id']; let { id } = params;
delete this.action; delete this.action;
if (id && id.indexOf('new-classification') !== -1) { if (id && id.indexOf('new-classification') !== -1) {
this.action = ACTION.CREATE; this.action = ACTION.CREATE;
@ -110,10 +109,10 @@ export class ClassificationDetailsComponent implements OnInit, OnDestroy {
if (id === 'undefined') { if (id === 'undefined') {
id = ''; id = '';
} }
this.fillClassificationInformation(this.classification ? this.classification : new ClassificationDefinition()) this.fillClassificationInformation(this.classification ? this.classification : new ClassificationDefinition());
} }
if (!this.classification || this.classification.classificationId !== id && id ) { if (!this.classification || this.classification.classificationId !== id && id) {
this.selectClassification(id); this.selectClassification(id);
} }
}); });
@ -128,7 +127,7 @@ export class ClassificationDetailsComponent implements OnInit, OnDestroy {
if (categories.length > 0 && this.classification) { if (categories.length > 0 && this.classification) {
// TSK-891 fix: The property is already set and is crucial value // TSK-891 fix: The property is already set and is crucial value
// Wrapped with an if to set a default if not already set. // Wrapped with an if to set a default if not already set.
if ( !this.classification.category ) { if (!this.classification.category) {
this.classification.category = categories[0]; this.classification.category = categories[0];
} }
} }
@ -136,7 +135,7 @@ export class ClassificationDetailsComponent implements OnInit, OnDestroy {
this.importingExportingSubscription = this.importExportService.getImportingFinished().subscribe((value: Boolean) => { this.importingExportingSubscription = this.importExportService.getImportingFinished().subscribe((value: Boolean) => {
if (this.classification.classificationId) { this.selectClassification(this.classification.classificationId); } if (this.classification.classificationId) { this.selectClassification(this.classification.classificationId); }
}) });
} }
backClicked(): void { backClicked(): void {
@ -188,10 +187,12 @@ export class ClassificationDetailsComponent implements OnInit, OnDestroy {
} else { } else {
try { try {
this.classification = (<ClassificationDefinition> await this.classificationsService.putClassification( this.classification = (<ClassificationDefinition> await this.classificationsService.putClassification(
this.classification._links.self.href, this.classification)); this.classification._links.self.href, this.classification
));
this.afterRequest(); this.afterRequest();
this.alertService.triggerAlert( this.alertService.triggerAlert(
new AlertModel(AlertType.SUCCESS, `Classification ${this.classification.key} was saved successfully`)); new AlertModel(AlertType.SUCCESS, `Classification ${this.classification.key} was saved successfully`)
);
this.cloneClassification(this.classification); this.cloneClassification(this.classification);
} catch (error) { } catch (error) {
this.generalModalService.triggerMessage(new MessageModal('There was error while saving your classification', error)); this.generalModalService.triggerMessage(new MessageModal('There was error while saving your classification', error));
@ -234,7 +235,7 @@ export class ClassificationDetailsComponent implements OnInit, OnDestroy {
} }
private classificationIsAlreadySelected(): boolean { private classificationIsAlreadySelected(): boolean {
if (this.action === ACTION.CREATE && this.classification) { return true } if (this.action === ACTION.CREATE && this.classification) { return true; }
} }
private fillClassificationInformation(classificationSelected: ClassificationDefinition) { private fillClassificationInformation(classificationSelected: ClassificationDefinition) {
@ -277,7 +278,8 @@ export class ClassificationDetailsComponent implements OnInit, OnDestroy {
private removeClassificationConfirmation() { private removeClassificationConfirmation() {
if (!this.classification || !this.classification.classificationId) { if (!this.classification || !this.classification.classificationId) {
this.generalModalService.triggerMessage( this.generalModalService.triggerMessage(
new MessageModal('There is no classification selected', 'Please check if you are creating a classification')); new MessageModal('There is no classification selected', 'Please check if you are creating a classification')
);
return false; return false;
} }
this.requestInProgressService.setRequestInProgress(true); this.requestInProgressService.setRequestInProgress(true);
@ -286,16 +288,16 @@ export class ClassificationDetailsComponent implements OnInit, OnDestroy {
this.classificationRemoveSubscription = this.classificationsService this.classificationRemoveSubscription = this.classificationsService
.deleteClassification(this.classification._links.self.href) .deleteClassification(this.classification._links.self.href)
.subscribe(() => { .subscribe(() => {
const key = this.classification.key; const { key } = this.classification;
delete this.classification; delete this.classification;
this.afterRequest(); this.afterRequest();
this.classificationsService.selectClassification(); this.classificationsService.selectClassification();
this.router.navigate(['taskana/administration/classifications']); this.router.navigate(['taskana/administration/classifications']);
this.alertService.triggerAlert(new AlertModel(AlertType.SUCCESS, `Classification ${key} was removed successfully`)) this.alertService.triggerAlert(new AlertModel(AlertType.SUCCESS, `Classification ${key} was removed successfully`));
}, error => { }, error => {
this.generalModalService.triggerMessage(new MessageModal('There was error while removing your classification', error)); this.generalModalService.triggerMessage(new MessageModal('There was error while removing your classification', error));
this.afterRequest(); this.afterRequest();
}) });
} }
private cloneClassification(classification: ClassificationDefinition) { private cloneClassification(classification: ClassificationDefinition) {
@ -311,7 +313,6 @@ export class ClassificationDetailsComponent implements OnInit, OnDestroy {
} }
ngOnDestroy(): void { ngOnDestroy(): void {
if (this.masterAndDetailSubscription) { this.masterAndDetailSubscription.unsubscribe(); } if (this.masterAndDetailSubscription) { this.masterAndDetailSubscription.unsubscribe(); }
if (this.routeSubscription) { this.routeSubscription.unsubscribe(); } if (this.routeSubscription) { this.routeSubscription.unsubscribe(); }
if (this.classificationSelectedSubscription) { this.classificationSelectedSubscription.unsubscribe(); } if (this.classificationSelectedSubscription) { this.classificationSelectedSubscription.unsubscribe(); }

View File

@ -9,7 +9,6 @@ import { AngularSvgIconModule } from 'angular-svg-icon';
import { TreeNodeModel } from 'app/models/tree-node'; import { TreeNodeModel } from 'app/models/tree-node';
import { ClassificationListComponent } from './classification-list.component';
import { ImportExportComponent } from 'app/administration/components/import-export/import-export.component'; import { ImportExportComponent } from 'app/administration/components/import-export/import-export.component';
import { ClassificationTypesSelectorComponent } from 'app/shared/classification-types-selector/classification-types-selector.component'; import { ClassificationTypesSelectorComponent } from 'app/shared/classification-types-selector/classification-types-selector.component';
@ -21,12 +20,11 @@ import { DomainService } from 'app/services/domain/domain.service';
import { GeneralModalService } from 'app/services/general-modal/general-modal.service'; import { GeneralModalService } from 'app/services/general-modal/general-modal.service';
import { RequestInProgressService } from 'app/services/requestInProgress/request-in-progress.service'; import { RequestInProgressService } from 'app/services/requestInProgress/request-in-progress.service';
import { configureTests } from 'app/app.test.configuration'; import { configureTests } from 'app/app.test.configuration';
import { import { ClassificationCategoriesService } from 'app/shared/services/classifications/classification-categories.service';
ClassificationCategoriesService
} from 'app/shared/services/classifications/classification-categories.service';
import { Pair } from 'app/models/pair'; import { Pair } from 'app/models/pair';
import { TreeService } from 'app/services/tree/tree.service'; import { TreeService } from 'app/services/tree/tree.service';
import { ImportExportService } from 'app/administration/services/import-export/import-export.service'; import { ImportExportService } from 'app/administration/services/import-export/import-export.service';
import { ClassificationListComponent } from './classification-list.component';
@Component({ @Component({
selector: 'taskana-dummy-detail', selector: 'taskana-dummy-detail',
@ -45,7 +43,8 @@ describe('ClassificationListComponent', () => {
let fixture: ComponentFixture<ClassificationListComponent>; let fixture: ComponentFixture<ClassificationListComponent>;
const treeNodes: Array<TreeNodeModel> = new Array(new TreeNodeModel()); const treeNodes: Array<TreeNodeModel> = new Array(new TreeNodeModel());
const classificationTypes: Array<string> = new Array<string>('type1', 'type2'); const classificationTypes: Array<string> = new Array<string>('type1', 'type2');
let classificationsService, classificationCategoriesService; let classificationsService; let
classificationCategoriesService;
beforeEach(done => { beforeEach(done => {
const configure = (testBed: TestBed) => { const configure = (testBed: TestBed) => {
@ -57,7 +56,7 @@ describe('ClassificationListComponent', () => {
HttpClient, WorkbasketDefinitionService, AlertService, ClassificationsService, DomainService, ClassificationDefinitionService, HttpClient, WorkbasketDefinitionService, AlertService, ClassificationsService, DomainService, ClassificationDefinitionService,
GeneralModalService, RequestInProgressService, ClassificationCategoriesService, TreeService, ImportExportService GeneralModalService, RequestInProgressService, ClassificationCategoriesService, TreeService, ImportExportService
] ]
}) });
}; };
configureTests(configure).then(testBed => { configureTests(configure).then(testBed => {
fixture = testBed.createComponent(ClassificationListComponent); fixture = testBed.createComponent(ClassificationListComponent);

View File

@ -7,14 +7,12 @@ import { Classification } from 'app/models/classification';
import { TreeNodeModel } from 'app/models/tree-node'; import { TreeNodeModel } from 'app/models/tree-node';
import { ClassificationsService } from 'app/shared/services/classifications/classifications.service'; import { ClassificationsService } from 'app/shared/services/classifications/classifications.service';
import { import { ClassificationCategoriesService } from 'app/shared/services/classifications/classification-categories.service';
ClassificationCategoriesService
} from 'app/shared/services/classifications/classification-categories.service';
import { Pair } from 'app/models/pair'; import { Pair } from 'app/models/pair';
import { ClassificationDefinition } from '../../../../models/classification-definition';
import { ImportExportService } from 'app/administration/services/import-export/import-export.service'; import { ImportExportService } from 'app/administration/services/import-export/import-export.service';
import {AlertModel, AlertType} from '../../../../models/alert'; import { ClassificationDefinition } from '../../../../models/classification-definition';
import {AlertService} from '../../../../services/alert/alert.service'; import { AlertModel, AlertType } from '../../../../models/alert';
import { AlertService } from '../../../../services/alert/alert.service';
@Component({ @Component({
selector: 'taskana-classification-list', selector: 'taskana-classification-list',
@ -22,8 +20,6 @@ import {AlertService} from '../../../../services/alert/alert.service';
styleUrls: ['./classification-list.component.scss'] styleUrls: ['./classification-list.component.scss']
}) })
export class ClassificationListComponent implements OnInit, OnDestroy { export class ClassificationListComponent implements OnInit, OnDestroy {
selectedCategory = ''; selectedCategory = '';
selectedId: string; selectedId: string;
selectionToImport = TaskanaType.CLASSIFICATIONS; selectionToImport = TaskanaType.CLASSIFICATIONS;
@ -48,7 +44,8 @@ export class ClassificationListComponent implements OnInit, OnDestroy {
private route: ActivatedRoute, private route: ActivatedRoute,
private categoryService: ClassificationCategoriesService, private categoryService: ClassificationCategoriesService,
private importExportService: ImportExportService, private importExportService: ImportExportService,
private alertService: AlertService) { private alertService: AlertService
) {
} }
ngOnInit() { ngOnInit() {
@ -62,13 +59,12 @@ export class ClassificationListComponent implements OnInit, OnDestroy {
this.performRequest(); this.performRequest();
}); });
this.categoriesSubscription = this.categoriesSubscription = this.categoryService.getCategories(this.classificationTypeSelected).subscribe((categories: Array<string>) => {
this.categoryService.getCategories(this.classificationTypeSelected).subscribe((categories: Array<string>) => {
this.categories = categories; this.categories = categories;
}); });
this.importingExportingSubscription = this.importExportService.getImportingFinished().subscribe((value: Boolean) => { this.importingExportingSubscription = this.importExportService.getImportingFinished().subscribe((value: Boolean) => {
this.performRequest(true); this.performRequest(true);
}) });
} }
selectClassificationType(classificationTypeSelected: string) { selectClassificationType(classificationTypeSelected: string) {
@ -107,8 +103,8 @@ export class ClassificationListComponent implements OnInit, OnDestroy {
this.requestInProgress = true; this.requestInProgress = true;
this.classifications = []; this.classifications = [];
if (this.classificationServiceSubscription) { this.classificationServiceSubscription.unsubscribe() } if (this.classificationServiceSubscription) { this.classificationServiceSubscription.unsubscribe(); }
if (this.classificationSelectedSubscription) { this.classificationSelectedSubscription.unsubscribe() } if (this.classificationSelectedSubscription) { this.classificationSelectedSubscription.unsubscribe(); }
this.classificationServiceSubscription = this.classificationService.getClassifications() this.classificationServiceSubscription = this.classificationService.getClassifications()
.subscribe((classifications: Array<TreeNodeModel>) => { .subscribe((classifications: Array<TreeNodeModel>) => {
@ -125,7 +121,6 @@ export class ClassificationListComponent implements OnInit, OnDestroy {
}); });
this.initialized = true; this.initialized = true;
} }
private getClassifications(key?: string) { private getClassifications(key?: string) {

View File

@ -1,15 +1,15 @@
import { ComponentFixture, TestBed } from '@angular/core/testing'; import { ComponentFixture, TestBed } from '@angular/core/testing';
import { ImportExportComponent } from './import-export.component';
import { WorkbasketService } from 'app/shared/services/workbasket/workbasket.service'; import { WorkbasketService } from 'app/shared/services/workbasket/workbasket.service';
import { ClassificationDefinitionService } from 'app/administration/services/classification-definition/classification-definition.service'; import { ClassificationDefinitionService } from 'app/administration/services/classification-definition/classification-definition.service';
import { WorkbasketDefinitionService } from '../../services/workbasket-definition/workbasket-definition.service';
import { AlertService } from 'app/services/alert/alert.service'; import { AlertService } from 'app/services/alert/alert.service';
import { HttpClientModule } from '@angular/common/http'; import { HttpClientModule } from '@angular/common/http';
import { GeneralModalService } from 'app/services/general-modal/general-modal.service'; import { GeneralModalService } from 'app/services/general-modal/general-modal.service';
import { AngularSvgIconModule } from 'angular-svg-icon'; import { AngularSvgIconModule } from 'angular-svg-icon';
import { configureTests } from 'app/app.test.configuration'; import { configureTests } from 'app/app.test.configuration';
import { ImportExportService } from 'app/administration/services/import-export/import-export.service'; import { ImportExportService } from 'app/administration/services/import-export/import-export.service';
import { WorkbasketDefinitionService } from '../../services/workbasket-definition/workbasket-definition.service';
import { ImportExportComponent } from './import-export.component';
describe('ImportExportComponent', () => { describe('ImportExportComponent', () => {
let component: ImportExportComponent; let component: ImportExportComponent;
@ -23,7 +23,7 @@ describe('ImportExportComponent', () => {
imports: [HttpClientModule, AngularSvgIconModule], imports: [HttpClientModule, AngularSvgIconModule],
providers: [WorkbasketService, ClassificationDefinitionService, WorkbasketDefinitionService, AlertService, providers: [WorkbasketService, ClassificationDefinitionService, WorkbasketDefinitionService, AlertService,
GeneralModalService, ImportExportService] GeneralModalService, ImportExportService]
}) });
}; };
configureTests(configure).then(testBed => { configureTests(configure).then(testBed => {
fixture = TestBed.createComponent(ImportExportComponent); fixture = TestBed.createComponent(ImportExportComponent);
@ -41,5 +41,4 @@ describe('ImportExportComponent', () => {
it('should create', () => { it('should create', () => {
expect(component).toBeTruthy(); expect(component).toBeTruthy();
}); });
}); });

View File

@ -17,7 +17,6 @@ import { ImportExportService } from 'app/administration/services/import-export/i
styleUrls: ['./import-export.component.scss'] styleUrls: ['./import-export.component.scss']
}) })
export class ImportExportComponent implements OnInit { export class ImportExportComponent implements OnInit {
@Input() currentSelection: TaskanaType; @Input() currentSelection: TaskanaType;
@ViewChild('selectedFile', { static: true }) @ViewChild('selectedFile', { static: true })
@ -33,7 +32,8 @@ export class ImportExportComponent implements OnInit {
private generalModalService: GeneralModalService, private generalModalService: GeneralModalService,
private alertService: AlertService, private alertService: AlertService,
public uploadservice: UploadService, public uploadservice: UploadService,
private importExportService: ImportExportService) { private importExportService: ImportExportService
) {
} }
ngOnInit() { ngOnInit() {
@ -51,31 +51,31 @@ export class ImportExportComponent implements OnInit {
} }
uploadFile() { uploadFile() {
const file = this.selectedFileInput.nativeElement.files[0], const file = this.selectedFileInput.nativeElement.files[0];
formdata = new FormData(), const formdata = new FormData();
ajax = new XMLHttpRequest(); const ajax = new XMLHttpRequest();
if (!this.checkFormatFile(file)) { return false } if (!this.checkFormatFile(file)) { return false; }
formdata.append('file', file); formdata.append('file', file);
ajax.upload.addEventListener('progress', this.progressHandler.bind(this), false); ajax.upload.addEventListener('progress', this.progressHandler.bind(this), false);
ajax.addEventListener('load', this.resetProgress.bind(this), false); ajax.addEventListener('load', this.resetProgress.bind(this), false);
ajax.addEventListener('error', this.onFailedResponse.bind(this, ajax), false); ajax.addEventListener('error', this.onFailedResponse.bind(this, ajax), false);
ajax.onreadystatechange = this.onReadyStateChangeHandler.bind(this, ajax); ajax.onreadystatechange = this.onReadyStateChangeHandler.bind(this, ajax);
if (this.currentSelection === TaskanaType.WORKBASKETS) { if (this.currentSelection === TaskanaType.WORKBASKETS) {
ajax.open('POST', environment.taskanaRestUrl + '/v1/workbasket-definitions'); ajax.open('POST', `${environment.taskanaRestUrl}/v1/workbasket-definitions`);
} else { } else {
ajax.open('POST', environment.taskanaRestUrl + '/v1/classification-definitions'); ajax.open('POST', `${environment.taskanaRestUrl}/v1/classification-definitions`);
} }
if (!environment.production) { if (!environment.production) {
ajax.setRequestHeader('Authorization', 'Basic YWRtaW46YWRtaW4='); ajax.setRequestHeader('Authorization', 'Basic YWRtaW46YWRtaW4=');
} }
ajax.send(formdata); ajax.send(formdata);
this.uploadservice.isInUse = true; this.uploadservice.isInUse = true;
this.uploadservice.setCurrentProgressValue(1) this.uploadservice.setCurrentProgressValue(1);
} }
progressHandler(event) { progressHandler(event) {
const percent = (event.loaded / event.total) * 100; const percent = (event.loaded / event.total) * 100;
this.uploadservice.setCurrentProgressValue(Math.round(percent)) this.uploadservice.setCurrentProgressValue(Math.round(percent));
} }
private checkFormatFile(file): boolean { private checkFormatFile(file): boolean {
@ -88,7 +88,7 @@ export class ImportExportComponent implements OnInit {
default: default:
file.value = ''; file.value = '';
this.generalModalService.triggerMessage(new MessageModal('Wrong format', this.generalModalService.triggerMessage(new MessageModal('Wrong format',
`This file format is not allowed! Please use a .json file.`)); 'This file format is not allowed! Please use a .json file.'));
} }
return check; return check;
} }
@ -100,7 +100,6 @@ export class ImportExportComponent implements OnInit {
} }
private onReadyStateChangeHandler(event) { private onReadyStateChangeHandler(event) {
if (event.readyState === 4 && event.status >= 400) { if (event.readyState === 4 && event.status >= 400) {
let title; let title;
if (event.status === 401) { if (event.status === 401) {
@ -110,10 +109,9 @@ export class ImportExportComponent implements OnInit {
} else if (event.status === 409) { } else if (event.status === 409) {
title = 'Import was not successful, operation has some conflicts.'; title = 'Import was not successful, operation has some conflicts.';
} else if (event.status === 413) { } else if (event.status === 413) {
title = 'Import was not successful, maximum file size exceeded.' title = 'Import was not successful, maximum file size exceeded.';
} }
this.errorHandler(title, JSON.parse(event.responseText).message); this.errorHandler(title, JSON.parse(event.responseText).message);
} else if (event.readyState === 4 && event.status === 200) { } else if (event.readyState === 4 && event.status === 200) {
this.alertService.triggerAlert(new AlertModel(AlertType.SUCCESS, 'Import was successful')); this.alertService.triggerAlert(new AlertModel(AlertType.SUCCESS, 'Import was successful'));
this.importExportService.setImportingFinished(true); this.importExportService.setImportingFinished(true);

View File

@ -1,8 +1,8 @@
import { ComponentFixture, TestBed } from '@angular/core/testing'; import { ComponentFixture, TestBed } from '@angular/core/testing';
import { AngularSvgIconModule } from 'angular-svg-icon'; import { AngularSvgIconModule } from 'angular-svg-icon';
import { HttpClientModule } from '@angular/common/http'; import { HttpClientModule } from '@angular/common/http';
import { IconTypeComponent } from './icon-type.component';
import { configureTests } from 'app/app.test.configuration'; import { configureTests } from 'app/app.test.configuration';
import { IconTypeComponent } from './icon-type.component';
describe('IconTypeComponent', () => { describe('IconTypeComponent', () => {
let component: IconTypeComponent; let component: IconTypeComponent;
@ -13,7 +13,7 @@ describe('IconTypeComponent', () => {
const configure = (testBed: TestBed) => { const configure = (testBed: TestBed) => {
testBed.configureTestingModule({ testBed.configureTestingModule({
imports: [AngularSvgIconModule, HttpClientModule] imports: [AngularSvgIconModule, HttpClientModule]
}) });
}; };
configureTests(configure).then(testBed => { configureTests(configure).then(testBed => {
fixture = TestBed.createComponent(IconTypeComponent); fixture = TestBed.createComponent(IconTypeComponent);

View File

@ -7,8 +7,6 @@ import { ICONTYPES } from 'app/models/type';
styleUrls: ['./icon-type.component.scss'] styleUrls: ['./icon-type.component.scss']
}) })
export class IconTypeComponent implements OnInit { export class IconTypeComponent implements OnInit {
@Input() @Input()
type: ICONTYPES = ICONTYPES.ALL; type: ICONTYPES = ICONTYPES.ALL;
@ -22,8 +20,8 @@ export class IconTypeComponent implements OnInit {
text: string; text: string;
public static get allTypes(): Map<string, string> { public static get allTypes(): Map<string, string> {
return new Map([['PERSONAL', 'Personal'], ['GROUP', 'Group'], ['CLEARANCE', 'Clearance'], ['TOPIC', 'Topic']]) return new Map([['PERSONAL', 'Personal'], ['GROUP', 'Group'], ['CLEARANCE', 'Clearance'], ['TOPIC', 'Topic']]);
}; }
constructor() { } constructor() { }
@ -32,10 +30,9 @@ export class IconTypeComponent implements OnInit {
} }
getIconPath(type: string) { getIconPath(type: string) {
return type === 'PERSONAL' ? 'user.svg' : return type === 'PERSONAL' ? 'user.svg'
type === 'GROUP' ? 'users.svg' : : type === 'GROUP' ? 'users.svg'
type === 'TOPIC' ? 'topic.svg' : : type === 'TOPIC' ? 'topic.svg'
type === 'CLEARANCE' ? 'clearance.svg' : 'asterisk.svg'; : type === 'CLEARANCE' ? 'clearance.svg' : 'asterisk.svg';
} }
} }

View File

@ -7,14 +7,13 @@ import { BlobGenerator } from 'app/shared/util/blob-generator';
@Injectable() @Injectable()
export class ClassificationDefinitionService { export class ClassificationDefinitionService {
url = `${environment.taskanaRestUrl}/v1/classification-definitions`;
url = environment.taskanaRestUrl + '/v1/classification-definitions';
constructor(private httpClient: HttpClient) { } constructor(private httpClient: HttpClient) { }
// GET // GET
async exportClassifications(domain: string) { async exportClassifications(domain: string) {
domain = (domain === '' ? '' : '?domain=' + domain); domain = (domain === '' ? '' : `?domain=${domain}`);
const classificationDefinitions = await this.httpClient.get<ClassificationDefinition[]>(this.url + domain).toPromise(); const classificationDefinitions = await this.httpClient.get<ClassificationDefinition[]>(this.url + domain).toPromise();
BlobGenerator.saveFile(classificationDefinitions, 'Classifications_' + TaskanaDate.getDate() + '.json') BlobGenerator.saveFile(classificationDefinitions, `Classifications_${TaskanaDate.getDate()}.json`);
} }
} }

View File

@ -3,7 +3,6 @@ import { Subject, Observable } from 'rxjs';
@Injectable() @Injectable()
export class ImportExportService { export class ImportExportService {
public importingFinished = new Subject<boolean>(); public importingFinished = new Subject<boolean>();
constructor() { } constructor() { }
@ -15,5 +14,4 @@ export class ImportExportService {
getImportingFinished(): Observable<boolean> { getImportingFinished(): Observable<boolean> {
return this.importingFinished.asObservable(); return this.importingFinished.asObservable();
} }
} }

View File

@ -1,5 +1,5 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { Subject , Observable } from 'rxjs'; import { Subject, Observable } from 'rxjs';
export class SavingInformation { export class SavingInformation {
constructor(public url: string, constructor(public url: string,
@ -10,7 +10,6 @@ export class SavingInformation {
@Injectable() @Injectable()
export class SavingWorkbasketService { export class SavingWorkbasketService {
public distributionTargetsSavingInformation = new Subject<SavingInformation>(); public distributionTargetsSavingInformation = new Subject<SavingInformation>();
public accessItemsSavingInformation = new Subject<SavingInformation>(); public accessItemsSavingInformation = new Subject<SavingInformation>();
@ -19,12 +18,15 @@ export class SavingWorkbasketService {
triggerDistributionTargetSaving(distributionTargetInformation: SavingInformation) { triggerDistributionTargetSaving(distributionTargetInformation: SavingInformation) {
this.distributionTargetsSavingInformation.next(distributionTargetInformation); this.distributionTargetsSavingInformation.next(distributionTargetInformation);
} }
triggerAccessItemsSaving(accessItemsInformation: SavingInformation) { triggerAccessItemsSaving(accessItemsInformation: SavingInformation) {
this.accessItemsSavingInformation.next(accessItemsInformation); this.accessItemsSavingInformation.next(accessItemsInformation);
} }
triggeredDistributionTargetsSaving(): Observable<SavingInformation> { triggeredDistributionTargetsSaving(): Observable<SavingInformation> {
return this.distributionTargetsSavingInformation.asObservable(); return this.distributionTargetsSavingInformation.asObservable();
} }
triggeredAccessItemsSaving(): Observable<SavingInformation> { triggeredAccessItemsSaving(): Observable<SavingInformation> {
return this.accessItemsSavingInformation.asObservable(); return this.accessItemsSavingInformation.asObservable();
} }

View File

@ -7,14 +7,14 @@ import { BlobGenerator } from 'app/shared/util/blob-generator';
@Injectable() @Injectable()
export class WorkbasketDefinitionService { export class WorkbasketDefinitionService {
url: string = environment.taskanaRestUrl + '/v1/workbasket-definitions'; url: string = `${environment.taskanaRestUrl}/v1/workbasket-definitions`;
constructor(private httpClient: HttpClient) { } constructor(private httpClient: HttpClient) { }
// GET // GET
async exportWorkbaskets(domain: string) { async exportWorkbaskets(domain: string) {
domain = (domain === '' ? domain : '?domain=' + domain); domain = (domain === '' ? domain : `?domain=${domain}`);
const workbasketDefinitions = await this.httpClient.get<WorkbasketDefinition[]>(this.url + domain).toPromise(); const workbasketDefinitions = await this.httpClient.get<WorkbasketDefinition[]>(this.url + domain).toPromise();
BlobGenerator.saveFile(workbasketDefinitions, 'Workbaskets_' + TaskanaDate.getDate() + '.json') BlobGenerator.saveFile(workbasketDefinitions, `Workbaskets_${TaskanaDate.getDate()}.json`);
} }
} }

View File

@ -13,7 +13,6 @@ import { WorkbasketAccessItems } from 'app/models/workbasket-access-items';
import { WorkbasketAccessItemsResource } from 'app/models/workbasket-access-items-resource'; import { WorkbasketAccessItemsResource } from 'app/models/workbasket-access-items-resource';
import { ICONTYPES } from 'app/models/type'; import { ICONTYPES } from 'app/models/type';
import { AccessItemsComponent } from './access-items.component';
import { GeneralModalService } from 'app/services/general-modal/general-modal.service'; import { GeneralModalService } from 'app/services/general-modal/general-modal.service';
import { SavingWorkbasketService } from 'app/administration/services/saving-workbaskets/saving-workbaskets.service'; import { SavingWorkbasketService } from 'app/administration/services/saving-workbaskets/saving-workbaskets.service';
@ -23,11 +22,13 @@ import { RequestInProgressService } from 'app/services/requestInProgress/request
import { CustomFieldsService } from 'app/services/custom-fields/custom-fields.service'; import { CustomFieldsService } from 'app/services/custom-fields/custom-fields.service';
import { AccessIdsService } from 'app/shared/services/access-ids/access-ids.service'; import { AccessIdsService } from 'app/shared/services/access-ids/access-ids.service';
import { FormsValidatorService } from 'app/shared/services/forms/forms-validator.service'; import { FormsValidatorService } from 'app/shared/services/forms/forms-validator.service';
import { AccessItemsComponent } from './access-items.component';
describe('AccessItemsComponent', () => { describe('AccessItemsComponent', () => {
let component: AccessItemsComponent; let component: AccessItemsComponent;
let fixture: ComponentFixture<AccessItemsComponent>; let fixture: ComponentFixture<AccessItemsComponent>;
let workbasketService, debugElement, alertService, accessIdsService, formsValidatorService; let workbasketService; let debugElement; let alertService; let accessIdsService; let
formsValidatorService;
beforeEach(done => { beforeEach(done => {
@ -37,15 +38,15 @@ describe('AccessItemsComponent', () => {
imports: [FormsModule, AngularSvgIconModule, HttpClientModule, ReactiveFormsModule], imports: [FormsModule, AngularSvgIconModule, HttpClientModule, ReactiveFormsModule],
providers: [WorkbasketService, AlertService, GeneralModalService, SavingWorkbasketService, RequestInProgressService, providers: [WorkbasketService, AlertService, GeneralModalService, SavingWorkbasketService, RequestInProgressService,
CustomFieldsService, AccessIdsService, FormsValidatorService] CustomFieldsService, AccessIdsService, FormsValidatorService]
}) });
}; };
configureTests(configure).then(testBed => { configureTests(configure).then(testBed => {
fixture = TestBed.createComponent(AccessItemsComponent); fixture = TestBed.createComponent(AccessItemsComponent);
component = fixture.componentInstance; component = fixture.componentInstance;
component.workbasket = new Workbasket('1'); component.workbasket = new Workbasket('1');
component.workbasket.type = ICONTYPES.TOPIC; component.workbasket.type = ICONTYPES.TOPIC;
component.workbasket._links = new Links() component.workbasket._links = new Links();
component.workbasket._links.accessItems = { 'href': 'someurl' }; component.workbasket._links.accessItems = { href: 'someurl' };
workbasketService = TestBed.get(WorkbasketService); workbasketService = TestBed.get(WorkbasketService);
alertService = TestBed.get(AlertService); alertService = TestBed.get(AlertService);
@ -53,8 +54,9 @@ describe('AccessItemsComponent', () => {
new Array<WorkbasketAccessItems>( new Array<WorkbasketAccessItems>(
new WorkbasketAccessItems('id1', '1', 'accessID1', '', false, false, false, false, false, false, false, false, new WorkbasketAccessItems('id1', '1', 'accessID1', '', false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false, false, false), false, false, false, false, false, false, false, false, false),
new WorkbasketAccessItems('id2', '1', 'accessID2')) new WorkbasketAccessItems('id2', '1', 'accessID2')
, new Links({ 'href': 'someurl' }) ),
new Links({ href: 'someurl' })
))); )));
spyOn(workbasketService, 'updateWorkBasketAccessItem').and.returnValue(of(true)), spyOn(workbasketService, 'updateWorkBasketAccessItem').and.returnValue(of(true)),
spyOn(alertService, 'triggerAlert').and.returnValue(of(true)), spyOn(alertService, 'triggerAlert').and.returnValue(of(true)),
@ -83,7 +85,6 @@ describe('AccessItemsComponent', () => {
it('should show two access items if server returns two entries', () => { it('should show two access items if server returns two entries', () => {
expect(debugElement.querySelectorAll('#table-access-items > tbody > tr').length).toBe(2); expect(debugElement.querySelectorAll('#table-access-items > tbody > tr').length).toBe(2);
}); });
it('should remove an access item if remove button is clicked', () => { it('should remove an access item if remove button is clicked', () => {
@ -101,8 +102,9 @@ describe('AccessItemsComponent', () => {
fixture.whenStable().then(() => { fixture.whenStable().then(() => {
fixture.detectChanges(); fixture.detectChanges();
expect(alertService.triggerAlert).toHaveBeenCalledWith( expect(alertService.triggerAlert).toHaveBeenCalledWith(
new AlertModel(AlertType.SUCCESS, `Workbasket ${component.workbasket.key} Access items were saved successfully`)); new AlertModel(AlertType.SUCCESS, `Workbasket ${component.workbasket.key} Access items were saved successfully`)
}) );
});
fixture.detectChanges(); fixture.detectChanges();
})); }));
@ -112,7 +114,5 @@ describe('AccessItemsComponent', () => {
expect(component.accessItemsClone.length).toBe(1); expect(component.accessItemsClone.length).toBe(1);
component.clear(); component.clear();
expect(component.accessItemsClone.length).toBe(2); expect(component.accessItemsClone.length).toBe(2);
}); });
}); });

View File

@ -26,13 +26,15 @@ import { AccessIdDefinition } from 'app/models/access-id';
styleUrls: ['./access-items.component.scss'] styleUrls: ['./access-items.component.scss']
}) })
export class AccessItemsComponent implements OnChanges, OnDestroy { export class AccessItemsComponent implements OnChanges, OnDestroy {
@Input() @Input()
workbasket: Workbasket; workbasket: Workbasket;
@Input() @Input()
action: string; action: string;
@Input() @Input()
active: string; active: string;
badgeMessage = ''; badgeMessage = '';
accessIdField = this.customFieldsService.getCustomField('Owner', 'workbaskets.access-items.accessId'); accessIdField = this.customFieldsService.getCustomField('Owner', 'workbaskets.access-items.accessId');
@ -61,21 +63,22 @@ export class AccessItemsComponent implements OnChanges, OnDestroy {
accessItemsGroups: this.formBuilder.array([ accessItemsGroups: this.formBuilder.array([
]) ])
}); });
toogleValidationAccessIdMap = new Map<number, boolean>(); toogleValidationAccessIdMap = new Map<number, boolean>();
private initialized = false; private initialized = false;
setAccessItemsGroups(accessItems: Array<WorkbasketAccessItems>) { setAccessItemsGroups(accessItems: Array<WorkbasketAccessItems>) {
const AccessItemsFormGroups = accessItems.map(accessItem => this.formBuilder.group(accessItem)); const AccessItemsFormGroups = accessItems.map(accessItem => this.formBuilder.group(accessItem));
AccessItemsFormGroups.map(accessItemGroup => { AccessItemsFormGroups.map(accessItemGroup => {
accessItemGroup.controls['accessId'].setValidators(Validators.required); accessItemGroup.controls.accessId.setValidators(Validators.required);
}); });
const AccessItemsFormArray = this.formBuilder.array(AccessItemsFormGroups); const AccessItemsFormArray = this.formBuilder.array(AccessItemsFormGroups);
this.AccessItemsForm.setControl('accessItemsGroups', AccessItemsFormArray); this.AccessItemsForm.setControl('accessItemsGroups', AccessItemsFormArray);
}; }
get accessItemsGroups(): FormArray { get accessItemsGroups(): FormArray {
return this.AccessItemsForm.get('accessItemsGroups') as FormArray; return this.AccessItemsForm.get('accessItemsGroups') as FormArray;
}; }
constructor( constructor(
private workbasketService: WorkbasketService, private workbasketService: WorkbasketService,
@ -85,7 +88,8 @@ export class AccessItemsComponent implements OnChanges, OnDestroy {
private requestInProgressService: RequestInProgressService, private requestInProgressService: RequestInProgressService,
private customFieldsService: CustomFieldsService, private customFieldsService: CustomFieldsService,
private formBuilder: FormBuilder, private formBuilder: FormBuilder,
private formsValidatorService: FormsValidatorService) { private formsValidatorService: FormsValidatorService
) {
} }
ngOnChanges(changes: SimpleChanges): void { ngOnChanges(changes: SimpleChanges): void {
@ -110,7 +114,7 @@ export class AccessItemsComponent implements OnChanges, OnDestroy {
this.accessItemsClone = this.cloneAccessItems(accessItemsResource.accessItems); this.accessItemsClone = this.cloneAccessItems(accessItemsResource.accessItems);
this.accessItemsResetClone = this.cloneAccessItems(accessItemsResource.accessItems); this.accessItemsResetClone = this.cloneAccessItems(accessItemsResource.accessItems);
this.requestInProgress = false; this.requestInProgress = false;
}) });
this.savingAccessItemsSubscription = this.savingWorkbaskets.triggeredAccessItemsSaving() this.savingAccessItemsSubscription = this.savingWorkbaskets.triggeredAccessItemsSaving()
.subscribe((savingInformation: SavingInformation) => { .subscribe((savingInformation: SavingInformation) => {
if (this.action === ACTION.COPY) { if (this.action === ACTION.COPY) {
@ -118,8 +122,7 @@ export class AccessItemsComponent implements OnChanges, OnDestroy {
this.setWorkbasketIdForCopy(savingInformation.workbasketId); this.setWorkbasketIdForCopy(savingInformation.workbasketId);
this.onSave(); this.onSave();
} }
}) });
} }
addAccessItem() { addAccessItem() {
@ -127,7 +130,7 @@ export class AccessItemsComponent implements OnChanges, OnDestroy {
workbasketAccessItems.workbasketId = this.workbasket.workbasketId; workbasketAccessItems.workbasketId = this.workbasket.workbasketId;
workbasketAccessItems.permRead = true; workbasketAccessItems.permRead = true;
const newForm = this.formBuilder.group(workbasketAccessItems); const newForm = this.formBuilder.group(workbasketAccessItems);
newForm.controls['accessId'].setValidators(Validators.required); newForm.controls.accessId.setValidators(Validators.required);
this.accessItemsGroups.push(newForm); this.accessItemsGroups.push(newForm);
this.accessItemsClone.push(workbasketAccessItems); this.accessItemsClone.push(workbasketAccessItems);
} }
@ -137,7 +140,7 @@ export class AccessItemsComponent implements OnChanges, OnDestroy {
this.AccessItemsForm.reset(); this.AccessItemsForm.reset();
this.setAccessItemsGroups(this.accessItemsResetClone); this.setAccessItemsGroups(this.accessItemsResetClone);
this.accessItemsClone = this.cloneAccessItems(this.accessItemsResetClone); this.accessItemsClone = this.cloneAccessItems(this.accessItemsResetClone);
this.alertService.triggerAlert(new AlertModel(AlertType.INFO, 'Reset edited fields')) this.alertService.triggerAlert(new AlertModel(AlertType.INFO, 'Reset edited fields'));
} }
remove(index: number) { remove(index: number) {
@ -176,17 +179,19 @@ export class AccessItemsComponent implements OnChanges, OnDestroy {
private onSave() { private onSave() {
this.requestInProgressService.setRequestInProgress(true); this.requestInProgressService.setRequestInProgress(true);
this.workbasketService.updateWorkBasketAccessItem( this.workbasketService.updateWorkBasketAccessItem(
this.accessItemsResource._links.self.href, this.AccessItemsForm.value.accessItemsGroups) this.accessItemsResource._links.self.href, this.AccessItemsForm.value.accessItemsGroups
)
.subscribe(response => { .subscribe(response => {
this.accessItemsClone = this.cloneAccessItems(this.AccessItemsForm.value.accessItemsGroups); this.accessItemsClone = this.cloneAccessItems(this.AccessItemsForm.value.accessItemsGroups);
this.accessItemsResetClone = this.cloneAccessItems(this.AccessItemsForm.value.accessItemsGroups); this.accessItemsResetClone = this.cloneAccessItems(this.AccessItemsForm.value.accessItemsGroups);
this.alertService.triggerAlert(new AlertModel( this.alertService.triggerAlert(new AlertModel(
AlertType.SUCCESS, `Workbasket ${this.workbasket.name} Access items were saved successfully`)); AlertType.SUCCESS, `Workbasket ${this.workbasket.name} Access items were saved successfully`
));
this.requestInProgressService.setRequestInProgress(false); this.requestInProgressService.setRequestInProgress(false);
}, error => { }, error => {
this.generalModalService.triggerMessage(new MessageModal(`There was error while saving your workbasket's access items`, error)) this.generalModalService.triggerMessage(new MessageModal('There was error while saving your workbasket\'s access items', error));
this.requestInProgressService.setRequestInProgress(false); this.requestInProgressService.setRequestInProgress(false);
}) });
} }
private setBadge() { private setBadge() {
@ -197,9 +202,10 @@ export class AccessItemsComponent implements OnChanges, OnDestroy {
private cloneAccessItems(inputaccessItem): Array<WorkbasketAccessItems> { private cloneAccessItems(inputaccessItem): Array<WorkbasketAccessItems> {
return this.AccessItemsForm.value.accessItemsGroups.map( return this.AccessItemsForm.value.accessItemsGroups.map(
(accessItems: WorkbasketAccessItems) => Object.assign({}, accessItems) (accessItems: WorkbasketAccessItems) => ({ ...accessItems })
); );
} }
private setWorkbasketIdForCopy(workbasketId: string) { private setWorkbasketIdForCopy(workbasketId: string) {
this.accessItemsGroups.value.forEach(element => { this.accessItemsGroups.value.forEach(element => {
delete element.accessItemId; delete element.accessItemId;

View File

@ -18,18 +18,18 @@ import { GeneralModalService } from 'app/services/general-modal/general-modal.se
import { SavingWorkbasketService } from 'app/administration/services/saving-workbaskets/saving-workbaskets.service'; import { SavingWorkbasketService } from 'app/administration/services/saving-workbaskets/saving-workbaskets.service';
import { RequestInProgressService } from 'app/services/requestInProgress/request-in-progress.service'; import { RequestInProgressService } from 'app/services/requestInProgress/request-in-progress.service';
import { DualListComponent } from './dual-list/dual-list.component';
import { DistributionTargetsComponent, Side } from './distribution-targets.component';
import { LinksWorkbasketSummary } from 'app/models/links-workbasket-summary'; import { LinksWorkbasketSummary } from 'app/models/links-workbasket-summary';
import { configureTests } from 'app/app.test.configuration'; import { configureTests } from 'app/app.test.configuration';
import { InfiniteScrollModule } from 'ngx-infinite-scroll'; import { InfiniteScrollModule } from 'ngx-infinite-scroll';
import { DistributionTargetsComponent, Side } from './distribution-targets.component';
import { DualListComponent } from './dual-list/dual-list.component';
describe('DistributionTargetsComponent', () => { describe('DistributionTargetsComponent', () => {
let component: DistributionTargetsComponent; let component: DistributionTargetsComponent;
let fixture: ComponentFixture<DistributionTargetsComponent>; let fixture: ComponentFixture<DistributionTargetsComponent>;
let workbasketService; let workbasketService;
const workbasket = new Workbasket('1', '', '', '', ICONTYPES.TOPIC, '', '', '', '', '', '', '', '', '', '', '', '', const workbasket = new Workbasket('1', '', '', '', ICONTYPES.TOPIC, '', '', '', '', '', '', '', '', '', '', '', '',
new Links({ 'href': 'someurl' }, { 'href': 'someurl' }, { 'href': 'someurl' })); new Links({ href: 'someurl' }, { href: 'someurl' }, { href: 'someurl' }));
beforeEach(done => { beforeEach(done => {
const configure = (testBed: TestBed) => { const configure = (testBed: TestBed) => {
@ -38,27 +38,27 @@ describe('DistributionTargetsComponent', () => {
declarations: [DistributionTargetsComponent, DualListComponent], declarations: [DistributionTargetsComponent, DualListComponent],
providers: [WorkbasketService, AlertService, SavingWorkbasketService, GeneralModalService, RequestInProgressService, providers: [WorkbasketService, AlertService, SavingWorkbasketService, GeneralModalService, RequestInProgressService,
] ]
}) });
}; };
configureTests(configure).then(testBed => { configureTests(configure).then(testBed => {
fixture = TestBed.createComponent(DistributionTargetsComponent); fixture = TestBed.createComponent(DistributionTargetsComponent);
component = fixture.componentInstance; component = fixture.componentInstance;
component.workbasket = workbasket; component.workbasket = workbasket;
workbasketService = TestBed.get(WorkbasketService); workbasketService = TestBed.get(WorkbasketService);
spyOn(workbasketService, 'getWorkBasketsSummary').and.callFake(() => { spyOn(workbasketService, 'getWorkBasketsSummary').and.callFake(() => of(new WorkbasketSummaryResource(
return of(new WorkbasketSummaryResource(
new Array<WorkbasketSummary>( new Array<WorkbasketSummary>(
new WorkbasketSummary('id1', '', '', '', '', '', '', '', '', '', '', '', false, new Links({ 'href': 'someurl' })), new WorkbasketSummary('id1', '', '', '', '', '', '', '', '', '', '', '', false, new Links({ href: 'someurl' })),
new WorkbasketSummary('id2', '', '', '', '', '', '', '', '', '', '', '', false, new Links({ 'href': 'someurl' })), new WorkbasketSummary('id2', '', '', '', '', '', '', '', '', '', '', '', false, new Links({ href: 'someurl' })),
new WorkbasketSummary('id3', '', '', '', '', '', '', '', '', '', '', '', false, new Links({ 'href': 'someurl' }))) new WorkbasketSummary('id3', '', '', '', '', '', '', '', '', '', '', '', false, new Links({ href: 'someurl' }))
, new LinksWorkbasketSummary({ 'href': 'someurl' }))) ),
}) new LinksWorkbasketSummary({ href: 'someurl' })
spyOn(workbasketService, 'getWorkBasketsDistributionTargets').and.callFake(() => { )));
return of(new WorkbasketDistributionTargetsResource( spyOn(workbasketService, 'getWorkBasketsDistributionTargets').and.callFake(() => of(new WorkbasketDistributionTargetsResource(
new Array<WorkbasketSummary>( new Array<WorkbasketSummary>(
new WorkbasketSummary('id2', '', '', '', '', '', '', '', '', '', '', '', false, new Links({ 'href': 'someurl' }))) new WorkbasketSummary('id2', '', '', '', '', '', '', '', '', '', '', '', false, new Links({ href: 'someurl' }))
, new LinksWorkbasketSummary({ 'href': 'someurl' }))) ),
}) new LinksWorkbasketSummary({ href: 'someurl' })
)));
component.ngOnChanges({ component.ngOnChanges({
active: new SimpleChange(undefined, 'distributionTargets', true) active: new SimpleChange(undefined, 'distributionTargets', true)
}); });
@ -86,9 +86,9 @@ describe('DistributionTargetsComponent', () => {
expect(component.distributionTargetsRight.length).toBe(1); expect(component.distributionTargetsRight.length).toBe(1);
component.distributionTargetsLeft.forEach(leftElement => { component.distributionTargetsLeft.forEach(leftElement => {
component.distributionTargetsRight.forEach(rightElement => { component.distributionTargetsRight.forEach(rightElement => {
if (leftElement.workbasketId === rightElement.workbasketId) { repeteadElemens = true }; if (leftElement.workbasketId === rightElement.workbasketId) { repeteadElemens = true; }
}) });
}) });
expect(repeteadElemens).toBeFalsy(); expect(repeteadElemens).toBeFalsy();
}); });
@ -96,11 +96,12 @@ describe('DistributionTargetsComponent', () => {
component.performFilter({ component.performFilter({
filterBy: new FilterModel({ filterBy: new FilterModel({
name: 'someName', owner: 'someOwner', description: 'someDescription', key: 'someKey' name: 'someName', owner: 'someOwner', description: 'someDescription', key: 'someKey'
}), side: Side.LEFT }),
side: Side.LEFT
}); });
component.distributionTargetsLeft = new Array<WorkbasketSummary>( component.distributionTargetsLeft = new Array<WorkbasketSummary>(
new WorkbasketSummary('id1', '', '', '', '', '', '', '', '', '', '', '', false, new Links({ 'href': 'someurl' })) new WorkbasketSummary('id1', '', '', '', '', '', '', '', '', '', '', '', false, new Links({ href: 'someurl' }))
) );
expect(component.distributionTargetsLeft.length).toBe(1); expect(component.distributionTargetsLeft.length).toBe(1);
expect(component.distributionTargetsLeft[0].workbasketId).toBe('id1'); expect(component.distributionTargetsLeft[0].workbasketId).toBe('id1');
expect(component.distributionTargetsRight.length).toBe(1); expect(component.distributionTargetsRight.length).toBe(1);
@ -109,9 +110,11 @@ describe('DistributionTargetsComponent', () => {
it('should reset distribution target and distribution target selected on reset', () => { it('should reset distribution target and distribution target selected on reset', () => {
component.distributionTargetsLeft.push( component.distributionTargetsLeft.push(
new WorkbasketSummary('id4', '', '', '', '', '', '', '', '', '', '', '', false, new Links({ 'href': 'someurl' }))); new WorkbasketSummary('id4', '', '', '', '', '', '', '', '', '', '', '', false, new Links({ href: 'someurl' }))
);
component.distributionTargetsRight.push( component.distributionTargetsRight.push(
new WorkbasketSummary('id5', '', '', '', '', '', '', '', '', '', '', '', false, new Links({ 'href': 'someurl' }))); new WorkbasketSummary('id5', '', '', '', '', '', '', '', '', '', '', '', false, new Links({ href: 'someurl' }))
);
expect(component.distributionTargetsLeft.length).toBe(3); expect(component.distributionTargetsLeft.length).toBe(3);
expect(component.distributionTargetsRight.length).toBe(2); expect(component.distributionTargetsRight.length).toBe(2);
@ -119,24 +122,23 @@ describe('DistributionTargetsComponent', () => {
component.onClear(); component.onClear();
fixture.detectChanges(); fixture.detectChanges();
expect(component.distributionTargetsLeft.length).toBe(2); expect(component.distributionTargetsLeft.length).toBe(2);
expect(component.distributionTargetsRight.length).toBe(1) expect(component.distributionTargetsRight.length).toBe(1);
}); });
it('should save distribution targets selected and update Clone objects.', () => { it('should save distribution targets selected and update Clone objects.', () => {
expect(component.distributionTargetsSelected.length).toBe(1); expect(component.distributionTargetsSelected.length).toBe(1);
expect(component.distributionTargetsSelectedClone.length).toBe(1); expect(component.distributionTargetsSelectedClone.length).toBe(1);
spyOn(workbasketService, 'updateWorkBasketsDistributionTargets').and.callFake(() => { spyOn(workbasketService, 'updateWorkBasketsDistributionTargets').and.callFake(() => of(new WorkbasketDistributionTargetsResource(
return of(new WorkbasketDistributionTargetsResource(
new Array<WorkbasketSummary>( new Array<WorkbasketSummary>(
new WorkbasketSummary('id2', '', '', '', '', '', '', '', '', '', '', '', false, new Links({ 'href': 'someurl' })), new WorkbasketSummary('id2', '', '', '', '', '', '', '', '', '', '', '', false, new Links({ href: 'someurl' })),
new WorkbasketSummary('id1', '', '', '', '', '', '', '', '', '', '', '', false, new Links({ 'href': 'someurl' }))) new WorkbasketSummary('id1', '', '', '', '', '', '', '', '', '', '', '', false, new Links({ href: 'someurl' }))
, new LinksWorkbasketSummary({ 'href': 'someurl' }))) ),
}) new LinksWorkbasketSummary({ href: 'someurl' })
)));
component.onSave(); component.onSave();
fixture.detectChanges(); fixture.detectChanges();
expect(component.distributionTargetsSelected.length).toBe(2); expect(component.distributionTargetsSelected.length).toBe(2);
expect(component.distributionTargetsSelectedClone.length).toBe(2); expect(component.distributionTargetsSelectedClone.length).toBe(2);
expect(component.distributionTargetsLeft.length).toBe(1); expect(component.distributionTargetsLeft.length).toBe(1);
}); });
}); });

View File

@ -29,13 +29,15 @@ export enum Side {
styleUrls: ['./distribution-targets.component.scss'] styleUrls: ['./distribution-targets.component.scss']
}) })
export class DistributionTargetsComponent implements OnChanges, OnDestroy { export class DistributionTargetsComponent implements OnChanges, OnDestroy {
@Input() @Input()
workbasket: Workbasket; workbasket: Workbasket;
@Input() @Input()
action: string; action: string;
@Input() @Input()
active: string; active: string;
badgeMessage = ''; badgeMessage = '';
distributionTargetsSubscription: Subscription; distributionTargetsSubscription: Subscription;
@ -71,7 +73,8 @@ export class DistributionTargetsComponent implements OnChanges, OnDestroy {
private savingWorkbaskets: SavingWorkbasketService, private savingWorkbaskets: SavingWorkbasketService,
private generalModalService: GeneralModalService, private generalModalService: GeneralModalService,
private requestInProgressService: RequestInProgressService, private requestInProgressService: RequestInProgressService,
private orientationService: OrientationService) { } private orientationService: OrientationService
) { }
ngOnChanges(changes: SimpleChanges): void { ngOnChanges(changes: SimpleChanges): void {
if (!this.initialized && changes.active && changes.active.currentValue === 'distributionTargets') { if (!this.initialized && changes.active && changes.active.currentValue === 'distributionTargets') {
@ -81,6 +84,7 @@ export class DistributionTargetsComponent implements OnChanges, OnDestroy {
this.setBadge(); this.setBadge();
} }
} }
onScroll(side: Side) { onScroll(side: Side) {
if (side === this.side.LEFT && this.page.totalPages > TaskanaQueryParameters.page) { if (side === this.side.LEFT && this.page.totalPages > TaskanaQueryParameters.page) {
this.loadingItems = true; this.loadingItems = true;
@ -111,7 +115,8 @@ export class DistributionTargetsComponent implements OnChanges, OnDestroy {
onSave() { onSave() {
this.requestInProgressService.setRequestInProgress(true); this.requestInProgressService.setRequestInProgress(true);
this.workbasketService.updateWorkBasketsDistributionTargets( this.workbasketService.updateWorkBasketsDistributionTargets(
this.distributionTargetsSelectedResource._links.self.href, this.getSeletedIds()).subscribe(response => { this.distributionTargetsSelectedResource._links.self.href, this.getSeletedIds()
).subscribe(response => {
this.requestInProgressService.setRequestInProgress(false); this.requestInProgressService.setRequestInProgress(false);
this.distributionTargetsSelected = response.distributionTargets; this.distributionTargetsSelected = response.distributionTargets;
this.distributionTargetsSelectedClone = Object.assign([], this.distributionTargetsSelected); this.distributionTargetsSelectedClone = Object.assign([], this.distributionTargetsSelected);
@ -122,14 +127,12 @@ export class DistributionTargetsComponent implements OnChanges, OnDestroy {
}, },
error => { error => {
this.generalModalService.triggerMessage( this.generalModalService.triggerMessage(
new MessageModal(`There was error while saving your workbasket's distribution targets`, error) new MessageModal('There was error while saving your workbasket\'s distribution targets', error)
); );
this.requestInProgressService.setRequestInProgress(false); this.requestInProgressService.setRequestInProgress(false);
return false; return false;
} });
);
return false; return false;
} }
onClear() { onClear() {
@ -146,9 +149,9 @@ export class DistributionTargetsComponent implements OnChanges, OnDestroy {
dualListFilter.filterBy.filterParams.name, dualListFilter.filterBy.filterParams.description, '', dualListFilter.filterBy.filterParams.name, dualListFilter.filterBy.filterParams.description, '',
dualListFilter.filterBy.filterParams.owner, dualListFilter.filterBy.filterParams.type, '', dualListFilter.filterBy.filterParams.owner, dualListFilter.filterBy.filterParams.type, '',
dualListFilter.filterBy.filterParams.key, '', true).subscribe(resultList => { dualListFilter.filterBy.filterParams.key, '', true).subscribe(resultList => {
(dualListFilter.side === Side.RIGHT) ? (dualListFilter.side === Side.RIGHT)
this.distributionTargetsRight = (resultList.workbaskets) : ? this.distributionTargetsRight = (resultList.workbaskets)
this.distributionTargetsLeft = (resultList.workbaskets); : this.distributionTargetsLeft = (resultList.workbaskets);
this.onRequest(true, dualListFilter.side); this.onRequest(true, dualListFilter.side);
}); });
} }
@ -167,7 +170,8 @@ export class DistributionTargetsComponent implements OnChanges, OnDestroy {
return; return;
} }
this.distributionTargetsSubscription = this.workbasketService.getWorkBasketsDistributionTargets( this.distributionTargetsSubscription = this.workbasketService.getWorkBasketsDistributionTargets(
this.workbasket._links.distributionTargets.href).subscribe( this.workbasket._links.distributionTargets.href
).subscribe(
(distributionTargetsSelectedResource: WorkbasketDistributionTargetsResource) => { (distributionTargetsSelectedResource: WorkbasketDistributionTargetsResource) => {
this.distributionTargetsSelectedResource = distributionTargetsSelectedResource; this.distributionTargetsSelectedResource = distributionTargetsSelectedResource;
this.distributionTargetsSelected = distributionTargetsSelectedResource.distributionTargets; this.distributionTargetsSelected = distributionTargetsSelectedResource.distributionTargets;
@ -175,7 +179,8 @@ export class DistributionTargetsComponent implements OnChanges, OnDestroy {
TaskanaQueryParameters.page = 1; TaskanaQueryParameters.page = 1;
this.calculateNumberItemsList(); this.calculateNumberItemsList();
this.getWorkbaskets(); this.getWorkbaskets();
}); }
);
this.savingDistributionTargetsSubscription = this.savingWorkbaskets.triggeredDistributionTargetsSaving() this.savingDistributionTargetsSubscription = this.savingWorkbaskets.triggeredDistributionTargetsSaving()
.subscribe((savingInformation: SavingInformation) => { .subscribe((savingInformation: SavingInformation) => {
@ -199,7 +204,7 @@ export class DistributionTargetsComponent implements OnChanges, OnDestroy {
} }
private getNextPage(side: Side) { private getNextPage(side: Side) {
TaskanaQueryParameters.page = TaskanaQueryParameters.page + 1; TaskanaQueryParameters.page += 1;
this.getWorkbaskets(side); this.getWorkbaskets(side);
} }
@ -232,7 +237,8 @@ export class DistributionTargetsComponent implements OnChanges, OnDestroy {
this.distributionTargetsClone = Object.assign([], distributionTargetsAvailable.workbaskets); this.distributionTargetsClone = Object.assign([], distributionTargetsAvailable.workbaskets);
} }
this.onRequest(true); this.onRequest(true);
}); }
);
} }
private setBadge() { private setBadge() {
@ -259,12 +265,12 @@ export class DistributionTargetsComponent implements OnChanges, OnDestroy {
this.loadingItems = false; this.loadingItems = false;
} }
if (finished) { if (finished) {
typeof side === 'undefined' ? (this.requestInProgressLeft = false, this.requestInProgressRight = false) : typeof side === 'undefined' ? (this.requestInProgressLeft = false, this.requestInProgressRight = false)
side === Side.LEFT ? this.requestInProgressLeft = false : this.requestInProgressRight = false; : side === Side.LEFT ? this.requestInProgressLeft = false : this.requestInProgressRight = false;
return; return;
} }
typeof side === 'undefined' ? (this.requestInProgressLeft = true, this.requestInProgressRight = true) : typeof side === 'undefined' ? (this.requestInProgressLeft = true, this.requestInProgressRight = true)
side === Side.LEFT ? this.requestInProgressLeft = true : this.requestInProgressRight = true; : side === Side.LEFT ? this.requestInProgressLeft = true : this.requestInProgressRight = true;
} }
private getSeletedIds(): Array<string> { private getSeletedIds(): Array<string> {

View File

@ -1,8 +1,8 @@
import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core'; import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core';
import { WorkbasketSummary } from 'app/models/workbasket-summary'; import { WorkbasketSummary } from 'app/models/workbasket-summary';
import { FilterModel } from 'app/models/filter'; import { FilterModel } from 'app/models/filter';
import { Side } from '../distribution-targets.component';
import { expandDown } from 'app/shared/animations/expand.animation'; import { expandDown } from 'app/shared/animations/expand.animation';
import { Side } from '../distribution-targets.component';
@Component({ @Component({
selector: 'taskana-dual-list', selector: 'taskana-dual-list',
@ -11,7 +11,6 @@ import { expandDown } from 'app/shared/animations/expand.animation';
animations: [expandDown] animations: [expandDown]
}) })
export class DualListComponent implements OnInit { export class DualListComponent implements OnInit {
@Input() distributionTargets: Array<WorkbasketSummary>; @Input() distributionTargets: Array<WorkbasketSummary>;
@Input() distributionTargetsSelected: Array<WorkbasketSummary>; @Input() distributionTargetsSelected: Array<WorkbasketSummary>;
@Output() performDualListFilter = new EventEmitter<{ filterBy: FilterModel, side: Side }>(); @Output() performDualListFilter = new EventEmitter<{ filterBy: FilterModel, side: Side }>();
@ -48,5 +47,4 @@ export class DualListComponent implements OnInit {
changeToolbarState(state: boolean) { changeToolbarState(state: boolean) {
this.toolbarState = state; this.toolbarState = state;
} }
} }

View File

@ -1,6 +1,5 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { WorkbasketService } from 'app/shared/services/workbasket/workbasket.service'; import { WorkbasketService } from 'app/shared/services/workbasket/workbasket.service';
import { WorkbasketInformationComponent } from './workbasket-information.component';
import { FormsModule } from '@angular/forms'; import { FormsModule } from '@angular/forms';
import { AngularSvgIconModule } from 'angular-svg-icon'; import { AngularSvgIconModule } from 'angular-svg-icon';
import { HttpClientModule } from '@angular/common/http'; import { HttpClientModule } from '@angular/common/http';
@ -21,6 +20,7 @@ import { RequestInProgressService } from 'app/services/requestInProgress/request
import { CustomFieldsService } from 'app/services/custom-fields/custom-fields.service'; import { CustomFieldsService } from 'app/services/custom-fields/custom-fields.service';
import { configureTests } from 'app/app.test.configuration'; import { configureTests } from 'app/app.test.configuration';
import { FormsValidatorService } from 'app/shared/services/forms/forms-validator.service'; import { FormsValidatorService } from 'app/shared/services/forms/forms-validator.service';
import { WorkbasketInformationComponent } from './workbasket-information.component';
@Component({ @Component({
selector: 'taskana-dummy-detail', selector: 'taskana-dummy-detail',
@ -37,7 +37,8 @@ const routes: Routes = [
describe('WorkbasketInformationComponent', () => { describe('WorkbasketInformationComponent', () => {
let component: WorkbasketInformationComponent; let component: WorkbasketInformationComponent;
let fixture: ComponentFixture<WorkbasketInformationComponent>; let fixture: ComponentFixture<WorkbasketInformationComponent>;
let debugElement, workbasketService, alertService, savingWorkbasketService, requestInProgressService, formsValidatorService; let debugElement; let workbasketService; let alertService; let savingWorkbasketService; let requestInProgressService; let
formsValidatorService;
beforeEach(done => { beforeEach(done => {
const configure = (testBed: TestBed) => { const configure = (testBed: TestBed) => {
@ -50,7 +51,7 @@ describe('WorkbasketInformationComponent', () => {
providers: [WorkbasketService, AlertService, SavingWorkbasketService, GeneralModalService, RequestInProgressService, providers: [WorkbasketService, AlertService, SavingWorkbasketService, GeneralModalService, RequestInProgressService,
CustomFieldsService, FormsValidatorService] CustomFieldsService, FormsValidatorService]
}) });
}; };
configureTests(configure).then(testBed => { configureTests(configure).then(testBed => {
fixture = TestBed.createComponent(WorkbasketInformationComponent); fixture = TestBed.createComponent(WorkbasketInformationComponent);
@ -88,7 +89,6 @@ describe('WorkbasketInformationComponent', () => {
fixture.whenStable().then(() => { fixture.whenStable().then(() => {
expect(debugElement.querySelector('#wb-information > .panel-body > form > div > div > input ').value).toBe('keyModified'); expect(debugElement.querySelector('#wb-information > .panel-body > form > div > div > input ').value).toBe('keyModified');
}); });
})); }));
it('selectType should set workbasket.type to personal with 0 and group in other case', () => { it('selectType should set workbasket.type to personal with 0 and group in other case', () => {
@ -112,19 +112,18 @@ describe('WorkbasketInformationComponent', () => {
it('should reset requestInProgress after saving request is done', () => { it('should reset requestInProgress after saving request is done', () => {
component.workbasket = new Workbasket('id', 'created', 'keyModified', 'domain', ICONTYPES.TOPIC, 'modified', 'name', 'description', component.workbasket = new Workbasket('id', 'created', 'keyModified', 'domain', ICONTYPES.TOPIC, 'modified', 'name', 'description',
'owner', 'custom1', 'custom2', 'custom3', 'custom4', 'orgLevel1', 'orgLevel2', 'owner', 'custom1', 'custom2', 'custom3', 'custom4', 'orgLevel1', 'orgLevel2',
'orgLevel3', 'orgLevel4', new Links({ 'href': 'someUrl' })); 'orgLevel3', 'orgLevel4', new Links({ href: 'someUrl' }));
fixture.detectChanges(); fixture.detectChanges();
spyOn(workbasketService, 'updateWorkbasket').and.returnValue(of(component.workbasket)); spyOn(workbasketService, 'updateWorkbasket').and.returnValue(of(component.workbasket));
spyOn(workbasketService, 'triggerWorkBasketSaved').and.returnValue(of(component.workbasket)); spyOn(workbasketService, 'triggerWorkBasketSaved').and.returnValue(of(component.workbasket));
component.onSubmit(); component.onSubmit();
expect(component.requestInProgress).toBeFalsy(); expect(component.requestInProgress).toBeFalsy();
}); });
it('should trigger triggerWorkBasketSaved method after saving request is done', async(() => { it('should trigger triggerWorkBasketSaved method after saving request is done', async(() => {
component.workbasket = new Workbasket('id', 'created', 'keyModified', 'domain', ICONTYPES.TOPIC, 'modified', 'name', 'description', component.workbasket = new Workbasket('id', 'created', 'keyModified', 'domain', ICONTYPES.TOPIC, 'modified', 'name', 'description',
'owner', 'custom1', 'custom2', 'custom3', 'custom4', 'orgLevel1', 'orgLevel2', 'owner', 'custom1', 'custom2', 'custom3', 'custom4', 'orgLevel1', 'orgLevel2',
'orgLevel3', 'orgLevel4', new Links({ 'href': 'someUrl' })); 'orgLevel3', 'orgLevel4', new Links({ href: 'someUrl' }));
spyOn(workbasketService, 'updateWorkbasket').and.returnValue(of(component.workbasket)); spyOn(workbasketService, 'updateWorkbasket').and.returnValue(of(component.workbasket));
spyOn(workbasketService, 'triggerWorkBasketSaved').and.returnValue(of(component.workbasket)); spyOn(workbasketService, 'triggerWorkBasketSaved').and.returnValue(of(component.workbasket));
fixture.detectChanges(); fixture.detectChanges();
@ -134,18 +133,19 @@ describe('WorkbasketInformationComponent', () => {
fixture.whenStable().then(() => { fixture.whenStable().then(() => {
fixture.detectChanges(); fixture.detectChanges();
expect(workbasketService.triggerWorkBasketSaved).toHaveBeenCalled(); expect(workbasketService.triggerWorkBasketSaved).toHaveBeenCalled();
}) });
})); }));
it('should post a new workbasket when no workbasketId is defined and update workbasket', async(() => { it('should post a new workbasket when no workbasketId is defined and update workbasket', async(() => {
const workbasket = new Workbasket(undefined, 'created', 'keyModified', 'domain', ICONTYPES.TOPIC, 'modified', 'name', 'description', const workbasket = new Workbasket(undefined, 'created', 'keyModified', 'domain', ICONTYPES.TOPIC, 'modified', 'name', 'description',
'owner', 'custom1', 'custom2', 'custom3', 'custom4', 'orgLevel1', 'orgLevel2', 'owner', 'custom1', 'custom2', 'custom3', 'custom4', 'orgLevel1', 'orgLevel2',
'orgLevel3', 'orgLevel4', new Links({ 'href': 'someUrl' })); 'orgLevel3', 'orgLevel4', new Links({ href: 'someUrl' }));
component.workbasket = workbasket component.workbasket = workbasket;
spyOn(workbasketService, 'createWorkbasket').and.returnValue(of( spyOn(workbasketService, 'createWorkbasket').and.returnValue(of(
new Workbasket('someNewId', 'created', 'keyModified', 'domain', ICONTYPES.TOPIC, 'modified', 'name', 'description', new Workbasket('someNewId', 'created', 'keyModified', 'domain', ICONTYPES.TOPIC, 'modified', 'name', 'description',
'owner', 'custom1', 'custom2', 'custom3', 'custom4', 'orgLevel1', 'orgLevel2', 'owner', 'custom1', 'custom2', 'custom3', 'custom4', 'orgLevel1', 'orgLevel2',
'orgLevel3', 'orgLevel4', new Links({ 'href': 'someUrl' })))); 'orgLevel3', 'orgLevel4', new Links({ href: 'someUrl' }))
));
fixture.detectChanges(); fixture.detectChanges();
spyOn(formsValidatorService, 'validateFormAccess').and.returnValue(Promise.resolve(true)); spyOn(formsValidatorService, 'validateFormAccess').and.returnValue(Promise.resolve(true));
component.onSubmit(); component.onSubmit();
@ -153,22 +153,23 @@ describe('WorkbasketInformationComponent', () => {
fixture.detectChanges(); fixture.detectChanges();
expect(alertService.triggerAlert).toHaveBeenCalled(); expect(alertService.triggerAlert).toHaveBeenCalled();
expect(component.workbasket.workbasketId).toBe('someNewId'); expect(component.workbasket.workbasketId).toBe('someNewId');
}) });
})); }));
it('should post a new workbasket, new distribution targets and new access ' + it('should post a new workbasket, new distribution targets and new access '
'items when no workbasketId is defined and action is copy', async(() => { + 'items when no workbasketId is defined and action is copy', async(() => {
const workbasket = new Workbasket(undefined, 'created', 'keyModified', 'domain', ICONTYPES.TOPIC, const workbasket = new Workbasket(undefined, 'created', 'keyModified', 'domain', ICONTYPES.TOPIC,
'modified', 'name', 'description', 'owner', 'custom1', 'custom2', 'modified', 'name', 'description', 'owner', 'custom1', 'custom2',
'custom3', 'custom4', 'orgLevel1', 'orgLevel2', 'custom3', 'custom4', 'orgLevel1', 'orgLevel2',
'orgLevel3', 'orgLevel4', new Links({ 'href': 'someUrl' })); 'orgLevel3', 'orgLevel4', new Links({ href: 'someUrl' }));
component.workbasket = workbasket component.workbasket = workbasket;
component.action = ACTION.COPY; component.action = ACTION.COPY;
spyOn(workbasketService, 'createWorkbasket').and.returnValue(of( spyOn(workbasketService, 'createWorkbasket').and.returnValue(of(
new Workbasket('someNewId', 'created', 'keyModified', 'domain', ICONTYPES.TOPIC, 'modified', 'name', 'description', new Workbasket('someNewId', 'created', 'keyModified', 'domain', ICONTYPES.TOPIC, 'modified', 'name', 'description',
'owner', 'custom1', 'custom2', 'custom3', 'custom4', 'orgLevel1', 'orgLevel2', 'owner', 'custom1', 'custom2', 'custom3', 'custom4', 'orgLevel1', 'orgLevel2',
'orgLevel3', 'orgLevel4', new Links({ 'href': 'someUrl' }, { 'href': 'someUrl' }, { 'href': 'someUrl' })))); 'orgLevel3', 'orgLevel4', new Links({ href: 'someUrl' }, { href: 'someUrl' }, { href: 'someUrl' }))
));
spyOn(savingWorkbasketService, 'triggerDistributionTargetSaving'); spyOn(savingWorkbasketService, 'triggerDistributionTargetSaving');
spyOn(savingWorkbasketService, 'triggerAccessItemsSaving'); spyOn(savingWorkbasketService, 'triggerAccessItemsSaving');
@ -181,12 +182,12 @@ describe('WorkbasketInformationComponent', () => {
expect(component.workbasket.workbasketId).toBe('someNewId'); expect(component.workbasket.workbasketId).toBe('someNewId');
expect(savingWorkbasketService.triggerDistributionTargetSaving).toHaveBeenCalled(); expect(savingWorkbasketService.triggerDistributionTargetSaving).toHaveBeenCalled();
expect(savingWorkbasketService.triggerAccessItemsSaving).toHaveBeenCalled(); expect(savingWorkbasketService.triggerAccessItemsSaving).toHaveBeenCalled();
}) });
})); }));
it('should trigger requestInProgress service true before and requestInProgress false after remove a workbasket', () => { it('should trigger requestInProgress service true before and requestInProgress false after remove a workbasket', () => {
const links = new Links({ 'href': 'someUrl' }); const links = new Links({ href: 'someUrl' });
links.removeDistributionTargets = { 'href': 'someUrl' }; links.removeDistributionTargets = { href: 'someUrl' };
const workbasket = new Workbasket(undefined, 'created', 'keyModified', 'domain', ICONTYPES.TOPIC, const workbasket = new Workbasket(undefined, 'created', 'keyModified', 'domain', ICONTYPES.TOPIC,
'modified', 'name', 'description', 'owner', 'custom1', 'custom2', 'modified', 'name', 'description', 'owner', 'custom1', 'custom2',
'custom3', 'custom4', 'orgLevel1', 'orgLevel2', 'custom3', 'custom4', 'orgLevel1', 'orgLevel2',
@ -202,6 +203,5 @@ describe('WorkbasketInformationComponent', () => {
}, error => { }, complete => { }, error => { }, complete => {
expect(requestInProgressServiceSpy).toHaveBeenCalledWith(false); expect(requestInProgressServiceSpy).toHaveBeenCalledWith(false);
}); });
}) });
}); });

View File

@ -1,12 +1,10 @@
import { import { Component,
Component,
OnInit, OnInit,
Input, Input,
OnDestroy, OnDestroy,
OnChanges, OnChanges,
SimpleChanges, SimpleChanges,
ViewChild ViewChild } from '@angular/core';
} from '@angular/core';
import { ActivatedRoute, Router } from '@angular/router'; import { ActivatedRoute, Router } from '@angular/router';
import { Subscription } from 'rxjs'; import { Subscription } from 'rxjs';
import { NgForm } from '@angular/forms'; import { NgForm } from '@angular/forms';
@ -20,10 +18,8 @@ import { TaskanaDate } from 'app/shared/util/taskana.date';
import { AlertService } from 'app/services/alert/alert.service'; import { AlertService } from 'app/services/alert/alert.service';
import { GeneralModalService } from 'app/services/general-modal/general-modal.service'; import { GeneralModalService } from 'app/services/general-modal/general-modal.service';
import { import { SavingWorkbasketService,
SavingWorkbasketService, SavingInformation } from 'app/administration/services/saving-workbaskets/saving-workbaskets.service';
SavingInformation
} from 'app/administration/services/saving-workbaskets/saving-workbaskets.service';
import { WorkbasketService } from 'app/shared/services/workbasket/workbasket.service'; import { WorkbasketService } from 'app/shared/services/workbasket/workbasket.service';
import { RequestInProgressService } from 'app/services/requestInProgress/request-in-progress.service'; import { RequestInProgressService } from 'app/services/requestInProgress/request-in-progress.service';
import { CustomFieldsService } from 'app/services/custom-fields/custom-fields.service'; import { CustomFieldsService } from 'app/services/custom-fields/custom-fields.service';
@ -39,6 +35,7 @@ export class WorkbasketInformationComponent
implements OnInit, OnChanges, OnDestroy { implements OnInit, OnChanges, OnDestroy {
@Input() @Input()
workbasket: Workbasket; workbasket: Workbasket;
workbasketClone: Workbasket; workbasketClone: Workbasket;
workbasketErrors; workbasketErrors;
@Input() @Input()
@ -52,18 +49,22 @@ export class WorkbasketInformationComponent
'Owner', 'Owner',
'workbaskets.information.owner' 'workbaskets.information.owner'
); );
custom1Field = this.customFieldsService.getCustomField( custom1Field = this.customFieldsService.getCustomField(
'Custom 1', 'Custom 1',
'workbaskets.information.custom1' 'workbaskets.information.custom1'
); );
custom2Field = this.customFieldsService.getCustomField( custom2Field = this.customFieldsService.getCustomField(
'Custom 2', 'Custom 2',
'workbaskets.information.custom2' 'workbaskets.information.custom2'
); );
custom3Field = this.customFieldsService.getCustomField( custom3Field = this.customFieldsService.getCustomField(
'Custom 3', 'Custom 3',
'workbaskets.information.custom3' 'workbaskets.information.custom3'
); );
custom4Field = this.customFieldsService.getCustomField( custom4Field = this.customFieldsService.getCustomField(
'Custom 4', 'Custom 4',
'workbaskets.information.custom4' 'workbaskets.information.custom4'
@ -237,7 +238,7 @@ export class WorkbasketInformationComponent
this.afterRequest(); this.afterRequest();
this.workbasketService.triggerWorkBasketSaved(); this.workbasketService.triggerWorkBasketSaved();
this.workbasketService.selectWorkBasket(this.workbasket.workbasketId); this.workbasketService.selectWorkBasket(this.workbasket.workbasketId);
this.router.navigate(['../' + this.workbasket.workbasketId], { this.router.navigate([`../${this.workbasket.workbasketId}`], {
relativeTo: this.route relativeTo: this.route
}); });
if (this.action === ACTION.COPY) { if (this.action === ACTION.COPY) {
@ -285,7 +286,7 @@ export class WorkbasketInformationComponent
); );
} else { } else {
this.alertService.triggerAlert( this.alertService.triggerAlert(
new AlertModel(AlertType.SUCCESS, 'The Workbasket ' + this.workbasket.workbasketId + ' has been marked for deletion') new AlertModel(AlertType.SUCCESS, `The Workbasket ${this.workbasket.workbasketId} has been marked for deletion`)
); );
} }
this.router.navigate(['taskana/administration/workbaskets']); this.router.navigate(['taskana/administration/workbaskets']);

View File

@ -1,5 +1,5 @@
import { Component } from '@angular/core'; import { Component } from '@angular/core';
import { ComponentFixture, TestBed, } from '@angular/core/testing'; import { ComponentFixture, TestBed } from '@angular/core/testing';
import { RouterTestingModule } from '@angular/router/testing'; import { RouterTestingModule } from '@angular/router/testing';
import { Router, Routes } from '@angular/router'; import { Router, Routes } from '@angular/router';
import { FormsModule, ReactiveFormsModule } from '@angular/forms'; import { FormsModule, ReactiveFormsModule } from '@angular/forms';
@ -25,13 +25,13 @@ import { RequestInProgressService } from 'app/services/requestInProgress/request
import { CustomFieldsService } from 'app/services/custom-fields/custom-fields.service'; import { CustomFieldsService } from 'app/services/custom-fields/custom-fields.service';
import { configureTests } from 'app/app.test.configuration'; import { configureTests } from 'app/app.test.configuration';
import { InfiniteScrollModule } from 'ngx-infinite-scroll';
import { ImportExportService } from 'app/administration/services/import-export/import-export.service';
import { WorkbasketDetailsComponent } from './workbasket-details.component'; import { WorkbasketDetailsComponent } from './workbasket-details.component';
import { WorkbasketInformationComponent } from './information/workbasket-information.component'; import { WorkbasketInformationComponent } from './information/workbasket-information.component';
import { AccessItemsComponent } from './access-items/access-items.component'; import { AccessItemsComponent } from './access-items/access-items.component';
import { DistributionTargetsComponent } from './distribution-targets/distribution-targets.component'; import { DistributionTargetsComponent } from './distribution-targets/distribution-targets.component';
import { DualListComponent } from './distribution-targets//dual-list/dual-list.component'; import { DualListComponent } from './distribution-targets/dual-list/dual-list.component';
import { InfiniteScrollModule } from 'ngx-infinite-scroll';
import { ImportExportService } from 'app/administration/services/import-export/import-export.service';
@Component({ @Component({
selector: 'taskana-dummy-detail', selector: 'taskana-dummy-detail',
@ -48,7 +48,7 @@ describe('WorkbasketDetailsComponent', () => {
let workbasketService; let workbasketService;
let router; let router;
const workbasket = new Workbasket('1', '', '', '', ICONTYPES.TOPIC, '', '', '', '', '', '', '', '', '', '', '', '', const workbasket = new Workbasket('1', '', '', '', ICONTYPES.TOPIC, '', '', '', '', '', '', '', '', '', '', '', '',
new Links({ 'href': 'someurl' }, { 'href': 'someurl' }, { 'href': 'someurl' })); new Links({ href: 'someurl' }, { href: 'someurl' }, { href: 'someurl' }));
const routes: Routes = [ const routes: Routes = [
{ path: '*', component: DummyDetailComponent } { path: '*', component: DummyDetailComponent }
@ -64,35 +64,33 @@ describe('WorkbasketDetailsComponent', () => {
DistributionTargetsComponent, DualListComponent, DummyDetailComponent], DistributionTargetsComponent, DualListComponent, DummyDetailComponent],
providers: [WorkbasketService, MasterAndDetailService, GeneralModalService, RequestInProgressService, providers: [WorkbasketService, MasterAndDetailService, GeneralModalService, RequestInProgressService,
AlertService, SavingWorkbasketService, CustomFieldsService, ImportExportService] AlertService, SavingWorkbasketService, CustomFieldsService, ImportExportService]
}) });
}; };
configureTests(configure).then(testBed => { configureTests(configure).then(testBed => {
fixture = TestBed.createComponent(WorkbasketDetailsComponent); fixture = TestBed.createComponent(WorkbasketDetailsComponent);
component = fixture.componentInstance; component = fixture.componentInstance;
debugElement = fixture.debugElement.nativeElement; debugElement = fixture.debugElement.nativeElement;
router = TestBed.get(Router) router = TestBed.get(Router);
fixture.detectChanges(); fixture.detectChanges();
masterAndDetailService = TestBed.get(MasterAndDetailService); masterAndDetailService = TestBed.get(MasterAndDetailService);
workbasketService = TestBed.get(WorkbasketService); workbasketService = TestBed.get(WorkbasketService);
spyOn(masterAndDetailService, 'getShowDetail').and.callFake(() => of(true)) spyOn(masterAndDetailService, 'getShowDetail').and.callFake(() => of(true));
spyOn(workbasketService, 'getSelectedWorkBasket').and.callFake(() => of('id1')) spyOn(workbasketService, 'getSelectedWorkBasket').and.callFake(() => of('id1'));
spyOn(workbasketService, 'getWorkBasketsSummary').and.callFake(() => { spyOn(workbasketService, 'getWorkBasketsSummary').and.callFake(() => of(new WorkbasketSummaryResource(
return of(new WorkbasketSummaryResource(
new Array<WorkbasketSummary>( new Array<WorkbasketSummary>(
new WorkbasketSummary('id1', '', '', '', '', '', '', '', '', '', '', '', new WorkbasketSummary('id1', '', '', '', '', '', '', '', '', '', '', '',
false, new Links({ 'href': 'someurl' }))) false, new Links({ href: 'someurl' }))
, new LinksWorkbasketSummary({ 'href': 'someurl' }))) ),
}) new LinksWorkbasketSummary({ href: 'someurl' })
)));
spyOn(workbasketService, 'getWorkBasket').and.callFake(() => of(workbasket)) spyOn(workbasketService, 'getWorkBasket').and.callFake(() => of(workbasket));
spyOn(workbasketService, 'getWorkBasketAccessItems').and.callFake(() => { spyOn(workbasketService, 'getWorkBasketAccessItems').and.callFake(() => of(new WorkbasketAccessItemsResource(
return of(new WorkbasketAccessItemsResource( new Array<WorkbasketAccessItems>(), new Links({ href: 'url' })
new Array<WorkbasketAccessItems>(), new Links({ 'href': 'url' }))) )));
}) spyOn(workbasketService, 'getWorkBasketsDistributionTargets').and.callFake(() => of(new WorkbasketSummaryResource(
spyOn(workbasketService, 'getWorkBasketsDistributionTargets').and.callFake(() => { new Array<WorkbasketSummary>(), new LinksWorkbasketSummary({ href: 'url' })
return of(new WorkbasketSummaryResource( )));
new Array<WorkbasketSummary>(), new LinksWorkbasketSummary({ 'href': 'url' })))
})
done(); done();
}); });
}); });
@ -104,5 +102,4 @@ describe('WorkbasketDetailsComponent', () => {
it('should be created', () => { it('should be created', () => {
expect(component).toBeTruthy(); expect(component).toBeTruthy();
}); });
}); });

View File

@ -4,20 +4,19 @@ import { Subscription } from 'rxjs';
import { Workbasket } from 'app/models/workbasket'; import { Workbasket } from 'app/models/workbasket';
import { ACTION } from 'app/models/action'; import { ACTION } from 'app/models/action';
import { MessageModal } from '../../../models/message-modal';
import { WorkbasketService } from 'app/shared/services/workbasket/workbasket.service' import { WorkbasketService } from 'app/shared/services/workbasket/workbasket.service';
import { MasterAndDetailService } from 'app/services/masterAndDetail/master-and-detail.service' import { MasterAndDetailService } from 'app/services/masterAndDetail/master-and-detail.service';
import { DomainService } from 'app/services/domain/domain.service'; import { DomainService } from 'app/services/domain/domain.service';
import { GeneralModalService } from '../../../services/general-modal/general-modal.service';
import { ImportExportService } from 'app/administration/services/import-export/import-export.service'; import { ImportExportService } from 'app/administration/services/import-export/import-export.service';
import { GeneralModalService } from '../../../services/general-modal/general-modal.service';
import { MessageModal } from '../../../models/message-modal';
@Component({ @Component({
selector: 'taskana-workbasket-details', selector: 'taskana-workbasket-details',
templateUrl: './workbasket-details.component.html' templateUrl: './workbasket-details.component.html'
}) })
export class WorkbasketDetailsComponent implements OnInit, OnDestroy { export class WorkbasketDetailsComponent implements OnInit, OnDestroy {
workbasket: Workbasket; workbasket: Workbasket;
workbasketCopy: Workbasket; workbasketCopy: Workbasket;
selectedId: string; selectedId: string;
@ -43,7 +42,6 @@ export class WorkbasketDetailsComponent implements OnInit, OnDestroy {
private importExportService: ImportExportService) { } private importExportService: ImportExportService) { }
ngOnInit() { ngOnInit() {
this.workbasketSelectedSubscription = this.service.getSelectedWorkBasket().subscribe(workbasketIdSelected => { this.workbasketSelectedSubscription = this.service.getSelectedWorkBasket().subscribe(workbasketIdSelected => {
delete this.workbasket; delete this.workbasket;
@ -51,7 +49,7 @@ export class WorkbasketDetailsComponent implements OnInit, OnDestroy {
}); });
this.routeSubscription = this.route.params.subscribe(params => { this.routeSubscription = this.route.params.subscribe(params => {
const id = params['id']; const { id } = params;
delete this.action; delete this.action;
if (id) { if (id) {
if (id.indexOf('new-workbasket') !== -1) { if (id.indexOf('new-workbasket') !== -1) {
@ -79,7 +77,7 @@ export class WorkbasketDetailsComponent implements OnInit, OnDestroy {
this.importingExportingSubscription = this.importExportService.getImportingFinished().subscribe(() => { this.importingExportingSubscription = this.importExportService.getImportingFinished().subscribe(() => {
if (this.workbasket) { this.getWorkbasketInformation(this.workbasket.workbasketId); } if (this.workbasket) { this.getWorkbasketInformation(this.workbasket.workbasketId); }
}) });
} }
backClicked(): void { backClicked(): void {
@ -117,7 +115,8 @@ export class WorkbasketDetailsComponent implements OnInit, OnDestroy {
this.checkDomainAndRedirect(); this.checkDomainAndRedirect();
}, err => { }, err => {
this.generalModalService.triggerMessage( this.generalModalService.triggerMessage(
new MessageModal('An error occurred while fetching the workbasket', err)); new MessageModal('An error occurred while fetching the workbasket', err)
);
}); });
} }
} }

View File

@ -15,7 +15,6 @@ import { Links } from 'app/models/links';
import { FilterModel } from 'app/models/filter'; import { FilterModel } from 'app/models/filter';
import { SortingModel } from 'app/models/sorting'; import { SortingModel } from 'app/models/sorting';
import { WorkbasketListToolbarComponent } from './workbasket-list-toolbar.component';
import { ImportExportComponent } from 'app/administration/components/import-export/import-export.component'; import { ImportExportComponent } from 'app/administration/components/import-export/import-export.component';
import { WorkbasketService } from 'app/shared/services/workbasket/workbasket.service'; import { WorkbasketService } from 'app/shared/services/workbasket/workbasket.service';
@ -23,6 +22,7 @@ import { ClassificationDefinitionService } from 'app/administration/services/cla
import { WorkbasketDefinitionService } from 'app/administration/services/workbasket-definition/workbasket-definition.service'; import { WorkbasketDefinitionService } from 'app/administration/services/workbasket-definition/workbasket-definition.service';
import { configureTests } from 'app/app.test.configuration'; import { configureTests } from 'app/app.test.configuration';
import { ImportExportService } from 'app/administration/services/import-export/import-export.service'; import { ImportExportService } from 'app/administration/services/import-export/import-export.service';
import { WorkbasketListToolbarComponent } from './workbasket-list-toolbar.component';
@Component({ @Component({
selector: 'taskana-dummy-detail', selector: 'taskana-dummy-detail',
@ -35,7 +35,8 @@ export class DummyDetailComponent {
describe('WorkbasketListToolbarComponent', () => { describe('WorkbasketListToolbarComponent', () => {
let component: WorkbasketListToolbarComponent; let component: WorkbasketListToolbarComponent;
let fixture: ComponentFixture<WorkbasketListToolbarComponent>; let fixture: ComponentFixture<WorkbasketListToolbarComponent>;
let debugElement, workbasketService, router; let debugElement; let workbasketService; let
router;
const routes: Routes = [ const routes: Routes = [
{ path: ':id', component: DummyDetailComponent, outlet: 'detail' } { path: ':id', component: DummyDetailComponent, outlet: 'detail' }
@ -53,7 +54,7 @@ describe('WorkbasketListToolbarComponent', () => {
WorkbasketDefinitionService, WorkbasketDefinitionService,
ImportExportService ImportExportService
] ]
}) });
}; };
configureTests(configure).then(testBed => { configureTests(configure).then(testBed => {
fixture = TestBed.createComponent(WorkbasketListToolbarComponent); fixture = TestBed.createComponent(WorkbasketListToolbarComponent);
@ -65,9 +66,10 @@ describe('WorkbasketListToolbarComponent', () => {
debugElement = fixture.debugElement.nativeElement; debugElement = fixture.debugElement.nativeElement;
component = fixture.componentInstance; component = fixture.componentInstance;
component.workbaskets = new Array<WorkbasketSummary>( component.workbaskets = new Array<WorkbasketSummary>(
new WorkbasketSummary('1', 'key1', 'NAME1', 'description 1', 'owner 1')); new WorkbasketSummary('1', 'key1', 'NAME1', 'description 1', 'owner 1')
);
component.workbaskets[0].markedForDeletion = false; component.workbaskets[0].markedForDeletion = false;
component.workbaskets[0]._links = new Links({ 'href': 'selfLink' }); component.workbaskets[0]._links = new Links({ href: 'selfLink' });
fixture.detectChanges(); fixture.detectChanges();
done(); done();
@ -93,19 +95,17 @@ describe('WorkbasketListToolbarComponent', () => {
let sort: SortingModel; let sort: SortingModel;
const compareSort = new SortingModel(); const compareSort = new SortingModel();
component.performSorting.subscribe((value) => { sort = value }) component.performSorting.subscribe(value => { sort = value; });
component.sorting(compareSort); component.sorting(compareSort);
expect(sort).toBe(compareSort); expect(sort).toBe(compareSort);
}); });
it('should emit performFilter when filter is triggered', () => { it('should emit performFilter when filter is triggered', () => {
let filter: FilterModel; let filter: FilterModel;
const compareFilter = new FilterModel(); const compareFilter = new FilterModel();
component.performFilter.subscribe((value) => { filter = value }) component.performFilter.subscribe(value => { filter = value; });
component.filtering(compareFilter); component.filtering(compareFilter);
expect(filter).toBe(compareFilter); expect(filter).toBe(compareFilter);
}); });
}); });

View File

@ -17,8 +17,6 @@ import { expandDown } from 'app/shared/animations/expand.animation';
styleUrls: ['./workbasket-list-toolbar.component.scss'] styleUrls: ['./workbasket-list-toolbar.component.scss']
}) })
export class WorkbasketListToolbarComponent implements OnInit { export class WorkbasketListToolbarComponent implements OnInit {
@Input() workbaskets: Array<WorkbasketSummary>; @Input() workbaskets: Array<WorkbasketSummary>;
@Output() performSorting = new EventEmitter<SortingModel>(); @Output() performSorting = new EventEmitter<SortingModel>();
@Output() performFilter = new EventEmitter<FilterModel>(); @Output() performFilter = new EventEmitter<FilterModel>();
@ -27,14 +25,16 @@ export class WorkbasketListToolbarComponent implements OnInit {
sortingFields = new Map([['name', 'Name'], ['key', 'Key'], ['description', 'Description'], ['owner', 'Owner'], ['type', 'Type']]); sortingFields = new Map([['name', 'Name'], ['key', 'Key'], ['description', 'Description'], ['owner', 'Owner'], ['type', 'Type']]);
filteringTypes = new Map([['ALL', 'All'], ['PERSONAL', 'Personal'], ['GROUP', 'Group'], filteringTypes = new Map([['ALL', 'All'], ['PERSONAL', 'Personal'], ['GROUP', 'Group'],
['CLEARANCE', 'Clearance'], ['TOPIC', 'Topic']]); ['CLEARANCE', 'Clearance'], ['TOPIC', 'Topic']]);
filterParams = {name: '', key: '', type: '', description: '', owner: ''};
filterParams = { name: '', key: '', type: '', description: '', owner: '' };
toolbarState = false; toolbarState = false;
filterType = TaskanaType.WORKBASKETS; filterType = TaskanaType.WORKBASKETS;
constructor( constructor(
private workbasketService: WorkbasketService, private workbasketService: WorkbasketService,
private route: ActivatedRoute, private route: ActivatedRoute,
private router: Router) { private router: Router
) {
} }
ngOnInit() { ngOnInit() {
@ -52,5 +52,4 @@ export class WorkbasketListToolbarComponent implements OnInit {
this.workbasketService.selectWorkBasket(); this.workbasketService.selectWorkBasket();
this.router.navigate([{ outlets: { detail: ['new-workbasket'] } }], { relativeTo: this.route }); this.router.navigate([{ outlets: { detail: ['new-workbasket'] } }], { relativeTo: this.route });
} }
} }

View File

@ -12,8 +12,6 @@ import { WorkbasketSummaryResource } from 'app/models/workbasket-summary-resourc
import { FilterModel } from 'app/models/filter'; import { FilterModel } from 'app/models/filter';
import { LinksWorkbasketSummary } from 'app/models/links-workbasket-summary'; 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 { ImportExportComponent } from 'app/administration/components/import-export/import-export.component';
import { WorkbasketDefinitionService } from 'app/administration/services/workbasket-definition/workbasket-definition.service'; import { WorkbasketDefinitionService } from 'app/administration/services/workbasket-definition/workbasket-definition.service';
@ -23,6 +21,8 @@ import { OrientationService } from 'app/services/orientation/orientation.service
import { configureTests } from 'app/app.test.configuration'; import { configureTests } from 'app/app.test.configuration';
import { Page } from 'app/models/page'; import { Page } from 'app/models/page';
import { ImportExportService } from 'app/administration/services/import-export/import-export.service'; import { ImportExportService } from 'app/administration/services/import-export/import-export.service';
import { WorkbasketListToolbarComponent } from './workbasket-list-toolbar/workbasket-list-toolbar.component';
import { WorkbasketListComponent } from './workbasket-list.component';
@Component({ @Component({
selector: 'taskana-dummy-detail', selector: 'taskana-dummy-detail',
@ -38,16 +38,20 @@ class DummyDetailComponent {
class PaginationComponent { class PaginationComponent {
@Input() @Input()
page: Page; page: Page;
@Output() @Output()
workbasketsResourceChange = new EventEmitter<any>(); workbasketsResourceChange = new EventEmitter<any>();
@Output() changePage = new EventEmitter<any>(); @Output() changePage = new EventEmitter<any>();
} }
const workbasketSummaryResource: WorkbasketSummaryResource = new WorkbasketSummaryResource( const workbasketSummaryResource: WorkbasketSummaryResource = new WorkbasketSummaryResource(
new Array<WorkbasketSummary>( new Array<WorkbasketSummary>(
new WorkbasketSummary('1', 'key1', 'NAME1', 'description 1', 'owner 1', '', '', 'PERSONAL', '', '', '', ''), new WorkbasketSummary('1', 'key1', 'NAME1', 'description 1', 'owner 1', '', '', 'PERSONAL', '', '', '', ''),
new WorkbasketSummary('2', 'key2', 'NAME2', 'description 2', 'owner 2', '', '', 'GROUP', '', '', '', '')) new WorkbasketSummary('2', 'key2', 'NAME2', 'description 2', 'owner 2', '', '', 'GROUP', '', '', '', '')
, new LinksWorkbasketSummary({ 'href': 'url' })); ),
new LinksWorkbasketSummary({ href: 'url' })
);
describe('WorkbasketListComponent', () => { describe('WorkbasketListComponent', () => {
@ -99,7 +103,6 @@ describe('WorkbasketListComponent', () => {
fixture.detectChanges(); fixture.detectChanges();
done(); done();
}); });
}); });
afterEach(() => { afterEach(() => {
@ -116,11 +119,11 @@ describe('WorkbasketListComponent', () => {
expect(workbasketService.getWorkBasketsSummary).toHaveBeenCalled(); expect(workbasketService.getWorkBasketsSummary).toHaveBeenCalled();
workbasketService.getWorkBasketsSummary().subscribe(value => { workbasketService.getWorkBasketsSummary().subscribe(value => {
expect(value).toBe(workbasketSummaryResource); expect(value).toBe(workbasketSummaryResource);
}) });
}); });
it('should have wb-action-toolbar, wb-search-bar, wb-list-container, wb-pagination,' + it('should have wb-action-toolbar, wb-search-bar, wb-list-container, wb-pagination,'
' collapsedMenufilterWb and taskana-filter created in the html', () => { + ' collapsedMenufilterWb and taskana-filter created in the html', () => {
expect(debugElement.querySelector('#wb-action-toolbar')).toBeDefined(); expect(debugElement.querySelector('#wb-action-toolbar')).toBeDefined();
expect(debugElement.querySelector('#wb-search-bar')).toBeDefined(); expect(debugElement.querySelector('#wb-search-bar')).toBeDefined();
expect(debugElement.querySelector('#wb-pagination')).toBeDefined(); expect(debugElement.querySelector('#wb-pagination')).toBeDefined();
@ -156,19 +159,19 @@ describe('WorkbasketListComponent', () => {
expect(debugElement.querySelector('#sort-by-description')).toBeDefined(); expect(debugElement.querySelector('#sort-by-description')).toBeDefined();
expect(debugElement.querySelector('#sort-by-owner')).toBeDefined(); expect(debugElement.querySelector('#sort-by-owner')).toBeDefined();
expect(debugElement.querySelector('#sort-by-type')).toBeDefined(); expect(debugElement.querySelector('#sort-by-type')).toBeDefined();
}); });
it('should have performRequest with forced = true after performFilter is triggered', (() => { it('should have performRequest with forced = true after performFilter is triggered', (() => {
const filter = new FilterModel({ const filter = new FilterModel({
name: 'someName', owner: 'someOwner', description: 'someDescription', name: 'someName',
key: 'someKey', type: 'PERSONAL' owner: 'someOwner',
description: 'someDescription',
key: 'someKey',
type: 'PERSONAL'
}); });
component.performFilter(filter); component.performFilter(filter);
expect(workbasketSummarySpy.calls.all()[1].args).toEqual([true, 'key', 'asc', expect(workbasketSummarySpy.calls.all()[1].args).toEqual([true, 'key', 'asc',
'', 'someName', 'someDescription', '', 'someOwner', 'PERSONAL', '', 'someKey', '']); '', 'someName', 'someDescription', '', 'someOwner', 'PERSONAL', '', 'someKey', '']);
})); }));
}); });

View File

@ -1,16 +1,16 @@
import {Component, ElementRef, OnDestroy, OnInit, ViewChild} from '@angular/core'; import { Component, ElementRef, OnDestroy, OnInit, ViewChild } from '@angular/core';
import {ActivatedRoute, Router} from '@angular/router'; import { ActivatedRoute, Router } from '@angular/router';
import {Subscription} from 'rxjs'; import { Subscription } from 'rxjs';
import {WorkbasketSummaryResource} from 'app/models/workbasket-summary-resource'; import { WorkbasketSummaryResource } from 'app/models/workbasket-summary-resource';
import {WorkbasketSummary} from 'app/models/workbasket-summary'; import { WorkbasketSummary } from 'app/models/workbasket-summary';
import {FilterModel} from 'app/models/filter' import { FilterModel } from 'app/models/filter';
import {SortingModel} from 'app/models/sorting'; import { SortingModel } from 'app/models/sorting';
import {Orientation} from 'app/models/orientation'; import { Orientation } from 'app/models/orientation';
import {WorkbasketService} from 'app/shared/services/workbasket/workbasket.service' import { WorkbasketService } from 'app/shared/services/workbasket/workbasket.service';
import {OrientationService} from 'app/services/orientation/orientation.service'; import { OrientationService } from 'app/services/orientation/orientation.service';
import {TaskanaQueryParameters} from 'app/shared/util/query-parameters'; import { TaskanaQueryParameters } from 'app/shared/util/query-parameters';
import { ImportExportService } from 'app/administration/services/import-export/import-export.service'; import { ImportExportService } from 'app/administration/services/import-export/import-export.service';
@Component({ @Component({
@ -19,7 +19,6 @@ import { ImportExportService } from 'app/administration/services/import-export/i
styleUrls: ['./workbasket-list.component.scss'] styleUrls: ['./workbasket-list.component.scss']
}) })
export class WorkbasketListComponent implements OnInit, OnDestroy { export class WorkbasketListComponent implements OnInit, OnDestroy {
selectedId = ''; selectedId = '';
workbasketsResource: WorkbasketSummaryResource; workbasketsResource: WorkbasketSummaryResource;
workbaskets: Array<WorkbasketSummary> = []; workbaskets: Array<WorkbasketSummary> = [];
@ -31,10 +30,11 @@ export class WorkbasketListComponent implements OnInit, OnDestroy {
cards: number = this.pageSize; cards: number = this.pageSize;
sort: SortingModel = new SortingModel(); sort: SortingModel = new SortingModel();
filterBy: FilterModel = new FilterModel({name: '', owner: '', type: '', description: '', key: ''}); filterBy: FilterModel = new FilterModel({ name: '', owner: '', type: '', description: '', key: '' });
@ViewChild('wbToolbar', { static: true }) @ViewChild('wbToolbar', { static: true })
private toolbarElement: ElementRef; private toolbarElement: ElementRef;
private workBasketSummarySubscription: Subscription; private workBasketSummarySubscription: Subscription;
private workbasketServiceSubscription: Subscription; private workbasketServiceSubscription: Subscription;
private workbasketServiceSavedSubscription: Subscription; private workbasketServiceSavedSubscription: Subscription;
@ -46,7 +46,8 @@ export class WorkbasketListComponent implements OnInit, OnDestroy {
private router: Router, private router: Router,
private route: ActivatedRoute, private route: ActivatedRoute,
private orientationService: OrientationService, private orientationService: OrientationService,
private importExportService: ImportExportService) { private importExportService: ImportExportService
) {
} }
ngOnInit() { ngOnInit() {
@ -69,13 +70,12 @@ export class WorkbasketListComponent implements OnInit, OnDestroy {
}); });
this.importingExportingSubscription = this.importExportService.getImportingFinished().subscribe((value: Boolean) => { this.importingExportingSubscription = this.importExportService.getImportingFinished().subscribe((value: Boolean) => {
this.refreshWorkbasketList(); this.refreshWorkbasketList();
}) });
} }
selectWorkbasket(id: string) { selectWorkbasket(id: string) {
this.selectedId = id; this.selectedId = id;
this.router.navigate([{outlets: {detail: [this.selectedId]}}], {relativeTo: this.route}); this.router.navigate([{ outlets: { detail: [this.selectedId] } }], { relativeTo: this.route });
} }
performSorting(sort: SortingModel) { performSorting(sort: SortingModel) {
@ -95,7 +95,8 @@ export class WorkbasketListComponent implements OnInit, OnDestroy {
refreshWorkbasketList() { refreshWorkbasketList() {
this.cards = this.orientationService.calculateNumberItemsList( this.cards = this.orientationService.calculateNumberItemsList(
window.innerHeight, 72, 170 + this.toolbarElement.nativeElement.offsetHeight, false); window.innerHeight, 72, 170 + this.toolbarElement.nativeElement.offsetHeight, false
);
this.performRequest(); this.performRequest();
} }
@ -106,7 +107,8 @@ export class WorkbasketListComponent implements OnInit, OnDestroy {
this.workbasketServiceSubscription = this.workbasketService.getWorkBasketsSummary( this.workbasketServiceSubscription = this.workbasketService.getWorkBasketsSummary(
true, this.sort.sortBy, this.sort.sortDirection, '', true, this.sort.sortBy, this.sort.sortDirection, '',
this.filterBy.filterParams.name, this.filterBy.filterParams.description, '', this.filterBy.filterParams.owner, this.filterBy.filterParams.name, this.filterBy.filterParams.description, '', this.filterBy.filterParams.owner,
this.filterBy.filterParams.type, '', this.filterBy.filterParams.key, '') this.filterBy.filterParams.type, '', this.filterBy.filterParams.key, ''
)
.subscribe(resultList => { .subscribe(resultList => {
this.workbasketsResource = resultList; this.workbasketsResource = resultList;
this.workbaskets = resultList.workbaskets; this.workbaskets = resultList.workbaskets;

View File

@ -57,7 +57,7 @@ const appRoutes: Routes = [
@NgModule({ @NgModule({
imports: [ imports: [
RouterModule.forRoot( RouterModule.forRoot(
appRoutes, {useHash: true} appRoutes, { useHash: true }
) )
], ],
exports: [ exports: [

View File

@ -1,16 +1,16 @@
import { async, inject, TestBed } from '@angular/core/testing'; import { async, inject, TestBed } from '@angular/core/testing';
import { Router, Routes } from '@angular/router'; import { Router, Routes } from '@angular/router';
import { AppComponent } from './app.component';
import { AngularSvgIconModule } from 'angular-svg-icon'; import { AngularSvgIconModule } from 'angular-svg-icon';
import { RouterTestingModule } from '@angular/router/testing'; import { RouterTestingModule } from '@angular/router/testing';
import { HttpClientModule } from '@angular/common/http'; import { HttpClientModule } from '@angular/common/http';
import { SharedModule } from 'app/shared/shared.module'; import { SharedModule } from 'app/shared/shared.module';
import { AppComponent } from './app.component';
import { NavBarComponent } from './components/nav-bar/nav-bar.component'; import { NavBarComponent } from './components/nav-bar/nav-bar.component';
describe('AppComponent', () => { describe('AppComponent', () => {
let app; let fixture; let
let app, fixture, debugElement; debugElement;
const routes: Routes = [ const routes: Routes = [
{ path: 'classifications', component: AppComponent } { path: 'classifications', component: AppComponent }
@ -32,7 +32,6 @@ describe('AppComponent', () => {
fixture = TestBed.createComponent(AppComponent); fixture = TestBed.createComponent(AppComponent);
app = fixture.debugElement.componentInstance; app = fixture.debugElement.componentInstance;
debugElement = fixture.debugElement.nativeElement; debugElement = fixture.debugElement.nativeElement;
})); }));
afterEach(async(() => { afterEach(async(() => {
@ -50,11 +49,9 @@ describe('AppComponent', () => {
})); }));
it('should call Router.navigateByUrl("classifications") and workbasketRoute should be false', (inject([Router], (router: Router) => { it('should call Router.navigateByUrl("classifications") and workbasketRoute should be false', (inject([Router], (router: Router) => {
expect(app.workbasketsRoute).toBe(true); expect(app.workbasketsRoute).toBe(true);
fixture.detectChanges(); fixture.detectChanges();
router.navigateByUrl(`/classifications`); router.navigateByUrl('/classifications');
expect(app.workbasketsRoute).toBe(false); expect(app.workbasketsRoute).toBe(false);
}))); })));
}) });

View File

@ -2,13 +2,13 @@ import { Component, OnInit, HostListener, OnDestroy } from '@angular/core';
import { Router, NavigationStart } from '@angular/router'; import { Router, NavigationStart } from '@angular/router';
import { Subscription } from 'rxjs'; import { Subscription } from 'rxjs';
import { FormsValidatorService } from 'app/shared/services/forms/forms-validator.service';
import { MessageModal } from './models/message-modal'; import { MessageModal } from './models/message-modal';
import { GeneralModalService } from './services/general-modal/general-modal.service'; import { GeneralModalService } from './services/general-modal/general-modal.service';
import { RequestInProgressService } from './services/requestInProgress/request-in-progress.service'; import { RequestInProgressService } from './services/requestInProgress/request-in-progress.service';
import { OrientationService } from './services/orientation/orientation.service'; import { OrientationService } from './services/orientation/orientation.service';
import { SelectedRouteService } from './services/selected-route/selected-route'; import { SelectedRouteService } from './services/selected-route/selected-route';
import { FormsValidatorService } from 'app/shared/services/forms/forms-validator.service';
import { UploadService } from './shared/services/upload/upload.service'; import { UploadService } from './shared/services/upload/upload.service';
@Component({ @Component({
@ -17,7 +17,6 @@ import { UploadService } from './shared/services/upload/upload.service';
styleUrls: ['./app.component.scss'] styleUrls: ['./app.component.scss']
}) })
export class AppComponent implements OnInit, OnDestroy { export class AppComponent implements OnInit, OnDestroy {
workbasketsRoute = true; workbasketsRoute = true;
modalMessage = ''; modalMessage = '';
@ -46,7 +45,8 @@ export class AppComponent implements OnInit, OnDestroy {
private orientationService: OrientationService, private orientationService: OrientationService,
private selectedRouteService: SelectedRouteService, private selectedRouteService: SelectedRouteService,
private formsValidatorService: FormsValidatorService, private formsValidatorService: FormsValidatorService,
public uploadService: UploadService) { public uploadService: UploadService
) {
} }
ngOnInit() { ngOnInit() {
@ -55,35 +55,35 @@ export class AppComponent implements OnInit, OnDestroy {
this.selectedRouteService.selectRoute(event); this.selectedRouteService.selectRoute(event);
this.formsValidatorService.formSubmitAttempt = false; this.formsValidatorService.formSubmitAttempt = false;
} }
}) });
this.modalSubscription = this.generalModalService.getMessage().subscribe((messageModal: MessageModal) => { this.modalSubscription = this.generalModalService.getMessage().subscribe((messageModal: MessageModal) => {
if (typeof messageModal.message === 'string') { if (typeof messageModal.message === 'string') {
this.modalMessage = messageModal.message this.modalMessage = messageModal.message;
} else if (messageModal.message.error instanceof ProgressEvent) { } else if (messageModal.message.error instanceof ProgressEvent) {
this.modalMessage = messageModal.message.message; this.modalMessage = messageModal.message.message;
} else { } else {
this.modalMessage = messageModal.message.error ? this.modalMessage = messageModal.message.error
(messageModal.message.error.error + ' ' + messageModal.message.error.message) ? (`${messageModal.message.error.error} ${messageModal.message.error.message}`)
: messageModal.message.message; : messageModal.message.message;
} }
this.modalTitle = messageModal.title; this.modalTitle = messageModal.title;
this.modalType = messageModal.type; this.modalType = messageModal.type;
}) });
this.requestInProgressSubscription = this.requestInProgressService.getRequestInProgress().subscribe((value: boolean) => { this.requestInProgressSubscription = this.requestInProgressService.getRequestInProgress().subscribe((value: boolean) => {
this.requestInProgress = value; this.requestInProgress = value;
}) });
this.selectedRouteSubscription = this.selectedRouteService.getSelectedRoute().subscribe((value: string) => { this.selectedRouteSubscription = this.selectedRouteService.getSelectedRoute().subscribe((value: string) => {
if (value.indexOf('classifications') !== -1) { if (value.indexOf('classifications') !== -1) {
this.workbasketsRoute = false; this.workbasketsRoute = false;
} }
this.selectedRoute = value; this.selectedRoute = value;
}) });
this.uploadingFileSubscription = this.uploadService.getCurrentProgressValue().subscribe(value => { this.uploadingFileSubscription = this.uploadService.getCurrentProgressValue().subscribe(value => {
this.currentProgressValue = value; this.currentProgressValue = value;
}) });
} }
ngOnDestroy() { ngOnDestroy() {

View File

@ -6,7 +6,6 @@ import { BrowserModule } from '@angular/platform-browser';
import { NgModule, APP_INITIALIZER } from '@angular/core'; import { NgModule, APP_INITIALIZER } from '@angular/core';
import { FormsModule, ReactiveFormsModule } from '@angular/forms'; import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { HttpClientModule } from '@angular/common/http'; import { HttpClientModule } from '@angular/common/http';
import { AppRoutingModule } from './app-routing.module';
import { AlertModule } from 'ngx-bootstrap'; import { AlertModule } from 'ngx-bootstrap';
import { AngularSvgIconModule } from 'angular-svg-icon'; import { AngularSvgIconModule } from 'angular-svg-icon';
import { TabsModule } from 'ngx-bootstrap/tabs'; import { TabsModule } from 'ngx-bootstrap/tabs';
@ -31,6 +30,9 @@ import { TitlesService } from 'app/services/titles/titles.service';
import { CustomFieldsService } from 'app/services/custom-fields/custom-fields.service'; import { CustomFieldsService } from 'app/services/custom-fields/custom-fields.service';
import { WindowRefService } from 'app/services/window/window.service'; import { WindowRefService } from 'app/services/window/window.service';
import { TaskanaEngineService } from 'app/services/taskana-engine/taskana-engine.service'; import { TaskanaEngineService } from 'app/services/taskana-engine/taskana-engine.service';
import { NavBarComponent } from 'app/components/nav-bar/nav-bar.component';
import { UserInformationComponent } from 'app/components/user-information/user-information.component';
import { NoAccessComponent } from 'app/components/no-access/no-access.component';
import { RemoveConfirmationService } from './services/remove-confirmation/remove-confirmation.service'; import { RemoveConfirmationService } from './services/remove-confirmation/remove-confirmation.service';
import { FormsValidatorService } from './shared/services/forms/forms-validator.service'; import { FormsValidatorService } from './shared/services/forms/forms-validator.service';
import { UploadService } from './shared/services/upload/upload.service'; import { UploadService } from './shared/services/upload/upload.service';
@ -39,9 +41,7 @@ import { UploadService } from './shared/services/upload/upload.service';
* Components * Components
*/ */
import { AppComponent } from './app.component'; import { AppComponent } from './app.component';
import { NavBarComponent } from 'app/components/nav-bar/nav-bar.component'; import { AppRoutingModule } from './app-routing.module';
import { UserInformationComponent } from 'app/components/user-information/user-information.component';
import { NoAccessComponent } from 'app/components/no-access/no-access.component';
/** /**
* Guards * Guards
@ -74,9 +74,7 @@ const DECLARATIONS = [
]; ];
export function startupServiceFactory(startupService: StartupService): () => Promise<any> { export function startupServiceFactory(startupService: StartupService): () => Promise<any> {
return (): Promise<any> => { return (): Promise<any> => startupService.load();
return startupService.load()
};
} }

View File

@ -1,31 +1,27 @@
import { import { getTestBed,
getTestBed, TestBed } from '@angular/core/testing';
TestBed,
} from '@angular/core/testing';
import { import { BrowserDynamicTestingModule,
BrowserDynamicTestingModule, platformBrowserDynamicTesting } from '@angular/platform-browser-dynamic/testing';
platformBrowserDynamicTesting,
} from '@angular/platform-browser-dynamic/testing';
import { CustomFieldsService } from 'app/services/custom-fields/custom-fields.service';
import { RemoveConfirmationService } from 'app/services/remove-confirmation/remove-confirmation.service';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { HttpClientModule } from '@angular/common/http';
import { AngularSvgIconModule } from 'angular-svg-icon';
import { TaskanaEngineServiceMock } from './services/taskana-engine/taskana-engine.mock.service'; import { TaskanaEngineServiceMock } from './services/taskana-engine/taskana-engine.mock.service';
import { TaskanaEngineService } from './services/taskana-engine/taskana-engine.service'; import { TaskanaEngineService } from './services/taskana-engine/taskana-engine.service';
import { DomainService } from './services/domain/domain.service'; import { DomainService } from './services/domain/domain.service';
import { DomainServiceMock } from './services/domain/domain.service.mock'; import { DomainServiceMock } from './services/domain/domain.service.mock';
import { CustomFieldsService } from 'app/services/custom-fields/custom-fields.service';
import { RemoveConfirmationService } from 'app/services/remove-confirmation/remove-confirmation.service';
import { AlertService } from './services/alert/alert.service'; import { AlertService } from './services/alert/alert.service';
import { GeneralModalService } from './services/general-modal/general-modal.service'; import { GeneralModalService } from './services/general-modal/general-modal.service';
import { RequestInProgressService } from './services/requestInProgress/request-in-progress.service'; import { RequestInProgressService } from './services/requestInProgress/request-in-progress.service';
import { OrientationService } from './services/orientation/orientation.service'; import { OrientationService } from './services/orientation/orientation.service';
import { SelectedRouteService } from './services/selected-route/selected-route'; import { SelectedRouteService } from './services/selected-route/selected-route';
import { FormsValidatorService } from './shared/services/forms/forms-validator.service'; import { FormsValidatorService } from './shared/services/forms/forms-validator.service';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { SharedModule } from './shared/shared.module'; import { SharedModule } from './shared/shared.module';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { HttpClientModule } from '@angular/common/http';
import { AngularSvgIconModule } from 'angular-svg-icon';
export const configureTests = (configure: (testBed: TestBed) => void) => { export const configureTests = (configure: (testBed: TestBed) => void) => {
const testBed = getTestBed(); const testBed = getTestBed();
@ -33,7 +29,8 @@ export const configureTests = (configure: (testBed: TestBed) => void) => {
if (testBed.platform == null) { if (testBed.platform == null) {
testBed.initTestEnvironment( testBed.initTestEnvironment(
BrowserDynamicTestingModule, BrowserDynamicTestingModule,
platformBrowserDynamicTesting()); platformBrowserDynamicTesting()
);
} }
configure(testBed); configure(testBed);

View File

@ -5,7 +5,6 @@ import { AngularSvgIconModule } from 'angular-svg-icon';
import { HttpClientModule } from '@angular/common/http'; import { HttpClientModule } from '@angular/common/http';
import { SharedModule } from 'app/shared/shared.module'; import { SharedModule } from 'app/shared/shared.module';
import { NavBarComponent } from './nav-bar.component';
import { UserInformationComponent } from 'app/components/user-information/user-information.component'; import { UserInformationComponent } from 'app/components/user-information/user-information.component';
import { SelectedRouteService } from 'app/services/selected-route/selected-route'; import { SelectedRouteService } from 'app/services/selected-route/selected-route';
@ -16,11 +15,13 @@ import { GeneralModalService } from 'app/services/general-modal/general-modal.se
import { RequestInProgressService } from 'app/services/requestInProgress/request-in-progress.service'; import { RequestInProgressService } from 'app/services/requestInProgress/request-in-progress.service';
import { configureTests } from 'app/app.test.configuration'; import { configureTests } from 'app/app.test.configuration';
import { NavBarComponent } from './nav-bar.component';
describe('NavBarComponent', () => { describe('NavBarComponent', () => {
let component: NavBarComponent; let component: NavBarComponent;
let fixture: ComponentFixture<NavBarComponent>; let fixture: ComponentFixture<NavBarComponent>;
let debugElement, navBar; let debugElement; let
navBar;
const routes: Routes = [ const routes: Routes = [
{ path: 'classifications', component: NavBarComponent } { path: 'classifications', component: NavBarComponent }
@ -43,7 +44,7 @@ describe('NavBarComponent', () => {
WindowRefService, WindowRefService,
GeneralModalService, GeneralModalService,
RequestInProgressService] RequestInProgressService]
}) });
}; };
configureTests(configure).then(testBed => { configureTests(configure).then(testBed => {
fixture = TestBed.createComponent(NavBarComponent); fixture = TestBed.createComponent(NavBarComponent);
@ -53,11 +54,10 @@ describe('NavBarComponent', () => {
fixture.detectChanges(); fixture.detectChanges();
done(); done();
}); });
}); });
afterEach(() => { afterEach(() => {
fixture.detectChanges() fixture.detectChanges();
document.body.removeChild(debugElement); document.body.removeChild(debugElement);
}); });
@ -65,8 +65,7 @@ describe('NavBarComponent', () => {
expect(component).toBeTruthy(); expect(component).toBeTruthy();
}); });
it(`should have as title ''`, (() => { it('should have as title \'\'', (() => {
expect(navBar.title).toEqual(''); expect(navBar.title).toEqual('');
})); }));
}); });

View File

@ -7,8 +7,8 @@ import { BusinessAdminGuard } from 'app/guards/business-admin.guard';
import { MonitorGuard } from 'app/guards/monitor.guard'; import { MonitorGuard } from 'app/guards/monitor.guard';
import { WindowRefService } from 'app/services/window/window.service'; import { WindowRefService } from 'app/services/window/window.service';
import { UserGuard } from 'app/guards/user.guard'; import { UserGuard } from 'app/guards/user.guard';
import { TaskanaEngineService } from '../../services/taskana-engine/taskana-engine.service';
import { expandRight } from 'app/shared/animations/expand.animation'; import { expandRight } from 'app/shared/animations/expand.animation';
import { TaskanaEngineService } from '../../services/taskana-engine/taskana-engine.service';
@Component({ @Component({
selector: 'taskana-nav-bar', selector: 'taskana-nav-bar',
templateUrl: './nav-bar.component.html', templateUrl: './nav-bar.component.html',
@ -16,7 +16,6 @@ import { expandRight } from 'app/shared/animations/expand.animation';
animations: [expandRight], animations: [expandRight],
}) })
export class NavBarComponent implements OnInit, OnDestroy { export class NavBarComponent implements OnInit, OnDestroy {
selectedRoute = ''; selectedRoute = '';
route: string; route: string;
title = ''; title = '';
@ -50,7 +49,8 @@ export class NavBarComponent implements OnInit, OnDestroy {
private selectedRouteService: SelectedRouteService, private selectedRouteService: SelectedRouteService,
private domainService: DomainService, private domainService: DomainService,
private taskanaEngineService: TaskanaEngineService, private taskanaEngineService: TaskanaEngineService,
private window: WindowRefService) { } private window: WindowRefService
) { }
ngOnInit() { ngOnInit() {
this.selectedRouteSubscription = this.selectedRouteService.getSelectedRoute().subscribe((value: string) => { this.selectedRouteSubscription = this.selectedRouteService.getSelectedRoute().subscribe((value: string) => {
@ -75,8 +75,7 @@ export class NavBarComponent implements OnInit, OnDestroy {
this.taskanaEngineService.isHistoryProviderEnabled().subscribe(value => { this.taskanaEngineService.isHistoryProviderEnabled().subscribe(value => {
this.historyAccess = value; this.historyAccess = value;
}) });
} }
switchDomain(domain) { switchDomain(domain) {
@ -90,14 +89,14 @@ export class NavBarComponent implements OnInit, OnDestroy {
logout() { logout() {
this.taskanaEngineService.logout().subscribe(() => { this.taskanaEngineService.logout().subscribe(() => {
}) });
this.window.nativeWindow.location.href = environment.taskanaLogoutUrl; this.window.nativeWindow.location.href = environment.taskanaLogoutUrl;
} }
showDomainSelector(): boolean { showDomainSelector(): boolean {
return this.selectedRoute.indexOf('administration') !== -1 return this.selectedRoute.indexOf('administration') !== -1
|| this.selectedRoute.indexOf('workbaskets') !== -1 || this.selectedRoute.indexOf('workbaskets') !== -1
|| this.selectedRoute.indexOf('classifications') !== -1 || this.selectedRoute.indexOf('classifications') !== -1;
} }
private setTitle(value: string = 'workbaskets') { private setTitle(value: string = 'workbaskets') {

View File

@ -1,10 +1,10 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { NoAccessComponent } from './no-access.component';
import { RouterTestingModule } from '@angular/router/testing'; import { RouterTestingModule } from '@angular/router/testing';
import { AngularSvgIconModule } from 'angular-svg-icon'; import { AngularSvgIconModule } from 'angular-svg-icon';
import { HttpClientModule } from '@angular/common/http'; import { HttpClientModule } from '@angular/common/http';
import { configureTests } from 'app/app.test.configuration'; import { configureTests } from 'app/app.test.configuration';
import { NoAccessComponent } from './no-access.component';
describe('NoAccessComponent', () => { describe('NoAccessComponent', () => {
let component: NoAccessComponent; let component: NoAccessComponent;
@ -17,7 +17,7 @@ describe('NoAccessComponent', () => {
testBed.configureTestingModule({ testBed.configureTestingModule({
imports: [RouterTestingModule, AngularSvgIconModule, HttpClientModule], imports: [RouterTestingModule, AngularSvgIconModule, HttpClientModule],
declarations: [NoAccessComponent] declarations: [NoAccessComponent]
}) });
}; };
configureTests(configure).then(testBed => { configureTests(configure).then(testBed => {
fixture = TestBed.createComponent(NoAccessComponent); fixture = TestBed.createComponent(NoAccessComponent);
@ -25,7 +25,6 @@ describe('NoAccessComponent', () => {
debugElement = fixture.debugElement.nativeElement; debugElement = fixture.debugElement.nativeElement;
done(); done();
}); });
}); });
afterEach(() => { afterEach(() => {

View File

@ -1,9 +1,9 @@
import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from '@angular/core';
import { TaskanaEngineService } from '../../services/taskana-engine/taskana-engine.service';
import { BusinessAdminGuard } from 'app/guards/business-admin.guard'; import { BusinessAdminGuard } from 'app/guards/business-admin.guard';
import { MonitorGuard } from 'app/guards/monitor.guard'; import { MonitorGuard } from 'app/guards/monitor.guard';
import { UserGuard } from 'app/guards/user.guard'; import { UserGuard } from 'app/guards/user.guard';
import { Router } from '@angular/router'; import { Router } from '@angular/router';
import { TaskanaEngineService } from '../../services/taskana-engine/taskana-engine.service';
@Component({ @Component({
selector: 'taskana-no-access', selector: 'taskana-no-access',
@ -11,7 +11,6 @@ import { Router } from '@angular/router';
styleUrls: ['./no-access.component.scss'] styleUrls: ['./no-access.component.scss']
}) })
export class NoAccessComponent implements OnInit { export class NoAccessComponent implements OnInit {
showNoAccess = false; showNoAccess = false;
constructor(private taskanaEngineService: TaskanaEngineService, public router: Router) { } constructor(private taskanaEngineService: TaskanaEngineService, public router: Router) { }

View File

@ -2,9 +2,9 @@ import { ComponentFixture, TestBed } from '@angular/core/testing';
import { AngularSvgIconModule } from 'angular-svg-icon'; import { AngularSvgIconModule } from 'angular-svg-icon';
import { HttpClientModule } from '@angular/common/http'; import { HttpClientModule } from '@angular/common/http';
import { configureTests } from 'app/app.test.configuration';
import { UserInformationComponent } from './user-information.component'; import { UserInformationComponent } from './user-information.component';
import { configureTests } from 'app/app.test.configuration';
describe('UserInformationComponent', () => { describe('UserInformationComponent', () => {
let component: UserInformationComponent; let component: UserInformationComponent;
@ -18,7 +18,7 @@ describe('UserInformationComponent', () => {
imports: [AngularSvgIconModule, imports: [AngularSvgIconModule,
HttpClientModule], HttpClientModule],
declarations: [UserInformationComponent], declarations: [UserInformationComponent],
}) });
}; };
configureTests(configure).then(testBed => { configureTests(configure).then(testBed => {
fixture = TestBed.createComponent(UserInformationComponent); fixture = TestBed.createComponent(UserInformationComponent);
@ -27,7 +27,6 @@ describe('UserInformationComponent', () => {
fixture.detectChanges(); fixture.detectChanges();
done(); done();
}); });
}); });
afterEach(() => { afterEach(() => {

View File

@ -10,7 +10,6 @@ import { expandDown } from '../../shared/animations/expand.animation';
animations: [expandDown], animations: [expandDown],
}) })
export class UserInformationComponent implements OnInit { export class UserInformationComponent implements OnInit {
userInformation: UserInfoModel; userInformation: UserInfoModel;
roles = ''; roles = '';
showRoles = false; showRoles = false;
@ -19,7 +18,7 @@ export class UserInformationComponent implements OnInit {
ngOnInit() { ngOnInit() {
this.userInformation = this.taskanaEngineService.currentUserInfo; this.userInformation = this.taskanaEngineService.currentUserInfo;
if (this.userInformation) { if (this.userInformation) {
this.roles = '[' + this.userInformation.roles.join(',') + ']'; this.roles = `[${this.userInformation.roles.join(',')}]`;
} }
} }

View File

@ -18,6 +18,6 @@ export class BusinessAdminGuard implements CanActivate {
navigateToWorkplace(): boolean { navigateToWorkplace(): boolean {
this.router.navigate(['workplace']); this.router.navigate(['workplace']);
return false return false;
} }
} }

View File

@ -12,13 +12,12 @@ export class DomainGuard implements CanActivate {
canActivate() { canActivate() {
return this.domainService.getDomains().pipe( return this.domainService.getDomains().pipe(
map(domain => { map(domain => true),
return true;
}),
catchError(() => { catchError(() => {
this.generalModalService.triggerMessage(new MessageModal( this.generalModalService.triggerMessage(new MessageModal(
'There was an error, please contact with your administrator', 'There was an error getting Domains')); 'There was an error, please contact with your administrator', 'There was an error getting Domains'
return of(false) ));
return of(false);
}) })
); );
} }

View File

@ -13,11 +13,13 @@ export class HistoryGuard implements CanActivate {
constructor( constructor(
private taskanaEngineService: TaskanaEngineService, private taskanaEngineService: TaskanaEngineService,
public router: Router, public router: Router,
public generalModalService: GeneralModalService) { } public generalModalService: GeneralModalService
) { }
canActivate( canActivate(
next: ActivatedRouteSnapshot, next: ActivatedRouteSnapshot,
state: RouterStateSnapshot): Observable<boolean> | Promise<boolean> | boolean { state: RouterStateSnapshot
): Observable<boolean> | Promise<boolean> | boolean {
return this.taskanaEngineService.isHistoryProviderEnabled().pipe( return this.taskanaEngineService.isHistoryProviderEnabled().pipe(
map(value => { map(value => {
if (value) { if (value) {
@ -27,7 +29,8 @@ export class HistoryGuard implements CanActivate {
}), }),
catchError(() => { catchError(() => {
this.generalModalService.triggerMessage(new MessageModal( this.generalModalService.triggerMessage(new MessageModal(
'There was an error, please contact with your administrator', 'There was an error getting history provider')); 'There was an error, please contact with your administrator', 'There was an error getting history provider'
));
return of(this.navigateToWorkplace()); return of(this.navigateToWorkplace());
}) })
); );

View File

@ -2,9 +2,9 @@ import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common'; import { CommonModule } from '@angular/common';
import { FormsModule, ReactiveFormsModule } from '@angular/forms'; import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { SharedModule } from 'app/shared/shared.module';
import { HistoryRoutingModule } from './history-routing.module'; import { HistoryRoutingModule } from './history-routing.module';
import { TaskQueryComponent } from './task-query/task-query.component'; import { TaskQueryComponent } from './task-query/task-query.component';
import { SharedModule } from 'app/shared/shared.module';
@NgModule({ @NgModule({
imports: [ imports: [

View File

@ -22,7 +22,6 @@ export class TaskQueryService {
searchForValues: TaskHistoryEventData, searchForValues: TaskHistoryEventData,
allPages: boolean = false allPages: boolean = false
): Observable<TaskHistoryEventResourceData> { ): Observable<TaskHistoryEventResourceData> {
return this.httpClient.get<TaskHistoryEventResourceData>(`${this.url}/v1/task-history-event${this.getQueryParameters( return this.httpClient.get<TaskHistoryEventResourceData>(`${this.url}/v1/task-history-event${this.getQueryParameters(
orderBy, orderBy,
sortDirection, sortDirection,
@ -48,7 +47,6 @@ export class TaskQueryService {
searchForValues.created, searchForValues.created,
allPages allPages
)}`); )}`);
} }
private getQueryParameters( private getQueryParameters(
@ -74,10 +72,10 @@ export class TaskQueryService {
custom3: string, custom3: string,
custom4: string, custom4: string,
created: string, created: string,
allPages: boolean = false): string { allPages: boolean = false
): string {
const parameters = new QueryParametersModel(); const parameters = new QueryParametersModel();
parameters.SORTBY = orderBy parameters.SORTBY = orderBy;
parameters.SORTDIRECTION = sortDirection; parameters.SORTDIRECTION = sortDirection;
parameters.TASK_ID_LIKE = taskId; parameters.TASK_ID_LIKE = taskId;
parameters.PARENT_BUSINESS_PROCESS_ID_LIKE = parentBPI; parameters.PARENT_BUSINESS_PROCESS_ID_LIKE = parentBPI;
@ -105,5 +103,3 @@ export class TaskQueryService {
return TaskanaQueryParameters.getQueryParameters(parameters); return TaskanaQueryParameters.getQueryParameters(parameters);
} }
} }

View File

@ -8,7 +8,7 @@ describe('TaskQueryComponent', () => {
beforeEach(async(() => { beforeEach(async(() => {
TestBed.configureTestingModule({ TestBed.configureTestingModule({
declarations: [ TaskQueryComponent ] declarations: [TaskQueryComponent]
}) })
.compileComponents(); .compileComponents();
})); }));

View File

@ -1,6 +1,4 @@
import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from '@angular/core';
import { TaskQueryService } from '../services/task-query/task-query.service';
import { TaskHistoryEventData } from '../../models/task-history-event';
import { SortingModel, Direction } from 'app/models/sorting'; import { SortingModel, Direction } from 'app/models/sorting';
import { OrientationService } from 'app/services/orientation/orientation.service'; import { OrientationService } from 'app/services/orientation/orientation.service';
import { Subscription } from 'rxjs'; import { Subscription } from 'rxjs';
@ -11,6 +9,8 @@ import { MessageModal } from 'app/models/message-modal';
import { FormGroup, FormControl } from '@angular/forms'; import { FormGroup, FormControl } from '@angular/forms';
import { TaskHistoryEventResourceData } from 'app/models/task-history-event-resource'; import { TaskHistoryEventResourceData } from 'app/models/task-history-event-resource';
import { RequestInProgressService } from 'app/services/requestInProgress/request-in-progress.service'; import { RequestInProgressService } from 'app/services/requestInProgress/request-in-progress.service';
import { TaskHistoryEventData } from '../../models/task-history-event';
import { TaskQueryService } from '../services/task-query/task-query.service';
@Component({ @Component({
selector: 'taskana-task-query', selector: 'taskana-task-query',
@ -18,9 +18,8 @@ import { RequestInProgressService } from 'app/services/requestInProgress/request
styleUrls: ['./task-query.component.scss'] styleUrls: ['./task-query.component.scss']
}) })
export class TaskQueryComponent implements OnInit { export class TaskQueryComponent implements OnInit {
taskQueryResource: TaskHistoryEventResourceData; taskQueryResource: TaskHistoryEventResourceData;
taskQuery: Array<TaskHistoryEventData> taskQuery: Array<TaskHistoryEventData>;
taskQueryHeader = new TaskHistoryEventData(); taskQueryHeader = new TaskHistoryEventData();
orderBy = new SortingModel(TaskanaQueryParameters.parameters.CREATED); orderBy = new SortingModel(TaskanaQueryParameters.parameters.CREATED);
orientationSubscription: Subscription; orientationSubscription: Subscription;
@ -33,7 +32,8 @@ export class TaskQueryComponent implements OnInit {
private taskQueryService: TaskQueryService, private taskQueryService: TaskQueryService,
private orientationService: OrientationService, private orientationService: OrientationService,
private generalModalService: GeneralModalService, private generalModalService: GeneralModalService,
private requestInProgressService: RequestInProgressService, ) { } private requestInProgressService: RequestInProgressService
) { }
ngOnInit() { ngOnInit() {
this.orientationSubscription = this.orientationService.getOrientation().subscribe((orientation: Orientation) => { this.orientationSubscription = this.orientationService.getOrientation().subscribe((orientation: Orientation) => {
@ -101,7 +101,7 @@ export class TaskQueryComponent implements OnInit {
} }
isDate(fieldName: string): boolean { isDate(fieldName: string): boolean {
return (fieldName === 'created') return (fieldName === 'created');
} }
filterFieldsToAllowQuerying(fieldName: string): boolean { filterFieldsToAllowQuerying(fieldName: string): boolean {
@ -150,7 +150,7 @@ export class TaskQueryComponent implements OnInit {
val, val,
'code' 'code'
) )
) );
} }
getTaskValue(key: string, task: TaskHistoryEventData): string { getTaskValue(key: string, task: TaskHistoryEventData): string {
@ -171,17 +171,18 @@ export class TaskQueryComponent implements OnInit {
if (sortDirection === Direction.ASC) { if (sortDirection === Direction.ASC) {
return Direction.DESC; return Direction.DESC;
} }
return Direction.ASC return Direction.ASC;
} }
private performRequest() { private performRequest() {
this.requestInProgressService.setRequestInProgress(true); this.requestInProgressService.setRequestInProgress(true);
this.calculateQueryPages(); this.calculateQueryPages();
this.taskQuerySubscription = this.taskQueryService.queryTask( this.taskQuerySubscription = this.taskQueryService.queryTask(
this.orderBy.sortBy.replace(/([A-Z])|([0-9])/g, (g) => `-${g[0].toLowerCase()}`), this.orderBy.sortBy.replace(/([A-Z])|([0-9])/g, g => `-${g[0].toLowerCase()}`),
this.orderBy.sortDirection, this.orderBy.sortDirection,
new TaskHistoryEventData(this.taskQueryForm.value), new TaskHistoryEventData(this.taskQueryForm.value),
false).subscribe(taskQueryResource => { false
).subscribe(taskQueryResource => {
this.requestInProgressService.setRequestInProgress(false); this.requestInProgressService.setRequestInProgress(false);
if (!taskQueryResource.taskHistoryEvents) { if (!taskQueryResource.taskHistoryEvents) {
this.taskQuery = null; this.taskQuery = null;
@ -190,18 +191,17 @@ export class TaskQueryComponent implements OnInit {
} }
this.taskQueryResource = taskQueryResource; this.taskQueryResource = taskQueryResource;
this.taskQuery = taskQueryResource.taskHistoryEvents; this.taskQuery = taskQueryResource.taskHistoryEvents;
}) });
} }
private initTaskQueryForm() { private initTaskQueryForm() {
const me = this; const me = this;
Object.keys(new TaskHistoryEventData()).forEach(function (key) { Object.keys(new TaskHistoryEventData()).forEach(key => {
me.taskQueryForm.addControl(key, new FormControl()); me.taskQueryForm.addControl(key, new FormControl());
}); });
} }
private calculateQueryPages() { private calculateQueryPages() {
const rowHeight = 34; const rowHeight = 34;
const unusedHeight = 300; const unusedHeight = 300;
const totalHeight = window.innerHeight; const totalHeight = window.innerHeight;
@ -219,5 +219,4 @@ export class TaskQueryComponent implements OnInit {
if (this.orientationSubscription) { this.orientationSubscription.unsubscribe(); } if (this.orientationSubscription) { this.orientationSubscription.unsubscribe(); }
if (this.taskQuerySubscription) { this.taskQuerySubscription.unsubscribe(); } if (this.taskQuerySubscription) { this.taskQuerySubscription.unsubscribe(); }
} }
} }

View File

@ -3,6 +3,7 @@ import { LinksClassification } from 'app/models/links-classfication';
export class AccessIdDefinition { export class AccessIdDefinition {
constructor( constructor(
public accessId?: string, public accessId?: string,
public name?: string) { public name?: string
) {
} }
} }

View File

@ -6,7 +6,6 @@ export enum AlertType {
} }
export class AlertModel { export class AlertModel {
constructor(public type: string = AlertType.SUCCESS, constructor(public type: string = AlertType.SUCCESS,
public text: string = 'Success', public text: string = 'Success',
public autoClosing: boolean = true, public autoClosing: boolean = true,

View File

@ -1,4 +1,4 @@
import {Links} from 'app/models/links'; import { Links } from 'app/models/links';
export class Classification { export class Classification {
constructor(public classificationId?: string, // newly created classifications don't have an id yet. constructor(public classificationId?: string, // newly created classifications don't have an id yet.
@ -10,6 +10,6 @@ export class Classification {
public parentId?: string, public parentId?: string,
public priority?: number, public priority?: number,
public serviceLevel?: string, public serviceLevel?: string,
public _links?: Links ) { public _links?: Links) {
} }
} }

View File

@ -1,8 +1,8 @@
export class CustomField { export class CustomField {
constructor( constructor(
public visible: boolean, public visible: boolean,
public field: string) { public field: string
) {
} }
} }

View File

@ -8,5 +8,5 @@ export class LinksClassification extends Links {
public getAllClassifications?: { 'href': string }, public getAllClassifications?: { 'href': string },
public createClassification?: { 'href': string }, public createClassification?: { 'href': string },
public updateClassification?: { 'href': string }, public updateClassification?: { 'href': string },
) { super(self, distributionTargets, accessItems) } ) { super(self, distributionTargets, accessItems); }
} }

View File

@ -6,5 +6,5 @@ export class LinksWorkbasketSummary extends Links {
distributionTargets?, distributionTargets?,
accessItems?, accessItems?,
public allWorkbaskets?: { 'href': string } public allWorkbaskets?: { 'href': string }
) { super(self, distributionTargets, accessItems) } ) { super(self, distributionTargets, accessItems); }
} }

View File

@ -1,7 +1,7 @@
export enum Direction { export enum Direction {
ASC = 'asc', ASC = 'asc',
DESC = 'desc' DESC = 'desc'
}; }
export class SortingModel { export class SortingModel {

View File

@ -2,6 +2,6 @@ import { Links } from './links';
import { TaskHistoryEventData } from './task-history-event'; import { TaskHistoryEventData } from './task-history-event';
export class TaskHistoryEventResourceData { export class TaskHistoryEventResourceData {
public taskHistoryEvents: Array<TaskHistoryEventData> public taskHistoryEvents: Array<TaskHistoryEventData>;
public _links: Links = new Links() public _links: Links = new Links();
} }

View File

@ -1,5 +1,4 @@
export enum ICONTYPES { export enum ICONTYPES {
ALL = 'ALL', ALL = 'ALL',
PERSONAL = 'PERSONAL', PERSONAL = 'PERSONAL',

View File

@ -3,6 +3,6 @@ export class UserInfoModel {
constructor( constructor(
public userId: string = '', public userId: string = '',
public groupIds: Array<string> = [], public groupIds: Array<string> = [],
public roles: Array<string> = []) { }; public roles: Array<string> = []
) { }
} }

View File

@ -2,5 +2,5 @@
export class VersionModel { export class VersionModel {
constructor( constructor(
public version: string = '' public version: string = ''
) { }; ) { }
} }

View File

@ -1,5 +1,5 @@
import {WorkbasketAccessItems} from './workbasket-access-items'; import { WorkbasketAccessItems } from './workbasket-access-items';
import {Workbasket} from './workbasket'; import { Workbasket } from './workbasket';
export class WorkbasketDefinition { export class WorkbasketDefinition {
constructor(distributionTargets: string[], constructor(distributionTargets: string[],

View File

@ -4,6 +4,7 @@ import { Links } from './links';
export class WorkbasketDistributionTargetsResource { export class WorkbasketDistributionTargetsResource {
constructor( constructor(
public distributionTargets: Array<WorkbasketSummary> = [], public distributionTargets: Array<WorkbasketSummary> = [],
public _links: Links = null) { public _links: Links = null
) {
} }
} }

View File

@ -4,5 +4,6 @@ import { Workbasket } from './workbasket';
export class WorkbasketResource { export class WorkbasketResource {
constructor( constructor(
public workbaskets: Array<Workbasket> = [], public workbaskets: Array<Workbasket> = [],
public _links: Links = new Links() ) { } public _links: Links = new Links()
) { }
} }

View File

@ -1,5 +1,5 @@
import { WorkbasketSummary } from './workbasket-summary';
import { Page } from 'app/models/page'; import { Page } from 'app/models/page';
import { WorkbasketSummary } from './workbasket-summary';
import { LinksWorkbasketSummary } from './links-workbasket-summary'; import { LinksWorkbasketSummary } from './links-workbasket-summary';
export class WorkbasketSummaryResource { export class WorkbasketSummaryResource {

View File

@ -18,6 +18,7 @@ export class WorkbasketSummary {
public orgLevel4?: string, public orgLevel4?: string,
public markedForDeletion: boolean = false, public markedForDeletion: boolean = false,
public _links?: Links, public _links?: Links,
public page?: Page ) { public page?: Page
) {
} }
} }

View File

@ -1,7 +1,7 @@
import { Links } from './links'; import { Links } from './links';
import { ICONTYPES } from './type'; import { ICONTYPES } from './type';
export class Workbasket {
export class Workbasket {
public static equals(org: Workbasket, comp: Workbasket): boolean { public static equals(org: Workbasket, comp: Workbasket): boolean {
if (org.workbasketId !== comp.workbasketId) { return false; } if (org.workbasketId !== comp.workbasketId) { return false; }
if (org.created !== comp.created) { return false; } if (org.created !== comp.created) { return false; }
@ -42,6 +42,7 @@ export class Workbasket {
public orgLevel2?: string, public orgLevel2?: string,
public orgLevel3?: string, public orgLevel3?: string,
public orgLevel4?: string, public orgLevel4?: string,
public _links: Links = new Links()) { public _links: Links = new Links()
) {
} }
} }

View File

@ -8,7 +8,7 @@ describe('ClassificationTasksComponent', () => {
beforeEach(async(() => { beforeEach(async(() => {
TestBed.configureTestingModule({ TestBed.configureTestingModule({
declarations: [ ClassificationTasksComponent ] declarations: [ClassificationTasksComponent]
}) })
.compileComponents(); .compileComponents();
})); }));

View File

@ -1,9 +1,9 @@
import {Component, OnInit} from '@angular/core'; import { Component, OnInit } from '@angular/core';
import {RestConnectorService} from 'app/monitor/services/restConnector/rest-connector.service'; import { RestConnectorService } from 'app/monitor/services/restConnector/rest-connector.service';
import {ReportData} from '../models/report-data'; import { ChartData } from 'app/monitor/models/chart-data';
import {ChartData} from 'app/monitor/models/chart-data'; import { ReportData } from '../models/report-data';
import {ChartColorsDefinition} from '../models/chart-colors'; import { ChartColorsDefinition } from '../models/chart-colors';
import {RequestInProgressService} from '../../services/requestInProgress/request-in-progress.service'; import { RequestInProgressService } from '../../services/requestInProgress/request-in-progress.service';
@Component({ @Component({
selector: 'taskana-monitor-classification-tasks', selector: 'taskana-monitor-classification-tasks',
@ -21,16 +21,18 @@ export class ClassificationTasksComponent implements OnInit {
lineChartOptions: any = { lineChartOptions: any = {
responsive: true responsive: true
}; };
lineChartColors = ChartColorsDefinition.getColors(); lineChartColors = ChartColorsDefinition.getColors();
constructor( constructor(
private restConnectorService: RestConnectorService, private restConnectorService: RestConnectorService,
private requestInProgressService: RequestInProgressService) { private requestInProgressService: RequestInProgressService
) {
} }
async ngOnInit() { async ngOnInit() {
this.requestInProgressService.setRequestInProgress(true); this.requestInProgressService.setRequestInProgress(true);
this.reportData = await this.restConnectorService.getClassificationTasksReport().toPromise() this.reportData = await this.restConnectorService.getClassificationTasksReport().toPromise();
this.lineChartData = this.restConnectorService.getChartData(this.reportData); this.lineChartData = this.restConnectorService.getChartData(this.reportData);
this.lineChartLabels = this.reportData.meta.header; this.lineChartLabels = this.reportData.meta.header;
this.requestInProgressService.setRequestInProgress(false); this.requestInProgressService.setRequestInProgress(false);

View File

@ -65,7 +65,6 @@ export class ChartColorsDefinition {
pointHoverBackgroundColor: '#fff', pointHoverBackgroundColor: '#fff',
pointHoverBorderColor: 'rgba(180, 137, 255, 0.8)' pointHoverBorderColor: 'rgba(180, 137, 255, 0.8)'
} }
] ];
} }
} }

View File

@ -1,5 +1,5 @@
import {ReportRow} from './report-row'; import { ReportRow } from './report-row';
import {MetaInfoData} from './meta-info-data'; import { MetaInfoData } from './meta-info-data';
export class ReportData { export class ReportData {
meta: MetaInfoData; meta: MetaInfoData;

View File

@ -1,4 +1,4 @@
import {Component, OnDestroy, OnInit} from '@angular/core'; import { Component, OnDestroy, OnInit } from '@angular/core';
@Component({ @Component({
@ -7,7 +7,6 @@ import {Component, OnDestroy, OnInit} from '@angular/core';
styleUrls: ['./monitor.component.scss'] styleUrls: ['./monitor.component.scss']
}) })
export class MonitorComponent implements OnInit, OnDestroy { export class MonitorComponent implements OnInit, OnDestroy {
tabSelected = 'tasks'; tabSelected = 'tasks';
ngOnInit(): void { ngOnInit(): void {

View File

@ -1,30 +1,27 @@
import {CommonModule} from '@angular/common'; import { CommonModule } from '@angular/common';
import {NgModule} from '@angular/core'; import { NgModule } from '@angular/core';
import {FormsModule} from '@angular/forms'; import { FormsModule } from '@angular/forms';
import {AlertModule} from 'ngx-bootstrap'; import { AlertModule } from 'ngx-bootstrap';
import {ChartsModule} from 'ng2-charts'; import { ChartsModule } from 'ng2-charts';
import {TabsModule} from 'ngx-bootstrap/tabs'; import { TabsModule } from 'ngx-bootstrap/tabs';
import {HttpClientModule} from '@angular/common/http'; import { HttpClientModule } from '@angular/common/http';
import {AngularSvgIconModule} from 'angular-svg-icon'; import { AngularSvgIconModule } from 'angular-svg-icon';
import {MonitorRoutingModule} from './monitor-routing.module'; import { MonitorRoutingModule } from './monitor-routing.module';
import {SharedModule} from '../shared/shared.module'; import { SharedModule } from '../shared/shared.module';
import {ReportComponent} from './report/report.component'; import { ReportComponent } from './report/report.component';
import {MonitorComponent} from './monitor.component'; import { MonitorComponent } from './monitor.component';
import {TasksComponent} from './tasks/tasks.component'; import { TasksComponent } from './tasks/tasks.component';
import {ClassificationTasksComponent} from './classification-tasks/classification-tasks.component'; import { ClassificationTasksComponent } from './classification-tasks/classification-tasks.component';
import {TimestampComponent} from './timestamp/timestamp.component'; import { TimestampComponent } from './timestamp/timestamp.component';
import {RestConnectorService} from './services/restConnector/rest-connector.service'; import { RestConnectorService } from './services/restConnector/rest-connector.service';
import {MapToIterable} from '../shared/pipes/mapToIterable/mapToIterable';
import {MonitorWorkbasketsComponent} from './workbasket/monitor-workbaskets.component';
import {MonitorWorkbasketPlannedDateComponent} from './workbasket/workbasket-planned-date/monitor-workbasket-planned-date.component';
import {MonitorWorkbasketDueDateComponent} from './workbasket/monitor-workbasket-due-date/monitor-workbasket-due-date.component';
import {
MonitorWorkbasketQuerySwitcherComponent
} from './workbasket/monitor-workbasket-query-switcher/monitor-workbasket-query-switcher.component';
import { MapToIterable } from '../shared/pipes/mapToIterable/mapToIterable';
import { MonitorWorkbasketsComponent } from './workbasket/monitor-workbaskets.component';
import { MonitorWorkbasketPlannedDateComponent } from './workbasket/workbasket-planned-date/monitor-workbasket-planned-date.component';
import { MonitorWorkbasketDueDateComponent } from './workbasket/monitor-workbasket-due-date/monitor-workbasket-due-date.component';
import { MonitorWorkbasketQuerySwitcherComponent } from './workbasket/monitor-workbasket-query-switcher/monitor-workbasket-query-switcher.component';
const MODULES = [ const MODULES = [

View File

@ -1,5 +1,5 @@
import {Component, Input, OnInit} from '@angular/core'; import { Component, Input, OnInit } from '@angular/core';
import {ReportData} from 'app/monitor/models/report-data'; import { ReportData } from 'app/monitor/models/report-data';
@Component({ @Component({
selector: 'taskana-report', selector: 'taskana-report',
@ -7,8 +7,6 @@ import {ReportData} from 'app/monitor/models/report-data';
styleUrls: ['./report.component.scss'] styleUrls: ['./report.component.scss']
}) })
export class ReportComponent implements OnInit { export class ReportComponent implements OnInit {
currentExpHeaders = 0; currentExpHeaders = 0;
@Input() @Input()

View File

@ -1,42 +1,40 @@
import {Injectable} from '@angular/core'; import { Injectable } from '@angular/core';
import {HttpClient} from '@angular/common/http'; import { HttpClient } from '@angular/common/http';
import {environment} from 'environments/environment'; import { environment } from 'environments/environment';
import {Observable} from 'rxjs'; import { Observable } from 'rxjs';
import {ReportData} from '../../models/report-data'; import { ChartData } from 'app/monitor/models/chart-data';
import {ChartData} from 'app/monitor/models/chart-data'; import { ReportData } from '../../models/report-data';
const monitorUrl = '/v1/monitor/'; const monitorUrl = '/v1/monitor/';
@Injectable() @Injectable()
export class RestConnectorService { export class RestConnectorService {
constructor(private httpClient: HttpClient) { constructor(private httpClient: HttpClient) {
} }
getTaskStatusReport(): Observable<ReportData> { getTaskStatusReport(): Observable<ReportData> {
return this.httpClient.get<ReportData>(environment.taskanaRestUrl + monitorUrl return this.httpClient.get<ReportData>(`${environment.taskanaRestUrl + monitorUrl
+ 'tasks-status-report?states=READY,CLAIMED,COMPLETED'); }tasks-status-report?states=READY,CLAIMED,COMPLETED`);
} }
getWorkbasketStatisticsQueryingByDueDate(): Observable<ReportData> { getWorkbasketStatisticsQueryingByDueDate(): Observable<ReportData> {
return this.httpClient.get<ReportData>(environment.taskanaRestUrl return this.httpClient.get<ReportData>(`${environment.taskanaRestUrl
+ monitorUrl + 'tasks-workbasket-report?states=READY,CLAIMED,COMPLETED'); + monitorUrl}tasks-workbasket-report?states=READY,CLAIMED,COMPLETED`);
} }
getWorkbasketStatisticsQueryingByPlannedDate(): Observable<ReportData> { getWorkbasketStatisticsQueryingByPlannedDate(): Observable<ReportData> {
return this.httpClient.get<ReportData>(environment.taskanaRestUrl return this.httpClient.get<ReportData>(`${environment.taskanaRestUrl
+ '/v1/monitor/tasks-workbasket-planned-date-report?daysInPast=7&states=READY,CLAIMED,COMPLETED'); }/v1/monitor/tasks-workbasket-planned-date-report?daysInPast=7&states=READY,CLAIMED,COMPLETED`);
} }
getClassificationTasksReport(): Observable<ReportData> { getClassificationTasksReport(): Observable<ReportData> {
return this.httpClient.get<ReportData>(environment.taskanaRestUrl return this.httpClient.get<ReportData>(`${environment.taskanaRestUrl
+ monitorUrl + 'tasks-classification-report'); + monitorUrl}tasks-classification-report`);
} }
getDailyEntryExitReport(): Observable<ReportData> { getDailyEntryExitReport(): Observable<ReportData> {
return this.httpClient.get<ReportData>(environment.taskanaRestUrl return this.httpClient.get<ReportData>(`${environment.taskanaRestUrl
+ monitorUrl + 'timestamp-report'); + monitorUrl}timestamp-report`);
} }
getChartData(source: ReportData): Array<ChartData> { getChartData(source: ReportData): Array<ChartData> {

View File

@ -8,7 +8,7 @@ describe('TasksComponent', () => {
beforeEach(async(() => { beforeEach(async(() => {
TestBed.configureTestingModule({ TestBed.configureTestingModule({
declarations: [ TasksComponent ] declarations: [TasksComponent]
}) })
.compileComponents(); .compileComponents();
})); }));

View File

@ -1,7 +1,7 @@
import {Component, OnInit} from '@angular/core'; import { Component, OnInit } from '@angular/core';
import {RestConnectorService} from '../services/restConnector/rest-connector.service'; import { ReportData } from 'app/monitor/models/report-data';
import {ReportData} from 'app/monitor/models/report-data'; import { RestConnectorService } from '../services/restConnector/rest-connector.service';
import {RequestInProgressService} from '../../services/requestInProgress/request-in-progress.service'; import { RequestInProgressService } from '../../services/requestInProgress/request-in-progress.service';
@Component({ @Component({
selector: 'taskana-monitor-tasks', selector: 'taskana-monitor-tasks',
@ -9,25 +9,24 @@ import {RequestInProgressService} from '../../services/requestInProgress/request
styleUrls: ['./tasks.component.scss'], styleUrls: ['./tasks.component.scss'],
}) })
export class TasksComponent implements OnInit { export class TasksComponent implements OnInit {
pieChartLabels: string[]; pieChartLabels: string[];
pieChartData: number[] = []; pieChartData: number[] = [];
pieChartType = 'pie'; pieChartType = 'pie';
reportData: ReportData reportData: ReportData;
constructor( constructor(
private restConnectorService: RestConnectorService, private restConnectorService: RestConnectorService,
private requestInProgressService: RequestInProgressService) { private requestInProgressService: RequestInProgressService
) {
} }
async ngOnInit() { async ngOnInit() {
this.requestInProgressService.setRequestInProgress(true); this.requestInProgressService.setRequestInProgress(true);
this.reportData = await this.restConnectorService.getTaskStatusReport().toPromise() this.reportData = await this.restConnectorService.getTaskStatusReport().toPromise();
this.pieChartLabels = this.reportData.meta.header; this.pieChartLabels = this.reportData.meta.header;
this.reportData.sumRow[0].cells.forEach(c => { this.reportData.sumRow[0].cells.forEach(c => {
this.pieChartData.push(c); this.pieChartData.push(c);
}) });
this.requestInProgressService.setRequestInProgress(false); this.requestInProgressService.setRequestInProgress(false);
} }

View File

@ -1,6 +1,6 @@
import {Component, OnInit} from '@angular/core'; import { Component, OnInit } from '@angular/core';
import {ReportData} from '../models/report-data'; import { ReportData } from '../models/report-data';
import {RestConnectorService} from '../services/restConnector/rest-connector.service'; import { RestConnectorService } from '../services/restConnector/rest-connector.service';
@Component({ @Component({
selector: 'taskana-monitor-timestamp', selector: 'taskana-monitor-timestamp',
@ -8,7 +8,6 @@ import {RestConnectorService} from '../services/restConnector/rest-connector.ser
styleUrls: ['./timestamp.component.scss'] styleUrls: ['./timestamp.component.scss']
}) })
export class TimestampComponent implements OnInit { export class TimestampComponent implements OnInit {
reportData: ReportData; reportData: ReportData;
constructor(private restConnectorService: RestConnectorService) { constructor(private restConnectorService: RestConnectorService) {
@ -17,7 +16,6 @@ export class TimestampComponent implements OnInit {
ngOnInit() { ngOnInit() {
this.restConnectorService.getDailyEntryExitReport().subscribe((data: ReportData) => { this.restConnectorService.getDailyEntryExitReport().subscribe((data: ReportData) => {
this.reportData = data; this.reportData = data;
}) });
} }
} }

View File

@ -1,6 +1,6 @@
import {async, ComponentFixture, TestBed} from '@angular/core/testing'; import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import {MonitorWorkbasketDueDateComponent} from './monitor-workbasket-due-date.component'; import { MonitorWorkbasketDueDateComponent } from './monitor-workbasket-due-date.component';
describe('MonitorWorkbasketDueDateComponent', () => { describe('MonitorWorkbasketDueDateComponent', () => {
let component: MonitorWorkbasketDueDateComponent; let component: MonitorWorkbasketDueDateComponent;

View File

@ -1,10 +1,10 @@
import {Component, EventEmitter, OnInit, Output} from '@angular/core'; import { Component, EventEmitter, OnInit, Output } from '@angular/core';
import {ReportData} from '../../models/report-data'; import { ReportData } from '../../models/report-data';
import {ChartData} from '../../models/chart-data'; import { ChartData } from '../../models/chart-data';
import {ChartColorsDefinition} from '../../models/chart-colors'; import { ChartColorsDefinition } from '../../models/chart-colors';
import {RestConnectorService} from '../../services/restConnector/rest-connector.service'; import { RestConnectorService } from '../../services/restConnector/rest-connector.service';
import {MetaInfoData} from '../../models/meta-info-data'; import { MetaInfoData } from '../../models/meta-info-data';
import {RequestInProgressService} from '../../../services/requestInProgress/request-in-progress.service'; import { RequestInProgressService } from '../../../services/requestInProgress/request-in-progress.service';
@Component({ @Component({
selector: 'taskana-monitor-workbasket-due-date', selector: 'taskana-monitor-workbasket-due-date',
@ -12,9 +12,8 @@ import {RequestInProgressService} from '../../../services/requestInProgress/requ
styleUrls: ['./monitor-workbasket-due-date.component.scss'] styleUrls: ['./monitor-workbasket-due-date.component.scss']
}) })
export class MonitorWorkbasketDueDateComponent implements OnInit { export class MonitorWorkbasketDueDateComponent implements OnInit {
@Output() @Output()
metaInformation = new EventEmitter<MetaInfoData>() metaInformation = new EventEmitter<MetaInfoData>();
reportData: ReportData; reportData: ReportData;
@ -26,11 +25,13 @@ export class MonitorWorkbasketDueDateComponent implements OnInit {
lineChartOptions: any = { lineChartOptions: any = {
responsive: true responsive: true
}; };
lineChartColors = ChartColorsDefinition.getColors(); lineChartColors = ChartColorsDefinition.getColors();
constructor( constructor(
private restConnectorService: RestConnectorService, private restConnectorService: RestConnectorService,
private requestInProgressService: RequestInProgressService) { private requestInProgressService: RequestInProgressService
) {
} }
@ -42,5 +43,4 @@ export class MonitorWorkbasketDueDateComponent implements OnInit {
this.lineChartData = this.restConnectorService.getChartData(this.reportData); this.lineChartData = this.restConnectorService.getChartData(this.reportData);
this.requestInProgressService.setRequestInProgress(false); this.requestInProgressService.setRequestInProgress(false);
} }
} }

View File

@ -8,7 +8,7 @@ describe('MonitorWorkbasketQuerySwitcherComponent', () => {
beforeEach(async(() => { beforeEach(async(() => {
TestBed.configureTestingModule({ TestBed.configureTestingModule({
declarations: [ MonitorWorkbasketQuerySwitcherComponent ] declarations: [MonitorWorkbasketQuerySwitcherComponent]
}) })
.compileComponents(); .compileComponents();
})); }));

View File

@ -1,5 +1,5 @@
import {Component, EventEmitter, OnInit, Output} from '@angular/core'; import { Component, EventEmitter, OnInit, Output } from '@angular/core';
import {MonitorQueryType} from '../../models/monitor-query-type'; import { MonitorQueryType } from '../../models/monitor-query-type';
@Component({ @Component({
selector: 'taskana-monitor-workbasket-query-switcher', selector: 'taskana-monitor-workbasket-query-switcher',
@ -7,9 +7,9 @@ import {MonitorQueryType} from '../../models/monitor-query-type';
styleUrls: ['./monitor-workbasket-query-switcher.component.scss'] styleUrls: ['./monitor-workbasket-query-switcher.component.scss']
}) })
export class MonitorWorkbasketQuerySwitcherComponent implements OnInit { export class MonitorWorkbasketQuerySwitcherComponent implements OnInit {
@Output() @Output()
queryChanged = new EventEmitter<MonitorQueryType>(); queryChanged = new EventEmitter<MonitorQueryType>();
selectedChartType: MonitorQueryType; selectedChartType: MonitorQueryType;
monitorQueryPlannedDateType = MonitorQueryType.PlannedDate; monitorQueryPlannedDateType = MonitorQueryType.PlannedDate;
monitorQueryDueDateType = MonitorQueryType.DueDate; monitorQueryDueDateType = MonitorQueryType.DueDate;
@ -26,5 +26,4 @@ export class MonitorWorkbasketQuerySwitcherComponent implements OnInit {
this.selectedChartType = queryType; this.selectedChartType = queryType;
this.queryChanged.emit(queryType); this.queryChanged.emit(queryType);
} }
} }

View File

@ -8,7 +8,7 @@ describe('MonitorWorkbasketsComponent', () => {
beforeEach(async(() => { beforeEach(async(() => {
TestBed.configureTestingModule({ TestBed.configureTestingModule({
declarations: [ MonitorWorkbasketsComponent ] declarations: [MonitorWorkbasketsComponent]
}) })
.compileComponents(); .compileComponents();
})); }));

View File

@ -1,6 +1,6 @@
import {Component, OnInit} from '@angular/core'; import { Component, OnInit } from '@angular/core';
import {MetaInfoData} from '../models/meta-info-data'; import { MetaInfoData } from '../models/meta-info-data';
import {MonitorQueryType} from '../models/monitor-query-type'; import { MonitorQueryType } from '../models/monitor-query-type';
@Component({ @Component({
selector: 'taskana-monitor-workbaskets', selector: 'taskana-monitor-workbaskets',
@ -8,7 +8,6 @@ import {MonitorQueryType} from '../models/monitor-query-type';
styleUrls: ['./monitor-workbaskets.component.scss'] styleUrls: ['./monitor-workbaskets.component.scss']
}) })
export class MonitorWorkbasketsComponent implements OnInit { export class MonitorWorkbasketsComponent implements OnInit {
metaInformation: MetaInfoData; metaInformation: MetaInfoData;
showMonitorQueryPlannedDate: Boolean; showMonitorQueryPlannedDate: Boolean;
showMonitorQueryDueDate: Boolean; showMonitorQueryDueDate: Boolean;
@ -28,18 +27,18 @@ export class MonitorWorkbasketsComponent implements OnInit {
} }
getTitle(): string { getTitle(): string {
return this.showMonitorQueryPlannedDate ? return this.showMonitorQueryPlannedDate
'Tasks grouped by workbasket, querying by planned date' : ? 'Tasks grouped by workbasket, querying by planned date'
'Tasks grouped by workbasket, querying by due date'; : 'Tasks grouped by workbasket, querying by due date';
} }
private switchGraphicShowed(monitorQueryType: MonitorQueryType) { private switchGraphicShowed(monitorQueryType: MonitorQueryType) {
if (monitorQueryType === MonitorQueryType.PlannedDate) { if (monitorQueryType === MonitorQueryType.PlannedDate) {
this.showMonitorQueryPlannedDate = true; this.showMonitorQueryPlannedDate = true;
this.showMonitorQueryDueDate = false this.showMonitorQueryDueDate = false;
} else if (monitorQueryType === MonitorQueryType.DueDate) { } else if (monitorQueryType === MonitorQueryType.DueDate) {
this.showMonitorQueryPlannedDate = false; this.showMonitorQueryPlannedDate = false;
this.showMonitorQueryDueDate = true this.showMonitorQueryDueDate = true;
} }
} }
} }

View File

@ -8,7 +8,7 @@ describe('MonitorWorkbasketPlannedDateComponent', () => {
beforeEach(async(() => { beforeEach(async(() => {
TestBed.configureTestingModule({ TestBed.configureTestingModule({
declarations: [ MonitorWorkbasketPlannedDateComponent ] declarations: [MonitorWorkbasketPlannedDateComponent]
}) })
.compileComponents(); .compileComponents();
})); }));

View File

@ -1,10 +1,10 @@
import {Component, EventEmitter, OnInit, Output} from '@angular/core'; import { Component, EventEmitter, OnInit, Output } from '@angular/core';
import {ReportData} from '../../models/report-data'; import { ReportData } from '../../models/report-data';
import {ChartData} from '../../models/chart-data'; import { ChartData } from '../../models/chart-data';
import {ChartColorsDefinition} from '../../models/chart-colors'; import { ChartColorsDefinition } from '../../models/chart-colors';
import {RestConnectorService} from '../../services/restConnector/rest-connector.service'; import { RestConnectorService } from '../../services/restConnector/rest-connector.service';
import {MetaInfoData} from '../../models/meta-info-data'; import { MetaInfoData } from '../../models/meta-info-data';
import {RequestInProgressService} from '../../../services/requestInProgress/request-in-progress.service'; import { RequestInProgressService } from '../../../services/requestInProgress/request-in-progress.service';
@Component({ @Component({
selector: 'taskana-monitor-workbasket-planned-date', selector: 'taskana-monitor-workbasket-planned-date',
@ -12,9 +12,8 @@ import {RequestInProgressService} from '../../../services/requestInProgress/requ
styleUrls: ['./monitor-workbasket-planned-date.component.scss'] styleUrls: ['./monitor-workbasket-planned-date.component.scss']
}) })
export class MonitorWorkbasketPlannedDateComponent implements OnInit { export class MonitorWorkbasketPlannedDateComponent implements OnInit {
@Output() @Output()
metaInformation = new EventEmitter<MetaInfoData>() metaInformation = new EventEmitter<MetaInfoData>();
reportData: ReportData; reportData: ReportData;
@ -25,13 +24,15 @@ export class MonitorWorkbasketPlannedDateComponent implements OnInit {
lineChartData: Array<ChartData>; lineChartData: Array<ChartData>;
lineChartOptions: any = { lineChartOptions: any = {
responsive: true, responsive: true,
scales: {xAxes: [{}], yAxes: [{}]}, scales: { xAxes: [{}], yAxes: [{}] },
}; };
lineChartColors = ChartColorsDefinition.getColors(); lineChartColors = ChartColorsDefinition.getColors();
constructor( constructor(
private restConnectorService: RestConnectorService, private restConnectorService: RestConnectorService,
private requestInProgressService: RequestInProgressService) { private requestInProgressService: RequestInProgressService
) {
} }
async ngOnInit() { async ngOnInit() {

View File

@ -1,10 +1,9 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { Subject , Observable } from 'rxjs'; import { Subject, Observable } from 'rxjs';
import { AlertModel } from 'app/models/alert'; import { AlertModel } from 'app/models/alert';
@Injectable() @Injectable()
export class AlertService { export class AlertService {
public alertTriggered = new Subject<AlertModel>(); public alertTriggered = new Subject<AlertModel>();
constructor() { } constructor() { }

View File

@ -14,7 +14,7 @@ describe('CustomFieldsService', () => {
})); }));
it('should take default icon path', inject([CustomFieldsService], (service: CustomFieldsService) => { it('should take default icon path', inject([CustomFieldsService], (service: CustomFieldsService) => {
const categoriesData = {'DEFAULT': 'assets/icons/categories/default.svg'} const categoriesData = { DEFAULT: 'assets/icons/categories/default.svg' };
const returnedValue = service.getCustomObject(categoriesData); const returnedValue = service.getCustomObject(categoriesData);
expect(returnedValue).toBe(categoriesData); expect(returnedValue).toBe(categoriesData);
expect(service).toBeTruthy(); expect(service).toBeTruthy();
@ -25,10 +25,10 @@ describe('CustomFieldsService', () => {
service.initCustomFields('EN', json); service.initCustomFields('EN', json);
const categoriesDefault = json.EN.classifications.categories; const categoriesDefault = json.EN.classifications.categories;
const categoriesData = { const categoriesData = {
'EXTERNAL': 'assets/icons/categories/external.svg', EXTERNAL: 'assets/icons/categories/external.svg',
'MANUAL': 'assets/icons/categories/manual.svg', MANUAL: 'assets/icons/categories/manual.svg',
'AUTOMATIC': 'assets/icons/categories/automatic.svg', AUTOMATIC: 'assets/icons/categories/automatic.svg',
'PROCESS': 'assets/icons/categories/external.svg' PROCESS: 'assets/icons/categories/external.svg'
}; };
const returnedValue = service.getCustomObject(categoriesData, 'classifications.categories'); const returnedValue = service.getCustomObject(categoriesData, 'classifications.categories');
expect(returnedValue).toEqual(categoriesDefault); expect(returnedValue).toEqual(categoriesDefault);
@ -38,13 +38,13 @@ describe('CustomFieldsService', () => {
it('should take merge icon path', inject([CustomFieldsService], (service: CustomFieldsService) => { it('should take merge icon path', inject([CustomFieldsService], (service: CustomFieldsService) => {
const json = require('./taskana-customization-test.json'); const json = require('./taskana-customization-test.json');
service.initCustomFields('EN', json); service.initCustomFields('EN', json);
const categoriesData = {'DEFAULT': 'assets/icons/categories/default.svg'} const categoriesData = { DEFAULT: 'assets/icons/categories/default.svg' };
const result = { const result = {
'AUTOMATIC': 'assets/icons/categories/automatic.svg', AUTOMATIC: 'assets/icons/categories/automatic.svg',
'DEFAULT': 'assets/icons/categories/default.svg', DEFAULT: 'assets/icons/categories/default.svg',
'EXTERNAL': 'assets/icons/categories/external.svg', EXTERNAL: 'assets/icons/categories/external.svg',
'MANUAL': 'assets/icons/categories/manual.svg', MANUAL: 'assets/icons/categories/manual.svg',
'PROCESS': 'assets/icons/categories/process.svg' PROCESS: 'assets/icons/categories/process.svg'
}; };
const returnedValue = service.getCustomObject(categoriesData, 'classifications.categories'); const returnedValue = service.getCustomObject(categoriesData, 'classifications.categories');
expect(returnedValue).toEqual(result); expect(returnedValue).toEqual(result);

View File

@ -12,7 +12,7 @@ export class CustomFieldsService {
getCustomField(fallbacktext: string, customPath?: string): CustomField { getCustomField(fallbacktext: string, customPath?: string): CustomField {
if (!customPath) { if (!customPath) {
return new CustomField(true, fallbacktext) return new CustomField(true, fallbacktext);
} }
return this.jsonPath(customPath, fallbacktext); return this.jsonPath(customPath, fallbacktext);
} }
@ -27,7 +27,7 @@ export class CustomFieldsService {
private jsonPath(path: string, fallbacktext: string): CustomField { private jsonPath(path: string, fallbacktext: string): CustomField {
if (!this.customizedFields) { if (!this.customizedFields) {
return new CustomField(true, fallbacktext); return new CustomField(true, fallbacktext);
}; }
const paths = path.split('.'); const paths = path.split('.');
let value = this.customizedFields; let value = this.customizedFields;
paths.every(element => { paths.every(element => {
@ -46,13 +46,13 @@ export class CustomFieldsService {
private jsonPathObject(path: string, fallbackObject: Object): Object { private jsonPathObject(path: string, fallbackObject: Object): Object {
if (!this.customizedFields) { if (!this.customizedFields) {
return fallbackObject; return fallbackObject;
}; }
const paths = path.split('.'); const paths = path.split('.');
let value = this.customizedFields; let value = this.customizedFields;
paths.every(element => { paths.every(element => {
value = value[element]; value = value[element];
if (!value) { if (!value) {
value = fallbackObject value = fallbackObject;
return false; return false;
} }
return true; return true;
@ -80,5 +80,4 @@ private mergeKeys(defaultObject: Object, newObject: Object) {
return value; return value;
} }
} }

View File

@ -3,8 +3,6 @@ import { Observable, BehaviorSubject, of } from 'rxjs';
@Injectable() @Injectable()
export class DomainServiceMock { export class DomainServiceMock {
private domainSelectedValue; private domainSelectedValue;
private domainSelected = new BehaviorSubject<string>('DOMAIN_A'); private domainSelected = new BehaviorSubject<string>('DOMAIN_A');
@ -38,6 +36,6 @@ export class DomainServiceMock {
} }
switchDomain(value: string) { switchDomain(value: string) {
this.selectDomain(value) this.selectDomain(value);
} }
} }

View File

@ -1,15 +1,14 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http'; import { HttpClient } from '@angular/common/http';
import { Observable, ReplaySubject } from 'rxjs'; import { Observable, ReplaySubject } from 'rxjs';
import { environment } from '../../../environments/environment';
import { Router } from '@angular/router'; import { Router } from '@angular/router';
import { environment } from '../../../environments/environment';
import { RequestInProgressService } from '../requestInProgress/request-in-progress.service'; import { RequestInProgressService } from '../requestInProgress/request-in-progress.service';
import { SelectedRouteService } from '../selected-route/selected-route'; import { SelectedRouteService } from '../selected-route/selected-route';
@Injectable() @Injectable()
export class DomainService { export class DomainService {
url = `${environment.taskanaRestUrl}/v1/domains`;
url = environment.taskanaRestUrl + '/v1/domains';
private domainRestValue: Array<string> = new Array<string>(); private domainRestValue: Array<string> = new Array<string>();
private domainValue: Array<string> = new Array<string>(); private domainValue: Array<string> = new Array<string>();
@ -22,10 +21,11 @@ export class DomainService {
private httpClient: HttpClient, private httpClient: HttpClient,
private router: Router, private router: Router,
private requestInProgressService: RequestInProgressService, private requestInProgressService: RequestInProgressService,
private selectedRouteService: SelectedRouteService) { private selectedRouteService: SelectedRouteService
) {
this.selectedRouteService.getSelectedRoute().subscribe((value: string) => { this.selectedRouteService.getSelectedRoute().subscribe((value: string) => {
if (value.indexOf('workbaskets') === 0) { if (value.indexOf('workbaskets') === 0) {
this.hasMasterDomain = false this.hasMasterDomain = false;
this.removeMasterDomain(); this.removeMasterDomain();
if (this.domainSelectedValue === '') { if (this.domainSelectedValue === '') {
this.selectDomain(this.domainValue[0]); this.selectDomain(this.domainValue[0]);
@ -35,7 +35,6 @@ export class DomainService {
this.addMasterDomain(); this.addMasterDomain();
} }
}); });
} }
// GET // GET
@ -108,7 +107,7 @@ export class DomainService {
private getNavigationUrl(): string { private getNavigationUrl(): string {
if (this.router.url.indexOf('workbaskets') !== -1) { if (this.router.url.indexOf('workbaskets') !== -1) {
return 'taskana/administration/workbaskets'; return 'taskana/administration/workbaskets';
} else if (this.router.url.indexOf('classifications') !== -1) { } if (this.router.url.indexOf('classifications') !== -1) {
return 'taskana/administration/classifications'; return 'taskana/administration/classifications';
} }
} }

View File

@ -1,10 +1,9 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { Subject , Observable } from 'rxjs'; import { Subject, Observable } from 'rxjs';
import { MessageModal } from 'app/models/message-modal'; import { MessageModal } from 'app/models/message-modal';
@Injectable() @Injectable()
export class GeneralModalService { export class GeneralModalService {
private messageTriggered = new Subject<MessageModal>(); private messageTriggered = new Subject<MessageModal>();
constructor() { } constructor() { }

View File

@ -1,5 +1,5 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { Observable , BehaviorSubject } from 'rxjs'; import { Observable, BehaviorSubject } from 'rxjs';
@Injectable() @Injectable()
export class MasterAndDetailService { export class MasterAndDetailService {
@ -15,5 +15,4 @@ export class MasterAndDetailService {
getShowDetail() { getShowDetail() {
return this.showDetail.asObservable(); return this.showDetail.asObservable();
} }
} }

View File

@ -1,11 +1,10 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { Orientation } from 'app/models/orientation'; import { Orientation } from 'app/models/orientation';
import { BehaviorSubject , Observable } from 'rxjs'; import { BehaviorSubject, Observable } from 'rxjs';
import { TaskanaQueryParameters } from 'app/shared/util/query-parameters'; import { TaskanaQueryParameters } from 'app/shared/util/query-parameters';
@Injectable() @Injectable()
export class OrientationService { export class OrientationService {
private lock = false; private lock = false;
private currentOrientation; private currentOrientation;
public orientation = new BehaviorSubject<Orientation>(this.currentOrientation); public orientation = new BehaviorSubject<Orientation>(this.currentOrientation);

View File

@ -1,9 +1,8 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { Subject , Observable } from 'rxjs'; import { Subject, Observable } from 'rxjs';
@Injectable() @Injectable()
export class RemoveConfirmationService { export class RemoveConfirmationService {
private removeConfirmationCallbackSubject = new Subject<{ callback: Function, message: string }>(); private removeConfirmationCallbackSubject = new Subject<{ callback: Function, message: string }>();
private removeConfirmationCallback: Function; private removeConfirmationCallback: Function;
@ -11,7 +10,7 @@ export class RemoveConfirmationService {
setRemoveConfirmation(callback: Function, message: string) { setRemoveConfirmation(callback: Function, message: string) {
this.removeConfirmationCallback = callback; this.removeConfirmationCallback = callback;
this.removeConfirmationCallbackSubject.next({ callback: callback, message: message }); this.removeConfirmationCallbackSubject.next({ callback, message });
} }
getRemoveConfirmation(): Observable<{ callback: Function, message: string }> { getRemoveConfirmation(): Observable<{ callback: Function, message: string }> {

View File

@ -1,9 +1,8 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { Subject , Observable } from 'rxjs'; import { Subject, Observable } from 'rxjs';
@Injectable() @Injectable()
export class RequestInProgressService { export class RequestInProgressService {
public requestInProgressTriggered = new Subject<boolean>(); public requestInProgressTriggered = new Subject<boolean>();
constructor() { } constructor() { }

View File

@ -1,10 +1,9 @@
import { Injectable, OnInit } from '@angular/core'; import { Injectable, OnInit } from '@angular/core';
import { Subject , Observable } from 'rxjs'; import { Subject, Observable } from 'rxjs';
import { Router, ActivatedRoute, NavigationStart } from '@angular/router'; import { Router, ActivatedRoute, NavigationStart } from '@angular/router';
@Injectable() @Injectable()
export class SelectedRouteService { export class SelectedRouteService {
public selectedRouteTriggered = new Subject<string>(); public selectedRouteTriggered = new Subject<string>();
private detailRoutes: Array<string> = ['workbaskets', 'classifications', 'monitor', 'workplace', 'access-items-management', 'history']; private detailRoutes: Array<string> = ['workbaskets', 'classifications', 'monitor', 'workplace', 'access-items-management', 'history'];
@ -24,7 +23,7 @@ export class SelectedRouteService {
if (!event) { if (!event) {
return this.checkUrl(this.router.url); return this.checkUrl(this.router.url);
} }
return this.checkUrl(event.url) return this.checkUrl(event.url);
} }
private checkUrl(url: string): string { private checkUrl(url: string): string {

View File

@ -1,23 +1,24 @@
import {TestBed, inject, getTestBed} from '@angular/core/testing'; import { TestBed, inject, getTestBed } from '@angular/core/testing';
import {StartupService} from './startup.service' import { HttpClient, HttpClientModule } from '@angular/common/http';
import {HttpClient, HttpClientModule} from '@angular/common/http'; import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing';
import {CustomFieldsService} from '../custom-fields/custom-fields.service'; import { StartupService } from './startup.service';
import {TaskanaEngineService} from '../taskana-engine/taskana-engine.service'; import { CustomFieldsService } from '../custom-fields/custom-fields.service';
import {WindowRefService} from '../window/window.service'; import { TaskanaEngineService } from '../taskana-engine/taskana-engine.service';
import {environment} from '../../../environments/environment'; import { WindowRefService } from '../window/window.service';
import {HttpClientTestingModule, HttpTestingController} from '@angular/common/http/testing'; import { environment } from '../../../environments/environment';
describe('StartupService', () => { describe('StartupService', () => {
const environmentFile = 'environments/data-sources/environment-information.json'; const environmentFile = 'environments/data-sources/environment-information.json';
const someRestUrl = 'someRestUrl'; const someRestUrl = 'someRestUrl';
const someLogoutUrl = 'someLogoutUrl'; const someLogoutUrl = 'someLogoutUrl';
const dummyEnvironmentInformation = { const dummyEnvironmentInformation = {
'taskanaRestUrl': someRestUrl, taskanaRestUrl: someRestUrl,
'taskanaLogoutUrl': someLogoutUrl taskanaLogoutUrl: someLogoutUrl
}; };
let httpMock, service; let httpMock; let
service;
beforeEach(() => { beforeEach(() => {
TestBed.configureTestingModule({ TestBed.configureTestingModule({
@ -46,10 +47,10 @@ describe('StartupService', () => {
expect(service).toBeTruthy(); expect(service).toBeTruthy();
})); }));
it('should initialize rest and logout url from external file', (done) => { it('should initialize rest and logout url from external file', done => {
environment.taskanaRestUrl = ''; environment.taskanaRestUrl = '';
environment.taskanaLogoutUrl = ''; environment.taskanaLogoutUrl = '';
service.getEnvironmentFilePromise().then((res) => { service.getEnvironmentFilePromise().then(res => {
expect(environment.taskanaRestUrl).toBe(someRestUrl); expect(environment.taskanaRestUrl).toBe(someRestUrl);
expect(environment.taskanaLogoutUrl).toBe(someLogoutUrl); expect(environment.taskanaLogoutUrl).toBe(someLogoutUrl);
done(); done();
@ -60,10 +61,10 @@ describe('StartupService', () => {
httpMock.verify(); httpMock.verify();
}); });
it('should initialize rest and logout url from external file and override previous config', (done) => { it('should initialize rest and logout url from external file and override previous config', done => {
environment.taskanaRestUrl = 'oldRestUrl'; environment.taskanaRestUrl = 'oldRestUrl';
environment.taskanaLogoutUrl = 'oldLogoutUrl'; environment.taskanaLogoutUrl = 'oldLogoutUrl';
service.getEnvironmentFilePromise().then((res) => { service.getEnvironmentFilePromise().then(res => {
expect(environment.taskanaRestUrl).toBe(someRestUrl); expect(environment.taskanaRestUrl).toBe(someRestUrl);
expect(environment.taskanaLogoutUrl).toBe(someLogoutUrl); expect(environment.taskanaLogoutUrl).toBe(someLogoutUrl);
done(); done();

View File

@ -1,12 +1,12 @@
import {of} from 'rxjs'; import { of } from 'rxjs';
import {HttpClient} from '@angular/common/http'; import { HttpClient } from '@angular/common/http';
import {Router} from '@angular/router'; import { Router } from '@angular/router';
import {environment} from 'app/../environments/environment'; import { environment } from 'app/../environments/environment';
import {Injectable, Injector} from '@angular/core'; import { Injectable, Injector } from '@angular/core';
import {CustomFieldsService} from 'app/services/custom-fields/custom-fields.service'; import { CustomFieldsService } from 'app/services/custom-fields/custom-fields.service';
import {TaskanaEngineService} from 'app/services/taskana-engine/taskana-engine.service'; import { TaskanaEngineService } from 'app/services/taskana-engine/taskana-engine.service';
import {map} from 'rxjs/operators'; import { map } from 'rxjs/operators';
import {WindowRefService} from 'app/services/window/window.service'; import { WindowRefService } from 'app/services/window/window.service';
@Injectable() @Injectable()
export class StartupService { export class StartupService {
@ -15,7 +15,8 @@ export class StartupService {
private customFieldsService: CustomFieldsService, private customFieldsService: CustomFieldsService,
private taskanaEngineService: TaskanaEngineService, private taskanaEngineService: TaskanaEngineService,
private injector: Injector, private injector: Injector,
private window: WindowRefService) { private window: WindowRefService
) {
} }
public get router(): Router { public get router(): Router {
@ -37,9 +38,7 @@ export class StartupService {
} }
this.customFieldsService.initCustomFields('EN', jsonFile); this.customFieldsService.initCustomFields('EN', jsonFile);
})).toPromise() })).toPromise()
.catch(() => { .catch(() => of(true));
return of(true)
});
} }
geCustomizedFieldsFilePromise() { geCustomizedFieldsFilePromise() {
@ -48,9 +47,7 @@ export class StartupService {
this.customFieldsService.initCustomFields('EN', jsonFile); this.customFieldsService.initCustomFields('EN', jsonFile);
} }
})).toPromise() })).toPromise()
.catch(() => { .catch(() => of(true));
return of(true)
});
} }
private loadEnvironment() { private loadEnvironment() {
@ -60,7 +57,7 @@ export class StartupService {
() => this.taskanaEngineService.getUserInformation() () => this.taskanaEngineService.getUserInformation()
).catch(error => { ).catch(error => {
console.log(error); console.log(error);
//this.window.nativeWindow.location.href = environment.taskanaRestUrl + '/login'; // this.window.nativeWindow.location.href = environment.taskanaRestUrl + '/login';
}); });
} }
} }

View File

@ -5,7 +5,6 @@ import { VersionModel } from '../../models/version';
@Injectable() @Injectable()
export class TaskanaEngineServiceMock { export class TaskanaEngineServiceMock {
currentUserInfo: UserInfoModel; currentUserInfo: UserInfoModel;
constructor( constructor(
@ -39,12 +38,10 @@ export class TaskanaEngineServiceMock {
} }
private findRole(roles2Find: Array<string>) { private findRole(roles2Find: Array<string>) {
return this.currentUserInfo.roles.find(role => { return this.currentUserInfo.roles.find(role => roles2Find.some(roleLookingFor => {
return roles2Find.some(roleLookingFor => {
if (role === roleLookingFor) { if (role === roleLookingFor) {
return true; return true;
} }
}); }));
});
} }
} }

View File

@ -9,7 +9,6 @@ import { map } from 'rxjs/operators';
@Injectable() @Injectable()
export class TaskanaEngineService { export class TaskanaEngineService {
currentUserInfo: UserInfoModel; currentUserInfo: UserInfoModel;
constructor( constructor(
@ -20,8 +19,9 @@ export class TaskanaEngineService {
getUserInformation(): Promise<any> { getUserInformation(): Promise<any> {
return this.httpClient.get<any>(`${environment.taskanaRestUrl}/v1/current-user-info`).pipe(map( return this.httpClient.get<any>(`${environment.taskanaRestUrl}/v1/current-user-info`).pipe(map(
data => { data => {
this.currentUserInfo = data this.currentUserInfo = data;
})).toPromise(); }
)).toPromise();
} }
hasRole(roles2Find: Array<string>): boolean { hasRole(roles2Find: Array<string>): boolean {
@ -41,7 +41,6 @@ export class TaskanaEngineService {
logout(): Observable<string> { logout(): Observable<string> {
return this.httpClient return this.httpClient
.post<string>(`${environment.taskanaLogoutUrl}`, ''); .post<string>(`${environment.taskanaLogoutUrl}`, '');
} }
isHistoryProviderEnabled(): Observable<boolean> { isHistoryProviderEnabled(): Observable<boolean> {
@ -49,12 +48,10 @@ export class TaskanaEngineService {
} }
private findRole(roles2Find: Array<string>) { private findRole(roles2Find: Array<string>) {
return this.currentUserInfo.roles.find(role => { return this.currentUserInfo.roles.find(role => roles2Find.some(roleLookingFor => {
return roles2Find.some(roleLookingFor => {
if (role === roleLookingFor) { if (role === roleLookingFor) {
return true; return true;
} }
}); }));
});
} }
} }

View File

@ -2,7 +2,6 @@ import { Injectable } from '@angular/core';
@Injectable() @Injectable()
export class TitlesService { export class TitlesService {
titles = new Map<number, string>(); titles = new Map<number, string>();
customizedTitles: any = {}; customizedTitles: any = {};
constructor() { } constructor() { }
@ -12,7 +11,6 @@ export class TitlesService {
} }
getTitle(id: number, fallBacktext: string, customPath?: string) { getTitle(id: number, fallBacktext: string, customPath?: string) {
return this.titles[id] ? this.titles[id] : fallBacktext;
return this.titles[id] ? this.titles[id] : fallBacktext
} }
} }

View File

@ -3,7 +3,6 @@ import { Subject } from 'rxjs';
@Injectable() @Injectable()
export class TreeService { export class TreeService {
public removedNodeId = new Subject<string>(); public removedNodeId = new Subject<string>();
constructor() { } constructor() { }
@ -15,5 +14,4 @@ export class TreeService {
getRemovedNodeId() { getRemovedNodeId() {
return this.removedNodeId.asObservable(); return this.removedNodeId.asObservable();
} }
} }

Some files were not shown because too many files have changed in this diff Show More