Refresh target active sessions for admin and desktop (#3001)
* fix: 🐛 refresh sessions for targets list on admin and desktop Refresh the sessions for the targets list pages on admin and desktop so that the active sessions column is up to date ✅ Closes: https://hashicorp.atlassian.net/browse/ICU-17646 * test: 💍 add test for targets list refreshing sessions on admin ✅ Closes: https://hashicorp.atlassian.net/browse/ICU-17646 * refactor: 💡 allow ipcStub to return current mirage data ✅ Closes: https://hashicorp.atlassian.net/browse/ICU-17646 * test: 💍 ensure that desktop targets sessions are refreshed ✅ Closes: https://hashicorp.atlassian.net/browse/ICU-17646 * test: 💍 update existing tests affected by sessions refresh ipc ✅ Closes: https://hashicorp.atlassian.net/browse/ICU-17646 * refactor: 💡 remove force_refresh from sessions sync ✅ Closes: https://hashicorp.atlassian.net/browse/ICU-17646
This commit is contained in:
1 parent
177b4af695
commit
46d477ea5b
10 files changed
+217
-45
No files matched your search
@@ -56,32 +56,33 @@ export default function setupStubs(hooks) {
|
||||
stubTypes = types;
|
||||
|
||||
types.forEach((type, i) => {
|
||||
let models;
|
||||
let resourceName;
|
||||
if (typeOf(type) === 'object') {
|
||||
models = type.func();
|
||||
resourceName = type.resource;
|
||||
} else {
|
||||
models = this.server.schema[type].all().models;
|
||||
resourceName = type;
|
||||
}
|
||||
|
||||
this.ipcStub
|
||||
.withArgs('searchCacheDaemon')
|
||||
.onCall(i)
|
||||
.returns({
|
||||
[underscore(resourceNames[singularize(resourceName)])]: models.map(
|
||||
(model) => {
|
||||
// Use internal serializer to serialize the model correctly
|
||||
// according to our mirage serializers
|
||||
const modelData =
|
||||
this.server.serializerOrRegistry.serialize(model);
|
||||
.callsFake(() => {
|
||||
let models;
|
||||
let resourceName;
|
||||
if (typeOf(type) === 'object') {
|
||||
models = type.func();
|
||||
resourceName = type.resource;
|
||||
} else {
|
||||
models = this.server.schema[type].all().models;
|
||||
resourceName = type;
|
||||
}
|
||||
|
||||
// Serialize the data properly to standard JSON as that is what
|
||||
// we're expecting from the cache daemon response
|
||||
return JSON.parse(JSON.stringify(modelData));
|
||||
},
|
||||
),
|
||||
return {
|
||||
[underscore(resourceNames[singularize(resourceName)])]:
|
||||
models.map((model) => {
|
||||
// Use internal serializer to serialize the model correctly
|
||||
// according to our mirage serializers
|
||||
const modelData =
|
||||
this.server.serializerOrRegistry.serialize(model);
|
||||
|
||||
// Serialize the data properly to standard JSON as that is what
|
||||
// we're expecting from the cache daemon response
|
||||
return JSON.parse(JSON.stringify(modelData));
|
||||
}),
|
||||
};
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user