Skip to content

Commit

Permalink
10.4.5 release
Browse files Browse the repository at this point in the history
  • Loading branch information
alderg committed Mar 13, 2019
1 parent 9c7881b commit 7a1ee7a
Show file tree
Hide file tree
Showing 11 changed files with 856 additions and 795 deletions.
6 changes: 6 additions & 0 deletions ChangeLog
@@ -1,3 +1,9 @@
13-MAR-2019: 10.4.5

- Fixes bug in Confluence cloud
- Fixes error handling
- Improves logging

12-MAR-2019: 10.4.4

- Adds blob.core.windows.net to known CORS urls
Expand Down
2 changes: 1 addition & 1 deletion VERSION
@@ -1 +1 @@
10.4.4
10.4.5
2 changes: 1 addition & 1 deletion src/main/webapp/cache.manifest
@@ -1,7 +1,7 @@
CACHE MANIFEST

# THIS FILE WAS GENERATED. DO NOT MODIFY!
# 03/12/2019 02:49 PM
# 03/13/2019 01:31 PM

app.html
index.html?offline=1
Expand Down
1,390 changes: 696 additions & 694 deletions src/main/webapp/js/app.min.js

Large diffs are not rendered by default.

103 changes: 60 additions & 43 deletions src/main/webapp/js/diagramly/App.js
Expand Up @@ -25,8 +25,11 @@ App = function(editor, container, lightbox)

if (file != null && file.constructor == DriveFile && file.isModified() && this.drive != null)
{
EditorUi.logEvent({category: 'Unload-Modified', action: file.getId(), label:
(this.drive.user != null) ? this.drive.user.id : 'unknown-user'});
EditorUi.logEvent({category: 'DISCARD-SAVE-GOOGLE-' + file.getId() + '.' +
file.desc.headRevisionId + '.' + file.desc.modifiedDate,
action: 'time-' + new Date().toISOString() + '-saved-' +
((file.lastSaved != null) ? file.lastSaved.toISOString() : 'never'),
label: (this.drive.user != null) ? this.drive.user.id : 'unknown-user'});
}
});
}
Expand Down Expand Up @@ -65,7 +68,27 @@ App = function(editor, container, lightbox)
pre();
}
});

// Handles cloning errors when copying cells
var clipboardCopy = mxClipboard.copy;
var self = this;

mxClipboard.copy = function(graph, cells)
{
var result = null;

try
{
result = clipboardCopy.apply(this, arguments);
}
catch (e)
{
self.handleError(e);
}

return result;
},

// Initial state for toolbar items is disabled
this.updateDocumentTitle();
this.updateUi();
Expand Down Expand Up @@ -1020,49 +1043,43 @@ App.prototype.init = function()

this.drive.checkRealtimeFiles(mxUtils.bind(this, function()
{
var day = new Date().getDay();
var isWeekend = (day === 6) || (day === 0);
var footer = document.createElement('div');
footer.style.cssText = 'position:absolute;bottom:0px;max-width:90%;padding:10px;padding-right:26px;' +
'white-space:nowrap;left:50%;bottom:2px;';
footer.className = 'geStatusAlert';

mxUtils.setPrefixedStyle(footer.style, 'transform', 'translate(-50%,110%)');
mxUtils.setPrefixedStyle(footer.style, 'transition', 'all 1s ease');
footer.style.whiteSpace = 'nowrap';
footer.innerHTML = '<a href="https://desk.draw.io/support/solutions/articles/16000092210" ' +
'target="_blank" style="display:inline;text-decoration:none;font-weight:700;font-size:13px;opacity:1;">' +
'<img src="' + this.editor.graph.warningImage.src + '" border="0" style="margin-top:-4px;margin-right:2px;" valign="middle"/>&nbsp;' +
'You need to take action to convert legacy files. Click here.&nbsp;' +
'<img src="' + this.editor.graph.warningImage.src + '" border="0" style="margin-top:-4px;margin-left:2px;" valign="middle"/></a>';

var img = document.createElement('img');

img.setAttribute('src', Dialog.prototype.closeImage);
img.setAttribute('title', mxResources.get('close'));
img.style.position = 'absolute';
img.style.cursor = 'pointer';
img.style.right = '10px';
img.style.top = '12px';

footer.appendChild(img);

mxEvent.addListener(img, 'click', mxUtils.bind(this, function()
{
footer.parentNode.removeChild(footer);
this.hideFooter();
}));

document.body.appendChild(footer);

if (isWeekend || Math.random() > 0.6)
window.setTimeout(mxUtils.bind(this, function()
{
var footer = document.createElement('div');
footer.style.cssText = 'position:absolute;bottom:0px;max-width:90%;padding:10px;padding-right:26px;' +
'white-space:nowrap;left:50%;bottom:2px;';
footer.className = 'geStatusAlert';

mxUtils.setPrefixedStyle(footer.style, 'transform', 'translate(-50%,110%)');
mxUtils.setPrefixedStyle(footer.style, 'transition', 'all 1s ease');
footer.style.whiteSpace = 'nowrap';
footer.innerHTML = '<a href="https://desk.draw.io/support/solutions/articles/16000092210" ' +
'target="_blank" style="display:inline;text-decoration:none;font-weight:700;font-size:13px;opacity:1;">' +
'<img src="' + this.editor.graph.warningImage.src + '" border="0" style="margin-top:-4px;margin-right:2px;" valign="middle"/>&nbsp;' +
'You need to take action to convert legacy files. Click here.&nbsp;' +
'<img src="' + this.editor.graph.warningImage.src + '" border="0" style="margin-top:-4px;margin-left:2px;" valign="middle"/></a>';

var img = document.createElement('img');

img.setAttribute('src', Dialog.prototype.closeImage);
img.setAttribute('title', mxResources.get('close'));
img.style.position = 'absolute';
img.style.cursor = 'pointer';
img.style.right = '10px';
img.style.top = '12px';

footer.appendChild(img);

mxEvent.addListener(img, 'click', mxUtils.bind(this, function()
{
footer.parentNode.removeChild(footer);
this.hideFooter();
}));

document.body.appendChild(footer);

window.setTimeout(mxUtils.bind(this, function()
{
mxUtils.setPrefixedStyle(footer.style, 'transform', 'translate(-50%,0%)');
}), 1500);
}
mxUtils.setPrefixedStyle(footer.style, 'transform', 'translate(-50%,0%)');
}), 1500);
}));
}))

Expand Down
59 changes: 37 additions & 22 deletions src/main/webapp/js/diagramly/DrawioFile.js
Expand Up @@ -120,10 +120,10 @@ DrawioFile.prototype.changeListenerEnabled = true;
DrawioFile.prototype.lastAutosaveRevision = null;

/**
* Sets the delay between revisions when using autosave. Default is 0 which
* creates a revision on every autosave.
* Sets the delay between revisions when using autosave. Default is 300000
* ie 5 mins. Set this to 0 to create a revision on every autosave.
*/
DrawioFile.prototype.maxAutosaveRevisionDelay = 0;
DrawioFile.prototype.maxAutosaveRevisionDelay = 300000;

/**
* Specifies if notify events should be ignored.
Expand Down Expand Up @@ -461,12 +461,9 @@ DrawioFile.prototype.checksumError = function(error, patches, details, etag, fun
this.ui.getPagesForNode(
mxUtils.parseXml(file.data).documentElement)), 25000) : 'n/a';

this.sendErrorReport(
'Checksum Error in ' + functionName,
((details != null) ? (details) : '') +
'\n\nPatches:\n' + json +
((remote != null) ? ('\n\nRemote:\n' + remote) : ''),
null, 70000);
this.sendErrorReport('Checksum Error in ' + functionName + ' ' + this.getId(),
((details != null) ? (details) : '') + '\n\nPatches:\n' + json +
((remote != null) ? ('\n\nRemote:\n' + remote) : ''), null, 70000);
});

if (etag == null)
Expand Down Expand Up @@ -734,7 +731,6 @@ DrawioFile.prototype.patch = function(patches, resolver)
}
else
{

graph.view.validate();
}

Expand All @@ -751,33 +747,52 @@ DrawioFile.prototype.patch = function(patches, resolver)
*/
DrawioFile.prototype.save = function(revision, success, error, unloading, overwrite, manual)
{
if (!this.isEditable())
try
{
if (error != null)
if (!this.isEditable())
{
error({message: mxResources.get('readOnly')});
if (error != null)
{
error({message: mxResources.get('readOnly')});
}
else
{
throw new Error(mxResources.get('readOnly'));
}
}
else if (!overwrite && this.invalidChecksum)
{
if (error != null)
{
error({message: mxResources.get('checksum')});
}
else
{
throw new Error(mxResources.get('checksum'));
}
}
else
{
throw new Error(mxResources.get('readOnly'));
this.updateFileData();
this.clearAutosave();

if (success != null)
{
success();
}
}
}
else if (!overwrite && this.invalidChecksum)
catch (e)
{
if (error != null)
{
error({message: mxResources.get('checksum')});
error(e);
}
else
{
throw new Error(mxResources.get('checksum'));
throw e;
}
}
else
{
this.updateFileData();
this.clearAutosave();
}
};

/**
Expand Down
52 changes: 35 additions & 17 deletions src/main/webapp/js/diagramly/DriveClient.js
Expand Up @@ -1044,10 +1044,37 @@ DriveClient.prototype.getXmlFile = function(resp, success, error, ignoreMime, re
* @param {number} dx X-coordinate of the translation.
* @param {number} dy Y-coordinate of the translation.
*/
DriveClient.prototype.saveFile = function(file, revision, success, error, noCheck, unloading, overwrite, properties)
DriveClient.prototype.saveFile = function(file, revision, success, errFn, noCheck, unloading, overwrite, properties)
{
var error = mxUtils.bind(this, function(e)
{
if (errFn != null)
{
errFn(e);
}
else
{
throw e;
}

// Logs failed save
try
{
EditorUi.logEvent({category: 'FAIL-SAVE-GOOGLE-' + file.desc.id + '.' +
file.desc.headRevisionId + '.' + file.desc.modifiedDate,
action: 'error-' + file.getErrorMessage(e),
label: (this.user != null) ? this.user.id : 'unknown-user'});
}
catch (e)
{
// ignore
}
});

var criticalError = mxUtils.bind(this, function(e)
{
error(e);

try
{
EditorUi.logError(e.message, null, null, e);
Expand All @@ -1064,15 +1091,6 @@ DriveClient.prototype.saveFile = function(file, revision, success, error, noChec
{
// ignore
}

if (error != null)
{
error(e);
}
else
{
throw e;
}
});

try
Expand All @@ -1084,7 +1102,7 @@ DriveClient.prototype.saveFile = function(file, revision, success, error, noChec
var head0 = file.desc.headRevisionId;
var saveAsPng = this.ui.useCanvasForExport && /(\.png)$/i.test(file.getTitle());
noCheck = (noCheck != null) ? noCheck : (!this.ui.isLegacyDriveDomain() || urlParams['ignoremime'] == '1');

// NOTE: Unloading arg is currently ignored, saving during unload/beforeUnload is not possible using
// asynchronous code, which is needed to create the thumbnail, or asynchronous requests which is the only
// way to execute the gapi request below.
Expand Down Expand Up @@ -1240,10 +1258,10 @@ DriveClient.prototype.saveFile = function(file, revision, success, error, noChec
// Logs successful save
try
{
EditorUi.logEvent({category: 'SAVE-GOOGLE-' + file.desc.id,
action: 'from-' + head0 + '.' + mod0 +
'-to-' + resp.headRevisionId + '.' + resp.modifiedDate,
label: (this.user != null) ? this.user.id : 'unknown-user'});
EditorUi.logEvent({category: 'SAVE-GOOGLE-' + file.desc.id +
'.' + head0 + '.' + mod0, action: 'saved-' + resp.headRevisionId +
'.' + resp.modifiedDate, label: (this.user != null) ?
this.user.id : 'unknown-user'});
}
catch (e)
{
Expand Down Expand Up @@ -1322,7 +1340,7 @@ DriveClient.prototype.saveFile = function(file, revision, success, error, noChec
'\n\nBrowser=' + navigator.userAgent +
'\nFile=' + file.desc.id + '.' + file.desc.headRevisionId +
'\nUser=' + ((this.user != null) ? this.user.id : 'unknown'));
EditorUi.logError('Warning: Stale Etag Overwrite',
EditorUi.logError('Warning: Stale Etag Overwrite ' + file.desc.id,
null, file.desc.id + '.' + file.desc.headRevisionId,
(this.user != null) ? this.user.id : 'unknown');
}
Expand Down Expand Up @@ -2460,7 +2478,7 @@ DriveClient.prototype.convertRealtimeFiles = function()
var day = new Date().getDay();
var isWeekend = (day === 6) || (day === 0);
var q = 'mimeType=\'application/vnd.jgraph.mxfile.realtime\'';
var convertDelay = (isWeekend) ? 1000 : 5000;
var convertDelay = (isWeekend) ? 1000 : 2000;
var convertedIds = {};
var converted = 0;
var fromJson = 0;
Expand Down
7 changes: 4 additions & 3 deletions src/main/webapp/js/diagramly/DriveFile.js
Expand Up @@ -133,9 +133,10 @@ DriveFile.prototype.isMovable = function()
*/
DriveFile.prototype.save = function(revision, success, error, unloading, overwrite)
{
DrawioFile.prototype.save.apply(this, arguments);

this.saveFile(null, revision, success, error, unloading, overwrite);
DrawioFile.prototype.save.apply(this, [revision, mxUtils.bind(this, function()
{
this.saveFile(null, revision, success, error, unloading, overwrite);
}), error, unloading, overwrite]);
};

/**
Expand Down
7 changes: 4 additions & 3 deletions src/main/webapp/js/diagramly/OneDriveFile.js
Expand Up @@ -263,9 +263,10 @@ OneDriveFile.prototype.getLastModifiedDate = function()
*/
OneDriveFile.prototype.save = function(revision, success, error, unloading, overwrite)
{
DrawioFile.prototype.save.apply(this, arguments);

this.saveFile(this.getTitle(), false, success, error, unloading, overwrite);
DrawioFile.prototype.save.apply(this, [revision, mxUtils.bind(this, function()
{
this.saveFile(this.getTitle(), false, success, error, unloading, overwrite);
}), error, unloading, overwrite]);
};

/**
Expand Down

0 comments on commit 7a1ee7a

Please sign in to comment.