From 2cd4995c9219b14c5a2bc30ed278759cb363d992 Mon Sep 17 00:00:00 2001 From: Randall Morey Date: Wed, 31 May 2023 11:28:27 -0700 Subject: [PATCH] Feature worker recording storage path (#299) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * refactor: 💡 refactor worker form fieldset to use HDS * feat: 🎸 add recording_storage_path optional config for workers * chore: 🤖 tweak language and add learn-more link * chore: 🤖 add additional feature check * Update addons/core/translations/resources/en-us.yaml Co-authored-by: Zhihe Li * chore: 🤖 use hds inline link --------- Co-authored-by: Zhihe Li --- addons/core/translations/resources/en-us.yaml | 8 +++ .../form/worker/create-worker-led/index.hbs | 52 ++++++++++++++++--- .../form/worker/create-worker-led/index.js | 17 +++++- ui/admin/config/environment.js | 1 + 4 files changed, 70 insertions(+), 8 deletions(-) diff --git a/addons/core/translations/resources/en-us.yaml b/addons/core/translations/resources/en-us.yaml index 3833ad15a..fb38da18c 100644 --- a/addons/core/translations/resources/en-us.yaml +++ b/addons/core/translations/resources/en-us.yaml @@ -718,6 +718,14 @@ worker: worker_tags: label: Worker Tags help: Boundary can use tags to define key-value pairs which targets can use to determine where they should route connections. + local_session_recording_storage: + label: Local Session Recording Storage + help: To record sessions using this worker, specify a local storage path and ensure that it is provisioned with sufficient capacity. In progress recordings are stored locally until they complete, and then moved to the remote storage bucket associated with their target. + enable_recording_storage_path: + label: Enable Recording Storage + recording_storage_path: + label: Recording Storage Path + help: Local path on the worker node for temporary file storage. steps: 1: title: 1. Configure your new worker diff --git a/ui/admin/app/components/form/worker/create-worker-led/index.hbs b/ui/admin/app/components/form/worker/create-worker-led/index.hbs index 5ed7d7fbc..9dc167d24 100644 --- a/ui/admin/app/components/form/worker/create-worker-led/index.hbs +++ b/ui/admin/app/components/form/worker/create-worker-led/index.hbs @@ -51,12 +51,12 @@ /> {{/if}} - - <:title>{{t 'resources.worker.form.worker_tags.label'}} - <:description>{{t + + {{t 'resources.worker.form.worker_tags.label'}} + {{t 'resources.worker.form.worker_tags.help' - }} - <:body> + }} + {{#each this.workerTags as |tag index|}} @@ -108,8 +108,46 @@ - - + + + + {{#if (feature-flag 'ssh-session-recording')}} + + {{t + 'resources.worker.form.local_session_recording_storage.label' + }} + + {{t 'resources.worker.form.local_session_recording_storage.help'}} + {{t + 'actions.learn-more' + }} + + + + {{t + 'resources.worker.form.enable_recording_storage_path.label' + }} + + + {{#if this.enableRecordingStoragePath}} + + + + {{/if}} + + {{/if}} diff --git a/ui/admin/app/components/form/worker/create-worker-led/index.js b/ui/admin/app/components/form/worker/create-worker-led/index.js index 355f9ab64..256880988 100644 --- a/ui/admin/app/components/form/worker/create-worker-led/index.js +++ b/ui/admin/app/components/form/worker/create-worker-led/index.js @@ -33,6 +33,8 @@ export default class FormWorkerCreateWorkerLedComponent extends Component { @tracked workerTags = A([]); @tracked newWorkerKey; @tracked newWorkerValue; + @tracked enableRecordingStoragePath = false; + @tracked recording_storage_path = ''; get clusterIDFromURL() { const hostname = this.window?.location?.hostname; @@ -55,6 +57,14 @@ export default class FormWorkerCreateWorkerLedComponent extends Component { touch ${this.configFilePath || ''}/pki-worker.hcl`; } + get recordingStoragePathText() { + const path = this.recording_storage_path || ''; + return this.features.isEnabled('ssh-session-recording') && + this.enableRecordingStoragePath + ? `\n recording_storage_path = "${path}"` + : ''; + } + /** * Returns config creation text for ``. The user will see * different outputs based on if they are using `hcp` or `oss` binaries. @@ -93,7 +103,7 @@ worker { this.features.isEnabled('byow-pki-hcp-cluster-id') ? `${tagsText}` : `${tagsText}${upstreamText}` - } + }${this.recordingStoragePathText} }`; if (this.features.isEnabled('byow-pki-hcp-cluster-id')) { @@ -187,4 +197,9 @@ unzip *.zip ;\\ removeWorkerTagByIndex(index) { this.workerTags.removeAt(index); } + + @action + toggleEnableRecordingStoragePath() { + this.enableRecordingStoragePath = !this.enableRecordingStoragePath; + } } diff --git a/ui/admin/config/environment.js b/ui/admin/config/environment.js index 17df14226..d5d47ed8e 100644 --- a/ui/admin/config/environment.js +++ b/ui/admin/config/environment.js @@ -104,6 +104,7 @@ module.exports = function (environment) { 'worker.manage-workers': '/workers/manage-workers-on-hcp', 'worker-filters': '/worker-filters', 'storage-bucket': '/storage-buckets', + 'session-recording': '/session-recordings', }, },