diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-12-07 15:10:33 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-12-07 15:10:33 +0300 |
commit | 6dd9e3644eea1a5c605a6a623cae1d53b156b9e5 (patch) | |
tree | 77a5887b505693994e85532da84a0b80a13bb5df /app | |
parent | dc62bfce8b1c716decb59a8d3fae4985d5490025 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app')
24 files changed, 186 insertions, 154 deletions
diff --git a/app/assets/javascripts/boards/graphql/issue_set_labels.mutation.graphql b/app/assets/javascripts/boards/graphql/issue_set_labels.mutation.graphql index 70eb1dfbf7e..c9c5d744371 100644 --- a/app/assets/javascripts/boards/graphql/issue_set_labels.mutation.graphql +++ b/app/assets/javascripts/boards/graphql/issue_set_labels.mutation.graphql @@ -1,13 +1,12 @@ +#import "~/graphql_shared/fragments/label.fragment.graphql" + mutation issueSetLabels($input: UpdateIssueInput!) { - updateIssue(input: $input) { - issue { + updateIssuableLabels: updateIssue(input: $input) { + issuable: issue { id labels { nodes { - id - title - color - description + ...Label } } } diff --git a/app/assets/javascripts/integrations/constants.js b/app/assets/javascripts/integrations/constants.js index 977811f81a4..74d99d02fc5 100644 --- a/app/assets/javascripts/integrations/constants.js +++ b/app/assets/javascripts/integrations/constants.js @@ -2,7 +2,6 @@ import { s__, __ } from '~/locale'; export const TEST_INTEGRATION_EVENT = 'testIntegration'; export const SAVE_INTEGRATION_EVENT = 'saveIntegration'; -export const TOGGLE_INTEGRATION_EVENT = 'toggleIntegration'; export const VALIDATE_INTEGRATION_FORM_EVENT = 'validateIntegrationForm'; export const integrationLevels = { diff --git a/app/assets/javascripts/integrations/edit/components/active_checkbox.vue b/app/assets/javascripts/integrations/edit/components/active_checkbox.vue index 9804a9e15f6..5ddf3aeb639 100644 --- a/app/assets/javascripts/integrations/edit/components/active_checkbox.vue +++ b/app/assets/javascripts/integrations/edit/components/active_checkbox.vue @@ -1,8 +1,6 @@ <script> import { GlFormGroup, GlFormCheckbox } from '@gitlab/ui'; import { mapGetters } from 'vuex'; -import { TOGGLE_INTEGRATION_EVENT } from '~/integrations/constants'; -import eventHub from '../event_hub'; export default { name: 'ActiveCheckbox', @@ -20,14 +18,11 @@ export default { }, mounted() { this.activated = this.propsSource.initialActivated; - // Initialize view - this.$nextTick(() => { - this.onChange(this.activated); - }); + this.onChange(this.activated); }, methods: { - onChange(e) { - eventHub.$emit(TOGGLE_INTEGRATION_EVENT, e); + onChange(isChecked) { + this.$emit('toggle-integration-active', isChecked); }, }, }; diff --git a/app/assets/javascripts/integrations/edit/components/integration_form.vue b/app/assets/javascripts/integrations/edit/components/integration_form.vue index 767810950b1..a30c84bd4d2 100644 --- a/app/assets/javascripts/integrations/edit/components/integration_form.vue +++ b/app/assets/javascripts/integrations/edit/components/integration_form.vue @@ -37,12 +37,21 @@ export default { }, mixins: [glFeatureFlagsMixin()], props: { + formSelector: { + type: String, + required: true, + }, helpHtml: { type: String, required: false, default: '', }, }, + data() { + return { + integrationActive: false, + }; + }, computed: { ...mapGetters(['currentKey', 'propsSource', 'isDisabled']), ...mapState([ @@ -71,7 +80,7 @@ export default { }, mounted() { // this form element is defined in Haml - this.form = document.querySelector('.js-integration-settings-form'); + this.form = document.querySelector(this.formSelector); }, methods: { ...mapActions([ @@ -84,11 +93,15 @@ export default { ]), onSaveClick() { this.setIsSaving(true); - eventHub.$emit(SAVE_INTEGRATION_EVENT); + + const formValid = this.form.checkValidity() || this.integrationActive === false; + eventHub.$emit(SAVE_INTEGRATION_EVENT, formValid); }, onTestClick() { this.setIsTesting(true); - eventHub.$emit(TEST_INTEGRATION_EVENT); + + const formValid = this.form.checkValidity(); + eventHub.$emit(TEST_INTEGRATION_EVENT, formValid); }, onResetClick() { this.fetchResetIntegration(); @@ -97,6 +110,19 @@ export default { const formData = new FormData(this.form); this.requestJiraIssueTypes(formData); }, + onToggleIntegrationState(integrationActive) { + this.integrationActive = integrationActive; + if (!this.form) { + return; + } + + // If integration will be active, enable form validation. + if (integrationActive) { + this.form.removeAttribute('novalidate'); + } else { + this.form.setAttribute('novalidate', true); + } + }, }, helpHtmlConfig: { ADD_ATTR: ['target'], // allow external links, can be removed after https://gitlab.com/gitlab-org/gitlab-ui/-/issues/1427 is implemented @@ -123,7 +149,11 @@ export default { <!-- helpHtml is trusted input --> <div v-if="helpHtml" v-safe-html:[$options.helpHtmlConfig]="helpHtml"></div> - <active-checkbox v-if="propsSource.showActive" :key="`${currentKey}-active-checkbox`" /> + <active-checkbox + v-if="propsSource.showActive" + :key="`${currentKey}-active-checkbox`" + @toggle-integration-active="onToggleIntegrationState" + /> <jira-trigger-fields v-if="isJira" :key="`${currentKey}-jira-trigger-fields`" @@ -167,6 +197,7 @@ export default { type="submit" :loading="isSaving" :disabled="isDisabled" + data-testid="save-button" data-qa-selector="save_changes_button" @click.prevent="onSaveClick" > @@ -180,6 +211,7 @@ export default { :loading="isTesting" :disabled="isDisabled" :href="propsSource.testPath" + data-testid="test-button" @click.prevent="onTestClick" > {{ __('Test settings') }} diff --git a/app/assets/javascripts/integrations/edit/index.js b/app/assets/javascripts/integrations/edit/index.js index 792e7d8e85e..2e41d2914b7 100644 --- a/app/assets/javascripts/integrations/edit/index.js +++ b/app/assets/javascripts/integrations/edit/index.js @@ -85,7 +85,7 @@ function parseDatasetToProps(data) { }; } -export default (el, defaultEl) => { +export default (el, defaultEl, formSelector) => { if (!el) { return null; } @@ -112,6 +112,7 @@ export default (el, defaultEl) => { return createElement(IntegrationForm, { props: { helpHtml, + formSelector, }, }); }, diff --git a/app/assets/javascripts/integrations/integration_settings_form.js b/app/assets/javascripts/integrations/integration_settings_form.js index 2b6959ed1cd..d3c227df1ee 100644 --- a/app/assets/javascripts/integrations/integration_settings_form.js +++ b/app/assets/javascripts/integrations/integration_settings_form.js @@ -5,7 +5,6 @@ import eventHub from './edit/event_hub'; import { TEST_INTEGRATION_EVENT, SAVE_INTEGRATION_EVENT, - TOGGLE_INTEGRATION_EVENT, VALIDATE_INTEGRATION_FORM_EVENT, I18N_DEFAULT_ERROR_MESSAGE, I18N_SUCCESSFUL_CONNECTION_MESSAGE, @@ -14,8 +13,8 @@ import { testIntegrationSettings } from './edit/api'; export default class IntegrationSettingsForm { constructor(formSelector) { + this.formSelector = formSelector; this.$form = document.querySelector(formSelector); - this.formActive = false; this.vue = null; @@ -28,26 +27,22 @@ export default class IntegrationSettingsForm { this.vue = initForm( document.querySelector('.js-vue-integration-settings'), document.querySelector('.js-vue-default-integration-settings'), + this.formSelector, ); - eventHub.$on(TOGGLE_INTEGRATION_EVENT, (active) => { - this.formActive = active; - this.toggleServiceState(); + eventHub.$on(TEST_INTEGRATION_EVENT, (formValid) => { + this.testIntegration(formValid); }); - eventHub.$on(TEST_INTEGRATION_EVENT, () => { - this.testIntegration(); - }); - eventHub.$on(SAVE_INTEGRATION_EVENT, () => { - this.saveIntegration(); + eventHub.$on(SAVE_INTEGRATION_EVENT, (formValid) => { + this.saveIntegration(formValid); }); } - saveIntegration() { + saveIntegration(formValid) { // Save Service if not active and check the following if active; // 1) If form contents are valid // 2) If this service can be saved // If both conditions are true, we override form submission // and save the service using provided configuration. - const formValid = this.$form.checkValidity() || this.formActive === false; if (formValid) { delay(() => { @@ -59,13 +54,13 @@ export default class IntegrationSettingsForm { } } - testIntegration() { + testIntegration(formValid) { // Service was marked active so now we check; // 1) If form contents are valid // 2) If this service can be tested // If both conditions are true, we override form submission // and test the service using provided configuration. - if (this.$form.checkValidity()) { + if (formValid) { this.testSettings(new FormData(this.$form)); } else { eventHub.$emit(VALIDATE_INTEGRATION_FORM_EVENT); @@ -74,17 +69,6 @@ export default class IntegrationSettingsForm { } /** - * Change Form's validation enforcement based on service status (active/inactive) - */ - toggleServiceState() { - if (this.formActive) { - this.$form.removeAttribute('novalidate'); - } else if (!this.$form.getAttribute('novalidate')) { - this.$form.setAttribute('novalidate', 'novalidate'); - } - } - - /** * Get a list of Jira issue types for the currently configured project * * @param {string} formData - URL encoded string containing the form data diff --git a/app/assets/javascripts/pages/help/ui/index.js b/app/assets/javascripts/pages/help/ui/index.js deleted file mode 100644 index 9ccc9123506..00000000000 --- a/app/assets/javascripts/pages/help/ui/index.js +++ /dev/null @@ -1,3 +0,0 @@ -import initUIKit from '~/ui_development_kit'; - -initUIKit(); diff --git a/app/assets/javascripts/pages/projects/path_locks/index.js b/app/assets/javascripts/pages/projects/path_locks/index.js deleted file mode 100644 index e5ab5d43bbf..00000000000 --- a/app/assets/javascripts/pages/projects/path_locks/index.js +++ /dev/null @@ -1,3 +0,0 @@ -import initDeprecatedRemoveRowBehavior from '~/behaviors/deprecated_remove_row_behavior'; - -document.addEventListener('DOMContentLoaded', initDeprecatedRemoveRowBehavior); diff --git a/app/assets/javascripts/runner/components/cells/runner_actions_cell.vue b/app/assets/javascripts/runner/components/cells/runner_actions_cell.vue index c4bddb7b398..33f7a67aba4 100644 --- a/app/assets/javascripts/runner/components/cells/runner_actions_cell.vue +++ b/app/assets/javascripts/runner/components/cells/runner_actions_cell.vue @@ -1,27 +1,29 @@ <script> -import { GlButton, GlButtonGroup, GlTooltipDirective } from '@gitlab/ui'; +import { GlButton, GlButtonGroup, GlModalDirective, GlTooltipDirective } from '@gitlab/ui'; import createFlash from '~/flash'; -import { __, s__ } from '~/locale'; +import { __, s__, sprintf } from '~/locale'; import runnerDeleteMutation from '~/runner/graphql/runner_delete.mutation.graphql'; import runnerActionsUpdateMutation from '~/runner/graphql/runner_actions_update.mutation.graphql'; import { captureException } from '~/runner/sentry_utils'; +import { getIdFromGraphQLId } from '~/graphql_shared/utils'; +import RunnerDeleteModal from '../runner_delete_modal.vue'; -const i18n = { - I18N_EDIT: __('Edit'), - I18N_PAUSE: __('Pause'), - I18N_RESUME: __('Resume'), - I18N_REMOVE: __('Remove'), - I18N_REMOVE_CONFIRMATION: s__('Runners|Are you sure you want to delete this runner?'), -}; +const I18N_EDIT = __('Edit'); +const I18N_PAUSE = __('Pause'); +const I18N_RESUME = __('Resume'); +const I18N_DELETE = s__('Runners|Delete runner'); +const I18N_DELETED_TOAST = s__('Runners|Runner %{name} was deleted'); export default { name: 'RunnerActionsCell', components: { GlButton, GlButtonGroup, + RunnerDeleteModal, }, directives: { GlTooltip: GlTooltipDirective, + GlModal: GlModalDirective, }, props: { runner: { @@ -48,21 +50,29 @@ export default { // mouseout listeners don't run leaving the tooltip stuck return ''; } - return this.isActive ? i18n.I18N_PAUSE : i18n.I18N_RESUME; + return this.isActive ? I18N_PAUSE : I18N_RESUME; }, deleteTitle() { - // Prevent a "sticky" tooltip: If element gets removed, - // mouseout listeners don't run and leaving the tooltip stuck - return this.deleting ? '' : i18n.I18N_REMOVE; + if (this.deleting) { + // Prevent a "sticky" tooltip: If this button is disabled, + // mouseout listeners don't run leaving the tooltip stuck + return ''; + } + return I18N_DELETE; + }, + runnerId() { + return getIdFromGraphQLId(this.runner.id); + }, + runnerName() { + return `#${this.runnerId} (${this.runner.shortSha})`; + }, + runnerDeleteModalId() { + return `delete-runner-modal-${this.runnerId}`; }, }, methods: { async onToggleActive() { this.updating = true; - // TODO In HAML iteration we had a confirmation modal via: - // data-confirm="_('Are you sure?')" - // this may not have to ported, this is an easily reversible operation - try { const toggledActive = !this.runner.active; @@ -91,12 +101,8 @@ export default { }, async onDelete() { - // TODO Replace confirmation with gl-modal - // eslint-disable-next-line no-alert - if (!window.confirm(i18n.I18N_REMOVE_CONFIRMATION)) { - return; - } - + // Deleting stays "true" until this row is removed, + // should only change back if the operation fails. this.deleting = true; try { const { @@ -115,11 +121,13 @@ export default { }); if (errors && errors.length) { throw new Error(errors.join(' ')); + } else { + // Use $root to have the toast message stay after this element is removed + this.$root.$toast?.show(sprintf(I18N_DELETED_TOAST, { name: this.runnerName })); } } catch (e) { - this.onError(e); - } finally { this.deleting = false; + this.onError(e); } }, @@ -133,14 +141,15 @@ export default { captureException({ error, component: this.$options.name }); }, }, - i18n, + I18N_EDIT, + I18N_DELETE, }; </script> <template> <gl-button-group> <!-- - This button appears for administratos: those with + This button appears for administrators: those with access to the adminUrl. More advanced permissions policies will allow more granular permissions. @@ -148,16 +157,14 @@ export default { --> <gl-button v-if="runner.adminUrl" - v-gl-tooltip.hover.viewport + v-gl-tooltip.hover.viewport="$options.I18N_EDIT" :href="runner.adminUrl" - :title="$options.i18n.I18N_EDIT" - :aria-label="$options.i18n.I18N_EDIT" + :aria-label="$options.I18N_EDIT" icon="pencil" data-testid="edit-runner" /> <gl-button - v-gl-tooltip.hover.viewport - :title="toggleActiveTitle" + v-gl-tooltip.hover.viewport="toggleActiveTitle" :aria-label="toggleActiveTitle" :icon="toggleActiveIcon" :loading="updating" @@ -165,14 +172,20 @@ export default { @click="onToggleActive" /> <gl-button - v-gl-tooltip.hover.viewport - :title="deleteTitle" + v-gl-tooltip.hover.viewport="deleteTitle" + v-gl-modal="runnerDeleteModalId" :aria-label="deleteTitle" icon="close" :loading="deleting" variant="danger" data-testid="delete-runner" - @click="onDelete" + /> + + <runner-delete-modal + :ref="runnerDeleteModalId" + :modal-id="runnerDeleteModalId" + :runner-name="runnerName" + @primary="onDelete" /> </gl-button-group> </template> diff --git a/app/assets/javascripts/runner/components/runner_delete_modal.vue b/app/assets/javascripts/runner/components/runner_delete_modal.vue new file mode 100644 index 00000000000..8be216a7eb5 --- /dev/null +++ b/app/assets/javascripts/runner/components/runner_delete_modal.vue @@ -0,0 +1,51 @@ +<script> +import { GlModal } from '@gitlab/ui'; +import { __, s__, sprintf } from '~/locale'; + +const I18N_TITLE = s__('Runners|Delete runner %{name}?'); +const I18N_BODY = s__( + 'Runners|The runner will be permanently deleted and no longer available for projects or groups in the instance. Are you sure you want to continue?', +); +const I18N_PRIMARY = s__('Runners|Delete runner'); +const I18N_CANCEL = __('Cancel'); + +export default { + components: { + GlModal, + }, + props: { + runnerName: { + type: String, + required: true, + }, + }, + computed: { + title() { + return sprintf(I18N_TITLE, { name: this.runnerName }); + }, + }, + methods: { + onPrimary() { + this.$refs.modal.hide(); + }, + }, + actionPrimary: { text: I18N_PRIMARY, attributes: { variant: 'danger' } }, + actionCancel: { text: I18N_CANCEL }, + I18N_BODY, +}; +</script> + +<template> + <gl-modal + ref="modal" + size="sm" + :title="title" + :action-primary="$options.actionPrimary" + :action-cancel="$options.actionCancel" + v-bind="$attrs" + v-on="$listeners" + @primary="onPrimary" + > + {{ $options.I18N_BODY }} + </gl-modal> +</template> diff --git a/app/assets/javascripts/runner/components/runner_list.vue b/app/assets/javascripts/runner/components/runner_list.vue index d70a28a2421..f96eb0fa564 100644 --- a/app/assets/javascripts/runner/components/runner_list.vue +++ b/app/assets/javascripts/runner/components/runner_list.vue @@ -81,6 +81,7 @@ export default { :tbody-tr-attr="runnerTrAttr" data-testid="runner-list" stacked="md" + primary-key="id" fixed > <template v-if="!runners.length" #table-busy> diff --git a/app/assets/javascripts/sidebar/queries/update_merge_request_labels.mutation.graphql b/app/assets/javascripts/sidebar/queries/update_merge_request_labels.mutation.graphql index 016c31ea096..a48c9e96fc2 100644 --- a/app/assets/javascripts/sidebar/queries/update_merge_request_labels.mutation.graphql +++ b/app/assets/javascripts/sidebar/queries/update_merge_request_labels.mutation.graphql @@ -1,7 +1,7 @@ mutation mergeRequestSetLabels($input: MergeRequestSetLabelsInput!) { - mergeRequestSetLabels(input: $input) { + updateIssuableLabels: mergeRequestSetLabels(input: $input) { errors - mergeRequest { + issuable: mergeRequest { id labels { nodes { diff --git a/app/assets/javascripts/ui_development_kit.js b/app/assets/javascripts/ui_development_kit.js deleted file mode 100644 index 1a3fd6c77ed..00000000000 --- a/app/assets/javascripts/ui_development_kit.js +++ /dev/null @@ -1,28 +0,0 @@ -import $ from 'jquery'; -import initDeprecatedJQueryDropdown from '~/deprecated_jquery_dropdown'; -import Api from './api'; - -export default () => { - initDeprecatedJQueryDropdown($('#js-project-dropdown'), { - data: (term, callback) => { - Api.projects( - term, - { - order_by: 'last_activity_at', - }, - (data) => { - callback(data); - }, - ); - }, - text: (project) => project.name_with_namespace || project.name, - selectable: true, - fieldName: 'author_id', - filterable: true, - search: { - fields: ['name_with_namespace'], - }, - id: (data) => data.id, - isSelected: (data) => data.id === 2, - }); -}; diff --git a/app/assets/javascripts/vue_shared/components/sidebar/labels_select_widget/graphql/epic_update_labels.mutation.graphql b/app/assets/javascripts/vue_shared/components/sidebar/labels_select_widget/graphql/epic_update_labels.mutation.graphql index 45fcb50732e..cb054e2968f 100644 --- a/app/assets/javascripts/vue_shared/components/sidebar/labels_select_widget/graphql/epic_update_labels.mutation.graphql +++ b/app/assets/javascripts/vue_shared/components/sidebar/labels_select_widget/graphql/epic_update_labels.mutation.graphql @@ -1,8 +1,8 @@ #import "~/graphql_shared/fragments/label.fragment.graphql" mutation updateEpicLabels($input: UpdateEpicInput!) { - updateEpic(input: $input) { - epic { + updateIssuableLabels: updateEpic(input: $input) { + issuable: epic { id labels { nodes { diff --git a/app/assets/javascripts/vue_shared/components/sidebar/labels_select_widget/labels_select_root.vue b/app/assets/javascripts/vue_shared/components/sidebar/labels_select_widget/labels_select_root.vue index 79a00b2848f..8e776f70437 100644 --- a/app/assets/javascripts/vue_shared/components/sidebar/labels_select_widget/labels_select_root.vue +++ b/app/assets/javascripts/vue_shared/components/sidebar/labels_select_widget/labels_select_root.vue @@ -225,16 +225,13 @@ export default { variables: { input: inputVariables }, }) .then(({ data }) => { - const { mutationName } = issuableLabelsQueries[this.issuableType]; - - if (data[mutationName]?.errors?.length) { + if (data.updateIssuableLabels?.errors?.length) { throw new Error(); } - this.issuableLabels = data[mutationName]?.[this.issuableType]?.labels?.nodes; this.$emit('updateSelectedLabels', { - id: data[mutationName]?.[this.issuableType]?.id, - labels: this.issuableLabels, + id: data.updateIssuableLabels?.issuable?.id, + labels: data.updateIssuableLabels?.issuable?.labels?.nodes, }); }) .catch((error) => diff --git a/app/assets/stylesheets/page_bundles/ide.scss b/app/assets/stylesheets/page_bundles/ide.scss index 47580e37eca..d37171bc75e 100644 --- a/app/assets/stylesheets/page_bundles/ide.scss +++ b/app/assets/stylesheets/page_bundles/ide.scss @@ -904,6 +904,7 @@ $ide-commit-header-height: 48px; .sidebar-context-title { white-space: nowrap; display: block; + color: var(--ide-text-color, $gl-text-color); &.text-secondary { font-weight: normal; @@ -964,6 +965,10 @@ $ide-commit-header-height: 48px; margin: 0; } } + + .gl-tab-content { + color: var(--ide-text-color, $gl-text-color); + } } .ide-pipeline-header { diff --git a/app/controllers/groups_controller.rb b/app/controllers/groups_controller.rb index cf5b0e0c575..c1f892d0ffc 100644 --- a/app/controllers/groups_controller.rb +++ b/app/controllers/groups_controller.rb @@ -59,6 +59,8 @@ class GroupsController < Groups::ApplicationController feature_category :projects, [:projects] feature_category :importers, [:export, :download_export] + urgency :high, [:unfoldered_environment_names] + def index redirect_to(current_user ? dashboard_groups_path : explore_groups_path) end diff --git a/app/controllers/help_controller.rb b/app/controllers/help_controller.rb index e0020c22145..f267d383804 100644 --- a/app/controllers/help_controller.rb +++ b/app/controllers/help_controller.rb @@ -59,10 +59,6 @@ class HelpController < ApplicationController @instance_configuration = InstanceConfiguration.new end - def ui - @user = User.new(id: 0, name: 'John Doe', username: '@johndoe') - end - private def path_params diff --git a/app/controllers/omniauth_callbacks_controller.rb b/app/controllers/omniauth_callbacks_controller.rb index 9d7a1712698..1696eef09a8 100644 --- a/app/controllers/omniauth_callbacks_controller.rb +++ b/app/controllers/omniauth_callbacks_controller.rb @@ -162,6 +162,10 @@ class OmniauthCallbacksController < Devise::OmniauthCallbacksController user = auth_user.find_and_update! if auth_user.valid_sign_in? + # In this case the `#current_user` would not be set. So we can't fetch it + # from that in `#context_user`. Pushing it manually here makes the information + # available in the logs for this request. + Gitlab::ApplicationContext.push(user: user) log_audit_event(user, with: oauth['provider']) set_remember_me(user) @@ -287,10 +291,6 @@ class OmniauthCallbacksController < Devise::OmniauthCallbacksController def fail_admin_mode_invalid_credentials redirect_to new_admin_session_path, alert: _('Invalid login or password') end - - def context_user - current_user - end end OmniauthCallbacksController.prepend_mod_with('OmniauthCallbacksController') diff --git a/app/controllers/projects/merge_requests_controller.rb b/app/controllers/projects/merge_requests_controller.rb index 89949b82ae5..3cffa9136d6 100644 --- a/app/controllers/projects/merge_requests_controller.rb +++ b/app/controllers/projects/merge_requests_controller.rb @@ -79,6 +79,8 @@ class Projects::MergeRequestsController < Projects::MergeRequests::ApplicationCo feature_category :infrastructure_as_code, [:terraform_reports] feature_category :continuous_integration, [:pipeline_status, :pipelines, :exposed_artifacts] + urgency :high, [:export_csv] + def index @merge_requests = @issuables diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index b617ec7bda5..36f69028d6a 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -51,7 +51,9 @@ class ProjectsController < Projects::ApplicationController feature_category :team_planning, [:preview_markdown, :new_issuable_address] feature_category :importers, [:export, :remove_export, :generate_new_export, :download_export] feature_category :code_review, [:unfoldered_environment_names] + urgency :low, [:refs] + urgency :high, [:unfoldered_environment_names] def index redirect_to(current_user ? root_path : explore_root_path) diff --git a/app/controllers/search_controller.rb b/app/controllers/search_controller.rb index 38af6dd0cde..8690ef40a57 100644 --- a/app/controllers/search_controller.rb +++ b/app/controllers/search_controller.rb @@ -5,7 +5,7 @@ class SearchController < ApplicationController include SearchHelper include RedisTracking - RESCUE_FROM_TIMEOUT_ACTIONS = [:count, :show].freeze + RESCUE_FROM_TIMEOUT_ACTIONS = [:count, :show, :autocomplete].freeze track_redis_hll_event :show, name: 'i_search_total' @@ -74,11 +74,7 @@ class SearchController < ApplicationController def autocomplete term = params[:term] - if params[:project_id].present? - @project = Project.find_by(id: params[:project_id]) - @project = nil unless can?(current_user, :read_project, @project) - end - + @project = search_service.project @ref = params[:project_ref] if params[:project_ref].present? render json: search_autocomplete_opts(term).to_json @@ -189,17 +185,16 @@ class SearchController < ApplicationController @timeout = true - if count_action_name? + case action_name.to_sym + when :count render json: {}, status: :request_timeout + when :autocomplete + render json: [], status: :request_timeout else render status: :request_timeout end end - def count_action_name? - action_name.to_sym == :count - end - def strip_surrounding_whitespace_from_search %i(term search).each { |param| params[param]&.strip! } end diff --git a/app/presenters/packages/npm/package_presenter.rb b/app/presenters/packages/npm/package_presenter.rb index 9e3308c2573..c30dfa6196b 100644 --- a/app/presenters/packages/npm/package_presenter.rb +++ b/app/presenters/packages/npm/package_presenter.rb @@ -12,10 +12,9 @@ module Packages attr_reader :name, :packages - def initialize(name, packages, include_metadata: false) + def initialize(name, packages) @name = name @packages = packages - @include_metadata = include_metadata end def versions @@ -24,10 +23,7 @@ module Packages packages.each_batch do |relation| batched_packages = relation.including_dependency_links .preload_files - - if @include_metadata - batched_packages = batched_packages.preload_npm_metadatum - end + .preload_npm_metadatum batched_packages.each do |package| package_file = package.package_files.last @@ -92,8 +88,6 @@ module Packages end def abbreviated_package_json(package) - return {} unless @include_metadata - json = package.npm_metadatum&.package_json || {} json.slice(*PACKAGE_JSON_ALLOWED_FIELDS) end diff --git a/app/services/packages/npm/create_package_service.rb b/app/services/packages/npm/create_package_service.rb index ae9c92a3d3a..655616c3a28 100644 --- a/app/services/packages/npm/create_package_service.rb +++ b/app/services/packages/npm/create_package_service.rb @@ -23,9 +23,7 @@ module Packages ::Packages::CreateDependencyService.new(package, package_dependencies).execute ::Packages::Npm::CreateTagService.new(package, dist_tag).execute - if Feature.enabled?(:packages_npm_abbreviated_metadata, project, default_enabled: :yaml) - package.create_npm_metadatum!(package_json: package_json) - end + package.create_npm_metadatum!(package_json: package_json) package end |