Warniings & Infos
This commit is contained in:
1 parent
0183cf850c
commit
077b8cb865
5 files changed
+291
-4
No files matched your search
+164
-3
@@ -24,6 +24,8 @@ function newUiObject() {
|
||||
shortcutKey: undefined,
|
||||
isShowing: undefined,
|
||||
hasError: undefined,
|
||||
hasWarning: undefined,
|
||||
hasInfo: undefined,
|
||||
run: run,
|
||||
stop: stop,
|
||||
heartBeat: heartBeat,
|
||||
@@ -35,6 +37,10 @@ function newUiObject() {
|
||||
runningAtBackend: runningAtBackend,
|
||||
setErrorMessage: setErrorMessage,
|
||||
resetErrorMessage: resetErrorMessage,
|
||||
setWarningMessage: setWarningMessage,
|
||||
resetWarningMessage: resetWarningMessage,
|
||||
setInfoMessage: setInfoMessage,
|
||||
resetInfoMessage: resetInfoMessage,
|
||||
setValue: setValue,
|
||||
resetValue: resetValue,
|
||||
setPercentage: setPercentage,
|
||||
@@ -76,6 +82,8 @@ function newUiObject() {
|
||||
let runningAtBackendCounter = 0
|
||||
|
||||
let errorMessageCounter = 0
|
||||
let warningMessageCounter = 0
|
||||
let infoMessageCounter = 0
|
||||
|
||||
let hasValue
|
||||
let valueCounter = 0
|
||||
@@ -109,6 +117,9 @@ function newUiObject() {
|
||||
let isDragging = false
|
||||
|
||||
let errorMessage = ''
|
||||
let warningMessage = ''
|
||||
let infoMessage = ''
|
||||
|
||||
let currentValue = 0
|
||||
let valueMinDecimals = undefined
|
||||
let currentPercentage = ''
|
||||
@@ -327,6 +338,8 @@ function newUiObject() {
|
||||
highlightPhisycs()
|
||||
runningAtBackendPhisycs()
|
||||
errorMessagePhisycs()
|
||||
warningMessagePhisycs()
|
||||
infoMessagePhisycs()
|
||||
valuePhisycs()
|
||||
percentagePhisycs()
|
||||
statusPhisycs()
|
||||
@@ -694,6 +707,22 @@ function newUiObject() {
|
||||
}
|
||||
}
|
||||
|
||||
function warningMessagePhisycs() {
|
||||
warningMessageCounter--
|
||||
if (warningMessageCounter < 0) {
|
||||
warningMessageCounter = 0
|
||||
thisObject.hasWarning = false
|
||||
}
|
||||
}
|
||||
|
||||
function infoMessagePhisycs() {
|
||||
infoMessageCounter--
|
||||
if (infoMessageCounter < 0) {
|
||||
infoMessageCounter = 0
|
||||
thisObject.hasInfo = false
|
||||
}
|
||||
}
|
||||
|
||||
function valuePhisycs() {
|
||||
valueCounter--
|
||||
if (valueCounter < 0) {
|
||||
@@ -767,6 +796,76 @@ function newUiObject() {
|
||||
thisObject.hasError = false
|
||||
}
|
||||
|
||||
function setWarningMessage(message, duration) {
|
||||
if (message !== undefined) {
|
||||
warningMessage = message
|
||||
thisObject.hasWarning = true
|
||||
if (duration === undefined) { duration = 1 }
|
||||
warningMessageCounter = 100 * duration
|
||||
|
||||
/*
|
||||
Next, we are going to try to inform the parent that this
|
||||
node has an warning, as a way to show the end user where the
|
||||
node with warning is. This is useful to detect warnings in nodes
|
||||
that are located at braches that are collapsed.
|
||||
*/
|
||||
|
||||
if (thisObject.payload !== undefined) {
|
||||
if (thisObject.payload.parentNode !== undefined) {
|
||||
if (thisObject.payload.parentNode.payload !== undefined) {
|
||||
if (thisObject.payload.parentNode.payload.floatingObject !== undefined) {
|
||||
if (thisObject.payload.parentNode.payload.floatingObject.isCollapsed === true || thisObject.payload.parentNode.payload.floatingObject.isParentCollapsed === true) {
|
||||
if (thisObject.payload.parentNode.payload.uiObject !== true) {
|
||||
thisObject.payload.parentNode.payload.uiObject.setWarningMessage('Warning Inside this Branch')
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function resetWarningMessage() {
|
||||
warningMessage = undefined
|
||||
thisObject.hasWarning = false
|
||||
}
|
||||
|
||||
function setInfoMessage(message, duration) {
|
||||
if (message !== undefined) {
|
||||
infoMessage = message
|
||||
thisObject.hasInfo = true
|
||||
if (duration === undefined) { duration = 1 }
|
||||
infoMessageCounter = 100 * duration
|
||||
|
||||
/*
|
||||
Next, we are going to try to inform the parent that this
|
||||
node has an info, as a way to show the end user where the
|
||||
node with info is. This is useful to detect infos in nodes
|
||||
that are located at braches that are collapsed.
|
||||
*/
|
||||
|
||||
if (thisObject.payload !== undefined) {
|
||||
if (thisObject.payload.parentNode !== undefined) {
|
||||
if (thisObject.payload.parentNode.payload !== undefined) {
|
||||
if (thisObject.payload.parentNode.payload.floatingObject !== undefined) {
|
||||
if (thisObject.payload.parentNode.payload.floatingObject.isCollapsed === true || thisObject.payload.parentNode.payload.floatingObject.isParentCollapsed === true) {
|
||||
if (thisObject.payload.parentNode.payload.uiObject !== true) {
|
||||
thisObject.payload.parentNode.payload.uiObject.setInfoMessage('Info Inside this Branch')
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function resetInfoMessage() {
|
||||
infoMessage = undefined
|
||||
thisObject.hasInfo = false
|
||||
}
|
||||
|
||||
function setValue(value, counter, minDecimals) {
|
||||
if (value !== undefined) {
|
||||
currentValue = value
|
||||
@@ -837,6 +936,8 @@ function newUiObject() {
|
||||
function run(pEventsServerClient, callBackFunction) {
|
||||
finalizeEventsServerClient()
|
||||
resetErrorMessage()
|
||||
resetWarningMessage()
|
||||
resetInfoMessage()
|
||||
resetPercentage()
|
||||
resetValue()
|
||||
resetStatus()
|
||||
@@ -1090,6 +1191,8 @@ function newUiObject() {
|
||||
if (thisObject.isOnFocus === false) {
|
||||
drawBodyAndPicture()
|
||||
drawErrorMessage()
|
||||
drawWarningMessage()
|
||||
drawInfoMessage()
|
||||
drawValue()
|
||||
drawPercentage()
|
||||
drawStatus()
|
||||
@@ -1170,6 +1273,8 @@ function newUiObject() {
|
||||
}
|
||||
|
||||
drawErrorMessage()
|
||||
drawWarningMessage()
|
||||
drawInfoMessage()
|
||||
drawValue()
|
||||
drawPercentage()
|
||||
drawStatus()
|
||||
@@ -1389,6 +1494,24 @@ function newUiObject() {
|
||||
|
||||
function drawErrorMessage() {
|
||||
if (thisObject.hasError === false) { return }
|
||||
drawMessage(errorMessage)
|
||||
}
|
||||
|
||||
function drawWarningMessage() {
|
||||
if (thisObject.hasError === true) { return }
|
||||
if (thisObject.hasWarning !== true) { return }
|
||||
drawMessage(warningMessage)
|
||||
}
|
||||
|
||||
function drawInfoMessage() {
|
||||
if (thisObject.hasError === true) { return }
|
||||
if (thisObject.hasWarning === true) { return }
|
||||
if (thisObject.hasInfo !== true) { return }
|
||||
drawMessage(infoMessage)
|
||||
}
|
||||
|
||||
function drawMessage(message) {
|
||||
|
||||
if (canvas.floatingSpace.inMapMode === true) {
|
||||
return
|
||||
}
|
||||
@@ -1414,7 +1537,7 @@ function newUiObject() {
|
||||
if (radius > 6) {
|
||||
const MAX_LABEL_LENGTH = 80
|
||||
|
||||
label = errorMessage
|
||||
label = message
|
||||
|
||||
if (label !== undefined && label !== null) {
|
||||
if (label.length > MAX_LABEL_LENGTH) {
|
||||
@@ -1695,7 +1818,7 @@ function newUiObject() {
|
||||
|
||||
let nodeDefinition = getNodeDefinition(thisObject.payload.node)
|
||||
if (nodeDefinition === undefined) {
|
||||
console.log('Node ' + thisObject.payload.node + ' without Node Definition at APP SCHEMA.')
|
||||
console.log('Node ' + thisObject.payload.node + ' without Node Definition at APP SCHEMA.')
|
||||
return
|
||||
}
|
||||
|
||||
@@ -1708,7 +1831,13 @@ function newUiObject() {
|
||||
browserCanvasContext.fillStyle = 'rgba(' + UI_COLOR.BLACK + ', 0.70)'
|
||||
browserCanvasContext.fill()
|
||||
/* Border when node is in focus */
|
||||
if (thisObject.hasError !== true && nodeDefinition.isHierarchyHead !== true && thisObject.circularProgressBar === undefined) {
|
||||
if (
|
||||
thisObject.hasError !== true &&
|
||||
thisObject.WarningError !== true &&
|
||||
thisObject.hasInfo !== true &&
|
||||
nodeDefinition.isHierarchyHead !== true &&
|
||||
thisObject.circularProgressBar === undefined
|
||||
) {
|
||||
browserCanvasContext.beginPath()
|
||||
browserCanvasContext.arc(visiblePosition.x, visiblePosition.y, VISIBLE_RADIUS, 0, Math.PI * 2, true)
|
||||
browserCanvasContext.closePath()
|
||||
@@ -1757,7 +1886,39 @@ function newUiObject() {
|
||||
browserCanvasContext.stroke()
|
||||
}
|
||||
|
||||
/* Info Ring */
|
||||
if (thisObject.hasInfo === true) {
|
||||
VISIBLE_RADIUS = thisObject.payload.floatingObject.container.frame.radius
|
||||
if (canvas.floatingSpace.inMapMode === true) {
|
||||
VISIBLE_RADIUS = canvas.floatingSpace.transformRadiusToMap(VISIBLE_RADIUS)
|
||||
}
|
||||
let OPACITY = infoMessageCounter / 30
|
||||
browserCanvasContext.beginPath()
|
||||
browserCanvasContext.arc(visiblePosition.x, visiblePosition.y, VISIBLE_RADIUS, 0, Math.PI * 2, true)
|
||||
browserCanvasContext.closePath()
|
||||
browserCanvasContext.strokeStyle = 'rgba(' + UI_COLOR.DARK_TURQUOISE + ', ' + OPACITY + ')'
|
||||
browserCanvasContext.lineWidth = 5
|
||||
browserCanvasContext.setLineDash([5, 10])
|
||||
browserCanvasContext.stroke()
|
||||
}
|
||||
|
||||
/* Warning Ring */
|
||||
if (thisObject.hasWarning === true) {
|
||||
VISIBLE_RADIUS = thisObject.payload.floatingObject.container.frame.radius
|
||||
if (canvas.floatingSpace.inMapMode === true) {
|
||||
VISIBLE_RADIUS = canvas.floatingSpace.transformRadiusToMap(VISIBLE_RADIUS)
|
||||
}
|
||||
let OPACITY = warningMessageCounter / 30
|
||||
browserCanvasContext.beginPath()
|
||||
browserCanvasContext.arc(visiblePosition.x, visiblePosition.y, VISIBLE_RADIUS, 0, Math.PI * 2, true)
|
||||
browserCanvasContext.closePath()
|
||||
browserCanvasContext.strokeStyle = 'rgba(' + UI_COLOR.TITANIUM_YELLOW + ', ' + OPACITY + ')'
|
||||
browserCanvasContext.lineWidth = 5
|
||||
browserCanvasContext.setLineDash([5, 10])
|
||||
browserCanvasContext.stroke()
|
||||
}
|
||||
|
||||
/* Error Ring */
|
||||
if (thisObject.hasError === true) {
|
||||
VISIBLE_RADIUS = thisObject.payload.floatingObject.container.frame.radius
|
||||
if (canvas.floatingSpace.inMapMode === true) {
|
||||
|
||||
Reference in new issue
Block a user