2023-03-15 16:00:52 +00:00
|
|
|
/**
|
|
|
|
* Copyright (c) HashiCorp, Inc.
|
|
|
|
* SPDX-License-Identifier: MPL-2.0
|
|
|
|
*/
|
|
|
|
|
2019-10-14 18:23:29 +00:00
|
|
|
import { inject as service } from '@ember/service';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @module RaftJoin
|
|
|
|
* RaftJoin component presents the user with a choice to join an existing raft cluster when a new Vault
|
|
|
|
* server is brought up
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* @example
|
|
|
|
* ```js
|
|
|
|
* <RaftJoin @onDismiss={{action (mut attr)}} />
|
|
|
|
* ```
|
|
|
|
* @param {function} onDismiss - This function will be called if the user decides not to join an existing
|
|
|
|
* raft cluster
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
import Component from '@ember/component';
|
|
|
|
|
|
|
|
export default Component.extend({
|
|
|
|
classNames: 'raft-join',
|
|
|
|
store: service(),
|
|
|
|
onDismiss() {},
|
|
|
|
preference: 'join',
|
|
|
|
showJoinForm: false,
|
|
|
|
actions: {
|
2022-10-18 15:46:02 +00:00
|
|
|
advanceFirstScreen(event) {
|
|
|
|
event.preventDefault();
|
2019-10-14 18:23:29 +00:00
|
|
|
if (this.preference !== 'join') {
|
|
|
|
this.onDismiss();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
this.set('showJoinForm', true);
|
|
|
|
},
|
|
|
|
newModel() {
|
|
|
|
return this.store.createRecord('raft-join');
|
|
|
|
},
|
|
|
|
},
|
|
|
|
});
|