feat: 🎸 Add mirage data for storage bucket id on targets (#141)
✅ Closes: ICU-8080
This commit is contained in:
1 parent
a51a74875d
commit
456a5944e0
3 files changed
+24
-3
No files matched your search
@@ -26,6 +26,8 @@ export default factory.extend({
|
||||
'remove-host-sources',
|
||||
'add-credential-sources',
|
||||
'remove-credential-sources',
|
||||
'set-storage-bucket',
|
||||
'remove-storage-bucket',
|
||||
],
|
||||
id: () => generateId('t_'),
|
||||
|
||||
@@ -66,6 +68,14 @@ export default factory.extend({
|
||||
.where((credential) => credential.scopeId === target.scope.id)
|
||||
.models.filter(() => randomBoolean())
|
||||
.map((cred) => cred.id);
|
||||
|
||||
const randomlySelectedStorageBucket = faker.helpers.arrayElement(
|
||||
server.schema.storageBuckets.all().models
|
||||
);
|
||||
if (randomlySelectedStorageBucket && randomBoolean()) {
|
||||
target.update({ storage_bucket_id: randomlySelectedStorageBucket.id });
|
||||
}
|
||||
|
||||
target.update({
|
||||
hostSets: randomlySelectedHostSets,
|
||||
brokeredCredentialSourceIds: [
|
||||
|
||||
@@ -100,5 +100,14 @@ export function targetHandler({ targets }, { params: { idMethod } }) {
|
||||
removedCredentialSources;
|
||||
}
|
||||
}
|
||||
|
||||
if (method === 'add-storage-bucket') {
|
||||
updatedAttrs.storage_bucket_id = attrs.storage_bucket_id;
|
||||
}
|
||||
|
||||
if (method === 'remove-storage-bucket') {
|
||||
updatedAttrs.storage_bucket_id = null;
|
||||
}
|
||||
|
||||
return target.update(updatedAttrs);
|
||||
}
|
||||
@@ -94,6 +94,10 @@ export default function (server) {
|
||||
role.update({ managedGroups });
|
||||
});
|
||||
|
||||
// Storage Buckets
|
||||
server.createList('storage-bucket', 3, { scope: globalScope });
|
||||
server.createList('storage-bucket', 2, { scope: orgScope });
|
||||
|
||||
// Other resources
|
||||
server.schema.scopes.where({ type: 'project' }).models.forEach((scope) => {
|
||||
server.createList('host-catalog', 8, { scope }, 'withChildren');
|
||||
@@ -110,9 +114,7 @@ export default function (server) {
|
||||
// Workers
|
||||
server.createList('worker', 3, { scope: globalScope });
|
||||
|
||||
// Session Recordings and Storage Buckets
|
||||
server.createList('storage-bucket', 3, { scope: globalScope });
|
||||
server.createList('storage-bucket', 2, { scope: orgScope });
|
||||
// Session Recordings
|
||||
server.createList(
|
||||
'session-recording',
|
||||
3,
|
||||
|
||||
Reference in new issue
Block a user