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) | 103 app.isConnectedVMTarget(target) : false; |
104 : false; | |
105 return new LIElement() | 104 return new LIElement() |
106 ..children = [ | 105 ..children = [ |
107 new VMConnectTargetElement(target, | 106 new VMConnectTargetElement(target, |
108 current: current, queue: _r.queue) | 107 current: current, queue: _r.queue) |
109 ..onConnect.listen(_connect) | 108 ..onConnect.listen(_connect) |
110 ..onDelete.listen(_delete) | 109 ..onDelete.listen(_delete) |
111 ]; | 110 ]; |
112 }).toList(), | 111 }).toList(), |
113 new HRElement(), | 112 new HRElement(), |
114 new FormElement() | 113 new FormElement() |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 } | 200 } |
202 try { | 201 try { |
203 Uri uri = Uri.parse(networkAddress); | 202 Uri uri = Uri.parse(networkAddress); |
204 return 'ws://${uri.authority}${uri.path}ws'; | 203 return 'ws://${uri.authority}${uri.path}ws'; |
205 } catch (e) { | 204 } catch (e) { |
206 print('caught exception with: $networkAddress -- $e'); | 205 print('caught exception with: $networkAddress -- $e'); |
207 return networkAddress; | 206 return networkAddress; |
208 } | 207 } |
209 } | 208 } |
210 } | 209 } |
OLD | NEW |