TSK-1163: fixes eslint issues

This commit is contained in:
Mustapha Zorgati 2020-03-18 05:49:53 +01:00
parent 9b79968f9b
commit 8f4e261679
21 changed files with 305 additions and 305 deletions

View File

@ -16,8 +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 { ErrorsService } from "../../services/errors/errors.service"; import { ErrorsService } from '../../services/errors/errors.service';
import { ERROR_TYPES } from "../../models/errors"; import { ERROR_TYPES } from '../../models/errors';
@Component({ @Component({
selector: 'taskana-access-items-management', selector: 'taskana-access-items-management',
@ -55,14 +55,14 @@ export class AccessItemsManagementComponent implements OnInit, OnDestroy {
custom12Field = this.customFieldsService.getCustomField('Custom 12', 'workbaskets.access-items.custom12'); custom12Field = this.customFieldsService.getCustomField('Custom 12', 'workbaskets.access-items.custom12');
constructor(private formBuilder: FormBuilder, constructor(private formBuilder: FormBuilder,
private customFieldsService: CustomFieldsService, private customFieldsService: CustomFieldsService,
private accessIdsService: AccessIdsService, private accessIdsService: AccessIdsService,
private formsValidatorService: FormsValidatorService, private formsValidatorService: FormsValidatorService,
private requestInProgressService: RequestInProgressService, private requestInProgressService: RequestInProgressService,
private removeConfirmationService: RemoveConfirmationService, private removeConfirmationService: RemoveConfirmationService,
private alertService: AlertService, private alertService: AlertService,
private generalModalService: GeneralModalService, private generalModalService: GeneralModalService,
private errorsService: ErrorsService) { private errorsService: ErrorsService) {
} }
get accessItemsGroups(): FormArray { get accessItemsGroups(): FormArray {
@ -110,16 +110,16 @@ export class AccessItemsManagementComponent implements OnInit, OnDestroy {
AccessItemsManagementComponent.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.errorsService.updateError(ERROR_TYPES.FETCH_ERR, error); this.errorsService.updateError(ERROR_TYPES.FETCH_ERR, error);
}); });
} }
} }
@ -136,28 +136,28 @@ export class AccessItemsManagementComponent implements OnInit, OnDestroy {
this.requestInProgressService.setRequestInProgress(true); this.requestInProgressService.setRequestInProgress(true);
AccessItemsManagementComponent.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);
}, },
error => { error => {
this.requestInProgressService.setRequestInProgress(false); this.requestInProgressService.setRequestInProgress(false);
this.errorsService.updateError(ERROR_TYPES.FETCH_ERR_2, error); this.errorsService.updateError(ERROR_TYPES.FETCH_ERR_2, 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?`
); );
} }
@ -169,16 +169,16 @@ export class AccessItemsManagementComponent implements OnInit, OnDestroy {
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();
}, },
@ -186,6 +186,6 @@ export class AccessItemsManagementComponent implements OnInit, OnDestroy {
this.requestInProgressService.setRequestInProgress(false); this.requestInProgressService.setRequestInProgress(false);
this.errorsService.updateError(ERROR_TYPES.DELETE_ERR, error); this.errorsService.updateError(ERROR_TYPES.DELETE_ERR, error);
} }
); );
} }
} }

View File

@ -26,7 +26,7 @@ import { FormsValidatorService } from 'app/shared/services/forms/forms-validator
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 '../../../models/errors'; import { ERROR_TYPES } from '../../../models/errors';
import { ErrorsService } from "../../../services/errors/errors.service"; import { ErrorsService } from '../../../services/errors/errors.service';
@Component({ @Component({
selector: 'taskana-classification-details', selector: 'taskana-classification-details',

View File

@ -10,10 +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 { HttpErrorResponse } from '@angular/common/http';
import { ERROR_TYPES } from '../../../models/errors'; import { ERROR_TYPES } from '../../../models/errors';
import { ErrorsService } from "../../../services/errors/errors.service"; import { ErrorsService } from '../../../services/errors/errors.service';
import { ErrorModel } from "../../../models/error-model"; import { ErrorModel } from '../../../models/error-model';
import { HttpErrorResponse } from "@angular/common/http";
@Component({ @Component({
selector: 'taskana-import-export-component', selector: 'taskana-import-export-component',
@ -23,29 +23,29 @@ import { HttpErrorResponse } from "@angular/common/http";
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 errorsService: ErrorsService, private errorsService: ErrorsService,
private importExportService: ImportExportService private importExportService: ImportExportService
) { ) {
} }
ngOnInit() { ngOnInit() {
this.domainService.getDomains().subscribe( this.domainService.getDomains().subscribe(
data => { data => {
this.domains = data; this.domains = data;
} }
); );
} }

View File

@ -8,10 +8,8 @@ import { WorkbasketAccessItemsResource } from 'app/models/workbasket-access-item
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 { import { SavingInformation,
SavingInformation, SavingWorkbasketService } from 'app/administration/services/saving-workbaskets/saving-workbaskets.service';
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';
@ -21,7 +19,7 @@ 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 '../../../../models/errors'; import { ERROR_TYPES } from '../../../../models/errors';
import { ErrorsService } from "../../../../services/errors/errors.service"; import { ErrorsService } from '../../../../services/errors/errors.service';
@Component({ @Component({
selector: 'taskana-workbasket-access-items', selector: 'taskana-workbasket-access-items',
@ -71,15 +69,15 @@ export class AccessItemsComponent implements OnChanges, OnDestroy {
private initialized = false; private initialized = false;
constructor( constructor(
private workbasketService: WorkbasketService, private workbasketService: WorkbasketService,
private alertService: AlertService, private alertService: AlertService,
private generalModalService: GeneralModalService, private generalModalService: GeneralModalService,
private savingWorkbaskets: SavingWorkbasketService, private savingWorkbaskets: SavingWorkbasketService,
private requestInProgressService: RequestInProgressService, private requestInProgressService: RequestInProgressService,
private customFieldsService: CustomFieldsService, private customFieldsService: CustomFieldsService,
private formBuilder: FormBuilder, private formBuilder: FormBuilder,
private formsValidatorService: FormsValidatorService, private formsValidatorService: FormsValidatorService,
private errorsService: ErrorsService private errorsService: ErrorsService
) { ) {
} }
@ -173,40 +171,40 @@ export class AccessItemsComponent implements OnChanges, OnDestroy {
} }
this.requestInProgress = true; this.requestInProgress = true;
this.accessItemsubscription = this.workbasketService.getWorkBasketAccessItems(this.workbasket._links.accessItems.href) this.accessItemsubscription = this.workbasketService.getWorkBasketAccessItems(this.workbasket._links.accessItems.href)
.subscribe((accessItemsResource: WorkbasketAccessItemsResource) => { .subscribe((accessItemsResource: WorkbasketAccessItemsResource) => {
this.accessItemsResource = accessItemsResource; this.accessItemsResource = accessItemsResource;
this.setAccessItemsGroups(accessItemsResource.accessItems); this.setAccessItemsGroups(accessItemsResource.accessItems);
this.accessItemsClone = this.cloneAccessItems(accessItemsResource.accessItems); this.accessItemsClone = this.cloneAccessItems(accessItemsResource.accessItems);
this.accessItemsResetClone = this.cloneAccessItems(accessItemsResource.accessItems); this.accessItemsResetClone = this.cloneAccessItems(accessItemsResource.accessItems);
this.requestInProgress = false; this.requestInProgress = false;
}); });
this.savingAccessItemsSubscription = this.savingWorkbaskets.triggeredAccessItemsSaving() this.savingAccessItemsSubscription = this.savingWorkbaskets.triggeredAccessItemsSaving()
.subscribe((savingInformation: SavingInformation) => { .subscribe((savingInformation: SavingInformation) => {
if (this.action === ACTION.COPY) { if (this.action === ACTION.COPY) {
this.accessItemsResource._links.self.href = savingInformation.url; this.accessItemsResource._links.self.href = savingInformation.url;
this.setWorkbasketIdForCopy(savingInformation.workbasketId); this.setWorkbasketIdForCopy(savingInformation.workbasketId);
this.onSave(); 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 => {
this.errorsService.updateError(ERROR_TYPES.SAVE_ERR_2, error); this.errorsService.updateError(ERROR_TYPES.SAVE_ERR_2, error);
this.requestInProgressService.setRequestInProgress(false); this.requestInProgressService.setRequestInProgress(false);
}); });
} }
private setBadge() { private setBadge() {
@ -217,7 +215,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 })
); );
} }

View File

@ -19,7 +19,7 @@ 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 '../../../../models/errors'; import { ERROR_TYPES } from '../../../../models/errors';
import { ErrorsService } from "../../../../services/errors/errors.service"; import { ErrorsService } from '../../../../services/errors/errors.service';
export enum Side { export enum Side {
LEFT, LEFT,

View File

@ -19,7 +19,7 @@ import { CustomFieldsService } from 'app/services/custom-fields/custom-fields.se
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 '../../../../models/errors'; import { ERROR_TYPES } from '../../../../models/errors';
import { ErrorsService } from "../../../../services/errors/errors.service"; import { ErrorsService } from '../../../../services/errors/errors.service';
@Component({ @Component({
selector: 'taskana-workbasket-information', selector: 'taskana-workbasket-information',
@ -168,9 +168,8 @@ implements OnInit, OnChanges, OnDestroy {
}, },
error => { error => {
this.errorsService.updateError(ERROR_TYPES.REMOVE_ERR_2, this.errorsService.updateError(ERROR_TYPES.REMOVE_ERR_2,
error, error,
new Map<String,String>([["workbasketId", this.workbasket.workbasketId]]) new Map<String, String>([['workbasketId', this.workbasket.workbasketId]]));
);
this.requestInProgressService.setRequestInProgress(false); this.requestInProgressService.setRequestInProgress(false);
} }
); );
@ -271,8 +270,8 @@ implements OnInit, OnChanges, OnDestroy {
this.workbasketService.triggerWorkBasketSaved(); this.workbasketService.triggerWorkBasketSaved();
if (response.status === 202) { if (response.status === 202) {
this.errorsService.updateError(ERROR_TYPES.MARK_ERR, this.errorsService.updateError(ERROR_TYPES.MARK_ERR,
undefined, undefined,
new Map<String, String>([['workbasketId', this.workbasket.workbasketId]])); new Map<String, String>([['workbasketId', this.workbasket.workbasketId]]));
} else { } else {
// new Key ALERT_TYPES.SUCCESS_ALERT_12 // new Key ALERT_TYPES.SUCCESS_ALERT_12
this.alertService.triggerAlert( this.alertService.triggerAlert(

View File

@ -12,7 +12,7 @@ import { ImportExportService } from 'app/administration/services/import-export/i
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 '../../../models/errors'; import { ERROR_TYPES } from '../../../models/errors';
import { ErrorsService } from "../../../services/errors/errors.service"; import { ErrorsService } from '../../../services/errors/errors.service';
@Component({ @Component({
selector: 'taskana-workbasket-details', selector: 'taskana-workbasket-details',

View File

@ -1,17 +1,17 @@
import {Component, HostListener, OnDestroy, OnInit} from '@angular/core'; import { Component, HostListener, OnDestroy, OnInit } from '@angular/core';
import {NavigationStart, Router} 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 { ErrorModel } from './models/error-model';
import {ErrorsService} from "./services/errors/errors.service"; import { ErrorsService } from './services/errors/errors.service';
@Component({ @Component({
selector: 'taskana-root', selector: 'taskana-root',
@ -37,14 +37,14 @@ export class AppComponent implements OnInit, OnDestroy {
error: ErrorModel; error: ErrorModel;
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,
private errorService: ErrorsService, private errorService: ErrorsService,
public uploadService: UploadService public uploadService: UploadService
) { ) {
} }
@ -68,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;

View File

@ -3,8 +3,8 @@ 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 { catchError, map } from 'rxjs/operators'; import { catchError, map } from 'rxjs/operators';
import { ErrorsService } from "../services/errors/errors.service"; import { ErrorsService } from '../services/errors/errors.service';
import { ERROR_TYPES } from "../models/errors"; import { ERROR_TYPES } from '../models/errors';
@Injectable() @Injectable()
export class DomainGuard implements CanActivate { export class DomainGuard implements CanActivate {
@ -13,11 +13,11 @@ export class DomainGuard implements CanActivate {
canActivate() { canActivate() {
return this.domainService.getDomains().pipe( return this.domainService.getDomains().pipe(
map(domain => true), map(domain => true),
catchError(() => { catchError(() => {
this.errorsService.updateError(ERROR_TYPES.FETCH_ERR_5); this.errorsService.updateError(ERROR_TYPES.FETCH_ERR_5);
return of(false); return of(false);
}) })
); );
} }
} }

View File

@ -4,34 +4,34 @@ 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 { catchError, map } from 'rxjs/operators'; import { catchError, map } from 'rxjs/operators';
import { ERROR_TYPES } from '../models/errors'; import { ERROR_TYPES } from '../models/errors';
import { ErrorsService } from "../services/errors/errors.service"; import { ErrorsService } from '../services/errors/errors.service';
@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,
private errorsService: ErrorsService 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(() => {
this.errorsService.updateError(ERROR_TYPES.FETCH_ERR_6) this.errorsService.updateError(ERROR_TYPES.FETCH_ERR_6);
return of(this.navigateToWorkplace()); return of(this.navigateToWorkplace());
}) })
); );
} }

View File

@ -11,7 +11,7 @@ import { TaskHistoryEventResourceData } from 'app/models/task-history-event-reso
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"; import { ErrorsService } from '../../services/errors/errors.service';
@Component({ @Component({
selector: 'taskana-task-query', selector: 'taskana-task-query',
@ -29,11 +29,11 @@ export class TaskQueryComponent implements OnInit {
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 private errorsService: ErrorsService
) { ) {
} }
@ -148,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'
) )
); );
} }
@ -195,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;

View File

@ -1,5 +1,5 @@
import { HttpErrorResponse } from '@angular/common/http';
import { ERROR_TYPES, errors } from './errors'; import { ERROR_TYPES, errors } from './errors';
import { HttpErrorResponse } from "@angular/common/http";
export class ErrorModel { export class ErrorModel {
public readonly errObj: HttpErrorResponse; public readonly errObj: HttpErrorResponse;
@ -11,8 +11,8 @@ export class ErrorModel {
this.message = errors.get(key).text; this.message = errors.get(key).text;
this.errObj = passedError; this.errObj = passedError;
if (addition) { if (addition) {
addition.forEach((value: string, key: string) => { addition.forEach((value: string, replacementKey: string) => {
this.message.replace(`{${key}}`, value); this.message.replace(`{${replacementKey}}`, value);
}); });
} }
} }

View File

@ -32,7 +32,6 @@ export enum ERROR_TYPES {
GENERAL_ERR, GENERAL_ERR,
ACCESS_ERR, ACCESS_ERR,
MARK_ERR, MARK_ERR,
NONE,
// ALERTS // ALERTS
INFO_ALERT, INFO_ALERT,
@ -60,251 +59,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', '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 {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(
'Workbasket was marked for deletion.', 'Workbasket was marked for deletion.',
'The Workbasket {workbasketId} still contains completed tasks and could not be deleted.' 'The Workbasket {workbasketId} still contains completed tasks and could not be deleted.'
+ 'Instead is was marked for deletion and will be deleted automatically ' + 'Instead is was marked for deletion and will be deleted automatically '
+ 'as soon as the completed tasks are deleted from the database.' + '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',
'' ''
)], )],
// spinner.component // spinner.component
[ERROR_TYPES.TIMEOUT_ERR, new Pair( [ERROR_TYPES.TIMEOUT_ERR, new Pair(
'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' '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 {workbasketId} has been deleted.', '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!',
'' ''
)], )],
]); ]);

View File

@ -1,8 +1,8 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { Observable, Subject } from 'rxjs'; import { Observable, Subject } from 'rxjs';
import { HttpErrorResponse } from '@angular/common/http';
import { ErrorModel } from '../../models/error-model'; import { ErrorModel } from '../../models/error-model';
import { ERROR_TYPES } from '../../models/errors'; import { ERROR_TYPES } from '../../models/errors';
import { HttpErrorResponse } from "@angular/common/http";
@Injectable({ @Injectable({
providedIn: 'root' providedIn: 'root'

View File

@ -13,7 +13,7 @@ import { expandTop } from '../animations/expand.animation';
export class AlertComponent implements OnInit { export class AlertComponent implements OnInit {
alert: AlertModel; alert: AlertModel;
private timeoutId: any; //NodeJS.Timer cannot be imported.. private timeoutId: any; // NodeJS.Timer cannot be imported..
constructor(private alertService: AlertService) { } constructor(private alertService: AlertService) { }
ngOnInit() { ngOnInit() {

View File

@ -1,6 +1,6 @@
import {async, ComponentFixture, TestBed} from '@angular/core/testing'; import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import {ErrorModalComponent} from './error-modal.component'; import { ErrorModalComponent } from './error-modal.component';
describe('GeneralMessageModalComponent', () => { describe('GeneralMessageModalComponent', () => {
let component: ErrorModalComponent; let component: ErrorModalComponent;
@ -10,7 +10,7 @@ describe('GeneralMessageModalComponent', () => {
TestBed.configureTestingModule({ TestBed.configureTestingModule({
declarations: [ErrorModalComponent] declarations: [ErrorModalComponent]
}) })
.compileComponents(); .compileComponents();
})); }));
beforeEach(() => { beforeEach(() => {

View File

@ -1,7 +1,7 @@
import {Component, EventEmitter, OnInit, Output, ViewChild} from '@angular/core'; import { Component, EventEmitter, OnInit, Output, ViewChild } from '@angular/core';
import {ErrorModel} from "../../models/error-model"; import { Subscription } from 'rxjs';
import {Subscription} from "rxjs"; import { ErrorModel } from '../../models/error-model';
import {ErrorsService} from "../../services/errors/errors.service"; import { ErrorsService } from '../../services/errors/errors.service';
@Component({ @Component({
selector: 'error-modal', selector: 'error-modal',

View File

@ -4,22 +4,22 @@ import { Observable } from 'rxjs';
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 { ErrorsService } from "../../../services/errors/errors.service"; import { ErrorsService } from '../../../services/errors/errors.service';
import { ERROR_TYPES } from "../../../models/errors"; import { ERROR_TYPES } from '../../../models/errors';
@Injectable() @Injectable()
export class HttpClientInterceptor implements HttpInterceptor { export class HttpClientInterceptor implements HttpInterceptor {
constructor( constructor(
private requestInProgressService: RequestInProgressService, private requestInProgressService: RequestInProgressService,
private errorsService: ErrorsService 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(() => { return next.handle(req).pipe(tap(() => {
}, error => { }, error => {

View File

@ -15,7 +15,6 @@ 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';
@ -25,6 +24,7 @@ import { RemoveConfirmationComponent } from 'app/shared/remove-confirmation/remo
import { FilterComponent } from 'app/shared/filter/filter.component'; import { FilterComponent } from 'app/shared/filter/filter.component';
import { IconTypeComponent } from 'app/administration/components/type-icon/icon-type.component'; import { IconTypeComponent } from 'app/administration/components/type-icon/icon-type.component';
import { FieldErrorDisplayComponent } from 'app/shared/field-error-display/field-error-display.component'; import { FieldErrorDisplayComponent } from 'app/shared/field-error-display/field-error-display.component';
import { ErrorModalComponent } from './error-message-modal/error-modal.component';
import { SortComponent } from './sort/sort.component'; import { SortComponent } from './sort/sort.component';
import { PaginationComponent } from './pagination/pagination.component'; import { PaginationComponent } from './pagination/pagination.component';
import { NumberPickerComponent } from './number-picker/number-picker.component'; import { NumberPickerComponent } from './number-picker/number-picker.component';

View File

@ -1,6 +1,6 @@
import { Component, EventEmitter, Input, OnDestroy, Output, ViewChild } from '@angular/core'; import { Component, EventEmitter, Input, OnDestroy, Output, ViewChild } from '@angular/core';
import { ERROR_TYPES } from '../../models/errors'; import { ERROR_TYPES } from '../../models/errors';
import { ErrorsService } from "../../services/errors/errors.service"; import { ErrorsService } from '../../services/errors/errors.service';
declare let $: any; declare let $: any;
@ -14,16 +14,20 @@ export class SpinnerComponent implements OnDestroy {
showSpinner: boolean; showSpinner: boolean;
@Input() @Input()
delay = 250; delay = 250;
@Input() @Input()
isModal = false; isModal = false;
@Input() @Input()
positionClass: string; positionClass: string;
@Output() @Output()
spinnerIsRunning = new EventEmitter<boolean>(); 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}) @ViewChild('spinnerModal', { static: true })
private modal; private modal;
constructor(private errorsService: ErrorsService) { constructor(private errorsService: ErrorsService) {

View File

@ -16,7 +16,7 @@ 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 '../../models/errors'; import { ERROR_TYPES } from '../../models/errors';
import { ErrorsService } from "../../services/errors/errors.service"; import { ErrorsService } from '../../services/errors/errors.service';
@Component({ @Component({
selector: 'taskana-task-details', selector: 'taskana-task-details',
@ -38,15 +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 errorsService: ErrorsService, private errorsService: ErrorsService,
private masterAndDetailService: MasterAndDetailService) { private masterAndDetailService: MasterAndDetailService) {
} }
ngOnInit() { ngOnInit() {
@ -68,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'));
} }
@ -97,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 {
@ -106,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 {
@ -126,7 +126,7 @@ 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 { ngOnDestroy(): void {
@ -174,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
@ -189,9 +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 };
} }
} }