X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=skyquake%2Fplugins%2Faccounts%2Fsrc%2Faccount%2FaccountStore.js;h=22e8a17a9a49a9e8e3bcd5479237639c6241243d;hb=80097691f3ed0adb4406906ef619c1042c2219ea;hp=f6e2ef1df33c10e7f05fca860b53bf1e7f081b00;hpb=e29efc315df33d546237e270470916e26df391d6;p=osm%2FUI.git diff --git a/skyquake/plugins/accounts/src/account/accountStore.js b/skyquake/plugins/accounts/src/account/accountStore.js index f6e2ef1df..22e8a17a9 100644 --- a/skyquake/plugins/accounts/src/account/accountStore.js +++ b/skyquake/plugins/accounts/src/account/accountStore.js @@ -1,5 +1,5 @@ /* - * + * * Copyright 2016 RIFT.IO Inc * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -18,9 +18,10 @@ import AccountActions from './accountActions.js'; import AccountSource from './accountSource.js'; - +var Utils = require('utils/utils.js'); var rw = require('utils/rw.js'); var altImage = rw.getSearchParams(window.location).alt_image; +var _ = require('lodash'); let Params = { //Config Agent @@ -125,16 +126,18 @@ let AccountMeta = { label: 'Floating IP Pool', ref: 'floating-ip-pool', optional: true - }], - "openmano": [{ - label: "Host", - ref: 'host' }, { - label: "Port", - ref: 'port' + label: "User Domain", + ref: 'user-domain', + optional: true + }, { + label: "Project Domain", + ref: 'project-domain', + optional: true }, { - label: "Tenant ID", - ref: 'tenant-id' + label: "Region", + ref: 'region', + optional: true }], "openvim": [{ label: "Host", @@ -174,9 +177,6 @@ let AccountMeta = { }, { "name": "Cloudsim", "account-type": "cloudsim_proxy" - }, { - "name": "Open Mano", - "account-type": "openmano" }, { "name": "AWS", "account-type": "aws" @@ -189,7 +189,6 @@ let AccountMeta = { }, image: { "aws": require("../../images/aws.png"), - "openmano": altImage || require("../../images/openmano.png"), "openvim": require("../../images/openmano.png"), "openstack": require("../../images/openstack.png"), "cloudsim_proxy": require("../../images/riftio.png"), @@ -199,7 +198,6 @@ let AccountMeta = { }, labelByType: { "aws": "AWS", - "openmano": "OpenStack", "openvim": "Open VIM", "openstack": "OpenStack", "cloudsim_proxy": "Cloudsim" @@ -216,6 +214,7 @@ export default class AccountStore { this.refreshingAll = false; this.sdnOptions = []; this.AccountMeta = AccountMeta; + this.showVIM = true; this.bindActions(AccountActions(this.alt)); this.registerAsync(AccountSource); this.exportPublicMethods({ @@ -248,6 +247,14 @@ export default class AccountStore { } refreshCloudAccountSuccess = () => { + } + getResourceOrchestratorSuccess = (data) => { + this.alt.actions.global.hideScreenLoader.defer(); + if(data['rw-launchpad:resource-orchestrator'] && (data['rw-launchpad:resource-orchestrator']['account-type'] == 'openmano')) { + this.setState({ + showVIM: false + }) + } } deleteAccountSuccess = (response) => { this.setState({ @@ -258,7 +265,6 @@ export default class AccountStore { openAccountSocketSuccess = (connection) => { let self = this; let ws = window.multiplexer.channel(connection); - if (!connection) return; this.setState({ socket: ws.ws, @@ -267,6 +273,9 @@ export default class AccountStore { ws.onmessage = (socket) => { try { var data = JSON.parse(socket.data); + Utils.checkAuthentication(data.statusCode, function() { + self.closeSocket(); + }); let SdnOptions = [{ label: 'Select an SDN Account', value: false @@ -283,7 +292,7 @@ export default class AccountStore { if(self.currentAccount) { let Account = self.getAccountFromStream(data[self.currentAccount.type].data, self.currentAccount.name); newState.account = self.account; - newState.account['connection-status'] = Account['connection-status'] + newState.account['connection-status'] = Account && Account['connection-status'] } self.setState(newState) } catch(error) { @@ -324,7 +333,7 @@ export default class AccountStore { } getAccountFromStream(data, name) { let result = null; - data.map(function(a) { + data && _.isArray(data) && data.map(function(a) { if(a.name == name) { result = a; } @@ -334,7 +343,7 @@ export default class AccountStore { viewAccount = ({type, name}) => { var data = null; var accounts = null; - if(this && this[type].length) { + if(this && this[type] && this[type].length) { accounts = this[type]; data = this.getAccountFromStream(accounts, name); if(data) { @@ -356,7 +365,7 @@ export default class AccountStore { } generateOptionsByName(data) { let results = []; - if (data.constructor.name == "Array") { + if (data && _.isArray(data)) { data.map(function(d) { results.push({ label: d.name, @@ -413,18 +422,3 @@ export default class AccountStore { } } - -/** - *Cloud - * - * {"name":"eng2","account-type":"openstack","openstack":{"key":"lmaultsb","secret":"mypasswd","auth_url":"http://engstack.eng.riftio.com:5000/v3/","tenant":"lmaultsb","mgmt-network":"private"}} -Name -Path - - -SDN - - - * - * - */