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>2022-09-13 18:12:17 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2022-09-13 18:12:17 +0300
commit4597f7fe473d9fa622510f8967620006d4bda64e (patch)
treedafe547a51e57112ad92258f4bf992c014591a88 /app/assets/javascripts/repository
parent37a739daec0d7021b2af6ad03c60d37ac3461d88 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/assets/javascripts/repository')
-rw-r--r--app/assets/javascripts/repository/components/blob_content_viewer.vue28
-rw-r--r--app/assets/javascripts/repository/components/table/row.vue2
-rw-r--r--app/assets/javascripts/repository/queries/blob_info.query.graphql66
-rw-r--r--app/assets/javascripts/repository/queries/project_info.query.graphql14
4 files changed, 38 insertions, 72 deletions
diff --git a/app/assets/javascripts/repository/components/blob_content_viewer.vue b/app/assets/javascripts/repository/components/blob_content_viewer.vue
index 78572f11f6f..902077ba3e4 100644
--- a/app/assets/javascripts/repository/components/blob_content_viewer.vue
+++ b/app/assets/javascripts/repository/components/blob_content_viewer.vue
@@ -13,9 +13,10 @@ import glFeatureFlagMixin from '~/vue_shared/mixins/gl_feature_flags_mixin';
import WebIdeLink from '~/vue_shared/components/web_ide_link.vue';
import CodeIntelligence from '~/code_navigation/components/app.vue';
import LineHighlighter from '~/blob/line_highlighter';
+import blobInfoQuery from 'shared_queries/repository/blob_info.query.graphql';
import addBlameLink from '~/blob/blob_blame_link';
+import projectInfoQuery from '../queries/project_info.query.graphql';
import getRefMixin from '../mixins/get_ref';
-import blobInfoQuery from '../queries/blob_info.query.graphql';
import userInfoQuery from '../queries/user_info.query.graphql';
import applicationInfoQuery from '../queries/application_info.query.graphql';
import { DEFAULT_BLOB_INFO, TEXT_FILE_TYPE, LFS_STORAGE, LEGACY_FILE_TYPES } from '../constants';
@@ -41,6 +42,21 @@ export default {
},
},
apollo: {
+ projectInfo: {
+ query: projectInfoQuery,
+ variables() {
+ return {
+ projectPath: this.projectPath,
+ };
+ },
+ error() {
+ this.displayError();
+ },
+ update({ project }) {
+ this.pathLocks = project.pathLocks || DEFAULT_BLOB_INFO.pathLocks;
+ this.userPermissions = project.userPermissions;
+ },
+ },
gitpodEnabled: {
query: applicationInfoQuery,
error() {
@@ -121,6 +137,8 @@ export default {
gitpodEnabled: DEFAULT_BLOB_INFO.gitpodEnabled,
currentUser: DEFAULT_BLOB_INFO.currentUser,
useFallback: false,
+ pathLocks: DEFAULT_BLOB_INFO.pathLocks,
+ userPermissions: DEFAULT_BLOB_INFO.userPermissions,
};
},
computed: {
@@ -163,7 +181,7 @@ export default {
);
},
canLock() {
- const { pushCode, downloadCode } = this.project.userPermissions;
+ const { pushCode, downloadCode } = this.userPermissions;
const currentUsername = window.gon?.current_username;
if (this.pathLockedByUser && this.pathLockedByUser.username !== currentUsername) {
@@ -173,12 +191,12 @@ export default {
return pushCode && downloadCode;
},
pathLockedByUser() {
- const pathLock = this.project?.pathLocks?.nodes.find((node) => node.path === this.path);
+ const pathLock = this.pathLocks?.nodes.find((node) => node.path === this.path);
return pathLock ? pathLock.user : null;
},
showForkSuggestion() {
- const { createMergeRequestIn, forkProject } = this.project.userPermissions;
+ const { createMergeRequestIn, forkProject } = this.userPermissions;
const { canModifyBlob } = this.blobInfo;
return this.isLoggedIn && !canModifyBlob && createMergeRequestIn && forkProject;
@@ -338,7 +356,7 @@ export default {
:name="blobInfo.name"
:replace-path="blobInfo.replacePath"
:delete-path="blobInfo.webPath"
- :can-push-code="project.userPermissions.pushCode"
+ :can-push-code="userPermissions.pushCode"
:can-push-to-branch="blobInfo.canCurrentUserPushToBranch"
:empty-repo="project.repository.empty"
:project-path="projectPath"
diff --git a/app/assets/javascripts/repository/components/table/row.vue b/app/assets/javascripts/repository/components/table/row.vue
index 49a18f40db9..c8cd64b5311 100644
--- a/app/assets/javascripts/repository/components/table/row.vue
+++ b/app/assets/javascripts/repository/components/table/row.vue
@@ -17,8 +17,8 @@ import { TREE_PAGE_SIZE, ROW_APPEAR_DELAY } from '~/repository/constants';
import FileIcon from '~/vue_shared/components/file_icon.vue';
import TimeagoTooltip from '~/vue_shared/components/time_ago_tooltip.vue';
import glFeatureFlagMixin from '~/vue_shared/mixins/gl_feature_flags_mixin';
+import blobInfoQuery from 'shared_queries/repository/blob_info.query.graphql';
import getRefMixin from '../../mixins/get_ref';
-import blobInfoQuery from '../../queries/blob_info.query.graphql';
import commitQuery from '../../queries/commit.query.graphql';
export default {
diff --git a/app/assets/javascripts/repository/queries/blob_info.query.graphql b/app/assets/javascripts/repository/queries/blob_info.query.graphql
deleted file mode 100644
index 45a7793e559..00000000000
--- a/app/assets/javascripts/repository/queries/blob_info.query.graphql
+++ /dev/null
@@ -1,66 +0,0 @@
-#import "ee_else_ce/repository/queries/path_locks.fragment.graphql"
-
-query getBlobInfo(
- $projectPath: ID!
- $filePath: String!
- $ref: String!
- $shouldFetchRawText: Boolean!
-) {
- project(fullPath: $projectPath) {
- userPermissions {
- pushCode
- downloadCode
- createMergeRequestIn
- forkProject
- }
- ...ProjectPathLocksFragment
- repository {
- empty
- blobs(paths: [$filePath], ref: $ref) {
- nodes {
- id
- webPath
- name
- size
- rawSize
- rawTextBlob @include(if: $shouldFetchRawText)
- fileType
- language
- path
- blamePath
- editBlobPath
- gitpodBlobUrl
- ideEditPath
- forkAndEditPath
- ideForkAndEditPath
- codeNavigationPath
- projectBlobPathRoot
- forkAndViewPath
- environmentFormattedExternalUrl
- environmentExternalUrlForRouteMap
- canModifyBlob
- canCurrentUserPushToBranch
- archived
- storedExternally
- externalStorage
- externalStorageUrl
- rawPath
- replacePath
- pipelineEditorPath
- simpleViewer {
- fileType
- tooLarge
- type
- renderError
- }
- richViewer {
- fileType
- tooLarge
- type
- renderError
- }
- }
- }
- }
- }
-}
diff --git a/app/assets/javascripts/repository/queries/project_info.query.graphql b/app/assets/javascripts/repository/queries/project_info.query.graphql
new file mode 100644
index 00000000000..7a380d25bb1
--- /dev/null
+++ b/app/assets/javascripts/repository/queries/project_info.query.graphql
@@ -0,0 +1,14 @@
+#import "ee_else_ce/repository/queries/path_locks.fragment.graphql"
+
+query getProjectInfo($projectPath: ID!) {
+ project(fullPath: $projectPath) {
+ id
+ userPermissions {
+ pushCode
+ downloadCode
+ createMergeRequestIn
+ forkProject
+ }
+ ...ProjectPathLocksFragment
+ }
+}