-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ui/pricing metrics page setup (#10049)
* Create model and adapter for metrics/activity * Query activity and return fake data on adapterError * Add stub of pricing metrics cards and search form elements to metrics template * Metrics page has pricing metrics rather than all-time tokens and requests * update metrics config model * Add metrics-config route and page * Remove metrics/http-requests route and template * remove log * Add alert banner for when tracking disabled, and add result dates * Small edits
- Loading branch information
Showing
16 changed files
with
221 additions
and
74 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import Application from '../application'; | ||
|
||
export default Application.extend({ | ||
queryRecord() { | ||
return this.ajax(this.urlForQuery(), 'GET').then(resp => { | ||
resp.id = resp.request_id; | ||
return resp; | ||
}); | ||
}, | ||
|
||
urlForQuery() { | ||
return this.buildURL() + '/internal/counters/activity'; | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import Application from '../application'; | ||
|
||
export default Application.extend({ | ||
queryRecord() { | ||
return this.ajax(this.urlForQuery(), 'GET').then(resp => { | ||
resp.id = resp.request_id; | ||
return resp; | ||
}); | ||
}, | ||
|
||
urlForQuery() { | ||
return this.buildURL() + '/internal/counters/config'; | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import Controller from '@ember/controller'; | ||
import { computed } from '@ember/object'; | ||
|
||
export default Controller.extend({ | ||
infoRows: computed(function() { | ||
return [ | ||
{ | ||
label: 'Usage data collection', | ||
helperText: 'Enable or disable collecting data to track clients.', | ||
valueKey: 'enabled', | ||
}, | ||
{ | ||
label: 'Retention period', | ||
helperText: 'The number of months of activity logs to maintain for client tracking.', | ||
valueKey: 'retentionMonths', | ||
}, | ||
{ | ||
label: 'Default display', | ||
helperText: 'The number of months we’ll display in the Vault usage dashboard by default.', | ||
valueKey: 'defaultReportMonths', | ||
}, | ||
]; | ||
}), | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import DS from 'ember-data'; | ||
|
||
export default DS.Model.extend({ | ||
total: DS.attr('object'), | ||
endTime: DS.attr('string'), | ||
startTime: DS.attr('string'), | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import DS from 'ember-data'; | ||
|
||
const { attr } = DS; | ||
|
||
export default DS.Model.extend({ | ||
queriesAvailable: attr('boolean'), | ||
defaultReportMonths: attr('number'), | ||
retentionMonths: attr('number'), | ||
enabled: attr('string'), | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import Route from '@ember/routing/route'; | ||
import ClusterRoute from 'vault/mixins/cluster-route'; | ||
|
||
export default Route.extend(ClusterRoute, { | ||
model() { | ||
return this.store.queryRecord('metrics/config', {}); | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,16 @@ | ||
import Route from '@ember/routing/route'; | ||
import ClusterRoute from 'vault/mixins/cluster-route'; | ||
import { hash } from 'rsvp'; | ||
|
||
export default Route.extend(ClusterRoute, { | ||
model() { | ||
return {}; | ||
let config = this.store.queryRecord('metrics/config', {}); | ||
|
||
let activity = this.store.queryRecord('metrics/activity', {}); | ||
|
||
return hash({ | ||
activity, | ||
config, | ||
}); | ||
}, | ||
}); |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import ApplicationSerializer from '../application'; | ||
|
||
export default ApplicationSerializer.extend({}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import ApplicationSerializer from '../application'; | ||
|
||
export default ApplicationSerializer.extend({ | ||
normalizeResponse(store, primaryModelClass, payload, id, requestType) { | ||
const normalizedPayload = { | ||
id: payload.id, | ||
...payload.data, | ||
enabled: payload.data.enabled.includes('enabled') ? 'On' : 'Off', | ||
}; | ||
return this._super(store, primaryModelClass, normalizedPayload, id, requestType); | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<PageHeader as |p|> | ||
<p.levelLeft> | ||
<h1 class="title is-3"> | ||
Metrics | ||
</h1> | ||
</p.levelLeft> | ||
</PageHeader> | ||
|
||
<div class="tabs-container box is-bottomless is-marginless is-fullwidth is-paddingless"> | ||
<nav class="tabs"> | ||
<ul> | ||
{{#link-to | ||
"vault.cluster.metrics" | ||
tagName="li" | ||
activeClass="is-active" | ||
}} | ||
{{#link-to | ||
"vault.cluster.metrics" | ||
data-test-configuration-tab=false | ||
}} | ||
Vault usage | ||
{{/link-to}} | ||
{{/link-to}} | ||
{{#link-to | ||
"vault.cluster.metrics-config" | ||
tagName="li" | ||
activeClass="is-active" | ||
}} | ||
{{#link-to | ||
"vault.cluster.metrics-config" | ||
data-test-configuration-tab=true | ||
}} | ||
Configuration | ||
{{/link-to}} | ||
{{/link-to}} | ||
</ul> | ||
</nav> | ||
</div> | ||
|
||
<div class="tabs-container box is-bottomless is-marginless is-fullwidth is-paddingless"> | ||
{{#each infoRows as |item|}} | ||
{{info-table-row | ||
label=item.label | ||
helperText=item.helperText | ||
value=(get model item.valueKey) | ||
}} | ||
{{/each}} | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
<PageHeader as |p|> | ||
<p.levelLeft> | ||
<h1 class="title is-3"> | ||
Metrics | ||
</h1> | ||
</p.levelLeft> | ||
</PageHeader> | ||
|
||
<div class="tabs-container box is-bottomless is-marginless is-fullwidth is-paddingless"> | ||
<nav class="tabs"> | ||
<ul> | ||
{{#link-to | ||
"vault.cluster.metrics" | ||
tagName="li" | ||
activeClass="is-active" | ||
}} | ||
{{#link-to | ||
"vault.cluster.metrics" | ||
data-test-configuration-tab=false | ||
}} | ||
Vault usage | ||
{{/link-to}} | ||
{{/link-to}} | ||
{{#link-to | ||
"vault.cluster.metrics-config" | ||
tagName="li" | ||
activeClass="is-active" | ||
}} | ||
{{#link-to | ||
"vault.cluster.metrics-config" | ||
data-test-configuration-tab=true | ||
}} | ||
Configuration | ||
{{/link-to}} | ||
{{/link-to}} | ||
</ul> | ||
</nav> | ||
</div> | ||
|
||
<div class="box is-sideless is-fullwidth is-marginless is-bottomless"> | ||
{{#unless (eq model.config.enabled 'On')}} | ||
<AlertBanner | ||
@type="warning" | ||
@title="Tracking is disabled" | ||
> | ||
This feature is currently disabled and data is not being collected. {{#link-to 'vault.cluster.metrics-config'}}Edit the configuration{{/link-to}} to enable tracking again. | ||
</AlertBanner> | ||
{{/unless}} | ||
<p class="has-bottom-margin-s">The active clients metric contributes to billing. It is collected at the end of each month alongside unique entities and direct active tokens.</p> | ||
<h2 class="title is-4"> | ||
{{date-format model.activity.startTime "MMM DD, YYYY"}} through {{date-format model.activity.endTime "MMM DD, YYYY"}} | ||
</h2> | ||
<div class="selectable-card-container"> | ||
<SelectableCard | ||
@cardTitle="Active clients" | ||
@total={{model.activity.total.clients}} | ||
@subText="Current namespace" | ||
/> | ||
<SelectableCard | ||
@cardTitle="Unique entities" | ||
@total={{model.activity.total.distinct_entities}} | ||
@subText="Current namespace" | ||
/> | ||
<SelectableCard | ||
@cardTitle="Active direct tokens" | ||
@total={{model.activity.total.non_entity_tokens}} | ||
@subText="Current namespace" | ||
/> | ||
</div> | ||
</div> |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.