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

add an option for url types so that it can be opened in current tab (master branch) #13209

Merged
merged 5 commits into from
Sep 14, 2017

Conversation

fbaligand
Copy link
Contributor

@fbaligand fbaligand commented Jul 30, 2017

In Management tab > Index Patterns, in field edition form with "URL" format and "Link" type, this PR adds a checkbox to indicate that this link is to be open in current tab (default is "in another tab", ie. _blank).

This is particularly useful when your link points to a kibana dashboard with filtered params.

Fix #12668

image

@elasticmachine
Copy link
Contributor

Can one of the admins verify this patch?

@fbaligand fbaligand changed the title add an option for url types so that it can be opened in current tab add an option for url types so that it can be opened in current tab (master branch) Jul 30, 2017
@fbaligand
Copy link
Contributor Author

@epixa
Could you review this PR ?

@epixa
Copy link
Contributor

epixa commented Aug 9, 2017

@fbaligand Sorry for the lack of response, I was on vacation last week and am still catching up on notifications. I'm sure we can get a review on this soon.

@epixa
Copy link
Contributor

epixa commented Aug 9, 2017

jenkins, test this

Copy link
Contributor

@chrisronline chrisronline left a comment

Choose a reason for hiding this comment

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

Thanks for the contribution! It looks awesome! Just one minor issue and it'll be good to go!

@@ -7,6 +7,13 @@
</select>
</div>

<div class="checkbox" ng-if="editor.formatParams.type == 'a'">
<label>
<input ng-model="editor.formatParams.openLinkInCurrentTab" class="ng-pristine ng-valid ng-touched" type="checkbox">
Copy link
Contributor

Choose a reason for hiding this comment

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

There really isn't a reason to manually add these classes (ng-pristine, ng-valid and ng-touched). Angular will handle that automatically.

@epixa
Copy link
Contributor

epixa commented Aug 9, 2017

It looks like there are some linting issues caught by CI as well.

@chrisronline
Copy link
Contributor

Good catch.

Copied from CI (which is linked below):

 /var/lib/jenkins/workspace/elastic+kibana+pull-request+multijob-intake/src/core_plugins/kibana/common/field_formats/types/url.js
  109:13  error  'linkTarget' is never reassigned. Use 'const' instead  prefer-const
  110:1   error  Trailing spaces not allowed                            no-trailing-spaces

Copy link
Contributor

@BigFunger BigFunger left a comment

Choose a reason for hiding this comment

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

Couple small tweaks.

@@ -106,7 +106,9 @@ UrlFormat.prototype._convert = {
linkLabel = label;
}

return `<a href="${url}" target="_blank">${linkLabel}</a>`;
let linkTarget = this.param('openLinkInCurrentTab') ? '_self' : '_blank';
Copy link
Contributor

@BigFunger BigFunger Aug 9, 2017

Choose a reason for hiding this comment

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

const that up. :)

@@ -119,6 +126,7 @@ <h4 class="hintbox-heading">
</div>

<input ng-model="editor.formatParams.labelTemplate" class="form-control">

Copy link
Contributor

Choose a reason for hiding this comment

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

Remove the extra whitespace, please.

@@ -7,6 +7,13 @@
</select>
</div>

<div class="checkbox" ng-if="editor.formatParams.type == 'a'">
<label>
<input ng-model="editor.formatParams.openLinkInCurrentTab" class="ng-pristine ng-valid ng-touched" type="checkbox">
Copy link
Contributor

Choose a reason for hiding this comment

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

These attributes should be one per line. See here for details.

@fbaligand
Copy link
Contributor Author

Thanks for your feedback and your review !
I will fix all your remarks as soon as possible !

@fbaligand
Copy link
Contributor Author

I'm currently on holidays (my turn ^^).
So I will fix remarks in about one week.
Sorry for the delay...

@fbaligand
Copy link
Contributor Author

fbaligand commented Aug 19, 2017

@epixa @chrisronline @BigFunger
I just fixed all your remarks and rebased my code to master.

=> Could you review it ?

If you wish I squash my 2 commits, tell me.

@@ -8,6 +8,16 @@
</select>
</div>

<div class="checkbox" ng-if="editor.formatParams.type == 'a'">
<label>
Copy link
Contributor

Choose a reason for hiding this comment

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

@cjcenizal @timroes Any accessibility concerns with this label/input approach?

Copy link
Contributor

Choose a reason for hiding this comment

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

@chrisronline nope, looks very fine :-) Thanks for pinging.

@fbaligand
Copy link
Contributor Author

@chrisronline
For information, to write my html for checkbox, I used exactly the same style than this existing one :

<label>
<input
type="checkbox"
ng-model="editor.formatParams.openLinkInCurrentTab">
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we move the > to the next line? Along the lines of these examples

@@ -8,6 +8,16 @@
</select>
</div>

<div class="checkbox" ng-if="editor.formatParams.type == 'a'">
Copy link
Contributor

@cjcenizal cjcenizal Aug 22, 2017

Choose a reason for hiding this comment

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

Would you mind changing this to:

<div ng-if="editor.formatParams.type == 'a'">
  <label class="kuiCheckBoxLabel">
    <input
      class="kuiCheckBox"
      type="checkbox"
      ng-model="editor.formatParams.openLinkInCurrentTab"
    ></input>
    
    <span class="kuiCheckBoxLabel__text">
      Open link in current tab
    </span>
  </label>
</div>

These classes are provided by the UI Framework.

@fbaligand
Copy link
Contributor Author

fbaligand commented Aug 22, 2017

@chrisronline @cjcenizal
OK.
I just pushed a commit which fixes the checkbox html.

@fbaligand
Copy link
Contributor Author

@chrisronline @BigFunger
Could you verify that your requested changes are done, and if so, give go for LGTM ?

@chrisronline
Copy link
Contributor

LGTM!

@fbaligand
Copy link
Contributor Author

Thanks @chrisronline !
Great news !

@fbaligand
Copy link
Contributor Author

@timroes
Done !
=> Could you check it ?

@timroes
Copy link
Contributor

timroes commented Sep 7, 2017

LGTM @BigFunger would you care for an approval (or dismiss of your review :D)?

@timroes
Copy link
Contributor

timroes commented Sep 7, 2017

Jenkins, test this

@timroes
Copy link
Contributor

timroes commented Sep 7, 2017

Sorry, I think adding that rel=noopener broke now 3 tests in this test (line 10, 24 and 37 - also see jenkins failure). Could you add the rel=noopener there, too?

@fbaligand
Copy link
Contributor Author

@timroes
Sorry for these broken tests.
I fixed them.

@timroes
Copy link
Contributor

timroes commented Sep 7, 2017

Jenkins, test this

@fbaligand
Copy link
Contributor Author

@timroes
Jenkins says it's OK.
So now, what's the next step ?
Should we wait for @BigFunger review ?

Copy link
Contributor

@BigFunger BigFunger left a comment

Choose a reason for hiding this comment

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

LGTM! Sorry for the delay!

@fbaligand
Copy link
Contributor Author

Great @BigFunger !

@fbaligand
Copy link
Contributor Author

@timroes @BigFunger @chrisronline
Given that all checks are green, 3 reviewers validated the PR, could you merge the PR ?

@BigFunger BigFunger merged commit 7f40ab7 into elastic:master Sep 14, 2017
BigFunger pushed a commit that referenced this pull request Sep 14, 2017
@BigFunger
Copy link
Contributor

BigFunger commented Sep 14, 2017

6.x/6.1: 5c93c1f
6.0: 7f85542 (revert: de4c1ba)

BigFunger pushed a commit that referenced this pull request Sep 14, 2017
@fbaligand
Copy link
Contributor Author

Houhou ! Great !
Thanks @BigFunger !

BigFunger added a commit that referenced this pull request Sep 14, 2017
@epixa
Copy link
Contributor

epixa commented Sep 15, 2017

Thanks a bunch for this contribution @fbaligand!

@fbaligand
Copy link
Contributor Author

@epixa happy to contribute !
With this PR, I now have contributed to Logstash, Elasticsearch and Kibana !

@epixa
Copy link
Contributor

epixa commented Sep 15, 2017

@fbaligand Nice!

@fbaligand
Copy link
Contributor Author

By the way, I have another kibana PR ready to push !
A really nice feature up to me !
Teasing... :)

fbaligand added a commit to fbaligand/kibana that referenced this pull request Sep 16, 2017
@fbaligand fbaligand deleted the open-link-in-current-tab branch September 16, 2017 07:54
chrisronline pushed a commit to chrisronline/kibana that referenced this pull request Nov 20, 2017
chrisronline pushed a commit to chrisronline/kibana that referenced this pull request Dec 1, 2017
fbaligand added a commit to fbaligand/kibana that referenced this pull request Dec 17, 2017
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.

8 participants