Correctly migrate duplicate clusters in workspaces (#3211)

- Keep track of the set of all workspaces that each duplicated entry was
  a part of

Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
Sebastian Malton authored and GitHub committed 2021-07-02 14:21:04 +03:00
1 parent b00afee15c
commit 05311c4b1b
4 files changed
+38 -11

No files matched your search

+12 -9
View File
@@ -71,17 +71,20 @@ export default {
for (const cluster of clusters) {
const uid = generateNewIdFor(cluster);
const workspaceHotbar = workspaceHotbars.get(cluster.workspace);
migrationLog(`Adding cluster ${uid} to ${workspaceHotbar.name}`);
for (const workspaceId of cluster.workspaces ?? [cluster.workspace].filter(Boolean)) {
const workspaceHotbar = workspaceHotbars.get(workspaceId);
if (workspaceHotbar?.items.length < defaultHotbarCells) {
workspaceHotbar.items.push({
entity: {
uid: generateNewIdFor(cluster),
name: cluster.preferences.clusterName || cluster.contextName,
}
});
migrationLog(`Adding cluster ${uid} to ${workspaceHotbar.name}`);
if (workspaceHotbar?.items.length < defaultHotbarCells) {
workspaceHotbar.items.push({
entity: {
uid: generateNewIdFor(cluster),
name: cluster.preferences.clusterName || cluster.contextName,
}
});
}
}
}