@c8y/ngx-components
Version:
Angular modules for Cumulocity IoT applications
97 lines (93 loc) • 3.44 kB
TypeScript
import { OperationService, IResult, IOperation } from '@c8y/client';
import { AlertService, ActionControl } from '@c8y/ngx-components';
import * as i0 from '@angular/core';
declare const SERVICE_FRAGMENT = "c8y_Service";
declare const SERVICE_COMMANDS_MAP: {
START: {
label: "Start";
command: string;
icon: string;
styleClass: string;
};
STOP: {
label: "Stop";
command: string;
icon: string;
styleClass: string;
};
RESTART: {
label: "Restart";
command: string;
icon: string;
styleClass: string;
};
};
interface Service {
id: string;
name: string;
serviceType: string;
status: string;
c8y_SupportedOperations?: string[];
c8y_SupportedServiceCommands?: string[];
[key: string]: unknown;
}
declare class ServiceCommandService {
private operationService;
private alertService;
constructor(operationService: OperationService, alertService: AlertService);
/**
* Check if the service supports service commands.
* @param service The service object containing supported operations.
* @returns boolean indicating if the service supports service commands.
*/
isServiceCommandSupported(service: Service): boolean;
/**
* Get the list of supported service commands for the given service object.
* @param service The service object containing the c8y_SupportedServiceCommands fragment.
* @returns Array of supported commands.
*/
getSupportedCommands(service: Service): string[];
/**
* Check if a specific command is supported for the given service.
* @param service The service object.
* @param command The command to check (e.g., START, STOP).
* @returns boolean indicating if the command is supported.
*/
isCommandSupported(service: Service, command: string): boolean;
/**
* Get all supported commands for a list of services.
* @param services The list of service objects to evaluate.
* @returns Array of all unique supported commands.
*/
getAllSupportedCommands(services: Service[]): string[];
/**
* Create an operation for the selected service command.
* @param service The service object the operation should target.
* @param command The command to execute (e.g., START, STOP).
* @returns Promise of the created operation.
*/
createOperation({ id, name, serviceType }: Service, command: string): Promise<IResult<IOperation>>;
/**
* Generate a static list of action controls.
* The specific logic for each service is handled dynamically in showIf and callback.
* @returns Array of ActionControl objects.
*/
generateActionControls(commands: string[]): ActionControl[];
/**
* Get the icon for a specific command.
* @param command The command name.
* @returns Icon string for the command.
*/
private getCommandIcon;
/**
* Get the icon class for a specific command.
* @param command The command name.
* @returns Icon class string for the command.
*/
private getCommandIconClass;
static ɵfac: i0.ɵɵFactoryDeclaration<ServiceCommandService, never>;
static ɵprov: i0.ɵɵInjectableDeclaration<ServiceCommandService>;
}
export { SERVICE_COMMANDS_MAP, SERVICE_FRAGMENT, ServiceCommandService };
export type { Service };
//# sourceMappingURL=index.d.ts.map