fix: 🐛 deleting session recording causes error (#2510)
* fix: 🐛 deleting session recording causes error ✅ Closes: https://hashicorp.atlassian.net/browse/ICU-15236 * fix: 🐛 remove scope filter & remove unused translation ✅ Closes: https://hashicorp.atlassian.net/browse/ICU-15236
This commit is contained in:
1 parent
401ff354e8
commit
64e568bd72
3 files changed
+31
-5
No files matched your search
@@ -454,7 +454,6 @@ storage-bucket:
|
||||
help_org: This storage bucket will be available for use with targets within this org.
|
||||
provider:
|
||||
label: Provider
|
||||
help: Boundary currently only supports Amazon S3 storage.
|
||||
endpoint_url:
|
||||
label: Endpoint URL
|
||||
help: Cannot be changed later.
|
||||
@@ -706,7 +705,7 @@ target:
|
||||
help: The local proxy port on which to listen by default when a session is started on a client.
|
||||
sidebar:
|
||||
label: Session Recording
|
||||
help: Record SSH sessions on this target and save them to an Amazon S3 bucket.
|
||||
help: Record SSH sessions on this target and save them to a storage bucket.
|
||||
link: Session Recording settings
|
||||
questions:
|
||||
delete-host-sources:
|
||||
|
||||
+2
-2
@@ -62,7 +62,7 @@ export default class ScopesScopeSessionRecordingsSessionRecordingChannelsByConne
|
||||
try {
|
||||
await sessionRecording.reapplyStoragePolicy();
|
||||
} catch (e) {
|
||||
await this.router.replaceWith('scopes.scope.session-recordings');
|
||||
this.router.replaceWith('scopes.scope.session-recordings');
|
||||
this.router.refresh();
|
||||
throw new Error(e);
|
||||
}
|
||||
@@ -79,7 +79,7 @@ export default class ScopesScopeSessionRecordingsSessionRecordingChannelsByConne
|
||||
@notifySuccess('notifications.delete-success')
|
||||
async delete(sessionRecording) {
|
||||
await sessionRecording.destroyRecord();
|
||||
await this.router.replaceWith('scopes.scope.session-recordings');
|
||||
this.router.replaceWith('scopes.scope.session-recordings');
|
||||
this.router.refresh();
|
||||
}
|
||||
}
|
||||
@@ -96,7 +96,10 @@ export default class ScopesScopeSessionRecordingsIndexRoute extends Route {
|
||||
if (!this.allSessionRecordings) {
|
||||
await this.getAllSessionRecordings(scope_id);
|
||||
}
|
||||
doSessionRecordingsExist = Boolean(this.allSessionRecordings.length);
|
||||
doSessionRecordingsExist = await this.getDoSessionRecordingsExist(
|
||||
scope_id,
|
||||
totalItems,
|
||||
);
|
||||
doStorageBucketsExist = await this.getDoStorageBucketsExist(scope_id);
|
||||
|
||||
return {
|
||||
@@ -125,6 +128,30 @@ export default class ScopesScopeSessionRecordingsIndexRoute extends Route {
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets doSessionRecordingsExist to true if there are any session recordings.
|
||||
* @param {string} scope_id
|
||||
* @param {number} totalItems
|
||||
* @returns {Promise<boolean>}
|
||||
*/
|
||||
async getDoSessionRecordingsExist(scope_id, totalItems) {
|
||||
if (totalItems > 0) {
|
||||
return true;
|
||||
}
|
||||
const options = { pushToStore: false, peekIndexedDB: true };
|
||||
const sessionRecordings = await this.store.query(
|
||||
'session-recording',
|
||||
{
|
||||
scope_id,
|
||||
page: 1,
|
||||
pageSize: 1,
|
||||
recursive: true,
|
||||
},
|
||||
options,
|
||||
);
|
||||
return sessionRecordings.length > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if any storage buckets exist.
|
||||
* @param {string} scope_id
|
||||
|
||||
Reference in new issue
Block a user