diff --git a/route/api/server.js b/route/api/server.js
index d72f57c..a1da4e2 100644
--- a/route/api/server.js
+++ b/route/api/server.js
@@ -295,6 +295,68 @@ router
return n();
})
+ .post('/getbmctl', async(req, res, n) => {
+ if (!config.permission.server) return n('ERR9000');
+
+ try {
+ let query = "select `uid`,`name` from ??.??";
+ let param = [config.db.db11, 'bmctl'];
+
+ let ctls = await tool.promiseQuery(res, query, param);
+
+ res.api_res = {
+ record: tool.checkArray(ctls.data)
+ }
+ } catch (err) {
+ return rt.err(res, err, n, 'ERR8000');
+ }
+
+ return n();
+ })
+ .post('/runbmctl', async(req, res, n) => {
+ if (!config.permission.server) return n('ERR9000');
+ if (!tool.checkPermission(req)) return n('ERR9000');
+ let arr = req.body;
+ if (!arr.data) return n('ERR0000');
+ if (!arr.data.ctlid || !arr.data.ipmuid) return n('ERR0028');
+
+ res.api_res = {
+ record: []
+ };
+
+ try {
+ let query = "select * from ??.?? where `uid` = ?";
+ let param = [config.db.db11, 'bmctl', arr.data.ctlid];
+ let ctl = await tool.promiseQuery(res, query, param);
+ if (ctl.data.length == 0) return n('ERR8000');
+
+ query = "select * from ??.?? where `ipmuid` = ?";
+ param = [config.db.db11, 'ipmi', arr.data.ipmuid];
+ let ipmi = await tool.promiseQuery(res, query, param);
+ if (ipmi.data.length == 0) return n('ERR8000');
+
+ let cmd = ctl.data[0].cmd;
+ cmd = cmd.trim();
+ if (!cmd) return n('ERR7000');
+
+ cmd = cmd.replace(/\@ipmuid/i, ipmi.data[0].ipmuid);
+ let result = await new Promise((resolve, reject) => {
+ exec(cmd, (err, stderr, stdout) => {
+ if (err) return reject(err);
+ return resolve(stdout || stderr);
+ });
+ })
+
+ result = result.split(/\n/).filter(e => e).join('');
+
+ if (result == 0) return n('ERR7000');
+
+ } catch (err) {
+ return rt.err(res, err, n, 'ERR8000');
+ }
+
+ return n();
+ })
.all('*', rt.send);
module.exports = router;
\ No newline at end of file
diff --git a/src/components/AdminPage/Server/IPMIPage/SetListItem.js b/src/components/AdminPage/Server/IPMIPage/SetListItem.js
index 9dbc662..3057784 100644
--- a/src/components/AdminPage/Server/IPMIPage/SetListItem.js
+++ b/src/components/AdminPage/Server/IPMIPage/SetListItem.js
@@ -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 (
@@ -10,6 +10,13 @@ const SetListItem = ({ i18n, data, openModal, delData }) => {