UNPKG

@c8y/ngx-components

Version:

Angular modules for Cumulocity IoT applications

87 lines 2.76 kB
import { IExternalIdentity, IManagedObject } from '@c8y/client'; import { SupportedIconsSuggestions } from '@c8y/ngx-components/icon-selector/icons'; import { Observable } from 'rxjs'; export interface ReplaceDeviceContext { deviceToReplace: IManagedObject; replacementDevice: IManagedObject; replacementDeviceId: string; newExternalIds: IExternalIdentity[]; oldExternalIds: IExternalIdentity[]; deleteReplacedDeviceOwner: boolean; time: string; skip?: boolean; } export interface Error { text: string; detailedData?: string | { status: string; statusText: string; }; } /** * Declares an execution step in the device replacement flow. */ export interface ReplaceDeviceStep { /** * Label to be used in the replace device wizard UI. */ label: string; /** * Step implementation. */ action: (context: ReplaceDeviceContext) => Observable<unknown> | Promise<unknown>; /** * Defines if the result from step execution should be passed to the next step in the flow. */ overrideContext?: boolean; info?: StepInfo; /** * Current execution state of the step. */ state?: ReplaceDeviceStepState; /** * Error occured during step execution. */ error?: Error; /** * !Internal use only! Flag to skip step execution, used to control retrial. */ skip?: boolean; /** * !Internal use only! Stores the context the step was initially executed with. */ context?: ReplaceDeviceContext; /** * !Internal use only! Context to be used for step re-trial. */ seed?: ReplaceDeviceContext; } /** * Allows to display an info popover for a particular step. */ export interface StepInfo { /** * Message that will be displayed as a popover for the given step. */ msg?: string | undefined; /** * A function that will be executed */ getMessage?: (context: ReplaceDeviceContext, step: ReplaceDeviceStep) => string | undefined; } declare const REPLACE_DEVICE_STEP_STATES: readonly ["Pending", "Executing", "Skipped", "Failed", "Successful"]; export type ReplaceDeviceStepState = (typeof REPLACE_DEVICE_STEP_STATES)[number]; export declare function isValidReplaceDeviceStepState(state: unknown): state is ReplaceDeviceStepState; export declare const REPLACE_DEVICE_STEP_STATE: { [key: string]: ReplaceDeviceStepState; }; export interface State { icon?: SupportedIconsSuggestions; styleClass?: string; } export type ReplaceDeviceStepStatesMap = { [key in ReplaceDeviceStepState]?: State; }; export declare const REPLACE_DEVICE_STEP_STATES_MAP: ReplaceDeviceStepStatesMap; export {}; //# sourceMappingURL=replace-device-wizard.model.d.ts.map