From 2baf0eca39c55603848b667087cfd0471c5ac9bb Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Tue, 13 Sep 2022 06:14:22 +0000 Subject: [PATCH] Add latest changes from gitlab-org/gitlab@master --- .../list/components/issues_list_app.vue | 44 ++++++++++++------- app/assets/stylesheets/utilities.scss | 13 ++++++ app/models/application_setting.rb | 5 +++ .../development/cube_api_proxy.yml | 8 ++++ .../group_ip_restrictions_allow_global.yml | 8 ---- ...dd_cube_api_key_to_application_settings.rb | 11 +++++ ...928_add_text_limit_to_cube_api_base_url.rb | 13 ++++++ db/schema_migrations/20220825105631 | 1 + db/schema_migrations/20220830082928 | 1 + db/structure.sql | 4 ++ .../visibility_and_access_controls.md | 9 +--- .../group/value_stream_analytics/index.md | 20 ++++++--- package.json | 2 +- .../list/components/issues_list_app_spec.js | 12 +++-- yarn.lock | 8 ++-- 15 files changed, 113 insertions(+), 46 deletions(-) create mode 100644 config/feature_flags/development/cube_api_proxy.yml delete mode 100644 config/feature_flags/development/group_ip_restrictions_allow_global.yml create mode 100644 db/migrate/20220825105631_add_cube_api_key_to_application_settings.rb create mode 100644 db/migrate/20220830082928_add_text_limit_to_cube_api_base_url.rb create mode 100644 db/schema_migrations/20220825105631 create mode 100644 db/schema_migrations/20220830082928 diff --git a/app/assets/javascripts/issues/list/components/issues_list_app.vue b/app/assets/javascripts/issues/list/components/issues_list_app.vue index a3d4bb668e2..0b424d105b9 100644 --- a/app/assets/javascripts/issues/list/components/issues_list_app.vue +++ b/app/assets/javascripts/issues/list/components/issues_list_app.vue @@ -38,6 +38,7 @@ import { TOKEN_TITLE_ORGANIZATION, TOKEN_TITLE_RELEASE, TOKEN_TITLE_TYPE, + FILTERED_SEARCH_TERM, } from '~/vue_shared/components/filtered_search_bar/constants'; import IssuableList from '~/vue_shared/issuable/list/components/issuable_list_root.vue'; import { IssuableListTabs, IssuableStates } from '~/vue_shared/issuable/list/constants'; @@ -466,6 +467,9 @@ export default { issuesHelpPagePath() { return helpPagePath('user/project/issues/index'); }, + shouldDisableSomeFilters() { + return this.isAnonymousSearchDisabled && !this.isSignedIn; + }, }, watch: { $route(newValue, oldValue) { @@ -582,13 +586,9 @@ export default { this.issuesError = null; }, handleFilter(filter) { - if (this.isAnonymousSearchDisabled && !this.isSignedIn) { - this.showAnonymousSearchingMessage(); - return; - } + this.setFilterTokens(filter); this.pageParams = getInitialPageParams(this.pageSize); - this.filterTokens = filter; this.$router.push({ query: this.urlParams }); }, @@ -678,6 +678,28 @@ export default { Sentry.captureException(error); }); }, + setFilterTokens(filtersArg) { + const filters = this.removeDisabledSearchTerms(filtersArg); + + this.filterTokens = filters; + + // If we filtered something out, let's show a warning message + if (filters.length < filtersArg.length) { + this.showAnonymousSearchingMessage(); + } + }, + removeDisabledSearchTerms(filters) { + // If we shouldn't disable anything, let's return the same thing + if (!this.shouldDisableSomeFilters) { + return filters; + } + + const filtersWithoutSearchTerms = filters.filter( + (token) => !(token.type === FILTERED_SEARCH_TERM && token.value?.data), + ); + + return filtersWithoutSearchTerms; + }, showAnonymousSearchingMessage() { createFlash({ message: this.$options.i18n.anonymousSearchingMessage, @@ -724,17 +746,9 @@ export default { sortKey = defaultSortKey; } - const isSearchDisabled = - this.isAnonymousSearchDisabled && - !this.isSignedIn && - window.location.search.includes('search='); - - if (isSearchDisabled) { - this.showAnonymousSearchingMessage(); - } - this.exportCsvPathWithQuery = this.getExportCsvPathWithQuery(); - this.filterTokens = isSearchDisabled ? [] : getFilterTokens(window.location.search); + this.setFilterTokens(getFilterTokens(window.location.search)); + this.pageParams = getInitialPageParams( this.pageSize, isPositiveInteger(firstPageSize) ? parseInt(firstPageSize, 10) : undefined, diff --git a/app/assets/stylesheets/utilities.scss b/app/assets/stylesheets/utilities.scss index 6bd05f90f26..6cc4d166af7 100644 --- a/app/assets/stylesheets/utilities.scss +++ b/app/assets/stylesheets/utilities.scss @@ -285,6 +285,19 @@ $gl-line-height-42: px-to-rem(42px); padding-right: $gl-spacing-scale-10; } +// TODO: will be moved to @gitlab/ui as part of https://gitlab.com/gitlab-org/gitlab/-/issues/349008 +.gl-sm-mt-6 { + @include media-breakpoint-up(sm) { + margin-top: $gl-spacing-scale-6; + } +} + +.gl-sm-mt-6\! { + @include media-breakpoint-up(sm) { + margin-top: $gl-spacing-scale-6 !important; + } +} + /* All of the following (up until the "End gitlab-ui#1709" comment) will be moved to @gitlab/ui by https://gitlab.com/gitlab-org/gitlab-ui/-/issues/1709 diff --git a/app/models/application_setting.rb b/app/models/application_setting.rb index 3590faa818a..edb9a2053b1 100644 --- a/app/models/application_setting.rb +++ b/app/models/application_setting.rb @@ -625,6 +625,10 @@ class ApplicationSetting < ApplicationRecord validates :inactive_projects_send_warning_email_after_months, numericality: { only_integer: true, greater_than: 0, less_than: :inactive_projects_delete_after_months } + validates :cube_api_base_url, + addressable_url: { allow_localhost: true, allow_local_network: false }, + allow_blank: true + attr_encrypted :asset_proxy_secret_key, mode: :per_attribute_iv, key: Settings.attr_encrypted_db_key_base_truncated, @@ -662,6 +666,7 @@ class ApplicationSetting < ApplicationRecord attr_encrypted :database_grafana_api_key, encryption_options_base_32_aes_256_gcm.merge(encode: false, encode_iv: false) attr_encrypted :arkose_labs_public_api_key, encryption_options_base_32_aes_256_gcm.merge(encode: false, encode_iv: false) attr_encrypted :arkose_labs_private_api_key, encryption_options_base_32_aes_256_gcm.merge(encode: false, encode_iv: false) + attr_encrypted :cube_api_key, encryption_options_base_32_aes_256_gcm validates :disable_feed_token, inclusion: { in: [true, false], message: _('must be a boolean value') } diff --git a/config/feature_flags/development/cube_api_proxy.yml b/config/feature_flags/development/cube_api_proxy.yml new file mode 100644 index 00000000000..06dcefb1303 --- /dev/null +++ b/config/feature_flags/development/cube_api_proxy.yml @@ -0,0 +1,8 @@ +--- +name: cube_api_proxy +introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/96250 +rollout_issue_url: +milestone: '15.4' +type: development +group: group::product_analytics +default_enabled: false diff --git a/config/feature_flags/development/group_ip_restrictions_allow_global.yml b/config/feature_flags/development/group_ip_restrictions_allow_global.yml deleted file mode 100644 index 87cfa5e8b1b..00000000000 --- a/config/feature_flags/development/group_ip_restrictions_allow_global.yml +++ /dev/null @@ -1,8 +0,0 @@ ---- -name: group_ip_restrictions_allow_global -introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/87579 -rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/362603 -milestone: '15.1' -type: development -group: group::source code -default_enabled: false diff --git a/db/migrate/20220825105631_add_cube_api_key_to_application_settings.rb b/db/migrate/20220825105631_add_cube_api_key_to_application_settings.rb new file mode 100644 index 00000000000..6ee5ad52315 --- /dev/null +++ b/db/migrate/20220825105631_add_cube_api_key_to_application_settings.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +class AddCubeApiKeyToApplicationSettings < Gitlab::Database::Migration[2.0] + def change + # rubocop:disable Migration/AddLimitToTextColumns + add_column :application_settings, :cube_api_base_url, :text + add_column :application_settings, :encrypted_cube_api_key, :binary + add_column :application_settings, :encrypted_cube_api_key_iv, :binary + # rubocop:enable Migration/AddLimitToTextColumns + end +end diff --git a/db/migrate/20220830082928_add_text_limit_to_cube_api_base_url.rb b/db/migrate/20220830082928_add_text_limit_to_cube_api_base_url.rb new file mode 100644 index 00000000000..7bab796a47f --- /dev/null +++ b/db/migrate/20220830082928_add_text_limit_to_cube_api_base_url.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +class AddTextLimitToCubeApiBaseUrl < Gitlab::Database::Migration[2.0] + disable_ddl_transaction! + + def up + add_text_limit :application_settings, :cube_api_base_url, 512 + end + + def down + remove_text_limit :application_settings, :cube_api_base_url + end +end diff --git a/db/schema_migrations/20220825105631 b/db/schema_migrations/20220825105631 new file mode 100644 index 00000000000..6d6691cc6a4 --- /dev/null +++ b/db/schema_migrations/20220825105631 @@ -0,0 +1 @@ +2e5f7b79076a35fdb61aec46dea27d45f81e47c20f962f12b494fc7a8c714813 \ No newline at end of file diff --git a/db/schema_migrations/20220830082928 b/db/schema_migrations/20220830082928 new file mode 100644 index 00000000000..9c7cf011ab7 --- /dev/null +++ b/db/schema_migrations/20220830082928 @@ -0,0 +1 @@ +4d7bde950a405f424c0bf3828d21e6bfd16746e091e177abfb397114c5b5b53c \ No newline at end of file diff --git a/db/structure.sql b/db/structure.sql index 7c04c42fd71..c591f79b119 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -11511,6 +11511,9 @@ CREATE TABLE application_settings ( deactivate_dormant_users_period integer DEFAULT 90 NOT NULL, auto_ban_user_on_excessive_projects_download boolean DEFAULT false NOT NULL, max_pages_custom_domains_per_project integer DEFAULT 0 NOT NULL, + cube_api_base_url text, + encrypted_cube_api_key bytea, + encrypted_cube_api_key_iv bytea, CONSTRAINT app_settings_container_reg_cleanup_tags_max_list_size_positive CHECK ((container_registry_cleanup_tags_service_max_list_size >= 0)), CONSTRAINT app_settings_container_registry_pre_import_tags_rate_positive CHECK ((container_registry_pre_import_tags_rate >= (0)::numeric)), CONSTRAINT app_settings_dep_proxy_ttl_policies_worker_capacity_positive CHECK ((dependency_proxy_ttl_group_policy_worker_capacity >= 0)), @@ -11542,6 +11545,7 @@ CREATE TABLE application_settings ( CONSTRAINT check_7ccfe2764a CHECK ((char_length(arkose_labs_namespace) <= 255)), CONSTRAINT check_85a39b68ff CHECK ((char_length(encrypted_ci_jwt_signing_key_iv) <= 255)), CONSTRAINT check_8dca35398a CHECK ((char_length(public_runner_releases_url) <= 255)), + CONSTRAINT check_8e7df605a1 CHECK ((char_length(cube_api_base_url) <= 512)), CONSTRAINT check_9a719834eb CHECK ((char_length(secret_detection_token_revocation_url) <= 255)), CONSTRAINT check_9c6c447a13 CHECK ((char_length(maintenance_mode_message) <= 255)), CONSTRAINT check_a5704163cc CHECK ((char_length(secret_detection_revocation_token_types_url) <= 255)), diff --git a/doc/user/admin_area/settings/visibility_and_access_controls.md b/doc/user/admin_area/settings/visibility_and_access_controls.md index 118d375da01..551191433bd 100644 --- a/doc/user/admin_area/settings/visibility_and_access_controls.md +++ b/doc/user/admin_area/settings/visibility_and_access_controls.md @@ -277,13 +277,8 @@ work in every repository. They can only be re-enabled by an administrator user o ## Configure globally-allowed IP address ranges -> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/87579) in GitLab 15.1 [with a flag](../../../administration/feature_flags.md) named `group_ip_restrictions_allow_global`. Disabled by default. - -FLAG: -On self-managed GitLab, by default this feature is not available. To make it available -per group, ask an administrator to [enable the feature flag](../../../administration/feature_flags.md) -named `group_ip_restrictions_allow_global`. -On GitLab.com, this feature is available. +> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/87579) in GitLab 15.1 [with a flag](../../../administration/feature_flags.md) named `group_ip_restrictions_allow_global`. Disabled by default. +> - [Generally available](https://gitlab.com/gitlab-org/gitlab/-/issues/366445) in GitLab 15.4. [Feature flag `group_ip_restrictions_allow_global`](https://gitlab.com/gitlab-org/gitlab/-/issues/366445) removed. This setting allows you to set IP address ranges to be combined with group-level IP allowlists. It helps administrators prevent aspects of the GitLab installation from being blocked diff --git a/doc/user/group/value_stream_analytics/index.md b/doc/user/group/value_stream_analytics/index.md index 1e3e27f19bb..cdc33b9ab30 100644 --- a/doc/user/group/value_stream_analytics/index.md +++ b/doc/user/group/value_stream_analytics/index.md @@ -349,13 +349,19 @@ The chart shows data for the last 500 workflow items. - In the **From** field, select a start date. - In the **To** field, select an end date. -## Tasks by type chart +## View tasks by type -This chart shows a cumulative count of issues and merge requests per day. +The **Tasks by type** chart displays the cumulative number of issues and merge requests per day for your group. -This chart uses the global page filters for displaying data based on the selected -group, projects, and time frame. The chart defaults to showing counts for issues but can be -toggled to show data for merge requests and further refined for specific group-level labels. +The chart uses the global page filters to display data based on the selected +group, projects, and time frame. -By default the top group-level labels (max. 10) are pre-selected, with the ability to -select up to a total of 15 labels. +To view tasks by type: + +1. On the top bar, select **Menu > Groups** and find your group. +1. On the left sidebar, select **Analytics > Value stream**. +1. Below the **Filter results** text box, select **Overview**. The **Tasks by type** chart displays below the **Total time** chart. +1. To switch between the task type, select the **Settings** (**{settings}**) dropdown list + and select **Issues** or **Merge Requests**. +1. To add or remove labels, select the **Settings** (**{settings}**) dropdown list + and select or search for a label. By default the top group-level labels (maximum 10) are selected. You can select a maximum of 15 labels. diff --git a/package.json b/package.json index 58fe61d76ed..5242ede8a09 100644 --- a/package.json +++ b/package.json @@ -53,7 +53,7 @@ "@gitlab/at.js": "1.5.7", "@gitlab/favicon-overlay": "2.0.0", "@gitlab/svgs": "3.3.0", - "@gitlab/ui": "43.14.0", + "@gitlab/ui": "43.16.0", "@gitlab/visual-review-tools": "1.7.3", "@gitlab/web-ide": "0.0.1-dev-20220815034418", "@rails/actioncable": "6.1.4-7", diff --git a/spec/frontend/issues/list/components/issues_list_app_spec.js b/spec/frontend/issues/list/components/issues_list_app_spec.js index fb25ab4c28d..83c11f5d356 100644 --- a/spec/frontend/issues/list/components/issues_list_app_spec.js +++ b/spec/frontend/issues/list/components/issues_list_app_spec.js @@ -59,6 +59,8 @@ import { WORK_ITEM_TYPE_ENUM_TEST_CASE, } from '~/work_items/constants'; +import { FILTERED_SEARCH_TERM } from '~/vue_shared/components/filtered_search_bar/constants'; + jest.mock('@sentry/browser'); jest.mock('~/flash'); jest.mock('~/lib/utils/scroll_utils', () => ({ scrollUp: jest.fn() })); @@ -429,8 +431,9 @@ describe('CE IssuesListApp component', () => { }); }); - it('is not set from url params', () => { - expect(findIssuableList().props('initialFilterValue')).toEqual([]); + it('is set from url params and removes search terms', () => { + const expected = filteredTokens.filter((token) => token.type !== FILTERED_SEARCH_TERM); + expect(findIssuableList().props('initialFilterValue')).toEqual(expected); }); it('shows an alert to tell the user they must be signed in to search', () => { @@ -1006,8 +1009,9 @@ describe('CE IssuesListApp component', () => { findIssuableList().vm.$emit('filter', filteredTokens); }); - it('does not update url params', () => { - expect(router.push).not.toHaveBeenCalled(); + it('removes search terms', () => { + const expected = filteredTokens.filter((token) => token.type !== FILTERED_SEARCH_TERM); + expect(findIssuableList().props('initialFilterValue')).toEqual(expected); }); it('shows an alert to tell the user they must be signed in to search', () => { diff --git a/yarn.lock b/yarn.lock index 7b20a766bc8..a0e22985f97 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1064,10 +1064,10 @@ resolved "https://registry.yarnpkg.com/@gitlab/svgs/-/svgs-3.3.0.tgz#99b044484fcf3d5a6431281e320e2405540ff5a9" integrity sha512-S8Hqf+ms8aNrSgmci9SVoIyj/0qQnizU5uV5vUPAOwiufMDFDyI5qfcgn4EYZ6mnju3LiO+ReSL/PPTD4qNgHA== -"@gitlab/ui@43.14.0": - version "43.14.0" - resolved "https://registry.yarnpkg.com/@gitlab/ui/-/ui-43.14.0.tgz#3f68f73977ad1e5403326af3dc9f6569f527c06b" - integrity sha512-tUqJ4c77m0rr3py9yEJG3+kANzs0Kao03Yi/7aaNsYMjzYBtt5V0fm0iQrv9plUl+vli2k+TFNYqf5MVxu6XZA== +"@gitlab/ui@43.16.0": + version "43.16.0" + resolved "https://registry.yarnpkg.com/@gitlab/ui/-/ui-43.16.0.tgz#cb383b5ca95b7b3d3fbb5d134a71676050c0aa20" + integrity sha512-wdB2Mjto7UgLaeeW6mSmUiWW2xxhl98msB18kcDFqth2cJ59JHvA6eUydmt8Es6pJ9kKj7MLUiC64wEaNgpQBA== dependencies: "@popperjs/core" "^2.11.2" bootstrap-vue "2.20.1"