diff --git a/web/src/client/storage.js b/web/src/client/storage.js index 3356bca503..17c6b9d699 100644 --- a/web/src/client/storage.js +++ b/web/src/client/storage.js @@ -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} + */ 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(); diff --git a/web/src/client/storage.test.js b/web/src/client/storage.test.js index 8841d37c75..06475bea82 100644 --- a/web/src/client/storage.test.js +++ b/web/src/client/storage.test.js @@ -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); }; @@ -175,7 +175,7 @@ describe("#isDeprecated", () => { it("returns false", async () => { const result = await client.isDeprecated(); - expect(result).toEqual(false) + expect(result).toEqual(false); }); }); });