We are using a custom cockpit application which has two widgets one widget will be added under Group level one widget will be added under device level.
I would like to get the group details(Id, name) and device details(Id, name) in my component. I found one option as @Input() config: any = {}; but I am able to access the config object only in config component. In my case I don’t want to use config component. this is my module. Is there any way to get the device and group details directly in widget ?
This enables the device/group selector for your widget, if you add it to a dashboard. The group/device selected will be written to the config object and automatically provided to your component. To get the config in your component you can define following member variable in your component:
@Input() config: { device: { id: string } };
Only the name and id are stored in the config. It will also be stored in the device object, doesn’t matter if it is a group or a device
Looks good to me. Not sure why the config isn’t available in your component.
On which version are you running? Is it a cloned Cockpit application?
Does the device/group selection work properly after you have changed the configuration for your widget?
Maybe some caching issue? Can you clear your cache and try again.