diff --git a/client/src/app/editor/editor.component.ts b/client/src/app/editor/editor.component.ts index 6fae587..704e6c8 100644 --- a/client/src/app/editor/editor.component.ts +++ b/client/src/app/editor/editor.component.ts @@ -47,9 +47,7 @@ import { UploadStaterComponent } from './components/upload-stater/upload-stater. import { DynamicExtendedCellValidation } from './models/dynamicExtendedCellValidation' import { EditRecordInputFocusedEvent } from './models/edit-record/edit-record-events' import { EditorRestrictions } from './models/editor-restrictions.model' -import { - parseTableColumns -} from './utils/grid.utils' +import { parseTableColumns } from './utils/grid.utils' import { errorRenderer, noSpinnerRenderer, @@ -59,7 +57,10 @@ import { LicenceService } from '../services/licence.service' import * as numbro from 'numbro' import * as languages from 'numbro/dist/languages.min' import { FileUploadEncoding } from '../models/FileUploadEncoding' -import { ParseResult, SpreadsheetService } from '../services/spreadsheet.service' +import { + ParseResult, + SpreadsheetService +} from '../services/spreadsheet.service' @Component({ selector: 'app-editor', @@ -471,50 +472,58 @@ export class EditorComponent implements OnInit, AfterViewInit { this.filename = file.name - this.spreadsheetService.parseExcelFile({ - file: file, - uploader: this.uploader, - dcValidator: this.dcValidator!, - headerPks: this.headerPks, - headerArray: this.headerArray, - headerShow: this.headerShow, - timeHeaders: this.timeHeaders, - dateHeaders: this.dateHeaders, - dateTimeHeaders: this.dateTimeHeaders, - xlRules: this.xlRules, - encoding: this.encoding - }, (uploadState: string) => { - this.appendUploadState(uploadState) - }, (tableFoundInfo: string) => { - this.eventService.showInfoModal('Table Found', tableFoundInfo) - }).then((parseResult: ParseResult | undefined) => { - if (parseResult) { - this.excelFileReady = true - - this.uploader = parseResult.uploader - - if (parseResult.data && parseResult.headerShow) { - // If data is returned it means we parsed excel file - this.data = parseResult.data - this.headerShow = parseResult.headerShow - this.getPendingExcelPreview() - } else { - // otherwise it's csv file, and we send them directly - this.uploadParsedFiles() + this.spreadsheetService + .parseExcelFile( + { + file: file, + uploader: this.uploader, + dcValidator: this.dcValidator!, + headerPks: this.headerPks, + headerArray: this.headerArray, + headerShow: this.headerShow, + timeHeaders: this.timeHeaders, + dateHeaders: this.dateHeaders, + dateTimeHeaders: this.dateTimeHeaders, + xlRules: this.xlRules, + encoding: this.encoding + }, + (uploadState: string) => { + this.appendUploadState(uploadState) + }, + (tableFoundInfo: string) => { + this.eventService.showInfoModal('Table Found', tableFoundInfo) } - } - }).catch((error: string) => { - this.eventService.showInfoModal('Error', error) + ) + .then((parseResult: ParseResult | undefined) => { + if (parseResult) { + this.excelFileReady = true - this.showUploadModal = false - this.uploadPreview = false + this.uploader = parseResult.uploader - setTimeout(() => { - this.filename = '' + if (parseResult.data && parseResult.headerShow) { + // If data is returned it means we parsed excel file + this.data = parseResult.data + this.headerShow = parseResult.headerShow + this.getPendingExcelPreview() + } else { + // otherwise it's csv file, and we send them directly + this.uploadParsedFiles() + } + } + }) + .catch((error: string) => { + this.eventService.showInfoModal('Error', error) + + this.showUploadModal = false + this.uploadPreview = false + + setTimeout(() => { + this.filename = '' + }) + }) + .finally(() => { + this.excelFileParsing = false }) - }).finally(() => { - this.excelFileParsing = false - }) } /** @@ -728,7 +737,6 @@ export class EditorComponent implements OnInit, AfterViewInit { this.sasStoreService.removeClause() } - async sendClause() { this.submitLoading = true let nullVariableArr = [] diff --git a/client/src/app/home/home-routing.module.ts b/client/src/app/home/home-routing.module.ts index c1e8f68..232eabd 100644 --- a/client/src/app/home/home-routing.module.ts +++ b/client/src/app/home/home-routing.module.ts @@ -13,7 +13,7 @@ const routes: Routes = [ { path: '', pathMatch: 'full', redirectTo: 'tables' }, { path: 'tables', component: HomeComponent }, { path: 'excel-maps', loadChildren: () => XLMapModule }, - { path: 'multi-load', loadChildren: () => MultiDatasetModule} + { path: 'multi-load', loadChildren: () => MultiDatasetModule } ] } ] diff --git a/client/src/app/models/FileUploadEncoding.ts b/client/src/app/models/FileUploadEncoding.ts index 94f8b69..f7ef4d9 100644 --- a/client/src/app/models/FileUploadEncoding.ts +++ b/client/src/app/models/FileUploadEncoding.ts @@ -1 +1 @@ -export type FileUploadEncoding = 'UTF-8' | 'WLATIN1' \ No newline at end of file +export type FileUploadEncoding = 'UTF-8' | 'WLATIN1' diff --git a/client/src/app/multi-dataset/multi-dataset-routing.module.ts b/client/src/app/multi-dataset/multi-dataset-routing.module.ts index 7ec0403..f7b5520 100644 --- a/client/src/app/multi-dataset/multi-dataset-routing.module.ts +++ b/client/src/app/multi-dataset/multi-dataset-routing.module.ts @@ -8,9 +8,7 @@ const routes: Routes = [ { path: '', component: MultiDatasetRouteComponent, - children: [ - { path: '', component: MultiDatasetComponent } - ] + children: [{ path: '', component: MultiDatasetComponent }] } ] diff --git a/client/src/app/multi-dataset/multi-dataset.component.html b/client/src/app/multi-dataset/multi-dataset.component.html index 599e5d9..69dcaf7 100644 --- a/client/src/app/multi-dataset/multi-dataset.component.html +++ b/client/src/app/multi-dataset/multi-dataset.component.html @@ -4,15 +4,21 @@
Selected file: {{ selectedFile?.name }}
-Paste or type the list of datasets to upload:
++ Selected file: {{ selectedFile?.name }} +
++ Paste or type the list of datasets to upload: +
- +Matched datasets:
-{{ matchedDataset }}
++ {{ matchedDataset }} +
Found in range: "{{ activeParsedDataset?.parseResult?.rangeSheetRes?.sheetName }}"!{{ activeParsedDataset?.parseResult?.rangeSheetRes?.rangeAddress }}
-Matched with dataset: LIB1.MPE_X_DATA
++ Found in range: + "{{ + activeParsedDataset?.parseResult?.rangeSheetRes?.sheetName + }}"!{{ + activeParsedDataset?.parseResult?.rangeSheetRes?.rangeAddress + }} +
++ Matched with dataset: LIB1.MPE_X_DATA +