Browse Source

20.8.5 release

David Benson 2 years ago
parent
commit
6c43d708d5

+ 12 - 0
ChangeLog

@@ -1,3 +1,15 @@
+12-JAN-2023: 20.8.5
+
+- Fixes possible NPE [DID-7061]
+- Shows spinner while authorizing with Google Drive
+- Conf & Jira Cloud: Added error check to JSON.parse in multiple locations [DID-7101]
+- Lucid import: Added support for notes [DID-7053]
+- Retries saving after invalid response from Google
+- Fixes possible NPE in mxCellEditor
+- Fixes hidden Format option in view menu [DID-7133]
+- About shift+click prints window and app to console
+- Fixes possible NPE in Lucid import extension
+
 11-JAN-2023: 20.8.4
 
 - Fixes evt is not defined in selectSiblings action

+ 1 - 1
VERSION

@@ -1 +1 @@
-20.8.4
+20.8.5

File diff suppressed because it is too large
+ 475 - 474
src/main/webapp/js/app.min.js


+ 0 - 2
src/main/webapp/js/diagramly/DrawioFileSync.js

@@ -1247,8 +1247,6 @@ DrawioFileSync.prototype.merge = function(patches, checksum, desc, success, erro
 				// Fallback to full reload with logging
 				this.reload(mxUtils.bind(this, function()
 				{
-					logError(false);
-
 					if (success != null)
 					{
 						success();

+ 140 - 110
src/main/webapp/js/diagramly/DriveClient.js

@@ -1459,120 +1459,67 @@ DriveClient.prototype.saveFile = function(file, revision, success, errFn, noChec
 						try
 						{
 							file.saveDelay = new Date().getTime() - t0;
-							file.saveLevel = 11;
-							
-							if (resp == null)
-							{
-								error({message: mxResources.get('errorSavingFile') + ': Empty response'});
-							}
-							else
+							file.saveLevel = null;
+							success(resp, savedData);
+	
+							if (prevDesc != null)
 							{
-								// Checks if modified time is in the future and head revision has changed
-								var delta = new Date(resp.modifiedDate).getTime() - new Date(mod0).getTime();
-								
-								if (delta <= 0 || etag0 == resp.etag || (revision && head0 == resp.headRevisionId))
+								// Pins previous revision
+								this.executeRequest({
+									url: '/files/' + prevDesc.id + '/revisions/' + prevDesc.headRevisionId + '?supportsAllDrives=true'
+								}, mxUtils.bind(this, mxUtils.bind(this, function(resp)
 								{
-									file.saveLevel = 12;
-									var reasons = [];
-									
-									if (delta <= 0)
-									{
-										reasons.push('invalid modified time');
-									}
-									
-									if (etag0 == resp.etag)
-									{
-										reasons.push('stale etag');
-									}
+									resp.pinned = true;
 									
-									if (revision && head0 == resp.headRevisionId)
-									{
-										reasons.push('stale revision');
-									}
-									
-									var temp = reasons.join(', ');
-									error({message: mxResources.get('errorSavingFile') + ': ' + temp}, resp);
-									
-									// Logs failed save
-									try
-									{
-										EditorUi.logError('Critical: Error saving to Google Drive ' + file.desc.id,
-											null, 'from-' + head0 + '.' + mod0 + '-' + this.ui.hashValue(etag0) +
-											'-to-' + resp.headRevisionId + '.' + resp.modifiedDate + '-' +
-											this.ui.hashValue(resp.etag) + ((temp.length > 0) ? '-errors-' + temp : ''),
-											'user-' + ((this.user != null) ? this.user.id : 'nouser') +
-										 	((file.sync != null) ? '-client_' + file.sync.clientId : '-nosync'));
-									}
-									catch (e)
-									{
-										// ignore
-									}
+									this.executeRequest({
+										url: '/files/' + prevDesc.id + '/revisions/' + prevDesc.headRevisionId,
+										method: 'PUT',
+										params: resp
+									});
+								})));
+								
+								// Logs conversion
+								try
+								{
+									EditorUi.logEvent({category: file.convertedFrom + '-CONVERT-FILE-' + file.getHash(),
+										action: 'from_' + prevDesc.id + '.' + prevDesc.headRevisionId +
+										'-to_' + file.desc.id + '.' + file.desc.headRevisionId,
+										label: (this.user != null) ? ('user_' + this.user.id) : 'nouser' +
+										((file.sync != null) ? '-client_' + file.sync.clientId : 'nosync')});
 								}
-								else
+								catch (e)
 								{
-									file.saveLevel = null;
-							    	success(resp, savedData);
-			
-							    	if (prevDesc != null)
-									{
-							    		// Pins previous revision
-										this.executeRequest({
-											url: '/files/' + prevDesc.id + '/revisions/' + prevDesc.headRevisionId + '?supportsAllDrives=true'
-										}, mxUtils.bind(this, mxUtils.bind(this, function(resp)
-										{
-											resp.pinned = true;
-											
-											this.executeRequest({
-												url: '/files/' + prevDesc.id + '/revisions/' + prevDesc.headRevisionId,
-												method: 'PUT',
-												params: resp
-											});
-										})));
-										
-										// Logs conversion
-										try
-										{
-											EditorUi.logEvent({category: file.convertedFrom + '-CONVERT-FILE-' + file.getHash(),
-												action: 'from_' + prevDesc.id + '.' + prevDesc.headRevisionId +
-												'-to_' + file.desc.id + '.' + file.desc.headRevisionId,
-												label: (this.user != null) ? ('user_' + this.user.id) : 'nouser' +
-												((file.sync != null) ? '-client_' + file.sync.clientId : 'nosync')});
-										}
-										catch (e)
-										{
-											// ignore
-										}
-									}
-							    	
-									// Logs successful save
-//									try
-//									{
-//										EditorUi.logEvent({category: 'SUCCESS-SAVE-FILE-' + file.getHash() +
-//											'-rev0_' + head0 + '-mod0_' + mod0,
-//											action: 'rev-' + resp.headRevisionId +
-//											'-mod_' + resp.modifiedDate + '-size_' + file.getSize() +
-//											'-mime_' + file.desc.mimeType +
-//											((this.ui.editor.autosave) ? '' : '-nosave') +
-//											((file.isAutosave()) ? '' : '-noauto') +
-//											((file.changeListenerEnabled) ? '' : '-nolisten') +
-//											((file.inConflictState) ? '-conflict' : '') +
-//											((file.invalidChecksum) ? '-invalid' : ''),
-//											label: ((this.user != null) ? ('user_' + this.user.id) : 'nouser') +
-//											((file.sync != null) ? ('-client_' + file.sync.clientId) : '-nosync')});
-//									}
-//									catch (e)
-//									{
-//										// ignore
-//									}
+									// ignore
 								}
 							}
+							
+							// Logs successful save
+							// try
+							// {
+							// 	EditorUi.logEvent({category: 'SUCCESS-SAVE-FILE-' + file.getHash() +
+							// 		'-rev0_' + head0 + '-mod0_' + mod0,
+							// 		action: 'rev-' + resp.headRevisionId +
+							// 		'-mod_' + resp.modifiedDate + '-size_' + file.getSize() +
+							// 		'-mime_' + file.desc.mimeType +
+							// 		((this.ui.editor.autosave) ? '' : '-nosave') +
+							// 		((file.isAutosave()) ? '' : '-noauto') +
+							// 		((file.changeListenerEnabled) ? '' : '-nolisten') +
+							// 		((file.inConflictState) ? '-conflict' : '') +
+							// 		((file.invalidChecksum) ? '-invalid' : ''),
+							// 		label: ((this.user != null) ? ('user_' + this.user.id) : 'nouser') +
+							// 		((file.sync != null) ? ('-client_' + file.sync.clientId) : '-nosync')});
+							// }
+							// catch (e)
+							// {
+							// 	// ignore
+							// }
 						}
 						catch (e)
 						{
 							criticalError(e);
 						}
 					});
-					
+
 					var doExecuteRequest = mxUtils.bind(this, function(data, binary)
 					{
 						file.saveLevel = 4;
@@ -1622,7 +1569,81 @@ DriveClient.prototype.saveFile = function(file, revision, success, errFn, noChec
 										
 										if (acceptResponse)
 										{
-											wrapper(resp);
+											// Checks if modified time is in the future and etag and head revision have changed
+											var delta = (resp != null) ? new Date(resp.modifiedDate).getTime() - new Date(mod0).getTime() : 0;
+											
+											if (delta <= 0 || etag0 == resp.etag || (revision && head0 == resp.headRevisionId))
+											{
+												var reasons = [];
+
+												if (resp == null)
+												{
+													reasons.push('Empty response');
+												}
+												else
+												{
+													if (delta <= 0)
+													{
+														reasons.push('Invalid modified time');
+													}
+													
+													if (etag0 == resp.etag)
+													{
+														reasons.push('Stale etag');
+													}
+													
+													if (revision && head0 == resp.headRevisionId)
+													{
+														reasons.push('Stale revision');
+													}
+
+													// Updates etag for retry
+													etag = resp.etag;
+												}
+
+												var temp = reasons.join(', ');
+
+												if (retryCount < this.staleEtagMaxRetries)
+												{
+													retryCount++;
+													var jitter = 1 + 0.1 * (Math.random() - 0.5);
+													var delay = Math.round(retryCount * 2 * this.coolOff * jitter);
+													window.setTimeout(doExecuteSave, delay);
+
+													if (urlParams['test'] == '1')
+													{
+														EditorUi.debug('DriveClient: Invalid response',
+															'retry', retryCount, 'delay', delay, 'rev',
+															(resp != null) ? resp.headRevisionId : 'null',
+															'errors', temp);
+													}
+												}
+												else
+												{
+													file.saveLevel = 12;
+													error({message: mxResources.get('error') + ': ' + temp}, resp);
+
+													// Logs failed save
+													try
+													{
+														EditorUi.logError('Critical: Saving to Google Drive failed ' + file.desc.id,
+															null, 'from-' + head0 + '.' + mod0 + '-' + this.ui.hashValue(etag0) +
+															'-to-' + resp.headRevisionId + '.' + resp.modifiedDate + '-' +
+															this.ui.hashValue(resp.etag) + ((temp.length > 0) ? '-errors-' + temp : ''),
+															'user-' + ((this.user != null) ? this.user.id : 'nouser') +
+															((file.sync != null) ? '-client_' + file.sync.clientId : '-nosync') +
+															'-retries-' + retryCount);
+													}
+													catch (e)
+													{
+														// ignore
+													}
+												}
+											}
+											else
+											{
+												wrapper(resp);
+											}
 										}
 									}), mxUtils.bind(this, function(err)
 									{
@@ -1657,7 +1678,7 @@ DriveClient.prototype.saveFile = function(file, revision, success, errFn, noChec
 																{
 																	retryCount++;
 																	var jitter = 1 + 0.1 * (Math.random() - 0.5);
-																	var delay = retryCount * 2 * this.coolOff * jitter;
+																	var delay = Math.round(retryCount * 2 * this.coolOff * jitter);
 																	window.setTimeout(executeSave, delay);
 																	
 																	if (urlParams['test'] == '1')
@@ -2352,18 +2373,27 @@ DriveClient.prototype.pickFolder = function(fn, force)
 	{
 		showPicker();
 	}
-	else
+	else if (this.ui.spinner.spin(document.body, mxResources.get('authorizing')))
 	{
 		this.execute(mxUtils.bind(this, function()
 		{
-			this.ui.confirm(mxResources.get('useRootFolder'), mxUtils.bind(this, function()
+			try
 			{
-				this.folderPickerCallback({action: google.picker.Action.PICKED,
-					docs: [{type: 'folder', id: 'root'}]});
-			}), mxUtils.bind(this, function()
+				this.ui.spinner.stop();
+
+				this.ui.confirm(mxResources.get('useRootFolder'), mxUtils.bind(this, function()
+				{
+					this.folderPickerCallback({action: google.picker.Action.PICKED,
+						docs: [{type: 'folder', id: 'root'}]});
+				}), mxUtils.bind(this, function()
+				{
+					showPicker();
+				}), mxResources.get('yes'), mxResources.get('noPickFolder') + '...', true);
+			}
+			catch (e)
 			{
-				showPicker();
-			}), mxResources.get('yes'), mxResources.get('noPickFolder') + '...', true);
+				this.ui.handleError(e);
+			}
 		}));
 	}
 };

+ 6 - 1
src/main/webapp/js/diagramly/Extensions.js

@@ -5553,6 +5553,11 @@ LucidImporter = {};
 			graph.setAttributeForCell(cell, 'link', getLink(p.Link[0]));
 		}
 		
+		if (p.NoteHint != null && p.NoteHint.t)
+		{
+			graph.setAttributeForCell(cell, 'Notes', p.NoteHint.t);
+		}
+
 		replacePlaceholders(cell, graph);
 		
 		for (var property in p)
@@ -5900,7 +5905,7 @@ LucidImporter = {};
 		
 		if (obj.id != null)
 		{
-			setAttributeForCell(cell, 'lucidchartObjectId', obj.id, graph);
+			cell.style += ';lucidId=' + obj.id + ';';
 		}
 
 		cell.lucidchartObject = obj;

+ 7 - 2
src/main/webapp/js/diagramly/Menus.js

@@ -923,6 +923,11 @@
 			if (evt != null && mxEvent.isShiftDown(evt))
 			{
 				mxLog.show();
+
+				if (window.console != null)
+				{
+					console.log(editorUi, window);
+				}
 			}
 			else if (editorUi.isOffline() || mxClient.IS_CHROMEAPP || EditorUi.isElectronApp)
 			{
@@ -4077,8 +4082,8 @@
 			}
 			else
 			{
-				this.addMenuItems(menu, ((this.editorUi.format != null) ? ['format'] : []).
-					concat(['outline', 'layers', 'tags']).concat((editorUi.commentsSupported()) ?
+				this.addMenuItems(menu, (['format', 'outline', 'layers', 'tags']).
+					concat((editorUi.commentsSupported()) ?
 					['comments', '-'] : ['-']));
 				
 				this.addMenuItems(menu, ['-', 'search'], parent);

File diff suppressed because it is too large
+ 352 - 352
src/main/webapp/js/extensions.min.js


File diff suppressed because it is too large
+ 463 - 463
src/main/webapp/js/integrate.min.js


File diff suppressed because it is too large
+ 2 - 2
src/main/webapp/js/shapes-14-6-5.min.js


File diff suppressed because it is too large
+ 7 - 7
src/main/webapp/js/viewer-static.min.js


File diff suppressed because it is too large
+ 5 - 5
src/main/webapp/js/viewer.min.js


File diff suppressed because it is too large
+ 4 - 4
src/main/webapp/mxgraph/mxClient.js


File diff suppressed because it is too large
+ 1 - 1
src/main/webapp/service-worker.js


File diff suppressed because it is too large
+ 1 - 1
src/main/webapp/service-worker.js.map


+ 5 - 1
src/main/webapp/shapes/mxCisco19.js

@@ -105,7 +105,11 @@ mxShapeCisco19Rect.prototype.paintVertexShape = function(c, x, y, w, h)
 	if (!circleBg.includes(prIcon) && prIcon != 'aci')
 	{
 		var frame = mxStencilRegistry.getStencil(bgIcon);
-		frame.drawShape(c, this, 0, 0, w, h);
+
+		if (frame != null)
+		{
+			frame.drawShape(c, this, 0, 0, w, h);
+		}
 	}
 
 	c.setShadow(false);