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
0
Merge Requests
0
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
Boxiang Sun
gitlab-ce
Commits
866429f7
Commit
866429f7
authored
Jul 18, 2018
by
Luke Bennett
Committed by
Bob Van Landuyt
Jul 26, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add instance_statistics_visibility_private application setting and top nav icon
parent
f8f2d0f9
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
33 additions
and
2 deletions
+33
-2
app/controllers/instance_statistics/application_controller.rb
...controllers/instance_statistics/application_controller.rb
+1
-1
app/helpers/application_settings_helper.rb
app/helpers/application_settings_helper.rb
+5
-0
app/models/application_setting.rb
app/models/application_setting.rb
+1
-0
app/views/admin/application_settings/_usage.html.haml
app/views/admin/application_settings/_usage.html.haml
+3
-0
app/views/layouts/nav/_dashboard.html.haml
app/views/layouts/nav/_dashboard.html.haml
+5
-1
db/migrate/20180718005113_add_instance_statistics_visibility_to_application_setting.rb
..._instance_statistics_visibility_to_application_setting.rb
+18
-0
No files found.
app/controllers/instance_statistics/application_controller.rb
View file @
866429f7
...
...
@@ -7,6 +7,6 @@ class InstanceStatistics::ApplicationController < ApplicationController
end
def
authenticate_user!
render_404
unless
current_user
.
admin?
render_404
if
ApplicationSettingsHelper
.
hide_instance_statistics?
(
current_user
)
end
end
app/helpers/application_settings_helper.rb
View file @
866429f7
...
...
@@ -16,6 +16,10 @@ module ApplicationSettingsHelper
Gitlab
::
CurrentSettings
.
enabled_git_access_protocol
.
present?
end
def
hide_instance_statistics?
(
user
=
current_user
)
Gitlab
::
CurrentSettings
.
instance_statistics_visibility_private?
&&
!
user
.
admin?
end
def
enabled_protocol
case
Gitlab
::
CurrentSettings
.
enabled_git_access_protocol
when
'http'
...
...
@@ -247,6 +251,7 @@ module ApplicationSettingsHelper
:unique_ips_limit_per_user
,
:unique_ips_limit_time_window
,
:usage_ping_enabled
,
:instance_statistics_visibility_private
,
:user_default_external
,
:user_oauth_applications
,
:version_check_enabled
,
...
...
app/models/application_setting.rb
View file @
866429f7
...
...
@@ -290,6 +290,7 @@ class ApplicationSetting < ActiveRecord::Base
user_default_external:
false
,
polling_interval_multiplier:
1
,
usage_ping_enabled:
Settings
.
gitlab
[
'usage_ping_enabled'
],
instance_statistics_visibility_private:
false
,
gitaly_timeout_fast:
10
,
gitaly_timeout_medium:
30
,
gitaly_timeout_default:
55
,
...
...
app/views/admin/application_settings/_usage.html.haml
View file @
866429f7
...
...
@@ -30,6 +30,9 @@
form. For more information, see the documentation on
=
succeed
'.'
do
=
link_to
'deactivating the usage ping'
,
help_page_path
(
'user/admin_area/settings/usage_statistics'
,
anchor:
'deactivate-the-usage-ping'
)
.form-group
=
f
.
label
:instance_statistics_visibility_private
,
'Instance Statistics visibility'
=
f
.
select
:instance_statistics_visibility_private
,
options_for_select
({
'All users'
=>
false
,
'Only admins'
=>
true
},
Gitlab
::
CurrentSettings
.
instance_statistics_visibility_private?
),
{},
class:
'form-control'
=
f
.
submit
'Save changes'
,
class:
"btn btn-success"
app/views/layouts/nav/_dashboard.html.haml
View file @
866429f7
...
...
@@ -70,6 +70,10 @@
=
nav_link
(
controller:
'admin/dashboard'
)
do
=
link_to
admin_root_path
,
class:
'admin-icon qa-admin-area-link'
,
title:
_
(
'Admin area'
),
aria:
{
label:
_
(
"Admin area"
)
},
data:
{
toggle:
'tooltip'
,
placement:
'bottom'
,
container:
'body'
}
do
=
sprite_icon
(
'admin'
,
size:
18
)
-
unless
hide_instance_statistics?
=
nav_link
(
controller: :instance_statistics
)
do
=
link_to
instance_statistics_root_path
,
title:
'Instance statistics'
,
aria:
{
label:
'Instance statistics'
},
data:
{
toggle:
'tooltip'
,
placement:
'bottom'
,
container:
'body'
}
do
=
sprite_icon
(
'chart'
,
size:
18
)
-
if
Gitlab
::
Sherlock
.
enabled?
%li
=
link_to
sherlock_transactions_path
,
class:
'admin-icon'
,
title:
_
(
'Sherlock Transactions'
),
...
...
db/migrate/20180718005113_add_instance_statistics_visibility_to_application_setting.rb
0 → 100644
View file @
866429f7
class
AddInstanceStatisticsVisibilityToApplicationSetting
<
ActiveRecord
::
Migration
include
Gitlab
::
Database
::
MigrationHelpers
DOWNTIME
=
false
disable_ddl_transaction!
def
up
add_column_with_default
(
:application_settings
,
:instance_statistics_visibility_private
,
:boolean
,
default:
false
,
allow_null:
false
)
end
def
down
remove_column
(
:application_settings
,
:instance_statistics_visibility_private
)
end
end
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