[timepicker] Use a single config
This commit is contained in:
parent
849897d606
commit
911ad8e74b
10 changed files with 32 additions and 50 deletions
|
@ -1,4 +1,4 @@
|
|||
<div dashboard-app class="app-container dashboard-container" chrome-context>
|
||||
<div dashboard-app class="app-container dashboard-container">
|
||||
<navbar name="dashboard-options">
|
||||
<div class="button-group dashboard-actions" role="toolbar">
|
||||
<button ng-click="newDashboard()"
|
||||
|
@ -48,14 +48,6 @@
|
|||
<div class="chrome-actions"kbn-chrome-append-nav-controls></div>
|
||||
</div>
|
||||
</navbar>
|
||||
|
||||
<config
|
||||
ng-show="timefilter.enabled"
|
||||
config-template="pickerTemplate"
|
||||
config-object="timefilter"
|
||||
config-close="pickerTemplate.close">
|
||||
</config>
|
||||
|
||||
<config config-template="configTemplate" config-object="opts"></config>
|
||||
|
||||
<navbar ng-show="chrome.getVisible()" name="dashboard-search">
|
||||
|
|
|
@ -105,7 +105,9 @@ app.directive('dashboardApp', function (Notifier, courier, AppState, timefilter,
|
|||
load: require('plugins/kibana/dashboard/partials/load_dashboard.html'),
|
||||
share: require('plugins/kibana/dashboard/partials/share.html'),
|
||||
pickVis: require('plugins/kibana/dashboard/partials/pick_visualization.html'),
|
||||
options: require('plugins/kibana/dashboard/partials/options.html')
|
||||
options: require('plugins/kibana/dashboard/partials/options.html'),
|
||||
filter: require('ui/chrome/config/filter.html'),
|
||||
interval: require('ui/chrome/config/interval.html')
|
||||
});
|
||||
|
||||
$scope.refresh = _.bindKey(courier, 'fetch');
|
||||
|
@ -239,7 +241,8 @@ app.directive('dashboardApp', function (Notifier, courier, AppState, timefilter,
|
|||
ui: $state.options,
|
||||
save: $scope.save,
|
||||
addVis: $scope.addVis,
|
||||
addSearch: $scope.addSearch
|
||||
addSearch: $scope.addSearch,
|
||||
timefilter: $scope.timefilter
|
||||
};
|
||||
|
||||
init();
|
||||
|
|
|
@ -96,16 +96,17 @@ app.controller('discover', function ($scope, config, courier, $route, $window, N
|
|||
$scope.toggleInterval = function () {
|
||||
$scope.showInterval = !$scope.showInterval;
|
||||
};
|
||||
|
||||
// config panel templates
|
||||
$scope.configTemplate = new ConfigTemplate({
|
||||
load: require('plugins/kibana/discover/partials/load_search.html'),
|
||||
save: require('plugins/kibana/discover/partials/save_search.html'),
|
||||
share: require('plugins/kibana/discover/partials/share_search.html')
|
||||
share: require('plugins/kibana/discover/partials/share_search.html'),
|
||||
filter: require('ui/chrome/config/filter.html'),
|
||||
interval: require('ui/chrome/config/interval.html')
|
||||
});
|
||||
|
||||
$scope.timefilter = timefilter;
|
||||
|
||||
|
||||
// the saved savedSearch
|
||||
const savedSearch = $route.current.locals.savedSearch;
|
||||
$scope.$on('$destroy', savedSearch.destroy);
|
||||
|
@ -147,7 +148,8 @@ app.controller('discover', function ($scope, config, courier, $route, $window, N
|
|||
index: $scope.indexPattern.id,
|
||||
timefield: $scope.indexPattern.timeFieldName,
|
||||
savedSearch: savedSearch,
|
||||
indexPatternList: $route.current.locals.ip.list
|
||||
indexPatternList: $route.current.locals.ip.list,
|
||||
timefilter: $scope.timefilter
|
||||
};
|
||||
|
||||
const init = _.once(function () {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<div ng-controller="discover" class="app-container" chrome-context>
|
||||
<div ng-controller="discover" class="app-container">
|
||||
<navbar name="discover-options">
|
||||
<div class="discover-info">
|
||||
<span ng-show="opts.savedSearch.id" class="discover-info-title">
|
||||
|
@ -42,12 +42,6 @@
|
|||
<div class="chrome-actions" kbn-chrome-append-nav-controls></div>
|
||||
</div>
|
||||
</navbar>
|
||||
<config
|
||||
ng-show="timefilter.enabled"
|
||||
config-template="pickerTemplate"
|
||||
config-object="timefilter"
|
||||
config-close="pickerTemplate.close">
|
||||
</config>
|
||||
<config
|
||||
config-template="configTemplate"
|
||||
config-object="opts"
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<div ng-controller="VisEditor" class="vis-editor vis-type-{{ vis.type.name }}" chrome-context>
|
||||
<div ng-controller="VisEditor" class="vis-editor vis-type-{{ vis.type.name }}">
|
||||
<navbar ng-if="chrome.getVisible()" name="visualize-options">
|
||||
<div class="button-group vis-editor-actions">
|
||||
<button ng-click="startOver()" aria-label="New Visualization">
|
||||
|
@ -42,12 +42,6 @@
|
|||
<div class="chrome-actions"kbn-chrome-append-nav-controls></div>
|
||||
</div>
|
||||
</navbar>
|
||||
<config
|
||||
ng-show="timefilter.enabled"
|
||||
config-template="pickerTemplate"
|
||||
config-object="timefilter"
|
||||
config-close="pickerTemplate.close">
|
||||
</config>
|
||||
<config
|
||||
ng-if="chrome.getVisible()"
|
||||
config-template="configTemplate"
|
||||
|
|
|
@ -85,6 +85,8 @@ uiModules
|
|||
save: require('plugins/kibana/visualize/editor/panels/save.html'),
|
||||
load: require('plugins/kibana/visualize/editor/panels/load.html'),
|
||||
share: require('plugins/kibana/visualize/editor/panels/share.html'),
|
||||
filter: require('ui/chrome/config/filter.html'),
|
||||
interval: require('ui/chrome/config/interval.html')
|
||||
});
|
||||
|
||||
if (savedVis.id) {
|
||||
|
@ -125,8 +127,8 @@ uiModules
|
|||
$scope.editableVis = editableVis;
|
||||
$scope.state = $state;
|
||||
$scope.uiState = $state.makeStateful('uiState');
|
||||
|
||||
$scope.conf = _.pick($scope, 'doSave', 'savedVis', 'shareData');
|
||||
$scope.timefilter = timefilter;
|
||||
$scope.conf = _.pick($scope, 'doSave', 'savedVis', 'shareData', 'timefilter');
|
||||
$scope.configTemplate = configTemplate;
|
||||
|
||||
editableVis.listeners.click = vis.listeners.click = filterBarClickHandler($state);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<kbn-timepicker
|
||||
from="timefilter.time.from"
|
||||
to="timefilter.time.to"
|
||||
mode="timefilter.time.mode"
|
||||
from="opts.timefilter.time.from"
|
||||
to="opts.timefilter.time.to"
|
||||
mode="opts.timefilter.time.mode"
|
||||
active-tab="'filter'"
|
||||
interval="timefilter.refreshInterval">
|
||||
interval="opts.timefilter.refreshInterval">
|
||||
</kbn-timepicker>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<kbn-timepicker
|
||||
from="timefilter.time.from"
|
||||
to="timefilter.time.to"
|
||||
mode="timefilter.time.mode"
|
||||
from="opts.timefilter.time.from"
|
||||
to="opts.timefilter.time.to"
|
||||
mode="opts.timefilter.time.mode"
|
||||
active-tab="'interval'"
|
||||
interval="timefilter.refreshInterval">
|
||||
interval="opts.timefilter.refreshInterval">
|
||||
</kbn-timepicker>
|
||||
|
|
|
@ -21,11 +21,6 @@ uiModules
|
|||
|
||||
// chrome is responsible for timepicker ui and state transfer...
|
||||
$scope.timefilter = timefilter;
|
||||
$scope.pickerTemplate = new ConfigTemplate({
|
||||
filter: require('ui/chrome/config/filter.html'),
|
||||
interval: require('ui/chrome/config/interval.html')
|
||||
});
|
||||
|
||||
$scope.toggleRefresh = function () {
|
||||
timefilter.refreshInterval.pause = !timefilter.refreshInterval.pause;
|
||||
};
|
||||
|
|
|
@ -8,11 +8,11 @@
|
|||
</li>
|
||||
|
||||
<li
|
||||
ng-show="timefilter.refreshInterval.value > 0 || !!pickerTemplate.current"
|
||||
ng-show="timefilter.refreshInterval.value > 0 || !!configTemplate.current"
|
||||
class="to-body">
|
||||
|
||||
<button ng-click="pickerTemplate.toggle('interval')"
|
||||
ng-class="{active: pickerTemplate.is('interval') }"
|
||||
<button ng-click="configTemplate.toggle('interval')"
|
||||
ng-class="{active: configTemplate.is('interval') }"
|
||||
class="navbar-timepicker-auto-refresh-desc">
|
||||
<span ng-show="timefilter.refreshInterval.value === 0"><i class="fa fa-repeat"></i> Auto-refresh</span>
|
||||
<span ng-show="timefilter.refreshInterval.value > 0">{{timefilter.refreshInterval.display}}</span>
|
||||
|
@ -21,11 +21,11 @@
|
|||
</li>
|
||||
|
||||
<li class="to-body" >
|
||||
<button ng-class="{active: pickerTemplate.is('filter')}"
|
||||
ng-click="pickerTemplate.toggle('filter')"
|
||||
<button ng-class="{active: configTemplate.is('filter')}"
|
||||
ng-click="configTemplate.toggle('filter')"
|
||||
aria-haspopup="true"
|
||||
aria-expanded="false"
|
||||
class="btnnavbar-timepicker-time-desc">
|
||||
class="navbar-timepicker-time-desc">
|
||||
<i aria-hidden="true" class="fa fa-clock-o"></i>
|
||||
<pretty-duration from="timefilter.time.from" to="timefilter.time.to"></pretty-duration>
|
||||
</button>
|
||||
|
|
Loading…
Reference in a new issue