feat(impressionStore): remove un needed js-ts bridge

This commit is contained in:
bergquist 2016-02-29 14:37:09 +01:00
parent e5970e83ff
commit b79217be1e
5 changed files with 10 additions and 17 deletions

View File

@ -16,5 +16,5 @@ define([
'./graphiteImportCtrl',
'./dynamicDashboardSrv',
'./importCtrl',
'./impressions',
'./impressionStore',
], function () {});

View File

@ -5,9 +5,9 @@ define([
'jquery',
'app/core/utils/kbn',
'app/core/utils/datemath',
'./impressions',
'./impressionStore',
],
function (angular, moment, _, $, kbn, dateMath, impressions) {
function (angular, moment, _, $, kbn, dateMath, impressionStore) {
'use strict';
var module = angular.module('grafana.services');
@ -41,7 +41,7 @@ function (angular, moment, _, $, kbn, dateMath, impressions) {
}
promise.then(function(result) {
impressions.addImpression(slug);
impressionStore.impressions.addDashboardImpression(slug);
return result;
});

View File

@ -3,10 +3,10 @@
import store from 'app/core/store';
import _ from 'lodash';
export class Impressions {
export class ImpressionsStore {
constructor() {}
addImpression(slug) {
addDashboardImpression(slug) {
var impressions = [];
if (store.exists("dashboard_impressions")) {
impressions = JSON.parse(store.get("dashboard_impressions"));
@ -28,13 +28,13 @@ export class Impressions {
store.set("dashboard_impressions", JSON.stringify(impressions));
}
getImpressions() {
getDashboardOpened() {
var k = store.get("dashboard_impressions");
return JSON.parse(k);
}
}
var impressions = new Impressions();
var impressions = new ImpressionsStore();
export {
impressions

View File

@ -1,7 +0,0 @@
define([
'./impressions2'
], function(impressions) {
'use strict';
// backward compatability hack;
return impressions.impressions;
});

View File

@ -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/impressions2';
import {impressions} from 'app/features/dashboard/impressionStore';
// Set and populate defaults
var panelDefaults = {
@ -43,7 +43,7 @@ class DashListCtrl extends PanelCtrl {
var params: any = {limit: this.panel.limit};
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 {
title: dashboard,
uri: 'db/' + dashboard