-
Notifications
You must be signed in to change notification settings - Fork 4.3k
/
Copy pathreplication-summary-card.js
37 lines (34 loc) · 1.24 KB
/
replication-summary-card.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/**
* Copyright (c) HashiCorp, Inc.
* SPDX-License-Identifier: BUSL-1.1
*/
import { get } from '@ember/object';
import Component from '@glimmer/component';
/**
* @module ReplicationSummaryCard
* The `ReplicationSummaryCard` is a card-like component. It displays cluster mode details for both DR and Performance
*
* @example
* ```js
* <ReplicationSummaryCard
@title='States'
@replicationDetails={DS.Model.replicationDetailsSummary}
/>
* ```
* @param {String} [title=null] - The title to be displayed on the top left corner of the card.
* @param {Object} replicationDetails=null - An Ember data object computed off the Ember Model. It combines the Model.dr and Model.performance objects into one and contains details specific to the mode replication.
*/
export default class ReplicationSummaryCard extends Component {
get key() {
return this.args.title === 'Performance' ? 'performance' : 'dr';
}
get lastWAL() {
return get(this.args.replicationDetails, `${this.key}.lastWAL`) || 0;
}
get merkleRoot() {
return get(this.args.replicationDetails, `${this.key}.merkleRoot`) || 'no hash found';
}
get knownSecondariesCount() {
return get(this.args.replicationDetails, `${this.key}.knownSecondaries.length`) || 0;
}
}