TSK-997: Autofix linting errors
Executed linting with the --fix command and removed now unnecessary suppressing rules
This commit is contained in:
parent
7c3d7ef9fe
commit
0fa4b1d5df
|
@ -15,40 +15,28 @@ module.exports = {
|
|||
"@typescript-eslint/tslint"
|
||||
],
|
||||
"rules": {
|
||||
"arrow-parens": ["off", "as-needed"],
|
||||
"arrow-parens": ["error", "as-needed"],
|
||||
"@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?
|
||||
"no-plusplus": "off",
|
||||
"object-curly-newline": ["off", { "ImportDeclaration": "never" }],
|
||||
"quote-props": ["warn", "as-needed"],
|
||||
|
||||
// This rules shall be activated after they were corrected
|
||||
//"lines-between-class-members": ["error", "always", { "exceptAfterSingleLine": true }],
|
||||
//"comma-dangle": ["error", "only-multiline"],
|
||||
//"function-paren-newline": ["error", "consistent"],
|
||||
//"no-underscore-dangle": ["error", { "allow": ["_links", "__karma__"] }],
|
||||
//"no-param-reassign": ["error", { "props": false }],
|
||||
"object-curly-newline": ["error", { "ImportDeclaration": "never" }],
|
||||
"quote-props": ["error", "as-needed"],
|
||||
"lines-between-class-members": ["error", "always", { "exceptAfterSingleLine": true }],
|
||||
"comma-dangle": ["error", "only-multiline"],
|
||||
"no-underscore-dangle": ["off", { "allow": ["_links", "__karma__"] }],
|
||||
"no-param-reassign": ["off", { "props": false }],
|
||||
|
||||
// all following rules SHOULD be removed
|
||||
"class-methods-use-this": "off",
|
||||
"import/order": "off",
|
||||
"import/extensions": "off",
|
||||
"import/no-unresolved": "off",
|
||||
"import/prefer-default-export": "off",
|
||||
"no-underscore-dangle": "off",
|
||||
"max-classes-per-file": "off",
|
||||
"no-useless-escape": "off",
|
||||
"object-curly-spacing": "off",
|
||||
"padded-blocks": "off",
|
||||
"@typescript-eslint/no-unused-vars": "off",
|
||||
"@typescript-eslint/no-unused-expressions": "off",
|
||||
"@typescript-eslint/semi": "off",
|
||||
|
||||
// all following rules MUST be removed (mostly autofix)
|
||||
"linebreak-style": ["off", "unix"], // own PR
|
||||
"comma-dangle": "off",
|
||||
"function-paren-newline": "off",
|
||||
"lines-between-class-members": "off",
|
||||
"no-restricted-syntax": "off",
|
||||
"consistent-return": "off",
|
||||
"no-return-assign": "off",
|
||||
|
@ -58,8 +46,8 @@ module.exports = {
|
|||
"@typescript-eslint/no-use-before-define": "off",
|
||||
"@typescript-eslint/camelcase": "off",
|
||||
"no-multi-assign": "off",
|
||||
"no-param-reassign": "off",
|
||||
"no-new-object": "off",
|
||||
"no-plusplus": "off",
|
||||
"array-callback-return": "off",
|
||||
"no-mixed-operators": "off",
|
||||
"no-multi-str": "off",
|
||||
|
@ -69,37 +57,5 @@ module.exports = {
|
|||
"no-self-assign": "off",
|
||||
"global-require": "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,
|
||||
}
|
||||
};
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { AccessItemsManagementComponent } from './access-items-management.component';
|
||||
import { configureTests } from 'app/app.test.configuration';
|
||||
import { AccessIdsService } from 'app/shared/services/access-ids/access-ids.service';
|
||||
import { FormsValidatorService } from 'app/shared/services/forms/forms-validator.service';
|
||||
import { AccessIdDefinition } from 'app/models/access-id';
|
||||
import { AccessItemsWorkbasketResource } from 'app/models/access-item-workbasket-resource';
|
||||
import { of } from 'rxjs';
|
||||
import { AccessItemsManagementComponent } from './access-items-management.component';
|
||||
|
||||
|
||||
describe('AccessItemsManagementComponent', () => {
|
||||
|
@ -20,8 +20,8 @@ describe('AccessItemsManagementComponent', () => {
|
|||
testBed.configureTestingModule({
|
||||
imports: [],
|
||||
declarations: [AccessItemsManagementComponent],
|
||||
providers: [ AccessIdsService, FormsValidatorService]
|
||||
})
|
||||
providers: [AccessIdsService, FormsValidatorService]
|
||||
});
|
||||
};
|
||||
|
||||
configureTests(configure).then(testBed => {
|
||||
|
|
|
@ -5,17 +5,17 @@ import { CustomFieldsService } from 'app/services/custom-fields/custom-fields.se
|
|||
import { Subscription } from 'rxjs';
|
||||
|
||||
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 { AccessItemWorkbasket } from 'app/models/access-item-workbasket';
|
||||
import { AccessIdsService } from '../../shared/services/access-ids/access-ids.service';
|
||||
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 { MessageModal } from 'app/models/message-modal';
|
||||
import { RemoveConfirmationService } from 'app/services/remove-confirmation/remove-confirmation.service';
|
||||
import { AlertModel, AlertType } from 'app/models/alert';
|
||||
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({
|
||||
selector: 'taskana-access-items-management',
|
||||
|
@ -23,7 +23,6 @@ import { AlertService } from 'app/services/alert/alert.service';
|
|||
styleUrls: ['./access-items-management.component.scss']
|
||||
})
|
||||
export class AccessItemsManagementComponent implements OnInit, OnDestroy {
|
||||
|
||||
accessIdSelected;
|
||||
accessIdPrevious;
|
||||
|
||||
|
@ -55,7 +54,7 @@ export class AccessItemsManagementComponent implements OnInit, OnDestroy {
|
|||
setAccessItemsGroups(accessItems: Array<AccessItemWorkbasket>) {
|
||||
const AccessItemsFormGroups = accessItems.map(accessItem => this.formBuilder.group(accessItem));
|
||||
AccessItemsFormGroups.map(accessItemGroup => {
|
||||
accessItemGroup.controls['accessId'].setValidators(Validators.required);
|
||||
accessItemGroup.controls.accessId.setValidators(Validators.required);
|
||||
for (const key of Object.keys(accessItemGroup.controls)) {
|
||||
accessItemGroup.controls[key].disable();
|
||||
}
|
||||
|
@ -63,13 +62,13 @@ export class AccessItemsManagementComponent implements OnInit, OnDestroy {
|
|||
const AccessItemsFormArray = this.formBuilder.array(AccessItemsFormGroups);
|
||||
if (!this.AccessItemsForm) { this.AccessItemsForm = this.formBuilder.group({}); }
|
||||
this.AccessItemsForm.setControl('accessItemsGroups', AccessItemsFormArray);
|
||||
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.workbasketKeyFilter) { this.AccessItemsForm.addControl('workbasketKeyFilter', new FormControl()); }
|
||||
if (!this.AccessItemsForm.value.accessIdFilter) { this.AccessItemsForm.addControl('accessIdFilter', new FormControl()); }
|
||||
}
|
||||
|
||||
get accessItemsGroups(): FormArray {
|
||||
return this.AccessItemsForm ? this.AccessItemsForm.get('accessItemsGroups') as FormArray : null;
|
||||
};
|
||||
}
|
||||
|
||||
constructor(private formBuilder: FormBuilder,
|
||||
private customFieldsService: CustomFieldsService,
|
||||
|
@ -89,10 +88,10 @@ export class AccessItemsManagementComponent implements OnInit, OnDestroy {
|
|||
return;
|
||||
}
|
||||
if (!this.AccessItemsForm || this.accessIdPrevious !== selected.accessId) {
|
||||
this.accessIdPrevious = selected.accessId
|
||||
this.accessIdPrevious = selected.accessId;
|
||||
this.isGroup = selected.accessId.includes(this.groupsKey);
|
||||
|
||||
this.unSubscribe(this.accessItemInformationsubscription)
|
||||
this.unSubscribe(this.accessItemInformationsubscription);
|
||||
this.accessItemInformationsubscription = this.accessIdsService.getAccessItemsInformation(selected.accessId, true)
|
||||
.subscribe((accessIdsWithGroups: Array<AccessIdDefinition>) => {
|
||||
this.accessIdsWithGroups = accessIdsWithGroups;
|
||||
|
@ -106,9 +105,8 @@ export class AccessItemsManagementComponent implements OnInit, OnDestroy {
|
|||
'There was error while retrieving your access ids with groups',
|
||||
error
|
||||
)
|
||||
)
|
||||
}
|
||||
)
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -123,13 +121,14 @@ export class AccessItemsManagementComponent implements OnInit, OnDestroy {
|
|||
|
||||
searchForAccessItemsWorkbaskets() {
|
||||
this.requestInProgressService.setRequestInProgress(true);
|
||||
this.unSubscribe(this.accessItemPermissionsSubscription)
|
||||
this.unSubscribe(this.accessItemPermissionsSubscription);
|
||||
this.accessItemPermissionsSubscription = this.accessIdsService.getAccessItemsPermissions(
|
||||
this.accessIdsWithGroups,
|
||||
this.AccessItemsForm ? this.AccessItemsForm.value.accessIdFilter : undefined,
|
||||
this.AccessItemsForm ? this.AccessItemsForm.value.workbasketKeyFilter : undefined,
|
||||
this.sortModel,
|
||||
true)
|
||||
true
|
||||
)
|
||||
.subscribe((accessItemsResource: AccessItemsWorkbasketResource) => {
|
||||
this.setAccessItemsGroups(accessItemsResource ? accessItemsResource.accessItems : []);
|
||||
this.requestInProgressService.setRequestInProgress(false);
|
||||
|
@ -142,8 +141,7 @@ export class AccessItemsManagementComponent implements OnInit, OnDestroy {
|
|||
error
|
||||
)
|
||||
);
|
||||
})
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
revokeAccess() {
|
||||
|
@ -174,11 +172,12 @@ export class AccessItemsManagementComponent implements OnInit, OnDestroy {
|
|||
this.requestInProgressService.setRequestInProgress(false);
|
||||
this.generalModalService.triggerMessage(
|
||||
new MessageModal(
|
||||
`You can't delete a group`,
|
||||
'You can\'t delete a group',
|
||||
error
|
||||
)
|
||||
);
|
||||
});
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
private unSubscribe(subscription: Subscription): void {
|
||||
|
@ -186,7 +185,7 @@ export class AccessItemsManagementComponent implements OnInit, OnDestroy {
|
|||
}
|
||||
|
||||
ngOnDestroy(): void {
|
||||
this.unSubscribe(this.accessItemPermissionsSubscription)
|
||||
this.unSubscribe(this.accessItemInformationsubscription)
|
||||
this.unSubscribe(this.accessItemPermissionsSubscription);
|
||||
this.unSubscribe(this.accessItemInformationsubscription);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,35 +1,35 @@
|
|||
// tslint:enable:max-line-length
|
||||
import {CommonModule} from '@angular/common';
|
||||
import {NgModule} from '@angular/core';
|
||||
import {FormsModule, ReactiveFormsModule} from '@angular/forms';
|
||||
import {AngularSvgIconModule} from 'angular-svg-icon';
|
||||
import {AlertModule, TypeaheadModule} from 'ngx-bootstrap';
|
||||
import {SharedModule} from 'app/shared/shared.module';
|
||||
import {AdministrationRoutingModule} from './administration-routing.module';
|
||||
import {InfiniteScrollModule} from 'ngx-infinite-scroll';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { NgModule } from '@angular/core';
|
||||
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
|
||||
import { AngularSvgIconModule } from 'angular-svg-icon';
|
||||
import { AlertModule, TypeaheadModule } from 'ngx-bootstrap';
|
||||
import { SharedModule } from 'app/shared/shared.module';
|
||||
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
|
||||
*/
|
||||
import {WorkbasketListComponent} from './workbasket/master/workbasket-list.component';
|
||||
import {WorkbasketListToolbarComponent} from './workbasket/master/workbasket-list-toolbar/workbasket-list-toolbar.component'
|
||||
import {WorkbasketDetailsComponent} from './workbasket/details/workbasket-details.component';
|
||||
import {WorkbasketInformationComponent} from './workbasket/details/information/workbasket-information.component';
|
||||
import {DistributionTargetsComponent} from './workbasket/details/distribution-targets/distribution-targets.component';
|
||||
import {DualListComponent} from './workbasket/details/distribution-targets/dual-list/dual-list.component';
|
||||
import {AccessItemsComponent} from './workbasket/details/access-items/access-items.component';
|
||||
import {ClassificationListComponent} from './classification/master/list/classification-list.component';
|
||||
import {ClassificationDetailsComponent} from './classification/details/classification-details.component';
|
||||
import {ImportExportComponent} from './components/import-export/import-export.component';
|
||||
import {ClassificationTypesSelectorComponent} from 'app/shared/classification-types-selector/classification-types-selector.component';
|
||||
import { WorkbasketListComponent } from './workbasket/master/workbasket-list.component';
|
||||
import { WorkbasketListToolbarComponent } from './workbasket/master/workbasket-list-toolbar/workbasket-list-toolbar.component';
|
||||
import { WorkbasketDetailsComponent } from './workbasket/details/workbasket-details.component';
|
||||
import { WorkbasketInformationComponent } from './workbasket/details/information/workbasket-information.component';
|
||||
import { DistributionTargetsComponent } from './workbasket/details/distribution-targets/distribution-targets.component';
|
||||
import { DualListComponent } from './workbasket/details/distribution-targets/dual-list/dual-list.component';
|
||||
import { AccessItemsComponent } from './workbasket/details/access-items/access-items.component';
|
||||
import { ClassificationListComponent } from './classification/master/list/classification-list.component';
|
||||
import { ClassificationDetailsComponent } from './classification/details/classification-details.component';
|
||||
import { ImportExportComponent } from './components/import-export/import-export.component';
|
||||
/**
|
||||
* Services
|
||||
*/
|
||||
import {SavingWorkbasketService} from './services/saving-workbaskets/saving-workbaskets.service';
|
||||
import {ClassificationDefinitionService} from './services/classification-definition/classification-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 {AccessItemsManagementComponent} from 'app/administration/access-items-management/access-items-management.component';
|
||||
import { SavingWorkbasketService } from './services/saving-workbaskets/saving-workbaskets.service';
|
||||
import { ClassificationDefinitionService } from './services/classification-definition/classification-definition.service';
|
||||
import { WorkbasketDefinitionService } from './services/workbasket-definition/workbasket-definition.service';
|
||||
import { ImportExportService } from './services/import-export/import-export.service';
|
||||
|
||||
const MODULES = [
|
||||
CommonModule,
|
||||
|
|
|
@ -9,7 +9,6 @@ import { AngularSvgIconModule } from 'angular-svg-icon';
|
|||
import { configureTests } from 'app/app.test.configuration';
|
||||
|
||||
|
||||
import { ClassificationDetailsComponent } from './classification-details.component';
|
||||
import { ClassificationDefinition } from 'app/models/classification-definition';
|
||||
import { LinksClassification } from 'app/models/links-classfication';
|
||||
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 { RemoveConfirmationService } from 'app/services/remove-confirmation/remove-confirmation.service';
|
||||
import { ImportExportService } from 'app/administration/services/import-export/import-export.service';
|
||||
import { ClassificationDetailsComponent } from './classification-details.component';
|
||||
|
||||
@Component({
|
||||
selector: 'taskana-dummy-detail',
|
||||
|
@ -44,8 +44,9 @@ describe('ClassificationDetailsComponent', () => {
|
|||
let fixture: ComponentFixture<ClassificationDetailsComponent>;
|
||||
const treeNodes: Array<TreeNodeModel> = new Array(new TreeNodeModel());
|
||||
|
||||
let classificationsService, classificationCategoriesService,
|
||||
treeService, removeConfirmationService;
|
||||
let classificationsService; let classificationCategoriesService;
|
||||
let treeService; let
|
||||
removeConfirmationService;
|
||||
|
||||
beforeEach(done => {
|
||||
const configure = (testBed: TestBed) => {
|
||||
|
@ -54,7 +55,7 @@ describe('ClassificationDetailsComponent', () => {
|
|||
declarations: [ClassificationDetailsComponent, DummyDetailComponent],
|
||||
providers: [MasterAndDetailService, RequestInProgressService, ClassificationsService, HttpClient, GeneralModalService, AlertService,
|
||||
TreeService, ClassificationCategoriesService, CustomFieldsService, ImportExportService]
|
||||
})
|
||||
});
|
||||
};
|
||||
configureTests(configure).then(testBed => {
|
||||
fixture = TestBed.createComponent(ClassificationDetailsComponent);
|
||||
|
@ -68,7 +69,7 @@ describe('ClassificationDetailsComponent', () => {
|
|||
spyOn(classificationsService, 'deleteClassification').and.returnValue(of(true));
|
||||
spyOn(classificationCategoriesService, 'getCategoryIcon').and.returnValue(new Pair('assets/icons/categories/external.svg'));
|
||||
component.classification = new ClassificationDefinition('id1');
|
||||
component.classification._links = new LinksClassification({ 'self': '' });
|
||||
component.classification._links = new LinksClassification({ self: '' });
|
||||
treeService = TestBed.get(TreeService);
|
||||
fixture.detectChanges();
|
||||
done();
|
||||
|
|
|
@ -22,11 +22,11 @@ import { RemoveConfirmationService } from 'app/services/remove-confirmation/remo
|
|||
import { ClassificationCategoriesService } from 'app/shared/services/classifications/classification-categories.service';
|
||||
// tslint:enable:max-line-length
|
||||
import { DomainService } from 'app/services/domain/domain.service';
|
||||
import { CustomFieldsService } from '../../../services/custom-fields/custom-fields.service';
|
||||
import { Pair } from 'app/models/pair';
|
||||
import { NgForm } from '@angular/forms';
|
||||
import { FormsValidatorService } from 'app/shared/services/forms/forms-validator.service';
|
||||
import { ImportExportService } from 'app/administration/services/import-export/import-export.service';
|
||||
import { CustomFieldsService } from '../../../services/custom-fields/custom-fields.service';
|
||||
|
||||
@Component({
|
||||
selector: 'taskana-classification-details',
|
||||
|
@ -35,7 +35,6 @@ import { ImportExportService } from 'app/administration/services/import-export/i
|
|||
styleUrls: ['./classification-details.component.scss']
|
||||
})
|
||||
export class ClassificationDetailsComponent implements OnInit, OnDestroy {
|
||||
|
||||
classification: ClassificationDefinition;
|
||||
classificationClone: ClassificationDefinition;
|
||||
showDetail = false;
|
||||
|
@ -92,8 +91,8 @@ export class ClassificationDetailsComponent implements OnInit, OnDestroy {
|
|||
});
|
||||
this.classificationSelectedSubscription = this.classificationsService.getSelectedClassification()
|
||||
.subscribe(classificationSelected => {
|
||||
if (classificationSelected && this.classification &&
|
||||
this.classification.classificationId === classificationSelected.classificationId) { return; }
|
||||
if (classificationSelected && this.classification
|
||||
&& this.classification.classificationId === classificationSelected.classificationId) { return; }
|
||||
this.initProperties();
|
||||
if (classificationSelected) {
|
||||
this.fillClassificationInformation(classificationSelected);
|
||||
|
@ -101,7 +100,7 @@ export class ClassificationDetailsComponent implements OnInit, OnDestroy {
|
|||
});
|
||||
|
||||
this.routeSubscription = this.route.params.subscribe(params => {
|
||||
let id = params['id'];
|
||||
let { id } = params;
|
||||
delete this.action;
|
||||
if (id && id.indexOf('new-classification') !== -1) {
|
||||
this.action = ACTION.CREATE;
|
||||
|
@ -110,10 +109,10 @@ export class ClassificationDetailsComponent implements OnInit, OnDestroy {
|
|||
if (id === 'undefined') {
|
||||
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);
|
||||
}
|
||||
});
|
||||
|
@ -128,7 +127,7 @@ export class ClassificationDetailsComponent implements OnInit, OnDestroy {
|
|||
if (categories.length > 0 && this.classification) {
|
||||
// TSK-891 fix: The property is already set and is crucial value
|
||||
// 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];
|
||||
}
|
||||
}
|
||||
|
@ -136,7 +135,7 @@ export class ClassificationDetailsComponent implements OnInit, OnDestroy {
|
|||
|
||||
this.importingExportingSubscription = this.importExportService.getImportingFinished().subscribe((value: Boolean) => {
|
||||
if (this.classification.classificationId) { this.selectClassification(this.classification.classificationId); }
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
backClicked(): void {
|
||||
|
@ -188,10 +187,12 @@ export class ClassificationDetailsComponent implements OnInit, OnDestroy {
|
|||
} else {
|
||||
try {
|
||||
this.classification = (<ClassificationDefinition> await this.classificationsService.putClassification(
|
||||
this.classification._links.self.href, this.classification));
|
||||
this.classification._links.self.href, this.classification
|
||||
));
|
||||
this.afterRequest();
|
||||
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);
|
||||
} catch (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 {
|
||||
if (this.action === ACTION.CREATE && this.classification) { return true }
|
||||
if (this.action === ACTION.CREATE && this.classification) { return true; }
|
||||
}
|
||||
|
||||
private fillClassificationInformation(classificationSelected: ClassificationDefinition) {
|
||||
|
@ -277,7 +278,8 @@ export class ClassificationDetailsComponent implements OnInit, OnDestroy {
|
|||
private removeClassificationConfirmation() {
|
||||
if (!this.classification || !this.classification.classificationId) {
|
||||
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;
|
||||
}
|
||||
this.requestInProgressService.setRequestInProgress(true);
|
||||
|
@ -286,16 +288,16 @@ export class ClassificationDetailsComponent implements OnInit, OnDestroy {
|
|||
this.classificationRemoveSubscription = this.classificationsService
|
||||
.deleteClassification(this.classification._links.self.href)
|
||||
.subscribe(() => {
|
||||
const key = this.classification.key;
|
||||
const { key } = this.classification;
|
||||
delete this.classification;
|
||||
this.afterRequest();
|
||||
this.classificationsService.selectClassification();
|
||||
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 => {
|
||||
this.generalModalService.triggerMessage(new MessageModal('There was error while removing your classification', error));
|
||||
this.afterRequest();
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
private cloneClassification(classification: ClassificationDefinition) {
|
||||
|
@ -311,7 +313,6 @@ export class ClassificationDetailsComponent implements OnInit, OnDestroy {
|
|||
}
|
||||
|
||||
ngOnDestroy(): void {
|
||||
|
||||
if (this.masterAndDetailSubscription) { this.masterAndDetailSubscription.unsubscribe(); }
|
||||
if (this.routeSubscription) { this.routeSubscription.unsubscribe(); }
|
||||
if (this.classificationSelectedSubscription) { this.classificationSelectedSubscription.unsubscribe(); }
|
||||
|
|
|
@ -9,7 +9,6 @@ import { AngularSvgIconModule } from 'angular-svg-icon';
|
|||
|
||||
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 { 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 { RequestInProgressService } from 'app/services/requestInProgress/request-in-progress.service';
|
||||
import { configureTests } from 'app/app.test.configuration';
|
||||
import {
|
||||
ClassificationCategoriesService
|
||||
} from 'app/shared/services/classifications/classification-categories.service';
|
||||
import { ClassificationCategoriesService } from 'app/shared/services/classifications/classification-categories.service';
|
||||
import { Pair } from 'app/models/pair';
|
||||
import { TreeService } from 'app/services/tree/tree.service';
|
||||
import { ImportExportService } from 'app/administration/services/import-export/import-export.service';
|
||||
import { ClassificationListComponent } from './classification-list.component';
|
||||
|
||||
@Component({
|
||||
selector: 'taskana-dummy-detail',
|
||||
|
@ -45,7 +43,8 @@ describe('ClassificationListComponent', () => {
|
|||
let fixture: ComponentFixture<ClassificationListComponent>;
|
||||
const treeNodes: Array<TreeNodeModel> = new Array(new TreeNodeModel());
|
||||
const classificationTypes: Array<string> = new Array<string>('type1', 'type2');
|
||||
let classificationsService, classificationCategoriesService;
|
||||
let classificationsService; let
|
||||
classificationCategoriesService;
|
||||
|
||||
beforeEach(done => {
|
||||
const configure = (testBed: TestBed) => {
|
||||
|
@ -57,7 +56,7 @@ describe('ClassificationListComponent', () => {
|
|||
HttpClient, WorkbasketDefinitionService, AlertService, ClassificationsService, DomainService, ClassificationDefinitionService,
|
||||
GeneralModalService, RequestInProgressService, ClassificationCategoriesService, TreeService, ImportExportService
|
||||
]
|
||||
})
|
||||
});
|
||||
};
|
||||
configureTests(configure).then(testBed => {
|
||||
fixture = testBed.createComponent(ClassificationListComponent);
|
||||
|
|
|
@ -7,14 +7,12 @@ import { Classification } from 'app/models/classification';
|
|||
import { TreeNodeModel } from 'app/models/tree-node';
|
||||
|
||||
import { ClassificationsService } from 'app/shared/services/classifications/classifications.service';
|
||||
import {
|
||||
ClassificationCategoriesService
|
||||
} from 'app/shared/services/classifications/classification-categories.service';
|
||||
import { ClassificationCategoriesService } from 'app/shared/services/classifications/classification-categories.service';
|
||||
import { Pair } from 'app/models/pair';
|
||||
import { ClassificationDefinition } from '../../../../models/classification-definition';
|
||||
import { ImportExportService } from 'app/administration/services/import-export/import-export.service';
|
||||
import {AlertModel, AlertType} from '../../../../models/alert';
|
||||
import {AlertService} from '../../../../services/alert/alert.service';
|
||||
import { ClassificationDefinition } from '../../../../models/classification-definition';
|
||||
import { AlertModel, AlertType } from '../../../../models/alert';
|
||||
import { AlertService } from '../../../../services/alert/alert.service';
|
||||
|
||||
@Component({
|
||||
selector: 'taskana-classification-list',
|
||||
|
@ -22,8 +20,6 @@ import {AlertService} from '../../../../services/alert/alert.service';
|
|||
styleUrls: ['./classification-list.component.scss']
|
||||
})
|
||||
export class ClassificationListComponent implements OnInit, OnDestroy {
|
||||
|
||||
|
||||
selectedCategory = '';
|
||||
selectedId: string;
|
||||
selectionToImport = TaskanaType.CLASSIFICATIONS;
|
||||
|
@ -48,7 +44,8 @@ export class ClassificationListComponent implements OnInit, OnDestroy {
|
|||
private route: ActivatedRoute,
|
||||
private categoryService: ClassificationCategoriesService,
|
||||
private importExportService: ImportExportService,
|
||||
private alertService: AlertService) {
|
||||
private alertService: AlertService
|
||||
) {
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
|
@ -62,13 +59,12 @@ export class ClassificationListComponent implements OnInit, OnDestroy {
|
|||
this.performRequest();
|
||||
});
|
||||
|
||||
this.categoriesSubscription =
|
||||
this.categoryService.getCategories(this.classificationTypeSelected).subscribe((categories: Array<string>) => {
|
||||
this.categoriesSubscription = this.categoryService.getCategories(this.classificationTypeSelected).subscribe((categories: Array<string>) => {
|
||||
this.categories = categories;
|
||||
});
|
||||
this.importingExportingSubscription = this.importExportService.getImportingFinished().subscribe((value: Boolean) => {
|
||||
this.performRequest(true);
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
selectClassificationType(classificationTypeSelected: string) {
|
||||
|
@ -107,8 +103,8 @@ export class ClassificationListComponent implements OnInit, OnDestroy {
|
|||
this.requestInProgress = true;
|
||||
this.classifications = [];
|
||||
|
||||
if (this.classificationServiceSubscription) { this.classificationServiceSubscription.unsubscribe() }
|
||||
if (this.classificationSelectedSubscription) { this.classificationSelectedSubscription.unsubscribe() }
|
||||
if (this.classificationServiceSubscription) { this.classificationServiceSubscription.unsubscribe(); }
|
||||
if (this.classificationSelectedSubscription) { this.classificationSelectedSubscription.unsubscribe(); }
|
||||
|
||||
this.classificationServiceSubscription = this.classificationService.getClassifications()
|
||||
.subscribe((classifications: Array<TreeNodeModel>) => {
|
||||
|
@ -125,7 +121,6 @@ export class ClassificationListComponent implements OnInit, OnDestroy {
|
|||
});
|
||||
|
||||
this.initialized = true;
|
||||
|
||||
}
|
||||
|
||||
private getClassifications(key?: string) {
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { ImportExportComponent } from './import-export.component';
|
||||
import { WorkbasketService } from 'app/shared/services/workbasket/workbasket.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 { HttpClientModule } from '@angular/common/http';
|
||||
import { GeneralModalService } from 'app/services/general-modal/general-modal.service';
|
||||
import { AngularSvgIconModule } from 'angular-svg-icon';
|
||||
import { configureTests } from 'app/app.test.configuration';
|
||||
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', () => {
|
||||
let component: ImportExportComponent;
|
||||
|
@ -23,7 +23,7 @@ describe('ImportExportComponent', () => {
|
|||
imports: [HttpClientModule, AngularSvgIconModule],
|
||||
providers: [WorkbasketService, ClassificationDefinitionService, WorkbasketDefinitionService, AlertService,
|
||||
GeneralModalService, ImportExportService]
|
||||
})
|
||||
});
|
||||
};
|
||||
configureTests(configure).then(testBed => {
|
||||
fixture = TestBed.createComponent(ImportExportComponent);
|
||||
|
@ -41,5 +41,4 @@ describe('ImportExportComponent', () => {
|
|||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
|
||||
});
|
||||
|
|
|
@ -17,7 +17,6 @@ import { ImportExportService } from 'app/administration/services/import-export/i
|
|||
styleUrls: ['./import-export.component.scss']
|
||||
})
|
||||
export class ImportExportComponent implements OnInit {
|
||||
|
||||
@Input() currentSelection: TaskanaType;
|
||||
|
||||
@ViewChild('selectedFile', { static: true })
|
||||
|
@ -33,7 +32,8 @@ export class ImportExportComponent implements OnInit {
|
|||
private generalModalService: GeneralModalService,
|
||||
private alertService: AlertService,
|
||||
public uploadservice: UploadService,
|
||||
private importExportService: ImportExportService) {
|
||||
private importExportService: ImportExportService
|
||||
) {
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
|
@ -51,31 +51,31 @@ export class ImportExportComponent implements OnInit {
|
|||
}
|
||||
|
||||
uploadFile() {
|
||||
const file = this.selectedFileInput.nativeElement.files[0],
|
||||
formdata = new FormData(),
|
||||
ajax = new XMLHttpRequest();
|
||||
if (!this.checkFormatFile(file)) { return false }
|
||||
const file = this.selectedFileInput.nativeElement.files[0];
|
||||
const formdata = new FormData();
|
||||
const ajax = new XMLHttpRequest();
|
||||
if (!this.checkFormatFile(file)) { return false; }
|
||||
formdata.append('file', file);
|
||||
ajax.upload.addEventListener('progress', this.progressHandler.bind(this), false);
|
||||
ajax.addEventListener('load', this.resetProgress.bind(this), false);
|
||||
ajax.addEventListener('error', this.onFailedResponse.bind(this, ajax), false);
|
||||
ajax.onreadystatechange = this.onReadyStateChangeHandler.bind(this, ajax);
|
||||
if (this.currentSelection === TaskanaType.WORKBASKETS) {
|
||||
ajax.open('POST', environment.taskanaRestUrl + '/v1/workbasket-definitions');
|
||||
ajax.open('POST', `${environment.taskanaRestUrl}/v1/workbasket-definitions`);
|
||||
} else {
|
||||
ajax.open('POST', environment.taskanaRestUrl + '/v1/classification-definitions');
|
||||
ajax.open('POST', `${environment.taskanaRestUrl}/v1/classification-definitions`);
|
||||
}
|
||||
if (!environment.production) {
|
||||
ajax.setRequestHeader('Authorization', 'Basic YWRtaW46YWRtaW4=');
|
||||
}
|
||||
ajax.send(formdata);
|
||||
this.uploadservice.isInUse = true;
|
||||
this.uploadservice.setCurrentProgressValue(1)
|
||||
this.uploadservice.setCurrentProgressValue(1);
|
||||
}
|
||||
|
||||
progressHandler(event) {
|
||||
const percent = (event.loaded / event.total) * 100;
|
||||
this.uploadservice.setCurrentProgressValue(Math.round(percent))
|
||||
this.uploadservice.setCurrentProgressValue(Math.round(percent));
|
||||
}
|
||||
|
||||
private checkFormatFile(file): boolean {
|
||||
|
@ -88,7 +88,7 @@ export class ImportExportComponent implements OnInit {
|
|||
default:
|
||||
file.value = '';
|
||||
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;
|
||||
}
|
||||
|
@ -100,7 +100,6 @@ export class ImportExportComponent implements OnInit {
|
|||
}
|
||||
|
||||
private onReadyStateChangeHandler(event) {
|
||||
|
||||
if (event.readyState === 4 && event.status >= 400) {
|
||||
let title;
|
||||
if (event.status === 401) {
|
||||
|
@ -110,10 +109,9 @@ export class ImportExportComponent implements OnInit {
|
|||
} else if (event.status === 409) {
|
||||
title = 'Import was not successful, operation has some conflicts.';
|
||||
} 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);
|
||||
|
||||
} else if (event.readyState === 4 && event.status === 200) {
|
||||
this.alertService.triggerAlert(new AlertModel(AlertType.SUCCESS, 'Import was successful'));
|
||||
this.importExportService.setImportingFinished(true);
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { AngularSvgIconModule } from 'angular-svg-icon';
|
||||
import { HttpClientModule } from '@angular/common/http';
|
||||
import { IconTypeComponent } from './icon-type.component';
|
||||
import { configureTests } from 'app/app.test.configuration';
|
||||
import { IconTypeComponent } from './icon-type.component';
|
||||
|
||||
describe('IconTypeComponent', () => {
|
||||
let component: IconTypeComponent;
|
||||
|
@ -13,7 +13,7 @@ describe('IconTypeComponent', () => {
|
|||
const configure = (testBed: TestBed) => {
|
||||
testBed.configureTestingModule({
|
||||
imports: [AngularSvgIconModule, HttpClientModule]
|
||||
})
|
||||
});
|
||||
};
|
||||
configureTests(configure).then(testBed => {
|
||||
fixture = TestBed.createComponent(IconTypeComponent);
|
||||
|
|
|
@ -7,8 +7,6 @@ import { ICONTYPES } from 'app/models/type';
|
|||
styleUrls: ['./icon-type.component.scss']
|
||||
})
|
||||
export class IconTypeComponent implements OnInit {
|
||||
|
||||
|
||||
@Input()
|
||||
type: ICONTYPES = ICONTYPES.ALL;
|
||||
|
||||
|
@ -22,8 +20,8 @@ export class IconTypeComponent implements OnInit {
|
|||
text: 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() { }
|
||||
|
||||
|
@ -32,10 +30,9 @@ export class IconTypeComponent implements OnInit {
|
|||
}
|
||||
|
||||
getIconPath(type: string) {
|
||||
return type === 'PERSONAL' ? 'user.svg' :
|
||||
type === 'GROUP' ? 'users.svg' :
|
||||
type === 'TOPIC' ? 'topic.svg' :
|
||||
type === 'CLEARANCE' ? 'clearance.svg' : 'asterisk.svg';
|
||||
|
||||
return type === 'PERSONAL' ? 'user.svg'
|
||||
: type === 'GROUP' ? 'users.svg'
|
||||
: type === 'TOPIC' ? 'topic.svg'
|
||||
: type === 'CLEARANCE' ? 'clearance.svg' : 'asterisk.svg';
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,14 +7,13 @@ import { BlobGenerator } from 'app/shared/util/blob-generator';
|
|||
|
||||
@Injectable()
|
||||
export class ClassificationDefinitionService {
|
||||
|
||||
url = environment.taskanaRestUrl + '/v1/classification-definitions';
|
||||
url = `${environment.taskanaRestUrl}/v1/classification-definitions`;
|
||||
constructor(private httpClient: HttpClient) { }
|
||||
|
||||
// GET
|
||||
async exportClassifications(domain: string) {
|
||||
domain = (domain === '' ? '' : '?domain=' + domain);
|
||||
domain = (domain === '' ? '' : `?domain=${domain}`);
|
||||
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`);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,7 +3,6 @@ import { Subject, Observable } from 'rxjs';
|
|||
|
||||
@Injectable()
|
||||
export class ImportExportService {
|
||||
|
||||
public importingFinished = new Subject<boolean>();
|
||||
|
||||
constructor() { }
|
||||
|
@ -15,5 +14,4 @@ export class ImportExportService {
|
|||
getImportingFinished(): Observable<boolean> {
|
||||
return this.importingFinished.asObservable();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { Injectable } from '@angular/core';
|
||||
import { Subject , Observable } from 'rxjs';
|
||||
import { Subject, Observable } from 'rxjs';
|
||||
|
||||
export class SavingInformation {
|
||||
constructor(public url: string,
|
||||
|
@ -10,7 +10,6 @@ export class SavingInformation {
|
|||
|
||||
@Injectable()
|
||||
export class SavingWorkbasketService {
|
||||
|
||||
public distributionTargetsSavingInformation = new Subject<SavingInformation>();
|
||||
public accessItemsSavingInformation = new Subject<SavingInformation>();
|
||||
|
||||
|
@ -19,12 +18,15 @@ export class SavingWorkbasketService {
|
|||
triggerDistributionTargetSaving(distributionTargetInformation: SavingInformation) {
|
||||
this.distributionTargetsSavingInformation.next(distributionTargetInformation);
|
||||
}
|
||||
|
||||
triggerAccessItemsSaving(accessItemsInformation: SavingInformation) {
|
||||
this.accessItemsSavingInformation.next(accessItemsInformation);
|
||||
}
|
||||
|
||||
triggeredDistributionTargetsSaving(): Observable<SavingInformation> {
|
||||
return this.distributionTargetsSavingInformation.asObservable();
|
||||
}
|
||||
|
||||
triggeredAccessItemsSaving(): Observable<SavingInformation> {
|
||||
return this.accessItemsSavingInformation.asObservable();
|
||||
}
|
||||
|
|
|
@ -7,14 +7,14 @@ import { BlobGenerator } from 'app/shared/util/blob-generator';
|
|||
|
||||
@Injectable()
|
||||
export class WorkbasketDefinitionService {
|
||||
url: string = environment.taskanaRestUrl + '/v1/workbasket-definitions';
|
||||
url: string = `${environment.taskanaRestUrl}/v1/workbasket-definitions`;
|
||||
|
||||
constructor(private httpClient: HttpClient) { }
|
||||
|
||||
// GET
|
||||
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();
|
||||
BlobGenerator.saveFile(workbasketDefinitions, 'Workbaskets_' + TaskanaDate.getDate() + '.json')
|
||||
BlobGenerator.saveFile(workbasketDefinitions, `Workbaskets_${TaskanaDate.getDate()}.json`);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,7 +13,6 @@ import { WorkbasketAccessItems } from 'app/models/workbasket-access-items';
|
|||
import { WorkbasketAccessItemsResource } from 'app/models/workbasket-access-items-resource';
|
||||
import { ICONTYPES } from 'app/models/type';
|
||||
|
||||
import { AccessItemsComponent } from './access-items.component';
|
||||
|
||||
import { GeneralModalService } from 'app/services/general-modal/general-modal.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 { AccessIdsService } from 'app/shared/services/access-ids/access-ids.service';
|
||||
import { FormsValidatorService } from 'app/shared/services/forms/forms-validator.service';
|
||||
import { AccessItemsComponent } from './access-items.component';
|
||||
|
||||
describe('AccessItemsComponent', () => {
|
||||
let component: AccessItemsComponent;
|
||||
let fixture: ComponentFixture<AccessItemsComponent>;
|
||||
let workbasketService, debugElement, alertService, accessIdsService, formsValidatorService;
|
||||
let workbasketService; let debugElement; let alertService; let accessIdsService; let
|
||||
formsValidatorService;
|
||||
|
||||
|
||||
beforeEach(done => {
|
||||
|
@ -37,15 +38,15 @@ describe('AccessItemsComponent', () => {
|
|||
imports: [FormsModule, AngularSvgIconModule, HttpClientModule, ReactiveFormsModule],
|
||||
providers: [WorkbasketService, AlertService, GeneralModalService, SavingWorkbasketService, RequestInProgressService,
|
||||
CustomFieldsService, AccessIdsService, FormsValidatorService]
|
||||
})
|
||||
});
|
||||
};
|
||||
configureTests(configure).then(testBed => {
|
||||
fixture = TestBed.createComponent(AccessItemsComponent);
|
||||
component = fixture.componentInstance;
|
||||
component.workbasket = new Workbasket('1');
|
||||
component.workbasket.type = ICONTYPES.TOPIC;
|
||||
component.workbasket._links = new Links()
|
||||
component.workbasket._links.accessItems = { 'href': 'someurl' };
|
||||
component.workbasket._links = new Links();
|
||||
component.workbasket._links.accessItems = { href: 'someurl' };
|
||||
|
||||
workbasketService = TestBed.get(WorkbasketService);
|
||||
alertService = TestBed.get(AlertService);
|
||||
|
@ -53,8 +54,9 @@ describe('AccessItemsComponent', () => {
|
|||
new Array<WorkbasketAccessItems>(
|
||||
new WorkbasketAccessItems('id1', '1', 'accessID1', '', false, false, false, false, false, false, false, false,
|
||||
false, false, false, false, false, false, false, false, false),
|
||||
new WorkbasketAccessItems('id2', '1', 'accessID2'))
|
||||
, new Links({ 'href': 'someurl' })
|
||||
new WorkbasketAccessItems('id2', '1', 'accessID2')
|
||||
),
|
||||
new Links({ href: 'someurl' })
|
||||
)));
|
||||
spyOn(workbasketService, 'updateWorkBasketAccessItem').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', () => {
|
||||
expect(debugElement.querySelectorAll('#table-access-items > tbody > tr').length).toBe(2);
|
||||
|
||||
});
|
||||
|
||||
it('should remove an access item if remove button is clicked', () => {
|
||||
|
@ -101,8 +102,9 @@ describe('AccessItemsComponent', () => {
|
|||
fixture.whenStable().then(() => {
|
||||
fixture.detectChanges();
|
||||
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();
|
||||
}));
|
||||
|
||||
|
@ -112,7 +114,5 @@ describe('AccessItemsComponent', () => {
|
|||
expect(component.accessItemsClone.length).toBe(1);
|
||||
component.clear();
|
||||
expect(component.accessItemsClone.length).toBe(2);
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
|
|
@ -26,13 +26,15 @@ import { AccessIdDefinition } from 'app/models/access-id';
|
|||
styleUrls: ['./access-items.component.scss']
|
||||
})
|
||||
export class AccessItemsComponent implements OnChanges, OnDestroy {
|
||||
|
||||
@Input()
|
||||
workbasket: Workbasket;
|
||||
|
||||
@Input()
|
||||
action: string;
|
||||
|
||||
@Input()
|
||||
active: string;
|
||||
|
||||
badgeMessage = '';
|
||||
|
||||
accessIdField = this.customFieldsService.getCustomField('Owner', 'workbaskets.access-items.accessId');
|
||||
|
@ -61,21 +63,22 @@ export class AccessItemsComponent implements OnChanges, OnDestroy {
|
|||
accessItemsGroups: this.formBuilder.array([
|
||||
])
|
||||
});
|
||||
|
||||
toogleValidationAccessIdMap = new Map<number, boolean>();
|
||||
private initialized = false;
|
||||
|
||||
setAccessItemsGroups(accessItems: Array<WorkbasketAccessItems>) {
|
||||
const AccessItemsFormGroups = accessItems.map(accessItem => this.formBuilder.group(accessItem));
|
||||
AccessItemsFormGroups.map(accessItemGroup => {
|
||||
accessItemGroup.controls['accessId'].setValidators(Validators.required);
|
||||
accessItemGroup.controls.accessId.setValidators(Validators.required);
|
||||
});
|
||||
const AccessItemsFormArray = this.formBuilder.array(AccessItemsFormGroups);
|
||||
this.AccessItemsForm.setControl('accessItemsGroups', AccessItemsFormArray);
|
||||
};
|
||||
}
|
||||
|
||||
get accessItemsGroups(): FormArray {
|
||||
return this.AccessItemsForm.get('accessItemsGroups') as FormArray;
|
||||
};
|
||||
}
|
||||
|
||||
constructor(
|
||||
private workbasketService: WorkbasketService,
|
||||
|
@ -85,7 +88,8 @@ export class AccessItemsComponent implements OnChanges, OnDestroy {
|
|||
private requestInProgressService: RequestInProgressService,
|
||||
private customFieldsService: CustomFieldsService,
|
||||
private formBuilder: FormBuilder,
|
||||
private formsValidatorService: FormsValidatorService) {
|
||||
private formsValidatorService: FormsValidatorService
|
||||
) {
|
||||
}
|
||||
|
||||
ngOnChanges(changes: SimpleChanges): void {
|
||||
|
@ -110,7 +114,7 @@ export class AccessItemsComponent implements OnChanges, OnDestroy {
|
|||
this.accessItemsClone = this.cloneAccessItems(accessItemsResource.accessItems);
|
||||
this.accessItemsResetClone = this.cloneAccessItems(accessItemsResource.accessItems);
|
||||
this.requestInProgress = false;
|
||||
})
|
||||
});
|
||||
this.savingAccessItemsSubscription = this.savingWorkbaskets.triggeredAccessItemsSaving()
|
||||
.subscribe((savingInformation: SavingInformation) => {
|
||||
if (this.action === ACTION.COPY) {
|
||||
|
@ -118,8 +122,7 @@ export class AccessItemsComponent implements OnChanges, OnDestroy {
|
|||
this.setWorkbasketIdForCopy(savingInformation.workbasketId);
|
||||
this.onSave();
|
||||
}
|
||||
})
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
addAccessItem() {
|
||||
|
@ -127,7 +130,7 @@ export class AccessItemsComponent implements OnChanges, OnDestroy {
|
|||
workbasketAccessItems.workbasketId = this.workbasket.workbasketId;
|
||||
workbasketAccessItems.permRead = true;
|
||||
const newForm = this.formBuilder.group(workbasketAccessItems);
|
||||
newForm.controls['accessId'].setValidators(Validators.required);
|
||||
newForm.controls.accessId.setValidators(Validators.required);
|
||||
this.accessItemsGroups.push(newForm);
|
||||
this.accessItemsClone.push(workbasketAccessItems);
|
||||
}
|
||||
|
@ -137,7 +140,7 @@ export class AccessItemsComponent implements OnChanges, OnDestroy {
|
|||
this.AccessItemsForm.reset();
|
||||
this.setAccessItemsGroups(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) {
|
||||
|
@ -176,17 +179,19 @@ export class AccessItemsComponent implements OnChanges, OnDestroy {
|
|||
private onSave() {
|
||||
this.requestInProgressService.setRequestInProgress(true);
|
||||
this.workbasketService.updateWorkBasketAccessItem(
|
||||
this.accessItemsResource._links.self.href, this.AccessItemsForm.value.accessItemsGroups)
|
||||
this.accessItemsResource._links.self.href, this.AccessItemsForm.value.accessItemsGroups
|
||||
)
|
||||
.subscribe(response => {
|
||||
this.accessItemsClone = this.cloneAccessItems(this.AccessItemsForm.value.accessItemsGroups);
|
||||
this.accessItemsResetClone = this.cloneAccessItems(this.AccessItemsForm.value.accessItemsGroups);
|
||||
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);
|
||||
}, 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);
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
private setBadge() {
|
||||
|
@ -197,9 +202,10 @@ export class AccessItemsComponent implements OnChanges, OnDestroy {
|
|||
|
||||
private cloneAccessItems(inputaccessItem): Array<WorkbasketAccessItems> {
|
||||
return this.AccessItemsForm.value.accessItemsGroups.map(
|
||||
(accessItems: WorkbasketAccessItems) => Object.assign({}, accessItems)
|
||||
(accessItems: WorkbasketAccessItems) => ({ ...accessItems })
|
||||
);
|
||||
}
|
||||
|
||||
private setWorkbasketIdForCopy(workbasketId: string) {
|
||||
this.accessItemsGroups.value.forEach(element => {
|
||||
delete element.accessItemId;
|
||||
|
|
|
@ -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 { 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 { configureTests } from 'app/app.test.configuration';
|
||||
import { InfiniteScrollModule } from 'ngx-infinite-scroll';
|
||||
import { DistributionTargetsComponent, Side } from './distribution-targets.component';
|
||||
import { DualListComponent } from './dual-list/dual-list.component';
|
||||
|
||||
describe('DistributionTargetsComponent', () => {
|
||||
let component: DistributionTargetsComponent;
|
||||
let fixture: ComponentFixture<DistributionTargetsComponent>;
|
||||
let workbasketService;
|
||||
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 => {
|
||||
const configure = (testBed: TestBed) => {
|
||||
|
@ -38,27 +38,27 @@ describe('DistributionTargetsComponent', () => {
|
|||
declarations: [DistributionTargetsComponent, DualListComponent],
|
||||
providers: [WorkbasketService, AlertService, SavingWorkbasketService, GeneralModalService, RequestInProgressService,
|
||||
]
|
||||
})
|
||||
});
|
||||
};
|
||||
configureTests(configure).then(testBed => {
|
||||
fixture = TestBed.createComponent(DistributionTargetsComponent);
|
||||
component = fixture.componentInstance;
|
||||
component.workbasket = workbasket;
|
||||
workbasketService = TestBed.get(WorkbasketService);
|
||||
spyOn(workbasketService, 'getWorkBasketsSummary').and.callFake(() => {
|
||||
return of(new WorkbasketSummaryResource(
|
||||
spyOn(workbasketService, 'getWorkBasketsSummary').and.callFake(() => of(new WorkbasketSummaryResource(
|
||||
new Array<WorkbasketSummary>(
|
||||
new WorkbasketSummary('id1', '', '', '', '', '', '', '', '', '', '', '', false, new Links({ 'href': 'someurl' })),
|
||||
new WorkbasketSummary('id2', '', '', '', '', '', '', '', '', '', '', '', false, new Links({ 'href': 'someurl' })),
|
||||
new WorkbasketSummary('id3', '', '', '', '', '', '', '', '', '', '', '', false, new Links({ 'href': 'someurl' })))
|
||||
, new LinksWorkbasketSummary({ 'href': 'someurl' })))
|
||||
})
|
||||
spyOn(workbasketService, 'getWorkBasketsDistributionTargets').and.callFake(() => {
|
||||
return of(new WorkbasketDistributionTargetsResource(
|
||||
new WorkbasketSummary('id1', '', '', '', '', '', '', '', '', '', '', '', false, new Links({ href: 'someurl' })),
|
||||
new WorkbasketSummary('id2', '', '', '', '', '', '', '', '', '', '', '', false, new Links({ href: 'someurl' })),
|
||||
new WorkbasketSummary('id3', '', '', '', '', '', '', '', '', '', '', '', false, new Links({ href: 'someurl' }))
|
||||
),
|
||||
new LinksWorkbasketSummary({ href: 'someurl' })
|
||||
)));
|
||||
spyOn(workbasketService, 'getWorkBasketsDistributionTargets').and.callFake(() => of(new WorkbasketDistributionTargetsResource(
|
||||
new Array<WorkbasketSummary>(
|
||||
new WorkbasketSummary('id2', '', '', '', '', '', '', '', '', '', '', '', false, new Links({ 'href': 'someurl' })))
|
||||
, new LinksWorkbasketSummary({ 'href': 'someurl' })))
|
||||
})
|
||||
new WorkbasketSummary('id2', '', '', '', '', '', '', '', '', '', '', '', false, new Links({ href: 'someurl' }))
|
||||
),
|
||||
new LinksWorkbasketSummary({ href: 'someurl' })
|
||||
)));
|
||||
component.ngOnChanges({
|
||||
active: new SimpleChange(undefined, 'distributionTargets', true)
|
||||
});
|
||||
|
@ -86,9 +86,9 @@ describe('DistributionTargetsComponent', () => {
|
|||
expect(component.distributionTargetsRight.length).toBe(1);
|
||||
component.distributionTargetsLeft.forEach(leftElement => {
|
||||
component.distributionTargetsRight.forEach(rightElement => {
|
||||
if (leftElement.workbasketId === rightElement.workbasketId) { repeteadElemens = true };
|
||||
})
|
||||
})
|
||||
if (leftElement.workbasketId === rightElement.workbasketId) { repeteadElemens = true; }
|
||||
});
|
||||
});
|
||||
expect(repeteadElemens).toBeFalsy();
|
||||
});
|
||||
|
||||
|
@ -96,11 +96,12 @@ describe('DistributionTargetsComponent', () => {
|
|||
component.performFilter({
|
||||
filterBy: new FilterModel({
|
||||
name: 'someName', owner: 'someOwner', description: 'someDescription', key: 'someKey'
|
||||
}), side: Side.LEFT
|
||||
}),
|
||||
side: Side.LEFT
|
||||
});
|
||||
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[0].workbasketId).toBe('id1');
|
||||
expect(component.distributionTargetsRight.length).toBe(1);
|
||||
|
@ -109,9 +110,11 @@ describe('DistributionTargetsComponent', () => {
|
|||
|
||||
it('should reset distribution target and distribution target selected on reset', () => {
|
||||
component.distributionTargetsLeft.push(
|
||||
new WorkbasketSummary('id4', '', '', '', '', '', '', '', '', '', '', '', false, new Links({ 'href': 'someurl' })));
|
||||
new WorkbasketSummary('id4', '', '', '', '', '', '', '', '', '', '', '', false, new Links({ href: 'someurl' }))
|
||||
);
|
||||
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.distributionTargetsRight.length).toBe(2);
|
||||
|
@ -119,24 +122,23 @@ describe('DistributionTargetsComponent', () => {
|
|||
component.onClear();
|
||||
fixture.detectChanges();
|
||||
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.', () => {
|
||||
expect(component.distributionTargetsSelected.length).toBe(1);
|
||||
expect(component.distributionTargetsSelectedClone.length).toBe(1);
|
||||
spyOn(workbasketService, 'updateWorkBasketsDistributionTargets').and.callFake(() => {
|
||||
return of(new WorkbasketDistributionTargetsResource(
|
||||
spyOn(workbasketService, 'updateWorkBasketsDistributionTargets').and.callFake(() => of(new WorkbasketDistributionTargetsResource(
|
||||
new Array<WorkbasketSummary>(
|
||||
new WorkbasketSummary('id2', '', '', '', '', '', '', '', '', '', '', '', false, new Links({ 'href': 'someurl' })),
|
||||
new WorkbasketSummary('id1', '', '', '', '', '', '', '', '', '', '', '', false, new Links({ 'href': 'someurl' })))
|
||||
, new LinksWorkbasketSummary({ 'href': 'someurl' })))
|
||||
})
|
||||
new WorkbasketSummary('id2', '', '', '', '', '', '', '', '', '', '', '', false, new Links({ href: 'someurl' })),
|
||||
new WorkbasketSummary('id1', '', '', '', '', '', '', '', '', '', '', '', false, new Links({ href: 'someurl' }))
|
||||
),
|
||||
new LinksWorkbasketSummary({ href: 'someurl' })
|
||||
)));
|
||||
component.onSave();
|
||||
fixture.detectChanges();
|
||||
expect(component.distributionTargetsSelected.length).toBe(2);
|
||||
expect(component.distributionTargetsSelectedClone.length).toBe(2);
|
||||
expect(component.distributionTargetsLeft.length).toBe(1);
|
||||
|
||||
});
|
||||
});
|
||||
|
|
|
@ -29,13 +29,15 @@ export enum Side {
|
|||
styleUrls: ['./distribution-targets.component.scss']
|
||||
})
|
||||
export class DistributionTargetsComponent implements OnChanges, OnDestroy {
|
||||
|
||||
@Input()
|
||||
workbasket: Workbasket;
|
||||
|
||||
@Input()
|
||||
action: string;
|
||||
|
||||
@Input()
|
||||
active: string;
|
||||
|
||||
badgeMessage = '';
|
||||
|
||||
distributionTargetsSubscription: Subscription;
|
||||
|
@ -71,7 +73,8 @@ export class DistributionTargetsComponent implements OnChanges, OnDestroy {
|
|||
private savingWorkbaskets: SavingWorkbasketService,
|
||||
private generalModalService: GeneralModalService,
|
||||
private requestInProgressService: RequestInProgressService,
|
||||
private orientationService: OrientationService) { }
|
||||
private orientationService: OrientationService
|
||||
) { }
|
||||
|
||||
ngOnChanges(changes: SimpleChanges): void {
|
||||
if (!this.initialized && changes.active && changes.active.currentValue === 'distributionTargets') {
|
||||
|
@ -81,6 +84,7 @@ export class DistributionTargetsComponent implements OnChanges, OnDestroy {
|
|||
this.setBadge();
|
||||
}
|
||||
}
|
||||
|
||||
onScroll(side: Side) {
|
||||
if (side === this.side.LEFT && this.page.totalPages > TaskanaQueryParameters.page) {
|
||||
this.loadingItems = true;
|
||||
|
@ -111,7 +115,8 @@ export class DistributionTargetsComponent implements OnChanges, OnDestroy {
|
|||
onSave() {
|
||||
this.requestInProgressService.setRequestInProgress(true);
|
||||
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.distributionTargetsSelected = response.distributionTargets;
|
||||
this.distributionTargetsSelectedClone = Object.assign([], this.distributionTargetsSelected);
|
||||
|
@ -122,14 +127,12 @@ export class DistributionTargetsComponent implements OnChanges, OnDestroy {
|
|||
},
|
||||
error => {
|
||||
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);
|
||||
return false;
|
||||
}
|
||||
);
|
||||
});
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
onClear() {
|
||||
|
@ -146,9 +149,9 @@ export class DistributionTargetsComponent implements OnChanges, OnDestroy {
|
|||
dualListFilter.filterBy.filterParams.name, dualListFilter.filterBy.filterParams.description, '',
|
||||
dualListFilter.filterBy.filterParams.owner, dualListFilter.filterBy.filterParams.type, '',
|
||||
dualListFilter.filterBy.filterParams.key, '', true).subscribe(resultList => {
|
||||
(dualListFilter.side === Side.RIGHT) ?
|
||||
this.distributionTargetsRight = (resultList.workbaskets) :
|
||||
this.distributionTargetsLeft = (resultList.workbaskets);
|
||||
(dualListFilter.side === Side.RIGHT)
|
||||
? this.distributionTargetsRight = (resultList.workbaskets)
|
||||
: this.distributionTargetsLeft = (resultList.workbaskets);
|
||||
this.onRequest(true, dualListFilter.side);
|
||||
});
|
||||
}
|
||||
|
@ -167,7 +170,8 @@ export class DistributionTargetsComponent implements OnChanges, OnDestroy {
|
|||
return;
|
||||
}
|
||||
this.distributionTargetsSubscription = this.workbasketService.getWorkBasketsDistributionTargets(
|
||||
this.workbasket._links.distributionTargets.href).subscribe(
|
||||
this.workbasket._links.distributionTargets.href
|
||||
).subscribe(
|
||||
(distributionTargetsSelectedResource: WorkbasketDistributionTargetsResource) => {
|
||||
this.distributionTargetsSelectedResource = distributionTargetsSelectedResource;
|
||||
this.distributionTargetsSelected = distributionTargetsSelectedResource.distributionTargets;
|
||||
|
@ -175,7 +179,8 @@ export class DistributionTargetsComponent implements OnChanges, OnDestroy {
|
|||
TaskanaQueryParameters.page = 1;
|
||||
this.calculateNumberItemsList();
|
||||
this.getWorkbaskets();
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
this.savingDistributionTargetsSubscription = this.savingWorkbaskets.triggeredDistributionTargetsSaving()
|
||||
.subscribe((savingInformation: SavingInformation) => {
|
||||
|
@ -199,7 +204,7 @@ export class DistributionTargetsComponent implements OnChanges, OnDestroy {
|
|||
}
|
||||
|
||||
private getNextPage(side: Side) {
|
||||
TaskanaQueryParameters.page = TaskanaQueryParameters.page + 1;
|
||||
TaskanaQueryParameters.page += 1;
|
||||
this.getWorkbaskets(side);
|
||||
}
|
||||
|
||||
|
@ -232,7 +237,8 @@ export class DistributionTargetsComponent implements OnChanges, OnDestroy {
|
|||
this.distributionTargetsClone = Object.assign([], distributionTargetsAvailable.workbaskets);
|
||||
}
|
||||
this.onRequest(true);
|
||||
});
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
private setBadge() {
|
||||
|
@ -259,12 +265,12 @@ export class DistributionTargetsComponent implements OnChanges, OnDestroy {
|
|||
this.loadingItems = false;
|
||||
}
|
||||
if (finished) {
|
||||
typeof side === 'undefined' ? (this.requestInProgressLeft = false, this.requestInProgressRight = false) :
|
||||
side === Side.LEFT ? this.requestInProgressLeft = false : this.requestInProgressRight = false;
|
||||
typeof side === 'undefined' ? (this.requestInProgressLeft = false, this.requestInProgressRight = false)
|
||||
: side === Side.LEFT ? this.requestInProgressLeft = false : this.requestInProgressRight = false;
|
||||
return;
|
||||
}
|
||||
typeof side === 'undefined' ? (this.requestInProgressLeft = true, this.requestInProgressRight = true) :
|
||||
side === Side.LEFT ? this.requestInProgressLeft = true : this.requestInProgressRight = true;
|
||||
typeof side === 'undefined' ? (this.requestInProgressLeft = true, this.requestInProgressRight = true)
|
||||
: side === Side.LEFT ? this.requestInProgressLeft = true : this.requestInProgressRight = true;
|
||||
}
|
||||
|
||||
private getSeletedIds(): Array<string> {
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core';
|
||||
import { WorkbasketSummary } from 'app/models/workbasket-summary';
|
||||
import { FilterModel } from 'app/models/filter';
|
||||
import { Side } from '../distribution-targets.component';
|
||||
import { expandDown } from 'app/shared/animations/expand.animation';
|
||||
import { Side } from '../distribution-targets.component';
|
||||
|
||||
@Component({
|
||||
selector: 'taskana-dual-list',
|
||||
|
@ -11,7 +11,6 @@ import { expandDown } from 'app/shared/animations/expand.animation';
|
|||
animations: [expandDown]
|
||||
})
|
||||
export class DualListComponent implements OnInit {
|
||||
|
||||
@Input() distributionTargets: Array<WorkbasketSummary>;
|
||||
@Input() distributionTargetsSelected: Array<WorkbasketSummary>;
|
||||
@Output() performDualListFilter = new EventEmitter<{ filterBy: FilterModel, side: Side }>();
|
||||
|
@ -48,5 +47,4 @@ export class DualListComponent implements OnInit {
|
|||
changeToolbarState(state: boolean) {
|
||||
this.toolbarState = state;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { WorkbasketService } from 'app/shared/services/workbasket/workbasket.service';
|
||||
import { WorkbasketInformationComponent } from './workbasket-information.component';
|
||||
import { FormsModule } from '@angular/forms';
|
||||
import { AngularSvgIconModule } from 'angular-svg-icon';
|
||||
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 { configureTests } from 'app/app.test.configuration';
|
||||
import { FormsValidatorService } from 'app/shared/services/forms/forms-validator.service';
|
||||
import { WorkbasketInformationComponent } from './workbasket-information.component';
|
||||
|
||||
@Component({
|
||||
selector: 'taskana-dummy-detail',
|
||||
|
@ -37,7 +37,8 @@ const routes: Routes = [
|
|||
describe('WorkbasketInformationComponent', () => {
|
||||
let component: 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 => {
|
||||
const configure = (testBed: TestBed) => {
|
||||
|
@ -50,7 +51,7 @@ describe('WorkbasketInformationComponent', () => {
|
|||
providers: [WorkbasketService, AlertService, SavingWorkbasketService, GeneralModalService, RequestInProgressService,
|
||||
CustomFieldsService, FormsValidatorService]
|
||||
|
||||
})
|
||||
});
|
||||
};
|
||||
configureTests(configure).then(testBed => {
|
||||
fixture = TestBed.createComponent(WorkbasketInformationComponent);
|
||||
|
@ -88,7 +89,6 @@ describe('WorkbasketInformationComponent', () => {
|
|||
fixture.whenStable().then(() => {
|
||||
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', () => {
|
||||
|
@ -112,19 +112,18 @@ describe('WorkbasketInformationComponent', () => {
|
|||
it('should reset requestInProgress after saving request is done', () => {
|
||||
component.workbasket = new Workbasket('id', 'created', 'keyModified', 'domain', ICONTYPES.TOPIC, 'modified', 'name', 'description',
|
||||
'owner', 'custom1', 'custom2', 'custom3', 'custom4', 'orgLevel1', 'orgLevel2',
|
||||
'orgLevel3', 'orgLevel4', new Links({ 'href': 'someUrl' }));
|
||||
'orgLevel3', 'orgLevel4', new Links({ href: 'someUrl' }));
|
||||
fixture.detectChanges();
|
||||
spyOn(workbasketService, 'updateWorkbasket').and.returnValue(of(component.workbasket));
|
||||
spyOn(workbasketService, 'triggerWorkBasketSaved').and.returnValue(of(component.workbasket));
|
||||
component.onSubmit();
|
||||
expect(component.requestInProgress).toBeFalsy();
|
||||
|
||||
});
|
||||
|
||||
it('should trigger triggerWorkBasketSaved method after saving request is done', async(() => {
|
||||
component.workbasket = new Workbasket('id', 'created', 'keyModified', 'domain', ICONTYPES.TOPIC, 'modified', 'name', 'description',
|
||||
'owner', 'custom1', 'custom2', 'custom3', 'custom4', 'orgLevel1', 'orgLevel2',
|
||||
'orgLevel3', 'orgLevel4', new Links({ 'href': 'someUrl' }));
|
||||
'orgLevel3', 'orgLevel4', new Links({ href: 'someUrl' }));
|
||||
spyOn(workbasketService, 'updateWorkbasket').and.returnValue(of(component.workbasket));
|
||||
spyOn(workbasketService, 'triggerWorkBasketSaved').and.returnValue(of(component.workbasket));
|
||||
fixture.detectChanges();
|
||||
|
@ -134,18 +133,19 @@ describe('WorkbasketInformationComponent', () => {
|
|||
fixture.whenStable().then(() => {
|
||||
fixture.detectChanges();
|
||||
expect(workbasketService.triggerWorkBasketSaved).toHaveBeenCalled();
|
||||
})
|
||||
});
|
||||
}));
|
||||
|
||||
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',
|
||||
'owner', 'custom1', 'custom2', 'custom3', 'custom4', 'orgLevel1', 'orgLevel2',
|
||||
'orgLevel3', 'orgLevel4', new Links({ 'href': 'someUrl' }));
|
||||
component.workbasket = workbasket
|
||||
'orgLevel3', 'orgLevel4', new Links({ href: 'someUrl' }));
|
||||
component.workbasket = workbasket;
|
||||
spyOn(workbasketService, 'createWorkbasket').and.returnValue(of(
|
||||
new Workbasket('someNewId', 'created', 'keyModified', 'domain', ICONTYPES.TOPIC, 'modified', 'name', 'description',
|
||||
'owner', 'custom1', 'custom2', 'custom3', 'custom4', 'orgLevel1', 'orgLevel2',
|
||||
'orgLevel3', 'orgLevel4', new Links({ 'href': 'someUrl' }))));
|
||||
'orgLevel3', 'orgLevel4', new Links({ href: 'someUrl' }))
|
||||
));
|
||||
fixture.detectChanges();
|
||||
spyOn(formsValidatorService, 'validateFormAccess').and.returnValue(Promise.resolve(true));
|
||||
component.onSubmit();
|
||||
|
@ -153,22 +153,23 @@ describe('WorkbasketInformationComponent', () => {
|
|||
fixture.detectChanges();
|
||||
expect(alertService.triggerAlert).toHaveBeenCalled();
|
||||
expect(component.workbasket.workbasketId).toBe('someNewId');
|
||||
})
|
||||
});
|
||||
}));
|
||||
|
||||
it('should post a new workbasket, new distribution targets and new access ' +
|
||||
'items when no workbasketId is defined and action is copy', async(() => {
|
||||
it('should post a new workbasket, new distribution targets and new access '
|
||||
+ 'items when no workbasketId is defined and action is copy', async(() => {
|
||||
const workbasket = new Workbasket(undefined, 'created', 'keyModified', 'domain', ICONTYPES.TOPIC,
|
||||
'modified', 'name', 'description', 'owner', 'custom1', 'custom2',
|
||||
'custom3', 'custom4', 'orgLevel1', 'orgLevel2',
|
||||
'orgLevel3', 'orgLevel4', new Links({ 'href': 'someUrl' }));
|
||||
component.workbasket = workbasket
|
||||
'orgLevel3', 'orgLevel4', new Links({ href: 'someUrl' }));
|
||||
component.workbasket = workbasket;
|
||||
component.action = ACTION.COPY;
|
||||
|
||||
spyOn(workbasketService, 'createWorkbasket').and.returnValue(of(
|
||||
new Workbasket('someNewId', 'created', 'keyModified', 'domain', ICONTYPES.TOPIC, 'modified', 'name', 'description',
|
||||
'owner', 'custom1', 'custom2', 'custom3', 'custom4', 'orgLevel1', 'orgLevel2',
|
||||
'orgLevel3', 'orgLevel4', new Links({ 'href': 'someUrl' }, { 'href': 'someUrl' }, { 'href': 'someUrl' }))));
|
||||
'orgLevel3', 'orgLevel4', new Links({ href: 'someUrl' }, { href: 'someUrl' }, { href: 'someUrl' }))
|
||||
));
|
||||
|
||||
spyOn(savingWorkbasketService, 'triggerDistributionTargetSaving');
|
||||
spyOn(savingWorkbasketService, 'triggerAccessItemsSaving');
|
||||
|
@ -181,12 +182,12 @@ describe('WorkbasketInformationComponent', () => {
|
|||
expect(component.workbasket.workbasketId).toBe('someNewId');
|
||||
expect(savingWorkbasketService.triggerDistributionTargetSaving).toHaveBeenCalled();
|
||||
expect(savingWorkbasketService.triggerAccessItemsSaving).toHaveBeenCalled();
|
||||
})
|
||||
});
|
||||
}));
|
||||
|
||||
it('should trigger requestInProgress service true before and requestInProgress false after remove a workbasket', () => {
|
||||
const links = new Links({ 'href': 'someUrl' });
|
||||
links.removeDistributionTargets = { 'href': 'someUrl' };
|
||||
const links = new Links({ href: 'someUrl' });
|
||||
links.removeDistributionTargets = { href: 'someUrl' };
|
||||
const workbasket = new Workbasket(undefined, 'created', 'keyModified', 'domain', ICONTYPES.TOPIC,
|
||||
'modified', 'name', 'description', 'owner', 'custom1', 'custom2',
|
||||
'custom3', 'custom4', 'orgLevel1', 'orgLevel2',
|
||||
|
@ -202,6 +203,5 @@ describe('WorkbasketInformationComponent', () => {
|
|||
}, error => { }, complete => {
|
||||
expect(requestInProgressServiceSpy).toHaveBeenCalledWith(false);
|
||||
});
|
||||
})
|
||||
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,12 +1,10 @@
|
|||
import {
|
||||
Component,
|
||||
import { Component,
|
||||
OnInit,
|
||||
Input,
|
||||
OnDestroy,
|
||||
OnChanges,
|
||||
SimpleChanges,
|
||||
ViewChild
|
||||
} from '@angular/core';
|
||||
ViewChild } from '@angular/core';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { Subscription } from 'rxjs';
|
||||
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 { GeneralModalService } from 'app/services/general-modal/general-modal.service';
|
||||
import {
|
||||
SavingWorkbasketService,
|
||||
SavingInformation
|
||||
} from 'app/administration/services/saving-workbaskets/saving-workbaskets.service';
|
||||
import { SavingWorkbasketService,
|
||||
SavingInformation } from 'app/administration/services/saving-workbaskets/saving-workbaskets.service';
|
||||
import { WorkbasketService } from 'app/shared/services/workbasket/workbasket.service';
|
||||
import { RequestInProgressService } from 'app/services/requestInProgress/request-in-progress.service';
|
||||
import { CustomFieldsService } from 'app/services/custom-fields/custom-fields.service';
|
||||
|
@ -39,6 +35,7 @@ export class WorkbasketInformationComponent
|
|||
implements OnInit, OnChanges, OnDestroy {
|
||||
@Input()
|
||||
workbasket: Workbasket;
|
||||
|
||||
workbasketClone: Workbasket;
|
||||
workbasketErrors;
|
||||
@Input()
|
||||
|
@ -52,18 +49,22 @@ export class WorkbasketInformationComponent
|
|||
'Owner',
|
||||
'workbaskets.information.owner'
|
||||
);
|
||||
|
||||
custom1Field = this.customFieldsService.getCustomField(
|
||||
'Custom 1',
|
||||
'workbaskets.information.custom1'
|
||||
);
|
||||
|
||||
custom2Field = this.customFieldsService.getCustomField(
|
||||
'Custom 2',
|
||||
'workbaskets.information.custom2'
|
||||
);
|
||||
|
||||
custom3Field = this.customFieldsService.getCustomField(
|
||||
'Custom 3',
|
||||
'workbaskets.information.custom3'
|
||||
);
|
||||
|
||||
custom4Field = this.customFieldsService.getCustomField(
|
||||
'Custom 4',
|
||||
'workbaskets.information.custom4'
|
||||
|
@ -237,7 +238,7 @@ export class WorkbasketInformationComponent
|
|||
this.afterRequest();
|
||||
this.workbasketService.triggerWorkBasketSaved();
|
||||
this.workbasketService.selectWorkBasket(this.workbasket.workbasketId);
|
||||
this.router.navigate(['../' + this.workbasket.workbasketId], {
|
||||
this.router.navigate([`../${this.workbasket.workbasketId}`], {
|
||||
relativeTo: this.route
|
||||
});
|
||||
if (this.action === ACTION.COPY) {
|
||||
|
@ -285,7 +286,7 @@ export class WorkbasketInformationComponent
|
|||
);
|
||||
} else {
|
||||
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']);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
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 { Router, Routes } from '@angular/router';
|
||||
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 { 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 { WorkbasketInformationComponent } from './information/workbasket-information.component';
|
||||
import { AccessItemsComponent } from './access-items/access-items.component';
|
||||
import { DistributionTargetsComponent } from './distribution-targets/distribution-targets.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';
|
||||
import { DualListComponent } from './distribution-targets/dual-list/dual-list.component';
|
||||
|
||||
@Component({
|
||||
selector: 'taskana-dummy-detail',
|
||||
|
@ -48,7 +48,7 @@ describe('WorkbasketDetailsComponent', () => {
|
|||
let workbasketService;
|
||||
let router;
|
||||
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 = [
|
||||
{ path: '*', component: DummyDetailComponent }
|
||||
|
@ -64,35 +64,33 @@ describe('WorkbasketDetailsComponent', () => {
|
|||
DistributionTargetsComponent, DualListComponent, DummyDetailComponent],
|
||||
providers: [WorkbasketService, MasterAndDetailService, GeneralModalService, RequestInProgressService,
|
||||
AlertService, SavingWorkbasketService, CustomFieldsService, ImportExportService]
|
||||
})
|
||||
});
|
||||
};
|
||||
configureTests(configure).then(testBed => {
|
||||
fixture = TestBed.createComponent(WorkbasketDetailsComponent);
|
||||
component = fixture.componentInstance;
|
||||
debugElement = fixture.debugElement.nativeElement;
|
||||
router = TestBed.get(Router)
|
||||
router = TestBed.get(Router);
|
||||
fixture.detectChanges();
|
||||
masterAndDetailService = TestBed.get(MasterAndDetailService);
|
||||
workbasketService = TestBed.get(WorkbasketService);
|
||||
spyOn(masterAndDetailService, 'getShowDetail').and.callFake(() => of(true))
|
||||
spyOn(workbasketService, 'getSelectedWorkBasket').and.callFake(() => of('id1'))
|
||||
spyOn(workbasketService, 'getWorkBasketsSummary').and.callFake(() => {
|
||||
return of(new WorkbasketSummaryResource(
|
||||
spyOn(masterAndDetailService, 'getShowDetail').and.callFake(() => of(true));
|
||||
spyOn(workbasketService, 'getSelectedWorkBasket').and.callFake(() => of('id1'));
|
||||
spyOn(workbasketService, 'getWorkBasketsSummary').and.callFake(() => of(new WorkbasketSummaryResource(
|
||||
new Array<WorkbasketSummary>(
|
||||
new WorkbasketSummary('id1', '', '', '', '', '', '', '', '', '', '', '',
|
||||
false, new Links({ 'href': 'someurl' })))
|
||||
, new LinksWorkbasketSummary({ 'href': 'someurl' })))
|
||||
})
|
||||
false, new Links({ href: 'someurl' }))
|
||||
),
|
||||
new LinksWorkbasketSummary({ href: 'someurl' })
|
||||
)));
|
||||
|
||||
spyOn(workbasketService, 'getWorkBasket').and.callFake(() => of(workbasket))
|
||||
spyOn(workbasketService, 'getWorkBasketAccessItems').and.callFake(() => {
|
||||
return of(new WorkbasketAccessItemsResource(
|
||||
new Array<WorkbasketAccessItems>(), new Links({ 'href': 'url' })))
|
||||
})
|
||||
spyOn(workbasketService, 'getWorkBasketsDistributionTargets').and.callFake(() => {
|
||||
return of(new WorkbasketSummaryResource(
|
||||
new Array<WorkbasketSummary>(), new LinksWorkbasketSummary({ 'href': 'url' })))
|
||||
})
|
||||
spyOn(workbasketService, 'getWorkBasket').and.callFake(() => of(workbasket));
|
||||
spyOn(workbasketService, 'getWorkBasketAccessItems').and.callFake(() => of(new WorkbasketAccessItemsResource(
|
||||
new Array<WorkbasketAccessItems>(), new Links({ href: 'url' })
|
||||
)));
|
||||
spyOn(workbasketService, 'getWorkBasketsDistributionTargets').and.callFake(() => of(new WorkbasketSummaryResource(
|
||||
new Array<WorkbasketSummary>(), new LinksWorkbasketSummary({ href: 'url' })
|
||||
)));
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
@ -104,5 +102,4 @@ describe('WorkbasketDetailsComponent', () => {
|
|||
it('should be created', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
|
||||
});
|
||||
|
|
|
@ -4,20 +4,19 @@ import { Subscription } from 'rxjs';
|
|||
|
||||
import { Workbasket } from 'app/models/workbasket';
|
||||
import { ACTION } from 'app/models/action';
|
||||
import { MessageModal } from '../../../models/message-modal';
|
||||
|
||||
import { WorkbasketService } from 'app/shared/services/workbasket/workbasket.service'
|
||||
import { MasterAndDetailService } from 'app/services/masterAndDetail/master-and-detail.service'
|
||||
import { WorkbasketService } from 'app/shared/services/workbasket/workbasket.service';
|
||||
import { MasterAndDetailService } from 'app/services/masterAndDetail/master-and-detail.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 { GeneralModalService } from '../../../services/general-modal/general-modal.service';
|
||||
import { MessageModal } from '../../../models/message-modal';
|
||||
|
||||
@Component({
|
||||
selector: 'taskana-workbasket-details',
|
||||
templateUrl: './workbasket-details.component.html'
|
||||
})
|
||||
export class WorkbasketDetailsComponent implements OnInit, OnDestroy {
|
||||
|
||||
workbasket: Workbasket;
|
||||
workbasketCopy: Workbasket;
|
||||
selectedId: string;
|
||||
|
@ -43,7 +42,6 @@ export class WorkbasketDetailsComponent implements OnInit, OnDestroy {
|
|||
private importExportService: ImportExportService) { }
|
||||
|
||||
|
||||
|
||||
ngOnInit() {
|
||||
this.workbasketSelectedSubscription = this.service.getSelectedWorkBasket().subscribe(workbasketIdSelected => {
|
||||
delete this.workbasket;
|
||||
|
@ -51,7 +49,7 @@ export class WorkbasketDetailsComponent implements OnInit, OnDestroy {
|
|||
});
|
||||
|
||||
this.routeSubscription = this.route.params.subscribe(params => {
|
||||
const id = params['id'];
|
||||
const { id } = params;
|
||||
delete this.action;
|
||||
if (id) {
|
||||
if (id.indexOf('new-workbasket') !== -1) {
|
||||
|
@ -79,7 +77,7 @@ export class WorkbasketDetailsComponent implements OnInit, OnDestroy {
|
|||
|
||||
this.importingExportingSubscription = this.importExportService.getImportingFinished().subscribe(() => {
|
||||
if (this.workbasket) { this.getWorkbasketInformation(this.workbasket.workbasketId); }
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
backClicked(): void {
|
||||
|
@ -117,7 +115,8 @@ export class WorkbasketDetailsComponent implements OnInit, OnDestroy {
|
|||
this.checkDomainAndRedirect();
|
||||
}, err => {
|
||||
this.generalModalService.triggerMessage(
|
||||
new MessageModal('An error occurred while fetching the workbasket', err));
|
||||
new MessageModal('An error occurred while fetching the workbasket', err)
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,7 +15,6 @@ import { Links } from 'app/models/links';
|
|||
import { FilterModel } from 'app/models/filter';
|
||||
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 { 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 { configureTests } from 'app/app.test.configuration';
|
||||
import { ImportExportService } from 'app/administration/services/import-export/import-export.service';
|
||||
import { WorkbasketListToolbarComponent } from './workbasket-list-toolbar.component';
|
||||
|
||||
@Component({
|
||||
selector: 'taskana-dummy-detail',
|
||||
|
@ -35,7 +35,8 @@ export class DummyDetailComponent {
|
|||
describe('WorkbasketListToolbarComponent', () => {
|
||||
let component: WorkbasketListToolbarComponent;
|
||||
let fixture: ComponentFixture<WorkbasketListToolbarComponent>;
|
||||
let debugElement, workbasketService, router;
|
||||
let debugElement; let workbasketService; let
|
||||
router;
|
||||
|
||||
const routes: Routes = [
|
||||
{ path: ':id', component: DummyDetailComponent, outlet: 'detail' }
|
||||
|
@ -53,7 +54,7 @@ describe('WorkbasketListToolbarComponent', () => {
|
|||
WorkbasketDefinitionService,
|
||||
ImportExportService
|
||||
]
|
||||
})
|
||||
});
|
||||
};
|
||||
configureTests(configure).then(testBed => {
|
||||
fixture = TestBed.createComponent(WorkbasketListToolbarComponent);
|
||||
|
@ -65,9 +66,10 @@ describe('WorkbasketListToolbarComponent', () => {
|
|||
debugElement = fixture.debugElement.nativeElement;
|
||||
component = fixture.componentInstance;
|
||||
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]._links = new Links({ 'href': 'selfLink' });
|
||||
component.workbaskets[0]._links = new Links({ href: 'selfLink' });
|
||||
|
||||
fixture.detectChanges();
|
||||
done();
|
||||
|
@ -93,19 +95,17 @@ describe('WorkbasketListToolbarComponent', () => {
|
|||
let sort: SortingModel;
|
||||
const compareSort = new SortingModel();
|
||||
|
||||
component.performSorting.subscribe((value) => { sort = value })
|
||||
component.performSorting.subscribe(value => { sort = value; });
|
||||
component.sorting(compareSort);
|
||||
expect(sort).toBe(compareSort);
|
||||
|
||||
});
|
||||
|
||||
it('should emit performFilter when filter is triggered', () => {
|
||||
let filter: FilterModel;
|
||||
const compareFilter = new FilterModel();
|
||||
|
||||
component.performFilter.subscribe((value) => { filter = value })
|
||||
component.performFilter.subscribe(value => { filter = value; });
|
||||
component.filtering(compareFilter);
|
||||
expect(filter).toBe(compareFilter);
|
||||
});
|
||||
|
||||
});
|
||||
|
|
|
@ -17,8 +17,6 @@ import { expandDown } from 'app/shared/animations/expand.animation';
|
|||
styleUrls: ['./workbasket-list-toolbar.component.scss']
|
||||
})
|
||||
export class WorkbasketListToolbarComponent implements OnInit {
|
||||
|
||||
|
||||
@Input() workbaskets: Array<WorkbasketSummary>;
|
||||
@Output() performSorting = new EventEmitter<SortingModel>();
|
||||
@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']]);
|
||||
filteringTypes = new Map([['ALL', 'All'], ['PERSONAL', 'Personal'], ['GROUP', 'Group'],
|
||||
['CLEARANCE', 'Clearance'], ['TOPIC', 'Topic']]);
|
||||
filterParams = {name: '', key: '', type: '', description: '', owner: ''};
|
||||
|
||||
filterParams = { name: '', key: '', type: '', description: '', owner: '' };
|
||||
toolbarState = false;
|
||||
filterType = TaskanaType.WORKBASKETS;
|
||||
|
||||
constructor(
|
||||
private workbasketService: WorkbasketService,
|
||||
private route: ActivatedRoute,
|
||||
private router: Router) {
|
||||
private router: Router
|
||||
) {
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
|
@ -52,5 +52,4 @@ export class WorkbasketListToolbarComponent implements OnInit {
|
|||
this.workbasketService.selectWorkBasket();
|
||||
this.router.navigate([{ outlets: { detail: ['new-workbasket'] } }], { relativeTo: this.route });
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -12,8 +12,6 @@ import { WorkbasketSummaryResource } from 'app/models/workbasket-summary-resourc
|
|||
import { FilterModel } from 'app/models/filter';
|
||||
import { LinksWorkbasketSummary } from 'app/models/links-workbasket-summary';
|
||||
|
||||
import { WorkbasketListComponent } from './workbasket-list.component';
|
||||
import { WorkbasketListToolbarComponent } from './workbasket-list-toolbar/workbasket-list-toolbar.component';
|
||||
import { ImportExportComponent } from 'app/administration/components/import-export/import-export.component';
|
||||
|
||||
import { 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 { Page } from 'app/models/page';
|
||||
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({
|
||||
selector: 'taskana-dummy-detail',
|
||||
|
@ -38,16 +38,20 @@ class DummyDetailComponent {
|
|||
class PaginationComponent {
|
||||
@Input()
|
||||
page: Page;
|
||||
|
||||
@Output()
|
||||
workbasketsResourceChange = new EventEmitter<any>();
|
||||
|
||||
@Output() changePage = new EventEmitter<any>();
|
||||
}
|
||||
|
||||
const workbasketSummaryResource: WorkbasketSummaryResource = new WorkbasketSummaryResource(
|
||||
new Array<WorkbasketSummary>(
|
||||
new WorkbasketSummary('1', 'key1', 'NAME1', 'description 1', 'owner 1', '', '', 'PERSONAL', '', '', '', ''),
|
||||
new WorkbasketSummary('2', 'key2', 'NAME2', 'description 2', 'owner 2', '', '', 'GROUP', '', '', '', ''))
|
||||
, new LinksWorkbasketSummary({ 'href': 'url' }));
|
||||
new WorkbasketSummary('2', 'key2', 'NAME2', 'description 2', 'owner 2', '', '', 'GROUP', '', '', '', '')
|
||||
),
|
||||
new LinksWorkbasketSummary({ href: 'url' })
|
||||
);
|
||||
|
||||
|
||||
describe('WorkbasketListComponent', () => {
|
||||
|
@ -99,7 +103,6 @@ describe('WorkbasketListComponent', () => {
|
|||
fixture.detectChanges();
|
||||
done();
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
|
@ -116,11 +119,11 @@ describe('WorkbasketListComponent', () => {
|
|||
expect(workbasketService.getWorkBasketsSummary).toHaveBeenCalled();
|
||||
workbasketService.getWorkBasketsSummary().subscribe(value => {
|
||||
expect(value).toBe(workbasketSummaryResource);
|
||||
})
|
||||
});
|
||||
});
|
||||
|
||||
it('should have wb-action-toolbar, wb-search-bar, wb-list-container, wb-pagination,' +
|
||||
' collapsedMenufilterWb and taskana-filter created in the html', () => {
|
||||
it('should have wb-action-toolbar, wb-search-bar, wb-list-container, wb-pagination,'
|
||||
+ ' collapsedMenufilterWb and taskana-filter created in the html', () => {
|
||||
expect(debugElement.querySelector('#wb-action-toolbar')).toBeDefined();
|
||||
expect(debugElement.querySelector('#wb-search-bar')).toBeDefined();
|
||||
expect(debugElement.querySelector('#wb-pagination')).toBeDefined();
|
||||
|
@ -156,19 +159,19 @@ describe('WorkbasketListComponent', () => {
|
|||
expect(debugElement.querySelector('#sort-by-description')).toBeDefined();
|
||||
expect(debugElement.querySelector('#sort-by-owner')).toBeDefined();
|
||||
expect(debugElement.querySelector('#sort-by-type')).toBeDefined();
|
||||
|
||||
});
|
||||
|
||||
it('should have performRequest with forced = true after performFilter is triggered', (() => {
|
||||
const filter = new FilterModel({
|
||||
name: 'someName', owner: 'someOwner', description: 'someDescription',
|
||||
key: 'someKey', type: 'PERSONAL'
|
||||
name: 'someName',
|
||||
owner: 'someOwner',
|
||||
description: 'someDescription',
|
||||
key: 'someKey',
|
||||
type: 'PERSONAL'
|
||||
});
|
||||
component.performFilter(filter);
|
||||
|
||||
expect(workbasketSummarySpy.calls.all()[1].args).toEqual([true, 'key', 'asc',
|
||||
'', 'someName', 'someDescription', '', 'someOwner', 'PERSONAL', '', 'someKey', '']);
|
||||
|
||||
}));
|
||||
|
||||
});
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
import {Component, ElementRef, OnDestroy, OnInit, ViewChild} from '@angular/core';
|
||||
import {ActivatedRoute, Router} from '@angular/router';
|
||||
import {Subscription} from 'rxjs';
|
||||
import { Component, ElementRef, OnDestroy, OnInit, ViewChild } from '@angular/core';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { Subscription } from 'rxjs';
|
||||
|
||||
import {WorkbasketSummaryResource} from 'app/models/workbasket-summary-resource';
|
||||
import {WorkbasketSummary} from 'app/models/workbasket-summary';
|
||||
import {FilterModel} from 'app/models/filter'
|
||||
import {SortingModel} from 'app/models/sorting';
|
||||
import {Orientation} from 'app/models/orientation';
|
||||
import { WorkbasketSummaryResource } from 'app/models/workbasket-summary-resource';
|
||||
import { WorkbasketSummary } from 'app/models/workbasket-summary';
|
||||
import { FilterModel } from 'app/models/filter';
|
||||
import { SortingModel } from 'app/models/sorting';
|
||||
import { Orientation } from 'app/models/orientation';
|
||||
|
||||
import {WorkbasketService} from 'app/shared/services/workbasket/workbasket.service'
|
||||
import {OrientationService} from 'app/services/orientation/orientation.service';
|
||||
import {TaskanaQueryParameters} from 'app/shared/util/query-parameters';
|
||||
import { WorkbasketService } from 'app/shared/services/workbasket/workbasket.service';
|
||||
import { OrientationService } from 'app/services/orientation/orientation.service';
|
||||
import { TaskanaQueryParameters } from 'app/shared/util/query-parameters';
|
||||
import { ImportExportService } from 'app/administration/services/import-export/import-export.service';
|
||||
|
||||
@Component({
|
||||
|
@ -19,7 +19,6 @@ import { ImportExportService } from 'app/administration/services/import-export/i
|
|||
styleUrls: ['./workbasket-list.component.scss']
|
||||
})
|
||||
export class WorkbasketListComponent implements OnInit, OnDestroy {
|
||||
|
||||
selectedId = '';
|
||||
workbasketsResource: WorkbasketSummaryResource;
|
||||
workbaskets: Array<WorkbasketSummary> = [];
|
||||
|
@ -31,10 +30,11 @@ export class WorkbasketListComponent implements OnInit, OnDestroy {
|
|||
cards: number = this.pageSize;
|
||||
|
||||
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 })
|
||||
private toolbarElement: ElementRef;
|
||||
|
||||
private workBasketSummarySubscription: Subscription;
|
||||
private workbasketServiceSubscription: Subscription;
|
||||
private workbasketServiceSavedSubscription: Subscription;
|
||||
|
@ -46,7 +46,8 @@ export class WorkbasketListComponent implements OnInit, OnDestroy {
|
|||
private router: Router,
|
||||
private route: ActivatedRoute,
|
||||
private orientationService: OrientationService,
|
||||
private importExportService: ImportExportService) {
|
||||
private importExportService: ImportExportService
|
||||
) {
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
|
@ -69,13 +70,12 @@ export class WorkbasketListComponent implements OnInit, OnDestroy {
|
|||
});
|
||||
this.importingExportingSubscription = this.importExportService.getImportingFinished().subscribe((value: Boolean) => {
|
||||
this.refreshWorkbasketList();
|
||||
})
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
selectWorkbasket(id: string) {
|
||||
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) {
|
||||
|
@ -95,7 +95,8 @@ export class WorkbasketListComponent implements OnInit, OnDestroy {
|
|||
|
||||
refreshWorkbasketList() {
|
||||
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();
|
||||
}
|
||||
|
||||
|
@ -106,7 +107,8 @@ export class WorkbasketListComponent implements OnInit, OnDestroy {
|
|||
this.workbasketServiceSubscription = this.workbasketService.getWorkBasketsSummary(
|
||||
true, this.sort.sortBy, this.sort.sortDirection, '',
|
||||
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 => {
|
||||
this.workbasketsResource = resultList;
|
||||
this.workbaskets = resultList.workbaskets;
|
||||
|
|
|
@ -57,7 +57,7 @@ const appRoutes: Routes = [
|
|||
@NgModule({
|
||||
imports: [
|
||||
RouterModule.forRoot(
|
||||
appRoutes, {useHash: true}
|
||||
appRoutes, { useHash: true }
|
||||
)
|
||||
],
|
||||
exports: [
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
import { async, inject, TestBed } from '@angular/core/testing';
|
||||
import { Router, Routes } from '@angular/router';
|
||||
import { AppComponent } from './app.component';
|
||||
import { AngularSvgIconModule } from 'angular-svg-icon';
|
||||
import { RouterTestingModule } from '@angular/router/testing';
|
||||
import { HttpClientModule } from '@angular/common/http';
|
||||
import { SharedModule } from 'app/shared/shared.module';
|
||||
import { AppComponent } from './app.component';
|
||||
|
||||
import { NavBarComponent } from './components/nav-bar/nav-bar.component';
|
||||
|
||||
describe('AppComponent', () => {
|
||||
|
||||
let app, fixture, debugElement;
|
||||
let app; let fixture; let
|
||||
debugElement;
|
||||
|
||||
const routes: Routes = [
|
||||
{ path: 'classifications', component: AppComponent }
|
||||
|
@ -32,7 +32,6 @@ describe('AppComponent', () => {
|
|||
fixture = TestBed.createComponent(AppComponent);
|
||||
app = fixture.debugElement.componentInstance;
|
||||
debugElement = fixture.debugElement.nativeElement;
|
||||
|
||||
}));
|
||||
|
||||
afterEach(async(() => {
|
||||
|
@ -50,11 +49,9 @@ describe('AppComponent', () => {
|
|||
}));
|
||||
|
||||
it('should call Router.navigateByUrl("classifications") and workbasketRoute should be false', (inject([Router], (router: Router) => {
|
||||
|
||||
expect(app.workbasketsRoute).toBe(true);
|
||||
fixture.detectChanges();
|
||||
router.navigateByUrl(`/classifications`);
|
||||
router.navigateByUrl('/classifications');
|
||||
expect(app.workbasketsRoute).toBe(false);
|
||||
|
||||
})));
|
||||
})
|
||||
});
|
||||
|
|
|
@ -2,13 +2,13 @@ import { Component, OnInit, HostListener, OnDestroy } from '@angular/core';
|
|||
import { Router, NavigationStart } from '@angular/router';
|
||||
import { Subscription } from 'rxjs';
|
||||
|
||||
import { FormsValidatorService } from 'app/shared/services/forms/forms-validator.service';
|
||||
import { MessageModal } from './models/message-modal';
|
||||
|
||||
import { GeneralModalService } from './services/general-modal/general-modal.service';
|
||||
import { RequestInProgressService } from './services/requestInProgress/request-in-progress.service';
|
||||
import { OrientationService } from './services/orientation/orientation.service';
|
||||
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';
|
||||
|
||||
@Component({
|
||||
|
@ -17,7 +17,6 @@ import { UploadService } from './shared/services/upload/upload.service';
|
|||
styleUrls: ['./app.component.scss']
|
||||
})
|
||||
export class AppComponent implements OnInit, OnDestroy {
|
||||
|
||||
workbasketsRoute = true;
|
||||
|
||||
modalMessage = '';
|
||||
|
@ -46,7 +45,8 @@ export class AppComponent implements OnInit, OnDestroy {
|
|||
private orientationService: OrientationService,
|
||||
private selectedRouteService: SelectedRouteService,
|
||||
private formsValidatorService: FormsValidatorService,
|
||||
public uploadService: UploadService) {
|
||||
public uploadService: UploadService
|
||||
) {
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
|
@ -55,35 +55,35 @@ export class AppComponent implements OnInit, OnDestroy {
|
|||
this.selectedRouteService.selectRoute(event);
|
||||
this.formsValidatorService.formSubmitAttempt = false;
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
this.modalSubscription = this.generalModalService.getMessage().subscribe((messageModal: MessageModal) => {
|
||||
if (typeof messageModal.message === 'string') {
|
||||
this.modalMessage = messageModal.message
|
||||
this.modalMessage = messageModal.message;
|
||||
} else if (messageModal.message.error instanceof ProgressEvent) {
|
||||
this.modalMessage = messageModal.message.message;
|
||||
} else {
|
||||
this.modalMessage = messageModal.message.error ?
|
||||
(messageModal.message.error.error + ' ' + messageModal.message.error.message)
|
||||
this.modalMessage = messageModal.message.error
|
||||
? (`${messageModal.message.error.error} ${messageModal.message.error.message}`)
|
||||
: messageModal.message.message;
|
||||
}
|
||||
this.modalTitle = messageModal.title;
|
||||
this.modalType = messageModal.type;
|
||||
})
|
||||
});
|
||||
|
||||
this.requestInProgressSubscription = this.requestInProgressService.getRequestInProgress().subscribe((value: boolean) => {
|
||||
this.requestInProgress = value;
|
||||
})
|
||||
});
|
||||
|
||||
this.selectedRouteSubscription = this.selectedRouteService.getSelectedRoute().subscribe((value: string) => {
|
||||
if (value.indexOf('classifications') !== -1) {
|
||||
this.workbasketsRoute = false;
|
||||
}
|
||||
this.selectedRoute = value;
|
||||
})
|
||||
});
|
||||
this.uploadingFileSubscription = this.uploadService.getCurrentProgressValue().subscribe(value => {
|
||||
this.currentProgressValue = value;
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
|
|
|
@ -6,7 +6,6 @@ import { BrowserModule } from '@angular/platform-browser';
|
|||
import { NgModule, APP_INITIALIZER } from '@angular/core';
|
||||
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
|
||||
import { HttpClientModule } from '@angular/common/http';
|
||||
import { AppRoutingModule } from './app-routing.module';
|
||||
import { AlertModule } from 'ngx-bootstrap';
|
||||
import { AngularSvgIconModule } from 'angular-svg-icon';
|
||||
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 { WindowRefService } from 'app/services/window/window.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 { FormsValidatorService } from './shared/services/forms/forms-validator.service';
|
||||
import { UploadService } from './shared/services/upload/upload.service';
|
||||
|
@ -39,9 +41,7 @@ import { UploadService } from './shared/services/upload/upload.service';
|
|||
* Components
|
||||
*/
|
||||
import { AppComponent } from './app.component';
|
||||
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 { AppRoutingModule } from './app-routing.module';
|
||||
|
||||
/**
|
||||
* Guards
|
||||
|
@ -74,9 +74,7 @@ const DECLARATIONS = [
|
|||
];
|
||||
|
||||
export function startupServiceFactory(startupService: StartupService): () => Promise<any> {
|
||||
return (): Promise<any> => {
|
||||
return startupService.load()
|
||||
};
|
||||
return (): Promise<any> => startupService.load();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,31 +1,27 @@
|
|||
|
||||
import {
|
||||
getTestBed,
|
||||
TestBed,
|
||||
} from '@angular/core/testing';
|
||||
import { getTestBed,
|
||||
TestBed } from '@angular/core/testing';
|
||||
|
||||
import {
|
||||
BrowserDynamicTestingModule,
|
||||
platformBrowserDynamicTesting,
|
||||
} from '@angular/platform-browser-dynamic/testing';
|
||||
import { BrowserDynamicTestingModule,
|
||||
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 { TaskanaEngineService } from './services/taskana-engine/taskana-engine.service';
|
||||
import { DomainService } from './services/domain/domain.service';
|
||||
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 { GeneralModalService } from './services/general-modal/general-modal.service';
|
||||
import { RequestInProgressService } from './services/requestInProgress/request-in-progress.service';
|
||||
import { OrientationService } from './services/orientation/orientation.service';
|
||||
import { SelectedRouteService } from './services/selected-route/selected-route';
|
||||
import { FormsValidatorService } from './shared/services/forms/forms-validator.service';
|
||||
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
|
||||
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) => {
|
||||
const testBed = getTestBed();
|
||||
|
@ -33,7 +29,8 @@ export const configureTests = (configure: (testBed: TestBed) => void) => {
|
|||
if (testBed.platform == null) {
|
||||
testBed.initTestEnvironment(
|
||||
BrowserDynamicTestingModule,
|
||||
platformBrowserDynamicTesting());
|
||||
platformBrowserDynamicTesting()
|
||||
);
|
||||
}
|
||||
|
||||
configure(testBed);
|
||||
|
|
|
@ -5,7 +5,6 @@ import { AngularSvgIconModule } from 'angular-svg-icon';
|
|||
import { HttpClientModule } from '@angular/common/http';
|
||||
import { SharedModule } from 'app/shared/shared.module';
|
||||
|
||||
import { NavBarComponent } from './nav-bar.component';
|
||||
import { UserInformationComponent } from 'app/components/user-information/user-information.component';
|
||||
|
||||
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 { configureTests } from 'app/app.test.configuration';
|
||||
import { NavBarComponent } from './nav-bar.component';
|
||||
|
||||
describe('NavBarComponent', () => {
|
||||
let component: NavBarComponent;
|
||||
let fixture: ComponentFixture<NavBarComponent>;
|
||||
let debugElement, navBar;
|
||||
let debugElement; let
|
||||
navBar;
|
||||
|
||||
const routes: Routes = [
|
||||
{ path: 'classifications', component: NavBarComponent }
|
||||
|
@ -43,7 +44,7 @@ describe('NavBarComponent', () => {
|
|||
WindowRefService,
|
||||
GeneralModalService,
|
||||
RequestInProgressService]
|
||||
})
|
||||
});
|
||||
};
|
||||
configureTests(configure).then(testBed => {
|
||||
fixture = TestBed.createComponent(NavBarComponent);
|
||||
|
@ -53,11 +54,10 @@ describe('NavBarComponent', () => {
|
|||
fixture.detectChanges();
|
||||
done();
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
fixture.detectChanges()
|
||||
fixture.detectChanges();
|
||||
document.body.removeChild(debugElement);
|
||||
});
|
||||
|
||||
|
@ -65,8 +65,7 @@ describe('NavBarComponent', () => {
|
|||
expect(component).toBeTruthy();
|
||||
});
|
||||
|
||||
it(`should have as title ''`, (() => {
|
||||
it('should have as title \'\'', (() => {
|
||||
expect(navBar.title).toEqual('');
|
||||
}));
|
||||
|
||||
});
|
||||
|
|
|
@ -7,8 +7,8 @@ import { BusinessAdminGuard } from 'app/guards/business-admin.guard';
|
|||
import { MonitorGuard } from 'app/guards/monitor.guard';
|
||||
import { WindowRefService } from 'app/services/window/window.service';
|
||||
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 { TaskanaEngineService } from '../../services/taskana-engine/taskana-engine.service';
|
||||
@Component({
|
||||
selector: 'taskana-nav-bar',
|
||||
templateUrl: './nav-bar.component.html',
|
||||
|
@ -16,7 +16,6 @@ import { expandRight } from 'app/shared/animations/expand.animation';
|
|||
animations: [expandRight],
|
||||
})
|
||||
export class NavBarComponent implements OnInit, OnDestroy {
|
||||
|
||||
selectedRoute = '';
|
||||
route: string;
|
||||
title = '';
|
||||
|
@ -50,7 +49,8 @@ export class NavBarComponent implements OnInit, OnDestroy {
|
|||
private selectedRouteService: SelectedRouteService,
|
||||
private domainService: DomainService,
|
||||
private taskanaEngineService: TaskanaEngineService,
|
||||
private window: WindowRefService) { }
|
||||
private window: WindowRefService
|
||||
) { }
|
||||
|
||||
ngOnInit() {
|
||||
this.selectedRouteSubscription = this.selectedRouteService.getSelectedRoute().subscribe((value: string) => {
|
||||
|
@ -75,8 +75,7 @@ export class NavBarComponent implements OnInit, OnDestroy {
|
|||
|
||||
this.taskanaEngineService.isHistoryProviderEnabled().subscribe(value => {
|
||||
this.historyAccess = value;
|
||||
})
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
switchDomain(domain) {
|
||||
|
@ -90,14 +89,14 @@ export class NavBarComponent implements OnInit, OnDestroy {
|
|||
|
||||
logout() {
|
||||
this.taskanaEngineService.logout().subscribe(() => {
|
||||
})
|
||||
});
|
||||
this.window.nativeWindow.location.href = environment.taskanaLogoutUrl;
|
||||
}
|
||||
|
||||
showDomainSelector(): boolean {
|
||||
return this.selectedRoute.indexOf('administration') !== -1
|
||||
|| this.selectedRoute.indexOf('workbaskets') !== -1
|
||||
|| this.selectedRoute.indexOf('classifications') !== -1
|
||||
|| this.selectedRoute.indexOf('classifications') !== -1;
|
||||
}
|
||||
|
||||
private setTitle(value: string = 'workbaskets') {
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { NoAccessComponent } from './no-access.component';
|
||||
import { RouterTestingModule } from '@angular/router/testing';
|
||||
import { AngularSvgIconModule } from 'angular-svg-icon';
|
||||
import { HttpClientModule } from '@angular/common/http';
|
||||
import { configureTests } from 'app/app.test.configuration';
|
||||
import { NoAccessComponent } from './no-access.component';
|
||||
|
||||
describe('NoAccessComponent', () => {
|
||||
let component: NoAccessComponent;
|
||||
|
@ -17,7 +17,7 @@ describe('NoAccessComponent', () => {
|
|||
testBed.configureTestingModule({
|
||||
imports: [RouterTestingModule, AngularSvgIconModule, HttpClientModule],
|
||||
declarations: [NoAccessComponent]
|
||||
})
|
||||
});
|
||||
};
|
||||
configureTests(configure).then(testBed => {
|
||||
fixture = TestBed.createComponent(NoAccessComponent);
|
||||
|
@ -25,7 +25,6 @@ describe('NoAccessComponent', () => {
|
|||
debugElement = fixture.debugElement.nativeElement;
|
||||
done();
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import { Component, OnInit } from '@angular/core';
|
||||
import { TaskanaEngineService } from '../../services/taskana-engine/taskana-engine.service';
|
||||
import { BusinessAdminGuard } from 'app/guards/business-admin.guard';
|
||||
import { MonitorGuard } from 'app/guards/monitor.guard';
|
||||
import { UserGuard } from 'app/guards/user.guard';
|
||||
import { Router } from '@angular/router';
|
||||
import { TaskanaEngineService } from '../../services/taskana-engine/taskana-engine.service';
|
||||
|
||||
@Component({
|
||||
selector: 'taskana-no-access',
|
||||
|
@ -11,7 +11,6 @@ import { Router } from '@angular/router';
|
|||
styleUrls: ['./no-access.component.scss']
|
||||
})
|
||||
export class NoAccessComponent implements OnInit {
|
||||
|
||||
showNoAccess = false;
|
||||
constructor(private taskanaEngineService: TaskanaEngineService, public router: Router) { }
|
||||
|
||||
|
|
|
@ -2,9 +2,9 @@ import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|||
import { AngularSvgIconModule } from 'angular-svg-icon';
|
||||
import { HttpClientModule } from '@angular/common/http';
|
||||
|
||||
import { configureTests } from 'app/app.test.configuration';
|
||||
import { UserInformationComponent } from './user-information.component';
|
||||
|
||||
import { configureTests } from 'app/app.test.configuration';
|
||||
|
||||
describe('UserInformationComponent', () => {
|
||||
let component: UserInformationComponent;
|
||||
|
@ -18,7 +18,7 @@ describe('UserInformationComponent', () => {
|
|||
imports: [AngularSvgIconModule,
|
||||
HttpClientModule],
|
||||
declarations: [UserInformationComponent],
|
||||
})
|
||||
});
|
||||
};
|
||||
configureTests(configure).then(testBed => {
|
||||
fixture = TestBed.createComponent(UserInformationComponent);
|
||||
|
@ -27,7 +27,6 @@ describe('UserInformationComponent', () => {
|
|||
fixture.detectChanges();
|
||||
done();
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
|
|
|
@ -10,7 +10,6 @@ import { expandDown } from '../../shared/animations/expand.animation';
|
|||
animations: [expandDown],
|
||||
})
|
||||
export class UserInformationComponent implements OnInit {
|
||||
|
||||
userInformation: UserInfoModel;
|
||||
roles = '';
|
||||
showRoles = false;
|
||||
|
@ -19,7 +18,7 @@ export class UserInformationComponent implements OnInit {
|
|||
ngOnInit() {
|
||||
this.userInformation = this.taskanaEngineService.currentUserInfo;
|
||||
if (this.userInformation) {
|
||||
this.roles = '[' + this.userInformation.roles.join(',') + ']';
|
||||
this.roles = `[${this.userInformation.roles.join(',')}]`;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -18,6 +18,6 @@ export class BusinessAdminGuard implements CanActivate {
|
|||
|
||||
navigateToWorkplace(): boolean {
|
||||
this.router.navigate(['workplace']);
|
||||
return false
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,13 +12,12 @@ export class DomainGuard implements CanActivate {
|
|||
|
||||
canActivate() {
|
||||
return this.domainService.getDomains().pipe(
|
||||
map(domain => {
|
||||
return true;
|
||||
}),
|
||||
map(domain => true),
|
||||
catchError(() => {
|
||||
this.generalModalService.triggerMessage(new MessageModal(
|
||||
'There was an error, please contact with your administrator', 'There was an error getting Domains'));
|
||||
return of(false)
|
||||
'There was an error, please contact with your administrator', 'There was an error getting Domains'
|
||||
));
|
||||
return of(false);
|
||||
})
|
||||
);
|
||||
}
|
||||
|
|
|
@ -13,11 +13,13 @@ export class HistoryGuard implements CanActivate {
|
|||
constructor(
|
||||
private taskanaEngineService: TaskanaEngineService,
|
||||
public router: Router,
|
||||
public generalModalService: GeneralModalService) { }
|
||||
public generalModalService: GeneralModalService
|
||||
) { }
|
||||
|
||||
canActivate(
|
||||
next: ActivatedRouteSnapshot,
|
||||
state: RouterStateSnapshot): Observable<boolean> | Promise<boolean> | boolean {
|
||||
state: RouterStateSnapshot
|
||||
): Observable<boolean> | Promise<boolean> | boolean {
|
||||
return this.taskanaEngineService.isHistoryProviderEnabled().pipe(
|
||||
map(value => {
|
||||
if (value) {
|
||||
|
@ -27,7 +29,8 @@ export class HistoryGuard implements CanActivate {
|
|||
}),
|
||||
catchError(() => {
|
||||
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());
|
||||
})
|
||||
);
|
||||
|
|
|
@ -2,9 +2,9 @@ import { NgModule } from '@angular/core';
|
|||
import { CommonModule } from '@angular/common';
|
||||
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
|
||||
|
||||
import { SharedModule } from 'app/shared/shared.module';
|
||||
import { HistoryRoutingModule } from './history-routing.module';
|
||||
import { TaskQueryComponent } from './task-query/task-query.component';
|
||||
import { SharedModule } from 'app/shared/shared.module';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
|
|
|
@ -22,7 +22,6 @@ export class TaskQueryService {
|
|||
searchForValues: TaskHistoryEventData,
|
||||
allPages: boolean = false
|
||||
): Observable<TaskHistoryEventResourceData> {
|
||||
|
||||
return this.httpClient.get<TaskHistoryEventResourceData>(`${this.url}/v1/task-history-event${this.getQueryParameters(
|
||||
orderBy,
|
||||
sortDirection,
|
||||
|
@ -48,7 +47,6 @@ export class TaskQueryService {
|
|||
searchForValues.created,
|
||||
allPages
|
||||
)}`);
|
||||
|
||||
}
|
||||
|
||||
private getQueryParameters(
|
||||
|
@ -74,10 +72,10 @@ export class TaskQueryService {
|
|||
custom3: string,
|
||||
custom4: string,
|
||||
created: string,
|
||||
allPages: boolean = false): string {
|
||||
|
||||
allPages: boolean = false
|
||||
): string {
|
||||
const parameters = new QueryParametersModel();
|
||||
parameters.SORTBY = orderBy
|
||||
parameters.SORTBY = orderBy;
|
||||
parameters.SORTDIRECTION = sortDirection;
|
||||
parameters.TASK_ID_LIKE = taskId;
|
||||
parameters.PARENT_BUSINESS_PROCESS_ID_LIKE = parentBPI;
|
||||
|
@ -105,5 +103,3 @@ export class TaskQueryService {
|
|||
return TaskanaQueryParameters.getQueryParameters(parameters);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ describe('TaskQueryComponent', () => {
|
|||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ TaskQueryComponent ]
|
||||
declarations: [TaskQueryComponent]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
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 { OrientationService } from 'app/services/orientation/orientation.service';
|
||||
import { Subscription } from 'rxjs';
|
||||
|
@ -11,6 +9,8 @@ import { MessageModal } from 'app/models/message-modal';
|
|||
import { FormGroup, FormControl } from '@angular/forms';
|
||||
import { TaskHistoryEventResourceData } from 'app/models/task-history-event-resource';
|
||||
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({
|
||||
selector: 'taskana-task-query',
|
||||
|
@ -18,9 +18,8 @@ import { RequestInProgressService } from 'app/services/requestInProgress/request
|
|||
styleUrls: ['./task-query.component.scss']
|
||||
})
|
||||
export class TaskQueryComponent implements OnInit {
|
||||
|
||||
taskQueryResource: TaskHistoryEventResourceData;
|
||||
taskQuery: Array<TaskHistoryEventData>
|
||||
taskQuery: Array<TaskHistoryEventData>;
|
||||
taskQueryHeader = new TaskHistoryEventData();
|
||||
orderBy = new SortingModel(TaskanaQueryParameters.parameters.CREATED);
|
||||
orientationSubscription: Subscription;
|
||||
|
@ -33,7 +32,8 @@ export class TaskQueryComponent implements OnInit {
|
|||
private taskQueryService: TaskQueryService,
|
||||
private orientationService: OrientationService,
|
||||
private generalModalService: GeneralModalService,
|
||||
private requestInProgressService: RequestInProgressService, ) { }
|
||||
private requestInProgressService: RequestInProgressService
|
||||
) { }
|
||||
|
||||
ngOnInit() {
|
||||
this.orientationSubscription = this.orientationService.getOrientation().subscribe((orientation: Orientation) => {
|
||||
|
@ -101,7 +101,7 @@ export class TaskQueryComponent implements OnInit {
|
|||
}
|
||||
|
||||
isDate(fieldName: string): boolean {
|
||||
return (fieldName === 'created')
|
||||
return (fieldName === 'created');
|
||||
}
|
||||
|
||||
filterFieldsToAllowQuerying(fieldName: string): boolean {
|
||||
|
@ -150,7 +150,7 @@ export class TaskQueryComponent implements OnInit {
|
|||
val,
|
||||
'code'
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
getTaskValue(key: string, task: TaskHistoryEventData): string {
|
||||
|
@ -171,17 +171,18 @@ export class TaskQueryComponent implements OnInit {
|
|||
if (sortDirection === Direction.ASC) {
|
||||
return Direction.DESC;
|
||||
}
|
||||
return Direction.ASC
|
||||
return Direction.ASC;
|
||||
}
|
||||
|
||||
private performRequest() {
|
||||
this.requestInProgressService.setRequestInProgress(true);
|
||||
this.calculateQueryPages();
|
||||
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,
|
||||
new TaskHistoryEventData(this.taskQueryForm.value),
|
||||
false).subscribe(taskQueryResource => {
|
||||
false
|
||||
).subscribe(taskQueryResource => {
|
||||
this.requestInProgressService.setRequestInProgress(false);
|
||||
if (!taskQueryResource.taskHistoryEvents) {
|
||||
this.taskQuery = null;
|
||||
|
@ -190,18 +191,17 @@ export class TaskQueryComponent implements OnInit {
|
|||
}
|
||||
this.taskQueryResource = taskQueryResource;
|
||||
this.taskQuery = taskQueryResource.taskHistoryEvents;
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
private initTaskQueryForm() {
|
||||
const me = this;
|
||||
Object.keys(new TaskHistoryEventData()).forEach(function (key) {
|
||||
Object.keys(new TaskHistoryEventData()).forEach(key => {
|
||||
me.taskQueryForm.addControl(key, new FormControl());
|
||||
});
|
||||
}
|
||||
|
||||
private calculateQueryPages() {
|
||||
|
||||
const rowHeight = 34;
|
||||
const unusedHeight = 300;
|
||||
const totalHeight = window.innerHeight;
|
||||
|
@ -219,5 +219,4 @@ export class TaskQueryComponent implements OnInit {
|
|||
if (this.orientationSubscription) { this.orientationSubscription.unsubscribe(); }
|
||||
if (this.taskQuerySubscription) { this.taskQuerySubscription.unsubscribe(); }
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ import { LinksClassification } from 'app/models/links-classfication';
|
|||
export class AccessIdDefinition {
|
||||
constructor(
|
||||
public accessId?: string,
|
||||
public name?: string) {
|
||||
public name?: string
|
||||
) {
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,7 +6,6 @@ export enum AlertType {
|
|||
}
|
||||
|
||||
export class AlertModel {
|
||||
|
||||
constructor(public type: string = AlertType.SUCCESS,
|
||||
public text: string = 'Success',
|
||||
public autoClosing: boolean = true,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import {Links} from 'app/models/links';
|
||||
import { Links } from 'app/models/links';
|
||||
|
||||
export class Classification {
|
||||
constructor(public classificationId?: string, // newly created classifications don't have an id yet.
|
||||
|
@ -10,6 +10,6 @@ export class Classification {
|
|||
public parentId?: string,
|
||||
public priority?: number,
|
||||
public serviceLevel?: string,
|
||||
public _links?: Links ) {
|
||||
public _links?: Links) {
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
|
||||
|
||||
export class CustomField {
|
||||
constructor(
|
||||
public visible: boolean,
|
||||
public field: string) {
|
||||
public field: string
|
||||
) {
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,5 +8,5 @@ export class LinksClassification extends Links {
|
|||
public getAllClassifications?: { 'href': string },
|
||||
public createClassification?: { 'href': string },
|
||||
public updateClassification?: { 'href': string },
|
||||
) { super(self, distributionTargets, accessItems) }
|
||||
) { super(self, distributionTargets, accessItems); }
|
||||
}
|
||||
|
|
|
@ -6,5 +6,5 @@ export class LinksWorkbasketSummary extends Links {
|
|||
distributionTargets?,
|
||||
accessItems?,
|
||||
public allWorkbaskets?: { 'href': string }
|
||||
) { super(self, distributionTargets, accessItems) }
|
||||
) { super(self, distributionTargets, accessItems); }
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
export enum Direction {
|
||||
ASC = 'asc',
|
||||
DESC = 'desc'
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
export class SortingModel {
|
||||
|
|
|
@ -2,6 +2,6 @@ import { Links } from './links';
|
|||
import { TaskHistoryEventData } from './task-history-event';
|
||||
|
||||
export class TaskHistoryEventResourceData {
|
||||
public taskHistoryEvents: Array<TaskHistoryEventData>
|
||||
public _links: Links = new Links()
|
||||
public taskHistoryEvents: Array<TaskHistoryEventData>;
|
||||
public _links: Links = new Links();
|
||||
}
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
|
||||
|
||||
export enum ICONTYPES {
|
||||
ALL = 'ALL',
|
||||
PERSONAL = 'PERSONAL',
|
||||
|
|
|
@ -3,6 +3,6 @@ export class UserInfoModel {
|
|||
constructor(
|
||||
public userId: string = '',
|
||||
public groupIds: Array<string> = [],
|
||||
public roles: Array<string> = []) { };
|
||||
|
||||
public roles: Array<string> = []
|
||||
) { }
|
||||
}
|
||||
|
|
|
@ -2,5 +2,5 @@
|
|||
export class VersionModel {
|
||||
constructor(
|
||||
public version: string = ''
|
||||
) { };
|
||||
) { }
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import {WorkbasketAccessItems} from './workbasket-access-items';
|
||||
import {Workbasket} from './workbasket';
|
||||
import { WorkbasketAccessItems } from './workbasket-access-items';
|
||||
import { Workbasket } from './workbasket';
|
||||
|
||||
export class WorkbasketDefinition {
|
||||
constructor(distributionTargets: string[],
|
||||
|
|
|
@ -4,6 +4,7 @@ import { Links } from './links';
|
|||
export class WorkbasketDistributionTargetsResource {
|
||||
constructor(
|
||||
public distributionTargets: Array<WorkbasketSummary> = [],
|
||||
public _links: Links = null) {
|
||||
public _links: Links = null
|
||||
) {
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,5 +4,6 @@ import { Workbasket } from './workbasket';
|
|||
export class WorkbasketResource {
|
||||
constructor(
|
||||
public workbaskets: Array<Workbasket> = [],
|
||||
public _links: Links = new Links() ) { }
|
||||
public _links: Links = new Links()
|
||||
) { }
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { WorkbasketSummary } from './workbasket-summary';
|
||||
import { Page } from 'app/models/page';
|
||||
import { WorkbasketSummary } from './workbasket-summary';
|
||||
import { LinksWorkbasketSummary } from './links-workbasket-summary';
|
||||
|
||||
export class WorkbasketSummaryResource {
|
||||
|
|
|
@ -18,6 +18,7 @@ export class WorkbasketSummary {
|
|||
public orgLevel4?: string,
|
||||
public markedForDeletion: boolean = false,
|
||||
public _links?: Links,
|
||||
public page?: Page ) {
|
||||
public page?: Page
|
||||
) {
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { Links } from './links';
|
||||
import { ICONTYPES } from './type';
|
||||
export class Workbasket {
|
||||
|
||||
export class Workbasket {
|
||||
public static equals(org: Workbasket, comp: Workbasket): boolean {
|
||||
if (org.workbasketId !== comp.workbasketId) { return false; }
|
||||
if (org.created !== comp.created) { return false; }
|
||||
|
@ -42,6 +42,7 @@ export class Workbasket {
|
|||
public orgLevel2?: string,
|
||||
public orgLevel3?: string,
|
||||
public orgLevel4?: string,
|
||||
public _links: Links = new Links()) {
|
||||
public _links: Links = new Links()
|
||||
) {
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ describe('ClassificationTasksComponent', () => {
|
|||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ ClassificationTasksComponent ]
|
||||
declarations: [ClassificationTasksComponent]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import {Component, OnInit} from '@angular/core';
|
||||
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 {ChartColorsDefinition} from '../models/chart-colors';
|
||||
import {RequestInProgressService} from '../../services/requestInProgress/request-in-progress.service';
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { RestConnectorService } from 'app/monitor/services/restConnector/rest-connector.service';
|
||||
import { ChartData } from 'app/monitor/models/chart-data';
|
||||
import { ReportData } from '../models/report-data';
|
||||
import { ChartColorsDefinition } from '../models/chart-colors';
|
||||
import { RequestInProgressService } from '../../services/requestInProgress/request-in-progress.service';
|
||||
|
||||
@Component({
|
||||
selector: 'taskana-monitor-classification-tasks',
|
||||
|
@ -21,16 +21,18 @@ export class ClassificationTasksComponent implements OnInit {
|
|||
lineChartOptions: any = {
|
||||
responsive: true
|
||||
};
|
||||
|
||||
lineChartColors = ChartColorsDefinition.getColors();
|
||||
|
||||
constructor(
|
||||
private restConnectorService: RestConnectorService,
|
||||
private requestInProgressService: RequestInProgressService) {
|
||||
private requestInProgressService: RequestInProgressService
|
||||
) {
|
||||
}
|
||||
|
||||
async ngOnInit() {
|
||||
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.lineChartLabels = this.reportData.meta.header;
|
||||
this.requestInProgressService.setRequestInProgress(false);
|
||||
|
|
|
@ -65,7 +65,6 @@ export class ChartColorsDefinition {
|
|||
pointHoverBackgroundColor: '#fff',
|
||||
pointHoverBorderColor: 'rgba(180, 137, 255, 0.8)'
|
||||
}
|
||||
]
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import {ReportRow} from './report-row';
|
||||
import {MetaInfoData} from './meta-info-data';
|
||||
import { ReportRow } from './report-row';
|
||||
import { MetaInfoData } from './meta-info-data';
|
||||
|
||||
export class ReportData {
|
||||
meta: MetaInfoData;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import {Component, OnDestroy, OnInit} from '@angular/core';
|
||||
import { Component, OnDestroy, OnInit } from '@angular/core';
|
||||
|
||||
|
||||
@Component({
|
||||
|
@ -7,7 +7,6 @@ import {Component, OnDestroy, OnInit} from '@angular/core';
|
|||
styleUrls: ['./monitor.component.scss']
|
||||
})
|
||||
export class MonitorComponent implements OnInit, OnDestroy {
|
||||
|
||||
tabSelected = 'tasks';
|
||||
|
||||
ngOnInit(): void {
|
||||
|
|
|
@ -1,30 +1,27 @@
|
|||
import {CommonModule} from '@angular/common';
|
||||
import {NgModule} from '@angular/core';
|
||||
import {FormsModule} from '@angular/forms';
|
||||
import {AlertModule} from 'ngx-bootstrap';
|
||||
import {ChartsModule} from 'ng2-charts';
|
||||
import {TabsModule} from 'ngx-bootstrap/tabs';
|
||||
import {HttpClientModule} from '@angular/common/http';
|
||||
import {AngularSvgIconModule} from 'angular-svg-icon';
|
||||
import {MonitorRoutingModule} from './monitor-routing.module';
|
||||
import {SharedModule} from '../shared/shared.module';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { NgModule } from '@angular/core';
|
||||
import { FormsModule } from '@angular/forms';
|
||||
import { AlertModule } from 'ngx-bootstrap';
|
||||
import { ChartsModule } from 'ng2-charts';
|
||||
import { TabsModule } from 'ngx-bootstrap/tabs';
|
||||
import { HttpClientModule } from '@angular/common/http';
|
||||
import { AngularSvgIconModule } from 'angular-svg-icon';
|
||||
import { MonitorRoutingModule } from './monitor-routing.module';
|
||||
import { SharedModule } from '../shared/shared.module';
|
||||
|
||||
import {ReportComponent} from './report/report.component';
|
||||
import {MonitorComponent} from './monitor.component';
|
||||
import {TasksComponent} from './tasks/tasks.component';
|
||||
import {ClassificationTasksComponent} from './classification-tasks/classification-tasks.component';
|
||||
import {TimestampComponent} from './timestamp/timestamp.component';
|
||||
import { ReportComponent } from './report/report.component';
|
||||
import { MonitorComponent } from './monitor.component';
|
||||
import { TasksComponent } from './tasks/tasks.component';
|
||||
import { ClassificationTasksComponent } from './classification-tasks/classification-tasks.component';
|
||||
import { TimestampComponent } from './timestamp/timestamp.component';
|
||||
|
||||
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 { 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';
|
||||
|
||||
|
||||
const MODULES = [
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import {Component, Input, OnInit} from '@angular/core';
|
||||
import {ReportData} from 'app/monitor/models/report-data';
|
||||
import { Component, Input, OnInit } from '@angular/core';
|
||||
import { ReportData } from 'app/monitor/models/report-data';
|
||||
|
||||
@Component({
|
||||
selector: 'taskana-report',
|
||||
|
@ -7,8 +7,6 @@ import {ReportData} from 'app/monitor/models/report-data';
|
|||
styleUrls: ['./report.component.scss']
|
||||
})
|
||||
export class ReportComponent implements OnInit {
|
||||
|
||||
|
||||
currentExpHeaders = 0;
|
||||
|
||||
@Input()
|
||||
|
|
|
@ -1,42 +1,40 @@
|
|||
import {Injectable} from '@angular/core';
|
||||
import {HttpClient} from '@angular/common/http';
|
||||
import {environment} from 'environments/environment';
|
||||
import {Observable} from 'rxjs';
|
||||
import {ReportData} from '../../models/report-data';
|
||||
import {ChartData} from 'app/monitor/models/chart-data';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { environment } from 'environments/environment';
|
||||
import { Observable } from 'rxjs';
|
||||
import { ChartData } from 'app/monitor/models/chart-data';
|
||||
import { ReportData } from '../../models/report-data';
|
||||
|
||||
const monitorUrl = '/v1/monitor/';
|
||||
|
||||
@Injectable()
|
||||
export class RestConnectorService {
|
||||
|
||||
|
||||
constructor(private httpClient: HttpClient) {
|
||||
}
|
||||
|
||||
getTaskStatusReport(): Observable<ReportData> {
|
||||
return this.httpClient.get<ReportData>(environment.taskanaRestUrl + monitorUrl
|
||||
+ 'tasks-status-report?states=READY,CLAIMED,COMPLETED');
|
||||
return this.httpClient.get<ReportData>(`${environment.taskanaRestUrl + monitorUrl
|
||||
}tasks-status-report?states=READY,CLAIMED,COMPLETED`);
|
||||
}
|
||||
|
||||
getWorkbasketStatisticsQueryingByDueDate(): Observable<ReportData> {
|
||||
return this.httpClient.get<ReportData>(environment.taskanaRestUrl
|
||||
+ monitorUrl + 'tasks-workbasket-report?states=READY,CLAIMED,COMPLETED');
|
||||
return this.httpClient.get<ReportData>(`${environment.taskanaRestUrl
|
||||
+ monitorUrl}tasks-workbasket-report?states=READY,CLAIMED,COMPLETED`);
|
||||
}
|
||||
|
||||
getWorkbasketStatisticsQueryingByPlannedDate(): Observable<ReportData> {
|
||||
return this.httpClient.get<ReportData>(environment.taskanaRestUrl
|
||||
+ '/v1/monitor/tasks-workbasket-planned-date-report?daysInPast=7&states=READY,CLAIMED,COMPLETED');
|
||||
return this.httpClient.get<ReportData>(`${environment.taskanaRestUrl
|
||||
}/v1/monitor/tasks-workbasket-planned-date-report?daysInPast=7&states=READY,CLAIMED,COMPLETED`);
|
||||
}
|
||||
|
||||
getClassificationTasksReport(): Observable<ReportData> {
|
||||
return this.httpClient.get<ReportData>(environment.taskanaRestUrl
|
||||
+ monitorUrl + 'tasks-classification-report');
|
||||
return this.httpClient.get<ReportData>(`${environment.taskanaRestUrl
|
||||
+ monitorUrl}tasks-classification-report`);
|
||||
}
|
||||
|
||||
getDailyEntryExitReport(): Observable<ReportData> {
|
||||
return this.httpClient.get<ReportData>(environment.taskanaRestUrl
|
||||
+ monitorUrl + 'timestamp-report');
|
||||
return this.httpClient.get<ReportData>(`${environment.taskanaRestUrl
|
||||
+ monitorUrl}timestamp-report`);
|
||||
}
|
||||
|
||||
getChartData(source: ReportData): Array<ChartData> {
|
||||
|
|
|
@ -8,7 +8,7 @@ describe('TasksComponent', () => {
|
|||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ TasksComponent ]
|
||||
declarations: [TasksComponent]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import {Component, OnInit} from '@angular/core';
|
||||
import {RestConnectorService} from '../services/restConnector/rest-connector.service';
|
||||
import {ReportData} from 'app/monitor/models/report-data';
|
||||
import {RequestInProgressService} from '../../services/requestInProgress/request-in-progress.service';
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
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';
|
||||
|
||||
@Component({
|
||||
selector: 'taskana-monitor-tasks',
|
||||
|
@ -9,25 +9,24 @@ import {RequestInProgressService} from '../../services/requestInProgress/request
|
|||
styleUrls: ['./tasks.component.scss'],
|
||||
})
|
||||
export class TasksComponent implements OnInit {
|
||||
|
||||
|
||||
pieChartLabels: string[];
|
||||
pieChartData: number[] = [];
|
||||
pieChartType = 'pie';
|
||||
reportData: ReportData
|
||||
reportData: ReportData;
|
||||
|
||||
constructor(
|
||||
private restConnectorService: RestConnectorService,
|
||||
private requestInProgressService: RequestInProgressService) {
|
||||
private requestInProgressService: RequestInProgressService
|
||||
) {
|
||||
}
|
||||
|
||||
async ngOnInit() {
|
||||
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.reportData.sumRow[0].cells.forEach(c => {
|
||||
this.pieChartData.push(c);
|
||||
})
|
||||
});
|
||||
this.requestInProgressService.setRequestInProgress(false);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import {Component, OnInit} from '@angular/core';
|
||||
import {ReportData} from '../models/report-data';
|
||||
import {RestConnectorService} from '../services/restConnector/rest-connector.service';
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { ReportData } from '../models/report-data';
|
||||
import { RestConnectorService } from '../services/restConnector/rest-connector.service';
|
||||
|
||||
@Component({
|
||||
selector: 'taskana-monitor-timestamp',
|
||||
|
@ -8,7 +8,6 @@ import {RestConnectorService} from '../services/restConnector/rest-connector.ser
|
|||
styleUrls: ['./timestamp.component.scss']
|
||||
})
|
||||
export class TimestampComponent implements OnInit {
|
||||
|
||||
reportData: ReportData;
|
||||
|
||||
constructor(private restConnectorService: RestConnectorService) {
|
||||
|
@ -17,7 +16,6 @@ export class TimestampComponent implements OnInit {
|
|||
ngOnInit() {
|
||||
this.restConnectorService.getDailyEntryExitReport().subscribe((data: ReportData) => {
|
||||
this.reportData = data;
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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', () => {
|
||||
let component: MonitorWorkbasketDueDateComponent;
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
import {Component, EventEmitter, OnInit, Output} from '@angular/core';
|
||||
import {ReportData} from '../../models/report-data';
|
||||
import {ChartData} from '../../models/chart-data';
|
||||
import {ChartColorsDefinition} from '../../models/chart-colors';
|
||||
import {RestConnectorService} from '../../services/restConnector/rest-connector.service';
|
||||
import {MetaInfoData} from '../../models/meta-info-data';
|
||||
import {RequestInProgressService} from '../../../services/requestInProgress/request-in-progress.service';
|
||||
import { Component, EventEmitter, OnInit, Output } from '@angular/core';
|
||||
import { ReportData } from '../../models/report-data';
|
||||
import { ChartData } from '../../models/chart-data';
|
||||
import { ChartColorsDefinition } from '../../models/chart-colors';
|
||||
import { RestConnectorService } from '../../services/restConnector/rest-connector.service';
|
||||
import { MetaInfoData } from '../../models/meta-info-data';
|
||||
import { RequestInProgressService } from '../../../services/requestInProgress/request-in-progress.service';
|
||||
|
||||
@Component({
|
||||
selector: 'taskana-monitor-workbasket-due-date',
|
||||
|
@ -12,9 +12,8 @@ import {RequestInProgressService} from '../../../services/requestInProgress/requ
|
|||
styleUrls: ['./monitor-workbasket-due-date.component.scss']
|
||||
})
|
||||
export class MonitorWorkbasketDueDateComponent implements OnInit {
|
||||
|
||||
@Output()
|
||||
metaInformation = new EventEmitter<MetaInfoData>()
|
||||
metaInformation = new EventEmitter<MetaInfoData>();
|
||||
|
||||
reportData: ReportData;
|
||||
|
||||
|
@ -26,11 +25,13 @@ export class MonitorWorkbasketDueDateComponent implements OnInit {
|
|||
lineChartOptions: any = {
|
||||
responsive: true
|
||||
};
|
||||
|
||||
lineChartColors = ChartColorsDefinition.getColors();
|
||||
|
||||
constructor(
|
||||
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.requestInProgressService.setRequestInProgress(false);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ describe('MonitorWorkbasketQuerySwitcherComponent', () => {
|
|||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ MonitorWorkbasketQuerySwitcherComponent ]
|
||||
declarations: [MonitorWorkbasketQuerySwitcherComponent]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import {Component, EventEmitter, OnInit, Output} from '@angular/core';
|
||||
import {MonitorQueryType} from '../../models/monitor-query-type';
|
||||
import { Component, EventEmitter, OnInit, Output } from '@angular/core';
|
||||
import { MonitorQueryType } from '../../models/monitor-query-type';
|
||||
|
||||
@Component({
|
||||
selector: 'taskana-monitor-workbasket-query-switcher',
|
||||
|
@ -7,9 +7,9 @@ import {MonitorQueryType} from '../../models/monitor-query-type';
|
|||
styleUrls: ['./monitor-workbasket-query-switcher.component.scss']
|
||||
})
|
||||
export class MonitorWorkbasketQuerySwitcherComponent implements OnInit {
|
||||
|
||||
@Output()
|
||||
queryChanged = new EventEmitter<MonitorQueryType>();
|
||||
|
||||
selectedChartType: MonitorQueryType;
|
||||
monitorQueryPlannedDateType = MonitorQueryType.PlannedDate;
|
||||
monitorQueryDueDateType = MonitorQueryType.DueDate;
|
||||
|
@ -26,5 +26,4 @@ export class MonitorWorkbasketQuerySwitcherComponent implements OnInit {
|
|||
this.selectedChartType = queryType;
|
||||
this.queryChanged.emit(queryType);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ describe('MonitorWorkbasketsComponent', () => {
|
|||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ MonitorWorkbasketsComponent ]
|
||||
declarations: [MonitorWorkbasketsComponent]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import {Component, OnInit} from '@angular/core';
|
||||
import {MetaInfoData} from '../models/meta-info-data';
|
||||
import {MonitorQueryType} from '../models/monitor-query-type';
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { MetaInfoData } from '../models/meta-info-data';
|
||||
import { MonitorQueryType } from '../models/monitor-query-type';
|
||||
|
||||
@Component({
|
||||
selector: 'taskana-monitor-workbaskets',
|
||||
|
@ -8,7 +8,6 @@ import {MonitorQueryType} from '../models/monitor-query-type';
|
|||
styleUrls: ['./monitor-workbaskets.component.scss']
|
||||
})
|
||||
export class MonitorWorkbasketsComponent implements OnInit {
|
||||
|
||||
metaInformation: MetaInfoData;
|
||||
showMonitorQueryPlannedDate: Boolean;
|
||||
showMonitorQueryDueDate: Boolean;
|
||||
|
@ -28,18 +27,18 @@ export class MonitorWorkbasketsComponent implements OnInit {
|
|||
}
|
||||
|
||||
getTitle(): string {
|
||||
return this.showMonitorQueryPlannedDate ?
|
||||
'Tasks grouped by workbasket, querying by planned date' :
|
||||
'Tasks grouped by workbasket, querying by due date';
|
||||
return this.showMonitorQueryPlannedDate
|
||||
? 'Tasks grouped by workbasket, querying by planned date'
|
||||
: 'Tasks grouped by workbasket, querying by due date';
|
||||
}
|
||||
|
||||
private switchGraphicShowed(monitorQueryType: MonitorQueryType) {
|
||||
if (monitorQueryType === MonitorQueryType.PlannedDate) {
|
||||
this.showMonitorQueryPlannedDate = true;
|
||||
this.showMonitorQueryDueDate = false
|
||||
this.showMonitorQueryDueDate = false;
|
||||
} else if (monitorQueryType === MonitorQueryType.DueDate) {
|
||||
this.showMonitorQueryPlannedDate = false;
|
||||
this.showMonitorQueryDueDate = true
|
||||
this.showMonitorQueryDueDate = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ describe('MonitorWorkbasketPlannedDateComponent', () => {
|
|||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ MonitorWorkbasketPlannedDateComponent ]
|
||||
declarations: [MonitorWorkbasketPlannedDateComponent]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
import {Component, EventEmitter, OnInit, Output} from '@angular/core';
|
||||
import {ReportData} from '../../models/report-data';
|
||||
import {ChartData} from '../../models/chart-data';
|
||||
import {ChartColorsDefinition} from '../../models/chart-colors';
|
||||
import {RestConnectorService} from '../../services/restConnector/rest-connector.service';
|
||||
import {MetaInfoData} from '../../models/meta-info-data';
|
||||
import {RequestInProgressService} from '../../../services/requestInProgress/request-in-progress.service';
|
||||
import { Component, EventEmitter, OnInit, Output } from '@angular/core';
|
||||
import { ReportData } from '../../models/report-data';
|
||||
import { ChartData } from '../../models/chart-data';
|
||||
import { ChartColorsDefinition } from '../../models/chart-colors';
|
||||
import { RestConnectorService } from '../../services/restConnector/rest-connector.service';
|
||||
import { MetaInfoData } from '../../models/meta-info-data';
|
||||
import { RequestInProgressService } from '../../../services/requestInProgress/request-in-progress.service';
|
||||
|
||||
@Component({
|
||||
selector: 'taskana-monitor-workbasket-planned-date',
|
||||
|
@ -12,9 +12,8 @@ import {RequestInProgressService} from '../../../services/requestInProgress/requ
|
|||
styleUrls: ['./monitor-workbasket-planned-date.component.scss']
|
||||
})
|
||||
export class MonitorWorkbasketPlannedDateComponent implements OnInit {
|
||||
|
||||
@Output()
|
||||
metaInformation = new EventEmitter<MetaInfoData>()
|
||||
metaInformation = new EventEmitter<MetaInfoData>();
|
||||
|
||||
reportData: ReportData;
|
||||
|
||||
|
@ -25,13 +24,15 @@ export class MonitorWorkbasketPlannedDateComponent implements OnInit {
|
|||
lineChartData: Array<ChartData>;
|
||||
lineChartOptions: any = {
|
||||
responsive: true,
|
||||
scales: {xAxes: [{}], yAxes: [{}]},
|
||||
scales: { xAxes: [{}], yAxes: [{}] },
|
||||
};
|
||||
|
||||
lineChartColors = ChartColorsDefinition.getColors();
|
||||
|
||||
constructor(
|
||||
private restConnectorService: RestConnectorService,
|
||||
private requestInProgressService: RequestInProgressService) {
|
||||
private requestInProgressService: RequestInProgressService
|
||||
) {
|
||||
}
|
||||
|
||||
async ngOnInit() {
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
import { Injectable } from '@angular/core';
|
||||
import { Subject , Observable } from 'rxjs';
|
||||
import { Subject, Observable } from 'rxjs';
|
||||
import { AlertModel } from 'app/models/alert';
|
||||
|
||||
@Injectable()
|
||||
export class AlertService {
|
||||
|
||||
public alertTriggered = new Subject<AlertModel>();
|
||||
|
||||
constructor() { }
|
||||
|
|
|
@ -14,7 +14,7 @@ describe('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);
|
||||
expect(returnedValue).toBe(categoriesData);
|
||||
expect(service).toBeTruthy();
|
||||
|
@ -25,10 +25,10 @@ describe('CustomFieldsService', () => {
|
|||
service.initCustomFields('EN', json);
|
||||
const categoriesDefault = json.EN.classifications.categories;
|
||||
const categoriesData = {
|
||||
'EXTERNAL': 'assets/icons/categories/external.svg',
|
||||
'MANUAL': 'assets/icons/categories/manual.svg',
|
||||
'AUTOMATIC': 'assets/icons/categories/automatic.svg',
|
||||
'PROCESS': 'assets/icons/categories/external.svg'
|
||||
EXTERNAL: 'assets/icons/categories/external.svg',
|
||||
MANUAL: 'assets/icons/categories/manual.svg',
|
||||
AUTOMATIC: 'assets/icons/categories/automatic.svg',
|
||||
PROCESS: 'assets/icons/categories/external.svg'
|
||||
};
|
||||
const returnedValue = service.getCustomObject(categoriesData, 'classifications.categories');
|
||||
expect(returnedValue).toEqual(categoriesDefault);
|
||||
|
@ -38,13 +38,13 @@ describe('CustomFieldsService', () => {
|
|||
it('should take merge icon path', inject([CustomFieldsService], (service: CustomFieldsService) => {
|
||||
const json = require('./taskana-customization-test.json');
|
||||
service.initCustomFields('EN', json);
|
||||
const categoriesData = {'DEFAULT': 'assets/icons/categories/default.svg'}
|
||||
const categoriesData = { DEFAULT: 'assets/icons/categories/default.svg' };
|
||||
const result = {
|
||||
'AUTOMATIC': 'assets/icons/categories/automatic.svg',
|
||||
'DEFAULT': 'assets/icons/categories/default.svg',
|
||||
'EXTERNAL': 'assets/icons/categories/external.svg',
|
||||
'MANUAL': 'assets/icons/categories/manual.svg',
|
||||
'PROCESS': 'assets/icons/categories/process.svg'
|
||||
AUTOMATIC: 'assets/icons/categories/automatic.svg',
|
||||
DEFAULT: 'assets/icons/categories/default.svg',
|
||||
EXTERNAL: 'assets/icons/categories/external.svg',
|
||||
MANUAL: 'assets/icons/categories/manual.svg',
|
||||
PROCESS: 'assets/icons/categories/process.svg'
|
||||
};
|
||||
const returnedValue = service.getCustomObject(categoriesData, 'classifications.categories');
|
||||
expect(returnedValue).toEqual(result);
|
||||
|
|
|
@ -12,7 +12,7 @@ export class CustomFieldsService {
|
|||
|
||||
getCustomField(fallbacktext: string, customPath?: string): CustomField {
|
||||
if (!customPath) {
|
||||
return new CustomField(true, fallbacktext)
|
||||
return new CustomField(true, fallbacktext);
|
||||
}
|
||||
return this.jsonPath(customPath, fallbacktext);
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ export class CustomFieldsService {
|
|||
private jsonPath(path: string, fallbacktext: string): CustomField {
|
||||
if (!this.customizedFields) {
|
||||
return new CustomField(true, fallbacktext);
|
||||
};
|
||||
}
|
||||
const paths = path.split('.');
|
||||
let value = this.customizedFields;
|
||||
paths.every(element => {
|
||||
|
@ -46,13 +46,13 @@ export class CustomFieldsService {
|
|||
private jsonPathObject(path: string, fallbackObject: Object): Object {
|
||||
if (!this.customizedFields) {
|
||||
return fallbackObject;
|
||||
};
|
||||
}
|
||||
const paths = path.split('.');
|
||||
let value = this.customizedFields;
|
||||
paths.every(element => {
|
||||
value = value[element];
|
||||
if (!value) {
|
||||
value = fallbackObject
|
||||
value = fallbackObject;
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
@ -80,5 +80,4 @@ private mergeKeys(defaultObject: Object, newObject: Object) {
|
|||
|
||||
return value;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -3,8 +3,6 @@ import { Observable, BehaviorSubject, of } from 'rxjs';
|
|||
|
||||
@Injectable()
|
||||
export class DomainServiceMock {
|
||||
|
||||
|
||||
private domainSelectedValue;
|
||||
private domainSelected = new BehaviorSubject<string>('DOMAIN_A');
|
||||
|
||||
|
@ -38,6 +36,6 @@ export class DomainServiceMock {
|
|||
}
|
||||
|
||||
switchDomain(value: string) {
|
||||
this.selectDomain(value)
|
||||
this.selectDomain(value);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,15 +1,14 @@
|
|||
import { Injectable } from '@angular/core';
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { Observable, ReplaySubject } from 'rxjs';
|
||||
import { environment } from '../../../environments/environment';
|
||||
import { Observable, ReplaySubject } from 'rxjs';
|
||||
import { Router } from '@angular/router';
|
||||
import { environment } from '../../../environments/environment';
|
||||
import { RequestInProgressService } from '../requestInProgress/request-in-progress.service';
|
||||
import { SelectedRouteService } from '../selected-route/selected-route';
|
||||
|
||||
@Injectable()
|
||||
export class DomainService {
|
||||
|
||||
url = environment.taskanaRestUrl + '/v1/domains';
|
||||
url = `${environment.taskanaRestUrl}/v1/domains`;
|
||||
|
||||
private domainRestValue: Array<string> = new Array<string>();
|
||||
private domainValue: Array<string> = new Array<string>();
|
||||
|
@ -22,10 +21,11 @@ export class DomainService {
|
|||
private httpClient: HttpClient,
|
||||
private router: Router,
|
||||
private requestInProgressService: RequestInProgressService,
|
||||
private selectedRouteService: SelectedRouteService) {
|
||||
private selectedRouteService: SelectedRouteService
|
||||
) {
|
||||
this.selectedRouteService.getSelectedRoute().subscribe((value: string) => {
|
||||
if (value.indexOf('workbaskets') === 0) {
|
||||
this.hasMasterDomain = false
|
||||
this.hasMasterDomain = false;
|
||||
this.removeMasterDomain();
|
||||
if (this.domainSelectedValue === '') {
|
||||
this.selectDomain(this.domainValue[0]);
|
||||
|
@ -35,7 +35,6 @@ export class DomainService {
|
|||
this.addMasterDomain();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
// GET
|
||||
|
@ -108,7 +107,7 @@ export class DomainService {
|
|||
private getNavigationUrl(): string {
|
||||
if (this.router.url.indexOf('workbaskets') !== -1) {
|
||||
return 'taskana/administration/workbaskets';
|
||||
} else if (this.router.url.indexOf('classifications') !== -1) {
|
||||
} if (this.router.url.indexOf('classifications') !== -1) {
|
||||
return 'taskana/administration/classifications';
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
import { Injectable } from '@angular/core';
|
||||
import { Subject , Observable } from 'rxjs';
|
||||
import { Subject, Observable } from 'rxjs';
|
||||
import { MessageModal } from 'app/models/message-modal';
|
||||
|
||||
@Injectable()
|
||||
export class GeneralModalService {
|
||||
|
||||
private messageTriggered = new Subject<MessageModal>();
|
||||
|
||||
constructor() { }
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { Injectable } from '@angular/core';
|
||||
import { Observable , BehaviorSubject } from 'rxjs';
|
||||
import { Observable, BehaviorSubject } from 'rxjs';
|
||||
|
||||
@Injectable()
|
||||
export class MasterAndDetailService {
|
||||
|
@ -15,5 +15,4 @@ export class MasterAndDetailService {
|
|||
getShowDetail() {
|
||||
return this.showDetail.asObservable();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
import { Injectable } from '@angular/core';
|
||||
import { Orientation } from 'app/models/orientation';
|
||||
import { BehaviorSubject , Observable } from 'rxjs';
|
||||
import { BehaviorSubject, Observable } from 'rxjs';
|
||||
import { TaskanaQueryParameters } from 'app/shared/util/query-parameters';
|
||||
|
||||
@Injectable()
|
||||
export class OrientationService {
|
||||
|
||||
private lock = false;
|
||||
private currentOrientation;
|
||||
public orientation = new BehaviorSubject<Orientation>(this.currentOrientation);
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
import { Injectable } from '@angular/core';
|
||||
import { Subject , Observable } from 'rxjs';
|
||||
import { Subject, Observable } from 'rxjs';
|
||||
|
||||
@Injectable()
|
||||
export class RemoveConfirmationService {
|
||||
|
||||
private removeConfirmationCallbackSubject = new Subject<{ callback: Function, message: string }>();
|
||||
private removeConfirmationCallback: Function;
|
||||
|
||||
|
@ -11,7 +10,7 @@ export class RemoveConfirmationService {
|
|||
|
||||
setRemoveConfirmation(callback: Function, message: string) {
|
||||
this.removeConfirmationCallback = callback;
|
||||
this.removeConfirmationCallbackSubject.next({ callback: callback, message: message });
|
||||
this.removeConfirmationCallbackSubject.next({ callback, message });
|
||||
}
|
||||
|
||||
getRemoveConfirmation(): Observable<{ callback: Function, message: string }> {
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
import { Injectable } from '@angular/core';
|
||||
import { Subject , Observable } from 'rxjs';
|
||||
import { Subject, Observable } from 'rxjs';
|
||||
|
||||
@Injectable()
|
||||
export class RequestInProgressService {
|
||||
|
||||
public requestInProgressTriggered = new Subject<boolean>();
|
||||
|
||||
constructor() { }
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
import { Injectable, OnInit } from '@angular/core';
|
||||
import { Subject , Observable } from 'rxjs';
|
||||
import { Subject, Observable } from 'rxjs';
|
||||
import { Router, ActivatedRoute, NavigationStart } from '@angular/router';
|
||||
|
||||
@Injectable()
|
||||
export class SelectedRouteService {
|
||||
|
||||
public selectedRouteTriggered = new Subject<string>();
|
||||
|
||||
private detailRoutes: Array<string> = ['workbaskets', 'classifications', 'monitor', 'workplace', 'access-items-management', 'history'];
|
||||
|
@ -24,7 +23,7 @@ export class SelectedRouteService {
|
|||
if (!event) {
|
||||
return this.checkUrl(this.router.url);
|
||||
}
|
||||
return this.checkUrl(event.url)
|
||||
return this.checkUrl(event.url);
|
||||
}
|
||||
|
||||
private checkUrl(url: string): string {
|
||||
|
|
|
@ -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 {CustomFieldsService} from '../custom-fields/custom-fields.service';
|
||||
import {TaskanaEngineService} from '../taskana-engine/taskana-engine.service';
|
||||
import {WindowRefService} from '../window/window.service';
|
||||
import {environment} from '../../../environments/environment';
|
||||
import {HttpClientTestingModule, HttpTestingController} from '@angular/common/http/testing';
|
||||
import { HttpClient, HttpClientModule } from '@angular/common/http';
|
||||
import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing';
|
||||
import { StartupService } from './startup.service';
|
||||
import { CustomFieldsService } from '../custom-fields/custom-fields.service';
|
||||
import { TaskanaEngineService } from '../taskana-engine/taskana-engine.service';
|
||||
import { WindowRefService } from '../window/window.service';
|
||||
import { environment } from '../../../environments/environment';
|
||||
|
||||
describe('StartupService', () => {
|
||||
const environmentFile = 'environments/data-sources/environment-information.json';
|
||||
const someRestUrl = 'someRestUrl';
|
||||
const someLogoutUrl = 'someLogoutUrl';
|
||||
const dummyEnvironmentInformation = {
|
||||
'taskanaRestUrl': someRestUrl,
|
||||
'taskanaLogoutUrl': someLogoutUrl
|
||||
taskanaRestUrl: someRestUrl,
|
||||
taskanaLogoutUrl: someLogoutUrl
|
||||
};
|
||||
|
||||
let httpMock, service;
|
||||
let httpMock; let
|
||||
service;
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
|
@ -46,10 +47,10 @@ describe('StartupService', () => {
|
|||
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.taskanaLogoutUrl = '';
|
||||
service.getEnvironmentFilePromise().then((res) => {
|
||||
service.getEnvironmentFilePromise().then(res => {
|
||||
expect(environment.taskanaRestUrl).toBe(someRestUrl);
|
||||
expect(environment.taskanaLogoutUrl).toBe(someLogoutUrl);
|
||||
done();
|
||||
|
@ -60,10 +61,10 @@ describe('StartupService', () => {
|
|||
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.taskanaLogoutUrl = 'oldLogoutUrl';
|
||||
service.getEnvironmentFilePromise().then((res) => {
|
||||
service.getEnvironmentFilePromise().then(res => {
|
||||
expect(environment.taskanaRestUrl).toBe(someRestUrl);
|
||||
expect(environment.taskanaLogoutUrl).toBe(someLogoutUrl);
|
||||
done();
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
import {of} from 'rxjs';
|
||||
import {HttpClient} from '@angular/common/http';
|
||||
import {Router} from '@angular/router';
|
||||
import {environment} from 'app/../environments/environment';
|
||||
import {Injectable, Injector} from '@angular/core';
|
||||
import {CustomFieldsService} from 'app/services/custom-fields/custom-fields.service';
|
||||
import {TaskanaEngineService} from 'app/services/taskana-engine/taskana-engine.service';
|
||||
import {map} from 'rxjs/operators';
|
||||
import {WindowRefService} from 'app/services/window/window.service';
|
||||
import { of } from 'rxjs';
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { Router } from '@angular/router';
|
||||
import { environment } from 'app/../environments/environment';
|
||||
import { Injectable, Injector } from '@angular/core';
|
||||
import { CustomFieldsService } from 'app/services/custom-fields/custom-fields.service';
|
||||
import { TaskanaEngineService } from 'app/services/taskana-engine/taskana-engine.service';
|
||||
import { map } from 'rxjs/operators';
|
||||
import { WindowRefService } from 'app/services/window/window.service';
|
||||
|
||||
@Injectable()
|
||||
export class StartupService {
|
||||
|
@ -15,7 +15,8 @@ export class StartupService {
|
|||
private customFieldsService: CustomFieldsService,
|
||||
private taskanaEngineService: TaskanaEngineService,
|
||||
private injector: Injector,
|
||||
private window: WindowRefService) {
|
||||
private window: WindowRefService
|
||||
) {
|
||||
}
|
||||
|
||||
public get router(): Router {
|
||||
|
@ -37,9 +38,7 @@ export class StartupService {
|
|||
}
|
||||
this.customFieldsService.initCustomFields('EN', jsonFile);
|
||||
})).toPromise()
|
||||
.catch(() => {
|
||||
return of(true)
|
||||
});
|
||||
.catch(() => of(true));
|
||||
}
|
||||
|
||||
geCustomizedFieldsFilePromise() {
|
||||
|
@ -48,9 +47,7 @@ export class StartupService {
|
|||
this.customFieldsService.initCustomFields('EN', jsonFile);
|
||||
}
|
||||
})).toPromise()
|
||||
.catch(() => {
|
||||
return of(true)
|
||||
});
|
||||
.catch(() => of(true));
|
||||
}
|
||||
|
||||
private loadEnvironment() {
|
||||
|
@ -60,7 +57,7 @@ export class StartupService {
|
|||
() => this.taskanaEngineService.getUserInformation()
|
||||
).catch(error => {
|
||||
console.log(error);
|
||||
//this.window.nativeWindow.location.href = environment.taskanaRestUrl + '/login';
|
||||
// this.window.nativeWindow.location.href = environment.taskanaRestUrl + '/login';
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,7 +5,6 @@ import { VersionModel } from '../../models/version';
|
|||
|
||||
@Injectable()
|
||||
export class TaskanaEngineServiceMock {
|
||||
|
||||
currentUserInfo: UserInfoModel;
|
||||
|
||||
constructor(
|
||||
|
@ -39,12 +38,10 @@ export class TaskanaEngineServiceMock {
|
|||
}
|
||||
|
||||
private findRole(roles2Find: Array<string>) {
|
||||
return this.currentUserInfo.roles.find(role => {
|
||||
return roles2Find.some(roleLookingFor => {
|
||||
return this.currentUserInfo.roles.find(role => roles2Find.some(roleLookingFor => {
|
||||
if (role === roleLookingFor) {
|
||||
return true;
|
||||
}
|
||||
});
|
||||
});
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,7 +9,6 @@ import { map } from 'rxjs/operators';
|
|||
|
||||
@Injectable()
|
||||
export class TaskanaEngineService {
|
||||
|
||||
currentUserInfo: UserInfoModel;
|
||||
|
||||
constructor(
|
||||
|
@ -20,8 +19,9 @@ export class TaskanaEngineService {
|
|||
getUserInformation(): Promise<any> {
|
||||
return this.httpClient.get<any>(`${environment.taskanaRestUrl}/v1/current-user-info`).pipe(map(
|
||||
data => {
|
||||
this.currentUserInfo = data
|
||||
})).toPromise();
|
||||
this.currentUserInfo = data;
|
||||
}
|
||||
)).toPromise();
|
||||
}
|
||||
|
||||
hasRole(roles2Find: Array<string>): boolean {
|
||||
|
@ -41,7 +41,6 @@ export class TaskanaEngineService {
|
|||
logout(): Observable<string> {
|
||||
return this.httpClient
|
||||
.post<string>(`${environment.taskanaLogoutUrl}`, '');
|
||||
|
||||
}
|
||||
|
||||
isHistoryProviderEnabled(): Observable<boolean> {
|
||||
|
@ -49,12 +48,10 @@ export class TaskanaEngineService {
|
|||
}
|
||||
|
||||
private findRole(roles2Find: Array<string>) {
|
||||
return this.currentUserInfo.roles.find(role => {
|
||||
return roles2Find.some(roleLookingFor => {
|
||||
return this.currentUserInfo.roles.find(role => roles2Find.some(roleLookingFor => {
|
||||
if (role === roleLookingFor) {
|
||||
return true;
|
||||
}
|
||||
});
|
||||
});
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,7 +2,6 @@ import { Injectable } from '@angular/core';
|
|||
|
||||
@Injectable()
|
||||
export class TitlesService {
|
||||
|
||||
titles = new Map<number, string>();
|
||||
customizedTitles: any = {};
|
||||
constructor() { }
|
||||
|
@ -12,7 +11,6 @@ export class TitlesService {
|
|||
}
|
||||
|
||||
getTitle(id: number, fallBacktext: string, customPath?: string) {
|
||||
|
||||
return this.titles[id] ? this.titles[id] : fallBacktext
|
||||
return this.titles[id] ? this.titles[id] : fallBacktext;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,7 +3,6 @@ import { Subject } from 'rxjs';
|
|||
|
||||
@Injectable()
|
||||
export class TreeService {
|
||||
|
||||
public removedNodeId = new Subject<string>();
|
||||
|
||||
constructor() { }
|
||||
|
@ -15,5 +14,4 @@ export class TreeService {
|
|||
getRemovedNodeId() {
|
||||
return this.removedNodeId.asObservable();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue