TSK-931: fixed linting issues

This commit is contained in:
Finn Mißfeldt 2020-02-28 13:22:25 +01:00
parent bbfdd53e2e
commit 897aaf1c47
15 changed files with 36 additions and 40 deletions

View File

@ -172,7 +172,7 @@ export class AccessItemsManagementComponent implements OnInit, OnDestroy {
); );
this.searchForAccessItemsWorkbaskets(); this.searchForAccessItemsWorkbaskets();
}, },
// new Key: ERROR_TYPES.DELETE_ERR // new Key: ERROR_TYPES.DELETE_ERR
error => { error => {
this.requestInProgressService.setRequestInProgress(false); this.requestInProgressService.setRequestInProgress(false);
this.generalModalService.triggerMessage( this.generalModalService.triggerMessage(

View File

@ -281,7 +281,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.generalModalService.triggerMessage(
// new Key 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') new MessageModal('There is no classification selected', 'Please check if you are creating a classification')
); );
return; return;
@ -297,7 +297,7 @@ export class ClassificationDetailsComponent implements OnInit, OnDestroy {
this.afterRequest(); this.afterRequest();
this.classificationsService.selectClassification(); this.classificationsService.selectClassification();
this.router.navigate(['taskana/administration/classifications']); this.router.navigate(['taskana/administration/classifications']);
// 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 // new Key: ERROR_TYPES.REMOVE_ERR

View File

@ -128,7 +128,7 @@ export class ImportExportComponent implements OnInit {
} }
private onFailedResponse(event) { private onFailedResponse(event) {
// new Key ERROR_TYPES.UPLOAD_ERR // new Key ERROR_TYPES.UPLOAD_ERR
this.errorHandler('Upload failed', 'The upload didn\'t proceed sucessfully. \n' this.errorHandler('Upload failed', 'The upload didn\'t proceed sucessfully. \n'
+ 'Probably the uploaded file exceeded the maximum file size of 10 MB'); + 'Probably the uploaded file exceeded the maximum file size of 10 MB');
} }

View File

@ -142,7 +142,7 @@ export class AccessItemsComponent implements OnChanges, OnDestroy {
this.setAccessItemsGroups(this.accessItemsResetClone); this.setAccessItemsGroups(this.accessItemsResetClone);
this.accessItemsClone = this.cloneAccessItems(this.accessItemsResetClone); this.accessItemsClone = this.cloneAccessItems(this.accessItemsResetClone);
// new Key ALERT_TYPES.INFO_ALERT // new Key ALERT_TYPES.INFO_ALERT
this.alertService.triggerAlert(new AlertModel(AlertType.INFO, 'Reset edited fields')); this.alertService.triggerAlert(new AlertModel(AlertType.INFO, 'Reset edited fields'));
} }
remove(index: number) { remove(index: number) {
@ -186,13 +186,13 @@ export class AccessItemsComponent implements OnChanges, OnDestroy {
.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 // new Key ERROR_TYPES.SAVE_ERR_2
this.generalModalService.triggerMessage(new MessageModal('There was error while saving your workbasket\'s access items', error)); this.generalModalService.triggerMessage(new MessageModal('There was error while saving your workbasket\'s access items', error));
this.requestInProgressService.setRequestInProgress(false); this.requestInProgressService.setRequestInProgress(false);
}); });

View File

@ -139,7 +139,7 @@ export class DistributionTargetsComponent implements OnChanges, OnDestroy {
} }
onClear() { onClear() {
// new key ALERT_TYPES.INFO_ALERT // new key ALERT_TYPES.INFO_ALERT
this.alertService.triggerAlert(new AlertModel(AlertType.INFO, 'Reset edited fields')); this.alertService.triggerAlert(new AlertModel(AlertType.INFO, 'Reset edited fields'));
this.distributionTargetsLeft = Object.assign([], this.distributionTargetsClone); this.distributionTargetsLeft = Object.assign([], this.distributionTargetsClone);
this.distributionTargetsRight = Object.assign([], this.distributionTargetsSelectedClone); this.distributionTargetsRight = Object.assign([], this.distributionTargetsSelectedClone);

View File

@ -18,7 +18,7 @@ import { RequestInProgressService } from 'app/services/requestInProgress/request
import { CustomFieldsService } from 'app/services/custom-fields/custom-fields.service'; import { CustomFieldsService } from 'app/services/custom-fields/custom-fields.service';
import { 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 {ALERT_TYPES, ERROR_TYPES} from '../../../../services/general-modal/errors'; import { ERROR_TYPES } from '../../../../services/general-modal/errors';
@Component({ @Component({
selector: 'taskana-workbasket-information', selector: 'taskana-workbasket-information',

View File

@ -115,7 +115,7 @@ export class WorkbasketDetailsComponent implements OnInit, OnDestroy {
this.requestInProgress = false; this.requestInProgress = false;
this.checkDomainAndRedirect(); this.checkDomainAndRedirect();
}, err => { }, err => {
// new Key ERROR_TYPES.FETCH_ERR_4 // new Key ERROR_TYPES.FETCH_ERR_4
this.generalModalService.triggerMessage( this.generalModalService.triggerMessage(
new MessageModal('An error occurred while fetching the workbasket', err) new MessageModal('An error occurred while fetching the workbasket', err)
); );

View File

@ -15,7 +15,7 @@ export class DomainGuard implements 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 // new Key ERROR_TYPES.FETCH_ERR_5
this.generalModalService.triggerMessage(new MessageModal( this.generalModalService.triggerMessage(new MessageModal(
'There was an error, please contact with your administrator', 'There was an error getting Domains' 'There was an error, please contact with your administrator', 'There was an error getting Domains'
)); ));

View File

@ -5,7 +5,7 @@ import { TaskanaEngineService } from 'app/services/taskana-engine/taskana-engine
import { map, catchError } from 'rxjs/operators'; import { map, catchError } from 'rxjs/operators';
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 {ERROR_TYPES} from '../services/general-modal/errors'; import { ERROR_TYPES } from '../services/general-modal/errors';
@Injectable({ @Injectable({
providedIn: 'root' providedIn: 'root'

View File

@ -1,4 +1,3 @@
import { ErrorModel } from '../../models/error-model';
import { Pair } from '../../models/pair'; import { Pair } from '../../models/pair';
@ -58,7 +57,7 @@ export enum ERROR_TYPES {
WARNING_ALERT_2, WARNING_ALERT_2,
} }
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(
'', '',
@ -122,8 +121,8 @@ export const errors = new Map<ERROR_TYPES, Pair> ([
// 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(
@ -148,7 +147,7 @@ export const errors = new Map<ERROR_TYPES, Pair> ([
// 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 ${this.workbasket.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(
@ -211,16 +210,16 @@ export const errors = new Map<ERROR_TYPES, Pair> ([
// 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
@ -233,12 +232,12 @@ export const errors = new Map<ERROR_TYPES, Pair> ([
)], )],
// 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
@ -248,32 +247,32 @@ export const errors = new Map<ERROR_TYPES, Pair> ([
)], )],
// 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 {this.workbasket.workbasketId} has been marked for deletion',
'' ''
)], )],
// forms-validator.service // forms-validator.service
@ -283,7 +282,7 @@ export const errors = new Map<ERROR_TYPES, Pair> ([
)], )],
// 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
@ -293,7 +292,7 @@ export const errors = new Map<ERROR_TYPES, Pair> ([
)], )],
// 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

View File

@ -9,7 +9,6 @@ export class GeneralModalService {
private messageTriggered = new Subject<MessageModal>(); private messageTriggered = new Subject<MessageModal>();
triggerMessage(message: MessageModal) { triggerMessage(message: MessageModal) {
console.log(ERRORS.get(ERROR_TYPES.DELETE_ERR));
this.messageTriggered.next(message); this.messageTriggered.next(message);
} }

View File

@ -8,7 +8,6 @@ import { ERROR_TYPES } from '../../../services/general-modal/errors';
}) })
export class ErrorsService { export class ErrorsService {
errorSubject$: Subject<ErrorModel>; errorSubject$: Subject<ErrorModel>;
constructor() {}
private updateErrorSubject(errorToShow: ErrorModel) { private updateErrorSubject(errorToShow: ErrorModel) {
this.errorSubject$.next(errorToShow); this.errorSubject$.next(errorToShow);

View File

@ -83,7 +83,7 @@ export class FormsValidatorService {
result = result && responseOwner.valid; result = result && responseOwner.valid;
}); });
if (!result) { if (!result) {
// new key ALERT_TYPES.WARNING_ALERT_2 // new key ALERT_TYPES.WARNING_ALERT_2
this.alertService.triggerAlert(new AlertModel(AlertType.WARNING, `The ${responseOwner.field} introduced is not valid.`)); this.alertService.triggerAlert(new AlertModel(AlertType.WARNING, `The ${responseOwner.field} introduced is not valid.`));
} }
return result; return result;

View File

@ -27,14 +27,14 @@ export class HttpClientInterceptor implements HttpInterceptor {
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 // new Key ERROR_TYPES.ACCESS_ERR
this.generalModalService.triggerMessage( this.generalModalService.triggerMessage(
new MessageModal('You have no access to this resource ', error) 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 message Key ERROR_TYPES.NONE
} else { } else {
// new Key ERROR_TYPES.GENERAL_ERR // new Key ERROR_TYPES.GENERAL_ERR
this.generalModalService.triggerMessage( this.generalModalService.triggerMessage(
new MessageModal('There was error, please contact with your administrator ', error) new MessageModal('There was error, please contact with your administrator ', error)
); );

View File

@ -4,12 +4,11 @@ import { Component, Input, Output, EventEmitter, OnDestroy, ViewChild } from '@a
import { MessageModal } from 'app/models/message-modal'; 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 {ERROR_TYPES} from '../../services/general-modal/errors'; import { ERROR_TYPES } from '../../services/general-modal/errors';
declare let $: any; declare let $: any;
@Component({ @Component({
selector: 'taskana-spinner', selector: 'taskana-spinner',
templateUrl: './spinner.component.html', templateUrl: './spinner.component.html',
@ -67,7 +66,7 @@ export class SpinnerComponent implements OnDestroy {
this.isDelayedRunning = value; this.isDelayedRunning = value;
this.cancelTimeout(); this.cancelTimeout();
this.requestTimeout = setTimeout(() => { this.requestTimeout = setTimeout(() => {
// new Key ERROR_TYPES.TIMEOUT_ERR // new Key ERROR_TYPES.TIMEOUT_ERR
this.generalModalService.triggerMessage( this.generalModalService.triggerMessage(
new MessageModal('There was an error with your request, please make sure you have internet connection', new MessageModal('There was an error with your request, please make sure you have internet connection',
'Request time execeed') 'Request time execeed')