-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathindex.html
executable file
·959 lines (882 loc) · 45.2 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="RabbitMQ Visualizer">
<meta name="author" content="James McClelland (@defactojames)">
<title>RabbitMQ Visualizer</title>
<script type="text/javascript" src="./js/d3.v3.min.js"></script>
<script src="./js/jquery.min.js"></script>
<script src="./js/bootstrap.min.js"></script>
<link rel="stylesheet" href="./css/bootstrap.min.css">
<link rel="stylesheet" href="./css/bootstrap-theme.min.css">
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<style>
circle.outer { fill: #555;}
text {
font: 12px consolas;
fill: #fff;
}
/* This disables text selection */
svg *::selection {
background : transparent;
}
g,circle { cursor : pointer; }
svg *::-moz-selection {
background:transparent;
}
svg *::-webkit-selection {
background:transparent;
}
g path { marker-end : url(#end-arrow); }
path.dragline {
fill : none;
stroke : #666;
stroke-width: 2px;
cursor : default;
stroke-dasharray: 4px;
pointer-events: none;
}
text.shadow {
stroke: #333;
stroke-width: 4.5px;
opacity: 0.6;
stroke-linejoin: round;
}
.bindings text {
fill: #333;
font-size: 13px;
}
.hidden {
display: none;
}
.btn-group { margin-top: 8px;}
.navbar { margin-bottom: 0px;}
.consumer { fill: url(#blue); }
.producer { fill: url(#green); }
.queue { fill: url(#cyan); }
.exchange { fill: url(#orange); }
#main {
box-sizing: border-box;
padding-top: 50px;
z-index:1;
webkit-transform: translate3d(0,0,0);
}
body, html, #main {
height: 100%;
min-height: 100%;
overflow: hidden;
}
#alert {
position: absolute;
width: 500px;
height: 100px;
margin: auto;
top: 80px; left: 0; bottom: 0; right: 0;
display: none;
}
#resourcetype { float: left;}
.greeting {
position: fixed;
width: 50%;
margin: 0 auto;
top: 50px; left: 0; right: 0;
}
</style>
</head>
<body>
<div class="navbar navbar-default navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#">RabbitMQ Visualizer</a>
</div>
<div class="navbar-collapse collapse">
<div id="resourcetype" class="btn-group" data-toggle="buttons">
<label class="btn btn-success"><input type="radio" name="resourceType" value="producer">producer</label>
<label class="btn btn-warning"><input type="radio" name="resourceType" value="exchange">exchange</label>
<label class="btn btn-info"><input type="radio" name="resourceType" value="queue">queue</label>
<label class="btn btn-primary active"><input type="radio" name="resourceType" value="consumer" checked>consumer</label>
</div>
<ul class="nav navbar-nav">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Examples <b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a class="examples" id="example_de" href="#">Direct Exchange</a></li>
<li><a class="examples" id="example_te" href="#">Topic Exchange</a></li>
<li><a class="examples" id="example_fe" href="#">Fanout Exchange</a></li>
<li><a class="examples" id="example_mq" href="#">Message Queueing</a></li>
<li><a class="examples" id="example_sim" href="#">Simulator Import</a></li>
</ul>
</li>
</ul>
<ul class="nav navbar-nav">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">About <b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a class="about" href="https://github.com/jmcle/rabbitmq-visualizer">View the Github project</a></li>
<li><a class="about" href="https://twitter.com/defactojames">Follow me on Twitter</a></li>
<li><a class="about" href="https://github.com/RabbitMQSimulator/RabbitMQSimulator">The Official RabbitMQ Simulator</a></li>
</ul>
</li>
</ul>
<div class="nav navbar-nav navbar-right">
<button id="navHelpButton" type="button" class="btn btn-default navbar-btn" >Help</button>
<button id="navClearButton" type="button" class="btn btn-default navbar-btn" >Clear</button>
<button id="navExportButton" type="button" class="btn btn-default navbar-btn" >Export</button>
<button id="navImportButton" type="button" class="btn btn-default navbar-btn" >Import</button>
</div>
</div><!--/.nav-collapse -->
</div>
</div>
<div class="modal fade" id="objProp" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h4 class="modal-title">Properties for: </h4>
</div>
<div class="modal-body">
<div class="input-group">
<span class="input-group-addon">name</span><input class="form-control" type="text" id="properties" value=""></input>
</div>
<div id="exchangetype" class="btn-group" data-toggle="buttons">
<label id="direct" class="btn btn-primary active"><input type="radio" name="exchangeType" value="0" checked>direct</label>
<label id="fanout" class="btn btn-primary"><input type="radio" name="exchangeType" value="1">fanout</label>
<label id="topic" class="btn btn-primary"><input type="radio" name="exchangeType" value="2">topic</label>
</div>
</div>
<div class="modal-footer">
<button id="save" type="button" class="btn btn-primary" data-dismiss="modal">Save changes</button>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
<div class="modal fade" id="import" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h4 id="jsonheader" class="modal-title">Import JSON: </h4>
</div>
<div class="modal-body">
<textarea id="jsonbody" class="form-control" rows="10"></textarea>
</div>
<div class="modal-footer">
<button id="importButton" type="button" class="btn btn-primary" data-dismiss="modal">Import</button>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
<div class="modal fade" id="help" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h4 id="jsonheader" class="modal-title">RabbitMQ Visualizer Help</h4>
</div>
<div class="modal-body">
<ul>
<li><strong>Create resources</strong>
<ul>
<li>Select a resource type from the navigation bar.</li>
<li>Double click on an empty space to create the resource.</li>
</ul>
</li>
<li><strong>Move resources</strong>
<ul>
<li>Left click and drag within the resource circle to move.</li>
</ul>
</li>
<li><strong>Remove resources</strong>
<ul>
<li>Double left click within a resource circle to remove.</li>
</ul>
</li>
<li><strong>Create bindings</strong>
<ul>
<li>Left click the source resource border and drag to the target resource.</li>
</ul>
</li>
<li><strong>Remove bindings</strong>
<ul>
<li>Double click the binding line (this can be tricky)</li>
</ul>
</li>
<li><strong>Send messages</strong>
<ul>
<li>Shift left click within the circle of a producer resource.</li>
<li>Currently messages are sent with a routing key equal to the name of the producer.</li>
</ul>
</li>
<li><strong>Change resource properties (name, exchange type, bindings)</strong>
<ul>
<li>Left click on the resource's label</li>
</ul>
</li>
</ul>
</div>
<div class="modal-footer">
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
<div id="main" class="container">
<div class="greeting alert alert-success alert-dismissable">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
<strong>Get started!</strong> Shift left click on a producer to send a message or click help for more options.
</div>
<div id="alert"></div>
<svg height="100%" width="100%">
<defs>
<linearGradient id="green" x1="0" x2="0" y1="0" y2="1">
<stop offset="0" style="stop-color:#5cb85c"/>
<stop offset="1" style="stop-color:#449d44"/>
</linearGradient>
<linearGradient id="blue" x1="0" x2="0" y1="0" y2="1">
<stop offset="0" style="stop-color:#428bca"/>
<stop offset="1" style="stop-color:#3071a9"/>
</linearGradient>
<linearGradient id="cyan" x1="0" x2="0" y1="0" y2="1">
<stop offset="0" style="stop-color:#5bc0de"/>
<stop offset="1" style="stop-color:#31b0d5"/>
</linearGradient>
<linearGradient id="orange" x1="0" x2="0" y1="0" y2="1">
<stop offset="0" style="stop-color:#f0ad4e"/>
<stop offset="1" style="stop-color:#ec971f"/>
</linearGradient>
</defs>
</svg>
</div>
</body>
<script>
//
// INITIALIZE
//
var debug;
var radius = 40;
function showalert(message,alerttype) {
$('#alert').show().append('<div id="alertdiv" class="alert ' + alerttype + '"><a class="close" data-dismiss="alert">×</a><span>'+message+'</span></div>')
setTimeout(function() { // this will automatically close the alert and remove this if the users doesnt close it in 5 secs
$("#alertdiv").remove();
$('#alert').hide()
}, 3000);
}
var svg = d3.select('svg');
// Add arrow heads to bindings indicating direction
svg.append('svg:defs')
.append('svg:marker')
.attr('id', 'end-arrow')
.attr('viewBox', '0 -5 10 10')
// refX value is currently a hacky workaround to put the arrow head at the right point on the link path
// if the radius of the node circles is increased or decreased, this will put the arrow in the wrong spot
.attr('refX', radius+8)
.attr('markerWidth', 6)
.attr('markerHeight', 6)
.attr('orient', 'auto')
.append('svg:path')
.attr('d', 'M0,-5L10,0L0,5')
.attr('fill', '#666');
//
// DEFINE DATA
//
// Sequence generator
var uid = (function(){var id=0;return function(){if(arguments[0] !== undefined)id=arguments[0];return id++;}})();
var example_sim = '{"exchanges": [{"name": "exchange1", "type": 1, "x": 300, "y": 120 },{"name": "exchange2", "type": 0, "x": 300, "y": 320 }], "queues": [{"name": "queue1", "x": 500, "y": 70 },{"name": "queue2", "x": 500, "y": 170 },{"name": "queue3", "x": 500, "y": 320 },{"name": "queue4", "x": 500, "y": 420 } ], "bindings": [{"source": "exchange1", "vhost": "myvhost", "destination": "queue1", "destination_type": "queue", "routing_key": "mykey", "arguments": [] },{"source": "exchange1", "vhost": "myvhost", "destination": "queue2", "destination_type": "queue", "routing_key": "mykey", "arguments": [] },{"source": "exchange2", "vhost": "myvhost", "destination": "queue3", "destination_type": "queue", "routing_key": "key1", "arguments": [] },{"source": "exchange2", "vhost": "myvhost", "destination": "queue4", "destination_type": "queue", "routing_key": "key2", "arguments": [] } ], "producers": [{"name": "producer1", "x": 100, "y": 120, "interval": 10, "publish": {"to": "exchange1", "payload": "mypayload", "routing_key": "myroutingkey"}},{"name": "producer2", "x": 100, "y": 320, "interval": 10, "publish": {"to": "exchange2", "payload": "mypayload", "routing_key": "key1"}} ], "consumers": [ {"name": "consumer1", "x": 700, "y": 120, "consume": "queue1"},{"name": "consumer2", "x": 700, "y": 320, "consume": "queue1"},{"name": "consumer3", "x": 800, "y": 120, "consume": "queue2"},{"name": "consumer4", "x": 800, "y": 220, "consume": "queue2"},{"name": "consumer5", "x": 800, "y": 320, "consume": "queue2"} ], "advanced_mode": false }';
var example_mq = '{"exchanges": [{"name": "topic.exch", "type": "2", "x": 299, "y": 297, "resource_type": "exchange", "id": 1 } ], "queues": [{"name": "queue.one", "x": 516, "y": 119, "resource_type": "queue", "id": 2, "messages": ["34", "35", "36", "37", "38"], "totalConsumers": 2, "lastConsumer": 1 }, {"name": "queue.two", "x": 521, "y": 297, "resource_type": "queue", "id": 3, "messages": ["34", "35", "36", "37", "38", "39", "40", "41", "42", "43", "44", "45"], "totalConsumers": 1, "lastConsumer": 0 } ], "bindings": [{"source": 1, "vhost": "demo", "destination": 3, "destination_type": "queue", "routing_key": "producer.*", "arguments": [], "resource_type": "binding", "id": 5, "source_type": "exchange"}, {"source": 1, "vhost": "demo", "destination": 2, "destination_type": "queue", "routing_key": "producer.one", "arguments": [], "resource_type": "binding", "id": 7, "source_type": "exchange"}, {"source": 8, "vhost": "default", "source_type": "producer", "destination": 1, "destination_type": "exchange", "id": 16, "routing_key": "di.usr.one", "arguments": [] }, {"source": 9, "vhost": "default", "source_type": "producer", "destination": 1, "destination_type": "exchange", "id": 17, "routing_key": "di.usr.two", "arguments": [] } ], "producers": [{"name": "producer.one", "x": 157, "y": 152, "interval": 5, "publish": {"to": 1, "payload": "one", "routing_key": "di.usr.one"}, "resource_type": "producer", "id": 8 }, {"name": "producer.two", "x": 151, "y": 396, "interval": 5, "publish": {"to": 1, "payload": "two", "routing_key": "di.usr.two"}, "resource_type": "producer", "id": 9 } ], "consumers": [] }'
var example_te = '{"exchanges": [{"name": "topic.exch", "type": "2", "x": 299, "y": 297, "resource_type": "exchange", "id": 1 } ], "queues": [{"name": "queue.one", "x": 516, "y": 119, "resource_type": "queue", "id": 2, "messages": [], "totalConsumers": 2, "lastConsumer": 1 }, {"name": "queue.two", "x": 521, "y": 297, "resource_type": "queue", "id": 3, "messages": [], "totalConsumers": 1, "lastConsumer": 0 }, {"name": "queue.three", "x": 533, "y": 468, "resource_type": "queue", "id": 4, "messages": [], "totalConsumers": 1, "lastConsumer": 0 } ], "bindings": [{"source": 1, "vhost": "demo", "destination": 3, "destination_type": "queue", "routing_key": "producer.*", "arguments": [], "resource_type": "binding", "id": 5, "source_type": "exchange"}, {"source": 1, "vhost": "demo", "destination": 4, "destination_type": "queue", "routing_key": "#two", "arguments": [], "resource_type": "binding", "id": 6, "source_type": "exchange"}, {"source": 1, "vhost": "demo", "destination": 2, "destination_type": "queue", "routing_key": "producer.one", "arguments": [], "resource_type": "binding", "id": 7, "source_type": "exchange"}, {"source": 2, "vhost": "default", "source_type": "queue", "destination": 10, "destination_type": "consumer", "id": 13, "routing_key": null, "arguments": [] }, {"source": 3, "vhost": "default", "source_type": "queue", "destination": 11, "destination_type": "consumer", "id": 14, "routing_key": null, "arguments": [] }, {"source": 4, "vhost": "default", "source_type": "queue", "destination": 12, "destination_type": "consumer", "id": 15, "routing_key": null, "arguments": [] }, {"source": 8, "vhost": "default", "source_type": "producer", "destination": 1, "destination_type": "exchange", "id": 16, "routing_key": "di.usr.one", "arguments": [] }, {"source": 9, "vhost": "default", "source_type": "producer", "destination": 1, "destination_type": "exchange", "id": 17, "routing_key": "di.usr.two", "arguments": [] }, {"source": 2, "vhost": "demo", "destination": 32, "destination_type": "consumer", "routing_key": "key", "arguments": [], "id": 33, "source_type": "queue"} ], "producers": [{"name": "producer.one", "x": 157, "y": 152, "interval": 5, "publish": {"to": 1, "payload": "one", "routing_key": "di.usr.one"}, "resource_type": "producer", "id": 8 }, {"name": "producer.two", "x": 151, "y": 396, "interval": 5, "publish": {"to": 1, "payload": "two", "routing_key": "di.usr.two"}, "resource_type": "producer", "id": 9 } ], "consumers": [{"name": "app.one.a", "x": 856, "y": 73, "consume": 2, "resource_type": "consumer", "id": 10 }, {"name": "app.two", "x": 860, "y": 299, "consume": 3, "resource_type": "consumer", "id": 11 }, {"name": "app.three", "x": 861, "y": 472, "consume": 4, "resource_type": "consumer", "id": 12 }, {"name": "app.one.b", "resource_type": "consumer", "id": 32, "type": 0, "x": 856, "y": 181 } ] }';
var example_fe = '{"exchanges": [{"name": "fanout.exch", "type": "1", "x": 299, "y": 297, "resource_type": "exchange", "id": 1 } ], "queues": [{"name": "queue.one", "x": 516, "y": 119, "resource_type": "queue", "id": 2, "messages": [], "totalConsumers": 2, "lastConsumer": 0 }, {"name": "queue.two", "x": 521, "y": 297, "resource_type": "queue", "id": 3, "messages": [], "totalConsumers": 1, "lastConsumer": 0 }, {"name": "queue.three", "x": 533, "y": 468, "resource_type": "queue", "id": 4, "messages": [], "totalConsumers": 1, "lastConsumer": 0 } ], "bindings": [{"source": 1, "vhost": "demo", "destination": 3, "destination_type": "queue", "routing_key": "producer.two", "arguments": [], "resource_type": "binding", "id": 5, "source_type": "exchange"}, {"source": 1, "vhost": "demo", "destination": 4, "destination_type": "queue", "routing_key": "producer.*", "arguments": [], "resource_type": "binding", "id": 6, "source_type": "exchange"}, {"source": 1, "vhost": "demo", "destination": 2, "destination_type": "queue", "routing_key": "producer.one", "arguments": [], "resource_type": "binding", "id": 7, "source_type": "exchange"}, {"source": 2, "vhost": "default", "source_type": "queue", "destination": 10, "destination_type": "consumer", "id": 13, "routing_key": null, "arguments": [] }, {"source": 3, "vhost": "default", "source_type": "queue", "destination": 11, "destination_type": "consumer", "id": 14, "routing_key": null, "arguments": [] }, {"source": 4, "vhost": "default", "source_type": "queue", "destination": 12, "destination_type": "consumer", "id": 15, "routing_key": null, "arguments": [] }, {"source": 8, "vhost": "default", "source_type": "producer", "destination": 1, "destination_type": "exchange", "id": 16, "routing_key": "di.usr.one", "arguments": [] }, {"source": 9, "vhost": "default", "source_type": "producer", "destination": 1, "destination_type": "exchange", "id": 17, "routing_key": "di.usr.two", "arguments": [] }, {"source": 2, "vhost": "demo", "destination": 32, "destination_type": "consumer", "routing_key": "key", "arguments": [], "id": 33, "source_type": "queue"} ], "producers": [{"name": "producer.one", "x": 157, "y": 152, "interval": 5, "publish": {"to": 1, "payload": "one", "routing_key": "di.usr.one"}, "resource_type": "producer", "id": 8 }, {"name": "producer.two", "x": 151, "y": 397, "interval": 5, "publish": {"to": 1, "payload": "two", "routing_key": "di.usr.two"}, "resource_type": "producer", "id": 9 } ], "consumers": [{"name": "app.one.a", "x": 856, "y": 73, "consume": 2, "resource_type": "consumer", "id": 10 }, {"name": "app.two", "x": 860, "y": 299, "consume": 3, "resource_type": "consumer", "id": 11 }, {"name": "app.three", "x": 861, "y": 472, "consume": 4, "resource_type": "consumer", "id": 12 }, {"name": "app.one.b", "resource_type": "consumer", "id": 32, "type": 0, "x": 856, "y": 181 } ] }';
var example_de = '{"exchanges": [{"name": "direct.exch", "type": "0", "x": 299, "y": 297, "resource_type": "exchange", "id": 1 } ], "queues": [{"name": "queue.one", "x": 516, "y": 119, "resource_type": "queue", "id": 2, "messages": [], "totalConsumers": 2, "lastConsumer": 1 }, {"name": "queue.two", "x": 521, "y": 297, "resource_type": "queue", "id": 3, "messages": [], "totalConsumers": 1, "lastConsumer": 0 }, {"name": "queue.three", "x": 533, "y": 468, "resource_type": "queue", "id": 4, "messages": [], "totalConsumers": 1, "lastConsumer": 0 } ], "bindings": [{"source": 1, "vhost": "demo", "destination": 3, "destination_type": "queue", "routing_key": "producer.two", "arguments": [], "resource_type": "binding", "id": 5, "source_type": "exchange"}, {"source": 1, "vhost": "demo", "destination": 4, "destination_type": "queue", "routing_key": "producer.*", "arguments": [], "resource_type": "binding", "id": 6, "source_type": "exchange"}, {"source": 1, "vhost": "demo", "destination": 2, "destination_type": "queue", "routing_key": "producer.one", "arguments": [], "resource_type": "binding", "id": 7, "source_type": "exchange"}, {"source": 2, "vhost": "default", "source_type": "queue", "destination": 10, "destination_type": "consumer", "id": 13, "routing_key": null, "arguments": [] }, {"source": 3, "vhost": "default", "source_type": "queue", "destination": 11, "destination_type": "consumer", "id": 14, "routing_key": null, "arguments": [] }, {"source": 4, "vhost": "default", "source_type": "queue", "destination": 12, "destination_type": "consumer", "id": 15, "routing_key": null, "arguments": [] }, {"source": 8, "vhost": "default", "source_type": "producer", "destination": 1, "destination_type": "exchange", "id": 16, "routing_key": "di.usr.one", "arguments": [] }, {"source": 9, "vhost": "default", "source_type": "producer", "destination": 1, "destination_type": "exchange", "id": 17, "routing_key": "di.usr.two", "arguments": [] }, {"source": 2, "vhost": "demo", "destination": 32, "destination_type": "consumer", "routing_key": "key", "arguments": [], "id": 33, "source_type": "queue"} ], "producers": [{"name": "producer.one", "x": 157, "y": 152, "interval": 5, "publish": {"to": 1, "payload": "one", "routing_key": "di.usr.one"}, "resource_type": "producer", "id": 8 }, {"name": "producer.two", "x": 151, "y": 397, "interval": 5, "publish": {"to": 1, "payload": "two", "routing_key": "di.usr.two"}, "resource_type": "producer", "id": 9 } ], "consumers": [{"name": "app.one.a", "x": 856, "y": 73, "consume": 2, "resource_type": "consumer", "id": 10 }, {"name": "app.two", "x": 860, "y": 299, "consume": 3, "resource_type": "consumer", "id": 11 }, {"name": "app.three", "x": 861, "y": 472, "consume": 4, "resource_type": "consumer", "id": 12 }, {"name": "app.one.b", "resource_type": "consumer", "id": 32, "type": 0, "x": 856, "y": 181 } ] }';
var default_config = '{"exchanges": [{"name": "topic.exch", "type": "2", "x": 299, "y": 297, "resource_type": "exchange", "id": 1 } ], "queues": [{"name": "queue.one", "x": 516, "y": 119, "resource_type": "queue", "id": 2, "messages": [], "totalConsumers": 2, "lastConsumer": 1 }, {"name": "queue.two", "x": 521, "y": 297, "resource_type": "queue", "id": 3, "messages": [], "totalConsumers": 1, "lastConsumer": 0 }, {"name": "queue.three", "x": 533, "y": 468, "resource_type": "queue", "id": 4, "messages": [], "totalConsumers": 1, "lastConsumer": 0 } ], "bindings": [{"source": 1, "vhost": "demo", "destination": 3, "destination_type": "queue", "routing_key": "producer.*", "arguments": [], "resource_type": "binding", "id": 5, "source_type": "exchange"}, {"source": 1, "vhost": "demo", "destination": 4, "destination_type": "queue", "routing_key": "#two", "arguments": [], "resource_type": "binding", "id": 6, "source_type": "exchange"}, {"source": 1, "vhost": "demo", "destination": 2, "destination_type": "queue", "routing_key": "producer.one", "arguments": [], "resource_type": "binding", "id": 7, "source_type": "exchange"}, {"source": 2, "vhost": "default", "source_type": "queue", "destination": 10, "destination_type": "consumer", "id": 13, "routing_key": null, "arguments": [] }, {"source": 3, "vhost": "default", "source_type": "queue", "destination": 11, "destination_type": "consumer", "id": 14, "routing_key": null, "arguments": [] }, {"source": 4, "vhost": "default", "source_type": "queue", "destination": 12, "destination_type": "consumer", "id": 15, "routing_key": null, "arguments": [] }, {"source": 8, "vhost": "default", "source_type": "producer", "destination": 1, "destination_type": "exchange", "id": 16, "routing_key": "di.usr.one", "arguments": [] }, {"source": 9, "vhost": "default", "source_type": "producer", "destination": 1, "destination_type": "exchange", "id": 17, "routing_key": "di.usr.two", "arguments": [] }, {"source": 2, "vhost": "demo", "destination": 32, "destination_type": "consumer", "routing_key": "key", "arguments": [], "id": 33, "source_type": "queue"} ], "producers": [{"name": "producer.one", "x": 157, "y": 152, "interval": 5, "publish": {"to": 1, "payload": "one", "routing_key": "di.usr.one"}, "resource_type": "producer", "id": 8 }, {"name": "producer.two", "x": 151, "y": 396, "interval": 5, "publish": {"to": 1, "payload": "two", "routing_key": "di.usr.two"}, "resource_type": "producer", "id": 9 } ], "consumers": [{"name": "app.one.a", "x": 856, "y": 73, "consume": 2, "resource_type": "consumer", "id": 10 }, {"name": "app.two", "x": 860, "y": 299, "consume": 3, "resource_type": "consumer", "id": 11 }, {"name": "app.three", "x": 861, "y": 472, "consume": 4, "resource_type": "consumer", "id": 12 }, {"name": "app.one.b", "resource_type": "consumer", "id": 32, "type": 0, "x": 856, "y": 181 } ] }'
var clear = '{"exchanges":[],"queues":[],"bindings":[],"producers":[],"consumers":[]}'
// this is to track nodes when creating links
// needs to be global as it is used by multiple event handlers
var startNode;
var endNode;
var exchangeType = ["direct","fanout","topic"];
var config;
// Restore sequence generator on import to avoid id collision
function setUID() {
var max = []
d3.keys(config).forEach(function(k){
if (typeof(config[k]) === "object") {
config[k].forEach(function(o) {
max.push(o.id);
})
}});
uid(Math.max.apply(null,max));
}
// Convert simulator JSON
function convertJSON() {
// Add a unique ID to each object type
d3.keys(config).forEach(function(k){
if (typeof(config[k]) === "object") {
config[k].forEach(function(o) {
o.resource_type = k.slice(0,-1);
o.id = uid();
})
}});
// Add new attribute to queue objects to allow for message storage
config.queues.forEach(function(o) {
o.messages = [];
})
// Update binding references to point to IDs
config.bindings.forEach(function(d){
type = d.destination_type + "s";
destination = config[type].filter(function (obj) {
return obj.name === d.destination;
});
source = config["exchanges"].filter(function (obj) {
return obj.name === d.source;
});
d.destination = destination[0].id;
d.source = source[0].id;
d.source_type = "exchange";
});
// Translate consumer details into bindings
config.consumers.forEach(function(d){
var source = config.queues.filter(function (obj) {
return obj.name === d.consume;
});
d.consume = source[0].id;
var bind = { source: d.consume, vhost: "default", source_type: "queue", destination: d.id, destination_type: "consumer", id: uid(), routing_key: null, arguments: [] }
config.bindings.push(bind);
});
// Translate producer details into bindings
config.producers.forEach(function(d){
var destination = config.exchanges.filter(function (obj) {
return obj.name === d.publish.to;
});
d.publish.to = destination[0].id;
var bind = { source: d.id, vhost: "default", source_type: "producer", destination: d.publish.to, destination_type: "exchange", id: uid(), routing_key: d.publish.routing_key, arguments: [] }
config.bindings.push(bind);
});
// remove this key as this is what we're using to identify RabbitMQ Simulator JSON
// if we don't remove this then native exports won't import properly
delete config.advanced_mode;
}
//
// Prototypes
//
// Add method to move objects to the top of the SVG Z
d3.selection.prototype.moveToFront = function() {
return this.each(function() {
this.parentNode.appendChild(this);
});
}
//
// SELECTORS
//
function getAllResources(resourceType) {
return svg.selectAll("g." + resourceType).data(config[resourceType], function(d) {return d.id;});
}
function getAllBindings(resourceType) {
return svg.selectAll("g." + resourceType).data(config[resourceType], function(d) {return d.id;});
}
//
// ATTRIBUTE SETTERS
//
function setPos() {
// set the x and y on the group (even though it doesn't do anything)
// to allow for easier selection by the drag function
// Translate is what is doing the actual positioning
this.attr("transform", function (d) { return "translate(" + [d.x, d.y] + ")"; })
.attr("x", function (d) {return 100*d.id})
.attr("y", function (d) {return 100*d.id})
}
function setTextAttrShadow() {
this.text(function(d){
if (d.resource_type === "queue" && d.messages && d.messages.length > 0) {
return "[ " + d.messages.length + " ]";
} else {
return d.name
}
})
.attr('class','shadow')
.attr('text-anchor', 'middle')
.attr('y', 4)
}
function setTextAttr() {
this.text(function(d){
if (d.resource_type === "queue" && d.messages && d.messages.length > 0) {
return "[ " + d.messages.length + " ]";
} else {
return d.name
}
})
.attr('class','normal')
.attr('text-anchor', 'middle')
.attr('y', 4)
.on("click", function (d) {
if (d3.event.shiftKey) {
return;
}
if (d.resource_type === "exchange") {
$('#' + exchangeType[d.type]).button('toggle');
$("#exchangetype").show();
d3.select("#exchangetype").selectAll("input").attr("uid",d.id).attr("restype",d.resource_type);
$('exchangetype').text(d.resource_type + " properties for: " + d.name);
} else {
$("#exchangetype").hide();
}
d3.event.stopPropagation();
d3.select("#properties").classed("hidden",false).property('value',d.name).attr('uid', d.id);
$('.input-group-addon').text("name");
$('.modal-title').text(d.resource_type + " properties for: " + d.name);
$('#objProp').modal('toggle');
})
.on("mousedown", function (d) {
d3.event.stopPropagation();
})
.on("dblclick", function (d) {
d3.event.stopPropagation();
});
}
var drag = d3.behavior.drag()
.on("drag", function(d,i) {
if (startNode) { return; }
d.x += d3.event.dx;
d.y += d3.event.dy;
d3.select("#uid" + d.id).attr("transform", "translate(" + [ d.x,d.y ] + ")")
.attr("x", d.x)
.attr("y", d.y);
// keep the links updated while dragging
bindingUpdate();
//d3.event.stopPropagation();
})
.on("dragend", function () {
linkIndicator.classed('hidden', true);
function createBinding(source,destination) {
config.bindings.push({
source: source.id,
vhost:"demo",
destination: destination.id,
destination_type: destination.resource_type,
routing_key: "key",
arguments: [],
id: uid(),
source_type: source.resource_type
});
}
if (startNode && endNode) {
dType = endNode.resource_type;
sType = startNode.resource_type;
if (sType === "queue" && dType === "exchange") {
createBinding(endNode,startNode);
} else if (sType === "exchange" && dType === "exchange") {
createBinding(startNode,endNode);
} else if (sType === "producer" && dType === "exchange") {
createBinding(startNode,endNode);
} else if (sType === "consumer" && dType === "queue") {
var binds = config.bindings.filter(function(d){return d.source === endNode.id}).length;
createBinding(endNode,startNode);
if ( endNode.messages.length > 0 && binds < 1 ) {
for(var i = 0; i<endNode.messages.length;i++){
//
(function(i,endNode) {
setTimeout( function() {
queueMessages(i,endNode)
}, 1000 * i + 500)
})(i,endNode);
}
}
} else { showalert("<strong>Error:</strong> Unable to create bindings from " + sType + "s to " + dType + "s","alert-danger"); }
// Redraw binds
bindingAppend();
}
startNode = undefined;
});
function queueMessages(i,end) {
var node = d3.select("#uid" + end.id);
messageAppend(node.datum(), node.node(), "test", "msgKey");
node.datum().messages.splice(0, 1);
containerUpdate("queues");
}
function containerRemove(d,e) {
var type = e.className.baseVal.split(" ")[0];
var index = config[type].indexOf(d);
// remove the object from the array
config[type].splice(index, 1);
// remove any bindings referencing the removed object
config.bindings = config.bindings.filter( function (obj) {
return !((obj.source === d.id) || (obj.destination === d.id));
});
// redraw containers and bindings to reflect change
containerUpdate(type);
bindingUpdate();
}
function bindingRemove(d) {
var index = config.bindings.indexOf(d);
// remove the object from the array
config.bindings.splice(index, 1);
// redraw containers and bindings to reflect change
bindingUpdate();
}
function setCircAttr(d,type) {
if (d.node() != undefined) {
if (type === "inner") {
this.attr('r', radius)
// .attr('fill', '#80A2B8')
.attr('class', "inner " + d.datum().resource_type);
} else if (type === "outer") {
this.attr('r', radius + 6)
// .attr('fill', '#ccc')
.attr('class', "outer");
}
}
}
//
// UPDATE OPERATIONS
//
function containerAppend(resourceType) {
var containers = getAllResources(resourceType).enter().append("g");
// Container group
containers.attr("id", function (d) {return "uid" + d.id})
.attr("class", resourceType + " resource")
.call(setPos)
.call(drag)
.on("dblclick", function(d) {
d3.event.stopPropagation();
if (!d3.event.shiftKey) {
containerRemove(d,this);
}
})
.on("click", function (d) {
var e = d3.event.sourceEvent;
if (d3.event.shiftKey) {
//d3.event.preventDefault();
if (resourceType === "producers") {
messageAppend(d,this);
}
}
})
.on("mouseover", function () {
d3.select(this).classed("hover", true);
})
.on("mouseout", function () {
d3.select(this).classed("hover", false);
});
// Outer circle
containers.append("circle")
.call(setCircAttr,"outer")
.on("mousedown", function (d) {
startNode = d;
endNode = undefined;
// reposition temporary link indicator
linkIndicator.classed('hidden', false).attr('d', 'M' + d.x + ',' + d.y + 'L' + d.x + ',' + d.y);
// force element to be an top
d3.selectAll(this.parentNode).moveToFront();
//this.parentNode.parentNode.appendChild(this.parentNode);
})
.on("dblclick", function (d) {
d3.event.stopPropagation();
});
// Inner circle
containers.append("circle")
.call(setCircAttr,"inner")
containers.append("text")
.call(setTextAttrShadow)
containers.append("text")
.call(setTextAttr);
// Remove any objects which have been removed from the array
getAllResources(resourceType).exit().remove();
}
function containerUpdate(resourceType) {
var containers = getAllResources(resourceType);
containers.call(setPos);
containers.select("text.shadow")
.call(setTextAttrShadow);
containers.select("text.normal")
.call(setTextAttr);
containers.exit().remove();
}
// TODO: combine binding and connection functions
function bindingAppend() {
// Can't figure out a good way to update text in a textpath
// removing and redrawing all bindings as a workaround.
getAllBindings("bindings").remove();
var containers = getAllBindings("bindings").enter().append("g");
containers.attr("id", function (d) {return "uid" + d.id})
.attr("class", "bindings");
containers.append('path')
.attr("id", function (d) {return "binding-" + d.source + "-" + d.destination })
.attr('stroke', "#666")
.attr('stroke-width', "2px")
.on("dblclick", function(d) { bindingRemove(d); d3.event.stopPropagation(); })
.attr('d', drawBinding);
containers.append('text')
.attr('dy', -4)
.attr('text-anchor', 'middle')
.on("dblclick", function(d) { bindingRemove(d); d3.event.stopPropagation(); })
.append("textPath")
.attr("startOffset", "50%")
.attr("xlink:href", function(d){
return "#binding-" + d.source + "-" + d.destination;
})
// Logic to only show routing keys on applicable exchange types
.text(function(d){
if (d.source_type === "exchange") {
var exchange = config.exchanges.filter(function(exchange){
return d.source === exchange.id
});
if (exchange[0].type != 1) {
return d.routing_key;
}
}
})
.attr('class','textpath')
.on("click", function (d) {
d3.select("#properties").property('value',d.routing_key).attr('uid', d.id);
$('.input-group-addon').text("key");
$('.modal-title').text(d.resource_type + " properties for: " + d.routing_key);
$('#objProp').modal('toggle');
});
getAllResources("bindings").exit().remove();
// Put bindings behind circles
d3.selectAll(".resource").moveToFront();
}
function bindingUpdate() {
var containers = getAllBindings("bindings");
containers.selectAll("path")
.attr('d', drawBinding)
containers.exit().remove();
}
function drawBinding(d) {
var destination = svg.select("#uid" + d.destination).datum();
var source = svg.select("#uid" + d.source).datum();
return 'M' + source.x + ',' + source.y + 'L' + destination.x + ',' + destination.y;
};
//
// SEND MESSAGES
//
function translateAlong(path) {
var len = path.node().getTotalLength();
return function () {
return function (t) {
var p = path.node().getPointAtLength(t * len);
return "translate(" + p.x + "," + p.y + ")";
}
}
}
function routeMessage(message,path,bind) {
var destType = bind.destination_type + "s";
message.transition()
.duration(1400)
.attrTween("transform", translateAlong(path))
.each('end', function (d) {
var destBinds = config.bindings.filter(function(d){return d.source === bind.destination});
var dest = d3.select("#uid" + bind.destination);
var payload = message.attr("payload");
var msgKey = message.attr("key");
if (destBinds.length > 0) {
var destData = dest.datum();
var destElement = dest.node();
messageAppend(destData, destElement, payload, msgKey);
message.remove();
} else {
if (dest.node() && dest.datum().resource_type === "queue") {
var index = config.queues.indexOf(dest.datum());
config.queues[index].messages.push(payload);
containerUpdate("queues")
message.remove();
} else {
message.remove();
}
}
});
}
function messageDraw(bind,payload,msgKey,source) {
path = d3.select("#binding-" + bind.source + "-" + bind.destination);
message = svg.append("circle")
.style("fill", "#fff")
.style("fill-opacity", 1)
.attr("r", 13)
.on("contextmenu", function (d) {
d3.event.preventDefault();
})
.attr("target", bind.destination)
.attr("payload", payload)
.attr("key", msgKey)
.attr('stroke', "#666")
.attr('stroke-width', "2px")
.attr("transform", "translate(" + source.x + "," + source.y + ")")
.attr('class', 'message');
routeMessage(message,path,bind);
}
function messageAppend(source,element,payload,msgKey) {
if ( !payload ) { payload = uid(); }
if ( !msgKey ) { msgKey = source.name }
var bindings = config.bindings.filter(function(d){return d.source === source.id});
var source_type = element.className.baseVal.split(" ")[0];
if (source_type === "exchanges" && bindings.length > 0) {
var type = exchangeType[source.type];
if (type === "fanout") {
bindings.forEach(function(bind) { messageDraw(bind,payload,msgKey,source) });
} else if (type === "direct") {
var routes = config.bindings.filter(function(d){
return ((d.routing_key === msgKey) && (d.source === source.id))
});
routes.forEach(function(route) { messageDraw(route,payload,msgKey,source) });
} else if (type === "topic") {
var routes = config.bindings.filter(function(d){
if (d.routing_key) {
var pattern = d.routing_key
.concat("$") // add end of string to prevent partial matches
.replace(/\./g,'\\.') // escape dots in routing key
.replace(/\*/g,'([^\.]+)') // convert * to regex
.replace(/#/g,'.+'); // convert # to regex
return ((d.source === source.id) && (msgKey.match(pattern)))
}
});
routes.forEach(function(route) { messageDraw(route,payload,msgKey,source) });
}
} else if (source_type === "queues" && bindings.length > 0) {
source.totalConsumers = bindings.length;
// Round robin logic
if (source.lastConsumer < source.totalConsumers-1) {
source.lastConsumer++
} else {
source.lastConsumer = 0
}
messageDraw(bindings[source.lastConsumer],payload,msgKey,source);
} else if (source_type === "producers" && bindings.length > 0) {
messageDraw(bindings[0],payload,msgKey,source);
}
}
//
// INITIALIZE
//
// Create the link indicator first so it's on the bottom of the Z plane
var linkIndicator = svg.append('svg:path').attr('class', 'dragline hidden').attr('d', 'M0,50L50,50');
function initialize() {
containerAppend("exchanges");
containerAppend("queues");
containerAppend("producers");
containerAppend("consumers");
bindingAppend();
// move cicles to the front so bindings don't overlap
d3.selectAll(".resource").moveToFront();
}
function clearAll() {
svg.selectAll("g").remove();
}
function redraw() {
clearAll();
containerAppend("exchanges");
containerAppend("queues");
containerAppend("producers");
containerAppend("consumers");
bindingAppend();
// move cicles to the front so bindings don't overlap
d3.selectAll(".resource").moveToFront();
}
// REGISTER EVENT TO CREATE NEW OBJECTS
svg.on("dblclick", function () {
if (d3.event.shiftKey) {
return;
}
var p = d3.mouse(this),
id = uid();
type = newResourceType + "s";
if (type === "queues") {
config[type].push({name: newResourceType + id, resource_type: newResourceType, id: id, type: 0, x: p[0], y: p[1], messages: [] });
} else {
config[type].push({name: newResourceType + id, resource_type: newResourceType, id: id, type: 0, x: p[0], y: p[1] });
}
containerAppend(type);
});
svg.on("mousemove", function () {
var p = d3.mouse(this);
if (startNode) {
// Set link indicator to attach to node under cursor and then follow cursor around
linkIndicator.attr('d', 'M' + startNode.x + ',' + startNode.y + 'L' + p[0] + ',' + p[1]);
// poll on every mouse movement to look for valid nodes under the cursor
var node = d3.select('g.hover');
endNode = (!node.empty() && node.datum()) || undefined;
}
})
//
// REGISTER EVENTS FOR DYNAMIC FORM
//
var newResourceType = "consumer";
$('#resourcetype.btn-group').click(function (e) {
newResourceType = e.target.innerText;
})
$('#save').click(function (e) {
$("#exchangetype").hide();
})
$('#navImportButton').click(function(){
$('#jsonbody').removeProp('disabled');
$('#jsonheader').text('Import JSON:');
$('#importButton').show();
$('#jsonbody').val('');
$('#import').modal('toggle');
})
$('#navHelpButton').click(function(){
$('#jsonheader').text('RabbitMQ Visualizer Help');
$('#help').modal('toggle');
})
$('#navClearButton').click(function(){
loadConfig(clear);
})
$('.examples').click(function(d){
loadConfig(eval(d.currentTarget.id));
})
$('#navExportButton').click(function(){
$('#jsonbody').prop("disabled", true);
$('#jsonheader').text('Export JSON:');
$('#jsonbody').val(JSON.stringify(config,undefined,2));
$('#importButton').hide();
$('#import').modal('toggle');
})
$('#importButton').click(function (e) {
//var userImport = d3.select("#importJSON");
loadConfig($('#jsonbody').val());
$('#jsonbody').val('');
})
d3.selectAll("input[name=\"resourceType\"]").on("change", function () { newResourceType = this.value; });
d3.selectAll("#exchangetype label.btn").on("click", function () {
var uid = this.firstChild.getAttribute('uid');
var type = this.firstChild.value;
d3.selectAll("#uid" + uid).each(function(d){d.type = type});
bindingAppend();
});
d3.select("#properties").on("change", function () {
var uid = this.getAttribute("uid");
var name = this.value;
var resourceType;
d3.select("#uid" + uid).each(function(d){
// check what type of object this is so we can update just that type
resourceType = this.className.baseVal.split(" ")[0];
if (resourceType === "bindings") {
d.routing_key = name;
bindingAppend();
} else {
d.name = name;
containerUpdate(resourceType);
}
});
});
// LOAD CONFIG AND INITIALIZE
function loadConfig(json) {
uid(0); // reset sequence generator
config = JSON.parse(json);
if (config.advanced_mode !== undefined) {
convertJSON();
redraw();
setUID();
} else {
redraw();
setUID();
}
}
loadConfig(default_config);
</script>
</html>