Commit c4616bac authored by Dietmar Maurer's avatar Dietmar Maurer

improve upload error messages

parent b60844dd
...@@ -19,7 +19,7 @@ Ext.define('PVE.storage.Upload', { ...@@ -19,7 +19,7 @@ Ext.define('PVE.storage.Upload', {
throw "no storage ID specified"; throw "no storage ID specified";
} }
var url = "/api2/htmljs/nodes/" + me.nodename + "/storage/" + me.storage + "/upload"; var baseurl = "/nodes/" + me.nodename + "/storage/" + me.storage + "/upload";
var pbar = Ext.create('Ext.ProgressBar', { var pbar = Ext.create('Ext.ProgressBar', {
text: 'Ready', text: 'Ready',
...@@ -27,7 +27,6 @@ Ext.define('PVE.storage.Upload', { ...@@ -27,7 +27,6 @@ Ext.define('PVE.storage.Upload', {
}); });
me.formPanel = Ext.create('Ext.form.Panel', { me.formPanel = Ext.create('Ext.form.Panel', {
url: url,
method: 'POST', method: 'POST',
waitMsgTarget: true, waitMsgTarget: true,
bodyPadding: 10, bodyPadding: 10,
...@@ -64,7 +63,7 @@ Ext.define('PVE.storage.Upload', { ...@@ -64,7 +63,7 @@ Ext.define('PVE.storage.Upload', {
var doStandardSubmit = function() { var doStandardSubmit = function() {
form.submit({ form.submit({
url: me.url, url: "/api2/htmljs" + baseurl,
waitMsg: 'Uploading file...', waitMsg: 'Uploading file...',
success: function(f, action) { success: function(f, action) {
me.close(); me.close();
...@@ -124,7 +123,7 @@ Ext.define('PVE.storage.Upload', { ...@@ -124,7 +123,7 @@ Ext.define('PVE.storage.Upload', {
if (xhr.status == 200) { if (xhr.status == 200) {
me.close(); me.close();
} else { } else {
var msg = "Error " + xhr.status + " occurred uploading your file."; var msg = "Error " + xhr.status + ": " + Ext.htmlEncode(xhr.statusText);
Ext.Msg.alert('Upload failed', msg, function(btn) { Ext.Msg.alert('Upload failed', msg, function(btn) {
me.close(); me.close();
}); });
...@@ -146,7 +145,7 @@ Ext.define('PVE.storage.Upload', { ...@@ -146,7 +145,7 @@ Ext.define('PVE.storage.Upload', {
} }
}, false); }, false);
xhr.open("POST", url); xhr.open("POST", "/api2/json" + baseurl, true);
xhr.send(fd); xhr.send(fd);
} }
}); });
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment