Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨ Rocket-lite Navigation Bar review #3619

Merged
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ qx.Class.define("osparc.auth.core.Utils", {
const regEx = /^\+[1-9]\d{4,14}$/;
const isValid = regEx.test(phoneNumber);
item.set({
invalidMessage: isValid ? "" : qx.locale.Manager.tr("Invalid phone number. Please, [+][country code][phone number plus area code]"),
invalidMessage: isValid ? "" : qx.locale.Manager.tr("Invalid phone number. Please, [+][country code][phone number]"),
valid: isValid
});
return isValid;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ qx.Class.define("osparc.component.metadata.ServicesInStudy", {
const infoButton = new qx.ui.form.Button(null, "@MaterialIcons/info_outline/14");
infoButton.addListener("execute", () => {
const metadata = osparc.utils.Services.getMetaData(node["key"], node["version"]);
const serviceDetails = new osparc.servicecard.Large(metadata, {
const serviceDetails = new osparc.info.ServiceLarge(metadata, {
nodeId,
label: node["label"]
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ qx.Class.define("osparc.component.node.BaseNodeView", {

__openServiceDetails: function() {
const node = this.getNode();
const serviceDetails = new osparc.servicecard.Large(node.getMetaData(), {
const serviceDetails = new osparc.info.ServiceLarge(node.getMetaData(), {
nodeId: node.getNodeId(),
label: node.getLabel(),
study: node.getStudy()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -237,14 +237,14 @@ qx.Class.define("osparc.component.widget.NodesTree", {
if (nodeId) {
const study = this.getStudy();
if (nodeId === study.getUuid()) {
const studyDetails = new osparc.studycard.Large(study);
const studyDetails = new osparc.info.StudyLarge(study);
const title = this.tr("Study Information");
const width = 500;
const height = 500;
osparc.ui.window.Window.popUpInWindow(studyDetails, title, width, height);
} else {
const node = study.getWorkbench().getNode(nodeId);
const serviceDetails = new osparc.servicecard.Large(node.getMetaData(), {
const serviceDetails = new osparc.info.ServiceLarge(node.getMetaData(), {
nodeId,
label: node.getLabel(),
study
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ qx.Class.define("osparc.component.widget.StudyTitleOnlyTree", {
},

__openStudyInfo: function() {
const studyDetails = new osparc.studycard.Large(this.getStudy());
const studyDetails = new osparc.info.StudyLarge(this.getStudy());
const title = this.tr("Study Information");
const width = 500;
const height = 500;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ qx.Class.define("osparc.component.widget.logger.LoggerView", {
toolTipText: this.tr("Download logs"),
appearance: "toolbar-button"
});
osparc.utils.Utils.setIdToWidget(control, "downloadLogsToClipboardButton");
osparc.utils.Utils.setIdToWidget(control, "downloadLogsButton");
toolbar.add(control);
break;
}
Expand Down Expand Up @@ -226,7 +226,7 @@ qx.Class.define("osparc.component.widget.logger.LoggerView", {
toolbar.add(copyToClipboardButton);

const downloadButton = this.getChildControl("download-logs-button");
downloadButton.addListener("execute", () => this.__downloadLogs(), this);
downloadButton.addListener("execute", () => this.downloadLogs(), this);
toolbar.add(downloadButton);

return toolbar;
Expand Down Expand Up @@ -297,7 +297,7 @@ qx.Class.define("osparc.component.widget.logger.LoggerView", {
osparc.utils.Utils.copyTextToClipboard(this.__getLogsString());
},

__downloadLogs: function() {
downloadLogs: function() {
const logs = this.__getLogsString();
osparc.utils.Utils.downloadContent("data:text/plain;charset=utf-8," + logs, "logs.log");
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ qx.Class.define("osparc.component.workbench.ServiceCatalog", {
},

__showServiceDetails: function() {
const serviceDetails = new osparc.servicecard.Large(this.__getSelectedService());
const serviceDetails = new osparc.info.ServiceLarge(this.__getSelectedService());
const title = this.tr("Service information");
const width = 600;
const height = 700;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1520,7 +1520,7 @@ qx.Class.define("osparc.component.workbench.WorkbenchUI", {
__openNodeInfo: function(nodeId) {
if (nodeId) {
const node = this.getStudy().getWorkbench().getNode(nodeId);
const serviceDetails = new osparc.servicecard.Large(node.getMetaData(), {
const serviceDetails = new osparc.info.ServiceLarge(node.getMetaData(), {
nodeId,
label: node.getLabel(),
study: this.getStudy()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ qx.Class.define("osparc.dashboard.ResourceMoreOptions", {
const title = this.tr("Information");
const icon = "@FontAwesome5Solid/info";
const resourceData = this.__resourceData;
const infoCard = osparc.utils.Resources.isService(resourceData) ? new osparc.servicecard.Large(resourceData, null, false) : new osparc.studycard.Large(resourceData, false);
const infoCard = osparc.utils.Resources.isService(resourceData) ? new osparc.info.ServiceLarge(resourceData, null, false) : new osparc.info.StudyLarge(resourceData, false);
infoCard.addListener("openAccessRights", () => this.openAccessRights());
infoCard.addListener("openClassifiers", () => this.openClassfiers());
infoCard.addListener("openQuality", () => this.openQuality());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ qx.Class.define("osparc.desktop.MainPage", {
__createNavigationBar: function() {
const navBar = new osparc.navigation.NavigationBar();
navBar.addListener("backToDashboardPressed", () => this.__backToDashboardPressed(), this);
navBar.addListener("downloadStudyLogs", () => this.__downloadStudyLogs(), this);
return navBar;
},

Expand Down Expand Up @@ -124,6 +125,12 @@ qx.Class.define("osparc.desktop.MainPage", {
dashboardBtn.setFetching(false);
},

__downloadStudyLogs: function() {
if (this.__studyEditor) {
this.__studyEditor.getStudyLogger().downloadLogs();
}
},

__createMainStack: function() {
const mainStack = new qx.ui.container.Stack().set({
alignX: "center"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ qx.Class.define("osparc.desktop.SlideshowToolbar", {
},

__openStudyDetails: function() {
const studyDetails = new osparc.studycard.Large(this.getStudy());
const studyDetails = new osparc.info.StudyLarge(this.getStudy());
const title = this.tr("Study Information");
const width = 500;
const height = 500;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ qx.Class.define("osparc.desktop.StudyEditor", {
this.__requestStartPipeline(this.getStudy().getUuid(), partialPipeline);
})
.catch(() => {
this.__getStudyLogger().error(null, "Run failed");
this.getStudyLogger().error(null, "Run failed");
this.getStudy().setPipelineRunning(false);
});
},
Expand All @@ -338,14 +338,14 @@ qx.Class.define("osparc.desktop.StudyEditor", {
const req = new osparc.io.request.ApiRequest(url, "POST");
req.addListener("success", this.__onPipelinesubmitted, this);
req.addListener("error", () => {
this.__getStudyLogger().error(null, "Error submitting pipeline");
this.getStudyLogger().error(null, "Error submitting pipeline");
this.getStudy().setPipelineRunning(false);
}, this);
req.addListener("fail", e => {
if (e.getTarget().getStatus() == "403") {
this.__getStudyLogger().error(null, "Pipeline is already running");
this.getStudyLogger().error(null, "Pipeline is already running");
} else if (e.getTarget().getStatus() == "422") {
this.__getStudyLogger().info(null, "The pipeline is up-to-date");
this.getStudyLogger().info(null, "The pipeline is up-to-date");
const msg = this.tr("The pipeline is up-to-date. Do you want to re-run it?");
const win = new osparc.ui.window.Confirmation(msg).set({
confirmText: this.tr("Run"),
Expand All @@ -359,7 +359,7 @@ qx.Class.define("osparc.desktop.StudyEditor", {
}
}, this);
} else {
this.__getStudyLogger().error(null, "Failed submitting pipeline");
this.getStudyLogger().error(null, "Failed submitting pipeline");
}
this.getStudy().setPipelineRunning(false);
}, this);
Expand All @@ -375,9 +375,9 @@ qx.Class.define("osparc.desktop.StudyEditor", {
req.setRequestData(requestData);
req.send();
if (partialPipeline.length) {
this.__getStudyLogger().info(null, "Starting partial pipeline");
this.getStudyLogger().info(null, "Starting partial pipeline");
} else {
this.__getStudyLogger().info(null, "Starting pipeline");
this.getStudyLogger().info(null, "Starting pipeline");
}

return true;
Expand All @@ -387,15 +387,15 @@ qx.Class.define("osparc.desktop.StudyEditor", {
const resp = e.getTarget().getResponse();
const pipelineId = resp.data["pipeline_id"];
const iterationRefIds = resp.data["ref_ids"];
this.__getStudyLogger().debug(null, "Pipeline ID " + pipelineId);
this.getStudyLogger().debug(null, "Pipeline ID " + pipelineId);
const notGood = [null, undefined, -1];
if (notGood.includes(pipelineId)) {
this.__getStudyLogger().error(null, "Submission failed");
this.getStudyLogger().error(null, "Submission failed");
} else {
if (iterationRefIds) {
this.__reloadSnapshotsAndIterations();
}
this.__getStudyLogger().info(null, "Pipeline started");
this.getStudyLogger().info(null, "Pipeline started");
/* If no projectStateUpdated comes in 60 seconds, client must
check state of pipeline and update button accordingly. */
const timer = setTimeout(() => {
Expand All @@ -422,12 +422,12 @@ qx.Class.define("osparc.desktop.StudyEditor", {
__requestStopPipeline: function(studyId) {
const url = "/computations/" + encodeURIComponent(studyId) + ":stop";
const req = new osparc.io.request.ApiRequest(url, "POST");
req.addListener("success", () => this.__getStudyLogger().debug(null, "Pipeline aborting"), this);
req.addListener("error", () => this.__getStudyLogger().error(null, "Error stopping pipeline"), this);
req.addListener("fail", () => this.__getStudyLogger().error(null, "Failed stopping pipeline"), this);
req.addListener("success", () => this.getStudyLogger().debug(null, "Pipeline aborting"), this);
req.addListener("error", () => this.getStudyLogger().error(null, "Error stopping pipeline"), this);
req.addListener("fail", () => this.getStudyLogger().error(null, "Failed stopping pipeline"), this);
req.send();

this.__getStudyLogger().info(null, "Stopping pipeline");
this.getStudyLogger().info(null, "Stopping pipeline");
return true;
},
// ------------------ START/STOP PIPELINE ------------------
Expand All @@ -436,13 +436,13 @@ qx.Class.define("osparc.desktop.StudyEditor", {
this.updateStudyDocument(false)
.then(() => {
if (node) {
this.__getStudyLogger().debug(node.getNodeId(), "Retrieving inputs");
this.getStudyLogger().debug(node.getNodeId(), "Retrieving inputs");
node.retrieveInputs(portKey);
} else {
this.__getStudyLogger().debug(null, "Retrieving inputs");
this.getStudyLogger().debug(null, "Retrieving inputs");
}
});
this.__getStudyLogger().debug(null, "Updating pipeline");
this.getStudyLogger().debug(null, "Updating pipeline");
},

// overridden
Expand All @@ -455,7 +455,7 @@ qx.Class.define("osparc.desktop.StudyEditor", {
this.__slideshowView.nodeSelected(nodeId);
},

__getStudyLogger: function() {
getStudyLogger: function() {
return this.__workbenchView.getLogger();
},

Expand Down Expand Up @@ -615,7 +615,7 @@ qx.Class.define("osparc.desktop.StudyEditor", {
console.error(error);
osparc.component.message.FlashMessenger.getInstance().logAs(this.tr("Error saving the study"), "ERROR");
}
this.__getStudyLogger().error(null, "Error updating pipeline");
this.getStudyLogger().error(null, "Error updating pipeline");
// Need to throw the error to be able to handle it later
throw error;
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -832,7 +832,7 @@ qx.Class.define("osparc.desktop.WorkbenchView", {
this.__studyOptionsPage.getChildControl("button").show();
this.getChildControl("side-panel-right-tabs").setSelection([this.__studyOptionsPage]);

this.__studyOptionsPage.add(new osparc.studycard.Medium(study), {
this.__studyOptionsPage.add(new osparc.info.StudyMedium(study), {
flex: 1
});

Expand Down
Loading