Updates pipeline and FSM design and development tools

* Updates pipeline and FSM design for 3.4 features:
    group and read/write design features.
* Adds tool to copy layout from existing design
* Adds pipeline design
This commit is contained in:
Ben Thomasson 2018-02-06 09:23:13 -05:00
parent 14ee6a8360
commit a222fb5ebd
No known key found for this signature in database
GPG Key ID: 5818EF4CC895D5F5
78 changed files with 666 additions and 34450 deletions

View File

@ -1,20 +1,7 @@
Building
========
To build the UI:
make
To push the UI to AWX code base:
make deploy
Getting Started With Development
================================
Getting Started With Network UI Development
===========================================
**Introduction**

View File

Before

Width:  |  Height:  |  Size: 55 KiB

After

Width:  |  Height:  |  Size: 55 KiB

View File

@ -1,34 +1,43 @@
app: button_fsm
panX: 53
panY: -52
scaleXY: 1
diagram_id: 66
name: 'button_fsm'
finite_state_machine_id: 12
states:
- label: Start
size: 100
x: 468
y: 170
- label: Ready
size: 100
x: 471
y: 376
- label: Pressed
size: 100
x: 606
y: 563
- label: Clicked
size: 100
- id: 3
label: Clicked
x: 331
y: 568
- id: 5
label: Disabled
x: 719
y: 283
- id: 4
label: Pressed
x: 606
y: 563
- id: 1
label: Ready
x: 471
y: 376
- id: 2
label: Start
x: 468
y: 170
transitions:
- from_state: Start
label: start
to_state: Ready
- from_state: Ready
label: onMouseDown
to_state: Pressed
- from_state: Pressed
label: onMouseUp
to_state: Clicked
- from_state: Clicked
label: start
to_state: Ready
- from_state: Disabled
label: onEnable
to_state: Ready
- from_state: Pressed
label: onMouseUp
to_state: Clicked
- from_state: Ready
label: onDisable
to_state: Disabled
- from_state: Ready
label: onMouseDown
to_state: Pressed
- from_state: Start
label: start
to_state: Ready

View File

Before

Width:  |  Height:  |  Size: 34 KiB

After

Width:  |  Height:  |  Size: 34 KiB

View File

@ -1,4 +1,5 @@
app: buttons_fsm
finite_state_machine_id: 7
panX: 133
panY: 41
scaleXY: 1

View File

Before

Width:  |  Height:  |  Size: 63 KiB

After

Width:  |  Height:  |  Size: 63 KiB

View File

@ -1,4 +1,5 @@
diagram_id: 70
finite_state_machine_id: 21
name: diagram
states:
- id: 1

View File

Before

Width:  |  Height:  |  Size: 41 KiB

After

Width:  |  Height:  |  Size: 41 KiB

View File

@ -1,4 +1,4 @@
finite_state_machine_id: 131
finite_state_machine_id: 19
name: device_detail_fsm
states:
- id: 2

View File

Before

Width:  |  Height:  |  Size: 113 KiB

After

Width:  |  Height:  |  Size: 113 KiB

View File

@ -1,111 +1,119 @@
diagram_id: 38
diagram_id: 61
finite_state_machine_id: 5
name: group_fsm
states:
- id: 1
label: Disable
x: 497
y: 84
- id: 2
label: Resize
x: 571
y: 911
- id: 12
label: ContextMenu
x: 1228
y: -74
- id: 3
label: Start
x: 744
y: 69
- id: 5
label: Selected1
x: 839
y: 640
- id: 6
label: Selected3
x: 1528
y: 360
- id: 7
label: Move
x: 1297
y: 786
- id: 8
label: Selected2
x: 1179
y: 435
- id: 10
label: Ready
x: 733
y: 304
- id: 11
label: EditLabel
x: 1130
y: 112
- id: 4
label: CornerSelected
x: 526
y: 554
- id: 8
label: Disable
x: 497
y: 84
- id: 9
label: EditLabel
x: 1130
y: 112
- id: 6
label: Move
x: 1297
y: 786
- id: 11
label: Placing
x: 299
y: 300
- id: 7
label: Ready
x: 733
y: 304
- id: 1
label: Resize
x: 571
y: 911
- id: 4
label: Selected1
x: 839
y: 640
- id: 10
label: Selected2
x: 1179
y: 435
- id: 5
label: Selected3
x: 1528
y: 360
- id: 2
label: Start
x: 744
y: 69
transitions:
- from_state: ContextMenu
label: onLabelEdit
to_state: EditLabel
- from_state: ContextMenu
label: onMouseDown
to_state: Ready
- from_state: CornerSelected
label: onMouseMove
to_state: Resize
- from_state: CornerSelected
label: onMouseUp
to_state: Selected1
- from_state: EditLabel
label: onKeyDown
to_state: Selected2
- from_state: EditLabel
label: onMouseDown
to_state: Ready
- from_state: Move
label: onMouseDown
to_state: Selected1
- from_state: Move
label: onMouseUp
to_state: Selected2
- from_state: Placing
label: onMouseDown
to_state: Resize
- 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: Resize
label: onMouseUp
to_state: Selected1
- from_state: Selected1
label: onMouseMove
to_state: Move
- from_state: Selected1
label: onMouseUp
to_state: Selected2
- from_state: Selected2
label: onKeyDown
to_state: Ready
- from_state: Selected2
label: onNewGroup
to_state: Ready
- from_state: Start
label: start
label: onMouseDown
to_state: Ready
- from_state: Selected2
label: onMouseDown
to_state: Ready
- from_state: EditLabel
label: onMouseDown
to_state: Selected3
- from_state: Selected2
label: onNewGroup
to_state: Ready
- from_state: Selected3
label: onMouseMove
to_state: Move
- from_state: Selected3
label: onMouseUp
to_state: EditLabel
to_state: ContextMenu
- from_state: Start
label: start
to_state: Ready

View File

Before

Width:  |  Height:  |  Size: 46 KiB

After

Width:  |  Height:  |  Size: 46 KiB

View File

@ -1,4 +1,4 @@
finite_state_machine_id: 113
finite_state_machine_id: 1
name: hotkeys_fsm
states:
- id: 2

View File

@ -1,4 +1,5 @@
diagram_id: 68
finite_state_machine_id: 18
name: diagram
states:
- id: 1

View File

Before

Width:  |  Height:  |  Size: 42 KiB

After

Width:  |  Height:  |  Size: 42 KiB

View File

@ -1,4 +1,4 @@
finite_state_machine_id: 10
finite_state_machine_id: 4
name: link_fsm
states:
- id: 5

View File

Before

Width:  |  Height:  |  Size: 53 KiB

After

Width:  |  Height:  |  Size: 53 KiB

View File

@ -1,65 +1,96 @@
finite_state_machine_id: 130
diagram_id: 68
finite_state_machine_id: 9
name: mode_fsm
states:
- id: 1
label: Start
x: 568
y: -379
- id: 7
label: Device
x: 558
y: 821
- id: 2
label: Interface
x: 340
y: 1053
- id: 3
label: Rack
x: 571
y: 486
- id: 4
label: Process
x: 833
y: 1051
- id: 5
label: MultiSite
x: 569
y: -88
- id: 4
label: Process
x: 833
y: 1051
- id: 6
label: Device
x: 558
y: 821
- id: 7
label: Rack
x: 571
y: 486
- id: 3
label: Site
x: 564
y: 201
- id: 1
label: Start
x: 568
y: -379
transitions:
- from_state: Rack
label: onMouseWheel
to_state: Site
- from_state: MultiSite
label: onMouseWheel
to_state: Site
- from_state: Device
label: onMouseWheel
to_state: Process
- from_state: Site
- from_state: Device
label: onMouseWheel
to_state: Rack
- from_state: Device
label: onMouseWheel
to_state: Interface
- from_state: Rack
label: onMouseWheel
to_state: Device
- from_state: Device
label: onScaleChanged
to_state: Interface
- from_state: Device
label: onScaleChanged
to_state: Rack
- from_state: Device
label: onScaleChanged
to_state: Process
- from_state: Interface
label: onMouseWheel
to_state: Device
- from_state: Device
- from_state: Interface
label: onScaleChanged
to_state: Device
- from_state: MultiSite
label: onMouseWheel
to_state: Rack
- from_state: Start
label: start
to_state: MultiSite
to_state: Site
- from_state: MultiSite
label: onScaleChanged
to_state: Site
- from_state: Process
label: onMouseWheel
to_state: Device
- from_state: Process
label: onScaleChanged
to_state: Device
- from_state: Rack
label: onMouseWheel
to_state: Site
- from_state: Rack
label: onMouseWheel
to_state: Device
- from_state: Rack
label: onScaleChanged
to_state: Site
- from_state: Rack
label: onScaleChanged
to_state: Device
- from_state: Site
label: onMouseWheel
to_state: MultiSite
- from_state: Site
label: onMouseWheel
to_state: Rack
- from_state: Site
label: onScaleChanged
to_state: MultiSite
- from_state: Site
label: onScaleChanged
to_state: Rack
- from_state: Start
label: start
to_state: MultiSite

View File

Before

Width:  |  Height:  |  Size: 271 KiB

After

Width:  |  Height:  |  Size: 271 KiB

View File

@ -1,4 +1,5 @@
diagram_id: 64
finite_state_machine_id: 3
name: move
states:
- id: 1

View File

Before

Width:  |  Height:  |  Size: 32 KiB

After

Width:  |  Height:  |  Size: 32 KiB

View File

@ -1,4 +1,4 @@
finite_state_machine_id: 114
finite_state_machine_id: 17
name: null_fsm
states:
- id: 1

View File

@ -0,0 +1,233 @@
channels:
- from_fsm: buttons_fsm
from_fsm_id: 7
inbox: ''
outbox: ''
to_fsm: button_fsm
to_fsm_id: 12
type: ''
- from_fsm: buttons_fsm
from_fsm_id: 7
inbox: ''
outbox: ''
to_fsm: toolbox_fsm
to_fsm_id: 14
type: ''
- from_fsm: details_panel_fsm
from_fsm_id: 21
inbox: ''
outbox: ''
to_fsm: move_fsm
to_fsm_id: 3
type: ''
- from_fsm: device_detail_fsm
from_fsm_id: 19
inbox: ''
outbox: ''
to_fsm: view_fsm
to_fsm_id: 2
type: ''
- from_fsm: group_fsm
from_fsm_id: 5
inbox: ''
outbox: ''
to_fsm: stream_fsm
to_fsm_id: 20
type: ''
- from_fsm: hotkeys_fsm
from_fsm_id: 1
inbox: ''
outbox: ''
to_fsm: null_fsm
to_fsm_id: 17
type: ''
- from_fsm: keybindings_fsm
from_fsm_id: 18
inbox: ''
outbox: ''
to_fsm: hotkeys_fsm
to_fsm_id: 1
type: ''
- from_fsm: link_fsm
from_fsm_id: 4
inbox: ''
outbox: ''
to_fsm: details_panel_fsm
to_fsm_id: 21
type: ''
- from_fsm: mode_fsm
from_fsm_id: 9
inbox: ''
outbox: ''
to_fsm: time_fsm
to_fsm_id: 8
type: ''
- from_fsm: move_fsm
from_fsm_id: 3
inbox: ''
outbox: ''
to_fsm: device_detail_fsm
to_fsm_id: 19
type: ''
- from_fsm: rack_fsm
from_fsm_id: 6
inbox: ''
outbox: ''
to_fsm: group_fsm
to_fsm_id: 5
type: ''
- from_fsm: site_fsm
from_fsm_id: 22
inbox: ''
outbox: ''
to_fsm: rack_fsm
to_fsm_id: 6
type: ''
- from_fsm: stream_fsm
from_fsm_id: 20
inbox: ''
outbox: ''
to_fsm: link_fsm
to_fsm_id: 4
type: ''
- from_fsm: test_fsm
from_fsm_id: 23
inbox: ''
outbox: ''
to_fsm: mode_fsm
to_fsm_id: 9
type: ''
- from_fsm: time_fsm
from_fsm_id: 8
inbox: ''
outbox: ''
to_fsm: buttons_fsm
to_fsm_id: 7
type: ''
- from_fsm: toolbox_fsm
from_fsm_id: 14
inbox: ''
outbox: ''
to_fsm: site_fsm
to_fsm_id: 22
type: ''
- from_fsm: view_fsm
from_fsm_id: 2
inbox: ''
outbox: ''
to_fsm: keybindings_fsm
to_fsm_id: 18
type: ''
diagram_id: 85
fsms:
- id: 12
name: button_fsm
x1: -2438
x2: -3026
y1: -934
y2: -1532
- id: 7
name: buttons_fsm
x1: -2650
x2: -2850
y1: -16
y2: -619
- id: 21
name: details_panel_fsm
x1: 5669
x2: 5140
y1: -64
y2: -521
- id: 19
name: device_detail_fsm
x1: 7667
x2: 7214
y1: -110
y2: -562
- id: 5
name: group_fsm
x1: 3685
x2: 2256
y1: 278
y2: -906
- id: 1
name: hotkeys_fsm
x1: 9692
x2: 9281
y1: -124
y2: -549
- id: 18
name: keybindings_fsm
x1: 9223
x2: 8370
y1: -71
y2: -614
- id: 4
name: link_fsm
x1: 5080
x2: 4436
y1: 154
y2: -732
- id: 9
name: mode_fsm
x1: -3760
x2: -4453
y1: 192
y2: -1439
- id: 3
name: move_fsm
x1: 6968
x2: 5813
y1: 146
y2: -935
- id: 17
name: null_fsm
x1: 10125
x2: 9925
y1: -129
y2: -543
- id: 6
name: rack_fsm
x1: 2214
x2: 1047
y1: 127
y2: -753
- id: 22
name: site_fsm
x1: 964
x2: -190
y1: 128
y2: -768
- id: 20
name: stream_fsm
x1: 4376
x2: 3868
y1: 56
y2: -643
- id: 23
name: test_fsm
x1: -4569
x2: -5140
y1: 72
y2: -863
- id: 8
name: time_fsm
x1: -3122
x2: -3693
y1: -69
y2: -553
- id: 14
name: toolbox_fsm
x1: -680
x2: -1722
y1: 265
y2: -904
- id: 2
name: view_fsm
x1: 8311
x2: 7734
y1: -25
y2: -684
name: diagram
states: []
transitions: []

View File

Before

Width:  |  Height:  |  Size: 102 KiB

After

Width:  |  Height:  |  Size: 102 KiB

View File

@ -1,72 +1,83 @@
finite_state_machine_id: 131
diagram_id: 65
finite_state_machine_id: 6
name: rack_fsm
states:
- id: 5
label: Selected2
x: 220
y: 810
- id: 9
label: ContextMenu
x: 898
y: 1016
- id: 2
label: Disable
x: 760
y: 468
- id: 7
label: EditLabel
x: 600
y: 934
- id: 2
label: Ready
x: 532
y: 560
- id: 3
label: Disable
x: 760
y: 468
- id: 6
label: Selected3
x: 249
y: 1047
- id: 4
label: Selected1
x: 214
y: 566
- id: 1
label: Start
x: 582
y: 334
- id: 8
label: Move
x: -69
y: 861
- id: 1
label: Ready
x: 532
y: 560
- id: 4
label: Selected1
x: 214
y: 566
- id: 5
label: Selected2
x: 220
y: 810
- id: 6
label: Selected3
x: 249
y: 1047
- id: 3
label: Start
x: 582
y: 334
transitions:
- from_state: Selected1
label: onMouseMove
to_state: Move
- from_state: Selected3
label: onMouseMove
to_state: Move
- from_state: ContextMenu
label: onLabelEdit
to_state: EditLabel
- from_state: ContextMenu
label: onMouseDown
to_state: Ready
- from_state: EditLabel
label: onKeyDown
to_state: Selected2
- from_state: EditLabel
label: onMouseDown
to_state: Ready
- from_state: Move
label: onMouseUp
to_state: Selected2
- from_state: Start
label: start
to_state: Ready
- from_state: Ready
label: onMouseDown
to_state: Selected1
- from_state: Selected1
label: onMouseMove
to_state: Move
- from_state: Selected1
label: onMouseUp
to_state: Selected2
- from_state: Selected2
label: onKeyDown
to_state: Ready
- from_state: Selected2
label: onMouseDown
to_state: Ready
- from_state: Selected2
label: onMouseDown
to_state: Selected3
- from_state: EditLabel
label: onKeyDown
to_state: Selected2
- from_state: Selected3
label: onMouseMove
to_state: Move
- from_state: Selected3
label: onMouseUp
to_state: EditLabel
- from_state: EditLabel
label: onMouseDown
to_state: Ready
- from_state: Selected2
label: onMouseDown
to_state: Ready
- from_state: Selected2
label: onKeyDown
to_state: ContextMenu
- from_state: Start
label: start
to_state: Ready

View File

Before

Width:  |  Height:  |  Size: 104 KiB

After

Width:  |  Height:  |  Size: 104 KiB

View File

@ -1,72 +1,83 @@
finite_state_machine_id: 131
diagram_id: 63
finite_state_machine_id: 22
name: site_fsm
states:
- id: 5
label: Selected2
x: 220
y: 810
- id: 9
label: ContextMenu
x: 887
y: 1031
- id: 2
label: Disable
x: 760
y: 468
- id: 7
label: EditLabel
x: 600
y: 934
- id: 2
label: Ready
x: 532
y: 560
- id: 3
label: Disable
x: 760
y: 468
- id: 6
label: Selected3
x: 249
y: 1047
- id: 4
label: Selected1
x: 214
y: 566
- id: 1
label: Start
x: 582
y: 334
- id: 8
label: Move
x: -69
y: 861
- id: 1
label: Ready
x: 532
y: 560
- id: 4
label: Selected1
x: 214
y: 566
- id: 5
label: Selected2
x: 220
y: 810
- id: 6
label: Selected3
x: 249
y: 1047
- id: 3
label: Start
x: 582
y: 334
transitions:
- from_state: Selected1
label: onMouseMove
to_state: Move
- from_state: Selected3
label: onMouseMove
to_state: Move
- from_state: ContextMenu
label: onLabelEdit
to_state: EditLabel
- from_state: ContextMenu
label: onMouseDown
to_state: Ready
- from_state: EditLabel
label: onKeyDown
to_state: Selected2
- from_state: EditLabel
label: onMouseDown
to_state: Ready
- from_state: Move
label: onMouseUp
to_state: Selected2
- from_state: Start
label: start
to_state: Ready
- from_state: Ready
label: onMouseDown
to_state: Selected1
- from_state: Selected1
label: onMouseMove
to_state: Move
- from_state: Selected1
label: onMouseUp
to_state: Selected2
- from_state: Selected2
label: onKeyDown
to_state: Ready
- from_state: Selected2
label: onMouseDown
to_state: Ready
- from_state: Selected2
label: onMouseDown
to_state: Selected3
- from_state: EditLabel
label: onKeyDown
to_state: Selected2
- from_state: Selected3
label: onMouseMove
to_state: Move
- from_state: Selected3
label: onMouseUp
to_state: EditLabel
- from_state: EditLabel
label: onMouseDown
to_state: Ready
- from_state: Selected2
label: onMouseDown
to_state: Ready
- from_state: Selected2
label: onKeyDown
to_state: ContextMenu
- from_state: Start
label: start
to_state: Ready

View File

Before

Width:  |  Height:  |  Size: 75 KiB

After

Width:  |  Height:  |  Size: 75 KiB

View File

@ -1,4 +1,4 @@
finite_state_machine_id: 82
finite_state_machine_id: 20
name: stream_fsm
states:
- id: 4

View File

@ -1,49 +1,50 @@
diagram_id: 42
diagram_id: 69
finite_state_machine_id: 23
name: diagram
states:
- id: 6
label: Reporting
x: 926
y: 721
- id: 2
- id: 1
label: Disabled
x: 895
y: 344
- id: 5
label: Running
x: 720
y: 922
- id: 1
label: Ready
x: 722
y: 509
- id: 3
label: Start
x: 702
y: 186
- id: 4
label: Loading
x: 524
y: 710
- id: 5
label: Ready
x: 722
y: 509
- id: 6
label: Reporting
x: 926
y: 721
- id: 3
label: Running
x: 720
y: 922
- id: 2
label: Start
x: 702
y: 186
transitions:
- from_state: Disabled
label: onEnableTest
to_state: Ready
- from_state: Loading
label: start
to_state: Running
- from_state: Ready
label: onDisableTest
to_state: Disabled
- from_state: Ready
label: start
to_state: Loading
- from_state: Reporting
label: start
to_state: Loading
- from_state: Running
label: onTestCompleted
to_state: Reporting
- from_state: Ready
label: onDisable
to_state: Disabled
- from_state: Start
label: start
to_state: Disabled
- from_state: Loading
label: onTestLoaded
to_state: Running
- from_state: Disabled
label: onEnable
to_state: Ready
- from_state: Reporting
label: onTestReported
to_state: Ready
- from_state: Ready
label: onStartTest
to_state: Loading

View File

Before

Width:  |  Height:  |  Size: 68 KiB

After

Width:  |  Height:  |  Size: 68 KiB

View File

@ -1,4 +1,4 @@
finite_state_machine_id: 11
finite_state_machine_id: 8
name: time_fsm
states:
- id: 1

View File

Before

Width:  |  Height:  |  Size: 58 KiB

After

Width:  |  Height:  |  Size: 58 KiB

View File

Before

Width:  |  Height:  |  Size: 69 KiB

After

Width:  |  Height:  |  Size: 69 KiB

View File

@ -1,4 +1,4 @@
finite_state_machine_id: 15
finite_state_machine_id: 2
name: view_fsm
states:
- id: 1

View File

@ -1,75 +0,0 @@
.PHONY: all main lint lessc install simple-server deploy
all: clean install lessc lint main
clean:
rm -rf src-instrumented
rm -f js/bundle.js
rm -f js/vendor.bundle.js
rm -f css/style.css
install:
npm i
main: install
webpack
lint:
jshint --verbose src/*js
lessc:
lessc src/style.less css/style.css
istanbul: main
istanbul instrument --output src-instrumented src
webpack --config webpack-instrumented.config.js
cp index.html index-instrumented.html
sed -i "s/\/bundle.js/\/bundle-instrumented.js/g" index-instrumented.html
cp vendor/*.js js/
simple-server: lint main lessc
python -m SimpleHTTPServer 8082
deploy: main
rsync -av src/ ../../../../awx/ui/client/src/network_ui/
deploy-instrumented: istanbul
rsync -av src-instrumented/ ../../../../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:
./tools/fsm-diff designs/button.yml extracted/button.yml
./tools/fsm-diff designs/buttons.yml extracted/buttons.yml
./tools/fsm-diff designs/device_detail.yml extracted/device_detail.yml
./tools/fsm-diff designs/group.yml extracted/group.yml
./tools/fsm-diff designs/hotkeys.yml extracted/hotkeys.yml
./tools/fsm-diff designs/link.yml extracted/link.yml
./tools/fsm-diff designs/mode.yml extracted/mode.yml
./tools/fsm-diff designs/move.yml extracted/move.yml
./tools/fsm-diff designs/null.yml extracted/null.yml
./tools/fsm-diff designs/rack.yml extracted/rack.yml
./tools/fsm-diff designs/site.yml extracted/site.yml
./tools/fsm-diff designs/stream.yml extracted/stream.yml
./tools/fsm-diff designs/time.yml extracted/time.yml
./tools/fsm-diff designs/toolbox.yml extracted/toolbox.yml
./tools/fsm-diff designs/view.yml extracted/view.yml

View File

@ -1,2 +0,0 @@
* See: [CONTRIBUTING.md](CONTRIBUTING.md)

View File

@ -1 +0,0 @@
Build directory for css files.

View File

@ -1,12 +0,0 @@
<!DOCTYPE html>
<html ng-app="networkUI">
<head>
<link rel="stylesheet" href="css/style.css" />
<script src="js/vendor.bundle.js"></script>
<script src="js/bundle.js"></script>
</head>
<body style="margin: 0px">
<awx-network-ui></awx-network-ui>
</body>
</html>

View File

@ -1,14 +0,0 @@
<!DOCTYPE html>
<html ng-app="tower">
<head>
<link href="https://netdna.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" href="css/style.css" />
<link rel="stylesheet" href="css/xeditable.css" />
<script src="js/vendor.bundle.js"></script>
<script src="js/bundle.js"></script>
</head>
<body>
<ui-view></ui-view>
</body>
</html>

View File

@ -1 +0,0 @@
Build directory for javascript files

View File

@ -1,32 +0,0 @@
{
"name": "network_ui",
"version": "1.0.0",
"description": "Ansible Tower Networking UI",
"main": "app.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "Ben Thomasson",
"license": "ISC",
"dependencies": {
"angular": "~1.6.2",
"angular-mousewheel": "~1.0.5",
"angular-ui-router": "",
"angular-xeditable": "~0.8.0",
"browserify": "",
"hamsterjs": "~1.1.2",
"inherits": "",
"jshint": "",
"less": "^2.7.2",
"mathjs": "",
"reconnectingwebsocket": "^1.0.0",
"require": "",
"webpack": "",
"titlecase": "",
"lodash": ""
},
"devDependencies": {
"eslint": "^3.17.1",
"eslint-config-google": "^0.7.1"
}
}

View File

@ -1,3 +0,0 @@
#!/bin/bash -ex
python -m SimpleHTTPServer 8080

View File

@ -1,112 +0,0 @@
var inherits = require('inherits');
var fsm = require('./fsm.js');
function _State () {
}
inherits(_State, fsm._State);
function _Disabled () {
this.name = 'Disabled';
}
inherits(_Disabled, _State);
var Disabled = new _Disabled();
exports.Disabled = Disabled;
function _Start () {
this.name = 'Start';
}
inherits(_Start, _State);
var Start = new _Start();
exports.Start = Start;
function _Running () {
this.name = 'Running';
}
inherits(_Running, _State);
var Running = new _Running();
exports.Running = Running;
function _Loading () {
this.name = 'Loading';
}
inherits(_Loading, _State);
var Loading = new _Loading();
exports.Loading = Loading;
function _Ready () {
this.name = 'Ready';
}
inherits(_Ready, _State);
var Ready = new _Ready();
exports.Ready = Ready;
function _Reporting () {
this.name = 'Reporting';
}
inherits(_Reporting, _State);
var Reporting = new _Reporting();
exports.Reporting = Reporting;
_Disabled.prototype.onEnable = function (controller) {
controller.changeState(Ready);
};
_Disabled.prototype.onEnable.transitions = ['Ready'];
_Start.prototype.start = function (controller) {
controller.changeState(Disabled);
};
_Start.prototype.start.transitions = ['Disabled'];
_Running.prototype.onTestCompleted = function (controller) {
controller.changeState(Reporting);
};
_Running.prototype.onTestCompleted.transitions = ['Reporting'];
_Loading.prototype.onTestLoaded = function (controller) {
controller.changeState(Running);
};
_Loading.prototype.onTestLoaded.transitions = ['Running'];
_Ready.prototype.onDisable = function (controller) {
controller.changeState(Disabled);
};
_Ready.prototype.onDisable.transitions = ['Disabled'];
_Ready.prototype.onStartTest = function (controller) {
controller.changeState(Loading);
};
_Ready.prototype.onStartTest.transitions = ['Loading'];
_Reporting.prototype.onTestReported = function (controller) {
controller.changeState(Ready);
};
_Reporting.prototype.onTestReported.transitions = ['Ready'];

File diff suppressed because it is too large Load Diff

View File

@ -1,327 +0,0 @@
/*
* Hamster.js v1.1.2
* (c) 2013 Monospaced http://monospaced.com
* License: MIT
*/
(function(window, document){
'use strict';
/**
* Hamster
* use this to create instances
* @returns {Hamster.Instance}
* @constructor
*/
var Hamster = function(element) {
return new Hamster.Instance(element);
};
// default event name
Hamster.SUPPORT = 'wheel';
// default DOM methods
Hamster.ADD_EVENT = 'addEventListener';
Hamster.REMOVE_EVENT = 'removeEventListener';
Hamster.PREFIX = '';
// until browser inconsistencies have been fixed...
Hamster.READY = false;
Hamster.Instance = function(element){
if (!Hamster.READY) {
// fix browser inconsistencies
Hamster.normalise.browser();
// Hamster is ready...!
Hamster.READY = true;
}
this.element = element;
// store attached event handlers
this.handlers = [];
// return instance
return this;
};
/**
* create new hamster instance
* all methods should return the instance itself, so it is chainable.
* @param {HTMLElement} element
* @returns {Hamster.Instance}
* @constructor
*/
Hamster.Instance.prototype = {
/**
* bind events to the instance
* @param {Function} handler
* @param {Boolean} useCapture
* @returns {Hamster.Instance}
*/
wheel: function onEvent(handler, useCapture){
Hamster.event.add(this, Hamster.SUPPORT, handler, useCapture);
// handle MozMousePixelScroll in older Firefox
if (Hamster.SUPPORT === 'DOMMouseScroll') {
Hamster.event.add(this, 'MozMousePixelScroll', handler, useCapture);
}
return this;
},
/**
* unbind events to the instance
* @param {Function} handler
* @param {Boolean} useCapture
* @returns {Hamster.Instance}
*/
unwheel: function offEvent(handler, useCapture){
// if no handler argument,
// unbind the last bound handler (if exists)
if (handler === undefined && (handler = this.handlers.slice(-1)[0])) {
handler = handler.original;
}
Hamster.event.remove(this, Hamster.SUPPORT, handler, useCapture);
// handle MozMousePixelScroll in older Firefox
if (Hamster.SUPPORT === 'DOMMouseScroll') {
Hamster.event.remove(this, 'MozMousePixelScroll', handler, useCapture);
}
return this;
}
};
Hamster.event = {
/**
* cross-browser 'addWheelListener'
* @param {Instance} hamster
* @param {String} eventName
* @param {Function} handler
* @param {Boolean} useCapture
*/
add: function add(hamster, eventName, handler, useCapture){
// store the original handler
var originalHandler = handler;
// redefine the handler
handler = function(originalEvent){
if (!originalEvent) {
originalEvent = window.event;
}
// create a normalised event object,
// and normalise "deltas" of the mouse wheel
var event = Hamster.normalise.event(originalEvent),
delta = Hamster.normalise.delta(originalEvent);
// fire the original handler with normalised arguments
return originalHandler(event, delta[0], delta[1], delta[2]);
};
// cross-browser addEventListener
hamster.element[Hamster.ADD_EVENT](Hamster.PREFIX + eventName, handler, useCapture || false);
// store original and normalised handlers on the instance
hamster.handlers.push({
original: originalHandler,
normalised: handler
});
},
/**
* removeWheelListener
* @param {Instance} hamster
* @param {String} eventName
* @param {Function} handler
* @param {Boolean} useCapture
*/
remove: function remove(hamster, eventName, handler, useCapture){
// find the normalised handler on the instance
var originalHandler = handler,
lookup = {},
handlers;
for (var i = 0, len = hamster.handlers.length; i < len; ++i) {
lookup[hamster.handlers[i].original] = hamster.handlers[i];
}
handlers = lookup[originalHandler];
handler = handlers.normalised;
// cross-browser removeEventListener
hamster.element[Hamster.REMOVE_EVENT](Hamster.PREFIX + eventName, handler, useCapture || false);
// remove original and normalised handlers from the instance
for (var h in hamster.handlers) {
if (hamster.handlers[h] === handlers) {
hamster.handlers.splice(h, 1);
break;
}
}
}
};
/**
* these hold the lowest deltas,
* used to normalise the delta values
* @type {Number}
*/
var lowestDelta,
lowestDeltaXY;
Hamster.normalise = {
/**
* fix browser inconsistencies
*/
browser: function normaliseBrowser(){
// detect deprecated wheel events
if (!('onwheel' in document || document.documentMode >= 9)) {
Hamster.SUPPORT = document.onmousewheel !== undefined ?
'mousewheel' : // webkit and IE < 9 support at least "mousewheel"
'DOMMouseScroll'; // assume remaining browsers are older Firefox
}
// detect deprecated event model
if (!window.addEventListener) {
// assume IE < 9
Hamster.ADD_EVENT = 'attachEvent';
Hamster.REMOVE_EVENT = 'detachEvent';
Hamster.PREFIX = 'on';
}
},
/**
* create a normalised event object
* @param {Function} originalEvent
* @returns {Object} event
*/
event: function normaliseEvent(originalEvent){
var event = {
// keep a reference to the original event object
originalEvent: originalEvent,
target: originalEvent.target || originalEvent.srcElement,
type: 'wheel',
deltaMode: originalEvent.type === 'MozMousePixelScroll' ? 0 : 1,
deltaX: 0,
delatZ: 0,
preventDefault: function(){
if (originalEvent.preventDefault) {
originalEvent.preventDefault();
} else {
originalEvent.returnValue = false;
}
},
stopPropagation: function(){
if (originalEvent.stopPropagation) {
originalEvent.stopPropagation();
} else {
originalEvent.cancelBubble = false;
}
}
};
// calculate deltaY (and deltaX) according to the event
// 'mousewheel'
if (originalEvent.wheelDelta) {
event.deltaY = - 1/40 * originalEvent.wheelDelta;
}
// webkit
if (originalEvent.wheelDeltaX) {
event.deltaX = - 1/40 * originalEvent.wheelDeltaX;
}
// 'DomMouseScroll'
if (originalEvent.detail) {
event.deltaY = originalEvent.detail;
}
return event;
},
/**
* normalise 'deltas' of the mouse wheel
* @param {Function} originalEvent
* @returns {Array} deltas
*/
delta: function normaliseDelta(originalEvent){
var delta = 0,
deltaX = 0,
deltaY = 0,
absDelta = 0,
absDeltaXY = 0,
fn;
// normalise deltas according to the event
// 'wheel' event
if (originalEvent.deltaY) {
deltaY = originalEvent.deltaY * -1;
delta = deltaY;
}
if (originalEvent.deltaX) {
deltaX = originalEvent.deltaX;
delta = deltaX * -1;
}
// 'mousewheel' event
if (originalEvent.wheelDelta) {
delta = originalEvent.wheelDelta;
}
// webkit
if (originalEvent.wheelDeltaY) {
deltaY = originalEvent.wheelDeltaY;
}
if (originalEvent.wheelDeltaX) {
deltaX = originalEvent.wheelDeltaX * -1;
}
// 'DomMouseScroll' event
if (originalEvent.detail) {
delta = originalEvent.detail * -1;
}
// Don't return NaN
if (delta === 0) {
return [0, 0, 0];
}
// look for lowest delta to normalize the delta values
absDelta = Math.abs(delta);
if (!lowestDelta || absDelta < lowestDelta) {
lowestDelta = absDelta;
}
absDeltaXY = Math.max(Math.abs(deltaY), Math.abs(deltaX));
if (!lowestDeltaXY || absDeltaXY < lowestDeltaXY) {
lowestDeltaXY = absDeltaXY;
}
// convert deltas to whole numbers
fn = delta > 0 ? 'floor' : 'ceil';
delta = Math[fn](delta / lowestDelta);
deltaX = Math[fn](deltaX / lowestDeltaXY);
deltaY = Math[fn](deltaY / lowestDeltaXY);
return [delta, deltaX, deltaY];
}
};
if (typeof window.define === 'function' && window.define.amd) {
// AMD
window.define('hamster', [], function(){
return Hamster;
});
} else if (typeof exports === 'object') {
// CommonJS
module.exports = Hamster;
} else {
// Browser global
window.Hamster = Hamster;
}
})(window, window.document);

View File

@ -1,52 +0,0 @@
/*
* angular-mousewheel v1.0.5
* (c) 2013 Monospaced http://monospaced.com
* License: MIT
*/
angular.module('monospaced.mousewheel', [])
.directive('msdWheel', ['$parse', function($parse){
return {
restrict: 'A, C',
link: function(scope, element, attr) {
var expr = $parse(attr['msdWheel']),
fn = function(event, delta, deltaX, deltaY){
scope.$apply(function(){
expr(scope, {
$event: event,
$delta: delta,
$deltaX: deltaX,
$deltaY: deltaY
});
});
},
hamster;
if (typeof Hamster === 'undefined') {
// fallback to standard wheel event
element.bind('wheel', function(event){
scope.$apply(function() {
expr(scope, {
$event: event
});
});
});
return;
}
// don't create multiple Hamster instances per element
if (!(hamster = element.data('hamster'))) {
hamster = Hamster(element[0]);
element.data('hamster', hamster);
}
// bind Hamster wheel event
hamster.wheel(fn);
// unbind Hamster wheel event
scope.$on('$destroy', function(){
hamster.unwheel(fn);
});
}
};
}]);

View File

@ -1,87 +0,0 @@
/*
* ngTouch.js v1.0.2
* (c) 2015 Mark Topper
* License: MIT
*/
"use strict";
angular.module("ngTouch", [])
.directive("ngTouchstart", function () {
return {
controller: ["$scope", "$element", function ($scope, $element) {
$element.bind("touchstart", onTouchStart);
function onTouchStart(event) {
var method = $element.attr("ng-touchstart");
$scope.$event = event;
$scope.$apply(method);
}
}]
};
})
.directive("ngTouchmove", function () {
return {
controller: ["$scope", "$element", function ($scope, $element) {
$element.bind("touchstart", onTouchStart);
function onTouchStart(event) {
event.preventDefault();
$element.bind("touchmove", onTouchMove);
$element.bind("touchend", onTouchEnd);
}
function onTouchMove(event) {
var method = $element.attr("ng-touchmove");
$scope.$event = event;
$scope.$apply(method);
}
function onTouchEnd(event) {
event.preventDefault();
$element.unbind("touchmove", onTouchMove);
$element.unbind("touchend", onTouchEnd);
}
}]
};
})
.directive("ngTouchend", function () {
return {
controller: ["$scope", "$element", function ($scope, $element) {
$element.bind("touchend", onTouchEnd);
function onTouchEnd(event) {
var method = $element.attr("ng-touchend");
$scope.$event = event;
$scope.$apply(method);
}
}]
};
})
.directive("ngTap", function () {
return {
controller: ["$scope", "$element", function ($scope, $element) {
var moved = false;
$element.bind("touchstart", onTouchStart);
function onTouchStart() {
$element.bind("touchmove", onTouchMove);
$element.bind("touchend", onTouchEnd);
}
function onTouchMove() {
moved = true;
}
function onTouchEnd() {
$element.unbind("touchmove", onTouchMove);
$element.unbind("touchend", onTouchEnd);
if (!moved) {
var method = $element.attr("ng-tap");
$scope.$apply(method);
}
}
}]
};
});

View File

@ -1,250 +0,0 @@
/**
* @license svg-crowbar
* (c) 2013 The New York Times
* License: MIT
*/
function svg_crowbar () {
var doctype = '<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">';
window.URL = (window.URL || window.webkitURL);
var body = document.body;
var prefix = {
xmlns: "http://www.w3.org/2000/xmlns/",
xlink: "http://www.w3.org/1999/xlink",
svg: "http://www.w3.org/2000/svg"
};
initialize();
function initialize() {
var documents = [window.document],
SVGSources = [],
iframes = document.querySelectorAll("iframe"),
objects = document.querySelectorAll("object");
[].forEach.call(iframes, function(el) {
try {
if (el.contentDocument) {
documents.push(el.contentDocument);
}
} catch(err) {
console.log(err);
}
});
[].forEach.call(objects, function(el) {
try {
if (el.contentDocument) {
documents.push(el.contentDocument);
}
} catch(err) {
console.log(err);
}
});
documents.forEach(function(doc) {
var styles = getStyles(doc);
var newSources = getSources(doc, styles);
// because of prototype on NYT pages
for (var i = 0; i < newSources.length; i++) {
SVGSources.push(newSources[i]);
}
});
if (SVGSources.length > 1) {
createPopover(SVGSources);
} else if (SVGSources.length > 0) {
download(SVGSources[0]);
} else {
alert("The Crowbar couldnt find any SVG nodes.");
}
}
function createPopover(sources) {
cleanup();
sources.forEach(function(s1) {
sources.forEach(function(s2) {
if (s1 !== s2) {
if ((Math.abs(s1.top - s2.top) < 38) && (Math.abs(s1.left - s2.left) < 38)) {
s2.top += 38;
s2.left += 38;
}
}
});
});
var buttonsContainer = document.createElement("div");
body.appendChild(buttonsContainer);
buttonsContainer.setAttribute("class", "svg-crowbar");
buttonsContainer.style["z-index"] = 1e7;
buttonsContainer.style.position = "absolute";
buttonsContainer.style.top = 0;
buttonsContainer.style.left = 0;
var background = document.createElement("div");
body.appendChild(background);
background.setAttribute("class", "svg-crowbar");
background.style.background = "rgba(255, 255, 255, 0.7)";
background.style.position = "fixed";
background.style.left = 0;
background.style.top = 0;
background.style.width = "100%";
background.style.height = "100%";
sources.forEach(function(d, i) {
var buttonWrapper = document.createElement("div");
buttonsContainer.appendChild(buttonWrapper);
buttonWrapper.setAttribute("class", "svg-crowbar");
buttonWrapper.style.position = "absolute";
buttonWrapper.style.top = (d.top + document.body.scrollTop) + "px";
buttonWrapper.style.left = (document.body.scrollLeft + d.left) + "px";
buttonWrapper.style.padding = "4px";
buttonWrapper.style["border-radius"] = "3px";
buttonWrapper.style.color = "white";
buttonWrapper.style["text-align"] = "center";
buttonWrapper.style["font-family"] = "'Helvetica Neue'";
buttonWrapper.style.background = "rgba(0, 0, 0, 0.8)";
buttonWrapper.style["box-shadow"] = "0px 4px 18px rgba(0, 0, 0, 0.4)";
buttonWrapper.style.cursor = "move";
buttonWrapper.textContent = "SVG #" + i + ": " + (d.id ? "#" + d.id : "") + (d.class ? "." + d.class : "");
var button = document.createElement("button");
buttonWrapper.appendChild(button);
button.setAttribute("data-source-id", i);
button.style.width = "150px";
button.style["font-size"] = "12px";
button.style["line-height"] = "1.4em";
button.style.margin = "5px 0 0 0";
button.textContent = "Download";
button.onclick = function() {
// console.log(el, d, i, sources)
download(d);
};
});
}
function cleanup() {
var crowbarElements = document.querySelectorAll(".svg-crowbar");
[].forEach.call(crowbarElements, function(el) {
el.parentNode.removeChild(el);
});
}
function getSources(doc, styles) {
var svgInfo = [],
svgs = doc.querySelectorAll("svg");
styles = (styles === undefined) ? "" : styles;
[].forEach.call(svgs, function (svg) {
svg.setAttribute("version", "1.1");
var defsEl = document.createElement("defs");
svg.insertBefore(defsEl, svg.firstChild); //TODO .insert("defs", ":first-child")
// defsEl.setAttribute("class", "svg-crowbar");
var styleEl = document.createElement("style");
defsEl.appendChild(styleEl);
styleEl.setAttribute("type", "text/css");
// removing attributes so they aren't doubled up
svg.removeAttribute("xmlns");
svg.removeAttribute("xlink");
// These are needed for the svg
if (!svg.hasAttributeNS(prefix.xmlns, "xmlns")) {
svg.setAttributeNS(prefix.xmlns, "xmlns", prefix.svg);
}
if (!svg.hasAttributeNS(prefix.xmlns, "xmlns:xlink")) {
svg.setAttributeNS(prefix.xmlns, "xmlns:xlink", prefix.xlink);
}
var source = (new XMLSerializer()).serializeToString(svg).replace('</style>', '<![CDATA[' + styles + ']]></style>');
var rect = svg.getBoundingClientRect();
svgInfo.push({
top: rect.top,
left: rect.left,
width: rect.width,
height: rect.height,
class: svg.getAttribute("class"),
id: svg.getAttribute("id"),
childElementCount: svg.childElementCount,
source: [doctype + source]
});
});
return svgInfo;
}
function download(source) {
var filename = "untitled";
if (source.id) {
filename = source.id;
} else if (source.class) {
filename = source.class;
} else if (window.document.title) {
filename = window.document.title.replace(/[^a-z0-9]/gi, '-').toLowerCase();
}
var url = window.URL.createObjectURL(new Blob(source.source, { "type" : "text\/xml" }));
var a = document.createElement("a");
body.appendChild(a);
a.setAttribute("class", "svg-crowbar");
a.setAttribute("download", filename + ".svg");
a.setAttribute("href", url);
a.style.display = "none";
a.click();
setTimeout(function() {
window.URL.revokeObjectURL(url);
}, 10);
}
function getStyles(doc) {
var styles = "",
styleSheets = doc.styleSheets;
if (styleSheets) {
for (var i = 0; i < styleSheets.length; i++) {
processStyleSheet(styleSheets[i]);
}
}
function processStyleSheet(ss) {
if (ss.cssRules) {
for (var i = 0; i < ss.cssRules.length; i++) {
var rule = ss.cssRules[i];
if (rule.type === 3) {
// Import Rule
processStyleSheet(rule.styleSheet);
} else {
// hack for illustrator crashing on descendent selectors
if (rule.selectorText) {
if (rule.selectorText.indexOf(">") === -1) {
styles += "\n" + rule.cssText;
}
}
}
}
}
}
return styles;
}
}
exports.svg_crowbar = svg_crowbar;

View File

@ -1,20 +0,0 @@
var webpack = require('webpack');
module.exports = {
entry: {
app: "./src-instrumented/main.js",
vendor: ["angular",
"angular-ui-router",
"hamsterjs",
"angular-mousewheel",
"reconnectingwebsocket",
"angular-xeditable"]
},
output: {
path: __dirname + "/js",
filename: "bundle-instrumented.js",
},
plugins: [
new webpack.ProvidePlugin({Hamster: 'hamsterjs'}),
new webpack.optimize.CommonsChunkPlugin({ name: 'vendor', filename: 'vendor.bundle.js' })
]
};

View File

@ -1,20 +0,0 @@
var webpack = require('webpack');
module.exports = {
entry: {
app: "./src/main.js",
vendor: ["angular",
"angular-ui-router",
"hamsterjs",
"angular-mousewheel",
"reconnectingwebsocket",
"angular-xeditable"]
},
output: {
path: __dirname + "/js",
filename: "bundle.js",
},
plugins: [
new webpack.ProvidePlugin({Hamster: 'hamsterjs'}),
new webpack.optimize.CommonsChunkPlugin({ name: 'vendor', filename: 'vendor.bundle.js' })
]
};

View File

@ -1,12 +0,0 @@
<!DOCTYPE html>
<html ng-app="networkWidgets">
<head>
<link rel="stylesheet" href="css/style.css" />
<script src="js/vendor.bundle.js"></script>
<script src="js/bundle.js"></script>
</head>
<body style="margin: 0px">
<awx-network-widgets></awx-network-widgets>
</body>
</html>

View File

@ -0,0 +1 @@
/extracted

View File

@ -0,0 +1,19 @@
.PHONY: check extract
FSMS = animation time test mode buttons button toolbox site rack group stream link details.panel move device.detail view keybindings hotkeys null
extract:
mkdir -p extracted
for fsm in $(FSMS); do \
./extract.js ./$${fsm}.fsm.js > extracted/$${fsm}.yml; \
done
check: extract
for fsm in $(FSMS); do \
./tools/fsm-diff ../../../../network_ui/designs/$$fsm.yml extracted/$$fsm.yml; \
./tools/copy-layout.py ../../../../network_ui/designs/$$fsm.yml extracted/$$fsm.yml; \
done

View File

@ -1,8 +1,8 @@
/* Copyright (c) 2017 Red Hat, Inc. */
var inherits = require('inherits');
var fsm = require('./fsm.js');
var move = require('./move.js');
var group = require('./group.js');
var move = require('./move.fsm.js');
var group = require('./group.fsm.js');
var rack_fsm = require('./rack.fsm.js');
var site_fsm = require('./site.fsm.js');

View File

@ -1,6 +1,6 @@
/* Copyright (c) 2017-2018 Red Hat, Inc. */
var fsm = require('./fsm.js');
var button = require('./button.js');
var button = require('./button.fsm.js');
var util = require('./util.js');
var inherits = require('inherits');
var animation_fsm = require('./animation.fsm.js');

View File

@ -8,13 +8,13 @@ var rack_fsm = require('./rack.fsm.js');
var site_fsm = require('./site.fsm.js');
var hotkeys = require('./hotkeys.fsm.js');
var toolbox_fsm = require('./toolbox.fsm.js');
var view = require('./view.js');
var move = require('./move.js');
var link = require('./link.js');
var view = require('./view.fsm.js');
var move = require('./move.fsm.js');
var link = require('./link.fsm.js');
var stream_fsm = require('./stream.fsm.js');
var group = require('./group.js');
var buttons = require('./buttons.js');
var time = require('./time.js');
var group = require('./group.fsm.js');
var buttons = require('./buttons.fsm.js');
var time = require('./time.fsm.js');
var test_fsm = require('./test.fsm.js');
var util = require('./util.js');
var models = require('./models.js');

View File

@ -0,0 +1,55 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2018 Benjamin Thomasson
"""
Usage:
copy-layout [options] <from> <to>
Options:
-h, --help Show this page
--debug Show debug logging
--verbose Show verbose logging
"""
from docopt import docopt
import logging
import sys
import yaml
logger = logging.getLogger('copy-layout')
def main(args=None):
if args is None:
args = sys.argv[1:]
parsed_args = docopt(__doc__, args)
if parsed_args['--debug']:
logging.basicConfig(level=logging.DEBUG)
elif parsed_args['--verbose']:
logging.basicConfig(level=logging.INFO)
else:
logging.basicConfig(level=logging.WARNING)
with open(parsed_args['<from>']) as f:
from_fsm = yaml.load(f.read())
with open(parsed_args['<to>']) as f:
to_fsm = yaml.load(f.read())
to_states = {x['label']: x for x in to_fsm.get('states', [])}
to_fsm['name'] = from_fsm.get('name', '')
to_fsm['finite_state_machine_id'] = from_fsm.get('finite_state_machine_id', '')
to_fsm['diagram_id'] = from_fsm.get('diagram_id', '')
for state in from_fsm.get('states', []):
to_states.get(state['label'], {})['x'] = state.get('x', 0)
to_states.get(state['label'], {})['y'] = state.get('y', 0)
with open(parsed_args['<to>'], 'w') as f:
f.write(yaml.safe_dump(to_fsm, default_flow_style=False))
return 0
if __name__ == '__main__':
sys.exit(main(sys.argv[1:]))

View File

@ -15,7 +15,7 @@ import yaml
logger = logging.getLogger('cli')
def fsm_diff(a, b, silent=True):
def fsm_diff(a_name, b_name, a, b, silent=True):
a_states = {x['label'] for x in a['states']}
b_states = {x['label'] for x in b['states']}
@ -25,10 +25,10 @@ def fsm_diff(a, b, silent=True):
if (missing_in_b) and not silent:
print "Extra states in a:\n ", "\n ".join(list(missing_in_b))
print "Extra states in " + a_name + ":\n ", "\n ".join(list(missing_in_b))
if (missing_in_a) and not silent:
print "Extra states in b:\n ", "\n ".join(list(missing_in_a))
print "Extra states in " + b_name + ":\n ", "\n ".join(list(missing_in_a))
new_states = missing_in_b.union(missing_in_a)
@ -40,10 +40,10 @@ def fsm_diff(a, b, silent=True):
if (missing_in_b) and not silent:
print "Extra transitions in a:\n ", "\n ".join(map(str, missing_in_b))
print "Extra transitions in " + a_name + ":\n ", "\n ".join(map(str, missing_in_b))
if (missing_in_a) and not silent:
print "Extra transitions in b:\n ", "\n ".join(map(str, missing_in_a))
print "Extra transitions in " + b_name + ":\n ", "\n ".join(map(str, missing_in_a))
new_transitions = missing_in_b.union(missing_in_a)
@ -70,7 +70,7 @@ def main(args=None):
with open(parsed_args['<b>']) as f:
b = yaml.load(f.read())
data = fsm_diff(a, b, silent=False)
data = fsm_diff(parsed_args['<a>'], parsed_args['<b>'], a, b, silent=False)
if parsed_args['<output>']:
with open(parsed_args['<output>'], 'w') as f: