Skip to content

Commit

Permalink
EMBCESSMOD-5590-Lint-Fix: Fix linting errors
Browse files Browse the repository at this point in the history
  • Loading branch information
sam-warren committed Oct 9, 2024
1 parent dfc45d7 commit d084e4d
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 22 deletions.
4 changes: 2 additions & 2 deletions suppliers/src/UI/embc-supplier/src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ import { AuthenticationService } from './core/services/authentication.service';
import { ConfigService } from './core/services/config.service';
import { SupplierService } from './core/services/supplier.service';
import { SupplierHttpService } from './core/services/supplierHttp.service';
import { ToastsContainer } from './core/components/toasts/toasts-container.component';
import { ToastsContainerComponent } from './core/components/toasts/toasts-container.component';

@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.scss'],
standalone: true,
imports: [BannerComponent, FooterComponent, HeaderComponent, RouterOutlet, ToastsContainer]
imports: [BannerComponent, FooterComponent, HeaderComponent, RouterOutlet, ToastsContainerComponent]
})
export class AppComponent implements OnInit, OnDestroy {
title = 'embc-supplier';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Toast, ToastService } from 'src/app/core/services/toast.service';
import { WarningService } from 'src/app/core/services/warning.service';
import * as constant from 'src/app/core/services/globalConstants';
import { DragDropDirective } from '../../directives/DragDrop.directive';
import { faCheck, faFileImage, faFilePdf, faInfoCircle, faTrash, faWarning } from "@fortawesome/free-solid-svg-icons";
import { faCheck, faFileImage, faFilePdf, faInfoCircle, faTrash, faWarning } from '@fortawesome/free-solid-svg-icons';
import { FontAwesomeModule } from '@fortawesome/angular-fontawesome';

@Component({
Expand Down Expand Up @@ -46,19 +46,43 @@ export class FileUploadComponent implements OnInit {
onInvoiceDropped(event: any) {
for (const e of event) {
if (!(e.size > 0)) {
this.toastService.show(constant.zeroFileMessage, { classname: 'bg-danger text-light', delay: constant.toastDelay, icon: faWarning });
this.toastService.show(constant.zeroFileMessage, {
classname: 'bg-danger text-light',
delay: constant.toastDelay,
icon: faWarning
});
} else if (!constant.allowedFileTypes.includes(e.type)) {
this.toastService.show(constant.fileTypeMessage, { classname: 'bg-danger text-light', delay: constant.toastDelay, icon: faWarning });
this.toastService.show(constant.fileTypeMessage, {
classname: 'bg-danger text-light',
delay: constant.toastDelay,
icon: faWarning
});
} else if (!constant.fileNameFormat.test(e.name)) {
this.toastService.show(constant.invalidFileNameMessage, { classname: 'bg-danger text-light', delay: constant.toastDelay, icon: faWarning });
this.toastService.show(constant.invalidFileNameMessage, {
classname: 'bg-danger text-light',
delay: constant.toastDelay,
icon: faWarning
});
} else if (e.size > constant.maxFileSize) {
this.toastService.show(constant.fileTooLargeMessage, { classname: 'bg-danger text-light', delay: constant.toastDelay, icon: faWarning });
this.toastService.show(constant.fileTooLargeMessage, {
classname: 'bg-danger text-light',
delay: constant.toastDelay,
icon: faWarning
});
} else if (this.invoiceAttachments !== undefined && this.invoiceAttachments.length >= this.noOfAttachments) {
this.toastService.show(constant.tooManyFilesMessage, { classname: 'bg-danger text-light', delay: constant.toastDelay, icon: faWarning });
this.toastService.show(constant.tooManyFilesMessage, {
classname: 'bg-danger text-light',
delay: constant.toastDelay,
icon: faWarning
});
} else {
this.invoiceAttachments.push(e.name);
this.attachedFile.emit(e);
this.toastService.show(e.name + " attached successfully", { classname: 'bg-success text-light', delay: constant.toastDelay, icon: faCheck });
this.toastService.show(e.name + ' attached successfully', {
classname: 'bg-success text-light',
delay: constant.toastDelay,
icon: faCheck
});
}
}
}
Expand All @@ -71,7 +95,11 @@ export class FileUploadComponent implements OnInit {
deleteAttachedInvoice(fileIndex: number) {
this.invoiceAttachments.splice(fileIndex, 1);
this.deleteFile.emit(fileIndex);
this.toastService.show("Attachment deleted", { classname: 'bg-info text-light', delay: constant.toastDelay, icon: faInfoCircle });
this.toastService.show('Attachment deleted', {
classname: 'bg-info text-light',
delay: constant.toastDelay,
icon: faInfoCircle
});
}

getFileImage(file: string) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
import { Component, inject } from '@angular/core';

import { ToastService } from "../../services/toast.service";
import { ToastService } from '../../services/toast.service';
import { NgTemplateOutlet } from '@angular/common';
import { NgbToastModule } from '@ng-bootstrap/ng-bootstrap';
import { faXmark } from "@fortawesome/free-solid-svg-icons";
import { faXmark } from '@fortawesome/free-solid-svg-icons';
import { FontAwesomeModule } from '@fortawesome/angular-fontawesome';

@Component({
selector: 'app-toasts',
standalone: true,
imports: [NgbToastModule, NgTemplateOutlet, FontAwesomeModule],
templateUrl: "./toasts-container.component.html",
styleUrls: ["./toasts-container.component.scss"]
selector: 'app-toasts',
standalone: true,
imports: [NgbToastModule, NgTemplateOutlet, FontAwesomeModule],
templateUrl: './toasts-container.component.html',
styleUrls: ['./toasts-container.component.scss']
})

export class ToastsContainer {
closeIcon = faXmark;
toastService = inject(ToastService);
export class ToastsContainerComponent {
closeIcon = faXmark;
toastService = inject(ToastService);
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,4 @@ export const fileNameFormat = /^[\w,\s-_()]+\.[A-Za-z]{3,4}$/;
export const invalidFileNameMessage =
'File name must not contain the following characters: ~ " . # % & * : < > ? / { | }. Leading and trailing spaces are not allowed.';
export const fileTooLargeMessage = 'File size must be less than ' + maxFileSize / 1000000 + 'MB';
export const tooManyFilesMessage = 'You have reached the maximum number of files allowed';
export const tooManyFilesMessage = 'You have reached the maximum number of files allowed';

0 comments on commit d084e4d

Please sign in to comment.