Permalink
Browse files

Carry on uploading after repository switch

Rework progress bar
  • Loading branch information...
1 parent 717b94e commit 2fa8ad0282be40fbd28ae5fff5efd98366eaa369 @cdujeu cdujeu committed Sep 18, 2016
@@ -323,13 +323,16 @@ class PydioApi{
}
- applyCheckHook(node, hookName, hookArg, completeCallback){
+ applyCheckHook(node, hookName, hookArg, completeCallback, additionalParams){
var params = {
get_action : "apply_check_hook",
file : node.getPath(),
hook_name : hookName,
hook_arg : hookArg
};
+ if(additionalParams){
+ params = LangUtils.objectMerge(params, additionalParams);
+ }
this.request(params, completeCallback, null, {async:false});
}
@@ -685,13 +685,13 @@ class PydioDataModel extends Observable{
}
- applyCheckHook (node){
- "use strict";
+ applyCheckHook (node, additionalParams = null){
+
var client = PydioApi.getClient();
var result;
client.applyCheckHook(node, "before_create", node.getMetadata().get("filesize") || -1, function(transport){
result = client.parseXmlMessage(transport.responseXML);
- });
+ }, additionalParams);
if(result === false){
throw new Error("Check failed");
}
Oops, something went wrong.
@@ -124,7 +124,7 @@ div#upload_files_list{
border: 1px solid rgba(0,0,0,0.13);
- div {
+ > div {
.dotted_container_item_mixin();
&.header{
padding: 8px 14px;
@@ -149,7 +149,15 @@ div#upload_files_list{
display: inline-block;
margin: 4px 10px;
}
-
+ div.uploader-pgbar{
+ position: absolute;
+ bottom: 0;
+ left: 0;
+ background-color: @primary-1-color;
+ height: 2px;
+ width: 0;
+ transition: all 550ms cubic-bezier(0.23, 1, 0.32, 1) 0ms;
+ }
}
span.item_relative_path{
@@ -2114,7 +2114,7 @@ div#total_files_list {
div#upload_files_list {
border: 1px solid rgba(0, 0, 0, 0.13);
}
-div#upload_files_list div {
+div#upload_files_list > div {
overflow: hidden;
padding: 16px 14px;
height: 20px;
@@ -2127,34 +2127,43 @@ div#upload_files_list div {
border-bottom: 1px solid rgba(0, 0, 0, 0.05);
color: rgba(0, 0, 0, 0.87);
}
-div#upload_files_list div rect {
+div#upload_files_list > div rect {
fill: #ffffff;
}
-div#upload_files_list div.header {
+div#upload_files_list > div.header {
padding: 8px 14px;
font-weight: 500;
font-size: 13px;
color: #636e75;
border-bottom: 0;
}
-div#upload_files_list div span.mdi.mdi-file,
-div#upload_files_list div span.mdi.mdi-folder {
+div#upload_files_list > div span.mdi.mdi-file,
+div#upload_files_list > div span.mdi.mdi-folder {
margin: 0 8px 0 0;
}
-div#upload_files_list div span.status,
-div#upload_files_list div span.path {
+div#upload_files_list > div span.status,
+div#upload_files_list > div span.path {
font-size: 11px;
display: inline-block;
margin: 0 6px;
color: rgba(0, 0, 0, 0.53);
}
-div#upload_files_list div span.stop-button {
+div#upload_files_list > div span.stop-button {
cursor: pointer;
color: #6b7781;
float: right;
display: inline-block;
margin: 4px 10px;
}
+div#upload_files_list > div div.uploader-pgbar {
+ position: absolute;
+ bottom: 0;
+ left: 0;
+ background-color: #009688;
+ height: 2px;
+ width: 0;
+ transition: all 550ms cubic-bezier(0.23, 1, 0.32, 1) 0ms;
+}
div#upload_files_list span.item_relative_path {
color: #5f5f5f;
margin-left: 15px;
@@ -66,6 +66,8 @@
if(this._relativePath) {
fullPath += PathUtils.getDirname(this._relativePath);
}
+ let currentRepo = global.pydio.user.activeRepository;
+
let queryString = '&get_action=upload&xhr_uploader=true&dir=' + encodeURIComponent(fullPath);
let dataModel = global.pydio.getContextHolder();
@@ -75,20 +77,27 @@
newNode.getMetadata().set("filesize", this._file.size);
}
try{
- dataModel.applyCheckHook(newNode);
+ let params = null;
+ if(currentRepo !== this._repositoryId) {
+ params = {tmp_repository_id:this._repositoryId};
+ }
+ dataModel.applyCheckHook(newNode, params);
}catch(e){
throw new Error('Error while checking before uploads');
}
let overwriteStatus = UploaderConfigs.getInstance().getOption("DEFAULT_EXISTING", "upload_existing");
if(overwriteStatus === 'rename'){
queryString += '&auto_rename=true';
- }else if(overwriteStatus === 'alert' && !this._relativePath){
+ }else if(overwriteStatus === 'alert' && !this._relativePath && currentRepo === this._repositoryId){
if(dataModel.fileNameExists(nodeName, false, this._targetNode)){
if(!global.confirm(MessageHash[124])){
throw new Error('File already exists');
}
}
}
+ if(currentRepo !== this._repositoryId){
+ queryString += '&tmp_repository_id=' + this._repositoryId;
+ }
return queryString;
}
_doProcess(completeCallback){
@@ -252,6 +261,7 @@
if(this.getAutoStart() && !this._processing.length) {
this.processNext();
} // Autostart with queue was empty before
+ UploadTask.getInstance().setRunning(this.getQueueSize());
this.notify('update');
}
pushFile(uploadItem){
@@ -263,6 +273,7 @@
if(this.getAutoStart() && !this._processing.length) {
this.processNext();
} // Autostart with queue was empty before
+ UploadTask.getInstance().setRunning(this.getQueueSize());
this.notify('update');
}
log(){
@@ -136,14 +136,15 @@
var relativeMessage = <span className="path">{this.props.item.getRelativePath()}</span>;
}
if(this.state && this.state.progress){
- style = {backgroundSize: this.state.progress + '% 100%'};
+ style = {width: this.state.progress + '%'};
}
return (
- <div style={style} className="file-row">
+ <div className="file-row">
<span className="mdi mdi-file"/> {this.props.item.getFile().name}
{relativeMessage}
<span className="status">{statusMessage}</span>
{stopButton}
+ <div className="uploader-pgbar" style={style}/>
</div>
);
}
@@ -192,20 +193,18 @@
}
items.sort(function(a, b){
let aType = a instanceof UploaderModel.FolderItem? 'folder' : 'file';
- let aString = a.getLabel();
let bType = b instanceof UploaderModel.FolderItem? 'folder' : 'file';
- let bString = b.getLabel();
if(aType === bType){
- return aString.localeCompare(bString);
+ return 0;
}else{
return aType === 'folder' ? -1 : 1;
}
});
items.forEach(function(f){
if(f instanceof UploaderModel.FolderItem){
- accumulator.push( <TransferFolder item={f} /> );
+ accumulator.push( <TransferFolder key={f.getLabel()} item={f} /> );
}else{
- accumulator.push( <TransferFile item={f} /> );
+ accumulator.push( <TransferFile key={f.getLabel()} item={f} /> );
}
});
},

0 comments on commit 2fa8ad0

Please sign in to comment.