mirror of https://github.com/grafana/grafana
commit
060cd6ebef
@ -0,0 +1,41 @@ |
||||
import coreModule from 'app/core/core_module'; |
||||
import appEvents from 'app/core/app_events'; |
||||
|
||||
export function pageScrollbar() { |
||||
return { |
||||
restrict: 'A', |
||||
link: function(scope, elem, attrs) { |
||||
let lastPos = 0; |
||||
|
||||
appEvents.on( |
||||
'dash-scroll', |
||||
evt => { |
||||
if (evt.restore) { |
||||
elem[0].scrollTop = lastPos; |
||||
return; |
||||
} |
||||
|
||||
lastPos = elem[0].scrollTop; |
||||
|
||||
if (evt.animate) { |
||||
elem.animate({ scrollTop: evt.pos }, 500); |
||||
} else { |
||||
elem[0].scrollTop = evt.pos; |
||||
} |
||||
}, |
||||
scope |
||||
); |
||||
|
||||
scope.$on('$routeChangeSuccess', () => { |
||||
lastPos = 0; |
||||
elem[0].scrollTop = 0; |
||||
elem[0].focus(); |
||||
}); |
||||
|
||||
elem[0].tabIndex = -1; |
||||
elem[0].focus(); |
||||
}, |
||||
}; |
||||
} |
||||
|
||||
coreModule.directive('pageScrollbar', pageScrollbar); |
@ -1,18 +1,18 @@ |
||||
<div dash-class ng-if="ctrl.dashboard"> |
||||
<dashnav dashboard="ctrl.dashboard"></dashnav> |
||||
|
||||
<div class="scroll-canvas scroll-canvas--dashboard" grafana-scrollbar> |
||||
<dashboard-settings dashboard="ctrl.dashboard" |
||||
ng-if="ctrl.dashboardViewState.state.editview" |
||||
class="dashboard-settings"> |
||||
</dashboard-settings> |
||||
<div class="scroll-canvas scroll-canvas--dashboard" page-scrollbar> |
||||
<dashboard-settings dashboard="ctrl.dashboard" |
||||
ng-if="ctrl.dashboardViewState.state.editview" |
||||
class="dashboard-settings"> |
||||
</dashboard-settings> |
||||
|
||||
<div class="dashboard-container"> |
||||
<dashboard-submenu ng-if="ctrl.dashboard.meta.submenuEnabled" dashboard="ctrl.dashboard"> |
||||
</dashboard-submenu> |
||||
<div class="dashboard-container"> |
||||
<dashboard-submenu ng-if="ctrl.dashboard.meta.submenuEnabled" dashboard="ctrl.dashboard"> |
||||
</dashboard-submenu> |
||||
|
||||
<dashboard-grid get-panel-container="ctrl.getPanelContainer"> |
||||
</dashboard-grid> |
||||
</div> |
||||
</div> |
||||
<dashboard-grid get-panel-container="ctrl.getPanelContainer"> |
||||
</dashboard-grid> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
|
@ -1,17 +1,19 @@ |
||||
<div class="dashlist" ng-repeat="group in ctrl.groups"> |
||||
<div class="dashlist-section" ng-if="group.show"> |
||||
<h6 class="dashlist-section-header" ng-show="ctrl.panel.headings"> |
||||
{{group.header}} |
||||
</h6> |
||||
<div class="dashlist-item" ng-repeat="dash in group.list"> |
||||
<a class="dashlist-link dashlist-link-{{dash.type}}" href="{{dash.url}}"> |
||||
<span class="dashlist-title"> |
||||
{{dash.title}} |
||||
</span> |
||||
<span class="dashlist-star" ng-click="ctrl.starDashboard(dash, $event)"> |
||||
<i class="fa" ng-class="{'fa-star': dash.isStarred, 'fa-star-o': dash.isStarred === false}"></i> |
||||
</span> |
||||
</a> |
||||
<div> |
||||
<div class="dashlist" ng-repeat="group in ctrl.groups"> |
||||
<div class="dashlist-section" ng-if="group.show"> |
||||
<h6 class="dashlist-section-header" ng-show="ctrl.panel.headings"> |
||||
{{group.header}} |
||||
</h6> |
||||
<div class="dashlist-item" ng-repeat="dash in group.list"> |
||||
<a class="dashlist-link dashlist-link-{{dash.type}}" href="{{dash.url}}"> |
||||
<span class="dashlist-title"> |
||||
{{dash.title}} |
||||
</span> |
||||
<span class="dashlist-star" ng-click="ctrl.starDashboard(dash, $event)"> |
||||
<i class="fa" ng-class="{'fa-star': dash.isStarred, 'fa-star-o': dash.isStarred === false}"></i> |
||||
</span> |
||||
</a> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
|
Loading…
Reference in new issue