import React from 'react';
import styled from 'styled-components';
-import MenuBar from '../menu/MenuBar';
+import MenuBar from './components/menu/MenuBar';
import Navbar from 'react-bootstrap/Navbar';
import logo from './logo.png';
-import { GlobalClampStyle } from '../../theme/globalStyle.js';
+import { GlobalClampStyle } from './theme/globalStyle.js';
-import ClosedLoopSvg from '../loop_viewer/svg/ClosedLoopSvg';
-import ClosedLoopLogs from '../loop_viewer/logs/ClosedLoopLogs';
-import ClosedLoopStatus from '../loop_viewer/status/ClosedLoopStatus';
-import UserService from '../backend_communication/UserService';
+import ClosedLoopSvg from './components/loop_viewer/svg/ClosedLoopSvg';
+import ClosedLoopLogs from './components/loop_viewer/logs/ClosedLoopLogs';
+import ClosedLoopStatus from './components/loop_viewer/status/ClosedLoopStatus';
+import UserService from './api/UserService';
const ProjectNameStyled = styled.a`
vertical-align: middle;
super();
this.getUser = this.getUser.bind(this);
}
-
+
componentDidMount() {
this.getUser();
}
*/
import React from 'react';
-import LoopUI from './components/app/LoopUI'
+import LoopUI from './LoopUI'
import { ThemeProvider } from 'styled-components';
import { DefaultClampTheme } from './theme/globalStyle.js';
* ===================================================================
*
*/
+
class LoopCache {
- constructor() {
- //this.loopJsonCache=loopJson;
- this.loopJsonCache = require('./example.json'); //(with path)
+ loopJsonCache;
+
+ constructor(loopJson) {
+ this.loopJsonCache=loopJson;
+ //LoopCache.SET_LOOP_JSON_CACHE(require('./example.json');
}
updateMsProperties(type, newMsProperties) {
return this.loopJsonCache.components;
}
+ get getLoopJsonCache() {
+ return this.loopJsonCache;
+ }
+
+ set setLoopJsonCache(newJson) {
+ this.loopJsonCache = newJson;
+ }
}
+
+export const LOOP_CACHE = new LoopCache(require('./example.json'));
+
export default LoopCache;
import React from 'react'
import Button from 'react-bootstrap/Button';
import Modal from 'react-bootstrap/Modal';
-import LoopCache from '../../backend_communication/LoopCache'
+import { LOOP_CACHE } from '../../../api/LoopCache'
import './OperationalPolicy.css'
import styled from 'styled-components';
constructor(props, context) {
super(props, context);
- this.loopCache = new LoopCache();
-
this.handleClose = this.handleClose.bind(this);
this.initPolicySelect = this.initPolicySelect.bind(this);
initPolicySelect() {
if (this.allPolicies['operational_policy'] === undefined || this.allPolicies['operational_policy'] === null) {
- this.allPolicies = this.loopCache.getOperationalPolicyProperty();
+ this.allPolicies = LOOP_CACHE.getOperationalPolicyProperty();
}
// Provision all policies ID first
if (this.policyIds.length == 0 && this.allPolicies['operational_policy'] != undefined) {
<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.loopCache.getLoopName()} />
+ readOnly="readonly" id="clname" value={LOOP_CACHE.getLoopName()} />
</div>
</div>
</form>