Index: runtime/observatory/lib/src/elements/isolate_reconnect.dart |
diff --git a/runtime/observatory/lib/src/elements/isolate_reconnect.dart b/runtime/observatory/lib/src/elements/isolate_reconnect.dart |
index 01edf8f0d1827ff7c52b070d8ef906580453af41..465bc0c1d3a9e5d46fb9e17d6569b3a6069aecf9 100644 |
--- a/runtime/observatory/lib/src/elements/isolate_reconnect.dart |
+++ b/runtime/observatory/lib/src/elements/isolate_reconnect.dart |
@@ -4,24 +4,111 @@ |
library isolate_reconnect_element; |
-import 'package:polymer/polymer.dart'; |
-import 'observatory_element.dart'; |
+import 'dart:html'; |
+import 'dart:async'; |
+import 'package:observatory/models.dart' as M; |
+import 'package:observatory/src/elements/helpers/rendering_scheduler.dart'; |
+import 'package:observatory/src/elements/helpers/tag.dart'; |
+import 'package:observatory/src/elements/helpers/uris.dart'; |
+import 'package:observatory/src/elements/nav/bar.dart'; |
+import 'package:observatory/src/elements/nav/notify.dart'; |
+import 'package:observatory/src/elements/nav/top_menu.dart'; |
+import 'package:observatory/src/elements/view_footer.dart'; |
+ |
+class IsolateReconnectElement extends HtmlElement implements Renderable{ |
+ static const tag = const Tag<IsolateReconnectElement>('isolate-reconnect', |
+ dependencies: const [NavBarElement.tag, |
+ NavTopMenuElement.tag, |
+ NavNotifyElement.tag, |
+ ViewFooterElement.tag]); |
+ |
+ RenderingScheduler _r; |
+ |
+ Stream<RenderedEvent<IsolateReconnectElement>> get onRendered => |
+ _r.onRendered; |
+ |
+ M.VM _vm; |
+ String _missing; |
+ Uri _uri; |
+ M.EventRepository _events; |
+ StreamSubscription _subscription; |
+ |
+ M.VM get vm => _vm; |
+ String get missing => _missing; |
+ Uri get uri => _uri; |
+ |
+ M.NotificationRepository _notifications; |
+ factory IsolateReconnectElement(M.VM vm, M.EventRepository events, |
+ M.NotificationRepository notifications, String missing, Uri uri, |
+ {RenderingQueue queue}) { |
+ assert(vm != null); |
+ assert(events != null); |
+ assert(missing != null); |
+ assert(uri != null); |
+ assert(notifications != null); |
+ IsolateReconnectElement e = document.createElement(tag.name); |
+ e._r = new RenderingScheduler(e, queue: queue); |
+ e._vm = vm; |
+ e._events = events; |
+ e._missing = missing; |
+ e._uri = uri; |
+ e._notifications = notifications; |
+ return e; |
+ } |
-@CustomTag('isolate-reconnect') |
-class IsolateReconnectElement extends ObservatoryElement { |
IsolateReconnectElement.created() : super.created(); |
- get missingIsolateId { |
- return app.locationManager.uri.queryParameters['originalIsolateId']; |
+ @override |
+ void attached() { |
+ super.attached(); |
+ _subscription = _events.onVMUpdate.listen((e) { |
+ _vm = e.vm; |
+ _r.dirty(); |
+ }); |
+ _r.enable(); |
+ } |
+ |
+ @override |
+ void detached() { |
+ super.detached(); |
+ children = []; |
+ _r.disable(notify: true); |
+ _subscription.cancel(); |
} |
- linkToContinueIn(isolate) { |
- var parameters = new Map.from(app.locationManager.uri.queryParameters); |
- parameters['isolateId'] = isolate.id; |
- parameters.remove('originalIsolateId'); |
- var path = parameters.remove('originalPath'); |
- path = "/$path"; |
- var generatedUri = new Uri(path: path, queryParameters: parameters); |
- return app.locationManager.makeLink(generatedUri.toString()); |
+ void render() { |
+ children = [ |
+ new NavBarElement(queue: _r.queue) |
+ ..children = [ |
+ new NavTopMenuElement(last: true, queue: _r.queue), |
+ new NavNotifyElement(_notifications, queue: _r.queue) |
+ ], |
+ new DivElement() |
+ ..classes = ['content-centered'] |
+ ..children = [ |
+ new HeadingElement.h1()..text = 'Isolate $_missing no longer exists', |
+ new BRElement(), new HRElement(), |
+ new DivElement()..classes = ['memberList'] |
+ ..children = (_vm.isolates.map((isolate) { |
+ final query = new Map.from(_uri.queryParameters); |
+ query['isolateId'] = isolate.id; |
+ final href = new Uri(path: _uri.path, queryParameters: query); |
+ return new DivElement()..classes = ['memberItem', 'doubleSpaced'] |
+ ..children = [ |
+ new SpanElement()..text = 'Continue in ', |
+ new AnchorElement(href: '#$href')..classes = ['isolate-link'] |
+ ..text = '${isolate.id} (${isolate.name})' |
+ ]; |
+ }).toList()..add( |
+ new DivElement()..classes = ['memberItem', 'doubleSpaced'] |
+ ..children = [ |
+ new SpanElement()..text = 'Go to ', |
+ new AnchorElement(href: Uris.vm()) |
+ ..text = 'isolates summary', |
+ ] |
+ )) |
+ ], |
+ new ViewFooterElement(queue: _r.queue) |
+ ]; |
} |
} |