Commit 50967e64 authored by Mayra Cabrera's avatar Mayra Cabrera

Merge branch 'ph/revertWebPath' into 'master'

Revert "Merge branch 'ph/225849/repositoryGraphQLWebPath' into 'master'"

See merge request gitlab-org/gitlab!36312
parents 0f68786a 9368ea07
......@@ -4,9 +4,9 @@ import { joinPaths, escapeFileUrl } from '~/lib/utils/url_utility';
import { __ } from '../../locale';
import Icon from '../../vue_shared/components/icon.vue';
import getRefMixin from '../mixins/get_ref';
import projectShortPathQuery from '../queries/project_short_path.query.graphql';
import projetPathQuery from '../queries/project_path.query.graphql';
import permissionsQuery from '../queries/permissions.query.graphql';
import getProjectShortPath from '../queries/getProjectShortPath.query.graphql';
import getProjectPath from '../queries/getProjectPath.query.graphql';
import getPermissions from '../queries/getPermissions.query.graphql';
const ROW_TYPES = {
header: 'header',
......@@ -23,13 +23,13 @@ export default {
},
apollo: {
projectShortPath: {
query: projectShortPathQuery,
query: getProjectShortPath,
},
projectPath: {
query: projetPathQuery,
query: getProjectPath,
},
userPermissions: {
query: permissionsQuery,
query: getPermissions,
variables() {
return {
projectPath: this.projectPath,
......
......@@ -8,8 +8,8 @@ import TimeagoTooltip from '../../vue_shared/components/time_ago_tooltip.vue';
import CiIcon from '../../vue_shared/components/ci_icon.vue';
import ClipboardButton from '../../vue_shared/components/clipboard_button.vue';
import getRefMixin from '../mixins/get_ref';
import projectPathQuery from '../queries/project_path.query.graphql';
import pathLastCommitQuery from '../queries/path_last_commit.query.graphql';
import getProjectPath from '../queries/getProjectPath.query.graphql';
import pathLastCommit from '../queries/pathLastCommit.query.graphql';
export default {
components: {
......@@ -28,10 +28,10 @@ export default {
mixins: [getRefMixin],
apollo: {
projectPath: {
query: projectPathQuery,
query: getProjectPath,
},
commit: {
query: pathLastCommitQuery,
query: pathLastCommit,
variables() {
return {
projectPath: this.projectPath,
......@@ -102,7 +102,7 @@ export default {
<template v-else-if="commit">
<user-avatar-link
v-if="commit.author"
:link-href="commit.author.webPath"
:link-href="commit.author.webUrl"
:img-src="commit.author.avatarUrl"
:img-size="40"
class="avatar-cell"
......@@ -118,7 +118,7 @@ export default {
<div class="commit-detail flex-list">
<div class="commit-content qa-commit-content">
<gl-link
:href="commit.webPath"
:href="commit.webUrl"
:class="{ 'font-italic': !commit.message }"
class="commit-row-message item-title"
v-html="commit.titleHtml"
......@@ -135,7 +135,7 @@ export default {
<div class="committer">
<gl-link
v-if="commit.author"
:href="commit.author.webPath"
:href="commit.author.webUrl"
class="commit-author-link js-user-link"
>
{{ commit.author.name }}
......
......@@ -3,15 +3,15 @@ import $ from 'jquery';
import '~/behaviors/markdown/render_gfm';
import { GlLink, GlLoadingIcon } from '@gitlab/ui';
import { handleLocationHash } from '~/lib/utils/common_utils';
import readmeQery from '../../queries/readme.query.graphql';
import getReadmeQuery from '../../queries/getReadme.query.graphql';
export default {
apollo: {
readme: {
query: readmeQery,
query: getReadmeQuery,
variables() {
return {
url: this.blob.webPath,
url: this.blob.webUrl,
};
},
loadingKey: 'loading',
......@@ -51,7 +51,7 @@ export default {
<div class="js-file-title file-title-flex-parent">
<div class="file-header-content">
<i aria-hidden="true" class="fa fa-file-text-o fa-fw"></i>
<gl-link :href="blob.webPath">
<gl-link :href="blob.webUrl">
<strong>{{ blob.name }}</strong>
</gl-link>
</div>
......
......@@ -2,7 +2,7 @@
import { GlSkeletonLoading } from '@gitlab/ui';
import { sprintf, __ } from '../../../locale';
import getRefMixin from '../../mixins/get_ref';
import projectPathQuery from '../../queries/project_path.query.graphql';
import getProjectPath from '../../queries/getProjectPath.query.graphql';
import TableHeader from './header.vue';
import TableRow from './row.vue';
import ParentRow from './parent_row.vue';
......@@ -17,7 +17,7 @@ export default {
mixins: [getRefMixin],
apollo: {
projectPath: {
query: projectPathQuery,
query: getProjectPath,
},
},
props: {
......@@ -96,7 +96,7 @@ export default {
:name="entry.name"
:path="entry.flatPath"
:type="entry.type"
:url="entry.webUrl || entry.webPath"
:url="entry.webUrl"
:submodule-tree-url="entry.treeUrl"
:lfs-oid="entry.lfsOid"
:loading-path="loadingPath"
......
......@@ -12,7 +12,7 @@ import { escapeFileUrl } from '~/lib/utils/url_utility';
import TimeagoTooltip from '~/vue_shared/components/time_ago_tooltip.vue';
import FileIcon from '~/vue_shared/components/file_icon.vue';
import getRefMixin from '../../mixins/get_ref';
import commitQuery from '../../queries/commit.query.graphql';
import getCommit from '../../queries/getCommit.query.graphql';
export default {
components: {
......@@ -29,7 +29,7 @@ export default {
},
apollo: {
commit: {
query: commitQuery,
query: getCommit,
variables() {
return {
fileName: this.name,
......
......@@ -3,8 +3,8 @@ import createFlash from '~/flash';
import { __ } from '../../locale';
import FileTable from './table/index.vue';
import getRefMixin from '../mixins/get_ref';
import filesQuery from '../queries/files.query.graphql';
import projectPathQuery from '../queries/project_path.query.graphql';
import getFiles from '../queries/getFiles.query.graphql';
import getProjectPath from '../queries/getProjectPath.query.graphql';
import FilePreview from './preview/index.vue';
import { readmeFile } from '../utils/readme';
......@@ -18,7 +18,7 @@ export default {
mixins: [getRefMixin],
apollo: {
projectPath: {
query: projectPathQuery,
query: getProjectPath,
},
},
props: {
......@@ -70,7 +70,7 @@ export default {
return this.$apollo
.query({
query: filesQuery,
query: getFiles,
variables: {
projectPath: this.projectPath,
ref: this.ref,
......
import { normalizeData } from 'ee_else_ce/repository/utils/commit';
import axios from '~/lib/utils/axios_utils';
import commitsQuery from './queries/commits.query.graphql';
import projectPathQuery from './queries/project_path.query.graphql';
import refQuery from './queries/ref.query.graphql';
import getCommits from './queries/getCommits.query.graphql';
import getProjectPath from './queries/getProjectPath.query.graphql';
import getRef from './queries/getRef.query.graphql';
let fetchpromise;
let resolvers = [];
......@@ -22,8 +22,8 @@ export function fetchLogsTree(client, path, offset, resolver = null) {
if (fetchpromise) return fetchpromise;
const { projectPath } = client.readQuery({ query: projectPathQuery });
const { escapedRef } = client.readQuery({ query: refQuery });
const { projectPath } = client.readQuery({ query: getProjectPath });
const { escapedRef } = client.readQuery({ query: getRef });
fetchpromise = axios
.get(
......@@ -36,10 +36,10 @@ export function fetchLogsTree(client, path, offset, resolver = null) {
)
.then(({ data, headers }) => {
const headerLogsOffset = headers['more-logs-offset'];
const { commits } = client.readQuery({ query: commitsQuery });
const { commits } = client.readQuery({ query: getCommits });
const newCommitData = [...commits, ...normalizeData(data, path)];
client.writeQuery({
query: commitsQuery,
query: getCommits,
data: { commits: newCommitData },
});
......
import refQuery from '../queries/ref.query.graphql';
import getRef from '../queries/getRef.query.graphql';
export default {
apollo: {
ref: {
query: refQuery,
query: getRef,
manual: true,
result({ data, loading }) {
if (!loading) {
......
import filesQuery from '../queries/files.query.graphql';
import getFiles from '../queries/getFiles.query.graphql';
import getRefMixin from './get_ref';
import projectPathQuery from '../queries/project_path.query.graphql';
import getProjectPath from '../queries/getProjectPath.query.graphql';
export default {
mixins: [getRefMixin],
apollo: {
projectPath: {
query: projectPathQuery,
query: getProjectPath,
},
},
data() {
......@@ -21,7 +21,7 @@ export default {
return this.$apollo
.query({
query: filesQuery,
query: getFiles,
variables: {
projectPath: this.projectPath,
ref: this.ref,
......
#import "ee_else_ce/repository/queries/commit.fragment.graphql"
query Commit($fileName: String!, $type: String!, $path: String!) {
query getCommit($fileName: String!, $type: String!, $path: String!) {
commit(path: $path, fileName: $fileName, type: $type) @client {
...TreeEntryCommit
}
......
#import "ee_else_ce/repository/queries/commit.fragment.graphql"
query Commits {
query getCommits {
commits @client {
...TreeEntryCommit
}
......
......@@ -8,7 +8,7 @@ fragment TreeEntry on Entry {
type
}
query Files(
query getFiles(
$projectPath: ID!
$path: String
$ref: String!
......@@ -22,7 +22,7 @@ query Files(
edges {
node {
...TreeEntry
webPath
webUrl
}
}
pageInfo {
......@@ -45,7 +45,7 @@ query Files(
edges {
node {
...TreeEntry
webPath
webUrl
lfsOid
}
}
......
query Permissions($projectPath: ID!) {
query getPermissions($projectPath: ID!) {
project(fullPath: $projectPath) {
userPermissions {
pushCode
......
query Readme($url: String!) {
query getReadme($url: String!) {
readme(url: $url) @client {
html
}
......
query PathLastCommit($projectPath: ID!, $path: String, $ref: String!) {
query pathLastCommit($projectPath: ID!, $path: String, $ref: String!) {
project(fullPath: $projectPath) {
repository {
tree(path: $path, ref: $ref) {
......@@ -8,14 +8,14 @@ query PathLastCommit($projectPath: ID!, $path: String, $ref: String!) {
titleHtml
description
message
webPath
webUrl
authoredDate
authorName
authorGravatar
author {
name
avatarUrl
webPath
webUrl
}
signatureHtml
pipelines(ref: $ref, first: 1) {
......
......@@ -23,8 +23,6 @@ module Types
description: 'Timestamp of when the commit was authored'
field :web_url, type: GraphQL::STRING_TYPE, null: false,
description: 'Web URL of the commit'
field :web_path, type: GraphQL::STRING_TYPE, null: false,
description: 'Web path of the commit'
field :signature_html, type: GraphQL::STRING_TYPE, null: true, calls_gitaly: true,
description: 'Rendered HTML of the commit signature'
field :author_name, type: GraphQL::STRING_TYPE, null: true,
......
......@@ -12,8 +12,6 @@ module Types
field :web_url, GraphQL::STRING_TYPE, null: true,
description: 'Web URL of the blob'
field :web_path, GraphQL::STRING_TYPE, null: true,
description: 'Web path of the blob'
field :lfs_oid, GraphQL::STRING_TYPE, null: true,
description: 'LFS ID of the blob',
resolve: -> (blob, args, ctx) do
......
......@@ -13,8 +13,6 @@ module Types
field :web_url, GraphQL::STRING_TYPE, null: true,
description: 'Web URL for the tree entry (directory)'
field :web_path, GraphQL::STRING_TYPE, null: true,
description: 'Web path for the tree entry (directory)'
end
# rubocop: enable Graphql/AuthorizeTypes
end
......
......@@ -22,8 +22,6 @@ module Types
description: "URL of the user's avatar"
field :web_url, GraphQL::STRING_TYPE, null: false,
description: 'Web URL of the user'
field :web_path, GraphQL::STRING_TYPE, null: false,
description: 'Web path of the user'
field :todos, Types::TodoType.connection_type, null: false,
resolver: Resolvers::TodoResolver,
description: 'Todos of the user'
......
......@@ -18,10 +18,6 @@ class BlobPresenter < Gitlab::View::Presenter::Delegated
Gitlab::Routing.url_helpers.project_blob_url(blob.repository.project, File.join(blob.commit_id, blob.path))
end
def web_path
Gitlab::Routing.url_helpers.project_blob_path(blob.repository.project, File.join(blob.commit_id, blob.path))
end
private
def load_all_blob_data
......
......@@ -21,10 +21,6 @@ class CommitPresenter < Gitlab::View::Presenter::Delegated
url_builder.build(commit)
end
def web_path
url_builder.build(commit, only_path: true)
end
def signature_html
return unless commit.has_signature?
......
......@@ -6,8 +6,4 @@ class TreeEntryPresenter < Gitlab::View::Presenter::Delegated
def web_url
Gitlab::Routing.url_helpers.project_tree_url(tree.repository.project, File.join(tree.commit_id, tree.path))
end
def web_path
Gitlab::Routing.url_helpers.project_tree_path(tree.repository.project, File.join(tree.commit_id, tree.path))
end
end
......@@ -6,8 +6,4 @@ class UserPresenter < Gitlab::View::Presenter::Delegated
def web_url
Gitlab::Routing.url_helpers.user_url(user)
end
def web_path
Gitlab::Routing.url_helpers.user_path(user)
end
end
......@@ -813,11 +813,6 @@ type Blob implements Entry {
"""
type: EntryType!
"""
Web path of the blob
"""
webPath: String
"""
Web URL of the blob
"""
......@@ -1221,11 +1216,6 @@ type Commit {
"""
titleHtml: String
"""
Web path of the commit
"""
webPath: String!
"""
Web URL of the commit
"""
......@@ -13387,11 +13377,6 @@ type TreeEntry implements Entry {
"""
type: EntryType!
"""
Web path for the tree entry (directory)
"""
webPath: String
"""
Web URL for the tree entry (directory)
"""
......@@ -14293,11 +14278,6 @@ type User {
"""
username: String!
"""
Web path of the user
"""
webPath: String!
"""
Web URL of the user
"""
......
......@@ -2128,20 +2128,6 @@
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "webPath",
"description": "Web path of the blob",
"args": [
],
"type": {
"kind": "SCALAR",
"name": "String",
"ofType": null
},
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "webUrl",
"description": "Web URL of the blob",
......@@ -3304,24 +3290,6 @@
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "webPath",
"description": "Web path of the commit",
"args": [
],
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "SCALAR",
"name": "String",
"ofType": null
}
},
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "webUrl",
"description": "Web URL of the commit",
......@@ -39550,20 +39518,6 @@
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "webPath",
"description": "Web path for the tree entry (directory)",
"args": [
],
"type": {
"kind": "SCALAR",
"name": "String",
"ofType": null
},
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "webUrl",
"description": "Web URL for the tree entry (directory)",
......@@ -41981,24 +41935,6 @@
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "webPath",
"description": "Web path of the user",
"args": [
],
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "SCALAR",
"name": "String",
"ofType": null
}
},
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "webUrl",
"description": "Web URL of the user",
......@@ -164,7 +164,6 @@ Autogenerated return type of AwardEmojiToggle
| `path` | String! | Path of the entry |
| `sha` | String! | Last commit sha for the entry |
| `type` | EntryType! | Type of tree entry |
| `webPath` | String | Web path of the blob |
| `webUrl` | String | Web URL of the blob |
## Board
......@@ -228,7 +227,6 @@ Autogenerated return type of BoardListUpdateLimitMetrics
| `signatureHtml` | String | Rendered HTML of the commit signature |
| `title` | String | Title of the commit message |
| `titleHtml` | String | The GitLab Flavored Markdown rendering of `title` |
| `webPath` | String! | Web path of the commit |
| `webUrl` | String! | Web URL of the commit |
## CommitCreatePayload
......@@ -2021,7 +2019,6 @@ Represents a directory
| `path` | String! | Path of the entry |
| `sha` | String! | Last commit sha for the entry |
| `type` | EntryType! | Type of tree entry |
| `webPath` | String | Web path for the tree entry (directory) |
| `webUrl` | String | Web URL for the tree entry (directory) |
## UpdateAlertStatusPayload
......@@ -2125,7 +2122,6 @@ Autogenerated return type of UpdateSnippet
| `state` | UserState! | State of the user |
| `userPermissions` | UserPermissions! | Permissions for the current user on the resource |
| `username` | String! | Username of the user. Unique within this instance of GitLab |
| `webPath` | String! | Web path of the user |
| `webUrl` | String! | Web URL of the user |
## UserPermissions
......
......@@ -10,7 +10,7 @@ exports[`Repository last commit component renders commit widget 1`] = `
imgcssclasses=""
imgsize="40"
imgsrc="https://test.com"
linkhref="/test"
linkhref="https://test.com/test"
tooltipplacement="top"
tooltiptext=""
username=""
......@@ -24,7 +24,7 @@ exports[`Repository last commit component renders commit widget 1`] = `
>
<gl-link-stub
class="commit-row-message item-title"
href="/commit/123"
href="https://test.com/commit/123"
>
Commit title
</gl-link-stub>
......@@ -36,7 +36,7 @@ exports[`Repository last commit component renders commit widget 1`] = `
>
<gl-link-stub
class="commit-author-link js-user-link"
href="/test"
href="https://test.com/test"
>
Test
......@@ -110,7 +110,7 @@ exports[`Repository last commit component renders the signature HTML as returned
imgcssclasses=""
imgsize="40"
imgsrc="https://test.com"
linkhref="/test"
linkhref="https://test.com/test"
tooltipplacement="top"
tooltiptext=""
username=""
......@@ -124,7 +124,7 @@ exports[`Repository last commit component renders the signature HTML as returned
>
<gl-link-stub
class="commit-row-message item-title"
href="/commit/123"
href="https://test.com/commit/123"
>
Commit title
</gl-link-stub>
......@@ -136,7 +136,7 @@ exports[`Repository last commit component renders the signature HTML as returned
>
<gl-link-stub
class="commit-author-link js-user-link"
href="/test"
href="https://test.com/test"
>
Test
......
......@@ -12,13 +12,11 @@ function createCommitData(data = {}) {
titleHtml: 'Commit title',
message: 'Commit message',
webUrl: 'https://test.com/commit/123',
webPath: '/commit/123',
authoredDate: '2019-01-01',
author: {
name: 'Test',
avatarUrl: 'https://test.com',
webUrl: 'https://test.com/test',
webPath: '/test',
},
pipeline: {
detailedStatus: {
......
......@@ -16,7 +16,7 @@ exports[`Repository file preview component renders file HTML 1`] = `
/>
<gl-link-stub
href="/test.md"
href="http://test.com"
>
<strong>
README.md
......
......@@ -31,7 +31,6 @@ describe('Repository file preview component', () => {
it('renders file HTML', () => {
factory({
webUrl: 'http://test.com',
webPath: '/test.md',
name: 'README.md',
});
......@@ -45,7 +44,6 @@ describe('Repository file preview component', () => {
it('handles hash after render', () => {
factory({
webUrl: 'http://test.com',
webPath: '/test.md',
name: 'README.md',
});
......@@ -62,7 +60,6 @@ describe('Repository file preview component', () => {
it('renders loading icon', () => {
factory({
webUrl: 'http://test.com',
webPath: '/test.md',
name: 'README.md',
});
......
......@@ -10,7 +10,7 @@ RSpec.describe GitlabSchema.types['Commit'] do
it 'contains attributes related to commit' do
expect(described_class).to have_graphql_fields(
:id, :sha, :title, :description, :message, :title_html, :authored_date,
:author_name, :author_gravatar, :author, :web_path, :web_url, :latest_pipeline,
:author_name, :author_gravatar, :author, :web_url, :latest_pipeline,
:pipelines, :signature_html
)
end
......
......@@ -5,5 +5,5 @@ require 'spec_helper'
RSpec.describe Types::Tree::BlobType do
specify { expect(described_class.graphql_name).to eq('Blob') }
specify { expect(described_class).to have_graphql_fields(:id, :sha, :name, :type, :path, :flat_path, :web_path, :web_url, :lfs_oid) }
specify { expect(described_class).to have_graphql_fields(:id, :sha, :name, :type, :path, :flat_path, :web_url, :lfs_oid) }
end
......@@ -5,5 +5,5 @@ require 'spec_helper'
RSpec.describe Types::Tree::TreeEntryType do
specify { expect(described_class.graphql_name).to eq('TreeEntry') }
specify { expect(described_class).to have_graphql_fields(:id, :sha, :name, :type, :path, :flat_path, :web_path, :web_url) }
specify { expect(described_class).to have_graphql_fields(:id, :sha, :name, :type, :path, :flat_path, :web_url) }
end
......@@ -16,7 +16,6 @@ RSpec.describe GitlabSchema.types['User'] do
username
avatarUrl
webUrl
webPath
todos
state
authoredMergeRequests
......
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