From 6c3a3ecb7139a4c1b0c8c3248c5657fd2d852d40 Mon Sep 17 00:00:00 2001 From: dharini Date: Tue, 16 Nov 2021 09:08:00 -0800 Subject: [PATCH 1/3] updates --- .../routes/scopes/scope/projects/sessions.js | 24 ++++++- .../scopes/scope/projects/sessions/index.hbs | 62 ++++++++++++++++++- ui/desktop/electron-app/src/index.js | 2 +- 3 files changed, 84 insertions(+), 4 deletions(-) diff --git a/ui/desktop/app/routes/scopes/scope/projects/sessions.js b/ui/desktop/app/routes/scopes/scope/projects/sessions.js index 799785f5b..0ba42ce3e 100644 --- a/ui/desktop/app/routes/scopes/scope/projects/sessions.js +++ b/ui/desktop/app/routes/scopes/scope/projects/sessions.js @@ -4,6 +4,7 @@ import { task, timeout } from 'ember-concurrency'; import config from '../../../../config/environment'; import { action } from '@ember/object'; import { notifySuccess, notifyError } from 'core/decorators/notify'; +import { resourceFilterParam } from 'core/decorators/resource-filter-param'; const POLL_TIMEOUT_SECONDS = config.sessionPollingTimeoutSeconds; @@ -17,6 +18,8 @@ export default class ScopesScopeProjectsSessionsRoute extends Route { // =attributes + @resourceFilterParam(['active', 'pending', 'canceling', 'terminated']) status; + /** * A simple Ember Concurrency-based polling task that refreshes the route * every POLL_TIMEOUT_SECONDS seconds. This is necessary to display changes @@ -50,10 +53,11 @@ export default class ScopesScopeProjectsSessionsRoute extends Route { * @return {Promise{[{session: SessionModel, target: TargetModel}]}} */ async model() { + const { status } = this; 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.resourceFilterStore.queryBy('session', { user_id }, { + return await this.resourceFilterStore.queryBy('session', { user: user_id , status }, { recursive: true, scope_id }); @@ -86,4 +90,22 @@ export default class ScopesScopeProjectsSessionsRoute extends Route { await session.cancelSession(); await this.ipc.invoke('stop', { session_id: session.id }); } + + /** + * Sets the specified resource filter field to the specified value. + * @param {string} field + * @param value + */ + @action + filterBy(field, value) { + this[field] = value; + } + + /** + * Clears and filter selections. + */ + @action + clearAllFilters() { + this.status = []; + } } diff --git a/ui/desktop/app/templates/scopes/scope/projects/sessions/index.hbs b/ui/desktop/app/templates/scopes/scope/projects/sessions/index.hbs index 49b3b5423..5c12e8f32 100644 --- a/ui/desktop/app/templates/scopes/scope/projects/sessions/index.hbs +++ b/ui/desktop/app/templates/scopes/scope/projects/sessions/index.hbs @@ -9,7 +9,58 @@ + {{#if (feature-flag 'filter')}} + {{#if + (or + @model (has-resource-filter-param-selections 'scopes.scope.projects.sessions') + ) + }} + + + {{#with + (resource-filter-param 'scopes.scope.projects.sessions' 'status') + as |filter| + }} + + + + + + + + {{/with}} + {{#if + (has-resource-filter-param-selections 'scopes.scope.projects.sessions') + }} + {{t 'actions.clear-all-filters'}} + + {{/if}} + + + {{/if}} + {{/if}} + {{#if @model}} {{#if this.sorted}} @@ -87,7 +138,14 @@ {{/each}} - + {{else if (has-resource-filter-param-selections 'scopes.scope.projects.sessions')}} + + + + {{t 'descriptions.no-results'}} + + + {{else}} @@ -102,7 +160,7 @@ {{/if}} - + {{/if}} \ No newline at end of file diff --git a/ui/desktop/electron-app/src/index.js b/ui/desktop/electron-app/src/index.js index 61d9a2c57..2f41103c3 100644 --- a/ui/desktop/electron-app/src/index.js +++ b/ui/desktop/electron-app/src/index.js @@ -159,7 +159,7 @@ app.on('ready', async () => { runtimeSettings.onOriginChange(() => mainWindow.loadURL(emberAppURL)); // If you want to open up dev tools programmatically, call - // mainWindow.openDevTools(); + mainWindow.openDevTools(); // Load the ember application mainWindow.loadURL(emberAppURL); From 3e87ea6c1b2029f95b2a4d539d6591afb7717ad0 Mon Sep 17 00:00:00 2001 From: dharini Date: Tue, 16 Nov 2021 10:30:00 -0800 Subject: [PATCH 2/3] =?UTF-8?q?feat:=20=F0=9F=8E=B8=20add=20toolbar=20to?= =?UTF-8?q?=20desktop=20sessions?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../routes/scopes/scope/projects/sessions.js | 2 +- .../scopes/scope/projects/sessions/index.hbs | 19 +++++++++++-------- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/ui/desktop/app/routes/scopes/scope/projects/sessions.js b/ui/desktop/app/routes/scopes/scope/projects/sessions.js index 0ba42ce3e..a7ce4bff7 100644 --- a/ui/desktop/app/routes/scopes/scope/projects/sessions.js +++ b/ui/desktop/app/routes/scopes/scope/projects/sessions.js @@ -57,7 +57,7 @@ export default class ScopesScopeProjectsSessionsRoute extends Route { 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.resourceFilterStore.queryBy('session', { user: user_id , status }, { + return await this.resourceFilterStore.queryBy('session', { user_id , status }, { recursive: true, scope_id }); diff --git a/ui/desktop/app/templates/scopes/scope/projects/sessions/index.hbs b/ui/desktop/app/templates/scopes/scope/projects/sessions/index.hbs index 5c12e8f32..2ebe5491b 100644 --- a/ui/desktop/app/templates/scopes/scope/projects/sessions/index.hbs +++ b/ui/desktop/app/templates/scopes/scope/projects/sessions/index.hbs @@ -12,7 +12,10 @@ {{#if (feature-flag 'filter')}} {{#if (or - @model (has-resource-filter-param-selections 'scopes.scope.projects.sessions') + @model + (has-resource-filter-param-selections + 'scopes.scope.projects.sessions' + ) ) }} @@ -47,7 +50,9 @@ {{/with}} {{#if - (has-resource-filter-param-selections 'scopes.scope.projects.sessions') + (has-resource-filter-param-selections + 'scopes.scope.projects.sessions' + ) }} {{/if}} {{/if}} - {{#if @model}} - {{#if this.sorted}} + {{#if this.sorted}} @@ -138,7 +142,9 @@ {{/each}} - {{else if (has-resource-filter-param-selections 'scopes.scope.projects.sessions')}} + {{else if (has-resource-filter-param-selections + 'scopes.scope.projects.sessions' + )}} @@ -147,7 +153,6 @@ {{else}} - - - {{/if}} {{/if}} From 6efebd7f450160f0b36a3a2fcc37987d8261e10a Mon Sep 17 00:00:00 2001 From: dharini Date: Tue, 16 Nov 2021 10:40:14 -0800 Subject: [PATCH 3/3] =?UTF-8?q?fix:=20=F0=9F=90=9B=20undo=20dev=20mode?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ui/desktop/electron-app/src/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/desktop/electron-app/src/index.js b/ui/desktop/electron-app/src/index.js index 2f41103c3..61d9a2c57 100644 --- a/ui/desktop/electron-app/src/index.js +++ b/ui/desktop/electron-app/src/index.js @@ -159,7 +159,7 @@ app.on('ready', async () => { runtimeSettings.onOriginChange(() => mainWindow.loadURL(emberAppURL)); // If you want to open up dev tools programmatically, call - mainWindow.openDevTools(); + // mainWindow.openDevTools(); // Load the ember application mainWindow.loadURL(emberAppURL);