Skip to content

Commit

Permalink
Fix uploading file
Browse files Browse the repository at this point in the history
  • Loading branch information
yuriiNazarenkoTine committed Mar 31, 2024
1 parent 9e8115d commit 0db8f64
Showing 1 changed file with 8 additions and 14 deletions.
22 changes: 8 additions & 14 deletions src/app/rr-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,11 +141,6 @@ Ext.define("SYNOCOMMUNITY.RRManager.Overview.Main", {
}
})();
},
opts: {
params: {
path: ""
}
},
getUpdateFileInfo: function (file) {
return new Promise((resolve, reject) => {
Ext.Ajax.request({
Expand Down Expand Up @@ -273,10 +268,7 @@ Ext.define("SYNOCOMMUNITY.RRManager.Overview.Main", {
var configName = 'rrConfig';
that[configName] = responseText;
localStorage.setItem(configName, JSON.stringify(responseText));
//populate rr config path
that['rrManagerConfig'] = that[configName]['rr_manager_config'];
this.opts.params.path = `/${that['rrManagerConfig']['SHARE_NAME']}/${that['rrManagerConfig']['RR_TMP_DIR']}`;
} catch (e) {
} catch (e) {
SYNO.Debug(e);
} finally {
this.owner.clearStatusBusy();
Expand Down Expand Up @@ -452,15 +444,14 @@ Ext.define("SYNOCOMMUNITY.RRManager.Overview.HealthPanel", {
}
else
e.append("size", t.size),
t.name ? e.append(this.opts.filefiledname, t, this.opts.params.fileName) : e.append(this.opts.filefiledname, t.file),
t.name ? e.append(this.opts.filefiledname, t, this.opts.params.filename) : e.append(this.opts.filefiledname, t.file),
n = e;
this.conn = new Ext.data.Connection({
method: 'POST',
url: `${this._baseUrl}api=SYNO.FileStation.Upload&method=upload&version=2&SynoToken=${localStorage['SynoToken']}`,
defaultHeaders: l,
timeout: null
});
// var tabs = Ext.getCmp('tabsControl');
var m = this.conn.request({
headers: s,
html5upload: !0,
Expand Down Expand Up @@ -491,7 +482,11 @@ Ext.define("SYNOCOMMUNITY.RRManager.Overview.HealthPanel", {
that.showMsg("title", "Error file uploading.");
console.log(x);
},
progress: (x) => { },
progress: (x) => {
//TODO: use fix indicate progress
// const percentage = ((x.loaded / x.total) * 100).toFixed(2);
// that.owner.getEl().mask(`${_T("common", "loading")}. Completed: ${percentage}`, "x-mask-loading");
},
});
}
},
Expand Down Expand Up @@ -547,14 +542,13 @@ Ext.define("SYNOCOMMUNITY.RRManager.Overview.HealthPanel", {
var rrConfigJson = localStorage.getItem('rrConfig');
var rrConfig = JSON.parse(rrConfigJson);
var rrManagerConfig = rrConfig.rr_manager_config;

this.opts.params.path = `/${rrManagerConfig.SHARE_NAME}/${rrManagerConfig.RR_TMP_DIR}`;
//create rr tmp folder
SYNO.API.currentManager.requestAPI('SYNO.FileStation.CreateFolder', "create", "2", {
folder_path: `/${rrManagerConfig.SHARE_NAME}`,
name: rrManagerConfig.RR_TMP_DIR,
force_parent: false
});
//rename file to update.zip
e = new File([e], this.opts.params.filename);
var t, i = !1;
if (-1 !== this.MAX_POST_FILESIZE && e.size > this.MAX_POST_FILESIZE && i)
Expand Down

0 comments on commit 0db8f64

Please sign in to comment.