From 58057bcfa0ac78fe0d2b3a94b30270ec0eaddde3 Mon Sep 17 00:00:00 2001 From: Jay Date: Thu, 25 May 2017 15:53:26 +0800 Subject: [PATCH] update ipmi page --- .../AdminPage/Server/Modals/IPMIInfoModal.js | 124 +++++++++++++++++- src/components/AdminPage/Server/index.js | 5 +- 2 files changed, 123 insertions(+), 6 deletions(-) diff --git a/src/components/AdminPage/Server/Modals/IPMIInfoModal.js b/src/components/AdminPage/Server/Modals/IPMIInfoModal.js index 9228f4b..e247d72 100644 --- a/src/components/AdminPage/Server/Modals/IPMIInfoModal.js +++ b/src/components/AdminPage/Server/Modals/IPMIInfoModal.js @@ -1,12 +1,13 @@ import React from 'react'; -import {Modal, Segment} from 'semantic-ui-react'; +import {Modal, Segment, Menu, Label, Container, Header, List, Table} from 'semantic-ui-react'; +import {convertTime} from '../../../../tools'; const stateDefault = () => ({ open: false, tabIdx: 1 }) class IPMIInfoModal extends React.Component { - + state = {...stateDefault()} componentWillReceiveProps(nextProps){ if(nextProps.open != this.state.open){ if(nextProps.open == false){ @@ -19,16 +20,129 @@ class IPMIInfoModal extends React.Component { } } + changeIdx = (idx) => { + this.setState({ + tabIdx: idx + }) + } + + getInfoView = () => { + switch(this.state.tabIdx){ + case 1: + return + case 2: + return + case 3: + return + default: + return null; + } + } + render() { - + let {closeModal} = this.props; return ( - null}> + closeModal('ipmiinfo')}> - + + this.changeIdx(1)} /> + this.changeIdx(2)} /> + this.changeIdx(3)} /> + + + {this.getInfoView()} + ) } } + +const BMCContent = ({group, data}) => { + + return ( + + { + group.map((t,idx) => ( + +
+ {t.name} + {t.value} +
+ + { + data.map((t2, idx) => ( + + + )) + } + +
+ )) + } +
+ ) +} + +const LogContent = ({log}) => { + + return ( + + + + + 行號 + 時間 + 內容 + + + + { + log.map((t,idx) => ( + + {t.line} + {convertTime(t.time, true)} + {t.content} + + )) + } + +
+
+ ) +} + +const SensorContent = ({sensor}) => { + + return ( + + + + + 名稱 + 數值 + 單位 + 狀態 + + + + { + sensor.map((t,idx) => ( + + {t.name} + {t.value} + {t.unit} + {t.status} + + )) + } + +
+
+ ) +} + export default IPMIInfoModal; \ No newline at end of file diff --git a/src/components/AdminPage/Server/index.js b/src/components/AdminPage/Server/index.js index 8261fa8..c0e43e7 100644 --- a/src/components/AdminPage/Server/index.js +++ b/src/components/AdminPage/Server/index.js @@ -5,7 +5,7 @@ import DevList from './DevList'; import IPMIPage from './IPMIPage'; import DevModal from './Modals/DevModal'; import IPMIModal from './Modals/IPMIModal'; -import IPMIInfoModal from './Modals' +import IPMIInfoModal from './Modals/IPMIInfoModal'; const stateDefault = ()=>({ list: [], @@ -293,6 +293,9 @@ class ServerPage extends React.Component { data={this.state.ipmiModal.data} closeModal={this.closeModal} submitModal={this.submitModal} /> + ) }