X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=skyquake%2Fplugins%2Fabout%2Fsrc%2Fabout.jsx;fp=skyquake%2Fplugins%2Fabout%2Fsrc%2Fabout.jsx;h=64587641bcb099de376350c871f034bf71913983;hb=e29efc315df33d546237e270470916e26df391d6;hp=0000000000000000000000000000000000000000;hpb=9c5e457509ba5a1822c316635c6308874e61b4b9;p=osm%2FUI.git diff --git a/skyquake/plugins/about/src/about.jsx b/skyquake/plugins/about/src/about.jsx new file mode 100644 index 000000000..64587641b --- /dev/null +++ b/skyquake/plugins/about/src/about.jsx @@ -0,0 +1,171 @@ +/* + * + * Copyright 2016 RIFT.IO Inc + * + * 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. + * + */ +import React from 'react'; +import './about.scss'; +import UpTime from 'widgets/uptime/uptime.jsx'; +import AppHeader from 'widgets/header/header.jsx'; +var aboutActions = require('./aboutActions.js'); +var aboutStore = require('./aboutStore.js'); +//var MissionControlStore = require('./missionControlStore.js'); +class About extends React.Component { + constructor(props) { + super(props) + var self = this; + this.state = aboutStore.getState(); + aboutStore.listen(this.listenerUpdate); + aboutStore.get(); + aboutStore.createTime(); + } + componentWillUnmount() { + aboutStore.listen(this.listenerUpdate); + } + listenerUpdate = (data) => { + if (data.aboutList) { + this.setState({ + list:data.aboutList + }) + } + if (data.createTime) { + // Required cause backend won't provide a create-time + let createTime = (data.createTime) ? Math.floor((new Date() / 1000)) - parseInt(data.createTime) : null; + this.setState({ + createTime: createTime + }) + } + if (data.descriptorCount) { + this.setState({ + descriptorCount: data.descriptorCount + }); + } + } + render() { + let self = this; + let refPage = window.sessionStorage.getItem('refPage') || '{}'; + refPage = JSON.parse(refPage); + + let mgmtDomainName = window.location.hash.split('/')[2]; + // If in the mission control, create an uptime table; + var uptime = this.state.createTime && this.state.createTime; + + var uptimeComponent = ( +
+

Uptime Info

+ + + + + + + +
+ Uptime + + +
+
+ ); + + var vcs_info = []; + + for (let i = 0; this.state && this.state.list && i < this.state.list.vcs.components.component_info.length; i++) { + var node = this.state.list.vcs.components.component_info[i]; + vcs_info.push( + + + {node.component_name} + + + {node.component_type} + + + {node.state} + + + + ) + } + + if (this.state != null) { + var html = ( +
+ {uptimeComponent} +
+

Version Info

+ + + + + + + + + + + + + + + +
+ Build SHA + + Version + + Build Date +
+ {this.state.list ? this.state.list.version.build_sha : null} + + {this.state.list ? this.state.list.version.version : null} + + {this.state.list ? this.state.list.version.build_date : null} +
+
+
+

Component Info

+ + + + + + + + + + {vcs_info} + +
+ Component Name + + Component Type + + State +
+
+
+ ); + } else { + html = '' + } + return ( +
+ {html} +
+ ) + } +} +export default About;