mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-03-04 10:11:26 +01:00
Filemanager: Fix some weirdness with Et2File upload
This commit is contained in:
parent
69789d0a17
commit
8a8f283bc6
@ -362,13 +362,14 @@ export class Et2File extends Et2InputWidget(LitElement)
|
||||
else
|
||||
{
|
||||
const ev = new CustomEvent("et2-load", {bubbles: true, detail: file});
|
||||
this.dispatchEvent(ev);
|
||||
Object.keys(response).forEach((tempName) =>
|
||||
{
|
||||
if(fileItem)
|
||||
{
|
||||
fileItem.variant = "success";
|
||||
}
|
||||
file['tempName'] = tempName;
|
||||
this.dispatchEvent(ev);
|
||||
|
||||
// Add file into value
|
||||
if (typeof this.value !== 'object' || !this.value)
|
||||
@ -625,7 +626,14 @@ export class Et2File extends Et2InputWidget(LitElement)
|
||||
// so we check if it is actually a file
|
||||
if(!icon && fileInfo.file instanceof File && type?.startsWith("image/"))
|
||||
{
|
||||
thumbnail = URL.createObjectURL(fileInfo.file);
|
||||
try
|
||||
{
|
||||
thumbnail = URL.createObjectURL(fileInfo.file);
|
||||
}
|
||||
catch(e)
|
||||
{
|
||||
// Thumbnail creation failed, but we don't really care
|
||||
}
|
||||
}
|
||||
const variant = !fileInfo.warning ? "default" : "warning";
|
||||
const closable = !this.readonly && (fileInfo.accepted || Object.values(this.value).indexOf(fileInfo) !== -1)
|
||||
|
@ -465,6 +465,10 @@ export class filemanagerAPP extends EgwApp
|
||||
uploadOnOne(_event)
|
||||
{
|
||||
this.upload(_event,1);
|
||||
|
||||
// Stop nm from refreshing, we'll get it on the push
|
||||
_event.stopPropagation();
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -487,15 +491,18 @@ export class filemanagerAPP extends EgwApp
|
||||
let widget = _event.target;
|
||||
widget.loading = true;
|
||||
_event.detail.accepted = false; // Turn off removable, it's too late now
|
||||
let value = widget.getValue();
|
||||
value.conflict = _conflict;
|
||||
const widgetValue = widget.getValue();
|
||||
const value = {};
|
||||
value[_event.detail.tempName] = {...widgetValue[_event.detail.tempName]};
|
||||
delete widgetValue[_event.detail.tempName];
|
||||
widget.value = widgetValue;
|
||||
value["conflict"] = _conflict;
|
||||
widget.requestUpdate("loading");
|
||||
egw.json(_target, ['upload', value, _path, {ui_path: this.egw.window.location.pathname}],
|
||||
this._upload_callback, this, true, this
|
||||
).sendRequest().finally(() =>
|
||||
{
|
||||
widget.loading = false;
|
||||
widget.value = {};
|
||||
widget.requestUpdate("loading", true);
|
||||
});
|
||||
}
|
||||
|
@ -57,7 +57,7 @@
|
||||
disabled="!@show_refresh" hideOnReadonly="true" image="reload" noSubmit="true"></et2-button>
|
||||
<et2-file label="Upload" statustext="Select file to upload in current directory" id="upload" class="et2_toolbar_hasCaption"
|
||||
dropTarget="filemanager-index" multiple="true"
|
||||
onFinishOne="app.filemanager.uploadOnOne"/>
|
||||
onFinishOne="app.filemanager.uploadOnOne" onchange="widget.value={}; return false;"/>
|
||||
</template>
|
||||
<template id="filemanager.index.header_row" template="" lang="" group="0" version="1.9.002">
|
||||
<et2-button id="home" statustext="Go to your home directory" image="gohome" onclick="app.filemanager.change_dir('~',widget);" noSubmit="true"></et2-button>
|
||||
|
Loading…
Reference in New Issue
Block a user