@versatiledatakit/data-pipelines
Version:
Data Pipelines help Data Engineers develop, deploy, run, and manage data processing workloads (called 'Data Job')
190 lines (189 loc) • 7.84 kB
TypeScript
import { ElementRef, OnInit } from '@angular/core';
import { Location } from '@angular/common';
import { ActivatedRoute, Router } from '@angular/router';
import { Subject } from 'rxjs';
import { ClrDatagridSortOrder, ClrDatagridStateInterface } from '@clr/angular';
import { ComponentModel, ComponentService, ErrorHandlerService, ErrorRecord, NavigationService, OnTaurusModelChange, OnTaurusModelError, OnTaurusModelInit, OnTaurusModelInitialLoad, OnTaurusModelLoad, RouterService, TaurusBaseComponent, URLStateManager } from '@versatiledatakit/shared';
import { QuickFilters } from '../../shared/components';
import { DataJob, DataJobExecutionStatus, DataJobStatus, DataPipelinesConfig, DisplayMode, GridFilters } from '../../model';
import { DataJobsApiService, DataJobsService } from '../../services';
import * as i0 from "@angular/core";
export declare const QUERY_PARAM_SEARCH = "search";
export declare type ClrGridUIState = {
totalItems: number;
lastPage: number;
pageSize: number;
filter: GridFilters;
sort: {
[key: string]: ClrDatagridSortOrder;
};
search: string;
};
export declare type UIElementOffset = {
x: number;
y: number;
};
export declare type DataJobsLocalStorageUserConfig = {
hiddenColumns: {
[columnName: string]: boolean;
};
};
export declare abstract class DataJobsBaseGridComponent extends TaurusBaseComponent implements OnInit, OnTaurusModelInit, OnTaurusModelInitialLoad, OnTaurusModelLoad, OnTaurusModelChange, OnTaurusModelError {
protected readonly routerService: RouterService;
protected readonly dataJobsService: DataJobsService;
protected readonly dataJobsApiService: DataJobsApiService;
protected readonly errorHandlerService: ErrorHandlerService;
protected readonly location: Location;
protected readonly router: Router;
protected readonly elementRef: ElementRef<HTMLElement>;
protected readonly document: Document;
protected dataPipelinesModuleConfig: DataPipelinesConfig;
protected readonly localStorageConfigKey: string;
localStorageUserConfig: DataJobsLocalStorageUserConfig;
/**
* @inheritDoc
*/
static readonly CLASS_NAME: string;
/**
* @inheritDoc
*/
static readonly PUBLIC_NAME: string;
static readonly UI_KEY_PAGE_OFFSET = "pageOffset";
static readonly UI_KEY_GRID_OFFSET = "gridOffset";
static readonly UI_KEY_GRID_UI_STATE = "gridUIState";
static readonly CONTENT_AREA_SELECTOR = ".content-area";
static readonly DATA_GRID_SELECTOR = ".datagrid";
/**
* ** Update strategy that will be used to update Browser URL.
*
* - 'updateLocation' will update softly update the URL using Location service, and it's default one
* - 'updateRouter' will trigger Angular router resolve mechanism with all guards and resolvers through Router service
*/
urlUpdateStrategy: 'updateLocation' | 'updateRouter';
/**
* ** Query param key for search value.
*/
searchParam: string;
/**
* ** Position for search query param.
*/
searchParamPosition: number;
/**
* ** Base position index for Data Jobs filters query param.
*
* - Every filter has its own defined +x from the base.
*/
filtersQueryParamPositionBase: number;
/**
* ** URLStateManager external dependency injection to act in synchronous way external pages and the Data Jobs.
*/
set urlStateManager(value: URLStateManager);
get urlStateManager(): URLStateManager;
teamNameFilter: string;
displayMode: DisplayMode;
filterByTeamName: boolean;
selectedJob: DataJob;
gridState: ClrDatagridStateInterface;
loading: boolean;
dataJobs: DataJob[];
totalJobs: number;
loadDataDebouncer: Subject<"normal" | "forced">;
deploymentStatuses: DataJobStatus[];
executionStatuses: DataJobExecutionStatus[];
clrGridCurrentPage: number;
clrGridUIState: ClrGridUIState;
clrGridDefaultFilter: ClrGridUIState['filter'];
clrGridDefaultSort: ClrGridUIState['sort'];
quickFilters: QuickFilters;
dataJobStatus: typeof DataJobStatus;
initializingComponent: boolean;
/**
* ** Array of error code patterns that component should listen for in errors store.
*/
listenForErrorPatterns: string[];
/**
* ** Flag that indicates actionable elements should be disabled.
*/
disableActionableElements: boolean;
protected restoreUIStateInProgress: boolean;
protected navigationInProgress: boolean;
protected _urlStateManager: URLStateManager;
private _isUrlStateManagerExternalDependency;
protected constructor(componentService: ComponentService, navigationService: NavigationService, activatedRoute: ActivatedRoute, routerService: RouterService, dataJobsService: DataJobsService, dataJobsApiService: DataJobsApiService, errorHandlerService: ErrorHandlerService, location: Location, router: Router, elementRef: ElementRef<HTMLElement>, document: Document, dataPipelinesModuleConfig: DataPipelinesConfig, localStorageConfigKey: string, localStorageUserConfig: DataJobsLocalStorageUserConfig, className?: string);
/**
* ** NgFor elements tracking function.
*/
trackByFn(index: number, dataJob: DataJob): string;
resolveLogsUrl(job: DataJob): string;
showOrHideColumnChange(columnName: string, hidden: boolean): void;
getJobStatus(job: DataJob): DataJobExecutionStatus;
getJobSuccessRateTitle(job: DataJob): string;
/**
* ** Callback (listener) for User search.
*/
search(value: string): void;
refresh(): void;
/**
* ** Main callback (listener) for ClrGrid state mutation, like filters, sort.
*/
loadDataWithState(state: ClrDatagridStateInterface): void;
isStandardDisplayMode(): boolean;
selectionChanged(dataJob: DataJob): void;
/**
* ** Navigate to Data Job details page, while at first save Ui State of the Page.
*/
navigateToJobDetails(job?: DataJob): void;
/**
* @inheritDoc
*/
onModelInit(): void;
/**
* @inheritDoc
*/
onModelInitialLoad(): void;
/**
* @inheritDoc
*/
onModelLoad(): void;
/**
* @inheritDoc
*/
onModelChange(model: ComponentModel): void;
/**
* @inheritDoc
*/
onModelError(model: ComponentModel, _task: string, newErrorRecords: ErrorRecord[]): void;
/**
* @inheritDoc
*/
ngOnInit(): void;
protected isLoadDataAllowed(): boolean;
protected isUrlUpdateAllowed(): boolean;
protected saveUIState(): void;
protected restoreUIState(): void;
private _shouldRestoreUIState;
private _doesRestoreUIStateExist;
private _clearUiPageState;
private _doLoadData;
private _extractData;
private _initUrlStateManager;
private _extractQueryParams;
private _updateUrlStateManager;
private _areQueryParamsPristine;
private _checkMutatedFilterAndUpdate;
private _doUrlUpdate;
private _loadLocalStorageUserConfig;
/**
* ** Builds refresh filters.
*
* - Convert filters from an array to map, because that's what backend-calling service is expecting
*/
private _buildRefreshFilters;
private _encodeFilterForQueryParam;
private _decodeFilterFromQueryParam;
private _createApiFilterPattern;
private _initializeQuickFilters;
private _initializeClrGridUIState;
static ɵfac: i0.ɵɵFactoryDeclaration<DataJobsBaseGridComponent, never>;
static ɵdir: i0.ɵɵDirectiveDeclaration<DataJobsBaseGridComponent, never, never, { "urlUpdateStrategy": "urlUpdateStrategy"; "searchParam": "searchParam"; "searchParamPosition": "searchParamPosition"; "filtersQueryParamPositionBase": "filtersQueryParamPositionBase"; "urlStateManager": "urlStateManager"; }, {}, never>;
}