mirror of
https://github.com/optim-enterprises-bv/vault.git
synced 2025-11-02 03:27:54 +00:00
base sys/license/status mock times based on current timestamp (#15286)
* base sys/license/status mock times based on current timestamp * add missing trailing commas * license specific test selector Co-authored-by: Claire Bontempo <cbontempo@hashicorp.com>
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
{{#if this.licenseExpired}}
|
||||
<div class="license-banner-wrapper" data-test-license-banner data-test-license-banner-expired>
|
||||
<AlertBanner
|
||||
@bannerType="license"
|
||||
@type="danger"
|
||||
@title="License expired"
|
||||
@message="Your Vault license expired on {{date-format
|
||||
@@ -21,6 +22,7 @@
|
||||
{{else if (lte this.licenseExpiringInDays 30)}}
|
||||
<div class="license-banner-wrapper" data-test-license-banner data-test-license-banner-warning>
|
||||
<AlertBanner
|
||||
@bannerType="license"
|
||||
@type="warning"
|
||||
@title="Vault license expiring"
|
||||
@message="Your Vault license will expire in {{this.licenseExpiringInDays}} days at {{date-format
|
||||
|
||||
@@ -17,6 +17,7 @@ import layout from '../templates/components/alert-banner';
|
||||
* @param {Object} [progressBar=null] - An object containing a value and maximum for a progress bar. Will be displayed next to the message title.
|
||||
* @param {String} [message=null] - The message to display within the banner.
|
||||
* @param {String} [title=null] - A title to show above the message. If this is not provided, there are default values for each type of alert.
|
||||
* @param {String} [bannerType=alert] - Defaults to 'alert', can be used to specify an alert banner's test selector
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -30,6 +31,7 @@ export default Component.extend({
|
||||
yieldWithoutColumn: false,
|
||||
marginless: false,
|
||||
classNameBindings: ['containerClass'],
|
||||
bannerType: 'alert',
|
||||
|
||||
containerClass: computed('type', 'marginless', function () {
|
||||
const base = this.marginless ? 'message message-marginless ' : 'message ';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<div data-test-alert-banner>
|
||||
<div data-test-alert-banner={{this.bannerType}}>
|
||||
<div class="columns is-mobile is-variable is-1">
|
||||
<div class="column is-narrow message-icon">
|
||||
<Icon class={{this.alertType.glyphClass}} aria-hidden="true" @name={{this.alertType.glyph}} />
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { formatISO, isAfter, isBefore, sub, isSameMonth, startOfMonth } from 'date-fns';
|
||||
import { addDays, formatISO, formatRFC3339, isAfter, isBefore, sub, isSameMonth, startOfMonth } from 'date-fns';
|
||||
import { parseAPITimestamp } from 'core/utils/date-formatters';
|
||||
const MOCK_MONTHLY_DATA = [
|
||||
{
|
||||
@@ -814,11 +814,13 @@ export default function (server) {
|
||||
});
|
||||
|
||||
server.get('sys/license/status', function () {
|
||||
const startTime = new Date();
|
||||
|
||||
return {
|
||||
data: {
|
||||
autoloading_used: true,
|
||||
autoloaded: {
|
||||
expiration_time: '2022-05-17T23:59:59.999Z',
|
||||
expiration_time: formatRFC3339(addDays(startTime, 365)),
|
||||
features: [
|
||||
'HSM',
|
||||
'Performance Replication',
|
||||
@@ -838,10 +840,10 @@ export default function (server) {
|
||||
],
|
||||
license_id: '060d7820-fa59-f95c-832b-395db0aeb9ba',
|
||||
performance_standby_count: 9999,
|
||||
start_time: '2021-01-17T00:00:00Z',
|
||||
start_time: formatRFC3339(startTime)
|
||||
},
|
||||
persisted_autoload: {
|
||||
expiration_time: '2022-05-17T23:59:59.999Z',
|
||||
expiration_time: formatRFC3339(addDays(startTime, 365)),
|
||||
features: [
|
||||
'HSM',
|
||||
'Performance Replication',
|
||||
@@ -861,7 +863,7 @@ export default function (server) {
|
||||
],
|
||||
license_id: '060d7820-fa59-f95c-832b-395db0aeb9ba',
|
||||
performance_standby_count: 9999,
|
||||
start_time: '2021-01-17T00:00:00Z',
|
||||
start_time: formatRFC3339(startTime)
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
@@ -283,7 +283,7 @@ module('Acceptance | clients history tab', function (hooks) {
|
||||
await visit('/vault/clients/history');
|
||||
assert.equal(currentURL(), '/vault/clients/history', 'clients/history URL is correct');
|
||||
assert.dom(SELECTORS.historyActiveTab).hasText('History', 'history tab is active');
|
||||
assert.dom('[data-test-alert-banner]').includesText('Vault was upgraded');
|
||||
assert.dom('[data-test-alert-banner="alert"]').includesText('Vault was upgraded');
|
||||
});
|
||||
|
||||
test('Shows empty if license start date is current month', async function (assert) {
|
||||
|
||||
@@ -89,9 +89,7 @@ module('Acceptance | settings/mount-secret-backend', function (hooks) {
|
||||
await page.enableEngine();
|
||||
await page.selectType('kv');
|
||||
await page.next().path(path).submit();
|
||||
assert
|
||||
.dom('[data-test-alert-banner] .alert-banner-message-body')
|
||||
.containsText(`path is already in use at ${path}`);
|
||||
assert.dom('[data-test-alert-banner="alert"]').containsText(`path is already in use at ${path}`);
|
||||
assert.equal(currentRouteName(), 'vault.cluster.settings.mount-secret-backend');
|
||||
|
||||
await page.secretList();
|
||||
|
||||
Reference in New Issue
Block a user