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