X-Git-Url: https://osm.etsi.org/gitweb/?p=osm%2FUI.git;a=blobdiff_plain;f=skyquake%2Fplugins%2Fconfig%2Fsrc%2Fdashboard%2Finputs.jsx;fp=skyquake%2Fplugins%2Fconfig%2Fsrc%2Fdashboard%2Finputs.jsx;h=0000000000000000000000000000000000000000;hp=1636f4c07517a537449f8779672e90e4e91f287e;hb=03156e335275de1dafbc2a816e98006afdf249bf;hpb=f2dc2462571800e62cba969964de621dca09299c
diff --git a/skyquake/plugins/config/src/dashboard/inputs.jsx b/skyquake/plugins/config/src/dashboard/inputs.jsx
deleted file mode 100644
index 1636f4c07..000000000
--- a/skyquake/plugins/config/src/dashboard/inputs.jsx
+++ /dev/null
@@ -1,401 +0,0 @@
-/*
- * STANDARD_RIFT_IO_COPYRIGHT
- */
-
-import React from 'react';
-import Button from 'widgets/button/rw.button.js';
-import _cloneDeep from 'lodash/cloneDeep';
-import SkyquakeComponent from 'widgets/skyquake_container/skyquakeComponent.jsx';
-import Crouton from 'react-crouton';
-import TextInput from 'widgets/form_controls/textInput.jsx';
-import 'style/common.scss';
-import './config.scss';
-class Account extends React.Component {
- constructor(props) {
- super(props);
- this.state = {};
- this.state.account = {};
- }
- storeListener = (state) => {
- if(!state.account) {
- this.setUp(this.props)
- }
- state.account && this.setState({account: state.account,accountType: state.accountType, types: state.types, sdnOptions: state.sdnOptions})
- }
- componentWillMount() {
- this.props.store.listen(this.storeListener);
- this.setUp(this.props);
- }
- componentWillReceiveProps(nextProps) {
- if(JSON.stringify(nextProps.params) != JSON.stringify(this.props.params)){
- this.setUp(nextProps);
- }
- }
- componentWillUnmount() {
- this.props.store.unlisten(this.storeListener);
- }
- setUp(props){
- if(props.params.name != 'create') {
- this.props.store.viewAccount({type: props.params.type, name: props.params.name});
- } else {
- this.props.store.setAccountTemplate(props.params.type);
- }
- }
- create(e) {
- e.preventDefault();
- var self = this;
- var Account = this.state.account;
- let AccountType = this.state.accountType;
- if (Account.name == "") {
- self.props.flux.actions.global.showNotification("Please give the account a name");
- return;
- } else {
- var type = Account['account-type'];
- var params = Account.params;
-
- if(params) {
- for (var i = 0; i < params.length; i++) {
- var param = params[i].ref;
- if (typeof(Account[type]) == 'undefined' || typeof(Account[type][param]) == 'undefined' || Account[type][param] == "") {
- if (!params[i].optional) {
- self.props.flux.actions.global.showNotification("Please fill all account details");
- return;
- }
- }
- }
- }
-
- let nestedParams = Account.nestedParams && Account.nestedParams;
- if (nestedParams && nestedParams.params) {
- for (let i = 0; i < nestedParams.params.length; i++) {
- let nestedParam = nestedParams.params[i].ref;
- if (typeof(Account[type]) == 'undefined' || typeof(Account[type][nestedParams['container-name']][nestedParam]) == 'undefined' || Account[type][nestedParams['container-name']][nestedParam] == "") {
- if (!nestedParams.params[i].optional) {
- self.props.flux.actions.global.showNotification("Please fill all account details");
- return;
- }
- }
- }
- }
- }
-
- let newAccount = _cloneDeep(removeTrailingWhitespace(Account));
- delete newAccount.params;
- newAccount.nestedParams &&
- newAccount.nestedParams['container-name'] &&
- delete newAccount[newAccount.nestedParams['container-name']];
- delete newAccount.nestedParams;
-
- this.props.flux.actions.global.showScreenLoader();
- this.props.store.create(newAccount, AccountType).then(function() {
- self.props.router.push({pathname:'accounts'});
- self.props.flux.actions.global.hideScreenLoader.defer();
- },
- function() {
- self.props.flux.actions.global.showNotification("There was an error creating your account. Please contact your system administrator.");
- self.props.flux.actions.global.hideScreenLoader.defer();
- });
- }
- update(e) {
- e.preventDefault();
- var self = this;
- var Account = this.state.account;
- let AccountType = this.state.accountType;
- this.props.flux.actions.global.showScreenLoader();
- this.props.store.update(Account, AccountType).then(function() {
- self.props.router.push({pathname:'accounts'});
- self.props.flux.actions.global.hideScreenLoader();
- },
- function() {
-
- });
- }
- cancel = (e) => {
- e.preventDefault();
- e.stopPropagation();
- this.props.router.push({pathname:'accounts'});
- }
- handleDelete = () => {
- let self = this;
- let msg = 'Preparing to delete "' + self.state.account.name + '"' +
- ' Are you sure you want to delete this ' + self.state.accountType + ' account?"';
- if (window.confirm(msg)) {
- this.props.store.delete(self.state.accountType, self.state.account.name).then(function() {
- self.props.flux.actions.global.hideScreenLoader();
- self.props.router.push({pathname:'accounts'});
- }, function(){
- // self.props.flux.actions.global.hideScreenLoader.defer();
- // console.log('Delete Account Fail');
- });
- } else {
- self.props.flux.actions.global.hideScreenLoader();
- }
- }
- handleNameChange(event) {
- this.props.store.handleNameChange(event);
- }
- handleAccountTypeChange(node, event) {
- this.props.store.handleAccountTypeChange(node, event);
- }
- handleSelectSdnAccount = (e) => {
- var tmp = this.state.account;
- if(e) {
- tmp['sdn-account'] = e;
- } else {
- if(tmp['sdn-account']) {
- delete tmp['sdn-account'];
- }
- }
- console.log(e, tmp)
- }
- preventDefault = (e) => {
- e.preventDefault();
- e.stopPropagation();
- }
- evaluateSubmit = (e) => {
- if (e.keyCode == 13) {
- if (this.props.edit) {
- this.update(e);
- } else {
- this.create(e);
- }
- e.preventDefault();
- e.stopPropagation();
- }
- }
-
- render() {
- let self = this;
- let {store, ...props} = this.props;
- // This section builds elements that only show up on the create page.
- // var name = ;
- var name =