Commit ed1864e0 by bergquist

feat(dashlist): stores recently visited dashboards per orgid

parent 0998ce81
......@@ -2,14 +2,16 @@
import store from 'app/core/store';
import _ from 'lodash';
import config from 'app/core/config';
export class ImpressionsStore {
constructor() {}
addDashboardImpression(dashboardId) {
var impressionsKey = this.impressionKey(config);
var impressions = [];
if (store.exists("dashboard_impressions")) {
impressions = JSON.parse(store.get("dashboard_impressions"));
if (store.exists(impressionsKey)) {
impressions = JSON.parse(store.get(impressionsKey));
if (!_.isArray(impressions)) {
impressions = [];
}
......@@ -24,11 +26,11 @@ export class ImpressionsStore {
if (impressions.length > 50) {
impressions.pop();
}
store.set("dashboard_impressions", JSON.stringify(impressions));
store.set(impressionsKey, JSON.stringify(impressions));
}
getDashboardOpened() {
var impressions = store.get("dashboard_impressions") || "[]";
var impressions = store.get(this.impressionKey(config)) || "[]";
impressions = JSON.parse(impressions);
......@@ -38,6 +40,10 @@ export class ImpressionsStore {
return impressions;
}
impressionKey(config) {
return "dashboard_impressions-" + config.bootData.user.orgId;
}
}
var impressions = new ImpressionsStore();
......
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