update
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import React from 'react';
|
||||
import {Table, Button} from 'semantic-ui-react';
|
||||
|
||||
const SetListItem = ({ i18n, data, openModal, delData }) => {
|
||||
const SetListItem = ({ i18n, data, openModal, delData, bmctl, runbmctl }) => {
|
||||
|
||||
return (
|
||||
<Table.Row>
|
||||
@@ -10,6 +10,13 @@ const SetListItem = ({ i18n, data, openModal, delData }) => {
|
||||
<Button content="刪除" basic onClick={()=>delData('ipmi', data.ipmuid)} />
|
||||
<Button content="ShowInfo" basic onClick={()=>openModal('ipmiinfo', 0, {id: data.ipmuid})} />
|
||||
</Table.Cell>
|
||||
<Table.Cell>
|
||||
{
|
||||
bmctl.map((t,idx) => (
|
||||
<Button key={idx} content={t.name} type="button" onClick={()=>runbmctl(t.uid, data.ipmuid)} />
|
||||
))
|
||||
}
|
||||
</Table.Cell>
|
||||
<Table.Cell>{data.ip}</Table.Cell>
|
||||
<Table.Cell>{data.account}</Table.Cell>
|
||||
<Table.Cell>{data.mac}</Table.Cell>
|
||||
|
||||
@@ -2,7 +2,7 @@ import React from 'react';
|
||||
import {Container, Segment, Button, Table} from 'semantic-ui-react';
|
||||
import SelListItem from './SetListItem';
|
||||
|
||||
const IPMIPage = ({i18n, list, openModal, delData}) => {
|
||||
const IPMIPage = ({i18n, list, openModal, delData, bmctl, runbmctl}) => {
|
||||
return (
|
||||
<Container>
|
||||
<Segment className="clearfix">
|
||||
@@ -16,7 +16,8 @@ const IPMIPage = ({i18n, list, openModal, delData}) => {
|
||||
<Table>
|
||||
<Table.Header>
|
||||
<Table.Row>
|
||||
<Table.HeaderCell>操作</Table.HeaderCell>
|
||||
<Table.HeaderCell>操作</Table.HeaderCell>
|
||||
<Table.HeaderCell>設備操作</Table.HeaderCell>
|
||||
<Table.HeaderCell>IP</Table.HeaderCell>
|
||||
<Table.HeaderCell>帳號</Table.HeaderCell>
|
||||
<Table.HeaderCell>MAC Address</Table.HeaderCell>
|
||||
@@ -30,7 +31,9 @@ const IPMIPage = ({i18n, list, openModal, delData}) => {
|
||||
i18n={i18n}
|
||||
data={t}
|
||||
openModal={openModal}
|
||||
delData={delData} />
|
||||
delData={delData}
|
||||
bmctl={bmctl}
|
||||
runbmctl={runbmctl} />
|
||||
)
|
||||
})
|
||||
}
|
||||
|
||||
@@ -72,12 +72,14 @@ const BMCContent = ({group, data}) => {
|
||||
</Header>
|
||||
<List>
|
||||
{
|
||||
data.map((t2, idx) => (
|
||||
data.map((t2, idx) => {
|
||||
if(t2.guid != t.guid) return null;
|
||||
return (
|
||||
<List.Item key={idx}>
|
||||
<Label content={t2.name} basic />
|
||||
{t2.value}
|
||||
</List.Item>
|
||||
))
|
||||
)})
|
||||
}
|
||||
</List>
|
||||
</Segment>
|
||||
|
||||
@@ -9,6 +9,7 @@ import IPMIInfoModal from './Modals/IPMIInfoModal';
|
||||
|
||||
const stateDefault = ()=>({
|
||||
list: [],
|
||||
bmctl: [],
|
||||
devSel: {
|
||||
id: null,
|
||||
type: null,
|
||||
@@ -42,6 +43,7 @@ class ServerPage extends React.Component {
|
||||
|
||||
componentDidMount(){
|
||||
this.getDevList();
|
||||
this.getBMCtl();
|
||||
}
|
||||
|
||||
getDevList = () => {
|
||||
@@ -58,6 +60,18 @@ class ServerPage extends React.Component {
|
||||
})
|
||||
}
|
||||
|
||||
getBMCtl = () => {
|
||||
fetch('/api/server/getbmctl', getRequest())
|
||||
.then(response=>response.json())
|
||||
.then(json => {
|
||||
if(json.status == 1) {
|
||||
this.setState({
|
||||
bmctl: json.data.record || []
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
selectDevice = (id, refresh = false) => {
|
||||
if(!id) return ;
|
||||
let {showDialog, toggleLoading} = this.props;
|
||||
@@ -106,7 +120,9 @@ class ServerPage extends React.Component {
|
||||
list={this.state.devSel.data.ipmi}
|
||||
openModal={this.openModal}
|
||||
closeModal={this.closeModal}
|
||||
delData={this.delData} />
|
||||
delData={this.delData}
|
||||
bmctl={this.state.bmctl}
|
||||
runbmctl={this.runbmctl} />
|
||||
|
||||
default:
|
||||
return null;
|
||||
@@ -246,6 +262,19 @@ class ServerPage extends React.Component {
|
||||
})
|
||||
}
|
||||
|
||||
runbmctl = (ctlid, ipmuid) => {
|
||||
if(!ctlid || !ipmuid) return ;
|
||||
let {i18n, showDialog, toggleLoading, callConfirm} = this.props;
|
||||
toggleLoading(1);
|
||||
fetch('/api/server/runbmctl', getRequest({ctlid, ipmuid}))
|
||||
.then(response=>response.json())
|
||||
.then(json => {
|
||||
toggleLoading(0);
|
||||
if(json.status != 1) return showDialog(json.message);
|
||||
return showDialog('命令執行完成');
|
||||
})
|
||||
}
|
||||
|
||||
render() {
|
||||
let {i18n, showDialog, toggleLoading, callConfirm} = this.props;
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user