2022-01-27 18:59:08 +00:00
|
|
|
import Component from '@glimmer/component';
|
2022-02-02 19:46:59 +00:00
|
|
|
import { tracked } from '@glimmer/tracking';
|
2022-01-27 18:59:08 +00:00
|
|
|
export default class Current extends Component {
|
|
|
|
chartLegend = [
|
|
|
|
{ key: 'entity_clients', label: 'entity clients' },
|
|
|
|
{ key: 'non_entity_clients', label: 'non-entity clients' },
|
|
|
|
];
|
2022-02-02 19:46:59 +00:00
|
|
|
@tracked selectedNamespace = null;
|
|
|
|
|
|
|
|
// TODO CMB get from model
|
|
|
|
get upgradeDate() {
|
|
|
|
return this.args.upgradeDate || null;
|
|
|
|
}
|
|
|
|
|
|
|
|
get licenseStartDate() {
|
|
|
|
return this.args.licenseStartDate || null;
|
|
|
|
}
|
|
|
|
|
2022-02-02 21:24:24 +00:00
|
|
|
// API client count data by namespace for current/partial month
|
2022-02-02 19:46:59 +00:00
|
|
|
get byNamespaceCurrent() {
|
|
|
|
return this.args.model.monthly?.byNamespace || null;
|
|
|
|
}
|
2022-01-27 18:59:08 +00:00
|
|
|
|
2022-02-02 21:24:24 +00:00
|
|
|
// top level TOTAL client counts for current/partial month
|
|
|
|
get totalUsageCounts() {
|
|
|
|
return this.selectedNamespace
|
|
|
|
? this.filterByNamespace(this.selectedNamespace)
|
|
|
|
: this.args.model.monthly?.total;
|
|
|
|
}
|
|
|
|
|
|
|
|
// total client data for horizontal bar chart in attribution component
|
|
|
|
get totalClientsData() {
|
2022-02-02 19:46:59 +00:00
|
|
|
if (this.selectedNamespace) {
|
|
|
|
let filteredNamespace = this.filterByNamespace(this.selectedNamespace);
|
2022-02-02 21:24:24 +00:00
|
|
|
return filteredNamespace.mounts ? this.filterByNamespace(this.selectedNamespace).mounts : null;
|
2022-02-02 19:46:59 +00:00
|
|
|
} else {
|
|
|
|
return this.byNamespaceCurrent;
|
|
|
|
}
|
2022-01-27 18:59:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
get responseTimestamp() {
|
|
|
|
return this.args.model.monthly?.responseTimestamp;
|
|
|
|
}
|
2022-02-02 19:46:59 +00:00
|
|
|
|
|
|
|
// HELPERS
|
|
|
|
filterByNamespace(namespace) {
|
|
|
|
return this.byNamespaceCurrent.find((ns) => ns.label === namespace);
|
|
|
|
}
|
2022-01-27 18:59:08 +00:00
|
|
|
}
|