diff options
author | sebdet <sebastien.determe@intl.att.com> | 2019-07-12 12:25:56 +0200 |
---|---|---|
committer | sebdet <sebastien.determe@intl.att.com> | 2019-07-12 12:25:56 +0200 |
commit | e44fdb1905fae612b12b56886af8f387e516e485 (patch) | |
tree | a59eb65fe06c08f92dfdda3961784580228b7c29 /ui-react | |
parent | 4946e5b7d80fa1a7baa1c6042100fa1dee24ee31 (diff) |
Rework the structure
Rework of the project structure and static loop cache added for the
entire site
Issue-ID: CLAMP-418
Change-Id: Ia2cf62431cd9139c91bf74bb639b502a368ce761
Signed-off-by: sebdet <sebastien.determe@intl.att.com>
Diffstat (limited to 'ui-react')
-rw-r--r-- | ui-react/src/LoopUI.js (renamed from ui-react/src/components/app/LoopUI.js) | 14 | ||||
-rw-r--r-- | ui-react/src/NotFound.js (renamed from ui-react/src/components/app/NotFound.js) | 0 | ||||
-rw-r--r-- | ui-react/src/OnapClamp.js | 2 | ||||
-rw-r--r-- | ui-react/src/api/LoopActionService.js (renamed from ui-react/src/components/backend_communication/LoopActionService.js) | 0 | ||||
-rw-r--r-- | ui-react/src/api/LoopCache.js (renamed from ui-react/src/components/backend_communication/LoopCache.js) | 19 | ||||
-rw-r--r-- | ui-react/src/api/UserService.js (renamed from ui-react/src/components/backend_communication/UserService.js) | 0 | ||||
-rw-r--r-- | ui-react/src/api/example.json (renamed from ui-react/src/components/backend_communication/example.json) | 0 | ||||
-rw-r--r-- | ui-react/src/components/dialogs/OperationalPolicy/OperationalPolicyModal.js | 8 | ||||
-rw-r--r-- | ui-react/src/logo.png (renamed from ui-react/src/components/app/logo.png) | bin | 21360 -> 21360 bytes |
9 files changed, 27 insertions, 16 deletions
diff --git a/ui-react/src/components/app/LoopUI.js b/ui-react/src/LoopUI.js index d058543a..997f94b1 100644 --- a/ui-react/src/components/app/LoopUI.js +++ b/ui-react/src/LoopUI.js @@ -23,15 +23,15 @@ 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; @@ -80,7 +80,7 @@ export default class LoopUI extends React.Component { super(); this.getUser = this.getUser.bind(this); } - + componentDidMount() { this.getUser(); } diff --git a/ui-react/src/components/app/NotFound.js b/ui-react/src/NotFound.js index d4b53fd7..d4b53fd7 100644 --- a/ui-react/src/components/app/NotFound.js +++ b/ui-react/src/NotFound.js diff --git a/ui-react/src/OnapClamp.js b/ui-react/src/OnapClamp.js index bdcea629..a8cc2154 100644 --- a/ui-react/src/OnapClamp.js +++ b/ui-react/src/OnapClamp.js @@ -22,7 +22,7 @@ */ 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'; diff --git a/ui-react/src/components/backend_communication/LoopActionService.js b/ui-react/src/api/LoopActionService.js index 9ce8ff0a..9ce8ff0a 100644 --- a/ui-react/src/components/backend_communication/LoopActionService.js +++ b/ui-react/src/api/LoopActionService.js diff --git a/ui-react/src/components/backend_communication/LoopCache.js b/ui-react/src/api/LoopCache.js index 2ef83962..80f02f02 100644 --- a/ui-react/src/components/backend_communication/LoopCache.js +++ b/ui-react/src/api/LoopCache.js @@ -20,10 +20,13 @@ * =================================================================== * */ + 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) { @@ -112,5 +115,15 @@ class LoopCache { 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; diff --git a/ui-react/src/components/backend_communication/UserService.js b/ui-react/src/api/UserService.js index 81453955..81453955 100644 --- a/ui-react/src/components/backend_communication/UserService.js +++ b/ui-react/src/api/UserService.js diff --git a/ui-react/src/components/backend_communication/example.json b/ui-react/src/api/example.json index f3cc9e18..f3cc9e18 100644 --- a/ui-react/src/components/backend_communication/example.json +++ b/ui-react/src/api/example.json diff --git a/ui-react/src/components/dialogs/OperationalPolicy/OperationalPolicyModal.js b/ui-react/src/components/dialogs/OperationalPolicy/OperationalPolicyModal.js index e52d930a..7d339313 100644 --- a/ui-react/src/components/dialogs/OperationalPolicy/OperationalPolicyModal.js +++ b/ui-react/src/components/dialogs/OperationalPolicy/OperationalPolicyModal.js @@ -24,7 +24,7 @@ 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'; @@ -37,8 +37,6 @@ export default class OperationalPolicyModal extends React.Component { constructor(props, context) { super(props, context); - this.loopCache = new LoopCache(); - this.handleClose = this.handleClose.bind(this); this.initPolicySelect = this.initPolicySelect.bind(this); @@ -59,7 +57,7 @@ export default class OperationalPolicyModal extends React.Component { 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) { @@ -197,7 +195,7 @@ export default class OperationalPolicyModal extends React.Component { <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> diff --git a/ui-react/src/components/app/logo.png b/ui-react/src/logo.png Binary files differindex c6f6857a..c6f6857a 100644 --- a/ui-react/src/components/app/logo.png +++ b/ui-react/src/logo.png |