diff options
author | Rémy Coutable <remy@rymai.me> | 2018-07-10 13:20:05 +0000 |
---|---|---|
committer | Felipe Artur <felipefac@gmail.com> | 2018-07-17 17:59:54 -0300 |
commit | 230d13528ef6a48b8dac28cf63888aa9c042dc5d (patch) | |
tree | 8ad9111b7e1ac13f38a0cbf31e4ec2ff6428dbe6 | |
parent | 3cb46411acf2249013c52a900fdb48b99d3b2d44 (diff) | |
download | gitlab-ce-230d13528ef6a48b8dac28cf63888aa9c042dc5d.tar.gz |
Merge branch '48578-disable-gcp-free-credit-banner-at-instance-level' into '11-1-prepare-rc3'
Resolve "Disable GCP free credit banner at instance level"
Closes #48578
See merge request gitlab-org/gitlab-ce!20379
-rw-r--r-- | app/helpers/application_settings_helper.rb | 1 | ||||
-rw-r--r-- | app/helpers/clusters_helper.rb | 1 | ||||
-rw-r--r-- | app/models/application_setting.rb | 1 | ||||
-rw-r--r-- | app/views/admin/application_settings/_third_party_offers.html.haml | 13 | ||||
-rw-r--r-- | app/views/admin/application_settings/show.html.haml | 11 | ||||
-rw-r--r-- | changelogs/unreleased/48578-disable-gcp-free-credit-banner-at-instance-level.yml | 5 | ||||
-rw-r--r-- | db/migrate/20180704204006_add_hide_third_party_offers_to_application_settings.rb | 18 | ||||
-rw-r--r-- | db/schema.rb | 3 | ||||
-rw-r--r-- | doc/administration/index.md | 1 | ||||
-rw-r--r-- | doc/user/admin_area/settings/third_party_offers.md | 6 | ||||
-rw-r--r-- | locale/gitlab.pot | 189 | ||||
-rw-r--r-- | spec/features/admin/admin_settings_spec.rb | 10 |
12 files changed, 201 insertions, 58 deletions
diff --git a/app/helpers/application_settings_helper.rb b/app/helpers/application_settings_helper.rb index ef1bf283d0c..358b896702b 100644 --- a/app/helpers/application_settings_helper.rb +++ b/app/helpers/application_settings_helper.rb @@ -251,6 +251,7 @@ module ApplicationSettingsHelper :user_oauth_applications, :version_check_enabled, :allow_local_requests_from_hooks_and_services, + :hide_third_party_offers, :enforce_terms, :terms, :mirror_available diff --git a/app/helpers/clusters_helper.rb b/app/helpers/clusters_helper.rb index c24d340d184..8fd0b6f14c6 100644 --- a/app/helpers/clusters_helper.rb +++ b/app/helpers/clusters_helper.rb @@ -4,6 +4,7 @@ module ClustersHelper end def render_gcp_signup_offer + return if Gitlab::CurrentSettings.current_application_settings.hide_third_party_offers? return unless show_gcp_signup_offer? content_tag :section, class: 'no-animate expanded' do diff --git a/app/models/application_setting.rb b/app/models/application_setting.rb index bddeb8b0352..f770b219422 100644 --- a/app/models/application_setting.rb +++ b/app/models/application_setting.rb @@ -294,6 +294,7 @@ class ApplicationSetting < ActiveRecord::Base gitaly_timeout_medium: 30, gitaly_timeout_default: 55, allow_local_requests_from_hooks_and_services: false, + hide_third_party_offers: false, mirror_available: true } end diff --git a/app/views/admin/application_settings/_third_party_offers.html.haml b/app/views/admin/application_settings/_third_party_offers.html.haml new file mode 100644 index 00000000000..c5d775d4bf5 --- /dev/null +++ b/app/views/admin/application_settings/_third_party_offers.html.haml @@ -0,0 +1,13 @@ +- application_setting = local_assigns.fetch(:application_setting) + += form_for application_setting, url: admin_application_settings_path, html: { class: 'fieldset-form' } do |f| + = form_errors(application_setting) + + %fieldset + .form-group + .form-check + = f.check_box :hide_third_party_offers, class: 'form-check-input' + = f.label :hide_third_party_offers, class: 'form-check-label' do + Do not display offers from third parties within GitLab + + = f.submit 'Save changes', class: "btn btn-success" diff --git a/app/views/admin/application_settings/show.html.haml b/app/views/admin/application_settings/show.html.haml index bd43504dd37..5cb8001a364 100644 --- a/app/views/admin/application_settings/show.html.haml +++ b/app/views/admin/application_settings/show.html.haml @@ -325,5 +325,16 @@ .settings-content = render partial: 'repository_mirrors_form' +%section.settings.as-third-party-offers.no-animate#js-third-party-offers-settings{ class: ('expanded' if expanded) } + .settings-header + %h4 + = _('Third party offers') + %button.btn.btn-default.js-settings-toggle{ type: 'button' } + = expanded ? _('Collapse') : _('Expand') + %p + = _('Control the display of third party offers.') + .settings-content + = render 'third_party_offers', application_setting: @application_setting + = render_if_exists 'admin/application_settings/pseudonymizer_settings', expanded: expanded diff --git a/changelogs/unreleased/48578-disable-gcp-free-credit-banner-at-instance-level.yml b/changelogs/unreleased/48578-disable-gcp-free-credit-banner-at-instance-level.yml new file mode 100644 index 00000000000..575767df912 --- /dev/null +++ b/changelogs/unreleased/48578-disable-gcp-free-credit-banner-at-instance-level.yml @@ -0,0 +1,5 @@ +--- +title: Add option to hide third party offers in admin application settings +merge_request: 20379 +author: +type: added diff --git a/db/migrate/20180704204006_add_hide_third_party_offers_to_application_settings.rb b/db/migrate/20180704204006_add_hide_third_party_offers_to_application_settings.rb new file mode 100644 index 00000000000..6631c5d1b6c --- /dev/null +++ b/db/migrate/20180704204006_add_hide_third_party_offers_to_application_settings.rb @@ -0,0 +1,18 @@ +class AddHideThirdPartyOffersToApplicationSettings < ActiveRecord::Migration + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def up + add_column_with_default(:application_settings, :hide_third_party_offers, + :boolean, + default: false, + allow_null: false) + end + + def down + remove_column(:application_settings, :hide_third_party_offers) + end +end diff --git a/db/schema.rb b/db/schema.rb index 79091892441..d2aa31fae30 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20180702120647) do +ActiveRecord::Schema.define(version: 20180704204006) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -167,6 +167,7 @@ ActiveRecord::Schema.define(version: 20180702120647) do t.boolean "allow_local_requests_from_hooks_and_services", default: false, null: false t.boolean "enforce_terms", default: false t.boolean "mirror_available", default: true, null: false + t.boolean "hide_third_party_offers", default: false, null: false end create_table "audit_events", force: :cascade do |t| diff --git a/doc/administration/index.md b/doc/administration/index.md index 922cc45d8c4..88190b2df5f 100644 --- a/doc/administration/index.md +++ b/doc/administration/index.md @@ -45,6 +45,7 @@ Learn how to install, configure, update, and maintain your GitLab instance. - [Environment variables](environment_variables.md): Supported environment variables that can be used to override their defaults values in order to configure GitLab. - [Plugins](plugins.md): With custom plugins, GitLab administrators can introduce custom integrations without modifying GitLab's source code. - [Enforcing Terms of Service](../user/admin_area/settings/terms.md) +- [Third party offers](../user/admin_area/settings/third_party_offers.md) #### Customizing GitLab's appearance diff --git a/doc/user/admin_area/settings/third_party_offers.md b/doc/user/admin_area/settings/third_party_offers.md new file mode 100644 index 00000000000..177251b52b9 --- /dev/null +++ b/doc/user/admin_area/settings/third_party_offers.md @@ -0,0 +1,6 @@ +# Third party offers + +> [Introduced](https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/20379) +> in [GitLab Core](https://about.gitlab.com/pricing/) 11.1 + +The display of third party offers can be controlled in the Admin Area -> Settings page. diff --git a/locale/gitlab.pot b/locale/gitlab.pot index 1959ee27e40..f2e4eda576f 100644 --- a/locale/gitlab.pot +++ b/locale/gitlab.pot @@ -8,8 +8,8 @@ msgid "" msgstr "" "Project-Id-Version: gitlab 1.0.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-07-01 21:24+1000\n" -"PO-Revision-Date: 2018-07-01 21:24+1000\n" +"POT-Creation-Date: 2018-07-10 08:56+0200\n" +"PO-Revision-Date: 2018-07-10 08:56+0200\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" "Language: \n" @@ -369,9 +369,18 @@ msgstr "" msgid "Alternatively, you can use a %{personal_access_token_link}. When you create your Personal Access Token, you will need to select the <code>repo</code> scope, so we can display a list of your public and private repositories which are available to import." msgstr "" +msgid "An error accured whilst committing your changes." +msgstr "" + msgid "An error occured creating the new branch." msgstr "" +msgid "An error occured whilst fetching the job trace." +msgstr "" + +msgid "An error occured whilst fetching the latest pipline." +msgstr "" + msgid "An error occured whilst loading all the files." msgstr "" @@ -390,6 +399,9 @@ msgstr "" msgid "An error occured whilst loading the merge request." msgstr "" +msgid "An error occured whilst loading the pipelines jobs." +msgstr "" + msgid "An error occurred previewing the blob" msgstr "" @@ -1085,9 +1097,6 @@ msgstr "" msgid "ClusterIntegration|Add Kubernetes cluster" msgstr "" -msgid "ClusterIntegration|Add an existing Kubernetes cluster" -msgstr "" - msgid "ClusterIntegration|Advanced options on this Kubernetes cluster's integration" msgstr "" @@ -1109,9 +1118,6 @@ msgstr "" msgid "ClusterIntegration|Certificate Authority bundle (PEM format)" msgstr "" -msgid "ClusterIntegration|Choose how to set up Kubernetes cluster integration" -msgstr "" - msgid "ClusterIntegration|Choose which of your project's environments will use this Kubernetes cluster." msgstr "" @@ -1139,18 +1145,6 @@ msgstr "" msgid "ClusterIntegration|Create Kubernetes cluster" msgstr "" -msgid "ClusterIntegration|Create Kubernetes cluster on Google Kubernetes Engine" -msgstr "" - -msgid "ClusterIntegration|Create a new Kubernetes cluster on Google Kubernetes Engine right from GitLab" -msgstr "" - -msgid "ClusterIntegration|Create on Google Kubernetes Engine" -msgstr "" - -msgid "ClusterIntegration|Enter the details for an existing Kubernetes cluster" -msgstr "" - msgid "ClusterIntegration|Enter the details for your Kubernetes cluster" msgstr "" @@ -1650,6 +1644,9 @@ msgstr "" msgid "ContributorsPage|Please wait a moment, this page will automatically refresh when ready." msgstr "" +msgid "Control the display of third party offers." +msgstr "" + msgid "Copy URL to clipboard" msgstr "" @@ -1662,6 +1659,9 @@ msgstr "" msgid "Copy commit SHA to clipboard" msgstr "" +msgid "Copy file name to clipboard" +msgstr "" + msgid "Copy file path to clipboard" msgstr "" @@ -2102,9 +2102,18 @@ msgstr "" msgid "Environments|An error occurred while making the request." msgstr "" +msgid "Environments|An error occurred while stopping the environment, please try again" +msgstr "" + +msgid "Environments|Are you sure you want to stop this environment?" +msgstr "" + msgid "Environments|Commit" msgstr "" +msgid "Environments|Deploy to..." +msgstr "" + msgid "Environments|Deployment" msgstr "" @@ -2117,43 +2126,49 @@ msgstr "" msgid "Environments|Job" msgstr "" +msgid "Environments|Learn more about stopping environments" +msgstr "" + msgid "Environments|New environment" msgstr "" msgid "Environments|No deployments yet" msgstr "" -msgid "Environments|Open" +msgid "Environments|Note that this action will stop the environment, but it will %{emphasis_start}not%{emphasis_end} have an effect on any existing deployment due to no “stop environment action” being defined in the %{ci_config_link_start}.gitlab-ci.yml%{ci_config_link_end} file." +msgstr "" + +msgid "Environments|Open live environment" msgstr "" -msgid "Environments|Re-deploy" +msgid "Environments|Re-deploy to environment" msgstr "" msgid "Environments|Read more about environments" msgstr "" -msgid "Environments|Rollback" +msgid "Environments|Rollback environment" msgstr "" msgid "Environments|Show all" msgstr "" -msgid "Environments|Updated" +msgid "Environments|Stop" msgstr "" -msgid "Environments|You don't have any environments right now." +msgid "Environments|Stop environment" msgstr "" -msgid "Error Reporting and Logging" +msgid "Environments|Updated" msgstr "" -msgid "Error committing changes. Please try again." +msgid "Environments|You don't have any environments right now." msgstr "" -msgid "Error fetching contributors data." +msgid "Error Reporting and Logging" msgstr "" -msgid "Error fetching job trace" +msgid "Error fetching contributors data." msgstr "" msgid "Error fetching labels." @@ -2174,6 +2189,9 @@ msgstr "" msgid "Error loading last commit." msgstr "" +msgid "Error loading markdown preview" +msgstr "" + msgid "Error loading merge requests." msgstr "" @@ -2231,6 +2249,9 @@ msgstr "" msgid "Expand sidebar" msgstr "" +msgid "Explore groups" +msgstr "" + msgid "Explore projects" msgstr "" @@ -2446,6 +2467,27 @@ msgstr "" msgid "Groups can also be nested by creating %{subgroup_docs_link_start}subgroups%{subgroup_docs_link_end}." msgstr "" +msgid "GroupsDropdown|Frequently visited" +msgstr "" + +msgid "GroupsDropdown|Groups you visit often will appear here" +msgstr "" + +msgid "GroupsDropdown|Loading groups" +msgstr "" + +msgid "GroupsDropdown|Search your groups" +msgstr "" + +msgid "GroupsDropdown|Something went wrong on our end." +msgstr "" + +msgid "GroupsDropdown|Sorry, no groups matched your search" +msgstr "" + +msgid "GroupsDropdown|This feature requires browser localStorage support" +msgstr "" + msgid "GroupsEmptyState|A group is a collection of several projects." msgstr "" @@ -2628,7 +2670,7 @@ msgstr "" msgid "Introducing Cycle Analytics" msgstr "" -msgid "Issue Board" +msgid "Issue Boards" msgstr "" msgid "Issue events" @@ -2822,9 +2864,6 @@ msgstr "" msgid "Locked to current projects" msgstr "" -msgid "Login" -msgstr "" - msgid "Manage all notifications" msgstr "" @@ -2861,6 +2900,9 @@ msgstr "" msgid "Members" msgstr "" +msgid "Merge Request" +msgstr "" + msgid "Merge Request:" msgstr "" @@ -2903,12 +2945,42 @@ msgstr "" msgid "Messages" msgstr "" +msgid "Metrics" +msgstr "" + msgid "Metrics - Influx" msgstr "" msgid "Metrics - Prometheus" msgstr "" +msgid "Metrics|Check out the CI/CD documentation on deploying to an environment" +msgstr "" + +msgid "Metrics|Environment" +msgstr "" + +msgid "Metrics|Learn about environments" +msgstr "" + +msgid "Metrics|No deployed environments" +msgstr "" + +msgid "Metrics|There was an error fetching the environments data, please try again" +msgstr "" + +msgid "Metrics|There was an error getting deployment information." +msgstr "" + +msgid "Metrics|There was an error getting environments information." +msgstr "" + +msgid "Metrics|Unexpected deployment data response from prometheus endpoint" +msgstr "" + +msgid "Metrics|Unexpected metrics data response from prometheus endpoint" +msgstr "" + msgid "Milestone" msgstr "" @@ -2992,12 +3064,6 @@ msgid_plural "New Issues" msgstr[0] "" msgstr[1] "" -msgid "New Kubernetes Cluster" -msgstr "" - -msgid "New Kubernetes cluster" -msgstr "" - msgid "New Label" msgstr "" @@ -3214,6 +3280,9 @@ msgstr "" msgid "Only project members can comment." msgstr "" +msgid "Oops, are you sure?" +msgstr "" + msgid "Open in Xcode" msgstr "" @@ -3502,6 +3571,9 @@ msgstr "" msgid "Profiles|Account scheduled for removal." msgstr "" +msgid "Profiles|Add key" +msgstr "" + msgid "Profiles|Change username" msgstr "" @@ -3529,9 +3601,15 @@ msgstr "" msgid "Profiles|Path" msgstr "" +msgid "Profiles|This doesn't look like a public SSH key, are you sure you want to add it?" +msgstr "" + msgid "Profiles|Type your %{confirmationValue} to confirm:" msgstr "" +msgid "Profiles|Typically starts with \"ssh-rsa …\"" +msgstr "" + msgid "Profiles|Update username" msgstr "" @@ -3550,6 +3628,9 @@ msgstr "" msgid "Profiles|Your account is currently an owner in these groups:" msgstr "" +msgid "Profiles|e.g. My MacBook key" +msgstr "" + msgid "Profiles|your account" msgstr "" @@ -3637,9 +3718,6 @@ msgstr "" msgid "ProjectsDropdown|Sorry, no projects matched your search" msgstr "" -msgid "ProjectsDropdown|This feature requires browser localStorage support" -msgstr "" - msgid "PrometheusDashboard|Time" msgstr "" @@ -3745,9 +3823,6 @@ msgstr "" msgid "Quick actions can be used in the issues description and comment boxes." msgstr "" -msgid "Re-deploy" -msgstr "" - msgid "Read more" msgstr "" @@ -3882,9 +3957,6 @@ msgstr "" msgid "Reviewing (merge request !%{mergeRequestId})" msgstr "" -msgid "Rollback" -msgstr "" - msgid "Runner token" msgstr "" @@ -4525,12 +4597,6 @@ msgstr "" msgid "There are problems accessing Git storage: " msgstr "" -msgid "There was an error loading jobs" -msgstr "" - -msgid "There was an error loading latest pipeline" -msgstr "" - msgid "There was an error loading users activity calendar." msgstr "" @@ -4552,6 +4618,9 @@ msgstr "" msgid "They can be managed using the %{link}." msgstr "" +msgid "Third party offers" +msgstr "" + msgid "This GitLab instance does not provide any shared Runners yet. Instance administrators can register shared Runners in the admin area." msgstr "" @@ -4811,6 +4880,9 @@ msgstr "" msgid "Tip:" msgstr "" +msgid "Title" +msgstr "" + msgid "To GitLab" msgstr "" @@ -5179,6 +5251,9 @@ msgstr "" msgid "Yes" msgstr "" +msgid "Yes, add it" +msgstr "" + msgid "You are going to remove %{group_name}. Removed groups CANNOT be restored! Are you ABSOLUTELY sure?" msgstr "" @@ -5438,6 +5513,9 @@ msgstr "" msgid "mrWidget|Merged by" msgstr "" +msgid "mrWidget|Open in Web IDE" +msgstr "" + msgid "mrWidget|Plain diff" msgstr "" @@ -5507,9 +5585,6 @@ msgstr "" msgid "mrWidget|This project is archived, write access has been disabled" msgstr "" -msgid "mrWidget|Web IDE" -msgstr "" - msgid "mrWidget|You can merge this merge request manually using the" msgstr "" diff --git a/spec/features/admin/admin_settings_spec.rb b/spec/features/admin/admin_settings_spec.rb index 9c6758abe86..a852ca689e7 100644 --- a/spec/features/admin/admin_settings_spec.rb +++ b/spec/features/admin/admin_settings_spec.rb @@ -272,6 +272,16 @@ describe 'Admin updates settings' do expect(Gitlab::CurrentSettings.allow_local_requests_from_hooks_and_services).to be true end + it 'Enable hiding third party offers' do + page.within('.as-third-party-offers') do + check 'Do not display offers from third parties within GitLab' + click_button 'Save changes' + end + + expect(page).to have_content "Application settings saved successfully" + expect(Gitlab::CurrentSettings.hide_third_party_offers).to be true + end + it 'Change Slack Notifications Service template settings' do first(:link, 'Service Templates').click click_link 'Slack notifications' |