Read about our upcoming Code of Conduct on this issue

Commit 05524517 authored by GitLab Bot's avatar GitLab Bot
Browse files

Add latest changes from gitlab-org/gitlab@12-10-stable-ee

parent 17702284fc34
......@@ -37,7 +37,7 @@ If applicable, any groups/projects that are happy to have this feature turned on
- [ ] Coordinate a time to enable the flag with `#production` and `#g_delivery` on slack.
- [ ] Announce on the issue an estimated time this will be enabled on GitLab.com
- [ ] Enable on GitLab.com by running chatops command in `#production`
- [ ] Cross post chatops slack command to `#support_gitlab-com` and in your team channel
- [ ] Cross post chatops slack command to `#support_gitlab-com` ([more guidance when this is necessary in the dev docs](https://docs.gitlab.com/ee/development/feature_flags/controls.html#where-to-run-commands)) and in your team channel
- [ ] Announce on the issue that the flag has been enabled
- [ ] Remove feature flag and add changelog entry
- [ ] After the flag removal is deployed, [clean up the feature flag](https://docs.gitlab.com/ee/development/feature_flags/controls.html#cleaning-up) by running chatops command in `#production` channel
......
This diff is collapsed.
<script>
import { mapActions, mapState } from 'vuex';
import { mapActions, mapGetters, mapState } from 'vuex';
import { GlAlert, GlSprintf, GlLink } from '@gitlab/ui';
import { s__ } from '~/locale';
......@@ -15,8 +15,15 @@ export default {
GlLink,
},
i18n: {
unavailableFeatureText: s__(
'ContainerRegistry|Currently, the Container Registry tag expiration feature is not available for projects created before GitLab version 12.8. For updates and more information, visit Issue %{linkStart}#196124%{linkEnd}',
unavailableFeatureTitle: s__(
`ContainerRegistry|Container Registry tag expiration and retention policy is disabled`,
),
unavailableFeatureIntroText: s__(
`ContainerRegistry|The Container Registry tag expiration and retention policies for this project have not been enabled.`,
),
unavailableUserFeatureText: s__(`ContainerRegistry|Please contact your administrator.`),
unavailableAdminFeatureText: s__(
`ContainerRegistry| Please visit the %{linkStart}administration settings%{linkEnd} to enable this feature.`,
),
fetchSettingsErrorText: FETCH_SETTINGS_ERROR_MESSAGE,
},
......@@ -26,10 +33,19 @@ export default {
};
},
computed: {
...mapState(['isDisabled']),
...mapState(['isAdmin', 'adminSettingsPath']),
...mapGetters({ isDisabled: 'getIsDisabled' }),
showSettingForm() {
return !this.isDisabled && !this.fetchSettingsError;
},
showDisabledFormMessage() {
return this.isDisabled && !this.fetchSettingsError;
},
unavailableFeatureMessage() {
return this.isAdmin
? this.$options.i18n.unavailableAdminFeatureText
: this.$options.i18n.unavailableUserFeatureText;
},
},
mounted() {
this.fetchSettings().catch(() => {
......@@ -59,16 +75,21 @@ export default {
</ul>
<settings-form v-if="showSettingForm" />
<template v-else>
<gl-alert v-if="isDisabled" :dismissible="false">
<p>
<gl-sprintf :message="$options.i18n.unavailableFeatureText">
<template #link="{content}">
<gl-link href="https://gitlab.com/gitlab-org/gitlab/issues/196124" target="_blank">
{{ content }}
</gl-link>
</template>
</gl-sprintf>
</p>
<gl-alert
v-if="showDisabledFormMessage"
:dismissible="false"
:title="$options.i18n.unavailableFeatureTitle"
variant="tip"
>
{{ $options.i18n.unavailableFeatureIntroText }}
<gl-sprintf :message="unavailableFeatureMessage">
<template #link="{ content }">
<gl-link :href="adminSettingsPath" target="_blank">
{{ content }}
</gl-link>
</template>
</gl-sprintf>
</gl-alert>
<gl-alert v-else-if="fetchSettingsError" variant="warning" :dismissible="false">
<gl-sprintf :message="$options.i18n.fetchSettingsErrorText" />
......
......@@ -5,11 +5,7 @@ export const setInitialState = ({ commit }, data) => commit(types.SET_INITIAL_ST
export const updateSettings = ({ commit }, data) => commit(types.UPDATE_SETTINGS, data);
export const toggleLoading = ({ commit }) => commit(types.TOGGLE_LOADING);
export const receiveSettingsSuccess = ({ commit }, data) => {
if (data) {
commit(types.SET_SETTINGS, data);
} else {
commit(types.SET_IS_DISABLED, true);
}
commit(types.SET_SETTINGS, data);
};
export const resetSettings = ({ commit }) => commit(types.RESET_SETTINGS);
......
......@@ -19,3 +19,7 @@ export const getSettings = (state, getters) => ({
});
export const getIsEdited = state => !isEqual(state.original, state.settings);
export const getIsDisabled = state => {
return !(state.original || state.enableHistoricEntries);
};
......@@ -3,4 +3,3 @@ export const UPDATE_SETTINGS = 'UPDATE_SETTINGS';
export const TOGGLE_LOADING = 'TOGGLE_LOADING';
export const SET_SETTINGS = 'SET_SETTINGS';
export const RESET_SETTINGS = 'RESET_SETTINGS';
export const SET_IS_DISABLED = 'SET_IS_DISABLED';
import { parseBoolean } from '~/lib/utils/common_utils';
import * as types from './mutation_types';
export default {
......@@ -8,19 +9,19 @@ export default {
keepN: JSON.parse(initialState.keepNOptions),
olderThan: JSON.parse(initialState.olderThanOptions),
};
state.enableHistoricEntries = parseBoolean(initialState.enableHistoricEntries);
state.isAdmin = parseBoolean(initialState.isAdmin);
state.adminSettingsPath = initialState.adminSettingsPath;
},
[types.UPDATE_SETTINGS](state, data) {
state.settings = { ...state.settings, ...data.settings };
},
[types.SET_SETTINGS](state, settings) {
state.settings = settings;
state.settings = settings ?? state.settings;
state.original = Object.freeze(settings);
},
[types.SET_IS_DISABLED](state, isDisabled) {
state.isDisabled = isDisabled;
},
[types.RESET_SETTINGS](state) {
state.settings = { ...state.original };
state.settings = Object.assign({}, state.original);
},
[types.TOGGLE_LOADING](state) {
state.isLoading = !state.isLoading;
......
......@@ -8,9 +8,17 @@ export default () => ({
*/
isLoading: false,
/*
* Boolean to determine if the user is allowed to interact with the form
* Boolean to determine if the user is an admin
*/
isDisabled: false,
isAdmin: false,
/*
* String containing the full path to the admin config page for CI/CD
*/
adminSettingsPath: '',
/*
* Boolean to determine if project created before 12.8 can use this feature
*/
enableHistoricEntries: false,
/*
* This contains the data shown and manipulated in the UI
* Has the following structure:
......@@ -24,9 +32,9 @@ export default () => ({
*/
settings: {},
/*
* Same structure as settings, above but Frozen object and used only in case the user clicks 'cancel'
* Same structure as settings, above but Frozen object and used only in case the user clicks 'cancel', initialized to null
*/
original: {},
original: null,
/*
* Contains the options used to populate the form selects
*/
......
......@@ -202,7 +202,7 @@ const fileExtensionIcons = {
flv: 'movie',
vob: 'movie',
ogv: 'movie',
ogg: 'movie',
ogg: 'music',
gifv: 'movie',
avi: 'movie',
mov: 'movie',
......
......@@ -496,6 +496,10 @@ def should_enforce_terms?
html_request? && !devise_controller?
end
def public_visibility_restricted?
Gitlab::CurrentSettings.restricted_visibility_levels.include? Gitlab::VisibilityLevel::PUBLIC
end
def set_usage_stats_consent_flag
return unless current_user
return if sessionless_user?
......
# frozen_string_literal: true
class Explore::ApplicationController < ApplicationController
skip_before_action :authenticate_user!
skip_before_action :authenticate_user!, unless: :public_visibility_restricted?
layout 'explore'
end
# frozen_string_literal: true
class HelpController < ApplicationController
skip_before_action :authenticate_user!
skip_before_action :authenticate_user!, unless: :public_visibility_restricted?
layout 'help'
......
......@@ -51,6 +51,10 @@ def any_explore_nav_link?(links)
links.any? { |link| explore_nav_link?(link) }
end
def public_visibility_restricted?
Gitlab::CurrentSettings.restricted_visibility_levels.include? Gitlab::VisibilityLevel::PUBLIC
end
private
def get_explore_nav_links
......
......@@ -74,7 +74,7 @@ def scoped_integrations_path
def scoped_integration_path(integration)
if @project.present?
project_settings_integration_path(@project, integration)
project_service_path(@project, integration)
elsif @group.present?
group_settings_integration_path(@group, integration)
else
......
......@@ -14,6 +14,7 @@ class ApplicationSetting < ApplicationRecord
add_authentication_token_field :static_objects_external_storage_auth_token
belongs_to :self_monitoring_project, class_name: "Project", foreign_key: 'instance_administration_project_id'
belongs_to :push_rule
alias_attribute :self_monitoring_project_id, :instance_administration_project_id
belongs_to :instance_administrators_group, class_name: "Group"
......
......@@ -15,6 +15,8 @@ class AlertsService < Service
before_validation :ensure_token, if: :activated?
def url
return if instance? || template?
url_helpers.project_alerts_notify_url(project, format: :json)
end
......
......@@ -9,3 +9,5 @@ def self.where_or_create_by(attrs)
where(primary_key => safe_find_or_create_by(attrs))
end
end
ProjectSetting.prepend_if_ee('EE::ProjectSetting')
......@@ -56,7 +56,12 @@ def savers
end
def tree_exporter
Gitlab::ImportExport::Group::TreeSaver.new(group: @group, current_user: @current_user, shared: @shared, params: @params)
Gitlab::ImportExport::Group::LegacyTreeSaver.new(
group: @group,
current_user: @current_user,
shared: @shared,
params: @params
)
end
def file_saver
......
......@@ -38,7 +38,9 @@
%hr.footer-fixed
.container.footer-container
.footer-links
= link_to _("Explore"), explore_root_path
= link_to _("Help"), help_path
- if !public_visibility_restricted?
= link_to _("Explore"), explore_root_path
= link_to _("Help"), help_path
= link_to _("About GitLab"), "https://about.gitlab.com/"
= footer_message
......@@ -14,7 +14,8 @@
%hr
.container
.footer-links
= link_to _("Explore"), explore_root_path
= link_to _("Help"), help_path
- if !public_visibility_restricted?
= link_to _("Explore"), explore_root_path
= link_to _("Help"), help_path
= link_to _("About GitLab"), "https://about.gitlab.com/"
= footer_message
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment