diff --git a/src/adonisjs/public/dccs/components/cell/rule-dcc-cell-neighbor.js b/src/adonisjs/public/dccs/components/cell/rule-dcc-cell-neighbor.js index 026d87d4..2c1c085c 100644 --- a/src/adonisjs/public/dccs/components/cell/rule-dcc-cell-neighbor.js +++ b/src/adonisjs/public/dccs/components/cell/rule-dcc-cell-neighbor.js @@ -76,7 +76,10 @@ class RuleDCCCellNeighbor extends RuleDCCTransition { notify (topic, message) { switch (topic.toLowerCase()) { - case 'probability': this.probability = message.value; break + case 'probability': + this.probability = + (message.value != null) ? message.value : message.body; + break } } } diff --git a/src/adonisjs/public/dccs/components/control/dcc-compute.js b/src/adonisjs/public/dccs/components/control/dcc-compute.js index 745e82b4..7ada10ee 100644 --- a/src/adonisjs/public/dccs/components/control/dcc-compute.js +++ b/src/adonisjs/public/dccs/components/control/dcc-compute.js @@ -148,9 +148,15 @@ class DCCCompute extends DCCBase { this.setAttribute('dependency', newValue) } - notify (topic, message) { - if (topic.toLowerCase() == 'update') + async notify (topic, message) { + const tp = topic.toLowerCase() + if (tp == 'update') this.update() + else if (tp.startsWith('var/')) { + await this._request('var/set/' + tp.substring(4).replace(/\./g, '/'), + message.value) + this.update() + } } async update () { diff --git a/src/adonisjs/public/dccs/components/visual/dcc-expression.js b/src/adonisjs/public/dccs/components/visual/dcc-expression.js index a481c70b..bbb49461 100644 --- a/src/adonisjs/public/dccs/components/visual/dcc-expression.js +++ b/src/adonisjs/public/dccs/components/visual/dcc-expression.js @@ -35,8 +35,6 @@ class DCCExpression extends DCCVisual { // also monitors all messages if (this.active) { this.stateChanged = this.stateChanged.bind(this) - console.log('=== component bus') - console.log(this._bus) this._subscribe('input/state/#', this.stateChanged) this._stateValues = {} } diff --git a/src/adonisjs/public/player/js/htracker.js b/src/adonisjs/public/player/js/htracker.js index b3ee9162..9897c0c0 100644 --- a/src/adonisjs/public/player/js/htracker.js +++ b/src/adonisjs/public/player/js/htracker.js @@ -20,6 +20,8 @@ class Tracker { this.caseCompleted = this.caseCompleted.bind(this) MessageBus.i.subscribe('case/completed/+', this.caseCompleted) MessageBus.i.subscribe('session/close', this.caseCompleted) + this.caseTryHalt = this.caseTryHalt.bind(this) + MessageBus.i.subscribe('case/tryhalt', this.caseTryHalt) this.submitVariables = this.submitVariables.bind(this) MessageBus.i.subscribe('input/submit/*', this.submitVariables) @@ -28,6 +30,7 @@ class Tracker { initializeTrack () { this._variables = {} this._varUpdated = {} + this._varTrack = [] // this._varChanged = {} this._mandatoryFilled = {} this._groupInput = null @@ -81,6 +84,11 @@ class Tracker { } inputChanged (topic, message) { + const varid = this._extractEntityId(topic, 3) + const currentDateTime = new Date() + const tr = {changed: currentDateTime.toJSON()} + tr[varid] = message.value + this._varTrack.push(tr) this._updateVariable(this._extractEntityId(topic, 3), message.value) // this._changedVariable(topic, message.value) } @@ -157,10 +165,26 @@ class Tracker { {userId: message.userId, caseId: message.caseId, knotTrack: this._knotTrack, - variables: this._variables}, true) + variables: this._variables, + varTrack: this._varTrack}, true) } } + async caseTryHalt (userId, caseId, instanceId) { + const currentDateTime = new Date() + this._knotTrack.push( + {event: '*** try case halt ***', + timeResume: currentDateTime.toJSON()} + ) + this._variables['try case halt'] = '*** try case halt ***' + await MessageBus.i.publish('case/summary/' + instanceId, + {userId: userId, + caseId: caseId, + knotTrack: this._knotTrack, + variables: this._variables, + varTrack: this._varTrack}, true) + } + caseHalt (userId, caseId, instanceId) { const track = this._trackRetrieve() if (track != null) { @@ -174,7 +198,8 @@ class Tracker { {userId: userId, caseId: caseId, knotTrack: track.knotTrack, - variables: track.variables}, true) + variables: track.variables, + varTrack: this._varTrack}, true) } } @@ -187,6 +212,7 @@ class Tracker { {knotTrack: this._knotTrack, variables: this._variables, varUpdated: this._varUpdated, + varTrack: this._varTrack, mandatoryFilled: this._mandatoryFilled, groupInput: this._groupInput, caseCompleted: this._caseCompleted @@ -207,6 +233,7 @@ class Tracker { if (track != null) { this._knotTrack = track.knotTrack this._variables = track.variables + this._varTrack = track.varTrack this._varUpdated = track.varUpdated this._mandatoryFilled = track.mandatoryFilled this._groupInput = track.groupInput diff --git a/src/adonisjs/public/player/js/player.js b/src/adonisjs/public/player/js/player.js index 8f172d69..3861196e 100644 --- a/src/adonisjs/public/player/js/player.js +++ b/src/adonisjs/public/player/js/player.js @@ -202,10 +202,26 @@ class PlayerManager { } */ + async tryHalt () { + try { + const pPlay = this._state.pendingPlayCheck() + if (!this._previewCase && pPlay != null && pPlay.running) + this._tracker.caseTryHalt(pPlay.userid, pPlay.caseid, pPlay.running.runningId) + } catch (e) { + console.log('=== error on halt') + console.log(e) + } + return '' + } + async startPlayer (caseid) { + this.tryHalt = this.tryHalt.bind(this) + window.onbeforeunload = this.tryHalt + /* window.onbeforeunload = function() { return ""; } + */ const resumeActive = true // activates and deactivates case resume this._mainPanel = document.querySelector('#player-panel') diff --git a/src/adonisjs/public/themes/plain/css/theme.css b/src/adonisjs/public/themes/plain/css/theme.css index c9523174..75d1d30a 100644 --- a/src/adonisjs/public/themes/plain/css/theme.css +++ b/src/adonisjs/public/themes/plain/css/theme.css @@ -61,6 +61,13 @@ body { margin-left: 6px } +/* Input Typed DCC + *****************/ + +.dcc-input-typed-theme input textarea { + font-size: 4vh; +} + /* Button DCC ************/