mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
use history service in the dashboard app
This commit is contained in:
parent
3c62973edb
commit
4d93498e81
2 changed files with 5 additions and 12 deletions
|
@ -42,10 +42,11 @@ define(function (require) {
|
|||
}
|
||||
});
|
||||
|
||||
app.directive('dashboardApp', function (Notifier, courier, storage, config, savedVisualizations, appStateFactory, timefilter) {
|
||||
app.directive('dashboardApp', function (Notifier, courier, History, savedVisualizations, appStateFactory, timefilter) {
|
||||
return {
|
||||
controller: function ($scope, $route, $routeParams, $location, configFile) {
|
||||
$scope.history = storage.get('dashboard:history') || [];
|
||||
var history = new History('dashboard:history');
|
||||
$scope.history = history.get();
|
||||
|
||||
var notify = new Notifier({
|
||||
location: 'Dashboard'
|
||||
|
@ -98,19 +99,10 @@ define(function (require) {
|
|||
}
|
||||
}
|
||||
|
||||
function updateQueryHistory() {
|
||||
if ($state.query.length) {
|
||||
var history = _.pull($scope.history.slice(0), $state.query);
|
||||
history.unshift($state.query);
|
||||
$scope.history = history.slice(0, config.get('history:limit'));
|
||||
storage.set('dashboard:history', $scope.history);
|
||||
}
|
||||
}
|
||||
|
||||
$scope.filterResults = function () {
|
||||
updateQueryOnRootSource();
|
||||
$state.save();
|
||||
updateQueryHistory();
|
||||
$scope.history = history.add($state.query);
|
||||
courier.fetch();
|
||||
};
|
||||
|
||||
|
|
|
@ -70,6 +70,7 @@
|
|||
'specs/filters/moment',
|
||||
'specs/filters/start_from',
|
||||
'specs/services/storage',
|
||||
'specs/services/history',
|
||||
'specs/utils/datemath',
|
||||
'specs/utils/interval',
|
||||
'specs/utils/versionmath',
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue