@c8y/ngx-components
Version:
Angular modules for Cumulocity IoT applications
63 lines • 2.49 kB
TypeScript
import type { IManagedObject } from '@c8y/client';
import { SupportedIconsSuggestions } from '@c8y/ngx-components/icon-selector/icons';
/**
* Global namespace declaration to enhance type safety for extension keys and associated service types.
* Extend the `ExtensionKeys` interface within this namespace to declare new extension keys and their service types.
*
* @example
* ```typescript
* // Extending the CumulocityServiceRegistry with a new service
* declare global {
* namespace CumulocityServiceRegistry {
* interface ExtensionKeys {
* layersServiceKey: TestService;
* }
*
* interface TestService {
* getLayers(): Promise<string[]>;
* }
* }
* }
* ```
*/
declare global {
/**
* Global namespace declaration to enhance type safety for extension keys and associated service types of the `ServiceRegistry`.
*/
namespace CumulocityServiceRegistry {
/**
* Holds the association between extension keys and their corresponding service types.
* Extend this interface to declare new extension keys and their service types.
*/
interface ExtensionKeys extends SpecificExtensionKeys {
[key: string]: unknown;
}
interface SpecificExtensionKeys {
additionalDeviceStatusButtons: AdditionalDeviceStatusButtonProvider;
}
/**
* Defines a provider for additional device status buttons.
* TODO to be removed when DeviceStatusWidget is migrated to Angular
*/
interface AdditionalDeviceStatusButtonProvider {
/**
* Determines whether the button should be shown for a given device.
* @param device The device for which to determine button visibility.
* @returns A boolean value indicating whether the button should be displayed.
*/
canShowButton(device: IManagedObject): boolean;
/**
* Provides the properties necessary to render the button.
* @returns An object containing the button's title, icon, label, click action and optionally a class.
*/
getButtonInfo(): {
title: string;
icon: SupportedIconsSuggestions;
label: string;
class?: string;
action: (device: IManagedObject) => void | Promise<void>;
};
}
}
}
//# sourceMappingURL=service-registry.model.d.ts.map