Skip to content

Commit

Permalink
fix: #250 dockly crashes on attempt to display non-existent widget (#254
Browse files Browse the repository at this point in the history
)
  • Loading branch information
lirantal authored Jul 29, 2023
1 parent a09177d commit 70b15de
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/widgetsTemplates/list.widget.template.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ class myWidget extends baseWidget(EventEmitter) {
this.toggleWidgetListColor = !this.toggleWidgetListColor

if (this.toggleWidgetListColor) {
str = chalk.cyan(chunk.toString('utf-8').trim())
str = chalk.cyan(chunk.toString('utf8').trim())
} else {
str = chalk.green(chunk.toString('utf-8').trim())
str = chalk.green(chunk.toString('utf8').trim())
}

this.updateItemLogs(str)
Expand Down
12 changes: 9 additions & 3 deletions widgets/containers/containerList.widget.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,21 @@ class myWidget extends ListWidget {
}

getItemLogs (containerId, cb) {
return this.utilsRepo.get('docker').getContainerLogs(containerId, cb)
if (this.widgetsRepo.has('containerLogs')) {
return this.utilsRepo.get('docker').getContainerLogs(containerId, cb)
}
}

updateItemLogs (str) {
return this.widgetsRepo.get('containerLogs').update(str)
if (this.widgetsRepo.has('containerLogs')) {
return this.widgetsRepo.get('containerLogs').update(str)
}
}

clearItemLogs () {
return this.widgetsRepo.get('containerLogs').clear()
if (this.widgetsRepo.has('containerLogs')) {
return this.widgetsRepo.get('containerLogs').clear()
}
}

getListItems (cb) {
Expand Down

0 comments on commit 70b15de

Please sign in to comment.