Skip to content

Commit

Permalink
fix reports (#167)
Browse files Browse the repository at this point in the history
* fix reports

* transform sidecar bus data in pipelines

* call callback at the end of busTransformer

* fix reports tweaks

---------

Co-authored-by: rafapaezbas <[email protected]>
  • Loading branch information
2 people authored and davidmarkclements committed May 29, 2024
1 parent bd242e3 commit e5f8ab8
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
6 changes: 3 additions & 3 deletions decal.html
Original file line number Diff line number Diff line change
Expand Up @@ -636,7 +636,7 @@ <h1 id="header">Unknown app</h1>
this.status = report
this.gid = Pear.Window.self.id
loader.hide()
const { type, headline, tagline, cta } = this.status
const { type, headline, tagline, cta, key } = this.status
if (type === 'update' && this.status.version?.force) {
await loader.updating(this.status.version)
continue
Expand All @@ -649,9 +649,9 @@ <h1 id="header">Unknown app</h1>
document.documentElement.classList.add('dialog')
document.body.appendChild(ctrl)
document.body.appendChild(trustConfirm)
trustConfirm.setLink(report.key.link)
trustConfirm.setLink(key.link)
trustConfirm.trust = async () => {
await this.ipc.trust({ z32: report.key.z32 })
await this.ipc.trust({ z32: key.z32 })
await this.ipc.restart({ id: this.gid })
}

Expand Down
15 changes: 12 additions & 3 deletions subsystems/sidecar/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ class Sidecar extends ReadyResource {
messages (ptn) {
const subscriber = this.sidecar.bus.sub({ topic: 'messages', id: this.id, ...(ptn ? { data: ptn } : {}) })
const stream = new streamx.PassThrough({ objectMode: true })
streamx.pipeline(subscriber, stream)
streamx.pipeline(subscriber, pickData(), stream)
return stream
}

Expand Down Expand Up @@ -359,7 +359,7 @@ class Sidecar extends ReadyResource {
warming (params, client) {
if (!client.userData) return
const stream = new streamx.PassThrough({ objectMode: true })
streamx.pipeline(client.userData.warming, stream)
streamx.pipeline(client.userData.warming, pickData(), stream)
return stream
}

Expand All @@ -370,7 +370,8 @@ class Sidecar extends ReadyResource {
reports (params, client) {
if (!client.userData) return
const stream = new streamx.PassThrough({ objectMode: true })
streamx.pipeline(client.userData.reporter, stream)
streamx.pipeline(client.userData.reporter, pickData(), stream)
return stream
}

createReport (err, client) {
Expand Down Expand Up @@ -776,4 +777,12 @@ class Sidecar extends ReadyResource {
}
}

function pickData () {
return new streamx.Transform({
transform ({ data }, cb) {
cb(null, data)
}
})
}

module.exports = Sidecar

0 comments on commit e5f8ab8

Please sign in to comment.