Display proper file upload errors
Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
@@ -911,14 +911,11 @@ input.input-inline {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#card-attachments {
|
.card-attachments {
|
||||||
ul {
|
.error {
|
||||||
margin: 5px;
|
padding-left: 38px;
|
||||||
}
|
margin-bottom: 5px;
|
||||||
|
background-position: 10px;
|
||||||
.details {
|
|
||||||
font-size: 8pt;
|
|
||||||
padding-left: 15px;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -30,13 +30,17 @@ export default class FileService {
|
|||||||
this.cardservice = CardService;
|
this.cardservice = CardService;
|
||||||
this.uploader.onAfterAddingFile = this.onAfterAddingFile.bind(this);
|
this.uploader.onAfterAddingFile = this.onAfterAddingFile.bind(this);
|
||||||
this.uploader.onSuccessItem = this.onSuccessItem.bind(this);
|
this.uploader.onSuccessItem = this.onSuccessItem.bind(this);
|
||||||
|
this.uploader.onErrorItem = this.onErrorItem.bind(this);
|
||||||
|
|
||||||
|
this.status = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
runUpload (fileItem, attachmentId) {
|
runUpload (fileItem, attachmentId) {
|
||||||
fileItem.url = OC.generateUrl('/apps/deck/cards/' + fileItem.cardId + '/attachment');
|
this.status = null;
|
||||||
|
fileItem.url = OC.generateUrl('/apps/deck/cards/' + fileItem.cardId + '/attachment?type=deck_file');
|
||||||
if (typeof attachmentId !== 'undefined') {
|
if (typeof attachmentId !== 'undefined') {
|
||||||
fileItem.url = OC.generateUrl('/apps/deck/cards/' + fileItem.cardId + '/attachment/' + attachmentId);
|
fileItem.url = OC.generateUrl('/apps/deck/cards/' + fileItem.cardId + '/attachment/' + attachmentId + '?type=deck_file');
|
||||||
} else {
|
} else {
|
||||||
fileItem.formData = [
|
fileItem.formData = [
|
||||||
{
|
{
|
||||||
@@ -95,6 +99,13 @@ export default class FileService {
|
|||||||
this.cardservice.get(item.cardId).attachments.push(response);
|
this.cardservice.get(item.cardId).attachments.push(response);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onErrorItem (item, response) {
|
||||||
|
this.status = {
|
||||||
|
error: t('deck', `Failed to upload:`) + ' ' + item.file.name,
|
||||||
|
message: response.message
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
app.service('FileService', FileService);
|
app.service('FileService', FileService);
|
||||||
@@ -104,6 +104,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="section-content card-attachments">
|
<div class="section-content card-attachments">
|
||||||
|
<div class="error icon-error" ng-if="fileservice.status"><strong>{{ fileservice.status.error }}</strong><br />{{ fileservice.status.message }}</div>
|
||||||
<attachment-list-component ng-if="params.tab === 1 && cardservice.getCurrent() && isArray(cardservice.getCurrent().attachments)" attachments="cardservice.getCurrent().attachments"></attachment-list-component>
|
<attachment-list-component ng-if="params.tab === 1 && cardservice.getCurrent() && isArray(cardservice.getCurrent().attachments)" attachments="cardservice.getCurrent().attachments"></attachment-list-component>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user