From c7d45ded1cf117a83a04fc2adcf1a8fe7ea491b6 Mon Sep 17 00:00:00 2001 From: Jason McCollum Date: Thu, 1 Feb 2024 13:26:35 -0800 Subject: [PATCH] Add CSV help dialog --- .../csv-help-dialog.component.html | 6 +++++ .../csv-help-dialog.component.scss | 0 .../csv-help-dialog.component.spec.ts | 22 +++++++++++++++++++ .../csv-help-dialog.component.ts | 9 ++++++++ .../upload-dialog.component.html | 4 +--- .../upload-dialog/upload-dialog.component.ts | 7 ++++++ .../frontend/src/app/core/core.module.ts | 2 ++ 7 files changed, 47 insertions(+), 3 deletions(-) create mode 100644 application/frontend/src/app/core/containers/csv-help-dialog/csv-help-dialog.component.html create mode 100644 application/frontend/src/app/core/containers/csv-help-dialog/csv-help-dialog.component.scss create mode 100644 application/frontend/src/app/core/containers/csv-help-dialog/csv-help-dialog.component.spec.ts create mode 100644 application/frontend/src/app/core/containers/csv-help-dialog/csv-help-dialog.component.ts diff --git a/application/frontend/src/app/core/containers/csv-help-dialog/csv-help-dialog.component.html b/application/frontend/src/app/core/containers/csv-help-dialog/csv-help-dialog.component.html new file mode 100644 index 00000000..d302c820 --- /dev/null +++ b/application/frontend/src/app/core/containers/csv-help-dialog/csv-help-dialog.component.html @@ -0,0 +1,6 @@ +

What data can I upload via CSV?

+

+ If you have data for vehicles, shipments, or vehicle operators in individual .csv files, you can + use this option to upload your data. You can also use this option get sample files to see how your + data should be structured. +

diff --git a/application/frontend/src/app/core/containers/csv-help-dialog/csv-help-dialog.component.scss b/application/frontend/src/app/core/containers/csv-help-dialog/csv-help-dialog.component.scss new file mode 100644 index 00000000..e69de29b diff --git a/application/frontend/src/app/core/containers/csv-help-dialog/csv-help-dialog.component.spec.ts b/application/frontend/src/app/core/containers/csv-help-dialog/csv-help-dialog.component.spec.ts new file mode 100644 index 00000000..2a6ff525 --- /dev/null +++ b/application/frontend/src/app/core/containers/csv-help-dialog/csv-help-dialog.component.spec.ts @@ -0,0 +1,22 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { CsvHelpDialogComponent } from './csv-help-dialog.component'; + +describe('CsvHelpDialogComponent', () => { + let component: CsvHelpDialogComponent; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + declarations: [CsvHelpDialogComponent], + }).compileComponents(); + + fixture = TestBed.createComponent(CsvHelpDialogComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/application/frontend/src/app/core/containers/csv-help-dialog/csv-help-dialog.component.ts b/application/frontend/src/app/core/containers/csv-help-dialog/csv-help-dialog.component.ts new file mode 100644 index 00000000..94bd318a --- /dev/null +++ b/application/frontend/src/app/core/containers/csv-help-dialog/csv-help-dialog.component.ts @@ -0,0 +1,9 @@ +import { ChangeDetectionStrategy, Component } from '@angular/core'; + +@Component({ + selector: 'app-csv-help-dialog', + templateUrl: './csv-help-dialog.component.html', + styleUrls: ['./csv-help-dialog.component.scss'], + changeDetection: ChangeDetectionStrategy.OnPush, +}) +export class CsvHelpDialogComponent {} diff --git a/application/frontend/src/app/core/containers/upload-dialog/upload-dialog.component.html b/application/frontend/src/app/core/containers/upload-dialog/upload-dialog.component.html index f4e56e81..3dfaedd2 100644 --- a/application/frontend/src/app/core/containers/upload-dialog/upload-dialog.component.html +++ b/application/frontend/src/app/core/containers/upload-dialog/upload-dialog.component.html @@ -116,9 +116,7 @@

Load shipment, vehicle, and operator data individually - +

diff --git a/application/frontend/src/app/core/containers/upload-dialog/upload-dialog.component.ts b/application/frontend/src/app/core/containers/upload-dialog/upload-dialog.component.ts index aedc8317..77717be9 100644 --- a/application/frontend/src/app/core/containers/upload-dialog/upload-dialog.component.ts +++ b/application/frontend/src/app/core/containers/upload-dialog/upload-dialog.component.ts @@ -28,6 +28,7 @@ import { DispatcherService, FileService, PlacesService, UploadService } from '.. import { toDispatcherLatLng } from 'src/app/util'; import { ScenarioSolutionHelpDialogComponent } from 'src/app/core/containers/scenario-solution-help-dialog/scenario-solution-help-dialog.component'; import { UploadActions } from '../../actions'; +import { CsvHelpDialogComponent } from '../csv-help-dialog/csv-help-dialog.component'; @Component({ selector: 'app-upload-dialog', @@ -84,6 +85,12 @@ export class UploadDialogComponent { }); } + openCsvHelp(): void { + this.dialog.open(CsvHelpDialogComponent, { + maxWidth: '600px', + }); + } + loadFromCsv(): void { this.dialogRef.close(); this.store.dispatch(UploadActions.openCsvDialog()); diff --git a/application/frontend/src/app/core/core.module.ts b/application/frontend/src/app/core/core.module.ts index c04f4b09..28694d24 100644 --- a/application/frontend/src/app/core/core.module.ts +++ b/application/frontend/src/app/core/core.module.ts @@ -89,6 +89,7 @@ import { ConfirmBulkEditDialogComponent } from './components/confirm-bulk-edit-d import { VehicleOperatorsControlBarComponent } from './containers/vehicle-operators-control-bar/vehicle-operators-control-bar.component'; import { BaseEditVehicleOperatorDialogComponent } from './components/base-edit-vehicle-operator-dialog/base-edit-vehicle-operator-dialog.component'; import { PreSolveEditVehicleOperatorDialogComponent } from './containers/pre-solve-edit-vehicle-operator-dialog/pre-solve-edit-vehicle-operator-dialog.component'; +import { CsvHelpDialogComponent } from './containers/csv-help-dialog/csv-help-dialog.component'; export const COMPONENTS = [ BaseDocumentationDialogComponent, @@ -180,6 +181,7 @@ export const CONTAINERS = [ VehicleOperatorsControlBarComponent, PreSolveEditVehicleOperatorDialogComponent, BaseEditVehicleOperatorDialogComponent, + CsvHelpDialogComponent, ], exports: [COMPONENTS, CONTAINERS, CsvUploadDialogComponent], })