Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(372)

Side by Side Diff: runtime/bin/vmservice/client/lib/src/observatory_elements/service_ref.dart

Issue 184233007: Refactor Observatory (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
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.
4
5 library service_ref_element;
6
7 import 'package:polymer/polymer.dart';
8 import 'observatory_element.dart';
9
10 @CustomTag('service-ref')
11 class ServiceRefElement extends ObservatoryElement {
12 @published Map ref;
13 @published bool internal = false;
14 @published Isolate isolate = null;
15 ServiceRefElement.created() : super.created();
16
17 void refChanged(oldValue) {
18 notifyPropertyChange(#url, "", url);
19 notifyPropertyChange(#name, [], name);
20 notifyPropertyChange(#hoverText, "", hoverText);
21 }
22
23 String get url {
24 if (ref != null) {
25 return relativeLink(ref['id']);
26 }
27 return '';
28 }
29
30 String get hoverText {
31 if (ref == null) {
32 return '';
33 }
34 // Return the VM name by default.
35 var name = ref['name'];
36 return name != null ? name : '';
37 }
38
39 String get name {
40 if (ref == null) {
41 return 'NULL REF';
42 }
43 String name_key = internal ? 'name' : 'user_name';
44 if (ref[name_key] != null) {
45 return ref[name_key];
46 } else if (ref['name'] != null) {
47 return ref['name'];
48 } else if (ref['user_name'] != null) {
49 return ref['user_name'];
50 }
51 return '';
52 }
53
54 void isolateChanged(oldValue) {
55 notifyPropertyChange(#relativeLink, 0, 1);
56 }
57
58 @observable
59 String relativeLink(String link) {
60 if (app == null) {
61 return '';
62 } else if (isolate == null) {
63 return app.locationManager.currentIsolateRelativeLink(link);
64 } else {
65 return app.locationManager.relativeLink(isolate.id, link);
66 }
67 }
68 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698