| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 } |
| OLD | NEW |