mirror of
https://github.com/hashicorp/vault.git
synced 2025-08-19 13:41:10 +02:00
* add secrets sync feature to version service * fix syntax for feature in version service * UI [Sidebranch]: correctly call activation flags endpoints (#26068) * Show empty state on client count sync page if feature isn't activated (#26024) * page/sync: show empty state if sync is not activated * tests: add sync page integration tests * tests: add secrets sync acceptance tests * cleanup: remove redundant empty state selector * chore: rename to isSecretsSyncActivated * Only make POST request to activation-flags in root namespace (#26081) * Clean up around opt-in banner on non-secrets-sync views (#26039) * only show and make request to activated-features if enterprise with secrets sync feature * waiting for final badge title but hiding banner and network request based on if user has secrets-sync feature. * final copy for badge * handle dismiss erorr message, custom messaging in errors, different badge names and upsell if not on license. * add secrets sync feature to version service * nope, add to main sidebranch not in this PR * use version service directly to check for secrets sync feature * update badges to use version service directly * do not unnecessarily pass hasSecretsSyncFeature, access from version directly * last spot to update using the feature getter * cleanup landing cta logic * UI [Sidebranch]: correctly call activation flags endpoints (#26068) * small cleanups after merge * remove unused type imports * update tests * update nav link test * add test waiter for race condition on test * add waiter to fetch activation-flags * remove customer waiters and go for waitFors in test * worth a try? mirage issues? * closer? * fix issue with inconsistent asserts * adding back in in case this is the issue * revert cluster.hbs change * skip test * delete test --------- Co-authored-by: clairebontempo@gmail.com <clairebontempo@gmail.com> Co-authored-by: claire bontempo <68122737+hellobontempo@users.noreply.github.com> Co-authored-by: Chelsea Shaw <82459713+hashishaw@users.noreply.github.com> * Hide sync for managed vault (#26084) * [secrets sync] hide sync content from client overview (#26078) * clients/overview: hide secrets sync content if not in license * clients: remove sync tab if not in license * routes: fetch isSecretsSyncActivated at clients/counts route level * wip - hide secrets sync from overview page * tests: fix usage-stats test * more wip hiding from overview page * hide secrets sync on attribution component/modal * hide secrets sync content on running total component * fix RunningTotal class name Co-authored-by: claire bontempo <68122737+hellobontempo@users.noreply.github.com> * controllers: fix type * tests: usage tests * tests: running totals tests * add s to secrets-sync * tests: running-total test cleanup --------- Co-authored-by: claire bontempo <68122737+hellobontempo@users.noreply.github.com> Co-authored-by: clairebontempo@gmail.com <clairebontempo@gmail.com> * cleanup unused version service * return extra line * wip - sync tests * wip -- clients overview acceptance tests * test coverage for sync in license, activated * tests: add more robust sync-related overview tests * hide sync client charts if feature not in license --------- Co-authored-by: clairebontempo@gmail.com <clairebontempo@gmail.com> Co-authored-by: Chelsea Shaw <82459713+hashishaw@users.noreply.github.com> Co-authored-by: Noelle Daley <noelledaley@users.noreply.github.com> Co-authored-by: claire bontempo <68122737+hellobontempo@users.noreply.github.com> Co-authored-by: Chelsea Shaw <cshaw@hashicorp.com>
95 lines
3.2 KiB
JavaScript
95 lines
3.2 KiB
JavaScript
/**
|
|
* Copyright (c) HashiCorp, Inc.
|
|
* SPDX-License-Identifier: BUSL-1.1
|
|
*/
|
|
|
|
import { module, test } from 'qunit';
|
|
import { setupRenderingTest } from 'ember-qunit';
|
|
import { render } from '@ember/test-helpers';
|
|
import { hbs } from 'ember-cli-htmlbars';
|
|
|
|
module('Integration | Component | clients/usage-stats', function (hooks) {
|
|
setupRenderingTest(hooks);
|
|
|
|
hooks.beforeEach(function () {
|
|
this.isSecretsSyncActivated = false;
|
|
this.counts = {};
|
|
|
|
this.renderComponent = async () =>
|
|
await render(
|
|
hbs`<Clients::UsageStats @totalUsageCounts={{this.counts}} @isSecretsSyncActivated={{this.isSecretsSyncActivated}} />`
|
|
);
|
|
});
|
|
|
|
test('it renders defaults', async function (assert) {
|
|
await this.renderComponent();
|
|
|
|
assert.dom('[data-test-stat-text]').exists({ count: 3 }, 'Renders 3 Stat texts even with no data passed');
|
|
assert.dom('[data-test-stat-text="total-clients"]').exists('Total clients exists');
|
|
assert.dom('[data-test-stat-text="total-clients"] .stat-value').hasText('-', 'renders dash when no data');
|
|
assert.dom('[data-test-stat-text="entity-clients"]').exists('Entity clients exists');
|
|
assert
|
|
.dom('[data-test-stat-text="entity-clients"] .stat-value')
|
|
.hasText('-', 'renders dash when no data');
|
|
assert.dom('[data-test-stat-text="non-entity-clients"]').exists('Non entity clients exists');
|
|
assert
|
|
.dom('[data-test-stat-text="non-entity-clients"] .stat-value')
|
|
.hasText('-', 'renders dash when no data');
|
|
assert
|
|
.dom('a')
|
|
.hasAttribute('href', 'https://developer.hashicorp.com/vault/tutorials/monitoring/usage-metrics');
|
|
});
|
|
|
|
test('it renders with token data', async function (assert) {
|
|
this.counts = {
|
|
clients: 17,
|
|
entity_clients: 7,
|
|
non_entity_clients: 10,
|
|
};
|
|
|
|
await this.renderComponent();
|
|
|
|
assert.dom('[data-test-stat-text]').exists({ count: 3 }, 'Renders 3 Stat texts');
|
|
assert
|
|
.dom('[data-test-stat-text="total-clients"] .stat-value')
|
|
.hasText('17', 'Total clients shows passed value');
|
|
assert
|
|
.dom('[data-test-stat-text="entity-clients"] .stat-value')
|
|
.hasText('7', 'entity clients shows passed value');
|
|
assert
|
|
.dom('[data-test-stat-text="non-entity-clients"] .stat-value')
|
|
.hasText('10', 'non entity clients shows passed value');
|
|
});
|
|
|
|
module('it renders with full totals data', function (hooks) {
|
|
hooks.beforeEach(function () {
|
|
this.counts = {
|
|
clients: 22,
|
|
entity_clients: 7,
|
|
non_entity_clients: 10,
|
|
secret_syncs: 5,
|
|
};
|
|
});
|
|
|
|
test('with secrets sync activated', async function (assert) {
|
|
this.isSecretsSyncActivated = true;
|
|
|
|
await this.renderComponent();
|
|
|
|
assert.dom('[data-test-stat-text]').exists({ count: 4 }, 'Renders 4 Stat texts');
|
|
assert
|
|
.dom('[data-test-stat-text="secret-syncs"] .stat-value')
|
|
.hasText('5', 'secrets sync clients shows passed value');
|
|
});
|
|
|
|
test('with secrets sync NOT activated', async function (assert) {
|
|
this.isSecretsSyncActivated = false;
|
|
|
|
await this.renderComponent();
|
|
|
|
assert.dom('[data-test-stat-text]').exists({ count: 3 }, 'Renders 3 Stat texts');
|
|
assert.dom('[data-test-stat-text="secret-syncs"] .stat-value').doesNotExist();
|
|
});
|
|
});
|
|
});
|