Timepicker and top navigation fixes#6657
Conversation
…cope, and be a bit more transparent, also some code cleanup
src/ui/public/directives/config.js
Outdated
| $scope.configTemplate = null; | ||
| $scope.kbnTopNavbar = { | ||
| currTemplate: false, | ||
| is: which => { return ctrlObj.curr === which; }, |
There was a problem hiding this comment.
I strongly object to removing the class in src/ui/public/config_template.js and then embedding it into the config directive.
There was a problem hiding this comment.
I misunderstood the way this was working and thought that the config template was being decorated with is() and such. This seems to be defining an API in the config directive, and then trying to export it to the parent scopes so that they can manipulate the current template.
The idea of exporting an API up to your parent directives is strange, but I suppose stranger things have happened. I don't really have strong arguments against it.
a2f1361 to
0c420c2
Compare
7c3355e to
3f062f1
Compare
There was a problem hiding this comment.
I don't like this name thing.
There was a problem hiding this comment.
presumably this should be something like
<kbn-top-nav name="dashboard" kbn-top-nav-button="kbnTopNav">
3f062f1 to
dc35fc4
Compare
…g extensions, added top navbar to every page
58d62c2 to
35f17d6
Compare
|
jenkins, test it |
6dde24a to
26cceb8
Compare
|
Addressed your concerns @rashidkpc. Waiting for these tests to pass. |
…ve timepicker opening button
|
Leaving the dojo now. Will fix the tests soon. Also @tsullivan maybe try
|
| */ | ||
|
|
||
| module.directive('config', function ($compile) { | ||
| module.directive('kbnTopNav', function (Private) { |
There was a problem hiding this comment.
This directive has no tests
There was a problem hiding this comment.
It does have tests. Not the most comprehensive, but they exist. I just check for the existence of the functions is, open, close, and toggle. Should I add more?
e157773 to
9c0b65a
Compare
2cbccb1 to
7a6ea3d
Compare
|
I figured out the issues I need to do to get the tabs navigation / timepicker elements cleaned up and working again. I see Rashid gave a LGTM but some things have changed since. Passing back to Rashid. |
| }, getTemplatesMap(niceMenuItems)); | ||
|
|
||
|
|
||
| $scope.kbnTopNav = { |
There was a problem hiding this comment.
Because this directive isn't isolate, and adds properties to $scope, is has the non-obvious side effect of causing every view that uses it to end up with a property on $scope called kbnTopNav
However, because that property is not defined until after the directive is compiled, it isn't available in the controller until after the initial setup. That means if you wish to toggle something when your controller starts you'll need to wait until the directive links:
$timeout(function () {
if (config.get('timelion:showTutorial', true)) {
$scope.kbnTopNav.open('docs');
}
}, 0);
There was a problem hiding this comment.
Not a blocker, but something to watch out for.
There was a problem hiding this comment.
Hmm, I would think that because I define kbnTopNav in the controller it
would work. But I can make an issue if it's really a nuisance and
investigate.
On Mar 31, 2016 11:48, "Rashid Khan" notifications@github.com wrote:
In src/ui/public/directives/kbn_top_nav.js
#6657 (comment):
}const templateToCompile = ctrlObj.templates[ctrlObj.curr] || false;$scope.kbnTopNav.currTemplate = templateToCompile ? $compile(templateToCompile)($scope) : false;};const normalizeOpts = _.partial(optionsNormalizer, (item) => {ctrlObj.toggleCurrTemplate(item.key);});
const niceMenuItems = _.compact(($scope[$attrs.config] || []).map(normalizeOpts));ctrlObj.templates = _.assign({interval: intervalTemplate,filter: filterTemplate,}, getTemplatesMap(niceMenuItems));
$scope.kbnTopNav = {Not a blocker, but something to watch out for.
—
You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub
https://github.com/elastic/kibana/pull/6657/files/8ccbc124822eecd23477ea4aed97c7e3ccaa021e#r58077811
|
I'd like to point out how much easier this is to use than the old way of doing buttons. Much less code, much easier to read and update. |
|
Upgraded timelion for this: elastic/timelion@7010b75 |



Changes the
configObjectdirective tokbnTopNavbar.continuation of #6502.
This and #6645 change how one goes about using the timepicker. you still need instantiate the
timefilterand settimefilter.enabled = true, the only extra step is you also have to use this directive, orkbn-global-timepicker. Timepicker is no longer a part ofkbn-chrome-append-nav-controls.