Skip to content

Commit

Permalink
feat (logger): logger no space
Browse files Browse the repository at this point in the history
  • Loading branch information
santanche committed Nov 24, 2021
1 parent dfb4203 commit 3d9cc70
Show file tree
Hide file tree
Showing 6 changed files with 98 additions and 20 deletions.
38 changes: 38 additions & 0 deletions src/adonisjs/public/infra/dcc-logger-manager.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/* Logger DCC
***********/

class DCCLoggerManager extends DCCLight {
constructor() {
super()

this._notifyLogger = this._notifyLogger.bind(this)
this._subscribe('case/summary/#', this._notifyLogger)
}

async _notifyLogger (topic, message, track) {
if (track) {
console.log('=== logger DCC: ' + topic)
console.log(message)

console.log('========== creating logger ==========')
let logger = await MessageBus.i.request('logger/create/post',
{
caseId: message.caseId,
instanceId: MessageBus.extractLevel(topic, 3),
log: JSON.stringify(message.knotTrack)
}
)
if (logger.message.error) {
console.log('--- error')
console.log(logger.message.error)
} else {
console.log('=== success ===')
console.log(logger.message)
}
}
}
}

(function () {
DCCLoggerManager.i = new DCCLoggerManager()
})()
29 changes: 29 additions & 0 deletions src/adonisjs/public/infra/dcc-rest-proxy.js
Original file line number Diff line number Diff line change
Expand Up @@ -639,4 +639,33 @@
}
)

DCC.component(
'harena-create-logger',
'dcc-rest',
{
environment: {
'url-manager': HarenaConfig.manager.url + HarenaConfig.manager.api
},
oas: {
paths: {
'{url-manager}/logger': {
'post': {
operationId: 'create-logger',
parameters: [
{name: 'url-manager',
in: 'path'},
{name: 'caseId',
in: 'query'},
{name: 'instanceId',
in: 'query'},
{name: 'log',
in: 'query'}
]
}
}
}
}
}
)

})()
2 changes: 2 additions & 0 deletions src/adonisjs/public/player/case/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
<script src="/infra/dcc-rest-proxy.js"></script>
<script src="/infra/dcc-basic.js"></script>
<script src="/infra/dcc-logger.js"></script>
<script src="/infra/dcc-logger-manager.js"></script>

<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png">
Expand Down Expand Up @@ -112,6 +113,7 @@
<body onload="PlayerManager.player.startPlayer()">
<!-- <div class="d-flex flex-column vh-100 vw-100 hidden-overflow"> -->

<dcc-rest id="harena-create-logger" bind="harena-create-logger" subscribe="logger/create/post"></dcc-rest>
<main role="main">
<div id="main-panel" class="d-flex flex-column vh-100 vw-100 scroll-y index-boot-padding">
<dcc-rest id="harena-case" bind="harena-case" subscribe="service/request/get"></dcc-rest>
Expand Down
10 changes: 5 additions & 5 deletions src/adonisjs/public/player/js/player.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ class PlayerManager {
result.message)
}
this._state.historyRecord(target)
this._updateFlowKnot(target)
// this._updateFlowKnot(target)
if (message.value) {
this._state.parameter = message.value
this.knotLoad(target, message.value)
Expand Down Expand Up @@ -175,17 +175,17 @@ class PlayerManager {
}

_updateFlowKnot (knot) {
console.log('=== knot & flow')
console.log(knot)
console.log(this._state.flow.slice())
// console.log('=== knot & flow')
// console.log(knot)
// console.log(this._state.flow.slice())
if (this._state.flow) {
let next
do {
next = this._state.flow.shift()
} while (this._state.flow.length > 0 && next.target != knot)
if (this._state.flow.length == 0) { delete this._state.flow }
}
console.log(this._state.flow.slice())
// console.log(this._state.flow.slice())
}

async startPlayer (caseid) {
Expand Down
26 changes: 16 additions & 10 deletions src/adonisjs/public/templates/simple/case/tbl-dynamic.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,14 @@ Write here the **stem**.
**Complementary Exams**

> Choose the 3 most relevant complementary exams to solve this case:
+ Exam 1 <-> Exam 1
+ Exam 2 <-> Exam 2
+ Exam 3 <-> Exam 3
+ Exam 4 <-> Exam 4
+ Exam 5 <-> Exam 5
? exams
* type: choice
* reveal: partial
* Exam 1 <-> Exam 1
* Exam 2 <-> Exam 2
* Exam 3 <-> Exam 3
* Exam 4 <-> Exam 4
* Exam 5 <-> Exam 5

* Next -> Conclusion

Expand Down Expand Up @@ -234,11 +237,14 @@ Write here the **stem**.
**Complementary Exams**

> Choose the 3 most relevant complementary exams to solve this case:
+ Exam 1 <-> Exam 1
+ Exam 2 <-> Exam 2
+ Exam 3 <-> Exam 3
+ Exam 4 <-> Exam 4
+ Exam 5 <-> Exam 5
? exams
* type: choice
* reveal: partial
* Exam 1 <-> Exam 1
* Exam 2 <-> Exam 2
* Exam 3 <-> Exam 3
* Exam 4 <-> Exam 4
* Exam 5 <-> Exam 5

* Next -> Conclusion

Expand Down
13 changes: 8 additions & 5 deletions src/adonisjs/public/templates/simple/knot/tbl_case.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,14 @@ Write here the **stem**.
**Complementary Exams**

> Choose the 3 most relevant complementary exams to solve this case:
+ Exam 1 <-> Exam 1
+ Exam 2 <-> Exam 2
+ Exam 3 <-> Exam 3
+ Exam 4 <-> Exam 4
+ Exam 5 <-> Exam 5
? exams
* type: choice
* reveal: partial
* Exam 1 <-> Exam 1
* Exam 2 <-> Exam 2
* Exam 3 <-> Exam 3
* Exam 4 <-> Exam 4
* Exam 5 <-> Exam 5

* Next -> Conclusion

Expand Down

0 comments on commit 3d9cc70

Please sign in to comment.