summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLiran Tal <liran.tal@gmail.com>2023-07-29 12:28:01 +0300
committerGitHub <noreply@github.com>2023-07-29 12:28:01 +0300
commit70b15de76357b80786b5998728036164c78b65f9 (patch)
tree398bc0d3f3f2425c414c4a008d211984b32c9fd6
parenta09177d38b86a3343a4cfca02de58a103bb2b112 (diff)
fix: #250 dockly crashes on attempt to display non-existent widget (#254)v3.23.2
-rw-r--r--src/widgetsTemplates/list.widget.template.js4
-rw-r--r--widgets/containers/containerList.widget.js12
2 files changed, 11 insertions, 5 deletions
diff --git a/src/widgetsTemplates/list.widget.template.js b/src/widgetsTemplates/list.widget.template.js
index 76009ea..018140c 100644
--- a/src/widgetsTemplates/list.widget.template.js
+++ b/src/widgetsTemplates/list.widget.template.js
@@ -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)
diff --git a/widgets/containers/containerList.widget.js b/widgets/containers/containerList.widget.js
index b482267..a9e5858 100644
--- a/widgets/containers/containerList.widget.js
+++ b/widgets/containers/containerList.widget.js
@@ -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) {