Skip to content
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from typing import Any, Final

from playwright._impl._sync_base import EventContextManager
from playwright.sync_api import APIRequestContext, FrameLocator, Page, Request
from playwright.sync_api import APIRequestContext, FrameLocator, Locator, Page, Request
from playwright.sync_api import TimeoutError as PlaywrightTimeoutError
from playwright.sync_api import WebSocket
from pydantic import AnyUrl
Expand Down Expand Up @@ -508,3 +508,22 @@ def app_mode_trigger_next_app(page: Page) -> None:
):
# Move to next step (this auto starts the next service)
page.get_by_test_id("AppMode_NextBtn").click()


def wait_for_label_text(
page: Page,
locator: str,
substring: str,
timeout: int = 10000
) -> Locator:
page.locator(locator).wait_for(
state="visible",
timeout=timeout
)

page.wait_for_function(
f"() => document.querySelector('{locator}').innerText.includes('{substring}')",
timeout=timeout
)

return page.locator(locator)
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@
qx.Class.define("osparc.data.PollTask", {
extend: qx.core.Object,

construct: function(taskData, interval) {
construct: function(taskData, interval = 1000) {
this.base(arguments);

interval ? this.setPollInterval(interval) : this.initPollInterval();
this.setPollInterval(interval);

if (taskData && "task_id" in taskData) {
this.set({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1241,26 +1241,6 @@ qx.Class.define("osparc.data.Resources", {
}
}
},
/*
* STORAGE ASYNC
*/
"storageAsyncJobs": {
useCache: false,
endpoints: {
jobStatus: {
method: "GET",
url: statics.API + "/storage/async-jobs/{jobId}/status"
},
jobResult: {
method: "GET",
url: statics.API + "/storage/async-jobs/{jobId}/result"
},
abortJob: {
method: "POST",
url: statics.API + "/storage/async-jobs/{jobId}/abort"
},
}
},
/*
* ACTIVITY
*/
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ qx.Class.define("osparc.file.TreeFolderView", {
icon: "@FontAwesome5Solid/spinner/14",
allowGrowX: false
});
osparc.utils.Utils.setIdToWidget(control.getChildControl("label"), "totalSizeLabel");
this.getChildControl("header-layout").add(control);
break;
case "tree-folder-layout":
Expand Down Expand Up @@ -160,22 +161,18 @@ qx.Class.define("osparc.file.TreeFolderView", {
const totalSize = this.getChildControl("total-size-label");
totalSize.getChildControl("icon").getContentElement().addClass("rotate");

osparc.data.Resources.fetch("storagePaths", "requestSize", { url: { pathId } })
.then(resp => {
const jobId = resp["job_id"];
if (jobId) {
const asyncJob = new osparc.file.StorageAsyncJob(jobId);
asyncJob.addListener("resultReceived", e => {
const size = e.getData();
totalSize.set({
icon: null,
label: this.tr("Total size: ") + osparc.utils.Utils.bytesToSize(size),
});
const pollTasks = osparc.store.PollTasks.getInstance();
const fetchPromise = osparc.data.Resources.fetch("storagePaths", "requestSize", { url: { pathId } })
pollTasks.createPollingTask(fetchPromise)
.then(task => {
task.addListener("resultReceived", e => {
const size = e.getData();
totalSize.set({
icon: null,
label: this.tr("Total size: ") + osparc.utils.Utils.bytesToSize(size),
});
asyncJob.addListener("pollingError", e => {
totalSize.hide();
});
}
});
task.addListener("pollingError", e => totalSize.hide());
})
.catch(err => {
console.error(err);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ qx.Class.define("osparc.store.Services", {
const services = this.__servicesCached;
if (key in services) {
const latestMetadata = Object.values(services[key])[0];
if (!osparc.service.Utils.isRetired(latestMetadata)) {
if (!osparc.service.Utils.isDeprecated(latestMetadata)) {
return latestMetadata;
}
}
Expand Down Expand Up @@ -168,8 +168,8 @@ qx.Class.define("osparc.store.Services", {
continue;
}
if (excludeDeprecated) {
if (osparc.service.Utils.isRetired(serviceLatest)) {
// first check if a previous version of this service isn't retired
if (osparc.service.Utils.isDeprecated(serviceLatest)) {
// first check if a previous version of this service isn't deprecated
// getService to get its history
await this.getService(serviceLatest["key"], serviceLatest["version"]);
const serviceMetadata = this.__servicesCached[key][serviceLatest["version"]];
Expand All @@ -185,7 +185,7 @@ qx.Class.define("osparc.store.Services", {
}
}
}
if (osparc.service.Utils.isRetired(serviceLatest)) {
if (osparc.service.Utils.isDeprecated(serviceLatest)) {
// do not add retired services
continue;
}
Expand Down
Loading