diff --git a/generators/comment_log.js b/generators/comment_log.js new file mode 100644 index 0000000..8179d8a --- /dev/null +++ b/generators/comment_log.js @@ -0,0 +1,17 @@ +//Add Comment Node +const utils = require('../utils') + + module.exports = function () { + const comment_id = utils.generateId() + const commentNode = { + "id": comment_id, + "type": "comment", + "z": "", + "name": "Dashboard 1.0 to 2.0 - Migration Log", + "info": "", + "x": 10, + "y": 100, + "wires": [] + } + return commentNode + } diff --git a/generators/index.js b/generators/index.js index 7443563..8716612 100644 --- a/generators/index.js +++ b/generators/index.js @@ -1,4 +1,5 @@ module.exports = { generateUiTheme: require('./ui-theme'), - generateUiBase: require('./ui-base') + generateUiBase: require('./ui-base'), + generateCommentLog: require('./comment_log') } diff --git a/index.js b/index.js index 60567b2..7b6c191 100644 --- a/index.js +++ b/index.js @@ -9,6 +9,10 @@ const MigrateDashboard = { const idMap = {} // map old IDs to new IDs so that we can update references to them const migratedFlow = [] + + const comment_log = generators.generateCommentLog(); + + let comment_string = "This is the comment log for the Node-Red Migration Page. As a rule of thumb, any node type that is listed in the README as \"Not Yet Supported\" could use help in migrating over. For more details please head to the [Github](https://github.com/FlowFuse/node-red-dashboard-2-migration) to help contribute. \n Any 1.0 nodes unable to successfully migrate are kept in the flow, but disabled, to enable manual updating of the nodes. \n The following nodes were unable to automatically migrate: \n" // generate nodes we know D1.0 doesn't provide const base = generators.generateUiBase() @@ -37,6 +41,9 @@ const MigrateDashboard = { if (node.type.startsWith('ui_')) { // Unsupported UI node types, disable them console.log('Unable to automatically migrate ' + node.type + ' nodes currently. Disabling the node.') + // Develop String that will be added to Comment. + let log_string = " - "+node.name+' Type:'+node.type + "\n" + comment_string = comment_string + log_string node.d = true } @@ -44,6 +51,10 @@ const MigrateDashboard = { // Not a Dashboard 1.0 node, we can just return it as is migratedFlow.push(node) }) + + //Add Log to Comment Node then Node to flow. + comment_log.info = comment_string + migratedFlow.push(comment_log) // work smart, not hard let strJson = JSON.stringify(migratedFlow)