Skip to content

Commit

Permalink
🐛 Fix: Service Catalog filters parameters (#3995)
Browse files Browse the repository at this point in the history
  • Loading branch information
odeimaiz authored Mar 20, 2023
1 parent 35fa716 commit 7946534
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 11 deletions.
2 changes: 1 addition & 1 deletion api/specs/webserver/openapi-user.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ paths:
in: path
required: true
schema:
type: integer
type: string
patch:
tags:
- user
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,8 @@ qx.Class.define("osparc.component.service.ServiceButtonList", {

_filterTags: function(tags) {
if (tags && tags.length) {
const type = this.getServiceModel().getType() || "";
// xtype is a tuned type by the frontend
const type = this.getServiceModel().getXType() || "";
if (!tags.includes(osparc.utils.Utils.capitalize(type.trim()))) {
return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -339,17 +339,19 @@ qx.Class.define("osparc.store.Store", {
})
.catch(err => console.error("getServices failed", err))
.finally(() => {
let servicesObj = {};
if (includeRetired) {
const servicesObj = osparc.utils.Services.convertArrayToObject(allServices);
osparc.utils.Services.addTSRInfo(servicesObj);
osparc.utils.Services.servicesCached = servicesObj;
resolve(servicesObj);
servicesObj = osparc.utils.Services.convertArrayToObject(allServices);
} else {
const nonDepServices = allServices.filter(service => !(osparc.utils.Services.isRetired(service) || osparc.utils.Services.isDeprecated(service)));
const servicesObj = osparc.utils.Services.convertArrayToObject(nonDepServices);
osparc.utils.Services.addTSRInfo(servicesObj);
resolve(servicesObj);
servicesObj = osparc.utils.Services.convertArrayToObject(nonDepServices);
}
osparc.utils.Services.addTSRInfo(servicesObj);
osparc.utils.Services.addExtraTypeInfo(servicesObj);
if (includeRetired) {
osparc.utils.Services.servicesCached = servicesObj;
}
resolve(servicesObj);
});
});
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,25 @@ qx.Class.define("osparc.utils.Services", {
});
},

addExtraTypeInfo: function(services) {
Object.values(services).forEach(serviceWVersion => {
Object.values(serviceWVersion).forEach(service => {
service["xType"] = service["type"];
if (["backend", "frontend"].includes(service["xType"])) {
if (osparc.data.model.Node.isFilePicker(service)) {
service["xType"] = "file";
} else if (osparc.data.model.Node.isParameter(service)) {
service["xType"] = "parameter";
} else if (osparc.data.model.Node.isIterator(service)) {
service["xType"] = "iterator";
} else if (osparc.data.model.Node.isProbe(service)) {
service["xType"] = "probe";
}
}
});
});
},

removeFileToKeyMap: function(service) {
[
"inputs",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1313,7 +1313,7 @@ paths:
in: path
required: true
schema:
type: integer
type: string
patch:
tags:
- user
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ async def update_user_notification(request: web.Request):
nid = request.match_info["nid"]
notifs = await _get_user_notifications(redis_client, user_id)
notif_idx = next((idx for (idx, n) in enumerate(notifs) if n["id"] == nid), None)
if notif_idx:
if notif_idx is not None:
notif = notifs[notif_idx]
# body includes a dict with the changes to make
body = await request.json()
Expand Down

0 comments on commit 7946534

Please sign in to comment.