diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-11-26 06:11:11 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-11-26 06:11:11 +0300 |
commit | 7de2fb40ba7d04779a8a2757faa3cf54fdc8f7c1 (patch) | |
tree | a09745a1b22a6b588551b0478998737a1565a533 /app | |
parent | 118b785094556d1bc1a9ead43b41edfaec5dc8ff (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app')
-rw-r--r-- | app/assets/javascripts/repository/components/code_owners.vue | 127 | ||||
-rw-r--r-- | app/assets/javascripts/repository/components/last_commit.vue | 2 | ||||
-rw-r--r-- | app/assets/javascripts/repository/index.js | 17 | ||||
-rw-r--r-- | app/assets/javascripts/repository/queries/code_owners_info.query.graphql | 15 | ||||
-rw-r--r-- | app/graphql/types/repository/blob_type.rb | 4 | ||||
-rw-r--r-- | app/presenters/blob_presenter.rb | 4 | ||||
-rw-r--r-- | app/views/projects/_files.html.haml | 5 |
7 files changed, 3 insertions, 171 deletions
diff --git a/app/assets/javascripts/repository/components/code_owners.vue b/app/assets/javascripts/repository/components/code_owners.vue deleted file mode 100644 index 52f75c476a8..00000000000 --- a/app/assets/javascripts/repository/components/code_owners.vue +++ /dev/null @@ -1,127 +0,0 @@ -<script> -import { GlIcon, GlLink } from '@gitlab/ui'; -import { __ } from '~/locale'; -import createFlash from '~/flash'; -import { helpPagePath } from '~/helpers/help_page_helper'; -import codeOwnersInfoQuery from '../queries/code_owners_info.query.graphql'; -import getRefMixin from '../mixins/get_ref'; - -export default { - i18n: { - title: __('Code owners'), - about: __('About this feature'), - andSeparator: __('and'), - errorMessage: __('An error occurred while loading code owners.'), - }, - codeOwnersHelpPath: helpPagePath('user/project/code_owners'), - components: { - GlIcon, - GlLink, - }, - mixins: [getRefMixin], - apollo: { - project: { - query: codeOwnersInfoQuery, - variables() { - return { - projectPath: this.projectPath, - filePath: this.filePath, - ref: this.ref, - }; - }, - skip() { - return !this.filePath; - }, - result() { - this.isFetching = false; - }, - error() { - createFlash({ message: this.$options.i18n.errorMessage }); - }, - }, - }, - props: { - projectPath: { - type: String, - required: true, - }, - filePath: { - type: String, - required: false, - default: null, - }, - }, - data() { - return { - isFetching: false, - project: { - repository: { - blobs: { - nodes: [ - { - codeOwners: [], - }, - ], - }, - }, - }, - }; - }, - computed: { - blobInfo() { - return this.project?.repository?.blobs?.nodes[0]; - }, - codeOwners() { - return this.blobInfo?.codeOwners || []; - }, - hasCodeOwners() { - return this.filePath && Boolean(this.codeOwners.length); - }, - commaSeparateList() { - return this.codeOwners.length > 2; - }, - showAndSeparator() { - return this.codeOwners.length > 1; - }, - lastListItem() { - return this.codeOwners.length - 1; - }, - }, - watch: { - filePath() { - this.isFetching = true; - this.$apollo.queries.project.refetch(); - }, - }, -}; -</script> - -<template> - <div - v-if="hasCodeOwners && !isFetching" - class="well-segment blob-auxiliary-viewer file-owner-content qa-file-owner-content" - > - <gl-icon name="users" data-testid="users-icon" /> - <strong>{{ $options.i18n.title }}</strong> - <gl-link :href="$options.codeOwnersHelpPath" target="_blank" :title="$options.i18n.about"> - <gl-icon name="question-o" data-testid="help-icon" /> - </gl-link> - : - <div - v-for="(owner, index) in codeOwners" - :key="index" - :class="[ - { 'gl-display-inline-block': commaSeparateList, 'gl-display-inline': !commaSeparateList }, - ]" - data-testid="code-owners" - > - <span v-if="commaSeparateList && index > 0" data-testid="comma-separator">,</span> - <span v-if="showAndSeparator && index === lastListItem" data-testid="and-separator">{{ - $options.i18n.andSeparator - }}</span> - <gl-link :href="owner.webPath" target="_blank" :title="$options.i18n.about"> - {{ owner.name }} - </gl-link> - </div> - </div> -</template> diff --git a/app/assets/javascripts/repository/components/last_commit.vue b/app/assets/javascripts/repository/components/last_commit.vue index 43e114a91d3..62066973ee6 100644 --- a/app/assets/javascripts/repository/components/last_commit.vue +++ b/app/assets/javascripts/repository/components/last_commit.vue @@ -111,7 +111,7 @@ export default { </script> <template> - <div class="well-segment commit gl-p-5 gl-w-full"> + <div class="info-well d-none d-sm-flex project-last-commit commit p-3"> <gl-loading-icon v-if="isLoading" size="md" color="dark" class="m-auto" /> <template v-else-if="commit"> <user-avatar-link diff --git a/app/assets/javascripts/repository/index.js b/app/assets/javascripts/repository/index.js index fc671f35691..45e026ad695 100644 --- a/app/assets/javascripts/repository/index.js +++ b/app/assets/javascripts/repository/index.js @@ -9,7 +9,6 @@ import App from './components/app.vue'; import Breadcrumbs from './components/breadcrumbs.vue'; import DirectoryDownloadLinks from './components/directory_download_links.vue'; import LastCommit from './components/last_commit.vue'; -import CodeOwners from './components/code_owners.vue'; import apolloProvider from './graphql'; import commitsQuery from './queries/commits.query.graphql'; import projectPathQuery from './queries/project_path.query.graphql'; @@ -72,23 +71,7 @@ export default function setupVueRepositoryList() { }, }); - const initCodeOwnersApp = () => - new Vue({ - el: document.getElementById('js-code-owners'), - router, - apolloProvider, - render(h) { - return h(CodeOwners, { - props: { - filePath: this.$route.params.path, - projectPath, - }, - }); - }, - }); - initLastCommitApp(); - initCodeOwnersApp(); router.afterEach(({ params: { path } }) => { setTitle(path, ref, fullName); diff --git a/app/assets/javascripts/repository/queries/code_owners_info.query.graphql b/app/assets/javascripts/repository/queries/code_owners_info.query.graphql deleted file mode 100644 index 29c6265bbbd..00000000000 --- a/app/assets/javascripts/repository/queries/code_owners_info.query.graphql +++ /dev/null @@ -1,15 +0,0 @@ -query getCodeOwnersInfo($projectPath: ID!, $filePath: String!, $ref: String!) { - project(fullPath: $projectPath) { - id - repository { - blobs(paths: [$filePath], ref: $ref) { - nodes { - codeOwners { - name - webPath - } - } - } - } - } -} diff --git a/app/graphql/types/repository/blob_type.rb b/app/graphql/types/repository/blob_type.rb index 0182a372df3..104171e6772 100644 --- a/app/graphql/types/repository/blob_type.rb +++ b/app/graphql/types/repository/blob_type.rb @@ -71,10 +71,6 @@ module Types field :pipeline_editor_path, GraphQL::Types::String, null: true, description: 'Web path to edit .gitlab-ci.yml file.' - field :code_owners, [Types::UserType], null: true, - description: 'List of code owners for the blob.', - calls_gitaly: true - field :file_type, GraphQL::Types::String, null: true, description: 'Expected format of the blob based on the extension.' diff --git a/app/presenters/blob_presenter.rb b/app/presenters/blob_presenter.rb index 5466e8e0b05..5835a77d0b9 100644 --- a/app/presenters/blob_presenter.rb +++ b/app/presenters/blob_presenter.rb @@ -66,10 +66,6 @@ class BlobPresenter < Gitlab::View::Presenter::Delegated project_ci_pipeline_editor_path(project, branch_name: blob.commit_id) if can_collaborate_with_project?(project) && blob.path == project.ci_config_path_or_default end - def code_owners - Gitlab::CodeOwners.for_blob(project, blob) - end - def fork_and_edit_path fork_path_for_current_user(project, edit_blob_path) end diff --git a/app/views/projects/_files.html.haml b/app/views/projects/_files.html.haml index 2f4a61865f8..cdcc98552f9 100644 --- a/app/views/projects/_files.html.haml +++ b/app/views/projects/_files.html.haml @@ -10,11 +10,10 @@ .nav-block.gl-display-flex.gl-xs-flex-direction-column.gl-align-items-stretch = render 'projects/tree/tree_header', tree: @tree - .info-well.gl-display-none.gl-sm-display-flex.project-last-commit.gl-flex-direction-column - #js-last-commit.gl-m-auto + #js-last-commit + .info-well.gl-display-none.gl-sm-display-flex.project-last-commit .gl-spinner-container.m-auto = loading_icon(size: 'md', color: 'dark', css_class: 'align-text-bottom') - #js-code-owners - if is_project_overview .project-buttons.gl-mb-3.js-show-on-project-root |