Skip to content

Commit

Permalink
feat(migrations): Add config nodes to mass update
Browse files Browse the repository at this point in the history
  • Loading branch information
zachowj committed Mar 9, 2021
1 parent f971856 commit 5d23126
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
4 changes: 2 additions & 2 deletions locales/en-US/common.json
Expand Up @@ -7,8 +7,8 @@
"migrations": {
"node_schema_updated": "Node schema has been updated",
"all_nodes_updated": "Home Assistant nodes have been updated. Deploy to save changes.",
"message": "This will update all Home Assistant nodes to the current schema. It is not required for the nodes to function.\nNodes with yellow labels need to be updated before they can be edited. This can be done by either opening each node individually in the Node-RED editor or running this command.",
"warning": "It is recommended to backup your flows.json file before doing an update of all Home Assistant nodes.",
"message": "This will update all Home Assistant nodes to the current schema. This is not required for the nodes to function.\nNodes with yellow labels need to be updated before they can be edited. This can be done by either opening each node individually in the Node-RED editor or running this command.",
"warning": "It is recommended to back up your flows before doing an update of all Home Assistant nodes.",
"title": "Update Home Assistant Nodes",
"button_label": "Update Home Assistant Nodes",
"button_ok": "Update Nodes",
Expand Down
10 changes: 10 additions & 0 deletions ui/shared/nodeversion.js
Expand Up @@ -62,6 +62,11 @@ const nodeVersion = (function ($, RED, haMigrations) {
migrate(node);
}
});
RED.nodes.eachConfig((node) => {
if (isHomeAssistantNode(node) && !isCurrentVersion(node)) {
migrate(node);
}
});
RED.nodes.dirty(true);
RED.notify(ha.i18n('home-assistant.ui.migrations.all_nodes_updated'));
RED.view.redraw();
Expand Down Expand Up @@ -123,6 +128,11 @@ const nodeVersion = (function ($, RED, haMigrations) {
count++;
}
});
RED.nodes.eachConfig((n) => {
if (isHomeAssistantNode(n) && !isCurrentVersion(n)) {
count++;
}
});

return count;
}
Expand Down

0 comments on commit 5d23126

Please sign in to comment.