xwikisas / application-diagram

Create various types of diagrams using draw.io
GNU Lesser General Public License v2.1
0 stars 7 forks source link

No error is shown to the user when saving the diagram as SVG or PNG fails #186

Closed slauriere closed 3 years ago

slauriere commented 3 years ago

Steps to reproduce

Expected result

This expected result assumes that all diagram pages should have either a SVG or a PNG attachment - as an application feature - which seems to be the case indeed since DiagramViewSheet expects such an attachment on export.

Actual result

slauriere commented 3 years ago

Handling a possible fail of the promise returned by saveFilesAsImageAttachments in DiagramEditSheet would fire the display of the expected error:

saveFilesAsImageAttachments().fail(function(e) {
    new XWiki.widgets.Notification(
      $jsontool.serialize($services.localization.render('diagram.editor.saveAsImageAttachmentError')), 'error');
 }).always(function() {
    saveButton.prop('disabled', false).click();
 });

Ready to push this small change to master upon approval unless a pull request is more appropriate.

mflorea commented 3 years ago

@slauriere please create a PR. Thanks.