Skip to content

Commit

Permalink
Merge branch 'is309/webserver-uses-apihub' of github.com:pcrespov/osp…
Browse files Browse the repository at this point in the history
…arc-simcore into is309/webserver-uses-apihub
  • Loading branch information
Pedro Crespo committed Nov 12, 2018
2 parents fec4dd3 + 6b35214 commit 1df73de
Show file tree
Hide file tree
Showing 24 changed files with 590 additions and 603 deletions.
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ matrix:
services:
- docker

cache: pip

before_install:
- python --version
- uname -a
Expand Down
53 changes: 53 additions & 0 deletions api/specs/shared/schemas/node-output-tree-api-v0.0.1.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
$schema: http://json-schema.org/draft-07/schema#
$id: https://simcore.io/api/specs/shared/schemas/node-output-tree-api-v0.0.1.yaml

title: node output tree api
description: nodes using the tree representation for the output
must be able to handle the following requests
type: object
required:
# the validator does not appreciate when required is missing here... and
# sadly does not throw any meaningful error about it... so for now I put this...
- getItemList
- getItem
properties:
getItemList:
description: a list of items making up one level of the tree
type: object
properties:
request:
summary: oa3 json schema description of the request structure.
description: |
If no `rootKey` is specified, the first level of the tree is returned.
The `filter` will return any items matching the filter string as well as any
folder items containing matching items further down the tree.
type: object
properties:
rootKey:
type: string
filter:
type: string
response:
type: array
items:
type: object
properties:
key:
type: string
label:
type: string
folder:
type: boolean
getItem:
description: get details about an item in the list
type: object
properties:
request:
type: object
required:
- key
properties:
key:
type: string
response:
type: object
16 changes: 8 additions & 8 deletions api/specs/webserver/v0/node-v0.0.1.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,10 @@ paths:
schema:
type: object
# oneOf:
# - $ref: '../../shared/schemas/node-output-list-api-v0.0.1.yaml#/properties/getItemList/request'
# - $ref: '../../shared/schemas/node-output-list-api-v0.0.1.yaml#/properties/getItem/request'
# - $ref: '../../shared/schemas/node-output-list-api-v0.0.1.yaml#/properties/getItemList/properties/request'
# - $ref: '../../shared/schemas/node-output-list-api-v0.0.1.yaml#/properties/getItem/properties/request'
# - $ref: '../../shared/schemas/node-output-tree-api-v0.0.1.yaml#/properties/getItemList/properties/request'
# - $ref: '../../shared/schemas/node-output-tree-api-v0.0.1.yaml#/properties/getItem/properties/request'
responses:
default:
description: node type specific api call according to the node type presented
Expand All @@ -79,8 +81,10 @@ paths:
schema:
type: object
# oneOf:
# - $ref: '../../shared/schemas/node-output-list-api-v0.0.1.yaml#/properties/getItemList/response'
# - $ref: '../../shared/schemas/node-output-list-api-v0.0.1.yaml#/properties/getItem/response'
# - $ref: '../../shared/schemas/node-output-list-api-v0.0.1.yaml#/properties/getItemList/properties/response'
# - $ref: '../../shared/schemas/node-output-list-api-v0.0.1.yaml#/properties/getItem/properties/response'
# - $ref: '../../shared/schemas/node-output-tree-api-v0.0.1.yaml#/properties/getItemList/properties/response'
# - $ref: '../../shared/schemas/node-output-tree-api-v0.0.1.yaml#/properties/getItem/properties/response'

/node/{nodeInstanceUUID}/iframe:
get:
Expand Down Expand Up @@ -122,10 +126,6 @@ components:
type: string
config:
type: object
apiCalls:
type: object
# oneOf:
# - $ref: '../../shared/schemas/node-output-list-api-v0.0.1.yaml#/properties'
outputApiCall:
type: object
properties:
Expand Down
2 changes: 1 addition & 1 deletion services/apihub/tests/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ openapi_spec_validator
pytest~=3.6
pytest-cov~=2.5
pytest-docker~=0.6
requests~=2.18
requests==2.20.1
requests-html~=0.9
openapi_core
2 changes: 1 addition & 1 deletion services/director/requirements/base.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
# Please keep alphabetical order
aiohttp==3.3.2
docker==3.5.0
requests==2.19.1
requests==2.20.1
tenacity==4.12.0
2 changes: 1 addition & 1 deletion services/storage/requirements/base.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ passlib==1.7.1
# See http://initd.org/psycopg/docs/install.html#binary-install-from-pypi
psycopg2-binary==2.7.5
python-socketio==1.9.0
requests==2.19.0
requests==2.20.1
sqlalchemy==1.2.9
tenacity==4.12.0
trafaret-config==2.0.1
Expand Down
28 changes: 26 additions & 2 deletions services/web/client/source/class/qxapp/component/form/Auto.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,14 @@ qx.Class.define("qxapp.component.form.Auto", {
/**
* @param structure {Array} form structure
*/
construct : function(content) {
construct : function(content, nodeModel) {
// nodeModel is necessary for creating links
if (nodeModel) {
this.setNodeModel(nodeModel);
} else {
this.setNodeModel(null);
}

this.base(arguments);
this.__ctrlMap = {};
this.__ctrlLinkMap = {};
Expand All @@ -86,6 +93,13 @@ qx.Class.define("qxapp.component.form.Auto", {
this);
},

properties: {
nodeModel: {
check: "qxapp.data.model.NodeModel",
nullable: true
}
},

events : {
/**
* fire when the form changes content and
Expand Down Expand Up @@ -530,7 +544,17 @@ qx.Class.define("qxapp.component.form.Auto", {
nodeUuid: fromNodeId,
output: fromPortId
};
this.getControlLink(toPortId).setValue("Linked to " + fromNodeId + ": " + fromPortId);

const workbenchModel = this.getNodeModel().getWorkbenchModel();
const fromNode = workbenchModel.getNodeModel(fromNodeId);
const fromNodeLabel = fromNode.getLabel(fromNodeId);
const port = fromNode.getOutput(fromPortId);
const fromPortLabel = port ? port.label : null;
if (fromNodeLabel && fromPortLabel) {
this.getControlLink(toPortId).setValue("Linked to " + fromNodeLabel + ": " + fromPortLabel);
} else {
this.getControlLink(toPortId).setValue("Linked to " + fromNodeId + ": " + fromPortId);
}

this.fireDataEvent("linkAdded", toPortId);
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,17 @@ qx.Class.define("qxapp.component.form.renderer.PropForm", {
*
* @param vizWidget {Widget} visualization widget to embedd
*/
construct: function(form, nodeModel) {
construct: function(form, workbenchModel, nodeModel) {
// workbenchModel and nodeModel are necessary for creating links
if (workbenchModel) {
this.setWorkbenchModel(workbenchModel);
} else {
this.setWorkbenchModel(null);
}
if (nodeModel) {
this.setNodeModel(nodeModel);
} else {
this.setNodeModel(null);
}

this.base(arguments, form);
Expand All @@ -40,8 +48,14 @@ qx.Class.define("qxapp.component.form.renderer.PropForm", {
},

properties: {
workbenchModel: {
check: "qxapp.data.model.WorkbenchModel",
nullable: true
},

nodeModel: {
check: "qxapp.data.model.NodeModel"
check: "qxapp.data.model.NodeModel",
nullable: true
}
},

Expand Down Expand Up @@ -145,12 +159,19 @@ qx.Class.define("qxapp.component.form.renderer.PropForm", {
}
},

__arePortsCompatible: function(node1, port1, node2, port2) {
return qxapp.data.Store.getInstance().arePortsCompatible(node1, port1, node2, port2);
__arePortsCompatible: function(node1Id, port1Id, node2Id, port2Id) {
if (this.getWorkbenchModel()) {
const node1 = this.getWorkbenchModel().getNodeModel(node1Id);
const port1 = node1.getOutput(port1Id);
const node2 = this.getWorkbenchModel().getNodeModel(node2Id);
const port2 = node2.getInput(port2Id);
return qxapp.data.Store.getInstance().arePortsCompatible(port1, port2);
}
return false;
},

__createDropMechanism: function(uiElement, portId) {
if (this.isPropertyInitialized("nodeModel")) {
if (this.getNodeModel()) {
uiElement.setDroppable(true);
uiElement.nodeId = this.getNodeModel().getNodeId();
uiElement.portId = portId;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ qx.Class.define("qxapp.component.widget.InputsMapper", {

let that = this;
tree.setDelegate({
createItem: () => new qxapp.component.widget.inputs.NodeOutputListItem(),
createItem: () => new qxapp.component.widget.inputs.NodeOutputTreeItem(),
bindItem: (c, item, id) => {
c.bindDefaultProperties(item, id);
// c.bindProperty("key", "key", null, item, id);
Expand Down Expand Up @@ -78,7 +78,7 @@ qx.Class.define("qxapp.component.widget.InputsMapper", {
const nodeInstanceUUID = null;
const itemProps = qxapp.data.Store.getInstance().getItem(nodeInstanceUUID, fromPortKey, newItem.getKey());
if (itemProps) {
let form = new qxapp.component.form.Auto(itemProps);
let form = new qxapp.component.form.Auto(itemProps, this.getNodeModel());
let propsWidget = new qxapp.component.form.renderer.PropForm(form);
newItem["propsWidget"] = propsWidget;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ qx.Class.define("qxapp.component.widget.NodePorts", {
return this.getNodeModel().getMetaData();
},

populateNodeLayout: function() {
populatePortsData: function() {
const metaData = this.getNodeModel().getMetaData();
this.__inputPort = {};
this.__outputPort = {};
Expand Down Expand Up @@ -92,15 +92,21 @@ qx.Class.define("qxapp.component.widget.NodePorts", {
let widget = null;
switch (port.type) {
case "node-output-list-api-v0.0.1": {
let nodeOutputList = new qxapp.component.widget.inputs.NodeOutputList(this.getNodeModel(), port, portKey);
widget = nodeOutputList.getOutputWidget();
console.log("widget for ", port.type, " to be implemented");
// let nodeOutputList = new qxapp.component.widget.inputs.NodeOutputList(this.getNodeModel(), port, portKey);
// widget = nodeOutputList.getOutputWidget();
break;
}
case "node-output-list-icon-api-v0.0.1": {
let nodeOutputList = new qxapp.component.widget.inputs.NodeOutputListIcon(this.getNodeModel(), port, portKey);
widget = nodeOutputList.getOutputWidget();
break;
}
case "node-output-tree-api-v0.0.1": {
let nodeOutputList = new qxapp.component.widget.inputs.NodeOutputTree(this.getNodeModel(), port, portKey);
widget = nodeOutputList.getOutputWidget();
break;
}
}
if (widget !== null) {
this._add(widget, {
Expand Down
Loading

0 comments on commit 1df73de

Please sign in to comment.