panels: general property which makes panel scrollable

This commit is contained in:
Alexander Zobnin
2017-11-16 15:33:12 +03:00
parent fd046428b4
commit 4b88cc0226
6 changed files with 39 additions and 40 deletions

View File

@@ -1,4 +1,4 @@
<div class="panel-alert-list" style="{{ctrl.contentHeight}}">
<div class="panel-alert-list">
<section class="card-section card-list-layout-list" ng-if="ctrl.panel.show === 'current'">
<ol class="card-list">
<li class="card-item-wrapper" ng-repeat="alert in ctrl.currentAlerts">

View File

@@ -21,7 +21,6 @@ class AlertListPanel extends PanelCtrl {
{text: 'Importance', value: 3},
];
contentHeight: string;
stateFilter: any = {};
currentAlerts: any = [];
alertHistory: any = [];
@@ -38,6 +37,7 @@ class AlertListPanel extends PanelCtrl {
constructor($scope, $injector, private backendSrv) {
super($scope, $injector);
_.defaults(this.panel, this.panelDefaults);
this.scrollable = true;
this.events.on('init-edit-mode', this.onInitEditMode.bind(this));
this.events.on('render', this.onRender.bind(this));
@@ -75,7 +75,6 @@ class AlertListPanel extends PanelCtrl {
}
onRender() {
this.contentHeight = "max-height: " + this.height + "px;";
if (this.panel.show === 'current') {
this.getCurrentAlertState();
}

View File

@@ -1,19 +1,17 @@
<div gemini-scrollbar>
<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="dashboard/{{dash.uri}}">
<span class="dashlist-title">
{{dash.title}}
</span>
<span class="dashlist-star">
<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="dashboard/{{dash.uri}}">
<span class="dashlist-title">
{{dash.title}}
</span>
<span class="dashlist-star">
<i class="fa" ng-class="{'fa-star': dash.isStarred, 'fa-star-o': dash.isStarred === false}"></i>
</span>
</a>
</div>
</div>
</div>

View File

@@ -25,6 +25,7 @@ class DashListCtrl extends PanelCtrl {
constructor($scope, $injector, private backendSrv) {
super($scope, $injector);
_.defaults(this.panel, this.panelDefaults);
this.scrollable = true;
if (this.panel.tag) {
this.panel.tags = [this.panel.tag];
@@ -33,9 +34,6 @@ class DashListCtrl extends PanelCtrl {
this.events.on('refresh', this.onRefresh.bind(this));
this.events.on('init-edit-mode', this.onInitEditMode.bind(this));
this.events.on('render', this.setPanelHeight.bind(this));
this.events.on('panel-size-changed', this.setPanelHeight.bind(this));
this.events.on('panel-change-view', this.setPanelHeight.bind(this));
this.groups = [
{list: [], show: false, header: "Starred dashboards",},
@@ -69,19 +67,6 @@ class DashListCtrl extends PanelCtrl {
this.addEditorTab('Options', 'public/app/plugins/panel/dashlist/editor.html');
}
setPanelHeight() {
this.$scope.setPanelHeight();
}
link(scope, elem, attrs, ctrl: DashListCtrl) {
let panelContentElem = elem.find('.panel-content');
panelContentElem.height(ctrl.height);
scope.setPanelHeight = () => {
panelContentElem.height(ctrl.height);
};
}
onRefresh() {
var promises = [];
@@ -90,10 +75,7 @@ class DashListCtrl extends PanelCtrl {
promises.push(this.getSearch());
return Promise.all(promises)
.then(() => {
this.setPanelHeight();
return this.renderingCompleted();
});
.then(this.renderingCompleted.bind(this));
}
getSearch() {