Commit 0896f380 authored by Phil Hughes's avatar Phil Hughes

Puts Vue LFS badge behind a feature flag

This puts the LFS badge entity in the GraphQL query behind
a feature flag. We have seen some errors in production
that could be caused by this entity.

Also added an extra check around the path locks button.
parent d4c405ab
...@@ -5,6 +5,7 @@ import FileTable from './table/index.vue'; ...@@ -5,6 +5,7 @@ import FileTable from './table/index.vue';
import getRefMixin from '../mixins/get_ref'; import getRefMixin from '../mixins/get_ref';
import getFiles from '../queries/getFiles.query.graphql'; import getFiles from '../queries/getFiles.query.graphql';
import getProjectPath from '../queries/getProjectPath.query.graphql'; import getProjectPath from '../queries/getProjectPath.query.graphql';
import getVueFileListLfsBadge from '../queries/getVueFileListLfsBadge.query.graphql';
import FilePreview from './preview/index.vue'; import FilePreview from './preview/index.vue';
import { readmeFile } from '../utils/readme'; import { readmeFile } from '../utils/readme';
...@@ -20,6 +21,9 @@ export default { ...@@ -20,6 +21,9 @@ export default {
projectPath: { projectPath: {
query: getProjectPath, query: getProjectPath,
}, },
vueFileListLfsBadge: {
query: getVueFileListLfsBadge,
},
}, },
props: { props: {
path: { path: {
...@@ -43,6 +47,7 @@ export default { ...@@ -43,6 +47,7 @@ export default {
blobs: [], blobs: [],
}, },
isLoadingFiles: false, isLoadingFiles: false,
vueFileListLfsBadge: false,
}; };
}, },
computed: { computed: {
...@@ -77,6 +82,7 @@ export default { ...@@ -77,6 +82,7 @@ export default {
path: this.path || '/', path: this.path || '/',
nextPageCursor: this.nextPageCursor, nextPageCursor: this.nextPageCursor,
pageSize: PAGE_SIZE, pageSize: PAGE_SIZE,
vueLfsEnabled: this.vueFileListLfsBadge,
}, },
}) })
.then(({ data }) => { .then(({ data }) => {
......
...@@ -23,6 +23,7 @@ export default function setupVueRepositoryList() { ...@@ -23,6 +23,7 @@ export default function setupVueRepositoryList() {
projectPath, projectPath,
projectShortPath, projectShortPath,
ref, ref,
vueFileListLfsBadge: gon?.features?.vueFileListLfsBadge,
commits: [], commits: [],
}, },
}); });
......
...@@ -14,6 +14,7 @@ query getFiles( ...@@ -14,6 +14,7 @@ query getFiles(
$ref: String! $ref: String!
$pageSize: Int! $pageSize: Int!
$nextPageCursor: String $nextPageCursor: String
$vueLfsEnabled: Boolean = false
) { ) {
project(fullPath: $projectPath) { project(fullPath: $projectPath) {
repository { repository {
...@@ -46,7 +47,7 @@ query getFiles( ...@@ -46,7 +47,7 @@ query getFiles(
node { node {
...TreeEntry ...TreeEntry
webUrl webUrl
lfsOid lfsOid @include(if: $vueLfsEnabled)
} }
} }
pageInfo { pageInfo {
......
query getProjectShortPath {
vueFileListLfsBadge @client
}
...@@ -15,6 +15,10 @@ class Projects::TreeController < Projects::ApplicationController ...@@ -15,6 +15,10 @@ class Projects::TreeController < Projects::ApplicationController
before_action :authorize_download_code! before_action :authorize_download_code!
before_action :authorize_edit_tree!, only: [:create_dir] before_action :authorize_edit_tree!, only: [:create_dir]
before_action only: [:show] do
push_frontend_feature_flag(:vue_file_list_lfs_badge)
end
def show def show
return render_404 unless @repository.commit(@ref) return render_404 unless @repository.commit(@ref)
......
...@@ -9,6 +9,8 @@ export default () => { ...@@ -9,6 +9,8 @@ export default () => {
if (data.pathLocksAvailable) { if (data.pathLocksAvailable) {
const toggleBtn = document.querySelector('.js-path-lock'); const toggleBtn = document.querySelector('.js-path-lock');
if (!toggleBtn) return;
toggleBtn.addEventListener('click', e => { toggleBtn.addEventListener('click', e => {
e.preventDefault(); e.preventDefault();
......
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