Gaudenz Alder 6 роки тому
батько
коміт
7a1ee7aa44

+ 6 - 0
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

+ 1 - 1
VERSION

@@ -1 +1 @@
-10.4.4
+10.4.5

+ 1 - 1
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

Різницю між файлами не показано, бо вона завелика
+ 696 - 694
src/main/webapp/js/app.min.js


+ 60 - 43
src/main/webapp/js/diagramly/App.js

@@ -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'});
 			}
 		});
 	}
@@ -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();
@@ -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);
 						}));
 					}))
 					

+ 37 - 22
src/main/webapp/js/diagramly/DrawioFile.js

@@ -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.
@@ -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)
@@ -734,7 +731,6 @@ DrawioFile.prototype.patch = function(patches, resolver)
 				}
 				else
 				{
-					
 					graph.view.validate();
 				}
 				
@@ -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();
-	}
 };
 
 /**

+ 35 - 17
src/main/webapp/js/diagramly/DriveClient.js

@@ -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);
@@ -1064,15 +1091,6 @@ DriveClient.prototype.saveFile = function(file, revision, success, error, noChec
 		{
 			// ignore
 		}
-
-		if (error != null)
-		{
-			error(e);
-		}
-		else
-		{
-			throw e;
-		}
 	});
 	
 	try
@@ -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.
@@ -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)
 								{
@@ -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');
 																}
@@ -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;

+ 4 - 3
src/main/webapp/js/diagramly/DriveFile.js

@@ -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]);
 };
 
 /**

+ 4 - 3
src/main/webapp/js/diagramly/OneDriveFile.js

@@ -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]);
 };
 
 /**

Різницю між файлами не показано, бо вона завелика
+ 10 - 10
src/main/webapp/js/viewer.min.js


+ 2 - 1
src/main/webapp/plugins/explore.js

@@ -358,7 +358,8 @@ Draw.loadPlugin(function(ui)
 		ui.editor.graph.click = function(me)
 		{
 			if (ui.editor.graph.model.isVertex(me.getCell()) &&
-				ui.editor.graph.model.getEdgeCount(me.getCell()) > 0)
+				ui.editor.graph.model.getEdgeCount(me.getCell()) > 0 &&
+				this.getLinkForCell(me.getCell()) == null)
 			{
 				exploreFromHere(me.getCell());
 			}