Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
joseivanlopez committed Mar 23, 2023
1 parent 27a8a84 commit a89748f
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
15 changes: 15 additions & 0 deletions web/src/client/storage.js
Original file line number Diff line number Diff line change
Expand Up @@ -511,16 +511,31 @@ class StorageBaseClient {
};
}

/**
* Probes the system
*/
async probe() {
const proxy = await this.proxies.storage;
return proxy.Probe();
}

/**
* Whether the system is in a deprecated status
*
* @returns {Promise<boolean>}
*/
async isDeprecated() {
const proxy = await this.proxies.storage;
return proxy.DeprecatedSystem;
}

/**
* Runs a handler function when the system becomes deprecated
*
* @callback handlerFn
*
* @param {handlerFn} handler
*/
onDeprecate(handler) {
return this.client.onObjectChanged(STORAGE_OBJECT, STORAGE_IFACE, (changes) => {
if (changes.DeprecatedSystem?.v) return handler();
Expand Down
4 changes: 2 additions & 2 deletions web/src/client/storage.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ const emitSignal = (path, iface, data) => {
if (!cockpitCallbacks[path]) return;

const handler = cockpitCallbacks[path][iface];
if(!handler) return;
if (!handler) return;

return handler(data);
};
Expand Down Expand Up @@ -175,7 +175,7 @@ describe("#isDeprecated", () => {

it("returns false", async () => {
const result = await client.isDeprecated();
expect(result).toEqual(false)
expect(result).toEqual(false);
});
});
});
Expand Down

0 comments on commit a89748f

Please sign in to comment.