OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 library vm_connect_element; | 5 library vm_connect_element; |
6 | 6 |
7 import 'dart:html'; | 7 import 'dart:html'; |
8 import 'dart:async'; | 8 import 'dart:async'; |
9 import 'dart:convert'; | 9 import 'dart:convert'; |
10 import 'package:observatory/models.dart' as M; | 10 import 'package:observatory/models.dart' as M; |
11 import 'package:observatory/src/elements/helpers/tag.dart'; | 11 import 'package:observatory/src/elements/helpers/tag.dart'; |
12 import 'package:observatory/src/elements/helpers/rendering_scheduler.dart'; | 12 import 'package:observatory/src/elements/helpers/rendering_scheduler.dart'; |
13 import 'package:observatory/src/elements/nav/bar.dart'; | 13 import 'package:observatory/src/elements/helpers/nav_bar.dart'; |
14 import 'package:observatory/src/elements/nav/notify.dart'; | 14 import 'package:observatory/src/elements/nav/notify.dart'; |
15 import 'package:observatory/src/elements/nav/top_menu.dart'; | 15 import 'package:observatory/src/elements/nav/top_menu.dart'; |
16 import 'package:observatory/src/elements/view_footer.dart'; | 16 import 'package:observatory/src/elements/view_footer.dart'; |
17 import 'package:observatory/src/elements/vm_connect_target.dart'; | 17 import 'package:observatory/src/elements/vm_connect_target.dart'; |
18 | 18 |
19 typedef void CrashDumpLoadCallback(Map dump); | 19 typedef void CrashDumpLoadCallback(Map dump); |
20 | 20 |
21 class VMConnectElement extends HtmlElement implements Renderable { | 21 class VMConnectElement extends HtmlElement implements Renderable { |
22 static const tag = const Tag<VMConnectElement>('vm-connect', | 22 static const tag = const Tag<VMConnectElement>('vm-connect', |
23 dependencies: const [NavBarElement.tag, | 23 dependencies: const [NavTopMenuElement.tag, |
24 NavTopMenuElement.tag, | |
25 NavNotifyElement.tag, | 24 NavNotifyElement.tag, |
26 ViewFooterElement.tag, | 25 ViewFooterElement.tag, |
27 VMConnectTargetElement.tag]); | 26 VMConnectTargetElement.tag]); |
28 | 27 |
29 RenderingScheduler _r; | 28 RenderingScheduler _r; |
30 | 29 |
31 Stream<RenderedEvent<VMConnectElement>> get onRendered => _r.onRendered; | 30 Stream<RenderedEvent<VMConnectElement>> get onRendered => _r.onRendered; |
32 | 31 |
33 CrashDumpLoadCallback _loadDump; | 32 CrashDumpLoadCallback _loadDump; |
34 M.NotificationRepository _notifications; | 33 M.NotificationRepository _notifications; |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 super.detached(); | 67 super.detached(); |
69 children = []; | 68 children = []; |
70 _r.disable(notify: true); | 69 _r.disable(notify: true); |
71 _targetsSubscription.cancel(); | 70 _targetsSubscription.cancel(); |
72 } | 71 } |
73 | 72 |
74 void render() { | 73 void render() { |
75 final host = window.location.hostname; | 74 final host = window.location.hostname; |
76 final port = window.location.port; | 75 final port = window.location.port; |
77 children = [ | 76 children = [ |
78 new NavBarElement(queue: _r.queue) | 77 navBar([ |
79 ..children = [ | 78 new NavTopMenuElement(queue: _r.queue), |
80 new NavTopMenuElement(last: true, queue: _r.queue), | 79 new NavNotifyElement(_notifications, queue: _r.queue) |
81 new NavNotifyElement(_notifications, queue: _r.queue) | 80 ]), |
82 ], | |
83 new DivElement() | 81 new DivElement() |
84 ..classes = ['content-centered'] | 82 ..classes = ['content-centered'] |
85 ..children = [ | 83 ..children = [ |
86 new HeadingElement.h1()..text = 'Connect to a Dart VM', | 84 new HeadingElement.h1()..text = 'Connect to a Dart VM', |
87 new BRElement(), new HRElement(), | 85 new BRElement(), new HRElement(), |
88 new DivElement() | 86 new DivElement() |
89 ..classes = ['flex-row'] | 87 ..classes = ['flex-row'] |
90 ..children = [ | 88 ..children = [ |
91 new DivElement() | 89 new DivElement() |
92 ..classes = ['flex-item-40-percent'] | 90 ..classes = ['flex-item-40-percent'] |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 void _connect(TargetEvent e) => _targets.setCurrent(e.target); | 173 void _connect(TargetEvent e) => _targets.setCurrent(e.target); |
176 void _delete(TargetEvent e) => _targets.delete(e.target); | 174 void _delete(TargetEvent e) => _targets.delete(e.target); |
177 | 175 |
178 static String _normalizeStandaloneAddress(String networkAddress) { | 176 static String _normalizeStandaloneAddress(String networkAddress) { |
179 if (networkAddress.startsWith('ws://')) { | 177 if (networkAddress.startsWith('ws://')) { |
180 return networkAddress; | 178 return networkAddress; |
181 } | 179 } |
182 return 'ws://${networkAddress}/ws'; | 180 return 'ws://${networkAddress}/ws'; |
183 } | 181 } |
184 } | 182 } |
OLD | NEW |