diff --git a/htdocs/js/pages/admin/Plugins.js b/htdocs/js/pages/admin/Plugins.js
index 88edf92..1b2cf90 100644
--- a/htdocs/js/pages/admin/Plugins.js
+++ b/htdocs/js/pages/admin/Plugins.js
@@ -78,6 +78,8 @@ Class.add( Page.Admin, {
html += '
';
html += '';
html += ' Add New Plugin... | ';
+ html += ' | '
+ html += ' from JSON | ';
html += '
';
html += ''; // padding
@@ -97,6 +99,62 @@ Class.add( Page.Admin, {
this.plugin = this.plugins[idx];
this.show_delete_plugin_dialog();
},
+
+ setImportEditor: function() {
+
+ let editor = CodeMirror.fromTextArea(document.getElementById("plugin_import"), {
+ mode: 'application/json',
+ styleActiveLine: true,
+ lineWrapping: false,
+ scrollbarStyle: "overlay",
+ lineNumbers: false,
+ theme: app.getPref('theme') == 'dark' ? 'gruvbox-dark' : 'default',
+ matchBrackets: true,
+ gutters: [''],
+ lint: true
+ })
+
+ editor.on('change', function(cm){
+ document.getElementById("plugin_import").value = cm.getValue();
+ });
+
+ editor.setSize('52vw', '52vh')
+
+ },
+
+ import_plugin: function (args) {
+
+ const self = this;
+
+ setTimeout(() => self.setImportEditor(), 30)
+ app.confirm(`Import Plugin from JSON
+
+ `, '', "Import", function (result) {
+ if (result) {
+ var importData = document.getElementById('plugin_import').value;
+ let plugin;
+ try { plugin = JSON.parse(importData)
+ } catch (e) {
+ return app.doError("Invalid JSON: " + e.message)
+ }
+ delete plugin.id
+ app.showProgress(1.0, "Importing...");
+ app.api.post('app/create_plugin', plugin, function (resp) {
+ app.hideProgress();
+
+ report = `Plugin ${resp.id} created`
+
+ setTimeout(function () {
+ Nav.go('#Admin?sub=plugins', 'force');
+ app.show_info(``, '');
+
+ }, 50);
+
+ });
+ }
+ });
+ },
+
show_delete_plugin_dialog: function() {
// delete selected plugin
@@ -166,7 +224,7 @@ Class.add( Page.Admin, {
html += 'Cancel | ';
html += ' | ';
html += ' Create Plugin | ';
- html += '';
+ html += '';
html += '';
html += '';
diff --git a/htdocs/js/pages/admin/Servers.js b/htdocs/js/pages/admin/Servers.js
index be1a078..7deb2ea 100644
--- a/htdocs/js/pages/admin/Servers.js
+++ b/htdocs/js/pages/admin/Servers.js
@@ -29,7 +29,7 @@ Class.add( Page.Admin, {
// Active Server Cluster
- var cols = ['Hostname', 'IP Address', 'PID', 'Node', 'Groups', 'Status', 'Active Jobs', 'Uptime', 'CPU', 'Mem', 'Actions'];
+ var cols = ['Hostname', 'IP Address', 'PID', 'Node', 'Engine', 'Groups', 'Status', 'Active Jobs', 'Uptime', 'CPU', 'Mem', 'Actions'];
html += '';
html += 'Server Cluster';
@@ -108,6 +108,7 @@ Class.add( Page.Admin, {
(server.ip || 'n/a').replace(/^\:\:ffff\:(\d+\.\d+\.\d+\.\d+)$/, '$1'),
server.pid,
server.nodev,
+ server.engine || '',
group_names.length ? group_names.join(', ') : '(None)',
server.manager ? ' Manager' : (eligible ? 'Backup' : 'Worker'),
num_jobs ? commify( num_jobs ) : '(None)',