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
34f6830c
Commit
34f6830c
authored
Jun 30, 2016
by
Stan Hu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add license breakdown to admin pages
Closes #653
parent
dab9481b
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
86 additions
and
36 deletions
+86
-36
app/controllers/admin/dashboard_controller.rb
app/controllers/admin/dashboard_controller.rb
+1
-0
app/views/admin/dashboard/index.html.haml
app/views/admin/dashboard/index.html.haml
+3
-0
app/views/admin/licenses/_breakdown.html.haml
app/views/admin/licenses/_breakdown.html.haml
+50
-0
app/views/admin/licenses/show.html.haml
app/views/admin/licenses/show.html.haml
+2
-36
spec/features/admin/admin_license_spec.rb
spec/features/admin/admin_license_spec.rb
+30
-0
No files found.
app/controllers/admin/dashboard_controller.rb
View file @
34f6830c
...
...
@@ -3,5 +3,6 @@ class Admin::DashboardController < Admin::ApplicationController
@projects
=
Project
.
limit
(
10
)
@users
=
User
.
limit
(
10
)
@groups
=
Group
.
limit
(
10
)
@license
=
License
.
current
end
end
app/views/admin/dashboard/index.html.haml
View file @
34f6830c
...
...
@@ -2,6 +2,9 @@
=
render
"admin/dashboard/head"
%div
{
class:
container_class
}
-
if
@license
=
render
"admin/licenses/breakdown"
,
license:
@license
.admin-dashboard.prepend-top-default
.row
.col-md-4
...
...
app/views/admin/licenses/_breakdown.html.haml
0 → 100644
View file @
34f6830c
-
if
license
.
restricted?
(
:active_user_count
)
-
restricted
=
license
.
restrictions
[
:active_user_count
]
-
licensed_users
=
number_with_delimiter
(
restricted
)
-
else
-
licensed_users
=
'Unlimited'
-
date_range
=
(
Date
.
today
-
1
.
year
)
..
Date
.
today
-
historical
=
HistoricalData
.
during
(
date_range
).
maximum
(
:active_user_count
)
||
0
-
if
historical
&&
restricted
&&
historical
>
restricted
-
users_over_license
=
historical
-
restricted
-
else
-
users_over_license
=
0
.license-panel.prepend-top-default
.row
.col-sm-4
.light-well
%h4
Users in License
.data
%h1
.center
=
licensed_users
%hr
-
if
@license
.
will_expire?
Your license is valid from
%strong
#{
@license
.
starts_at
}
to
%strong<>
#{
@license
.
expires_at
}
\.
The
%a
{
href:
'https://about.gitlab.com/license-faq/'
}
true-up model
allows having more users, and additional users will incur a retroactive charge on renewal.
.col-sm-4
.light-well
%h4
Maximum Users
.data
%h1
.center
=
number_with_delimiter
historical
%hr
This is the highest peak of users on your installation since the license started, and this is the minimum
number you need to purchase when you renew your license.
.col-sm-4
.light-well
%h4
Users over License
.data
%h1
.center
=
number_with_delimiter
users_over_license
%hr
The
%a
{
href:
'https://about.gitlab.com/license-faq/'
}
true-up model
has a retroactive charge for these users at the next renewal. If you want to update your
license sooner to prevent this, please contact
#{
mail_to
'sales@gitlab.com'
}
.
app/views/admin/licenses/show.html.haml
View file @
34f6830c
...
...
@@ -42,42 +42,6 @@
%span
.label.label-danger.pull-right
%strong
Expired
.panel.panel-default
.panel-heading
Users
%ul
.well-list
%li
%span
.light
License limit:
%strong
-
if
@license
.
restricted?
(
:active_user_count
)
-
restricted
=
@license
.
restrictions
[
:active_user_count
]
#{
number_with_delimiter
restricted
}
#{
"users"
.
pluralize
(
restricted
)
}
-
else
Unlimited
%li
%span
.light
Current active users:
%strong
-
current
=
User
.
active
.
count
#{
number_with_delimiter
current
}
#{
"users"
.
pluralize
(
current
)
}
-
if
restricted
&&
current
>
restricted
%span
.label.label-danger.pull-right
%strong
Exceeds license limit
-
date_range
=
(
Date
.
today
-
1
.
year
)
..
Date
.
today
-
historical
=
HistoricalData
.
during
(
date_range
).
maximum
(
:active_user_count
)
-
if
historical
%li
%span
.light
Maximum active users:
%strong
#{
number_with_delimiter
historical
}
#{
"users"
.
pluralize
(
historical
)
}
-
if
restricted
&&
historical
>
restricted
%span
.label.label-danger.pull-right
%strong
Exceeds license limit
.col-md-6
.panel.panel-info
.panel-heading
...
...
@@ -98,6 +62,8 @@
%br
=
link_to
'Remove license'
,
admin_license_path
,
data:
{
confirm:
"Are you sure you want to remove the license?"
},
method: :delete
,
class:
"btn btn-remove"
=
render
"breakdown"
,
license:
@license
-
if
@previous_licenses
.
any?
%h4
License History
...
...
spec/features/admin/admin_license_spec.rb
0 → 100644
View file @
34f6830c
require
'spec_helper'
feature
"License Admin"
,
feature:
true
do
before
do
login_as
:admin
end
describe
'#show'
do
it
'shows a valid license'
do
visit
admin_license_path
expect
(
page
).
to
have_content
(
'Your license is valid'
)
page
.
within
'.license-panel'
do
expect
(
page
).
to
have_content
(
'Unlimited'
)
end
end
describe
'limited users'
do
it
'shows panel counts'
do
restrictions
=
{
active_user_count:
2000
}
allow_any_instance_of
(
Gitlab
::
License
).
to
receive
(
:restrictions
).
and_return
(
restrictions
)
visit
admin_license_path
page
.
within
'.license-panel'
do
expect
(
page
).
to
have_content
(
'2,000'
)
end
end
end
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