Thanks for the update Tristan. Apologies for the late reply. We did not get chance incorporate the change the icon which you suggested since they are okay with the current icon of the device. So that’s why we did not find the setLabel() function.
By extending we can rename the groups below as you said. I have one basic question. do I need to pass all this services as dependencies( InventoryService, ApiService etc) ? for changing the name group name. I tried by removing some dependencies it is breaking somewhere. So just thought to double check.
import { Inject, Injectable, Optional } from "@angular/core";
import { InventoryService, UserService } from "@c8y/client";
import {
AlertService,
AppStateService,
BreadcrumbService,
ModalService,
NavigatorNodeData,
OptionsService,
} from "@c8y/ngx-components";
import { ApiService } from "@c8y/ngx-components/api";
import {
ASSET_NAVIGATOR_CONFIG,
AssetNavigatorConfig,
AssetNode,
AssetNodeService,
DeviceGroupService,
} from "@c8y/ngx-components/assets-navigator";
class CustomAssetNode extends AssetNode {
constructor(service: AssetNodeService, config?: NavigatorNodeData) {
super(service, config);
}
setLabel() {
if(this.root) {
this.label = "My custom Name";
} else {
super.setLabel();
}
}
}
@Injectable()
export class CustomAssetNodeService extends AssetNodeService {
constructor(
inventory: InventoryService,
apiService: ApiService,
modal: ModalService,
alert: AlertService,
breadcrumbService: BreadcrumbService,
user: UserService,
appState: AppStateService,
optionsService: OptionsService,
@Optional() @Inject(ASSET_NAVIGATOR_CONFIG) moduleConfig: AssetNavigatorConfig,
deviceGroupService: DeviceGroupService
) {
super(
inventory,
apiService,
modal,
alert,
breadcrumbService,
user,
appState,
optionsService,
moduleConfig,
deviceGroupService
);
}
createAssetNode(config: Partial<AssetNode>): AssetNode {
return new CustomAssetNode(this, config);
}
}