TSK-1163: implemented error modal and replaced dangling error messages
since TSK-931 introduced a new error model with a corresponding service I removed all dangling error messages and replaced then with the corresponding error key
This commit is contained in:
parent
7eab4d5f2e
commit
76c59ed3f7
File diff suppressed because it is too large
Load Diff
|
|
@ -1,5 +1,5 @@
|
||||||
import { Component, OnInit, OnDestroy } from '@angular/core';
|
import { Component, OnDestroy, OnInit } from '@angular/core';
|
||||||
import { FormBuilder, FormArray, Validators, FormGroup, FormControl } from '@angular/forms';
|
import { FormArray, FormBuilder, FormControl, FormGroup, Validators } from '@angular/forms';
|
||||||
import { CustomFieldsService } from 'app/services/custom-fields/custom-fields.service';
|
import { CustomFieldsService } from 'app/services/custom-fields/custom-fields.service';
|
||||||
|
|
||||||
import { Subscription } from 'rxjs';
|
import { Subscription } from 'rxjs';
|
||||||
|
|
@ -16,7 +16,8 @@ import { AlertService } from 'app/services/alert/alert.service';
|
||||||
import { RequestInProgressService } from '../../services/requestInProgress/request-in-progress.service';
|
import { RequestInProgressService } from '../../services/requestInProgress/request-in-progress.service';
|
||||||
import { AccessIdsService } from '../../shared/services/access-ids/access-ids.service';
|
import { AccessIdsService } from '../../shared/services/access-ids/access-ids.service';
|
||||||
import { AccessIdDefinition } from '../../models/access-id';
|
import { AccessIdDefinition } from '../../models/access-id';
|
||||||
import { ERROR_TYPES } from '../../services/general-modal/errors';
|
import { ErrorsService } from "../../services/errors/errors.service";
|
||||||
|
import { ERROR_TYPES } from "../../models/errors";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'taskana-access-items-management',
|
selector: 'taskana-access-items-management',
|
||||||
|
|
@ -53,6 +54,27 @@ export class AccessItemsManagementComponent implements OnInit, OnDestroy {
|
||||||
custom11Field = this.customFieldsService.getCustomField('Custom 11', 'workbaskets.access-items.custom11');
|
custom11Field = this.customFieldsService.getCustomField('Custom 11', 'workbaskets.access-items.custom11');
|
||||||
custom12Field = this.customFieldsService.getCustomField('Custom 12', 'workbaskets.access-items.custom12');
|
custom12Field = this.customFieldsService.getCustomField('Custom 12', 'workbaskets.access-items.custom12');
|
||||||
|
|
||||||
|
constructor(private formBuilder: FormBuilder,
|
||||||
|
private customFieldsService: CustomFieldsService,
|
||||||
|
private accessIdsService: AccessIdsService,
|
||||||
|
private formsValidatorService: FormsValidatorService,
|
||||||
|
private requestInProgressService: RequestInProgressService,
|
||||||
|
private removeConfirmationService: RemoveConfirmationService,
|
||||||
|
private alertService: AlertService,
|
||||||
|
private generalModalService: GeneralModalService,
|
||||||
|
private errorsService: ErrorsService) {
|
||||||
|
}
|
||||||
|
|
||||||
|
get accessItemsGroups(): FormArray {
|
||||||
|
return this.AccessItemsForm ? this.AccessItemsForm.get('accessItemsGroups') as FormArray : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static unSubscribe(subscription: Subscription): void {
|
||||||
|
if (subscription) {
|
||||||
|
subscription.unsubscribe();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
setAccessItemsGroups(accessItems: Array<AccessItemWorkbasket>) {
|
setAccessItemsGroups(accessItems: Array<AccessItemWorkbasket>) {
|
||||||
const AccessItemsFormGroups = accessItems.map(accessItem => this.formBuilder.group(accessItem));
|
const AccessItemsFormGroups = accessItems.map(accessItem => this.formBuilder.group(accessItem));
|
||||||
AccessItemsFormGroups.forEach(accessItemGroup => {
|
AccessItemsFormGroups.forEach(accessItemGroup => {
|
||||||
|
|
@ -62,25 +84,18 @@ export class AccessItemsManagementComponent implements OnInit, OnDestroy {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
const AccessItemsFormArray = this.formBuilder.array(AccessItemsFormGroups);
|
const AccessItemsFormArray = this.formBuilder.array(AccessItemsFormGroups);
|
||||||
if (!this.AccessItemsForm) { this.AccessItemsForm = this.formBuilder.group({}); }
|
if (!this.AccessItemsForm) {
|
||||||
|
this.AccessItemsForm = this.formBuilder.group({});
|
||||||
|
}
|
||||||
this.AccessItemsForm.setControl('accessItemsGroups', AccessItemsFormArray);
|
this.AccessItemsForm.setControl('accessItemsGroups', AccessItemsFormArray);
|
||||||
if (!this.AccessItemsForm.value.workbasketKeyFilter) { this.AccessItemsForm.addControl('workbasketKeyFilter', new FormControl()); }
|
if (!this.AccessItemsForm.value.workbasketKeyFilter) {
|
||||||
if (!this.AccessItemsForm.value.accessIdFilter) { this.AccessItemsForm.addControl('accessIdFilter', new FormControl()); }
|
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,
|
|
||||||
private accessIdsService: AccessIdsService,
|
|
||||||
private formsValidatorService: FormsValidatorService,
|
|
||||||
private requestInProgressService: RequestInProgressService,
|
|
||||||
private removeConfirmationService: RemoveConfirmationService,
|
|
||||||
private alertService: AlertService,
|
|
||||||
private generalModalService: GeneralModalService) { }
|
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -93,23 +108,18 @@ export class AccessItemsManagementComponent implements OnInit, OnDestroy {
|
||||||
this.accessIdPrevious = selected.accessId;
|
this.accessIdPrevious = selected.accessId;
|
||||||
this.isGroup = selected.accessId.includes(this.groupsKey);
|
this.isGroup = selected.accessId.includes(this.groupsKey);
|
||||||
|
|
||||||
this.unSubscribe(this.accessItemInformationsubscription);
|
AccessItemsManagementComponent.unSubscribe(this.accessItemInformationsubscription);
|
||||||
this.accessItemInformationsubscription = this.accessIdsService.getAccessItemsInformation(selected.accessId, true)
|
this.accessItemInformationsubscription = this.accessIdsService.getAccessItemsInformation(selected.accessId, true)
|
||||||
.subscribe((accessIdsWithGroups: Array<AccessIdDefinition>) => {
|
.subscribe((accessIdsWithGroups: Array<AccessIdDefinition>) => {
|
||||||
this.accessIdsWithGroups = accessIdsWithGroups;
|
this.accessIdsWithGroups = accessIdsWithGroups;
|
||||||
this.belongingGroups = accessIdsWithGroups.filter(item => item.accessId.includes(this.groupsKey));
|
this.belongingGroups = accessIdsWithGroups.filter(item => item.accessId.includes(this.groupsKey));
|
||||||
this.searchForAccessItemsWorkbaskets();
|
this.searchForAccessItemsWorkbaskets();
|
||||||
},
|
},
|
||||||
// new Key: ERROR_TYPES.FETCH_ERR
|
// new Key: ERROR_TYPES.FETCH_ERR
|
||||||
error => {
|
error => {
|
||||||
this.requestInProgressService.setRequestInProgress(false);
|
this.requestInProgressService.setRequestInProgress(false);
|
||||||
this.generalModalService.triggerMessage(
|
this.errorsService.updateError(ERROR_TYPES.FETCH_ERR, error);
|
||||||
new MessageModal(
|
});
|
||||||
'There was error while retrieving your access ids with groups',
|
|
||||||
error
|
|
||||||
)
|
|
||||||
);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -124,74 +134,58 @@ export class AccessItemsManagementComponent implements OnInit, OnDestroy {
|
||||||
|
|
||||||
searchForAccessItemsWorkbaskets() {
|
searchForAccessItemsWorkbaskets() {
|
||||||
this.requestInProgressService.setRequestInProgress(true);
|
this.requestInProgressService.setRequestInProgress(true);
|
||||||
this.unSubscribe(this.accessItemPermissionsSubscription);
|
AccessItemsManagementComponent.unSubscribe(this.accessItemPermissionsSubscription);
|
||||||
this.accessItemPermissionsSubscription = this.accessIdsService.getAccessItemsPermissions(
|
this.accessItemPermissionsSubscription = this.accessIdsService.getAccessItemsPermissions(
|
||||||
this.accessIdsWithGroups,
|
this.accessIdsWithGroups,
|
||||||
this.AccessItemsForm ? this.AccessItemsForm.value.accessIdFilter : undefined,
|
this.AccessItemsForm ? this.AccessItemsForm.value.accessIdFilter : undefined,
|
||||||
this.AccessItemsForm ? this.AccessItemsForm.value.workbasketKeyFilter : undefined,
|
this.AccessItemsForm ? this.AccessItemsForm.value.workbasketKeyFilter : undefined,
|
||||||
this.sortModel,
|
this.sortModel,
|
||||||
true
|
true
|
||||||
)
|
)
|
||||||
.subscribe((accessItemsResource: AccessItemsWorkbasketResource) => {
|
.subscribe((accessItemsResource: AccessItemsWorkbasketResource) => {
|
||||||
this.setAccessItemsGroups(accessItemsResource ? accessItemsResource.accessItems : []);
|
this.setAccessItemsGroups(accessItemsResource ? accessItemsResource.accessItems : []);
|
||||||
this.requestInProgressService.setRequestInProgress(false);
|
this.requestInProgressService.setRequestInProgress(false);
|
||||||
},
|
},
|
||||||
// new Key: ERROR_TYPES.FETCH_ERR_2
|
error => {
|
||||||
error => {
|
this.requestInProgressService.setRequestInProgress(false);
|
||||||
this.requestInProgressService.setRequestInProgress(false);
|
this.errorsService.updateError(ERROR_TYPES.FETCH_ERR_2, error);
|
||||||
this.generalModalService.triggerMessage(
|
});
|
||||||
new MessageModal(
|
|
||||||
'There was error while retrieving your access items',
|
|
||||||
error
|
|
||||||
)
|
|
||||||
);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
revokeAccess() {
|
revokeAccess() {
|
||||||
this.removeConfirmationService.setRemoveConfirmation(
|
this.removeConfirmationService.setRemoveConfirmation(
|
||||||
this.onRemoveConfirmed.bind(this),
|
this.onRemoveConfirmed.bind(this),
|
||||||
`You are going to delete all access related: ${
|
`You are going to delete all access related: ${
|
||||||
this.accessIdSelected
|
this.accessIdSelected
|
||||||
}. Can you confirm this action?`
|
}. Can you confirm this action?`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ngOnDestroy(): void {
|
||||||
|
AccessItemsManagementComponent.unSubscribe(this.accessItemPermissionsSubscription);
|
||||||
|
AccessItemsManagementComponent.unSubscribe(this.accessItemInformationsubscription);
|
||||||
|
}
|
||||||
|
|
||||||
private onRemoveConfirmed() {
|
private onRemoveConfirmed() {
|
||||||
this.requestInProgressService.setRequestInProgress(true);
|
this.requestInProgressService.setRequestInProgress(true);
|
||||||
this.accessIdsService.removeAccessItemsPermissions(this.accessIdSelected)
|
this.accessIdsService.removeAccessItemsPermissions(this.accessIdSelected)
|
||||||
.subscribe(
|
.subscribe(
|
||||||
// new Key: ALERT_TYPES.SUCCESS_ALERT
|
// new Key: ALERT_TYPES.SUCCESS_ALERT
|
||||||
response => {
|
response => {
|
||||||
this.requestInProgressService.setRequestInProgress(false);
|
this.requestInProgressService.setRequestInProgress(false);
|
||||||
this.alertService.triggerAlert(
|
this.alertService.triggerAlert(
|
||||||
new AlertModel(
|
new AlertModel(
|
||||||
AlertType.SUCCESS,
|
AlertType.SUCCESS,
|
||||||
`${this.accessIdSelected
|
`${this.accessIdSelected
|
||||||
} was removed successfully`
|
} was removed successfully`
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
this.searchForAccessItemsWorkbaskets();
|
this.searchForAccessItemsWorkbaskets();
|
||||||
},
|
},
|
||||||
// new Key: ERROR_TYPES.DELETE_ERR
|
|
||||||
error => {
|
error => {
|
||||||
this.requestInProgressService.setRequestInProgress(false);
|
this.requestInProgressService.setRequestInProgress(false);
|
||||||
this.generalModalService.triggerMessage(
|
this.errorsService.updateError(ERROR_TYPES.DELETE_ERR, error);
|
||||||
new MessageModal(
|
|
||||||
'You can\'t delete a group',
|
|
||||||
error
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
|
||||||
|
|
||||||
private unSubscribe(subscription: Subscription): void {
|
|
||||||
if (subscription) { subscription.unsubscribe(); }
|
|
||||||
}
|
|
||||||
|
|
||||||
ngOnDestroy(): void {
|
|
||||||
this.unSubscribe(this.accessItemPermissionsSubscription);
|
|
||||||
this.unSubscribe(this.accessItemInformationsubscription);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,8 @@ import { NgForm } from '@angular/forms';
|
||||||
import { FormsValidatorService } from 'app/shared/services/forms/forms-validator.service';
|
import { FormsValidatorService } from 'app/shared/services/forms/forms-validator.service';
|
||||||
import { ImportExportService } from 'app/administration/services/import-export/import-export.service';
|
import { ImportExportService } from 'app/administration/services/import-export/import-export.service';
|
||||||
import { CustomFieldsService } from '../../../services/custom-fields/custom-fields.service';
|
import { CustomFieldsService } from '../../../services/custom-fields/custom-fields.service';
|
||||||
import { ERROR_TYPES } from '../../../services/general-modal/errors';
|
import { ERROR_TYPES } from '../../../models/errors';
|
||||||
|
import { ErrorsService } from "../../../services/errors/errors.service";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'taskana-classification-details',
|
selector: 'taskana-classification-details',
|
||||||
|
|
@ -81,6 +82,7 @@ export class ClassificationDetailsComponent implements OnInit, OnDestroy {
|
||||||
private customFieldsService: CustomFieldsService,
|
private customFieldsService: CustomFieldsService,
|
||||||
private removeConfirmationService: RemoveConfirmationService,
|
private removeConfirmationService: RemoveConfirmationService,
|
||||||
private formsValidatorService: FormsValidatorService,
|
private formsValidatorService: FormsValidatorService,
|
||||||
|
private errorsService: ErrorsService,
|
||||||
private importExportService: ImportExportService) {
|
private importExportService: ImportExportService) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -180,9 +182,8 @@ export class ClassificationDetailsComponent implements OnInit, OnDestroy {
|
||||||
this.alertService.triggerAlert(new AlertModel(AlertType.SUCCESS, `Classification ${classification.key} was saved successfully`));
|
this.alertService.triggerAlert(new AlertModel(AlertType.SUCCESS, `Classification ${classification.key} was saved successfully`));
|
||||||
this.afterRequest();
|
this.afterRequest();
|
||||||
},
|
},
|
||||||
// new Key: ERROR_TYPES.CREATE_ERR
|
|
||||||
error => {
|
error => {
|
||||||
this.generalModalService.triggerMessage(new MessageModal('There was an error creating a classification', error));
|
this.errorsService.updateError(ERROR_TYPES.CREATE_ERR, error);
|
||||||
this.afterRequest();
|
this.afterRequest();
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -197,8 +198,7 @@ export class ClassificationDetailsComponent implements OnInit, OnDestroy {
|
||||||
);
|
);
|
||||||
this.cloneClassification(this.classification);
|
this.cloneClassification(this.classification);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
// new Key: ERROR_TYPES.SAVE_ERR
|
this.errorsService.updateError(ERROR_TYPES.SAVE_ERR, error);
|
||||||
this.generalModalService.triggerMessage(new MessageModal('There was error while saving your classification', error));
|
|
||||||
this.afterRequest();
|
this.afterRequest();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -280,10 +280,7 @@ export class ClassificationDetailsComponent implements OnInit, OnDestroy {
|
||||||
|
|
||||||
private removeClassificationConfirmation() {
|
private removeClassificationConfirmation() {
|
||||||
if (!this.classification || !this.classification.classificationId) {
|
if (!this.classification || !this.classification.classificationId) {
|
||||||
this.generalModalService.triggerMessage(
|
this.errorsService.updateError(ERROR_TYPES.SELECT_ERR);
|
||||||
// new Key ERROR_TYPES.SELECT_ERR
|
|
||||||
new MessageModal('There is no classification selected', 'Please check if you are creating a classification')
|
|
||||||
);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.requestInProgressService.setRequestInProgress(true);
|
this.requestInProgressService.setRequestInProgress(true);
|
||||||
|
|
@ -300,8 +297,7 @@ export class ClassificationDetailsComponent implements OnInit, OnDestroy {
|
||||||
// new Key: ALERT_TYPES.SUCCESS_ALERT_4
|
// new Key: ALERT_TYPES.SUCCESS_ALERT_4
|
||||||
this.alertService.triggerAlert(new AlertModel(AlertType.SUCCESS, `Classification ${key} was removed successfully`));
|
this.alertService.triggerAlert(new AlertModel(AlertType.SUCCESS, `Classification ${key} was removed successfully`));
|
||||||
}, error => {
|
}, error => {
|
||||||
// new Key: ERROR_TYPES.REMOVE_ERR
|
this.errorsService.updateError(ERROR_TYPES.REMOVE_ERR, error);
|
||||||
this.generalModalService.triggerMessage(new MessageModal('There was error while removing your classification', error));
|
|
||||||
this.afterRequest();
|
this.afterRequest();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ import { ImportExportService } from 'app/administration/services/import-export/i
|
||||||
import { ClassificationDefinition } from '../../../../models/classification-definition';
|
import { ClassificationDefinition } from '../../../../models/classification-definition';
|
||||||
import { AlertModel, AlertType } from '../../../../models/alert';
|
import { AlertModel, AlertType } from '../../../../models/alert';
|
||||||
import { AlertService } from '../../../../services/alert/alert.service';
|
import { AlertService } from '../../../../services/alert/alert.service';
|
||||||
import { ERROR_TYPES } from '../../../../services/general-modal/errors';
|
import { ERROR_TYPES } from '../../../../models/errors';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'taskana-classification-list',
|
selector: 'taskana-classification-list',
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,10 @@ import { AlertService } from 'app/services/alert/alert.service';
|
||||||
import { AlertModel, AlertType } from 'app/models/alert';
|
import { AlertModel, AlertType } from 'app/models/alert';
|
||||||
import { UploadService } from 'app/shared/services/upload/upload.service';
|
import { UploadService } from 'app/shared/services/upload/upload.service';
|
||||||
import { ImportExportService } from 'app/administration/services/import-export/import-export.service';
|
import { ImportExportService } from 'app/administration/services/import-export/import-export.service';
|
||||||
import { ERROR_TYPES } from '../../../services/general-modal/errors';
|
import { ERROR_TYPES } from '../../../models/errors';
|
||||||
|
import { ErrorsService } from "../../../services/errors/errors.service";
|
||||||
|
import { ErrorModel } from "../../../models/error-model";
|
||||||
|
import { HttpErrorResponse } from "@angular/common/http";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'taskana-import-export-component',
|
selector: 'taskana-import-export-component',
|
||||||
|
|
@ -20,26 +23,29 @@ import { ERROR_TYPES } from '../../../services/general-modal/errors';
|
||||||
export class ImportExportComponent implements OnInit {
|
export class ImportExportComponent implements OnInit {
|
||||||
@Input() currentSelection: TaskanaType;
|
@Input() currentSelection: TaskanaType;
|
||||||
|
|
||||||
@ViewChild('selectedFile', { static: true })
|
@ViewChild('selectedFile', {static: true})
|
||||||
selectedFileInput;
|
selectedFileInput;
|
||||||
|
|
||||||
domains: string[] = [];
|
domains: string[] = [];
|
||||||
errorWhileUploadingText: string;
|
errorWhileUploadingText: string;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private domainService: DomainService,
|
private domainService: DomainService,
|
||||||
private workbasketDefinitionService: WorkbasketDefinitionService,
|
private workbasketDefinitionService: WorkbasketDefinitionService,
|
||||||
private classificationDefinitionService: ClassificationDefinitionService,
|
private classificationDefinitionService: ClassificationDefinitionService,
|
||||||
private generalModalService: GeneralModalService,
|
private generalModalService: GeneralModalService,
|
||||||
private alertService: AlertService,
|
private alertService: AlertService,
|
||||||
public uploadservice: UploadService,
|
public uploadservice: UploadService,
|
||||||
private importExportService: ImportExportService
|
private errorsService: ErrorsService,
|
||||||
|
private importExportService: ImportExportService
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.domainService.getDomains().subscribe(
|
this.domainService.getDomains().subscribe(
|
||||||
data => { this.domains = data; }
|
data => {
|
||||||
|
this.domains = data;
|
||||||
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -83,15 +89,11 @@ export class ImportExportComponent implements OnInit {
|
||||||
private checkFormatFile(file): boolean {
|
private checkFormatFile(file): boolean {
|
||||||
const ending = file.name.match(/\.([^.]+)$/)[1];
|
const ending = file.name.match(/\.([^.]+)$/)[1];
|
||||||
let check = false;
|
let check = false;
|
||||||
switch (ending) {
|
if (ending === 'json') {
|
||||||
case 'json':
|
check = true;
|
||||||
check = true;
|
} else {
|
||||||
break;
|
file.value = '';
|
||||||
default:
|
this.errorsService.updateError(ERROR_TYPES.FILE_ERR);
|
||||||
file.value = '';
|
|
||||||
// new Key: ERROR_TYPES.FILE_ERR
|
|
||||||
this.generalModalService.triggerMessage(new MessageModal('Wrong format',
|
|
||||||
'This file format is not allowed! Please use a .json file.'));
|
|
||||||
}
|
}
|
||||||
return check;
|
return check;
|
||||||
}
|
}
|
||||||
|
|
@ -105,20 +107,18 @@ export class ImportExportComponent implements OnInit {
|
||||||
private onReadyStateChangeHandler(event) {
|
private onReadyStateChangeHandler(event) {
|
||||||
if (event.readyState === 4 && event.status >= 400) {
|
if (event.readyState === 4 && event.status >= 400) {
|
||||||
let title;
|
let title;
|
||||||
|
let key: ERROR_TYPES;
|
||||||
if (event.status === 401) {
|
if (event.status === 401) {
|
||||||
// new Key ERROR_TYPES.IMPORT_ERR_1
|
key = ERROR_TYPES.IMPORT_ERR_1;
|
||||||
title = 'Import was not successful, you have no access to apply this operation.';
|
title = 'Import was not successful, you have no access to apply this operation.';
|
||||||
} else if (event.status === 404) {
|
} else if (event.status === 404) {
|
||||||
// new Key ERROR_TYPES.IMPORT_ERR_2
|
key = ERROR_TYPES.IMPORT_ERR_2;
|
||||||
title = 'Import was not successful, operation was not found.';
|
|
||||||
} else if (event.status === 409) {
|
} else if (event.status === 409) {
|
||||||
// new Key ERROR_TYPES.IMPORT_ERR_3
|
key = ERROR_TYPES.IMPORT_ERR_3;
|
||||||
title = 'Import was not successful, operation has some conflicts.';
|
|
||||||
} else if (event.status === 413) {
|
} else if (event.status === 413) {
|
||||||
// new Key ERROR_TYPES.IMPORT_ERR_4
|
key = ERROR_TYPES.IMPORT_ERR_4;
|
||||||
title = 'Import was not successful, maximum file size exceeded.';
|
|
||||||
}
|
}
|
||||||
this.errorHandler(title, JSON.parse(event.responseText).message);
|
this.errorHandler(key, event);
|
||||||
} else if (event.readyState === 4 && event.status === 200) {
|
} else if (event.readyState === 4 && event.status === 200) {
|
||||||
// new Key: ALERT_TYPES.SUCCESS_ALERT_6
|
// new Key: ALERT_TYPES.SUCCESS_ALERT_6
|
||||||
this.alertService.triggerAlert(new AlertModel(AlertType.SUCCESS, 'Import was successful'));
|
this.alertService.triggerAlert(new AlertModel(AlertType.SUCCESS, 'Import was successful'));
|
||||||
|
|
@ -127,19 +127,12 @@ export class ImportExportComponent implements OnInit {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private onFailedResponse(event) {
|
private onFailedResponse() {
|
||||||
// new Key ERROR_TYPES.UPLOAD_ERR
|
this.errorHandler(ERROR_TYPES.UPLOAD_ERR);
|
||||||
this.errorHandler('Upload failed', 'The upload didn\'t proceed sucessfully. \n'
|
|
||||||
+ 'Probably the uploaded file exceeded the maximum file size of 10 MB');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private errorHandler(title = 'Import was not successful', message) {
|
private errorHandler(key: ERROR_TYPES, passedError?: HttpErrorResponse) {
|
||||||
this.generalModalService.triggerMessage(
|
this.errorsService.updateError(key, passedError);
|
||||||
new MessageModal(
|
|
||||||
title,
|
|
||||||
message
|
|
||||||
)
|
|
||||||
);
|
|
||||||
delete this.selectedFileInput.files;
|
delete this.selectedFileInput.files;
|
||||||
this.resetProgress();
|
this.resetProgress();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,17 @@
|
||||||
import { Component, Input, OnDestroy, OnChanges, SimpleChanges } from '@angular/core';
|
import { Component, Input, OnChanges, OnDestroy, SimpleChanges } from '@angular/core';
|
||||||
import { Subscription } from 'rxjs';
|
import { Subscription } from 'rxjs';
|
||||||
import { FormBuilder, Validators, FormArray } from '@angular/forms';
|
import { FormArray, FormBuilder, Validators } from '@angular/forms';
|
||||||
|
|
||||||
import { Workbasket } from 'app/models/workbasket';
|
import { Workbasket } from 'app/models/workbasket';
|
||||||
import { WorkbasketAccessItems } from 'app/models/workbasket-access-items';
|
import { WorkbasketAccessItems } from 'app/models/workbasket-access-items';
|
||||||
import { WorkbasketAccessItemsResource } from 'app/models/workbasket-access-items-resource';
|
import { WorkbasketAccessItemsResource } from 'app/models/workbasket-access-items-resource';
|
||||||
import { MessageModal } from 'app/models/message-modal';
|
|
||||||
import { ACTION } from 'app/models/action';
|
import { ACTION } from 'app/models/action';
|
||||||
import { AlertModel, AlertType } from 'app/models/alert';
|
import { AlertModel, AlertType } from 'app/models/alert';
|
||||||
|
|
||||||
import { SavingWorkbasketService, SavingInformation } from 'app/administration/services/saving-workbaskets/saving-workbaskets.service';
|
import {
|
||||||
|
SavingInformation,
|
||||||
|
SavingWorkbasketService
|
||||||
|
} from 'app/administration/services/saving-workbaskets/saving-workbaskets.service';
|
||||||
import { GeneralModalService } from 'app/services/general-modal/general-modal.service';
|
import { GeneralModalService } from 'app/services/general-modal/general-modal.service';
|
||||||
import { WorkbasketService } from 'app/shared/services/workbasket/workbasket.service';
|
import { WorkbasketService } from 'app/shared/services/workbasket/workbasket.service';
|
||||||
import { AlertService } from 'app/services/alert/alert.service';
|
import { AlertService } from 'app/services/alert/alert.service';
|
||||||
|
|
@ -18,7 +20,8 @@ import { CustomFieldsService } from 'app/services/custom-fields/custom-fields.se
|
||||||
import { highlight } from 'app/shared/animations/validation.animation';
|
import { highlight } from 'app/shared/animations/validation.animation';
|
||||||
import { FormsValidatorService } from 'app/shared/services/forms/forms-validator.service';
|
import { FormsValidatorService } from 'app/shared/services/forms/forms-validator.service';
|
||||||
import { AccessIdDefinition } from 'app/models/access-id';
|
import { AccessIdDefinition } from 'app/models/access-id';
|
||||||
import { ERROR_TYPES } from '../../../../services/general-modal/errors';
|
import { ERROR_TYPES } from '../../../../models/errors';
|
||||||
|
import { ErrorsService } from "../../../../services/errors/errors.service";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'taskana-workbasket-access-items',
|
selector: 'taskana-workbasket-access-items',
|
||||||
|
|
@ -61,13 +64,29 @@ export class AccessItemsComponent implements OnChanges, OnDestroy {
|
||||||
accessItemsubscription: Subscription;
|
accessItemsubscription: Subscription;
|
||||||
savingAccessItemsSubscription: Subscription;
|
savingAccessItemsSubscription: Subscription;
|
||||||
AccessItemsForm = this.formBuilder.group({
|
AccessItemsForm = this.formBuilder.group({
|
||||||
accessItemsGroups: this.formBuilder.array([
|
accessItemsGroups: this.formBuilder.array([])
|
||||||
])
|
|
||||||
});
|
});
|
||||||
|
|
||||||
toogleValidationAccessIdMap = new Map<number, boolean>();
|
toogleValidationAccessIdMap = new Map<number, boolean>();
|
||||||
private initialized = false;
|
private initialized = false;
|
||||||
|
|
||||||
|
constructor(
|
||||||
|
private workbasketService: WorkbasketService,
|
||||||
|
private alertService: AlertService,
|
||||||
|
private generalModalService: GeneralModalService,
|
||||||
|
private savingWorkbaskets: SavingWorkbasketService,
|
||||||
|
private requestInProgressService: RequestInProgressService,
|
||||||
|
private customFieldsService: CustomFieldsService,
|
||||||
|
private formBuilder: FormBuilder,
|
||||||
|
private formsValidatorService: FormsValidatorService,
|
||||||
|
private errorsService: ErrorsService
|
||||||
|
) {
|
||||||
|
}
|
||||||
|
|
||||||
|
get accessItemsGroups(): FormArray {
|
||||||
|
return this.AccessItemsForm.get('accessItemsGroups') as FormArray;
|
||||||
|
}
|
||||||
|
|
||||||
setAccessItemsGroups(accessItems: Array<WorkbasketAccessItems>) {
|
setAccessItemsGroups(accessItems: Array<WorkbasketAccessItems>) {
|
||||||
const AccessItemsFormGroups = accessItems.map(accessItem => this.formBuilder.group(accessItem));
|
const AccessItemsFormGroups = accessItems.map(accessItem => this.formBuilder.group(accessItem));
|
||||||
AccessItemsFormGroups.forEach(accessItemGroup => {
|
AccessItemsFormGroups.forEach(accessItemGroup => {
|
||||||
|
|
@ -77,22 +96,6 @@ export class AccessItemsComponent implements OnChanges, OnDestroy {
|
||||||
this.AccessItemsForm.setControl('accessItemsGroups', AccessItemsFormArray);
|
this.AccessItemsForm.setControl('accessItemsGroups', AccessItemsFormArray);
|
||||||
}
|
}
|
||||||
|
|
||||||
get accessItemsGroups(): FormArray {
|
|
||||||
return this.AccessItemsForm.get('accessItemsGroups') as FormArray;
|
|
||||||
}
|
|
||||||
|
|
||||||
constructor(
|
|
||||||
private workbasketService: WorkbasketService,
|
|
||||||
private alertService: AlertService,
|
|
||||||
private generalModalService: GeneralModalService,
|
|
||||||
private savingWorkbaskets: SavingWorkbasketService,
|
|
||||||
private requestInProgressService: RequestInProgressService,
|
|
||||||
private customFieldsService: CustomFieldsService,
|
|
||||||
private formBuilder: FormBuilder,
|
|
||||||
private formsValidatorService: FormsValidatorService
|
|
||||||
) {
|
|
||||||
}
|
|
||||||
|
|
||||||
ngOnChanges(changes: SimpleChanges): void {
|
ngOnChanges(changes: SimpleChanges): void {
|
||||||
if (!this.initialized && changes.active && changes.active.currentValue === 'accessItems') {
|
if (!this.initialized && changes.active && changes.active.currentValue === 'accessItems') {
|
||||||
this.init();
|
this.init();
|
||||||
|
|
@ -102,30 +105,6 @@ export class AccessItemsComponent implements OnChanges, OnDestroy {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private init() {
|
|
||||||
this.initialized = true;
|
|
||||||
if (!this.workbasket._links.accessItems) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
this.requestInProgress = true;
|
|
||||||
this.accessItemsubscription = this.workbasketService.getWorkBasketAccessItems(this.workbasket._links.accessItems.href)
|
|
||||||
.subscribe((accessItemsResource: WorkbasketAccessItemsResource) => {
|
|
||||||
this.accessItemsResource = accessItemsResource;
|
|
||||||
this.setAccessItemsGroups(accessItemsResource.accessItems);
|
|
||||||
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) {
|
|
||||||
this.accessItemsResource._links.self.href = savingInformation.url;
|
|
||||||
this.setWorkbasketIdForCopy(savingInformation.workbasketId);
|
|
||||||
this.onSave();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
addAccessItem() {
|
addAccessItem() {
|
||||||
const workbasketAccessItems = new WorkbasketAccessItems();
|
const workbasketAccessItems = new WorkbasketAccessItems();
|
||||||
workbasketAccessItems.workbasketId = this.workbasket.workbasketId;
|
workbasketAccessItems.workbasketId = this.workbasket.workbasketId;
|
||||||
|
|
@ -178,24 +157,56 @@ export class AccessItemsComponent implements OnChanges, OnDestroy {
|
||||||
this.accessItemsGroups.controls[row].get('accessName').setValue(accessItem.name);
|
this.accessItemsGroups.controls[row].get('accessName').setValue(accessItem.name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ngOnDestroy(): void {
|
||||||
|
if (this.accessItemsubscription) {
|
||||||
|
this.accessItemsubscription.unsubscribe();
|
||||||
|
}
|
||||||
|
if (this.savingAccessItemsSubscription) {
|
||||||
|
this.savingAccessItemsSubscription.unsubscribe();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private init() {
|
||||||
|
this.initialized = true;
|
||||||
|
if (!this.workbasket._links.accessItems) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.requestInProgress = true;
|
||||||
|
this.accessItemsubscription = this.workbasketService.getWorkBasketAccessItems(this.workbasket._links.accessItems.href)
|
||||||
|
.subscribe((accessItemsResource: WorkbasketAccessItemsResource) => {
|
||||||
|
this.accessItemsResource = accessItemsResource;
|
||||||
|
this.setAccessItemsGroups(accessItemsResource.accessItems);
|
||||||
|
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) {
|
||||||
|
this.accessItemsResource._links.self.href = savingInformation.url;
|
||||||
|
this.setWorkbasketIdForCopy(savingInformation.workbasketId);
|
||||||
|
this.onSave();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
private onSave() {
|
private onSave() {
|
||||||
this.requestInProgressService.setRequestInProgress(true);
|
this.requestInProgressService.setRequestInProgress(true);
|
||||||
this.workbasketService.updateWorkBasketAccessItem(
|
this.workbasketService.updateWorkBasketAccessItem(
|
||||||
this.accessItemsResource._links.self.href, this.AccessItemsForm.value.accessItemsGroups
|
this.accessItemsResource._links.self.href, this.AccessItemsForm.value.accessItemsGroups
|
||||||
)
|
)
|
||||||
.subscribe(response => {
|
.subscribe(response => {
|
||||||
this.accessItemsClone = this.cloneAccessItems(this.AccessItemsForm.value.accessItemsGroups);
|
this.accessItemsClone = this.cloneAccessItems(this.AccessItemsForm.value.accessItemsGroups);
|
||||||
this.accessItemsResetClone = this.cloneAccessItems(this.AccessItemsForm.value.accessItemsGroups);
|
this.accessItemsResetClone = this.cloneAccessItems(this.AccessItemsForm.value.accessItemsGroups);
|
||||||
// new Key ALERT_TYPES.SUCCESS_ALERT_7
|
// new Key ALERT_TYPES.SUCCESS_ALERT_7
|
||||||
this.alertService.triggerAlert(new AlertModel(
|
this.alertService.triggerAlert(new AlertModel(
|
||||||
AlertType.SUCCESS, `Workbasket ${this.workbasket.name} Access items were saved successfully`
|
AlertType.SUCCESS, `Workbasket ${this.workbasket.name} Access items were saved successfully`
|
||||||
));
|
));
|
||||||
this.requestInProgressService.setRequestInProgress(false);
|
this.requestInProgressService.setRequestInProgress(false);
|
||||||
}, error => {
|
}, error => {
|
||||||
// new Key ERROR_TYPES.SAVE_ERR_2
|
this.errorsService.updateError(ERROR_TYPES.SAVE_ERR_2, error);
|
||||||
this.generalModalService.triggerMessage(new MessageModal('There was error while saving your workbasket\'s access items', error));
|
this.requestInProgressService.setRequestInProgress(false);
|
||||||
this.requestInProgressService.setRequestInProgress(false);
|
});
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private setBadge() {
|
private setBadge() {
|
||||||
|
|
@ -206,7 +217,7 @@ export class AccessItemsComponent implements OnChanges, OnDestroy {
|
||||||
|
|
||||||
private cloneAccessItems(inputaccessItem): Array<WorkbasketAccessItems> {
|
private cloneAccessItems(inputaccessItem): Array<WorkbasketAccessItems> {
|
||||||
return this.AccessItemsForm.value.accessItemsGroups.map(
|
return this.AccessItemsForm.value.accessItemsGroups.map(
|
||||||
(accessItems: WorkbasketAccessItems) => ({ ...accessItems })
|
(accessItems: WorkbasketAccessItems) => ({...accessItems})
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -216,9 +227,4 @@ export class AccessItemsComponent implements OnChanges, OnDestroy {
|
||||||
element.workbasketId = workbasketId;
|
element.workbasketId = workbasketId;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnDestroy(): void {
|
|
||||||
if (this.accessItemsubscription) { this.accessItemsubscription.unsubscribe(); }
|
|
||||||
if (this.savingAccessItemsSubscription) { this.savingAccessItemsSubscription.unsubscribe(); }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,8 @@ import { TaskanaQueryParameters } from 'app/shared/util/query-parameters';
|
||||||
import { Page } from 'app/models/page';
|
import { Page } from 'app/models/page';
|
||||||
import { OrientationService } from 'app/services/orientation/orientation.service';
|
import { OrientationService } from 'app/services/orientation/orientation.service';
|
||||||
import { Orientation } from 'app/models/orientation';
|
import { Orientation } from 'app/models/orientation';
|
||||||
import { ERROR_TYPES } from '../../../../services/general-modal/errors';
|
import { ERROR_TYPES } from '../../../../models/errors';
|
||||||
|
import { ErrorsService } from "../../../../services/errors/errors.service";
|
||||||
|
|
||||||
export enum Side {
|
export enum Side {
|
||||||
LEFT,
|
LEFT,
|
||||||
|
|
@ -74,7 +75,8 @@ export class DistributionTargetsComponent implements OnChanges, OnDestroy {
|
||||||
private savingWorkbaskets: SavingWorkbasketService,
|
private savingWorkbaskets: SavingWorkbasketService,
|
||||||
private generalModalService: GeneralModalService,
|
private generalModalService: GeneralModalService,
|
||||||
private requestInProgressService: RequestInProgressService,
|
private requestInProgressService: RequestInProgressService,
|
||||||
private orientationService: OrientationService
|
private orientationService: OrientationService,
|
||||||
|
private errorsService: ErrorsService
|
||||||
) { }
|
) { }
|
||||||
|
|
||||||
ngOnChanges(changes: SimpleChanges): void {
|
ngOnChanges(changes: SimpleChanges): void {
|
||||||
|
|
@ -128,10 +130,7 @@ export class DistributionTargetsComponent implements OnChanges, OnDestroy {
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
error => {
|
error => {
|
||||||
// new Key ERROR_TYPES.SAVE_ERR_3
|
this.errorsService.updateError(ERROR_TYPES.SAVE_ERR_3, error);
|
||||||
this.generalModalService.triggerMessage(
|
|
||||||
new MessageModal('There was error while saving your workbasket\'s distribution targets', error)
|
|
||||||
);
|
|
||||||
this.requestInProgressService.setRequestInProgress(false);
|
this.requestInProgressService.setRequestInProgress(false);
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -89,9 +89,9 @@ describe('WorkbasketInformationComponent', () => {
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
expect(debugElement.querySelector('#wb-information')).toBeDefined();
|
expect(debugElement.querySelector('#wb-information')).toBeDefined();
|
||||||
expect(debugElement.querySelector('#wb-information > .panel-heading > h4').textContent.trim()).toBe('name');
|
expect(debugElement.querySelector('#wb-information > .panel-heading > h4').textContent.trim()).toBe('name');
|
||||||
expect(debugElement.querySelectorAll('#wb-information > .panel-body > form').length).toBe(1);
|
expect(debugElement.querySelectorAll('#wb-information > .panel-message > form').length).toBe(1);
|
||||||
fixture.whenStable().then(() => {
|
fixture.whenStable().then(() => {
|
||||||
expect(debugElement.querySelector('#wb-information > .panel-body > form > div > div > input ').value).toBe('keyModified');
|
expect(debugElement.querySelector('#wb-information > .panel-message > form > div > div > input ').value).toBe('keyModified');
|
||||||
});
|
});
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,8 @@ import { RequestInProgressService } from 'app/services/requestInProgress/request
|
||||||
import { CustomFieldsService } from 'app/services/custom-fields/custom-fields.service';
|
import { CustomFieldsService } from 'app/services/custom-fields/custom-fields.service';
|
||||||
import { RemoveConfirmationService } from 'app/services/remove-confirmation/remove-confirmation.service';
|
import { RemoveConfirmationService } from 'app/services/remove-confirmation/remove-confirmation.service';
|
||||||
import { FormsValidatorService } from 'app/shared/services/forms/forms-validator.service';
|
import { FormsValidatorService } from 'app/shared/services/forms/forms-validator.service';
|
||||||
import { ERROR_TYPES } from '../../../../services/general-modal/errors';
|
import { ERROR_TYPES } from '../../../../models/errors';
|
||||||
|
import { ErrorsService } from "../../../../services/errors/errors.service";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'taskana-workbasket-information',
|
selector: 'taskana-workbasket-information',
|
||||||
|
|
@ -81,7 +82,8 @@ implements OnInit, OnChanges, OnDestroy {
|
||||||
private requestInProgressService: RequestInProgressService,
|
private requestInProgressService: RequestInProgressService,
|
||||||
private customFieldsService: CustomFieldsService,
|
private customFieldsService: CustomFieldsService,
|
||||||
private removeConfirmationService: RemoveConfirmationService,
|
private removeConfirmationService: RemoveConfirmationService,
|
||||||
private formsValidatorService: FormsValidatorService
|
private formsValidatorService: FormsValidatorService,
|
||||||
|
private errorsService: ErrorsService
|
||||||
) {
|
) {
|
||||||
this.allTypes = new Map([
|
this.allTypes = new Map([
|
||||||
['PERSONAL', 'Personal'],
|
['PERSONAL', 'Personal'],
|
||||||
|
|
@ -165,14 +167,9 @@ implements OnInit, OnChanges, OnDestroy {
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
error => {
|
error => {
|
||||||
// new Key ERROR_TYPES.REMOVE_ERR_2
|
this.errorsService.updateError(ERROR_TYPES.REMOVE_ERR_2,
|
||||||
this.generalModalService.triggerMessage(
|
error,
|
||||||
new MessageModal(
|
new Map<String,String>([["workbasketId", this.workbasket.workbasketId]])
|
||||||
`There was an error removing distribution target for ${
|
|
||||||
this.workbasket.workbasketId
|
|
||||||
}.`,
|
|
||||||
error
|
|
||||||
)
|
|
||||||
);
|
);
|
||||||
this.requestInProgressService.setRequestInProgress(false);
|
this.requestInProgressService.setRequestInProgress(false);
|
||||||
}
|
}
|
||||||
|
|
@ -203,13 +200,7 @@ implements OnInit, OnChanges, OnDestroy {
|
||||||
},
|
},
|
||||||
error => {
|
error => {
|
||||||
this.afterRequest();
|
this.afterRequest();
|
||||||
// new Key ERROR_TYPES.SAVE_ERR_4
|
this.errorsService.updateError(ERROR_TYPES.SAVE_ERR_4, error);
|
||||||
this.generalModalService.triggerMessage(
|
|
||||||
new MessageModal(
|
|
||||||
'There was error while saving your workbasket',
|
|
||||||
error
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
@ -258,9 +249,7 @@ implements OnInit, OnChanges, OnDestroy {
|
||||||
},
|
},
|
||||||
error => {
|
error => {
|
||||||
// new Key ERROR_TYPES.CREATE_ERR_2
|
// new Key ERROR_TYPES.CREATE_ERR_2
|
||||||
this.generalModalService.triggerMessage(
|
this.errorsService.updateError(ERROR_TYPES.CREATE_ERR_2, error);
|
||||||
new MessageModal('There was an error creating a workbasket', error)
|
|
||||||
);
|
|
||||||
this.requestInProgressService.setRequestInProgress(false);
|
this.requestInProgressService.setRequestInProgress(false);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
@ -281,17 +270,11 @@ implements OnInit, OnChanges, OnDestroy {
|
||||||
this.requestInProgressService.setRequestInProgress(false);
|
this.requestInProgressService.setRequestInProgress(false);
|
||||||
this.workbasketService.triggerWorkBasketSaved();
|
this.workbasketService.triggerWorkBasketSaved();
|
||||||
if (response.status === 202) {
|
if (response.status === 202) {
|
||||||
// new Key ERROR_TYPES.MARK_ERR
|
this.errorsService.updateError(ERROR_TYPES.MARK_ERR,
|
||||||
// TODO: message changed
|
undefined,
|
||||||
this.generalModalService.triggerMessage(
|
new Map<String, String>([['workbasketId', this.workbasket.workbasketId]]));
|
||||||
new MessageModal('Workbasket was marked for deletion.',
|
|
||||||
`The Workbasket ${this.workbasket.workbasketId} still contains completed tasks and could not be deleted.`
|
|
||||||
+ 'Instead is was marked for deletion and will be deleted automatically '
|
|
||||||
+ 'as soon as the completed tasks are deleted from the database.')
|
|
||||||
);
|
|
||||||
} else {
|
} else {
|
||||||
// new Key ALERT_TYPES.SUCCESS_ALERT_12
|
// new Key ALERT_TYPES.SUCCESS_ALERT_12
|
||||||
// TODO: message changed
|
|
||||||
this.alertService.triggerAlert(
|
this.alertService.triggerAlert(
|
||||||
new AlertModel(AlertType.SUCCESS, `The Workbasket ${this.workbasket.workbasketId} has been deleted.`)
|
new AlertModel(AlertType.SUCCESS, `The Workbasket ${this.workbasket.workbasketId} has been deleted.`)
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,8 @@ import { DomainService } from 'app/services/domain/domain.service';
|
||||||
import { ImportExportService } from 'app/administration/services/import-export/import-export.service';
|
import { ImportExportService } from 'app/administration/services/import-export/import-export.service';
|
||||||
import { GeneralModalService } from '../../../services/general-modal/general-modal.service';
|
import { GeneralModalService } from '../../../services/general-modal/general-modal.service';
|
||||||
import { MessageModal } from '../../../models/message-modal';
|
import { MessageModal } from '../../../models/message-modal';
|
||||||
import { ERROR_TYPES } from '../../../services/general-modal/errors';
|
import { ERROR_TYPES } from '../../../models/errors';
|
||||||
|
import { ErrorsService } from "../../../services/errors/errors.service";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'taskana-workbasket-details',
|
selector: 'taskana-workbasket-details',
|
||||||
|
|
@ -39,6 +40,7 @@ export class WorkbasketDetailsComponent implements OnInit, OnDestroy {
|
||||||
private router: Router,
|
private router: Router,
|
||||||
private masterAndDetailService: MasterAndDetailService,
|
private masterAndDetailService: MasterAndDetailService,
|
||||||
private domainService: DomainService,
|
private domainService: DomainService,
|
||||||
|
private errorsService: ErrorsService,
|
||||||
private generalModalService: GeneralModalService,
|
private generalModalService: GeneralModalService,
|
||||||
private importExportService: ImportExportService) { }
|
private importExportService: ImportExportService) { }
|
||||||
|
|
||||||
|
|
@ -114,11 +116,8 @@ export class WorkbasketDetailsComponent implements OnInit, OnDestroy {
|
||||||
this.workbasket = workbasket;
|
this.workbasket = workbasket;
|
||||||
this.requestInProgress = false;
|
this.requestInProgress = false;
|
||||||
this.checkDomainAndRedirect();
|
this.checkDomainAndRedirect();
|
||||||
}, err => {
|
}, error => {
|
||||||
// new Key ERROR_TYPES.FETCH_ERR_4
|
this.errorsService.updateError(ERROR_TYPES.FETCH_ERR_4, error);
|
||||||
this.generalModalService.triggerMessage(
|
|
||||||
new MessageModal('An error occurred while fetching the workbasket', err)
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -9,8 +9,8 @@ import { WorkbasketSummary } from 'app/models/workbasket-summary';
|
||||||
import { WorkbasketService } from 'app/shared/services/workbasket/workbasket.service';
|
import { WorkbasketService } from 'app/shared/services/workbasket/workbasket.service';
|
||||||
import { TaskanaType } from 'app/models/taskana-type';
|
import { TaskanaType } from 'app/models/taskana-type';
|
||||||
import { expandDown } from 'app/shared/animations/expand.animation';
|
import { expandDown } from 'app/shared/animations/expand.animation';
|
||||||
import { ErrorsService } from '../../../../shared/services/errors/errors.service';
|
import { ErrorsService } from '../../../../services/errors/errors.service';
|
||||||
import { ERROR_TYPES } from '../../../../services/general-modal/errors';
|
import { ERROR_TYPES } from '../../../../models/errors';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'taskana-workbasket-list-toolbar',
|
selector: 'taskana-workbasket-list-toolbar',
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,10 @@
|
||||||
<taskana-nav-bar></taskana-nav-bar>
|
<taskana-nav-bar></taskana-nav-bar>
|
||||||
<div class="container-fluid container-main" (window:resize)="onResize($event)">
|
<div (window:resize)="onResize()" class="container-fluid container-main">
|
||||||
<div class="row ">
|
<div class="row ">
|
||||||
<router-outlet></router-outlet>
|
<router-outlet></router-outlet>
|
||||||
<taskana-general-message-modal *ngIf="modalMessage" [(message)]="modalMessage" [title]="modalTitle"
|
<taskana-general-message-modal *ngIf="modalMessage" [(message)]="modalMessage" [title]="modalTitle"
|
||||||
[type]="modalType" error="true"></taskana-general-message-modal>
|
[type]="modalType" error="true"></taskana-general-message-modal>
|
||||||
|
<error-modal></error-modal>
|
||||||
<taskana-spinner [isRunning]="requestInProgress" isModal=true></taskana-spinner>
|
<taskana-spinner [isRunning]="requestInProgress" isModal=true></taskana-spinner>
|
||||||
<taskana-alert></taskana-alert>
|
<taskana-alert></taskana-alert>
|
||||||
<taskana-remove-confirmation></taskana-remove-confirmation>
|
<taskana-remove-confirmation></taskana-remove-confirmation>
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,17 @@
|
||||||
import { Component, OnInit, HostListener, OnDestroy } from '@angular/core';
|
import {Component, HostListener, OnDestroy, OnInit} from '@angular/core';
|
||||||
import { Router, NavigationStart } from '@angular/router';
|
import {NavigationStart, Router} from '@angular/router';
|
||||||
import { Subscription } from 'rxjs';
|
import {Subscription} from 'rxjs';
|
||||||
|
|
||||||
import { FormsValidatorService } from 'app/shared/services/forms/forms-validator.service';
|
import {FormsValidatorService} from 'app/shared/services/forms/forms-validator.service';
|
||||||
import { MessageModal } from './models/message-modal';
|
import {MessageModal} from './models/message-modal';
|
||||||
|
|
||||||
import { GeneralModalService } from './services/general-modal/general-modal.service';
|
import {GeneralModalService} from './services/general-modal/general-modal.service';
|
||||||
import { RequestInProgressService } from './services/requestInProgress/request-in-progress.service';
|
import {RequestInProgressService} from './services/requestInProgress/request-in-progress.service';
|
||||||
import { OrientationService } from './services/orientation/orientation.service';
|
import {OrientationService} from './services/orientation/orientation.service';
|
||||||
import { SelectedRouteService } from './services/selected-route/selected-route';
|
import {SelectedRouteService} from './services/selected-route/selected-route';
|
||||||
import { UploadService } from './shared/services/upload/upload.service';
|
import {UploadService} from './shared/services/upload/upload.service';
|
||||||
|
import {ErrorModel} from "./models/error-model";
|
||||||
|
import {ErrorsService} from "./services/errors/errors.service";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'taskana-root',
|
selector: 'taskana-root',
|
||||||
|
|
@ -32,23 +34,25 @@ export class AppComponent implements OnInit, OnDestroy {
|
||||||
selectedRouteSubscription: Subscription;
|
selectedRouteSubscription: Subscription;
|
||||||
routerSubscription: Subscription;
|
routerSubscription: Subscription;
|
||||||
uploadingFileSubscription: Subscription;
|
uploadingFileSubscription: Subscription;
|
||||||
|
error: ErrorModel;
|
||||||
@HostListener('window:resize', ['$event'])
|
|
||||||
onResize(event) {
|
|
||||||
this.orientationService.onResize();
|
|
||||||
}
|
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private router: Router,
|
private router: Router,
|
||||||
private generalModalService: GeneralModalService,
|
private generalModalService: GeneralModalService,
|
||||||
private requestInProgressService: RequestInProgressService,
|
private requestInProgressService: RequestInProgressService,
|
||||||
private orientationService: OrientationService,
|
private orientationService: OrientationService,
|
||||||
private selectedRouteService: SelectedRouteService,
|
private selectedRouteService: SelectedRouteService,
|
||||||
private formsValidatorService: FormsValidatorService,
|
private formsValidatorService: FormsValidatorService,
|
||||||
public uploadService: UploadService
|
private errorService: ErrorsService,
|
||||||
|
public uploadService: UploadService
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@HostListener('window:resize', ['$event'])
|
||||||
|
onResize() {
|
||||||
|
this.orientationService.onResize();
|
||||||
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.routerSubscription = this.router.events.subscribe(event => {
|
this.routerSubscription = this.router.events.subscribe(event => {
|
||||||
if (event instanceof NavigationStart) {
|
if (event instanceof NavigationStart) {
|
||||||
|
|
@ -64,8 +68,8 @@ export class AppComponent implements OnInit, OnDestroy {
|
||||||
this.modalMessage = messageModal.message.message;
|
this.modalMessage = messageModal.message.message;
|
||||||
} else {
|
} else {
|
||||||
this.modalMessage = messageModal.message.error
|
this.modalMessage = messageModal.message.error
|
||||||
? (`${messageModal.message.error.error} ${messageModal.message.error.message}`)
|
? (`${messageModal.message.error.error} ${messageModal.message.error.message}`)
|
||||||
: messageModal.message.message;
|
: messageModal.message.message;
|
||||||
}
|
}
|
||||||
this.modalTitle = messageModal.title;
|
this.modalTitle = messageModal.title;
|
||||||
this.modalType = messageModal.type;
|
this.modalType = messageModal.type;
|
||||||
|
|
@ -87,10 +91,20 @@ export class AppComponent implements OnInit, OnDestroy {
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnDestroy() {
|
ngOnDestroy() {
|
||||||
if (this.routerSubscription) { this.routerSubscription.unsubscribe(); }
|
if (this.routerSubscription) {
|
||||||
if (this.modalSubscription) { this.modalSubscription.unsubscribe(); }
|
this.routerSubscription.unsubscribe();
|
||||||
if (this.requestInProgressSubscription) { this.requestInProgressSubscription.unsubscribe(); }
|
}
|
||||||
if (this.selectedRouteSubscription) { this.selectedRouteSubscription.unsubscribe(); }
|
if (this.modalSubscription) {
|
||||||
if (this.uploadingFileSubscription) { this.uploadingFileSubscription.unsubscribe(); }
|
this.modalSubscription.unsubscribe();
|
||||||
|
}
|
||||||
|
if (this.requestInProgressSubscription) {
|
||||||
|
this.requestInProgressSubscription.unsubscribe();
|
||||||
|
}
|
||||||
|
if (this.selectedRouteSubscription) {
|
||||||
|
this.selectedRouteSubscription.unsubscribe();
|
||||||
|
}
|
||||||
|
if (this.uploadingFileSubscription) {
|
||||||
|
this.uploadingFileSubscription.unsubscribe();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@ import { NoAccessComponent } from 'app/components/no-access/no-access.component'
|
||||||
import { RemoveConfirmationService } from './services/remove-confirmation/remove-confirmation.service';
|
import { RemoveConfirmationService } from './services/remove-confirmation/remove-confirmation.service';
|
||||||
import { FormsValidatorService } from './shared/services/forms/forms-validator.service';
|
import { FormsValidatorService } from './shared/services/forms/forms-validator.service';
|
||||||
import { UploadService } from './shared/services/upload/upload.service';
|
import { UploadService } from './shared/services/upload/upload.service';
|
||||||
import { ErrorsService } from './shared/services/errors/errors.service';
|
import { ErrorsService } from './services/errors/errors.service';
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -2,25 +2,22 @@ import { of } from 'rxjs';
|
||||||
import { CanActivate } from '@angular/router';
|
import { CanActivate } from '@angular/router';
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { DomainService } from 'app/services/domain/domain.service';
|
import { DomainService } from 'app/services/domain/domain.service';
|
||||||
import { GeneralModalService } from 'app/services/general-modal/general-modal.service';
|
import { catchError, map } from 'rxjs/operators';
|
||||||
import { MessageModal } from 'app/models/message-modal';
|
import { ErrorsService } from "../services/errors/errors.service";
|
||||||
import { map, catchError } from 'rxjs/operators';
|
import { ERROR_TYPES } from "../models/errors";
|
||||||
import { ERROR_TYPES } from '../services/general-modal/errors';
|
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class DomainGuard implements CanActivate {
|
export class DomainGuard implements CanActivate {
|
||||||
constructor(private domainService: DomainService, private generalModalService: GeneralModalService) { }
|
constructor(private domainService: DomainService, private errorsService: ErrorsService) {
|
||||||
|
}
|
||||||
|
|
||||||
canActivate() {
|
canActivate() {
|
||||||
return this.domainService.getDomains().pipe(
|
return this.domainService.getDomains().pipe(
|
||||||
map(domain => true),
|
map(domain => true),
|
||||||
catchError(() => {
|
catchError(() => {
|
||||||
// new Key ERROR_TYPES.FETCH_ERR_5
|
this.errorsService.updateError(ERROR_TYPES.FETCH_ERR_5);
|
||||||
this.generalModalService.triggerMessage(new MessageModal(
|
return of(false);
|
||||||
'There was an error, please contact with your administrator', 'There was an error getting Domains'
|
})
|
||||||
));
|
|
||||||
return of(false);
|
|
||||||
})
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,40 +1,37 @@
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { CanActivate, ActivatedRouteSnapshot, RouterStateSnapshot, Router } from '@angular/router';
|
import { ActivatedRouteSnapshot, CanActivate, Router, RouterStateSnapshot } from '@angular/router';
|
||||||
import { Observable, of } from 'rxjs';
|
import { Observable, of } from 'rxjs';
|
||||||
import { TaskanaEngineService } from 'app/services/taskana-engine/taskana-engine.service';
|
import { TaskanaEngineService } from 'app/services/taskana-engine/taskana-engine.service';
|
||||||
import { map, catchError } from 'rxjs/operators';
|
import { catchError, map } from 'rxjs/operators';
|
||||||
import { GeneralModalService } from 'app/services/general-modal/general-modal.service';
|
import { ERROR_TYPES } from '../models/errors';
|
||||||
import { MessageModal } from 'app/models/message-modal';
|
import { ErrorsService } from "../services/errors/errors.service";
|
||||||
import { ERROR_TYPES } from '../services/general-modal/errors';
|
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root'
|
providedIn: 'root'
|
||||||
})
|
})
|
||||||
export class HistoryGuard implements CanActivate {
|
export class HistoryGuard implements CanActivate {
|
||||||
constructor(
|
constructor(
|
||||||
private taskanaEngineService: TaskanaEngineService,
|
private taskanaEngineService: TaskanaEngineService,
|
||||||
public router: Router,
|
public router: Router,
|
||||||
public generalModalService: GeneralModalService
|
private errorsService: ErrorsService
|
||||||
) { }
|
) {
|
||||||
|
}
|
||||||
|
|
||||||
canActivate(
|
canActivate(
|
||||||
next: ActivatedRouteSnapshot,
|
next: ActivatedRouteSnapshot,
|
||||||
state: RouterStateSnapshot
|
state: RouterStateSnapshot
|
||||||
): Observable<boolean> | Promise<boolean> | boolean {
|
): Observable<boolean> | Promise<boolean> | boolean {
|
||||||
return this.taskanaEngineService.isHistoryProviderEnabled().pipe(
|
return this.taskanaEngineService.isHistoryProviderEnabled().pipe(
|
||||||
map(value => {
|
map(value => {
|
||||||
if (value) {
|
if (value) {
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
return this.navigateToWorkplace();
|
return this.navigateToWorkplace();
|
||||||
}),
|
}),
|
||||||
catchError(() => {
|
catchError(() => {
|
||||||
// new Key ERROR_TYPES.FETCH_ERR_6
|
this.errorsService.updateError(ERROR_TYPES.FETCH_ERR_6)
|
||||||
this.generalModalService.triggerMessage(new MessageModal(
|
return of(this.navigateToWorkplace());
|
||||||
'There was an error, please contact with your administrator', 'There was an error getting history provider'
|
})
|
||||||
));
|
|
||||||
return of(this.navigateToWorkplace());
|
|
||||||
})
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,17 @@
|
||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnInit } from '@angular/core';
|
||||||
import { SortingModel, Direction } from 'app/models/sorting';
|
import { Direction, SortingModel } from 'app/models/sorting';
|
||||||
import { OrientationService } from 'app/services/orientation/orientation.service';
|
import { OrientationService } from 'app/services/orientation/orientation.service';
|
||||||
import { Subscription } from 'rxjs';
|
import { Subscription } from 'rxjs';
|
||||||
import { Orientation } from 'app/models/orientation';
|
import { Orientation } from 'app/models/orientation';
|
||||||
import { TaskanaQueryParameters } from 'app/shared/util/query-parameters';
|
import { TaskanaQueryParameters } from 'app/shared/util/query-parameters';
|
||||||
import { GeneralModalService } from 'app/services/general-modal/general-modal.service';
|
import { GeneralModalService } from 'app/services/general-modal/general-modal.service';
|
||||||
import { MessageModal } from 'app/models/message-modal';
|
import { MessageModal } from 'app/models/message-modal';
|
||||||
import { FormGroup, FormControl } from '@angular/forms';
|
import { FormControl, FormGroup } from '@angular/forms';
|
||||||
import { TaskHistoryEventResourceData } from 'app/models/task-history-event-resource';
|
import { TaskHistoryEventResourceData } from 'app/models/task-history-event-resource';
|
||||||
import { RequestInProgressService } from 'app/services/requestInProgress/request-in-progress.service';
|
import { RequestInProgressService } from 'app/services/requestInProgress/request-in-progress.service';
|
||||||
import { TaskHistoryEventData } from '../../models/task-history-event';
|
import { TaskHistoryEventData } from '../../models/task-history-event';
|
||||||
import { TaskQueryService } from '../services/task-query/task-query.service';
|
import { TaskQueryService } from '../services/task-query/task-query.service';
|
||||||
|
import { ErrorsService } from "../../services/errors/errors.service";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'taskana-task-query',
|
selector: 'taskana-task-query',
|
||||||
|
|
@ -25,15 +26,16 @@ export class TaskQueryComponent implements OnInit {
|
||||||
orientationSubscription: Subscription;
|
orientationSubscription: Subscription;
|
||||||
taskQuerySubscription: Subscription;
|
taskQuerySubscription: Subscription;
|
||||||
|
|
||||||
taskQueryForm = new FormGroup({
|
taskQueryForm = new FormGroup({});
|
||||||
});
|
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private taskQueryService: TaskQueryService,
|
private taskQueryService: TaskQueryService,
|
||||||
private orientationService: OrientationService,
|
private orientationService: OrientationService,
|
||||||
private generalModalService: GeneralModalService,
|
private generalModalService: GeneralModalService,
|
||||||
private requestInProgressService: RequestInProgressService
|
private requestInProgressService: RequestInProgressService,
|
||||||
) { }
|
private errorsService: ErrorsService
|
||||||
|
) {
|
||||||
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.orientationSubscription = this.orientationService.getOrientation().subscribe((orientation: Orientation) => {
|
this.orientationSubscription = this.orientationService.getOrientation().subscribe((orientation: Orientation) => {
|
||||||
|
|
@ -106,7 +108,7 @@ export class TaskQueryComponent implements OnInit {
|
||||||
|
|
||||||
filterFieldsToAllowQuerying(fieldName: string): boolean {
|
filterFieldsToAllowQuerying(fieldName: string): boolean {
|
||||||
if (!fieldName || fieldName === 'oldData' || fieldName === 'newData' || fieldName === 'comment'
|
if (!fieldName || fieldName === 'oldData' || fieldName === 'newData' || fieldName === 'comment'
|
||||||
|| fieldName === 'oldValue' || fieldName === 'newValue') {
|
|| fieldName === 'oldValue' || fieldName === 'newValue') {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -122,8 +124,8 @@ export class TaskQueryComponent implements OnInit {
|
||||||
|
|
||||||
filterExpandGroup(fieldName: string): boolean {
|
filterExpandGroup(fieldName: string): boolean {
|
||||||
if (fieldName === 'custom1' || fieldName === 'custom2' || fieldName === 'custom3' || fieldName === 'custom4'
|
if (fieldName === 'custom1' || fieldName === 'custom2' || fieldName === 'custom3' || fieldName === 'custom4'
|
||||||
|| fieldName === 'oldData' || fieldName === 'newData' || fieldName === 'comment'
|
|| fieldName === 'oldData' || fieldName === 'newData' || fieldName === 'comment'
|
||||||
|| fieldName === 'oldValue' || fieldName === 'newValue') {
|
|| fieldName === 'oldValue' || fieldName === 'newValue') {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -146,11 +148,11 @@ export class TaskQueryComponent implements OnInit {
|
||||||
// TODO: Global?
|
// TODO: Global?
|
||||||
openDetails(key: string, val: string) {
|
openDetails(key: string, val: string) {
|
||||||
this.generalModalService.triggerMessage(
|
this.generalModalService.triggerMessage(
|
||||||
new MessageModal(
|
new MessageModal(
|
||||||
`These are the details of ${this.getHeaderFieldDescription(key)}`,
|
`These are the details of ${this.getHeaderFieldDescription(key)}`,
|
||||||
val,
|
val,
|
||||||
'code'
|
'code'
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -168,6 +170,20 @@ export class TaskQueryComponent implements OnInit {
|
||||||
this.performRequest();
|
this.performRequest();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
updateDate($event: string) {
|
||||||
|
this.taskQueryForm.get('created').setValue($event.substring(0, 10));
|
||||||
|
this.performRequest();
|
||||||
|
}
|
||||||
|
|
||||||
|
ngOnDestroy() {
|
||||||
|
if (this.orientationSubscription) {
|
||||||
|
this.orientationSubscription.unsubscribe();
|
||||||
|
}
|
||||||
|
if (this.taskQuerySubscription) {
|
||||||
|
this.taskQuerySubscription.unsubscribe();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private toggleSortDirection(sortDirection: string): Direction {
|
private toggleSortDirection(sortDirection: string): Direction {
|
||||||
if (sortDirection === Direction.ASC) {
|
if (sortDirection === Direction.ASC) {
|
||||||
return Direction.DESC;
|
return Direction.DESC;
|
||||||
|
|
@ -179,10 +195,10 @@ export class TaskQueryComponent implements OnInit {
|
||||||
this.requestInProgressService.setRequestInProgress(true);
|
this.requestInProgressService.setRequestInProgress(true);
|
||||||
this.calculateQueryPages();
|
this.calculateQueryPages();
|
||||||
this.taskQuerySubscription = this.taskQueryService.queryTask(
|
this.taskQuerySubscription = this.taskQueryService.queryTask(
|
||||||
this.orderBy.sortBy.replace(/([A-Z])|([0-9])/g, g => `-${g[0].toLowerCase()}`),
|
this.orderBy.sortBy.replace(/([A-Z])|([0-9])/g, g => `-${g[0].toLowerCase()}`),
|
||||||
this.orderBy.sortDirection,
|
this.orderBy.sortDirection,
|
||||||
new TaskHistoryEventData(this.taskQueryForm.value),
|
new TaskHistoryEventData(this.taskQueryForm.value),
|
||||||
false
|
false
|
||||||
).subscribe(taskQueryResource => {
|
).subscribe(taskQueryResource => {
|
||||||
this.requestInProgressService.setRequestInProgress(false);
|
this.requestInProgressService.setRequestInProgress(false);
|
||||||
this.taskQueryResource = taskQueryResource.taskHistoryEvents ? taskQueryResource : null;
|
this.taskQueryResource = taskQueryResource.taskHistoryEvents ? taskQueryResource : null;
|
||||||
|
|
@ -205,14 +221,4 @@ export class TaskQueryComponent implements OnInit {
|
||||||
TaskanaQueryParameters.page = TaskanaQueryParameters.page ? TaskanaQueryParameters.page : 1;
|
TaskanaQueryParameters.page = TaskanaQueryParameters.page ? TaskanaQueryParameters.page : 1;
|
||||||
TaskanaQueryParameters.pageSize = cards > 0 ? cards : 1;
|
TaskanaQueryParameters.pageSize = cards > 0 ? cards : 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
updateDate($event: string) {
|
|
||||||
this.taskQueryForm.get('created').setValue($event.substring(0, 10));
|
|
||||||
this.performRequest();
|
|
||||||
}
|
|
||||||
|
|
||||||
onDestroy() {
|
|
||||||
if (this.orientationSubscription) { this.orientationSubscription.unsubscribe(); }
|
|
||||||
if (this.taskQuerySubscription) { this.taskQuerySubscription.unsubscribe(); }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,17 +1,19 @@
|
||||||
import { ErrorHandler } from '@angular/core';
|
import { ERROR_TYPES, errors } from './errors';
|
||||||
import { ERROR_TYPES, errors } from '../services/general-modal/errors';
|
import { HttpErrorResponse } from "@angular/common/http";
|
||||||
|
|
||||||
export class ErrorModel {
|
export class ErrorModel {
|
||||||
head: string;
|
public readonly errObj: HttpErrorResponse;
|
||||||
body: string;
|
public readonly title: string;
|
||||||
errObj?: ErrorHandler;
|
public readonly message: string;
|
||||||
|
|
||||||
constructor(key: ERROR_TYPES, passedError?: ErrorHandler, addition?: string) {
|
constructor(key: ERROR_TYPES, passedError?: HttpErrorResponse, addition?: Map<String, String>) {
|
||||||
this.head = errors.get(key).name;
|
this.title = errors.get(key).name;
|
||||||
this.body = errors.get(key).text;
|
this.message = errors.get(key).text;
|
||||||
if (addition) {
|
|
||||||
this.body.replace('{rep}', addition);
|
|
||||||
}
|
|
||||||
this.errObj = passedError;
|
this.errObj = passedError;
|
||||||
|
if (addition) {
|
||||||
|
addition.forEach((value: string, key: string) => {
|
||||||
|
this.message.replace(`{${key}}`, value);
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import { Pair } from '../../models/pair';
|
import { Pair } from './pair';
|
||||||
|
|
||||||
|
|
||||||
export enum ERROR_TYPES {
|
export enum ERROR_TYPES {
|
||||||
|
|
@ -60,254 +60,251 @@ export enum ERROR_TYPES {
|
||||||
export const errors = new Map<ERROR_TYPES, Pair>([
|
export const errors = new Map<ERROR_TYPES, Pair>([
|
||||||
// access-items-management.component.ts
|
// access-items-management.component.ts
|
||||||
[ERROR_TYPES.FETCH_ERR, new Pair(
|
[ERROR_TYPES.FETCH_ERR, new Pair(
|
||||||
'',
|
'There was error while retrieving your access ids with groups.',
|
||||||
'There was error while retrieving your access ids with groups.'
|
''
|
||||||
)],
|
)],
|
||||||
// access-items-management.component.ts
|
// access-items-management.component.ts
|
||||||
[ERROR_TYPES.FETCH_ERR_2, new Pair(
|
[ERROR_TYPES.FETCH_ERR_2, new Pair(
|
||||||
'',
|
'There was error while retrieving your access items ',
|
||||||
'There was error while retrieving your access items '
|
''
|
||||||
)],
|
)],
|
||||||
// access-items-management.component.ts
|
// access-items-management.component.ts
|
||||||
[ERROR_TYPES.DELETE_ERR, new Pair(
|
[ERROR_TYPES.DELETE_ERR, new Pair(
|
||||||
'',
|
'You can\'t delete a group',
|
||||||
'You can\'t delete a group'
|
'',
|
||||||
)],
|
)],
|
||||||
// classification-details.component
|
// classification-details.component
|
||||||
[ERROR_TYPES.CREATE_ERR, new Pair(
|
[ERROR_TYPES.CREATE_ERR, new Pair(
|
||||||
'',
|
'There was an error creating a classification',
|
||||||
'There was an error creating a classification'
|
'',
|
||||||
)],
|
)],
|
||||||
// classification-details.component
|
// classification-details.component
|
||||||
[ERROR_TYPES.REMOVE_ERR, new Pair(
|
[ERROR_TYPES.REMOVE_ERR, new Pair(
|
||||||
'',
|
'There was error while removing your classification',
|
||||||
'There was error while removing your classification'
|
''
|
||||||
)],
|
)],
|
||||||
// classification-details.component
|
// classification-details.component
|
||||||
[ERROR_TYPES.SAVE_ERR, new Pair(
|
[ERROR_TYPES.SAVE_ERR, new Pair(
|
||||||
'',
|
'There was error while saving your classification',
|
||||||
'There was error while saving your classification'
|
''
|
||||||
)],
|
)],
|
||||||
// classification-details.component
|
// classification-details.component
|
||||||
[ERROR_TYPES.SELECT_ERR, new Pair(
|
[ERROR_TYPES.SELECT_ERR, new Pair(
|
||||||
'There is no classification selected',
|
'There is no classification selected',
|
||||||
'Please check if you are creating a classification'
|
'Please check if you are creating a classification'
|
||||||
)],
|
)],
|
||||||
// import-export.component
|
// import-export.component
|
||||||
[ERROR_TYPES.FILE_ERR, new Pair(
|
[ERROR_TYPES.FILE_ERR, new Pair(
|
||||||
'',
|
'Wrong format',
|
||||||
'This file format is not allowed! Please use a .json file.'
|
'This file format is not allowed! Please use a .json file.'
|
||||||
)],
|
)],
|
||||||
// import-export.component
|
// import-export.component
|
||||||
[ERROR_TYPES.IMPORT_ERR_1, new Pair(
|
[ERROR_TYPES.IMPORT_ERR_1, new Pair(
|
||||||
'Import was not successful',
|
'Import was not successful',
|
||||||
'Import was not successful, you have no access to apply this operation.'
|
'Import was not successful, you have no access to apply this operation.'
|
||||||
)],
|
)],
|
||||||
// import-export.component
|
// import-export.component
|
||||||
[ERROR_TYPES.IMPORT_ERR_2, new Pair(
|
[ERROR_TYPES.IMPORT_ERR_2, new Pair(
|
||||||
'Import was not successful',
|
'Import was not successful',
|
||||||
'Import was not successful, operation was not found.'
|
'Import was not successful, operation was not found.'
|
||||||
)],
|
)],
|
||||||
// import-export.component
|
// import-export.component
|
||||||
[ERROR_TYPES.IMPORT_ERR_3, new Pair(
|
[ERROR_TYPES.IMPORT_ERR_3, new Pair(
|
||||||
'Import was not successful',
|
'Import was not successful',
|
||||||
'Import was not successful, operation has some conflicts.'
|
'Import was not successful, operation has some conflicts.'
|
||||||
)],
|
)],
|
||||||
// import-export.component
|
// import-export.component
|
||||||
[ERROR_TYPES.IMPORT_ERR_4, new Pair(
|
[ERROR_TYPES.IMPORT_ERR_4, new Pair(
|
||||||
'Import was not successful',
|
'Import was not successful',
|
||||||
'Import was not successful, maximum file size exceeded.'
|
'Import was not successful, maximum file size exceeded.'
|
||||||
)],
|
)],
|
||||||
// import-export.component
|
// import-export.component
|
||||||
[ERROR_TYPES.UPLOAD_ERR, new Pair(
|
[ERROR_TYPES.UPLOAD_ERR, new Pair(
|
||||||
'Upload failed',
|
'Upload failed',
|
||||||
`The upload didn't proceed sucessfully.
|
`The upload didn't proceed sucessfully.
|
||||||
\n Probably the uploaded file exceeded the maximum file size of 10 MB.`
|
\n Probably the uploaded file exceeded the maximum file size of 10 MB.`
|
||||||
)],
|
)],
|
||||||
// taskdetails.component
|
// taskdetails.component
|
||||||
[ERROR_TYPES.FETCH_ERR_3, new Pair(
|
[ERROR_TYPES.FETCH_ERR_3, new Pair(
|
||||||
'',
|
'',
|
||||||
'An error occurred while fetching the task'
|
'An error occurred while fetching the task'
|
||||||
)],
|
)],
|
||||||
// workbasket-details.component
|
// workbasket-details.component
|
||||||
[ERROR_TYPES.FETCH_ERR_4, new Pair(
|
[ERROR_TYPES.FETCH_ERR_4, new Pair(
|
||||||
'',
|
'An error occurred while fetching the workbasket',
|
||||||
'An error occurred while fetching the workbasket'
|
''
|
||||||
)],
|
)],
|
||||||
// access-items.component
|
// access-items.component
|
||||||
[ERROR_TYPES.SAVE_ERR_2, new Pair(
|
[ERROR_TYPES.SAVE_ERR_2, new Pair(
|
||||||
'',
|
'There was error while saving your workbasket\'s access items',
|
||||||
'There was error while saving your workbasket\'s access items'
|
''
|
||||||
)],
|
)],
|
||||||
// workbaskets-distribution-targets.component
|
// workbaskets-distribution-targets.component
|
||||||
[ERROR_TYPES.SAVE_ERR_3, new Pair(
|
[ERROR_TYPES.SAVE_ERR_3, new Pair(
|
||||||
'',
|
'There was error while saving your workbasket\'s distribution targets',
|
||||||
'There was error while saving your workbasket\'s distribution targets'
|
'',
|
||||||
)],
|
)],
|
||||||
// workbasket-information.component
|
// workbasket-information.component
|
||||||
[ERROR_TYPES.REMOVE_ERR_2, new Pair(
|
[ERROR_TYPES.REMOVE_ERR_2, new Pair(
|
||||||
'',
|
'There was an error removing distribution target for {workbasketId}.',
|
||||||
'There was an error removing distribution target for {this.workbasket.workbasketId}.'
|
'',
|
||||||
)],
|
)],
|
||||||
// workbasket-information.component
|
// workbasket-information.component
|
||||||
[ERROR_TYPES.SAVE_ERR_4, new Pair(
|
[ERROR_TYPES.SAVE_ERR_4, new Pair(
|
||||||
'',
|
'There was error while saving your workbasket',
|
||||||
'There was error while saving your workbasket'
|
''
|
||||||
)],
|
)],
|
||||||
// workbasket-information.component
|
// workbasket-information.component
|
||||||
[ERROR_TYPES.CREATE_ERR_2, new Pair(
|
[ERROR_TYPES.CREATE_ERR_2, new Pair(
|
||||||
'',
|
'There was an error creating a workbasket',
|
||||||
'There was an error creating a workbasket'
|
''
|
||||||
)],
|
)],
|
||||||
// workbasket-information.component
|
// workbasket-information.component
|
||||||
[ERROR_TYPES.MARK_ERR, new Pair(
|
[ERROR_TYPES.MARK_ERR, new Pair(
|
||||||
'There was an error marking workbasket for deletion',
|
'Workbasket was marked for deletion.',
|
||||||
'It not possible to mark the workbasket for deletion, It has been deleted.'
|
'The Workbasket {workbasketId} still contains completed tasks and could not be deleted.'
|
||||||
|
+ 'Instead is was marked for deletion and will be deleted automatically '
|
||||||
|
+ 'as soon as the completed tasks are deleted from the database.'
|
||||||
)],
|
)],
|
||||||
// domain.guard
|
// domain.guard
|
||||||
[ERROR_TYPES.FETCH_ERR_5, new Pair(
|
[ERROR_TYPES.FETCH_ERR_5, new Pair(
|
||||||
'There was an error, please contact with your administrator',
|
'There was an error, please contact with your administrator',
|
||||||
'There was an error getting Domains'
|
'There was an error getting Domains'
|
||||||
)],
|
)],
|
||||||
// history.guard
|
// history.guard
|
||||||
[ERROR_TYPES.FETCH_ERR_6, new Pair(
|
[ERROR_TYPES.FETCH_ERR_6, new Pair(
|
||||||
'There was an error, please contact with your administrator',
|
'There was an error, please contact with your administrator',
|
||||||
'There was an error getting history provider'
|
'There was an error getting history provider'
|
||||||
)],
|
)],
|
||||||
// http-client-interceptor.service
|
// http-client-interceptor.service
|
||||||
[ERROR_TYPES.ACCESS_ERR, new Pair(
|
[ERROR_TYPES.ACCESS_ERR, new Pair(
|
||||||
'You have no access to this resource ',
|
'You have no access to this resource ',
|
||||||
''
|
''
|
||||||
)],
|
)],
|
||||||
// http-client-interceptor.service
|
// http-client-interceptor.service
|
||||||
[ERROR_TYPES.GENERAL_ERR, new Pair(
|
[ERROR_TYPES.GENERAL_ERR, new Pair(
|
||||||
'There was error, please contact with your administrator',
|
'There was error, please contact with your administrator',
|
||||||
''
|
''
|
||||||
)],
|
|
||||||
// http-client-interceptor.service
|
|
||||||
[ERROR_TYPES.NONE, new Pair(
|
|
||||||
'',
|
|
||||||
'Error wird ignoriert, keine Message geworfen'
|
|
||||||
)],
|
)],
|
||||||
// spinner.component
|
// spinner.component
|
||||||
[ERROR_TYPES.TIMEOUT_ERR, new Pair(
|
[ERROR_TYPES.TIMEOUT_ERR, new Pair(
|
||||||
'Request time exceeded',
|
'There was an error with your request, please make sure you have internet connection',
|
||||||
'There was an error with your request, please make sure you have internet connection'
|
'Request time exceeded'
|
||||||
)],
|
)],
|
||||||
// taskdetails.component
|
// taskdetails.component
|
||||||
[ERROR_TYPES.FETCH_ERR_7, new Pair(
|
[ERROR_TYPES.FETCH_ERR_7, new Pair(
|
||||||
'',
|
'An error occurred while fetching the task',
|
||||||
'An error occurred while fetching the task'
|
''
|
||||||
)],
|
)],
|
||||||
// taskdetails.component
|
// taskdetails.component
|
||||||
[ERROR_TYPES.DELETE_ERR_2, new Pair(
|
[ERROR_TYPES.DELETE_ERR_2, new Pair(
|
||||||
'',
|
'An error occurred while deleting the task',
|
||||||
'An error occurred while deleting the task'
|
''
|
||||||
)],
|
)],
|
||||||
|
|
||||||
// ALERTS
|
// ALERTS
|
||||||
|
|
||||||
// access-items-management.component
|
// access-items-management.component
|
||||||
[ERROR_TYPES.SUCCESS_ALERT, new Pair(
|
[ERROR_TYPES.SUCCESS_ALERT, new Pair(
|
||||||
'',
|
'',
|
||||||
'{this.accessIdSelected} was removed successfully'
|
'{this.accessIdSelected} was removed successfully'
|
||||||
)],
|
)],
|
||||||
// classification-details.component
|
// classification-details.component
|
||||||
[ERROR_TYPES.SUCCESS_ALERT_2, new Pair(
|
[ERROR_TYPES.SUCCESS_ALERT_2, new Pair(
|
||||||
'',
|
'',
|
||||||
'Classification {classification.key} was saved successfully'
|
'Classification {classification.key} was saved successfully'
|
||||||
)],
|
)],
|
||||||
// classification-details.component
|
// classification-details.component
|
||||||
[ERROR_TYPES.SUCCESS_ALERT_3, new Pair(
|
[ERROR_TYPES.SUCCESS_ALERT_3, new Pair(
|
||||||
'Classification {this.classification.key} was saved successfully',
|
'Classification {this.classification.key} was saved successfully',
|
||||||
''
|
''
|
||||||
)],
|
)],
|
||||||
// classification-details.component
|
// classification-details.component
|
||||||
// access-items.component
|
// access-items.component
|
||||||
// workbasket.distribution-targets.component
|
// workbasket.distribution-targets.component
|
||||||
// workbasket-information.component
|
// workbasket-information.component
|
||||||
[ERROR_TYPES.INFO_ALERT, new Pair(
|
[ERROR_TYPES.INFO_ALERT, new Pair(
|
||||||
'Reset edited fields',
|
'Reset edited fields',
|
||||||
''
|
''
|
||||||
)],
|
)],
|
||||||
// classification-details.component
|
// classification-details.component
|
||||||
[ERROR_TYPES.SUCCESS_ALERT_4, new Pair(
|
[ERROR_TYPES.SUCCESS_ALERT_4, new Pair(
|
||||||
'Classification {key} was removed successfully',
|
'Classification {key} was removed successfully',
|
||||||
''
|
''
|
||||||
)],
|
)],
|
||||||
// classification-list.component
|
// classification-list.component
|
||||||
[ERROR_TYPES.SUCCESS_ALERT_5, new Pair(
|
[ERROR_TYPES.SUCCESS_ALERT_5, new Pair(
|
||||||
'Classification {key} was saved successfully',
|
'Classification {key} was saved successfully',
|
||||||
''
|
''
|
||||||
)],
|
)],
|
||||||
// import-export.component
|
// import-export.component
|
||||||
[ERROR_TYPES.SUCCESS_ALERT_6, new Pair(
|
[ERROR_TYPES.SUCCESS_ALERT_6, new Pair(
|
||||||
'Import was successful',
|
'Import was successful',
|
||||||
''
|
''
|
||||||
)],
|
)],
|
||||||
// access-items.component
|
// access-items.component
|
||||||
[ERROR_TYPES.SUCCESS_ALERT_7, new Pair(
|
[ERROR_TYPES.SUCCESS_ALERT_7, new Pair(
|
||||||
'Workbasket {component.workbasket.key} Access items were saved successfully',
|
'Workbasket {component.workbasket.key} Access items were saved successfully',
|
||||||
''
|
''
|
||||||
)],
|
)],
|
||||||
// workbasket.distribution-targets.component
|
// workbasket.distribution-targets.component
|
||||||
[ERROR_TYPES.SUCCESS_ALERT_8, new Pair(
|
[ERROR_TYPES.SUCCESS_ALERT_8, new Pair(
|
||||||
'Workbasket {this.workbasket.name} Distribution targets were saved successfully',
|
'Workbasket {this.workbasket.name} Distribution targets were saved successfully',
|
||||||
''
|
''
|
||||||
)],
|
)],
|
||||||
// workbasket-information.component
|
// workbasket-information.component
|
||||||
[ERROR_TYPES.SUCCESS_ALERT_9, new Pair(
|
[ERROR_TYPES.SUCCESS_ALERT_9, new Pair(
|
||||||
'DistributionTarget for workbasketID {this.workbasket.workbasketId} was removed successfully',
|
'DistributionTarget for workbasketID {this.workbasket.workbasketId} was removed successfully',
|
||||||
''
|
''
|
||||||
)],
|
)],
|
||||||
// workbasket-information.component
|
// workbasket-information.component
|
||||||
[ERROR_TYPES.SUCCESS_ALERT_10, new Pair(
|
[ERROR_TYPES.SUCCESS_ALERT_10, new Pair(
|
||||||
'Workbasket {workbasketUpdated.key} was saved successfully',
|
'Workbasket {workbasketUpdated.key} was saved successfully',
|
||||||
''
|
''
|
||||||
)],
|
)],
|
||||||
// workbasket-information.component
|
// workbasket-information.component
|
||||||
[ERROR_TYPES.SUCCESS_ALERT_11, new Pair(
|
[ERROR_TYPES.SUCCESS_ALERT_11, new Pair(
|
||||||
'Workbasket {workbasketUpdated.key} was created successfully',
|
'Workbasket {workbasketUpdated.key} was created successfully',
|
||||||
''
|
''
|
||||||
)],
|
)],
|
||||||
// workbasket-information.component
|
// workbasket-information.component
|
||||||
[ERROR_TYPES.SUCCESS_ALERT_12, new Pair(
|
[ERROR_TYPES.SUCCESS_ALERT_12, new Pair(
|
||||||
'The Workbasket {this.workbasket.workbasketId} has been marked for deletion',
|
'The Workbasket {workbasketId} has been deleted.',
|
||||||
''
|
''
|
||||||
)],
|
)],
|
||||||
// forms-validator.service
|
// forms-validator.service
|
||||||
[ERROR_TYPES.WARNING_ALERT, new Pair(
|
[ERROR_TYPES.WARNING_ALERT, new Pair(
|
||||||
'There are some empty fields which are required.',
|
'There are some empty fields which are required.',
|
||||||
''
|
''
|
||||||
)],
|
)],
|
||||||
// forms-validator.service x2
|
// forms-validator.service x2
|
||||||
[ERROR_TYPES.WARNING_ALERT_2, new Pair(
|
[ERROR_TYPES.WARNING_ALERT_2, new Pair(
|
||||||
'The {responseOwner.field} introduced is not valid.',
|
'The {responseOwner.field} introduced is not valid.',
|
||||||
''
|
''
|
||||||
)],
|
)],
|
||||||
// taskdetails.component
|
// taskdetails.component
|
||||||
[ERROR_TYPES.DANGER_ALERT, new Pair(
|
[ERROR_TYPES.DANGER_ALERT, new Pair(
|
||||||
'There was an error while updating.',
|
'There was an error while updating.',
|
||||||
''
|
''
|
||||||
)],
|
)],
|
||||||
// taskdetails.component
|
// taskdetails.component
|
||||||
[ERROR_TYPES.SUCCESS_ALERT_13, new Pair(
|
[ERROR_TYPES.SUCCESS_ALERT_13, new Pair(
|
||||||
'Task {this.currentId} was created successfully.',
|
'Task {this.currentId} was created successfully.',
|
||||||
''
|
''
|
||||||
)],
|
)],
|
||||||
// taskdetails.component
|
// taskdetails.component
|
||||||
[ERROR_TYPES.SUCCESS_ALERT_14, new Pair(
|
[ERROR_TYPES.SUCCESS_ALERT_14, new Pair(
|
||||||
'Updating was successful.',
|
'Updating was successful.',
|
||||||
''
|
''
|
||||||
)],
|
)],
|
||||||
// taskdetails.component
|
// taskdetails.component
|
||||||
[ERROR_TYPES.DANGER_ALERT_2, new Pair(
|
[ERROR_TYPES.DANGER_ALERT_2, new Pair(
|
||||||
'There was an error while creating a new task.',
|
'There was an error while creating a new task.',
|
||||||
''
|
''
|
||||||
)],
|
)],
|
||||||
// task-master.component
|
// task-master.component
|
||||||
[ERROR_TYPES.INFO_ALERT_2, new Pair(
|
[ERROR_TYPES.INFO_ALERT_2, new Pair(
|
||||||
'The selected Workbasket is empty!',
|
'The selected Workbasket is empty!',
|
||||||
''
|
''
|
||||||
)],
|
)],
|
||||||
]);
|
]);
|
||||||
|
|
@ -0,0 +1,25 @@
|
||||||
|
import { Injectable } from '@angular/core';
|
||||||
|
import { Observable, Subject } from 'rxjs';
|
||||||
|
import { ErrorModel } from '../../models/error-model';
|
||||||
|
import { ERROR_TYPES } from '../../models/errors';
|
||||||
|
import { HttpErrorResponse } from "@angular/common/http";
|
||||||
|
|
||||||
|
@Injectable({
|
||||||
|
providedIn: 'root'
|
||||||
|
})
|
||||||
|
export class ErrorsService {
|
||||||
|
errorSubject$: Subject<ErrorModel> = new Subject<ErrorModel>();
|
||||||
|
|
||||||
|
public updateError(key: ERROR_TYPES, passedError?: HttpErrorResponse, addition?: Map<String, String>): void {
|
||||||
|
const errorModel = new ErrorModel(key, passedError, addition);
|
||||||
|
this.updateErrorSubject(errorModel);
|
||||||
|
}
|
||||||
|
|
||||||
|
getError(): Observable<ErrorModel> {
|
||||||
|
return this.errorSubject$.asObservable();
|
||||||
|
}
|
||||||
|
|
||||||
|
private updateErrorSubject(errorToShow: ErrorModel) {
|
||||||
|
this.errorSubject$.next(errorToShow);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,9 +1,7 @@
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { Subject, Observable } from 'rxjs';
|
import { Observable, Subject } from 'rxjs';
|
||||||
import { MessageModal } from 'app/models/message-modal';
|
import { MessageModal } from 'app/models/message-modal';
|
||||||
|
|
||||||
import { ERROR_TYPES, errors as ERRORS } from './errors';
|
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class GeneralModalService {
|
export class GeneralModalService {
|
||||||
private messageTriggered = new Subject<MessageModal>();
|
private messageTriggered = new Subject<MessageModal>();
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,28 @@
|
||||||
|
<div *ngIf="error">
|
||||||
|
<div class="modal-backdrop show"></div>
|
||||||
|
<div aria-labelledby="errorModalLabel"
|
||||||
|
class="modal show"
|
||||||
|
data-backdrop="static"
|
||||||
|
data-keyboard="false" role="dialog"
|
||||||
|
tabindex="-1">
|
||||||
|
<div class="modal-dialog" role="document">
|
||||||
|
<div class="modal-content word-break">
|
||||||
|
<div class="modal-header">
|
||||||
|
<h4 class="modal-title" id="errorModalLabel">{{error.title}}</h4>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<div class="alert alert-danger" role="alert">
|
||||||
|
<span class="material-icons md-20" data-toggle="tooltip">error</span>
|
||||||
|
<span class="sr-only">Error:</span>
|
||||||
|
{{error.message ? error.message : error.errObj.error.message}}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button (click)="removeMessage()" class="btn btn-default btn-danger" data-dismiss="modal"
|
||||||
|
type="button">Close
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
.word-break {
|
||||||
|
word-break: break-word;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,25 @@
|
||||||
|
import {async, ComponentFixture, TestBed} from '@angular/core/testing';
|
||||||
|
|
||||||
|
import {ErrorModalComponent} from './error-modal.component';
|
||||||
|
|
||||||
|
describe('GeneralMessageModalComponent', () => {
|
||||||
|
let component: ErrorModalComponent;
|
||||||
|
let fixture: ComponentFixture<ErrorModalComponent>;
|
||||||
|
|
||||||
|
beforeEach(async(() => {
|
||||||
|
TestBed.configureTestingModule({
|
||||||
|
declarations: [ErrorModalComponent]
|
||||||
|
})
|
||||||
|
.compileComponents();
|
||||||
|
}));
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
fixture = TestBed.createComponent(ErrorModalComponent);
|
||||||
|
component = fixture.componentInstance;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create', () => {
|
||||||
|
expect(component).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
@ -0,0 +1,34 @@
|
||||||
|
import {Component, EventEmitter, OnInit, Output, ViewChild} from '@angular/core';
|
||||||
|
import {ErrorModel} from "../../models/error-model";
|
||||||
|
import {Subscription} from "rxjs";
|
||||||
|
import {ErrorsService} from "../../services/errors/errors.service";
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'error-modal',
|
||||||
|
templateUrl: './error-modal.component.html',
|
||||||
|
styleUrls: ['./error-modal.component.scss']
|
||||||
|
})
|
||||||
|
export class ErrorModalComponent implements OnInit {
|
||||||
|
error: ErrorModel;
|
||||||
|
|
||||||
|
errorsSubscription: Subscription;
|
||||||
|
|
||||||
|
constructor(private errorsService: ErrorsService) {
|
||||||
|
}
|
||||||
|
|
||||||
|
ngOnInit(): void {
|
||||||
|
this.errorsSubscription = this.errorsService.getError().subscribe((error: ErrorModel) => {
|
||||||
|
this.error = error;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
removeMessage() {
|
||||||
|
delete this.error;
|
||||||
|
}
|
||||||
|
|
||||||
|
ngOnDestroy() {
|
||||||
|
if (this.errorsSubscription) {
|
||||||
|
this.errorsSubscription.unsubscribe();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,20 +0,0 @@
|
||||||
import { ErrorHandler, Injectable } from '@angular/core';
|
|
||||||
import { Subject } from 'rxjs';
|
|
||||||
import { ErrorModel } from '../../../models/error-model';
|
|
||||||
import { ERROR_TYPES } from '../../../services/general-modal/errors';
|
|
||||||
|
|
||||||
@Injectable({
|
|
||||||
providedIn: 'root'
|
|
||||||
})
|
|
||||||
export class ErrorsService {
|
|
||||||
errorSubject$: Subject<ErrorModel>;
|
|
||||||
|
|
||||||
private updateErrorSubject(errorToShow: ErrorModel) {
|
|
||||||
this.errorSubject$.next(errorToShow);
|
|
||||||
}
|
|
||||||
|
|
||||||
public updateError(key: ERROR_TYPES, passedError?: ErrorHandler, addition?: string): void {
|
|
||||||
const errorModel = new ErrorModel(key, passedError, addition);
|
|
||||||
this.updateErrorSubject(errorModel);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -3,7 +3,7 @@ import { Injectable } from '@angular/core';
|
||||||
import { AlertService } from 'app/services/alert/alert.service';
|
import { AlertService } from 'app/services/alert/alert.service';
|
||||||
import { AlertModel, AlertType } from 'app/models/alert';
|
import { AlertModel, AlertType } from 'app/models/alert';
|
||||||
import { AccessIdsService } from 'app/shared/services/access-ids/access-ids.service';
|
import { AccessIdsService } from 'app/shared/services/access-ids/access-ids.service';
|
||||||
import { ERROR_TYPES } from '../../../services/general-modal/errors';
|
import { ERROR_TYPES } from '../../../models/errors';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class FormsValidatorService {
|
export class FormsValidatorService {
|
||||||
|
|
|
||||||
|
|
@ -1,43 +1,35 @@
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { HttpEvent, HttpInterceptor, HttpHandler, HttpRequest, HttpErrorResponse } from '@angular/common/http';
|
import { HttpEvent, HttpInterceptor, HttpHandler, HttpRequest, HttpErrorResponse } from '@angular/common/http';
|
||||||
import { Observable } from 'rxjs';
|
import { Observable } from 'rxjs';
|
||||||
|
|
||||||
import { MessageModal } from 'app/models/message-modal';
|
|
||||||
|
|
||||||
import { GeneralModalService } from 'app/services/general-modal/general-modal.service';
|
|
||||||
import { RequestInProgressService } from 'app/services/requestInProgress/request-in-progress.service';
|
import { RequestInProgressService } from 'app/services/requestInProgress/request-in-progress.service';
|
||||||
import { environment } from 'environments/environment';
|
import { environment } from 'environments/environment';
|
||||||
import { tap } from 'rxjs/operators';
|
import { tap } from 'rxjs/operators';
|
||||||
import { ERROR_TYPES } from '../../../services/general-modal/errors';
|
import { ErrorsService } from "../../../services/errors/errors.service";
|
||||||
|
import { ERROR_TYPES } from "../../../models/errors";
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class HttpClientInterceptor implements HttpInterceptor {
|
export class HttpClientInterceptor implements HttpInterceptor {
|
||||||
constructor(
|
constructor(
|
||||||
private generalModalService: GeneralModalService,
|
private requestInProgressService: RequestInProgressService,
|
||||||
private requestInProgressService: RequestInProgressService
|
private errorsService: ErrorsService
|
||||||
) {
|
) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
intercept(request: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> {
|
intercept(request: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> {
|
||||||
let req = request.clone({ headers: request.headers.set('Content-Type', 'application/hal+json') });
|
let req = request.clone({headers: request.headers.set('Content-Type', 'application/hal+json')});
|
||||||
if (!environment.production) {
|
if (!environment.production) {
|
||||||
req = req.clone({ headers: req.headers.set('Authorization', 'Basic YWRtaW46YWRtaW4=') });
|
req = req.clone({headers: req.headers.set('Authorization', 'Basic YWRtaW46YWRtaW4=')});
|
||||||
}
|
}
|
||||||
return next.handle(req).pipe(tap(() => { }, error => {
|
return next.handle(req).pipe(tap(() => {
|
||||||
|
}, error => {
|
||||||
this.requestInProgressService.setRequestInProgress(false);
|
this.requestInProgressService.setRequestInProgress(false);
|
||||||
if (error instanceof HttpErrorResponse && (error.status === 401 || error.status === 403)) {
|
if (error instanceof HttpErrorResponse && (error.status === 401 || error.status === 403)) {
|
||||||
// new Key ERROR_TYPES.ACCESS_ERR
|
this.errorsService.updateError(ERROR_TYPES.ACCESS_ERR, error);
|
||||||
this.generalModalService.triggerMessage(
|
|
||||||
new MessageModal('You have no access to this resource ', error)
|
|
||||||
);
|
|
||||||
} else if (error instanceof HttpErrorResponse && (error.status === 404) && error.url.indexOf('environment-information.json')) {
|
} else if (error instanceof HttpErrorResponse && (error.status === 404) && error.url.indexOf('environment-information.json')) {
|
||||||
// ignore this error message Key ERROR_TYPES.NONE
|
// ignore this error
|
||||||
} else {
|
} else {
|
||||||
// new Key ERROR_TYPES.GENERAL_ERR
|
this.errorsService.updateError(ERROR_TYPES.GENERAL_ERR, error);
|
||||||
this.generalModalService.triggerMessage(
|
|
||||||
new MessageModal('There was error, please contact with your administrator ', error)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,7 @@ import { ClassificationsService } from 'app/shared/services/classifications/clas
|
||||||
* Components
|
* Components
|
||||||
*/
|
*/
|
||||||
import { GeneralMessageModalComponent } from 'app/shared/general-message-modal/general-message-modal.component';
|
import { GeneralMessageModalComponent } from 'app/shared/general-message-modal/general-message-modal.component';
|
||||||
|
import { ErrorModalComponent } from "./error-message-modal/error-modal.component";
|
||||||
import { SpinnerComponent } from 'app/shared/spinner/spinner.component';
|
import { SpinnerComponent } from 'app/shared/spinner/spinner.component';
|
||||||
import { AlertComponent } from 'app/shared/alert/alert.component';
|
import { AlertComponent } from 'app/shared/alert/alert.component';
|
||||||
import { MasterAndDetailComponent } from 'app/shared/master-and-detail/master-and-detail.component';
|
import { MasterAndDetailComponent } from 'app/shared/master-and-detail/master-and-detail.component';
|
||||||
|
|
@ -65,6 +66,7 @@ const MODULES = [
|
||||||
|
|
||||||
const DECLARATIONS = [
|
const DECLARATIONS = [
|
||||||
GeneralMessageModalComponent,
|
GeneralMessageModalComponent,
|
||||||
|
ErrorModalComponent,
|
||||||
SpinnerComponent,
|
SpinnerComponent,
|
||||||
AlertComponent,
|
AlertComponent,
|
||||||
MasterAndDetailComponent,
|
MasterAndDetailComponent,
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,6 @@
|
||||||
import { Component, Input, Output, EventEmitter, OnDestroy, ViewChild } from '@angular/core';
|
import { Component, EventEmitter, Input, OnDestroy, Output, ViewChild } from '@angular/core';
|
||||||
|
import { ERROR_TYPES } from '../../models/errors';
|
||||||
|
import { ErrorsService } from "../../services/errors/errors.service";
|
||||||
import { MessageModal } from 'app/models/message-modal';
|
|
||||||
|
|
||||||
import { GeneralModalService } from 'app/services/general-modal/general-modal.service';
|
|
||||||
import { ERROR_TYPES } from '../../services/general-modal/errors';
|
|
||||||
|
|
||||||
declare let $: any;
|
declare let $: any;
|
||||||
|
|
||||||
|
|
@ -15,25 +11,37 @@ declare let $: any;
|
||||||
styleUrls: ['./spinner.component.scss']
|
styleUrls: ['./spinner.component.scss']
|
||||||
})
|
})
|
||||||
export class SpinnerComponent implements OnDestroy {
|
export class SpinnerComponent implements OnDestroy {
|
||||||
|
showSpinner: boolean;
|
||||||
|
@Input()
|
||||||
|
delay = 250;
|
||||||
|
@Input()
|
||||||
|
isModal = false;
|
||||||
|
@Input()
|
||||||
|
positionClass: string;
|
||||||
|
@Output()
|
||||||
|
spinnerIsRunning = new EventEmitter<boolean>();
|
||||||
private currentTimeout: any;
|
private currentTimeout: any;
|
||||||
private requestTimeout: any;
|
private requestTimeout: any;
|
||||||
private maxRequestTimeout = 10000;
|
private maxRequestTimeout = 10000;
|
||||||
|
@ViewChild('spinnerModal', {static: true})
|
||||||
|
private modal;
|
||||||
|
|
||||||
|
constructor(private errorsService: ErrorsService) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
set isDelayedRunning(value: boolean) {
|
set isDelayedRunning(value: boolean) {
|
||||||
this.showSpinner = value;
|
this.showSpinner = value;
|
||||||
this.spinnerIsRunning.next(value);
|
this.spinnerIsRunning.next(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
showSpinner: boolean;
|
|
||||||
|
|
||||||
@Input()
|
|
||||||
delay = 250;
|
|
||||||
|
|
||||||
@Input()
|
@Input()
|
||||||
set isRunning(value: boolean) {
|
set isRunning(value: boolean) {
|
||||||
if (!value) {
|
if (!value) {
|
||||||
this.cancelTimeout();
|
this.cancelTimeout();
|
||||||
if (this.isModal) { this.closeModal(); }
|
if (this.isModal) {
|
||||||
|
this.closeModal();
|
||||||
|
}
|
||||||
this.isDelayedRunning = false;
|
this.isDelayedRunning = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -44,33 +52,19 @@ export class SpinnerComponent implements OnDestroy {
|
||||||
this.runSpinner(value);
|
this.runSpinner(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Input()
|
ngOnDestroy(): any {
|
||||||
isModal = false;
|
this.cancelTimeout();
|
||||||
|
|
||||||
@Input()
|
|
||||||
positionClass: string;
|
|
||||||
|
|
||||||
@Output()
|
|
||||||
spinnerIsRunning = new EventEmitter<boolean>();
|
|
||||||
|
|
||||||
@ViewChild('spinnerModal', { static: true })
|
|
||||||
private modal;
|
|
||||||
|
|
||||||
constructor(private generalModalService: GeneralModalService) {
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private runSpinner(value) {
|
private runSpinner(value) {
|
||||||
this.currentTimeout = setTimeout(() => {
|
this.currentTimeout = setTimeout(() => {
|
||||||
if (this.isModal) { $(this.modal.nativeElement).modal('show'); }
|
if (this.isModal) {
|
||||||
|
$(this.modal.nativeElement).modal('show');
|
||||||
|
}
|
||||||
this.isDelayedRunning = value;
|
this.isDelayedRunning = value;
|
||||||
this.cancelTimeout();
|
this.cancelTimeout();
|
||||||
this.requestTimeout = setTimeout(() => {
|
this.requestTimeout = setTimeout(() => {
|
||||||
// new Key ERROR_TYPES.TIMEOUT_ERR
|
this.errorsService.updateError(ERROR_TYPES.TIMEOUT_ERR);
|
||||||
this.generalModalService.triggerMessage(
|
|
||||||
new MessageModal('There was an error with your request, please make sure you have internet connection',
|
|
||||||
'Request time execeed')
|
|
||||||
);
|
|
||||||
this.cancelTimeout();
|
this.cancelTimeout();
|
||||||
this.isRunning = false;
|
this.isRunning = false;
|
||||||
}, this.maxRequestTimeout);
|
}, this.maxRequestTimeout);
|
||||||
|
|
@ -83,15 +77,10 @@ export class SpinnerComponent implements OnDestroy {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private cancelTimeout(): void {
|
private cancelTimeout(): void {
|
||||||
clearTimeout(this.currentTimeout);
|
clearTimeout(this.currentTimeout);
|
||||||
clearTimeout(this.requestTimeout);
|
clearTimeout(this.requestTimeout);
|
||||||
delete this.currentTimeout; // do we need this?
|
delete this.currentTimeout; // do we need this?
|
||||||
delete this.requestTimeout;
|
delete this.requestTimeout;
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnDestroy(): any {
|
|
||||||
this.cancelTimeout();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,6 @@ import { TaskService } from 'app/workplace/services/task.service';
|
||||||
import { RemoveConfirmationService } from 'app/services/remove-confirmation/remove-confirmation.service';
|
import { RemoveConfirmationService } from 'app/services/remove-confirmation/remove-confirmation.service';
|
||||||
|
|
||||||
import { Task } from 'app/workplace/models/task';
|
import { Task } from 'app/workplace/models/task';
|
||||||
import { MessageModal } from 'app/models/message-modal';
|
|
||||||
import { GeneralModalService } from 'app/services/general-modal/general-modal.service';
|
import { GeneralModalService } from 'app/services/general-modal/general-modal.service';
|
||||||
import { RequestInProgressService } from 'app/services/requestInProgress/request-in-progress.service';
|
import { RequestInProgressService } from 'app/services/requestInProgress/request-in-progress.service';
|
||||||
import { AlertService } from 'app/services/alert/alert.service';
|
import { AlertService } from 'app/services/alert/alert.service';
|
||||||
|
|
@ -16,7 +15,8 @@ import { ObjectReference } from 'app/workplace/models/object-reference';
|
||||||
import { Workbasket } from 'app/models/workbasket';
|
import { Workbasket } from 'app/models/workbasket';
|
||||||
import { WorkplaceService } from 'app/workplace/services/workplace.service';
|
import { WorkplaceService } from 'app/workplace/services/workplace.service';
|
||||||
import { MasterAndDetailService } from 'app/services/masterAndDetail/master-and-detail.service';
|
import { MasterAndDetailService } from 'app/services/masterAndDetail/master-and-detail.service';
|
||||||
import { ERROR_TYPES } from '../../services/general-modal/errors';
|
import { ERROR_TYPES } from '../../models/errors';
|
||||||
|
import { ErrorsService } from "../../services/errors/errors.service";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'taskana-task-details',
|
selector: 'taskana-task-details',
|
||||||
|
|
@ -38,14 +38,15 @@ export class TaskdetailsComponent implements OnInit, OnDestroy {
|
||||||
private deleteTaskSubscription: Subscription;
|
private deleteTaskSubscription: Subscription;
|
||||||
|
|
||||||
constructor(private route: ActivatedRoute,
|
constructor(private route: ActivatedRoute,
|
||||||
private taskService: TaskService,
|
private taskService: TaskService,
|
||||||
private workplaceService: WorkplaceService,
|
private workplaceService: WorkplaceService,
|
||||||
private router: Router,
|
private router: Router,
|
||||||
private removeConfirmationService: RemoveConfirmationService,
|
private removeConfirmationService: RemoveConfirmationService,
|
||||||
private requestInProgressService: RequestInProgressService,
|
private requestInProgressService: RequestInProgressService,
|
||||||
private alertService: AlertService,
|
private alertService: AlertService,
|
||||||
private generalModalService: GeneralModalService,
|
private generalModalService: GeneralModalService,
|
||||||
private masterAndDetailService: MasterAndDetailService) {
|
private errorsService: ErrorsService,
|
||||||
|
private masterAndDetailService: MasterAndDetailService) {
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
|
|
@ -67,10 +68,10 @@ export class TaskdetailsComponent implements OnInit, OnDestroy {
|
||||||
}
|
}
|
||||||
|
|
||||||
resetTask(): void {
|
resetTask(): void {
|
||||||
this.task = { ...this.taskClone };
|
this.task = {...this.taskClone};
|
||||||
this.task.customAttributes = this.taskClone.customAttributes.slice(0);
|
this.task.customAttributes = this.taskClone.customAttributes.slice(0);
|
||||||
this.task.callbackInfo = this.taskClone.callbackInfo.slice(0);
|
this.task.callbackInfo = this.taskClone.callbackInfo.slice(0);
|
||||||
this.task.primaryObjRef = { ...this.taskClone.primaryObjRef };
|
this.task.primaryObjRef = {...this.taskClone.primaryObjRef};
|
||||||
this.alertService.triggerAlert(new AlertModel(AlertType.INFO, 'Reset edited fields'));
|
this.alertService.triggerAlert(new AlertModel(AlertType.INFO, 'Reset edited fields'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -85,11 +86,8 @@ export class TaskdetailsComponent implements OnInit, OnDestroy {
|
||||||
this.task = task;
|
this.task = task;
|
||||||
this.cloneTask();
|
this.cloneTask();
|
||||||
this.taskService.selectTask(task);
|
this.taskService.selectTask(task);
|
||||||
}, err => {
|
}, error => {
|
||||||
// new Key ERROR_TYPES.FETCH_ERR_7
|
this.errorsService.updateError(ERROR_TYPES.FETCH_ERR_7, error);
|
||||||
this.generalModalService.triggerMessage(
|
|
||||||
new MessageModal('An error occurred while fetching the task', err)
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -99,7 +97,7 @@ export class TaskdetailsComponent implements OnInit, OnDestroy {
|
||||||
}
|
}
|
||||||
|
|
||||||
openTask() {
|
openTask() {
|
||||||
this.router.navigate([{ outlets: { detail: `task/${this.currentId}` } }], { relativeTo: this.route.parent });
|
this.router.navigate([{outlets: {detail: `task/${this.currentId}`}}], {relativeTo: this.route.parent});
|
||||||
}
|
}
|
||||||
|
|
||||||
workOnTaskDisabled(): boolean {
|
workOnTaskDisabled(): boolean {
|
||||||
|
|
@ -108,7 +106,7 @@ export class TaskdetailsComponent implements OnInit, OnDestroy {
|
||||||
|
|
||||||
deleteTask(): void {
|
deleteTask(): void {
|
||||||
this.removeConfirmationService.setRemoveConfirmation(this.deleteTaskConfirmation.bind(this),
|
this.removeConfirmationService.setRemoveConfirmation(this.deleteTaskConfirmation.bind(this),
|
||||||
`You are going to delete Task: ${this.currentId}. Can you confirm this action?`);
|
`You are going to delete Task: ${this.currentId}. Can you confirm this action?`);
|
||||||
}
|
}
|
||||||
|
|
||||||
deleteTaskConfirmation(): void {
|
deleteTaskConfirmation(): void {
|
||||||
|
|
@ -116,11 +114,8 @@ export class TaskdetailsComponent implements OnInit, OnDestroy {
|
||||||
this.taskService.publishUpdatedTask();
|
this.taskService.publishUpdatedTask();
|
||||||
this.task = null;
|
this.task = null;
|
||||||
this.router.navigate(['taskana/workplace/tasks']);
|
this.router.navigate(['taskana/workplace/tasks']);
|
||||||
}, err => {
|
}, error => {
|
||||||
// new Key ERROR_TYPES.DELETE_ERR_2
|
this.errorsService.updateError(ERROR_TYPES.DELETE_ERR_2, error);
|
||||||
this.generalModalService.triggerMessage(
|
|
||||||
new MessageModal('An error occurred while deleting the task ', err)
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -131,7 +126,22 @@ export class TaskdetailsComponent implements OnInit, OnDestroy {
|
||||||
backClicked(): void {
|
backClicked(): void {
|
||||||
delete this.task;
|
delete this.task;
|
||||||
this.taskService.selectTask(this.task);
|
this.taskService.selectTask(this.task);
|
||||||
this.router.navigate(['./'], { relativeTo: this.route.parent });
|
this.router.navigate(['./'], {relativeTo: this.route.parent});
|
||||||
|
}
|
||||||
|
|
||||||
|
ngOnDestroy(): void {
|
||||||
|
if (this.routeSubscription) {
|
||||||
|
this.routeSubscription.unsubscribe();
|
||||||
|
}
|
||||||
|
if (this.workbasketSubscription) {
|
||||||
|
this.workbasketSubscription.unsubscribe();
|
||||||
|
}
|
||||||
|
if (this.masterAndDetailSubscription) {
|
||||||
|
this.masterAndDetailSubscription.unsubscribe();
|
||||||
|
}
|
||||||
|
if (this.deleteTaskSubscription) {
|
||||||
|
this.deleteTaskSubscription.unsubscribe();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private onSave() {
|
private onSave() {
|
||||||
|
|
@ -164,7 +174,7 @@ export class TaskdetailsComponent implements OnInit, OnDestroy {
|
||||||
this.task = task;
|
this.task = task;
|
||||||
this.taskService.selectTask(this.task);
|
this.taskService.selectTask(this.task);
|
||||||
this.taskService.publishUpdatedTask(task);
|
this.taskService.publishUpdatedTask(task);
|
||||||
this.router.navigate([`../${task.taskId}`], { relativeTo: this.route });
|
this.router.navigate([`../${task.taskId}`], {relativeTo: this.route});
|
||||||
}, err => {
|
}, err => {
|
||||||
this.requestInProgressService.setRequestInProgress(false);
|
this.requestInProgressService.setRequestInProgress(false);
|
||||||
// new Key ALERT_TYPES.DANGER_ALERT_2
|
// new Key ALERT_TYPES.DANGER_ALERT_2
|
||||||
|
|
@ -179,24 +189,9 @@ export class TaskdetailsComponent implements OnInit, OnDestroy {
|
||||||
}
|
}
|
||||||
|
|
||||||
private cloneTask() {
|
private cloneTask() {
|
||||||
this.taskClone = { ...this.task };
|
this.taskClone = {...this.task};
|
||||||
this.taskClone.customAttributes = this.task.customAttributes.slice(0);
|
this.taskClone.customAttributes = this.task.customAttributes.slice(0);
|
||||||
this.taskClone.callbackInfo = this.task.callbackInfo.slice(0);
|
this.taskClone.callbackInfo = this.task.callbackInfo.slice(0);
|
||||||
this.taskClone.primaryObjRef = { ...this.task.primaryObjRef };
|
this.taskClone.primaryObjRef = {...this.task.primaryObjRef};
|
||||||
}
|
|
||||||
|
|
||||||
ngOnDestroy(): void {
|
|
||||||
if (this.routeSubscription) {
|
|
||||||
this.routeSubscription.unsubscribe();
|
|
||||||
}
|
|
||||||
if (this.workbasketSubscription) {
|
|
||||||
this.workbasketSubscription.unsubscribe();
|
|
||||||
}
|
|
||||||
if (this.masterAndDetailSubscription) {
|
|
||||||
this.masterAndDetailSubscription.unsubscribe();
|
|
||||||
}
|
|
||||||
if (this.deleteTaskSubscription) {
|
|
||||||
this.deleteTaskSubscription.unsubscribe();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue