temp commit before rebase

This commit is contained in:
Finn Mißfeldt 2020-02-27 14:59:33 +01:00
parent 20c07f2cfe
commit 092b3a3cc9
19 changed files with 160 additions and 110 deletions

View File

@ -16,6 +16,7 @@ import { AlertService } from 'app/services/alert/alert.service';
import { RequestInProgressService } from '../../services/requestInProgress/request-in-progress.service';
import { AccessIdsService } from '../../shared/services/access-ids/access-ids.service';
import { AccessIdDefinition } from '../../models/access-id';
import { ERROR_TYPES } from '../../services/general-modal/errors';
@Component({
selector: 'taskana-access-items-management',
@ -98,6 +99,7 @@ export class AccessItemsManagementComponent implements OnInit, OnDestroy {
this.belongingGroups = accessIdsWithGroups.filter(item => item.accessId.includes(this.groupsKey));
this.searchForAccessItemsWorkbaskets();
},
// new Key: ERROR_TYPES.FETCH_ERR
error => {
this.requestInProgressService.setRequestInProgress(false);
this.generalModalService.triggerMessage(
@ -133,6 +135,7 @@ export class AccessItemsManagementComponent implements OnInit, OnDestroy {
this.setAccessItemsGroups(accessItemsResource ? accessItemsResource.accessItems : []);
this.requestInProgressService.setRequestInProgress(false);
},
// new Key: ERROR_TYPES.FETCH_ERR_2
error => {
this.requestInProgressService.setRequestInProgress(false);
this.generalModalService.triggerMessage(
@ -157,6 +160,7 @@ export class AccessItemsManagementComponent implements OnInit, OnDestroy {
this.requestInProgressService.setRequestInProgress(true);
this.accessIdsService.removeAccessItemsPermissions(this.accessIdSelected)
.subscribe(
// new Key: ALERT_TYPES.SUCCESS_ALERT
response => {
this.requestInProgressService.setRequestInProgress(false);
this.alertService.triggerAlert(
@ -168,6 +172,7 @@ export class AccessItemsManagementComponent implements OnInit, OnDestroy {
);
this.searchForAccessItemsWorkbaskets();
},
// new Key: ERROR_TYPES.DELETE_ERR
error => {
this.requestInProgressService.setRequestInProgress(false);
this.generalModalService.triggerMessage(

View File

@ -25,6 +25,7 @@ import { NgForm } from '@angular/forms';
import { FormsValidatorService } from 'app/shared/services/forms/forms-validator.service';
import { ImportExportService } from 'app/administration/services/import-export/import-export.service';
import { CustomFieldsService } from '../../../services/custom-fields/custom-fields.service';
import { ERROR_TYPES } from '../../../services/general-modal/errors';
@Component({
selector: 'taskana-classification-details',
@ -175,9 +176,11 @@ export class ClassificationDetailsComponent implements OnInit, OnDestroy {
.subscribe((classification: ClassificationDefinition) => {
this.classification = classification;
this.classificationsService.selectClassification(classification);
// new Key ALERT_TYPES.SUCCESS_ALERT_2
this.alertService.triggerAlert(new AlertModel(AlertType.SUCCESS, `Classification ${classification.key} was saved successfully`));
this.afterRequest();
},
// new Key: ERROR_TYPES.CREATE_ERR
error => {
this.generalModalService.triggerMessage(new MessageModal('There was an error creating a classification', error));
this.afterRequest();
@ -188,11 +191,13 @@ export class ClassificationDetailsComponent implements OnInit, OnDestroy {
this.classification._links.self.href, this.classification
));
this.afterRequest();
// new Key: ALERT_TYPES.SUCCESS_ALERT_3
this.alertService.triggerAlert(
new AlertModel(AlertType.SUCCESS, `Classification ${this.classification.key} was saved successfully`)
);
this.cloneClassification(this.classification);
} catch (error) {
// new Key: ERROR_TYPES.SAVE_ERR
this.generalModalService.triggerMessage(new MessageModal('There was error while saving your classification', error));
this.afterRequest();
}
@ -201,6 +206,7 @@ export class ClassificationDetailsComponent implements OnInit, OnDestroy {
onClear() {
this.formsValidatorService.formSubmitAttempt = false;
// new Key: ALERT_TYPES.INFO_ALERT
this.alertService.triggerAlert(new AlertModel(AlertType.INFO, 'Reset edited fields'));
this.classification = { ...this.classificationClone };
}
@ -275,6 +281,7 @@ export class ClassificationDetailsComponent implements OnInit, OnDestroy {
private removeClassificationConfirmation() {
if (!this.classification || !this.classification.classificationId) {
this.generalModalService.triggerMessage(
// new Key ERROR_TYPES.SELECT_ERR
new MessageModal('There is no classification selected', 'Please check if you are creating a classification')
);
return;
@ -290,8 +297,10 @@ export class ClassificationDetailsComponent implements OnInit, OnDestroy {
this.afterRequest();
this.classificationsService.selectClassification();
this.router.navigate(['taskana/administration/classifications']);
// new Key: ALERT_TYPES.SUCCESS_ALERT_4
this.alertService.triggerAlert(new AlertModel(AlertType.SUCCESS, `Classification ${key} was removed successfully`));
}, error => {
// new Key: ERROR_TYPES.REMOVE_ERR
this.generalModalService.triggerMessage(new MessageModal('There was error while removing your classification', error));
this.afterRequest();
});

View File

@ -13,6 +13,7 @@ import { ImportExportService } from 'app/administration/services/import-export/i
import { ClassificationDefinition } from '../../../../models/classification-definition';
import { AlertModel, AlertType } from '../../../../models/alert';
import { AlertService } from '../../../../services/alert/alert.service';
import { ERROR_TYPES } from '../../../../services/general-modal/errors';
@Component({
selector: 'taskana-classification-list',
@ -130,6 +131,7 @@ export class ClassificationListComponent implements OnInit, OnDestroy {
this.requestInProgress = false;
});
// new Error-Key: ALERT_TYPES.SUCCESS_ALERT_5
if (key) {
this.alertService.triggerAlert(new AlertModel(AlertType.SUCCESS, `Classification ${key} was saved successfully`));
}

View File

@ -10,6 +10,7 @@ import { AlertService } from 'app/services/alert/alert.service';
import { AlertModel, AlertType } from 'app/models/alert';
import { UploadService } from 'app/shared/services/upload/upload.service';
import { ImportExportService } from 'app/administration/services/import-export/import-export.service';
import { ERROR_TYPES } from '../../../services/general-modal/errors';
@Component({
selector: 'taskana-import-export-component',
@ -88,6 +89,7 @@ export class ImportExportComponent implements OnInit {
break;
default:
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.'));
}
@ -104,16 +106,21 @@ export class ImportExportComponent implements OnInit {
if (event.readyState === 4 && event.status >= 400) {
let title;
if (event.status === 401) {
// new Key ERROR_TYPES.IMPORT_ERR_1
title = 'Import was not successful, you have no access to apply this operation.';
} else if (event.status === 404) {
// new Key ERROR_TYPES.IMPORT_ERR_2
title = 'Import was not successful, operation was not found.';
} else if (event.status === 409) {
// new Key ERROR_TYPES.IMPORT_ERR_3
title = 'Import was not successful, operation has some conflicts.';
} else if (event.status === 413) {
// new Key ERROR_TYPES.IMPORT_ERR_4
title = 'Import was not successful, maximum file size exceeded.';
}
this.errorHandler(title, JSON.parse(event.responseText).message);
} else if (event.readyState === 4 && event.status === 200) {
// new Key: ALERT_TYPES.SUCCESS_ALERT_6
this.alertService.triggerAlert(new AlertModel(AlertType.SUCCESS, 'Import was successful'));
this.importExportService.setImportingFinished(true);
this.resetProgress();
@ -121,6 +128,7 @@ export class ImportExportComponent implements OnInit {
}
private onFailedResponse(event) {
// new Key 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');
}

View File

@ -18,6 +18,7 @@ import { CustomFieldsService } from 'app/services/custom-fields/custom-fields.se
import { highlight } from 'app/shared/animations/validation.animation';
import { FormsValidatorService } from 'app/shared/services/forms/forms-validator.service';
import { AccessIdDefinition } from 'app/models/access-id';
import { ERROR_TYPES } from '../../../../services/general-modal/errors';
@Component({
selector: 'taskana-workbasket-access-items',
@ -140,7 +141,8 @@ export class AccessItemsComponent implements OnChanges, OnDestroy {
this.AccessItemsForm.reset();
this.setAccessItemsGroups(this.accessItemsResetClone);
this.accessItemsClone = this.cloneAccessItems(this.accessItemsResetClone);
this.alertService.triggerAlert(new AlertModel(AlertType.INFO, 'Reset edited fields'));
// new Key ALERT_TYPES.INFO_ALERT
this.alertService.triggerAlert(new AlertModel(AlertType.INFO, 'Reset edited fields'));
}
remove(index: number) {
@ -184,11 +186,13 @@ export class AccessItemsComponent implements OnChanges, OnDestroy {
.subscribe(response => {
this.accessItemsClone = this.cloneAccessItems(this.AccessItemsForm.value.accessItemsGroups);
this.accessItemsResetClone = this.cloneAccessItems(this.AccessItemsForm.value.accessItemsGroups);
// new Key ALERT_TYPES.SUCCESS_ALERT_7
this.alertService.triggerAlert(new AlertModel(
AlertType.SUCCESS, `Workbasket ${this.workbasket.name} Access items were saved successfully`
));
this.requestInProgressService.setRequestInProgress(false);
}, error => {
// new Key ERROR_TYPES.SAVE_ERR_2
this.generalModalService.triggerMessage(new MessageModal('There was error while saving your workbasket\'s access items', error));
this.requestInProgressService.setRequestInProgress(false);
});

View File

@ -18,6 +18,7 @@ import { TaskanaQueryParameters } from 'app/shared/util/query-parameters';
import { Page } from 'app/models/page';
import { OrientationService } from 'app/services/orientation/orientation.service';
import { Orientation } from 'app/models/orientation';
import { ALERT_TYPES, ERROR_TYPES } from '../../../../services/general-modal/errors';
export enum Side {
LEFT,
@ -121,11 +122,13 @@ export class DistributionTargetsComponent implements OnChanges, OnDestroy {
this.distributionTargetsSelected = response.distributionTargets;
this.distributionTargetsSelectedClone = Object.assign([], this.distributionTargetsSelected);
this.distributionTargetsClone = Object.assign([], this.distributionTargetsLeft);
// new Key ALERT_TYPES.SUCCESS_ALERT_8
this.alertService.triggerAlert(new AlertModel(AlertType.SUCCESS,
`Workbasket ${this.workbasket.name} : Distribution targets were saved successfully`));
return true;
},
error => {
// new Key ERROR_TYPES.SAVE_ERR_3
this.generalModalService.triggerMessage(
new MessageModal('There was error while saving your workbasket\'s distribution targets', error)
);
@ -136,6 +139,7 @@ export class DistributionTargetsComponent implements OnChanges, OnDestroy {
}
onClear() {
// new key ALERT_TYPES.INFO_ALERT
this.alertService.triggerAlert(new AlertModel(AlertType.INFO, 'Reset edited fields'));
this.distributionTargetsLeft = Object.assign([], this.distributionTargetsClone);
this.distributionTargetsRight = Object.assign([], this.distributionTargetsSelectedClone);

View File

@ -18,6 +18,7 @@ import { RequestInProgressService } from 'app/services/requestInProgress/request
import { CustomFieldsService } from 'app/services/custom-fields/custom-fields.service';
import { RemoveConfirmationService } from 'app/services/remove-confirmation/remove-confirmation.service';
import { FormsValidatorService } from 'app/shared/services/forms/forms-validator.service';
import {ALERT_TYPES, ERROR_TYPES} from '../../../../services/general-modal/errors';
@Component({
selector: 'taskana-workbasket-information',
@ -123,6 +124,7 @@ implements OnInit, OnChanges, OnDestroy {
onClear() {
this.formsValidatorService.formSubmitAttempt = false;
this.alertService.triggerAlert(
// new Key ALERT_TYPES.INFO_ALERT
new AlertModel(AlertType.INFO, 'Reset edited fields')
);
this.workbasket = { ...this.workbasketClone };
@ -152,6 +154,7 @@ implements OnInit, OnChanges, OnDestroy {
.subscribe(
reponse => {
this.requestInProgressService.setRequestInProgress(false);
// new Key ALERT_TYPES.SUCCESS_ALERT_9
this.alertService.triggerAlert(
new AlertModel(
AlertType.SUCCESS,
@ -162,6 +165,7 @@ implements OnInit, OnChanges, OnDestroy {
);
},
error => {
// new Key ERROR_TYPES.REMOVE_ERR_2
this.generalModalService.triggerMessage(
new MessageModal(
`There was an error removing distribution target for ${
@ -189,6 +193,7 @@ implements OnInit, OnChanges, OnDestroy {
this.afterRequest();
this.workbasket = workbasketUpdated;
this.workbasketClone = { ...this.workbasket };
// new Key ALERT_TYPES.SUCCESS_ALERT_10
this.alertService.triggerAlert(
new AlertModel(
AlertType.SUCCESS,
@ -198,6 +203,7 @@ implements OnInit, OnChanges, OnDestroy {
},
error => {
this.afterRequest();
// new Key ERROR_TYPES.SAVE_ERR_4
this.generalModalService.triggerMessage(
new MessageModal(
'There was error while saving your workbasket',
@ -221,6 +227,7 @@ implements OnInit, OnChanges, OnDestroy {
this.addDateToWorkbasket();
this.workbasketService.createWorkbasket(this.workbasket).subscribe(
(workbasketUpdated: Workbasket) => {
// new Key ALERT_TYPES.SUCCESS_ALERT_11
this.alertService.triggerAlert(
new AlertModel(
AlertType.SUCCESS,
@ -250,6 +257,7 @@ implements OnInit, OnChanges, OnDestroy {
}
},
error => {
// new Key ERROR_TYPES.CREATE_ERR_2
this.generalModalService.triggerMessage(
new MessageModal('There was an error creating a workbasket', error)
);
@ -273,11 +281,13 @@ implements OnInit, OnChanges, OnDestroy {
this.requestInProgressService.setRequestInProgress(false);
this.workbasketService.triggerWorkBasketSaved();
if (response) {
// new Key ERROR_TYPES.MARK_ERR
this.generalModalService.triggerMessage(
new MessageModal('There was an error marking workbasket for deletion',
'It not possible to mark the workbasket for deletion, It has been deleted.')
);
} else {
// new Key ALERT_TYPES.SUCCESS_ALERT_12
this.alertService.triggerAlert(
new AlertModel(AlertType.SUCCESS, `The Workbasket ${this.workbasket.workbasketId} has been marked for deletion`)
);

View File

@ -11,6 +11,7 @@ import { DomainService } from 'app/services/domain/domain.service';
import { ImportExportService } from 'app/administration/services/import-export/import-export.service';
import { GeneralModalService } from '../../../services/general-modal/general-modal.service';
import { MessageModal } from '../../../models/message-modal';
import { ERROR_TYPES } from '../../../services/general-modal/errors';
@Component({
selector: 'taskana-workbasket-details',
@ -114,6 +115,7 @@ export class WorkbasketDetailsComponent implements OnInit, OnDestroy {
this.requestInProgress = false;
this.checkDomainAndRedirect();
}, err => {
// new Key ERROR_TYPES.FETCH_ERR_4
this.generalModalService.triggerMessage(
new MessageModal('An error occurred while fetching the workbasket', err)
);

View File

@ -9,6 +9,8 @@ import { WorkbasketSummary } from 'app/models/workbasket-summary';
import { WorkbasketService } from 'app/shared/services/workbasket/workbasket.service';
import { TaskanaType } from 'app/models/taskana-type';
import { expandDown } from 'app/shared/animations/expand.animation';
import { ErrorsService } from '../../../../shared/services/errors/errors.service';
import { ERROR_TYPES } from '../../../../services/general-modal/errors';
@Component({
selector: 'taskana-workbasket-list-toolbar',
@ -33,7 +35,8 @@ export class WorkbasketListToolbarComponent implements OnInit {
constructor(
private workbasketService: WorkbasketService,
private route: ActivatedRoute,
private router: Router
private router: Router,
private errors: ErrorsService
) {
}

View File

@ -5,6 +5,7 @@ import { DomainService } from 'app/services/domain/domain.service';
import { GeneralModalService } from 'app/services/general-modal/general-modal.service';
import { MessageModal } from 'app/models/message-modal';
import { map, catchError } from 'rxjs/operators';
import { ERROR_TYPES } from '../services/general-modal/errors';
@Injectable()
export class DomainGuard implements CanActivate {
@ -14,6 +15,7 @@ export class DomainGuard implements CanActivate {
return this.domainService.getDomains().pipe(
map(domain => true),
catchError(() => {
// new Key ERROR_TYPES.FETCH_ERR_5
this.generalModalService.triggerMessage(new MessageModal(
'There was an error, please contact with your administrator', 'There was an error getting Domains'
));

View File

@ -5,6 +5,7 @@ import { TaskanaEngineService } from 'app/services/taskana-engine/taskana-engine
import { map, catchError } from 'rxjs/operators';
import { GeneralModalService } from 'app/services/general-modal/general-modal.service';
import { MessageModal } from 'app/models/message-modal';
import {ERROR_TYPES} from '../services/general-modal/errors';
@Injectable({
providedIn: 'root'
@ -28,6 +29,7 @@ export class HistoryGuard implements CanActivate {
return this.navigateToWorkplace();
}),
catchError(() => {
// new Key ERROR_TYPES.FETCH_ERR_6
this.generalModalService.triggerMessage(new MessageModal(
'There was an error, please contact with your administrator', 'There was an error getting history provider'
));

View File

@ -6,9 +6,12 @@ export class ErrorModel {
body: string;
errObj?: ErrorHandler;
constructor(key: ERROR_TYPES, passedError?: ErrorHandler) {
constructor(key: ERROR_TYPES, passedError?: ErrorHandler, addition?: string) {
this.head = errors.get(key).name;
this.body = errors.get(key).text;
this.body = errors.get(key).text
if (addition) {
this.body.replace('{rep}', addition);
}
this.errObj = passedError;
}
}

View File

@ -1,23 +1,27 @@
import { ErrorModel } from '../../models/error-model';
import {Pair} from '../../models/pair';
import { Pair } from '../../models/pair';
export enum ERROR_TYPES {
DELETE_ERR_2,
FETCH_ERR_7,
NONE,
// Mock Errors
NO_AUTH,
EXP_AUTH,
NO_ACCESS,
// Real Errors
// ERRORS
FETCH_ERR,
FETCH_ERR_2,
FETCH_ERR_3,
FETCH_ERR_4,
FETCH_ERR_5,
FETCH_ERR_6,
FETCH_ERR_7,
DELETE_ERR,
DELETE_ERR_2,
CREATE_ERR,
CREATE_ERR_2,
REMOVE_ERR,
REMOVE_ERR_2,
SAVE_ERR,
SAVE_ERR_2,
SAVE_ERR_3,
SAVE_ERR_4,
SELECT_ERR,
FILE_ERR,
IMPORT_ERR_1,
@ -25,62 +29,36 @@ export enum ERROR_TYPES {
IMPORT_ERR_3,
IMPORT_ERR_4,
UPLOAD_ERR,
FETCH_ERR_3,
CREATE_ERR_2,
SAVE_ERR_4,
REMOVE_ERR_2,
SAVE_ERR_3,
SAVE_ERR_2,
FETCH_ERR_4,
TIMEOUT_ERR,
GENERAL_ERR,
HANDLE_ERR,
FETCH_ERR_6,
FETCH_ERR_5,
ACCESS_ERR,
MARK_ERR,
NONE,
}
export enum ALERT_TYPES {
INFO_ALERT_2,
DANGER_ALERT_2,
SUCCESS_ALERT_14,
SUCCESS_ALERT_13,
WARNING_ALERT_2,
SUCCESS_ALERT_12,
SUCCESS_ALERT_11,
SUCCESS_ALERT_10,
SUCCESS_ALERT_9,
// TODO: check all alert models
SUCCESS_ALERT,
// ALERTS
INFO_ALERT,
WARNING_ALERT,
INFO_ALERT_2,
DANGER_ALERT,
SUCCESS_ALERT_8,
SUCCESS_ALERT_7,
SUCCESS_ALERT_6,
SUCCESS_ALERT_5,
SUCCESS_ALERT_4,
SUCCESS_ALERT_3,
DANGER_ALERT_2,
SUCCESS_ALERT,
SUCCESS_ALERT_2,
SUCCESS_ALERT_3,
SUCCESS_ALERT_4,
SUCCESS_ALERT_5,
SUCCESS_ALERT_6,
SUCCESS_ALERT_7,
SUCCESS_ALERT_8,
SUCCESS_ALERT_9,
SUCCESS_ALERT_10,
SUCCESS_ALERT_11,
SUCCESS_ALERT_12,
SUCCESS_ALERT_13,
SUCCESS_ALERT_14,
WARNING_ALERT,
WARNING_ALERT_2,
}
// TODO: funktioniert unser Pair hierfür? -> Konstruktor checken!
export const errors = new Map<ERROR_TYPES|ALERT_TYPES, Pair> ([
[ERROR_TYPES.NO_AUTH, new Pair(
'Authentication required',
'You need to be logged in to perform this action.'
)],
[ERROR_TYPES.EXP_AUTH, new Pair(
'Authentication expired',
'Your session has expired, log in to perform this action.'
)],
[ERROR_TYPES.NO_ACCESS, new Pair(
'Access denied',
'You have no permission to perform this action.'
)],
export const errors = new Map<ERROR_TYPES, Pair> ([
// access-items-management.component.ts
[ERROR_TYPES.FETCH_ERR, new Pair(
'',
@ -123,22 +101,22 @@ export const errors = new Map<ERROR_TYPES|ALERT_TYPES, Pair> ([
)],
// import-export.component
[ERROR_TYPES.IMPORT_ERR_1, new Pair(
'',
'Import was not successful',
'Import was not successful, you have no access to apply this operation.'
)],
// import-export.component
[ERROR_TYPES.IMPORT_ERR_2, new Pair(
'',
'Import was not successful',
'Import was not successful, operation was not found.'
)],
// import-export.component
[ERROR_TYPES.IMPORT_ERR_3, new Pair(
'',
'Import was not successful',
'Import was not successful, operation has some conflicts.'
)],
// import-export.component
[ERROR_TYPES.IMPORT_ERR_4, new Pair(
'',
'Import was not successful',
'Import was not successful, maximum file size exceeded.'
)],
// import-export.component
@ -197,139 +175,139 @@ export const errors = new Map<ERROR_TYPES|ALERT_TYPES, Pair> ([
'There was an error, please contact with your administrator',
'There was an error getting history provider'
)],
// http-client-interceptor.component
[ERROR_TYPES.HANDLE_ERR, new Pair(
// http-client-interceptor.service
[ERROR_TYPES.ACCESS_ERR, new Pair(
'You have no access to this resource ',
''
)],
// http-client-interceptor.component
// http-client-interceptor.service
[ERROR_TYPES.GENERAL_ERR, new Pair(
'There was error, please contact with your administrator',
''
)],
// http-client-interceptor.component
// http-client-interceptor.service
[ERROR_TYPES.NONE, new Pair(
'Error wird ignoriert, keine Message geworfen',
''
'',
'Error wird ignoriert, keine Message geworfen'
)],
// spinner.component
[ERROR_TYPES.TIMEOUT_ERR, new Pair(
'There was an error with your request, please make sure you have internet connection',
'Request time execeed'
'Request time exceeded',
'There was an error with your request, please make sure you have internet connection'
)],
// taskdetails.component
[ERROR_TYPES.FETCH_ERR_7, new Pair(
'An error occurred while fetching the task',
''
'',
'An error occurred while fetching the task'
)],
// taskdetails.component
[ERROR_TYPES.DELETE_ERR_2, new Pair(
'An error occurred while deleting the task',
''
'',
'An error occurred while deleting the task'
)],
// ALERTS
// access-items-management.component
[ALERT_TYPES.SUCCESS_ALERT, new Pair(
'${this.accessIdSelected} was removed successfully',
''
[ERROR_TYPES.SUCCESS_ALERT, new Pair(
'',
'${this.accessIdSelected} was removed successfully'
)],
// classification-details.component
[ALERT_TYPES.SUCCESS_ALERT_2, new Pair(
'Classification ${classification.key} was saved successfully',
''
[ERROR_TYPES.SUCCESS_ALERT_2, new Pair(
'',
'Classification ${classification.key} was saved successfully'
)],
// classification-details.component
[ALERT_TYPES.SUCCESS_ALERT_3, new Pair(
[ERROR_TYPES.SUCCESS_ALERT_3, new Pair(
'Classification ${this.classification.key} was saved successfully',
''
)],
// classification-details.component
// access-items.component
// distribution-targets.component
// workbasket.distribution-targets.component
// workbasket-information.component
[ALERT_TYPES.INFO_ALERT, new Pair(
[ERROR_TYPES.INFO_ALERT, new Pair(
'Reset edited fields',
''
)],
// classification-details.component
[ALERT_TYPES.SUCCESS_ALERT_4, new Pair(
[ERROR_TYPES.SUCCESS_ALERT_4, new Pair(
'Classification ${key} was removed successfully',
''
)],
// classification-list.component
[ALERT_TYPES.SUCCESS_ALERT_5, new Pair(
[ERROR_TYPES.SUCCESS_ALERT_5, new Pair(
'Classification ${key} was saved successfully',
''
)],
// import-export.component
[ALERT_TYPES.SUCCESS_ALERT_6, new Pair(
[ERROR_TYPES.SUCCESS_ALERT_6, new Pair(
'Import was successful',
''
)],
// access-items.component
[ALERT_TYPES.SUCCESS_ALERT_7, new Pair(
[ERROR_TYPES.SUCCESS_ALERT_7, new Pair(
'Workbasket ${component.workbasket.key} Access items were saved successfully',
''
)],
// distribution-targets.component
[ALERT_TYPES.SUCCESS_ALERT_8, new Pair(
// workbasket.distribution-targets.component
[ERROR_TYPES.SUCCESS_ALERT_8, new Pair(
'Workbasket ${this.workbasket.name} : Distribution targets were saved successfully',
''
)],
// workbasket-information.component
[ALERT_TYPES.SUCCESS_ALERT_9, new Pair(
[ERROR_TYPES.SUCCESS_ALERT_9, new Pair(
'DistributionTarget for workbasketID: ${this.workbasket.workbasketId} was removed successfully',
''
)],
// workbasket-information.component
[ALERT_TYPES.SUCCESS_ALERT_10, new Pair(
[ERROR_TYPES.SUCCESS_ALERT_10, new Pair(
'Workbasket ${workbasketUpdated.key} was saved successfully',
''
)],
// workbasket-information.component
[ALERT_TYPES.SUCCESS_ALERT_11, new Pair(
[ERROR_TYPES.SUCCESS_ALERT_11, new Pair(
'Workbasket ${workbasketUpdated.key} was created successfully',
''
)],
// workbasket-information.component
[ALERT_TYPES.SUCCESS_ALERT_12, new Pair(
[ERROR_TYPES.SUCCESS_ALERT_12, new Pair(
'The Workbasket ${this.workbasket.workbasketId} has been marked for deletion',
''
)],
// forms-validator.service
[ALERT_TYPES.WARNING_ALERT, new Pair(
[ERROR_TYPES.WARNING_ALERT, new Pair(
'There are some empty fields which are required.',
''
)],
// forms-validator.service x2
[ALERT_TYPES.WARNING_ALERT_2, new Pair(
[ERROR_TYPES.WARNING_ALERT_2, new Pair(
'The ${responseOwner.field} introduced is not valid.',
''
)],
// taskdetails.component TODO: is dis error
[ALERT_TYPES.DANGER_ALERT, new Pair(
// taskdetails.component
[ERROR_TYPES.DANGER_ALERT, new Pair(
'There was an error while updating.',
''
)],
// taskdetails.component
[ALERT_TYPES.SUCCESS_ALERT_13, new Pair(
[ERROR_TYPES.SUCCESS_ALERT_13, new Pair(
'Task ${this.currentId} was created successfully.',
''
)],
// taskdetails.component
[ALERT_TYPES.SUCCESS_ALERT_14, new Pair(
[ERROR_TYPES.SUCCESS_ALERT_14, new Pair(
'Updating was successful.',
''
)],
// taskdetails.component
[ALERT_TYPES.DANGER_ALERT_2, new Pair(
[ERROR_TYPES.DANGER_ALERT_2, new Pair(
'There was an error while creating a new task.',
''
)],
// task-master.component
[ALERT_TYPES.INFO_ALERT_2, new Pair(
[ERROR_TYPES.INFO_ALERT_2, new Pair(
'The selected Workbasket is empty!',
''
)],

View File

@ -2,13 +2,14 @@ import { Injectable } from '@angular/core';
import { Subject, Observable } from 'rxjs';
import { MessageModal } from 'app/models/message-modal';
import { errors as ERRORS } from './errors';
import { ERROR_TYPES, errors as ERRORS } from './errors';
@Injectable()
export class GeneralModalService {
private messageTriggered = new Subject<MessageModal>();
triggerMessage(message: MessageModal) {
console.log(ERRORS.get(ERROR_TYPES.DELETE_ERR));
this.messageTriggered.next(message);
}

View File

@ -7,7 +7,6 @@ import { ERROR_TYPES } from '../../../services/general-modal/errors';
providedIn: 'root'
})
export class ErrorsService {
// Wie initialisieren? Default ERROR_TYPE für leeres initialisieren einfügen?
errorSubject$: Subject<ErrorModel>;
constructor() {}
@ -15,8 +14,8 @@ export class ErrorsService {
this.errorSubject$.next(errorToShow);
}
public updateError(key: ERROR_TYPES, passedError: ErrorHandler): void {
// wahrscheinlich wollen wir nicht jedes mal ein neues ErrorModel erzeugen... oder wollen wir?
this.updateErrorSubject(new ErrorModel(key, passedError));
public updateError(key: ERROR_TYPES, passedError?: ErrorHandler): void {
const errorModel = new ErrorModel(key, passedError);
this.updateErrorSubject(errorModel);
}
}

View File

@ -3,6 +3,7 @@ import { Injectable } from '@angular/core';
import { AlertService } from 'app/services/alert/alert.service';
import { AlertModel, AlertType } from 'app/models/alert';
import { AccessIdsService } from 'app/shared/services/access-ids/access-ids.service';
import { ALERT_TYPES } from '../../../services/general-modal/errors';
@Injectable()
export class FormsValidatorService {
@ -51,8 +52,10 @@ export class FormsValidatorService {
const responseOwner = new ResponseOwner(values[1]);
if (!(values[0] && responseOwner.valid)) {
if (!responseOwner.valid) {
// new Key ALERT_TYPES.WARNING_ALERT_2
this.alertService.triggerAlert(new AlertModel(AlertType.WARNING, `The ${responseOwner.field} introduced is not valid.`));
} else {
// new Key ALERT_TYPES.WARNING_ALERT
this.alertService.triggerAlert(new AlertModel(AlertType.WARNING, 'There are some empty fields which are required.'));
}
}
@ -80,6 +83,7 @@ export class FormsValidatorService {
result = result && responseOwner.valid;
});
if (!result) {
// new key ALERT_TYPES.WARNING_ALERT_2
this.alertService.triggerAlert(new AlertModel(AlertType.WARNING, `The ${responseOwner.field} introduced is not valid.`));
}
return result;

View File

@ -8,6 +8,7 @@ import { GeneralModalService } from 'app/services/general-modal/general-modal.se
import { RequestInProgressService } from 'app/services/requestInProgress/request-in-progress.service';
import { environment } from 'environments/environment';
import { tap } from 'rxjs/operators';
import { ERROR_TYPES } from '../../../services/general-modal/errors';
@Injectable()
export class HttpClientInterceptor implements HttpInterceptor {
@ -26,12 +27,14 @@ export class HttpClientInterceptor implements HttpInterceptor {
return next.handle(req).pipe(tap(() => { }, error => {
this.requestInProgressService.setRequestInProgress(false);
if (error instanceof HttpErrorResponse && (error.status === 401 || error.status === 403)) {
this.generalModalService.triggerMessage(
// new Key ERROR_TYPES.ACCESS_ERR
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')) {
// ignore this error message
// ignore this error message Key ERROR_TYPES.NONE
} else {
// new Key ERROR_TYPES.GENERAL_ERR
this.generalModalService.triggerMessage(
new MessageModal('There was error, please contact with your administrator ', error)
);

View File

@ -4,9 +4,12 @@ import { Component, Input, Output, EventEmitter, OnDestroy, ViewChild } from '@a
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;
@Component({
selector: 'taskana-spinner',
templateUrl: './spinner.component.html',
@ -64,6 +67,7 @@ export class SpinnerComponent implements OnDestroy {
this.isDelayedRunning = value;
this.cancelTimeout();
this.requestTimeout = setTimeout(() => {
// new Key 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')

View File

@ -16,6 +16,7 @@ import { ObjectReference } from 'app/workplace/models/object-reference';
import { Workbasket } from 'app/models/workbasket';
import { WorkplaceService } from 'app/workplace/services/workplace.service';
import { MasterAndDetailService } from 'app/services/masterAndDetail/master-and-detail.service';
import { ERROR_TYPES } from '../../services/general-modal/errors';
@Component({
selector: 'taskana-task-details',
@ -85,6 +86,7 @@ export class TaskdetailsComponent implements OnInit, OnDestroy {
this.cloneTask();
this.taskService.selectTask(task);
}, err => {
// new Key ERROR_TYPES.FETCH_ERR_7
this.generalModalService.triggerMessage(
new MessageModal('An error occurred while fetching the task', err)
);
@ -115,6 +117,7 @@ export class TaskdetailsComponent implements OnInit, OnDestroy {
this.task = null;
this.router.navigate(['taskana/workplace/tasks']);
}, err => {
// new Key ERROR_TYPES.DELETE_ERR_2
this.generalModalService.triggerMessage(
new MessageModal('An error occurred while deleting the task ', err)
);
@ -142,9 +145,11 @@ export class TaskdetailsComponent implements OnInit, OnDestroy {
this.task = task;
this.cloneTask();
this.taskService.publishUpdatedTask(task);
// new Key ALERT_TYPES.SUCCESS_ALERT_14
this.alertService.triggerAlert(new AlertModel(AlertType.SUCCESS, 'Updating was successful.'));
}, err => {
this.requestInProgressService.setRequestInProgress(false);
// new Key ALERT_TYPES.DANGER_ALERT
this.alertService.triggerAlert(new AlertModel(AlertType.DANGER, 'There was an error while updating.'));
});
}
@ -154,6 +159,7 @@ export class TaskdetailsComponent implements OnInit, OnDestroy {
this.addDateToTask();
this.taskService.createTask(this.task).subscribe(task => {
this.requestInProgressService.setRequestInProgress(false);
// new Key ALERT_TYPES.SUCCESS_ALERT_13
this.alertService.triggerAlert(new AlertModel(AlertType.SUCCESS, `Task ${this.currentId} was created successfully.`));
this.task = task;
this.taskService.selectTask(this.task);
@ -161,6 +167,7 @@ export class TaskdetailsComponent implements OnInit, OnDestroy {
this.router.navigate([`../${task.taskId}`], { relativeTo: this.route });
}, err => {
this.requestInProgressService.setRequestInProgress(false);
// new Key ALERT_TYPES.DANGER_ALERT_2
this.alertService.triggerAlert(new AlertModel(AlertType.DANGER, 'There was an error while creating a new task.'));
});
}