From 2d80ade70258fa78e9ada2e8b3055129a69654f3 Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Mon, 14 Nov 2022 15:11:29 +0000 Subject: [PATCH] Add latest changes from gitlab-org/gitlab@master --- .gitlab/ci/review-apps/main.gitlab-ci.yml | 2 +- GITALY_SERVER_VERSION | 2 +- .../behaviors/shortcuts/keybindings.js | 7 + .../behaviors/shortcuts/shortcuts.js | 4 + .../runner/components/runner_bulk_delete.vue | 35 +- .../components/runner_delete_button.vue | 7 +- .../components/ci_admin_variables.vue | 142 +----- .../components/ci_group_variables.vue | 132 +----- .../components/ci_project_variables.vue | 161 ++----- .../components/ci_variable_shared.vue | 226 +++++++++ .../admin_add_variable.mutation.graphql | 2 +- .../admin_delete_variable.mutation.graphql | 2 +- .../admin_update_variable.mutation.graphql | 2 +- .../group_add_variable.mutation.graphql | 11 +- .../group_delete_variable.mutation.graphql | 11 +- .../group_update_variable.mutation.graphql | 11 +- .../project_add_variable.mutation.graphql | 11 +- .../project_delete_variable.mutation.graphql | 6 +- .../project_update_variable.mutation.graphql | 6 +- .../ci_variable_list/graphql/settings.js | 60 +-- .../graphql_shared/issuable_client.js | 27 -- .../token_access/components/token_access.vue | 6 +- .../components/token_projects_table.vue | 21 +- ...ects_with_ci_job_token_scope.query.graphql | 4 + .../vue_shared/components/help_popover.vue | 7 +- .../source_viewer/plugins/wrap_child_nodes.js | 2 +- .../components/work_item_detail.vue | 18 +- .../work_item_links/work_item_links.vue | 4 + .../work_item_links/work_item_links_form.vue | 42 +- .../components/work_item_milestone.vue | 37 +- .../graphql/get_issue_details.query.graphql | 3 + .../graphql/milestone.fragment.graphql | 5 + .../work_items/graphql/typedefs.graphql | 11 - .../graphql/work_item.query.graphql | 11 - .../graphql/work_item_by_iid.query.graphql | 11 - .../work_item_milestone.subscription.graphql | 17 + .../work_item_widgets.fragment.graphql | 7 + .../concerns/access_tokens_actions.rb | 33 +- .../concerns/render_access_tokens.rb | 31 ++ .../settings/access_tokens_controller.rb | 1 + .../personal_access_tokens_controller.rb | 33 +- .../settings/access_tokens_controller.rb | 1 + app/graphql/resolvers/blobs_resolver.rb | 2 +- app/graphql/types/commit_type.rb | 2 +- app/graphql/types/project_type.rb | 2 +- .../types/projects/branch_rule_type.rb | 12 + app/graphql/types/release_links_type.rb | 10 +- app/graphql/types/release_source_type.rb | 2 +- app/graphql/types/release_type.rb | 2 +- app/graphql/types/repository_type.rb | 2 +- app/models/ci/build.rb | 14 +- app/models/concerns/file_store_mounter.rb | 34 +- .../concerns/packages/debian/distribution.rb | 9 +- app/models/project_setting.rb | 1 + app/presenters/release_presenter.rb | 10 +- app/services/users/destroy_service.rb | 42 ++ app/views/groups/settings/_remove.html.haml | 2 +- .../settings/access_tokens/index.html.haml | 3 +- app/views/layouts/header/_default.html.haml | 2 +- .../personal_access_tokens/index.html.haml | 2 +- .../settings/access_tokens/index.html.haml | 2 +- app/views/shared/issuable/_sidebar.html.haml | 2 +- .../ci_assign_job_token_on_scheduling.yml | 8 + config/initializers/1_settings.rb | 2 +- config/open_api.yml | 4 + ...hanged_at_index_to_gitlab_subscriptions.rb | 15 + ..._for_vulnerabilities_feedback_migration.rb | 24 + db/schema_migrations/20221102225800 | 1 + db/schema_migrations/20221108121322 | 1 + db/structure.sql | 4 + .../monitoring/prometheus/gitlab_metrics.md | 2 + .../reference_architectures/10k_users.md | 2 +- doc/api/graphql/reference/index.md | 43 +- doc/api/suggestions.md | 54 ++- .../testing_guide/end_to_end/feature_flags.md | 2 +- doc/development/utilities.md | 16 + doc/integration/omniauth.md | 66 ++- doc/update/index.md | 4 +- doc/user/admin_area/license.md | 2 +- doc/user/analytics/dora_metrics.md | 12 +- doc/user/project/merge_requests/changes.md | 6 +- .../merge_requests/img/conflict_ui_v14_0.png | Bin 8371 -> 0 bytes .../merge_requests/img/conflict_ui_v15_6.png | Bin 0 -> 13672 bytes .../img/web_editor_markdown_live_preview.png | Bin 0 -> 454769 bytes doc/user/project/repository/web_editor.md | 14 + doc/user/tasks.md | 24 + lib/api/api.rb | 4 +- lib/api/dependency_proxy.rb | 13 +- lib/api/entities/resource_milestone_event.rb | 12 +- lib/api/resource_milestone_events.rb | 17 +- lib/api/terraform/modules/v1/packages.rb | 2 +- lib/api/terraform/state_version.rb | 2 +- locale/gitlab.pot | 31 +- .../1_manage/project/create_project_spec.rb | 3 - scripts/review_apps/review-apps.sh | 20 +- scripts/utils.sh | 2 +- .../personal_access_tokens_controller_spec.rb | 95 +--- spec/factories/ci/builds.rb | 12 + .../components/runner_bulk_delete_spec.js | 156 ++++--- .../components/runner_delete_button_spec.js | 11 +- .../components/ci_admin_variables_spec.js | 174 +------ .../components/ci_group_variables_spec.js | 188 ++------ .../components/ci_project_variables_spec.js | 201 +------- .../components/ci_variable_shared_spec.js | 426 +++++++++++++++++ spec/frontend/ci_variable_list/mocks.js | 77 +++ spec/frontend/token_access/mock_data.js | 12 + .../token_access/token_access_spec.js | 7 +- .../token_access/token_projects_table_spec.js | 13 +- .../components/help_popover_spec.js | 14 + .../plugins/wrap_child_nodes_spec.js | 3 +- .../components/work_item_detail_spec.js | 52 ++- .../work_item_links_form_spec.js | 2 +- .../work_item_links/work_item_links_spec.js | 7 + .../components/work_item_milestone_spec.js | 28 +- spec/frontend/work_items/mock_data.js | 30 +- spec/frontend/work_items/router_spec.js | 13 + spec/graphql/types/commit_type_spec.rb | 2 +- .../types/projects/branch_rule_type_spec.rb | 1 + spec/graphql/types/release_links_type_spec.rb | 10 +- .../graphql/types/release_source_type_spec.rb | 2 +- spec/graphql/types/repository_type_spec.rb | 2 +- spec/models/ci/build_spec.rb | 22 + .../concerns/file_store_mounter_spec.rb | 93 ++++ spec/models/concerns/has_user_type_spec.rb | 42 ++ .../concerns/token_authenticatable_spec.rb | 10 +- spec/models/packages/package_file_spec.rb | 2 +- .../api/graphql/project/branch_rules_spec.rb | 142 ++++-- .../settings/access_tokens_controller_spec.rb | 13 +- .../settings/access_tokens_controller_spec.rb | 13 +- spec/services/users/destroy_service_spec.rb | 40 +- .../features/access_tokens_shared_examples.rb | 14 +- .../debian/component_file_shared_example.rb | 2 +- ...ccess_tokens_controller_shared_examples.rb | 41 +- test.html | 439 ------------------ 134 files changed, 2247 insertions(+), 1905 deletions(-) create mode 100644 app/assets/javascripts/ci_variable_list/components/ci_variable_shared.vue create mode 100644 app/assets/javascripts/work_items/graphql/milestone.fragment.graphql create mode 100644 app/assets/javascripts/work_items/graphql/work_item_milestone.subscription.graphql create mode 100644 app/controllers/concerns/render_access_tokens.rb create mode 100644 config/feature_flags/development/ci_assign_job_token_on_scheduling.yml create mode 100644 db/migrate/20221102225800_add_max_seats_used_changed_at_index_to_gitlab_subscriptions.rb create mode 100644 db/post_migrate/20221108121322_add_supporting_index_for_vulnerabilities_feedback_migration.rb create mode 100644 db/schema_migrations/20221102225800 create mode 100644 db/schema_migrations/20221108121322 delete mode 100644 doc/user/project/merge_requests/img/conflict_ui_v14_0.png create mode 100644 doc/user/project/merge_requests/img/conflict_ui_v15_6.png create mode 100644 doc/user/project/repository/img/web_editor_markdown_live_preview.png create mode 100644 spec/frontend/ci_variable_list/components/ci_variable_shared_spec.js create mode 100644 spec/models/concerns/file_store_mounter_spec.rb delete mode 100644 test.html diff --git a/.gitlab/ci/review-apps/main.gitlab-ci.yml b/.gitlab/ci/review-apps/main.gitlab-ci.yml index 68fc4e48ba9..8b49327b9f4 100644 --- a/.gitlab/ci/review-apps/main.gitlab-ci.yml +++ b/.gitlab/ci/review-apps/main.gitlab-ci.yml @@ -123,7 +123,7 @@ review-deploy: - run_timed_command "check_kube_domain" - run_timed_command "download_chart" - run_timed_command "deploy" || (display_deployment_debug && exit 1) - - run_timed_command "verify_deploy" || exit 1 + - run_timed_command "verify_deploy"|| (display_deployment_debug && exit 1) - run_timed_command "disable_sign_ups" || (delete_release && exit 1) after_script: # Run seed-dast-test-data.sh only when DAST_RUN is set to true. This is to pupulate review app with data for DAST scan. diff --git a/GITALY_SERVER_VERSION b/GITALY_SERVER_VERSION index c3191271fd8..f76ff29f1bb 100644 --- a/GITALY_SERVER_VERSION +++ b/GITALY_SERVER_VERSION @@ -1 +1 @@ -a415ff702cfd0755db5d1a09c63c13ce13b54f58 +4b3f2921b5f0d659b44aee6323d82fc3698a8ede diff --git a/app/assets/javascripts/behaviors/shortcuts/keybindings.js b/app/assets/javascripts/behaviors/shortcuts/keybindings.js index 3239375bf7c..38ee02938cc 100644 --- a/app/assets/javascripts/behaviors/shortcuts/keybindings.js +++ b/app/assets/javascripts/behaviors/shortcuts/keybindings.js @@ -93,6 +93,12 @@ export const GO_TO_YOUR_MERGE_REQUESTS = { defaultKeys: ['shift+m'], }; +export const GO_TO_YOUR_REVIEW_REQUESTS = { + id: 'globalShortcuts.goToYourReviewRequests', + description: __('Go to your review requests'), + defaultKeys: ['shift+r'], +}; + export const GO_TO_YOUR_TODO_LIST = { id: 'globalShortcuts.goToYourTodoList', description: __('Go to your To-Do list'), @@ -523,6 +529,7 @@ export const GLOBAL_SHORTCUTS_GROUP = { FOCUS_FILTER_BAR, GO_TO_YOUR_ISSUES, GO_TO_YOUR_MERGE_REQUESTS, + GO_TO_YOUR_REVIEW_REQUESTS, GO_TO_YOUR_TODO_LIST, TOGGLE_PERFORMANCE_BAR, HIDE_APPEARING_CONTENT, diff --git a/app/assets/javascripts/behaviors/shortcuts/shortcuts.js b/app/assets/javascripts/behaviors/shortcuts/shortcuts.js index 4d78c7b56a0..7a1577e97d5 100644 --- a/app/assets/javascripts/behaviors/shortcuts/shortcuts.js +++ b/app/assets/javascripts/behaviors/shortcuts/shortcuts.js @@ -24,6 +24,7 @@ import { GO_TO_MILESTONE_LIST, GO_TO_YOUR_SNIPPETS, GO_TO_PROJECT_FIND_FILE, + GO_TO_YOUR_REVIEW_REQUESTS, } from './keybindings'; import { disableShortcuts, shouldDisableShortcuts } from './shortcuts_toggle'; @@ -94,6 +95,9 @@ export default class Shortcuts { Mousetrap.bind(keysFor(GO_TO_YOUR_MERGE_REQUESTS), () => findAndFollowLink('.dashboard-shortcuts-merge_requests'), ); + Mousetrap.bind(keysFor(GO_TO_YOUR_REVIEW_REQUESTS), () => + findAndFollowLink('.dashboard-shortcuts-review_requests'), + ); Mousetrap.bind(keysFor(GO_TO_YOUR_PROJECTS), () => findAndFollowLink('.dashboard-shortcuts-projects'), ); diff --git a/app/assets/javascripts/ci/runner/components/runner_bulk_delete.vue b/app/assets/javascripts/ci/runner/components/runner_bulk_delete.vue index 703da01d9c8..1ec3f8da7c3 100644 --- a/app/assets/javascripts/ci/runner/components/runner_bulk_delete.vue +++ b/app/assets/javascripts/ci/runner/components/runner_bulk_delete.vue @@ -117,31 +117,34 @@ export default { const { errors, deletedIds } = data.bulkRunnerDelete; if (errors?.length) { - this.onError(new Error(errors.join(' '))); - this.$refs.modal.hide(); - return; + createAlert({ + message: s__( + 'Runners|An error occurred while deleting. Some runners may not have been deleted.', + ), + captureError: true, + error: new Error(errors.join(' ')), + }); } - this.$emit('deleted', { - message: this.toastConfirmationMessage(deletedIds.length), - }); + if (deletedIds?.length) { + this.$emit('deleted', { + message: this.toastConfirmationMessage(deletedIds.length), + }); - // Clean up - - // Remove deleted runners from the cache - deletedIds.forEach((id) => { - const cacheId = cache.identify({ __typename: RUNNER_TYPENAME, id }); - cache.evict({ id: cacheId }); - }); - cache.gc(); - - this.$refs.modal.hide(); + // Remove deleted runners from the cache + deletedIds.forEach((id) => { + const cacheId = cache.identify({ __typename: RUNNER_TYPENAME, id }); + cache.evict({ id: cacheId }); + }); + cache.gc(); + } }, }); } catch (error) { this.onError(error); } finally { this.isDeleting = false; + this.$refs.modal.hide(); } }, onError(error) { diff --git a/app/assets/javascripts/ci/runner/components/runner_delete_button.vue b/app/assets/javascripts/ci/runner/components/runner_delete_button.vue index 13404baad89..32d4076b00f 100644 --- a/app/assets/javascripts/ci/runner/components/runner_delete_button.vue +++ b/app/assets/javascripts/ci/runner/components/runner_delete_button.vue @@ -2,7 +2,7 @@ import { GlButton, GlModalDirective, GlTooltipDirective } from '@gitlab/ui'; import runnerDeleteMutation from '~/ci/runner/graphql/shared/runner_delete.mutation.graphql'; import { createAlert } from '~/flash'; -import { sprintf } from '~/locale'; +import { sprintf, s__ } from '~/locale'; import { captureException } from '~/ci/runner/sentry_utils'; import { getIdFromGraphQLId } from '~/graphql_shared/utils'; import { I18N_DELETE_RUNNER, I18N_DELETED_TOAST } from '../constants'; @@ -122,8 +122,11 @@ export default { onError(error) { this.deleting = false; const { message } = error; + const title = sprintf(s__('Runner|Runner %{runnerName} failed to delete'), { + runnerName: this.runnerName, + }); - createAlert({ message }); + createAlert({ title, message }); captureException({ error, component: this.$options.name }); }, }, diff --git a/app/assets/javascripts/ci_variable_list/components/ci_admin_variables.vue b/app/assets/javascripts/ci_variable_list/components/ci_admin_variables.vue index 8d891ff1746..afdac28cbd6 100644 --- a/app/assets/javascripts/ci_variable_list/components/ci_admin_variables.vue +++ b/app/assets/javascripts/ci_variable_list/components/ci_admin_variables.vue @@ -1,143 +1,35 @@ diff --git a/app/assets/javascripts/ci_variable_list/components/ci_group_variables.vue b/app/assets/javascripts/ci_variable_list/components/ci_group_variables.vue index 4af696b8dab..c8f5ac1736d 100644 --- a/app/assets/javascripts/ci_variable_list/components/ci_group_variables.vue +++ b/app/assets/javascripts/ci_variable_list/components/ci_group_variables.vue @@ -1,143 +1,53 @@ diff --git a/app/assets/javascripts/ci_variable_list/components/ci_project_variables.vue b/app/assets/javascripts/ci_variable_list/components/ci_project_variables.vue index 6bd549817f8..2c4818e20c1 100644 --- a/app/assets/javascripts/ci_variable_list/components/ci_project_variables.vue +++ b/app/assets/javascripts/ci_variable_list/components/ci_project_variables.vue @@ -1,160 +1,55 @@ diff --git a/app/assets/javascripts/ci_variable_list/components/ci_variable_shared.vue b/app/assets/javascripts/ci_variable_list/components/ci_variable_shared.vue new file mode 100644 index 00000000000..48081fe28f1 --- /dev/null +++ b/app/assets/javascripts/ci_variable_list/components/ci_variable_shared.vue @@ -0,0 +1,226 @@ + + + diff --git a/app/assets/javascripts/ci_variable_list/graphql/mutations/admin_add_variable.mutation.graphql b/app/assets/javascripts/ci_variable_list/graphql/mutations/admin_add_variable.mutation.graphql index eba4b0c32f8..9208c34f154 100644 --- a/app/assets/javascripts/ci_variable_list/graphql/mutations/admin_add_variable.mutation.graphql +++ b/app/assets/javascripts/ci_variable_list/graphql/mutations/admin_add_variable.mutation.graphql @@ -1,7 +1,7 @@ #import "~/ci_variable_list/graphql/fragments/ci_variable.fragment.graphql" mutation addAdminVariable($variable: CiVariable!, $endpoint: String!) { - addAdminVariable(variable: $variable, endpoint: $endpoint) @client { + ciVariableMutation: addAdminVariable(variable: $variable, endpoint: $endpoint) @client { ciVariables { nodes { ...BaseCiVariable diff --git a/app/assets/javascripts/ci_variable_list/graphql/mutations/admin_delete_variable.mutation.graphql b/app/assets/javascripts/ci_variable_list/graphql/mutations/admin_delete_variable.mutation.graphql index 96eb8c794bc..a79b98f5e95 100644 --- a/app/assets/javascripts/ci_variable_list/graphql/mutations/admin_delete_variable.mutation.graphql +++ b/app/assets/javascripts/ci_variable_list/graphql/mutations/admin_delete_variable.mutation.graphql @@ -1,7 +1,7 @@ #import "~/ci_variable_list/graphql/fragments/ci_variable.fragment.graphql" mutation deleteAdminVariable($variable: CiVariable!, $endpoint: String!) { - deleteAdminVariable(variable: $variable, endpoint: $endpoint) @client { + ciVariableMutation: deleteAdminVariable(variable: $variable, endpoint: $endpoint) @client { ciVariables { nodes { ...BaseCiVariable diff --git a/app/assets/javascripts/ci_variable_list/graphql/mutations/admin_update_variable.mutation.graphql b/app/assets/javascripts/ci_variable_list/graphql/mutations/admin_update_variable.mutation.graphql index c0388507bb8..ddea753bf90 100644 --- a/app/assets/javascripts/ci_variable_list/graphql/mutations/admin_update_variable.mutation.graphql +++ b/app/assets/javascripts/ci_variable_list/graphql/mutations/admin_update_variable.mutation.graphql @@ -1,7 +1,7 @@ #import "~/ci_variable_list/graphql/fragments/ci_variable.fragment.graphql" mutation updateAdminVariable($variable: CiVariable!, $endpoint: String!) { - updateAdminVariable(variable: $variable, endpoint: $endpoint) @client { + ciVariableMutation: updateAdminVariable(variable: $variable, endpoint: $endpoint) @client { ciVariables { nodes { ...BaseCiVariable diff --git a/app/assets/javascripts/ci_variable_list/graphql/mutations/group_add_variable.mutation.graphql b/app/assets/javascripts/ci_variable_list/graphql/mutations/group_add_variable.mutation.graphql index f8e4dc55fa4..c44ee2ecc1d 100644 --- a/app/assets/javascripts/ci_variable_list/graphql/mutations/group_add_variable.mutation.graphql +++ b/app/assets/javascripts/ci_variable_list/graphql/mutations/group_add_variable.mutation.graphql @@ -1,16 +1,11 @@ #import "~/ci_variable_list/graphql/fragments/ci_variable.fragment.graphql" -mutation addGroupVariable( - $variable: CiVariable! - $endpoint: String! - $fullPath: ID! - $groupId: ID! -) { - addGroupVariable( +mutation addGroupVariable($variable: CiVariable!, $endpoint: String!, $fullPath: ID!, $id: ID!) { + ciVariableMutation: addGroupVariable( variable: $variable endpoint: $endpoint fullPath: $fullPath - groupId: $groupId + id: $id ) @client { group { id diff --git a/app/assets/javascripts/ci_variable_list/graphql/mutations/group_delete_variable.mutation.graphql b/app/assets/javascripts/ci_variable_list/graphql/mutations/group_delete_variable.mutation.graphql index 310e4a6e551..53e9b411dd2 100644 --- a/app/assets/javascripts/ci_variable_list/graphql/mutations/group_delete_variable.mutation.graphql +++ b/app/assets/javascripts/ci_variable_list/graphql/mutations/group_delete_variable.mutation.graphql @@ -1,16 +1,11 @@ #import "~/ci_variable_list/graphql/fragments/ci_variable.fragment.graphql" -mutation deleteGroupVariable( - $variable: CiVariable! - $endpoint: String! - $fullPath: ID! - $groupId: ID! -) { - deleteGroupVariable( +mutation deleteGroupVariable($variable: CiVariable!, $endpoint: String!, $fullPath: ID!, $id: ID!) { + ciVariableMutation: deleteGroupVariable( variable: $variable endpoint: $endpoint fullPath: $fullPath - groupId: $groupId + id: $id ) @client { group { id diff --git a/app/assets/javascripts/ci_variable_list/graphql/mutations/group_update_variable.mutation.graphql b/app/assets/javascripts/ci_variable_list/graphql/mutations/group_update_variable.mutation.graphql index 5291942eb87..2dddca14bd8 100644 --- a/app/assets/javascripts/ci_variable_list/graphql/mutations/group_update_variable.mutation.graphql +++ b/app/assets/javascripts/ci_variable_list/graphql/mutations/group_update_variable.mutation.graphql @@ -1,16 +1,11 @@ #import "~/ci_variable_list/graphql/fragments/ci_variable.fragment.graphql" -mutation updateGroupVariable( - $variable: CiVariable! - $endpoint: String! - $fullPath: ID! - $groupId: ID! -) { - updateGroupVariable( +mutation updateGroupVariable($variable: CiVariable!, $endpoint: String!, $fullPath: ID!, $id: ID!) { + ciVariableMutation: updateGroupVariable( variable: $variable endpoint: $endpoint fullPath: $fullPath - groupId: $groupId + id: $id ) @client { group { id diff --git a/app/assets/javascripts/ci_variable_list/graphql/mutations/project_add_variable.mutation.graphql b/app/assets/javascripts/ci_variable_list/graphql/mutations/project_add_variable.mutation.graphql index ab3a46da854..39504770e33 100644 --- a/app/assets/javascripts/ci_variable_list/graphql/mutations/project_add_variable.mutation.graphql +++ b/app/assets/javascripts/ci_variable_list/graphql/mutations/project_add_variable.mutation.graphql @@ -1,16 +1,11 @@ #import "~/ci_variable_list/graphql/fragments/ci_variable.fragment.graphql" -mutation addProjectVariable( - $variable: CiVariable! - $endpoint: String! - $fullPath: ID! - $projectId: ID! -) { - addProjectVariable( +mutation addProjectVariable($variable: CiVariable!, $endpoint: String!, $fullPath: ID!, $id: ID!) { + ciVariableMutation: addProjectVariable( variable: $variable endpoint: $endpoint fullPath: $fullPath - projectId: $projectId + id: $id ) @client { project { id diff --git a/app/assets/javascripts/ci_variable_list/graphql/mutations/project_delete_variable.mutation.graphql b/app/assets/javascripts/ci_variable_list/graphql/mutations/project_delete_variable.mutation.graphql index e83dc9a5e5e..f55c255e332 100644 --- a/app/assets/javascripts/ci_variable_list/graphql/mutations/project_delete_variable.mutation.graphql +++ b/app/assets/javascripts/ci_variable_list/graphql/mutations/project_delete_variable.mutation.graphql @@ -4,13 +4,13 @@ mutation deleteProjectVariable( $variable: CiVariable! $endpoint: String! $fullPath: ID! - $projectId: ID! + $id: ID! ) { - deleteProjectVariable( + ciVariableMutation: deleteProjectVariable( variable: $variable endpoint: $endpoint fullPath: $fullPath - projectId: $projectId + id: $id ) @client { project { id diff --git a/app/assets/javascripts/ci_variable_list/graphql/mutations/project_update_variable.mutation.graphql b/app/assets/javascripts/ci_variable_list/graphql/mutations/project_update_variable.mutation.graphql index 4788911431b..fc589e8a939 100644 --- a/app/assets/javascripts/ci_variable_list/graphql/mutations/project_update_variable.mutation.graphql +++ b/app/assets/javascripts/ci_variable_list/graphql/mutations/project_update_variable.mutation.graphql @@ -4,13 +4,13 @@ mutation updateProjectVariable( $variable: CiVariable! $endpoint: String! $fullPath: ID! - $projectId: ID! + $id: ID! ) { - updateProjectVariable( + ciVariableMutation: updateProjectVariable( variable: $variable endpoint: $endpoint fullPath: $fullPath - projectId: $projectId + id: $id ) @client { project { id diff --git a/app/assets/javascripts/ci_variable_list/graphql/settings.js b/app/assets/javascripts/ci_variable_list/graphql/settings.js index ecdc4f220bd..02f6c226b0f 100644 --- a/app/assets/javascripts/ci_variable_list/graphql/settings.js +++ b/app/assets/javascripts/ci_variable_list/graphql/settings.js @@ -36,12 +36,12 @@ const mapVariableTypes = (variables = [], kind) => { }); }; -const prepareProjectGraphQLResponse = ({ data, projectId, errors = [] }) => { +const prepareProjectGraphQLResponse = ({ data, id, errors = [] }) => { return { errors, project: { __typename: GRAPHQL_PROJECT_TYPE, - id: convertToGraphQLId(GRAPHQL_PROJECT_TYPE, projectId), + id: convertToGraphQLId(GRAPHQL_PROJECT_TYPE, id), ciVariables: { __typename: `Ci${GRAPHQL_PROJECT_TYPE}VariableConnection`, pageInfo: { @@ -57,12 +57,12 @@ const prepareProjectGraphQLResponse = ({ data, projectId, errors = [] }) => { }; }; -const prepareGroupGraphQLResponse = ({ data, groupId, errors = [] }) => { +const prepareGroupGraphQLResponse = ({ data, id, errors = [] }) => { return { errors, group: { __typename: GRAPHQL_GROUP_TYPE, - id: convertToGraphQLId(GRAPHQL_GROUP_TYPE, groupId), + id: convertToGraphQLId(GRAPHQL_GROUP_TYPE, id), ciVariables: { __typename: `Ci${GRAPHQL_GROUP_TYPE}VariableConnection`, pageInfo: { @@ -95,20 +95,13 @@ const prepareAdminGraphQLResponse = ({ data, errors = [] }) => { }; }; -async function callProjectEndpoint({ - endpoint, - fullPath, - variable, - projectId, - cache, - destroy = false, -}) { +async function callProjectEndpoint({ endpoint, fullPath, variable, id, cache, destroy = false }) { try { const { data } = await axios.patch(endpoint, { variables_attributes: [prepareVariableForApi({ variable, destroy })], }); - const graphqlData = prepareProjectGraphQLResponse({ data, projectId }); + const graphqlData = prepareProjectGraphQLResponse({ data, id }); cache.writeQuery({ query: getProjectVariables, @@ -122,26 +115,19 @@ async function callProjectEndpoint({ } catch (e) { return prepareProjectGraphQLResponse({ data: cache.readQuery({ query: getProjectVariables, variables: { fullPath } }), - projectId, + id, errors: [...e.response.data], }); } } -const callGroupEndpoint = async ({ - endpoint, - fullPath, - variable, - groupId, - cache, - destroy = false, -}) => { +const callGroupEndpoint = async ({ endpoint, fullPath, variable, id, cache, destroy = false }) => { try { const { data } = await axios.patch(endpoint, { variables_attributes: [prepareVariableForApi({ variable, destroy })], }); - const graphqlData = prepareGroupGraphQLResponse({ data, groupId }); + const graphqlData = prepareGroupGraphQLResponse({ data, id }); cache.writeQuery({ query: getGroupVariables, @@ -152,7 +138,7 @@ const callGroupEndpoint = async ({ } catch (e) { return prepareGroupGraphQLResponse({ data: cache.readQuery({ query: getGroupVariables, variables: { fullPath } }), - groupId, + id, errors: [...e.response.data], }); } @@ -182,23 +168,23 @@ const callAdminEndpoint = async ({ endpoint, variable, cache, destroy = false }) export const resolvers = { Mutation: { - addProjectVariable: async (_, { endpoint, fullPath, variable, projectId }, { cache }) => { - return callProjectEndpoint({ endpoint, fullPath, variable, projectId, cache }); + addProjectVariable: async (_, { endpoint, fullPath, variable, id }, { cache }) => { + return callProjectEndpoint({ endpoint, fullPath, variable, id, cache }); }, - updateProjectVariable: async (_, { endpoint, fullPath, variable, projectId }, { cache }) => { - return callProjectEndpoint({ endpoint, fullPath, variable, projectId, cache }); + updateProjectVariable: async (_, { endpoint, fullPath, variable, id }, { cache }) => { + return callProjectEndpoint({ endpoint, fullPath, variable, id, cache }); }, - deleteProjectVariable: async (_, { endpoint, fullPath, variable, projectId }, { cache }) => { - return callProjectEndpoint({ endpoint, fullPath, variable, projectId, cache, destroy: true }); + deleteProjectVariable: async (_, { endpoint, fullPath, variable, id }, { cache }) => { + return callProjectEndpoint({ endpoint, fullPath, variable, id, cache, destroy: true }); }, - addGroupVariable: async (_, { endpoint, fullPath, variable, groupId }, { cache }) => { - return callGroupEndpoint({ endpoint, fullPath, variable, groupId, cache }); + addGroupVariable: async (_, { endpoint, fullPath, variable, id }, { cache }) => { + return callGroupEndpoint({ endpoint, fullPath, variable, id, cache }); }, - updateGroupVariable: async (_, { endpoint, fullPath, variable, groupId }, { cache }) => { - return callGroupEndpoint({ endpoint, fullPath, variable, groupId, cache }); + updateGroupVariable: async (_, { endpoint, fullPath, variable, id }, { cache }) => { + return callGroupEndpoint({ endpoint, fullPath, variable, id, cache }); }, - deleteGroupVariable: async (_, { endpoint, fullPath, variable, groupId }, { cache }) => { - return callGroupEndpoint({ endpoint, fullPath, variable, groupId, cache, destroy: true }); + deleteGroupVariable: async (_, { endpoint, fullPath, variable, id }, { cache }) => { + return callGroupEndpoint({ endpoint, fullPath, variable, id, cache, destroy: true }); }, addAdminVariable: async (_, { endpoint, variable }, { cache }) => { return callAdminEndpoint({ endpoint, variable, cache }); @@ -238,7 +224,7 @@ export const cacheConfig = { Project: { fields: { ciVariables: { - keyArgs: ['fullPath', 'endpoint', 'projectId'], + keyArgs: ['fullPath', 'endpoint', 'id'], merge: mergeVariables, }, }, diff --git a/app/assets/javascripts/graphql_shared/issuable_client.js b/app/assets/javascripts/graphql_shared/issuable_client.js index 38c7af8cf95..15e7ef7d62c 100644 --- a/app/assets/javascripts/graphql_shared/issuable_client.js +++ b/app/assets/javascripts/graphql_shared/issuable_client.js @@ -5,7 +5,6 @@ import { concatPagination } from '@apollo/client/utilities'; import getIssueStateQuery from '~/issues/show/queries/get_issue_state.query.graphql'; import createDefaultClient from '~/lib/graphql'; import typeDefs from '~/work_items/graphql/typedefs.graphql'; -import { WIDGET_TYPE_MILESTONE } from '~/work_items/constants'; export const config = { typeDefs, @@ -15,10 +14,6 @@ export const config = { // eslint-disable-next-line no-underscore-dangle return object.__typename === 'BoardList' ? object.iid : defaultDataIdFromObject(object); }, - - possibleTypes: { - LocalWorkItemWidget: ['LocalWorkItemMilestone'], - }, typePolicies: { Project: { fields: { @@ -29,28 +24,6 @@ export const config = { }, WorkItem: { fields: { - mockWidgets: { - read(widgets) { - return ( - widgets || [ - { - __typename: 'LocalWorkItemMilestone', - type: WIDGET_TYPE_MILESTONE, - nodes: [ - { - dueDate: null, - expired: false, - id: 'gid://gitlab/Milestone/30', - title: 'v4.0', - // eslint-disable-next-line @gitlab/require-i18n-strings - __typename: 'Milestone', - }, - ], - }, - ] - ); - }, - }, widgets: { merge(existing = [], incoming) { if (existing.length === 0) { diff --git a/app/assets/javascripts/token_access/components/token_access.vue b/app/assets/javascripts/token_access/components/token_access.vue index 4b91872d80d..fe99f3e1fdd 100644 --- a/app/assets/javascripts/token_access/components/token_access.vue +++ b/app/assets/javascripts/token_access/components/token_access.vue @@ -117,7 +117,7 @@ export default { throw new Error(errors[0]); } } catch (error) { - createAlert({ message: error }); + createAlert({ message: error.message }); } }, async addProject() { @@ -140,7 +140,7 @@ export default { throw new Error(errors[0]); } } catch (error) { - createAlert({ message: error }); + createAlert({ message: error.message }); } finally { this.clearTargetProjectPath(); this.getProjects(); @@ -166,7 +166,7 @@ export default { throw new Error(errors[0]); } } catch (error) { - createAlert({ message: error }); + createAlert({ message: error.message }); } finally { this.getProjects(); } diff --git a/app/assets/javascripts/token_access/components/token_projects_table.vue b/app/assets/javascripts/token_access/components/token_projects_table.vue index 82ef3371d91..ce33478cbee 100644 --- a/app/assets/javascripts/token_access/components/token_projects_table.vue +++ b/app/assets/javascripts/token_access/components/token_projects_table.vue @@ -10,14 +10,21 @@ export default { { key: 'project', label: __('Projects that can be accessed'), - tdClass: 'gl-p-5!', - columnClass: 'gl-w-85p', + thClass: 'gl-border-t-none!', + columnClass: 'gl-w-40p', + }, + { + key: 'namespace', + label: __('Namespace'), + thClass: 'gl-border-t-none!', + columnClass: 'gl-w-40p', }, { key: 'actions', label: '', - tdClass: 'gl-p-5! gl-text-right', - columnClass: 'gl-w-15p', + tdClass: 'gl-text-right', + thClass: 'gl-border-t-none!', + columnClass: 'gl-w-10p', }, ], components: { @@ -57,7 +64,11 @@ export default { + +