Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
10747e3e
Commit
10747e3e
authored
Sep 09, 2018
by
Clement Ho
Committed by
Robert Speicher
Sep 09, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Summit challenge - health check
parent
a068d23c
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
190 additions
and
0 deletions
+190
-0
app/views/layouts/header/_current_user_dropdown.html.haml
app/views/layouts/header/_current_user_dropdown.html.haml
+2
-0
config/routes/admin.rb
config/routes/admin.rb
+1
-0
doc/administration/img/instance_review_button.png
doc/administration/img/instance_review_button.png
+0
-0
doc/administration/instance_review.md
doc/administration/instance_review.md
+17
-0
ee/app/controllers/admin/instance_review_controller.rb
ee/app/controllers/admin/instance_review_controller.rb
+37
-0
ee/app/helpers/ee/application_helper.rb
ee/app/helpers/ee/application_helper.rb
+4
-0
ee/app/models/ee/application_setting.rb
ee/app/models/ee/application_setting.rb
+11
-0
ee/app/views/shared/_user_dropdown_instance_review.html.haml
ee/app/views/shared/_user_dropdown_instance_review.html.haml
+5
-0
ee/changelogs/unreleased/summit-challenge-hc.yml
ee/changelogs/unreleased/summit-challenge-hc.yml
+5
-0
ee/spec/controllers/admin/instance_review_controller_spec.rb
ee/spec/controllers/admin/instance_review_controller_spec.rb
+64
-0
ee/spec/models/application_setting_spec.rb
ee/spec/models/application_setting_spec.rb
+41
-0
locale/gitlab.pot
locale/gitlab.pot
+3
-0
No files found.
app/views/layouts/header/_current_user_dropdown.html.haml
View file @
10747e3e
...
...
@@ -18,6 +18,8 @@
-
if
current_user_menu?
(
:help
)
||
current_user_menu?
(
:settings
)
||
current_user_menu?
(
:profile
)
%li
.divider
=
render
'shared/user_dropdown_contributing_link'
-
if
instance_review_permitted?
=
render
'shared/user_dropdown_instance_review'
-
if
current_user_menu?
(
:sign_out
)
%li
=
link_to
_
(
"Sign out"
),
destroy_user_session_path
,
class:
"sign-out-link"
config/routes/admin.rb
View file @
10747e3e
...
...
@@ -24,6 +24,7 @@ namespace :admin do
## EE-specific
resource
:push_rule
,
only:
[
:show
,
:update
]
get
:instance_review
,
to:
'instance_review#index'
## EE-specific
resource
:impersonation
,
only: :destroy
...
...
doc/administration/img/instance_review_button.png
0 → 100644
View file @
10747e3e
85.2 KB
doc/administration/instance_review.md
0 → 100644
View file @
10747e3e
# Instance Review
> [Introduced][6995] in [GitLab Core][ee] 11.3.
If you are running a medium size instance of GitLab Core edition you are qualified for a free Instance Review. You can find the button in the User menu.
![
Instance Review button
](
img/instance_review_button.png
)
When you click the button you will be redirected to a form with prefilled data obtained from your instance.
Once you submit the data to GitLab Inc. you can see the initial report.
Additionally you will be contacted by our team for further review which should help you to improve your usage of GitLab.
[
6995
]:
https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/6995
[
ee
]:
https://about.gitlab.com/pricing/
ee/app/controllers/admin/instance_review_controller.rb
0 → 100644
View file @
10747e3e
# frozen_string_literal: true
class
Admin::InstanceReviewController
<
Admin
::
ApplicationController
def
index
redirect_to
(
"
#{
EE
::
SUBSCRIPTIONS_URL
}
/instance_review?
#{
instance_review_params
}
"
)
end
def
instance_review_params
result
=
{
instance_review:
{
email:
current_user
.
email
,
last_name:
current_user
.
name
,
version:
::
Gitlab
::
VERSION
}
}
if
Gitlab
::
CurrentSettings
.
usage_ping_enabled?
data
=
::
Gitlab
::
UsageData
.
data
counts
=
data
[
:counts
]
result
[
:instance_review
].
merge!
(
users_count:
data
[
:active_user_count
],
projects_count:
counts
[
:projects
],
groups_count:
counts
[
:groups
],
issues_count:
counts
[
:issues
],
merge_requests_count:
counts
[
:merge_requests
],
internal_pipelines_count:
counts
[
:ci_internal_pipelines
],
external_pipelines_count:
counts
[
:ci_external_pipelines
],
labels_count:
counts
[
:labels
],
milestones_count:
counts
[
:milestones
],
snippets_count:
counts
[
:snippets
],
notes_count:
counts
[
:notes
]
)
end
result
.
to_query
end
end
ee/app/helpers/ee/application_helper.rb
View file @
10747e3e
...
...
@@ -72,6 +72,10 @@ module EE
}
end
def
instance_review_permitted?
::
Gitlab
::
CurrentSettings
.
instance_review_permitted?
&&
current_user
&
.
admin?
end
private
def
appearance
...
...
ee/app/models/ee/application_setting.rb
View file @
10747e3e
...
...
@@ -10,6 +10,7 @@ module EE
include
IgnorableColumn
EMAIL_ADDITIONAL_TEXT_CHARACTER_LIMIT
=
10_000
INSTANCE_REVIEW_MIN_USERS
=
100
belongs_to
:file_template_project
,
class_name:
"Project"
...
...
@@ -193,6 +194,16 @@ module EE
::
Project
.
where
(
namespace_id:
group_id
)
end
def
instance_review_permitted?
return
if
License
.
current
users_count
=
Rails
.
cache
.
fetch
(
'limited_users_count'
,
expires_in:
1
.
day
)
do
::
User
.
limit
(
INSTANCE_REVIEW_MIN_USERS
+
1
).
count
(
:all
)
end
users_count
>=
INSTANCE_REVIEW_MIN_USERS
end
private
def
mirror_max_delay_in_minutes
...
...
ee/app/views/shared/_user_dropdown_instance_review.html.haml
0 → 100644
View file @
10747e3e
%li
=
link_to
admin_instance_review_path
,
target:
'_blank'
,
class:
'text-nowrap'
do
=
_
(
"Get a free instance review"
)
=
sprite_icon
(
'external-link'
,
size:
16
)
%li
.divider
ee/changelogs/unreleased/summit-challenge-hc.yml
0 → 100644
View file @
10747e3e
---
title
:
"
Add
Instance
Review
for
Core
users"
merge_request
:
6995
author
:
type
:
added
ee/spec/controllers/admin/instance_review_controller_spec.rb
0 → 100644
View file @
10747e3e
# frozen_string_literal: true
require
'spec_helper'
describe
Admin
::
InstanceReviewController
do
let
(
:admin
)
{
create
(
:admin
)
}
before
do
sign_in
(
admin
)
end
context
'GET #index'
do
let!
(
:group
)
{
create
(
:group
)
}
let!
(
:projects
)
{
create_list
(
:project
,
2
,
group:
group
)
}
subject
{
post
:index
}
context
'with usage ping enabled'
do
before
do
stub_application_setting
(
usage_ping_enabled:
true
)
::
Gitlab
::
UsageData
.
data
(
force_refresh:
true
)
subject
end
it
'redirects to the customers app with correct params'
do
params
=
{
instance_review:
{
email:
admin
.
email
,
last_name:
admin
.
name
,
version:
::
Gitlab
::
VERSION
,
users_count:
5
,
projects_count:
2
,
groups_count:
1
,
issues_count:
0
,
merge_requests_count:
0
,
internal_pipelines_count:
0
,
external_pipelines_count:
0
,
labels_count:
0
,
milestones_count:
0
,
snippets_count:
0
,
notes_count:
0
}
}.
to_query
expect
(
response
).
to
redirect_to
(
"
#{
EE
::
SUBSCRIPTIONS_URL
}
/instance_review?
#{
params
}
"
)
end
end
context
'with usage ping disabled'
do
before
do
stub_application_setting
(
usage_ping_enabled:
false
)
subject
end
it
'redirects to the customers app with correct params'
do
params
=
{
instance_review:
{
email:
admin
.
email
,
last_name:
admin
.
name
,
version:
::
Gitlab
::
VERSION
}
}.
to_query
expect
(
response
).
to
redirect_to
(
"
#{
EE
::
SUBSCRIPTIONS_URL
}
/instance_review?
#{
params
}
"
)
end
end
end
end
ee/spec/models/application_setting_spec.rb
View file @
10747e3e
...
...
@@ -275,4 +275,45 @@ describe ApplicationSetting do
end
end
end
describe
'#instance_review_permitted?'
do
subject
{
setting
.
instance_review_permitted?
}
context
'for instances with a valid license'
do
before
do
license
=
create
(
:license
,
plan:
::
License
::
PREMIUM_PLAN
)
allow
(
License
).
to
receive
(
:current
).
and_return
(
license
)
end
it
'is not permitted'
do
expect
(
subject
).
to
be_falsey
end
end
context
'for instances without a valid license'
do
before
do
allow
(
License
).
to
receive
(
:current
).
and_return
(
nil
)
end
context
'when there are more users than minimum count'
do
before
do
expect
(
Rails
.
cache
).
to
receive
(
:fetch
).
and_return
(
101
)
end
it
'is permitted'
do
expect
(
subject
).
to
be_truthy
end
end
context
'when there are less users than minimum count'
do
before
do
create
(
:user
)
end
it
'is not permitted'
do
expect
(
subject
).
to
be_falsey
end
end
end
end
end
locale/gitlab.pot
View file @
10747e3e
...
...
@@ -3620,6 +3620,9 @@ msgstr ""
msgid "Geo|You need a different license to use Geo replication"
msgstr ""
msgid "Get a free instance review"
msgstr ""
msgid "Git"
msgstr ""
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment