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
d00eb7e2
Commit
d00eb7e2
authored
May 09, 2015
by
Douwe Maan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Tweak presentation and error around historical user count.
parent
4ffa34a4
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
40 additions
and
35 deletions
+40
-35
app/controllers/admin/licenses_controller.rb
app/controllers/admin/licenses_controller.rb
+0
-1
app/models/license.rb
app/models/license.rb
+15
-16
app/views/admin/licenses/show.html.haml
app/views/admin/licenses/show.html.haml
+25
-18
No files found.
app/controllers/admin/licenses_controller.rb
View file @
d00eb7e2
...
...
@@ -5,7 +5,6 @@ class Admin::LicensesController < Admin::ApplicationController
respond_to
:html
def
show
@historical_active_user_count
=
HistoricalData
.
during
(
license
.
issued_at
..
Date
.
today
).
maximum
(
:active_user_count
)
@previous_licenses
=
License
.
previous
end
...
...
app/models/license.rb
View file @
d00eb7e2
...
...
@@ -95,27 +95,26 @@ class License < ActiveRecord::Base
restricted_user_count
=
self
.
restrictions
[
:active_user_count
]
active_user_count
=
User
.
active
.
count
historical_active_user_count
=
HistoricalData
.
maximum
(
:active_user_count
)
||
0
if
active_user_count
>
restricted_user_count
message
=
"This license allows
#{
restricted_user_count
}
active users. "
message
<<
"This GitLab installation currently has
#{
active_user_count
}
, "
message
<<
"i.e.
#{
active_user_count
-
restricted_user_count
}
too many."
max_active_user_count
=
[
active_user_count
,
historical_active_user_count
].
max
self
.
errors
.
add
(
:base
,
message
)
return
end
return
if
max_active_user_count
<
restricted_user_count
if
License
.
current
historical_active_user_count
=
HistoricalData
.
during
(
License
.
current
.
issued_at
..
Date
.
today
).
maximum
(
:active_user_count
)
too_many
=
max_active_user_count
-
restricted_user_count
if
historical_active_user_count
&&
historical_active_user_count
>
restricted_user_count
message
=
"This license allows
#{
restricted_user_count
}
active users. "
message
<<
"At one point during the life of the previous license, this GitLab installation had "
message
<<
"
#{
historical_active_user_count
}
active users,
"
message
<<
"i.e.
#{
historical_active_user_count
-
restricted_user_count
}
too many."
self
.
errors
.
add
(
:base
,
message
)
message
=
"This license allows
#{
restricted_user_count
}
active users. "
message
<<
if
historical_active_user_count
>
active_user_count
"At one point, this GitLab installation had
"
else
"Currently, this GitLab installation has "
end
end
message
<<
"
#{
max_active_user_count
}
active users, "
message
<<
"i.e.
#{
too_many
}
too many. "
message
<<
"Please upload a license for at least
#{
max_active_user_count
}
users."
self
.
errors
.
add
(
:base
,
message
)
end
def
not_expired
...
...
app/views/admin/licenses/show.html.haml
View file @
d00eb7e2
...
...
@@ -35,38 +35,45 @@
%strong
-
if
@license
.
will_expire?
=
time_ago_with_tooltip
@license
.
expires_at
-
if
@license
.
expired?
%span
.label.label-danger.pull-right
%strong
Expired
-
else
Never
-
if
@license
.
expired?
%span
.label.label-danger.pull-right
%strong
Expired
.panel.panel-default
.panel-heading
Restriction
s
User
s
%ul
.well-list
%li
%span
.light
Active
users:
%span
.light
Licensed
users:
%strong
-
if
@license
.
restricted?
(
:active_user_count
)
-
restricted
=
@license
.
restrictions
[
:active_user_count
]
-
current
=
User
.
active
.
count
-
historical
=
@historical_active_user_count
#{
restricted
}
users
-
else
Unlimited
%li
%span
.light
Current active users:
%strong
-
current
=
User
.
active
.
count
#{
current
}
users
-
if
historical
&&
historical
>
restricted
&&
current
<
restricted
%span
.label.label-danger.pull-right.prepend-left-10
%strong
Maximum during license life:
#{
historical
}
users
-
if
restricted
&&
current
>
restricted
%span
.label.label-danger.pull-right
%strong
Exceeds license
-
label_class
=
current
>
restricted
?
"danger"
:
restricted
>
current
?
"success"
:
"info"
%span
.label.pull-right
{
class:
"label-#{label_class}"
}
%strong
Current:
#{
current
}
users
-
historical
=
HistoricalData
.
maximum
(
:active_user_count
)
-
if
historical
%li
%span
.light
Maximum active users:
%strong
#{
historical
}
users
-
else
Unlimited
-
if
restricted
&&
historical
>
restricted
%span
.label.label-danger.pull-right
%strong
Exceeds license
.col-md-6
.panel.panel-info
...
...
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