From 6adb784bf2839a2b8a73de5602cbfe617836526c Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Wed, 23 Feb 2022 00:18:11 +0000 Subject: [PATCH] Add latest changes from gitlab-org/gitlab@master --- .rubocop_todo/rails/include_url_helper.yml | 1 - .../jobs/components/table/constants.js | 10 --- .../components/table/graphql/cache_config.js | 29 +++++++ .../graphql/queries/get_jobs.query.graphql | 15 ++-- .../jobs/components/table/index.js | 8 +- .../jobs/components/table/jobs_table_app.vue | 67 ++++++--------- app/controllers/search_controller.rb | 1 + app/models/application_record.rb | 6 +- app/presenters/gitlab/blame_presenter.rb | 9 +- doc/administration/job_artifacts.md | 2 +- .../img/AzureAD-scim_provisioning.png | Bin 539414 -> 80244 bytes doc/api/alert_management_alerts.md | 60 +++++++++++++ .../gitlab-autoscaling-overview.png | Bin 94088 -> 37761 bytes .../img/object_hierarchy_example_V14_10.png | Bin 55849 -> 20826 bytes .../scan_result_policy_yaml_mode_v14_6.png | Bin 76484 -> 19583 bytes .../epic-view-ancestors-in-sidebar_v14_6.png | Bin 24780 -> 5010 bytes ...ssue-view-parent-epic-in-sidebar_v14_6.png | Bin 25077 -> 4994 bytes .../img/vsa_stage_table_v14_7.png | Bin 242008 -> 79595 bytes .../img/personal_readme_setup_v14_5.png | Bin 26192 -> 10328 bytes .../project/repository/forking_workflow.md | 4 +- doc/user/project/settings/import_export.md | 6 +- doc/user/search/img/code_search.png | Bin 113383 -> 35763 bytes .../prevent_cross_database_modification.rb | 2 +- locale/gitlab.pot | 3 + .../table/graphql/cache_config_spec.js | 51 +++++++++++ .../components/table/job_table_app_spec.js | 59 ++++--------- spec/frontend/jobs/mock_data.js | 79 +++++++++--------- spec/services/groups/destroy_service_spec.rb | 2 - .../helpers/database_connection_helpers.rb | 11 --- workhorse/internal/upstream/routes.go | 5 +- workhorse/upload_test.go | 1 + 31 files changed, 265 insertions(+), 166 deletions(-) create mode 100644 app/assets/javascripts/jobs/components/table/graphql/cache_config.js create mode 100644 spec/frontend/jobs/components/table/graphql/cache_config_spec.js delete mode 100644 spec/support/helpers/database_connection_helpers.rb diff --git a/.rubocop_todo/rails/include_url_helper.yml b/.rubocop_todo/rails/include_url_helper.yml index dcafeafb9f0..1d8f88e9be1 100644 --- a/.rubocop_todo/rails/include_url_helper.yml +++ b/.rubocop_todo/rails/include_url_helper.yml @@ -19,7 +19,6 @@ Rails/IncludeUrlHelper: - app/models/integrations/redmine.rb - app/models/integrations/webex_teams.rb - app/models/integrations/youtrack.rb - - app/presenters/gitlab/blame_presenter.rb - ee/app/models/integrations/github.rb - ee/spec/helpers/ee/projects/security/configuration_helper_spec.rb - ee/spec/lib/banzai/filter/cross_project_issuable_information_filter_spec.rb diff --git a/app/assets/javascripts/jobs/components/table/constants.js b/app/assets/javascripts/jobs/components/table/constants.js index 962979ba573..951d9324813 100644 --- a/app/assets/javascripts/jobs/components/table/constants.js +++ b/app/assets/javascripts/jobs/components/table/constants.js @@ -1,16 +1,6 @@ import { s__, __ } from '~/locale'; import { DEFAULT_TH_CLASSES } from '~/lib/utils/constants'; -export const GRAPHQL_PAGE_SIZE = 30; - -export const initialPaginationState = { - currentPage: 1, - prevPageCursor: '', - nextPageCursor: '', - first: GRAPHQL_PAGE_SIZE, - last: null, -}; - /* Error constants */ export const POST_FAILURE = 'post_failure'; export const DEFAULT = 'default'; diff --git a/app/assets/javascripts/jobs/components/table/graphql/cache_config.js b/app/assets/javascripts/jobs/components/table/graphql/cache_config.js new file mode 100644 index 00000000000..846efdf21ee --- /dev/null +++ b/app/assets/javascripts/jobs/components/table/graphql/cache_config.js @@ -0,0 +1,29 @@ +import { isEqual } from 'lodash'; + +export default { + typePolicies: { + Project: { + fields: { + jobs: { + keyArgs: false, + }, + }, + }, + CiJobConnection: { + merge(existing = {}, incoming, { args = {} }) { + let nodes; + + if (Object.keys(existing).length !== 0 && isEqual(existing?.statuses, args?.statuses)) { + nodes = [...existing.nodes, ...incoming.nodes]; + } else { + nodes = [...incoming.nodes]; + } + + return { + nodes, + statuses: Array.isArray(args.statuses) ? [...args.statuses] : args.statuses, + }; + }, + }, + }, +}; diff --git a/app/assets/javascripts/jobs/components/table/graphql/queries/get_jobs.query.graphql b/app/assets/javascripts/jobs/components/table/graphql/queries/get_jobs.query.graphql index 88937185a8c..151e49af87e 100644 --- a/app/assets/javascripts/jobs/components/table/graphql/queries/get_jobs.query.graphql +++ b/app/assets/javascripts/jobs/components/table/graphql/queries/get_jobs.query.graphql @@ -1,25 +1,22 @@ -query getJobs( - $fullPath: ID! - $first: Int - $last: Int - $after: String - $before: String - $statuses: [CiJobStatus!] -) { +query getJobs($fullPath: ID!, $after: String, $statuses: [CiJobStatus!]) { project(fullPath: $fullPath) { id - jobs(after: $after, before: $before, first: $first, last: $last, statuses: $statuses) { + __typename + jobs(after: $after, first: 30, statuses: $statuses) { pageInfo { endCursor hasNextPage hasPreviousPage startCursor + __typename } nodes { + __typename artifacts { nodes { downloadPath fileType + __typename } } allowFailure diff --git a/app/assets/javascripts/jobs/components/table/index.js b/app/assets/javascripts/jobs/components/table/index.js index f24daf90815..1b9c7cdcfdd 100644 --- a/app/assets/javascripts/jobs/components/table/index.js +++ b/app/assets/javascripts/jobs/components/table/index.js @@ -4,12 +4,18 @@ import VueApollo from 'vue-apollo'; import JobsTableApp from '~/jobs/components/table/jobs_table_app.vue'; import createDefaultClient from '~/lib/graphql'; import { parseBoolean } from '~/lib/utils/common_utils'; +import cacheConfig from './graphql/cache_config'; Vue.use(VueApollo); Vue.use(GlToast); const apolloProvider = new VueApollo({ - defaultClient: createDefaultClient(), + defaultClient: createDefaultClient( + {}, + { + cacheConfig, + }, + ), }); export default (containerId = 'js-jobs-table') => { diff --git a/app/assets/javascripts/jobs/components/table/jobs_table_app.vue b/app/assets/javascripts/jobs/components/table/jobs_table_app.vue index 81f42c1e293..864e322eecd 100644 --- a/app/assets/javascripts/jobs/components/table/jobs_table_app.vue +++ b/app/assets/javascripts/jobs/components/table/jobs_table_app.vue @@ -1,7 +1,6 @@