35c188fba7
* Client count updates - Added Current month tab which leverages partial monthly activity api - Refactored Vault usage to Monthly history - New client count history component based on StatText and BarChart component - Restrict bar chart to showcase only top 10 namespaces - Removed config route, as config and history component will be rendered based on query param - Updated all metrics reference to clients - Removed old tests and added integration test for current month * Fixed navbar permission - Added changelog * Updated the model for current month data * Fixed current month tests * Fixed indentation and chart label
41 lines
1.2 KiB
JavaScript
41 lines
1.2 KiB
JavaScript
import Component from '@glimmer/component';
|
|
|
|
export default class HistoryComponent extends Component {
|
|
max_namespaces = 10;
|
|
|
|
get hasClientData() {
|
|
if (this.args.tab === 'current') {
|
|
return this.args.model.activity && this.args.model.activity.clients;
|
|
}
|
|
return this.args.model.activity && this.args.model.activity.total;
|
|
}
|
|
|
|
get barChartDataset() {
|
|
if (!this.args.model.activity || !this.args.model.activity.byNamespace) {
|
|
return null;
|
|
}
|
|
let dataset = this.args.model.activity.byNamespace;
|
|
// Filter out root data
|
|
dataset = dataset.filter(item => {
|
|
return item.namespace_id !== 'root';
|
|
});
|
|
// Show only top 10 namespaces
|
|
dataset = dataset.slice(0, this.max_namespaces);
|
|
return dataset.map(d => {
|
|
return {
|
|
label: d['namespace_path'],
|
|
non_entity_tokens: d['counts']['non_entity_tokens'],
|
|
distinct_entities: d['counts']['distinct_entities'],
|
|
total: d['counts']['clients'],
|
|
};
|
|
});
|
|
}
|
|
|
|
get showGraphs() {
|
|
if (!this.args.model.activity || !this.args.model.activity.byNamespace) {
|
|
return null;
|
|
}
|
|
return this.args.model.activity.byNamespace.length > 1;
|
|
}
|
|
}
|