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; |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 ..children = [ | 92 ..children = [ |
93 new DivElement() | 93 new DivElement() |
94 ..classes = ['flex-item-40-percent'] | 94 ..classes = ['flex-item-40-percent'] |
95 ..children = [ | 95 ..children = [ |
96 new HeadingElement.h2()..text = 'Connect over WebSocket', | 96 new HeadingElement.h2()..text = 'Connect over WebSocket', |
97 new BRElement(), | 97 new BRElement(), |
98 new UListElement() | 98 new UListElement() |
99 ..children = _targets.list().map((target) { | 99 ..children = _targets.list().map((target) { |
100 final ObservatoryApplication app = | 100 final ObservatoryApplication app = |
101 ObservatoryApplication.app; | 101 ObservatoryApplication.app; |
102 final bool current = (app != null) ? | 102 final bool current = (app != null) |
103 app.isConnectedVMTarget(target) : false; | 103 ? app.isConnectedVMTarget(target) |
| 104 : false; |
104 return new LIElement() | 105 return new LIElement() |
105 ..children = [ | 106 ..children = [ |
106 new VMConnectTargetElement(target, | 107 new VMConnectTargetElement(target, |
107 current: current, queue: _r.queue) | 108 current: current, queue: _r.queue) |
108 ..onConnect.listen(_connect) | 109 ..onConnect.listen(_connect) |
109 ..onDelete.listen(_delete) | 110 ..onDelete.listen(_delete) |
110 ]; | 111 ]; |
111 }).toList(), | 112 }).toList(), |
112 new HRElement(), | 113 new HRElement(), |
113 new FormElement() | 114 new FormElement() |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 } | 201 } |
201 try { | 202 try { |
202 Uri uri = Uri.parse(networkAddress); | 203 Uri uri = Uri.parse(networkAddress); |
203 return 'ws://${uri.authority}${uri.path}ws'; | 204 return 'ws://${uri.authority}${uri.path}ws'; |
204 } catch (e) { | 205 } catch (e) { |
205 print('caught exception with: $networkAddress -- $e'); | 206 print('caught exception with: $networkAddress -- $e'); |
206 return networkAddress; | 207 return networkAddress; |
207 } | 208 } |
208 } | 209 } |
209 } | 210 } |
OLD | NEW |