diff --git a/awx/network_ui/static/network_ui/.gitignore b/awx/network_ui/static/network_ui/.gitignore index bacea08b79..4b8b5ad138 100644 --- a/awx/network_ui/static/network_ui/.gitignore +++ b/awx/network_ui/static/network_ui/.gitignore @@ -1,7 +1,6 @@ /bundle.js /node_modules /style.css -/extract.js /css /js /src-instrumented diff --git a/awx/network_ui/static/network_ui/Makefile b/awx/network_ui/static/network_ui/Makefile index b23f0a55b2..78b3c0c90c 100644 --- a/awx/network_ui/static/network_ui/Makefile +++ b/awx/network_ui/static/network_ui/Makefile @@ -34,3 +34,40 @@ simple-server: lint main lessc deploy: main rsync -av src/ ../../../../awx/ui/client/src/network_ui/ + + +extract: + mkdir -p extracted + ./extract.js ./src/button.js > extracted/button.yml + ./extract.js ./src/buttons.js > extracted/buttons.yml + ./extract.js ./src/device.detail.fsm.js > extracted/device_detail.yml + ./extract.js ./src/group.js > extracted/group.yml + ./extract.js ./src/hotkeys.fsm.js > extracted/hotkeys.yml + ./extract.js ./src/link.js > extracted/link.yml + ./extract.js ./src/mode.fsm.js > extracted/mode.yml + ./extract.js ./src/move.js > extracted/move.yml + ./extract.js ./src/null.fsm.js > extracted/null.yml + ./extract.js ./src/rack.fsm.js > extracted/rack.yml + ./extract.js ./src/site.fsm.js > extracted/site.yml + ./extract.js ./src/stream.fsm.js > extracted/stream.yml + ./extract.js ./src/toolbox.fsm.js > extracted/toolbox.yml + ./extract.js ./src/view.js > extracted/view.yml + ./extract.js ./src/time.js > extracted/time.yml + + +diff: + fsm_diff designs/button.yml extracted/button.yml + fsm_diff designs/buttons.yml extracted/buttons.yml + fsm_diff designs/device_detail.yml extracted/device_detail.yml + fsm_diff designs/group.yml extracted/group.yml + fsm_diff designs/hotkeys.yml extracted/hotkeys.yml + fsm_diff designs/link.yml extracted/link.yml + fsm_diff designs/mode.yml extracted/mode.yml + fsm_diff designs/move.yml extracted/move.yml + fsm_diff designs/null.yml extracted/null.yml + fsm_diff designs/rack.yml extracted/rack.yml + fsm_diff designs/site.yml extracted/site.yml + fsm_diff designs/stream.yml extracted/stream.yml + fsm_diff designs/time.yml extracted/time.yml + fsm_diff designs/toolbox.yml extracted/toolbox.yml + fsm_diff designs/view.yml extracted/view.yml diff --git a/awx/network_ui/static/network_ui/designs/buttons.yml b/awx/network_ui/static/network_ui/designs/buttons.yml index 449021f616..a0efa20d36 100644 --- a/awx/network_ui/static/network_ui/designs/buttons.yml +++ b/awx/network_ui/static/network_ui/designs/buttons.yml @@ -17,7 +17,7 @@ states: y: 491 transitions: - from_state: Start - label: '' + label: start to_state: Ready - from_state: Ready label: onMouseDown diff --git a/awx/network_ui/static/network_ui/designs/group.yml b/awx/network_ui/static/network_ui/designs/group.yml index c5b3f146c8..3c36f739c4 100644 --- a/awx/network_ui/static/network_ui/designs/group.yml +++ b/awx/network_ui/static/network_ui/designs/group.yml @@ -1,6 +1,10 @@ -finite_state_machine_id: 102 +finite_state_machine_id: 6 name: fsm states: +- id: 11 + label: Disable + x: 497 + y: 84 - id: 1 label: Resize x: 571 @@ -25,14 +29,6 @@ states: label: Move x: 1297 y: 786 -- id: 7 - label: Ready - x: 740 - y: 324 -- id: 8 - label: EditLabel - x: 1056 - y: 148 - id: 9 label: Selected2 x: 1179 @@ -41,58 +37,75 @@ states: label: Placing x: 410 y: 295 +- id: 7 + label: Ready + x: 733 + y: 304 +- id: 8 + label: EditLabel + x: 1130 + y: 112 transitions: -- from_state: Ready - label: onMouseDown - to_state: Selected1 -- from_state: EditLabel - label: onMouseDown - to_state: Ready -- from_state: Selected2 - label: onMouseDown - to_state: Ready -- from_state: Selected2 - label: onMouseDown - to_state: Selected3 -- from_state: Selected1 - label: onMouseUp - to_state: Selected2 -- from_state: Move - label: onMouseUp - to_state: Selected2 -- from_state: Selected1 - label: onMouseMove - to_state: Move -- from_state: Start - label: start - to_state: Ready -- from_state: Ready - label: onMouseDown - to_state: CornerSelected -- from_state: Selected3 - label: onMouseMove - to_state: Move -- from_state: Selected3 - label: onMouseUp - to_state: EditLabel -- from_state: Ready - label: onNewGroup - to_state: Placing -- from_state: Placing - label: onMouseDown - to_state: CornerSelected - from_state: CornerSelected label: onMouseMove to_state: Resize -- from_state: Resize - label: onMouseUp - to_state: Selected1 -- from_state: Selected2 - label: onNewGroup - to_state: Ready -- from_state: CornerSelected - label: onMouseUp - to_state: Selected1 +- from_state: Placing + label: onMouseDown + to_state: CornerSelected +- from_state: Ready + label: onMouseDown + to_state: CornerSelected - from_state: Move label: onMouseDown to_state: Selected1 +- from_state: CornerSelected + label: onMouseUp + to_state: Selected1 +- from_state: Resize + label: onMouseUp + to_state: Selected1 +- from_state: Ready + label: onMouseDown + to_state: Selected1 +- from_state: Selected2 + label: onMouseDown + to_state: Selected3 +- from_state: Selected3 + label: onMouseMove + to_state: Move +- from_state: Selected1 + label: onMouseMove + to_state: Move +- from_state: EditLabel + label: onKeyDown + to_state: Selected2 +- from_state: Ready + label: onPasteGroup + to_state: Selected2 +- from_state: Move + label: onMouseUp + to_state: Selected2 +- from_state: Selected1 + label: onMouseUp + to_state: Selected2 +- from_state: Ready + label: onNewGroup + to_state: Placing +- from_state: Selected2 + label: onKeyDown + to_state: Ready +- from_state: Selected2 + label: onNewGroup + to_state: Ready +- from_state: Start + label: start + to_state: Ready +- from_state: Selected2 + label: onMouseDown + to_state: Ready +- from_state: EditLabel + label: onMouseDown + to_state: Ready +- from_state: Selected3 + label: onMouseUp + to_state: EditLabel diff --git a/awx/network_ui/static/network_ui/designs/link.yml b/awx/network_ui/static/network_ui/designs/link.yml index a7eed0994b..f5227f500f 100644 --- a/awx/network_ui/static/network_ui/designs/link.yml +++ b/awx/network_ui/static/network_ui/designs/link.yml @@ -1,32 +1,27 @@ -app: link -panX: -15 -panY: 0 -scaleXY: 1 +finite_state_machine_id: 10 +name: src/link states: -- label: Ready - size: 100 - x: 540 - y: 307 -- label: Start - size: 100 - x: 533 - y: 96 -- label: Selecting - size: 100 - x: 780 - y: 299 -- label: Connecting - size: 100 - x: 782 - y: 541 -- label: Connected - size: 100 - x: 546 - y: 543 +- id: 5 + label: Selecting + x: -429 + y: 63 +- id: 2 + label: Start + x: 15 + y: -221 +- id: 4 + label: Connecting + x: -429 + y: 466 +- id: 3 + label: Connected + x: 47 + y: 453 +- id: 1 + label: Ready + x: 26 + y: 61 transitions: -- from_state: Start - label: start - to_state: Ready - from_state: Ready label: onNewLink to_state: Selecting @@ -36,6 +31,12 @@ transitions: - from_state: Connecting label: onMouseUp to_state: Connected -- from_state: Connected - label: free +- from_state: Connecting + label: onMouseUp + to_state: Ready +- from_state: Connected + label: start + to_state: Ready +- from_state: Start + label: start to_state: Ready diff --git a/awx/network_ui/static/network_ui/designs/move.yml b/awx/network_ui/static/network_ui/designs/move.yml index 4425aaa4d0..bc6d55ebfb 100644 --- a/awx/network_ui/static/network_ui/designs/move.yml +++ b/awx/network_ui/static/network_ui/designs/move.yml @@ -1,6 +1,10 @@ -finite_state_machine_id: 106 +finite_state_machine_id: 13 name: move states: +- id: 9 + label: Disable + x: 743 + y: 108 - id: 1 label: Start x: 533 @@ -34,54 +38,57 @@ states: x: 92 y: 82 transitions: +- from_state: Selected2 + label: onKeyDown + to_state: Ready +- from_state: Selected2 + label: onNewDevice + to_state: Ready +- from_state: EditLabel + label: onMouseDown + to_state: Ready +- from_state: Selected2 + label: onMouseDown + to_state: Ready - from_state: Start label: start to_state: Ready -- from_state: Ready +- from_state: Move label: onMouseDown to_state: Selected1 -- from_state: Selected1 - label: onMouseUp - to_state: Selected2 -- from_state: Selected1 - label: onMouseMove - to_state: Move -- from_state: Selected2 +- from_state: Placing label: onMouseDown - to_state: Ready + to_state: Selected1 - from_state: Move label: onMouseUp to_state: Selected1 +- from_state: Ready + label: onMouseDown + to_state: Selected1 +- from_state: Ready + label: onPasteDevice + to_state: Selected2 - from_state: EditLabel label: onKeyDown to_state: Selected2 -- from_state: EditLabel - label: onMouseDown - to_state: Ready -- from_state: Selected2 - label: onMouseDown - to_state: Selected3 +- from_state: Selected1 + label: onMouseUp + to_state: Selected2 +- from_state: Placing + label: onMouseMove + to_state: Move - from_state: Selected3 label: onMouseMove to_state: Move +- from_state: Selected1 + label: onMouseMove + to_state: Move - from_state: Selected3 label: onMouseUp to_state: EditLabel -- from_state: Placing - label: onMouseMove - to_state: Move +- from_state: Selected2 + label: onMouseDown + to_state: Selected3 - from_state: Ready label: onNewDevice to_state: Placing -- from_state: Placing - label: onMouseDown - to_state: Selected1 -- from_state: Move - label: onMouseDown - to_state: Selected1 -- from_state: Selected2 - label: onNewDevice - to_state: Ready -- from_state: Selected2 - label: onKeyDown - to_state: Ready diff --git a/awx/network_ui/static/network_ui/designs/time.yml b/awx/network_ui/static/network_ui/designs/time.yml index 4c431fabd3..5ef3634919 100644 --- a/awx/network_ui/static/network_ui/designs/time.yml +++ b/awx/network_ui/static/network_ui/designs/time.yml @@ -1,7 +1,7 @@ -finite_state_machine_id: 89 +finite_state_machine_id: 11 name: src/time states: -- id: 3 +- id: 1 label: Present x: 256 y: 123 @@ -9,14 +9,11 @@ states: label: Start x: 245 y: -161 -- id: 1 +- id: 3 label: Past x: -115 y: 129 transitions: -- from_state: Past - label: onMessage - to_state: Present - from_state: Past label: onRedo to_state: Present @@ -29,9 +26,6 @@ transitions: - from_state: Start label: start to_state: Present -- from_state: Present - label: onMessage - to_state: Past - from_state: Present label: onUndo to_state: Past diff --git a/awx/network_ui/static/network_ui/designs/toolbox.yml b/awx/network_ui/static/network_ui/designs/toolbox.yml index 99ed20522c..16233fa9fe 100644 --- a/awx/network_ui/static/network_ui/designs/toolbox.yml +++ b/awx/network_ui/static/network_ui/designs/toolbox.yml @@ -1,49 +1,62 @@ -finite_state_machine_id: 120 +finite_state_machine_id: 14 name: toolbox states: -- id: 6 - label: Dropping - x: 1197 - y: 427 -- id: 4 - label: Selected - x: 889 - y: 713 - id: 2 + label: Selected + x: 1180 + y: 959 +- id: 6 + label: Move + x: 1409 + y: 741 +- id: 3 label: Ready x: 892 y: 429 -- id: 3 +- id: 4 label: Scrolling x: 567 y: 431 -- id: 1 +- id: 5 label: Start x: 892 y: 216 -- id: 5 - label: Move - x: 1197 - y: 708 +- id: 7 + label: Selecting + x: 888 + y: 710 +- id: 1 + label: Dropping + x: 1358 + y: 431 transitions: -- from_state: Start - label: start - to_state: Ready -- from_state: Move - label: onMouseUp - to_state: Dropping -- from_state: Dropping - label: start - to_state: Ready -- from_state: Ready +- from_state: Selecting label: onMouseDown to_state: Selected -- from_state: Ready - label: onMouseWheel - to_state: Scrolling -- from_state: Scrolling - label: start - to_state: Ready - from_state: Selected label: onMouseMove to_state: Move +- from_state: Selecting + label: onMouseDown + to_state: Ready +- from_state: Selected + label: onMouseUp + to_state: Ready +- from_state: Dropping + label: start + to_state: Ready +- from_state: Start + label: start + to_state: Ready +- from_state: Scrolling + label: onMouseWheel + to_state: Ready +- from_state: Ready + label: onMouseWheel + to_state: Scrolling +- from_state: Ready + label: onMouseDown + to_state: Selecting +- from_state: Move + label: onMouseUp + to_state: Dropping diff --git a/awx/network_ui/static/network_ui/designs/view.yml b/awx/network_ui/static/network_ui/designs/view.yml index cae0d7785c..ee889f5a3e 100644 --- a/awx/network_ui/static/network_ui/designs/view.yml +++ b/awx/network_ui/static/network_ui/designs/view.yml @@ -1,38 +1,36 @@ -app: view -panX: 1 -panY: -67 -scaleXY: 1 +finite_state_machine_id: 15 +name: view states: -- label: Start - size: 100 +- id: 1 + label: Start x: 498 y: 175 -- label: Ready - size: 100 +- id: 2 + label: Ready x: 506 y: 395 -- label: Scale - size: 100 +- id: 3 + label: Scale x: 310 y: 626 -- label: Pan - size: 100 +- id: 4 + label: Pan x: 741 y: 631 -- label: Pressed - size: 100 +- id: 5 + label: Pressed x: 739 y: 392 transitions: +- from_state: Scale + label: onMouseWheel + to_state: Ready - from_state: Start label: start to_state: Ready - from_state: Ready label: onMouseWheel to_state: Scale -- from_state: Scale - label: onTimeout - to_state: Ready - from_state: Ready label: onMouseDown to_state: Pressed diff --git a/awx/network_ui/static/network_ui/extract.js b/awx/network_ui/static/network_ui/extract.js new file mode 100755 index 0000000000..40c14c7462 --- /dev/null +++ b/awx/network_ui/static/network_ui/extract.js @@ -0,0 +1,47 @@ +#!/usr/bin/env node +var YAML = require('yamljs'); + +function Iterator(o){ + var k=Object.keys(o); + return { + next:function(){ + return k.shift(); + } + }; +} + +var myArgs = process.argv.slice(2); +var implementation = require(myArgs[0]); +var states = []; +var transitions = []; +var data = {states: states, + transitions: transitions}; + +var state_iter = Iterator(implementation); +var transition_iter = null; +var next_state = state_iter.next(); +var next_transition = null; +var state = null; +var transition = null; +var i = 0; +while(next_state !== undefined) { + state = implementation[next_state]; + transition_iter = Iterator(state.constructor.prototype) + next_transition = transition_iter.next(); + while (next_transition !== undefined) { + transition = state.constructor.prototype[next_transition]; + if (transition.transitions !== undefined) { + for (i = 0; i < transition.transitions.length; i++) { + transitions.push({from_state: next_state, + to_state:transition.transitions[i], + label:next_transition}); + } + } + next_transition = transition_iter.next(); + } + states.push({label: state.name}); + next_state = state_iter.next(); +} + + +console.log(YAML.stringify(data)); diff --git a/awx/network_ui/static/network_ui/index.html b/awx/network_ui/static/network_ui/index.html index 1c91728390..00248badc2 100644 --- a/awx/network_ui/static/network_ui/index.html +++ b/awx/network_ui/static/network_ui/index.html @@ -2,8 +2,8 @@
- +