feat: 🎸 allow session recording deletion (#2132)
* feat: 🎸 allow session recording deletion
This commit is contained in:
1 parent
4db8b8e1e7
commit
786e6130cd
9 files changed
+136
-4
No files matched your search
@@ -29,4 +29,14 @@ export default class OverrideSessionRecordingAbility extends SessionRecordingAbi
|
||||
? this.hasAuthorizedAction('reapply-storage-policy')
|
||||
: false;
|
||||
}
|
||||
|
||||
/**
|
||||
* This override ensures that session recordings may be deleted only if the
|
||||
* session-recording feature flag is enabled.
|
||||
*/
|
||||
get canDelete() {
|
||||
return this.features.isEnabled('ssh-session-recording')
|
||||
? super.canDelete
|
||||
: false;
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,10 @@
|
||||
import Route from '@ember/routing/route';
|
||||
import { inject as service } from '@ember/service';
|
||||
import orderBy from 'lodash/orderBy';
|
||||
import { loading } from 'ember-loading';
|
||||
import { confirm } from 'core/decorators/confirm';
|
||||
import { action } from '@ember/object';
|
||||
import { notifySuccess, notifyError } from 'core/decorators/notify';
|
||||
|
||||
export default class ScopesScopeSessionRecordingsRoute extends Route {
|
||||
// =services
|
||||
@@ -68,4 +72,19 @@ export default class ScopesScopeSessionRecordingsRoute extends Route {
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes the session recording
|
||||
* @param {SessionRecording} recording
|
||||
*/
|
||||
@action
|
||||
@loading
|
||||
@confirm('resources.session-recording.questions.delete')
|
||||
@notifyError(({ message }) => message, { catch: true })
|
||||
@notifySuccess('notifications.delete-success')
|
||||
async delete(recording) {
|
||||
await recording.destroyRecord();
|
||||
await this.router.replaceWith('scopes.scope.session-recordings');
|
||||
this.router.refresh();
|
||||
}
|
||||
}
|
||||
+15
-2
@@ -16,8 +16,12 @@
|
||||
{{#if
|
||||
(can 'reapplyStoragePolicy session-recording' @model.sessionRecording)
|
||||
}}
|
||||
<Hds::Dropdown data-test-manage-dropdown as |dd|>
|
||||
<dd.ToggleButton @text={{t 'actions.manage'}} @color='secondary' />
|
||||
<Hds::Dropdown as |dd|>
|
||||
<dd.ToggleButton
|
||||
data-test-manage-dropdown
|
||||
@text={{t 'actions.manage'}}
|
||||
@color='secondary'
|
||||
/>
|
||||
|
||||
<dd.Interactive
|
||||
@text={{t 'resources.policy.actions.update'}}
|
||||
@@ -26,6 +30,15 @@
|
||||
(route-action 'reapplyStoragepolicy' @model.sessionRecording)
|
||||
}}
|
||||
/>
|
||||
{{#if (can 'delete session-recording' @model.sessionRecording)}}
|
||||
<dd.Separator />
|
||||
<dd.Interactive
|
||||
data-test-manage-dropdown-delete
|
||||
@color='critical'
|
||||
@text={{t 'resources.policy.actions.delete_recording'}}
|
||||
{{on 'click' (route-action 'delete' @model.sessionRecording)}}
|
||||
/>
|
||||
{{/if}}
|
||||
</Hds::Dropdown>
|
||||
{{/if}}
|
||||
</page.actions>
|
||||
|
||||
Reference in new issue
Block a user