Product/components used and version/fix level:
1018
Detailed explanation of the problem:
Hey guys
I want to create hundreds of new groups → add devices into the groups. Moreover, I have a table which tells me which dashboard i need to copy for the newly created group. I have the managed object id of the existing dashboard.
How can I replicate the copy dashboard functionality in my MS?
I tried copying the c8y_Dashboard fragment from the existing dashboard but then this contains the group id and the device id (from the original dashboard), which I can replace. This seems to be a cumbersome approach. Is there a better way to do this?
Seems to be they way to do it. You can check the sources here
A Cumulocity webapp to migrate applications, dashboards, groups, devices, simulators, smart rules, images, and managed objects between tenants. Developed by Global Presales. - GitHub - SoftwareAG/...
for (let otherManagedObjectMigration of otherMigrations) {
if (otherManagedObjectMigration.updateExisting) {
// TODO implement update mechanism
} else {
this.log$.next(MigrationLogEvent.verbose(`Migrating: ${otherManagedObjectMigration.managedObject.id} - Creating new Managed Object.`));
let managedObjectToMigrate = this.otherManagedObjectMigrationToManagedObject(otherManagedObjectMigration, oldIdsToNewIds);
oldIdsToNewIds.set(otherManagedObjectMigration.managedObject.id.toString(), await this.destinationClient.createManagedObject(managedObjectToMigrate));
}
}
// Migrate the dashboards
this.log$.next(MigrationLogEvent.info("Migrating Dashboards..."));
for (let dashboardMigration of dashboardMigrations) {
if (dashboardMigration.updateExisting) {
this.log$.next(MigrationLogEvent.verbose(`Migrating: ${dashboardMigration.managedObject.id} - Updating existing dashboard: ${dashboardMigration.updateExisting.id}.`));
const db = this.dashboardMigrationToManagedObject(dashboardMigration, new Map(oldIdsToNewIds));
db.id = dashboardMigration.updateExisting.id;
oldIdsToNewIds.set(dashboardMigration.managedObject.id.toString(), await this.destinationClient.updateManagedObject(db));
} else {
this.log$.next(MigrationLogEvent.verbose(`Migrating: ${dashboardMigration.managedObject.id} - Creating new dashboard.`));
dashboardMigration.updateExisting = this.dashboardMigrationToManagedObject(dashboardMigration, oldIdsToNewIds);
system
(system)
Closed
July 28, 2024, 3:19pm
3
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.