diff --git a/ui/desktop/app/routes/scopes/scope/projects.js b/ui/desktop/app/routes/scopes/scope/projects.js index 585a35ab6..0d7ada97c 100644 --- a/ui/desktop/app/routes/scopes/scope/projects.js +++ b/ui/desktop/app/routes/scopes/scope/projects.js @@ -1,7 +1,5 @@ import Route from '@ember/routing/route'; import { inject as service } from '@ember/service'; -import { action } from '@ember/object'; -import { notifySuccess, notifyError } from 'core/decorators/notify'; export default class ScopesScopeProjectsRoute extends Route { // =services @@ -28,16 +26,4 @@ export default class ScopesScopeProjectsRoute extends Route { }); } - // =actions - - /** - * Cancels the specified session and notifies user of success or error. - * @param {SessionModel} - */ - @action - @notifyError(({ message }) => message, { catch: true }) - @notifySuccess('notifications.canceled-success') - async cancelSession(session) { - await session.cancelSession(); - } } diff --git a/ui/desktop/app/routes/scopes/scope/projects/sessions.js b/ui/desktop/app/routes/scopes/scope/projects/sessions.js index ee013ee3c..1c0f133ef 100644 --- a/ui/desktop/app/routes/scopes/scope/projects/sessions.js +++ b/ui/desktop/app/routes/scopes/scope/projects/sessions.js @@ -4,6 +4,8 @@ import { all, hash } from 'rsvp'; import { task, timeout } from 'ember-concurrency'; import { A } from '@ember/array'; import config from '../../../../config/environment'; +import { action } from '@ember/object'; +import { notifySuccess, notifyError } from 'core/decorators/notify'; const POLL_TIMEOUT_SECONDS = config.sessionPollingTimeoutSeconds; @@ -100,4 +102,16 @@ export default class ScopesScopeProjectsSessionsRoute extends Route { this.poller.cancelAll(); } + // =actions + + /** + * Cancels the specified session and notifies user of success or error. + * @param {SessionModel} + */ + @action + @notifyError(({ message }) => message, { catch: true }) + @notifySuccess('notifications.canceled-success') + async cancelSession(session) { + await session.cancelSession(); + } } diff --git a/ui/desktop/app/routes/scopes/scope/projects/targets/target/sessions.js b/ui/desktop/app/routes/scopes/scope/projects/targets/target/sessions.js index bf3f475f3..8b448bd47 100644 --- a/ui/desktop/app/routes/scopes/scope/projects/targets/target/sessions.js +++ b/ui/desktop/app/routes/scopes/scope/projects/targets/target/sessions.js @@ -1,4 +1,6 @@ import Route from '@ember/routing/route'; +import { action } from '@ember/object'; +import { notifySuccess, notifyError } from 'core/decorators/notify'; export default class ScopesScopeProjectsTargetsTargetSessionsRoute extends Route { // =methods @@ -10,4 +12,17 @@ export default class ScopesScopeProjectsTargetsTargetSessionsRoute extends Route async model() { return this.modelFor('scopes.scope.projects.targets.target').sessions; } + + // =actions + + /** + * Cancels the specified session and notifies user of success or error. + * @param {SessionModel} + */ + @action + @notifyError(({ message }) => message, { catch: true }) + @notifySuccess('notifications.canceled-success') + async cancelSession(session) { + await session.cancelSession(); + } }