open-vault/ui/tests/integration/components/clients/monthly-usage-test.js

1488 lines
44 KiB
JavaScript
Raw Normal View History

/**
* Copyright (c) HashiCorp, Inc.
* SPDX-License-Identifier: MPL-2.0
*/
import { module, test } from 'qunit';
import sinon from 'sinon';
import { setupRenderingTest } from 'ember-qunit';
import { render } from '@ember/test-helpers';
import { hbs } from 'ember-cli-htmlbars';
import { formatRFC3339 } from 'date-fns';
import { findAll } from '@ember/test-helpers';
import { calculateAverage } from 'vault/utils/chart-helpers';
import { formatNumber } from 'core/helpers/format-number';
import timestamp from 'core/utils/timestamp';
module('Integration | Component | clients/monthly-usage', function (hooks) {
setupRenderingTest(hooks);
const DATASET = [
{
month: '8/21',
timestamp: '2021-08-01T00:00:00Z',
counts: null,
namespaces: [],
new_clients: {
month: '8/21',
namespaces: [],
},
namespaces_by_key: {},
},
{
month: '9/21',
clients: 19251,
entity_clients: 10713,
non_entity_clients: 8538,
namespaces: [
{
label: 'root',
clients: 4852,
entity_clients: 3108,
non_entity_clients: 1744,
mounts: [
{
label: 'path-3-with-over-18-characters',
clients: 1598,
entity_clients: 687,
non_entity_clients: 911,
},
{
label: 'path-1',
clients: 1429,
entity_clients: 981,
non_entity_clients: 448,
},
{
label: 'path-4-with-over-18-characters',
clients: 965,
entity_clients: 720,
non_entity_clients: 245,
},
{
label: 'path-2',
clients: 860,
entity_clients: 720,
non_entity_clients: 140,
},
],
},
{
label: 'test-ns-2/',
clients: 4702,
entity_clients: 3057,
non_entity_clients: 1645,
mounts: [
{
label: 'path-3-with-over-18-characters',
clients: 1686,
entity_clients: 926,
non_entity_clients: 760,
},
{
label: 'path-4-with-over-18-characters',
clients: 1525,
entity_clients: 789,
non_entity_clients: 736,
},
{
label: 'path-2',
clients: 905,
entity_clients: 849,
non_entity_clients: 56,
},
{
label: 'path-1',
clients: 586,
entity_clients: 493,
non_entity_clients: 93,
},
],
},
{
label: 'test-ns-1/',
clients: 4569,
entity_clients: 1871,
non_entity_clients: 2698,
mounts: [
{
label: 'path-4-with-over-18-characters',
clients: 1534,
entity_clients: 619,
non_entity_clients: 915,
},
{
label: 'path-3-with-over-18-characters',
clients: 1528,
entity_clients: 589,
non_entity_clients: 939,
},
{
label: 'path-1',
clients: 828,
entity_clients: 612,
non_entity_clients: 216,
},
{
label: 'path-2',
clients: 679,
entity_clients: 51,
non_entity_clients: 628,
},
],
},
{
label: 'test-ns-2-with-namespace-length-over-18-characters/',
clients: 3771,
entity_clients: 2029,
non_entity_clients: 1742,
mounts: [
{
label: 'path-3-with-over-18-characters',
clients: 1249,
entity_clients: 793,
non_entity_clients: 456,
},
{
label: 'path-1',
clients: 1046,
entity_clients: 444,
non_entity_clients: 602,
},
{
label: 'path-2',
clients: 930,
entity_clients: 277,
non_entity_clients: 653,
},
{
label: 'path-4-with-over-18-characters',
clients: 546,
entity_clients: 515,
non_entity_clients: 31,
},
],
},
{
label: 'test-ns-1-with-namespace-length-over-18-characters/',
clients: 1357,
entity_clients: 648,
non_entity_clients: 709,
mounts: [
{
label: 'path-1',
clients: 613,
entity_clients: 23,
non_entity_clients: 590,
},
{
label: 'path-3-with-over-18-characters',
clients: 543,
entity_clients: 465,
non_entity_clients: 78,
},
{
label: 'path-2',
clients: 146,
entity_clients: 141,
non_entity_clients: 5,
},
{
label: 'path-4-with-over-18-characters',
clients: 55,
entity_clients: 19,
non_entity_clients: 36,
},
],
},
],
namespaces_by_key: {
root: {
month: '9/21',
clients: 4852,
entity_clients: 3108,
non_entity_clients: 1744,
new_clients: {
month: '9/21',
label: 'root',
clients: 2525,
entity_clients: 1315,
non_entity_clients: 1210,
},
mounts_by_key: {
'path-3-with-over-18-characters': {
month: '9/21',
label: 'path-3-with-over-18-characters',
clients: 1598,
entity_clients: 687,
non_entity_clients: 911,
new_clients: {
month: '9/21',
label: 'path-3-with-over-18-characters',
clients: 1055,
entity_clients: 257,
non_entity_clients: 798,
},
},
'path-1': {
month: '9/21',
label: 'path-1',
clients: 1429,
entity_clients: 981,
non_entity_clients: 448,
new_clients: {
month: '9/21',
label: 'path-1',
clients: 543,
entity_clients: 340,
non_entity_clients: 203,
},
},
'path-4-with-over-18-characters': {
month: '9/21',
label: 'path-4-with-over-18-characters',
clients: 965,
entity_clients: 720,
non_entity_clients: 245,
new_clients: {
month: '9/21',
label: 'path-4-with-over-18-characters',
clients: 136,
entity_clients: 7,
non_entity_clients: 129,
},
},
'path-2': {
month: '9/21',
label: 'path-2',
clients: 860,
entity_clients: 720,
non_entity_clients: 140,
new_clients: {
month: '9/21',
label: 'path-2',
clients: 791,
entity_clients: 711,
non_entity_clients: 80,
},
},
},
},
'test-ns-2/': {
month: '9/21',
clients: 4702,
entity_clients: 3057,
non_entity_clients: 1645,
new_clients: {
month: '9/21',
label: 'test-ns-2/',
clients: 1537,
entity_clients: 662,
non_entity_clients: 875,
},
mounts_by_key: {
'path-3-with-over-18-characters': {
month: '9/21',
label: 'path-3-with-over-18-characters',
clients: 1686,
entity_clients: 926,
non_entity_clients: 760,
new_clients: {
month: '9/21',
label: 'path-3-with-over-18-characters',
clients: 520,
entity_clients: 13,
non_entity_clients: 507,
},
},
'path-4-with-over-18-characters': {
month: '9/21',
label: 'path-4-with-over-18-characters',
clients: 1525,
entity_clients: 789,
non_entity_clients: 736,
new_clients: {
month: '9/21',
label: 'path-4-with-over-18-characters',
clients: 499,
entity_clients: 197,
non_entity_clients: 302,
},
},
'path-2': {
month: '9/21',
label: 'path-2',
clients: 905,
entity_clients: 849,
non_entity_clients: 56,
new_clients: {
month: '9/21',
label: 'path-2',
clients: 398,
entity_clients: 370,
non_entity_clients: 28,
},
},
'path-1': {
month: '9/21',
label: 'path-1',
clients: 586,
entity_clients: 493,
non_entity_clients: 93,
new_clients: {
month: '9/21',
label: 'path-1',
clients: 120,
entity_clients: 82,
non_entity_clients: 38,
},
},
},
},
'test-ns-1/': {
month: '9/21',
clients: 4569,
entity_clients: 1871,
non_entity_clients: 2698,
new_clients: {
month: '9/21',
label: 'test-ns-1/',
clients: 2712,
entity_clients: 879,
non_entity_clients: 1833,
},
mounts_by_key: {
'path-4-with-over-18-characters': {
month: '9/21',
label: 'path-4-with-over-18-characters',
clients: 1534,
entity_clients: 619,
non_entity_clients: 915,
new_clients: {
month: '9/21',
label: 'path-4-with-over-18-characters',
clients: 740,
entity_clients: 39,
non_entity_clients: 701,
},
},
'path-3-with-over-18-characters': {
month: '9/21',
label: 'path-3-with-over-18-characters',
clients: 1528,
entity_clients: 589,
non_entity_clients: 939,
new_clients: {
month: '9/21',
label: 'path-3-with-over-18-characters',
clients: 1250,
entity_clients: 536,
non_entity_clients: 714,
},
},
'path-1': {
month: '9/21',
label: 'path-1',
clients: 828,
entity_clients: 612,
non_entity_clients: 216,
new_clients: {
month: '9/21',
label: 'path-1',
clients: 463,
entity_clients: 283,
non_entity_clients: 180,
},
},
'path-2': {
month: '9/21',
label: 'path-2',
clients: 679,
entity_clients: 51,
non_entity_clients: 628,
new_clients: {
month: '9/21',
label: 'path-2',
clients: 259,
entity_clients: 21,
non_entity_clients: 238,
},
},
},
},
'test-ns-2-with-namespace-length-over-18-characters/': {
month: '9/21',
clients: 3771,
entity_clients: 2029,
non_entity_clients: 1742,
new_clients: {
month: '9/21',
label: 'test-ns-2-with-namespace-length-over-18-characters/',
clients: 2087,
entity_clients: 902,
non_entity_clients: 1185,
},
mounts_by_key: {
'path-3-with-over-18-characters': {
month: '9/21',
label: 'path-3-with-over-18-characters',
clients: 1249,
entity_clients: 793,
non_entity_clients: 456,
new_clients: {
month: '9/21',
label: 'path-3-with-over-18-characters',
clients: 472,
entity_clients: 260,
non_entity_clients: 212,
},
},
'path-1': {
month: '9/21',
label: 'path-1',
clients: 1046,
entity_clients: 444,
non_entity_clients: 602,
new_clients: {
month: '9/21',
label: 'path-1',
clients: 775,
entity_clients: 349,
non_entity_clients: 426,
},
},
'path-2': {
month: '9/21',
label: 'path-2',
clients: 930,
entity_clients: 277,
non_entity_clients: 653,
new_clients: {
month: '9/21',
label: 'path-2',
clients: 632,
entity_clients: 90,
non_entity_clients: 542,
},
},
'path-4-with-over-18-characters': {
month: '9/21',
label: 'path-4-with-over-18-characters',
clients: 546,
entity_clients: 515,
non_entity_clients: 31,
new_clients: {
month: '9/21',
label: 'path-4-with-over-18-characters',
clients: 208,
entity_clients: 203,
non_entity_clients: 5,
},
},
},
},
'test-ns-1-with-namespace-length-over-18-characters/': {
month: '9/21',
clients: 1357,
entity_clients: 648,
non_entity_clients: 709,
new_clients: {
month: '9/21',
label: 'test-ns-1-with-namespace-length-over-18-characters/',
clients: 560,
entity_clients: 189,
non_entity_clients: 371,
},
mounts_by_key: {
'path-1': {
month: '9/21',
label: 'path-1',
clients: 613,
entity_clients: 23,
non_entity_clients: 590,
new_clients: {
month: '9/21',
label: 'path-1',
clients: 318,
entity_clients: 12,
non_entity_clients: 306,
},
},
'path-3-with-over-18-characters': {
month: '9/21',
label: 'path-3-with-over-18-characters',
clients: 543,
entity_clients: 465,
non_entity_clients: 78,
new_clients: {
month: '9/21',
label: 'path-3-with-over-18-characters',
clients: 126,
entity_clients: 89,
non_entity_clients: 37,
},
},
'path-2': {
month: '9/21',
label: 'path-2',
clients: 146,
entity_clients: 141,
non_entity_clients: 5,
new_clients: {
month: '9/21',
label: 'path-2',
clients: 76,
entity_clients: 75,
non_entity_clients: 1,
},
},
'path-4-with-over-18-characters': {
month: '9/21',
label: 'path-4-with-over-18-characters',
clients: 55,
entity_clients: 19,
non_entity_clients: 36,
new_clients: {
month: '9/21',
label: 'path-4-with-over-18-characters',
clients: 40,
entity_clients: 13,
non_entity_clients: 27,
},
},
},
},
},
new_clients: {
month: '9/21',
clients: 9421,
entity_clients: 3947,
non_entity_clients: 5474,
namespaces: [
{
label: 'test-ns-1/',
clients: 2712,
entity_clients: 879,
non_entity_clients: 1833,
mounts: [
{
label: 'path-3-with-over-18-characters',
clients: 1250,
entity_clients: 536,
non_entity_clients: 714,
},
{
label: 'path-4-with-over-18-characters',
clients: 740,
entity_clients: 39,
non_entity_clients: 701,
},
{
label: 'path-1',
clients: 463,
entity_clients: 283,
non_entity_clients: 180,
},
{
label: 'path-2',
clients: 259,
entity_clients: 21,
non_entity_clients: 238,
},
],
},
{
label: 'root',
clients: 2525,
entity_clients: 1315,
non_entity_clients: 1210,
mounts: [
{
label: 'path-3-with-over-18-characters',
clients: 1055,
entity_clients: 257,
non_entity_clients: 798,
},
{
label: 'path-2',
clients: 791,
entity_clients: 711,
non_entity_clients: 80,
},
{
label: 'path-1',
clients: 543,
entity_clients: 340,
non_entity_clients: 203,
},
{
label: 'path-4-with-over-18-characters',
clients: 136,
entity_clients: 7,
non_entity_clients: 129,
},
],
},
{
label: 'test-ns-2-with-namespace-length-over-18-characters/',
clients: 2087,
entity_clients: 902,
non_entity_clients: 1185,
mounts: [
{
label: 'path-1',
clients: 775,
entity_clients: 349,
non_entity_clients: 426,
},
{
label: 'path-2',
clients: 632,
entity_clients: 90,
non_entity_clients: 542,
},
{
label: 'path-3-with-over-18-characters',
clients: 472,
entity_clients: 260,
non_entity_clients: 212,
},
{
label: 'path-4-with-over-18-characters',
clients: 208,
entity_clients: 203,
non_entity_clients: 5,
},
],
},
{
label: 'test-ns-2/',
clients: 1537,
entity_clients: 662,
non_entity_clients: 875,
mounts: [
{
label: 'path-3-with-over-18-characters',
clients: 520,
entity_clients: 13,
non_entity_clients: 507,
},
{
label: 'path-4-with-over-18-characters',
clients: 499,
entity_clients: 197,
non_entity_clients: 302,
},
{
label: 'path-2',
clients: 398,
entity_clients: 370,
non_entity_clients: 28,
},
{
label: 'path-1',
clients: 120,
entity_clients: 82,
non_entity_clients: 38,
},
],
},
{
label: 'test-ns-1-with-namespace-length-over-18-characters/',
clients: 560,
entity_clients: 189,
non_entity_clients: 371,
mounts: [
{
label: 'path-1',
clients: 318,
entity_clients: 12,
non_entity_clients: 306,
},
{
label: 'path-3-with-over-18-characters',
clients: 126,
entity_clients: 89,
non_entity_clients: 37,
},
{
label: 'path-2',
clients: 76,
entity_clients: 75,
non_entity_clients: 1,
},
{
label: 'path-4-with-over-18-characters',
clients: 40,
entity_clients: 13,
non_entity_clients: 27,
},
],
},
],
},
},
{
month: '10/21',
clients: 19417,
entity_clients: 10105,
non_entity_clients: 9312,
namespaces: [
{
label: 'root',
clients: 4835,
entity_clients: 2364,
non_entity_clients: 2471,
mounts: [
{
label: 'path-3-with-over-18-characters',
clients: 1797,
entity_clients: 883,
non_entity_clients: 914,
},
{
label: 'path-1',
clients: 1501,
entity_clients: 663,
non_entity_clients: 838,
},
{
label: 'path-2',
clients: 1461,
entity_clients: 800,
non_entity_clients: 661,
},
{
label: 'path-4-with-over-18-characters',
clients: 76,
entity_clients: 18,
non_entity_clients: 58,
},
],
},
{
label: 'test-ns-2/',
clients: 4027,
entity_clients: 1692,
non_entity_clients: 2335,
mounts: [
{
label: 'path-4-with-over-18-characters',
clients: 1223,
entity_clients: 820,
non_entity_clients: 403,
},
{
label: 'path-3-with-over-18-characters',
clients: 1110,
entity_clients: 111,
non_entity_clients: 999,
},
{
label: 'path-1',
clients: 1034,
entity_clients: 462,
non_entity_clients: 572,
},
{
label: 'path-2',
clients: 660,
entity_clients: 299,
non_entity_clients: 361,
},
],
},
{
label: 'test-ns-2-with-namespace-length-over-18-characters/',
clients: 3924,
entity_clients: 2132,
non_entity_clients: 1792,
mounts: [
{
label: 'path-3-with-over-18-characters',
clients: 1411,
entity_clients: 765,
non_entity_clients: 646,
},
{
label: 'path-2',
clients: 1205,
entity_clients: 382,
non_entity_clients: 823,
},
{
label: 'path-1',
clients: 884,
entity_clients: 850,
non_entity_clients: 34,
},
{
label: 'path-4-with-over-18-characters',
clients: 424,
entity_clients: 135,
non_entity_clients: 289,
},
],
},
{
label: 'test-ns-1-with-namespace-length-over-18-characters/',
clients: 3639,
entity_clients: 2314,
non_entity_clients: 1325,
mounts: [
{
label: 'path-1',
clients: 1062,
entity_clients: 781,
non_entity_clients: 281,
},
{
label: 'path-4-with-over-18-characters',
clients: 1021,
entity_clients: 609,
non_entity_clients: 412,
},
{
label: 'path-2',
clients: 849,
entity_clients: 426,
non_entity_clients: 423,
},
{
label: 'path-3-with-over-18-characters',
clients: 707,
entity_clients: 498,
non_entity_clients: 209,
},
],
},
{
label: 'test-ns-1/',
clients: 2992,
entity_clients: 1603,
non_entity_clients: 1389,
mounts: [
{
label: 'path-1',
clients: 1140,
entity_clients: 480,
non_entity_clients: 660,
},
{
label: 'path-4-with-over-18-characters',
clients: 1058,
entity_clients: 651,
non_entity_clients: 407,
},
{
label: 'path-2',
clients: 575,
entity_clients: 416,
non_entity_clients: 159,
},
{
label: 'path-3-with-over-18-characters',
clients: 219,
entity_clients: 56,
non_entity_clients: 163,
},
],
},
],
namespaces_by_key: {
root: {
month: '10/21',
clients: 4835,
entity_clients: 2364,
non_entity_clients: 2471,
new_clients: {
month: '10/21',
label: 'root',
clients: 1732,
entity_clients: 586,
non_entity_clients: 1146,
},
mounts_by_key: {
'path-3-with-over-18-characters': {
month: '10/21',
label: 'path-3-with-over-18-characters',
clients: 1797,
entity_clients: 883,
non_entity_clients: 914,
new_clients: {
month: '10/21',
label: 'path-3-with-over-18-characters',
clients: 907,
entity_clients: 192,
non_entity_clients: 715,
},
},
'path-1': {
month: '10/21',
label: 'path-1',
clients: 1501,
entity_clients: 663,
non_entity_clients: 838,
new_clients: {
month: '10/21',
label: 'path-1',
clients: 276,
entity_clients: 202,
non_entity_clients: 74,
},
},
'path-2': {
month: '10/21',
label: 'path-2',
clients: 1461,
entity_clients: 800,
non_entity_clients: 661,
new_clients: {
month: '10/21',
label: 'path-2',
clients: 502,
entity_clients: 189,
non_entity_clients: 313,
},
},
'path-4-with-over-18-characters': {
month: '10/21',
label: 'path-4-with-over-18-characters',
clients: 76,
entity_clients: 18,
non_entity_clients: 58,
new_clients: {
month: '10/21',
label: 'path-4-with-over-18-characters',
clients: 47,
entity_clients: 3,
non_entity_clients: 44,
},
},
},
},
'test-ns-2/': {
month: '10/21',
clients: 4027,
entity_clients: 1692,
non_entity_clients: 2335,
new_clients: {
month: '10/21',
label: 'test-ns-2/',
clients: 2301,
entity_clients: 678,
non_entity_clients: 1623,
},
mounts_by_key: {
'path-4-with-over-18-characters': {
month: '10/21',
label: 'path-4-with-over-18-characters',
clients: 1223,
entity_clients: 820,
non_entity_clients: 403,
new_clients: {
month: '10/21',
label: 'path-4-with-over-18-characters',
clients: 602,
entity_clients: 212,
non_entity_clients: 390,
},
},
'path-3-with-over-18-characters': {
month: '10/21',
label: 'path-3-with-over-18-characters',
clients: 1110,
entity_clients: 111,
non_entity_clients: 999,
new_clients: {
month: '10/21',
label: 'path-3-with-over-18-characters',
clients: 440,
entity_clients: 7,
non_entity_clients: 433,
},
},
'path-1': {
month: '10/21',
label: 'path-1',
clients: 1034,
entity_clients: 462,
non_entity_clients: 572,
new_clients: {
month: '10/21',
label: 'path-1',
clients: 980,
entity_clients: 454,
non_entity_clients: 526,
},
},
'path-2': {
month: '10/21',
label: 'path-2',
clients: 660,
entity_clients: 299,
non_entity_clients: 361,
new_clients: {
month: '10/21',
label: 'path-2',
clients: 279,
entity_clients: 5,
non_entity_clients: 274,
},
},
},
},
'test-ns-2-with-namespace-length-over-18-characters/': {
month: '10/21',
clients: 3924,
entity_clients: 2132,
non_entity_clients: 1792,
new_clients: {
month: '10/21',
label: 'test-ns-2-with-namespace-length-over-18-characters/',
clients: 1561,
entity_clients: 1225,
non_entity_clients: 336,
},
mounts_by_key: {
'path-3-with-over-18-characters': {
month: '10/21',
label: 'path-3-with-over-18-characters',
clients: 1411,
entity_clients: 765,
non_entity_clients: 646,
new_clients: {
month: '10/21',
label: 'path-3-with-over-18-characters',
clients: 948,
entity_clients: 660,
non_entity_clients: 288,
},
},
'path-2': {
month: '10/21',
label: 'path-2',
clients: 1205,
entity_clients: 382,
non_entity_clients: 823,
new_clients: {
month: '10/21',
label: 'path-2',
clients: 305,
entity_clients: 289,
non_entity_clients: 16,
},
},
'path-1': {
month: '10/21',
label: 'path-1',
clients: 884,
entity_clients: 850,
non_entity_clients: 34,
new_clients: {
month: '10/21',
label: 'path-1',
clients: 230,
entity_clients: 207,
non_entity_clients: 23,
},
},
'path-4-with-over-18-characters': {
month: '10/21',
label: 'path-4-with-over-18-characters',
clients: 424,
entity_clients: 135,
non_entity_clients: 289,
new_clients: {
month: '10/21',
label: 'path-4-with-over-18-characters',
clients: 78,
entity_clients: 69,
non_entity_clients: 9,
},
},
},
},
'test-ns-1-with-namespace-length-over-18-characters/': {
month: '10/21',
clients: 3639,
entity_clients: 2314,
non_entity_clients: 1325,
new_clients: {
month: '10/21',
label: 'test-ns-1-with-namespace-length-over-18-characters/',
clients: 1245,
entity_clients: 710,
non_entity_clients: 535,
},
mounts_by_key: {
'path-1': {
month: '10/21',
label: 'path-1',
clients: 1062,
entity_clients: 781,
non_entity_clients: 281,
new_clients: {
month: '10/21',
label: 'path-1',
clients: 288,
entity_clients: 63,
non_entity_clients: 225,
},
},
'path-4-with-over-18-characters': {
month: '10/21',
label: 'path-4-with-over-18-characters',
clients: 1021,
entity_clients: 609,
non_entity_clients: 412,
new_clients: {
month: '10/21',
label: 'path-4-with-over-18-characters',
clients: 440,
entity_clients: 323,
non_entity_clients: 117,
},
},
'path-2': {
month: '10/21',
label: 'path-2',
clients: 849,
entity_clients: 426,
non_entity_clients: 423,
new_clients: {
month: '10/21',
label: 'path-2',
clients: 339,
entity_clients: 308,
non_entity_clients: 31,
},
},
'path-3-with-over-18-characters': {
month: '10/21',
label: 'path-3-with-over-18-characters',
clients: 707,
entity_clients: 498,
non_entity_clients: 209,
new_clients: {
month: '10/21',
label: 'path-3-with-over-18-characters',
clients: 178,
entity_clients: 16,
non_entity_clients: 162,
},
},
},
},
'test-ns-1/': {
month: '10/21',
clients: 2992,
entity_clients: 1603,
non_entity_clients: 1389,
new_clients: {
month: '10/21',
label: 'test-ns-1/',
clients: 820,
entity_clients: 356,
non_entity_clients: 464,
},
mounts_by_key: {
'path-1': {
month: '10/21',
label: 'path-1',
clients: 1140,
entity_clients: 480,
non_entity_clients: 660,
new_clients: {
month: '10/21',
label: 'path-1',
clients: 239,
entity_clients: 30,
non_entity_clients: 209,
},
},
'path-4-with-over-18-characters': {
month: '10/21',
label: 'path-4-with-over-18-characters',
clients: 1058,
entity_clients: 651,
non_entity_clients: 407,
new_clients: {
month: '10/21',
label: 'path-4-with-over-18-characters',
clients: 256,
entity_clients: 63,
non_entity_clients: 193,
},
},
'path-2': {
month: '10/21',
label: 'path-2',
clients: 575,
entity_clients: 416,
non_entity_clients: 159,
new_clients: {
month: '10/21',
label: 'path-2',
clients: 259,
entity_clients: 245,
non_entity_clients: 14,
},
},
'path-3-with-over-18-characters': {
month: '10/21',
label: 'path-3-with-over-18-characters',
clients: 219,
entity_clients: 56,
non_entity_clients: 163,
new_clients: {
month: '10/21',
label: 'path-3-with-over-18-characters',
clients: 66,
entity_clients: 18,
non_entity_clients: 48,
},
},
},
},
},
new_clients: {
month: '10/21',
clients: 7659,
entity_clients: 3555,
non_entity_clients: 4104,
namespaces: [
{
label: 'test-ns-2/',
clients: 2301,
entity_clients: 678,
non_entity_clients: 1623,
mounts: [
{
label: 'path-1',
clients: 980,
entity_clients: 454,
non_entity_clients: 526,
},
{
label: 'path-4-with-over-18-characters',
clients: 602,
entity_clients: 212,
non_entity_clients: 390,
},
{
label: 'path-3-with-over-18-characters',
clients: 440,
entity_clients: 7,
non_entity_clients: 433,
},
{
label: 'path-2',
clients: 279,
entity_clients: 5,
non_entity_clients: 274,
},
],
},
{
label: 'root',
clients: 1732,
entity_clients: 586,
non_entity_clients: 1146,
mounts: [
{
label: 'path-3-with-over-18-characters',
clients: 907,
entity_clients: 192,
non_entity_clients: 715,
},
{
label: 'path-2',
clients: 502,
entity_clients: 189,
non_entity_clients: 313,
},
{
label: 'path-1',
clients: 276,
entity_clients: 202,
non_entity_clients: 74,
},
{
label: 'path-4-with-over-18-characters',
clients: 47,
entity_clients: 3,
non_entity_clients: 44,
},
],
},
{
label: 'test-ns-2-with-namespace-length-over-18-characters/',
clients: 1561,
entity_clients: 1225,
non_entity_clients: 336,
mounts: [
{
label: 'path-3-with-over-18-characters',
clients: 948,
entity_clients: 660,
non_entity_clients: 288,
},
{
label: 'path-2',
clients: 305,
entity_clients: 289,
non_entity_clients: 16,
},
{
label: 'path-1',
clients: 230,
entity_clients: 207,
non_entity_clients: 23,
},
{
label: 'path-4-with-over-18-characters',
clients: 78,
entity_clients: 69,
non_entity_clients: 9,
},
],
},
{
label: 'test-ns-1-with-namespace-length-over-18-characters/',
clients: 1245,
entity_clients: 710,
non_entity_clients: 535,
mounts: [
{
label: 'path-4-with-over-18-characters',
clients: 440,
entity_clients: 323,
non_entity_clients: 117,
},
{
label: 'path-2',
clients: 339,
entity_clients: 308,
non_entity_clients: 31,
},
{
label: 'path-1',
clients: 288,
entity_clients: 63,
non_entity_clients: 225,
},
{
label: 'path-3-with-over-18-characters',
clients: 178,
entity_clients: 16,
non_entity_clients: 162,
},
],
},
{
label: 'test-ns-1/',
clients: 820,
entity_clients: 356,
non_entity_clients: 464,
mounts: [
{
label: 'path-2',
clients: 259,
entity_clients: 245,
non_entity_clients: 14,
},
{
label: 'path-4-with-over-18-characters',
clients: 256,
entity_clients: 63,
non_entity_clients: 193,
},
{
label: 'path-1',
clients: 239,
entity_clients: 30,
non_entity_clients: 209,
},
{
label: 'path-3-with-over-18-characters',
clients: 66,
entity_clients: 18,
non_entity_clients: 48,
},
],
},
],
},
},
];
hooks.before(function () {
sinon.stub(timestamp, 'now').callsFake(() => new Date('2018-04-03T14:15:30'));
});
hooks.beforeEach(function () {
this.set('timestamp', formatRFC3339(timestamp.now()));
this.set('isDateRange', true);
this.set('chartLegend', [
{ label: 'entity clients', key: 'entity_clients' },
{ label: 'non-entity clients', key: 'non_entity_clients' },
]);
this.set('byMonthActivityData', DATASET);
});
hooks.after(function () {
timestamp.now.restore();
});
test('it renders empty state with no data', async function (assert) {
await render(hbs`
<div id="modal-wormhole"></div>
UI: combine current + history client count tabs into one dashboard (#17575) * WIP/initial routing-ish * refactor date dropdown to reuse in modal and allowe current month selection * swap linter disable line * refactor date-dropdown to return object * refactor calendar widget, add tests * change calendar start and end args to getters * refactor dashboard to use date objects instead of array of year, month * remove dashboard files for easier to follow git diff * comment out dashboard tab until route name updated * delete current tab and route * fix undefined banner time * cleanup version history serializer and upgrade data * first pass of updating tests * add changelog * update client count util test * validate end time is after start time * update comment * add current month to calendar widget * add comments for code changes to make following API update * Removed a modified file from pull request * address comments/cleanup * update variables to const * update test const * rename history -> dashboard, fix tests * fix timestamps for attribution chart * update release note * refactor using backend start and end time params * add test for adapter formatting time params * fix tests * cleanup adapter comment and query params * change back history file name for diff * rename file using cli * revert filenames * rename files via git cli * revert route file name * last cli rename * refactor mirage * hold off on running total changes * update params in test * refactor to remove conditional assertions * finish tests * fix firefox tooltip * remove current-when * refactor version history * add timezone/UTC note * final cleanup!!!! * fix test * fix client count date tests * fix date-dropdown test * clear datedropdown completely * update date selectors to accommodate new year (#18586) * Revert "hold off on running total changes" This reverts commit 8dc79a626d549df83bc47e290392a556c670f98f. * remove assumed 0 values * update average helper to only calculate for array of objects * remove passing in bar chart data, map in running totals component instead * cleanup usage stat component * clear ss filters for new queries * update csv export, add explanation to modal * update test copy * consistently return null if no upgrade during activity (instead of empty array) * update description, add clarifying comments * update tes * add more clarifying comments * fix historic single month chart * remove old test tag * Update ui/app/components/clients/dashboard.js
2023-01-27 02:21:12 +00:00
<Clients::MonthlyUsage @chartLegend={{this.chartLegend}} @responseTimestamp={{this.timestamp}}/>
`);
assert.dom('[data-test-monthly-usage]').exists('monthly usage component renders');
assert.dom('[data-test-component="empty-state"]').exists();
assert.dom('[data-test-empty-state-subtext]').hasText('No data to display');
assert.dom('[data-test-monthly-usage-average-total] p.data-details').hasText('0', 'average total is 0');
assert.dom('[data-test-monthly-usage-average-new] p.data-details').hasText('0', 'average new is 0');
assert.dom('[data-test-vertical-bar-chart]').doesNotExist('vertical bar chart does not render');
assert.dom('[data-test-monthly-usage-legend]').doesNotExist('legend does not exist');
assert.dom('[data-test-monthly-usage-timestamp]').exists('renders timestamp');
});
test('it renders with month over month activity data', async function (assert) {
const expectedTotal = formatNumber([calculateAverage(DATASET, 'clients')]);
const expectedNew = formatNumber([
calculateAverage(
DATASET?.map((d) => d.new_clients),
'clients'
),
]);
await render(hbs`
<div id="modal-wormhole"></div>
<Clients::MonthlyUsage
Ember Upgrade to 4.4 (#17086) * runs ember-cli-update to 4.4.0 * updates yarn.lock * updates dependencies causing runtime errors (#17135) * Inject Store Service When Accessed Implicitly (#17345) * adds codemod for injecting store service * adds custom babylon parser with decorators-legacy plugin for jscodeshift transforms * updates inject-store-service codemod to only look for .extend object expressions and adds recast options * runs inject-store-service codemod on js files * replace query-params helper with hash (#17404) * Updates/removes dependencies throwing errors in Ember 4.4 (#17396) * updates ember-responsive to latest * updates ember-composable-helpers to latest and uses includes helper since contains was removed * updates ember-concurrency to latest * updates ember-cli-clipboard to latest * temporary workaround for toolbar-link component throwing errors for using params arg with LinkTo * adds missing store injection to auth configure route * fixes issue with string-list component throwing error for accessing prop in same computation * fixes non-iterable query params issue in mfa methods controller * refactors field-to-attrs to handle belongsTo rather than fragments * converts mount-config fragment to belongsTo on auth-method model * removes ember-api-actions and adds tune method to auth-method adapter * converts cluster replication attributes from fragment to relationship * updates ember-data, removes ember-data-fragments and updates yarn to latest * removes fragments from secret-engine model * removes fragment from test-form-model * removes commented out code * minor change to inject-store-service codemod and runs again on js files * Remove LinkTo positional params (#17421) * updates ember-cli-page-object to latest version * update toolbar-link to support link-to args and not positional params * adds replace arg to toolbar-link component * Clean up js lint errors (#17426) * replaces assert.equal to assert.strictEqual * update eslint no-console to error and disables invididual intended uses of console * cleans up hbs lint warnings (#17432) * Upgrade bug and test fixes (#17500) * updates inject-service codemod to take arg for service name and runs for flashMessages service * fixes hbs lint error after merging main * fixes flash messages * updates more deps * bug fixes * test fixes * updates ember-cli-content-security-policy and prevents default form submission throwing errors * more bug and test fixes * removes commented out code * fixes issue with code-mirror modifier sending change event on setup causing same computation error * Upgrade Clean Up (#17543) * updates deprecation workflow and filter * cleans up build errors, removes unused ivy-codemirror and sass and updates ember-cli-sass and node-sass to latest * fixes control groups test that was skipped after upgrade * updates control group service tests * addresses review feedback * updates control group service handleError method to use router.currentURL rather that transition.intent.url * adds changelog entry
2022-10-18 15:46:02 +00:00
@chartLegend={{this.chartLegend}}
@verticalBarChartData={{this.byMonthActivityData}}
UI: combine current + history client count tabs into one dashboard (#17575) * WIP/initial routing-ish * refactor date dropdown to reuse in modal and allowe current month selection * swap linter disable line * refactor date-dropdown to return object * refactor calendar widget, add tests * change calendar start and end args to getters * refactor dashboard to use date objects instead of array of year, month * remove dashboard files for easier to follow git diff * comment out dashboard tab until route name updated * delete current tab and route * fix undefined banner time * cleanup version history serializer and upgrade data * first pass of updating tests * add changelog * update client count util test * validate end time is after start time * update comment * add current month to calendar widget * add comments for code changes to make following API update * Removed a modified file from pull request * address comments/cleanup * update variables to const * update test const * rename history -> dashboard, fix tests * fix timestamps for attribution chart * update release note * refactor using backend start and end time params * add test for adapter formatting time params * fix tests * cleanup adapter comment and query params * change back history file name for diff * rename file using cli * revert filenames * rename files via git cli * revert route file name * last cli rename * refactor mirage * hold off on running total changes * update params in test * refactor to remove conditional assertions * finish tests * fix firefox tooltip * remove current-when * refactor version history * add timezone/UTC note * final cleanup!!!! * fix test * fix client count date tests * fix date-dropdown test * clear datedropdown completely * update date selectors to accommodate new year (#18586) * Revert "hold off on running total changes" This reverts commit 8dc79a626d549df83bc47e290392a556c670f98f. * remove assumed 0 values * update average helper to only calculate for array of objects * remove passing in bar chart data, map in running totals component instead * cleanup usage stat component * clear ss filters for new queries * update csv export, add explanation to modal * update test copy * consistently return null if no upgrade during activity (instead of empty array) * update description, add clarifying comments * update tes * add more clarifying comments * fix historic single month chart * remove old test tag * Update ui/app/components/clients/dashboard.js
2023-01-27 02:21:12 +00:00
@responseTimestamp={{this.timestamp}}
/>
`);
assert.dom('[data-test-monthly-usage]').exists('monthly usage component renders');
assert.dom('[data-test-component="empty-state"]').doesNotExist();
assert.dom('[data-test-vertical-bar-chart]').exists('vertical bar chart displays');
assert.dom('[data-test-monthly-usage-legend]').exists('renders vertical bar chart legend');
assert.dom('[data-test-monthly-usage-timestamp]').exists('renders timestamp');
findAll('[data-test-vertical-chart="x-axis-labels"] text').forEach((e, i) => {
assert.dom(e).hasText(`${DATASET[i].month}`, `renders x-axis label: ${DATASET[i].month}`);
});
assert
.dom('[data-test-vertical-chart="data-bar"]')
.exists(
{ count: DATASET.filter((m) => m.counts !== null).length * 2 },
'renders correct number of data bars'
);
assert
.dom('[data-test-monthly-usage-average-total] p.data-details')
.hasText(`${expectedTotal}`, `renders correct total average ${expectedTotal}`);
assert
.dom('[data-test-monthly-usage-average-new] p.data-details')
.hasText(`${expectedNew}`, `renders correct new average ${expectedNew}`);
});
});