diff options
Diffstat (limited to 'app/assets/javascripts/repository/components')
7 files changed, 44 insertions, 16 deletions
diff --git a/app/assets/javascripts/repository/components/blob_content_viewer.vue b/app/assets/javascripts/repository/components/blob_content_viewer.vue index 902077ba3e4..bf1667d8734 100644 --- a/app/assets/javascripts/repository/components/blob_content_viewer.vue +++ b/app/assets/javascripts/repository/components/blob_content_viewer.vue @@ -4,7 +4,7 @@ import { uniqueId } from 'lodash'; import BlobContent from '~/blob/components/blob_content.vue'; import BlobHeader from '~/blob/components/blob_header.vue'; import { SIMPLE_BLOB_VIEWER, RICH_BLOB_VIEWER } from '~/blob/components/constants'; -import createFlash from '~/flash'; +import { createAlert } from '~/flash'; import axios from '~/lib/utils/axios_utils'; import { isLoggedIn, handleLocationHash } from '~/lib/utils/common_utils'; import { __ } from '~/locale'; @@ -271,7 +271,7 @@ export default { .catch(() => this.displayError()); }, displayError() { - createFlash({ message: __('An error occurred while loading the file. Please try again.') }); + createAlert({ message: __('An error occurred while loading the file. Please try again.') }); }, switchViewer(newViewer) { this.activeViewerType = newViewer || SIMPLE_BLOB_VIEWER; diff --git a/app/assets/javascripts/repository/components/blob_controls.vue b/app/assets/javascripts/repository/components/blob_controls.vue index fb1227f0df9..29c2c3762fc 100644 --- a/app/assets/javascripts/repository/components/blob_controls.vue +++ b/app/assets/javascripts/repository/components/blob_controls.vue @@ -1,9 +1,11 @@ <script> import { GlButton } from '@gitlab/ui'; import { __ } from '~/locale'; -import createFlash from '~/flash'; +import { createAlert } from '~/flash'; import getRefMixin from '~/repository/mixins/get_ref'; import initSourcegraph from '~/sourcegraph'; +import ShortcutsBlob from '~/behaviors/shortcuts/shortcuts_blob'; +import BlobLinePermalinkUpdater from '~/blob/blob_line_permalink_updater'; import { updateElementsVisibility } from '../utils/dom'; import blobControlsQuery from '../queries/blob_controls.query.graphql'; @@ -34,7 +36,7 @@ export default { return !this.filePath; }, error() { - createFlash({ message: this.$options.i18n.errorMessage }); + createAlert({ message: this.$options.i18n.errorMessage }); }, }, }, @@ -84,6 +86,33 @@ export default { }, blobInfo() { initSourcegraph(); + this.$nextTick(() => { + this.initShortcuts(); + this.initLinksUpdate(); + }); + }, + }, + methods: { + initShortcuts() { + const fileBlobPermalinkUrlElement = document.querySelector( + '.js-data-file-blob-permalink-url', + ); + const fileBlobPermalinkUrl = + fileBlobPermalinkUrlElement && fileBlobPermalinkUrlElement.getAttribute('href'); + // eslint-disable-next-line no-new + new ShortcutsBlob({ + skipResetBindings: true, + fileBlobPermalinkUrl, + fileBlobPermalinkUrlElement, + }); + }, + initLinksUpdate() { + // eslint-disable-next-line no-new + new BlobLinePermalinkUpdater( + document.querySelector('.tree-holder'), + '.file-line-num[data-line-number], .file-line-num[data-line-number] *', + document.querySelectorAll('.js-data-file-blob-permalink-url, .js-blob-blame-link'), + ); }, }, }; @@ -99,6 +128,7 @@ export default { data-testid="blame" :href="blobInfo.blamePath" :class="$options.buttonClassList" + class="js-blob-blame-link" > {{ $options.i18n.blame }} </gl-button> diff --git a/app/assets/javascripts/repository/components/last_commit.vue b/app/assets/javascripts/repository/components/last_commit.vue index 22fe3fe440e..05d64077866 100644 --- a/app/assets/javascripts/repository/components/last_commit.vue +++ b/app/assets/javascripts/repository/components/last_commit.vue @@ -122,14 +122,12 @@ export default { :link-href="commit.author.webPath" :img-src="commit.author.avatarUrl" :img-size="32" - :img-css-classes="'gl-mr-0!' /* NOTE: this is needed only while we migrate user-avatar-image to GlAvatar (7731 epics) */" class="gl-my-2 gl-mr-4" /> <user-avatar-image v-else class="gl-my-2 gl-mr-4" :img-src="commit.authorGravatar || $options.defaultAvatarUrl" - :css-classes="'gl-mr-0!' /* NOTE: this is needed only while we migrate user-avatar-image to GlAvatar (7731 epics) */" :size="32" /> <div @@ -171,7 +169,7 @@ export default { v-if="commitDescription" v-safe-html:[$options.safeHtmlConfig]="commitDescription" :class="{ 'd-block': showDescription }" - class="commit-row-description gl-mb-3" + class="commit-row-description gl-mb-3 gl-white-space-pre-line" ></pre> </div> <div class="gl-flex-grow-1"></div> diff --git a/app/assets/javascripts/repository/components/new_directory_modal.vue b/app/assets/javascripts/repository/components/new_directory_modal.vue index 6c5797bf5b2..b28ebe7bb1e 100644 --- a/app/assets/javascripts/repository/components/new_directory_modal.vue +++ b/app/assets/javascripts/repository/components/new_directory_modal.vue @@ -8,7 +8,7 @@ import { GlFormTextarea, GlToggle, } from '@gitlab/ui'; -import createFlash from '~/flash'; +import { createAlert } from '~/flash'; import axios from '~/lib/utils/axios_utils'; import { visitUrl } from '~/lib/utils/url_utility'; import { __ } from '~/locale'; @@ -140,7 +140,7 @@ export default { }) .catch(() => { this.loading = false; - createFlash({ message: ERROR_MESSAGE }); + createAlert({ message: ERROR_MESSAGE }); }); }, }, diff --git a/app/assets/javascripts/repository/components/table/row.vue b/app/assets/javascripts/repository/components/table/row.vue index c8cd64b5311..f3c5ace75fc 100644 --- a/app/assets/javascripts/repository/components/table/row.vue +++ b/app/assets/javascripts/repository/components/table/row.vue @@ -260,19 +260,19 @@ export default { class="ml-1" /> </td> - <td class="d-none d-sm-table-cell tree-commit cursor-default"> + <td class="d-none d-sm-table-cell tree-commit cursor-default gl-text-secondary"> <gl-link v-if="commitData" v-safe-html:[$options.safeHtmlConfig]="commitData.titleHtml" :href="commitData.commitPath" :title="commitData.message" - class="str-truncated-100 tree-commit-link" + class="str-truncated-100 tree-commit-link gl-text-secondary" /> <gl-intersection-observer @appear="rowAppeared" @disappear="rowDisappeared"> <gl-skeleton-loader v-if="showSkeletonLoader" :lines="1" /> </gl-intersection-observer> </td> - <td class="tree-time-ago text-right cursor-default"> + <td class="tree-time-ago text-right cursor-default gl-text-secondary"> <timeago-tooltip v-if="commitData" :time="commitData.committedDate" /> <gl-skeleton-loader v-if="showSkeletonLoader" :lines="1" /> </td> diff --git a/app/assets/javascripts/repository/components/tree_content.vue b/app/assets/javascripts/repository/components/tree_content.vue index 2200e999c75..8a45a351c35 100644 --- a/app/assets/javascripts/repository/components/tree_content.vue +++ b/app/assets/javascripts/repository/components/tree_content.vue @@ -1,6 +1,6 @@ <script> import paginatedTreeQuery from 'shared_queries/repository/paginated_tree.query.graphql'; -import createFlash from '~/flash'; +import { createAlert } from '~/flash'; import glFeatureFlagMixin from '~/vue_shared/mixins/gl_feature_flags_mixin'; import { __ } from '~/locale'; import { @@ -142,7 +142,7 @@ export default { } }) .catch((error) => { - createFlash({ + createAlert({ message: __('An error occurred while fetching folder content.'), }); throw error; diff --git a/app/assets/javascripts/repository/components/upload_blob_modal.vue b/app/assets/javascripts/repository/components/upload_blob_modal.vue index 7fcaf772aac..4603ea2710d 100644 --- a/app/assets/javascripts/repository/components/upload_blob_modal.vue +++ b/app/assets/javascripts/repository/components/upload_blob_modal.vue @@ -9,7 +9,7 @@ import { GlButton, GlAlert, } from '@gitlab/ui'; -import createFlash from '~/flash'; +import { createAlert } from '~/flash'; import axios from '~/lib/utils/axios_utils'; import { ContentTypeMultipartFormData } from '~/lib/utils/headers'; import { numberToHumanSize } from '~/lib/utils/number_utils'; @@ -171,7 +171,7 @@ export default { }) .catch(() => { this.loading = false; - createFlash({ message: ERROR_MESSAGE }); + createAlert({ message: ERROR_MESSAGE }); }); }, formData() { |