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

Side by Side Diff: runtime/observatory/lib/src/elements/nav_bar.dart

Issue 2161633005: Converted Observatory nav-refresh element (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Final Merge Created 4 years, 5 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
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 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 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 nav_bar_element; 5 library nav_bar_element;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:html' hide Notification; 8 import 'dart:html' hide Notification;
9 import 'observatory_element.dart'; 9 import 'observatory_element.dart';
10 import 'package:observatory/service.dart'; 10 import 'package:observatory/service.dart';
(...skipping 24 matching lines...) Expand all
35 @CustomTag('nav-menu-item') 35 @CustomTag('nav-menu-item')
36 class NavMenuItemElement extends ObservatoryElement { 36 class NavMenuItemElement extends ObservatoryElement {
37 @published String link = '#'; 37 @published String link = '#';
38 @published String anchor = '---'; 38 @published String anchor = '---';
39 39
40 NavMenuItemElement.created() : super.created(); 40 NavMenuItemElement.created() : super.created();
41 } 41 }
42 42
43 typedef Future RefreshCallback(); 43 typedef Future RefreshCallback();
44 44
45 @CustomTag('nav-refresh')
46 class NavRefreshElement extends ObservatoryElement {
47 @published RefreshCallback callback;
48 @published bool active = false;
49 @published String label = 'Refresh';
50
51 NavRefreshElement.created() : super.created();
52
53 void buttonClick(Event e, var detail, Node target) {
54 if (active) {
55 return;
56 }
57 active = true;
58 if (callback != null) {
59 callback()
60 .catchError(app.handleException)
61 .whenComplete(refreshDone);
62 }
63 }
64
65 void refreshDone() {
66 active = false;
67 }
68 }
69
70 @CustomTag('top-nav-menu') 45 @CustomTag('top-nav-menu')
71 class TopNavMenuElement extends ObservatoryElement { 46 class TopNavMenuElement extends ObservatoryElement {
72 @published bool last = false; 47 @published bool last = false;
73 48
74 TopNavMenuElement.created() : super.created(); 49 TopNavMenuElement.created() : super.created();
75 } 50 }
76 51
77 @CustomTag('vm-nav-menu') 52 @CustomTag('vm-nav-menu')
78 class VMNavMenuElement extends ObservatoryElement { 53 class VMNavMenuElement extends ObservatoryElement {
79 @published bool last = false; 54 @published bool last = false;
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 @observable get isUnexpectedError { 130 @observable get isUnexpectedError {
156 return (exception is! NetworkRpcException); 131 return (exception is! NetworkRpcException);
157 } 132 }
158 133
159 void closeItem(MouseEvent e, var detail, Element target) { 134 void closeItem(MouseEvent e, var detail, Element target) {
160 notifications.remove(notification); 135 notifications.remove(notification);
161 } 136 }
162 137
163 NavNotifyExceptionElement.created() : super.created(); 138 NavNotifyExceptionElement.created() : super.created();
164 } 139 }
OLDNEW
« no previous file with comments | « runtime/observatory/lib/src/elements/nav/refresh_wrapper.dart ('k') | runtime/observatory/lib/src/elements/nav_bar.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698