Commit a7eac516 authored by Enrique Alcántara's avatar Enrique Alcántara

Merge branch...

Merge branch '249791-replace-bstooltip-with-gltooltip-in-app-assets-javascripts-build_artifacts-js' into 'master'

Replace tooltip api calls with tooltips facade in build_artifacts.js

Closes #249791

See merge request gitlab-org/gitlab!44153
parents dd456683 08ee9910
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
import $ from 'jquery'; import $ from 'jquery';
import { visitUrl } from './lib/utils/url_utility'; import { visitUrl } from './lib/utils/url_utility';
import { parseBoolean } from './lib/utils/common_utils'; import { parseBoolean } from './lib/utils/common_utils';
import { hide, initTooltips, show } from '~/tooltips';
export default class BuildArtifacts { export default class BuildArtifacts {
constructor() { constructor() {
...@@ -10,6 +11,7 @@ export default class BuildArtifacts { ...@@ -10,6 +11,7 @@ export default class BuildArtifacts {
this.setupEntryClick(); this.setupEntryClick();
this.setupTooltips(); this.setupTooltips();
} }
// eslint-disable-next-line class-methods-use-this // eslint-disable-next-line class-methods-use-this
disablePropagation() { disablePropagation() {
$('.top-block').on('click', '.download', e => { $('.top-block').on('click', '.download', e => {
...@@ -19,15 +21,17 @@ export default class BuildArtifacts { ...@@ -19,15 +21,17 @@ export default class BuildArtifacts {
e.stopImmediatePropagation(); e.stopImmediatePropagation();
}); });
} }
// eslint-disable-next-line class-methods-use-this // eslint-disable-next-line class-methods-use-this
setupEntryClick() { setupEntryClick() {
return $('.tree-holder').on('click', 'tr[data-link]', function() { return $('.tree-holder').on('click', 'tr[data-link]', function() {
visitUrl(this.dataset.link, parseBoolean(this.dataset.externalLink)); visitUrl(this.dataset.link, parseBoolean(this.dataset.externalLink));
}); });
} }
// eslint-disable-next-line class-methods-use-this // eslint-disable-next-line class-methods-use-this
setupTooltips() { setupTooltips() {
$('.js-artifact-tree-tooltip').tooltip({ initTooltips({
placement: 'bottom', placement: 'bottom',
// Stop the tooltip from hiding when we stop hovering the element directly // Stop the tooltip from hiding when we stop hovering the element directly
// We handle all the showing/hiding below // We handle all the showing/hiding below
...@@ -38,14 +42,14 @@ export default class BuildArtifacts { ...@@ -38,14 +42,14 @@ export default class BuildArtifacts {
// But be placed below and in the middle of the file name // But be placed below and in the middle of the file name
$('.js-artifact-tree-row') $('.js-artifact-tree-row')
.on('mouseenter', e => { .on('mouseenter', e => {
$(e.currentTarget) const $el = $(e.currentTarget).find('.js-artifact-tree-tooltip');
.find('.js-artifact-tree-tooltip')
.tooltip('show'); show($el);
}) })
.on('mouseleave', e => { .on('mouseleave', e => {
$(e.currentTarget) const $el = $(e.currentTarget).find('.js-artifact-tree-tooltip');
.find('.js-artifact-tree-tooltip')
.tooltip('hide'); hide($el);
}); });
} }
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment