Merge pull request #487 from hashicorp/chore-poll-targets
Chore poll targets - ICU-1103
This commit is contained in:
2 files changed
+9
-13
No files matched your search
@@ -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
|
||||
|
||||
@@ -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');
|
||||
|
||||
Reference in new issue
Block a user