diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-10-21 07:08:36 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-10-21 07:08:36 +0000 |
commit | 48aff82709769b098321c738f3444b9bdaa694c6 (patch) | |
tree | e00c7c43e2d9b603a5a6af576b1685e400410dee /app/assets/javascripts/blob | |
parent | 879f5329ee916a948223f8f43d77fba4da6cd028 (diff) | |
download | gitlab-ce-48aff82709769b098321c738f3444b9bdaa694c6.tar.gz |
Add latest changes from gitlab-org/gitlab@13-5-stable-eev13.5.0-rc42
Diffstat (limited to 'app/assets/javascripts/blob')
7 files changed, 32 insertions, 114 deletions
diff --git a/app/assets/javascripts/blob/components/blob_edit_content.vue b/app/assets/javascripts/blob/components/blob_edit_content.vue index 6293f3bed1c..a013d637c1d 100644 --- a/app/assets/javascripts/blob/components/blob_edit_content.vue +++ b/app/assets/javascripts/blob/components/blob_edit_content.vue @@ -1,12 +1,9 @@ <script> import { debounce } from 'lodash'; import { initEditorLite } from '~/blob/utils'; -import { - SNIPPET_MARK_BLOBS_CONTENT, - SNIPPET_MARK_EDIT_APP_START, - SNIPPET_MEASURE_BLOBS_CONTENT, - SNIPPET_MEASURE_BLOBS_CONTENT_WITHIN_APP, -} from '~/performance_constants'; +import { SNIPPET_MEASURE_BLOBS_CONTENT } from '~/performance_constants'; + +import eventHub from './eventhub'; export default { props: { @@ -48,13 +45,7 @@ export default { this.editor.onDidChangeModelContent(debounce(this.onFileChange.bind(this), 250)); - window.requestAnimationFrame(() => { - if (!performance.getEntriesByName(SNIPPET_MARK_BLOBS_CONTENT).length) { - performance.mark(SNIPPET_MARK_BLOBS_CONTENT); - performance.measure(SNIPPET_MEASURE_BLOBS_CONTENT); - performance.measure(SNIPPET_MEASURE_BLOBS_CONTENT_WITHIN_APP, SNIPPET_MARK_EDIT_APP_START); - } - }); + eventHub.$emit(SNIPPET_MEASURE_BLOBS_CONTENT); }, beforeDestroy() { this.editor.dispose(); diff --git a/app/assets/javascripts/blob/components/blob_header_filepath.vue b/app/assets/javascripts/blob/components/blob_header_filepath.vue index 601b694db87..f99ecba2324 100644 --- a/app/assets/javascripts/blob/components/blob_header_filepath.vue +++ b/app/assets/javascripts/blob/components/blob_header_filepath.vue @@ -43,6 +43,7 @@ export default { :text="blob.path" :gfm="gfmCopyText" :title="__('Copy file path')" + category="tertiary" css-class="btn-clipboard btn-transparent lh-100 position-static" /> </div> diff --git a/app/assets/javascripts/blob/components/eventhub.js b/app/assets/javascripts/blob/components/eventhub.js new file mode 100644 index 00000000000..e31806ad199 --- /dev/null +++ b/app/assets/javascripts/blob/components/eventhub.js @@ -0,0 +1,3 @@ +import createEventHub from '~/helpers/event_hub_factory'; + +export default createEventHub(); diff --git a/app/assets/javascripts/blob/pipeline_tour_success_modal.vue b/app/assets/javascripts/blob/pipeline_tour_success_modal.vue index 411241b72d5..1412e49836d 100644 --- a/app/assets/javascripts/blob/pipeline_tour_success_modal.vue +++ b/app/assets/javascripts/blob/pipeline_tour_success_modal.vue @@ -1,8 +1,7 @@ <script> import { GlModal, GlSprintf, GlLink, GlButton } from '@gitlab/ui'; import Cookies from 'js-cookie'; -import { sprintf, s__, __ } from '~/locale'; -import { glEmojiTag } from '~/emoji'; +import { s__ } from '~/locale'; import Tracking from '~/tracking'; const trackingMixin = Tracking.mixin(); @@ -12,21 +11,6 @@ export default { 'https://about.gitlab.com/blog/2018/01/22/a-beginners-guide-to-continuous-integration/', exampleLink: 'https://docs.gitlab.com/ee/ci/examples/', codeQualityLink: 'https://docs.gitlab.com/ee/user/project/merge_requests/code_quality.html', - bodyMessage: s__( - `MR widget|The pipeline will test your code on every commit. A %{codeQualityLinkStart}code quality report%{codeQualityLinkEnd} will appear in your merge requests to warn you about potential code degradations.`, - ), - helpMessage: s__( - `MR widget|Take a look at our %{beginnerLinkStart}Beginner's Guide to Continuous Integration%{beginnerLinkEnd} and our %{exampleLinkStart}examples of GitLab CI/CD%{exampleLinkEnd} to learn more.`, - ), - pipelinesButton: s__('MR widget|See your pipeline in action'), - mergeRequestButton: s__('MR widget|Back to the Merge request'), - modalTitle: sprintf( - __("That's it, well done!%{celebrate}"), - { - celebrate: glEmojiTag('tada'), - }, - false, - ), goToTrackValuePipelines: 10, goToTrackValueMergeRequest: 20, trackEvent: 'click_button', @@ -78,6 +62,17 @@ export default { return ''; }, }, + i18n: { + modalTitle: s__("That's it, well done!"), + pipelinesButton: s__('MR widget|See your pipeline in action'), + mergeRequestButton: s__('MR widget|Back to the Merge request'), + bodyMessage: s__( + `MR widget|The pipeline will test your code on every commit. A %{codeQualityLinkStart}code quality report%{codeQualityLinkEnd} will appear in your merge requests to warn you about potential code degradations.`, + ), + helpMessage: s__( + `MR widget|Take a look at our %{beginnerLinkStart}Beginner's Guide to Continuous Integration%{beginnerLinkEnd} and our %{exampleLinkStart}examples of GitLab CI/CD%{exampleLinkEnd} to learn more.`, + ), + }, mounted() { this.track(); this.disableModalFromRenderingAgain(); @@ -90,14 +85,13 @@ export default { }; </script> <template> - <gl-modal - visible - size="sm" - :title="$options.modalTitle" - modal-id="success-pipeline-modal-id-not-used" - > + <gl-modal visible size="sm" modal-id="success-pipeline-modal-id-not-used"> + <template #modal-title> + {{ $options.i18n.modalTitle }} + <gl-emoji class="gl-vertical-align-baseline font-size-inherit gl-mr-1" data-name="tada" /> + </template> <p> - <gl-sprintf :message="$options.bodyMessage"> + <gl-sprintf :message="$options.i18n.bodyMessage"> <template #codeQualityLink="{content}"> <gl-link :href="$options.codeQualityLink" target="_blank" class="font-size-inherit">{{ content @@ -105,7 +99,7 @@ export default { </template> </gl-sprintf> </p> - <gl-sprintf :message="$options.helpMessage"> + <gl-sprintf :message="$options.i18n.helpMessage"> <template #beginnerLink="{content}"> <gl-link :href="$options.beginnerLink" target="_blank"> {{ content }} @@ -127,7 +121,7 @@ export default { :data-track-event="$options.trackEvent" :data-track-label="trackLabel" > - {{ $options.mergeRequestButton }} + {{ $options.i18n.mergeRequestButton }} </gl-button> <gl-button ref="goToPipelines" @@ -138,7 +132,7 @@ export default { :data-track-event="$options.trackEvent" :data-track-label="trackLabel" > - {{ $options.pipelinesButton }} + {{ $options.i18n.pipelinesButton }} </gl-button> </template> </gl-modal> diff --git a/app/assets/javascripts/blob/suggest_web_ide_ci/components/web_ide_alert.vue b/app/assets/javascripts/blob/suggest_web_ide_ci/components/web_ide_alert.vue deleted file mode 100644 index 1308ca53e74..00000000000 --- a/app/assets/javascripts/blob/suggest_web_ide_ci/components/web_ide_alert.vue +++ /dev/null @@ -1,50 +0,0 @@ -<script> -import { GlAlert, GlButton } from '@gitlab/ui'; -import axios from '~/lib/utils/axios_utils'; - -export default { - components: { - GlAlert, - GlButton, - }, - props: { - dismissEndpoint: { - type: String, - required: true, - }, - featureId: { - type: String, - required: true, - }, - editPath: { - type: String, - required: true, - }, - }, - data() { - return { - showAlert: true, - }; - }, - methods: { - dismissAlert() { - this.showAlert = false; - - return axios.post(this.dismissEndpoint, { - feature_name: this.featureId, - }); - }, - }, -}; -</script> - -<template> - <gl-alert v-if="showAlert" class="gl-mt-5" @dismiss="dismissAlert"> - {{ __('The Web IDE offers advanced syntax highlighting capabilities and more.') }} - <div class="gl-mt-5"> - <gl-button :href="editPath" category="primary" variant="info">{{ - __('Open Web IDE') - }}</gl-button> - </div> - </gl-alert> -</template> diff --git a/app/assets/javascripts/blob/suggest_web_ide_ci/index.js b/app/assets/javascripts/blob/suggest_web_ide_ci/index.js deleted file mode 100644 index eadf3cd6216..00000000000 --- a/app/assets/javascripts/blob/suggest_web_ide_ci/index.js +++ /dev/null @@ -1,20 +0,0 @@ -import Vue from 'vue'; -import WebIdeAlert from './components/web_ide_alert.vue'; - -export default el => { - const { dismissEndpoint, featureId, editPath } = el.dataset; - - // eslint-disable-next-line no-new - new Vue({ - el, - render(createElement) { - return createElement(WebIdeAlert, { - props: { - dismissEndpoint, - featureId, - editPath, - }, - }); - }, - }); -}; diff --git a/app/assets/javascripts/blob/viewer/index.js b/app/assets/javascripts/blob/viewer/index.js index 05ee8e49eb1..aa76364c466 100644 --- a/app/assets/javascripts/blob/viewer/index.js +++ b/app/assets/javascripts/blob/viewer/index.js @@ -5,6 +5,7 @@ import { handleLocationHash } from '../../lib/utils/common_utils'; import axios from '../../lib/utils/axios_utils'; import eventHub from '../../notes/event_hub'; import { __ } from '~/locale'; +import { fixTitle } from '~/tooltips'; const loadRichBlobViewer = type => { switch (type) { @@ -124,7 +125,7 @@ export default class BlobViewer { this.copySourceBtn.classList.add('disabled'); } - $(this.copySourceBtn).tooltip('_fixTitle'); + fixTitle($(this.copySourceBtn)); } switchToViewer(name) { @@ -179,9 +180,7 @@ export default class BlobViewer { viewer.innerHTML = data.html; viewer.setAttribute('data-loaded', 'true'); - if (window.gon?.features?.codeNavigation) { - eventHub.$emit('showBlobInteractionZones', viewer.dataset.path); - } + eventHub.$emit('showBlobInteractionZones', viewer.dataset.path); return viewer; }); |