datapoints-export-selector/datapoints-export-selector-modal/datapoints-export-selector-file-exporter/datapoints-export-selector-file-exporter.component.ts
OnInit
OnDestroy
selector | c8y-datapoints-export-selector-file-exporter |
standalone | true |
imports |
CoreModule
DataPointsExportSelectorDataScopeComponent
DataPointsExportSelectorFileTypesComponent
DataPointsExportSelectorPreviewComponent
DataPointsExportSelectorTimeRangeComponent
KeyValuePipe
ReactiveFormsModule
|
templateUrl | ./datapoints-export-selector-file-exporter.component.html |
Properties |
Methods |
|
Inputs |
Outputs |
constructor(datapointsExportModalService: DataProcessingService, datapointsExportSelectorService: DataFetchingService, datapointsExportSelectorFileExporterService: DatapointsExportSelectorFileExporterService, formBuilder: FormBuilder, generators: FileGenerator[], gainsightService: GainsightService)
|
|||||||||||||||||||||
Parameters :
|
exportConfig |
Type : ExportConfig
|
onDownloadButtonStateChange |
Type : EventEmitter<boolean>
|
Async downloadFile | ||||||||||||
downloadFile(blob: Blob | null, fileType: string, measurementsZipFileName: string)
|
||||||||||||
Parameters :
Returns :
Promise<void>
|
excludeDatapointsThatExceedsApiLimit | ||||||
excludeDatapointsThatExceedsApiLimit(exportConfig: ExportConfig)
|
||||||
Parameters :
Returns :
ExportConfig
|
Async exportAndDownload |
exportAndDownload()
|
Returns :
Promise<void>
|
Async exportFile | ||||||
exportFile(fileType: string)
|
||||||
Parameters :
Returns :
Promise<Blob | null>
|
Async exportMeasurementFile | ||||||||
exportMeasurementFile(fileType: string)
|
||||||||
Exports a measurement file of the specified type. Measurements API does provide a way to fetch a preprocessed CSV/Excel file. At this point a backed file needs to be fetched. Measurement data used for a preview contains just 5 first records and it's not fetched with CSV/Excel headers.
Parameters :
Returns :
Promise | null
A Promise that resolves to a Blob representing the exported file or null when no data to export or it's sent via email. |
Async exportSeriesFile | ||||||||
exportSeriesFile(fileType: string)
|
||||||||
Exports the series data to a file of the specified type. Series API does not provide a way to fetch a preprocessed CSV/Excel file. Series data used for exporting a file is already fetched for a preview and can be reused for exporting.
Parameters :
Returns :
Promise<Blob>
A Promise that resolves to a Blob representing the exported file. |
getOnlySelectedFileExports | ||||||
getOnlySelectedFileExports(fileExports: FileExportConfig[])
|
||||||
Parameters :
Returns :
FileExportConfig[]
|
ngOnDestroy |
ngOnDestroy()
|
Returns :
void
|
Async ngOnInit |
ngOnInit()
|
Returns :
Promise<void>
|
Async onAggregationChange | ||||||
onAggregationChange(aggregation: AggregationOption)
|
||||||
Parameters :
Returns :
Promise<void>
|
onDateFromChange | ||||||
onDateFromChange(updatedDate: string)
|
||||||
Parameters :
Returns :
void
|
onDateToChange | ||||||
onDateToChange(updatedDate: string)
|
||||||
Parameters :
Returns :
void
|
Async onExportTypeChange | ||||||
onExportTypeChange(exportType: string)
|
||||||
Parameters :
Returns :
Promise<void>
|
setFilesType | ||||||
setFilesType(generators: FileGenerator[])
|
||||||
Parameters :
Returns :
void
|
Async updateDateAndFetchData | |||||||||
updateDateAndFetchData(dateType: "dateFrom" | "dateTo", updatedDate: string)
|
|||||||||
Parameters :
Returns :
Promise<void>
|
datapointsExceedingBrowserDownloadLimit |
Type : DatapointsExceedingLimit[]
|
Default value : []
|
Contains all datapoints that number of records exceeds a threshold, where data for these datapoints will be processed by the backend. Applies only to measurement API which can return processed CSV, Excel or XML data. |
disabledAggregationOptions |
Type : AggregationOptionStatus
|
Default value : {}
|
Represents aggregation selector options that are disabled. This state is determined based on the current date range. |
dynamicFilesTypeMetadata |
Type : literal type
|
Default value : {}
|
formGroup |
Type : ReturnType<>
|
hasNoExportableData |
Type : boolean
|
Indicates if there is no exportable data because the date range of all selected datapoints exceeds 1,000,000 records. |
hasPermissionToReadAnyMeasurements |
Default value : false
|
isPreviewLoading |
Default value : true
|
limitExceededMessage |
Type : string
|
previewTableData |
Type : ExportData[]
|
<div class="p-b-16">
<ng-container *ngIf="hasPermissionToReadAnyMeasurements; else hasNoRoleToReadAnyMeasurements">
<div class="p-16 text-center separator-bottom sticky-top bg-component">
<p class="text-medium text-16">
{{ 'Configure export' | translate }}
</p>
</div>
<div
class="p-t-24 p-r-16 p-l-16 gap-8 p-b-16 flex-wrap"
[ngClass]="{ 'separator-bottom': isFullTypeOfExport }"
>
<div class="row">
<div class="col-md-4">
<c8y-datapoints-export-selector-time-range
*ngIf="this.hasPermissionToReadAnyMeasurements"
[formGroup]="formGroup"
(onDateFromChange)="onDateFromChange($event)"
(onDateToChange)="onDateToChange($event)"
></c8y-datapoints-export-selector-time-range>
</div>
<div class="col-md-4">
<c8y-datapoints-export-selector-data-scope
*ngIf="this.hasPermissionToReadAnyMeasurements"
[disabledAggregationOptions]="disabledAggregationOptions"
[formGroup]="formGroup"
(onAggregationChange)="onAggregationChange($event)"
(onExportTypeChange)="onExportTypeChange($event)"
></c8y-datapoints-export-selector-data-scope>
</div>
<div class="col-md-4">
<c8y-datapoints-export-selector-file-types
*ngIf="this.hasPermissionToReadAnyMeasurements"
[dynamicFilesTypeMetadata]="dynamicFilesTypeMetadata"
[formGroup]="formGroup"
></c8y-datapoints-export-selector-file-types>
</div>
</div>
</div>
<ng-container
*ngIf="!isFullTypeOfExport && !hasFetchedDataAnyValuesToExport && !isPreviewLoading"
>
<div class="p-t-24 p-r-16 p-l-16 p-b-16 separator-bottom d-flex">
<div
class="alert alert-warning center-block"
role="alert"
data-cy="file-exporter--no-data-available"
translate
>
No data available.
</div>
</div>
</ng-container>
<ng-container *ngIf="datapointsExceedingBrowserDownloadLimit.length > 0">
<div class="p-t-24 p-r-16 p-l-16 p-b-16 separator-bottom d-flex">
<div
[class]="
hasNoExportableData
? 'alert alert-warning center-block'
: 'alert alert-info center-block'
"
role="alert"
[innerHTML]="limitExceededMessage"
></div>
</div>
</ng-container>
<ng-container *ngIf="isFullTypeOfExport">
<c8y-datapoints-export-selector-preview
*ngIf="this.hasPermissionToReadAnyMeasurements"
[hasFetchedDataAnyValuesToExport]="hasFetchedDataAnyValuesToExport"
[isPreviewLoading]="isPreviewLoading"
[previewTableData]="previewTableData"
></c8y-datapoints-export-selector-preview>
</ng-container>
</ng-container>
<ng-template #hasNoRoleToReadAnyMeasurements>
<div class="p-t-24 p-r-16 p-l-16 p-b-16 d-flex">
<div
class="alert alert-info center-block"
role="alert"
translate
>
<p>To export data, you must meet at least one of these criteria:</p>
<ul>
<li>
Have
<b>READ permission for "Measurements" permission type</b>
(either as a global role or for the specific source)
</li>
<li>
Be the
<b>owner of the source</b>
you want to export data from
</li>
</ul>
<p>Don't meet these requirements? Contact your system administrator for assistance.</p>
</div>
</div>
</ng-template>
</div>