ngx-dynamic-dashboard
Version:
an dashboard lib for angular 10
103 lines (102 loc) • 4.42 kB
TypeScript
import { ErrorObject } from '../../error/error-model';
import { GadgetPropertyService } from './gadget-property.service';
import { GadgetInstanceService } from '../../grid/grid.service';
import { AfterViewInit, ChangeDetectorRef, OnDestroy, OnInit } from '@angular/core';
import { DynamicFormComponent } from '../../dynamic-form/dynamic-form.component';
import { OptionsService } from '../../configuration/tab-options/service';
import { IGadget } from './igadget';
import { EndPoint } from './endpoint.model';
/**
* Created by jayhamilton on 6/22/17.
*/
export declare abstract class GadgetBase implements IGadget, OnDestroy, OnInit, AfterViewInit {
protected _gadgetInstanceService: GadgetInstanceService;
protected _propertyService: GadgetPropertyService;
protected changeDetectionRef: ChangeDetectorRef;
protected _optionsService: OptionsService;
propertyPageForm: DynamicFormComponent;
title: string;
instanceId: number;
config: any;
gadgetTags: Array<any>;
/**
* Used to determine when to show the controls that appear in the gadgets
* heading area. This is set by the mouseover/mouseout events.
* @type {boolean}
*/
showControls: boolean;
/**
* determines whether to show the gadgets property page
* @type {boolean}
*/
inConfig: boolean;
/**
* Determines if a gadget is runnning or not
* @type {boolean}
*/
inRun: boolean;
/**
* When a gadget is manually put into run mode this property will be used to
* display a spinning icon and will be enabled between intiating an operation (run or stop)
* to the operation is enabled
* @type {boolean}
*/
actionInitiated: boolean;
/**
* Gadgets that are of type realtime have a run/stop set of controls.
* Those gadgets should set this property to true. This property's visibility
* will also be controlled by whether the gadget's configuration form is valid.
* @type {boolean}
*/
showOperationControls: boolean;
/**
* This property is used to simply allow the gadget to not show any run/stop controls.
* This is needed because the showOperationControls does something similar but not exactly the same.
* The showOperationControls property allows the gadgetBase to determine if the run control, if the gadget
* uses it, to be displayed when the gadget has a valid configuration.
*
* Default: true - Gadgets without a need for run/stop control should override this value.
* @type {boolean}
*/
gadgetHasOperationControls: boolean;
/**
* Most gadgets need configuration so gadgets that don't can override this property
* @type {boolean}
*/
showConfigurationControl: boolean;
propertyPages: any[];
endpointObject: EndPoint;
errorObject: ErrorObject;
errorExists: boolean;
globalOptions: any;
protected constructor(_gadgetInstanceService: GadgetInstanceService, _propertyService: GadgetPropertyService, changeDetectionRef: ChangeDetectorRef, _optionsService: OptionsService);
ngOnInit(): void;
ngAfterViewInit(): void;
initializeState(): void;
toggleConfigMode(): void;
initializeProperties(): void;
abstract run(): void;
abstract stop(): void;
abstract updateProperties(updatedProperties: any): void;
abstract updateData(data: any[]): void;
abstract preRun(): void;
handleError(error: ErrorObject): void;
initializeRunState(forceRunState: boolean): void;
setInRunState(): void;
setStopState(longRunningStopAction: boolean): void;
remove(): void;
showGadgetControls(enable: boolean): void;
/**
* called from cell.component after the gadget is created during runtime
* intanceId, config, title and endpoint are common to all gadgets. Once the gadgets are configured
* we give them an opportunity to perform an action during the preRun() method. For example,
* the statistic gadget uses preRun() to make a single call to the endpoint to update its display.
* */
configureGadget(instanceId: number, config: any, tags: Array<any>): void;
ngOnDestroy(): void;
updateGadgetWithGlobalOptions(options: any): void;
protected setEndPoint(endpoint: string): void;
protected getEndPoint(): EndPoint;
protected setTitle(title: string): void;
protected getPropFromPropertyPages(prop: string): any;
}