X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=skyquake%2Fplugins%2Flaunchpad%2Fsrc%2FrecordViewer%2FrecordView.jsx;fp=skyquake%2Fplugins%2Flaunchpad%2Fsrc%2FrecordViewer%2FrecordView.jsx;h=224bad52d6d718b3790599f9054658673c1c3066;hb=e29efc315df33d546237e270470916e26df391d6;hp=0000000000000000000000000000000000000000;hpb=9c5e457509ba5a1822c316635c6308874e61b4b9;p=osm%2FUI.git diff --git a/skyquake/plugins/launchpad/src/recordViewer/recordView.jsx b/skyquake/plugins/launchpad/src/recordViewer/recordView.jsx new file mode 100644 index 000000000..224bad52d --- /dev/null +++ b/skyquake/plugins/launchpad/src/recordViewer/recordView.jsx @@ -0,0 +1,115 @@ + +/* + * + * 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 RecordNavigator from './recordNavigator.jsx'; +import RecordCard from './recordCard.jsx'; +import RecordDetails from './recordDetails.jsx'; +import RecordViewStore from './recordViewStore.js'; +import RecordViewActions from './recordViewActions.js'; +import LaunchpadBreadcrumbs from '../launchpadBreadcrumbs.jsx'; +import Utils from 'utils/utils.js'; +import AppHeader from 'widgets/header/header.jsx'; +import './recordViewer.scss'; +export default class RecordView extends React.Component { + constructor(props) { + super(props); + this.state = RecordViewStore.getState(); + this.state.showRecordDetails = false; + this.state.jobData = []; + RecordViewStore.listen(this.storeListener); + } + storeListener = (state) => { + this.setState(state); + } + componentWillUnmount = () => { + RecordViewStore.handleCloseSocket(); + RecordViewStore.handleCloseJobSocket(); + RecordViewStore.unlisten(this.storeListener); + } + componentDidMount() { + let nsrRegEx = new RegExp("([0-9a-zA-Z-]+)\/detail"); + let nsr_id; + try { + console.log('NSR ID in url is', this.props.location.query); + console.log(this.props) + nsr_id = this.props.location.query.id; + } catch (e) { + + } + RecordViewStore.getNSR(nsr_id); + RecordViewStore.getRawNSR(nsr_id); + RecordViewStore.getNSRSocket(nsr_id); + RecordViewStore.getConfigJobSocket(nsr_id); + } + loadRecord = (record) => { + RecordViewActions.loadRecord(record); + RecordViewStore['getRaw' + record.type.toUpperCase()](record.id) + RecordViewStore['get' + record.type.toUpperCase() + 'Socket'](record.id) + } + recordDetailsToggle = () => { + this.setState({ + showRecordDetails: !this.state.showRecordDetails + }) + } + render() { + let {location} = this.props; + let html; + let mgmtDomainName = window.location.hash.split('/')[2]; + let recordDetails = this.state.showRecordDetails || null; + let nsrId = 0; + let navItems = [{ + name: 'Viewport' + },{ + name: 'COMPUTE TOPOLOGY', + onClick: this.context.router.push.bind(this, {pathname:'/compute-topology', query: {id: location.query.id, sdnpresent: location.query.sdnpresent}}) + }]; + + if (location.query.sdnpresent == 'true') { + navItems.push({ + name: 'NETWORK TOPOLOGY', + onClick: this.context.router.push.bind(this, {pathname:'/network-topology', query: {id: location.query.id, sdnpresent: location.query.sdnpresent}}) + }); + } + + let nav = + if (this.state.showRecordDetails) { + recordDetails = + } + html = ( +
+ {nav} +
+ + +
+ + + {recordDetails} +
+ + +
+
+ ); + return html; + } +} +RecordView.contextTypes = { + router: React.PropTypes.object +};