From bbce13139d86c7cd9c35b32910768e98c15853d3 Mon Sep 17 00:00:00 2001 From: Ammar Alakkad <aalakkad@gitlab.com> Date: Sat, 10 Dec 2022 01:34:36 +0000 Subject: [PATCH] Update storage purchase messages Also removes the warning thresold Changelog: changed EE: true --- .../components/storage_inline_alert.vue | 35 ++++--------------- .../usage_quotas/storage/constants.js | 2 -- .../components/storage_inline_alert_spec.js | 27 ++------------ .../usage_quotas/storage/utils_spec.js | 2 +- locale/gitlab.pot | 12 ++----- 5 files changed, 14 insertions(+), 64 deletions(-) diff --git a/ee/app/assets/javascripts/usage_quotas/storage/components/storage_inline_alert.vue b/ee/app/assets/javascripts/usage_quotas/storage/components/storage_inline_alert.vue index fc0fb5c8d9f64..6cebc9b81e19a 100644 --- a/ee/app/assets/javascripts/usage_quotas/storage/components/storage_inline_alert.vue +++ b/ee/app/assets/javascripts/usage_quotas/storage/components/storage_inline_alert.vue @@ -1,24 +1,22 @@ <script> import { GlAlert } from '@gitlab/ui'; import { n__, s__, sprintf } from '~/locale'; -import { ALERT_THRESHOLD, ERROR_THRESHOLD, WARNING_THRESHOLD } from '../constants'; +import { ALERT_THRESHOLD, ERROR_THRESHOLD } from '../constants'; import { formatUsageSize, usageRatioToThresholdLevel } from '../utils'; export default { i18n: { - lockedWithNoPurchasedStorageTitle: s__('UsageQuota|This namespace contains locked projects'), lockedWithNoPurchasedStorageText: s__( - 'UsageQuota|You have reached the free storage limit of %{actualRepositorySizeLimit} on %{projectsLockedText}. To unlock them, purchase additional storage.', + 'UsageQuota|You have reached the free storage limit on %{projectsLockedText}. To unlock them, purchase additional storage.', ), - storageUsageText: s__('UsageQuota|%{percentageLeft} of purchased storage is available'), lockedWithPurchaseText: s__( - 'UsageQuota|You have consumed all of your additional storage. Purchase more to unlock your projects over the free %{actualRepositorySizeLimit} limit.', + 'UsageQuota|You have consumed all of your additional storage. Purchase more to unlock projects over the limit.', ), warningWithPurchaseText: s__( 'UsageQuota|Your purchased storage is running low. To avoid locked projects, purchase more storage.', ), infoWithPurchaseText: s__( - 'UsageQuota|When you purchase additional storage, we automatically unlock projects that were locked when you reached the %{actualRepositorySizeLimit} limit.', + 'UsageQuota|When you purchase additional storage, we automatically unlock projects that were locked if the storage limit was reached.', ), }, components: { @@ -59,14 +57,6 @@ export default { ? this.hasPurchasedStorageText() : this.hasNotPurchasedStorageText(); }, - alertTitle() { - if (!this.hasPurchasedStorage() && this.containsLockedProjects) { - return this.$options.i18n.lockedWithNoPurchasedStorageTitle; - } - return sprintf(this.$options.i18n.storageUsageText, { - percentageLeft: `${this.excessStoragePercentageLeft}%`, - }); - }, excessStorageRatio() { return this.totalRepositorySizeExcess / this.additionalPurchasedStorageSize; }, @@ -82,8 +72,6 @@ export default { thresholdLevelToAlertVariant() { if (this.thresholdLevel === ERROR_THRESHOLD || this.thresholdLevel === ALERT_THRESHOLD) { return 'danger'; - } else if (this.thresholdLevel === WARNING_THRESHOLD) { - return 'warning'; } return 'info'; }, @@ -107,23 +95,15 @@ export default { }, hasPurchasedStorageText() { if (this.thresholdLevel === ERROR_THRESHOLD) { - return sprintf(this.$options.i18n.lockedWithPurchaseText, { - actualRepositorySizeLimit: this.formatSize(this.actualRepositorySizeLimit), - }); - } else if ( - this.thresholdLevel === WARNING_THRESHOLD || - this.thresholdLevel === ALERT_THRESHOLD - ) { + return this.$options.i18n.lockedWithPurchaseText; + } else if (this.thresholdLevel === ALERT_THRESHOLD) { return this.$options.i18n.warningWithPurchaseText; } - return sprintf(this.$options.i18n.infoWithPurchaseText, { - actualRepositorySizeLimit: this.formatSize(this.actualRepositorySizeLimit), - }); + return this.$options.i18n.infoWithPurchaseText; }, hasNotPurchasedStorageText() { if (this.thresholdLevel === ERROR_THRESHOLD) { return sprintf(this.$options.i18n.lockedWithNoPurchasedStorageText, { - actualRepositorySizeLimit: this.formatSize(this.actualRepositorySizeLimit), projectsLockedText: this.projectsLockedText, }); } @@ -138,7 +118,6 @@ export default { class="gl-mt-5" :variant="thresholdLevelToAlertVariant" :dismissible="false" - :title="alertTitle" > {{ alertText }} </gl-alert> diff --git a/ee/app/assets/javascripts/usage_quotas/storage/constants.js b/ee/app/assets/javascripts/usage_quotas/storage/constants.js index 85abbf06cbc3b..f5b25c23bcebc 100644 --- a/ee/app/assets/javascripts/usage_quotas/storage/constants.js +++ b/ee/app/assets/javascripts/usage_quotas/storage/constants.js @@ -81,14 +81,12 @@ export const SKELETON_LOADER_ROWS = 5; export const NONE_THRESHOLD = 'none'; export const INFO_THRESHOLD = 'info'; -export const WARNING_THRESHOLD = 'warning'; export const ALERT_THRESHOLD = 'alert'; export const ERROR_THRESHOLD = 'error'; export const STORAGE_USAGE_THRESHOLDS = { [NONE_THRESHOLD]: 0.0, [INFO_THRESHOLD]: 0.5, - [WARNING_THRESHOLD]: 0.75, [ALERT_THRESHOLD]: 0.95, [ERROR_THRESHOLD]: 1.0, }; diff --git a/ee/spec/frontend/usage_quotas/storage/components/storage_inline_alert_spec.js b/ee/spec/frontend/usage_quotas/storage/components/storage_inline_alert_spec.js index 716becc8ab1ff..12162969010d3 100644 --- a/ee/spec/frontend/usage_quotas/storage/components/storage_inline_alert_spec.js +++ b/ee/spec/frontend/usage_quotas/storage/components/storage_inline_alert_spec.js @@ -52,7 +52,7 @@ describe('StorageInlineAlert', () => { const alert = findAlert(); expect(alert.props('variant')).toBe('danger'); expect(alert.text()).toBe( - 'You have reached the free storage limit of 10.0GiB on 1 project. To unlock them, purchase additional storage.', + 'You have reached the free storage limit on 1 project. To unlock them, purchase additional storage.', ); }); }); @@ -73,7 +73,7 @@ describe('StorageInlineAlert', () => { const alert = findAlert(); expect(alert.props('variant')).toBe('info'); expect(alert.text()).toBe( - 'When you purchase additional storage, we automatically unlock projects that were locked when you reached the 10.0GiB limit.', + 'When you purchase additional storage, we automatically unlock projects that were locked if the storage limit was reached.', ); }); }); @@ -94,28 +94,7 @@ describe('StorageInlineAlert', () => { const alert = findAlert(); expect(alert.props('variant')).toBe('danger'); expect(alert.text()).toBe( - 'You have consumed all of your additional storage. Purchase more to unlock your projects over the free 10.0GiB limit.', - ); - }); - }); - - describe('excess storage below purchase limit in warning threshold', () => { - beforeEach(() => { - mountComponent({ - containsLockedProjects: false, - repositorySizeExcessProjectCount: 0, - totalRepositorySizeExcess: TEN_GB_IN_BYTES, - totalRepositorySize: THIRTEEN_GB_IN_BYTES, - additionalPurchasedStorageSize: THIRTEEN_GB_IN_BYTES, - actualRepositorySizeLimit: TEN_GB_IN_BYTES, - }); - }); - - it('renders warning alert with correct message', () => { - const alert = findAlert(); - expect(alert.props('variant')).toBe('warning'); - expect(alert.text()).toBe( - 'Your purchased storage is running low. To avoid locked projects, purchase more storage.', + 'You have consumed all of your additional storage. Purchase more to unlock projects over the limit.', ); }); }); diff --git a/ee/spec/frontend/usage_quotas/storage/utils_spec.js b/ee/spec/frontend/usage_quotas/storage/utils_spec.js index 2457bfc43fdc9..43ce3f157175b 100644 --- a/ee/spec/frontend/usage_quotas/storage/utils_spec.js +++ b/ee/spec/frontend/usage_quotas/storage/utils_spec.js @@ -90,7 +90,7 @@ describe('UsageThreshold', () => { ${0} | ${'none'} ${0.4} | ${'none'} ${0.5} | ${'info'} - ${0.9} | ${'warning'} + ${0.9} | ${'info'} ${0.99} | ${'alert'} ${1} | ${'error'} ${1.5} | ${'error'} diff --git a/locale/gitlab.pot b/locale/gitlab.pot index 69b8d736f3e09..cf0dd1004f0be 100644 --- a/locale/gitlab.pot +++ b/locale/gitlab.pot @@ -44212,9 +44212,6 @@ msgstr "" msgid "UsageQuota|%{linkTitle} help link" msgstr "" -msgid "UsageQuota|%{percentageLeft} of purchased storage is available" -msgstr "" - msgid "UsageQuota|%{storage_limit_link_start}A namespace storage limit%{link_end} will soon be enforced for the %{strong_start}%{namespace_name}%{strong_end} namespace. %{extra_message}" msgstr "" @@ -44386,9 +44383,6 @@ msgstr "" msgid "UsageQuota|This is the total amount of storage used by projects above the free %{actualRepositorySizeLimit} storage limit." msgstr "" -msgid "UsageQuota|This namespace contains locked projects" -msgstr "" - msgid "UsageQuota|This namespace has no projects which used shared runners in the current period" msgstr "" @@ -44434,7 +44428,7 @@ msgstr "" msgid "UsageQuota|User settings > Usage quotas" msgstr "" -msgid "UsageQuota|When you purchase additional storage, we automatically unlock projects that were locked when you reached the %{actualRepositorySizeLimit} limit." +msgid "UsageQuota|When you purchase additional storage, we automatically unlock projects that were locked if the storage limit was reached." msgstr "" msgid "UsageQuota|Wiki" @@ -44443,10 +44437,10 @@ msgstr "" msgid "UsageQuota|Wiki content." msgstr "" -msgid "UsageQuota|You have consumed all of your additional storage. Purchase more to unlock your projects over the free %{actualRepositorySizeLimit} limit." +msgid "UsageQuota|You have consumed all of your additional storage. Purchase more to unlock projects over the limit." msgstr "" -msgid "UsageQuota|You have reached the free storage limit of %{actualRepositorySizeLimit} on %{projectsLockedText}. To unlock them, purchase additional storage." +msgid "UsageQuota|You have reached the free storage limit on %{projectsLockedText}. To unlock them, purchase additional storage." msgstr "" msgid "UsageQuota|You used: %{usage} %{limit}" -- GitLab