diff --git a/.github/workflows/ui-release-trigger.yml b/.github/workflows/ui-release-trigger.yml index 02e107c99..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 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 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 7b1d3cc3f..439dc78c7 100644 --- a/ui/desktop/app/controllers/scopes/scope/projects/sessions/index.js +++ b/ui/desktop/app/controllers/scopes/scope/projects/sessions/index.js @@ -1,11 +1,6 @@ import Controller from '@ember/controller'; -import { inject as service } from '@ember/service'; export default class ScopesScopeProjectsSessionsIndexController extends Controller { - // =sessions - - @service session; - // =attributes /** @@ -14,11 +9,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(); diff --git a/ui/desktop/app/routes/scopes/scope/projects/sessions.js b/ui/desktop/app/routes/scopes/scope/projects/sessions.js index 91973bf27..272cf0672 100644 --- a/ui/desktop/app/routes/scopes/scope/projects/sessions.js +++ b/ui/desktop/app/routes/scopes/scope/projects/sessions.js @@ -49,8 +49,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 + }); } /** diff --git a/ui/desktop/app/routes/scopes/scope/projects/targets.js b/ui/desktop/app/routes/scopes/scope/projects/targets.js index 6913852eb..dca07f657 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(); } /* eslint-disable-next-line prettier/prettier */ }).drop() poller; @@ -52,18 +52,17 @@ 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 }); - } - - /** - * 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 }); + 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, + scope_id + }); } /** @@ -89,7 +88,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'); diff --git a/ui/desktop/electron-app/src/boundary-cli.js b/ui/desktop/electron-app/src/boundary-cli.js index 24083493b..453a959df 100644 --- a/ui/desktop/electron-app/src/boundary-cli.js +++ b/ui/desktop/electron-app/src/boundary-cli.js @@ -20,6 +20,7 @@ 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; @@ -34,12 +35,12 @@ module.exports = { `-token=${sanitized.token}`, `-addr=${addr}`, '-format=json', - '--output-json-errors', ]; 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']; diff --git a/ui/desktop/electron-app/src/spawn-promise.js b/ui/desktop/electron-app/src/spawn-promise.js index d9f44c7a8..d73390f02 100644 --- a/ui/desktop/electron-app/src/spawn-promise.js +++ b/ui/desktop/electron-app/src/spawn-promise.js @@ -51,8 +51,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)); + } }); }); },