Add latest changes from gitlab-org/gitlab@master
This commit is contained in:
parent
e2c8097958
commit
27852d1997
|
@ -13,6 +13,9 @@ import './toggler_behavior';
|
|||
import './preview_markdown';
|
||||
import initCollapseSidebarOnWindowResize from './collapse_sidebar_on_window_resize';
|
||||
import initSelect2Dropdowns from './select2';
|
||||
import { loadStartupCSS } from './load_startup_css';
|
||||
|
||||
loadStartupCSS();
|
||||
|
||||
installGlEmojiElement();
|
||||
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
export const loadStartupCSS = () => {
|
||||
// We need to fallback to dispatching `load` in case our event listener was added too late
|
||||
// or the browser environment doesn't load media=print.
|
||||
// Do this on `window.load` so that the default deferred behavior takes precedence.
|
||||
// https://gitlab.com/gitlab-org/gitlab/-/issues/239357
|
||||
window.addEventListener(
|
||||
'load',
|
||||
() => {
|
||||
document
|
||||
.querySelectorAll('link[media=print]')
|
||||
.forEach(x => x.dispatchEvent(new Event('load')));
|
||||
},
|
||||
{ once: true },
|
||||
);
|
||||
};
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
class Admin::ApplicationSettingsController < Admin::ApplicationController
|
||||
include InternalRedirect
|
||||
include ServicesHelper
|
||||
|
||||
# NOTE: Use @application_setting in this controller when you need to access
|
||||
# application_settings after it has been modified. This is because the
|
||||
|
@ -32,6 +33,8 @@ class Admin::ApplicationSettingsController < Admin::ApplicationController
|
|||
end
|
||||
|
||||
def integrations
|
||||
return not_found unless instance_level_integrations?
|
||||
|
||||
@integrations = Service.find_or_initialize_all(Service.for_instance).sort_by(&:title)
|
||||
end
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
class Admin::IntegrationsController < Admin::ApplicationController
|
||||
include IntegrationsActions
|
||||
include ServicesHelper
|
||||
|
||||
private
|
||||
|
||||
|
@ -10,7 +11,7 @@ class Admin::IntegrationsController < Admin::ApplicationController
|
|||
end
|
||||
|
||||
def integrations_enabled?
|
||||
true
|
||||
instance_level_integrations?
|
||||
end
|
||||
|
||||
def scoped_edit_integration_path(integration)
|
||||
|
|
|
@ -20,7 +20,7 @@ module IntegrationsActions
|
|||
respond_to do |format|
|
||||
format.html do
|
||||
if saved
|
||||
PropagateIntegrationWorker.perform_async(integration.id, false)
|
||||
PropagateIntegrationWorker.perform_async(integration.id)
|
||||
redirect_to scoped_edit_integration_path(integration), notice: success_message
|
||||
else
|
||||
render 'shared/integrations/edit'
|
||||
|
|
|
@ -61,8 +61,8 @@ module PreferencesHelper
|
|||
@user_application_theme ||= Gitlab::Themes.for_user(current_user).css_class
|
||||
end
|
||||
|
||||
def user_application_theme_name
|
||||
@user_application_theme_name ||= Gitlab::Themes.for_user(current_user).name.downcase.tr(' ', '_')
|
||||
def user_application_theme_css_filename
|
||||
@user_application_theme_css_filename ||= Gitlab::Themes.for_user(current_user).css_filename
|
||||
end
|
||||
|
||||
def user_color_scheme
|
||||
|
|
|
@ -124,6 +124,10 @@ module ServicesHelper
|
|||
@group.present? && Feature.enabled?(:group_level_integrations, @group)
|
||||
end
|
||||
|
||||
def instance_level_integrations?
|
||||
!Gitlab.com?
|
||||
end
|
||||
|
||||
extend self
|
||||
|
||||
private
|
||||
|
|
|
@ -875,7 +875,7 @@ module Ci
|
|||
end
|
||||
|
||||
def builds_with_coverage
|
||||
builds.with_coverage
|
||||
builds.latest.with_coverage
|
||||
end
|
||||
|
||||
def has_reports?(reports_scope)
|
||||
|
|
|
@ -20,19 +20,11 @@ class MergeRequestPollWidgetEntity < Grape::Entity
|
|||
expose :merge_user, using: UserEntity
|
||||
|
||||
expose :actual_head_pipeline, as: :pipeline, if: -> (mr, _) { presenter(mr).can_read_pipeline? } do |merge_request, options|
|
||||
if Feature.enabled?(:merge_request_short_pipeline_serializer, merge_request.project, default_enabled: true)
|
||||
MergeRequests::PipelineEntity.represent(merge_request.actual_head_pipeline, options)
|
||||
else
|
||||
PipelineDetailsEntity.represent(merge_request.actual_head_pipeline, options)
|
||||
end
|
||||
MergeRequests::PipelineEntity.represent(merge_request.actual_head_pipeline, options)
|
||||
end
|
||||
|
||||
expose :merge_pipeline, if: ->(mr, _) { mr.merged? && can?(request.current_user, :read_pipeline, mr.target_project)} do |merge_request, options|
|
||||
if Feature.enabled?(:merge_request_short_pipeline_serializer, merge_request.project, default_enabled: true)
|
||||
MergeRequests::PipelineEntity.represent(merge_request.merge_pipeline, options)
|
||||
else
|
||||
PipelineDetailsEntity.represent(merge_request.merge_pipeline, options)
|
||||
end
|
||||
MergeRequests::PipelineEntity.represent(merge_request.merge_pipeline, options)
|
||||
end
|
||||
|
||||
expose :default_merge_commit_message
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
= s_('AdminArea|Active users')
|
|
@ -50,11 +50,9 @@
|
|||
= s_('AdminArea|Bots')
|
||||
%td.p-3.text-right
|
||||
= @users_statistics&.bots.to_i
|
||||
|
||||
%tr.bg-gray-light.gl-text-gray-900
|
||||
%td.p-3
|
||||
%strong
|
||||
= s_('AdminArea|Active users')
|
||||
= render_if_exists 'admin/dashboard/billable_users_text'
|
||||
%td.p-3.text-right
|
||||
%strong
|
||||
|
|
|
@ -53,7 +53,7 @@
|
|||
- else
|
||||
= stylesheet_link_tag_defer "application"
|
||||
- unless use_startup_css?
|
||||
= stylesheet_link_tag_defer "themes/theme_#{user_application_theme_name}"
|
||||
= stylesheet_link_tag_defer "themes/#{user_application_theme_css_filename}" if user_application_theme_css_filename
|
||||
= stylesheet_link_tag "disable_animations", media: "all" if Rails.env.test? || Gitlab.config.gitlab['disable_animations']
|
||||
= stylesheet_link_tag_defer 'performance_bar' if performance_bar_enabled?
|
||||
|
||||
|
|
|
@ -3,5 +3,5 @@
|
|||
- startup_filename = current_path?("sessions#new") ? 'signin' : user_application_theme == 'gl-dark' ? 'dark' : 'general'
|
||||
|
||||
%style{ type: "text/css" }
|
||||
= Rails.application.assets_manifest.find_sources("themes/theme_#{user_application_theme_name}.css").first.to_s.html_safe
|
||||
= Rails.application.assets_manifest.find_sources("themes/#{user_application_theme_css_filename}.css").first.to_s.html_safe if user_application_theme_css_filename
|
||||
= Rails.application.assets_manifest.find_sources("startup/startup-#{startup_filename}.css").first.to_s.html_safe
|
||||
|
|
|
@ -7,4 +7,3 @@
|
|||
const startupLinkLoadedEvent = new CustomEvent('CSSStartupLinkLoaded');
|
||||
linkTag.addEventListener('load',function(){this.media='all';this.setAttribute('data-startupcss', 'loaded');document.dispatchEvent(startupLinkLoadedEvent);},{once: true});
|
||||
})
|
||||
- return unless use_startup_css?
|
||||
|
|
|
@ -260,10 +260,11 @@
|
|||
= link_to general_admin_application_settings_path, title: _('General'), class: 'qa-admin-settings-general-item' do
|
||||
%span
|
||||
= _('General')
|
||||
= nav_link(path: ['application_settings#integrations', 'integrations#edit']) do
|
||||
= link_to integrations_admin_application_settings_path, title: _('Integrations'), data: { qa_selector: 'integration_settings_link' } do
|
||||
%span
|
||||
= _('Integrations')
|
||||
- if instance_level_integrations?
|
||||
= nav_link(path: ['application_settings#integrations', 'integrations#edit']) do
|
||||
= link_to integrations_admin_application_settings_path, title: _('Integrations'), data: { qa_selector: 'integration_settings_link' } do
|
||||
%span
|
||||
= _('Integrations')
|
||||
= nav_link(path: 'application_settings#repository') do
|
||||
= link_to repository_admin_application_settings_path, title: _('Repository'), class: 'qa-admin-settings-repository-item' do
|
||||
%span
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
- @content_class = "limit-container-width" unless fluid_layout
|
||||
|
||||
- Gitlab::Themes.each do |theme|
|
||||
= stylesheet_link_tag "themes/theme_#{theme.css_class.gsub('ui-', '')}"
|
||||
= stylesheet_link_tag "themes/#{theme.css_filename}" if theme.css_filename
|
||||
|
||||
= form_for @user, url: profile_preferences_path, remote: true, method: :put, html: { class: 'row gl-mt-3 js-preferences-form' } do |f|
|
||||
.col-lg-4.application-theme#navigation-theme
|
||||
|
|
|
@ -12,9 +12,7 @@ module AuthorizedProjectUpdate
|
|||
idempotent!
|
||||
|
||||
def perform
|
||||
if ::Feature.enabled?(:periodic_project_authorization_recalculation, default_enabled: true)
|
||||
AuthorizedProjectUpdate::PeriodicRecalculateService.new.execute
|
||||
end
|
||||
AuthorizedProjectUpdate::PeriodicRecalculateService.new.execute
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -12,9 +12,7 @@ module AuthorizedProjectUpdate
|
|||
idempotent!
|
||||
|
||||
def perform(start_user_id, end_user_id)
|
||||
if ::Feature.enabled?(:periodic_project_authorization_recalculation, default_enabled: true)
|
||||
AuthorizedProjectUpdate::RecalculateForUserRangeService.new(start_user_id, end_user_id).execute
|
||||
end
|
||||
AuthorizedProjectUpdate::RecalculateForUserRangeService.new(start_user_id, end_user_id).execute
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -7,7 +7,8 @@ class PropagateIntegrationWorker
|
|||
idempotent!
|
||||
loggable_arguments 1
|
||||
|
||||
# Keep overwrite parameter for backwards compatibility.
|
||||
# TODO: Keep overwrite parameter for backwards compatibility. Remove after >= 14.0
|
||||
# https://gitlab.com/gitlab-org/gitlab/-/issues/255382
|
||||
def perform(integration_id, overwrite = nil)
|
||||
Admin::PropagateIntegrationService.propagate(Service.find(integration_id))
|
||||
end
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
title: Hide instance-level integrations on GitLab.com
|
||||
merge_request: 42808
|
||||
author:
|
||||
type: changed
|
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
title: Do not show retried builds in the MR code coverage
|
||||
merge_request: 42402
|
||||
author: Simon Lenz @koala7
|
||||
type: fixed
|
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
title: Fix theme selector not working immediately for some themes
|
||||
merge_request: 43239
|
||||
author:
|
||||
type: fixed
|
|
@ -1,7 +1,7 @@
|
|||
---
|
||||
name: cleanup_lfs_during_gc
|
||||
introduced_by_url:
|
||||
rollout_issue_url:
|
||||
group:
|
||||
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/38813
|
||||
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/238605
|
||||
group: group::source code
|
||||
type: development
|
||||
default_enabled: false
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
---
|
||||
name: group_export_ndjson
|
||||
introduced_by_url:
|
||||
rollout_issue_url:
|
||||
group:
|
||||
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/29590
|
||||
rollout_issue_url:
|
||||
group: import
|
||||
type: development
|
||||
default_enabled: true
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
---
|
||||
name: group_import_ndjson
|
||||
introduced_by_url:
|
||||
rollout_issue_url:
|
||||
group:
|
||||
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/29716
|
||||
rollout_issue_url:
|
||||
group: import
|
||||
type: development
|
||||
default_enabled: true
|
||||
|
|
|
@ -1,7 +0,0 @@
|
|||
---
|
||||
name: merge_request_short_pipeline_serializer
|
||||
introduced_by_url:
|
||||
rollout_issue_url:
|
||||
group:
|
||||
type: development
|
||||
default_enabled: true
|
|
@ -1,7 +1,7 @@
|
|||
---
|
||||
name: migrate_user_mentions
|
||||
introduced_by_url:
|
||||
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/34378
|
||||
rollout_issue_url:
|
||||
group:
|
||||
group: group::project management
|
||||
type: development
|
||||
default_enabled: true
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
---
|
||||
name: paginated_notes
|
||||
introduced_by_url:
|
||||
rollout_issue_url:
|
||||
group:
|
||||
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/34628
|
||||
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/254987
|
||||
group: group::source code
|
||||
type: development
|
||||
default_enabled: false
|
||||
|
|
|
@ -1,7 +0,0 @@
|
|||
---
|
||||
name: periodic_project_authorization_recalculation
|
||||
introduced_by_url:
|
||||
rollout_issue_url:
|
||||
group:
|
||||
type: development
|
||||
default_enabled: true
|
|
@ -1,7 +1,7 @@
|
|||
---
|
||||
name: repack_after_shard_migration
|
||||
introduced_by_url:
|
||||
rollout_issue_url:
|
||||
group:
|
||||
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/21502
|
||||
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/195597
|
||||
group: group::source code
|
||||
type: development
|
||||
default_enabled: false
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
---
|
||||
name: specialized_project_authorization_project_share_worker
|
||||
introduced_by_url:
|
||||
rollout_issue_url:
|
||||
group:
|
||||
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/32864
|
||||
rollout_issue_url:
|
||||
group: group::access
|
||||
type: development
|
||||
default_enabled: false
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
---
|
||||
name: specialized_project_authorization_workers
|
||||
introduced_by_url:
|
||||
rollout_issue_url:
|
||||
group:
|
||||
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/31377
|
||||
rollout_issue_url:
|
||||
group: group::access
|
||||
type: development
|
||||
default_enabled: false
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
---
|
||||
name: store_mentioned_users_to_db
|
||||
introduced_by_url:
|
||||
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/19088
|
||||
rollout_issue_url:
|
||||
group:
|
||||
group: group::project management
|
||||
type: development
|
||||
default_enabled: true
|
||||
|
|
|
@ -11,4 +11,4 @@ level: suggestion
|
|||
ignorecase: true
|
||||
swap:
|
||||
sanity (?:check|test): check for completeness
|
||||
dummy: placeholder
|
||||
dummy: placeholder, sample, fake
|
||||
|
|
|
@ -12,5 +12,5 @@ ignorecase: true
|
|||
swap:
|
||||
blacklist(?:ed|ing|s)?: denylist
|
||||
whitelist(?:ed|ing|s)?: allowlist
|
||||
master: primary
|
||||
master: primary, main
|
||||
slave: secondary
|
||||
|
|
|
@ -177,9 +177,20 @@ Kubernetes resources required for the Agent to be installed. You can modify this
|
|||
example [`resources.yml` file](#example-resourcesyml-file) in the following ways:
|
||||
|
||||
- You can replace `gitlab-agent` with `<YOUR-DESIRED-NAMESPACE>`.
|
||||
- For the `kas-address` (Kubernetes Agent Server), you can replace
|
||||
`grpc://host.docker.internal:5005` with the address of the `kas` agent initialized
|
||||
in your Helm install.
|
||||
- For the `kas-address` (Kubernetes Agent Server), the agent can use the WebSockets
|
||||
or gRPC protocols to connect to the Agent Server. Depending on your cluster
|
||||
configuration and GitLab architecture, you may need to use one or the other.
|
||||
For the `gitlab-kas` Helm chart, an Ingress is created for the Agent Server using
|
||||
the `/-/kubernetes-agent` endpoint. This can be used for the WebSockets protocol connection.
|
||||
- Specify the `grpc` scheme (such as `grpc://gitlab-kas:5005`) to use gRPC directly.
|
||||
Encrypted gRPC is not supported yet. Follow the
|
||||
[Support TLS for gRPC communication issue](https://gitlab.com/gitlab-org/cluster-integration/gitlab-agent/-/issues/7)
|
||||
for progress updates.
|
||||
- Specify the `ws` scheme (such as `ws://gitlab-kas-ingress:80/-/kubernetes-agent`)
|
||||
to use an unencrypted WebSockets connection.
|
||||
- Specify the `wss` scheme (such as `wss://gitlab-kas-ingress:443/-/kubernetes-agent`)
|
||||
to use an encrypted WebSockets connection. This is the recommended option if
|
||||
installing the Agent into a separate cluster from your Agent Server.
|
||||
- If you defined your own secret name, replace `gitlab-agent-token` with your secret name.
|
||||
|
||||
To apply this file, run the following command:
|
||||
|
|
|
@ -10,21 +10,21 @@ module Gitlab
|
|||
APPLICATION_DEFAULT = 1
|
||||
|
||||
# Struct class representing a single Theme
|
||||
Theme = Struct.new(:id, :name, :css_class)
|
||||
Theme = Struct.new(:id, :name, :css_class, :css_filename)
|
||||
|
||||
# All available Themes
|
||||
THEMES = [
|
||||
Theme.new(1, 'Indigo', 'ui-indigo'),
|
||||
Theme.new(6, 'Light Indigo', 'ui-light-indigo'),
|
||||
Theme.new(4, 'Blue', 'ui-blue'),
|
||||
Theme.new(7, 'Light Blue', 'ui-light-blue'),
|
||||
Theme.new(5, 'Green', 'ui-green'),
|
||||
Theme.new(8, 'Light Green', 'ui-light-green'),
|
||||
Theme.new(9, 'Red', 'ui-red'),
|
||||
Theme.new(10, 'Light Red', 'ui-light-red'),
|
||||
Theme.new(2, 'Dark', 'ui-dark'),
|
||||
Theme.new(3, 'Light', 'ui-light'),
|
||||
Theme.new(11, 'Dark Mode (alpha)', 'gl-dark')
|
||||
Theme.new(1, 'Indigo', 'ui-indigo', 'theme_indigo'),
|
||||
Theme.new(6, 'Light Indigo', 'ui-light-indigo', 'theme_light_indigo'),
|
||||
Theme.new(4, 'Blue', 'ui-blue', 'theme_blue'),
|
||||
Theme.new(7, 'Light Blue', 'ui-light-blue', 'theme_light_blue'),
|
||||
Theme.new(5, 'Green', 'ui-green', 'theme_green'),
|
||||
Theme.new(8, 'Light Green', 'ui-light-green', 'theme_light_green'),
|
||||
Theme.new(9, 'Red', 'ui-red', 'theme_red'),
|
||||
Theme.new(10, 'Light Red', 'ui-light-red', 'theme_light_red'),
|
||||
Theme.new(2, 'Dark', 'ui-dark', 'theme_dark'),
|
||||
Theme.new(3, 'Light', 'ui-light', 'theme_light'),
|
||||
Theme.new(11, 'Dark Mode (alpha)', 'gl-dark', nil)
|
||||
].freeze
|
||||
|
||||
# Convenience method to get a space-separated String of all the theme
|
||||
|
|
|
@ -1465,12 +1465,6 @@ msgstr ""
|
|||
msgid "Active Sessions"
|
||||
msgstr ""
|
||||
|
||||
msgid "Active Users:"
|
||||
msgstr ""
|
||||
|
||||
msgid "Active users"
|
||||
msgstr ""
|
||||
|
||||
msgid "Activity"
|
||||
msgstr ""
|
||||
|
||||
|
@ -3982,6 +3976,9 @@ msgstr ""
|
|||
msgid "Bi-weekly code coverage"
|
||||
msgstr ""
|
||||
|
||||
msgid "Billable Users:"
|
||||
msgstr ""
|
||||
|
||||
msgid "Billing"
|
||||
msgstr ""
|
||||
|
||||
|
@ -27983,6 +27980,9 @@ msgstr ""
|
|||
msgid "Users"
|
||||
msgstr ""
|
||||
|
||||
msgid "Users in License"
|
||||
msgstr ""
|
||||
|
||||
msgid "Users in License:"
|
||||
msgstr ""
|
||||
|
||||
|
|
|
@ -15,6 +15,37 @@ RSpec.describe Admin::ApplicationSettingsController do
|
|||
stub_env('IN_MEMORY_APPLICATION_SETTINGS', 'false')
|
||||
end
|
||||
|
||||
describe 'GET #integrations' do
|
||||
before do
|
||||
sign_in(admin)
|
||||
end
|
||||
|
||||
context 'when GitLab.com' do
|
||||
before do
|
||||
allow(::Gitlab).to receive(:com?) { true }
|
||||
end
|
||||
|
||||
it 'returns 404' do
|
||||
get :integrations
|
||||
|
||||
expect(response).to have_gitlab_http_status(:not_found)
|
||||
end
|
||||
end
|
||||
|
||||
context 'when not GitLab.com' do
|
||||
before do
|
||||
allow(::Gitlab).to receive(:com?) { false }
|
||||
end
|
||||
|
||||
it 'renders correct template' do
|
||||
get :integrations
|
||||
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
expect(response).to render_template('admin/application_settings/integrations')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe 'GET #usage_data with no access' do
|
||||
before do
|
||||
stub_usage_data_connections
|
||||
|
|
|
@ -20,6 +20,18 @@ RSpec.describe Admin::IntegrationsController do
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
context 'when GitLab.com' do
|
||||
before do
|
||||
allow(::Gitlab).to receive(:com?) { true }
|
||||
end
|
||||
|
||||
it 'returns 404' do
|
||||
get :edit, params: { id: Service.available_services_names.sample }
|
||||
|
||||
expect(response).to have_gitlab_http_status(:not_found)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe '#update' do
|
||||
|
@ -43,7 +55,7 @@ RSpec.describe Admin::IntegrationsController do
|
|||
end
|
||||
|
||||
it 'calls to PropagateIntegrationWorker' do
|
||||
expect(PropagateIntegrationWorker).to have_received(:perform_async).with(integration.id, false)
|
||||
expect(PropagateIntegrationWorker).to have_received(:perform_async).with(integration.id)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -28,11 +28,9 @@ RSpec.describe 'admin visits dashboard' do
|
|||
|
||||
describe 'Users statistic' do
|
||||
let_it_be(:users_statistics) { create(:users_statistics) }
|
||||
let_it_be(:users_count_label) { Gitlab.ee? ? 'Billable users 71' : 'Active users 71' }
|
||||
|
||||
it 'shows correct amounts of users', :aggregate_failures do
|
||||
expected_active_users_text = Gitlab.ee? ? 'Active users (Billable users) 71' : 'Active users 71'
|
||||
|
||||
sign_in(create(:admin))
|
||||
visit admin_dashboard_stats_path
|
||||
|
||||
expect(page).to have_content('Users without a Group and Project 23')
|
||||
|
@ -42,9 +40,9 @@ RSpec.describe 'admin visits dashboard' do
|
|||
expect(page).to have_content('Users with highest role Maintainer 6')
|
||||
expect(page).to have_content('Users with highest role Owner 5')
|
||||
expect(page).to have_content('Bots 2')
|
||||
expect(page).to have_content(expected_active_users_text)
|
||||
expect(page).to have_content('Blocked users 7')
|
||||
expect(page).to have_content('Total users 78')
|
||||
expect(page).to have_content(users_count_label)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -0,0 +1,44 @@
|
|||
import { setHTMLFixture } from 'helpers/fixtures';
|
||||
import { loadStartupCSS } from '~/behaviors/load_startup_css';
|
||||
|
||||
describe('behaviors/load_startup_css', () => {
|
||||
let loadListener;
|
||||
|
||||
const setupListeners = () => {
|
||||
document
|
||||
.querySelectorAll('link')
|
||||
.forEach(x => x.addEventListener('load', () => loadListener(x)));
|
||||
};
|
||||
|
||||
beforeEach(() => {
|
||||
loadListener = jest.fn();
|
||||
|
||||
setHTMLFixture(`
|
||||
<meta charset="utf-8" />
|
||||
<link media="print" src="./lorem-print.css" />
|
||||
<link media="print" src="./ipsum-print.css" />
|
||||
<link media="all" src="./dolar-all.css" />
|
||||
`);
|
||||
|
||||
setupListeners();
|
||||
|
||||
loadStartupCSS();
|
||||
});
|
||||
|
||||
it('does nothing at first', () => {
|
||||
expect(loadListener).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
describe('on window load', () => {
|
||||
beforeEach(() => {
|
||||
window.dispatchEvent(new Event('load'));
|
||||
});
|
||||
|
||||
it('dispatches load to the print links', () => {
|
||||
expect(loadListener.mock.calls.map(([el]) => el.getAttribute('src'))).toEqual([
|
||||
'./lorem-print.css',
|
||||
'./ipsum-print.css',
|
||||
]);
|
||||
});
|
||||
});
|
||||
});
|
|
@ -47,4 +47,18 @@ RSpec.describe Gitlab::Themes, lib: true do
|
|||
expect(ids).not_to be_empty
|
||||
end
|
||||
end
|
||||
|
||||
describe 'theme.css_filename' do
|
||||
described_class.each do |theme|
|
||||
next unless theme.css_filename
|
||||
|
||||
context "for #{theme.name}" do
|
||||
it 'returns an existing CSS filename' do
|
||||
css_file_path = Rails.root.join('app/assets/stylesheets/themes', theme.css_filename + '.scss')
|
||||
|
||||
expect(File.exist?(css_file_path)).to eq(true)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -3628,6 +3628,16 @@ RSpec.describe Ci::Pipeline, :mailer, factory_default: :keep do
|
|||
expect(builds).to include(rspec, jest)
|
||||
expect(builds).not_to include(karma)
|
||||
end
|
||||
|
||||
it 'returns only latest builds' do
|
||||
obsolete = create(:ci_build, name: "jest", coverage: 10.12, pipeline: pipeline, retried: true)
|
||||
retried = create(:ci_build, name: "jest", coverage: 20.11, pipeline: pipeline)
|
||||
|
||||
builds = pipeline.builds_with_coverage
|
||||
|
||||
expect(builds).to include(retried)
|
||||
expect(builds).not_to include(obsolete)
|
||||
end
|
||||
end
|
||||
|
||||
describe '#base_and_ancestors' do
|
||||
|
|
|
@ -44,20 +44,6 @@ RSpec.describe MergeRequestPollWidgetEntity do
|
|||
expect(subject[:merge_pipeline]).to eq(pipeline_payload)
|
||||
end
|
||||
|
||||
context 'when merge_request_short_pipeline_serializer is disabled' do
|
||||
it 'returns detailed info about pipeline' do
|
||||
stub_feature_flags(merge_request_short_pipeline_serializer: false)
|
||||
|
||||
pipeline.reload
|
||||
pipeline_payload =
|
||||
PipelineDetailsEntity
|
||||
.represent(pipeline, request: request)
|
||||
.as_json
|
||||
|
||||
expect(subject[:merge_pipeline]).to eq(pipeline_payload)
|
||||
end
|
||||
end
|
||||
|
||||
context 'when user cannot read pipelines on target project' do
|
||||
before do
|
||||
project.add_guest(user)
|
||||
|
@ -245,19 +231,6 @@ RSpec.describe MergeRequestPollWidgetEntity do
|
|||
expect(subject[:pipeline]).to eq(pipeline_payload)
|
||||
end
|
||||
|
||||
context 'when merge_request_short_pipeline_serializer is disabled' do
|
||||
it 'returns detailed info about pipeline' do
|
||||
stub_feature_flags(merge_request_short_pipeline_serializer: false)
|
||||
|
||||
pipeline_payload =
|
||||
PipelineDetailsEntity
|
||||
.represent(pipeline, request: req)
|
||||
.as_json
|
||||
|
||||
expect(subject[:pipeline]).to eq(pipeline_payload)
|
||||
end
|
||||
end
|
||||
|
||||
it 'returns ci_status' do
|
||||
expect(subject[:ci_status]).to eq('pending')
|
||||
end
|
||||
|
|
|
@ -37,7 +37,7 @@ RSpec.describe 'admin/dashboard/index.html.haml' do
|
|||
render
|
||||
|
||||
expect(rendered).not_to have_content "Users in License"
|
||||
expect(rendered).not_to have_content "Active Users"
|
||||
expect(rendered).not_to have_content "Billable Users"
|
||||
expect(rendered).not_to have_content "Maximum Users"
|
||||
expect(rendered).not_to have_content "Users over License"
|
||||
end
|
||||
|
|
|
@ -92,7 +92,11 @@ RSpec.describe 'layouts/nav/sidebar/_admin' do
|
|||
end
|
||||
|
||||
context 'on settings' do
|
||||
let(:gitlab_com?) { false }
|
||||
|
||||
before do
|
||||
allow(::Gitlab).to receive(:com?) { gitlab_com? }
|
||||
|
||||
render
|
||||
end
|
||||
|
||||
|
@ -100,6 +104,20 @@ RSpec.describe 'layouts/nav/sidebar/_admin' do
|
|||
expect(rendered).to have_link('General', href: general_admin_application_settings_path)
|
||||
end
|
||||
|
||||
context 'when GitLab.com' do
|
||||
let(:gitlab_com?) { true }
|
||||
|
||||
it 'does not include Integrations link' do
|
||||
expect(rendered).not_to have_link('Integrations', href: integrations_admin_application_settings_path)
|
||||
end
|
||||
end
|
||||
|
||||
context 'when not GitLab.com' do
|
||||
it 'includes Integrations link' do
|
||||
expect(rendered).to have_link('Integrations', href: integrations_admin_application_settings_path)
|
||||
end
|
||||
end
|
||||
|
||||
context 'when GitLab FOSS' do
|
||||
it 'does not include Templates link' do
|
||||
expect(rendered).not_to have_link('Templates', href: '/admin/application_settings/templates')
|
||||
|
|
|
@ -20,6 +20,14 @@ RSpec.describe 'profiles/preferences/show' do
|
|||
it 'has an id for anchoring' do
|
||||
expect(rendered).to have_css('#navigation-theme')
|
||||
end
|
||||
|
||||
it 'has correct stylesheet tags' do
|
||||
Gitlab::Themes.each do |theme|
|
||||
next unless theme.css_filename
|
||||
|
||||
expect(rendered).to have_selector("link[href*=\"themes/#{theme.css_filename}\"]", visible: false)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context 'syntax highlighting theme' do
|
||||
|
|
|
@ -11,17 +11,5 @@ RSpec.describe AuthorizedProjectUpdate::PeriodicRecalculateWorker do
|
|||
|
||||
subject.perform
|
||||
end
|
||||
|
||||
context 'feature flag :periodic_project_authorization_recalculation is disabled' do
|
||||
before do
|
||||
stub_feature_flags(periodic_project_authorization_recalculation: false)
|
||||
end
|
||||
|
||||
it 'does not call AuthorizedProjectUpdate::PeriodicRecalculateService' do
|
||||
expect(AuthorizedProjectUpdate::PeriodicRecalculateService).not_to receive(:new)
|
||||
|
||||
subject.perform
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -14,17 +14,5 @@ RSpec.describe AuthorizedProjectUpdate::UserRefreshOverUserRangeWorker do
|
|||
|
||||
subject.perform(start_user_id, end_user_id)
|
||||
end
|
||||
|
||||
context 'feature flag :periodic_project_authorization_recalculation is disabled' do
|
||||
before do
|
||||
stub_feature_flags(periodic_project_authorization_recalculation: false)
|
||||
end
|
||||
|
||||
it 'does not call AuthorizedProjectUpdate::RecalculateForUserRangeService' do
|
||||
expect(AuthorizedProjectUpdate::RecalculateForUserRangeService).not_to receive(:new)
|
||||
|
||||
subject.perform(start_user_id, end_user_id)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue