diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-12-04 09:09:34 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-12-04 09:09:34 +0300 |
commit | a2f16969fa9bb982d5ec01f18efff5eabfc89a67 (patch) | |
tree | 881f7d8db86c1758fd21c070908a26b3d1d032c8 /app | |
parent | edf27428120b9726e34e577e5b1d3371c74baf1d (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app')
-rw-r--r-- | app/assets/javascripts/diffs/components/app.vue | 1 | ||||
-rw-r--r-- | app/assets/javascripts/diffs/store/actions.js | 32 | ||||
-rw-r--r-- | app/controllers/projects/merge_requests_controller.rb | 1 | ||||
-rw-r--r-- | app/views/admin/groups/_form.html.haml | 1 | ||||
-rw-r--r-- | app/views/groups/_new_group_fields.html.haml | 5 | ||||
-rw-r--r-- | app/views/shared/_group_form.html.haml | 8 | ||||
-rw-r--r-- | app/views/shared/_group_form_description.html.haml | 5 |
7 files changed, 36 insertions, 17 deletions
diff --git a/app/assets/javascripts/diffs/components/app.vue b/app/assets/javascripts/diffs/components/app.vue index 53eb8cd8eb8..731050f2e51 100644 --- a/app/assets/javascripts/diffs/components/app.vue +++ b/app/assets/javascripts/diffs/components/app.vue @@ -539,6 +539,7 @@ export default { <template #total>{{ diffFiles.length }}</template> </gl-sprintf> </div> + <gl-loading-icon v-else-if="retrievingBatches" size="lg" /> </template> <no-changes v-else :changes-empty-state-illustration="changesEmptyStateIllustration" /> </div> diff --git a/app/assets/javascripts/diffs/store/actions.js b/app/assets/javascripts/diffs/store/actions.js index 51d9fe12102..c41828a4221 100644 --- a/app/assets/javascripts/diffs/store/actions.js +++ b/app/assets/javascripts/diffs/store/actions.js @@ -75,22 +75,33 @@ export const setBaseConfig = ({ commit }, options) => { }; export const fetchDiffFilesBatch = ({ commit, state, dispatch }) => { + const diffsGradualLoad = window.gon?.features?.diffsGradualLoad; + let perPage = DIFFS_PER_PAGE; + let increaseAmount = 1.4; + + if (diffsGradualLoad) { + perPage = state.viewDiffsFileByFile ? 1 : 5; + } + + const startPage = diffsGradualLoad ? 0 : 1; const id = window?.location?.hash; const isNoteLink = id.indexOf('#note') === 0; const urlParams = { - per_page: DIFFS_PER_PAGE, w: state.showWhitespace ? '0' : '1', view: 'inline', }; + let totalLoaded = 0; commit(types.SET_BATCH_LOADING, true); commit(types.SET_RETRIEVING_BATCHES, true); eventHub.$emit(EVT_PERF_MARK_DIFF_FILES_START); - const getBatch = (page = 1) => + const getBatch = (page = startPage) => axios - .get(mergeUrlParams({ ...urlParams, page }, state.endpointBatch)) + .get(mergeUrlParams({ ...urlParams, page, per_page: perPage }, state.endpointBatch)) .then(({ data: { pagination, diff_files } }) => { + totalLoaded += diff_files.length; + commit(types.SET_DIFF_DATA_BATCH, { diff_files }); commit(types.SET_BATCH_LOADING, false); @@ -102,7 +113,10 @@ export const fetchDiffFilesBatch = ({ commit, state, dispatch }) => { dispatch('setCurrentDiffFileIdFromNote', id.split('_').pop()); } - if (!pagination.next_page) { + if ( + (diffsGradualLoad && totalLoaded === pagination.total_pages) || + (!diffsGradualLoad && !pagination.next_page) + ) { commit(types.SET_RETRIEVING_BATCHES, false); // We need to check that the currentDiffFileId points to a file that exists @@ -128,6 +142,16 @@ export const fetchDiffFilesBatch = ({ commit, state, dispatch }) => { }), ); } + + return null; + } + + if (diffsGradualLoad) { + const nextPage = page + perPage; + perPage = Math.min(Math.ceil(perPage * increaseAmount), 30); + increaseAmount = Math.min(increaseAmount + 0.2, 2); + + return nextPage; } return pagination.next_page; diff --git a/app/controllers/projects/merge_requests_controller.rb b/app/controllers/projects/merge_requests_controller.rb index 2e11ffe7912..db12dd526ed 100644 --- a/app/controllers/projects/merge_requests_controller.rb +++ b/app/controllers/projects/merge_requests_controller.rb @@ -42,6 +42,7 @@ class Projects::MergeRequestsController < Projects::MergeRequests::ApplicationCo push_frontend_feature_flag(:core_security_mr_widget_counts, @project) push_frontend_feature_flag(:remove_resolve_note, @project, default_enabled: true) push_frontend_feature_flag(:test_failure_history, @project) + push_frontend_feature_flag(:diffs_gradual_load, @project) record_experiment_user(:invite_members_version_a) record_experiment_user(:invite_members_version_b) diff --git a/app/views/admin/groups/_form.html.haml b/app/views/admin/groups/_form.html.haml index 6174da14ac0..e4517dca6d0 100644 --- a/app/views/admin/groups/_form.html.haml +++ b/app/views/admin/groups/_form.html.haml @@ -1,6 +1,7 @@ = form_for [:admin, @group] do |f| = form_errors(@group) = render 'shared/group_form', f: f + = render 'shared/group_form_description', f: f = render_if_exists 'shared/old_repository_size_limit_setting', form: f, type: :group = render_if_exists 'admin/namespace_plan', f: f diff --git a/app/views/groups/_new_group_fields.html.haml b/app/views/groups/_new_group_fields.html.haml index d9706556e79..e21a5101ea9 100644 --- a/app/views/groups/_new_group_fields.html.haml +++ b/app/views/groups/_new_group_fields.html.haml @@ -2,11 +2,6 @@ = render 'shared/group_form', f: f, autofocus: true .row - .form-group.group-description-holder.col-sm-12 - = f.label :avatar, _("Group avatar"), class: 'label-bold' - %div - = render 'shared/choose_avatar_button', f: f - .form-group.col-sm-12 %label.label-bold = _('Visibility level') diff --git a/app/views/shared/_group_form.html.haml b/app/views/shared/_group_form.html.haml index ca603eed703..c3fac5cd464 100644 --- a/app/views/shared/_group_form.html.haml +++ b/app/views/shared/_group_form.html.haml @@ -47,11 +47,3 @@ = f.label :id, class: 'label-bold' do = _("Group ID") = f.text_field :id, class: 'form-control', readonly: true - -.row - .form-group.group-description-holder.col-sm-8 - = f.label :description, class: 'label-bold' do - = _("Group description") - %span (optional) - = f.text_area :description, maxlength: 250, - class: 'form-control js-gfm-input', rows: 4 diff --git a/app/views/shared/_group_form_description.html.haml b/app/views/shared/_group_form_description.html.haml new file mode 100644 index 00000000000..9a895cee884 --- /dev/null +++ b/app/views/shared/_group_form_description.html.haml @@ -0,0 +1,5 @@ +.row + .form-group.group-description-holder.col-sm-8 + = f.label :description, _('Group description (optional)'), class: 'label-bold' + = f.text_area :description, maxlength: 250, + class: 'form-control js-gfm-input', rows: 4 |