3 * STANDARD_RIFT_IO_COPYRIGHT
5 import Alt from '../alt';
6 import LaunchNetworkServiceSource from '../network_service_launcher/launchNetworkServiceSource';
7 import LaunchNetworkServiceActions from '../network_service_launcher/launchNetworkServiceActions';
8 var ConfigAgentAccountSource = require('./configAgentAccountSource');
9 var ConfigAgentAccountActions = require('./configAgentAccountActions');
11 function createconfigAgentAccountStore () {
12 this.exportAsync(ConfigAgentAccountSource);
13 this.exportAsync(LaunchNetworkServiceSource);
14 this.bindAction(ConfigAgentAccountActions.createConfigAccountSuccess, this.createConfigAccountSuccess);
15 this.bindAction(ConfigAgentAccountActions.createConfigAccountLoading, this.createConfigAccountLoading);
16 this.bindAction(ConfigAgentAccountActions.createConfigAccountFailed, this.createConfigAccountFailed);
17 this.bindAction(ConfigAgentAccountActions.UPDATE_SUCCESS, this.updateSuccess);
18 this.bindAction(ConfigAgentAccountActions.UPDATE_LOADING, this.updateLoading);
19 this.bindAction(ConfigAgentAccountActions.UPDATE_FAIL, this.updateFail);
20 this.bindAction(ConfigAgentAccountActions.DELETE_SUCCESS, this.deleteSuccess);
21 this.bindAction(ConfigAgentAccountActions.DELETE_FAIL, this.deleteFail);
22 this.bindAction(ConfigAgentAccountActions.GET_CONFIG_AGENT_ACCOUNT_SUCCESS, this.getConfigAgentAccountSuccess);
23 this.bindAction(ConfigAgentAccountActions.GET_CONFIG_AGENT_ACCOUNT_FAIL, this.getConfigAgentAccountFail);
24 this.bindAction(ConfigAgentAccountActions.GET_CONFIG_AGENT_ACCOUNTS_SUCCESS, this.getConfigAgentAccountsSuccess);
25 // this.bindAction(ConfigAgentAccountActions.GET_CONFIG_AGENT_ACCOUNTS_FAIL, this.getConfigAgentAccountsFail);
26 this.bindAction(ConfigAgentAccountActions.VALIDATE_ERROR, this.validateError);
27 this.bindAction(ConfigAgentAccountActions.VALIDATE_RESET, this.validateReset);
29 getCatalogSuccess: LaunchNetworkServiceActions.getCatalogSuccess
31 this.exportPublicMethods({
32 resetAccount: this.resetAccount.bind(this),
33 validateReset: this.validateReset.bind(this),
34 createConfigAccountFailed: this.createConfigAccountFailed.bind(this)
36 this.configAgentAccount = {};
37 this.configAgentAccounts = [];
39 self.validateErrorMsg = "";
40 self.validateErrorEvent = 0;
41 this.isLoading = true;
61 "account-type": "juju",
64 this.configAgentAccount = {
66 'account-type': 'juju'
68 this.validateErrorEvent = 0;
69 this.validateErrorMsg = '';
73 createconfigAgentAccountStore.prototype.resetAccount = function() {
77 'account-type': 'juju'
81 createconfigAgentAccountStore.prototype.validateReset = function() {
83 validateErrorEvent: false
86 createconfigAgentAccountStore.prototype.createConfigAccountLoading = function() {
91 createconfigAgentAccountStore.prototype.createConfigAccountSuccess = function() {
96 createconfigAgentAccountStore.prototype.createConfigAccountFailed = function(msg) {
98 var xhr = arguments[0];
101 validateErrorEvent: true,
102 validateErrorMsg: "There was an error creating your Config Agent Account. Please contact your system administrator"
105 createconfigAgentAccountStore.prototype.updateLoading = function() {
110 createconfigAgentAccountStore.prototype.updateSuccess = function() {
115 createconfigAgentAccountStore.prototype.updateFail = function() {
116 var xhr = arguments[0];
119 validateErrorEvent: true,
120 validateErrorMsg: "There was an error updating your Config Agent Account. Please contact your system administrator"
124 createconfigAgentAccountStore.prototype.deleteSuccess = function(data) {
133 createconfigAgentAccountStore.prototype.deleteFail = function(data) {
136 validateErrorEvent: true,
137 validateErrorMsg: "There was an error deleting your Config Agent Account. Please contact your system administrator"
144 createconfigAgentAccountStore.prototype.getConfigAgentAccountSuccess = function(data) {
147 configAgentAccount: data.configAgentAccount,
152 createconfigAgentAccountStore.prototype.getConfigAgentAccountFail = function(data) {
155 validateErrorEvent: true,
156 validateErrorMsg: "There was an error obtaining the data for the Config Agent Account. Please contact your system administrator"
160 createconfigAgentAccountStore.prototype.validateError = function(msg) {
162 validateErrorEvent: true,
163 validateErrorMsg: msg
166 createconfigAgentAccountStore.prototype.validateReset = function() {
168 validateErrorEvent: false
171 createconfigAgentAccountStore.prototype.getConfigAgentAccountsSuccess = function(configAgentAccounts) {
173 configAgentAccounts: configAgentAccounts || [],
177 createconfigAgentAccountStore.prototype.getCatalogSuccess = function(data) {
179 var descriptorCount = 0;
180 data.forEach(function(catalog) {
181 descriptorCount += catalog.descriptors.length;
185 descriptorCount: descriptorCount
190 module.exports = Alt.createStore(createconfigAgentAccountStore);;