mirror of
https://github.com/hashicorp/vault.git
synced 2025-08-19 13:41:10 +02:00
* Add replication-overview-mode component + tests * Move both primary view higher to template * simplify replication-summary component * remove replication-mode-summary * Add jsdocs to replication-overview-mode * fix overview-mode test * fix page/mode-index test * copyright * address PR comments * note to devs
39 lines
1.2 KiB
JavaScript
39 lines
1.2 KiB
JavaScript
/**
|
|
* Copyright (c) HashiCorp, Inc.
|
|
* SPDX-License-Identifier: BUSL-1.1
|
|
*/
|
|
|
|
import { service } from '@ember/service';
|
|
import { computed } from '@ember/object';
|
|
import Component from '@ember/component';
|
|
import ReplicationActions from 'core/mixins/replication-actions';
|
|
|
|
/**
|
|
* @module ReplicationSummary
|
|
* ReplicationSummary component is a component to show the mode-specific summary for replication
|
|
*
|
|
* @param {ClusterModel} cluster - the cluster ember-data model
|
|
* @param {string} initialReplicationMode - mode for replication details we want to see, either "dr" or "performance"
|
|
*/
|
|
export default Component.extend(ReplicationActions, {
|
|
'data-test-replication-summary': true,
|
|
attributeBindings: ['data-test-replication-summary'],
|
|
replicationMode: 'dr',
|
|
mode: 'primary',
|
|
version: service(),
|
|
rm: service('replication-mode'),
|
|
didReceiveAttrs() {
|
|
this._super(...arguments);
|
|
const initialReplicationMode = this.initialReplicationMode;
|
|
if (initialReplicationMode) {
|
|
this.set('replicationMode', initialReplicationMode);
|
|
}
|
|
},
|
|
initialReplicationMode: null,
|
|
cluster: null,
|
|
|
|
attrsForCurrentMode: computed('cluster', 'rm.mode', function () {
|
|
return this.cluster[this.rm.mode];
|
|
}),
|
|
});
|