Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-10-02 06:08:28 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-10-02 06:08:28 +0300
commit895563036ae0fb388dd3ac3cae3a31f2bf1fa85f (patch)
treef8217c367096716b85fd91cca07208596527c66e /app/assets/javascripts/repository
parent5da5ddb5ae9a39ca557ea63731add049f3da6c0b (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/assets/javascripts/repository')
-rw-r--r--app/assets/javascripts/repository/index.js56
-rw-r--r--app/assets/javascripts/repository/queries/path_last_commit.query.graphql9
2 files changed, 14 insertions, 51 deletions
diff --git a/app/assets/javascripts/repository/index.js b/app/assets/javascripts/repository/index.js
index 1d6749654f5..65da8f70b40 100644
--- a/app/assets/javascripts/repository/index.js
+++ b/app/assets/javascripts/repository/index.js
@@ -12,17 +12,12 @@ import { setTitle } from './utils/title';
import { updateFormAction } from './utils/dom';
import { convertObjectPropsToCamelCase, parseBoolean } from '../lib/utils/common_utils';
import { __ } from '../locale';
-import PathLastCommitQuery from './queries/path_last_commit.query.graphql';
export default function setupVueRepositoryList() {
const el = document.getElementById('js-tree-list');
const { dataset } = el;
const { projectPath, projectShortPath, ref, escapedRef, fullName } = dataset;
const router = createRouter(projectPath, escapedRef);
- const pathRegex = /-\/tree\/[^/]+\/(.+$)/;
- const matches = window.location.href.match(pathRegex);
-
- const currentRoutePath = matches ? matches[1] : '';
apolloProvider.clients.defaultClient.cache.writeData({
data: {
@@ -34,43 +29,6 @@ export default function setupVueRepositoryList() {
},
});
- const initLastCommitApp = () =>
- new Vue({
- el: document.getElementById('js-last-commit'),
- router,
- apolloProvider,
- render(h) {
- return h(LastCommit, {
- props: {
- currentPath: this.$route.params.path,
- },
- });
- },
- });
-
- if (window.gl.startup_graphql_calls) {
- const query = window.gl.startup_graphql_calls.find(
- call => call.operationName === 'pathLastCommit',
- );
- query.fetchCall
- .then(res => res.json())
- .then(res => {
- apolloProvider.clients.defaultClient.writeQuery({
- query: PathLastCommitQuery,
- data: res.data,
- variables: {
- projectPath,
- ref,
- path: currentRoutePath,
- },
- });
- })
- .catch(() => {})
- .finally(() => initLastCommitApp());
- } else {
- initLastCommitApp();
- }
-
router.afterEach(({ params: { path } }) => {
setTitle(path, ref, fullName);
});
@@ -119,6 +77,20 @@ export default function setupVueRepositoryList() {
});
}
+ // eslint-disable-next-line no-new
+ new Vue({
+ el: document.getElementById('js-last-commit'),
+ router,
+ apolloProvider,
+ render(h) {
+ return h(LastCommit, {
+ props: {
+ currentPath: this.$route.params.path,
+ },
+ });
+ },
+ });
+
const treeHistoryLinkEl = document.getElementById('js-tree-history-link');
const { historyLink } = treeHistoryLinkEl.dataset;
diff --git a/app/assets/javascripts/repository/queries/path_last_commit.query.graphql b/app/assets/javascripts/repository/queries/path_last_commit.query.graphql
index d845f7c6224..51f3f790a5d 100644
--- a/app/assets/javascripts/repository/queries/path_last_commit.query.graphql
+++ b/app/assets/javascripts/repository/queries/path_last_commit.query.graphql
@@ -1,12 +1,8 @@
query pathLastCommit($projectPath: ID!, $path: String, $ref: String!) {
project(fullPath: $projectPath) {
- __typename
repository {
- __typename
tree(path: $path, ref: $ref) {
- __typename
lastCommit {
- __typename
sha
title
titleHtml
@@ -17,20 +13,15 @@ query pathLastCommit($projectPath: ID!, $path: String, $ref: String!) {
authorName
authorGravatar
author {
- __typename
name
avatarUrl
webPath
}
signatureHtml
pipelines(ref: $ref, first: 1) {
- __typename
edges {
- __typename
node {
- __typename
detailedStatus {
- __typename
detailsPath
icon
tooltip