From 6cb575d612cd2470ee4224159fa16458f5426f73 Mon Sep 17 00:00:00 2001 From: Eric Eastwood Date: Tue, 6 Jun 2017 15:46:31 -0500 Subject: Add support for multiple tooltips in the same Vue component Fix https://gitlab.com/gitlab-org/gitlab-ce/issues/33223 --- .../components/environment_actions.vue | 11 ++-- .../components/environment_external_url.vue | 9 +++- .../components/environment_monitoring.vue | 9 +++- .../environments/components/environment_stop.vue | 8 ++- .../components/environment_terminal_button.vue | 8 ++- .../issue_show/components/fields/project_move.vue | 12 ++--- .../pipelines/components/async_button.vue | 11 ++-- .../components/graph/action_component.vue | 11 ++-- .../components/graph/dropdown_action_component.vue | 11 ++-- .../components/graph/dropdown_job_component.vue | 12 ++--- .../pipelines/components/graph/job_component.vue | 14 +++-- .../pipelines/components/pipeline_url.vue | 16 +++--- .../pipelines/components/pipelines_actions.vue | 10 ++-- .../pipelines/components/pipelines_artifacts.vue | 12 ++--- .../javascripts/pipelines/components/stage.vue | 10 ++-- .../javascripts/pipelines/components/time_ago.vue | 8 +-- .../vue_shared/components/header_ci_component.vue | 12 ++--- .../vue_shared/components/markdown/header.vue | 12 ++--- .../components/markdown/toolbar_button.vue | 10 ++-- .../vue_shared/components/time_ago_tooltip.vue | 12 +++-- .../components/user_avatar/user_avatar_image.vue | 8 +-- .../javascripts/vue_shared/directives/tooltip.js | 13 +++++ .../javascripts/vue_shared/mixins/tooltip.js | 13 ----- doc/development/fe_guide/style_guide_js.md | 12 +++-- .../environments/environment_actions_spec.js | 9 +++- .../environments/environment_monitoring_spec.js | 19 +++++-- .../environments/environment_stop_spec.js | 9 +++- .../environment_terminal_button_spec.js | 9 +++- .../vue_shared/components/time_ago_tooltip_spec.js | 1 - .../vue_shared/directives/tooltip_spec.js | 63 ++++++++++++++++++++++ 30 files changed, 251 insertions(+), 123 deletions(-) create mode 100644 app/assets/javascripts/vue_shared/directives/tooltip.js delete mode 100644 app/assets/javascripts/vue_shared/mixins/tooltip.js create mode 100644 spec/javascripts/vue_shared/directives/tooltip_spec.js diff --git a/app/assets/javascripts/environments/components/environment_actions.vue b/app/assets/javascripts/environments/components/environment_actions.vue index a2448520a5f..e7495677e7c 100644 --- a/app/assets/javascripts/environments/components/environment_actions.vue +++ b/app/assets/javascripts/environments/components/environment_actions.vue @@ -2,6 +2,7 @@ import playIconSvg from 'icons/_icon_play.svg'; import eventHub from '../event_hub'; import loadingIcon from '../../vue_shared/components/loading_icon.vue'; +import tooltip from '../../vue_shared/directives/tooltip'; export default { props: { @@ -12,6 +13,10 @@ export default { }, }, + directives: { + tooltip, + }, + components: { loadingIcon, }, @@ -33,8 +38,6 @@ export default { onClickAction(endpoint) { this.isLoading = true; - $(this.$refs.tooltip).tooltip('destroy'); - eventHub.$emit('postAction', endpoint); }, @@ -53,11 +56,11 @@ export default { class="btn-group" role="group">