Commit ad9b2ab6 by bergquist

fix(impressionStorage): use title instead of slut

closes #4194
parent df8e56dd
......@@ -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
};
});
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment