Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions generators/comment_log.js
Original file line number Diff line number Diff line change
@@ -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
}
3 changes: 2 additions & 1 deletion generators/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
module.exports = {
generateUiTheme: require('./ui-theme'),
generateUiBase: require('./ui-base')
generateUiBase: require('./ui-base'),
generateCommentLog: require('./comment_log')
}
11 changes: 11 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -37,13 +41,20 @@ 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
}

// We don't have any particular migration logic for this node type
// 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)
Expand Down