summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/repository
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-11-14 12:06:30 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2019-11-14 12:06:30 +0000
commitd8c06be498acbfc2024c01b6b6b02d120dc499f2 (patch)
tree9e2e0852c45332d6222898676a2f6f096e600084 /app/assets/javascripts/repository
parent2fa7d2ddf6a7004f89616e43b8279229af831e25 (diff)
downloadgitlab-ce-d8c06be498acbfc2024c01b6b6b02d120dc499f2.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/assets/javascripts/repository')
-rw-r--r--app/assets/javascripts/repository/components/last_commit.vue17
-rw-r--r--app/assets/javascripts/repository/components/preview/index.vue2
-rw-r--r--app/assets/javascripts/repository/queries/pathLastCommit.query.graphql18
-rw-r--r--app/assets/javascripts/repository/utils/readme.js8
4 files changed, 30 insertions, 15 deletions
diff --git a/app/assets/javascripts/repository/components/last_commit.vue b/app/assets/javascripts/repository/components/last_commit.vue
index 5cbe8d6247a..5a89efa4538 100644
--- a/app/assets/javascripts/repository/components/last_commit.vue
+++ b/app/assets/javascripts/repository/components/last_commit.vue
@@ -38,7 +38,14 @@ export default {
path: this.currentPath.replace(/^\//, ''),
};
},
- update: data => data.project.repository.tree.lastCommit,
+ update: data => {
+ const pipelines = data.project.repository.tree.lastCommit.pipelines.edges;
+
+ return {
+ ...data.project.repository.tree.lastCommit,
+ pipeline: pipelines.length && pipelines[0].node,
+ };
+ },
context: {
isSingleRequest: true,
},
@@ -61,7 +68,7 @@ export default {
computed: {
statusTitle() {
return sprintf(s__('Commits|Commit: %{commitText}'), {
- commitText: this.commit.latestPipeline.detailedStatus.text,
+ commitText: this.commit.pipeline.detailedStatus.text,
});
},
isLoading() {
@@ -127,14 +134,14 @@ export default {
<div v-if="commit.signatureHtml" v-html="commit.signatureHtml"></div>
<div class="ci-status-link">
<gl-link
- v-if="commit.latestPipeline"
+ v-if="commit.pipeline"
v-gl-tooltip.left
- :href="commit.latestPipeline.detailedStatus.detailsPath"
+ :href="commit.pipeline.detailedStatus.detailsPath"
:title="statusTitle"
class="js-commit-pipeline"
>
<ci-icon
- :status="commit.latestPipeline.detailedStatus"
+ :status="commit.pipeline.detailedStatus"
:size="24"
:aria-label="statusTitle"
/>
diff --git a/app/assets/javascripts/repository/components/preview/index.vue b/app/assets/javascripts/repository/components/preview/index.vue
index 564be211c46..7f974838359 100644
--- a/app/assets/javascripts/repository/components/preview/index.vue
+++ b/app/assets/javascripts/repository/components/preview/index.vue
@@ -34,7 +34,7 @@ export default {
</script>
<template>
- <article class="file-holder js-hide-on-navigation limited-width-container readme-holder">
+ <article class="file-holder limited-width-container readme-holder">
<div class="file-title">
<i aria-hidden="true" class="fa fa-file-text-o fa-fw"></i>
<gl-link :href="blob.webUrl">
diff --git a/app/assets/javascripts/repository/queries/pathLastCommit.query.graphql b/app/assets/javascripts/repository/queries/pathLastCommit.query.graphql
index 71c1bf12749..74ccdd79dd0 100644
--- a/app/assets/javascripts/repository/queries/pathLastCommit.query.graphql
+++ b/app/assets/javascripts/repository/queries/pathLastCommit.query.graphql
@@ -14,13 +14,17 @@ query pathLastCommit($projectPath: ID!, $path: String, $ref: String!) {
webUrl
}
signatureHtml
- latestPipeline {
- detailedStatus {
- detailsPath
- icon
- tooltip
- text
- group
+ pipelines(ref: $ref, first: 1) {
+ edges {
+ node {
+ detailedStatus {
+ detailsPath
+ icon
+ tooltip
+ text
+ group
+ }
+ }
}
}
}
diff --git a/app/assets/javascripts/repository/utils/readme.js b/app/assets/javascripts/repository/utils/readme.js
index b219b857c66..e43b2bdc33a 100644
--- a/app/assets/javascripts/repository/utils/readme.js
+++ b/app/assets/javascripts/repository/utils/readme.js
@@ -3,7 +3,11 @@ const ASCIIDOC_EXTENSIONS = ['adoc', 'ad', 'asciidoc'];
const OTHER_EXTENSIONS = ['textile', 'rdoc', 'org', 'creole', 'wiki', 'mediawiki', 'rst'];
const EXTENSIONS = [...MARKDOWN_EXTENSIONS, ...ASCIIDOC_EXTENSIONS, ...OTHER_EXTENSIONS];
const PLAIN_FILENAMES = ['readme', 'index'];
-const FILE_REGEXP = new RegExp(`^(${PLAIN_FILENAMES.join('|')})`, 'i');
+const FILE_REGEXP = new RegExp(
+ `^(${PLAIN_FILENAMES.join('|')})(.(${EXTENSIONS.join('|')}))?$`,
+ 'i',
+);
+const PLAIN_FILE_REGEXP = new RegExp(`^(${PLAIN_FILENAMES.join('|')})`, 'i');
const EXTENSIONS_REGEXP = new RegExp(`.(${EXTENSIONS.join('|')})$`, 'i');
// eslint-disable-next-line import/prefer-default-export
@@ -11,7 +15,7 @@ export const readmeFile = blobs => {
const readMeFiles = blobs.filter(f => f.name.search(FILE_REGEXP) !== -1);
const previewableReadme = readMeFiles.find(f => f.name.search(EXTENSIONS_REGEXP) !== -1);
- const plainReadme = readMeFiles.find(f => f.name.search(FILE_REGEXP) !== -1);
+ const plainReadme = readMeFiles.find(f => f.name.search(PLAIN_FILE_REGEXP) !== -1);
return previewableReadme || plainReadme;
};