From 38acced902f014ec89531d0e4ff47e7bb07b9252 Mon Sep 17 00:00:00 2001 From: Randall Morey Date: Thu, 25 Feb 2021 12:35:57 -0500 Subject: [PATCH 1/7] =?UTF-8?q?chore:=20=F0=9F=A4=96=20support=20api=5Ferr?= =?UTF-8?q?ors=20and=20drop=20errors=20format=20flag?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ui/desktop/electron-app/src/boundary-cli.js | 7 +++++-- ui/desktop/electron-app/src/spawn-promise.js | 6 ++++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/ui/desktop/electron-app/src/boundary-cli.js b/ui/desktop/electron-app/src/boundary-cli.js index 2227687ed..e42255ea4 100644 --- a/ui/desktop/electron-app/src/boundary-cli.js +++ b/ui/desktop/electron-app/src/boundary-cli.js @@ -18,8 +18,10 @@ const escapeAndValidateBase62 = (str) => { }; module.exports = { + // Check boundary cli existence exists: () => Boolean(cliPath()), + // Initiate connection and return output connect: (target_id, token, host_id) => { const addr = origin.origin; @@ -33,13 +35,13 @@ module.exports = { `-target-id=${sanitized.target_id}`, `-token=${sanitized.token}`, `-addr=${addr}`, - '-format=json', - '--output-json-errors' + '-format=json' ]; if (host_id) command.push(`-host-id=${sanitized.host_id}`) return spawnAsyncJSONPromise(command); }, + // Returns JSON-formatted version information from the CLI version: () => { const command = [ '-v' ]; @@ -54,4 +56,5 @@ module.exports = { return { gitRevision, versionNumber, formatted }; return rawOutput; } + } diff --git a/ui/desktop/electron-app/src/spawn-promise.js b/ui/desktop/electron-app/src/spawn-promise.js index ba08e2685..47afae96d 100644 --- a/ui/desktop/electron-app/src/spawn-promise.js +++ b/ui/desktop/electron-app/src/spawn-promise.js @@ -52,8 +52,10 @@ module.exports = { childProcess.stderr.on('data', (data) => { errorStream += data.toString(); const jsonData = jsonify(errorStream); - const error = jsonData ? jsonData.error : undefined; - if (jsonData) reject(new Error(error)); + if (jsonData) { + const error = jsonData.api_error || jsonData.error; + reject(new Error(error)); + } }); }); }, From 03963579a1066e5b16c98d2039d93895b6058e73 Mon Sep 17 00:00:00 2001 From: Randall Morey Date: Fri, 26 Feb 2021 16:17:30 -0500 Subject: [PATCH 2/7] =?UTF-8?q?feat:=20=F0=9F=8E=B8=20filter=20desktop=20t?= =?UTF-8?q?argets=20by=20authorize-session=20action?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ui/desktop/app/routes/scopes/scope/projects/targets.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ui/desktop/app/routes/scopes/scope/projects/targets.js b/ui/desktop/app/routes/scopes/scope/projects/targets.js index 867011648..f16ccb61e 100644 --- a/ui/desktop/app/routes/scopes/scope/projects/targets.js +++ b/ui/desktop/app/routes/scopes/scope/projects/targets.js @@ -52,7 +52,11 @@ export default class ScopesScopeProjectsTargetsRoute extends Route { async model() { const { id: scope_id } = this.modelFor('scopes.scope'); await this.refreshSessions(); - return this.store.query('target', { recursive: true, scope_id }); + return this.store.query('target', { + filter: '"authorize-session" in "/item/authorized_actions"', + recursive: true, + scope_id + }); } /** From 13a8b531a7e14c6f6a56943982c359e187753f49 Mon Sep 17 00:00:00 2001 From: Randall Morey Date: Fri, 26 Feb 2021 16:37:12 -0500 Subject: [PATCH 3/7] =?UTF-8?q?feat:=20=F0=9F=8E=B8=20filter=20top-level?= =?UTF-8?q?=20sessions=20by=20current=20user=20ID?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controllers/scopes/scope/projects/sessions/index.js | 8 -------- ui/desktop/app/routes/scopes/scope/projects/sessions.js | 7 ++++++- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/ui/desktop/app/controllers/scopes/scope/projects/sessions/index.js b/ui/desktop/app/controllers/scopes/scope/projects/sessions/index.js index 0cfb61dbf..bafa6a171 100644 --- a/ui/desktop/app/controllers/scopes/scope/projects/sessions/index.js +++ b/ui/desktop/app/controllers/scopes/scope/projects/sessions/index.js @@ -1,12 +1,7 @@ import Controller from '@ember/controller'; -import { inject as service } from '@ember/service'; export default class ScopesScopeProjectsSessionsIndexController extends Controller { - // =sessions - - @service session; - // =attributes /** @@ -15,11 +10,8 @@ export default class ScopesScopeProjectsSessionsIndexController extends Controll * @type {SessionModel[]} */ get sorted() { - const userId = this.session.data.authenticated.user_id; const sessions = this.model; const sortedSessions = sessions - // filter sessions by current user - .filter(session => session.user_id === userId) // sort by created time .sortBy('session.created_time').reverse(); return [ diff --git a/ui/desktop/app/routes/scopes/scope/projects/sessions.js b/ui/desktop/app/routes/scopes/scope/projects/sessions.js index 149aedb7f..466a42767 100644 --- a/ui/desktop/app/routes/scopes/scope/projects/sessions.js +++ b/ui/desktop/app/routes/scopes/scope/projects/sessions.js @@ -48,8 +48,13 @@ export default class ScopesScopeProjectsSessionsRoute extends Route { */ async model() { const { id: scope_id } = this.modelFor('scopes.scope'); + const { user_id } = this.session.data.authenticated; await this.store.query('target', { recursive: true, scope_id }); - return await this.store.query('session', { recursive: true, scope_id }); + return await this.store.query('session', { + filter: `"/item/user_id" == "${user_id}"`, + recursive: true, + scope_id + }); } /** From 837d75f733ce6180c98adc67ce6114823708232c Mon Sep 17 00:00:00 2001 From: Randall Morey Date: Fri, 26 Feb 2021 17:07:29 -0500 Subject: [PATCH 4/7] =?UTF-8?q?chore:=20=F0=9F=A4=96=20poll=20for=20target?= =?UTF-8?q?s=20too,=20so=20desktop=20views=20are=20"live"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../routes/scopes/scope/projects/targets.js | 21 +++++++------------ 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/ui/desktop/app/routes/scopes/scope/projects/targets.js b/ui/desktop/app/routes/scopes/scope/projects/targets.js index f16ccb61e..63884e634 100644 --- a/ui/desktop/app/routes/scopes/scope/projects/targets.js +++ b/ui/desktop/app/routes/scopes/scope/projects/targets.js @@ -32,7 +32,7 @@ export default class ScopesScopeProjectsTargetsRoute extends Route { @task(function * () { while(true) { yield timeout(POLL_TIMEOUT_SECONDS * 1000); - yield this.refreshSessions(); + yield this.refresh(); } }).drop() poller; @@ -51,7 +51,12 @@ export default class ScopesScopeProjectsTargetsRoute extends Route { */ async model() { const { id: scope_id } = this.modelFor('scopes.scope'); - await this.refreshSessions(); + const { user_id } = this.session.data.authenticated; + await this.store.query('session', { + filter: `"/item/user_id" == "${user_id}"`, + recursive: true, + scope_id + }); return this.store.query('target', { filter: '"authorize-session" in "/item/authorized_actions"', recursive: true, @@ -59,16 +64,6 @@ export default class ScopesScopeProjectsTargetsRoute extends Route { }); } - /** - * Loads all sessions for all scopes in order to prime the store. - * Targets peek into the store to determine if they are active. - * TODO: query only for sessions associated with the current user. - */ - async refreshSessions() { - const { id: scope_id } = this.modelFor('scopes.scope'); - await this.store.query('session', { recursive: true, scope_id }); - } - /** * When this route is activated (entered), begin polling for changes. */ @@ -92,7 +87,7 @@ export default class ScopesScopeProjectsTargetsRoute extends Route { */ @action async connect(model, host) { - // TODO: Connect: Refactor into an addon + // TODO: Connect: move this logic into the target model try { // Check for CLI const cliExists = await this.ipc.invoke('cliExists'); From 61562aea0a7403da71cf09eaf4a59657f5c3271e Mon Sep 17 00:00:00 2001 From: Randall Morey Date: Fri, 26 Feb 2021 19:27:47 -0500 Subject: [PATCH 5/7] docs: add changelog entry --- ui/desktop/CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/ui/desktop/CHANGELOG.md b/ui/desktop/CHANGELOG.md index e34a1edd7..e2e21e111 100644 --- a/ui/desktop/CHANGELOG.md +++ b/ui/desktop/CHANGELOG.md @@ -7,6 +7,7 @@ Canonical reference for changes, improvements, and bugfixes for Boundary Desktop ### New & Improved +- Changes to targets (like adding, removing) are rapidly reflected in Boundary Desktop. ([PR](https://github.com/hashicorp/boundary-ui/pull/487)) - Scrolling now occurs within columns individually so that sidebar and header remain visible when scrolling the application body. ([PR](https://github.com/hashicorp/boundary-ui/pull/482)) ### Changes/Deprecations From c8a843e843a2cd39cb54234d12d80df4266bbea6 Mon Sep 17 00:00:00 2001 From: 99 Date: Sat, 27 Feb 2021 11:01:26 -0800 Subject: [PATCH 6/7] Fix a tag parameter for the release pipeline --- .github/workflows/ui-release-trigger.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ui-release-trigger.yml b/.github/workflows/ui-release-trigger.yml index 02e107c99..06dd46c0f 100644 --- a/.github/workflows/ui-release-trigger.yml +++ b/.github/workflows/ui-release-trigger.yml @@ -15,5 +15,5 @@ jobs: echo "Triggering release with a TAG ${GITHUB_REF#refs/tags/}" curl -u ${{ secrets.CIRCLE_TOKEN }}: -X POST --header "Content-Type: application/json" \ - -d '{ "branch": "main", "parameters": {"TAG": "${GITHUB_REF#refs/tags/}" }}' \ + -d '{ "branch": "main", "parameters": {"TAG": ${GITHUB_REF#refs/tags/} }}' \ https://circleci.com/api/v2/project/github/hashicorp/boundary-ui-releases/pipeline From 6ed036a35e1611004f0f30afe68c39f9b548ab5c Mon Sep 17 00:00:00 2001 From: 99 <5048814+99@users.noreply.github.com> Date: Mon, 1 Mar 2021 14:38:10 -0800 Subject: [PATCH 7/7] Update .github/workflows/ui-release-trigger.yml Co-authored-by: Sam Salisbury --- .github/workflows/ui-release-trigger.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ui-release-trigger.yml b/.github/workflows/ui-release-trigger.yml index 06dd46c0f..10683ba54 100644 --- a/.github/workflows/ui-release-trigger.yml +++ b/.github/workflows/ui-release-trigger.yml @@ -15,5 +15,5 @@ jobs: echo "Triggering release with a TAG ${GITHUB_REF#refs/tags/}" curl -u ${{ secrets.CIRCLE_TOKEN }}: -X POST --header "Content-Type: application/json" \ - -d '{ "branch": "main", "parameters": {"TAG": ${GITHUB_REF#refs/tags/} }}' \ + -d '{ "branch": "main", "parameters": {"TAG": "'${GITHUB_REF#refs/tags/}'" }}' \ https://circleci.com/api/v2/project/github/hashicorp/boundary-ui-releases/pipeline