diff options
Diffstat (limited to 'ui-react/src')
-rw-r--r-- | ui-react/src/LoopUI.js | 32 | ||||
-rw-r--r-- | ui-react/src/api/LoopActionService.js | 74 | ||||
-rw-r--r-- | ui-react/src/api/LoopCache.js | 4 | ||||
-rw-r--r-- | ui-react/src/api/LoopService.js | 24 | ||||
-rw-r--r-- | ui-react/src/components/dialogs/ConfigurationPolicy/ConfigurationPolicyModal.js | 2 | ||||
-rw-r--r-- | ui-react/src/components/dialogs/DeployLoop.js | 128 | ||||
-rw-r--r-- | ui-react/src/components/dialogs/LoopProperties.js | 7 | ||||
-rw-r--r-- | ui-react/src/components/dialogs/OperationalPolicy/OperationalPolicyModal.js | 533 | ||||
-rw-r--r-- | ui-react/src/components/dialogs/PerformActions.js | 85 | ||||
-rw-r--r-- | ui-react/src/components/dialogs/RefreshStatus.js | 66 | ||||
-rw-r--r-- | ui-react/src/components/loop_viewer/svg/LoopSvg.js | 17 | ||||
-rw-r--r-- | ui-react/src/components/menu/MenuBar.js | 71 | ||||
-rw-r--r-- | ui-react/src/index.js | 2 | ||||
-rw-r--r-- | ui-react/src/theme/globalStyle.js | 13 |
14 files changed, 507 insertions, 551 deletions
diff --git a/ui-react/src/LoopUI.js b/ui-react/src/LoopUI.js index 643b32d14..b64cfbaa3 100644 --- a/ui-react/src/LoopUI.js +++ b/ui-react/src/LoopUI.js @@ -34,13 +34,16 @@ import LoopStatus from './components/loop_viewer/status/LoopStatus'; import UserService from './api/UserService'; import LoopCache from './api/LoopCache'; -import { Route, Redirect } from 'react-router-dom' +import { Route } from 'react-router-dom' import OpenLoopModal from './components/dialogs/OpenLoop/OpenLoopModal'; import OperationalPolicyModal from './components/dialogs/OperationalPolicy/OperationalPolicyModal'; import ConfigurationPolicyModal from './components/dialogs/ConfigurationPolicy/ConfigurationPolicyModal'; import LoopProperties from './components/dialogs/LoopProperties'; import UserInfo from './components/dialogs/UserInfo'; import LoopService from './api/LoopService'; +import PerformAction from './components/dialogs/PerformActions'; +import RefreshStatus from './components/dialogs/RefreshStatus'; +import DeployLoop from './components/dialogs/DeployLoop'; const ProjectNameStyled = styled.a` vertical-align: middle; @@ -80,7 +83,7 @@ export default class LoopUI extends React.Component { state = { userName: null, loopName: LoopUI.defaultLoopName, - loopCache: new LoopCache({}), + loopCache: new LoopCache({}) }; constructor() { @@ -88,6 +91,7 @@ export default class LoopUI extends React.Component { this.getUser = this.getUser.bind(this); this.updateLoopCache = this.updateLoopCache.bind(this); this.loadLoop = this.loadLoop.bind(this); + this.closeLoop = this.closeLoop.bind(this); } componentWillMount() { @@ -102,7 +106,7 @@ export default class LoopUI extends React.Component { renderMenuNavBar() { return ( - <MenuBar loopCache={this.state.loopCache}/> + <MenuBar loopName={this.state.loopName}/> ); } @@ -155,6 +159,7 @@ export default class LoopUI extends React.Component { return this.state.loopCache; } + renderLoopViewer() { return ( <LoopViewDivStyled> @@ -165,11 +170,10 @@ export default class LoopUI extends React.Component { } updateLoopCache(loopJson) { - this.setState({ loopCache: new LoopCache(loopJson) }); - this.setState({ loopName: this.state.loopCache.getLoopName() }); + this.setState({ loopCache: new LoopCache(loopJson), loopName: this.state.loopCache.getLoopName() }); console.info(this.state.loopName+" loop loaded successfully"); } - + loadLoop(loopName) { LoopService.getLoop(loopName).then(loop => { console.debug("Updating loopCache"); @@ -177,7 +181,12 @@ export default class LoopUI extends React.Component { }); } - render() { + closeLoop() { + this.setState({ loopCache: new LoopCache({}), loopName: LoopUI.defaultLoopName }); + this.props.history.push('/'); + } + + render() { return ( <div id="main_div"> <Route path="/operationalPolicyModal" @@ -186,7 +195,14 @@ export default class LoopUI extends React.Component { <Route path="/openLoop" render={(routeProps) => (<OpenLoopModal {...routeProps} loadLoopFunction={this.loadLoop} />)} /> <Route path="/loopProperties" render={(routeProps) => (<LoopProperties {...routeProps} loopCache={this.getLoopCache()} loadLoopFunction={this.loadLoop}/>)} /> <Route path="/userInfo" render={(routeProps) => (<UserInfo {...routeProps} />)} /> - <Route path="/closeLoop" render={(routeProps) => (<Redirect to='/'/>)} /> + <Route path="/closeLoop" render={this.closeLoop} /> + <Route path="/submit" render={(routeProps) => (<PerformAction {...routeProps} loopAction="submit" loopCache={this.getLoopCache()} updateLoopFunction={this.updateLoopCache}/>)} /> + <Route path="/stop" render={(routeProps) => (<PerformAction {...routeProps} loopAction="stop" loopCache={this.getLoopCache()} updateLoopFunction={this.updateLoopCache}/>)} /> + <Route path="/restart" render={(routeProps) => (<PerformAction {...routeProps} loopAction="restart" loopCache={this.getLoopCache()} updateLoopFunction={this.updateLoopCache}/>)} /> + <Route path="/delete" render={(routeProps) => (<PerformAction {...routeProps} loopAction="delete" loopCache={this.getLoopCache()} updateLoopFunction={this.updateLoopCache}/>)} /> + <Route path="/undeploy" render={(routeProps) => (<PerformAction {...routeProps} loopAction="undeploy" loopCache={this.getLoopCache()} updateLoopFunction={this.updateLoopCache}/>)} /> + <Route path="/deploy" render={(routeProps) => (<DeployLoop {...routeProps} loopCache={this.getLoopCache()} updateLoopFunction={this.updateLoopCache}/>)} /> + <Route path="/refreshStatus" render={(routeProps) => (<RefreshStatus {...routeProps} loopCache={this.getLoopCache()} updateLoopFunction={this.updateLoopCache}/>)} /> <GlobalClampStyle /> {this.renderNavBar()} {this.renderLoopViewer()} diff --git a/ui-react/src/api/LoopActionService.js b/ui-react/src/api/LoopActionService.js index 9ce8ff0a9..6e45ce4b9 100644 --- a/ui-react/src/api/LoopActionService.js +++ b/ui-react/src/api/LoopActionService.js @@ -20,35 +20,55 @@ * =================================================================== * */ -const loopActionService = { - submit -}; +export default class LoopActionService{ -function submit(uiAction) { - const cl_name = ""; - console.log("clActionServices perform action: " + uiAction + " closedloopName=" - + cl_name); - const svcAction = uiAction.toLowerCase(); - const svcUrl = "/restservices/clds/v2/loop/" + svcAction + "/" + cl_name; + static performAction(cl_name, uiAction) { + console.log("LoopActionService perform action: " + uiAction + " closedloopName=" + cl_name); + const svcAction = uiAction.toLowerCase(); + return fetch("/restservices/clds/v2/loop/" + svcAction + "/" + cl_name, { + method: 'PUT', + credentials: 'same-origin', + }) + .then(function (response) { + if (response.ok) { + return response.json(); + } else { + return Promise.reject("Perform action failed with code:" + response.status); + } + }) + .then(function (data) { + alert("Action Successful: " + uiAction); + return data; + }) + .catch(function(error) { + console.log("Action Failure: " + uiAction); + return Promise.reject(error); + }); + } - let options = { - method: 'GET' - }; - return sendRequest(svcUrl, svcAction, options); -} - -function sendRequest(svcUrl, svcAction) { - fetch(svcUrl, options) - .then( - response => { - alertService.alertMessage("Action Successful: " + svcAction, 1) - }).error(error => { - alertService.alertMessage("Action Failure: " + svcAction, 2); - return Promise.reject(error); - }); - return response.json(); -}; + static refreshStatus(cl_name) { + console.log("Refresh the status for closedloopName=" + cl_name); -export default loopActionService;
\ No newline at end of file + return fetch("/restservices/clds/v2/loop/getstatus/" + cl_name, { + method: 'GET', + credentials: 'same-origin', + }) + .then(function (response) { + if (response.ok) { + return response.json(); + } else { + return Promise.reject("Refresh status failed with code:" + response.status); + } + }) + .then(function (data) { + console.info ("Refresh status Successful"); + return data; + }) + .catch(function(error) { + console.info ("Refresh status failed:", error); + return Promise.reject(error); + }); + } +} diff --git a/ui-react/src/api/LoopCache.js b/ui-react/src/api/LoopCache.js index 3ee5acc68..d83e3ce9d 100644 --- a/ui-react/src/api/LoopCache.js +++ b/ui-react/src/api/LoopCache.js @@ -51,6 +51,10 @@ export default class LoopCache { getOperationalPolicyConfigurationJson() { return this.loopJsonCache["operationalPolicies"]["0"]["configurationsJson"]; } + + getOperationalPolicyJsonSchema() { + return this.loopJsonCache["operationalPolicySchema"]; + } getOperationalPolicies() { return this.loopJsonCache["operationalPolicies"]; diff --git a/ui-react/src/api/LoopService.js b/ui-react/src/api/LoopService.js index 031ec638f..eece20c96 100644 --- a/ui-react/src/api/LoopService.js +++ b/ui-react/src/api/LoopService.js @@ -104,6 +104,30 @@ export default class LoopService { return ""; }); } + + static setOperationalPolicyProperties(loopName, jsonData) { + return fetch('/restservices/clds/v2/loop/updateOperationalPolicies/' + loopName, { + method: 'POST', + credentials: 'same-origin', + headers: { + "Content-Type": "application/json", + }, + body: JSON.stringify(jsonData), + }) + .then(function (response) { + console.debug("updateOperationalPolicies response received: ", response.status); + if (response.ok) { + return response.text(); + } else { + console.error("updateOperationalPolicies query failed"); + return ""; + } + }) + .catch(function (error) { + console.error("updateOperationalPolicies error received", error); + return ""; + }); + } static updateGlobalProperties(loopName, jsonData) { return fetch('/restservices/clds/v2/loop/updateGlobalProperties/' + loopName, { diff --git a/ui-react/src/components/dialogs/ConfigurationPolicy/ConfigurationPolicyModal.js b/ui-react/src/components/dialogs/ConfigurationPolicy/ConfigurationPolicyModal.js index 4fbb7832c..9863ef721 100644 --- a/ui-react/src/components/dialogs/ConfigurationPolicy/ConfigurationPolicyModal.js +++ b/ui-react/src/components/dialogs/ConfigurationPolicy/ConfigurationPolicyModal.js @@ -103,7 +103,7 @@ export default class ConfigurationPolicyModal extends React.Component { render() { return ( - <ModalStyled size="lg" show={this.state.show} onHide={this.handleClose}> + <ModalStyled size="xl" show={this.state.show} onHide={this.handleClose}> <Modal.Header closeButton> <Modal.Title>Configuration policies</Modal.Title> </Modal.Header> diff --git a/ui-react/src/components/dialogs/DeployLoop.js b/ui-react/src/components/dialogs/DeployLoop.js new file mode 100644 index 000000000..2ec395d23 --- /dev/null +++ b/ui-react/src/components/dialogs/DeployLoop.js @@ -0,0 +1,128 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP CLAMP + * ================================================================================ + * Copyright (C) 2019 AT&T Intellectual Property. All rights + * reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END============================================ + * =================================================================== + * + */ +import React from 'react'; +import LoopActionService from '../../api/LoopActionService'; +import LoopService from '../../api/LoopService'; +import Button from 'react-bootstrap/Button'; +import Modal from 'react-bootstrap/Modal'; +import Form from 'react-bootstrap/Form'; +import styled from 'styled-components'; + +const ModalStyled = styled(Modal)` + background-color: transparent; +` +const FormStyled = styled(Form.Group)` + padding: .25rem 1.5rem; +` +export default class DeployLoop extends React.Component { + state = { + loopCache: this.props.loopCache, + temporaryPropertiesJson: JSON.parse(JSON.stringify(this.props.loopCache.getGlobalProperties())), + show: true + }; + constructor(props, context) { + super(props, context); + + this.handleSave = this.handleSave.bind(this); + this.handleClose = this.handleClose.bind(this); + this.handleChange = this.handleChange.bind(this); + this.refreshStatus = this.refreshStatus.bind(this); + this.renderDeployParam = this.renderDeployParam.bind(this); + } + componentWillReceiveProps(newProps) { + this.setState({ + loopName: newProps.loopCache.getLoopName(), + show: true + }); + } + handleClose(){ + this.props.history.push('/'); + } + handleSave(e) { + const loopName = this.props.loopCache.getLoopName(); + // save the global propserties + LoopService.updateGlobalProperties(loopName, this.state.temporaryPropertiesJson).then(resp => { + this.setState({ show: false }); + + console.log("Perform action: deploy"); + LoopActionService.performAction(loopName, "deploy").then(pars => { + alert("Action deploy successfully performed"); + // refresh status and update loop logs + this.refreshStatus(loopName); + }) + .catch(error => { + alert("Action deploy failed"); + // refresh status and update loop logs + this.refreshStatus(loopName); + }); + }); + } + + refreshStatus(loopName) { + LoopActionService.refreshStatus(loopName).then(data => { + this.props.updateLoopFunction(data); + this.props.history.push('/'); + }) + .catch(error => { + alert("Refresh status failed"); + this.props.history.push('/'); + }); + } + handleChange(event) { + let deploymentParam = this.state.temporaryPropertiesJson["dcaeDeployParameters"]; + deploymentParam[event.target.name] = event.target.value; + + this.setState({temporaryPropertiesJson:{dcaeDeployParameters: deploymentParam}}); + } + renderDeployParam() { + if (typeof (this.state.temporaryPropertiesJson) === "undefined") { + return ""; + } + + const deployJson = this.state.temporaryPropertiesJson["dcaeDeployParameters"]; + var indents = []; + Object.keys(deployJson).map((item,key) => + indents.push(<FormStyled> + <Form.Label>{item}</Form.Label> + <Form.Control type="text" name={item} onChange={this.handleChange} defaultValue={deployJson[item]}></Form.Control> + </FormStyled>)); + + return indents; + } + + + render() { + return ( + <ModalStyled size="lg" show={this.state.show} onHide={this.handleClose} > + <Modal.Header closeButton> + <Modal.Title>Deployment parameters</Modal.Title> + </Modal.Header> + {this.renderDeployParam()} + <Modal.Footer> + <Button variant="secondary" type="null" onClick={this.handleClose}>Cancel</Button> + <Button variant="primary" type="submit" onClick={this.handleSave}>Deploy</Button> + </Modal.Footer> + </ModalStyled> + ); + } +} diff --git a/ui-react/src/components/dialogs/LoopProperties.js b/ui-react/src/components/dialogs/LoopProperties.js index dac77655f..fa82a7e48 100644 --- a/ui-react/src/components/dialogs/LoopProperties.js +++ b/ui-react/src/components/dialogs/LoopProperties.js @@ -30,7 +30,6 @@ import LoopService from '../../api/LoopService'; const ModalStyled = styled(Modal)` background-color: transparent; ` - export default class LoopProperties extends React.Component { state = { @@ -45,7 +44,7 @@ export default class LoopProperties extends React.Component { this.handleClose = this.handleClose.bind(this); this.handleSave = this.handleSave.bind(this); this.handleChange = this.handleChange.bind(this); - + this.renderDcaeParameters = this.renderDcaeParameters.bind(this); this.renderAllParameters = this.renderAllParameters.bind(this); this.getDcaeParameters = this.getDcaeParameters.bind(this); @@ -55,7 +54,7 @@ export default class LoopProperties extends React.Component { this.setState({ loopCache: newProps.loopCache, temporaryPropertiesJson: JSON.parse(JSON.stringify(newProps.loopCache.getGlobalProperties())), - + }); } @@ -90,7 +89,7 @@ export default class LoopProperties extends React.Component { } else { return ""; } - + } renderDcaeParameters() { diff --git a/ui-react/src/components/dialogs/OperationalPolicy/OperationalPolicyModal.js b/ui-react/src/components/dialogs/OperationalPolicy/OperationalPolicyModal.js index 2a812c877..6db38fd23 100644 --- a/ui-react/src/components/dialogs/OperationalPolicy/OperationalPolicyModal.js +++ b/ui-react/src/components/dialogs/OperationalPolicy/OperationalPolicyModal.js @@ -24,8 +24,9 @@ import React from 'react' import Button from 'react-bootstrap/Button'; import Modal from 'react-bootstrap/Modal'; -import './OperationalPolicy.css' import styled from 'styled-components'; +import LoopService from '../../../api/LoopService'; +import JSONEditor from '@json-editor/json-editor'; const ModalStyled = styled(Modal)` background-color: transparent; @@ -36,512 +37,94 @@ export default class OperationalPolicyModal extends React.Component { state = { show: true, loopCache: this.props.loopCache, + jsonEditor: null, }; - allPolicies = []; - policyIds = []; - constructor(props, context) { super(props, context); - this.handleClose = this.handleClose.bind(this); - this.initPolicySelect = this.initPolicySelect.bind(this); - this.initPolicySelect(); + this.handleSave = this.handleSave.bind(this); + this.renderJsonEditor = this.renderJsonEditor.bind(this); + this.setDefaultJsonEditorOptions(); } - handleClose() { - this.setState({ show: false }); - this.props.history.push('/') - } + handleSave() { + var errors = this.state.jsonEditor.validate(); + var editorData = this.state.jsonEditor.getValue(); - initPolicySelect() { - if (this.allPolicies['operational_policy'] === undefined || this.allPolicies['operational_policy'] === null) { - this.allPolicies = this.state.loopCache.getOperationalPolicyConfigurationJson(); + if (errors.length !== 0) { + console.error("Errors detected during config policy data validation ", errors); + alert(errors); } - // Provision all policies ID first - if (this.policyIds.length === 0 && this.allPolicies['operational_policy'] !== undefined) { - - for (let i = 0; i < this.allPolicies['operational_policy']['policies'].length; i++) { - this.policyIds.push(this.allPolicies['operational_policy']['policies'][i]['id']); - } + else { + console.info("NO validation errors found in config policy data"); + this.state.loopCache.updateOperationalPolicyProperties(editorData); + LoopService.setOperationalPolicyProperties(this.state.loopCache.getLoopName(), this.state.loopCache.getOperationalPolicies()).then(resp => { + this.setState({ show: false }); + this.props.history.push('/'); + this.props.loadLoopFunction(this.state.loopCache.getLoopName()); + }); } } - renderPolicyIdSelect() { - return ( - <select type="text" id="trigger_policy" name="trigger_policy" - className="form-control"> - <option value="">-- choose an option --</option> - {this.policyIds.map(policyId => (<option key={policyId}>{policyId}</option>))} - </select> - ); + handleClose() { + this.setState({ show: false }); + this.props.history.push('/'); } - serializeElement(element) { - var o = {}; - element.serializeArray().forEach(function () { - if (o[this.name]) { - if (!o[this.name].push) { - o[this.name] = [o[this.name]]; - } - o[this.name].push(this.value || ''); - } else { - o[this.name] = this.value || ''; - } - }); - return o; + componentDidMount() { + this.renderJsonEditor(); } - // When we change the name of a policy - isDuplicatedId(event) { - // update policy id structure - var formNum = document.getElementById(event.target).closest('.formId').attr('id').substring(6); - var policyId = document.getElementById(event.target).val(); - if (this.policyIds.includes(policyId)) { - console.log("Duplicated ID, cannot proceed"); - return true; - } else { - this.duplicated = false; - this.policyIds.splice(this.policyIds.indexOf(document.getElementById("#formId" + formNum + " #id").val()), 1); - this.policyIds.push(document.getElementById(event.target).val()); - // Update the tab now - document.getElementById("#go_properties_tab" + formNum).text(document.getElementById(event.target).val()); - } + setDefaultJsonEditorOptions() { + JSONEditor.defaults.options.theme = 'bootstrap4'; + // JSONEditor.defaults.options.iconlib = 'bootstrap2'; + + JSONEditor.defaults.options.object_layout = 'grid'; + JSONEditor.defaults.options.disable_properties = true; + JSONEditor.defaults.options.disable_edit_json = false; + JSONEditor.defaults.options.disable_array_reorder = true; + JSONEditor.defaults.options.disable_array_delete_last_row = true; + JSONEditor.defaults.options.disable_array_delete_all_rows = false; + JSONEditor.defaults.options.array_controls_top=true; + JSONEditor.defaults.options.show_errors = 'always'; + JSONEditor.defaults.options.keep_oneof_values=false; + JSONEditor.defaults.options.ajax=true; + JSONEditor.defaults.options.collapsed=true; + //JSONEditor.defaults.options.template = 'default'; } + + renderJsonEditor() { + console.debug("Rendering OperationalPolicyModal"); + var schema_json = this.state.loopCache.getOperationalPolicyJsonSchema(); + + if (schema_json == null) { + console.error("NO Operational policy schema found"); + return; + } + var operationalPoliciesData = this.state.loopCache.getOperationalPolicies(); - configureComponents() { - console.log("Load properties to op policy"); - // Set the header - document.getElementsByClassName('form-control').forEach(function () { - this.val(this.allPolicies['operational_policy']['controlLoop'][this.id]); - }); - // Set the sub-policies - this.allPolicies['operational_policy']['policies'].forEach(function (opPolicyElemIndex, opPolicyElemValue) { - - /* var formNum = add_one_more(); - forEach(document.getElementsByClassName('policyProperties').find('.form-control'), function(opPolicyPropIndex, opPolicyPropValue) { - - $("#formId" + formNum + " .policyProperties").find("#" + opPolicyPropValue.id).val( - allPolicies['operational_policy']['policies'][opPolicyElemIndex][opPolicyPropValue.id]); - }); - - // Initial TargetResourceId options - initTargetResourceIdOptions(allPolicies['operational_policy']['policies'][opPolicyElemIndex]['target']['type'], formNum); - $.each($('.policyTarget').find('.form-control'), function(opPolicyTargetPropIndex, opPolicyTargetPropValue) { - - $("#formId" + formNum + " .policyTarget").find("#" + opPolicyTargetPropValue.id).val( - allPolicies['operational_policy']['policies'][opPolicyElemIndex]['target'][opPolicyTargetPropValue.id]); - }); - - // update the current tab label - $("#go_properties_tab" + formNum).text( - allPolicies['operational_policy']['policies'][opPolicyElemIndex]['id']); - // Check if there is a guard set for it - $.each(allPolicies['guard_policies'], function(guardElemId, guardElemValue) { - - if (guardElemValue.recipe === $($("#formId" + formNum + " #recipe")[0]).val()) { - // Found one, set all guard prop - $.each($('.guardProperties').find('.form-control'), function(guardPropElemIndex, - guardPropElemValue) { - - guardElemValue['id'] = guardElemId; - $("#formId" + formNum + " .guardProperties").find("#" + guardPropElemValue.id).val( - guardElemValue[guardPropElemValue.id]); - }); - iniGuardPolicyType(guardElemId, formNum); - // And finally enable the flag - $("#formId" + formNum + " #enableGuardPolicy").prop("checked", true); - } - });*/ - }); + this.setState({ + jsonEditor: new JSONEditor(document.getElementById("editor"), + { schema: schema_json.schema, startval: operationalPoliciesData }) + }) } render() { return ( - <ModalStyled size="lg" show={this.state.show} onHide={this.handleClose}> + <ModalStyled size="xl" show={this.state.show} onHide={this.handleClose}> <Modal.Header closeButton> <Modal.Title>Operational policies</Modal.Title> </Modal.Header> <Modal.Body> - <div attribute-test="policywindowproperties" id="configure-widgets" - className="disabled-block-container"> - <div attribute-test="policywindowpropertiesb" className="modal-body row"> - <div className="panel panel-default col-sm-10 policyPanel"> - <form id="operationalPolicyHeaderForm" className="form-horizontal"> - <div className="form-group clearfix"> - <label className="col-sm-2">Parent policy</label> - <div className="col-sm-3" style={{ padding: '0px' }}> - {this.renderPolicyIdSelect()} - </div> - - <label htmlFor="timeout" className="col-sm-3" - style={{ paddingLeft: '5px', paddingRight: '10px' }}>Overall - Time Limit</label> - <div className="col-sm-2" style={{ paddingLeft: '0px' }}> - <input type="text" ng-pattern="/^[0-9]*$/" ng-model="number" - className="form-control" id="timeout" name="timeout" /> - </div> - - <label htmlFor="abatement" className="col-sm-2">Abatement</label> - <div className="col-sm-2" style={{ paddingLeft: '0px' }}> - <select className="form-control" id="abatement" name="abatement"> - <option value="false">False</option> - <option value="true">True</option> - </select> - </div> - </div> - <div className="form-group clearfix row"> - <label className="col-sm-4 control-label" htmlFor="clname">ControlLoopName</label> - <div className="col-sm-8"> - <input type="text" className="form-control" name="controlLoopName" - readOnly="readonly" id="clname" value={this.state.loopCache.getLoopName()} /> - </div> - </div> - </form> - <div className="panel-heading" style={{ backgroundColor: 'white' }}> - <ul id="nav_Tabs" className="nav nav-tabs"> - <li> - <a id="add_one_more" href="#desc_tab"> - <span - className="glyphicon glyphicon-plus" aria-hidden="true"> - </span> - </a> - </li> - </ul> - </div> - <div className="panel-body"> - <div className="tab-content"> - <div id="properties_tab" className="tab-pane fade in active"></div> - </div> - </div> - </div> - - <span id="formSpan" style={{ display: 'none' }}> - <form className="policyProperties form-horizontal" - style={{ border: '2px dotted gray' }} - title="Operational Policy Properties"> - <div className="form-group clearfix"> - <label className="col-sm-4 control-label" htmlFor="id">ID</label> - <div className="col-sm-8"> - <input type="text" className="form-control" name="id" id="id" - onKeyUp="updateTabLabel($event)" /> - <span >ID must be unique</span> - </div> - </div> - <div className="form-group clearfix"> - <label className="col-sm-4 control-label" htmlFor="recipe">Recipe</label> - <div className="col-sm-8"> - <select className="form-control" name="recipe" id="recipe" - ng-model="recipe" ng-click="updateGuardRecipe($event)"> - <option value="">-- choose an option --</option> - <option value="Restart">Restart</option> - <option value="Rebuild">Rebuild</option> - <option value="Migrate">Migrate</option> - <option value="Health-Check">Health-Check</option> - <option value="ModifyConfig">ModifyConfig</option> - <option value="VF Module Create">VF Module Create</option> - <option value="VF Module Delete">VF Module Delete</option> - <option value="Reroute">Reroute</option> - </select> - </div> - </div> - <div className="form-group clearfix"> - <label htmlFor="retry" className="col-sm-4 control-label"> Retry</label> - <div className="col-sm-8"> - <input type="text" maxLength="5" className="form-control" id="retry" - ng-pattern="/^[0-9]*$/" ng-model="number" name="retry"> - </input> - </div> - </div> - <div className="form-group clearfix"> - <label htmlFor="timeout" className="col-sm-4 control-label"> - Timeout</label> - <div className="col-sm-8"> - <input type="text" maxLength="5" className="form-control" - id="timeout" ng-pattern="/^[0-9]*$/" ng-model="number" - name="timeout"></input> - </div> - </div> - - <div className="form-group clearfix"> - <label htmlFor="actor" className="col-sm-4 control-label"> Actor</label> - <div className="col-sm-8"> - <select className="form-control" id="actor" name="actor" ng-click="updateGuardActor($event)" ng-model="actor"> - <option value="">-- choose an option --</option> - <option value="APPC">APPC</option> - <option value="SO">SO</option> - <option value="VFC">VFC</option> - <option value="SDNC">SDNC</option>° - <option value="SDNR">SDNR</option>° - </select> - </div> - - <label htmlFor="payload" className="col-sm-4 control-label"> - Payload (YAML)</label> - <div className="col-sm-8"> - <textarea className="form-control" id="payload" name="payload"></textarea> - </div> - </div> - <div className="form-group clearfix"> - <label htmlFor="success" className="col-sm-4 control-label">When - Success</label> - <div className="col-sm-8"> - <select className="form-control" id="success" name="success" - ng-model="null_dump" - ng-options="policy for policy in policy_ids track by policy"> - <option value="">-- choose an option --</option> - </select> - </div> - </div> - <div className="form-group clearfix"> - <label htmlFor="failure" className="col-sm-4 control-label">When - Failure</label> - <div className="col-sm-8"> - <select className="form-control" id="failure" name="failure" - ng-model="null_dump" - ng-options="policy for policy in policy_ids track by policy"> - <option value="">-- choose an option --</option> - </select> - - </div> - </div> - <div className="form-group clearfix"> - <label htmlFor="failure_timeout" className="col-sm-4 control-label">When - Failure Timeout</label> - <div className="col-sm-8"> - <select className="form-control" id="failure_timeout" - name="failure_timeout" ng-model="null_dump" - ng-options="policy for policy in policy_ids track by policy"> - <option value="">-- choose an option --</option> - </select> - </div> - </div> - <div className="form-group clearfix"> - <label htmlFor="failure_retries" className="col-sm-4 control-label">When - Failure Retries</label> - <div className="col-sm-8"> - <select className="form-control" id="failure_retries" - name="failure_retries" ng-model="null_dump" - ng-options="policy for policy in policy_ids track by policy"> - <option value="">-- choose an option --</option> - </select> - </div> - </div> - <div className="form-group clearfix"> - <label htmlFor="failure_exception" className="col-sm-4 control-label">When - Failure Exception</label> - <div className="col-sm-8"> - <select className="form-control" id="failure_exception" - name="failure_exception" ng-model="null_dump" - ng-options="policy for policy in policy_ids track by policy"> - <option value="">-- choose an option --</option> - </select> - </div> - </div> - <div className="form-group clearfix"> - <label htmlFor="failure_guard" className="col-sm-4 control-label">When - Failure Guard</label> - <div className="col-sm-8"> - <select className="form-control" id="failure_guard" - name="failure_guard" ng-model="null_dump" - ng-options="policy for policy in policy_ids track by policy"> - <option value="">-- choose an option --</option> - </select> - </div> - </div> - </form> - <form className="policyTarget form-horizontal" - title="Operational Policy Target" style={{ border: '2px dotted gray' }}> - <div className="form-group clearfix"> - <label htmlFor="type" className="col-sm-4 control-label"> Target - Type</label> - <div className="col-sm-8"> - <select className="form-control" name="type" id="type" - ng-click="initTargetResourceId($event)" ng-model="type"> - <option value="">-- choose an option --</option> - <option value="VFMODULE">VFMODULE</option> - <option value="VM">VM</option> - <option value="VNF">VNF</option> - </select> - </div> - </div> - <div className="form-group clearfix"> - <label htmlFor="resourceID" className="col-sm-4 control-label"> - Target ResourceId</label> - <div className="col-sm-8"> - <select className="form-control" name="resourceID" id="resourceID" - ng-click="changeTargetResourceId($event)" - ng-model="resourceId"> - <option value="">-- choose an option --</option> - </select> - </div> - </div> - <div id="metadata"> - <div className="form-group clearfix"> - <label htmlFor="modelInvariantId" className="col-sm-4 control-label"> - Model Invariant Id</label> - <div className="col-sm-8"> - <input className="form-control" name="modelInvariantId" - id="modelInvariantId" readOnly /> - </div> - </div> - <div className="form-group clearfix"> - <label htmlFor="modelVersionId" className="col-sm-4 control-label"> - Model Version Id</label> - <div className="col-sm-8"> - <input className="form-control" name="modelVersionId" - id="modelVersionId" readOnly /> - </div> - </div> - <div className="form-group clearfix"> - <label htmlFor="modelName" className="col-sm-4 control-label"> - Model Name</label> - <div className="col-sm-8"> - <input className="form-control" name="modelName" id="modelName" - readOnly /> - </div> - </div> - <div className="form-group clearfix"> - <label htmlFor="modelVersion" className="col-sm-4 control-label"> - Model Version</label> - <div className="col-sm-8"> - <input className="form-control" name="modelVersion" - id="modelVersion" readOnly /> - </div> - </div> - <div className="form-group clearfix"> - <label htmlFor="modelCustomizationId" className="col-sm-4 control-label"> - Model Customization Id</label> - <div className="col-sm-8"> - <input className="form-control" name="modelCustomizationId" - id="modelCustomizationId" readOnly /> - </div> - </div> - </div> - </form> - <div className="form-group clearfix"> - <label htmlFor="enableGuardPolicy" className="col-sm-4 control-label"> - Enable Guard Policy</label> - <div className="col-sm-8"> - <input type="checkbox" className="form-control" - name="enableGuardPolicy" id="enableGuardPolicy" /> - </div> - - <div className="col-sm-8"> - <label htmlFor="guardPolicyType" className="col-sm-4 control-label"> - Guard Policy Type</label> <select className="form-control" - name="guardPolicyType" id="guardPolicyType" - ng-click="changeGuardPolicyType()" ng-model="guardType"> - <option value="GUARD_MIN_MAX">MinMax</option> - <option value="GUARD_YAML">FrequencyLimiter</option> - </select> - </div> - </div> - <form className="guardProperties form-horizontal" - title="Guard policy associated" style={{ border: '2px dotted gray' }}> - - <div className="form-group clearfix withnote"> - <label className="col-sm-4 control-label" htmlFor="id">Guard Policy ID</label> - <div className="col-sm-8"> - <input type="text" className="form-control" name="id" id="id" ng-blur="changeGuardId()" ng-model="id" /> - </div> - </div> - <div> - <label className="form-group note">Note: Prefix will be added to Guard Policy ID automatically based on Guard Policy Type</label> - </div> - <div className="form-group clearfix"> - <label className="col-sm-4 control-label" htmlFor="recipe">Recipe</label> - <div className="col-sm-8"> - <input type="text" className="form-control" name="recipe" - readOnly="readonly" id="recipe" /> - </div> - </div> - <div className="form-group clearfix"> - <label className="col-sm-4 control-label" htmlFor="clname">ControlLoopName</label> - <div className="col-sm-8"> - <input type="text" className="form-control" name="clname" - readOnly="readonly" id="clname" ng-model="clname" /> - </div> - </div> - <div className="form-group clearfix"> - <label htmlFor="actor" className="col-sm-4 control-label">Actor</label> - <div className="col-sm-8"> - <input type="text" className="form-control" name="actor" - readOnly="readonly" id="actor" /> - </div> - </div> - <div className="form-group clearfix"> - - <label htmlFor="targets" className="col-sm-4 control-label">Guard - targets</label> - <div className="col-sm-8"> - <input className="form-control" name="targets" id="targets" /> - </div> - </div> - - <div className="form-group clearfix" id="minMaxGuardPolicyDiv"> - <label htmlFor="min" className="col-sm-4 control-label"> Min - Guard</label> - <div className="col-sm-8"> - <input className="form-control" name="min" id="min" /> - </div> - <label htmlFor="max" className="col-sm-4 control-label"> Max - Guard</label> - <div className="col-sm-8"> - <input className="form-control" name="max" id="max" /> - </div> - </div> - <div className="form-group clearfix" - id="frequencyLimiterGuardPolicyDiv" style={{ display: 'none' }}> - <label htmlFor="limit" className="col-sm-4 control-label">Limit</label> - <div className="col-sm-8"> - <input className="form-control" name="limit" id="limit" /> - </div> - <label htmlFor="timeUnits" className="col-sm-4 control-label">Time Units</label> - <div className="col-sm-8"> - <select className="form-control" name="timeUnits" - id="timeUnits"> - <option value=""></option> - <option value="minute">minute</option> - <option value="hour">hour</option> - <option value="day">day</option> - <option value="week">week</option> - <option value="month">month</option> - <option value="year">year</option> - </select> - </div> - <label htmlFor="timeWindow" className="col-sm-4 control-label">Time Window</label> - <div className="col-sm-8"> - <input className="form-control" name="timeWindow" id="timeWindow" /> - </div> - </div> - <div className="form-group clearfix"> - <label htmlFor="guardActiveStart" className="col-sm-4 control-label"> - Guard Active Start</label> - <div className="col-sm-8"> - <input className="form-control" name="guardActiveStart" - id="guardActiveStart" value="00:00:00Z" /> - </div> - <label htmlFor="guardActiveEnd" className="col-sm-4 control-label"> - Guard Active End</label> - <div className="col-sm-8"> - <input className="form-control" name="guardActiveEnd" - id="guardActiveEnd" value="00:00:01Z" /> - </div> - </div> - - </form> - - </span> - </div> - </div> + <div id="editor" /> </Modal.Body> <Modal.Footer> <Button variant="secondary" onClick={this.handleClose}> Close </Button> - <Button variant="primary" onClick={this.handleClose}> + <Button variant="primary" onClick={this.handleSave}> Save Changes </Button> </Modal.Footer> diff --git a/ui-react/src/components/dialogs/PerformActions.js b/ui-react/src/components/dialogs/PerformActions.js new file mode 100644 index 000000000..9c34e141b --- /dev/null +++ b/ui-react/src/components/dialogs/PerformActions.js @@ -0,0 +1,85 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP CLAMP + * ================================================================================ + * Copyright (C) 2019 AT&T Intellectual Property. All rights + * reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END============================================ + * =================================================================== + * + */ +import React from 'react'; +import LoopActionService from '../../api/LoopActionService'; +import Spinner from 'react-bootstrap/Spinner' +import styled from 'styled-components'; + +const StyledSpinnerDiv = styled.div` + justify-content: center !important; + display: flex !important; +`; + +export default class PerformActions extends React.Component { + state = { + loopName: this.props.loopCache.getLoopName(), + loopAction: this.props.loopAction + }; + constructor(props, context) { + super(props, context); + + this.refreshStatus = this.refreshStatus.bind(this); + } + componentWillReceiveProps(newProps) { + this.setState({ + loopName: newProps.loopCache.getLoopName(), + loopAction: newProps.loopAction + }); + } + + componentDidMount() { + const action = this.state.loopAction; + const loopName = this.state.loopName; + console.log("Perform action:" + action); + LoopActionService.performAction(loopName, action).then(pars => { + alert("Action " + action + " successfully performed"); + // refresh status and update loop logs + this.refreshStatus(loopName); + }) + .catch(error => { + alert("Action " + action + " failed"); + // refresh status and update loop logs + this.refreshStatus(loopName); + }); + + } + + refreshStatus(loopName) { + LoopActionService.refreshStatus(loopName).then(data => { + this.props.updateLoopFunction(data); + this.props.history.push('/'); + }) + .catch(error => { + this.props.history.push('/'); + }); + } + + render() { + return ( + <StyledSpinnerDiv> + <Spinner animation="border" role="status"> + </Spinner> + </StyledSpinnerDiv> + ); + } +} diff --git a/ui-react/src/components/dialogs/RefreshStatus.js b/ui-react/src/components/dialogs/RefreshStatus.js new file mode 100644 index 000000000..cf08655ee --- /dev/null +++ b/ui-react/src/components/dialogs/RefreshStatus.js @@ -0,0 +1,66 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP CLAMP + * ================================================================================ + * Copyright (C) 2019 AT&T Intellectual Property. All rights + * reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END============================================ + * =================================================================== + * + */ +import React from 'react'; +import LoopActionService from '../../api/LoopActionService'; +import Spinner from 'react-bootstrap/Spinner' +import styled from 'styled-components'; + +const StyledSpinnerDiv = styled.div` + justify-content: center !important; + display: flex !important; +`; + +export default class RefreshStatus extends React.Component { + state = { + loopName: this.props.loopCache.getLoopName() + }; + + componentWillReceiveProps(newProps) { + this.setState({ + loopName: newProps.loopCache.getLoopName() + }); + } + + componentDidMount() { + console.log("Refresh status for: " + this.state.loopName); + // refresh status and update loop logs + LoopActionService.refreshStatus(this.state.loopName).then(data => { + alert("Status successfully refreshed") + this.props.updateLoopFunction(data); + this.props.history.push('/'); + }) + .catch(error => { + alert("Status refreshing failed"); + this.props.history.push('/'); + }); + } + + render() { + return ( + <StyledSpinnerDiv> + <Spinner animation="border" role="status"> + </Spinner> + </StyledSpinnerDiv> + ); + } +} diff --git a/ui-react/src/components/loop_viewer/svg/LoopSvg.js b/ui-react/src/components/loop_viewer/svg/LoopSvg.js index 3ac2f31fd..1b1e24280 100644 --- a/ui-react/src/components/loop_viewer/svg/LoopSvg.js +++ b/ui-react/src/components/loop_viewer/svg/LoopSvg.js @@ -61,13 +61,14 @@ class LoopViewSvg extends React.Component { return this.state.svgContent !== nextState.svgContent; } - componentWillReceiveProps(newProps) { - this.setState({ - loopCache: newProps.loopCache, - componentModalMapping: LoopComponentConverter.buildMapOfComponents(newProps.loopCache), - - }); - this.getSvg(newProps.loopCache.getLoopName()); + componentWillReceiveProps(newProps) { + if (this.state.loopCache !== newProps.loopCache) { + this.setState({ + loopCache: newProps.loopCache, + componentModalMapping: LoopComponentConverter.buildMapOfComponents(newProps.loopCache), + }); + this.getSvg(newProps.loopCache.getLoopName()); + } } getSvg(loopName) { @@ -79,6 +80,8 @@ class LoopViewSvg extends React.Component { this.setState({ svgContent: LoopViewSvg.emptySvg }) } }); + } else { + this.setState({ svgContent: LoopViewSvg.emptySvg }) } } diff --git a/ui-react/src/components/menu/MenuBar.js b/ui-react/src/components/menu/MenuBar.js index 811a48ba0..121787ffd 100644 --- a/ui-react/src/components/menu/MenuBar.js +++ b/ui-react/src/components/menu/MenuBar.js @@ -21,21 +21,14 @@ * */ import React from 'react'; +import Nav from 'react-bootstrap/Nav'; import Navbar from 'react-bootstrap/Navbar'; import NavDropdown from 'react-bootstrap/NavDropdown'; +import LoopUI from '../../LoopUI'; import 'bootstrap-css-only/css/bootstrap.min.css'; import styled from 'styled-components'; import { Link } from 'react-router-dom' -const StyledNavDropdownItem = styled(NavDropdown.Item)` - color: ${props => props.theme.menuFontColor}; - background-color: ${props => props.theme.menuBackgroundColor}; - :hover { - background-color: ${props => props.theme.menuHighlightedBackgroundColor}; - color: ${props => props.theme.menuHighlightedFontColor}; - } -`; - const StyledLink = styled(Link)` color: ${props => props.theme.menuColor}; background-color: ${props => props.theme.menuBackgroundColor}; @@ -53,31 +46,53 @@ const StyledLink = styled(Link)` color: ${props => props.theme.loopViewerHeaderFontColor}; } `; - +const StyledNavLink = styled(Nav.Link)` + color: ${props => props.theme.menuColor}; + background-color: ${props => props.theme.menuBackgroundColor}; + font-weight: normal; + padding: .25rem 1.5rem; + :hover { + background-color: ${props => props.theme.loopViewerHeaderBackgroundColor}; + color: ${props => props.theme.loopViewerHeaderFontColor} + } +`; export default class MenuBar extends React.Component { + state = { + loopName: this.props.loopName, + disabled: true + }; + + componentWillReceiveProps(newProps) { + if (newProps.loopName !== LoopUI.defaultLoopName) { + this.setState({ disabled: false }); + } else { + this.setState({ disabled: true }); + } + } + render () { return ( - <Navbar.Collapse id="basic-navbar-nav" className="justify-content-center"> - <NavDropdown title="Closed Loop" id="basic-nav-dropdown"> - <StyledNavDropdownItem as={StyledLink} to="/openLoop">Open CL</StyledNavDropdownItem> - <StyledNavDropdownItem as={StyledLink} to="/loopProperties">Properties CL</StyledNavDropdownItem> - <StyledNavDropdownItem as={StyledLink} to="/closeLoop">Close Model</StyledNavDropdownItem> + <Navbar.Collapse> + <NavDropdown title="Closed Loop"> + <NavDropdown.Item as={StyledLink} to="/openLoop">Open CL</NavDropdown.Item> + <NavDropdown.Item as={StyledLink} to="/loopProperties" disabled={this.state.disabled}>Properties CL</NavDropdown.Item> + <NavDropdown.Item as={StyledLink} to="/closeLoop" disabled={this.state.disabled}>Close Model</NavDropdown.Item> </NavDropdown> - <NavDropdown title="Manage" id="basic-nav-dropdown"> - <StyledNavDropdownItem as={StyledLink} to="/operationalPolicyModal">Submit</StyledNavDropdownItem> - <StyledNavDropdownItem as={StyledLink} to="#action/3.2">Stop</StyledNavDropdownItem> - <StyledNavDropdownItem as={StyledLink} to="#action/3.3">Restart</StyledNavDropdownItem> - <StyledNavDropdownItem as={StyledLink} to="#action/3.3">Delete</StyledNavDropdownItem> - <StyledNavDropdownItem as={StyledLink} to="#action/3.3">Deploy</StyledNavDropdownItem> - <StyledNavDropdownItem as={StyledLink} to="#action/3.3">UnDeploy</StyledNavDropdownItem> + <NavDropdown title="Manage"> + <NavDropdown.Item as={StyledLink} to="/submit" disabled={this.state.disabled}>Submit</NavDropdown.Item> + <NavDropdown.Item as={StyledLink} to="/stop" disabled={this.state.disabled}>Stop</NavDropdown.Item> + <NavDropdown.Item as={StyledLink} to="/restart" disabled={this.state.disabled}>Restart</NavDropdown.Item> + <NavDropdown.Item as={StyledLink} to="/delete" disabled={this.state.disabled}>Delete</NavDropdown.Item> + <NavDropdown.Item as={StyledLink} to="/deploy" disabled={this.state.disabled}>Deploy</NavDropdown.Item> + <NavDropdown.Item as={StyledLink} to="/undeploy" disabled={this.state.disabled}>UnDeploy</NavDropdown.Item> </NavDropdown> - <NavDropdown title="View" id="basic-nav-dropdown"> - <StyledNavDropdownItem as={StyledLink} to="#action/3.1">Refresh Status</StyledNavDropdownItem> + <NavDropdown title="View"> + <NavDropdown.Item as={StyledLink} to="/refreshStatus" disabled={this.state.disabled}>Refresh Status</NavDropdown.Item> </NavDropdown> - <NavDropdown title="Help" id="basic-nav-dropdown"> - <StyledNavDropdownItem href="https://wiki.onap.org/" target="_blank">Wiki</StyledNavDropdownItem> - <StyledNavDropdownItem href="mailto:onap-discuss@lists.onap.org?subject=CLAMP&body=Please send us suggestions or feature enhancements or defect. If possible, please send us the steps to replicate any defect.">Contact Us</StyledNavDropdownItem> - <StyledNavDropdownItem as={StyledLink} to="/userInfo">User Info</StyledNavDropdownItem> + <NavDropdown title="Help"> + <StyledNavLink href="https://wiki.onap.org/" target="_blank">Wiki</StyledNavLink> + <StyledNavLink href="mailto:onap-discuss@lists.onap.org?subject=CLAMP&body=Please send us suggestions or feature enhancements or defect. If possible, please send us the steps to replicate any defect.">Contact Us</StyledNavLink> + <NavDropdown.Item as={StyledLink} to="/userInfo">User Info</NavDropdown.Item> </NavDropdown> </Navbar.Collapse> ); diff --git a/ui-react/src/index.js b/ui-react/src/index.js index 39df36427..cbbdc65ef 100644 --- a/ui-react/src/index.js +++ b/ui-react/src/index.js @@ -32,7 +32,7 @@ const routing = ( </BrowserRouter> ); -ReactDOM.render( +export var mainClamp = ReactDOM.render( routing, document.getElementById('root') ) diff --git a/ui-react/src/theme/globalStyle.js b/ui-react/src/theme/globalStyle.js index cbd86b199..0f6fb91c6 100644 --- a/ui-react/src/theme/globalStyle.js +++ b/ui-react/src/theme/globalStyle.js @@ -65,6 +65,19 @@ export const GlobalClampStyle = createGlobalStyle` width: 100%; height: 100%; } + + button { + background-color: ${props => (props.theme.loopViewerHeaderBackgroundColor)}; + border: 1px; + color: white; + padding: 15px 32px; + text-align: center; + text-decoration: none; + display: inline-block; + font-size: ${props => props.theme.fontSize}; + font-family: ${props => props.theme.fontFamily}; + + } ` export const DefaultClampTheme = { |