Commit 67e63e22 authored by Andrew Fontaine's avatar Andrew Fontaine

Merge branch 'refactor_license_page' into 'master'

Refactor license page

Closes #217560

See merge request gitlab-org/gitlab!32425
parents 4bba2799 6abd18e7
...@@ -324,7 +324,6 @@ linters: ...@@ -324,7 +324,6 @@ linters:
- "ee/app/views/admin/geo/projects/_registry_never.html.haml" - "ee/app/views/admin/geo/projects/_registry_never.html.haml"
- "ee/app/views/admin/licenses/_upload_trial_license.html.haml" - "ee/app/views/admin/licenses/_upload_trial_license.html.haml"
- "ee/app/views/admin/licenses/new.html.haml" - "ee/app/views/admin/licenses/new.html.haml"
- "ee/app/views/admin/licenses/show.html.haml"
- "ee/app/views/admin/monitoring/ee/_nav.html.haml" - "ee/app/views/admin/monitoring/ee/_nav.html.haml"
- "ee/app/views/admin/projects/_shared_runner_status.html.haml" - "ee/app/views/admin/projects/_shared_runner_status.html.haml"
- "ee/app/views/admin/users/_auditor_access_level_radio.html.haml" - "ee/app/views/admin/users/_auditor_access_level_radio.html.haml"
......
...@@ -272,4 +272,5 @@ en: ...@@ -272,4 +272,5 @@ en:
long: "%B %d, %Y %H:%M" long: "%B %d, %Y %H:%M"
short: "%d %b %H:%M" short: "%d %b %H:%M"
timeago_tooltip: "%b %-d, %Y %-l:%M%P" timeago_tooltip: "%b %-d, %Y %-l:%M%P"
with_timezone: "%Y-%m-%d %H:%M:%S %z"
pm: pm pm: pm
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
- restricted = license.restrictions[:active_user_count] - restricted = license.restrictions[:active_user_count]
- licensed_users = number_with_delimiter(restricted) - licensed_users = number_with_delimiter(restricted)
- else - else
- licensed_users = 'Unlimited' - licensed_users = _('Unlimited')
- max_user_count = maximum_user_count - max_user_count = maximum_user_count
......
- return unless local_assigns.fetch(:license)
.row
.col-md-6
.card
.card-header
= _('Licensed to')
%ul.content-list
- @license.licensee.each do |label, value|
%li
%span.light= succeed(':') { label }
%strong= value
.card.js-license-info-panel
.card-header
= _('Details')
%ul.content-list
%li
%span.light= _('Plan:')
%strong= @license.plan.capitalize
%li
%span.light= _('Uploaded:')
%strong= time_ago_with_tooltip @license.created_at
%li
%span.light= _('Started:')
%strong= time_ago_with_tooltip @license.starts_at
%li
%span.light
- if @license.expired?
= _('Expired:')
- else
= _('Expires:')
- if @license.will_expire? && !@license.expired?
- if @license.trial?
%strong.has-tooltip{ title: @license.expires_at.to_formatted_s(:long), data: { placement: 'top' } }
= _('Free trial will expire in %{days}' % { days: pluralize(@license.remaining_days, 'day') })
- else
%strong= time_ago_with_tooltip(@license.expires_at)
- else
%strong= _('Never')
- if @license.expired?
%span.badge.badge-danger.float-right
%strong= _('Expired')
.col-md-6
.card.border-info
.card-header.bg-info.text-white
= _('Download license')
.card-body
%p= _('Your license will be included in your GitLab backup and will survive upgrades, so in normal usage you should never need to re-upload your <code>.gitlab-license</code> file.').html_safe
%p= _('Still, we recommend keeping a backup saved somewhere. Otherwise, if you ever need it and have lost it, you will need to request GitLab Inc. to send it to you again.')
%br
= link_to _('Download license'), download_admin_license_path, class: 'btn btn-info'
= link_to _('Customer Portal'), 'https://customers.gitlab.com', class: 'btn btn-info btn-inverted', data: { track_event: 'click_text', track_label: 'license_dashboard', track_property: 'customer_portal' }, target: '_blank', rel: 'noopener noreferrer'
.card.border-danger
.card-header.bg-danger.text-white
= _('Remove license')
.card-body
%p= _('If you remove this license, GitLab will fall back on the previous license, if any.')
%p= _('If there is no previous license or if the previous license has expired, some GitLab functionality will be blocked until a new, valid license is uploaded.')
%br
= link_to _('Remove license'), admin_license_path, data: { confirm: _('Are you sure you want to remove the license?'), qa_selector: 'remove_license_link' }, method: :delete, class: 'btn btn-remove'
- return unless local_assigns.fetch(:licenses)
- local_assigns.fetch(:license)
- licensee_keys = @licenses.first.licensee.keys
%h4= _('License History')
.card#license_history
%table.table
%thead.card-header
%tr
- licensee_keys.each do |label|
%th= label
%th= _('Plan')
%th= _('Uploaded on')
%th= _('Valid from')
%th= _('Expires on')
%th= _('Active users')
%tbody
- @licenses.each do |license|
%tr{ class: ('gl-bg-blue-50 font-weight-bold gl-text-blue-500' if license == @license), data: { testid: ('license-current' if license == @license) } }
- licensee_keys.each do |label|
%td= license.licensee[label]
%td
%span
= license.plan.capitalize
%td
%span
= l(license.created_at, format: :with_timezone)
%td
%span
= l(license.starts_at)
%td
%span
= license.expires_at.present? ? l(license.expires_at) : _('Never')
%td
%span
- if license.restricted?(:active_user_count)
= license.restrictions[:active_user_count]
- else
= _('Unlimited')
= link_to 'Buy License', ::EE::SUBSCRIPTIONS_PLANS_URL, target: '_blank', rel: 'noopener noreferrer nofollow', class: "btn btn-success btn-inverted float-right btn-buy-license" = link_to _('Buy License'), ::EE::SUBSCRIPTIONS_PLANS_URL, target: '_blank', rel: 'noopener noreferrer nofollow', class: 'btn btn-success btn-inverted float-right btn-buy-license'
= link_to 'Upload New License', new_admin_license_path, class: "btn float-right btn-upload-license append-right-10" = link_to _('Upload New License'), new_admin_license_path, class: 'btn float-right btn-upload-license append-right-10', data: { qa_selector: 'license_upload_link' }
...@@ -13,7 +13,8 @@ ...@@ -13,7 +13,8 @@
.container.blank-state-container .container.blank-state-container
.text-center .text-center
= custom_icon("missing_license") = custom_icon("missing_license")
%h4.qa-missing-license= s_('License|You do not have a license.') %h4{ data: { qa_selector: 'missing_license' } }
= s_('License|You do not have a license.')
- if License.eligible_for_trial? - if License.eligible_for_trial?
%p.trial-description= s_('License|You can start a free trial of GitLab Ultimate without any obligation or payment details.') %p.trial-description= s_('License|You can start a free trial of GitLab Ultimate without any obligation or payment details.')
= link_to 'Start free trial', new_trial_url, target: '_blank', class: "btn btn-success btn-start-trial prepend-top-10" = link_to 'Start free trial', new_trial_url, target: '_blank', class: "btn btn-success btn-start-trial prepend-top-10"
......
- page_title "License" - page_title _('License')
- if Feature.enabled?(:licenses_app) - if Feature.enabled?(:licenses_app)
#instance-license-mount-element{ license_app_data } #instance-license-mount-element{ license_app_data }
- else - else
%h3.page-title %h3.page-title
Your License = _('Your License')
- if @license&.trial? - if @license&.trial?
= render "upload_buy_license" = render 'upload_buy_license'
- else - else
= link_to 'Upload New License', new_admin_license_path, class: "btn btn-success float-right" = link_to _('Upload New License'), new_admin_license_path, class: 'btn btn-success float-right', data: { qa_selector: 'license_upload_link' }
%hr %hr
...@@ -16,111 +16,10 @@ ...@@ -16,111 +16,10 @@
.gl-alert.gl-alert-info .gl-alert.gl-alert-info
= sprite_icon('information-o', size: 16, css_class: 'gl-icon gl-alert-icon gl-alert-icon-no-title') = sprite_icon('information-o', size: 16, css_class: 'gl-icon gl-alert-icon gl-alert-icon-no-title')
.gl-alert-body .gl-alert-body
%h4.gl-alert-title= s_('You do not have an active license') %h4.gl-alert-title= _('You do not have an active license')
= s_('You have a license(s) that activates at a future date. Please see the License History table below.') = _('You have a license that activates at a future date. Please see the License History table below.')
- if @license.present? = render 'info', license: @license
.row = render 'breakdown', license: @license
.col-md-6
.card
.card-header
Licensed to
%ul.content-list
- @license.licensee.each do |label, value|
%li
%span.light #{label}:
%strong= value
.card.js-license-info-panel = render 'license_history', license: @license, licenses: @licenses
.card-header
Details
%ul.content-list
%li
%span.light Plan:
%strong= @license.plan.capitalize
%li
%span.light Uploaded:
%strong= time_ago_with_tooltip @license.created_at
%li
%span.light Started:
%strong= time_ago_with_tooltip @license.starts_at
%li
%span.light
- if @license.expired?
Expired:
- else
Expires:
- if @license.will_expire? && !@license.expired?
- if @license.trial?
%strong.has-tooltip{ title: @license.expires_at.to_formatted_s(:long), data: { placement: 'top' } }
Free trial will expire in #{pluralize(@license.remaining_days, 'day')}
- else
%strong= time_ago_with_tooltip(@license.expires_at)
- else
%strong Never
- if @license.expired?
%span.badge.badge-danger.float-right
%strong Expired
.col-md-6
.card.border-info
.card-header.bg-info.text-white
Download license
.card-body
%p Your license will be included in your GitLab backup and will survive upgrades, so in normal usage you should never need to re-upload your <code>.gitlab-license</code> file.
%p Still, we recommend keeping a backup saved somewhere. Otherwise, if you ever need it and have lost it, you will need to request GitLab Inc. to send it to you again.
%br
= link_to 'Download license', download_admin_license_path, class: "btn btn-info"
= link_to 'Customer Portal', 'https://customers.gitlab.com', class: 'btn btn-info btn-inverted', data: { track_event: 'click_text', track_label: 'license_dashboard', track_property: 'customer_portal' }, target: '_blank', rel: 'noopener noreferrer'
.card.border-danger
.card-header.bg-danger.text-white
Remove license
.card-body
%p If you remove this license, GitLab will fall back on the previous license, if any.
%p If there is no previous license or if the previous license has expired, some GitLab functionality will be blocked until a new, valid license is uploaded.
%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 qa-remove-license-link"
= render "breakdown", license: @license
- if @licenses.any?
- licensee_keys = @licenses.first.licensee.keys
%h4 License History
.card#license_history
%table.table
%thead.card-header
%tr
- licensee_keys.each do |label|
%th= label
%th Plan
%th Uploaded on
%th Valid from
%th Expires on
%th Active users
%tbody
- @licenses.each do |license|
%tr{ class: ('gl-bg-blue-50 font-weight-bold gl-text-blue-500' if license == @license), data: { testid: ('license-current' if license == @license) } }
- licensee_keys.each do |label|
%td= license.licensee[label]
%td
%span
= license.plan.capitalize
%td
%span
= license.created_at
%td
%span
= license.starts_at
%td
%span
= license.expires_at || "Never"
%td
%span
- if license.restricted?(:active_user_count)
= license.restrictions[:active_user_count]
- else
Unlimited
...@@ -36,7 +36,7 @@ describe "Admin uploads license" do ...@@ -36,7 +36,7 @@ describe "Admin uploads license" do
it "installs license" do it "installs license" do
expect(page).to have_content("The license was successfully uploaded and will be active from #{license.starts_at}. You can see the details below.") expect(page).to have_content("The license was successfully uploaded and will be active from #{license.starts_at}. You can see the details below.")
.and have_content("You have a license(s) that activates at a future date. Please see the License History table below.") .and have_content("You have a license that activates at a future date. Please see the License History table below.")
end end
end end
end end
...@@ -97,7 +97,7 @@ describe "Admin uploads license" do ...@@ -97,7 +97,7 @@ describe "Admin uploads license" do
expect(page).to have_content("The license was successfully uploaded and will be active from #{license.starts_at}. You can see the details below.") expect(page).to have_content("The license was successfully uploaded and will be active from #{license.starts_at}. You can see the details below.")
.and have_content(license.licensee.each_value.first) .and have_content(license.licensee.each_value.first)
.and have_content("You have a license(s) that activates at a future date. Please see the License History table below.") .and have_content("You have a license that activates at a future date. Please see the License History table below.")
end end
end end
end end
......
...@@ -60,9 +60,9 @@ describe "Admin views license" do ...@@ -60,9 +60,9 @@ describe "Admin views license" do
expect(highlighted_license_row).to have_content(license.licensee[:email]) expect(highlighted_license_row).to have_content(license.licensee[:email])
expect(highlighted_license_row).to have_content(license.licensee[:company]) expect(highlighted_license_row).to have_content(license.licensee[:company])
expect(highlighted_license_row).to have_content(license.plan.capitalize) expect(highlighted_license_row).to have_content(license.plan.capitalize)
expect(highlighted_license_row).to have_content(license.created_at) expect(highlighted_license_row).to have_content(I18n.l(license.created_at, format: :with_timezone))
expect(highlighted_license_row).to have_content(license.starts_at) expect(highlighted_license_row).to have_content(I18n.l(license.starts_at))
expect(highlighted_license_row).to have_content(license.expires_at) expect(highlighted_license_row).to have_content(I18n.l(license.expires_at))
expect(highlighted_license_row).to have_content(license.restrictions[:active_user_count]) expect(highlighted_license_row).to have_content(license.restrictions[:active_user_count])
end end
end end
...@@ -114,9 +114,9 @@ describe "Admin views license" do ...@@ -114,9 +114,9 @@ describe "Admin views license" do
expect(license_history_row).to have_content(license.licensee[:email]) expect(license_history_row).to have_content(license.licensee[:email])
expect(license_history_row).to have_content(license.licensee[:company]) expect(license_history_row).to have_content(license.licensee[:company])
expect(license_history_row).to have_content(license.plan.capitalize) expect(license_history_row).to have_content(license.plan.capitalize)
expect(license_history_row).to have_content(license.created_at) expect(license_history_row).to have_content(I18n.l(license.created_at, format: :with_timezone))
expect(license_history_row).to have_content(license.starts_at) expect(license_history_row).to have_content(I18n.l(license.starts_at))
expect(license_history_row).to have_content(license.expires_at) expect(license_history_row).to have_content(I18n.l(license.expires_at))
expect(license_history_row).to have_content(license.restrictions[:active_user_count]) expect(license_history_row).to have_content(license.restrictions[:active_user_count])
end end
end end
......
...@@ -1151,6 +1151,9 @@ msgstr "" ...@@ -1151,6 +1151,9 @@ msgstr ""
msgid "Active Users:" msgid "Active Users:"
msgstr "" msgstr ""
msgid "Active users"
msgstr ""
msgid "Activity" msgid "Activity"
msgstr "" msgstr ""
...@@ -2690,6 +2693,9 @@ msgstr "" ...@@ -2690,6 +2693,9 @@ msgstr ""
msgid "Are you sure you want to remove the attachment?" msgid "Are you sure you want to remove the attachment?"
msgstr "" msgstr ""
msgid "Are you sure you want to remove the license?"
msgstr ""
msgid "Are you sure you want to remove this identity?" msgid "Are you sure you want to remove this identity?"
msgstr "" msgstr ""
...@@ -3561,6 +3567,9 @@ msgstr "" ...@@ -3561,6 +3567,9 @@ msgstr ""
msgid "Business metrics (Custom)" msgid "Business metrics (Custom)"
msgstr "" msgstr ""
msgid "Buy License"
msgstr ""
msgid "Buy more Pipeline minutes" msgid "Buy more Pipeline minutes"
msgstr "" msgstr ""
...@@ -6631,6 +6640,9 @@ msgstr "" ...@@ -6631,6 +6640,9 @@ msgstr ""
msgid "CustomCycleAnalytics|Update stage" msgid "CustomCycleAnalytics|Update stage"
msgstr "" msgstr ""
msgid "Customer Portal"
msgstr ""
msgid "Customize colors" msgid "Customize colors"
msgstr "" msgstr ""
...@@ -8973,6 +8985,9 @@ msgstr "" ...@@ -8973,6 +8985,9 @@ msgstr ""
msgid "Expired %{expiredOn}" msgid "Expired %{expiredOn}"
msgstr "" msgstr ""
msgid "Expired:"
msgstr ""
msgid "Expires" msgid "Expires"
msgstr "" msgstr ""
...@@ -8982,6 +8997,9 @@ msgstr "" ...@@ -8982,6 +8997,9 @@ msgstr ""
msgid "Expires in %{expires_at}" msgid "Expires in %{expires_at}"
msgstr "" msgstr ""
msgid "Expires on"
msgstr ""
msgid "Expires:" msgid "Expires:"
msgstr "" msgstr ""
...@@ -11467,6 +11485,9 @@ msgstr "" ...@@ -11467,6 +11485,9 @@ msgstr ""
msgid "If enabled, and if object storage is enabled, GitLab will handle Object Storage replication using Geo" msgid "If enabled, and if object storage is enabled, GitLab will handle Object Storage replication using Geo"
msgstr "" msgstr ""
msgid "If there is no previous license or if the previous license has expired, some GitLab functionality will be blocked until a new, valid license is uploaded."
msgstr ""
msgid "If this was a mistake you can %{leave_link_start}leave the %{source_type}%{link_end}." msgid "If this was a mistake you can %{leave_link_start}leave the %{source_type}%{link_end}."
msgstr "" msgstr ""
...@@ -11491,6 +11512,9 @@ msgstr "" ...@@ -11491,6 +11512,9 @@ msgstr ""
msgid "If you recently signed in and recognize the IP address, you may disregard this email." msgid "If you recently signed in and recognize the IP address, you may disregard this email."
msgstr "" msgstr ""
msgid "If you remove this license, GitLab will fall back on the previous license, if any."
msgstr ""
msgid "If your HTTP repository is not publicly accessible, add your credentials." msgid "If your HTTP repository is not publicly accessible, add your credentials."
msgstr "" msgstr ""
...@@ -12689,6 +12713,9 @@ msgstr "" ...@@ -12689,6 +12713,9 @@ msgstr ""
msgid "License Compliance" msgid "License Compliance"
msgstr "" msgstr ""
msgid "License History"
msgstr ""
msgid "License-Check" msgid "License-Check"
msgstr "" msgstr ""
...@@ -15761,6 +15788,12 @@ msgstr "" ...@@ -15761,6 +15788,12 @@ msgstr ""
msgid "Plain diff" msgid "Plain diff"
msgstr "" msgstr ""
msgid "Plan"
msgstr ""
msgid "Plan:"
msgstr ""
msgid "PlantUML" msgid "PlantUML"
msgstr "" msgstr ""
...@@ -17883,6 +17916,9 @@ msgstr "" ...@@ -17883,6 +17916,9 @@ msgstr ""
msgid "Remove group" msgid "Remove group"
msgstr "" msgstr ""
msgid "Remove license"
msgstr ""
msgid "Remove limit" msgid "Remove limit"
msgstr "" msgstr ""
...@@ -20580,6 +20616,9 @@ msgstr "" ...@@ -20580,6 +20616,9 @@ msgstr ""
msgid "Started asynchronous removal of all repository check states." msgid "Started asynchronous removal of all repository check states."
msgstr "" msgstr ""
msgid "Started:"
msgstr ""
msgid "Starting..." msgid "Starting..."
msgstr "" msgstr ""
...@@ -20709,6 +20748,9 @@ msgstr "" ...@@ -20709,6 +20748,9 @@ msgstr ""
msgid "Stay updated about the performance and health of your environment by configuring Prometheus to monitor your deployments." msgid "Stay updated about the performance and health of your environment by configuring Prometheus to monitor your deployments."
msgstr "" msgstr ""
msgid "Still, we recommend keeping a backup saved somewhere. Otherwise, if you ever need it and have lost it, you will need to request GitLab Inc. to send it to you again."
msgstr ""
msgid "Stop Terminal" msgid "Stop Terminal"
msgstr "" msgstr ""
...@@ -23476,6 +23518,9 @@ msgstr "" ...@@ -23476,6 +23518,9 @@ msgstr ""
msgid "Upload New File" msgid "Upload New File"
msgstr "" msgstr ""
msgid "Upload New License"
msgstr ""
msgid "Upload a certificate for your domain with all intermediates" msgid "Upload a certificate for your domain with all intermediates"
msgstr "" msgstr ""
...@@ -23494,6 +23539,9 @@ msgstr "" ...@@ -23494,6 +23539,9 @@ msgstr ""
msgid "Uploaded on" msgid "Uploaded on"
msgstr "" msgstr ""
msgid "Uploaded:"
msgstr ""
msgid "Uploading changes to terminal" msgid "Uploading changes to terminal"
msgstr "" msgstr ""
...@@ -23989,6 +24037,9 @@ msgstr "" ...@@ -23989,6 +24037,9 @@ msgstr ""
msgid "Using required encryption strategy when encrypted field is missing!" msgid "Using required encryption strategy when encrypted field is missing!"
msgstr "" msgstr ""
msgid "Valid from"
msgstr ""
msgid "Validate" msgid "Validate"
msgstr "" msgstr ""
...@@ -25039,7 +25090,7 @@ msgstr "" ...@@ -25039,7 +25090,7 @@ msgstr ""
msgid "You don’t have access to Value Stream Analytics for this group" msgid "You don’t have access to Value Stream Analytics for this group"
msgstr "" msgstr ""
msgid "You have a license(s) that activates at a future date. Please see the License History table below." msgid "You have a license that activates at a future date. Please see the License History table below."
msgstr "" msgstr ""
msgid "You have been granted %{access_level} access to the %{source_link} %{source_type}." msgid "You have been granted %{access_level} access to the %{source_link} %{source_type}."
...@@ -25273,6 +25324,9 @@ msgstr "" ...@@ -25273,6 +25324,9 @@ msgstr ""
msgid "Your Groups" msgid "Your Groups"
msgstr "" msgstr ""
msgid "Your License"
msgstr ""
msgid "Your Personal Access Tokens will expire in %{days_to_expire} days or less" msgid "Your Personal Access Tokens will expire in %{days_to_expire} days or less"
msgstr "" msgstr ""
...@@ -25375,6 +25429,9 @@ msgstr "" ...@@ -25375,6 +25429,9 @@ msgstr ""
msgid "Your license is valid from" msgid "Your license is valid from"
msgstr "" msgstr ""
msgid "Your license will be included in your GitLab backup and will survive upgrades, so in normal usage you should never need to re-upload your <code>.gitlab-license</code> file."
msgstr ""
msgid "Your message here" msgid "Your message here"
msgstr "" msgstr ""
......
...@@ -10,7 +10,10 @@ module QA ...@@ -10,7 +10,10 @@ module QA
end end
view 'ee/app/views/admin/licenses/show.html.haml' do view 'ee/app/views/admin/licenses/show.html.haml' do
element :license_upload_link, "link_to 'Upload New License'" # rubocop:disable QA/ElementWithPattern element :license_upload_link
end
view 'ee/app/views/admin/licenses/_info.html.haml' do
element :remove_license_link element :remove_license_link
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment