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,GCAaS,GAAb,MAAM,QAEJtZ,YAAoBuZ,qBAGpBC,UAAUC,EAAuB5O,GAC/B,OAAI4O,EAAIC,MAAQC,mBACPvZ,KAAKmZ,WAAWR,QAGrBU,EAAIC,MAAQC,sBACPvF,QAAG,IAAI+E,KAAa,CAACC,OAAQ,OAG/BvO,EAAK+O,OAAOH,iDAdVH,GAA0BtV,sCAA1BsV,EAA0BpR,QAA1BoR,EAA0B,qBADd,SACZA,GAAb,mEC4EO,IAAMO,GAAb,MAAM,sDAAOA,6DARA,CACTC,KACA,CACEC,QAASC,KACTC,SAAUX,GACVY,OAAO,IACPC,SApCK,CACPC,KACAC,KACAC,KACAC,KACAC,KACAC,KACAC,KACAC,KACAC,MACAC,KACAC,MACAC,KACAC,KACAC,MACAC,KACAvC,GACAwC,KACAC,KACAC,MACAC,MACAC,KACAC,KACAC,MACAC,KACAC,KACAC,MACAC,KACAT,SAUSvB,GAAb","names":["ApUploadFormatsComponent","constructor","store","translationStore","mapViewStore","this","hideMapView","ngAfterContentInit","loadImportDataSetColumns","getDataFromStore","gridBuilder","ngOnDestroy","_subscriptions","forEach","d","unsubscribe","loadImportDataSetTypes","importDataSetLoading$","Listen","s","loading","push","columns","subscribe","importDataSetColumns","_dataSetColumns","types","importDataSetTypes","items","map","ds","attributes","_getCountAttributes","geometryType","FindTranslationForSelectedLanguage","first","GeometryType","Id","SourceItem","Attributes","Status","StatusClass","StatusDesc","ApDynGridStatusColumnConfig","field","showHeaderTitle","class","description","ApDynGridPropertyColumnConfig","title","filterable","width","headerFilterable","ApDynGridEditColumnConfig","disabled","pager","ApDynGridPagerWizardConfig","ApDynGridPagerWizardSection","item","count","findDataSetColumns","filter","dsc","DataSetType","length","i0","selectors","ApDynComponentComponent","file","uploadStore","uid","EventEmitter","rewind","guid","isEndOfFile","onFinish","emit","offset","onChunkFinish","readBlockAsText","getFileSize","defaultChunkSize","fileReader","FileReader","blob","slice","onloadend","event","target","error","result","byteLength","sendUpload","onError","readAsArrayBuffer","size","DataTypes","UploadActions","payload","UPLOAD_LOG_VERIFY","UploadStore","Store","backend","super","data","loaded","registerObservable","UploadSend","Mutate","Data","fileGuid","chunk","tmp","arr","Uint8Array","key","hasOwnProperty","DispatchBackend","Name","Type","NetTypes","Value","verifyUpload","filename","md5","farmId","userId","typeId","UploadVerify","verifyLogUpload","UploadLogVerify","factory","LabResultAttachmentStore","LabResultAttachmentLoadSuccess","SetLoadFinishState","LabResultAttachmentLoadFail","_","SetLoadFailState","AfterDatabaseUpdate","ReloadSource","Loading$","LabResultAttachments$","loadLabResultAttachments","SetLoadState","LabResultAttachmentLoad","deleteLabResultAttachment","attachmentId","LabResultAttachmentDelete","uploadLabResultAttachment","attachment","Promise","resolve","reject","LabResultAttachmentUpload","ApCustomTypes","watchStream","action","LabResultAttachmentUploadSuccess","todo","LabResultAttachmentUploadFail","downloadLabResultAttachment","LabResultAttachmentDownload","LabResultAttachmentDownloadSuccess","LabResultAttachmentDownloadFail","ApUploadComponent","importStore","routeStore","labResultAttachmentStore","fileService","uploadFileService","permissionPipe","BehaviorSubject","ngOnInit","fieldSets$","next","_generateFormConfig","_selectedDataType","types$","combineLatest","transform","ApPermissions","dynForm","FormValues$","pipe","debounceTime","_1","fieldSets","distinctUntilChanged","pFormValues","_2","cFormValues","_3","_dataTypeFormKey","tap","formValues","isEditImportAvailable","x","e","releaseNavigation","selectedDataTypeId","ApDynformsConfigFieldset","config","ApDynformsConfigComboBox","label","valueField","textField","value","options","_dataTypeOptions","valuePrimitive","translate","validators","ApDynformsValidator","validator","Validators","errorKey","ApDynformsConfigPlaceholder","legend","useMaxWidth","_getFilesUploadConfig","dataType","_getApDynformsConfigUpload","undefined","isDisabled","allowedFileExtensions","ApDynformsConfigUpload","validateWithForm","onlyUniqueFiles","restrictions","uploadEventHandler","_uploadEventHandler","bind","blockNavigation","_uploadFile","then","files","fileDataInfo","state","FileState","_logFilesUpload","_labFilesUpload","ex","console","warn","fileProcess","setUploadFailed","_releaseNavigationRouteIfReady","fileStreamer","FileStreamer","rawFile","oCF","chunkSize","Math","floor","valueOf","setUploadProgress","__awaiter","name","setUploadFinished","rawFileDataUrl","readFileToDataUrl","LastModified","lastModified","ContentSize","ContentMimeType","type","ContentBase64","getBase64FromDataUrl","shouldProgressStopProgress","controlUploadProgress","progress","Interval","Increment","catch","some","ApDynformsComponent","ApLabResultFilesOverviewComponent","notifyStore","languageStore","asObservable","items$","labResultAttachment","_generateGridItem","SelectedLanguage$","isEditPermissions","selectedLanguage","_generateColumns","_generatePager","subscription","labResultAttachments","gridItemStatus","ApColumnState","Note","LastModifiedDate","Date","ImportedDate","CreatedAt","format","DateFormat","TimeFormat","text","callback","ApUtilService","_downloadAttachment","_deleteAttachment","isEditAvailableForUser","ApDynGridPagerConfig","listMassEditing","apply","_applyClicked","hasPermission","dataItem","base64StringToFileData","saveAs","addMessage","Counter","DisplayTimeout","ErrorKey","Level","ApLogfileFilesOverviewComponent","mapStore","campaignYearStore","dateService","translationService","sensorService","of","loading$","_getItems","_onApplyClicked","_onClick","_onShowOnMapClick","updatedDataSet","dataSets","ApLodash","_buildGridDataRecord","selectedYear","cy","loadImportDataSets","Convert","filterType","FilterType","_downloadCsv","id","ApGridPagerType","values","rows","dynComponent","getSelectedItems","object","downloadCsv","row","MongoFileId","upload","Uploaded","toFarmDateFromUtcGetJsDate","created","Created","gridStatus","getGridStatus","UploadDate","getFullYear","CreatedDate","ErrCode","Imported","moment","diff","loadByDataset","Editor","ShowDeleteButton","ImportOverviewTabs","ApImportOverviewComponent","searchIn","selectedTab","a","t","labsFilesOverviewComponent","_a","dynGrid","_b","filterGrid","l","n","logfileFilesOverviewComponent","_c","_d","selectTab","index","ctx","routes","path","component","canActivate","ApPermissionGuard","login","layout","PageMode","ApImportRoutes","RouterModule","ApUploadFakeStreamService","initHandler","handler","HttpEventType","total","finish","HttpResponse","status","Error","ApUploadInterceptorService","fakeStream","intercept","req","url","APP_CONFIGURATION","handle","ApImportModule","UploadService","provide","HTTP_INTERCEPTORS","useClass","multi","imports","ReactiveFormsModule","HttpClientModule","ApCoreModule","ApIconModule","LayoutModule","ButtonModule","CommonModule","SplitButtonModule","InputsModule","ComboBoxModule","DateInputsModule","DropDownsModule","FormsModule","GridModule","ApTranslationModule","UploadModule","SharedModule","BodyModule","HeaderModule","ApTooltipModule","ApResponsiveTextModule","PagerModule","ApSectionHeaderModule","ApDynComponentModule","ApUtilsModule","ApPermissionModule"],"sources":["./src/app/import/components/ap-upload-formats.component.ts","./src/app/import/classes/FileStreamer.ts","./src/app/import/types/ap-upload.types.ts","./projects/invoker-transport/src/lib/actions/import/upload.action.ts","./src/app/stores/import/upload.store.ts","./src/app/stores/dpl3/lab-result-attachment.store.ts","./src/app/import/components/ap-upload.component.ts","./src/app/import/components/overview/ap-lab-result-files-overview.component.ts","./src/app/import/components/overview/ap-logfile-files-overview.component.ts","./src/app/import/types/ap-import-overview.types.ts","./src/app/import/components/overview/ap-import-overview.component.html","./src/app/import/components/overview/ap-import-overview.component.ts","./src/app/import/ap-import.routes.ts","./src/app/import/services/ap-upload-fake-stream.service.ts","./src/app/import/services/ap-upload-interceptor.service.ts","./src/app/import/ap-import.module.ts"],"sourcesContent":["import {AfterContentInit, Component, OnDestroy, ViewChild} from '@angular/core';\nimport {Observable, Subscription} from 'rxjs';\nimport {ApDynComponentComponent} from '../../ap-dyncomponent/ap-dyncomponent.component';\nimport {\n ApDynGridColumnConfigBase\n} from '../../ap-dyngrids/config/ap-dyn-grid-column-config-base';\nimport {\n ApDynGridPagerConfigBase\n} from '../../ap-dyngrids/config/ap-dyn-grid-pager-config-base';\nimport {\n ApDynGridPropertyColumnConfig\n} from '../../ap-dyngrids/config/ap-dyn-grid-property-column-config';\nimport {\n ApDynGridEditColumnConfig\n} from '../../ap-dyngrids/config/ap-dyn-grid-edit-column-config';\nimport {\n ApDynGridPagerWizardConfig,\n ApDynGridPagerWizardSection\n} from '../../ap-dyngrids/config/ap-dyn-grid-pager-wizard-config';\nimport {\n ApDynGridStatusColumnConfig\n} from '../../ap-dyngrids/config/ap-dyn-grid-status-column-config';\nimport {first} from 'lodash';\nimport {ImportStore} from '../../stores/import/import.store';\nimport {MapViewStore} from '../../stores/layout/mapview.store';\nimport {TranslationStore} from '../../stores/translation/translation.store';\nimport IDataSetColumn = Data.Import.IDataSetColumn;\nimport IDataSetType = Data.Import.IDataSetType;\n\n/**\n * Component for the upload formats\n */\n@Component({\n selector: 'ap-upload-formats',\n template: `\n `\n})\nexport class ApUploadFormatsComponent implements AfterContentInit, OnDestroy {\n @ViewChild(ApDynComponentComponent, {static: true}) dynComponent: ApDynComponentComponent;\n columns: ApDynGridColumnConfigBase[] = [];\n items: any[] = [];\n pager: ApDynGridPagerConfigBase;\n importDataSetLoading$: Observable;\n\n private _subscriptions: Array = [];\n private _dataSetColumns: IDataSetColumn[] = [];\n\n constructor(private store: ImportStore,\n private translationStore: TranslationStore,\n private mapViewStore: MapViewStore) {\n this.mapViewStore.hideMapView();\n }\n\n ngAfterContentInit(): void {\n this.store.loadImportDataSetColumns();\n this.getDataFromStore();\n this.gridBuilder();\n }\n\n ngOnDestroy(): void {\n this._subscriptions.forEach(d => {\n d.unsubscribe();\n });\n }\n\n getDataFromStore(): void {\n this.store.loadImportDataSetTypes();\n this.importDataSetLoading$ = this.store.Listen(s => s.loading);\n this._subscriptions.push(this.store.Listen(s => s.columns).subscribe(importDataSetColumns => {\n this._dataSetColumns = importDataSetColumns;\n }));\n this._subscriptions.push(this.store.Listen(s => s.types).subscribe(importDataSetTypes => {\n if (importDataSetTypes == null) {\n return;\n }\n this.items = importDataSetTypes.map(ds => {\n const attributes = this._getCountAttributes(ds);\n const geometryType = this.translationStore.FindTranslationForSelectedLanguage(first(ds.GeometryType));\n return {\n Id: ds.Id,\n SourceItem: ds,\n Attributes: attributes,\n GeometryType: geometryType,\n Status: -1,\n StatusClass: 'ap-status-green',\n StatusDesc: 'Global__Active',\n };\n });\n }));\n }\n\n gridBuilder(): void {\n this.columns = [\n new ApDynGridStatusColumnConfig({\n field: 'Status',\n showHeaderTitle: true,\n class: 'StatusClass',\n description: 'StatusDesc'\n }),\n new ApDynGridPropertyColumnConfig({\n field: 'SourceItem.DataSetName',\n title: 'Global__Name',\n filterable: true,\n width: 90,\n headerFilterable: true\n }),\n new ApDynGridPropertyColumnConfig({\n field: 'SourceItem.FileType',\n title: 'Global__File_Type',\n filterable: true,\n width: 90,\n headerFilterable: true\n }),\n new ApDynGridPropertyColumnConfig({\n field: 'GeometryType',\n title: 'Global__Geometry',\n filterable: true,\n width: 90,\n headerFilterable: true\n }),\n new ApDynGridPropertyColumnConfig({\n field: 'Attributes',\n title: 'Global__Attributes',\n filterable: true,\n width: 90,\n headerFilterable: true\n }),\n new ApDynGridEditColumnConfig({\n disabled: true\n })\n ];\n this.pager = new ApDynGridPagerWizardConfig(\n new ApDynGridPagerWizardSection(),\n new ApDynGridPagerWizardSection(),\n new ApDynGridPagerWizardSection()\n );\n }\n\n private _getCountAttributes(item: IDataSetType): number {\n let count = 0;\n const findDataSetColumns = this._dataSetColumns.filter(dsc => dsc.DataSetType.Id === item.Id);\n if (findDataSetColumns) {\n count = findDataSetColumns.length;\n }\n return count;\n }\n}\n","import {EventEmitter} from '@angular/core';\nimport {UploadStore} from '../../stores/import/upload.store';\n\nexport class FileStreamer {\n private offset = 0;\n private readonly defaultChunkSize = 512 * 1024; // bytes\n public onChunkFinish = new EventEmitter();\n public onFinish = new EventEmitter();\n public onError = new EventEmitter();\n\n constructor(private file: File,\n private uploadStore: UploadStore,\n private uid: string) {\n this.rewind();\n\n this.uploadStore.Listen(s => s.guid).subscribe(guid => {\n if (guid == null) {\n return;\n }\n if (guid === this.uid) {\n if (!this.isEndOfFile()) {\n this.onChunkFinish.emit(this.offset);\n this.readBlockAsText();\n } else {\n this.onFinish.emit(this.offset);\n }\n }\n });\n }\n\n public rewind(): void {\n this.offset = 0;\n }\n\n public isEndOfFile(): boolean {\n return this.offset >= this.getFileSize();\n }\n\n public readBlockAsText(length: number = this.defaultChunkSize): void {\n const fileReader = new FileReader();\n const blob: Blob = this.file.slice(this.offset, this.offset + length);\n\n fileReader.onloadend = (event: ProgressEvent) => {\n const target = (event.target) as FileReader;\n if (target.error == null) {\n const result: ArrayBuffer = target.result as ArrayBuffer;\n this.offset += result.byteLength;\n\n this.uploadStore.sendUpload(this.uid, result);\n } else {\n this.onError.emit(target.error);\n }\n };\n fileReader.readAsArrayBuffer(blob);\n }\n\n private getFileSize(): number {\n return this.file.size;\n }\n}\n","export type DataType = {\n Id: number,\n Name: string\n};\n\nexport enum DataTypes {\n Logfiles = 0,\n LabResultFiles = 1\n}\n","import {IAction, IApInvokerArguments} from '../../interfaces';\n\nexport enum UploadActions {\n UPLOAD_SEND = '[upload] send',\n UPLOAD_SEND_SUCCESS = '[upload] send success',\n UPLOAD_VERIFY = '[upload] verify',\n UPLOAD_LOG_VERIFY = '[upload] log verify',\n UPLOAD_VERIFY_SUCCESS = '[upload] verify success',\n}\n\n/**\n * send data to backend\n */\nexport class UploadSend implements IAction {\n readonly type = UploadActions.UPLOAD_SEND;\n\n constructor(public payload: IApInvokerArguments[]) {\n }\n}\n\n/**\n * send Verify to backend\n */\nexport class UploadVerify implements IAction {\n readonly type = UploadActions.UPLOAD_VERIFY;\n\n constructor(public payload: IApInvokerArguments[]) {\n }\n}\n\n/**\n * send Verify to backend success\n */\nexport class UploadVerifySuccess implements IAction {\n readonly type = UploadActions.UPLOAD_VERIFY_SUCCESS;\n\n constructor(public payload: any) {\n }\n}\n\n/**\n * send Verify to backend\n */\nexport class UploadLogVerify implements IAction {\n readonly type = UploadActions.UPLOAD_LOG_VERIFY;\n\n constructor(public payload: IApInvokerArguments[]) {\n }\n}\n","import {IStateStore} from '../../ap-interface/interfaces/store';\nimport {Injectable} from '@angular/core';\nimport {Store} from '../index';\nimport {NetTypes, UploadSend, UploadVerify} from 'invoker-transport';\nimport IGuid = System.IGuid;\nimport {UploadLogVerify} from '../../../../projects/invoker-transport/src/lib/actions/import';\nimport {ApSignalrService} from '../../ap-core/services/ap-signalr.service';\n\ninterface IUploadStore extends IStateStore {\n guid: IGuid;\n}\n\n@Injectable({providedIn: 'root'})\nexport class UploadStore extends Store {\n constructor(public backend: ApSignalrService) {\n super(backend, {\n data: [],\n loaded: false,\n loading: false,\n guid: ''\n });\n\n backend.registerObservable(UploadSend).subscribe(d => {\n super.Mutate(s => s.guid, () => d.Data);\n });\n }\n\n /**\n * send upload data to the database\n */\n public sendUpload(fileGuid: IGuid, chunk: ArrayBuffer): void {\n super.Mutate(s => s.guid, () => '');\n const tmp = [];\n const arr = new Uint8Array(chunk);\n for (const key in arr) {\n if (!arr.hasOwnProperty(key)) {\n continue;\n }\n tmp[key] = arr[key];\n }\n\n this.DispatchBackend(new UploadSend([\n {Name: 'fileGuid', Type: NetTypes.GUID, Value: fileGuid},\n {Name: 'chunk', Type: NetTypes.BYTE + '[]', Value: tmp}\n ]));\n }\n\n /**\n * send verify to the database\n */\n public verifyUpload(fileGuid: IGuid, filename: string, md5: string, farmId: number, userId: number, typeId: number): void {\n this.DispatchBackend(new UploadVerify([\n {Name: 'fileGuid', Type: NetTypes.GUID, Value: fileGuid},\n {Name: 'filename', Type: NetTypes.STRING, Value: filename},\n {Name: 'md5', Type: NetTypes.STRING, Value: md5},\n {Name: 'typeId', Type: NetTypes.INT, Value: typeId}\n ]));\n }\n\n public verifyLogUpload(fileGuid: IGuid, filename: string): void {\n this.DispatchBackend(new UploadLogVerify([\n {Name: 'fileGuid', Type: NetTypes.GUID, Value: fileGuid},\n {Name: 'filename', Type: NetTypes.STRING, Value: filename},\n ]));\n }\n}\n","import {Injectable} from '@angular/core';\nimport {IStateStore} from '../../ap-interface';\nimport {Store} from '../index';\nimport {ApSignalrService} from '../../ap-core/services/ap-signalr.service';\nimport {\n ApCustomTypes,\n LabResultAttachmentDelete,\n LabResultAttachmentDownload,\n LabResultAttachmentDownloadFail,\n LabResultAttachmentDownloadSuccess,\n LabResultAttachmentLoad,\n LabResultAttachmentLoadFail,\n LabResultAttachmentLoadSuccess,\n LabResultAttachmentUpload,\n LabResultAttachmentUploadFail,\n LabResultAttachmentUploadSuccess,\n NetTypes\n} from 'invoker-transport';\nimport {SafeBehaviorSubject} from 'ts-tooling';\nimport IGuid = System.IGuid;\nimport ILabResultAttachment = Data.Dpl3.ILabResultAttachment;\n\ninterface ILabResultAttachmentStore extends IStateStore {\n}\n\n@Injectable({providedIn: 'root'})\nexport class LabResultAttachmentStore extends Store {\n constructor(public backend: ApSignalrService) {\n super(backend, {\n loaded: false,\n loading: false,\n data: []\n });\n backend.registerObservable(LabResultAttachmentLoadSuccess).subscribe(d => {\n super.Mutate(s => s.data, () => d.Data);\n super.SetLoadFinishState();\n });\n backend.registerObservable(LabResultAttachmentLoadFail).subscribe(_ => {\n super.SetLoadFailState();\n });\n this.AfterDatabaseUpdate.subscribe(() => this.ReloadSource());\n }\n\n /**\n * Observable for tracking the loading state of lab result attachments\n * @returns SafeBehaviorSubject emitting boolean loading state\n */\n public get Loading$(): SafeBehaviorSubject {\n return super.Listen(s => s.loading);\n }\n\n /**\n * Observable for accessing the current list of lab result attachments\n * @returns SafeBehaviorSubject emitting array of ILabResultAttachment objects\n */\n public get LabResultAttachments$(): SafeBehaviorSubject {\n return this.Listen((s) => s.data);\n }\n\n /**\n * Initiates loading of lab result attachments from the backend\n * Sets loading state and dispatches load request\n */\n public loadLabResultAttachments(): void {\n super.SetLoadState();\n this.DispatchBackend(new LabResultAttachmentLoad([]));\n }\n\n /**\n * Requests deletion of a specific lab result attachment\n * @param attachmentId - Unique identifier of the attachment to delete\n * @public\n */\n public deleteLabResultAttachment(attachmentId: IGuid): void {\n this.DispatchBackend(new LabResultAttachmentDelete([\n {Name: 'attachmentId', Type: NetTypes.GUID, Value: attachmentId}\n ]));\n }\n\n /**\n * Uploads a new lab result attachment to the backend\n * @param attachment - Lab result attachment data to upload\n * @returns Promise resolving on successful upload, rejecting on failure\n * @public\n */\n public uploadLabResultAttachment(attachment: ILabResultAttachment): Promise {\n return new Promise((resolve, reject) => {\n this.DispatchBackend(new LabResultAttachmentUpload([\n {Name: 'attachment', Type: ApCustomTypes.Data_Dpl3_LabResultAttachment, Value: attachment}\n ])).watchStream({\n action: LabResultAttachmentUploadSuccess,\n todo: () => resolve()\n }).watchStream({\n action: LabResultAttachmentUploadFail,\n todo: _ => reject()\n });\n });\n }\n\n /**\n * Downloads a specific lab result attachment by it`s Id\n * @param attachmentId - Unique identifier of the attachment to download\n * @returns Promise resolving with attachment data on successful download, rejecting on failure\n * @public\n */\n public downloadLabResultAttachment(attachmentId: IGuid): Promise {\n return new Promise((resolve, reject) => {\n this.DispatchBackend(new LabResultAttachmentDownload([\n {Name: 'attachmentId', Type: NetTypes.GUID, Value: attachmentId}\n ])).watchStream({\n action: LabResultAttachmentDownloadSuccess,\n todo: (result: any) => resolve(result.Data as ILabResultAttachment)\n }).watchStream({\n action: LabResultAttachmentDownloadFail,\n todo: _ => reject()\n });\n });\n }\n}\n","import {AfterContentInit, Component, OnDestroy, OnInit, ViewChild} from '@angular/core';\nimport {Validators} from '@angular/forms';\nimport {BehaviorSubject, combineLatest, Observable, Subscription} from 'rxjs';\nimport {FileState} from '@progress/kendo-angular-upload';\nimport {ImportStore} from '../../stores/import/import.store';\nimport {ApDynformsComponent} from '../../ap-dynforms/ap-dynforms.component';\nimport {\n ApDynformsConfigFieldset\n} from '../../ap-dynforms/config/ap-dynforms-config-fieldset';\nimport {\n ApDynformsConfigComboBox\n} from '../../ap-dynforms/config/ap-dynforms-config-combobox';\nimport {ApDynformsValidator} from '../../ap-dynforms/ap-dynforms-validator';\nimport {UploadStore} from '../../stores/import/upload.store';\nimport {GetPermissionPipe} from '../../ap-permission/pipes/get-permission.pipe';\nimport {FileStreamer} from '../classes/FileStreamer';\nimport {RouterStore} from '../../stores/router/router.store';\nimport {\n ApDynformsConfigPlaceholder\n} from '../../ap-dynforms/config/ap-dynforms-config-placeholder';\nimport {\n ApDynformsConfigUpload\n} from '../../ap-dynforms/config/ap-dynforms-config-upload';\nimport {FileInfoData, UploadFileEvent} from '../../ap-dynforms/types/ap-file-upload.types';\nimport {debounceTime, distinctUntilChanged, filter, tap} from 'rxjs/operators';\nimport {DataType, DataTypes} from '../types/ap-upload.types';\nimport {MapViewStore} from '../../stores/layout/mapview.store';\nimport {LabResultAttachmentStore} from '../../stores/dpl3/lab-result-attachment.store';\nimport {FileService} from '../../services/common/file.service';\nimport {ApPermissions} from 'invoker-transport';\nimport {UploadFileService} from '../../services/common/upload-file.service';\nimport IDataSetType = Data.Import.IDataSetType;\nimport ILabResultAttachment = Data.Dpl3.ILabResultAttachment;\nimport IGuid = System.IGuid;\n\n/**\n * Component for the upload data\n */\n@Component({\n selector: 'ap-upload',\n template: `\n \n `\n})\nexport class ApUploadComponent implements OnInit, AfterContentInit, OnDestroy {\n @ViewChild(ApDynformsComponent, {static: true}) dynForm: ApDynformsComponent;\n public fieldSets$ = new BehaviorSubject([]);\n public types$: Observable;\n public caption = 'UploadUpload';\n\n private _selectedDataType: DataTypes | undefined;\n private _dataTypeFormKey = 'DataType';\n private _subscriptions: Subscription[] = [];\n\n constructor(private mapViewStore: MapViewStore,\n private importStore: ImportStore,\n private uploadStore: UploadStore,\n private routeStore: RouterStore,\n private labResultAttachmentStore: LabResultAttachmentStore,\n private fileService: FileService,\n private uploadFileService: UploadFileService,\n private permissionPipe: GetPermissionPipe) {\n }\n\n /**\n * Initializes the component by hiding map view and generating initial form configuration\n * @public\n */\n public ngOnInit(): void {\n this.mapViewStore.hideMapView();\n this.fieldSets$.next(this._generateFormConfig(this._selectedDataType, false));\n }\n\n /**\n * Sets up component subscriptions and loads import data set types after content initialization\n * @public\n */\n public ngAfterContentInit(): void {\n this.types$ = this.importStore.Listen(s => s.types);\n this._subscriptions.push(\n combineLatest([\n this.permissionPipe.transform(ApPermissions.EDIT_IMPORTS),\n this.dynForm.FormValues$,\n this.fieldSets$\n ]).pipe(\n debounceTime(100),\n filter(([_, _1, fieldSets]) => fieldSets.length !== 0),\n distinctUntilChanged(([_, pFormValues, _1], [_2, cFormValues, _3]) => {\n return pFormValues[this._dataTypeFormKey] === cFormValues[this._dataTypeFormKey];\n }),\n tap(([_, formValues, _1]) => {\n this._selectedDataType = formValues[this._dataTypeFormKey];\n })\n ).subscribe(([isEditImportAvailable, formValues, _]) => {\n this.fieldSets$.next(this._generateFormConfig(formValues[this._dataTypeFormKey], isEditImportAvailable));\n })\n );\n this.importStore.loadImportDataSetTypes();\n }\n\n /**\n * Cleans up subscriptions and releases navigation on component destruction\n * @public\n */\n public ngOnDestroy(): void {\n this._subscriptions.forEach(x => x?.unsubscribe());\n this.routeStore.releaseNavigation();\n }\n\n /**\n * Generates form configuration based on selected data type and edit permissions\n * @param selectedDataTypeId - ID of the selected data type\n * @param isEditImportAvailable - Flag indicating if edit import permission is available\n * @returns Array of form fieldset configurations\n * @private\n */\n private _generateFormConfig(selectedDataTypeId: DataTypes | undefined, isEditImportAvailable: boolean): ApDynformsConfigFieldset[] {\n return [\n new ApDynformsConfigFieldset({\n key: 'GeneralData',\n config: [\n new ApDynformsConfigComboBox({\n label: 'Global__Data_type',\n key: this._dataTypeFormKey,\n valueField: 'Id',\n textField: 'Name',\n value: selectedDataTypeId,\n options: this._dataTypeOptions(),\n disabled: !isEditImportAvailable,\n valuePrimitive: true,\n translate: true,\n validators: [\n new ApDynformsValidator({validator: Validators.required, errorKey: 'Global__Choice_Data_Type_Error'}),\n ]\n }),\n new ApDynformsConfigPlaceholder()\n ]\n }),\n new ApDynformsConfigFieldset({\n key: 'FilesToUpload',\n legend: 'FilesToUpload',\n useMaxWidth: true,\n config: [\n this._getFilesUploadConfig(this._selectedDataType, isEditImportAvailable)\n ]\n })\n ];\n }\n\n /**\n * Provides data type options for the combo box\n * @returns Array of DataType objects\n * @private\n */\n private _dataTypeOptions(): DataType[] {\n return [\n {\n Id: DataTypes.Logfiles,\n Name: 'N__Logfile',\n },\n {\n Id: DataTypes.LabResultFiles,\n Name: 'LabsFiles',\n }\n ];\n }\n\n /**\n * Gets file upload configuration based on data type and edit permissions\n * @param dataType - Value from DataTypes which is id of selected data type\n * @param isEditImportAvailable - Flag indicating if edit import permission is available\n * @returns Upload configuration object\n * @private\n */\n private _getFilesUploadConfig(dataType: DataTypes | undefined, isEditImportAvailable: boolean): ApDynformsConfigUpload {\n switch (dataType) {\n case DataTypes.Logfiles:\n return this._getApDynformsConfigUpload(!isEditImportAvailable, ['.zip', '.log', '.csv']);\n case DataTypes.LabResultFiles:\n return this._getApDynformsConfigUpload(!isEditImportAvailable, ['.pdf']);\n case undefined:\n default:\n return this._getApDynformsConfigUpload(true, []);\n }\n }\n\n /**\n * Creates upload configuration with specified restrictions\n * @param isDisabled - Flag indicating if upload is disabled\n * @param allowedFileExtensions - Array of allowed file extensions\n * @returns Upload configuration object\n * @private\n */\n private _getApDynformsConfigUpload(isDisabled: boolean, allowedFileExtensions: string[]): ApDynformsConfigUpload {\n return new ApDynformsConfigUpload({\n key: 'Attachments',\n validateWithForm: true,\n onlyUniqueFiles: true,\n disabled: isDisabled,\n restrictions: allowedFileExtensions,\n uploadEventHandler: this._uploadEventHandler.bind(this)\n });\n }\n\n /**\n * Handles file upload events by blocking navigation and initiating file upload\n * @param event - Upload file event containing file information\n * @private\n */\n private _uploadEventHandler(event: UploadFileEvent): void {\n this.routeStore.blockNavigation('Global__Import_in_Progress');\n this._uploadFile(event).then();\n }\n\n /**\n * Processes file upload using FileStreamer\n * @param event - Upload file event containing file information\n * @returns Promise that resolves when upload is complete\n * @private\n */\n private async _uploadFile(event: UploadFileEvent): Promise {\n if (event.files.length <= 0) {\n return;\n }\n for (const fileDataInfo of event.files) {\n if (fileDataInfo.state === FileState.Uploading || fileDataInfo.state === FileState.Uploaded) {\n return;\n }\n try {\n switch (this._selectedDataType) {\n case DataTypes.Logfiles:\n this._logFilesUpload(fileDataInfo, event);\n break;\n case DataTypes.LabResultFiles:\n await this._labFilesUpload(fileDataInfo, event);\n break;\n }\n } catch (ex) {\n console.warn(ex);\n event.fileProcess.setUploadFailed(fileDataInfo.uid);\n this._releaseNavigationRouteIfReady(event.files);\n }\n }\n }\n\n /**\n * Handles the upload of log files using FileStreamer\n * @param fileDataInfo - Information about the file being uploaded\n * @param event - Upload event containing file processing callbacks\n * @private\n */\n private _logFilesUpload(fileDataInfo: FileInfoData, event: UploadFileEvent): void {\n const fileStreamer = new FileStreamer(fileDataInfo.rawFile, this.uploadStore, fileDataInfo.uid);\n fileStreamer.onChunkFinish.subscribe(oCF => {\n const chunkSize = Math.floor(oCF.valueOf() / fileDataInfo.rawFile.size * 100);\n event.fileProcess.setUploadProgress(fileDataInfo.uid, chunkSize);\n });\n fileStreamer.onFinish.subscribe(async () => {\n const name = fileDataInfo.name;\n this.uploadStore.verifyLogUpload(fileDataInfo.uid, name);\n event.fileProcess.setUploadProgress(fileDataInfo.uid, 100);\n event.fileProcess.setUploadFinished(fileDataInfo.uid);\n this._releaseNavigationRouteIfReady(event.files);\n });\n fileStreamer.onError.subscribe(() => {\n event.fileProcess.setUploadFailed(fileDataInfo.uid);\n this._releaseNavigationRouteIfReady(event.files);\n });\n fileStreamer.readBlockAsText();\n }\n\n /**\n * Handles the upload of lab result files\n * Converts file to base64, creates attachment object, and manages upload progress\n * @param fileDataInfo - Information about the file being uploaded\n * @param event - Upload event containing file processing callbacks\n * @returns Promise that resolves when upload is complete\n * @private\n */\n private async _labFilesUpload(fileDataInfo: FileInfoData, event: UploadFileEvent): Promise {\n const rawFileDataUrl = await this.fileService.readFileToDataUrl(fileDataInfo.rawFile);\n const attachment = {\n Id: fileDataInfo.uid as IGuid,\n Name: fileDataInfo.name,\n LastModified: fileDataInfo.rawFile.lastModified,\n ContentSize: fileDataInfo.rawFile.size,\n ContentMimeType: fileDataInfo.rawFile.type,\n ContentBase64: this.fileService.getBase64FromDataUrl(rawFileDataUrl)\n } as ILabResultAttachment;\n event.fileProcess.setUploadProgress(fileDataInfo.uid, 0);\n let shouldProgressStopProgress = false;\n this.uploadFileService.controlUploadProgress((progress: number) => {\n event.fileProcess.setUploadProgress(fileDataInfo.uid, progress);\n return shouldProgressStopProgress;\n }, {Interval: 100, Increment: 9});\n this.labResultAttachmentStore.uploadLabResultAttachment(attachment)\n .then(() => {\n shouldProgressStopProgress = true;\n event.fileProcess.setUploadProgress(fileDataInfo.uid, 100);\n event.fileProcess.setUploadFinished(fileDataInfo.uid);\n this._releaseNavigationRouteIfReady(event.files);\n })\n .catch(() => {\n shouldProgressStopProgress = true;\n event.fileProcess.setUploadFailed(fileDataInfo.uid);\n this._releaseNavigationRouteIfReady(event.files);\n });\n }\n\n /**\n * Releases navigation route if all files have finished uploading\n * @param files - Array of file information data\n * @private\n */\n private _releaseNavigationRouteIfReady(files: FileInfoData[]): void {\n if (!files || files.length === 0 || files?.some(x => x.state === FileState.Uploading)) {\n return;\n }\n this.routeStore.releaseNavigation();\n }\n}\n","import {AfterContentInit, Component, EventEmitter, OnDestroy, OnInit, ViewChild} from '@angular/core';\nimport {\n ApDynComponentComponent\n} from '../../../ap-dyncomponent/ap-dyncomponent.component';\nimport {\n ApDynGridColumnConfigBase\n} from '../../../ap-dyngrids/config/ap-dyn-grid-column-config-base';\nimport {combineLatest, Observable, Subscription} from 'rxjs';\nimport {\n ApDynGridPagerConfigBase\n} from '../../../ap-dyngrids/config/ap-dyn-grid-pager-config-base';\nimport {\n ApPermissions\n} from '../../../../../projects/invoker-transport/src/lib/generated/backend.enums';\nimport {\n ApDynGridStatusColumnConfig\n} from '../../../ap-dyngrids/config/ap-dyn-grid-status-column-config';\nimport {\n ApDynGridPropertyColumnConfig\n} from '../../../ap-dyngrids/config/ap-dyn-grid-property-column-config';\nimport {\n ApDynGridPagerConfig\n} from '../../../ap-dyngrids/config/ap-dyn-grid-pager-config';\nimport {\n GetPermissionPipe\n} from '../../../ap-permission/pipes/get-permission.pipe';\nimport {\n LanguageStore\n} from '../../../stores/translation/language.store';\nimport {\n LabResultAttachmentStore\n} from '../../../stores/dpl3/lab-result-attachment.store';\nimport {map} from 'rxjs/operators';\nimport {\n ILabResultAttachmentGridItem\n} from '../../types/ap-lab-result-files-overview.types';\nimport {\n ApColumnState\n} from '../../../ap-interface/enums/ap-column-state.enum';\nimport {\n ApDynGridEditColumnConfig\n} from '../../../ap-dyngrids/config/ap-dyn-grid-edit-column-config';\nimport {\n ApUtilService\n} from '../../../ap-utils/service/ap-util.service';\nimport {\n FileService\n} from '../../../services/common/file.service';\nimport {saveAs} from '@progress/kendo-file-saver';\nimport {\n NotifyStore\n} from '../../../stores/dialog/notify.store';\nimport ILanguage = Data.Language.ILanguage;\nimport ILabResultAttachment = Data.Dpl3.ILabResultAttachment;\nimport ApValidationLevel = Data.Api.Validation.ApValidationLevel;\nimport IApValidationResult = Data.Api.Validation.IApValidationResult;\n\n/**\n * Component for displaying and managing lab result files in a grid view.\n */\n@Component({\n selector: 'ap-lab-result-files-overview',\n template: `\n \n `\n})\nexport class ApLabResultFilesOverviewComponent implements OnInit, AfterContentInit, OnDestroy {\n @ViewChild(ApDynComponentComponent, {static: true})\n public dynComponent: ApDynComponentComponent;\n public columns: ApDynGridColumnConfigBase[] = [];\n public pager: ApDynGridPagerConfigBase;\n public items$: Observable;\n public loading$: Observable = this.labResultAttachmentStore.Loading$.asObservable();\n\n private _subscriptions: Subscription[] = [];\n private _applyClicked = new EventEmitter();\n\n constructor(private notifyStore: NotifyStore,\n private languageStore: LanguageStore,\n private labResultAttachmentStore: LabResultAttachmentStore,\n private permissionPipe: GetPermissionPipe,\n private fileService: FileService) {\n }\n\n /**\n * Initializes component by setting up items stream and loading initial data\n * @public\n */\n public ngOnInit(): void {\n this.items$ = this.labResultAttachmentStore.LabResultAttachments$.pipe(\n map(labResultAttachment => this._generateGridItem(labResultAttachment))\n );\n this.labResultAttachmentStore.loadLabResultAttachments();\n }\n\n /**\n * Sets up component subscriptions after content initialization\n * Configures grid columns and pager based on permissions and language\n * @public\n */\n public ngAfterContentInit(): void {\n this._subscriptions.push(\n combineLatest([\n this.permissionPipe.transform(ApPermissions.SHOW_IMPORTS),\n this.permissionPipe.transform(ApPermissions.EDIT_IMPORTS),\n this.languageStore.SelectedLanguage$\n ]).subscribe(([_, isEditPermissions, selectedLanguage]) => {\n this.columns = this._generateColumns(selectedLanguage);\n this.pager = this._generatePager(isEditPermissions);\n })\n );\n }\n\n /**\n * Performs cleanup by unsubscribing from all subscriptions\n * @public\n */\n public ngOnDestroy(): void {\n this._subscriptions.forEach(subscription => subscription.unsubscribe());\n }\n\n /**\n * Transforms lab result attachments into grid items\n * @param labResultAttachments - Array of lab result attachments\n * @returns Array of formatted grid items\n * @private\n */\n private _generateGridItem(labResultAttachments: ILabResultAttachment[]): ILabResultAttachmentGridItem[] {\n const gridItemStatus = {state: ApColumnState.Green, class: 'ap-status-green', description: ''};\n return labResultAttachments.map(labResultAttachment => {\n return {\n Id: labResultAttachment.Id,\n Status: gridItemStatus.state,\n StatusClass: gridItemStatus.class,\n StatusDesc: gridItemStatus.description,\n Name: labResultAttachment.Name,\n Note: labResultAttachment.Note,\n LastModifiedDate: new Date(labResultAttachment.LastModified),\n ImportedDate: new Date(labResultAttachment.CreatedAt)\n } as ILabResultAttachmentGridItem;\n });\n }\n\n /**\n * Generates grid column configurations based on selected language\n * @param selectedLanguage - Current language settings\n * @returns Array of columns configurations\n * @private\n */\n private _generateColumns(selectedLanguage: ILanguage): ApDynGridColumnConfigBase[] {\n return [\n new ApDynGridStatusColumnConfig({\n field: 'Status',\n class: 'StatusClass',\n description: 'StatusDesc'\n }),\n new ApDynGridPropertyColumnConfig({\n field: 'Name',\n title: 'Global__File',\n filterable: true,\n width: 90,\n headerFilterable: true\n }),\n new ApDynGridPropertyColumnConfig({\n field: 'LastModifiedDate',\n title: 'Global__CreatedAt',\n filterable: true,\n format: `${selectedLanguage.DateFormat} ${selectedLanguage.TimeFormat}`,\n width: 90,\n headerFilterable: true\n }),\n new ApDynGridPropertyColumnConfig({\n field: 'ImportedDate',\n title: 'Base_Upload__Imported',\n filterable: true,\n format: selectedLanguage.DateFormat,\n width: 90,\n headerFilterable: true\n }),\n new ApDynGridPropertyColumnConfig({\n field: 'Note',\n title: 'Global__Note',\n filterable: true,\n width: 90,\n headerFilterable: true\n }),\n new ApDynGridEditColumnConfig({\n data: [\n {\n text: 'Global__Download',\n callback: ApUtilService.createEventEmitter(this._downloadAttachment.bind(this), this._subscriptions)\n },\n {\n text: 'Global__Delete',\n callback: ApUtilService.createEventEmitter(this._deleteAttachment.bind(this), this._subscriptions)\n }\n ]\n })\n ];\n }\n\n /**\n * Generates pager configuration based on user permissions\n * @param isEditAvailableForUser - Flag indicating if user has edit permissions\n * @returns Pager configuration object\n * @remarks\n * Does not have any actions for pager\n * @private\n */\n private _generatePager(isEditAvailableForUser: boolean): ApDynGridPagerConfig {\n return new ApDynGridPagerConfig({\n listMassEditing: [],\n apply: this._applyClicked,\n hasPermission: isEditAvailableForUser\n });\n }\n\n /**\n * Handles attachment download requests\n * Downloads and saves the attachment file using the file service\n * @param dataItem - Grid item containing attachment information\n * @private\n */\n private _downloadAttachment(dataItem: ILabResultAttachmentGridItem): void {\n this.labResultAttachmentStore.downloadLabResultAttachment(dataItem.Id)\n .then(attachment => {\n const file = this.fileService.base64StringToFileData(attachment.Name,\n attachment.ContentMimeType, attachment.ContentBase64);\n saveAs(file, attachment.Name);\n })\n .catch(() => {\n this.notifyStore.addMessage({\n Counter: 1,\n DisplayTimeout: 5,\n ErrorKey: 'CannotDownloadFile',\n Level: ApValidationLevel.Error\n } as IApValidationResult);\n });\n }\n\n /**\n * Handles attachment deletion requests\n * @param dataItem - Grid item containing attachment information\n * @private\n */\n private _deleteAttachment(dataItem: ILabResultAttachmentGridItem): void {\n this.labResultAttachmentStore.deleteLabResultAttachment(dataItem.Id);\n }\n}\n","import {AfterContentInit, Component, EventEmitter, OnDestroy, OnInit, ViewChild} from '@angular/core';\nimport {\n ApDynComponentComponent\n} from '../../../ap-dyncomponent/ap-dyncomponent.component';\nimport {\n ImportStore\n} from '../../../stores/import/import.store';\nimport {filter, map} from 'rxjs/operators';\nimport {ApLodash} from '../../../ap-utils';\nimport {combineLatest, Observable, of, Subscription} from 'rxjs';\nimport {\n ApDynGridColumnConfigBase\n} from '../../../ap-dyngrids/config/ap-dyn-grid-column-config-base';\nimport {\n ApDynGridPagerConfigBase\n} from '../../../ap-dyngrids/config/ap-dyn-grid-pager-config-base';\nimport {ApGridPagerType, IGridPagerData, IWizardChoiceData} from '../../../ap-interface';\nimport {\n ApDynGridStatusColumnConfig\n} from '../../../ap-dyngrids/config/ap-dyn-grid-status-column-config';\nimport {\n ApDynGridPropertyColumnConfig,\n FilterType\n} from '../../../ap-dyngrids/config/ap-dyn-grid-property-column-config';\nimport {\n ApDynGridEditColumnConfig\n} from '../../../ap-dyngrids/config/ap-dyn-grid-edit-column-config';\nimport {\n ApUtilService\n} from '../../../ap-utils/service/ap-util.service';\nimport {\n ApDynGridPagerConfig\n} from '../../../ap-dyngrids/config/ap-dyn-grid-pager-config';\nimport * as moment from 'moment/moment';\nimport {\n IImportGridData\n} from '../../types/ap-logfile-files-overview.types';\nimport {\n CampaignYearStore\n} from '../../../stores/login/campaignyear.store';\nimport {\n GetPermissionPipe\n} from '../../../ap-permission/pipes/get-permission.pipe';\nimport {\n ApPermissions\n} from '../../../../../projects/invoker-transport/src/lib/generated/backend.enums';\nimport {\n LanguageStore\n} from '../../../stores/translation/language.store';\nimport {\n ApTranslationService\n} from '../../../ap-utils/service/ap-translation.service';\nimport {\n ApDateService\n} from '../../../ap-core/services/ap-date-service';\nimport {\n ApSensorDataService\n} from '../../../stores/services/ap-sensor-data.service';\nimport {MapStore} from '../../../stores/map/map.store';\nimport {\n ApColumnState\n} from '../../../ap-interface/enums/ap-column-state.enum';\nimport {\n IGridStatus\n} from '../../../ap-interface/interfaces/ap-grid-status.interface';\nimport IImportDataSet = Data.Import.IImportDataSet;\nimport ILanguage = Data.Language.ILanguage;\n\n@Component({\n selector: 'ap-logfile-files-overview',\n template: `\n \n `\n})\nexport class ApLogfileFilesOverviewComponent implements OnInit, AfterContentInit, OnDestroy {\n @ViewChild(ApDynComponentComponent, {static: true})\n public dynComponent: ApDynComponentComponent;\n public columns: ApDynGridColumnConfigBase[] = [];\n public pager: ApDynGridPagerConfigBase;\n public items$: Observable = of([]);\n public loading$: Observable = of(false);\n\n private _subscriptions: Subscription[] = [];\n private _onClick = new EventEmitter();\n private _applyClicked = new EventEmitter();\n\n constructor(private mapStore: MapStore,\n private importStore: ImportStore,\n private languageStore: LanguageStore,\n private campaignYearStore: CampaignYearStore,\n private dateService: ApDateService,\n private translationService: ApTranslationService,\n private permissionPipe: GetPermissionPipe,\n private sensorService: ApSensorDataService) {\n }\n\n public ngOnInit(): void {\n this.loading$ = this.importStore.Loading$();\n this.items$ = this._getItems();\n this.importStore.loadImportDataSetTypes();\n }\n\n public ngAfterContentInit(): void {\n this._subscriptions.push(this._applyClicked.subscribe((d) => this._onApplyClicked(d)));\n this._subscriptions.push(this._onClick.subscribe((e) => this._onShowOnMapClick(e)));\n this._subscriptions.push(\n this.importStore.Listen(s => s.updatedDataSet)\n .pipe(filter(updatedDataSet => !!updatedDataSet))\n .subscribe(updatedDataSet => {\n this.items$ = this.items$.pipe(\n filter(d => !!d),\n map(dataSets => ApLodash.replaceItem(dataSets, this._buildGridDataRecord(updatedDataSet), 'Id'))\n );\n })\n );\n this._subscriptions.push(\n this.campaignYearStore.Listen(s => s.selectedYear).subscribe((cy) => {\n this.importStore.loadImportDataSets(cy);\n })\n );\n this._subscriptions.push(\n combineLatest([\n this.permissionPipe.transform(ApPermissions.SHOW_IMPORTS),\n this.permissionPipe.transform(ApPermissions.EDIT_IMPORTS),\n this.languageStore.SelectedLanguage$\n ]).subscribe(([_, isEditPermissions, selectedLanguage]) => {\n this.columns = this._generateColumns(selectedLanguage);\n this.pager = this._generatePager(isEditPermissions);\n })\n );\n }\n\n public ngOnDestroy(): void {\n this._subscriptions.forEach(d => d?.unsubscribe());\n }\n\n private _getItems(): Observable {\n return this.importStore.Listen(s => s.data).pipe(\n filter(d => !!d),\n map(d => d.Convert((ds: IImportDataSet) => this._buildGridDataRecord(ds)))\n );\n }\n\n private _generateColumns(selectedLanguage: ILanguage): ApDynGridColumnConfigBase[] {\n return [\n new ApDynGridStatusColumnConfig({\n field: 'Status',\n showHeaderTitle: true,\n class: 'StatusClass',\n description: 'StatusDesc'\n }),\n new ApDynGridPropertyColumnConfig({\n field: 'SourceItem.DataSetName',\n title: 'Global__File',\n filterable: true,\n width: 90,\n headerFilterable: true\n }),\n new ApDynGridPropertyColumnConfig({\n field: 'UploadDate',\n title: 'Base_Upload__Imported',\n filterable: true,\n format: `${selectedLanguage.DateFormat} ${selectedLanguage.TimeFormat}`,\n width: 90,\n headerFilterable: true\n }),\n new ApDynGridPropertyColumnConfig({\n field: 'CreatedDate',\n title: 'Global__FieldGeom_Creation_Date',\n filterable: true,\n format: `${selectedLanguage.DateFormat} ${selectedLanguage.TimeFormat}`,\n width: 90,\n headerFilterable: true\n }),\n new ApDynGridPropertyColumnConfig({\n field: 'SourceItem.DataSetType.DataSetName',\n title: 'Tasks_ViewModel__Type',\n filterable: true,\n width: 90,\n headerFilterable: true\n }),\n new ApDynGridPropertyColumnConfig({\n field: 'SourceItem.LogCount',\n title: 'Nutrients_Pages__CountSamples',\n filterable: true,\n filterType: FilterType.NUMBER,\n width: 90,\n headerFilterable: true\n }),\n new ApDynGridEditColumnConfig({\n data: [\n {\n text: 'Download_Csv',\n callback: ApUtilService.createEventEmitter(this._downloadCsv.bind(this), this._subscriptions)\n },\n // TODO Log Download fix\n /*{\n text: 'Download_Log',\n callback: ApUtilService.createEventEmitter(this._downloadLog.bind(this), this._subscriptions)\n }*/\n ]\n }),\n ];\n }\n\n private _generatePager(isEditAvailableForUser: boolean): ApDynGridPagerConfig {\n return new ApDynGridPagerConfig({\n listMassEditing: [\n {\n id: 0,\n name: this.translationService.translate('Download_Csv'),\n type: ApGridPagerType.None,\n values: null\n } as IWizardChoiceData\n ],\n apply: this._applyClicked,\n hasPermission: isEditAvailableForUser\n });\n }\n\n private _onApplyClicked(data: IGridPagerData): void {\n const rows = this.dynComponent.getSelectedItems();\n switch (data.object.id) {\n case 0:\n this.importStore.downloadCsv(rows.map((row) => row['SourceItem']['MongoFileId']));\n break;\n }\n }\n\n private _buildGridDataRecord(ds: IImportDataSet): IImportGridData {\n const upload = !!ds.Uploaded ? this.dateService.toFarmDateFromUtcGetJsDate(ds.Uploaded) : undefined;\n const created = !!ds.Uploaded ? this.dateService.toFarmDateFromUtcGetJsDate(ds.Created) : undefined;\n const gridStatus = this.getGridStatus(ds);\n return {\n Id: ds.Id,\n SourceItem: ds,\n Status: gridStatus.state,\n StatusClass: gridStatus.class,\n StatusDesc: gridStatus.description,\n UploadDate: !!upload && upload.getFullYear() > 1910 ? upload : null,\n CreatedDate: !!created && created.getFullYear() > 1910 ? created : null,\n } as IImportGridData;\n }\n\n private getGridStatus(item: IImportDataSet): IGridStatus {\n if (item.ErrCode != null) {\n return {\n state: ApColumnState.Red,\n class: 'ap-status-red',\n description: item.ErrCode\n };\n }\n if (item.Imported != null && (moment().diff(item.Imported) > 0)) {\n return {\n state: ApColumnState.Green,\n class: 'ap-status-green',\n description: 'Global__Upload_Successfully_Imported'\n };\n }\n return {\n state: ApColumnState.Yellow,\n class: 'ap-status-yellow',\n description: 'Global__Upload_Not_Successfully_Imported'\n };\n }\n\n private _onShowOnMapClick(dataItem: any): void {\n this.sensorService.loadByDataset(dataItem.Id);\n this.mapStore.Editor.ShowDeleteButton();\n }\n\n private _downloadCsv(dataItem: any): void {\n this.importStore.downloadCsv(dataItem['SourceItem']['MongoFileId']);\n }\n\n // TODO Log Download fix\n /*private _downloadLog(dataItem: any): void {\n this.importStore.downloadLog(dataItem['SourceItem']['MongoFileId']);\n }*/\n}\n","export enum ImportOverviewTabs {\n LabFilesTab = 0,\n LogfileFilesTab = 1\n}\n","\n \n\n\n
\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
\n","import {Component, OnInit, ViewChild} from '@angular/core';\nimport {MapViewStore} from '../../../stores/layout/mapview.store';\nimport {ApLabResultFilesOverviewComponent} from './ap-lab-result-files-overview.component';\nimport {ApLogfileFilesOverviewComponent} from './ap-logfile-files-overview.component';\nimport {ImportOverviewTabs} from '../../types/ap-import-overview.types';\n\n/**\n * Component for the import overview\n */\n@Component({\n selector: 'ap-import-overview',\n templateUrl: 'ap-import-overview.component.html'\n})\nexport class ApImportOverviewComponent implements OnInit {\n @ViewChild(ApLabResultFilesOverviewComponent, {static: false})\n public labsFilesOverviewComponent: ApLabResultFilesOverviewComponent;\n\n @ViewChild(ApLogfileFilesOverviewComponent, {static: false})\n public logfileFilesOverviewComponent: ApLogfileFilesOverviewComponent;\n\n public selectedTab: ImportOverviewTabs = ImportOverviewTabs.LabFilesTab;\n\n constructor(private mapViewStore: MapViewStore) {\n }\n\n public ngOnInit(): void {\n this.mapViewStore.hideMapView();\n }\n\n public searchIn(value: string): void {\n switch (this.selectedTab) {\n case ImportOverviewTabs.LabFilesTab:\n this.labsFilesOverviewComponent.dynComponent?.dynGrid?.filterGrid(value);\n break;\n case ImportOverviewTabs.LogfileFilesTab:\n this.logfileFilesOverviewComponent.dynComponent?.dynGrid?.filterGrid(value);\n break;\n }\n }\n\n public selectTab(e: any): void {\n switch (this.selectedTab) {\n case ImportOverviewTabs.LabFilesTab:\n this.labsFilesOverviewComponent.dynComponent?.dynGrid.filterGrid('');\n break;\n case ImportOverviewTabs.LogfileFilesTab:\n this.logfileFilesOverviewComponent.dynComponent?.dynGrid.filterGrid('');\n break;\n }\n this.selectedTab = e.index as ImportOverviewTabs;\n }\n}\n","import {Route, RouterModule} from '@angular/router';\nimport {NgModule} from '@angular/core';\nimport {PageMode} from '../ap-interface';\nimport {ApUploadFormatsComponent} from './components/ap-upload-formats.component';\nimport {ApUploadComponent} from './components/ap-upload.component';\nimport {ApImportOverviewComponent} from './components/overview/ap-import-overview.component';\nimport {ApPermissionGuard} from '../guards/ap-permission-guard.service';\n\nconst routes: Route[] = [\n {\n path: 'overview',\n component: ApImportOverviewComponent,\n canActivate: [ApPermissionGuard],\n data: {\n login: true,\n layout: PageMode.HALFSCREEN\n }\n },\n {\n path: 'upload',\n component: ApUploadComponent,\n canActivate: [ApPermissionGuard],\n data: {\n login: true,\n layout: PageMode.HALFSCREEN\n },\n },\n {\n path: 'formats',\n component: ApUploadFormatsComponent,\n canActivate: [ApPermissionGuard],\n data: {\n login: true,\n layout: PageMode.HALFSCREEN\n },\n }\n];\n\n@NgModule({\n imports: [\n RouterModule.forChild(routes)\n ],\n exports: [RouterModule]\n})\nexport class ApImportRoutes {\n}\n","import {Injectable} from '@angular/core';\nimport {BehaviorSubject} from 'rxjs';\nimport {HttpEvent, HttpEventType, HttpProgressEvent, HttpResponse} from '@angular/common/http';\n\n@Injectable({\n providedIn: 'root'\n})\nexport class ApUploadFakeStreamService {\n handler: BehaviorSubject> = null;\n\n constructor() {\n this.initHandler();\n }\n\n initHandler(): void {\n this.handler = new BehaviorSubject>({\n type: HttpEventType.UploadProgress,\n loaded: 0,\n total: 100\n } as HttpProgressEvent);\n }\n\n next(event: HttpEvent): void {\n this.handler.next(event);\n }\n\n finish(): void {\n this.handler.next(new HttpResponse({status: 200}));\n this.initHandler();\n }\n\n error(): void {\n this.handler.error(new Error('404'));\n this.initHandler();\n }\n}\n","import {Injectable} from '@angular/core';\nimport {HttpEvent, HttpHandler, HttpRequest, HttpResponse} from '@angular/common/http';\nimport {Observable, of} from 'rxjs';\nimport {ApUploadFakeStreamService} from './ap-upload-fake-stream.service';\nimport {APP_CONFIGURATION} from '../../ap-core/config';\n\n@Injectable({providedIn: 'root'})\nexport class ApUploadInterceptorService {\n\n constructor(private fakeStream: ApUploadFakeStreamService) {\n }\n\n intercept(req: HttpRequest, next: HttpHandler): Observable> {\n if (req.url === APP_CONFIGURATION.UploadSaveUrl) {\n return this.fakeStream.handler;\n }\n\n if (req.url === APP_CONFIGURATION.UploadRemoveUrl) {\n return of(new HttpResponse({status: 200}));\n }\n\n return next.handle(req);\n }\n}\n","import {ApUploadComponent} from './components/ap-upload.component';\nimport {ApImportOverviewComponent} from './components/overview/ap-import-overview.component';\nimport {ApUploadFormatsComponent} from './components/ap-upload-formats.component';\nimport {FormsModule, ReactiveFormsModule} from '@angular/forms';\nimport {ApCoreModule} from '../ap-core/ap-core.module';\nimport {ApIconModule} from '../icons/ap-icon.module';\nimport {LayoutModule} from '@progress/kendo-angular-layout';\nimport {ButtonModule, SplitButtonModule} from '@progress/kendo-angular-buttons';\nimport {CommonModule} from '@angular/common';\nimport {InputsModule} from '@progress/kendo-angular-inputs';\nimport {ComboBoxModule, DropDownsModule} from '@progress/kendo-angular-dropdowns';\nimport {NgModule} from '@angular/core';\nimport {DateInputsModule} from '@progress/kendo-angular-dateinputs';\nimport {ApImportRoutes} from './ap-import.routes';\nimport {ApTranslationModule} from '../translation/ap-translation.module';\nimport {BodyModule, GridModule, HeaderModule, PagerModule} from '@progress/kendo-angular-grid';\nimport {SharedModule, UploadModule, UploadService} from '@progress/kendo-angular-upload';\nimport {HTTP_INTERCEPTORS, HttpClientModule} from '@angular/common/http';\nimport {ApUploadInterceptorService} from './services/ap-upload-interceptor.service';\nimport {ApTooltipModule} from '../ap-tooltip/ap-tooltip.module';\nimport {ApResponsiveTextModule} from '../ap-responsive-text/ap-responsive-text.module';\nimport {ApSectionHeaderModule} from '../ap-section-header/ap-section-header.module';\nimport {ApDynComponentModule} from '../ap-dyncomponent/ap-dyncomponent.module';\nimport {ApUtilsModule} from '../ap-utils';\nimport {ApPermissionModule} from '../ap-permission/ap-permission.module';\nimport {\n ApLabResultFilesOverviewComponent\n} from './components/overview/ap-lab-result-files-overview.component';\nimport {\n ApLogfileFilesOverviewComponent\n} from './components/overview/ap-logfile-files-overview.component';\n\n@NgModule({\n declarations: [\n ApUploadComponent,\n ApImportOverviewComponent,\n ApUploadFormatsComponent,\n ApLabResultFilesOverviewComponent,\n ApLogfileFilesOverviewComponent\n ],\n exports: [\n ApUploadComponent,\n ApImportOverviewComponent,\n ApUploadFormatsComponent,\n ],\n imports: [\n ReactiveFormsModule,\n HttpClientModule,\n ApCoreModule,\n ApIconModule,\n LayoutModule,\n ButtonModule,\n CommonModule,\n SplitButtonModule,\n InputsModule,\n ComboBoxModule,\n DateInputsModule,\n DropDownsModule,\n FormsModule,\n GridModule,\n ApTranslationModule,\n ApImportRoutes,\n UploadModule,\n SharedModule,\n BodyModule,\n HeaderModule,\n ApTooltipModule,\n ApResponsiveTextModule,\n PagerModule,\n ApSectionHeaderModule,\n ApDynComponentModule,\n ApUtilsModule,\n ApPermissionModule,\n SharedModule\n ],\n providers: [\n UploadService,\n {\n provide: HTTP_INTERCEPTORS,\n useClass: ApUploadInterceptorService,\n multi: true\n }]\n})\nexport class ApImportModule {\n}\n"],"sourceRoot":"webpack:///","file":"284.c73571aa895c3ebd.js"}