').appendTo(uploadToolbar);
+ var uploadFilename = $('
').appendTo(uploadForm);
+ var uploadFilenameLabel = $('
').appendTo(uploadFilename);
+ var uploadButtons = $('
').appendTo(uploadForm);
+ $('
').text(RED._("common.label.cancel")).appendTo(uploadButtons).on("click", function(evt) {
+ evt.preventDefault();
+ uploadToolbar.slideUp(200);
+ uploadInput.val("");
+ });
+ $('
').text(RED._("common.label.upload")).appendTo(uploadButtons).on("click", function(evt) {
+ evt.preventDefault();
+
+ var spinner = RED.utils.addSpinnerOverlay(uploadToolbar, true);
+ var buttonRow = $('
').appendTo(spinner);
+ $('
').text(RED._("eventLog.view")).appendTo(buttonRow).on("click", function(evt) {
+ evt.preventDefault();
+ RED.actions.invoke("core:show-event-log");
+ });
+ RED.eventLog.startEvent(RED._("palette.editor.confirm.button.install")+" : "+uploadInput[0].files[0].name);
+
+ var data = new FormData();
+ data.append("tarball",uploadInput[0].files[0]);
+ var filename = uploadInput[0].files[0].name;
+ $.ajax({
+ url: 'nodes',
+ data: data,
+ cache: false,
+ contentType: false,
+ processData: false,
+ method: 'POST',
+ }).always(function(data,textStatus,xhr) {
+ spinner.remove();
+ uploadInput.val("");
+ uploadToolbar.slideUp(200);
+ }).fail(function(xhr,textStatus,err) {
+ var message = textStatus;
+ if (xhr.responseJSON) {
+ message = xhr.responseJSON.message;
+ }
+ var notification = RED.notify(RED._('palette.editor.errors.installFailed',{module: filename,message:message}),{
+ type: 'error',
+ modal: true,
+ fixed: true,
+ buttons: [
+ {
+ text: RED._("common.label.close"),
+ click: function() {
+ notification.close();
+ }
+ },{
+ text: RED._("eventLog.view"),
+ click: function() {
+ notification.close();
+ RED.actions.invoke("core:show-event-log");
+ }
+ }
+ ]
+ });
+ uploadInput.val("");
+ uploadToolbar.slideUp(200);
+ })
+ })
+ RED.popover.tooltip(uploadButton,RED._("palette.editor.upload"));
+ }
+
$('
').appendTo(installTab);
}
+
function update(entry,version,url,container,done) {
if (RED.settings.theme('palette.editable') === false) {
done(new Error('Palette not editable'));
diff --git a/packages/node_modules/@node-red/editor-client/src/sass/palette-editor.scss b/packages/node_modules/@node-red/editor-client/src/sass/palette-editor.scss
index 7e167e4a4..7ed9bc7e4 100644
--- a/packages/node_modules/@node-red/editor-client/src/sass/palette-editor.scss
+++ b/packages/node_modules/@node-red/editor-client/src/sass/palette-editor.scss
@@ -237,3 +237,41 @@ ul.red-ui-palette-module-error-list {
#red-ui-palette-module-install-shade {
padding-top: 80px;
}
+button.red-ui-palette-editor-upload-button {
+ padding: 0;
+ height: 25px;
+ margin-top: -1px;
+
+ input[type="file"] {
+ opacity: 0;
+ margin: 0;
+ height: 0;
+ width: 0;
+ }
+ .red-ui-settings-tabs-content & label {
+ margin: 0;
+ min-width: 0;
+ padding: 2px 8px;
+ }
+}
+.red-ui-palette-editor-upload {
+ display: none;
+ position: absolute;
+ left: 0;
+ right: 0;
+ top: 44px;
+ padding: 20px;
+ background: $secondary-background;
+ border-bottom: 1px $secondary-border-color solid;
+ box-shadow: 1px 1px 4px $shadow;
+
+ .placeholder-input {
+ width: calc(100% - 180px);
+ }
+}
+.red-ui-palette-editor-upload-buttons {
+ float: right;
+ button {
+ margin-left: 10px;
+ }
+}
\ No newline at end of file