Add partial implementation of adding library sources via editor

This adds lots of commented out code that provides a settings panel
to add new library sources. It is incomplete as it doesn't actually
add/update the library sources on the runtime.

For 1.3, I'm focussing on allowing additional sources get added
via the settings file only. I've done enough work on the editor
side to convince myself more work is needed than I can justify
at this time on what is otherwise not going to be a widely
used feature.
This commit is contained in:
Nick O'Leary
2021-01-22 11:20:28 +00:00
committed by Nick O'Leary
parent 8a076c01ab
commit 3f9a29730f
13 changed files with 393 additions and 39 deletions

View File

@@ -4,8 +4,19 @@
name: "Local File-System Library",
icon: "font-awesome/fa-hdd-o",
defaults: {
name: { value: "" },
path: { value: ""}
path: { value: ""},
// secret: { type: "password" }
}
})
RED.plugins.registerPlugin("node-red-library-dbstore", {
type: "node-red-library-source",
name: "Database Library",
icon: "font-awesome/fa-database",
defaults: {
connection: { value: ""}
}
})
</script>

View File

@@ -1,13 +1,15 @@
module.exports = function(RED) {
const PLUGIN_TYPE_ID = "node-red-library-filestore";
class FileStorePlugin {
constructor(config) {
this.type = PLUGIN_TYPE_ID;
this.id = config.id;
this.name = config.name;
this.config = config;
this.label = config.label;
this.config = config.config;
this.icon = config.icon;
console.log("FileStorePlugin",config)
}
async init() {
@@ -20,13 +22,16 @@ module.exports = function(RED) {
}
async saveEntry(type,path,meta,body) {
console.log("FileStorePlugin.saveLibraryEntry",type,path)
}
}
RED.plugins.registerPlugin("node-red-library-filestore", {
RED.plugins.registerPlugin(PLUGIN_TYPE_ID, {
type: "node-red-library-source",
class: FileStorePlugin
class: FileStorePlugin,
defaults: {
"path": { value: "" },
// "secret": { type: "password" }
}
})
}

View File

@@ -0,0 +1,8 @@
{
"label": {
"path": "Path"
},
"desc": {
"path":"The local file-system path to the library"
}
}