2 * STANDARD_RIFT_IO_COPYRIGHT
4 import AccountActions
from './configActions.js';
5 import AccountSource
from './configSource.js';
8 "rw-launchpad:resource-orchestrator": {
10 "account-type": "openmano",
13 "tenant-id": "d2581f60-4f28-11e6-9732-fa163e4bfd3e",
19 var rw
= require('utils/rw.js');
20 var altImage
= rw
.getSearchParams(window
.location
).alt_image
;
32 'account-types': ['openmano', 'rift-ro'],
45 "openmano": altImage
|| require("../../images/openmano.png"),
46 "rift-ro": require("../../images/riftio.png")
50 "openmano": "OpenStack",
55 export default class ConfigStore
{
58 this.accountType
= 'openmano';
59 this.refreshingAll
= false;
61 this.AccountMeta
= AccountMeta
;
62 this.bindActions(AccountActions(this.alt
));
63 this.registerAsync(AccountSource
);
64 this.exportPublicMethods({
65 getROAccount
: this.getROAccount
,
66 handleParamChange
: this.handleParamChange
,
67 handleNameChange
: this.handleNameChange
,
68 handleAccountTypeChange
: this.handleAccountTypeChange
,
69 updateAccount
: this.updateAccount
,
70 getImage
: this.getImage
73 setAccountTemplate
= (AccountType
) => {
77 'account-type': AccountType
|| 'rift-ro',
79 account
[AccountType
|| 'rift-ro'] = {};
80 state
.account
= account
;
81 state
.accountType
= AccountType
;
82 if (AccountType
== this.initialAccountType
) {
83 state
.account
= this.initialAccount
;
87 updateAccount
= (account
) => {
88 this.setState({account
:account
})
90 getROAccount
= () => {
91 let data
= tempData
["rw-launchpad:resource-orchestrator"]
96 handleNameChange
= (event
) => {
97 var account
= this.account
;
98 account
.name
= event
.target
.value
;
105 handleAccountTypeChange
= (event
) => {
106 var accountType
= event
.target
.value
;
107 this.setAccountTemplate(accountType
);
109 handleParamChange(node
, event
) {
110 return function(event
) {
111 var account
= this.state
.account
;
112 account
[account
['account-type']][node
.ref
] = event
.target
.value
;
113 this.updateAccount(account
);
116 getImage
= (type
) => {
117 return AccountMeta
.imageByType
[type
];
119 getResourceOrchestratorSuccess
= (data
) => {
120 this.alt
.actions
.global
.hideScreenLoader
.defer();
122 this.setAccountTemplate(false)
125 initialAccount
: data
,
126 initialAccountType
: data
['account-type'],
128 accountType
: data
['account-type'] || 'rift-ro'
132 updateResourceOrchestratorSuccess
= (data
) => {
133 this.alt
.actions
.global
.showNotification
.defer({type
:'success', msg
: 'Resource Orchestrator has been succesfully updated'});