Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {
- "id": 116,
- "name": "flow",
- "op_start": 9,
- "op_start_type": "web_hook",
- "style": {
- "x": 41,
- "y": 35,
- "width": 250,
- "height": 250
- },
- "modules": {
- "web_hook": {
- "8": {
- "id": 8,
- "request_body": "auth",
- "name": "nameew",
- "op_success": null,
- "op_failure": null,
- "op_success_type": null,
- "op_failure_type": null,
- "style": {
- "x": 628,
- "y": 70,
- "width": 250,
- "height": 250
- }
- },
- "9": {
- "id": 9,
- "request_body": "auth",
- "name": "testontest",
- "op_success": 1,
- "op_failure": null,
- "op_success_type": "ring",
- "op_failure_type": null,
- "style": {
- "x": 438,
- "y": 140,
- "width": 250,
- "height": 250
- }
- }
- },
- "ring": {
- "1": {
- "id": 1,
- "request_body": "auth",
- "name": "testontest",
- "op_success": null,
- "op_failure": null,
- "op_success_type": null,
- "op_failure_type": null,
- "style": {
- "x": 438,
- "y": 140,
- "width": 250,
- "height": 250
- }
- }
- }
- }
- }
- {
- "nodes": [
- {
- "name": "flow",
- "id": 116,
- "x": 41,
- "y": 35,
- "width": 250,
- "inputConnectors": [],
- "outputConnectors": [
- {
- "name": "op_start"
- }
- ]
- },
- {
- "name": "web_hook",
- "id": 8,
- "x": 628,
- "y": 70,
- "inputConnectors": [
- {
- "name": "iA"
- }
- ],
- "outputConnectors": [
- {
- "name": "op_success"
- },
- {
- "name": "op_failure"
- }
- ],
- "width": 250
- },
- {
- "name": "ring",
- "id": 9,
- "x": 438,
- "y": 140,
- "inputConnectors": [
- {
- "name": "iA"
- }
- ],
- "outputConnectors": [
- {
- "name": "op_success"
- }
- ],
- "width": 250
- }
- ],
- "connections": [
- {
- "source": {
- "nodeID": 116,
- "connectorIndex": 0
- },
- "dest": {
- "nodeID": 8,
- "connectorIndex": 0
- }
- },
- {
- "source": {
- "nodeID": 8,
- "connectorIndex": 0
- },
- "dest": {
- "nodeID": 9,
- "connectorIndex": 0
- }
- }
- ]
- }
- var resData = response.data; // input json is inside response.data
- // Creating first fixed node
- var newDefinition = {
- "nodes": [
- {
- "name": "flow",
- "id": resData.id,
- "x": resData.x,
- "y": resData.y,
- "width": resData.width,
- "inputConnectors": [],
- "outputConnectors": [
- {
- "name": "op_start"
- }
- ]
- }
- ],
- "connections": []
- };
- // Getting the first connected node
- var nextType = resData.op_start_type;
- var nextId = resData.op_start;
- var next = resData.modules[nextType][nextId];
- newDefinition.nodes.push({
- "name": next.name,
- "id": next.id,
- "x": next.style.x,
- "y": next.style.y,
- "width": next.style.width,
- "inputConnectors": [
- {
- name: ''
- }
- ],
- "outputConnectors": [
- {
- "name": "op_start"
- }
- ]
- });
Add Comment
Please, Sign In to add comment