X-Git-Url: https://osm.etsi.org/gitweb/?p=osm%2FUI.git;a=blobdiff_plain;f=skyquake%2Fplugins%2Fredundancy%2Fsrc%2Fdashboard%2Fconfig.jsx;fp=skyquake%2Fplugins%2Fredundancy%2Fsrc%2Fdashboard%2Fconfig.jsx;h=5db3e5a347c08f66fcd42e4f6e9443d06d608335;hp=0000000000000000000000000000000000000000;hb=03156e335275de1dafbc2a816e98006afdf249bf;hpb=f2dc2462571800e62cba969964de621dca09299c;ds=sidebyside diff --git a/skyquake/plugins/redundancy/src/dashboard/config.jsx b/skyquake/plugins/redundancy/src/dashboard/config.jsx new file mode 100644 index 000000000..5db3e5a34 --- /dev/null +++ b/skyquake/plugins/redundancy/src/dashboard/config.jsx @@ -0,0 +1,227 @@ +/* + * STANDARD_RIFT_IO_COPYRIGHT + */ + +import React from 'react'; +import ReactDOM from 'react-dom'; +import AppHeader from 'widgets/header/header.jsx'; +import RedundancyStore from './redundancyStore.js'; +import SkyquakeComponent from 'widgets/skyquake_container/skyquakeComponent.jsx'; +import SkyquakeRBAC from 'widgets/skyquake_rbac/skyquakeRBAC.jsx'; +import 'style/layout.scss'; +import {Panel, PanelWrapper} from 'widgets/panel/panel'; +import {InputCollection, FormSection} from 'widgets/form_controls/formControls.jsx'; + +import TextInput from 'widgets/form_controls/textInput.jsx'; +import Input from 'widgets/form_controls/input.jsx'; +import Button, {ButtonGroup} from 'widgets/button/sq-button.jsx'; +import SelectOption from 'widgets/form_controls/selectOption.jsx'; +import 'widgets/form_controls/formControls.scss'; +import imgAdd from '../../node_modules/open-iconic/svg/plus.svg' +import imgRemove from '../../node_modules/open-iconic/svg/trash.svg' +import _ from 'lodash'; +import ROLES from 'utils/roleConstants.js'; + +import './redundancy.scss'; +const PLATFORM = ROLES.PLATFORM; + +class ConfigDashboard extends React.Component { + constructor(props) { + super(props); + this.Store = this.props.flux.stores.hasOwnProperty('RedundancyStore') ? this.props.flux.stores.RedundancyStore : this.props.flux.createStore(RedundancyStore, 'RedundancyStore'); + this.state = this.Store.getState(); + this.actions = this.state.actions; + } + componentDidUpdate() { + } + componentWillMount() { + this.state = this.Store.getState(); + this.Store.getRedundancy(); + this.Store.listen(this.updateState); + } + componentWillUnmount() { + this.Store.unlisten(this.updateState); + } + updateState = (state) => { + this.setState(state); + } + updateConfigInput = (containerName, key, e) => { + let configData = this.state[containerName]; + if(!configData) { + configData = {}; + } + configData[key] = e.target.value; + this.actions.handleUpdateConfigInput({[containerName]:configData}) + } + updateDnsIpFqdnConfigInput = (e) => { + let value = e.target.value; + this.actions.handleUpdateConfigInput({'dns-ip-fqdn':value}) + } + updateConfig = (e) => { + let self = this; + e.preventDefault(); + e.stopPropagation(); + let configData = self.state.configData; + let userCredentials = configData['user-credentials']; + if (!userCredentials || (userCredentials['username'].trim() == '' ) || (userCredentials['password'].trim() == '' )) { + self.props.flux.actions.global.showNotification("Please enter your user credentials"); + return; + } + this.Store.updateConfig(configData); + } + evaluateSubmit = (e) => { + if (e.keyCode == 13) { + if (this.props.isEdit) { + this.updateConfig(e); + } else { + this.updateConfig(e); + } + e.preventDefault(); + e.stopPropagation(); + } + } + failOverDecisionChange = (e) => { + let value = e.target.value; + value = value.toUpperCase(); + this.actions.handleFailOverDecisionChange(value); + } + render() { + let self = this; + let html; + let props = this.props; + let state = this.state; + let passwordSectionHTML = null; + let configData = state.configData; + let formButtonsHTML = ( + +