From 6c65700893365a36ceb91e26afb0764b620e13bd Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Thu, 26 Mar 2020 17:16:47 +0100 Subject: [PATCH] Bug fixed, deleting UIObjects while not connected over websockets --- AppSchema.json | 2 +- CanvasApp/FloatingSpace/CircularMenuItem.js | 6 +++++- CanvasApp/FloatingSpace/CircularProgressBar.js | 4 +++- CanvasApp/FloatingSpace/UiObject.js | 9 +++++++-- CanvasApp/SystemEventHandler.js | 4 +++- 5 files changed, 19 insertions(+), 6 deletions(-) diff --git a/AppSchema.json b/AppSchema.json index e526e8e70..411b00154 100644 --- a/AppSchema.json +++ b/AppSchema.json @@ -2754,7 +2754,7 @@ "action": "Delete UI Object", "askConfirmation": true, "confirmationLabel": "Confirm to Delete", - "label": "Delete Process Dependencies", + "label": "Delete Dependencies", "iconPathOn": "delete", "iconPathOff": "delete", "actionFunction": "payload.onMenuItemClick" diff --git a/CanvasApp/FloatingSpace/CircularMenuItem.js b/CanvasApp/FloatingSpace/CircularMenuItem.js index ca2d77c7e..ce0cd313e 100644 --- a/CanvasApp/FloatingSpace/CircularMenuItem.js +++ b/CanvasApp/FloatingSpace/CircularMenuItem.js @@ -279,7 +279,11 @@ function newCircularMenuItem () { /* A Click during confirmation executes the pre-defined action. */ if (temporaryStatus === STATUS_WAITING_CONFIRMATION || temporaryStatus === STATUS_PRIMARY_WORK_DONE) { executeAction() - setStatus(thisObject.workDoneLabel, UI_COLOR.PATINATED_TURQUOISE, 100, STATUS_SECONDARY_WORK_DONE) + if (thisObject.workDoneLabel !== undefined) { + setStatus(thisObject.workDoneLabel, UI_COLOR.PATINATED_TURQUOISE, 100, STATUS_SECONDARY_WORK_DONE) + } else { + setStatus('Done', UI_COLOR.PATINATED_TURQUOISE, 100, STATUS_SECONDARY_WORK_DONE) + } return } } diff --git a/CanvasApp/FloatingSpace/CircularProgressBar.js b/CanvasApp/FloatingSpace/CircularProgressBar.js index 07973d7ee..a78943473 100644 --- a/CanvasApp/FloatingSpace/CircularProgressBar.js +++ b/CanvasApp/FloatingSpace/CircularProgressBar.js @@ -31,7 +31,9 @@ function newCircularProgressBar () { function finalize () { let key = thisObject.payload.node.name + '-' + thisObject.payload.node.type + '-' + thisObject.payload.node.id - systemEventHandler.stopListening(key, eventSubscriptionIdHeartbeat) + if (eventSubscriptionIdHeartbeat !== undefined) { + systemEventHandler.stopListening(key, eventSubscriptionIdHeartbeat) + } thisObject.container = undefined thisObject.payload = undefined diff --git a/CanvasApp/FloatingSpace/UiObject.js b/CanvasApp/FloatingSpace/UiObject.js index 96955b532..9f6999404 100644 --- a/CanvasApp/FloatingSpace/UiObject.js +++ b/CanvasApp/FloatingSpace/UiObject.js @@ -120,8 +120,13 @@ function newUiObject () { function finalize () { let key = thisObject.payload.node.name + '-' + thisObject.payload.node.type + '-' + thisObject.payload.node.id - systemEventHandler.stopListening(key, eventSubscriptionIdOnRunning, 'UiObject') - systemEventHandler.stopListening(key, eventSubscriptionIdOnStopped, 'UiObject') + + if (eventSubscriptionIdOnRunning !== undefined) { + systemEventHandler.stopListening(key, eventSubscriptionIdOnRunning, 'UiObject') + } + if (eventSubscriptionIdOnStopped !== undefined) { + systemEventHandler.stopListening(key, eventSubscriptionIdOnStopped, 'UiObject') + } thisObject.container.eventHandler.stopListening(selfFocusEventSubscriptionId) thisObject.container.eventHandler.stopListening(selfNotFocusEventSubscriptionId) diff --git a/CanvasApp/SystemEventHandler.js b/CanvasApp/SystemEventHandler.js index 07618cbf8..d8c4b520c 100644 --- a/CanvasApp/SystemEventHandler.js +++ b/CanvasApp/SystemEventHandler.js @@ -44,7 +44,9 @@ function newSystemEventHandler () { responseWaiters.set(command.callerId, responseCallBack) } - WEB_SOCKETS_CONNECTION.send(JSON.stringify(command)) + if (WEB_SOCKETS_CONNECTION.readyState === 1) { // 1 means connected and ready. + WEB_SOCKETS_CONNECTION.send(JSON.stringify(command)) + } } function createEventHandler (eventHandlerName, callerId, responseCallBack) {