From b46d41d54b05eab84bb9653c111124b67f573dd8 Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Tue, 31 Aug 2021 09:08:57 +0000 Subject: [PATCH] Add latest changes from gitlab-org/gitlab@master --- GITALY_SERVER_VERSION | 2 +- app/assets/javascripts/api.js | 8 +++ .../components/deploy_freeze_table.vue | 63 +++++++++++++++++- .../deploy_freeze/store/actions.js | 16 +++++ .../deploy_freeze/store/mutation_types.js | 4 ++ .../deploy_freeze/store/mutations.js | 33 +++++++-- .../environments/components/container.vue | 6 +- .../components/environment_item.vue | 10 +-- .../components/environments_app.vue | 5 -- .../components/environments_detail_header.vue | 8 +-- .../components/environments_table.vue | 7 -- .../folder/environments_folder_bundle.js | 3 - .../folder/environments_folder_view.vue | 5 -- app/assets/javascripts/environments/index.js | 2 - .../javascripts/environments/mount_show.js | 1 - .../components/blob_viewers/image_viewer.vue | 19 ++++++ .../components/blob_viewers/index.js | 6 ++ .../search/highlight_blob_search_result.js | 2 +- app/controllers/boards/issues_controller.rb | 4 +- app/controllers/registrations_controller.rb | 3 +- .../resolvers/board_list_issues_resolver.rb | 5 +- app/graphql/types/ci/stage_type.rb | 21 ++++-- app/helpers/environment_helper.rb | 1 - app/models/ci/pipeline.rb | 1 + app/models/concerns/cron_schedulable.rb | 8 +-- app/models/member.rb | 6 +- app/models/note.rb | 2 +- app/presenters/ci/build_presenter.rb | 8 +-- app/presenters/ci/stage_presenter.rb | 25 ++++--- app/services/boards/issues/list_service.rb | 8 +++ .../dast_profile_schedule_cadence.json | 31 +++++++++ app/views/admin/runners/show.html.haml | 2 +- app/views/projects/ci/builds/_build.html.haml | 6 +- app/views/search/results/_blob_data.html.haml | 2 +- ...instrumentation_disable_initialization.yml | 8 +++ config/initializers/zz_metrics.rb | 38 ++++++----- ...6_add_cadence_to_dast_profile_schedules.rb | 7 ++ ..._add_timezone_to_dast_profile_schedules.rb | 26 ++++++++ ...add_starts_at_to_dast_profile_schedules.rb | 7 ++ ..._dast_profile_to_dast_profile_schedules.rb | 38 +++++++++++ ...pound_index_from_dast_profile_schedules.rb | 30 +++++++++ ...dex_project_id_on_dast_profile_schedule.rb | 13 ++++ db/schema_migrations/20210807101446 | 1 + db/schema_migrations/20210807101621 | 1 + db/schema_migrations/20210807102004 | 1 + db/schema_migrations/20210816095826 | 1 + db/schema_migrations/20210818061156 | 1 + db/schema_migrations/20210818115613 | 1 + db/structure.sql | 10 ++- doc/ci/cloud_deployment/index.md | 2 +- doc/ci/environments/deployment_safety.md | 4 +- doc/ci/environments/incremental_rollouts.md | 2 +- doc/ci/environments/index.md | 2 +- doc/ci/environments/protected_environments.md | 2 +- doc/ci/pipeline_editor/index.md | 2 +- doc/ci/troubleshooting.md | 4 +- doc/ci/yaml/index.md | 4 +- doc/development/changelog.md | 1 + doc/user/application_security/dast/index.md | 6 +- .../offline_deployments/index.md | 2 +- doc/user/project/clusters/serverless/index.md | 2 +- .../test_coverage_visualization.md | 10 +-- doc/user/project/pages/index.md | 2 +- .../releases/img/deploy_freeze_v13_10.png | Bin 15902 -> 0 bytes .../releases/img/deploy_freeze_v14_3.png | Bin 0 -> 32558 bytes doc/user/project/releases/index.md | 12 ++-- lib/gitlab/ci/cron_parser.rb | 36 +++++++++- locale/gitlab.pot | 18 +++++ .../projects/pipelines_controller_spec.rb | 37 +++++++--- .../registrations_controller_spec.rb | 20 ++++++ spec/features/invites_spec.rb | 10 +++ .../components/deploy_freeze_table_spec.js | 26 ++++++++ .../deploy_freeze/store/actions_spec.js | 44 ++++++++++++ .../deploy_freeze/store/mutations_spec.js | 6 +- .../environments/environment_item_spec.js | 7 -- .../environments/environment_table_spec.js | 11 --- .../environments/environments_app_spec.js | 1 - .../environments_detail_header_spec.js | 8 +-- .../environments_folder_view_spec.js | 1 - .../folder/environments_folder_view_spec.js | 1 - .../blob_viewers/image_viewer_spec.js | 25 +++++++ .../highlight_blob_search_result_spec.js | 2 +- .../board_list_issues_resolver_spec.rb | 14 ++-- spec/helpers/environment_helper_spec.rb | 1 - spec/lib/gitlab/ci/cron_parser_spec.rb | 61 +++++++++++++++++ spec/lib/gitlab/import_export/all_models.yml | 1 + spec/models/member_spec.rb | 10 +++ spec/models/note_spec.rb | 8 +++ .../boards/board_list_issues_query_spec.rb | 14 ++-- .../api/graphql/project/pipeline_spec.rb | 12 +++- .../boards/issues/list_service_spec.rb | 47 +++++++++++++ 91 files changed, 802 insertions(+), 192 deletions(-) create mode 100644 app/assets/javascripts/repository/components/blob_viewers/image_viewer.vue create mode 100644 app/validators/json_schemas/dast_profile_schedule_cadence.json create mode 100644 config/feature_flags/development/method_instrumentation_disable_initialization.yml create mode 100644 db/migrate/20210807101446_add_cadence_to_dast_profile_schedules.rb create mode 100644 db/migrate/20210807101621_add_timezone_to_dast_profile_schedules.rb create mode 100644 db/migrate/20210807102004_add_starts_at_to_dast_profile_schedules.rb create mode 100644 db/migrate/20210816095826_add_unique_index_on_dast_profile_to_dast_profile_schedules.rb create mode 100644 db/migrate/20210818061156_remove_project_profile_compound_index_from_dast_profile_schedules.rb create mode 100644 db/migrate/20210818115613_add_index_project_id_on_dast_profile_schedule.rb create mode 100644 db/schema_migrations/20210807101446 create mode 100644 db/schema_migrations/20210807101621 create mode 100644 db/schema_migrations/20210807102004 create mode 100644 db/schema_migrations/20210816095826 create mode 100644 db/schema_migrations/20210818061156 create mode 100644 db/schema_migrations/20210818115613 delete mode 100644 doc/user/project/releases/img/deploy_freeze_v13_10.png create mode 100644 doc/user/project/releases/img/deploy_freeze_v14_3.png create mode 100644 spec/frontend/repository/components/blob_viewers/image_viewer_spec.js diff --git a/GITALY_SERVER_VERSION b/GITALY_SERVER_VERSION index 522c3806095..ff24873ca4c 100644 --- a/GITALY_SERVER_VERSION +++ b/GITALY_SERVER_VERSION @@ -1 +1 @@ -40fae4205d3ad62ca9341620146486bee8d31b28 +d924490032231edb9452acdaca7d8e4747cf6ab4 diff --git a/app/assets/javascripts/api.js b/app/assets/javascripts/api.js index 84a5d5ae4b3..01e463c1965 100644 --- a/app/assets/javascripts/api.js +++ b/app/assets/javascripts/api.js @@ -870,6 +870,14 @@ const Api = { return axios.put(url, freezePeriod); }, + deleteFreezePeriod(id, freezePeriodId) { + const url = Api.buildUrl(this.freezePeriodPath) + .replace(':id', encodeURIComponent(id)) + .replace(':freeze_period_id', encodeURIComponent(freezePeriodId)); + + return axios.delete(url); + }, + trackRedisCounterEvent(event) { if (!gon.features?.usageDataApi) { return null; diff --git a/app/assets/javascripts/deploy_freeze/components/deploy_freeze_table.vue b/app/assets/javascripts/deploy_freeze/components/deploy_freeze_table.vue index 8282f1d910a..77767456f76 100644 --- a/app/assets/javascripts/deploy_freeze/components/deploy_freeze_table.vue +++ b/app/assets/javascripts/deploy_freeze/components/deploy_freeze_table.vue @@ -1,5 +1,5 @@ @@ -72,6 +100,18 @@ export default { @click="setFreezePeriod(item)" /> + diff --git a/app/assets/javascripts/deploy_freeze/store/actions.js b/app/assets/javascripts/deploy_freeze/store/actions.js index fed80b46eda..a2056165cb2 100644 --- a/app/assets/javascripts/deploy_freeze/store/actions.js +++ b/app/assets/javascripts/deploy_freeze/store/actions.js @@ -52,6 +52,22 @@ export const updateFreezePeriod = (store) => }), ); +export const deleteFreezePeriod = ({ state, commit }, { id }) => { + commit(types.REQUEST_DELETE_FREEZE_PERIOD, id); + + return Api.deleteFreezePeriod(state.projectId, id) + .then(() => commit(types.RECEIVE_DELETE_FREEZE_PERIOD_SUCCESS, id)) + .catch((e) => { + createFlash({ + message: __('Error: Unable to delete deploy freeze'), + }); + commit(types.RECEIVE_DELETE_FREEZE_PERIOD_ERROR, id); + + // eslint-disable-next-line no-console + console.error('[gitlab] Unable to delete deploy freeze:', e); + }); +}; + export const fetchFreezePeriods = ({ commit, state }) => { commit(types.REQUEST_FREEZE_PERIODS); diff --git a/app/assets/javascripts/deploy_freeze/store/mutation_types.js b/app/assets/javascripts/deploy_freeze/store/mutation_types.js index 8e6fdfd4443..0fec96e2e4c 100644 --- a/app/assets/javascripts/deploy_freeze/store/mutation_types.js +++ b/app/assets/javascripts/deploy_freeze/store/mutation_types.js @@ -10,4 +10,8 @@ export const SET_SELECTED_ID = 'SET_SELECTED_ID'; export const SET_FREEZE_START_CRON = 'SET_FREEZE_START_CRON'; export const SET_FREEZE_END_CRON = 'SET_FREEZE_END_CRON'; +export const REQUEST_DELETE_FREEZE_PERIOD = 'REQUEST_DELETE_FREEZE_PERIOD'; +export const RECEIVE_DELETE_FREEZE_PERIOD_SUCCESS = 'RECEIVE_DELETE_FREEZE_PERIOD_SUCCESS'; +export const RECEIVE_DELETE_FREEZE_PERIOD_ERROR = 'RECEIVE_DELETE_FREEZE_PERIOD_ERROR'; + export const RESET_MODAL = 'RESET_MODAL'; diff --git a/app/assets/javascripts/deploy_freeze/store/mutations.js b/app/assets/javascripts/deploy_freeze/store/mutations.js index fdd1ea6e32e..151f7f39f5a 100644 --- a/app/assets/javascripts/deploy_freeze/store/mutations.js +++ b/app/assets/javascripts/deploy_freeze/store/mutations.js @@ -1,15 +1,28 @@ +import Vue from 'vue'; import { convertObjectPropsToCamelCase } from '~/lib/utils/common_utils'; +import { secondsToHours } from '~/lib/utils/datetime_utility'; import * as types from './mutation_types'; -const formatTimezoneName = (freezePeriod, timezoneList) => - convertObjectPropsToCamelCase({ +const formatTimezoneName = (freezePeriod, timezoneList) => { + const tz = timezoneList.find((timezone) => timezone.identifier === freezePeriod.cron_timezone); + return convertObjectPropsToCamelCase({ ...freezePeriod, cron_timezone: { - formattedTimezone: timezoneList.find((tz) => tz.identifier === freezePeriod.cron_timezone) - ?.name, + formattedTimezone: tz && `[UTC ${secondsToHours(tz.offset)}] ${tz.name}`, identifier: freezePeriod.cron_timezone, }, }); +}; + +const setFreezePeriodIsDeleting = (state, id, isDeleting) => { + const freezePeriod = state.freezePeriods.find((f) => f.id === id); + + if (!freezePeriod) { + return; + } + + Vue.set(freezePeriod, 'isDeleting', isDeleting); +}; export default { [types.REQUEST_FREEZE_PERIODS](state) { @@ -53,6 +66,18 @@ export default { state.selectedId = id; }, + [types.REQUEST_DELETE_FREEZE_PERIOD](state, id) { + setFreezePeriodIsDeleting(state, id, true); + }, + + [types.RECEIVE_DELETE_FREEZE_PERIOD_SUCCESS](state, id) { + state.freezePeriods = state.freezePeriods.filter((f) => f.id !== id); + }, + + [types.RECEIVE_DELETE_FREEZE_PERIOD_ERROR](state, id) { + setFreezePeriodIsDeleting(state, id, false); + }, + [types.RESET_MODAL](state) { state.freezeStartCron = ''; state.freezeEndCron = ''; diff --git a/app/assets/javascripts/environments/components/container.vue b/app/assets/javascripts/environments/components/container.vue index 9e058af56c4..cec53869aa8 100644 --- a/app/assets/javascripts/environments/components/container.vue +++ b/app/assets/javascripts/environments/components/container.vue @@ -22,10 +22,6 @@ export default { type: Object, required: true, }, - canReadEnvironment: { - type: Boolean, - required: true, - }, }, methods: { onChangePage(page) { @@ -42,7 +38,7 @@ export default {
- +