mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
feat(impressionStore): remove un needed js-ts bridge
This commit is contained in:
parent
e5970e83ff
commit
b79217be1e
@ -16,5 +16,5 @@ define([
|
|||||||
'./graphiteImportCtrl',
|
'./graphiteImportCtrl',
|
||||||
'./dynamicDashboardSrv',
|
'./dynamicDashboardSrv',
|
||||||
'./importCtrl',
|
'./importCtrl',
|
||||||
'./impressions',
|
'./impressionStore',
|
||||||
], function () {});
|
], function () {});
|
||||||
|
@ -5,9 +5,9 @@ define([
|
|||||||
'jquery',
|
'jquery',
|
||||||
'app/core/utils/kbn',
|
'app/core/utils/kbn',
|
||||||
'app/core/utils/datemath',
|
'app/core/utils/datemath',
|
||||||
'./impressions',
|
'./impressionStore',
|
||||||
],
|
],
|
||||||
function (angular, moment, _, $, kbn, dateMath, impressions) {
|
function (angular, moment, _, $, kbn, dateMath, impressionStore) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var module = angular.module('grafana.services');
|
var module = angular.module('grafana.services');
|
||||||
@ -41,7 +41,7 @@ function (angular, moment, _, $, kbn, dateMath, impressions) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
promise.then(function(result) {
|
promise.then(function(result) {
|
||||||
impressions.addImpression(slug);
|
impressionStore.impressions.addDashboardImpression(slug);
|
||||||
return result;
|
return result;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -3,10 +3,10 @@
|
|||||||
import store from 'app/core/store';
|
import store from 'app/core/store';
|
||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
|
|
||||||
export class Impressions {
|
export class ImpressionsStore {
|
||||||
constructor() {}
|
constructor() {}
|
||||||
|
|
||||||
addImpression(slug) {
|
addDashboardImpression(slug) {
|
||||||
var impressions = [];
|
var impressions = [];
|
||||||
if (store.exists("dashboard_impressions")) {
|
if (store.exists("dashboard_impressions")) {
|
||||||
impressions = JSON.parse(store.get("dashboard_impressions"));
|
impressions = JSON.parse(store.get("dashboard_impressions"));
|
||||||
@ -28,13 +28,13 @@ export class Impressions {
|
|||||||
store.set("dashboard_impressions", JSON.stringify(impressions));
|
store.set("dashboard_impressions", JSON.stringify(impressions));
|
||||||
}
|
}
|
||||||
|
|
||||||
getImpressions() {
|
getDashboardOpened() {
|
||||||
var k = store.get("dashboard_impressions");
|
var k = store.get("dashboard_impressions");
|
||||||
return JSON.parse(k);
|
return JSON.parse(k);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var impressions = new Impressions();
|
var impressions = new ImpressionsStore();
|
||||||
|
|
||||||
export {
|
export {
|
||||||
impressions
|
impressions
|
@ -1,7 +0,0 @@
|
|||||||
define([
|
|
||||||
'./impressions2'
|
|
||||||
], function(impressions) {
|
|
||||||
'use strict';
|
|
||||||
// backward compatability hack;
|
|
||||||
return impressions.impressions;
|
|
||||||
});
|
|
@ -3,7 +3,7 @@
|
|||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
import config from 'app/core/config';
|
import config from 'app/core/config';
|
||||||
import {PanelCtrl} from 'app/plugins/sdk';
|
import {PanelCtrl} from 'app/plugins/sdk';
|
||||||
import {impressions} from 'app/features/dashboard/impressions2';
|
import {impressions} from 'app/features/dashboard/impressionStore';
|
||||||
|
|
||||||
// Set and populate defaults
|
// Set and populate defaults
|
||||||
var panelDefaults = {
|
var panelDefaults = {
|
||||||
@ -43,7 +43,7 @@ class DashListCtrl extends PanelCtrl {
|
|||||||
var params: any = {limit: this.panel.limit};
|
var params: any = {limit: this.panel.limit};
|
||||||
|
|
||||||
if (this.panel.mode === 'last viewed') {
|
if (this.panel.mode === 'last viewed') {
|
||||||
var dashListNames = _.first(impressions.getImpressions(), this.panel.limit).map((dashboard) => {
|
var dashListNames = _.first(impressions.getDashboardOpened(), this.panel.limit).map((dashboard) => {
|
||||||
return {
|
return {
|
||||||
title: dashboard,
|
title: dashboard,
|
||||||
uri: 'db/' + dashboard
|
uri: 'db/' + dashboard
|
||||||
|
Loading…
Reference in New Issue
Block a user