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:
- "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/new.html.haml"
- "ee/app/views/admin/licenses/show.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/users/_auditor_access_level_radio.html.haml"
......
......@@ -272,4 +272,5 @@ en:
long: "%B %d, %Y %H:%M"
short: "%d %b %H:%M"
timeago_tooltip: "%b %-d, %Y %-l:%M%P"
with_timezone: "%Y-%m-%d %H:%M:%S %z"
pm: pm
......@@ -4,7 +4,7 @@
- restricted = license.restrictions[:active_user_count]
- licensed_users = number_with_delimiter(restricted)
- else
- licensed_users = 'Unlimited'
- licensed_users = _('Unlimited')
- 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 'Upload New License', new_admin_license_path, class: "btn float-right btn-upload-license append-right-10"
= 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', data: { qa_selector: 'license_upload_link' }
......@@ -13,7 +13,8 @@
.container.blank-state-container
.text-center
= 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?
%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"
......
- page_title "License"
- page_title _('License')
- if Feature.enabled?(:licenses_app)
#instance-license-mount-element{ license_app_data }
- else
%h3.page-title
Your License
= _('Your License')
- if @license&.trial?
= render "upload_buy_license"
= render 'upload_buy_license'
- 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
......@@ -16,111 +16,10 @@
.gl-alert.gl-alert-info
= sprite_icon('information-o', size: 16, css_class: 'gl-icon gl-alert-icon gl-alert-icon-no-title')
.gl-alert-body
%h4.gl-alert-title= s_('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.')
%h4.gl-alert-title= _('You do not have an active license')
= _('You have a license that activates at a future date. Please see the License History table below.')
- if @license.present?
.row
.col-md-6
.card
.card-header
Licensed to
%ul.content-list
- @license.licensee.each do |label, value|
%li
%span.light #{label}:
%strong= value
= render 'info', license: @license
= render 'breakdown', license: @license
.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 #{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
= render 'license_history', license: @license, licenses: @licenses
......@@ -36,7 +36,7 @@ describe "Admin uploads 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.")
.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
......@@ -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.")
.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
......
......@@ -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[:company])
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(license.starts_at)
expect(highlighted_license_row).to have_content(license.expires_at)
expect(highlighted_license_row).to have_content(I18n.l(license.created_at, format: :with_timezone))
expect(highlighted_license_row).to have_content(I18n.l(license.starts_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])
end
end
......@@ -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[:company])
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(license.starts_at)
expect(license_history_row).to have_content(license.expires_at)
expect(license_history_row).to have_content(I18n.l(license.created_at, format: :with_timezone))
expect(license_history_row).to have_content(I18n.l(license.starts_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])
end
end
......
......@@ -1151,6 +1151,9 @@ msgstr ""
msgid "Active Users:"
msgstr ""
msgid "Active users"
msgstr ""
msgid "Activity"
msgstr ""
......@@ -2690,6 +2693,9 @@ msgstr ""
msgid "Are you sure you want to remove the attachment?"
msgstr ""
msgid "Are you sure you want to remove the license?"
msgstr ""
msgid "Are you sure you want to remove this identity?"
msgstr ""
......@@ -3561,6 +3567,9 @@ msgstr ""
msgid "Business metrics (Custom)"
msgstr ""
msgid "Buy License"
msgstr ""
msgid "Buy more Pipeline minutes"
msgstr ""
......@@ -6631,6 +6640,9 @@ msgstr ""
msgid "CustomCycleAnalytics|Update stage"
msgstr ""
msgid "Customer Portal"
msgstr ""
msgid "Customize colors"
msgstr ""
......@@ -8973,6 +8985,9 @@ msgstr ""
msgid "Expired %{expiredOn}"
msgstr ""
msgid "Expired:"
msgstr ""
msgid "Expires"
msgstr ""
......@@ -8982,6 +8997,9 @@ msgstr ""
msgid "Expires in %{expires_at}"
msgstr ""
msgid "Expires on"
msgstr ""
msgid "Expires:"
msgstr ""
......@@ -11467,6 +11485,9 @@ msgstr ""
msgid "If enabled, and if object storage is enabled, GitLab will handle Object Storage replication using Geo"
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}."
msgstr ""
......@@ -11491,6 +11512,9 @@ msgstr ""
msgid "If you recently signed in and recognize the IP address, you may disregard this email."
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."
msgstr ""
......@@ -12689,6 +12713,9 @@ msgstr ""
msgid "License Compliance"
msgstr ""
msgid "License History"
msgstr ""
msgid "License-Check"
msgstr ""
......@@ -15761,6 +15788,12 @@ msgstr ""
msgid "Plain diff"
msgstr ""
msgid "Plan"
msgstr ""
msgid "Plan:"
msgstr ""
msgid "PlantUML"
msgstr ""
......@@ -17883,6 +17916,9 @@ msgstr ""
msgid "Remove group"
msgstr ""
msgid "Remove license"
msgstr ""
msgid "Remove limit"
msgstr ""
......@@ -20580,6 +20616,9 @@ msgstr ""
msgid "Started asynchronous removal of all repository check states."
msgstr ""
msgid "Started:"
msgstr ""
msgid "Starting..."
msgstr ""
......@@ -20709,6 +20748,9 @@ msgstr ""
msgid "Stay updated about the performance and health of your environment by configuring Prometheus to monitor your deployments."
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"
msgstr ""
......@@ -23476,6 +23518,9 @@ msgstr ""
msgid "Upload New File"
msgstr ""
msgid "Upload New License"
msgstr ""
msgid "Upload a certificate for your domain with all intermediates"
msgstr ""
......@@ -23494,6 +23539,9 @@ msgstr ""
msgid "Uploaded on"
msgstr ""
msgid "Uploaded:"
msgstr ""
msgid "Uploading changes to terminal"
msgstr ""
......@@ -23989,6 +24037,9 @@ msgstr ""
msgid "Using required encryption strategy when encrypted field is missing!"
msgstr ""
msgid "Valid from"
msgstr ""
msgid "Validate"
msgstr ""
......@@ -25039,7 +25090,7 @@ msgstr ""
msgid "You don’t have access to Value Stream Analytics for this group"
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 ""
msgid "You have been granted %{access_level} access to the %{source_link} %{source_type}."
......@@ -25273,6 +25324,9 @@ msgstr ""
msgid "Your Groups"
msgstr ""
msgid "Your License"
msgstr ""
msgid "Your Personal Access Tokens will expire in %{days_to_expire} days or less"
msgstr ""
......@@ -25375,6 +25429,9 @@ msgstr ""
msgid "Your license is valid from"
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"
msgstr ""
......
......@@ -10,7 +10,10 @@ module QA
end
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
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