mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
parent
df8e56ddf8
commit
ad9b2ab617
@ -16,5 +16,5 @@ define([
|
||||
'./graphiteImportCtrl',
|
||||
'./dynamicDashboardSrv',
|
||||
'./importCtrl',
|
||||
'./impressionStore',
|
||||
'./impression_store',
|
||||
], function () {});
|
||||
|
@ -5,7 +5,7 @@ define([
|
||||
'jquery',
|
||||
'app/core/utils/kbn',
|
||||
'app/core/utils/datemath',
|
||||
'./impressionStore',
|
||||
'./impression_store',
|
||||
],
|
||||
function (angular, moment, _, $, kbn, dateMath, impressionStore) {
|
||||
'use strict';
|
||||
@ -41,7 +41,7 @@ function (angular, moment, _, $, kbn, dateMath, impressionStore) {
|
||||
}
|
||||
|
||||
promise.then(function(result) {
|
||||
impressionStore.impressions.addDashboardImpression(slug);
|
||||
impressionStore.impressions.addDashboardImpression(result);
|
||||
return result;
|
||||
});
|
||||
|
||||
|
@ -6,7 +6,8 @@ import _ from 'lodash';
|
||||
export class ImpressionsStore {
|
||||
constructor() {}
|
||||
|
||||
addDashboardImpression(slug) {
|
||||
addDashboardImpression(impression) {
|
||||
console.log(impression);
|
||||
var impressions = [];
|
||||
if (store.exists("dashboard_impressions")) {
|
||||
impressions = JSON.parse(store.get("dashboard_impressions"));
|
||||
@ -15,12 +16,14 @@ export class ImpressionsStore {
|
||||
}
|
||||
}
|
||||
|
||||
var exists = impressions.indexOf(slug);
|
||||
if (exists >= 0) {
|
||||
impressions.splice(exists, 1);
|
||||
}
|
||||
impressions = impressions.filter((imp) => {
|
||||
return impression.meta.slug !== imp.slug;
|
||||
});
|
||||
|
||||
impressions.unshift(slug);
|
||||
impressions.unshift({
|
||||
title: impression.dashboard.title,
|
||||
slug: impression.meta.slug
|
||||
});
|
||||
|
||||
if (impressions.length > 20) {
|
||||
impressions.shift();
|
@ -3,7 +3,7 @@
|
||||
import _ from 'lodash';
|
||||
import config from 'app/core/config';
|
||||
import {PanelCtrl} from 'app/plugins/sdk';
|
||||
import {impressions} from 'app/features/dashboard/impressionStore';
|
||||
import {impressions} from 'app/features/dashboard/impression_store';
|
||||
|
||||
// Set and populate defaults
|
||||
var panelDefaults = {
|
||||
@ -45,8 +45,8 @@ class DashListCtrl extends PanelCtrl {
|
||||
if (this.panel.mode === 'last viewed') {
|
||||
var dashListNames = _.first(impressions.getDashboardOpened(), this.panel.limit).map((dashboard) => {
|
||||
return {
|
||||
title: dashboard,
|
||||
uri: 'db/' + dashboard
|
||||
title: dashboard.title,
|
||||
uri: 'db/' + dashboard.slug
|
||||
};
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user