Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Timepicker and top navigation fixes #6657

Merged
merged 16 commits into from
Mar 31, 2016
Merged

Conversation

panda01
Copy link
Contributor

@panda01 panda01 commented Mar 25, 2016

Changes the configObject directive to kbnTopNavbar.

continuation of #6502.

This and #6645 change how one goes about using the timepicker. you still need instantiate the timefilter and set timefilter.enabled = true, the only extra step is you also have to use this directive, or kbn-global-timepicker. Timepicker is no longer a part of kbn-chrome-append-nav-controls.

@panda01 panda01 self-assigned this Mar 25, 2016
@panda01 panda01 added the v5.0.0 label Mar 25, 2016
$scope.configTemplate = null;
$scope.kbnTopNavbar = {
currTemplate: false,
is: which => { return ctrlObj.curr === which; },
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I strongly object to removing the class in src/ui/public/config_template.js and then embedding it into the config directive.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@spalger why?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@panda01 panda01 force-pushed the fix/configObject branch 2 times, most recently from 7c3355e to 3f062f1 Compare March 29, 2016 22:50
@@ -1,60 +1,11 @@
<div dashboard-app class="app-container dashboard-container">
<navbar name="dashboard-options" class="kibana-nav-options">
<kbn-top-nav name="dashboard">
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't like this name thing.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

presumably this should be something like

<kbn-top-nav name="dashboard" kbn-top-nav-button="kbnTopNav">

@panda01 panda01 force-pushed the fix/configObject branch 5 times, most recently from 58d62c2 to 35f17d6 Compare March 30, 2016 17:34
@spalger
Copy link
Contributor

spalger commented Mar 30, 2016

jenkins, test it

@rashidkpc
Copy link
Contributor

screen shot 2016-03-30 at 12 51 51 pm

Pretty sure this doesn't exist in master?

@panda01 panda01 force-pushed the fix/configObject branch 2 times, most recently from 6dde24a to 26cceb8 Compare March 30, 2016 21:24
@panda01
Copy link
Contributor Author

panda01 commented Mar 30, 2016

Addressed your concerns @rashidkpc. Waiting for these tests to pass.

@rashidkpc
Copy link
Contributor

Also broken:

screen shot 2016-03-30 at 3 53 18 pm

@tsullivan
Copy link
Member

I got the controls added to my page by adding the kbn-global-timepicker directive. It looks like it will take some playing to get it to appear next to tabs.

When I click the controls, they don't do anything - just the play/pause button works.

image

@panda01
Copy link
Contributor Author

panda01 commented Mar 30, 2016

Leaving the dojo now. Will fix the tests soon. Also @tsullivan maybe try
adding it further up in the Dom. It doesn't matter where you put it in the
Dom as long as you put time filter enabled.
On Mar 30, 2016 19:09, "Tim Sullivan" [email protected] wrote:

I got the controls added to my page by adding the kbn-global-timepicker
directive. It looks like it will take some playing to get it to appear next
to tabs.

When I click the controls, they don't do anything - just the play/pause
button works.

[image: image]
https://cloud.githubusercontent.com/assets/908371/14160460/5932a88e-f691-11e5-8754-8476812811ca.png


You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub
#6657 (comment)

@rashidkpc
Copy link
Contributor

Grab my commits from this pull. I also noted the failing tests there.

@panda01 #6711

@rashidkpc rashidkpc changed the title Fix/config object Timepicker and top navigation fixes Mar 30, 2016
* ```
*/

module.directive('config', function ($compile) {
module.directive('kbnTopNav', function (Private) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This directive has no tests

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

@panda01 panda01 force-pushed the fix/configObject branch 2 times, most recently from e157773 to 9c0b65a Compare March 31, 2016 00:37
@tsullivan
Copy link
Member

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.

@tsullivan tsullivan assigned rashidkpc and unassigned tsullivan Mar 31, 2016
}, getTemplatesMap(niceMenuItems));


$scope.kbnTopNav = {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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);

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a blocker, but something to watch out for.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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" [email protected] 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

@rashidkpc
Copy link
Contributor

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.

@rashidkpc
Copy link
Contributor

Upgraded timelion for this: elastic/timelion@7010b75

@rashidkpc rashidkpc merged commit 727f24b into elastic:master Mar 31, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants