diff options
author | Omri Bar-Zik <omri@bar-zik.com> | 2021-05-12 14:46:08 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-12 14:46:08 +0300 |
commit | 9ef2fa30323c30ea8dc19680102d21b363a3f68b (patch) | |
tree | 1f304472d0f24ac1fbf8e7a0bd7db87da4d3a645 | |
parent | 9851ce468ab86f57b9a1b764c9e9966c89b192dd (diff) |
fix: allow Service Id Copy (#154)v3.18.2
-rw-r--r-- | hooks/services.hook.js | 20 | ||||
-rw-r--r-- | src/widgetsTemplates/help.widget.template.js | 2 | ||||
-rw-r--r-- | widgets/toolbar.widget.js | 2 |
3 files changed, 22 insertions, 2 deletions
diff --git a/hooks/services.hook.js b/hooks/services.hook.js index 8f02436..6396b1e 100644 --- a/hooks/services.hook.js +++ b/hooks/services.hook.js @@ -33,6 +33,10 @@ class hook extends baseWidget(EventEmitter) { this.emit('servicesAndImagesList', data) }) } + + if (keyString === 'c') { + this.copyServiceIdToClipboard() + } }) } @@ -60,6 +64,22 @@ class hook extends baseWidget(EventEmitter) { }) }) } + + copyServiceIdToClipboard() { + if (this.widgetsRepo && this.widgetsRepo.has('servicesList')) { + const serviceId = this.widgetsRepo.get('servicesList').getSelectedService() + if (serviceId) { + clipboardy.writeSync(serviceId) + + const actionStatus = this.widgetsRepo.get('actionStatus') + const message = `Service Id ${serviceId} was copied to the clipboard` + + actionStatus.emit('message', { + message: message + }) + } + } + } } module.exports = hook diff --git a/src/widgetsTemplates/help.widget.template.js b/src/widgetsTemplates/help.widget.template.js index d2f1ded..df51368 100644 --- a/src/widgetsTemplates/help.widget.template.js +++ b/src/widgetsTemplates/help.widget.template.js @@ -107,7 +107,7 @@ class myWidget extends baseWidget() { ▸ /: Search the containers list view ▸ i: Display information dialog about the selected container or service ▸ ⏎: Show the logs of the current container or service - ▸ c: Copy container id to the clipboard + ▸ c: Copy id to the clipboard ▸ v: Toggle between Containers and Services view ▸ q: Quit dockly diff --git a/widgets/toolbar.widget.js b/widgets/toolbar.widget.js index 984191e..1947afd 100644 --- a/widgets/toolbar.widget.js +++ b/widgets/toolbar.widget.js @@ -44,7 +44,7 @@ class myWidget extends baseWidget(EventEmitter) { keys: ['-'], callback: () => { this.emit('key', '-') } }, - 'copy container id': { + 'copy id': { keys: ['c'], callback: () => { this.emit('key', 'c') } } |