diff --git a/src/adonisjs/public/importer/documents/index.html b/src/adonisjs/public/importer/documents/index.html
index 5462a689..298431ca 100644
--- a/src/adonisjs/public/importer/documents/index.html
+++ b/src/adonisjs/public/importer/documents/index.html
@@ -130,7 +130,15 @@
Documents to Import:
+
+
+
+
+ - Import - imports documents to annotate from a CSV: each row contains the title and document.
+ - Sample - samples existing imported documents in a new Quest and Room: each row contains the id of the selected case
+
+
diff --git a/src/adonisjs/public/importer/js/importer.js b/src/adonisjs/public/importer/js/importer.js
index b83bf7a0..a69669e2 100644
--- a/src/adonisjs/public/importer/js/importer.js
+++ b/src/adonisjs/public/importer/js/importer.js
@@ -1,11 +1,13 @@
class ImporterManager {
- constructor(){
+ constructor (){
this._totalReady = 0
this._updateCSV = this._updateCSV.bind(this)
MessageBus.i.subscribe('table/updated', this._updateCSV)
this._importDocuments = this._importDocuments.bind(this)
MessageBus.i.subscribe('author/import/documents', this._importDocuments)
+ MessageBus.i.subscribe('author/select/samples',
+ this._importSampleSelection.bind(this))
this._preStart = this._preStart.bind(this)
MessageBus.i.subscribe('control/dhtml/ready', this._preStart)
MessageBus.i.publish('control/dhtml/status/request')
@@ -33,7 +35,7 @@ class ImporterManager {
this._settingsFromUrl()
}
- _settingsFromUrl(){
+ _settingsFromUrl () {
let url = new URL(document.location)
try {
if(url.searchParams.get('quest')){
@@ -171,6 +173,79 @@ class ImporterManager {
}, 8000)
}
}
+
+ async _importSampleSelection (topic, message) {
+ console.log('=== import sample selection')
+ console.log(document.querySelector('#btn-samples').form.checkValidity())
+ console.log(this._table)
+ if(document.querySelector('#btn-samples').form.checkValidity() &&
+ this._table != null) {
+ const questId = document.querySelector('#quests').value
+ console.log('=== quest selected')
+ console.log(questId)
+
+ const roomId = document.querySelector('#rooms').value
+ console.log('=== room selected')
+ console.log(roomId)
+
+ const schema = this._table.schema
+ const content = this._table.content
+
+ for (let line = 0; line < content.length; line++) {
+ const caseId = content[line][0]
+ let csq = await MessageBus.i.request('link/quest/post',
+ {
+ questId: questId,
+ caseId: caseId,
+ orderPosition: line
+ }
+ )
+ if (csq.message.error) {
+ console.log('--- error')
+ console.log(csq.message.error)
+ } else {
+ console.log('--- link quest success')
+ let rmq = await MessageBus.i.request('link/room/post',
+ {
+ room_id: roomId,
+ case_id: caseId
+ }
+ )
+ if (rmq.message.error) {
+ console.log('--- error')
+ console.log(rmq.message.error)
+ } else {
+ console.log('--- link room success')
+ }
+ }
+ }
+ }
+ if(this._table == null){
+ let alert = document.querySelector('#alert-feedback')
+ alert.innerHTML = ""
+ let header = document.createElement('h4')
+ header.innerHTML = 'Empty table!'
+ header.classList.add('alert-header')
+ header.style.color = '#721c24'
+ alert.classList.add('alert-danger', 'alert-dismissible', 'show')
+ alert.classList.remove('alert-success')
+ alert.insertAdjacentElement('afterbegin', header)
+ alert.insertAdjacentText('beforeend','You have to drag a csv containing the list of the selected documents id in the "drag zone"')
+ alert.style.display = 'block'
+ alert.insertAdjacentHTML('beforeend',`
+ `)
+ alert.querySelector('button.close').onclick = function() {
+ alert.classList.remove('show')
+ alert.style.display = 'none'
+ }
+ setTimeout(function(){
+ alert.classList.remove('show')
+ alert.style.display = 'none'
+ }, 8000)
+ }
+ }
}
(function () {
diff --git a/src/adonisjs/public/infra/dcc-logger-manager.js b/src/adonisjs/public/infra/dcc-logger-manager.js
index bfd891d3..9fec5f1b 100644
--- a/src/adonisjs/public/infra/dcc-logger-manager.js
+++ b/src/adonisjs/public/infra/dcc-logger-manager.js
@@ -7,13 +7,22 @@ class DCCLoggerManager extends DCCLight {
this._notifyLogger = this._notifyLogger.bind(this)
this._subscribe('case/summary/#', this._notifyLogger)
+ this._subscribe('case/track/#', this._notifyLogger)
}
async _notifyLogger (topic, message, track) {
if (track) {
+ if (message.userId != null)
+ delete message.userId
+ let caseId = null
+ if (message.caseId != null) {
+ caseId = message.caseId
+ delete message.caseId
+ }
+ message.logType = MessageBus.extractLevel(topic, 2)
let logger = await MessageBus.i.request('logger/create/post',
{
- caseId: message.caseId,
+ caseId: caseId,
instanceId: MessageBus.extractLevel(topic, 3),
log: JSON.stringify(message)
}
@@ -21,9 +30,6 @@ class DCCLoggerManager extends DCCLight {
if (logger.message.error) {
console.log('--- error')
console.log(logger.message.error)
- } else {
- console.log('=== success ===')
- console.log(logger.message)
}
}
}
diff --git a/src/adonisjs/public/player/case/tracker-no-login.html b/src/adonisjs/public/player/case/tracker-no-login.html
new file mode 100644
index 00000000..5d6a5c18
--- /dev/null
+++ b/src/adonisjs/public/player/case/tracker-no-login.html
@@ -0,0 +1,165 @@
+
+
+
+
+ Tracker Download
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/adonisjs/public/player/js/heart/harena-dcc-oid.js b/src/adonisjs/public/player/js/heart/harena-dcc-oid.js
index f352e57d..74691519 100644
--- a/src/adonisjs/public/player/js/heart/harena-dcc-oid.js
+++ b/src/adonisjs/public/player/js/heart/harena-dcc-oid.js
@@ -5,22 +5,94 @@ export class HarenaDCCOid {
PlayerManager.player.startPlayer()
Bus.i.subscribe('action/robot', this.reportBlocksUpdate.bind(this))
Bus.i.subscribe('talk/robot', this.reportRobotTalk.bind(this))
+ Bus.i.publish('track/detailed')
}
reportBlocksUpdate (topic, message) {
- console.log('=== Harena to record')
- console.log(message)
+ let cps = ''
+ if (message.value == null || (message.value[0] != '{' && message.value[0] != '['))
+ cps = message.value
+ else {
+ const jsonl = message.value.split('\n')
+ const cpl = []
+ for (const jl of jsonl) {
+ let vj = JSON.parse(jl)
+ let compact = {}
+ if (!Array.isArray(vj))
+ compact = this._mapFields(vj)
+ else {
+ compact = []
+ for (const j of vj)
+ compact.push(this._mapFields(j))
+ }
+ cpl.push(compact)
+ }
+
+ let sep = ''
+ for (const cp of cpl) {
+ cps += sep + JSON.stringify(cp)
+ sep = '\n'
+ }
+ }
+
MessageBus.i.publish('input/changed/blocks',
- {value: message}, true)
+ {value: cps}, true)
+ }
+
+ _mapFields (original) {
+ const compact = {}
+ for (const field in original) {
+ let mapped = original[field]
+ if (original[field] == null)
+ mapped = 0
+ else if (typeof original[field] === 'string') {
+ if (HarenaDCCOid.mapValue[original[field]])
+ mapped = HarenaDCCOid.mapValue[original[field]]
+ } else if (typeof original[field] === 'object')
+ mapped = this._mapFields(original[field])
+
+ if (HarenaDCCOid.mapField[field])
+ compact[HarenaDCCOid.mapField[field]] = mapped
+ else
+ compact[field] = mapped
+ }
+ return compact
}
reportRobotTalk (topic, message) {
- console.log('=== Talk to record')
- console.log(message)
MessageBus.i.publish('input/changed/talk',
{value: message}, true)
}
}
+HarenaDCCOid.mapField = {
+ 'type': '1',
+ 'image': '2',
+ 'estrutura': '3',
+ 'efeito': '4',
+ 'efeitoMec': '5',
+ 'efeitoFis': '6',
+ 'onda': '7',
+ 'atvEle': '8',
+ 'atvMec': '9'
+}
+
+HarenaDCCOid.mapValue = {
+ 'sequence': 1,
+ 'eletro': 2,
+ 'mecanico': 3,
+ 'onda': 4,
+ 'fisico': 5,
+ 'ondaP': 6,
+ 'segmentoPR': 7,
+ 'ondaQRS': 8,
+ 'segmentoST': 9,
+ 'ondaT': 10,
+ 'ondaQRS': 11,
+ 'segmentoST/ondaT': 12,
+ 'segmentoPR/segmentoST': 13,
+ 'ondaQRS/segmentoST/ondaT': 14
+}
+
HarenaDCCOid.i = new HarenaDCCOid()
window.harenaDCCOid = HarenaDCCOid.i
\ No newline at end of file
diff --git a/src/adonisjs/public/player/js/heart/lively-talk-oid-custom.js b/src/adonisjs/public/player/js/heart/lively-talk-oid-custom.js
index 4223b6bd..592321f1 100644
--- a/src/adonisjs/public/player/js/heart/lively-talk-oid-custom.js
+++ b/src/adonisjs/public/player/js/heart/lively-talk-oid-custom.js
@@ -45,8 +45,6 @@ Oid.customize('foid:lively-talk', {
oid.txt = 'AnĂ¡lise | Status | |
'
//oid.txt = 'Erro | |
'
oid.know = ''
- console.log('=== simular')
- console.log(oid.statements)
if (oid.statements == null || oid.statements.length == 0){
//oid.handleSend('display', {value: '-> Nada a ser processado'})
existe = '❌'
@@ -321,8 +319,6 @@ Oid.customize('foid:lively-talk', {
else if (parameters.value.length == 0)
oid.statements = null
else if (parameters.value != null) {
- console.log('=== guarda parametros')
- console.log(parameters.value)
const lines = parameters.value.split('\n')
oid.statements = []
for (const l of lines)
diff --git a/src/adonisjs/public/player/js/htracker.js b/src/adonisjs/public/player/js/htracker.js
index e84b70b4..d894215e 100644
--- a/src/adonisjs/public/player/js/htracker.js
+++ b/src/adonisjs/public/player/js/htracker.js
@@ -2,6 +2,11 @@ class Tracker {
constructor () {
this.initializeTrack()
+ MessageBus.i.subscribe('case/start/#', this.caseStart.bind(this))
+
+ this._details = false
+ MessageBus.i.subscribe('track/detailed', this.trackDetailed.bind(this))
+
this.inputReady = this.inputReady.bind(this)
MessageBus.i.subscribe('input/ready/#', this.inputReady)
this.inputMandatory = this.inputMandatory.bind(this)
@@ -41,6 +46,23 @@ class Tracker {
this._caseCompleted = false
}
+ caseStart (topic, message) {
+ this._instanceId = MessageBus.extractLevel(topic, 3)
+
+ // redundant provisory
+ this._userId = message.userId
+ this._caseId = message.caseId
+
+ if (this._details)
+ MessageBus.i.publish('case/track/' + this._instanceId,
+ {userId: message.userId,
+ caseId: message.caseId}, true)
+ }
+
+ trackDetailed () {
+ this._details = true
+ }
+
_extractEntityId (topic, position) {
return MessageBus.extractLevelsSegment(topic, position).replace(/\//g, '.')
}
@@ -85,13 +107,27 @@ class Tracker {
// this._changedVariable(topic, message.value)
}
+ _publishDetails (message, userId, caseId) {
+ if (this._details) {
+ const ii = (this._instanceId == null)
+ ? ii = ui + '__' + ci : this._instanceId
+ message['userId'] = (userId == null) ? this._userId : userId
+ message['caseId'] = (caseId == null) ? this._caseId : caseId
+
+ MessageBus.i.publish('case/track/' + ii, message, true)
+ }
+ }
+
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._publishDetails({varTrack: tr}, message.userId, message.caseId)
+
+ this._updateVariable(varid, message.value)
// check for inconsistencies
MessageBus.i.publish('var/set/' + MessageBus.extractLevel(topic, 3),
@@ -145,10 +181,11 @@ class Tracker {
knotStart (topic, message) {
const currentDateTime = new Date()
- this._knotTrack.push(
- {knotid: this._extractEntityId(topic, 3),
- timeStart: currentDateTime.toJSON()})
+ const kt = {knotid: this._extractEntityId(topic, 3),
+ timeStart: currentDateTime.toJSON()}
+ this._knotTrack.push(kt)
this._trackStore()
+ this._publishDetails({knotTrack: kt}, this._userId, this._caseId)
}
inputSummary (topic, message) {
@@ -168,6 +205,8 @@ class Tracker {
kt.knotid = message.knotid
this._knotTrack.push(kt)
this._trackStore()
+ this._publishDetails({knotTrack: kt}, message.userId, message.caseId)
+ this._publishDetails({variables: this._variables}, message.userId, message.caseId)
MessageBus.i.publish('case/summary/' + MessageBus.extractLevel(topic, 3),
{userId: message.userId,
caseId: message.caseId,
@@ -188,6 +227,7 @@ class Tracker {
kt.knotid = message.knotid
this._knotTrack.push(kt)
this._trackStore()
+ this._publishDetails({knotTrack: kt}, message.userId, message.caseId)
MessageBus.i.publish('case/summary/' + MessageBus.extractLevel(topic, 3),
{userId: message.userId,
caseId: message.caseId,
@@ -197,10 +237,10 @@ class Tracker {
async caseTryHalt (userId, caseId, instanceId) {
const currentDateTime = new Date()
- this._knotTrack.push(
- {event: '*** try case halt ***',
- timeResume: currentDateTime.toJSON()}
- )
+ const kt = {event: '*** try case halt ***',
+ timeResume: currentDateTime.toJSON()}
+ this._knotTrack.push(kt)
+ this._publishDetails({knotTrack: kt}, userId, caseId)
this._variables['try case halt'] = '*** try case halt ***'
await MessageBus.i.publish('case/summary/' + instanceId,
{userId: userId,
@@ -214,10 +254,10 @@ class Tracker {
const track = this._trackRetrieve()
if (track != null) {
const currentDateTime = new Date()
- track.knotTrack.push(
- {event: '*** case halted ***',
- timeResume: currentDateTime.toJSON()}
- )
+ const kt = {event: '*** case halted ***',
+ timeResume: currentDateTime.toJSON()}
+ track.knotTrack.push(kt)
+ this._publishDetails({knotTrack: kt}, userId, caseId)
track.variables['case halted'] = '*** case halted ***'
MessageBus.i.publish('case/summary/' + instanceId,
{userId: userId,
diff --git a/src/adonisjs/public/player/js/teste.json b/src/adonisjs/public/player/js/teste.json
new file mode 100644
index 00000000..b1e37a05
--- /dev/null
+++ b/src/adonisjs/public/player/js/teste.json
@@ -0,0 +1 @@
+{"0":0,"1":1}
\ No newline at end of file