Compare commits
112
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8955d6a580 | ||
|
|
5c37893d1c | ||
|
|
d702c63eb6 | ||
|
|
58057bcfa0 | ||
|
|
432ff46ecd | ||
|
|
c934490047 | ||
|
|
7a270f862f | ||
|
|
68e07e0dcd | ||
|
|
00eb87487e | ||
|
|
63520e50d5 | ||
|
|
97cb15bdb1 | ||
|
|
7826befe8e | ||
|
|
0cd5667f63 | ||
|
|
be4c8fddc6 | ||
|
|
a1637181fb | ||
|
|
bcc4b1ed7d | ||
|
|
fbab4f44e8 | ||
|
|
af1d96062a | ||
|
|
5113518997 | ||
|
|
ef5e115b9d | ||
|
|
9ed476df9c | ||
|
|
27cd09220e | ||
|
|
bb260bd312 | ||
|
|
e1fa3d2bc7 | ||
|
|
a8adbf4cfd | ||
|
|
efbd54191f | ||
|
|
ee67fb6636 | ||
|
|
fec43a6840 | ||
|
|
08dcdf08ae | ||
|
|
b3e752792d | ||
|
|
cf66e9d94e | ||
|
|
af02ee856d | ||
|
|
5e751abbdc | ||
|
|
c8c4c28dfc | ||
|
|
feac093bda | ||
|
|
f02af21b7b | ||
|
|
3062208332 | ||
|
|
f64ab2ae82 | ||
|
|
06ab118cfe | ||
|
|
712a78c4ed | ||
|
|
e27d143330 | ||
|
|
48b178ac3a | ||
|
|
b07e51ef7c | ||
|
|
847bd06ac6 | ||
|
|
6f50504660 | ||
|
|
27d2209ea2 | ||
|
|
a4b949bbfe | ||
|
|
588c5d77ab | ||
|
|
768bad6e2d | ||
|
|
9b70a544df | ||
|
|
2d958f2d85 | ||
|
|
a92d29e107 | ||
|
|
85cb31b013 | ||
|
|
b849574ee1 | ||
|
|
5429ffbb73 | ||
|
|
a4ac4742be | ||
|
|
1a0a4fdc4d | ||
|
|
88255a1ae2 | ||
|
|
26f669fb96 | ||
|
|
eb6b8d9ad5 | ||
|
|
12ff3a4020 | ||
|
|
54f41a85e6 | ||
|
|
6b34422a63 | ||
|
|
afd3994e95 | ||
|
|
d504f26bda | ||
|
|
29a5543c44 | ||
|
|
e3a3307340 | ||
|
|
efdc7e01c2 | ||
|
|
91effa014a | ||
|
|
0ea24f857d | ||
|
|
e5bf72435c | ||
|
|
87525f2597 | ||
|
|
64ad807310 | ||
|
|
0cdbd319c8 | ||
|
|
b1ad20d86c | ||
|
|
6e0f6faa25 | ||
|
|
5c02a34897 | ||
|
|
59331f9b1c | ||
|
|
7a30f23138 | ||
|
|
108e7db8f3 | ||
|
|
0fdcaf3bfc | ||
|
|
2434db599d | ||
|
|
05e38c2e2d | ||
|
|
b8ccbe4cd3 | ||
|
|
e18fa6546b | ||
|
|
b781efabea | ||
|
|
c132be1ed0 | ||
|
|
8d8b4818ae | ||
|
|
34f2d0e24a | ||
|
|
b684672ad2 | ||
|
|
57a37b047f | ||
|
|
7cfdf4f2af | ||
|
|
e529794956 | ||
|
|
c1b443b9d2 | ||
|
|
b419194b6b | ||
|
|
f8f3cbe0d8 | ||
|
|
e1ce5290da | ||
|
|
3e66691b67 | ||
|
|
77bf5f58d2 | ||
|
|
eeead43baf | ||
|
|
52e18de9ac | ||
|
|
e2040a181e | ||
|
|
493dd36e18 | ||
|
|
404fb8c346 | ||
|
|
57c8083012 | ||
|
|
37d854334d | ||
|
|
1df91aac09 | ||
|
|
7f93ea3bd6 | ||
|
|
40fa771e43 | ||
|
|
c434a59910 | ||
|
|
4ae177e455 | ||
|
|
c990935194 |
No files matched your search
@@ -1 +1,3 @@
|
|||||||
node_modules
|
node_modules
|
||||||
|
public/js/admin_bundle.js
|
||||||
|
public/js/index_bundle.js
|
||||||
@@ -7,13 +7,16 @@ const logger = require('morgan');
|
|||||||
const path = require('path');
|
const path = require('path');
|
||||||
const config = require('./config');
|
const config = require('./config');
|
||||||
const so = require('./includes/storeObject');
|
const so = require('./includes/storeObject');
|
||||||
|
const exec = require('child_process').exec;
|
||||||
|
const fs = require('fs');
|
||||||
|
const archiver = require('archiver');
|
||||||
|
|
||||||
const app = express();
|
const app = express();
|
||||||
|
|
||||||
const api_route = require('./route/api');
|
const api_route = require('./route/api');
|
||||||
|
|
||||||
// storeObject interval clear
|
// storeObject interval clear
|
||||||
const clearStore = setInterval(() =>{
|
const clearStore = setInterval(() => {
|
||||||
so.clear();
|
so.clear();
|
||||||
}, 30000)
|
}, 30000)
|
||||||
|
|
||||||
@@ -34,6 +37,10 @@ app.use(express.static(path.resolve(__dirname, 'public')));
|
|||||||
app.use('/semantic', express.static(path.resolve(__dirname, 'node_modules', 'semantic-ui-css')));
|
app.use('/semantic', express.static(path.resolve(__dirname, 'node_modules', 'semantic-ui-css')));
|
||||||
app.use('/react-datetime', express.static(path.resolve(__dirname, 'node_modules', 'react-datetime', 'css')));
|
app.use('/react-datetime', express.static(path.resolve(__dirname, 'node_modules', 'react-datetime', 'css')));
|
||||||
|
|
||||||
|
app.use(/\/locales\/(\w+).json/, (req, res, n) => {
|
||||||
|
res.sendFile(path.resolve(__dirname, 'public', 'locales', 'zh.json'));
|
||||||
|
})
|
||||||
|
|
||||||
const server = app.listen(app.get('port'), () => {
|
const server = app.listen(app.get('port'), () => {
|
||||||
console.log(`Server start on port ${server.address().port}`);
|
console.log(`Server start on port ${server.address().port}`);
|
||||||
});
|
});
|
||||||
@@ -45,6 +52,87 @@ app.get('/', (req, res) => {
|
|||||||
res.sendFile(path.resolve(__dirname, 'views', 'index.html'));
|
res.sendFile(path.resolve(__dirname, 'views', 'index.html'));
|
||||||
});
|
});
|
||||||
|
|
||||||
app.get(['/admin','/admin/*'], (req,res) => {
|
app.get(['/admin', '/admin/*'], (req, res) => {
|
||||||
res.sendFile(path.resolve(__dirname, 'views', 'admin.html'));
|
res.sendFile(path.resolve(__dirname, 'views', 'admin.html'));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
app.get('/camevent', (req, res) => {
|
||||||
|
let ip = req.headers['x-forwarded-for'] || req.connection.remoteAddress;
|
||||||
|
ip = ip.split(':').pop();
|
||||||
|
let cmd = `camcam ${ip} ${Math.floor(Date.now() / 1000)}`;
|
||||||
|
exec(cmd, (err, sout, serr) => {
|
||||||
|
res.send({ ip });
|
||||||
|
});
|
||||||
|
})
|
||||||
|
app.get(['/viewcamimg/:dir/:file', '/dlcamvideo/:dir/:file'], async(req, res) => {
|
||||||
|
let dir = req.params.dir;
|
||||||
|
let file = req.params.file;
|
||||||
|
if (!dir || !file) return res.sendStatus(404);
|
||||||
|
try {
|
||||||
|
let stat = await new Promise((resolve, reject) => {
|
||||||
|
fs.stat(path.resolve(config.cmdpath.ipcamsave, dir, file), (err, stats) => {
|
||||||
|
if (err) return reject(err);
|
||||||
|
return resolve(stats);
|
||||||
|
})
|
||||||
|
})
|
||||||
|
if (!stat.isFile()) return res.sendStatus(404);
|
||||||
|
} catch (e) {
|
||||||
|
return res.sendStatus(404);
|
||||||
|
}
|
||||||
|
res.sendfile(path.resolve(config.cmdpath.ipcamsave, dir, file))
|
||||||
|
})
|
||||||
|
app.get('/dlevent/:dir', async(req, res) => {
|
||||||
|
let dir = req.params.dir;
|
||||||
|
if (!dir) return res.sendStatus(404);
|
||||||
|
let list = [];
|
||||||
|
try {
|
||||||
|
let stat = await new Promise((resolve, reject) => {
|
||||||
|
fs.stat(path.resolve(config.cmdpath.ipcamsave, dir), (err, stats) => {
|
||||||
|
if (err) return reject(err);
|
||||||
|
return resolve(stats);
|
||||||
|
})
|
||||||
|
});
|
||||||
|
if (!stat.isDirectory()) return res.sendStatus(404);
|
||||||
|
list = await new Promise((resolve, reject) => {
|
||||||
|
fs.readdir(path.resolve(config.cmdpath.ipcamsave, dir), (err, fis) => {
|
||||||
|
if (err) return reject(err);
|
||||||
|
return resolve(fis);
|
||||||
|
})
|
||||||
|
})
|
||||||
|
} catch (e) {
|
||||||
|
return res.sendStatus(404);
|
||||||
|
}
|
||||||
|
res.writeHead(200, {
|
||||||
|
'Content-Type': 'application/zip',
|
||||||
|
'Content-disposition': 'attachment; filename=cam_event.zip'
|
||||||
|
});
|
||||||
|
let zip = archiver('zip', { store: true });
|
||||||
|
zip.pipe(res);
|
||||||
|
for (let i of list) {
|
||||||
|
zip.file(path.resolve(config.cmdpath.ipcamsave, dir, i), { name: i })
|
||||||
|
}
|
||||||
|
zip.finalize();
|
||||||
|
})
|
||||||
|
|
||||||
|
app.get('/servcmd', (req, res) => {
|
||||||
|
res.send({ status: `exit time ${(new Date()).toString()}` });
|
||||||
|
setTimeout(() => { process.exit(1) }, 2000);
|
||||||
|
});
|
||||||
|
|
||||||
|
app.get('/fixmysql', (req, res) => {
|
||||||
|
exec('systemctl stop mysqld', (err, sout, serr) => {
|
||||||
|
let cmd = 'rm /home/www/mydb/aria*';
|
||||||
|
let json = {
|
||||||
|
rm: '',
|
||||||
|
restart: ''
|
||||||
|
};
|
||||||
|
exec(cmd, (err, stdout, stderr) => {
|
||||||
|
let cmd = 'systemctl start mysqld';
|
||||||
|
json.rm = stdout;
|
||||||
|
exec(cmd, (err, sout, serr) => {
|
||||||
|
json.restart = sout;
|
||||||
|
res.send(json);
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
|
});
|
||||||
+14
-5
@@ -4,7 +4,8 @@
|
|||||||
},
|
},
|
||||||
"uni_token": "webiounitoken",
|
"uni_token": "webiounitoken",
|
||||||
"perpage": 10,
|
"perpage": 10,
|
||||||
"leone_limie": 40,
|
"leone_limit": 40,
|
||||||
|
"ipcam_limit": 4,
|
||||||
"db": {
|
"db": {
|
||||||
"user": "root",
|
"user": "root",
|
||||||
"pass": "16055536",
|
"pass": "16055536",
|
||||||
@@ -17,7 +18,11 @@
|
|||||||
"db5": "jcmbset",
|
"db5": "jcmbset",
|
||||||
"db6": "jcmbrt",
|
"db6": "jcmbrt",
|
||||||
"db7": "jcioclc",
|
"db7": "jcioclc",
|
||||||
"db8": "jciocln"
|
"db8": "jciocln",
|
||||||
|
"db9": "jcbtwristband",
|
||||||
|
"db10": "jcmblog",
|
||||||
|
"db11": "jciocserver",
|
||||||
|
"db12": "jcioccam"
|
||||||
},
|
},
|
||||||
"permission": {
|
"permission": {
|
||||||
"dio": true,
|
"dio": true,
|
||||||
@@ -27,9 +32,12 @@
|
|||||||
"iocmd": true,
|
"iocmd": true,
|
||||||
"schedule": true,
|
"schedule": true,
|
||||||
"modbus": true,
|
"modbus": true,
|
||||||
"link": true
|
"link": true,
|
||||||
|
"ipcam": true,
|
||||||
|
"wristband": true,
|
||||||
|
"server": true
|
||||||
},
|
},
|
||||||
"cmdpath":{
|
"cmdpath": {
|
||||||
"manualip": "/home/www/cmd/manualip",
|
"manualip": "/home/www/cmd/manualip",
|
||||||
"dhcpip": "/home/www/cmd/dhcpip",
|
"dhcpip": "/home/www/cmd/dhcpip",
|
||||||
"sysinfo": "/home/www/sysinfo",
|
"sysinfo": "/home/www/sysinfo",
|
||||||
@@ -39,6 +47,7 @@
|
|||||||
"iocmd": "/home/www/cmd/cmdio",
|
"iocmd": "/home/www/cmd/cmdio",
|
||||||
"leonert": "/home/www/tmp/rtles",
|
"leonert": "/home/www/tmp/rtles",
|
||||||
"htsrt": "/home/www/tmp/rthts",
|
"htsrt": "/home/www/tmp/rthts",
|
||||||
"version": "/factory/webioa_version"
|
"version": "/factory/webioa_version",
|
||||||
|
"ipcamsave": "/home/www/cam"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -54,6 +54,25 @@
|
|||||||
"ERR0052": "ScaleMin輸入錯誤",
|
"ERR0052": "ScaleMin輸入錯誤",
|
||||||
"ERR0053": "ScaleMax輸入錯誤",
|
"ERR0053": "ScaleMax輸入錯誤",
|
||||||
"ERR0054": "此位址設定已存在",
|
"ERR0054": "此位址設定已存在",
|
||||||
|
"ERR0055": "Func Code 輸入錯誤",
|
||||||
|
"ERR0056": "LeOne數量已達上限",
|
||||||
|
"ERR0057": "連動資料輸入錯誤",
|
||||||
|
"ERR0058": "timezone輸入錯誤",
|
||||||
|
"ERR0059": "timezone設定失敗",
|
||||||
|
"ERR0060": "手環ID輸入錯誤",
|
||||||
|
"ERR0061": "手環ID已存在",
|
||||||
|
"ERR0062": "機器序號輸入錯誤",
|
||||||
|
"ERR0063": "機器序號已存在",
|
||||||
|
"ERR0064": "MAC Addr 輸入錯誤",
|
||||||
|
"ERR0065": "版本輸入錯誤",
|
||||||
|
"ERR0066": "SNMP Level輸入錯誤",
|
||||||
|
"ERR0067": "型號輸入錯誤",
|
||||||
|
"ERR0068": "事件數量輸入錯誤",
|
||||||
|
"ERR0069": "圖片數量輸入錯誤",
|
||||||
|
"ERR0070": "IPCam 裝置已達上限",
|
||||||
|
"ERR0071": "無此裝置資料",
|
||||||
|
"ERR0072": "目錄資訊取得失敗",
|
||||||
|
"ERR0073": "目錄輸入錯誤",
|
||||||
|
|
||||||
"ERR7000": "命令執行失敗",
|
"ERR7000": "命令執行失敗",
|
||||||
|
|
||||||
@@ -61,5 +80,7 @@
|
|||||||
"ERR8001": "資料新增失敗",
|
"ERR8001": "資料新增失敗",
|
||||||
"ERR8002": "資料更新失敗",
|
"ERR8002": "資料更新失敗",
|
||||||
"ERR8003": "資料刪除失敗",
|
"ERR8003": "資料刪除失敗",
|
||||||
"ERR9000": "操作權限不足"
|
"ERR8100": "DB連線失敗",
|
||||||
|
"ERR9000": "操作權限不足",
|
||||||
|
"ERR9001": "登入Token無效"
|
||||||
}
|
}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
const StoreObj = (() => {
|
const StoreObj = (() => {
|
||||||
|
|
||||||
let memStore = {};
|
let memStore = {};
|
||||||
let maxAge = 3600000;
|
let maxAge = 86400000;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {string} uuid
|
* @param {string} uuid
|
||||||
|
|||||||
@@ -0,0 +1,91 @@
|
|||||||
|
const mysql = require('mysql');
|
||||||
|
const config = require('../config.json');
|
||||||
|
|
||||||
|
class MySQLPool {
|
||||||
|
constructor() {
|
||||||
|
this._user = '';
|
||||||
|
this._password = '';
|
||||||
|
this._host = '';
|
||||||
|
this._port = 3306;
|
||||||
|
this._database = '';
|
||||||
|
this._socketPath = '/var/lib/mysql/mysql.sock'
|
||||||
|
this._pool = null;
|
||||||
|
this.autoclose = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
createPool(){
|
||||||
|
this._pool = mysql.createPool({
|
||||||
|
connectionLimit: 30,
|
||||||
|
user: this._user,
|
||||||
|
password: this._password,
|
||||||
|
host: this._host,
|
||||||
|
port: this._port,
|
||||||
|
socketPath: this._socketPath
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async getConn() {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
this._pool.getConnection((err, conn) => {
|
||||||
|
if(err) return reject(err);
|
||||||
|
return resolve(conn)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
formatQuery(query, arg) {
|
||||||
|
return mysql.format(query, arg);
|
||||||
|
}
|
||||||
|
|
||||||
|
escape(val) {
|
||||||
|
return mysql.escape(val);
|
||||||
|
}
|
||||||
|
|
||||||
|
recordPage(rows, page, maxPage) {
|
||||||
|
if (!page || !isFinite(page) || page < 1) page = 1;
|
||||||
|
|
||||||
|
let totalpage = Math.ceil(rows / maxPage);
|
||||||
|
|
||||||
|
let prevpage = page - 1;
|
||||||
|
let nextpage = page + 1;
|
||||||
|
|
||||||
|
if (prevpage < 1) prevpage = 1;
|
||||||
|
if (nextpage > totalpage) nextpage = totalpage;
|
||||||
|
|
||||||
|
let rec_start = (page - 1) * maxPage + 1
|
||||||
|
let rec_end = (rec_start + maxPage - 1);
|
||||||
|
if (rec_end > rows) rec_end = rows;
|
||||||
|
|
||||||
|
let json = {
|
||||||
|
rec_start,
|
||||||
|
rec_end,
|
||||||
|
total: rows,
|
||||||
|
prevpage,
|
||||||
|
nextpage,
|
||||||
|
totalpage,
|
||||||
|
page
|
||||||
|
};
|
||||||
|
|
||||||
|
return json;
|
||||||
|
}
|
||||||
|
|
||||||
|
set user(str) { this._user = str; }
|
||||||
|
set host(str) { this._host = str; }
|
||||||
|
set password(str) { this._password = str; }
|
||||||
|
set port(str) { this._port = str; }
|
||||||
|
set database(str) { this._database = str; }
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
let Pool = (()=>{
|
||||||
|
let pool = new MySQLPool();
|
||||||
|
pool.user = config.db.user;
|
||||||
|
pool.password = config.db.pass;
|
||||||
|
pool.host = config.db.host;
|
||||||
|
pool.port = config.db.port;
|
||||||
|
pool.createPool();
|
||||||
|
|
||||||
|
return pool
|
||||||
|
})()
|
||||||
|
|
||||||
|
module.exports = Pool;
|
||||||
@@ -12,6 +12,7 @@
|
|||||||
"author": "",
|
"author": "",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"archiver": "^1.3.0",
|
||||||
"body-parser": "^1.16.1",
|
"body-parser": "^1.16.1",
|
||||||
"cookie-parser": "^1.4.3",
|
"cookie-parser": "^1.4.3",
|
||||||
"cors": "^2.8.1",
|
"cors": "^2.8.1",
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ div#app {
|
|||||||
.login-grid {
|
.login-grid {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.login-column {
|
.login-column {
|
||||||
max-width: 450px;
|
max-width: 450px;
|
||||||
}
|
}
|
||||||
@@ -19,6 +20,11 @@ div#app {
|
|||||||
clear: both;
|
clear: both;
|
||||||
visibility: hidden;
|
visibility: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
.hide-element {
|
.hide-element {
|
||||||
display: 'none' !important;
|
display: 'none' !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.pointer {
|
||||||
|
cursor: pointer !important;
|
||||||
|
}
|
||||||
@@ -1,52 +0,0 @@
|
|||||||
!function(e){function t(r){if(n[r])return n[r].exports;var a=n[r]={i:r,l:!1,exports:{}};return e[r].call(a.exports,a,a.exports,t),a.l=!0,a.exports}var n={};return t.m=e,t.c=n,t.i=function(e){return e},t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=1110)}([function(e,t,n){"use strict";e.exports=n(73)},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}t.__esModule=!0;var a=n(465),o=r(a);t.default=o.default||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}},function(e,t,n){"use strict";var r=n(855);n.d(t,"l",function(){return r.a});var a=n(858);n.d(t,"q",function(){return a});var o=n(859);n.d(t,"a",function(){return o.a}),n.d(t,"f",function(){return o.b}),n.d(t,"h",function(){return o.d}),n.d(t,"e",function(){return o.c}),n.d(t,"s",function(){return o.f}),n.d(t,"i",function(){return o.e});var i=(n(860),n(861));n.d(t,"m",function(){return i.a});var s=n(862);n.d(t,"g",function(){return s.a}),n.d(t,"j",function(){return s.b}),n.d(t,"k",function(){return s.c}),n.d(t,"r",function(){return s.d}),n.d(t,"t",function(){return s.e});var u=n(864);n.d(t,"b",function(){return u.a});var l=n(863);n.d(t,"c",function(){return l.a});var c=n(404);n.d(t,"o",function(){return c.a});var d=(n(405),n(856));n.d(t,"d",function(){return d});var f=n(857);n.d(t,"u",function(){return f});var p=n(865);n.d(t,"n",function(){return p.a});var m=(n(222),n(866));n.d(t,"p",function(){return m.a})},function(e,t,n){var r,a;/*!
|
|
||||||
Copyright (c) 2016 Jed Watson.
|
|
||||||
Licensed under the MIT License (MIT), see
|
|
||||||
http://jedwatson.github.io/classnames
|
|
||||||
*/
|
|
||||||
!function(){"use strict";function n(){for(var e=[],t=0;t<arguments.length;t++){var r=arguments[t];if(r){var a=typeof r;if("string"===a||"number"===a)e.push(r);else if(Array.isArray(r))e.push(n.apply(null,r));else if("object"===a)for(var i in r)o.call(r,i)&&r[i]&&e.push(i)}}return e.join(" ")}var o={}.hasOwnProperty;"undefined"!=typeof e&&e.exports?e.exports=n:(r=[],a=function(){return n}.apply(t,r),!(void 0!==a&&(e.exports=a)))}()},function(e,t){function n(e){return null==e}e.exports=n},function(e,t,n){(function(e){!function(t,n){e.exports=n()}(this,function(){"use strict";function t(){return vr.apply(null,arguments)}function r(e){vr=e}function a(e){return e instanceof Array||"[object Array]"===Object.prototype.toString.call(e)}function o(e){return null!=e&&"[object Object]"===Object.prototype.toString.call(e)}function i(e){var t;for(t in e)return!1;return!0}function s(e){return"number"==typeof e||"[object Number]"===Object.prototype.toString.call(e)}function u(e){return e instanceof Date||"[object Date]"===Object.prototype.toString.call(e)}function l(e,t){var n,r=[];for(n=0;n<e.length;++n)r.push(t(e[n],n));return r}function c(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function d(e,t){for(var n in t)c(t,n)&&(e[n]=t[n]);return c(t,"toString")&&(e.toString=t.toString),c(t,"valueOf")&&(e.valueOf=t.valueOf),e}function f(e,t,n,r){return gt(e,t,n,r,!0).utc()}function p(){return{empty:!1,unusedTokens:[],unusedInput:[],overflow:-2,charsLeftOver:0,nullInput:!1,invalidMonth:null,invalidFormat:!1,userInvalidated:!1,iso:!1,parsedDateParts:[],meridiem:null}}function m(e){return null==e._pf&&(e._pf=p()),e._pf}function h(e){if(null==e._isValid){var t=m(e),n=gr.call(t.parsedDateParts,function(e){return null!=e}),r=!isNaN(e._d.getTime())&&t.overflow<0&&!t.empty&&!t.invalidMonth&&!t.invalidWeekday&&!t.nullInput&&!t.invalidFormat&&!t.userInvalidated&&(!t.meridiem||t.meridiem&&n);if(e._strict&&(r=r&&0===t.charsLeftOver&&0===t.unusedTokens.length&&void 0===t.bigHour),null!=Object.isFrozen&&Object.isFrozen(e))return r;e._isValid=r}return e._isValid}function _(e){var t=f(NaN);return null!=e?d(m(t),e):m(t).userInvalidated=!0,t}function v(e){return void 0===e}function y(e,t){var n,r,a;if(v(t._isAMomentObject)||(e._isAMomentObject=t._isAMomentObject),v(t._i)||(e._i=t._i),v(t._f)||(e._f=t._f),v(t._l)||(e._l=t._l),v(t._strict)||(e._strict=t._strict),v(t._tzm)||(e._tzm=t._tzm),v(t._isUTC)||(e._isUTC=t._isUTC),v(t._offset)||(e._offset=t._offset),v(t._pf)||(e._pf=m(t)),v(t._locale)||(e._locale=t._locale),br.length>0)for(n in br)r=br[n],a=t[r],v(a)||(e[r]=a);return e}function g(e){y(this,e),this._d=new Date(null!=e._d?e._d.getTime():NaN),this.isValid()||(this._d=new Date(NaN)),Mr===!1&&(Mr=!0,t.updateOffset(this),Mr=!1)}function b(e){return e instanceof g||null!=e&&null!=e._isAMomentObject}function M(e){return e<0?Math.ceil(e)||0:Math.floor(e)}function L(e){var t=+e,n=0;return 0!==t&&isFinite(t)&&(n=M(t)),n}function k(e,t,n){var r,a=Math.min(e.length,t.length),o=Math.abs(e.length-t.length),i=0;for(r=0;r<a;r++)(n&&e[r]!==t[r]||!n&&L(e[r])!==L(t[r]))&&i++;return i+o}function w(e){t.suppressDeprecationWarnings===!1&&"undefined"!=typeof console&&console.warn&&console.warn("Deprecation warning: "+e)}function E(e,n){var r=!0;return d(function(){if(null!=t.deprecationHandler&&t.deprecationHandler(null,e),r){for(var a,o=[],i=0;i<arguments.length;i++){if(a="","object"==typeof arguments[i]){a+="\n["+i+"] ";for(var s in arguments[0])a+=s+": "+arguments[0][s]+", ";a=a.slice(0,-2)}else a=arguments[i];o.push(a)}w(e+"\nArguments: "+Array.prototype.slice.call(o).join("")+"\n"+(new Error).stack),r=!1}return n.apply(this,arguments)},n)}function T(e,n){null!=t.deprecationHandler&&t.deprecationHandler(e,n),Lr[e]||(w(n),Lr[e]=!0)}function S(e){return e instanceof Function||"[object Function]"===Object.prototype.toString.call(e)}function D(e){var t,n;for(n in e)t=e[n],S(t)?this[n]=t:this["_"+n]=t;this._config=e,this._ordinalParseLenient=new RegExp(this._ordinalParse.source+"|"+/\d{1,2}/.source)}function x(e,t){var n,r=d({},e);for(n in t)c(t,n)&&(o(e[n])&&o(t[n])?(r[n]={},d(r[n],e[n]),d(r[n],t[n])):null!=t[n]?r[n]=t[n]:delete r[n]);for(n in e)c(e,n)&&!c(t,n)&&o(e[n])&&(r[n]=d({},r[n]));return r}function Y(e){null!=e&&this.set(e)}function C(e,t,n){var r=this._calendar[e]||this._calendar.sameElse;return S(r)?r.call(t,n):r}function O(e){var t=this._longDateFormat[e],n=this._longDateFormat[e.toUpperCase()];return t||!n?t:(this._longDateFormat[e]=n.replace(/MMMM|MM|DD|dddd/g,function(e){return e.slice(1)}),this._longDateFormat[e])}function P(){return this._invalidDate}function j(e){return this._ordinal.replace("%d",e)}function N(e,t,n,r){var a=this._relativeTime[n];return S(a)?a(e,t,n,r):a.replace(/%d/i,e)}function A(e,t){var n=this._relativeTime[e>0?"future":"past"];return S(n)?n(t):n.replace(/%s/i,t)}function I(e,t){var n=e.toLowerCase();Or[n]=Or[n+"s"]=Or[t]=e}function H(e){return"string"==typeof e?Or[e]||Or[e.toLowerCase()]:void 0}function R(e){var tLine truncated
|
|
||||||
return this._isUTC?"Coordinated Universal Time":""}function Fn(e){return bt(1e3*e)}function Wn(){return bt.apply(null,arguments).parseZone()}function Un(e){return e}function zn(e,t,n,r){var a=rt(),o=f().set(r,t);return a[n](o,e)}function Bn(e,t,n){if(s(e)&&(t=e,e=void 0),e=e||"",null!=t)return zn(e,t,n,"month");var r,a=[];for(r=0;r<12;r++)a[r]=zn(e,r,n,"month");return a}function Vn(e,t,n,r){"boolean"==typeof e?(s(t)&&(n=t,t=void 0),t=t||""):(t=e,n=t,e=!1,s(t)&&(n=t,t=void 0),t=t||"");var a=rt(),o=e?a._week.dow:0;if(null!=n)return zn(t,(n+o)%7,r,"day");var i,u=[];for(i=0;i<7;i++)u[i]=zn(t,(i+o)%7,r,"day");return u}function qn(e,t){return Bn(e,t,"months")}function Gn(e,t){return Bn(e,t,"monthsShort")}function Jn(e,t,n){return Vn(e,t,n,"weekdays")}function Kn(e,t,n){return Vn(e,t,n,"weekdaysShort")}function $n(e,t,n){return Vn(e,t,n,"weekdaysMin")}function Qn(){var e=this._data;return this._milliseconds=eo(this._milliseconds),this._days=eo(this._days),this._months=eo(this._months),e.milliseconds=eo(e.milliseconds),e.seconds=eo(e.seconds),e.minutes=eo(e.minutes),e.hours=eo(e.hours),e.months=eo(e.months),e.years=eo(e.years),this}function Zn(e,t,n,r){var a=Ut(t,n);return e._milliseconds+=r*a._milliseconds,e._days+=r*a._days,e._months+=r*a._months,e._bubble()}function Xn(e,t){return Zn(this,e,t,1)}function er(e,t){return Zn(this,e,t,-1)}function tr(e){return e<0?Math.floor(e):Math.ceil(e)}function nr(){var e,t,n,r,a,o=this._milliseconds,i=this._days,s=this._months,u=this._data;return o>=0&&i>=0&&s>=0||o<=0&&i<=0&&s<=0||(o+=864e5*tr(ar(s)+i),i=0,s=0),u.milliseconds=o%1e3,e=M(o/1e3),u.seconds=e%60,t=M(e/60),u.minutes=t%60,n=M(t/60),u.hours=n%24,i+=M(n/24),a=M(rr(i)),s+=a,i-=tr(ar(a)),r=M(s/12),s%=12,u.days=i,u.months=s,u.years=r,this}function rr(e){return 4800*e/146097}function ar(e){return 146097*e/4800}function or(e){var t,n,r=this._milliseconds;if(e=H(e),"month"===e||"year"===e)return t=this._days+r/864e5,n=this._months+rr(t),"month"===e?n:n/12;switch(t=this._days+Math.round(ar(this._months)),e){case"week":return t/7+r/6048e5;case"day":return t+r/864e5;case"hour":return 24*t+r/36e5;case"minute":return 1440*t+r/6e4;case"second":return 86400*t+r/1e3;case"millisecond":return Math.floor(864e5*t)+r;default:throw new Error("Unknown unit "+e)}}function ir(){return this._milliseconds+864e5*this._days+this._months%12*2592e6+31536e6*L(this._months/12)}function sr(e){return function(){return this.as(e)}}function ur(e){return e=H(e),this[e+"s"]()}function lr(e){return function(){return this._data[e]}}function cr(){return M(this.days()/7)}function dr(e,t,n,r,a){return a.relativeTime(t||1,!!n,e,r)}function fr(e,t,n){var r=Ut(e).abs(),a=vo(r.as("s")),o=vo(r.as("m")),i=vo(r.as("h")),s=vo(r.as("d")),u=vo(r.as("M")),l=vo(r.as("y")),c=a<yo.s&&["s",a]||o<=1&&["m"]||o<yo.m&&["mm",o]||i<=1&&["h"]||i<yo.h&&["hh",i]||s<=1&&["d"]||s<yo.d&&["dd",s]||u<=1&&["M"]||u<yo.M&&["MM",u]||l<=1&&["y"]||["yy",l];return c[2]=t,c[3]=+e>0,c[4]=n,dr.apply(null,c)}function pr(e){return void 0===e?vo:"function"==typeof e&&(vo=e,!0)}function mr(e,t){return void 0!==yo[e]&&(void 0===t?yo[e]:(yo[e]=t,!0))}function hr(e){var t=this.localeData(),n=fr(this,!e,t);return e&&(n=t.pastFuture(+this,n)),t.postformat(n)}function _r(){var e,t,n,r=go(this._milliseconds)/1e3,a=go(this._days),o=go(this._months);e=M(r/60),t=M(e/60),r%=60,e%=60,n=M(o/12),o%=12;var i=n,s=o,u=a,l=t,c=e,d=r,f=this.asSeconds();return f?(f<0?"-":"")+"P"+(i?i+"Y":"")+(s?s+"M":"")+(u?u+"D":"")+(l||c||d?"T":"")+(l?l+"H":"")+(c?c+"M":"")+(d?d+"S":""):"P0D"}var vr,yr;yr=Array.prototype.some?Array.prototype.some:function(e){for(var t=Object(this),n=t.length>>>0,r=0;r<n;r++)if(r in t&&e.call(this,t[r],r,t))return!0;return!1};var gr=yr,br=t.momentProperties=[],Mr=!1,Lr={};t.suppressDeprecationWarnings=!1,t.deprecationHandler=null;var kr;kr=Object.keys?Object.keys:function(e){var t,n=[];for(t in e)c(e,t)&&n.push(t);return n};var wr,Er=kr,Tr={sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},Sr={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},Dr="Invalid date",xr="%d",Yr=/\d{1,2}/,Cr={future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},Or={},Pr={},jr=/(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|YYYYYY|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g,Nr=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,Ar={},Ir={},Hr=/\d/,Rr=/\d\d/,Fr=/\d{3}/,Wr=/\d{4}/,Ur=/[+-]?\d{6}/,zr=/\d\d?/,Br=/\d\d\d\d?/,Vr=/\d\d\d\d\d\d?/,qr=/\d{1,3}/,Gr=/\d{1,4}/,Jr=/[+-]?\d{1,6}/,Kr=/\d+/,$r=/[+-]?\d+/,Qr=/Z|[+-]\d\d:?\d\d/gi,Zr=/Z|[+-]\d\d(?::?\d\d)?/gi,Xr=/[+-]?\d+(\.\d{1,3})?/,ea=/[0-9]*['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+|[\u0600-\u06FLine truncated
|
|
||||||
object-assign
|
|
||||||
(c) Sindre Sorhus
|
|
||||||
@license MIT
|
|
||||||
*/
|
|
||||||
var o=Object.getOwnPropertySymbols,i=Object.prototype.hasOwnProperty,s=Object.prototype.propertyIsEnumerable;e.exports=a()?Object.assign:function(e,t){for(var n,a,u=r(e),l=1;l<arguments.length;l++){n=Object(arguments[l]);for(var c in n)i.call(n,c)&&(u[c]=n[c]);if(o){a=o(n);for(var d=0;d<a.length;d++)s.call(n,a[d])&&(u[a[d]]=n[a[d]])}}return u}},function(e,t){e.exports={}},function(e,t,n){function r(e,t,n){return a(o,e,t,n)}var a=n(686),o=n(688);e.exports=r},function(e,t,n){"use strict";function r(e,t){return 1===e.nodeType&&e.getAttribute(m)===String(t)||8===e.nodeType&&e.nodeValue===" react-text: "+t+" "||8===e.nodeType&&e.nodeValue===" react-empty: "+t+" "}function a(e){for(var t;t=e._renderedComponent;)e=t;return e}function o(e,t){var n=a(e);n._hostNode=t,t[_]=n}function i(e){var t=e._hostNode;t&&(delete t[_],e._hostNode=null)}function s(e,t){if(!(e._flags&h.hasCachedChildNodes)){var n=e._renderedChildren,i=t.firstChild;e:for(var s in n)if(n.hasOwnProperty(s)){var u=n[s],l=a(u)._domID;if(0!==l){for(;null!==i;i=i.nextSibling)if(r(i,l)){o(u,i);continue e}d("32",l)}}e._flags|=h.hasCachedChildNodes}}function u(e){if(e[_])return e[_];for(var t=[];!e[_];){if(t.push(e),!e.parentNode)return null;e=e.parentNode}for(var n,r;e&&(r=e[_]);e=t.pop())n=r,t.length&&s(r,e);return n}function l(e){var t=u(e);return null!=t&&t._hostNode===e?t:null}function c(e){if(void 0===e._hostNode?d("33"):void 0,e._hostNode)return e._hostNode;for(var t=[];!e._hostNode;)t.push(e),e._hostParent?void 0:d("34"),e=e._hostParent;for(;t.length;e=t.pop())s(e,e._hostNode);return e._hostNode}var d=n(12),f=n(71),p=n(330),m=(n(6),f.ID_ATTRIBUTE_NAME),h=p,_="__reactInternalInstance$"+Math.random().toString(36).slice(2),v={getClosestInstanceFromNode:u,getInstanceFromNode:l,getNodeFromInstance:c,precacheChildNodes:s,precacheNode:o,uncacheNode:i};e.exports=v},function(e,t,n){function r(e,t){var n=s(e)?a:i;return n(e,o(t,3))}var a=n(36),o=n(30),i=n(275),s=n(14);e.exports=r},function(e,t,n){"use strict";var r=n(138);n.d(t,"a",function(){return r.a})},function(e,t,n){"use strict";var r=!("undefined"==typeof window||!window.document||!window.document.createElement),a={canUseDOM:r,canUseWorkers:"undefined"!=typeof Worker,canUseEventListeners:r&&!(!window.addEventListener&&!window.attachEvent),canUseViewport:r&&!!window.screen,isInWorker:!r};e.exports=a},function(e,t,n){var r=n(286),a="object"==typeof self&&self&&self.Object===Object&&self,o=r||a||Function("return this")();e.exports=o},function(e,t){function n(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}e.exports=n},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=t.add_dialog_msg=function(e,t){return{type:"dialog_addmsg",msg:e,act:t||null}},a=(t.remove_dialog_msg=function(){return{type:"dialog_remove_first"}},t.set_i18n=function(e){return{type:"i18n_set_ctx",i18n:e}},t.toggle_menu=function(e){return{type:e?"ui_show_menu":"ui_hide_menu"}},t.toggle_loading=function(e){return{type:e?"ui_show_loading":"ui_hide_loading"}}),o=t.getRequest=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t={method:"post",headers:{Accept:"application/json","Content-Type":"application/json"},mode:"cors"},n=sessionStorage.getItem("token");return n&&(t.headers["x-auth-token"]=n),t.body=JSON.stringify({data:e}),t},i=t.get_network_info=function(){return function(e){return e(a(1)),fetch("/api/system/getnetwork",o()).then(function(e){return e.json()}).then(function(t){if(e(a(0)),1!=t.status)return e(r(t.message));var n={};return"data"in t&&"record"in t.data&&t.data.record.length>0&&(n=t.data.record[0]),e(s(n))})}},s=function(e){return{type:"network_info",network:e}},u=(t.set_network_info=function(e,t,n,s,u){return function(l){l(a(1));var c=e?"dhcp":"manual",d=o(),f={data:{type:c,ip:t,netmask:n,gateway:s,dns:u}};return d.body=JSON.stringify(f),fetch("/api/system/updatenetwork",d).then(function(e){return e.json()}).then(function(e){return l(a(0)),l(1!=e.status?r(e.message):i())})}},t.get_system_time=function(){return function(e){return e(a(1)),fetch("/api/system/gettime",o()).then(function(e){return e.json()}).then(function(t){if(e(a(0)),1!=t.status)return e(r(t.message));var n="";return"data"in t&&"record"in t.data&&t.data.record.length>0&&(n=t.data.record[0].time),e(l(n))})}}),l=function(e){return{type:"system_time",time:e}},c=(t.set_system_time=function(e){return function(t){t(a(1));var n=o({time:e});return fetch("/api/system/updatetime",n).then(function(e){return e.json()}).then(function(e){return t(a(0)),t(1!=e.status?r(e.message):u())})}},t.get_user_list=function(){return function(e){e(a(1));var t=o();return fetch("/api/system/getuserlist",t).then(function(e){return e.json()}).then(function(t){return e(a(0)),e(1!=t.status?r(t.message):d(t.data.record))})}}),d=function(e){return{type:"user_list",user:e}},f=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function(n){n(a(1));var i=o(t);return fetch(e,i).then(function(e){retLine truncated
|
|
||||||
l.createElement),m=l.createFactory,h=l.cloneElement,_=r,v={Children:{map:a.map,forEach:a.forEach,count:a.count,toArray:a.toArray,only:f},Component:o,PureComponent:i,createElement:p,cloneElement:h,isValidElement:l.isValidElement,PropTypes:c,createClass:s.createClass,createFactory:m,createMixin:function(e){return e},DOM:u,version:d,__spread:_};e.exports=v},function(e,t,n){"use strict";function r(e){return void 0!==e.ref}function a(e){return void 0!==e.key}var o=n(16),i=n(40),s=(n(7),n(356),Object.prototype.hasOwnProperty),u=n(354),l={key:!0,ref:!0,__self:!0,__source:!0},c=function(e,t,n,r,a,o,i){var s={$$typeof:u,type:e,key:t,ref:n,props:i,_owner:o};return s};c.createElement=function(e,t,n){var o,u={},d=null,f=null,p=null,m=null;if(null!=t){r(t)&&(f=t.ref),a(t)&&(d=""+t.key),p=void 0===t.__self?null:t.__self,m=void 0===t.__source?null:t.__source;for(o in t)s.call(t,o)&&!l.hasOwnProperty(o)&&(u[o]=t[o])}var h=arguments.length-2;if(1===h)u.children=n;else if(h>1){for(var _=Array(h),v=0;v<h;v++)_[v]=arguments[v+2];u.children=_}if(e&&e.defaultProps){var y=e.defaultProps;for(o in y)void 0===u[o]&&(u[o]=y[o])}return c(e,d,f,p,m,i.current,u)},c.createFactory=function(e){var t=c.createElement.bind(null,e);return t.type=e,t},c.cloneAndReplaceKey=function(e,t){var n=c(e.type,t,e.ref,e._self,e._source,e._owner,e.props);return n},c.cloneElement=function(e,t,n){var u,d=o({},e.props),f=e.key,p=e.ref,m=e._self,h=e._source,_=e._owner;if(null!=t){r(t)&&(p=t.ref,_=i.current),a(t)&&(f=""+t.key);var v;e.type&&e.type.defaultProps&&(v=e.type.defaultProps);for(u in t)s.call(t,u)&&!l.hasOwnProperty(u)&&(void 0===t[u]&&void 0!==v?d[u]=v[u]:d[u]=t[u])}var y=arguments.length-2;if(1===y)d.children=n;else if(y>1){for(var g=Array(y),b=0;b<y;b++)g[b]=arguments[b+2];d.children=g}return c(e.type,f,p,m,h,_,d)},c.isValidElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===u},e.exports=c},function(e,t,n){"use strict";function r(e){for(var t=arguments.length-1,n="Minified React error #"+e+"; visit http://facebook.github.io/react/docs/error-decoder.html?invariant="+e,r=0;r<t;r++)n+="&args[]="+encodeURIComponent(arguments[r+1]);n+=" for the full message or use the non-minified dev environment for full errors and additional helpful warnings.";var a=new Error(n);throw a.name="Invariant Violation",a.framesToPop=1,a}e.exports=r},function(e,t,n){"use strict";var r=n(393);n.d(t,"a",function(){return r.a})},function(e,t){e.exports=function(e){return"object"==typeof e?null!==e:"function"==typeof e}},function(e,t){e.exports={}},function(e,t,n){var r=n(252),a=n(153);e.exports=Object.keys||function(e){return r(e,a)}},function(e,t){e.exports=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}}},function(e,t,n){"use strict";var r={};e.exports=r},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var a=function(){function e(){r(this,e),this.observers={}}return e.prototype.on=function(e,t){var n=this;e.split(" ").forEach(function(e){n.observers[e]=n.observers[e]||[],n.observers[e].push(t)})},e.prototype.off=function(e,t){var n=this;this.observers[e]&&this.observers[e].forEach(function(){if(t){var r=n.observers[e].indexOf(t);r>-1&&n.observers[e].splice(r,1)}else delete n.observers[e]})},e.prototype.emit=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];if(this.observers[e]){var a=[].concat(this.observers[e]);a.forEach(function(e){e.apply(void 0,n)})}if(this.observers["*"]){var o=[].concat(this.observers["*"]);o.forEach(function(t){var r;t.apply(t,(r=[e]).concat.apply(r,n))})}},e}();t.a=a},function(e,t,n){"use strict";function r(e){return null==e?"":""+e}function a(e,t,n){e.forEach(function(e){t[e]&&(n[e]=t[e])})}function o(e,t,n){function r(e){return e&&e.indexOf("###")>-1?e.replace(/###/g,"."):e}for(var a="string"!=typeof t?[].concat(t):t.split(".");a.length>1;){if(!e)return{};var o=r(a.shift());!e[o]&&n&&(e[o]=new n),e=e[o]}return e?{obj:e,k:r(a.shift())}:{}}function i(e,t,n){var r=o(e,t,Object),a=r.obj,i=r.k;a[i]=n}function s(e,t,n,r){var a=o(e,t,Object),i=a.obj,s=a.k;i[s]=i[s]||[],r&&(i[s]=i[s].concat(n)),r||i[s].push(n)}function u(e,t){var n=o(e,t),r=n.obj,a=n.k;if(r)return r[a]}function l(e,t,n){for(var r in t)r in e?"string"==typeof e[r]||e[r]instanceof String||"string"==typeof t[r]||t[r]instanceof String?n&&(e[r]=t[r]):l(e[r],t[r],n):e[r]=t[r];return e}function c(e){return e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}function d(e){return"string"==typeof e?e.replace(/[&<>"'\/]/g,function(e){return f[e]}):e}t.f=r,t.a=a,t.g=i,t.b=s,t.c=u,t.h=l,t.e=c,t.d=d;var f={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"}},function(e,t){function n(e,t){for(var n=-1,r=null==e?0:e.length;++n<r&&t(e[n],n,e)!==!1;);return e}e.exports=n},function(e,t,n){var r=n(24),a=Object.create,o=function(){function e(){}return function(t){if(!r(t))return{};if(a)return a(t);e.prototype=t;var n=neLine truncated
|
|
||||||
if("function"==typeof(n=e.valueOf)&&!r(a=n.call(e)))return a;if(!t&&"function"==typeof(n=e.toString)&&!r(a=n.call(e)))return a;throw TypeError("Can't convert object to primitive value")}},function(e,t,n){var r=n(43),a=n(26),o=n(154),i=n(164),s=n(44).f;e.exports=function(e){var t=a.Symbol||(a.Symbol=o?{}:r.Symbol||{});"_"==e.charAt(0)||e in t||s(t,e,{value:i.f(e)})}},function(e,t,n){t.f=n(32)},function(e,t,n){"use strict";function r(e,t){return e===t?0!==e||0!==t||1/e===1/t:e!==e&&t!==t}function a(e,t){if(r(e,t))return!0;if("object"!=typeof e||null===e||"object"!=typeof t||null===t)return!1;var n=Object.keys(e),a=Object.keys(t);if(n.length!==a.length)return!1;for(var i=0;i<n.length;i++)if(!o.call(t,n[i])||!r(e[n[i]],t[n[i]]))return!1;return!0}var o=Object.prototype.hasOwnProperty;e.exports=a},function(e,t,n){"use strict";function r(e){if(!n.i(i.a)(e)||n.i(a.a)(e)!=s)return!1;var t=n.i(o.a)(e);if(null===t)return!0;var r=d.call(t,"constructor")&&t.constructor;return"function"==typeof r&&r instanceof r&&c.call(r)==f}var a=n(544),o=n(546),i=n(551),s="[object Object]",u=Function.prototype,l=Object.prototype,c=u.toString,d=l.hasOwnProperty,f=c.call(Object);t.a=r},function(e,t,n){function r(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=i,this.__views__=[]}var a=n(85),o=n(179),i=4294967295;r.prototype=a(o.prototype),r.prototype.constructor=r,e.exports=r},function(e,t,n){function r(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=void 0}var a=n(85),o=n(179);r.prototype=a(o.prototype),r.prototype.constructor=r,e.exports=r},function(e,t,n){var r=n(57),a=n(23),o=r(a,"Map");e.exports=o},function(e,t,n){function r(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}var a=n(648),o=n(649),i=n(650),s=n(651),u=n(652);r.prototype.clear=a,r.prototype.delete=o,r.prototype.get=i,r.prototype.has=s,r.prototype.set=u,e.exports=r},function(e,t,n){function r(e){var t=this.__data__=new a(e);this.size=t.size}var a=n(99),o=n(663),i=n(664),s=n(665),u=n(666),l=n(667);r.prototype.clear=o,r.prototype.delete=i,r.prototype.get=s,r.prototype.has=u,r.prototype.set=l,e.exports=r},function(e,t){function n(e,t,n){for(var r=-1,a=null==e?0:e.length;++r<a;)if(n(t,e[r]))return!0;return!1}e.exports=n},function(e,t){function n(e,t){for(var n=-1,r=t.length,a=e.length;++n<r;)e[a+n]=t[n];return e}e.exports=n},function(e,t,n){function r(e,t,n){"__proto__"==t&&a?a(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}var a=n(284);e.exports=r},function(e,t,n){function r(e,t,n,S,D,x){var Y,P=t&k,j=t&w,A=t&E;if(n&&(Y=D?n(e,S,D,x):n(e)),void 0!==Y)return Y;if(!M(e))return e;var I=g(e);if(I){if(Y=_(e),!P)return c(e,Y)}else{var H=h(e),R=H==C||H==O;if(b(e))return l(e,P);if(H==N||H==T||R&&!D){if(Y=j||R?{}:y(e),!P)return j?f(e,u(Y,e)):d(e,s(Y,e))}else{if(!Z[H])return D?e:{};Y=v(e,H,r,P)}}x||(x=new a);var F=x.get(e);if(F)return F;x.set(e,Y);var W=A?j?m:p:j?keysIn:L,U=I?void 0:W(e);return o(U||e,function(a,o){U&&(o=a,a=e[o]),i(Y,o,r(a,t,n,o,e,x))}),Y}var a=n(171),o=n(84),i=n(104),s=n(269),u=n(560),l=n(597),c=n(111),d=n(606),f=n(607),p=n(287),m=n(288),h=n(184),_=n(636),v=n(637),y=n(638),g=n(14),b=n(90),M=n(24),L=n(27),k=1,w=2,E=4,T="[object Arguments]",S="[object Array]",D="[object Boolean]",x="[object Date]",Y="[object Error]",C="[object Function]",O="[object GeneratorFunction]",P="[object Map]",j="[object Number]",N="[object Object]",A="[object RegExp]",I="[object Set]",H="[object String]",R="[object Symbol]",F="[object WeakMap]",W="[object ArrayBuffer]",U="[object DataView]",z="[object Float32Array]",B="[object Float64Array]",V="[object Int8Array]",q="[object Int16Array]",G="[object Int32Array]",J="[object Uint8Array]",K="[object Uint8ClampedArray]",$="[object Uint16Array]",Q="[object Uint32Array]",Z={};Z[T]=Z[S]=Z[W]=Z[U]=Z[D]=Z[x]=Z[z]=Z[B]=Z[V]=Z[q]=Z[G]=Z[P]=Z[j]=Z[N]=Z[A]=Z[I]=Z[H]=Z[R]=Z[J]=Z[K]=Z[$]=Z[Q]=!0,Z[Y]=Z[C]=Z[F]=!1,e.exports=r},function(e,t,n){function r(e,t){return e&&a(e,t,o)}var a=n(564),o=n(27);e.exports=r},function(e,t,n){function r(e,t,n,i,s){return e===t||(null==e||null==t||!o(e)&&!o(t)?e!==e&&t!==t:a(e,t,n,i,r,s))}var a=n(571),o=n(34);e.exports=r},function(e,t,n){function r(e){if(!a(e))return o(e);var t=[];for(var n in Object(e))s.call(e,n)&&"constructor"!=n&&t.push(n);return t}var a=n(87),o=n(655),i=Object.prototype,s=i.hasOwnProperty;e.exports=r},function(e,t){function n(){}e.exports=n},function(e,t,n){function r(e){var t=new e.constructor(e.byteLength);return new a(t).set(new a(e)),t}var a=n(264);e.exports=r},function(e,t,n){var r=n(297),a=n(319),o=r?function(e){return r.get(e)}:a;e.exports=o},function(e,t){function n(e){var t=e;return t.placeholder}e.exports=n},function(e,t,n){var r=n(266),a=n(323),o=Object.prototype,i=o.propertyIsEnumerable,s=Object.getOwnPropertySymbols,u=s?function(e){return null==e?[]:(e=Object(e),r(s(e),function(t){return i.call(e,t)}))}:a;e.exports=u}Line truncated
|
|
||||||
* Checks if an event is supported in the current execution environment.
|
|
||||||
*
|
|
||||||
* NOTE: This will not work correctly for non-generic events such as `change`,
|
|
||||||
* `reset`, `load`, `error`, and `select`.
|
|
||||||
*
|
|
||||||
* Borrows from Modernizr.
|
|
||||||
*
|
|
||||||
* @param {string} eventNameSuffix Event name, e.g. "click".
|
|
||||||
* @param {?boolean} capture Check if the capture phase is supported.
|
|
||||||
* @return {boolean} True if the event is supported.
|
|
||||||
* @internal
|
|
||||||
* @license Modernizr 3.0.0pre (Custom Build) | MIT
|
|
||||||
*/
|
|
||||||
function r(e,t){if(!o.canUseDOM||t&&!("addEventListener"in document))return!1;var n="on"+e,r=n in document;if(!r){var i=document.createElement("div");i.setAttribute(n,"return;"),r="function"==typeof i[n]}return!r&&a&&"wheel"===e&&(r=document.implementation.hasFeature("Events.wheel","3.0")),r}var a,o=n(22);o.canUseDOM&&(a=document.implementation&&document.implementation.hasFeature&&document.implementation.hasFeature("","")!==!0),e.exports=r},function(e,t,n){"use strict";function r(e,t){var n=null===e||e===!1,r=null===t||t===!1;if(n||r)return n===r;var a=typeof e,o=typeof t;return"string"===a||"number"===a?"string"===o||"number"===o:"object"===o&&e.type===t.type&&e.key===t.key}e.exports=r},function(e,t,n){"use strict";var r=(n(16),n(29)),a=(n(7),r);e.exports=a},function(e,t,n){"use strict";function r(e){"undefined"!=typeof console&&"function"==typeof console.error&&console.error(e);try{throw new Error(e)}catch(e){}}t.a=r},function(e,t,n){"use strict";function r(e,t,n){this.props=e,this.context=t,this.refs=i,this.updater=n||o}var a=n(75),o=n(211),i=(n(356),n(81));n(6),n(7);r.prototype.isReactComponent={},r.prototype.setState=function(e,t){"object"!=typeof e&&"function"!=typeof e&&null!=e?a("85"):void 0,this.updater.enqueueSetState(this,e),t&&this.updater.enqueueCallback(this,t,"setState")},r.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this),e&&this.updater.enqueueCallback(this,e,"forceUpdate")};e.exports=r},function(e,t,n){"use strict";function r(e,t){}var a=(n(7),{isMounted:function(e){return!1},enqueueCallback:function(e,t){},enqueueForceUpdate:function(e){r(e,"forceUpdate")},enqueueReplaceState:function(e,t){r(e,"replaceState")},enqueueSetState:function(e,t){r(e,"setState")}});e.exports=a},function(e,t,n){"use strict";var r=n(821);n.d(t,"a",function(){return r.a})},function(e,t,n){"use strict";function r(e){var t=e.children,a=e.className,i=e.content,u=l()("content",a),c=n.i(f.b)(r,e),p=n.i(f.c)(r,e);return d.a.createElement(p,o()({},c,{className:u}),s()(t)?i:t)}var a=n(1),o=n.n(a),i=n(4),s=n.n(i),u=n(3),l=n.n(u),c=n(0),d=n.n(c),f=n(2);r.handledProps=["as","children","className","content"],r._meta={name:"MessageItem",parent:"Message",type:f.d.TYPES.COLLECTION},r.defaultProps={as:"li"},r.create=n.i(f.g)(r,function(e){return{content:e}},!0),t.a=r},function(e,t,n){"use strict";function r(e){var t=e.children,a=e.className,i=e.fullWidth,u=s()(n.i(c.a)(i,"full-width"),a),d=n.i(c.b)(r,e),f=n.i(c.c)(r,e);return l.a.createElement(f,o()({},d,{className:u}),t)}var a=n(1),o=n.n(a),i=n(3),s=n.n(i),u=n(0),l=n.n(u),c=n(2);r.handledProps=["as","children","className","fullWidth"],r._meta={name:"TableHeader",type:c.d.TYPES.COLLECTION,parent:"Table"},r.defaultProps={as:"thead"},t.a=r},function(e,t,n){"use strict";var r=n(385);n.d(t,"a",function(){return r.a})},function(e,t,n){"use strict";var r=n(843);n.d(t,"a",function(){return r.a})},function(e,t,n){"use strict";var r=n(1),a=n.n(r),o=n(8),i=n.n(o),s=n(9),u=n.n(s),l=n(11),c=n.n(l),d=n(10),f=n.n(d),p=n(126),m=n.n(p),h=n(4),_=n.n(h),v=n(3),y=n.n(v),g=n(0),b=n.n(g),M=n(2),L=n(138),k=n(393),w=n(395),E=n(396),T=function(e){function t(){var e,n,r,a;i()(this,t);for(var o=arguments.length,s=Array(o),u=0;u<o;u++)s[u]=arguments[u];return n=r=c()(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(s))),r.handleClick=function(e){var t=r.props.onClick;t&&t(e,r.props)},r.handleRemove=function(e){var t=r.props.onRemove;t&&t(e,r.props)},a=n,c()(r,a)}return f()(t,e),u()(t,[{key:"render",value:function(){var e=this.props,r=e.active,o=e.attached,i=e.basic,s=e.children,u=e.circular,l=e.className,c=e.color,d=e.content,f=e.corner,p=e.detail,h=e.empty,v=e.floating,g=e.horizontal,E=e.icon,T=e.image,S=e.onRemove,D=e.pointing,x=e.removeIcon,Y=e.ribbon,C=e.size,O=e.tag,P=D===!0&&"pointing"||("left"===D||"right"===D)&&D+" pointing"||("above"===D||"below"===D)&&"pointing "+D,j=y()("ui",c,P,C,n.i(M.a)(r,"active"),n.i(M.a)(i,"basic"),n.i(M.a)(u,"circular"),n.i(M.a)(h,"empty"),n.i(M.a)(v,"floating"),n.i(M.a)(g,"horizontal"),n.i(M.a)(T===!0,"image"),n.i(M.a)(O,"tag"),n.i(M.h)(f,"corner"),n.i(M.h)(Y,"ribbon"),n.i(M.f)(o,"attached"),"label",l),N=n.i(M.b)(t,this.props),A=n.i(M.c)(t,this.props);if(!_()(s))return b.a.createElement(A,a()({},N,{className:j,onClick:this.handleClick}),s);var I=m()(x)?"delete":x;return b.a.createElement(A,a()({className:j,onClick:this.handleClick},N),L.a.create(E),"boolean"!=typeof T&&k.a.create(T),d,n.i(M.j)(w.a,function(e){return{content:e}},p),S&&L.a.create(I,{onClick:this.handleRemove}))}}]),t}(g.Component);T._meta={name:"Label",type:M.d.TYPES.ELEMENT},T.Detail=w.a,T.Group=E.a,t.a=T,T.handledProps=["active","as","attached","basic","children","circular","className","color","content","corner","detail","empty","floating","horizontal","icon","image","onClick","onRemove","pointing","removeIcon","ribbon","size","tag"],T.create=n.i(M.g)(T,function(e){return{content:e}})},function(e,t,n){"use strict";function r(e){var t=e.children,a=e.classNameLine truncated
|
|
||||||
!!c&&u(c)&&s(f,c)&&(i(e)||o(e)))}var a=n(56),o=n(122),i=n(14),s=n(86),u=n(191),l=n(50);e.exports=r},function(e,t){function n(e){return c.test(e)}var r="\\ud800-\\udfff",a="\\u0300-\\u036f",o="\\ufe20-\\ufe2f",i="\\u20d0-\\u20ff",s=a+o+i,u="\\ufe0e\\ufe0f",l="\\u200d",c=RegExp("["+l+r+s+u+"]");e.exports=n},function(e,t,n){function r(e){var t=i(e),n=s[t];if("function"!=typeof n||!(t in a.prototype))return!1;if(e===n)return!0;var r=o(n);return!!r&&e===r[0]}var a=n(167),o=n(181),i=n(289),s=n(726);e.exports=r},function(e,t,n){function r(e){return e===e&&!a(e)}var a=n(24);e.exports=r},function(e,t){function n(e){var t=-1,n=Array(e.size);return e.forEach(function(e,r){n[++t]=[r,e]}),n}e.exports=n},function(e,t){function n(e,t){return function(n){return null!=n&&(n[e]===t&&(void 0!==t||e in Object(n)))}}e.exports=n},function(e,t,n){var r=n(265),a=r&&new r;e.exports=a},function(e,t){function n(e,t){return function(n){return e(t(n))}}e.exports=n},function(e,t,n){function r(e,t,n){return t=o(void 0===t?e.length-1:t,0),function(){for(var r=arguments,i=-1,s=o(r.length-t,0),u=Array(s);++i<s;)u[i]=r[t+i];i=-1;for(var l=Array(t+1);++i<t;)l[i]=r[i];return l[t]=n(u),a(e,this,l)}}var a=n(101),o=Math.max;e.exports=r},function(e,t,n){function r(e,t){return t.length<2?e:a(e,o(t,0,-1))}var a=n(107),o=n(108);e.exports=r},function(e,t,n){var r=n(276),a=n(303),o=a(r);e.exports=o},function(e,t,n){function r(e,t,n){var r=t+"";return i(e,o(r,s(a(r),n)))}var a=n(629),o=n(639),i=n(186),s=n(672);e.exports=r},function(e,t){function n(e){var t=0,n=0;return function(){var i=o(),s=a-(i-n);if(n=i,s>0){if(++t>=r)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}var r=800,a=16,o=Date.now;e.exports=n},function(e,t,n){var r=n(653),a=/^\./,o=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,i=/\\(\\)?/g,s=r(function(e){var t=[];return a.test(e)&&t.push(""),e.replace(o,function(e,n,r,a){t.push(r?a.replace(i,"$1"):n||e)}),t});e.exports=s},function(e,t){function n(e){if(null!=e){try{return a.call(e)}catch(e){}try{return e+""}catch(e){}}return""}var r=Function.prototype,a=r.toString;e.exports=n},function(e,t){function n(e){for(var t=-1,n=null==e?0:e.length,r=0,a=[];++t<n;){var o=e[t];o&&(a[r++]=o)}return a}e.exports=n},function(e,t,n){function r(e,t,n){t=n?void 0:t;var i=a(e,o,void 0,void 0,void 0,void 0,void 0,t);return i.placeholder=r.placeholder,i}var a=n(113),o=8;r.placeholder={},e.exports=r},function(e,t,n){function r(e,t,n){var r=s(e)?a:o;return n&&u(e,t,n)&&(t=void 0),r(e,i(t,3))}var a=n(557),o=n(561),i=n(30),s=n(14),u=n(117);e.exports=r},function(e,t,n){function r(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var u=null==n?0:i(n);return u<0&&(u=s(r+u,0)),a(e,o(t,3),u)}var a=n(272),o=n(30),i=n(38),s=Math.max;e.exports=r},function(e,t,n){var r=n(18),a=r("flow",n(684));a.placeholder=n(17),e.exports=a},function(e,t,n){var r=n(18),a=r("includes",n(89));a.placeholder=n(17),e.exports=a},function(e,t,n){var r=n(18),a=r("isNil",n(4),n(37));a.placeholder=n(17),e.exports=a},function(e,t,n){function r(e,t){return null!=e&&o(e,t,a)}var a=n(566),o=n(291);e.exports=r},function(e,t,n){var r=n(569),a=n(49),o=a(r);e.exports=o},function(e,t,n){function r(e){return"number"==typeof e||o(e)&&a(e)==i}var a=n(48),o=n(34),i="[object Number]";e.exports=r},function(e,t,n){function r(e){return"string"==typeof e||!o(e)&&i(e)&&a(e)==s}var a=n(48),o=n(14),i=n(34),s="[object String]";e.exports=r},function(e,t,n){function r(e){return i(e)?a(e,!0):o(e)}var a=n(267),o=n(576),i=n(33);e.exports=r},function(e,t){function n(e){var t=null==e?0:e.length;return t?e[t-1]:void 0}e.exports=n},function(e,t){function n(){}e.exports=n},function(e,t,n){function r(e,t,n){var r=u(e)?a:s,l=arguments.length<3;return r(e,i(t,4),n,l,o)}var a=n(103),o=n(66),i=n(30),s=n(586),u=n(14);e.exports=r},function(e,t,n){function r(e,t,n){var r=s(e)?a:i;return n&&u(e,t,n)&&(t=void 0),r(e,o(t,3))}var a=n(268),o=n(30),i=n(589),s=n(14),u=n(117);e.exports=r},function(e,t,n){function r(e,t,n){return e=s(e),n=null==n?0:a(i(n),0,e.length),t=o(t),e.slice(n,n+t.length)==t}var a=n(270),o=n(278),i=n(38),s=n(52);e.exports=r},function(e,t){function n(){return[]}e.exports=n},function(e,t,n){function r(e,t){if(e=i(e),e<1||e>s)return[];var n=u,r=l(e,u);t=o(t),e-=u;for(var c=a(r,t);++n<e;)t(n);return c}var a=n(277),o=n(279),i=n(38),s=9007199254740991,u=4294967295,l=Math.min;e.exports=r},function(e,t,n){function r(e){if(!e)return 0===e?e:0;if(e=a(e),e===o||e===-o){var t=e<0?-1:1;return t*i}return e===e?e:0}var a=n(129),o=1/0,i=1.7976931348623157e308;e.exports=r},function(e,t,n){"use strict";var r=n(1004),a=n(5),o=n(0),i=n(1088),s=o.PropTypes,u=o.createClass({propTypes:{onFocus:s.func,onBlur:s.func,onChange:s.func,locale:s.string,utc:s.bool,input:s.bool,inputProps:s.object,timeConstraints:s.object,viewMode:s.oneOf(["years","months","days","time"]),isValidDate:s.func,open:s.bool,strictParsing:s.bool,closeOnSelect:s.bool,closeOnTab:s.bool},getDefaultProps:function(){vLine truncated
|
|
||||||
o},r}}n(351);t.b=r,t.a=o},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(){var e=[],t=[];return{clear:function(){t=o,e=o},notify:function(){for(var n=e=t,r=0;r<n.length;r++)n[r]()},subscribe:function(n){var r=!0;return t===e&&(t=e.slice()),t.push(n),function(){r&&e!==o&&(r=!1,t===e&&(t=e.slice()),t.splice(t.indexOf(n),1))}}}}n.d(t,"a",function(){return s});var o=null,i={notify:function(){}},s=function(){function e(t,n){r(this,e),this.store=t,this.parentSub=n,this.unsubscribe=null,this.listeners=i}return e.prototype.addNestedSub=function(e){return this.trySubscribe(),this.listeners.subscribe(e)},e.prototype.notifyNestedSubs=function(){this.listeners.notify()},e.prototype.isSubscribed=function(){return Boolean(this.unsubscribe)},e.prototype.trySubscribe=function(){this.unsubscribe||(this.unsubscribe=this.parentSub?this.parentSub.addNestedSub(this.onStateChange):this.store.subscribe(this.onStateChange),this.listeners=a())},e.prototype.tryUnsubscribe=function(){this.unsubscribe&&(this.unsubscribe(),this.unsubscribe=null,this.listeners.clear(),this.listeners=i)},e}()},function(e,t,n){"use strict";var r=n(0);n.n(r);t.a=r.PropTypes.shape({subscribe:r.PropTypes.func.isRequired,dispatch:r.PropTypes.func.isRequired,getState:r.PropTypes.func.isRequired})},function(e,t,n){"use strict";n(166),n(209)},function(e,t,n){"use strict";function r(e,t,n){if(e[t])return new Error("<"+n+'> should not have a "'+t+'" prop')}var a=n(0);n.n(a);t.c=r,n.d(t,"a",function(){return f}),n.d(t,"b",function(){return p}),n.d(t,"d",function(){return h});var o=a.PropTypes.func,i=a.PropTypes.object,s=a.PropTypes.arrayOf,u=a.PropTypes.oneOfType,l=a.PropTypes.element,c=a.PropTypes.shape,d=a.PropTypes.string,f=(c({listen:o.isRequired,push:o.isRequired,replace:o.isRequired,go:o.isRequired,goBack:o.isRequired,goForward:o.isRequired}),u([o,d])),p=u([f,i]),m=u([i,l]),h=u([m,s(m)])},function(e,t,n){"use strict";function r(e){var t=Function.prototype.toString,n=Object.prototype.hasOwnProperty,r=RegExp("^"+t.call(n).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");try{var a=t.call(e);return r.test(a)}catch(e){return!1}}function a(e){var t=l(e);if(t){var n=t.childIDs;c(e),n.forEach(a)}}function o(e,t,n){return"\n in "+(e||"Unknown")+(t?" (at "+t.fileName.replace(/^.*[\\\/]/,"")+":"+t.lineNumber+")":n?" (created by "+n+")":"")}function i(e){return null==e?"#empty":"string"==typeof e||"number"==typeof e?"#text":"string"==typeof e.type?e.type:e.type.displayName||e.type.name||"Unknown"}function s(e){var t,n=E.getDisplayName(e),r=E.getElement(e),a=E.getOwnerID(e);return a&&(t=E.getDisplayName(a)),o(n,r&&r._source,t)}var u,l,c,d,f,p,m,h=n(75),_=n(40),v=(n(6),n(7),"function"==typeof Array.from&&"function"==typeof Map&&r(Map)&&null!=Map.prototype&&"function"==typeof Map.prototype.keys&&r(Map.prototype.keys)&&"function"==typeof Set&&r(Set)&&null!=Set.prototype&&"function"==typeof Set.prototype.keys&&r(Set.prototype.keys));if(v){var y=new Map,g=new Set;u=function(e,t){y.set(e,t)},l=function(e){return y.get(e)},c=function(e){y.delete(e)},d=function(){return Array.from(y.keys())},f=function(e){g.add(e)},p=function(e){g.delete(e)},m=function(){return Array.from(g.keys())}}else{var b={},M={},L=function(e){return"."+e},k=function(e){return parseInt(e.substr(1),10)};u=function(e,t){var n=L(e);b[n]=t},l=function(e){var t=L(e);return b[t]},c=function(e){var t=L(e);delete b[t]},d=function(){return Object.keys(b).map(k)},f=function(e){var t=L(e);M[t]=!0},p=function(e){var t=L(e);delete M[t]},m=function(){return Object.keys(M).map(k)}}var w=[],E={onSetChildren:function(e,t){var n=l(e);n?void 0:h("144"),n.childIDs=t;for(var r=0;r<t.length;r++){var a=t[r],o=l(a);o?void 0:h("140"),null==o.childIDs&&"object"==typeof o.element&&null!=o.element?h("141"):void 0,o.isMounted?void 0:h("71"),null==o.parentID&&(o.parentID=e),o.parentID!==e?h("142",a,o.parentID,e):void 0}},onBeforeMountComponent:function(e,t,n){var r={element:t,parentID:n,text:null,childIDs:[],isMounted:!1,updateCount:0};u(e,r)},onBeforeUpdateComponent:function(e,t){var n=l(e);n&&n.isMounted&&(n.element=t)},onMountComponent:function(e){var t=l(e);t?void 0:h("144"),t.isMounted=!0;var n=0===t.parentID;n&&f(e)},onUpdateComponent:function(e){var t=l(e);t&&t.isMounted&&t.updateCount++},onUnmountComponent:function(e){var t=l(e);if(t){t.isMounted=!1;var n=0===t.parentID;n&&p(e)}w.push(e)},purgeUnmountedComponents:function(){if(!E._preventPurging){for(var e=0;e<w.length;e++){var t=w[e];a(t)}w.length=0}},isMounted:function(e){var t=l(e);return!!t&&t.isMounted},getCurrentStackAddendum:function(e){var t="";if(e){var n=i(e),r=e._owner;t+=o(n,e._source,r&&r.getName())}var a=_.current,s=a&&a._debugID;return t+=E.getStackAddendumByID(s)},getStackAddendumByID:function(e){for(var t="";e;)t+=s(e),e=E.getParentID(e);return t},getChildIDs:function(e){var t=l(e);return t?t.childIDs:[]},gLine truncated
|
|
||||||
if(p)return"a"});return m()(o)?y.a.createElement(k,a()({},L,{className:v,href:c,onClick:this.handleClick}),b.a.create(d),y.a.createElement(M.a,{description:u,title:h})):y.a.createElement(k,a()({},L,{className:v,href:c,onClick:this.handleClick}),o)}}]),t}(v.Component);E._meta={name:"Step",type:g.d.TYPES.ELEMENT},E.Content=M.a,E.Description=L.a,E.Group=k.a,E.Title=w.a,t.a=E,E.handledProps=["active","as","children","className","completed","description","disabled","href","icon","link","onClick","ordered","title"]},function(e,t,n){"use strict";function r(e){var t=e.children,a=e.className,i=e.description,u=e.title,c=l()("content",a),h=n.i(f.b)(r,e),_=n.i(f.c)(r,e);return s()(t)?d.a.createElement(_,o()({},h,{className:c}),n.i(f.j)(m.a,function(e){return{title:e}},u),n.i(f.j)(p.a,function(e){return{description:e}},i)):d.a.createElement(_,o()({},h,{className:c}),t)}var a=n(1),o=n.n(a),i=n(4),s=n.n(i),u=n(3),l=n.n(u),c=n(0),d=n.n(c),f=n(2),p=n(220),m=n(221);r.handledProps=["as","children","className","description","title"],r._meta={name:"StepContent",parent:"Step",type:f.d.TYPES.ELEMENT},t.a=r},function(e,t,n){"use strict";function r(e){var t=e.children,a=e.className,i=e.fluid,s=e.items,l=e.ordered,d=e.size,p=e.stackable,v=e.vertical,y=f()("ui",d,n.i(h.a)(i,"fluid"),n.i(h.a)(l,"ordered"),n.i(h.a)(v,"vertical"),n.i(h.f)(p,"stackable"),"steps",a),g=n.i(h.b)(r,e),b=n.i(h.c)(r,e);if(!c()(t))return m.a.createElement(b,o()({},g,{className:y}),t);var M=u()(s,function(e){var t=e.key||[e.title,e.description].join("-");return m.a.createElement(_.a,o()({key:t},e))});return m.a.createElement(b,o()({},g,{className:y}),M)}var a=n(1),o=n.n(a),i=n(15),s=(n.n(i),n(20)),u=n.n(s),l=n(4),c=n.n(l),d=n(3),f=n.n(d),p=n(0),m=n.n(p),h=n(2),_=n(401);r.handledProps=["as","children","className","fluid","items","ordered","size","stackable","vertical"],r._meta={name:"StepGroup",parent:"Step",type:h.d.TYPES.ELEMENT},t.a=r},function(e,t,n){"use strict";var r=n(61),a=n.n(r),o="object"===("undefined"==typeof document?"undefined":a()(document))&&null!==document,i="object"===("undefined"==typeof window?"undefined":a()(window))&&null!==window&&window.self===window;t.a=o&&i},function(e,t,n){"use strict";var r=function(){return 0};t.a=r},function(e,t,n){"use strict";function r(e){var t=e.active,a=e.children,i=e.className,u=l()("content",n.i(c.a)(t,"active"),i),d=n.i(c.b)(r,e),f=n.i(c.c)(r,e);return s.a.createElement(f,o()({},d,{className:u}),a)}var a=n(1),o=n.n(a),i=n(0),s=n.n(i),u=n(3),l=n.n(u),c=n(2);r.handledProps=["active","as","children","className"],r.displayName="AccordionContent",r._meta={name:"AccordionContent",type:c.d.TYPES.MODULE,parent:"Accordion"},t.a=r},function(e,t,n){"use strict";var r=n(1),a=n.n(r),o=n(8),i=n.n(o),s=n(9),u=n.n(s),l=n(11),c=n.n(l),d=n(10),f=n.n(d),p=n(3),m=n.n(p),h=n(0),_=n.n(h),v=n(2),y=function(e){function t(){var e,n,r,a;i()(this,t);for(var o=arguments.length,s=Array(o),u=0;u<o;u++)s[u]=arguments[u];return n=r=c()(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(s))),r.handleClick=function(e){var t=r.props.onClick;t&&t(e,r.props)},a=n,c()(r,a)}return f()(t,e),u()(t,[{key:"render",value:function(){var e=this.props,r=e.active,o=e.children,i=e.className,s=m()(n.i(v.a)(r,"active"),"title",i),u=n.i(v.b)(t,this.props),l=n.i(v.c)(t,this.props);return _.a.createElement(l,a()({},u,{className:s,onClick:this.handleClick}),o)}}]),t}(h.Component);y.displayName="AccordionTitle",y._meta={name:"AccordionTitle",type:v.d.TYPES.MODULE,parent:"Accordion"},t.a=y,y.handledProps=["active","as","children","className","onClick"]},function(e,t,n){"use strict";function r(e){var t=e.blurring,a=e.className,i=e.children,u=e.dimmed,d=s()(n.i(c.a)(t,"blurring"),n.i(c.a)(u,"dimmed"),"dimmable",a),f=n.i(c.b)(r,e),p=n.i(c.c)(r,e);return l.a.createElement(p,o()({},f,{className:d}),i)}var a=n(1),o=n.n(a),i=n(3),s=n.n(i),u=n(0),l=n.n(u),c=n(2);r.handledProps=["as","blurring","children","className","dimmed"],r._meta={name:"DimmerDimmable",type:c.d.TYPES.MODULE,parent:"Dimmer"},t.a=r},function(e,t,n){"use strict";var r=n(869);n.d(t,"a",function(){return r.a})},function(e,t,n){"use strict";function r(e){var t=e.className,a=s()("divider",t),i=n.i(c.b)(r,e),u=n.i(c.c)(r,e);return l.a.createElement(u,o()({},i,{className:a}))}var a=n(1),o=n.n(a),i=n(3),s=n.n(i),u=n(0),l=n.n(u),c=n(2);r.handledProps=["as","className"],r._meta={name:"DropdownDivider",parent:"Dropdown",type:c.d.TYPES.MODULE},t.a=r},function(e,t,n){"use strict";function r(e){var t=e.children,a=e.className,i=e.content,u=e.icon,c=l()("header",a),m=n.i(f.b)(r,e),h=n.i(f.c)(r,e);return s()(t)?d.a.createElement(h,o()({},m,{className:c}),p.a.create(u),i):d.a.createElement(h,o()({},m,{className:c}),t)}var a=n(1),o=n.n(a),i=n(4),s=n.n(i),u=n(3),l=n.n(u),c=n(0),d=n.n(c),f=n(2),p=n(21);r.handledProps=["as","children","className","content","icon"],r._meta={name:"DropdownHeader",parent:"Dropdown",type:f.d.TYPES.MODULE},t.a=r},function(e,t,n){"use strict";var r=n(1),a=n.n(r),o=n(8),i=n.nLine truncated
|
|
||||||
value:!0});var r=n(543);n.d(t,"changeLanguage",function(){return a}),n.d(t,"cloneInstance",function(){return o}),n.d(t,"createInstance",function(){return i}),n.d(t,"dir",function(){return s}),n.d(t,"exists",function(){return u}),n.d(t,"getFixedT",function(){return l}),n.d(t,"init",function(){return c}),n.d(t,"loadLanguages",function(){return d}),n.d(t,"loadNamespaces",function(){return f}),n.d(t,"loadResources",function(){return p}),n.d(t,"off",function(){return m}),n.d(t,"on",function(){return h}),n.d(t,"setDefaultNamespace",function(){return _}),n.d(t,"t",function(){return v}),n.d(t,"use",function(){return y}),t.default=r.a;var a=r.a.changeLanguage.bind(r.a),o=r.a.cloneInstance.bind(r.a),i=r.a.createInstance.bind(r.a),s=r.a.dir.bind(r.a),u=r.a.exists.bind(r.a),l=r.a.getFixedT.bind(r.a),c=r.a.init.bind(r.a),d=r.a.loadLanguages.bind(r.a),f=r.a.loadNamespaces.bind(r.a),p=r.a.loadResources.bind(r.a),m=r.a.off.bind(r.a),h=r.a.on.bind(r.a),_=r.a.setDefaultNamespace.bind(r.a),v=r.a.t.bind(r.a),y=r.a.use.bind(r.a)},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var a=n(0),o=r(a),i=n(13),s=function(e){var t=e.i18n,n=e.querySelectList,r=e.page,a=e.permissions,s=e.devs,u=e.addSelect,l=e.showGroup,c=null,d=null;return o.default.createElement(i.Form.Group,{inline:!0},o.default.createElement(i.Form.Field,null,o.default.createElement("label",null,t&&t.t?t.t("page."+(r||"")+".form.label.select_device"):""),o.default.createElement("select",{ref:function(e){return d=e},onChange:function(e){n(e.target.value)}},o.default.createElement("option",{value:""},t&&t.t?t.t("select.dev_type"):""),a.dio?o.default.createElement("option",{value:"do"},t&&t.t?t.t("select.digitoutput"):""):null,a.leone?o.default.createElement("option",{value:"leone"},t&&t.t?t.t("select.leone"):""):null,a.iogroup&&l?o.default.createElement("option",{value:"iogroup"},t&&t.t?t.t("select.iogroup"):""):null)),o.default.createElement(i.Form.Field,null,o.default.createElement("select",{ref:function(e){return c=e}},s.map(function(e,t){return o.default.createElement("option",{key:t,value:e.id||""},e.name||"")}))),o.default.createElement(i.Form.Field,null,o.default.createElement(i.Button,{type:"button",basic:!0,size:"mini",content:t&&t.t?t.t("page."+(r||"")+".form.button.join"):"",onClick:function(){var e="",t="",n="",r="";if(null!=d&&(e=d.options[d.selectedIndex].innerHTML,r="leone"==d.value?"le":d.value),null!=c){if(0==c.options.length)return;t=c.options[c.selectedIndex].innerHTML,n=""+r+c.value}var a={type:e,name:t,id:n};d.value&&e&&t&&u(a)}})))};t.default=s},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var a=n(0),o=r(a),i=n(13),s=function(e){var t=e.obj,n=e.getNext;return o.default.createElement(i.Modal,{open:!(!t||""==t.msg),onClose:function(){return n(t.act)},style:{zIndex:"2001"}},o.default.createElement(i.Modal.Content,null,t&&t.msg?t.msg:""),o.default.createElement(i.Modal.Actions,null,o.default.createElement(i.Button,{onClick:function(){return n(t.act)},content:"OK"})))};t.default=s},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var a=n(0),o=r(a),i=n(13),s=function(e){var t=e.active;return o.default.createElement(i.Dimmer,{active:t,style:{zIndex:"2000"}},o.default.createElement(i.Loader,{size:"large"}))};t.default=s},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var a=n(28),o=n(455),i=r(o),s=n(25),u=function(e){return{obj:e.dialog[0]||null}},l=function(e,t){return{getNext:function(t){"function"==typeof t&&t(),e((0,s.remove_dialog_msg)())}}};t.default=(0,a.connect)(u,l)(i.default)},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var a=n(28),o=n(456),i=r(o),s=function(e){return{active:e.ui.showLoading}};t.default=(0,a.connect)(s)(i.default)},function(e,t,n){"use strict";function r(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}Object.defineProperty(t,"__esModule",{value:!0});var a=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments[1];switch(t.type){case"dialog_addmsg":return[].concat(r(e),[{msg:t.msg,act:t.act||null}]);case"dialog_remove_first":return e.slice(1);default:return e}};t.default=a},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments[1];switch(t.type){case"i18n_set_ctx":return t.i18n;default:return e}};t.default=r},function(e,t,n){"use strict";function r(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments[1];switch(t.type){case"mb_data":return t.id!=e.uid?e:a({},e,{iolist:t.iolist||[],aioset:t.aioset||[Line truncated
|
|
||||||
s.indexOf(t)<0&&s.push(t)))}),n||i.push(e)}),(a.length||o.length)&&this.queue.push({pending:o,loaded:{},errors:[],callback:n}),{toLoad:a,pending:o,toLoadLanguages:i,toLoadNamespaces:s}},t.prototype.loaded=function(e,t,n){var r=this,a=e.split("|"),o=f(a,2),i=o[0],l=o[1];t&&this.emit("failedLoading",i,l,t),n&&this.store.addResourceBundle(i,l,n),this.state[e]=t?-1:2,this.queue.forEach(function(n){u.b(n.loaded,[i],l),s(n.pending,e),t&&n.errors.push(t),0!==n.pending.length||n.done||(r.emit("loaded",n.loaded),n.errors.length?n.callback(n.errors):n.callback(),n.done=!0)}),this.queue=this.queue.filter(function(e){return!e.done})},t.prototype.read=function(e,t,n,r,a,o){var i=this;return r||(r=0),a||(a=250),e.length?void this.backend[n](e,t,function(s,u){return s&&u&&r<5?void setTimeout(function(){i.read.call(i,e,t,n,++r,2*a,o)},a):void o(s,u)}):o(null,{})},t.prototype.load=function(e,t,n){var r=this;if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),n&&n();var a=d({},this.backend.options,this.options.backend);"string"==typeof e&&(e=this.services.languageUtils.toResolveHierarchy(e)),"string"==typeof t&&(t=[t]);var o=this.queueLoad(e,t,n);return o.toLoad.length?void(a.allowMultiLoading&&this.backend.readMulti?this.read(o.toLoadLanguages,o.toLoadNamespaces,"readMulti",null,null,function(e,t){e&&r.logger.warn("loading namespaces "+o.toLoadNamespaces.join(", ")+" for languages "+o.toLoadLanguages.join(", ")+" via multiloading failed",e),!e&&t&&r.logger.log("loaded namespaces "+o.toLoadNamespaces.join(", ")+" for languages "+o.toLoadLanguages.join(", ")+" via multiloading",t),o.toLoad.forEach(function(n){var a=n.split("|"),o=f(a,2),i=o[0],s=o[1],l=u.c(t,[i,s]);if(l)r.loaded(n,e,l);else{var c="loading namespace "+s+" for language "+i+" via multiloading failed";r.loaded(n,c),r.logger.error(c)}})}):!function(){var e=function(e){var t=this,n=e.split("|"),r=f(n,2),a=r[0],o=r[1];this.read(a,o,"read",null,null,function(n,r){n&&t.logger.warn("loading namespace "+o+" for language "+a+" failed",n),!n&&r&&t.logger.log("loaded namespace "+o+" for language "+a,r),t.loaded(e,n,r)})};o.toLoad.forEach(function(t){e.call(r,t)})}()):void(o.pending.length||n())},t.prototype.reload=function(e,t){var n=this;this.backend||this.logger.warn("No backend was added via i18next.use. Will not load resources.");var r=d({},this.backend.options,this.options.backend);"string"==typeof e&&(e=this.services.languageUtils.toResolveHierarchy(e)),"string"==typeof t&&(t=[t]),r.allowMultiLoading&&this.backend.readMulti?this.read(e,t,"readMulti",null,null,function(r,a){r&&n.logger.warn("reloading namespaces "+t.join(", ")+" for languages "+e.join(", ")+" via multiloading failed",r),!r&&a&&n.logger.log("reloaded namespaces "+t.join(", ")+" for languages "+e.join(", ")+" via multiloading",a),e.forEach(function(e){t.forEach(function(t){var o=u.c(a,[e,t]);if(o)n.loaded(e+"|"+t,r,o);else{var i="reloading namespace "+t+" for language "+e+" via multiloading failed";n.loaded(e+"|"+t,i),n.logger.error(i)}})})}):!function(){var r=function(e){var t=this,n=e.split("|"),r=f(n,2),a=r[0],o=r[1];this.read(a,o,"read",null,null,function(n,r){n&&t.logger.warn("reloading namespace "+o+" for language "+a+" failed",n),!n&&r&&t.logger.log("reloaded namespace "+o+" for language "+a,r),t.loaded(e,n,r)})};e.forEach(function(e){t.forEach(function(t){r.call(n,e+"|"+t)})})}()},t.prototype.saveMissing=function(e,t,n,r){this.backend&&this.backend.create&&this.backend.create(e,t,n,r),e&&e[0]&&this.store.addResource(e[0],t,n,r)},t}(c.a);t.a=p},function(e,t,n){"use strict";function r(e,t){for(var n=Object.getOwnPropertyNames(t),r=0;r<n.length;r++){var a=n[r],o=Object.getOwnPropertyDescriptor(t,a);o&&o.configurable&&void 0===e[a]&&Object.defineProperty(e,a,o)}return e}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):r(e,t))}var s=(n(83),n(46)),u=n(82),l=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},c=function(e){function t(n,r,i){var u=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};a(this,t);var l=o(this,e.call(this));return l.cache=n,l.store=r,l.services=i,l.options=u,l.logger=s.a.create("cacheConnector"),l.cache&&l.cache.init&&l.cache.init(i,u.cache,u),l}return i(t,e),t.prototype.load=function(e,t,n){var r=this;if(!this.cache)return n&&n();var a=l({},this.cache.options,this.options.cache);"string"==typeof e&&(e=this.sLine truncated
|
|
||||||
},t.prototype.loadLanguages=function(e,t){"string"==typeof e&&(e=[e]);var n=this.options.preload||[],r=e.filter(function(e){return n.indexOf(e)<0});return r.length?(this.options.preload=n.concat(r),void this.loadResources(t)):t()},t.prototype.dir=function(e){if(e||(e=this.language),!e)return"rtl";var t=["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam"];return t.indexOf(this.services.languageUtils.getLanguagePartFromCode(e))>=0?"rtl":"ltr"},t.prototype.createInstance=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments[1];return new t(e,n)},t.prototype.cloneInstance=function(){var e=this,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:s,a=M({},n,this.options,{isClone:!0}),o=new t(a,r),i=["store","services","language"];return i.forEach(function(t){o[t]=e[t]}),o.translator=new d.a(o.services,o.options),o.translator.on("*",function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];o.emit.apply(o,[e].concat(n))}),o.init(a,r),o},t}(l.a);t.a=new L},function(e,t,n){"use strict";function r(e){return null==e?void 0===e?u:s:l&&l in Object(e)?n.i(o.a)(e):n.i(i.a)(e)}var a=n(262),o=n(547),i=n(548),s="[object Null]",u="[object Undefined]",l=a.a?a.a.toStringTag:void 0;t.a=r},function(e,t,n){"use strict";(function(e){var n="object"==typeof e&&e&&e.Object===Object&&e;t.a=n}).call(t,n(238))},function(e,t,n){"use strict";var r=n(549),a=n.i(r.a)(Object.getPrototypeOf,Object);t.a=a},function(e,t,n){"use strict";function r(e){var t=i.call(e,u),n=e[u];try{e[u]=void 0;var r=!0}catch(e){}var a=s.call(e);return r&&(t?e[u]=n:delete e[u]),a}var a=n(262),o=Object.prototype,i=o.hasOwnProperty,s=o.toString,u=a.a?a.a.toStringTag:void 0;t.a=r},function(e,t,n){"use strict";function r(e){return o.call(e)}var a=Object.prototype,o=a.toString;t.a=r},function(e,t,n){"use strict";function r(e,t){return function(n){return e(t(n))}}t.a=r},function(e,t,n){"use strict";var r=n(545),a="object"==typeof self&&self&&self.Object===Object&&self,o=r.a||a||Function("return this")();t.a=o},function(e,t,n){"use strict";function r(e){return null!=e&&"object"==typeof e}t.a=r},function(e,t,n){var r=n(57),a=n(23),o=r(a,"DataView");e.exports=o},function(e,t,n){function r(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}var a=n(631),o=n(632),i=n(633),s=n(634),u=n(635);r.prototype.clear=a,r.prototype.delete=o,r.prototype.get=i,r.prototype.has=s,r.prototype.set=u,e.exports=r},function(e,t,n){var r=n(57),a=n(23),o=r(a,"Promise");e.exports=o},function(e,t){function n(e,t){return e.set(t[0],t[1]),e}e.exports=n},function(e,t){function n(e,t){return e.add(t),e}e.exports=n},function(e,t){function n(e,t){for(var n=-1,r=null==e?0:e.length;++n<r;)if(!t(e[n],n,e))return!1;return!0}e.exports=n},function(e,t){function n(e){return e.split("")}e.exports=n},function(e,t){function n(e){return e.match(r)||[]}var r=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;e.exports=n},function(e,t,n){function r(e,t){return e&&a(t,o(t),e)}var a=n(67),o=n(317);e.exports=r},function(e,t,n){function r(e,t){var n=!0;return a(e,function(e,r,a){return n=!!t(e,r,a)}),n}var a=n(66);e.exports=r},function(e,t,n){function r(e,t,n){for(var r=-1,o=e.length;++r<o;){var i=e[r],s=t(i);if(null!=s&&(void 0===u?s===s&&!a(s):n(s,u)))var u=s,l=i}return l}var a=n(59);e.exports=r},function(e,t,n){function r(e,t){var n=[];return a(e,function(e,r,a){t(e,r,a)&&n.push(e)}),n}var a=n(66);e.exports=r},function(e,t,n){var r=n(612),a=r();e.exports=a},function(e,t){function n(e,t){return null!=e&&a.call(e,t)}var r=Object.prototype,a=r.hasOwnProperty;e.exports=n},function(e,t){function n(e,t){return null!=e&&t in Object(e)}e.exports=n},function(e,t){function n(e,t,n){return e>=a(t,n)&&e<r(t,n)}var r=Math.max,a=Math.min;e.exports=n},function(e,t,n){function r(e,t,n){for(var r=n?i:o,d=e[0].length,f=e.length,p=f,m=Array(f),h=1/0,_=[];p--;){var v=e[p];p&&t&&(v=s(v,u(t))),h=c(v.length,h),m[p]=!n&&(t||d>=120&&v.length>=120)?new a(p&&v):void 0}v=e[0];var y=-1,g=m[0];e:for(;++y<d&&_.length<h;){var b=v[y],M=t?t(b):b;if(b=n||0!==b?b:0,!(g?l(g,M):r(_,M,n))){for(p=f;--p;){var L=m[p];if(!(L?l(L,M):r(e[p],M,n)))continue e}g&&g.push(M),_.push(b)}}return _}var a=n(100),o=n(102),i=n(172),s=n(36),u=n(109),l=n(110),c=Math.min;e.exports=r},function(e,t,n){function r(e,t,n){t=o(t,e),e=s(e,t);var r=null==e?e:e[u(i(t))];return null==r?void 0:a(r,e,n)}var a=n(101),o=n(56),i=n(318),s=n(300),u=n(50);e.exports=r},function(e,t,n){function r(e){return o(e)&&a(e)==i}var a=n(48),o=n(34),i="[object Arguments]";e.exports=r},function(e,t,n){function r(e,t,n,r,_,y){var g=l(e),b=l(t),M=g?m:u(e),L=b?Line truncated
|
|
||||||
fixed:!("fixed"in f)||f.fixed,immutable:!("immutable"in f)||f.immutable,rearg:!("rearg"in f)||f.rearg},D="curry"in f&&f.curry,x="fixed"in f&&f.fixed,Y="rearg"in f&&f.rearg,C=E?n:d,O=E?n.runInContext():void 0,P=E?n:{ary:e.ary,assign:e.assign,clone:e.clone,curry:e.curry,forEach:e.forEach,isArray:e.isArray,isFunction:e.isFunction,iteratee:e.iteratee,keys:e.keys,rearg:e.rearg,toInteger:e.toInteger,toPath:e.toPath},j=P.ary,N=P.assign,A=P.clone,I=P.curry,H=P.forEach,R=P.isArray,F=P.isFunction,W=P.keys,U=P.rearg,z=P.toInteger,B=P.toPath,V=W(c.aryMethod),q={castArray:function(e){return function(){var t=arguments[0];return R(t)?e(o(t)):e.apply(void 0,arguments)}},iteratee:function(e){return function(){var t=arguments[0],n=arguments[1],r=e(t,n),o=r.length;return S.cap&&"number"==typeof n?(n=n>2?n-2:1,o&&o<=n?r:a(r,n)):r}},mixin:function(e){return function(t){var n=this;if(!F(n))return e(n,Object(t));var r=[];return H(W(t),function(e){F(t[e])&&r.push([e,n.prototype[e]])}),e(n,Object(t)),H(r,function(e){var t=e[1];F(t)?n.prototype[e[0]]=t:delete n.prototype[e[0]]}),n}},nthArg:function(e){return function(t){var n=t<0?1:z(t)+1;return I(e(t),n)}},rearg:function(e){return function(t,n){var r=n?n.length:0;return I(e(t,n),r)}},runInContext:function(t){return function(n){return l(e,t(n),f)}}};if(!T)return k(t,n);var G=n,J=[];return H(V,function(e){H(c.aryMethod[e],function(e){var t=G[c.remap[e]||e];t&&J.push([e,k(e,t)])})}),H(W(G),function(e){var t=G[e];if("function"==typeof t){for(var n=J.length;n--;)if(J[n][0]==e)return;t.convert=g(e,t),J.push([e,t])}}),H(J,function(e){G[e[0]]=e[1]}),G.convert=y,w&&(G.placeholder=C),H(W(G),function(e){H(c.realToAlias[e]||[],function(t){G[t]=G[e]})}),G}var c=n(687),d=n(17),f=Array.prototype.push;e.exports=l},function(e,t){t.aliasToReal={each:"forEach",eachRight:"forEachRight",entries:"toPairs",entriesIn:"toPairsIn",extend:"assignIn",extendAll:"assignInAll",extendAllWith:"assignInAllWith",extendWith:"assignInWith",first:"head",conforms:"conformsTo",matches:"isMatch",property:"get",__:"placeholder",F:"stubFalse",T:"stubTrue",all:"every",allPass:"overEvery",always:"constant",any:"some",anyPass:"overSome",apply:"spread",assoc:"set",assocPath:"set",complement:"negate",compose:"flowRight",contains:"includes",dissoc:"unset",dissocPath:"unset",dropLast:"dropRight",dropLastWhile:"dropRightWhile",equals:"isEqual",identical:"eq",indexBy:"keyBy",init:"initial",invertObj:"invert",juxt:"over",omitAll:"omit",nAry:"ary",path:"get",pathEq:"matchesProperty",pathOr:"getOr",paths:"at",pickAll:"pick",pipe:"flow",pluck:"map",prop:"get",propEq:"matchesProperty",propOr:"getOr",props:"at",symmetricDifference:"xor",symmetricDifferenceBy:"xorBy",symmetricDifferenceWith:"xorWith",takeLast:"takeRight",takeLastWhile:"takeRightWhile",unapply:"rest",unnest:"flatten",useWith:"overArgs",where:"conformsTo",whereEq:"isMatch",zipObj:"zipObject"},t.aryMethod={1:["assignAll","assignInAll","attempt","castArray","ceil","create","curry","curryRight","defaultsAll","defaultsDeepAll","floor","flow","flowRight","fromPairs","invert","iteratee","memoize","method","mergeAll","methodOf","mixin","nthArg","over","overEvery","overSome","rest","reverse","round","runInContext","spread","template","trim","trimEnd","trimStart","uniqueId","words","zipAll"],2:["add","after","ary","assign","assignAllWith","assignIn","assignInAllWith","at","before","bind","bindAll","bindKey","chunk","cloneDeepWith","cloneWith","concat","conformsTo","countBy","curryN","curryRightN","debounce","defaults","defaultsDeep","defaultTo","delay","difference","divide","drop","dropRight","dropRightWhile","dropWhile","endsWith","eq","every","filter","find","findIndex","findKey","findLast","findLastIndex","findLastKey","flatMap","flatMapDeep","flattenDepth","forEach","forEachRight","forIn","forInRight","forOwn","forOwnRight","get","groupBy","gt","gte","has","hasIn","includes","indexOf","intersection","invertBy","invoke","invokeMap","isEqual","isMatch","join","keyBy","lastIndexOf","lt","lte","map","mapKeys","mapValues","matchesProperty","maxBy","meanBy","merge","mergeAllWith","minBy","multiply","nth","omit","omitBy","overArgs","pad","padEnd","padStart","parseInt","partial","partialRight","partition","pick","pickBy","propertyOf","pull","pullAll","pullAt","random","range","rangeRight","rearg","reject","remove","repeat","restFrom","result","sampleSize","some","sortBy","sortedIndex","sortedIndexOf","sortedLastIndex","sortedLastIndexOf","sortedUniqBy","split","spreadFrom","startsWith","subtract","sumBy","take","takeRight","takeRightWhile","takeWhile","tap","throttle","thru","times","trimChars","trimCharsEnd","trimCharsStart","truncate","union","uniqBy","uniqWith","unset","unzipWith","without","wrap","xor","zip","zipObject","zipObjectDeep"],3:["assignInWith","assignWith","clamp","differenceBy","differenceWith","findFrom","findIndexFrom","findLastFrom","findLastIndexFrom","getOr","includesFrom","indexOfFrom","inRange","intersectionBy","intersectionWith","invokeArgs","invokeArgsMap","isEqLine truncated
|
|
||||||
this._performComponentUpdate(n,c,d,i,e,a)):(this._currentElement=n,this._context=a,o.props=c,o.state=d,o.context=i)},_processPendingState:function(e,t){var n=this._instance,r=this._pendingStateQueue,a=this._pendingReplaceState;if(this._pendingReplaceState=!1,this._pendingStateQueue=null,!r)return n.state;if(a&&1===r.length)return r[0];for(var o=u({},a?r[0]:n.state),i=a?1:0;i<r.length;i++){var s=r[i];u(o,"function"==typeof s?s.call(n,o,e,t):s)}return o},_performComponentUpdate:function(e,t,n,r,a,o){var i,s,u,l=this._instance,c=Boolean(l.componentDidUpdate);c&&(i=l.props,s=l.state,u=l.context),l.componentWillUpdate&&l.componentWillUpdate(t,n,r),this._currentElement=e,this._context=o,l.props=t,l.state=n,l.context=r,this._updateRenderedComponent(a,o),c&&a.getReactMountReady().enqueue(l.componentDidUpdate.bind(l,i,s,u),l)},_updateRenderedComponent:function(e,t){var n=this._renderedComponent,r=n._currentElement,a=this._renderValidatedComponent(),o=0;if(y(r,a))h.receiveComponent(n,a,e,this._processChildContext(t));else{var i=h.getHostNode(n);h.unmountComponent(n,!1);var s=m.getType(a);this._renderedNodeType=s;var u=this._instantiateReactComponent(a,s!==m.EMPTY);this._renderedComponent=u;var l=h.mountComponent(u,e,this._hostParent,this._hostContainerInfo,this._processChildContext(t),o);this._replaceNodeWithMarkup(i,l,n)}},_replaceNodeWithMarkup:function(e,t,n){c.replaceNodeWithMarkup(e,t,n)},_renderValidatedComponentWithoutOwnerOrContext:function(){var e,t=this._instance;return e=t.render()},_renderValidatedComponent:function(){var e;if(this._compositeType!==g.StatelessFunctional){d.current=this;try{e=this._renderValidatedComponentWithoutOwnerOrContext()}finally{d.current=null}}else e=this._renderValidatedComponentWithoutOwnerOrContext();return null===e||e===!1||l.isValidElement(e)?void 0:s("109",this.getName()||"ReactCompositeComponent"),e},attachRef:function(e,t){var n=this.getPublicInstance();null==n?s("110"):void 0;var r=t.getPublicInstance(),a=n.refs===_?n.refs={}:n.refs;a[e]=r},detachRef:function(e){var t=this.getPublicInstance().refs;delete t[e]},getName:function(){var e=this._currentElement.type,t=this._instance&&this._instance.constructor;return e.displayName||t&&t.displayName||e.name||t&&t.name||null},getPublicInstance:function(){var e=this._instance;return this._compositeType===g.StatelessFunctional?null:e},_instantiateReactComponent:null};e.exports=M},function(e,t,n){"use strict";var r=n(19),a=n(754),o=n(336),i=n(72),s=n(35),u=n(767),l=n(783),c=n(341),d=n(791);n(7);a.inject();var f={findDOMNode:l,render:o.render,unmountComponentAtNode:o.unmountComponentAtNode,version:u,unstable_batchedUpdates:s.batchedUpdates,unstable_renderSubtreeIntoContainer:d};"undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.inject&&__REACT_DEVTOOLS_GLOBAL_HOOK__.inject({ComponentTree:{getClosestInstanceFromNode:r.getClosestInstanceFromNode,getNodeFromInstance:function(e){return e._renderedComponent&&(e=c(e)),e?r.getNodeFromInstance(e):null}},Mount:o,Reconciler:i});e.exports=f},function(e,t,n){"use strict";function r(e){if(e){var t=e._currentElement._owner||null;if(t){var n=t.getName();if(n)return" This DOM node was rendered by `"+n+"`."}}return""}function a(e,t){t&&(J[e._tag]&&(null!=t.children||null!=t.dangerouslySetInnerHTML?h("137",e._tag,e._currentElement._owner?" Check the render method of "+e._currentElement._owner.getName()+".":""):void 0),null!=t.dangerouslySetInnerHTML&&(null!=t.children?h("60"):void 0,"object"==typeof t.dangerouslySetInnerHTML&&U in t.dangerouslySetInnerHTML?void 0:h("61")),null!=t.style&&"object"!=typeof t.style?h("62",r(e)):void 0)}function o(e,t,n,r){if(!(r instanceof P)){var a=e._hostContainerInfo,o=a._node&&a._node.nodeType===B,s=o?a._node:a._ownerDocument;H(t,s),r.getReactMountReady().enqueue(i,{inst:e,registrationName:t,listener:n})}}function i(){var e=this;k.putListener(e.inst,e.registrationName,e.listener)}function s(){var e=this;D.postMountWrapper(e)}function u(){var e=this;C.postMountWrapper(e)}function l(){var e=this;x.postMountWrapper(e)}function c(){var e=this;e._rootNodeID?void 0:h("63");var t=I(e);switch(t?void 0:h("64"),e._tag){case"iframe":case"object":e._wrapperState.listeners=[E.trapBubbledEvent("topLoad","load",t)];break;case"video":case"audio":e._wrapperState.listeners=[];for(var n in V)V.hasOwnProperty(n)&&e._wrapperState.listeners.push(E.trapBubbledEvent(n,V[n],t));break;case"source":e._wrapperState.listeners=[E.trapBubbledEvent("topError","error",t)];break;case"img":e._wrapperState.listeners=[E.trapBubbledEvent("topError","error",t),E.trapBubbledEvent("topLoad","load",t)];break;case"form":e._wrapperState.listeners=[E.trapBubbledEvent("topReset","reset",t),E.trapBubbledEvent("topSubmit","submit",t)];break;case"input":case"select":case"textarea":e._wrapperState.listeners=[E.trapBubbledEvent("topInvalid","invalid",t)]}}function d(){Y.postUpdateWrapper(this)}function f(e){Q.call($,e)||(K.test(e)?void 0:h("65",e),$[e]=!0)}function pLine truncated
|
|
||||||
var r={xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace"},a={accentHeight:"accent-height",accumulate:0,additive:0,alignmentBaseline:"alignment-baseline",allowReorder:"allowReorder",alphabetic:0,amplitude:0,arabicForm:"arabic-form",ascent:0,attributeName:"attributeName",attributeType:"attributeType",autoReverse:"autoReverse",azimuth:0,baseFrequency:"baseFrequency",baseProfile:"baseProfile",baselineShift:"baseline-shift",bbox:0,begin:0,bias:0,by:0,calcMode:"calcMode",capHeight:"cap-height",clip:0,clipPath:"clip-path",clipRule:"clip-rule",clipPathUnits:"clipPathUnits",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",contentScriptType:"contentScriptType",contentStyleType:"contentStyleType",cursor:0,cx:0,cy:0,d:0,decelerate:0,descent:0,diffuseConstant:"diffuseConstant",direction:0,display:0,divisor:0,dominantBaseline:"dominant-baseline",dur:0,dx:0,dy:0,edgeMode:"edgeMode",elevation:0,enableBackground:"enable-background",end:0,exponent:0,externalResourcesRequired:"externalResourcesRequired",fill:0,fillOpacity:"fill-opacity",fillRule:"fill-rule",filter:0,filterRes:"filterRes",filterUnits:"filterUnits",floodColor:"flood-color",floodOpacity:"flood-opacity",focusable:0,fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",format:0,from:0,fx:0,fy:0,g1:0,g2:0,glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",glyphRef:"glyphRef",gradientTransform:"gradientTransform",gradientUnits:"gradientUnits",hanging:0,horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",ideographic:0,imageRendering:"image-rendering",in:0,in2:0,intercept:0,k:0,k1:0,k2:0,k3:0,k4:0,kernelMatrix:"kernelMatrix",kernelUnitLength:"kernelUnitLength",kerning:0,keyPoints:"keyPoints",keySplines:"keySplines",keyTimes:"keyTimes",lengthAdjust:"lengthAdjust",letterSpacing:"letter-spacing",lightingColor:"lighting-color",limitingConeAngle:"limitingConeAngle",local:0,markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",markerHeight:"markerHeight",markerUnits:"markerUnits",markerWidth:"markerWidth",mask:0,maskContentUnits:"maskContentUnits",maskUnits:"maskUnits",mathematical:0,mode:0,numOctaves:"numOctaves",offset:0,opacity:0,operator:0,order:0,orient:0,orientation:0,origin:0,overflow:0,overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pathLength:"pathLength",patternContentUnits:"patternContentUnits",patternTransform:"patternTransform",patternUnits:"patternUnits",pointerEvents:"pointer-events",points:0,pointsAtX:"pointsAtX",pointsAtY:"pointsAtY",pointsAtZ:"pointsAtZ",preserveAlpha:"preserveAlpha",preserveAspectRatio:"preserveAspectRatio",primitiveUnits:"primitiveUnits",r:0,radius:0,refX:"refX",refY:"refY",renderingIntent:"rendering-intent",repeatCount:"repeatCount",repeatDur:"repeatDur",requiredExtensions:"requiredExtensions",requiredFeatures:"requiredFeatures",restart:0,result:0,rotate:0,rx:0,ry:0,scale:0,seed:0,shapeRendering:"shape-rendering",slope:0,spacing:0,specularConstant:"specularConstant",specularExponent:"specularExponent",speed:0,spreadMethod:"spreadMethod",startOffset:"startOffset",stdDeviation:"stdDeviation",stemh:0,stemv:0,stitchTiles:"stitchTiles",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",string:0,stroke:0,strokeDasharray:"stroke-dasharray",strokeDashoffset:"stroke-dashoffset",strokeLinecap:"stroke-linecap",strokeLinejoin:"stroke-linejoin",strokeMiterlimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",surfaceScale:"surfaceScale",systemLanguage:"systemLanguage",tableValues:"tableValues",targetX:"targetX",targetY:"targetY",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",textLength:"textLength",to:0,transform:0,u1:0,u2:0,underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicode:0,unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",values:0,vectorEffect:"vector-effect",version:0,vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",viewBox:"viewBox",viewTarget:"viewTarget",visibility:0,widths:0,wordSpacing:"word-spacing",writingMode:"writing-mode",x:0,xHeight:"x-height",x1:0,x2:0,xChannelSelector:"xChannelSelector",xlinkActuate:"xlink:actuate",xlinkArcrole:"xlink:arcrole",xlinkHref:"xlink:href",xlinkRole:"xlink:role",xlinkShow:"xlink:show",xlinkTitle:"xlink:title",xlinkType:"xlink:type",xmlBase:"xml:base",xmlns:0,xmlnsXlink:"xmlns:xlink",xmlLang:"xml:lang",xLine truncated
|
|
||||||
meter:a("meter"),nav:a("nav"),noscript:a("noscript"),object:a("object"),ol:a("ol"),optgroup:a("optgroup"),option:a("option"),output:a("output"),p:a("p"),param:a("param"),picture:a("picture"),pre:a("pre"),progress:a("progress"),q:a("q"),rp:a("rp"),rt:a("rt"),ruby:a("ruby"),s:a("s"),samp:a("samp"),script:a("script"),section:a("section"),select:a("select"),small:a("small"),source:a("source"),span:a("span"),strong:a("strong"),style:a("style"),sub:a("sub"),summary:a("summary"),sup:a("sup"),table:a("table"),tbody:a("tbody"),td:a("td"),textarea:a("textarea"),tfoot:a("tfoot"),th:a("th"),thead:a("thead"),time:a("time"),title:a("title"),tr:a("tr"),track:a("track"),u:a("u"),ul:a("ul"),var:a("var"),video:a("video"),wbr:a("wbr"),circle:a("circle"),clipPath:a("clipPath"),defs:a("defs"),ellipse:a("ellipse"),g:a("g"),image:a("image"),line:a("line"),linearGradient:a("linearGradient"),mask:a("mask"),path:a("path"),pattern:a("pattern"),polygon:a("polygon"),polyline:a("polyline"),radialGradient:a("radialGradient"),rect:a("rect"),stop:a("stop"),svg:a("svg"),text:a("text"),tspan:a("tspan")};e.exports=o},function(e,t,n){"use strict";function r(e,t){return e===t?0!==e||1/e===1/t:e!==e&&t!==t}function a(e){this.message=e,this.stack=""}function o(e){function t(t,n,r,o,i,s,u){o=o||T,s=s||r;if(null==n[r]){var l=L[i];return t?new a(null===n[r]?"The "+l+" `"+s+"` is marked as required "+("in `"+o+"`, but its value is `null`."):"The "+l+" `"+s+"` is marked as required in "+("`"+o+"`, but its value is `undefined`.")):null}return e(n,r,o,i,s)}var n=t.bind(null,!1);return n.isRequired=t.bind(null,!0),n}function i(e){function t(t,n,r,o,i,s){var u=t[n],l=y(u);if(l!==e){var c=L[o],d=g(u);return new a("Invalid "+c+" `"+i+"` of type "+("`"+d+"` supplied to `"+r+"`, expected ")+("`"+e+"`."))}return null}return o(t)}function s(){return o(w.thatReturns(null))}function u(e){function t(t,n,r,o,i){if("function"!=typeof e)return new a("Property `"+i+"` of component `"+r+"` has invalid PropType notation inside arrayOf.");var s=t[n];if(!Array.isArray(s)){var u=L[o],l=y(s);return new a("Invalid "+u+" `"+i+"` of type "+("`"+l+"` supplied to `"+r+"`, expected an array."))}for(var c=0;c<s.length;c++){var d=e(s,c,r,o,i+"["+c+"]",k);if(d instanceof Error)return d}return null}return o(t)}function l(){function e(e,t,n,r,o){var i=e[t];if(!M.isValidElement(i)){var s=L[r],u=y(i);return new a("Invalid "+s+" `"+o+"` of type "+("`"+u+"` supplied to `"+n+"`, expected a single ReactElement."))}return null}return o(e)}function c(e){function t(t,n,r,o,i){if(!(t[n]instanceof e)){var s=L[o],u=e.name||T,l=b(t[n]);return new a("Invalid "+s+" `"+i+"` of type "+("`"+l+"` supplied to `"+r+"`, expected ")+("instance of `"+u+"`."))}return null}return o(t)}function d(e){function t(t,n,o,i,s){for(var u=t[n],l=0;l<e.length;l++)if(r(u,e[l]))return null;var c=L[i],d=JSON.stringify(e);return new a("Invalid "+c+" `"+s+"` of value `"+u+"` "+("supplied to `"+o+"`, expected one of "+d+"."))}return Array.isArray(e)?o(t):w.thatReturnsNull}function f(e){function t(t,n,r,o,i){if("function"!=typeof e)return new a("Property `"+i+"` of component `"+r+"` has invalid PropType notation inside objectOf.");var s=t[n],u=y(s);if("object"!==u){var l=L[o];return new a("Invalid "+l+" `"+i+"` of type "+("`"+u+"` supplied to `"+r+"`, expected an object."))}for(var c in s)if(s.hasOwnProperty(c)){var d=e(s,c,r,o,i+"."+c,k);if(d instanceof Error)return d}return null}return o(t)}function p(e){function t(t,n,r,o,i){for(var s=0;s<e.length;s++){var u=e[s];if(null==u(t,n,r,o,i,k))return null}var l=L[o];return new a("Invalid "+l+" `"+i+"` supplied to "+("`"+r+"`."))}return Array.isArray(e)?o(t):w.thatReturnsNull}function m(){function e(e,t,n,r,o){if(!_(e[t])){var i=L[r];return new a("Invalid "+i+" `"+o+"` supplied to "+("`"+n+"`, expected a ReactNode."))}return null}return o(e)}function h(e){function t(t,n,r,o,i){var s=t[n],u=y(s);if("object"!==u){var l=L[o];return new a("Invalid "+l+" `"+i+"` of type `"+u+"` "+("supplied to `"+r+"`, expected `object`."))}for(var c in e){var d=e[c];if(d){var f=d(s,c,r,o,i+"."+c,k);if(f)return f}}return null}return o(t)}function _(e){switch(typeof e){case"number":case"string":case"undefined":return!0;case"boolean":return!e;case"object":if(Array.isArray(e))return e.every(_);if(null===e||M.isValidElement(e))return!0;var t=E(e);if(!t)return!1;var n,r=t.call(e);if(t!==e.entries){for(;!(n=r.next()).done;)if(!_(n.value))return!1}else for(;!(n=r.next()).done;){var a=n.value;if(a&&!_(a[1]))return!1}return!0;default:return!1}}function v(e,t){return"symbol"===e||("Symbol"===t["@@toStringTag"]||"function"==typeof Symbol&&t instanceof Symbol)}function y(e){var t=typeof e;return Array.isArray(e)?"array":e instanceof RegExp?"object":v(t,e)?"symbol":t}function g(e){var t=y(e);if("object"===t){if(e instanceof Date)return"date";if(e instanceof RegExp)return"regexp"}return t}function b(e){return e.constructor&&e.constructor.name?e.constructor.name:T}var M=n(74),L=n(355),k=n(810),w=n(29),E=n(357),T=(n(7Line truncated
|
|
||||||
if(!u()(i))return f.a.createElement(Y,o()({},x,{className:D}),i);var C=m.a.create(M),O=h.a.create(L),P=_.a.create(T);return C||O?f.a.createElement(Y,o()({},x,{className:D}),C||O,(d||P)&&f.a.createElement(v.a,null,d,P)):f.a.createElement(Y,o()({},x,{className:D}),d,P)}var a=n(1),o=n.n(a),i=n(15),s=(n.n(i),n(4)),u=n.n(s),l=n(3),c=n.n(l),d=n(0),f=n.n(d),p=n(2),m=n(21),h=n(76),_=n(391),v=n(390);r.handledProps=["as","attached","block","children","className","color","content","disabled","dividing","floated","icon","image","inverted","size","sub","subheader","textAlign"],r._meta={name:"Header",type:p.d.TYPES.ELEMENT},r.Content=v.a,r.Subheader=_.a,t.a=r},function(e,t,n){"use strict";var r=n(841);n.d(t,"a",function(){return r.a})},function(e,t,n){"use strict";var r=n(1),a=n.n(r),o=n(8),i=n.n(o),s=n(9),u=n.n(s),l=n(11),c=n.n(l),d=n(10),f=n.n(d),p=n(89),m=n.n(p),h=n(20),_=n.n(h),v=n(4),y=n.n(v),g=n(128),b=n.n(g),M=n(127),L=n.n(M),k=n(68),w=n.n(k),E=n(0),T=n.n(E),S=n(3),D=n.n(S),x=n(2),Y=n(215),C=n(21),O=n(139),P=["selected","defaultValue","defaultChecked","autoCapitalize","autoComplete","autoFocus","checked","form","max","maxLength","min","name","pattern","placeholder","readOnly","required","step","type","value","onKeyDown","onKeyPress","onKeyUp","onFocus","onBlur","onChange","onInput","onClick","onContextMenu","onDrag","onDragEnd","onDragEnter","onDragExit","onDragLeave","onDragOver","onDragStart","onDrop","onMouseDown","onMouseEnter","onMouseLeave","onMouseMove","onMouseOut","onMouseOver","onMouseUp","onSelect","onTouchCancel","onTouchEnd","onTouchMove","onTouchStart"],j=function(e){function t(){var e,n,r,o;i()(this,t);for(var s=arguments.length,u=Array(s),l=0;l<s;l++)u[l]=arguments[l];return n=r=c()(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(u))),r.handleChange=function(e){var t=w()(e,"target.value"),n=r.props.onChange;n&&n(e,a()({},r.props,{value:t}))},o=n,c()(r,o)}return f()(t,e),u()(t,[{key:"render",value:function(){var e=this.props,r=e.action,o=e.actionPosition,i=e.children,s=e.className,u=e.disabled,l=e.error,c=e.fluid,d=e.focus,f=e.icon,p=e.iconPosition,h=e.input,v=e.inverted,g=e.label,M=e.labelPosition,k=e.loading,w=e.onChange,S=e.size,j=e.tabIndex,N=e.transparent,A=e.type,I=D()("ui",S,n.i(x.a)(u,"disabled"),n.i(x.a)(l,"error"),n.i(x.a)(c,"fluid"),n.i(x.a)(d,"focus"),n.i(x.a)(v,"inverted"),n.i(x.a)(k,"loading"),n.i(x.a)(N,"transparent"),n.i(x.f)(o,"action")||n.i(x.a)(r,"action"),n.i(x.f)(p,"icon")||n.i(x.a)(f,"icon"),n.i(x.f)(M,"labeled")||n.i(x.a)(g,"labeled"),"input",s),H=n.i(x.b)(t,this.props),R=L()(H,P),F=b()(this.props,P);w&&(F.onChange=this.handleChange);var W=n.i(x.c)(t,this.props);if(y()(j)?u&&(F.tabIndex=-1):F.tabIndex=j,!y()(i)){var U=_()(E.Children.toArray(i),function(e){return"input"!==e.type?e:n.i(E.cloneElement)(e,a()({},F,e.props))});return T.a.createElement(W,a()({},R,{className:I}),U)}var z=Y.a.create(r,function(e){return{className:D()(!m()(e.className,"button")&&"button")}}),B=C.a.create(f),V=O.a.create(g,function(e){return{className:D()(!m()(e.className,"label")&&"label",m()(M,"corner")&&M)}});return T.a.createElement(W,a()({},R,{className:I}),"left"===o&&z,"left"===p&&B,"right"!==M&&V,n.i(x.t)(h||A,F),"left"!==o&&z,"left"!==p&&B,"right"===M&&V)}}]),t}(E.Component);j.defaultProps={type:"text"},j._meta={name:"Input",type:x.d.TYPES.ELEMENT},j.handledProps=["action","actionPosition","as","children","className","disabled","error","fluid","focus","icon","iconPosition","input","inverted","label","labelPosition","loading","onChange","size","tabIndex","transparent","type"],j.create=n.i(x.g)(j,function(e){return{type:e}}),t.a=j},function(e,t,n){"use strict";function r(e){var t=e.animated,a=e.bulleted,i=e.celled,u=e.children,c=e.className,f=e.divided,h=e.floated,_=e.horizontal,v=e.inverted,y=e.items,b=e.link,M=e.ordered,L=e.relaxed,k=e.selection,w=e.size,E=e.verticalAlign,T=d()("ui",w,n.i(m.a)(t,"animated"),n.i(m.a)(a,"bulleted"),n.i(m.a)(i,"celled"),n.i(m.a)(f,"divided"),n.i(m.a)(_,"horizontal"),n.i(m.a)(v,"inverted"),n.i(m.a)(b,"link"),n.i(m.a)(M,"ordered"),n.i(m.a)(k,"selection"),n.i(m.h)(L,"relaxed"),n.i(m.f)(h,"floated"),n.i(m.i)(E),"list",c),S=n.i(m.b)(r,e),D=n.i(m.c)(r,e);return l()(u)?p.a.createElement(D,o()({},S,{role:"list",className:T}),s()(y,function(e){return g.a.create(e)})):p.a.createElement(D,o()({},S,{role:"list",className:T}),u)}var a=n(1),o=n.n(a),i=n(20),s=n.n(i),u=n(4),l=n.n(u),c=n(3),d=n.n(c),f=n(0),p=n.n(f),m=n(2),h=n(218),_=n(140),v=n(141),y=n(219),g=n(397),b=n(398);r.handledProps=["animated","as","bulleted","celled","children","className","divided","floated","horizontal","inverted","items","link","ordered","relaxed","selection","size","verticalAlign"],r._meta={name:"List",type:m.d.TYPES.ELEMENT},r.Content=h.a,r.Description=_.a,r.Header=v.a,r.Icon=y.a,r.Item=g.a,r.List=b.a,t.a=r},function(e,t,n){"use strict";var r=n(844);n.d(t,"a",function(){return r.a})},function(e,t,n){"use strict";function r(e){var t=e.active,a=e.children,i=e.className,u=e.cLine truncated
|
|
||||||
{v:n.i(C.cloneElement)(e,i()({},e.props,{active:a,onClick:o}))}}();if("object"===("undefined"==typeof u?"undefined":a()(u)))return u.v}if(s){var c=w()(e,"props.active")?e.props.active:l.isIndexActive(r);return r++,n.i(C.cloneElement)(e,i()({},e.props,{active:c}))}return e})},l.renderPanels=function(){var e=l.props.panels,t=[];return L()(e,function(e,n){var r=w()(e,"active")?e.active:l.isIndexActive(n),a=function(t){l.handleTitleClick(t,n),e.onClick&&e.onClick(t,n)};t.push(O.a.createElement(A.a,{key:e.title+"-title",active:r,onClick:a},O.a.createElement(j.a,{name:"dropdown"}),e.title)),t.push(O.a.createElement(N.a,{key:e.title+"-content",active:r},e.content))}),t},l.state={activeIndex:l.props.exclusive?-1:[-1]},l}return _()(t,e),f()(t,[{key:"render",value:function(){var e=this.props,r=e.className,a=e.fluid,o=e.inverted,s=e.panels,u=e.styled,l=Y()("ui",n.i(P.a)(a,"fluid"),n.i(P.a)(o,"inverted"),n.i(P.a)(u,"styled"),"accordion",r),c=b()(this.props,y()(t.propTypes)),d=n.i(P.c)(t,this.props);return O.a.createElement(d,i()({},c,{className:l}),s?this.renderPanels():this.renderChildren())}}]),t}(P.l);I.defaultProps={exclusive:!0},I.autoControlledProps=["activeIndex"],I._meta={name:"Accordion",type:P.d.TYPES.MODULE},I.Content=N.a,I.Title=A.a,t.a=I,I.handledProps=["activeIndex","as","children","className","defaultActiveIndex","exclusive","fluid","inverted","onTitleClick","panels","styled"]},function(e,t,n){"use strict";var r=n(1),a=n.n(r),o=n(8),i=n.n(o),s=n(9),u=n.n(s),l=n(11),c=n.n(l),d=n(10),f=n.n(d),p=n(312),m=n.n(p),h=n(3),_=n.n(h),v=n(0),y=n.n(v),g=n(2),b=n.i(g.m)("checkbox"),M=function(e){function t(){var e,n,r,o;i()(this,t);for(var s=arguments.length,u=Array(s),l=0;l<s;l++)u[l]=arguments[l];return n=r=c()(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(u))),r.state={},r.canToggle=function(){var e=r.props,t=e.disabled,n=e.radio,a=e.readOnly,o=r.state.checked;return!(t||a||n&&o)},r.handleRef=function(e){r.checkboxRef=e},r.handleClick=function(e){b("handleClick()");var t=r.props,n=t.onChange,o=t.onClick,i=r.state,s=i.checked,u=i.indeterminate;r.canToggle()&&(o&&o(e,a()({},r.props,{checked:!!s,indeterminate:!!u})),n&&n(e,a()({},r.props,{checked:!s,indeterminate:!1})),r.trySetState({checked:!s,indeterminate:!1}))},r.setIndeterminate=function(){var e=r.state.indeterminate;r.checkboxRef&&(r.checkboxRef.indeterminate=!!e)},o=n,c()(r,o)}return f()(t,e),u()(t,[{key:"componentDidMount",value:function(){this.setIndeterminate()}},{key:"componentDidUpdate",value:function(){this.setIndeterminate()}},{key:"render",value:function(){var e=this.props,r=e.className,o=e.disabled,i=e.label,s=e.name,u=e.radio,l=e.readOnly,c=e.slider,d=e.tabIndex,f=e.toggle,p=e.type,h=e.value,v=this.state,b=v.checked,M=v.indeterminate,L=_()("ui",n.i(g.a)(b,"checked"),n.i(g.a)(o,"disabled"),n.i(g.a)(M,"indeterminate"),n.i(g.a)(!i,"fitted"),n.i(g.a)(u,"radio"),n.i(g.a)(l,"read-only"),n.i(g.a)(c,"slider"),n.i(g.a)(f,"toggle"),"checkbox",r),k=n.i(g.b)(t,this.props),w=n.i(g.c)(t,this.props),E=void 0;return E=m()(d)?o?-1:0:d,y.a.createElement(w,a()({},k,{className:L,onClick:this.handleClick,onChange:this.handleClick}),y.a.createElement("input",{checked:b,className:"hidden",name:s,readOnly:!0,ref:this.handleRef,tabIndex:E,type:p,value:h}),n.i(g.r)(i)||y.a.createElement("label",null))}}]),t}(g.l);M.defaultProps={type:"checkbox"},M.autoControlledProps=["checked","indeterminate"],M._meta={name:"Checkbox",type:g.d.TYPES.MODULE},t.a=M,M.handledProps=["as","checked","className","defaultChecked","defaultIndeterminate","disabled","fitted","indeterminate","label","name","onChange","onClick","radio","readOnly","slider","tabIndex","toggle","type","value"]},function(e,t,n){"use strict";var r=n(1),a=n.n(r),o=n(8),i=n.n(o),s=n(9),u=n.n(s),l=n(11),c=n.n(l),d=n(10),f=n.n(d),p=n(4),m=n.n(p),h=n(3),_=n.n(h),v=n(0),y=n.n(v),g=n(2),b=n(136),M=n(408),L=function(e){function t(){var e,n,r,a;i()(this,t);for(var o=arguments.length,s=Array(o),u=0;u<o;u++)s[u]=arguments[u];return n=r=c()(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(s))),r.handlePortalMount=function(){g.o&&document.body.classList.add("dimmed","dimmable")},r.handlePortalUnmount=function(){g.o&&document.body.classList.remove("dimmed","dimmable")},r.handleClick=function(e){var t=r.props,n=t.onClick,a=t.onClickOutside;n&&n(e,r.props),r.center&&r.center!==e.target&&r.center.contains(e.target)||a&&a(e,r.props)},r.handleCenterRef=function(e){return r.center=e},a=n,c()(r,a)}return f()(t,e),u()(t,[{key:"render",value:function(){var e=this.props,r=e.active,o=e.children,i=e.className,s=e.content,u=e.disabled,l=e.inverted,c=e.page,d=e.simple,f=_()("ui",n.i(g.a)(r,"active transition visible"),n.i(g.a)(u,"disabled"),n.i(g.a)(l,"inverted"),n.i(g.a)(c,"page"),n.i(g.a)(d,"simple"),"dimmer",i),p=n.i(g.b)(t,this.props),h=n.i(g.c)(t,this.props),v=m()(o)?s:o,M=y.a.createElement(h,a()({},p,{className:f,onClick:this.handleClick}),v&&y.a.createElement("div",{className:"content"},y.a.crLine truncated
|
|
||||||
},function(e,t,n){"use strict";var r=n(874);n.d(t,"a",function(){return r.a})},function(e,t,n){"use strict";var r=n(1),a=n.n(r),o=n(8),i=n.n(o),s=n(9),u=n.n(s),l=n(11),c=n.n(l),d=n(10),f=n.n(d),p=n(308),m=n.n(p),h=n(715),_=n.n(h),v=n(676),y=n.n(v),g=n(126),b=n.n(g),M=n(15),L=(n.n(M),n(3)),k=n.n(L),w=n(0),E=n.n(w),T=n(2),S=function(e){function t(){var e,n,r,a;i()(this,t);for(var o=arguments.length,s=Array(o),u=0;u<o;u++)s[u]=arguments[u];return n=r=c()(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(s))),r.calculatePercent=function(){var e=r.props,t=e.percent,n=e.total,a=e.value;return b()(t)?b()(n)||b()(a)?void 0:a/n*100:t},r.getPercent=function(){var e=r.props.precision,t=y()(r.calculatePercent(),0,100);return b()(e)?t:_()(t,e)},r.isAutoSuccess=function(){var e=r.props,t=e.autoSuccess,n=e.percent,a=e.total,o=e.value;return t&&(n>=100||o>=a)},r.showProgress=function(){var e=r.props,t=e.label,n=e.precision,a=e.progress,o=e.total,i=e.value;return!(!t&&!a&&b()(n))||!m()([o,i],b.a)},a=n,c()(r,a)}return f()(t,e),u()(t,[{key:"render",value:function(){var e=this.props,r=e.active,o=e.attached,i=e.children,s=e.className,u=e.color,l=e.disabled,c=e.error,d=e.indicating,f=e.inverted,p=e.label,m=e.size,h=e.success,_=e.total,v=e.value,y=e.warning,g=k()("ui",u,m,n.i(T.a)(r||d,"active"),n.i(T.a)(l,"disabled"),n.i(T.a)(c,"error"),n.i(T.a)(d,"indicating"),n.i(T.a)(f,"inverted"),n.i(T.a)(h||this.isAutoSuccess(),"success"),n.i(T.a)(y,"warning"),n.i(T.f)(o,"attached"),"progress",s),b=n.i(T.b)(t,this.props),M=n.i(T.c)(t,this.props),L=this.getPercent();return E.a.createElement(M,a()({},b,{className:g}),E.a.createElement("div",{className:"bar",style:{width:L+"%"}},this.showProgress()&&E.a.createElement("div",{className:"progress"},"ratio"!==p?L+"%":v+"/"+_)),i&&E.a.createElement("div",{className:"label"},i))}}]),t}(w.Component);S._meta={name:"Progress",type:T.d.TYPES.MODULE},S.handledProps=["active","as","attached","autoSuccess","children","className","color","disabled","error","indicating","inverted","label","percent","precision","progress","size","success","total","value","warning"],t.a=S},function(e,t,n){"use strict";var r=n(876);n.d(t,"a",function(){return r.a})},function(e,t,n){"use strict";var r=n(1),a=n.n(r),o=n(8),i=n.n(o),s=n(9),u=n.n(s),l=n(11),c=n.n(l),d=n(10),f=n.n(d),p=n(324),m=n.n(p),h=n(314),_=n.n(h),v=n(15),y=(n.n(v),n(3)),g=n.n(y),b=n(0),M=n.n(b),L=n(2),k=n(421),w=function(e){function t(){var e,n,r,a;i()(this,t);for(var o=arguments.length,s=Array(o),u=0;u<o;u++)s[u]=arguments[u];return n=r=c()(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(s))),E.call(r),a=n,c()(r,a)}return f()(t,e),u()(t,[{key:"render",value:function(){var e=this,r=this.props,o=r.className,i=r.disabled,s=r.icon,u=r.maxRating,l=r.size,c=this.state,d=c.rating,f=c.selectedIndex,p=c.isSelecting,h=g()("ui",s,l,n.i(L.a)(i,"disabled"),n.i(L.a)(p&&!i&&f>=0,"selected"),"rating",o),_=n.i(L.b)(t,this.props),v=n.i(L.c)(t,this.props);return M.a.createElement(v,a()({},_,{className:h,role:"radiogroup",onMouseLeave:this.handleMouseLeave}),m()(u,function(t){return M.a.createElement(k.a,{active:d>=t+1,"aria-checked":d===t+1,"aria-posinset":t+1,"aria-setsize":u,index:t,key:t,onClick:e.handleIconClick,onMouseEnter:e.handleIconMouseEnter,selected:f>=t&&p})}))}}]),t}(L.l);w.autoControlledProps=["rating"],w.defaultProps={clearable:"auto",maxRating:1},w._meta={name:"Rating",type:L.d.TYPES.MODULE},w.Icon=k.a;var E=function(){var e=this;this.handleIconClick=function(t,n){var r=n.index,o=e.props,i=o.clearable,s=o.disabled,u=o.maxRating,l=o.onRate,c=e.state.rating;if(!s){var d=r+1;"auto"===i&&1===u?d=+!c:i===!0&&d===c&&(d=0),e.trySetState({rating:d},{isSelecting:!1}),l&&l(t,a()({},e.props,{rating:d}))}},this.handleIconMouseEnter=function(t,n){var r=n.index;e.props.disabled||e.setState({selectedIndex:r,isSelecting:!0})},this.handleMouseLeave=function(){for(var t=arguments.length,n=Array(t),r=0;r<t;r++)n[r]=arguments[r];_.a.apply(void 0,[e.props,"onMouseLeave"].concat(n)),e.props.disabled||e.setState({selectedIndex:-1,isSelecting:!1})}};t.a=w,w.handledProps=["as","className","clearable","defaultRating","disabled","icon","maxRating","onRate","rating","size"]},function(e,t,n){"use strict";var r=n(878);n.d(t,"a",function(){return r.a})},function(e,t,n){"use strict";var r=n(1),a=n.n(r),o=n(149),i=n.n(o),s=n(8),u=n.n(s),l=n(9),c=n.n(l),d=n(11),f=n.n(d),p=n(245),m=n.n(p),h=n(10),_=n.n(h),v=n(189),y=n.n(v),g=n(712),b=n.n(g),M=n(706),L=n.n(M),k=n(20),w=n.n(k),E=n(68),T=n.n(E),S=n(320),D=n.n(S),x=n(190),Y=n.n(x),C=n(15),O=(n.n(C),n(3)),P=n.n(O),j=n(0),N=n.n(j),A=n(2),I=n(216),H=n(422),R=n(423),F=n(424),W=n.i(A.m)("search"),U=function(e){function t(){var e,n,r,o;u()(this,t);for(var s=arguments.length,l=Array(s),c=0;c<s;c++)l[c]=arguments[c];return n=r=f()(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(l))),r.handleResultSelect=function(e,t){W("handleResultSelect()"),W(t);var n=r.props.onResultSelect;n&&n(eLine truncated
|
|
||||||
var n=e.split("_");return t%10===1&&t%100!==11?n[0]:t%10>=2&&t%10<=4&&(t%100<10||t%100>=20)?n[1]:n[2]}function n(e,n,r){var a={mm:n?"хвіліна_хвіліны_хвілін":"хвіліну_хвіліны_хвілін",hh:n?"гадзіна_гадзіны_гадзін":"гадзіну_гадзіны_гадзін",dd:"дзень_дні_дзён",MM:"месяц_месяцы_месяцаў",yy:"год_гады_гадоў"};return"m"===r?n?"хвіліна":"хвіліну":"h"===r?n?"гадзіна":"гадзіну":e+" "+t(a[r],+e)}var r=e.defineLocale("be",{months:{format:"студзеня_лютага_сакавіка_красавіка_траўня_чэрвеня_ліпеня_жніўня_верасня_кастрычніка_лістапада_снежня".split("_"),standalone:"студзень_люты_сакавік_красавік_травень_чэрвень_ліпень_жнівень_верасень_кастрычнік_лістапад_снежань".split("_")},monthsShort:"студ_лют_сак_крас_трав_чэрв_ліп_жнів_вер_каст_ліст_снеж".split("_"),weekdays:{format:"нядзелю_панядзелак_аўторак_сераду_чацвер_пятніцу_суботу".split("_"),standalone:"нядзеля_панядзелак_аўторак_серада_чацвер_пятніца_субота".split("_"),isFormat:/\[ ?[Вв] ?(?:мінулую|наступную)? ?\] ?dddd/},weekdaysShort:"нд_пн_ат_ср_чц_пт_сб".split("_"),weekdaysMin:"нд_пн_ат_ср_чц_пт_сб".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D MMMM YYYY г.",LLL:"D MMMM YYYY г., HH:mm",LLLL:"dddd, D MMMM YYYY г., HH:mm"},calendar:{sameDay:"[Сёння ў] LT",nextDay:"[Заўтра ў] LT",lastDay:"[Учора ў] LT",nextWeek:function(){return"[У] dddd [ў] LT"},lastWeek:function(){switch(this.day()){case 0:case 3:case 5:case 6:return"[У мінулую] dddd [ў] LT";case 1:case 2:case 4:return"[У мінулы] dddd [ў] LT"}},sameElse:"L"},relativeTime:{future:"праз %s",past:"%s таму",s:"некалькі секунд",m:n,mm:n,h:n,hh:n,d:"дзень",dd:n,M:"месяц",MM:n,y:"год",yy:n},meridiemParse:/ночы|раніцы|дня|вечара/,isPM:function(e){return/^(дня|вечара)$/.test(e)},meridiem:function(e,t,n){return e<4?"ночы":e<12?"раніцы":e<17?"дня":"вечара"},ordinalParse:/\d{1,2}-(і|ы|га)/,ordinal:function(e,t){switch(t){case"M":case"d":case"DDD":case"w":case"W":return e%10!==2&&e%10!==3||e%100===12||e%100===13?e+"-ы":e+"-і";case"D":return e+"-га";default:return e}},week:{dow:1,doy:7}});return r})},function(e,t,n){!function(e,t){t(n(5))}(this,function(e){"use strict";var t=e.defineLocale("bg",{months:"януари_февруари_март_април_май_юни_юли_август_септември_октомври_ноември_декември".split("_"),monthsShort:"янр_фев_мар_апр_май_юни_юли_авг_сеп_окт_ное_дек".split("_"),weekdays:"неделя_понеделник_вторник_сряда_четвъртък_петък_събота".split("_"),weekdaysShort:"нед_пон_вто_сря_чет_пет_съб".split("_"),weekdaysMin:"нд_пн_вт_ср_чт_пт_сб".split("_"),longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"D.MM.YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY H:mm",LLLL:"dddd, D MMMM YYYY H:mm"},calendar:{sameDay:"[Днес в] LT",nextDay:"[Утре в] LT",nextWeek:"dddd [в] LT",lastDay:"[Вчера в] LT",lastWeek:function(){switch(this.day()){case 0:case 3:case 6:return"[В изминалата] dddd [в] LT";case 1:case 2:case 4:case 5:return"[В изминалия] dddd [в] LT"}},sameElse:"L"},relativeTime:{future:"след %s",past:"преди %s",s:"няколко секунди",m:"минута",mm:"%d минути",h:"час",hh:"%d часа",d:"ден",dd:"%d дни",M:"месец",MM:"%d месеца",y:"година",yy:"%d години"},ordinalParse:/\d{1,2}-(ев|ен|ти|ви|ри|ми)/,ordinal:function(e){var t=e%10,n=e%100;return 0===e?e+"-ев":0===n?e+"-ен":n>10&&n<20?e+"-ти":1===t?e+"-ви":2===t?e+"-ри":7===t||8===t?e+"-ми":e+"-ти"},week:{dow:1,doy:7}});return t})},function(e,t,n){!function(e,t){t(n(5))}(this,function(e){"use strict";var t={1:"১",2:"২",3:"৩",4:"৪",5:"৫",6:"৬",7:"৭",8:"৮",9:"৯",0:"০"},n={"১":"1","২":"2","৩":"3","৪":"4","৫":"5","৬":"6","৭":"7","৮":"8","৯":"9","০":"0"},r=e.defineLocale("bn",{months:"জানুয়ারী_ফেব্রুয়ারি_মার্চ_এপ্রিল_মে_জুন_জুলাই_আগস্ট_সেপ্টেম্বর_অক্টোবর_নভেম্বর_ডিসেম্বর".split("_"),monthsShort:"জানু_ফেব_মার্চ_এপ্র_মে_জুন_জুল_আগ_সেপ্ট_অক্টো_নভে_ডিসে".split("_"),weekdays:"রবিLine truncated
|
|
||||||
s:"unos segundos",m:"un minuto",mm:"%d minutos",h:"una hora",hh:"%d horas",d:"un día",dd:"%d días",M:"un mes",MM:"%d meses",y:"un año",yy:"%d años"},ordinalParse:/\d{1,2}º/,ordinal:"%dº",week:{dow:1,doy:4}});return r})},function(e,t,n){!function(e,t){t(n(5))}(this,function(e){"use strict";function t(e,t,n,r){var a={s:["mõne sekundi","mõni sekund","paar sekundit"],m:["ühe minuti","üks minut"],mm:[e+" minuti",e+" minutit"],h:["ühe tunni","tund aega","üks tund"],hh:[e+" tunni",e+" tundi"],d:["ühe päeva","üks päev"],M:["kuu aja","kuu aega","üks kuu"],MM:[e+" kuu",e+" kuud"],y:["ühe aasta","aasta","üks aasta"],yy:[e+" aasta",e+" aastat"]};return t?a[n][2]?a[n][2]:a[n][1]:r?a[n][0]:a[n][1]}var n=e.defineLocale("et",{months:"jaanuar_veebruar_märts_aprill_mai_juuni_juuli_august_september_oktoober_november_detsember".split("_"),monthsShort:"jaan_veebr_märts_apr_mai_juuni_juuli_aug_sept_okt_nov_dets".split("_"),weekdays:"pühapäev_esmaspäev_teisipäev_kolmapäev_neljapäev_reede_laupäev".split("_"),weekdaysShort:"P_E_T_K_N_R_L".split("_"),weekdaysMin:"P_E_T_K_N_R_L".split("_"),longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"DD.MM.YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY H:mm",LLLL:"dddd, D. MMMM YYYY H:mm"},calendar:{sameDay:"[Täna,] LT",nextDay:"[Homme,] LT",nextWeek:"[Järgmine] dddd LT",lastDay:"[Eile,] LT",lastWeek:"[Eelmine] dddd LT",sameElse:"L"},relativeTime:{future:"%s pärast",past:"%s tagasi",s:t,m:t,mm:t,h:t,hh:t,d:t,dd:"%d päeva",M:t,MM:t,y:t,yy:t},ordinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}});return n})},function(e,t,n){!function(e,t){t(n(5))}(this,function(e){"use strict";var t=e.defineLocale("eu",{months:"urtarrila_otsaila_martxoa_apirila_maiatza_ekaina_uztaila_abuztua_iraila_urria_azaroa_abendua".split("_"),monthsShort:"urt._ots._mar._api._mai._eka._uzt._abu._ira._urr._aza._abe.".split("_"),monthsParseExact:!0,weekdays:"igandea_astelehena_asteartea_asteazkena_osteguna_ostirala_larunbata".split("_"),weekdaysShort:"ig._al._ar._az._og._ol._lr.".split("_"),weekdaysMin:"ig_al_ar_az_og_ol_lr".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"YYYY-MM-DD",LL:"YYYY[ko] MMMM[ren] D[a]",LLL:"YYYY[ko] MMMM[ren] D[a] HH:mm",LLLL:"dddd, YYYY[ko] MMMM[ren] D[a] HH:mm",l:"YYYY-M-D",ll:"YYYY[ko] MMM D[a]",lll:"YYYY[ko] MMM D[a] HH:mm",llll:"ddd, YYYY[ko] MMM D[a] HH:mm"},calendar:{sameDay:"[gaur] LT[etan]",nextDay:"[bihar] LT[etan]",nextWeek:"dddd LT[etan]",lastDay:"[atzo] LT[etan]",lastWeek:"[aurreko] dddd LT[etan]",sameElse:"L"},relativeTime:{future:"%s barru",past:"duela %s",s:"segundo batzuk",m:"minutu bat",mm:"%d minutu",h:"ordu bat",hh:"%d ordu",d:"egun bat",dd:"%d egun",M:"hilabete bat",MM:"%d hilabete",y:"urte bat",yy:"%d urte"},ordinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:7}});return t})},function(e,t,n){!function(e,t){t(n(5))}(this,function(e){"use strict";var t={1:"۱",2:"۲",3:"۳",4:"۴",5:"۵",6:"۶",7:"۷",8:"۸",9:"۹",0:"۰"},n={"۱":"1","۲":"2","۳":"3","۴":"4","۵":"5","۶":"6","۷":"7","۸":"8","۹":"9","۰":"0"},r=e.defineLocale("fa",{months:"ژانویه_فوریه_مارس_آوریل_مه_ژوئن_ژوئیه_اوت_سپتامبر_اکتبر_نوامبر_دسامبر".split("_"),monthsShort:"ژانویه_فوریه_مارس_آوریل_مه_ژوئن_ژوئیه_اوت_سپتامبر_اکتبر_نوامبر_دسامبر".split("_"),weekdays:"یکشنبه_دوشنبه_سهشنبه_چهارشنبه_پنجشنبه_جمعه_شنبه".split("_"),weekdaysShort:"یکشنبه_دوشنبه_سهشنبه_چهارشنبه_پنجشنبه_جمعه_شنبه".split("_"),weekdaysMin:"ی_د_س_چ_پ_ج_ش".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},meridiemParse:/قبل از ظهر|بعد از ظهر/,isPM:function(e){return/بعد از ظهر/.test(e)},meridiem:function(e,t,n){return e<12?"قبل از ظهر":"بعد از ظهر"},calendar:{sameDay:"[امروز ساعت] LT",nextDay:"[فردا ساعت] LT",nextWeek:"dddd [ساعت] LT",lastDay:"[دیروز ساعت] LT",lastWeek:"dddd [پیش] [ساعت] LT",sameElse:"L"},relativeTime:{future:"در %s",past:"%s پیش",s:"چندین ثانیه",m:"یک دقیقه",mm:"%d دقیقه",h:"یک ساعت",hh:"%d ساعت",d:"یک روز",dd:"%d روز",M:"یک ماه",MM:"%d ماه",y:"یک سال",yy:"%d سال"},preparse:function(e){return e.replace(/[۰-۹]/g,function(e){return n[e]}).replace(/،/g,",")},postformat:function(e){return e.replace(/\d/g,function(e){return t[e]}).replace(/,/g,"،")},ordinalParse:/\d{1,2}م/,ordinal:"%dم",week:{dow:6,doy:12}});return r})},function(e,t,n){!function(e,t){t(n(5))}(this,function(e){"use strict";function t(e,t,r,a){var o="";switch(r){case"s":return a?"muutaman sekunnin":"muutama sekunti";case"m":return a?"minuutin":"minuutti";case"mm":o=a?"minuutin":"minuuttia";break;case"h":return a?"tunnin":"tunti";case"hh":o=a?"tLine truncated
|
|
||||||
longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[ថ្ងៃនេះ ម៉ោង] LT",nextDay:"[ស្អែក ម៉ោង] LT",nextWeek:"dddd [ម៉ោង] LT",lastDay:"[ម្សិលមិញ ម៉ោង] LT",lastWeek:"dddd [សប្តាហ៍មុន] [ម៉ោង] LT",sameElse:"L"},relativeTime:{future:"%sទៀត",past:"%sមុន",s:"ប៉ុន្មានវិនាទី",m:"មួយនាទី",mm:"%d នាទី",h:"មួយម៉ោង",hh:"%d ម៉ោង",d:"មួយថ្ងៃ",dd:"%d ថ្ងៃ",M:"មួយខែ",MM:"%d ខែ",y:"មួយឆ្នាំ",yy:"%d ឆ្នាំ"},week:{dow:1,doy:4}});return t})},function(e,t,n){!function(e,t){t(n(5))}(this,function(e){"use strict";var t=e.defineLocale("ko",{months:"1월_2월_3월_4월_5월_6월_7월_8월_9월_10월_11월_12월".split("_"),monthsShort:"1월_2월_3월_4월_5월_6월_7월_8월_9월_10월_11월_12월".split("_"),weekdays:"일요일_월요일_화요일_수요일_목요일_금요일_토요일".split("_"),weekdaysShort:"일_월_화_수_목_금_토".split("_"),weekdaysMin:"일_월_화_수_목_금_토".split("_"),longDateFormat:{LT:"A h시 m분",LTS:"A h시 m분 s초",L:"YYYY.MM.DD",LL:"YYYY년 MMMM D일",LLL:"YYYY년 MMMM D일 A h시 m분",LLLL:"YYYY년 MMMM D일 dddd A h시 m분"},calendar:{sameDay:"오늘 LT",nextDay:"내일 LT",nextWeek:"dddd LT",lastDay:"어제 LT",lastWeek:"지난주 dddd LT",sameElse:"L"},relativeTime:{future:"%s 후",past:"%s 전",s:"몇 초",ss:"%d초",m:"일분",mm:"%d분",h:"한 시간",hh:"%d시간",d:"하루",dd:"%d일",M:"한 달",MM:"%d달",y:"일 년",yy:"%d년"},ordinalParse:/\d{1,2}일/,ordinal:"%d일",meridiemParse:/오전|오후/,isPM:function(e){return"오후"===e},meridiem:function(e,t,n){return e<12?"오전":"오후"}});return t})},function(e,t,n){!function(e,t){t(n(5))}(this,function(e){"use strict";var t={0:"-чү",1:"-чи",2:"-чи",3:"-чү",4:"-чү",5:"-чи",6:"-чы",7:"-чи",8:"-чи",9:"-чу",10:"-чу",20:"-чы",30:"-чу",40:"-чы",50:"-чү",60:"-чы",70:"-чи",80:"-чи",90:"-чу",100:"-чү"},n=e.defineLocale("ky",{months:"январь_февраль_март_апрель_май_июнь_июль_август_сентябрь_октябрь_ноябрь_декабрь".split("_"),monthsShort:"янв_фев_март_апр_май_июнь_июль_авг_сен_окт_ноя_дек".split("_"),weekdays:"Жекшемби_Дүйшөмбү_Шейшемби_Шаршемби_Бейшемби_Жума_Ишемби".split("_"),weekdaysShort:"Жек_Дүй_Шей_Шар_Бей_Жум_Ише".split("_"),weekdaysMin:"Жк_Дй_Шй_Шр_Бй_Жм_Иш".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[Бүгүн саат] LT",nextDay:"[Эртең саат] LT",nextWeek:"dddd [саат] LT",lastDay:"[Кече саат] LT",lastWeek:"[Өткен аптанын] dddd [күнү] [саат] LT",sameElse:"L"},relativeTime:{future:"%s ичинде",past:"%s мурун",s:"бирнече секунд",m:"бир мүнөт",mm:"%d мүнөт",h:"бир саат",hh:"%d саат",d:"бир күн",dd:"%d күн",M:"бир ай",MM:"%d ай",y:"бир жыл",yy:"%d жыл"},ordinalParse:/\d{1,2}-(чи|чы|чү|чу)/,ordinal:function(e){var n=e%10,r=e>=100?100:null;return e+(t[e]||t[n]||t[r])},week:{dow:1,doy:7}});return n})},function(e,t,n){!function(e,t){t(n(5))}(this,function(e){"use strict";function t(e,t,n,r){var a={m:["eng Minutt","enger Minutt"],h:["eng Stonn","enger Stonn"],d:["een Dag","engem Dag"],M:["ee Mount","engem Mount"],y:["ee Joer","engem Joer"]};return t?a[n][0]:a[n][1]}function n(e){var t=e.substr(0,e.indexOf(" "));return a(t)?"a "+e:"an "+e}function r(e){var t=e.substr(0,e.indexOf(" "));return a(t)?"viru "+e:"virun "+e}function a(e){if(e=parseInt(e,10),isNaN(e))return!1;if(e<0)return!0;if(e<10)return 4<=e&&e<=7;if(e<100){var t=e%10,n=e/10;return a(0===t?n:t)}if(e<1e4){for(;e>=10;)e/=10;return a(e)}return e/=1e3,a(e)}var o=e.defineLocale("lb",{months:"Januar_Februar_Mäerz_Abrëll_Mee_Juni_Juli_August_September_Oktober_November_Dezember".split("_"),monthsShort:"Jan._Febr._Mrz._Abr._Mee_Jun._Jul._Aug._Sept._Okt._Nov._Dez.".split("_"),monthsParseExact:!0,weekdays:"Sonndeg_Méindeg_Dënschdeg_Mëttwoch_Donneschdeg_Freideg_Samschdeg".split("_"),weekdaysShort:"So._Mé._Dë._Më._Do._Fr._Sa.".split("_"),weekdaysMin:"So_Mé_Dë_Më_Do_Fr_Sa".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"H:mm [Auer]",LTS:"H:mm:ss [Auer]",L:"DD.MM.YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY H:mm [Auer]",LLLL:"dddd, D. MMMM YYYY H:mm [Auer]"},calendar:{sameDay:"[Haut um] LT",sameElse:"L",nextDay:"[Muer um] LT",nextWeek:"dddd [um] LT",lastDay:"[Gëschter um] LT",lastWeek:function(){switch(this.day()){case 2:case 4:return"[Leschten] dddd [um] LT";default:retuLine truncated
|
|
||||||
weekdays:"Domingo_Segunda-feira_Terça-feira_Quarta-feira_Quinta-feira_Sexta-feira_Sábado".split("_"),weekdaysShort:"Dom_Seg_Ter_Qua_Qui_Sex_Sáb".split("_"),weekdaysMin:"Dom_2ª_3ª_4ª_5ª_6ª_Sáb".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D [de] MMMM [de] YYYY",LLL:"D [de] MMMM [de] YYYY [às] HH:mm",LLLL:"dddd, D [de] MMMM [de] YYYY [às] HH:mm"},calendar:{sameDay:"[Hoje às] LT",nextDay:"[Amanhã às] LT",nextWeek:"dddd [às] LT",lastDay:"[Ontem às] LT",lastWeek:function(){return 0===this.day()||6===this.day()?"[Último] dddd [às] LT":"[Última] dddd [às] LT"},sameElse:"L"},relativeTime:{future:"em %s",past:"%s atrás",s:"poucos segundos",m:"um minuto",mm:"%d minutos",h:"uma hora",hh:"%d horas",d:"um dia",dd:"%d dias",M:"um mês",MM:"%d meses",y:"um ano",yy:"%d anos"},ordinalParse:/\d{1,2}º/,ordinal:"%dº"});return t})},function(e,t,n){!function(e,t){t(n(5))}(this,function(e){"use strict";var t=e.defineLocale("pt",{months:"Janeiro_Fevereiro_Março_Abril_Maio_Junho_Julho_Agosto_Setembro_Outubro_Novembro_Dezembro".split("_"),monthsShort:"Jan_Fev_Mar_Abr_Mai_Jun_Jul_Ago_Set_Out_Nov_Dez".split("_"),weekdays:"Domingo_Segunda-Feira_Terça-Feira_Quarta-Feira_Quinta-Feira_Sexta-Feira_Sábado".split("_"),weekdaysShort:"Dom_Seg_Ter_Qua_Qui_Sex_Sáb".split("_"),weekdaysMin:"Dom_2ª_3ª_4ª_5ª_6ª_Sáb".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D [de] MMMM [de] YYYY",LLL:"D [de] MMMM [de] YYYY HH:mm",LLLL:"dddd, D [de] MMMM [de] YYYY HH:mm"},calendar:{sameDay:"[Hoje às] LT",nextDay:"[Amanhã às] LT",nextWeek:"dddd [às] LT",lastDay:"[Ontem às] LT",lastWeek:function(){return 0===this.day()||6===this.day()?"[Último] dddd [às] LT":"[Última] dddd [às] LT"},sameElse:"L"},relativeTime:{future:"em %s",past:"há %s",s:"segundos",m:"um minuto",mm:"%d minutos",h:"uma hora",hh:"%d horas",d:"um dia",dd:"%d dias",M:"um mês",MM:"%d meses",y:"um ano",yy:"%d anos"},ordinalParse:/\d{1,2}º/,ordinal:"%dº",week:{dow:1,doy:4}});return t})},function(e,t,n){!function(e,t){t(n(5))}(this,function(e){"use strict";function t(e,t,n){var r={mm:"minute",hh:"ore",dd:"zile",MM:"luni",yy:"ani"},a=" ";return(e%100>=20||e>=100&&e%100===0)&&(a=" de "),e+a+r[n]}var n=e.defineLocale("ro",{months:"ianuarie_februarie_martie_aprilie_mai_iunie_iulie_august_septembrie_octombrie_noiembrie_decembrie".split("_"),monthsShort:"ian._febr._mart._apr._mai_iun._iul._aug._sept._oct._nov._dec.".split("_"),monthsParseExact:!0,weekdays:"duminică_luni_marți_miercuri_joi_vineri_sâmbătă".split("_"),weekdaysShort:"Dum_Lun_Mar_Mie_Joi_Vin_Sâm".split("_"),weekdaysMin:"Du_Lu_Ma_Mi_Jo_Vi_Sâ".split("_"),longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"DD.MM.YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY H:mm",LLLL:"dddd, D MMMM YYYY H:mm"},calendar:{sameDay:"[azi la] LT",nextDay:"[mâine la] LT",nextWeek:"dddd [la] LT",lastDay:"[ieri la] LT",lastWeek:"[fosta] dddd [la] LT",sameElse:"L"},relativeTime:{future:"peste %s",past:"%s în urmă",s:"câteva secunde",m:"un minut",mm:t,h:"o oră",hh:t,d:"o zi",dd:t,M:"o lună",MM:t,y:"un an",yy:t},week:{dow:1,doy:7}});return n})},function(e,t,n){!function(e,t){t(n(5))}(this,function(e){"use strict";function t(e,t){var n=e.split("_");return t%10===1&&t%100!==11?n[0]:t%10>=2&&t%10<=4&&(t%100<10||t%100>=20)?n[1]:n[2]}function n(e,n,r){var a={mm:n?"минута_минуты_минут":"минуту_минуты_минут",hh:"час_часа_часов",dd:"день_дня_дней",MM:"месяц_месяца_месяцев",yy:"год_года_лет"};return"m"===r?n?"минута":"минуту":e+" "+t(a[r],+e)}var r=[/^янв/i,/^фев/i,/^мар/i,/^апр/i,/^ма[йя]/i,/^июн/i,/^июл/i,/^авг/i,/^сен/i,/^окт/i,/^ноя/i,/^дек/i],a=e.defineLocale("ru",{months:{format:"января_февраля_марта_апреля_мая_июня_июля_августа_сентября_октября_ноября_декабря".split("_"),standalone:"январь_февраль_март_апрель_май_июнь_июль_август_сентябрь_октябрь_ноябрь_декабрь".split("_")},monthsShort:{format:"янв._февр._мар._апр._мая_июня_июля_авг._сент._окт._нояб._дек.".split("_"),standalone:"янв._февр._март_апр._май_июнь_июль_авг._сент._окт._нояб._дек.".split("_")},weekdays:{standalone:"воскресенье_понедельник_вторник_среда_четверг_пятница_суббота".split("_"),format:"воскресенье_понедельник_вторник_среду_четверг_пятницу_субботу".split("_"),isFormat:/\[ ?[Вв] ?(?:прошлую|следующую|эту)? ?\] ?dddd/},weekdaysShort:"вс_пн_вт_ср_чт_пт_сб".split("_"),weekdaysMin:"вс_пн_вт_ср_чт_пт_сб".split("_"),monthsParse:r,longMonthsParse:r,shortMonthsParse:r,monthsRegeLine truncated
|
|
||||||
},meridiemParse:/d\'o|d\'a/i,isPM:function(e){return"d'o"===e.toLowerCase()},meridiem:function(e,t,n){return e>11?n?"d'o":"D'O":n?"d'a":"D'A"},calendar:{sameDay:"[oxhi à] LT",nextDay:"[demà à] LT",nextWeek:"dddd [à] LT",lastDay:"[ieiri à] LT",lastWeek:"[sür el] dddd [lasteu à] LT",sameElse:"L"},relativeTime:{future:"osprei %s",past:"ja%s",s:t,m:t,mm:t,h:t,hh:t,d:t,dd:t,M:t,MM:t,y:t,yy:t},ordinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}});return n})},function(e,t,n){!function(e,t){t(n(5))}(this,function(e){"use strict";var t=e.defineLocale("tzm-latn",{months:"innayr_brˤayrˤ_marˤsˤ_ibrir_mayyw_ywnyw_ywlywz_ɣwšt_šwtanbir_ktˤwbrˤ_nwwanbir_dwjnbir".split("_"),monthsShort:"innayr_brˤayrˤ_marˤsˤ_ibrir_mayyw_ywnyw_ywlywz_ɣwšt_šwtanbir_ktˤwbrˤ_nwwanbir_dwjnbir".split("_"),weekdays:"asamas_aynas_asinas_akras_akwas_asimwas_asiḍyas".split("_"),weekdaysShort:"asamas_aynas_asinas_akras_akwas_asimwas_asiḍyas".split("_"),weekdaysMin:"asamas_aynas_asinas_akras_akwas_asimwas_asiḍyas".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},calendar:{sameDay:"[asdkh g] LT",nextDay:"[aska g] LT",nextWeek:"dddd [g] LT",lastDay:"[assant g] LT",lastWeek:"dddd [g] LT",sameElse:"L"},relativeTime:{future:"dadkh s yan %s",past:"yan %s",s:"imik",m:"minuḍ",mm:"%d minuḍ",h:"saɛa",hh:"%d tassaɛin",d:"ass",dd:"%d ossan",M:"ayowr",MM:"%d iyyirn",y:"asgas",yy:"%d isgasn"},week:{dow:6,doy:12}});return t})},function(e,t,n){!function(e,t){t(n(5))}(this,function(e){"use strict";var t=e.defineLocale("tzm",{months:"ⵉⵏⵏⴰⵢⵔ_ⴱⵕⴰⵢⵕ_ⵎⴰⵕⵚ_ⵉⴱⵔⵉⵔ_ⵎⴰⵢⵢⵓ_ⵢⵓⵏⵢⵓ_ⵢⵓⵍⵢⵓⵣ_ⵖⵓⵛⵜ_ⵛⵓⵜⴰⵏⴱⵉⵔ_ⴽⵟⵓⴱⵕ_ⵏⵓⵡⴰⵏⴱⵉⵔ_ⴷⵓⵊⵏⴱⵉⵔ".split("_"),monthsShort:"ⵉⵏⵏⴰⵢⵔ_ⴱⵕⴰⵢⵕ_ⵎⴰⵕⵚ_ⵉⴱⵔⵉⵔ_ⵎⴰⵢⵢⵓ_ⵢⵓⵏⵢⵓ_ⵢⵓⵍⵢⵓⵣ_ⵖⵓⵛⵜ_ⵛⵓⵜⴰⵏⴱⵉⵔ_ⴽⵟⵓⴱⵕ_ⵏⵓⵡⴰⵏⴱⵉⵔ_ⴷⵓⵊⵏⴱⵉⵔ".split("_"),weekdays:"ⴰⵙⴰⵎⴰⵙ_ⴰⵢⵏⴰⵙ_ⴰⵙⵉⵏⴰⵙ_ⴰⴽⵔⴰⵙ_ⴰⴽⵡⴰⵙ_ⴰⵙⵉⵎⵡⴰⵙ_ⴰⵙⵉⴹⵢⴰⵙ".split("_"),weekdaysShort:"ⴰⵙⴰⵎⴰⵙ_ⴰⵢⵏⴰⵙ_ⴰⵙⵉⵏⴰⵙ_ⴰⴽⵔⴰⵙ_ⴰⴽⵡⴰⵙ_ⴰⵙⵉⵎⵡⴰⵙ_ⴰⵙⵉⴹⵢⴰⵙ".split("_"),weekdaysMin:"ⴰⵙⴰⵎⴰⵙ_ⴰⵢⵏⴰⵙ_ⴰⵙⵉⵏⴰⵙ_ⴰⴽⵔⴰⵙ_ⴰⴽⵡⴰⵙ_ⴰⵙⵉⵎⵡⴰⵙ_ⴰⵙⵉⴹⵢⴰⵙ".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},calendar:{sameDay:"[ⴰⵙⴷⵅ ⴴ] LT",nextDay:"[ⴰⵙⴽⴰ ⴴ] LT",nextWeek:"dddd [ⴴ] LT",lastDay:"[ⴰⵚⴰⵏⵜ ⴴ] LT",lastWeek:"dddd [ⴴ] LT",sameElse:"L"},relativeTime:{future:"ⴷⴰⴷⵅ ⵙ ⵢⴰⵏ %s",past:"ⵢⴰⵏ %s",s:"ⵉⵎⵉⴽ",m:"ⵎⵉⵏⵓⴺ",mm:"%d ⵎⵉⵏⵓⴺ",h:"ⵙⴰⵄⴰ",hh:"%d ⵜⴰⵙⵙⴰⵄⵉⵏ",d:"ⴰⵙⵙ",dd:"%d oⵙⵙⴰⵏ",M:"ⴰⵢoⵓⵔ",MM:"%d ⵉⵢⵢⵉⵔⵏ",y:"ⴰⵙⴳⴰⵙ",yy:"%d ⵉⵙⴳⴰⵙⵏ"},week:{dow:6,doy:12}});return t})},function(e,t,n){!function(e,t){t(n(5))}(this,function(e){"use strict";function t(e,t){var n=e.split("_");return t%10===1&&t%100!==11?n[0]:t%10>=2&&t%10<=4&&(t%100<10||t%100>=20)?n[1]:n[2]}function n(e,n,r){var a={mm:n?"хвилина_хвилини_хвилин":"хвилину_хвилини_хвилин",hh:n?"година_години_годин":"годину_години_годин",dd:"день_дні_днів",MM:"місяць_місяці_місяців",yy:"рік_роки_років"};return"m"===r?n?"хвилина":"хвилину":"h"===r?n?"година":"годину":e+" "+t(a[r],+e)}function r(e,t){var n={nominative:"неділя_понеділок_вівторок_середа_четвер_п’ятниця_субота".split("_"),accusative:"неділю_понеділок_вівторок_середу_четвер_п’ятницю_суботу".split("_"),genitive:"неділі_понеділка_вівторка_середи_четверга_п’ятниці_суботи".split("_")},r=/(\[[ВвУу]\]) ?dddd/.test(t)?"accusative":/\[?(?:минулої|наступної)? ?\] ?dddd/.test(t)?"genitive":"nominative";return n[r][e.day()]}function a(e){return function(){return e+"о"+(11===this.hours()?"б":"")+"] LT"}}var o=e.defineLocale("uk",{months:{format:"січня_лютого_березня_квітня_травня_червня_липня_серпня_вересня_жовтня_листопада_грудня".split("_"),standalone:"січень_лютий_березень_квітень_травень_червень_липень_серпень_вересень_жовтень_листопад_грудень".split("_")},monthsShort:"січ_лют_бер_квіт_трав_черв_лип_серп_вер_жовт_лист_грLine truncated
|
|
||||||
}Object.defineProperty(t,"__esModule",{value:!0});var s=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},u=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),l=n(0),c=r(l),d=n(13),f=[{code:"0",name:"等於"},{code:"1",name:"大於"},{code:"2",name:"小於"},{code:"3",name:"大於等於"},{code:"4",name:"小於等於"},{code:"5",name:"不等於"},{code:"8",name:"AND"},{code:"9",name:"OR"}],p={di:{prefix:"di",dev:"",op:"",value:"",mode:"di_status"},leone:{prefix:"le",dev:"",op:"",value:"",mode:""},unit:{dev:""},time:{op:"",dev:"dt0",mode:"mode0",year:"-",week:"-",month:"-",day:"-",hour:"-",min:"-"}},m=function(e){function t(){var e,n,r,i;a(this,t);for(var u=arguments.length,l=Array(u),c=0;c<u;c++)l[c]=arguments[c];return n=r=o(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(l))),r.state={st:"",data:{}},r.handleDataChange=function(e,t){var n=r.state.data,a=r.props.updateData;e in n&&(n[e]=t),r.setState({data:n},function(){var e=r.state.data,t=s({},r.props.data.data),n=r.props.data.st;"di"!=n&&"leone"!=n||(t.id=""+e.prefix+e.dev+","+e.mode,t.op=e.op,t.value=e.value),"unit"==n&&(t.dev=e.dev),"time"==n&&(t.id=e.dev+","+e.mode,t.op=e.op,t.value=e.min+"|"+e.hour+"|"+e.day+"|"+e.month+"|"+e.week+"|"+e.year),a(r.props.unit,t)})},i=n,o(r,i)}return i(t,e),u(t,[{key:"componentWillReceiveProps",value:function(e){var t=s({},this.state.data);e.data.st!=this.state.st&&(t=e.data.st in p?s({},p[e.data.st]):{}),this.setState({data:t,st:e.data.st})}},{key:"render",value:function(){var e=this.props,t=e.unit,n=e.data,r=e.getList;return c.default.createElement(d.Grid.Column,null,c.default.createElement(d.Segment,null,c.default.createElement(d.Form.Field,null,c.default.createElement("label",null,"選擇元件"),c.default.createElement("select",{value:n.st,onChange:function(e){r(t,e.target.value)}},c.default.createElement("option",{value:""},"請選擇元件"),c.default.createElement("option",{value:"leone"},"LeOne"),c.default.createElement("option",{value:"di"},"DigitInput"),c.default.createElement("option",{value:"time"},"時間"),c.default.createElement("option",{value:"unit"},"已建立群組"))),n.st?c.default.createElement(h,{data:n,state:this.state.data,dataChange:this.handleDataChange}):null))}}]),t}(c.default.Component),h=function(e){var t=e.data,n=e.state,r=e.dataChange;return"di"==t.st?c.default.createElement("div",null,c.default.createElement("select",{value:n.dev,onChange:function(e){r("dev",e.target.value)}},c.default.createElement("option",{value:""},"選擇裝置"),t.list.map(function(e,t){return c.default.createElement("option",{key:t,value:e.id},e.name)})),c.default.createElement("select",{value:n.op,onChange:function(e){r("op",e.target.value)}},c.default.createElement("option",{value:""},"選擇條件"),f.map(function(e,t){if(8!=e.code&&9!=e.code)return c.default.createElement("option",{key:t,value:e.code},e.name)})),c.default.createElement("select",{value:n.value,onChange:function(e){r("value",e.target.value)}},c.default.createElement("option",{value:""},"選擇狀態"),c.default.createElement("option",{value:"0"},"0"),c.default.createElement("option",{value:"1"},"1"))):"leone"==t.st?c.default.createElement("div",null,c.default.createElement("select",{value:n.dev,onChange:function(e){r("dev",e.target.value)}},c.default.createElement("option",{value:""},"選擇裝置"),t.list.map(function(e,t){return c.default.createElement("option",{key:t,value:e.id},e.name)})),c.default.createElement("select",{value:n.mode,onChange:function(e){r("mode",e.target.value)}},c.default.createElement("option",{value:""},"選擇感測器"),c.default.createElement("option",{value:"leone_ttrigger1"},"溫度"),c.default.createElement("option",{value:"leone_htrigger1"},"濕度")),c.default.createElement("select",{value:n.op,onChange:function(e){r("op",e.target.value)}},c.default.createElement("option",{value:""},"選擇條件"),f.map(function(e,t){if(8!=e.code&&9!=e.code)return c.default.createElement("option",{key:t,value:e.code},e.name)})),c.default.createElement(d.Input,{size:"mini",placeholder:"請輸入數值",value:n.value,onChange:function(e,t){r("value",t.value)}})):"unit"==t.st?c.default.createElement("div",null,c.default.createElement("select",{value:n.dev,onChange:function(e){r("dev",e.target.value)}},c.default.createElement("option",{value:""},"選擇群組"),t.list.map(function(e,t){return c.default.createElement("option",{key:t,value:e.id},e.name)}))):"time"==t.st?c.default.createElement("div",null,c.default.createElement("select",{value:n.op,onChange:function(e){r("op",e.target.value)}},c.default.createElement("option",{value:""},"選擇條件"),f.map(function(e,t){if(8!=e.code&&9!=e.code)return c.deLine truncated
|
|
||||||
items:[]},r.showGroupItems=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];r.setState({showItem:!0,items:e})},r.closeItemModal=function(){r.setState({showItem:!1,items:[]})},r.openModal=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];r.props.clearSelectList(),r.setState({modal:!0,modalType:e,modalData:t,modalSelect:n})},r.closeModal=function(){r.setState({modal:!1,modalData:{},modalSelect:[]})},r.submitModal=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=r.props.i18n;if(!t.name||1==e&&!t.id)return r.props.showDialog(n&&n.t?n.t("tip.input_empty"):"");var a=r.state.modalSelect.map(function(e){return e.id}),o=u({},t,{devs:a.join(",")});1==e?r.props.editIOGroup(o):r.props.addIOGroup(o),r.closeModal()},r.querySelectList=function(e){r.props.clearSelectList(),e&&r.props.getSelectList({type:e})},r.removeSelect=function(e){r.state.modalSelect.splice(e,1),r.setState({modalSelect:r.state.modalSelect})},r.addSelect=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=r.state.modalSelect.filter(function(t){return t.id==e.id});t.length>0||r.setState({modalSelect:[].concat(a(r.state.modalSelect),[e])})},r.delIOGroup=function(e){e&&r.props.delIOGroup({id:e})},s=n,i(r,s)}return s(t,e),l(t,[{key:"componentDidMount",value:function(){var e=this;this.props.getIOGroupList(),this.props.router.setRouteLeaveHook(this.props.route,function(){e.props.clearList()})}},{key:"render",value:function(){var e=this,t=this.props,n=t.i18n,r=t.list,a=t.dos,o=t.leones,i=t.permissions,s=t.devs;return d.default.createElement(f.Container,null,d.default.createElement(f.Segment,{className:"clearfix"},d.default.createElement(f.Button,{basic:!0,type:"button",color:"green",floated:"right",style:{marginBottom:"15px"},icon:"plus",content:n&&n.t?n.t("page.iogroup.table.button.add"):"",onClick:function(){e.openModal(0)}}),d.default.createElement(f.Table,null,d.default.createElement(f.Table.Header,null,d.default.createElement(f.Table.Row,null,d.default.createElement(f.Table.HeaderCell,null,n&&n.t?n.t("page.iogroup.table.operate"):""),d.default.createElement(f.Table.HeaderCell,null,n&&n.t?n.t("page.iogroup.table.name"):""),d.default.createElement(f.Table.HeaderCell,null,n&&n.t?n.t("page.iogroup.table.groups"):""))),d.default.createElement(f.Table.Body,null,r.map(function(t,r){return d.default.createElement(m.default,{i18n:n,key:r,data:t,dos:a,les:o,openItemModal:e.showGroupItems,onDelete:e.delIOGroup,openModal:e.openModal})})))),d.default.createElement(y,{open:this.state.showItem,items:this.state.items,onClose:this.closeItemModal}),d.default.createElement(_.default,{i18n:n,open:this.state.modal,data:this.state.modalData,type:this.state.modalType,onClose:this.closeModal,onSubmit:this.submitModal,permissions:i,devs:s,selected:this.state.modalSelect,removeSelect:this.removeSelect,addSelect:this.addSelect,querySelectList:this.querySelectList}))}}]),t}(d.default.Component),y=function(e){var t=(e.i18n,e.open),n=e.items,r=e.onClose;return d.default.createElement(f.Modal,{open:t,onClose:function(){r()},size:"small"},d.default.createElement(f.Modal.Content,null,n.map(function(e,t){return d.default.createElement(f.Item,{key:t},d.default.createElement(f.Label,{content:e.type}),e.name)})))};t.default=v},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var a=n(0),o=r(a),i=n(13),s=function(e){var t=e.i18n,n=e.open,r=e.id,a=e.devname,s=e.cmd,u=e.onSubmit,l=e.onClose,c=t&&t.getResource&&t.language?t.getResource(t.language+".translation.action_list"):[],d=c.filter(function(e){return e.cmd==s});return o.default.createElement(i.Modal,{open:n,closeOnDimmerClick:!1},o.default.createElement(i.Modal.Content,null,o.default.createElement(i.Form,{onSubmit:function(e,t){e.preventDefault(),u(t.formData)},serializer:function(e){var t={devs:"le"+r};if(t.cmd=s,2==t.cmd){var n=e.querySelector('input[name="temp"]');n&&"value"in n&&(t.cmd=t.cmd+" "+n.value)}return t}},o.default.createElement(i.Header,{as:"h4",content:a||""}),o.default.createElement(i.Header,{as:"h4",content:(t&&t.t?t.t("page.leone.form.label.run_command"):"")+" "+(d[0]?d[0].name:"")}),s&&"2"==s?o.default.createElement(i.Form.Field,null,o.default.createElement(i.Input,{fluid:!0,name:"temp",label:t&&t.t?t.t("page.leone.form.label.temp"):""})):null,o.default.createElement(i.Grid,{columns:2,style:{marginTop:"15px"}},o.default.createElement(i.Grid.Column,null,o.default.createElement(i.Button,{fluid:!0,type:"submit",content:t&&t.t?t.t("page.leone.form.button.submit"):""})),o.default.createElement(i.Grid.Column,null,o.default.createElement(i.Button,{fluid:!0,type:"button",content:t&&t.t?t.t("page.leone.form.button.cancel"):"",onClick:function(){l()}}))))))};t.default=s},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{vLine truncated
|
|
||||||
}),o.default.createElement(i.Modal.Content,null,o.default.createElement(i.Form,{onSubmit:function(e,t){e.preventDefault(),s(r,t.formData)},serializer:function(e){var t={id:a.uid||"",addr:"",num:"",type:""},n=e.querySelector('input[name="addr"]');n&&"value"in n&&(t.addr=n.value);var r=e.querySelector('input[name="num"]');r&&"value"in r&&(t.num=r.value);var o=e.querySelector('select[name="io_type"]');return o&&"value"in o&&(t.type=o.value),t}},o.default.createElement(i.Form.Field,null,o.default.createElement("label",null,"接口類型"),o.default.createElement("select",{name:"io_type",defaultValue:a.type||"",disabled:1==r},o.default.createElement("option",{value:""},"請選擇類型"),l.map(function(e,t){return o.default.createElement("option",{key:t,value:e.code},e.name)}))),o.default.createElement(i.Form.Field,null,o.default.createElement(i.Input,{name:"addr",label:"起始位址",defaultValue:a.addr||""})),o.default.createElement(i.Form.Field,null,o.default.createElement(i.Input,{name:"num",label:"數量",defaultValue:a.num||""})),o.default.createElement(i.Grid,{columns:2},o.default.createElement(i.Grid.Column,null,o.default.createElement(i.Button,{type:"submit",fluid:!0,content:"Submit"})),o.default.createElement(i.Grid.Column,null,o.default.createElement(i.Button,{type:"button",fluid:!0,content:"Cancel",onClick:function(){u()}}))))))};t.default=s},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),u=n(0),l=r(u),c=n(13),d=n(243),f=n(1048),p=r(f),m=function(e){function t(){var e,n,r,i;a(this,t);for(var s=arguments.length,u=Array(s),l=0;l<s;l++)u[l]=arguments[l];return n=r=o(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(u))),r.state={tabIdx:"1"},r.tabItemClick=function(e,t){r.setState({tabIdx:t.name},function(){r.props.getStatus({id:r.props.data.uid||"",type:r.state.tabIdx})})},i=n,o(r,i)}return i(t,e),s(t,[{key:"componentWillReceiveProps",value:function(e){e.data&&e.data.uid&&(this.props.data&&this.props.data.uid?this.props.data.uid!=e.data.uid&&this.props.getStatus({id:e.data.uid,type:this.state.tabIdx}):this.props.getStatus({id:e.data.uid,type:this.state.tabIdx}))}},{key:"render",value:function(){var e=this,t=this.props,n=t.i18n,r=t.show,a=t.data,o=t.ioModal,i=t.delIOList,s=t.showAIOSet;if(!r)return null;var u=a.iolist||[],f=u.filter(function(t){if(t.type==e.state.tabIdx)return t}),m=a.status||{},h=m[this.state.tabIdx]||[];return l.default.createElement("div",null,l.default.createElement(c.Menu,{attached:"top",tabular:!0},l.default.createElement(c.Menu.Item,{content:"DigitOutput",name:"1",active:"1"==this.state.tabIdx,onClick:this.tabItemClick}),l.default.createElement(c.Menu.Item,{content:"DigitInput",name:"2",active:"2"==this.state.tabIdx,onClick:this.tabItemClick}),l.default.createElement(c.Menu.Item,{content:"AnalogyOutput",name:"3",active:"3"==this.state.tabIdx,onClick:this.tabItemClick}),l.default.createElement(c.Menu.Item,{content:"AnalogyInput",name:"4",active:"4"==this.state.tabIdx,onClick:this.tabItemClick}),l.default.createElement(c.Menu.Menu,{position:"right"},l.default.createElement(c.Menu.Item,{content:"AddIO",icon:"plus",onClick:function(){o(0)}}))),l.default.createElement(c.Segment,{attached:"bottom"},l.default.createElement(c.Table,null,l.default.createElement(c.Table.Header,null,l.default.createElement(c.Table.Row,null,l.default.createElement(c.Table.HeaderCell,null,"起始位置"),l.default.createElement(c.Table.HeaderCell,null,"接口數量"),l.default.createElement(c.Table.HeaderCell,null,"操作"))),l.default.createElement(c.Table.Body,null,f.map(function(e,t){return l.default.createElement(p.default,{key:t,i18n:n,data:e,ioModal:o,delIOList:i,showAIOSet:s})}))),l.default.createElement(c.Segment,null,l.default.createElement(c.Header,{as:"h3",content:"接口資訊"}),h.map(function(e,t){return l.default.createElement("div",{key:t},l.default.createElement(c.Label,{basic:!0,color:"blue",content:"PortNum:"+e.port}),l.default.createElement(c.Label,{basic:!0,color:"blue",content:"原始數值:"+e.value}),l.default.createElement(c.Label,{basic:!0,color:"blue",content:"轉換數值:Line truncated
|
|
||||||
active:!this.state.input,content:n&&"t"in n?n.t("page.system_info.form.button.manualip"):"",onClick:function(){e.changeActive(!1)}})),l.default.createElement(d.Form,{onSubmit:function(e,t){e.preventDefault(),r(t.formData)},serializer:function(t){var n={ip:t.querySelector('input[name="ip"]').value,netmask:t.querySelector('input[name="netmask"]').value,gateway:t.querySelector('input[name="gateway"]').value,dns:t.querySelector('input[name="dns"]').value,dhcpMode:e.state.input};return n}},l.default.createElement(d.Table,null,l.default.createElement(d.Table.Body,null,l.default.createElement(d.Table.Row,null,l.default.createElement(d.Table.Cell,{width:8,content:n&&"t"in n?n.t("page.system_info.form.label.ip"):"",textAlign:"center"}),l.default.createElement(d.Table.Cell,{width:8,textAlign:"center"},l.default.createElement(d.Input,{fluid:!0,name:"ip",value:this.state.ip,disabled:this.state.input,onChange:function(t){e.setInputState("ip",t.target.value)}}))),l.default.createElement(d.Table.Row,null,l.default.createElement(d.Table.Cell,{width:8,content:n&&"t"in n?n.t("page.system_info.form.label.netmask"):"",textAlign:"center"}),l.default.createElement(d.Table.Cell,{width:8,textAlign:"center"},l.default.createElement(d.Input,{fluid:!0,name:"netmask",value:this.state.netmask,disabled:this.state.input,onChange:function(t){e.setInputState("netmask",t.target.value)}}))),l.default.createElement(d.Table.Row,null,l.default.createElement(d.Table.Cell,{width:8,content:n&&"t"in n?n.t("page.system_info.form.label.gateway"):"",textAlign:"center"}),l.default.createElement(d.Table.Cell,{width:8,textAlign:"center"},l.default.createElement(d.Input,{fluid:!0,name:"gateway",value:this.state.gateway,disabled:this.state.input,onChange:function(t){e.setInputState("gateway",t.target.value)}}))),l.default.createElement(d.Table.Row,null,l.default.createElement(d.Table.Cell,{width:8,content:n&&"t"in n?n.t("page.system_info.form.label.dns"):"",textAlign:"center"}),l.default.createElement(d.Table.Cell,{width:8,textAlign:"center"},l.default.createElement(d.Input,{fluid:!0,name:"dns",value:this.state.dns,disabled:this.state.input,onChange:function(t){e.setInputState("dns",t.target.value)}})))),l.default.createElement(d.Table.Footer,null,l.default.createElement(d.Table.Row,null,l.default.createElement(d.Table.Cell,{colSpan:"2"},l.default.createElement(d.Button,{type:"submit",fluid:!0,content:n&&"t"in n?n.t("page.system_info.form.button.update_network"):""})))))))}}]),t}(l.default.Component);t.default=f},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var a=n(0),o=r(a);n(25);var i=n(326),s=r(i),u=n(13),l=n(243),c=function(e){var t=e.i18n,n=e.time,r=e.onSubmit;return o.default.createElement(u.Form,{onSubmit:function(e,t){e.preventDefault(),r(t.formData)},serializer:function(e){var t={};return t.time=e.querySelector("input").value||"",t}},o.default.createElement(u.Table,null,o.default.createElement(u.Table.Body,null,o.default.createElement(u.Table.Row,null,o.default.createElement(u.Table.Cell,{width:8,content:t&&"t"in t?t.t("page.system_info.form.label.sysdate"):"",textAlign:"center"}),o.default.createElement(u.Table.Cell,{width:8,textAlign:"center"},o.default.createElement(s.default,{dateFormat:"YYYY-MM-DD",timeFormat:"HH:mm",value:(0,l.convertTime)(n),input:!0})))),o.default.createElement(u.Table.Footer,null,o.default.createElement(u.Table.Row,null,o.default.createElement(u.Table.Cell,{colSpan:"2"},o.default.createElement(u.Button,{type:"submit",fluid:!0,content:t&&"t"in t?t.t("page.system_info.form.button.update_time"):""}))))))};t.default=c},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),u=n(0),l=r(u),c=n(25),d=n(326),f=(r(d),n(13)),p=n(1055),m=r(p),h=n(1056),_=r(h),v=n(243),y=function(e){function t(){var e,n,r,i;a(this,t);for(var s=arguments.length,u=Array(s),l=0;l<s;l++)u[l]=arguments[l];return n=r=o(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(u))),r.netSubmit=function(e){var t=r.props,n=t.dispatch,a=t.i18n;return e.dhcpMode||e.ip&&e.netmask&&e.gatLine truncated
|
|
||||||
h=o,e(o)}},a=d(),o=t.encodePath(a);return a!==o&&p(o),(0,s.addEventListener)(window,c,r),function(){return(0,s.removeEventListener)(window,c,r)}},function(e,t,n,r){var a=e.state,o=e.key,i=t.encodePath((0,l.createPath)(e));void 0!==a&&(i=(0,l.addQueryStringValueToPath)(i,n,o),(0,u.saveState)(o,a)),h=e,r(i)});t.pushLocation=function(e,t,n){return _(e,t,n,function(e){d()!==e&&f(e)})},t.replaceLocation=function(e,t,n){return _(e,t,n,function(e){d()!==e&&p(e)})}},function(e,t,n){"use strict";t.__esModule=!0,t.replaceLocation=t.pushLocation=t.getCurrentLocation=t.go=t.getUserConfirmation=void 0;var r=n(531);Object.defineProperty(t,"getUserConfirmation",{enumerable:!0,get:function(){return r.getUserConfirmation}}),Object.defineProperty(t,"go",{enumerable:!0,get:function(){return r.go}});var a=n(239),o=n(145);t.getCurrentLocation=function(){return(0,a.createLocation)(window.location)},t.pushLocation=function(e){return window.location.href=(0,o.createPath)(e),!1},t.replaceLocation=function(e){return window.location.replace((0,o.createPath)(e)),!1}},function(e,t,n){"use strict";function r(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}function a(e){return e&&e.__esModule?e:{default:e}}t.__esModule=!0;var o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},i=n(47),s=a(i),u=n(532),l=n(531),c=r(l),d=n(1082),f=r(d),p=n(450),m=n(533),h=a(m),_=function(){var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0];u.canUseDOM?void 0:(0,s.default)(!1);var t=e.forceRefresh||!(0,p.supportsHistory)(),n=t?f:c,r=n.getUserConfirmation,a=n.getCurrentLocation,i=n.pushLocation,l=n.replaceLocation,d=n.go,m=(0,h.default)(o({getUserConfirmation:r},e,{getCurrentLocation:a,pushLocation:i,replaceLocation:l,go:d})),_=0,v=void 0,y=function(e,t){1===++_&&(v=c.startListener(m.transitionTo));var n=t?m.listenBefore(e):m.listen(e);return function(){n(),0===--_&&v()}},g=function(e){return y(e,!0)},b=function(e){return y(e,!1)};return o({},m,{listenBefore:g,listen:b})};t.default=_},function(e,t,n){"use strict";function r(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}function a(e){return e&&e.__esModule?e:{default:e}}t.__esModule=!0;var o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},i=n(147),s=(a(i),n(47)),u=a(s),l=n(532),c=n(450),d=n(1081),f=r(d),p=n(533),m=a(p),h="_k",_=function(e){return"/"===e.charAt(0)?e:"/"+e},v={hashbang:{encodePath:function(e){return"!"===e.charAt(0)?e:"!"+e},decodePath:function(e){return"!"===e.charAt(0)?e.substring(1):e}},noslash:{encodePath:function(e){return"/"===e.charAt(0)?e.substring(1):e},decodePath:_},slash:{encodePath:_,decodePath:_}},y=function(){var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0];l.canUseDOM?void 0:(0,u.default)(!1);var t=e.queryKey,n=e.hashType;"string"!=typeof t&&(t=h),null==n&&(n="slash"),n in v||(n="slash");var r=v[n],a=f.getUserConfirmation,i=function(){return f.getCurrentLocation(r,t)},s=function(e){return f.pushLocation(e,r,t)},d=function(e){return f.replaceLocation(e,r,t)},p=(0,m.default)(o({getUserConfirmation:a},e,{getCurrentLocation:i,pushLocation:s,replaceLocation:d,go:f.go})),_=0,y=void 0,g=function(e,n){1===++_&&(y=f.startListener(p.transitionTo,r,t));var a=n?p.listenBefore(e):p.listen(e);return function(){a(),0===--_&&y()}},b=function(e){return g(e,!0)},M=function(e){return g(e,!1)},L=((0,c.supportsGoWithoutReloadUsingHash)(),function(e){p.go(e)}),k=function(e){return"#"+r.encodePath(p.createHref(e))};return o({},p,{listenBefore:b,listen:M,go:L,createHref:k})};t.default=y},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}t.__esModule=!0;var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},o=n(147),i=(r(o),n(47)),s=r(i),u=n(239),l=n(145),c=n(533),d=r(c),f=n(449),p=function(e){return e.filter(function(e){return e.state}).reduce(function(e,t){return e[t.key]=t.state,e},{})},m=function(){var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0];Array.isArray(e)?e={entries:e}:"string"==typeof e&&(e={entries:[e]});var t=function(){var e=h[_],t=(0,l.createPath)(e),n=void 0,r=void 0;e.key&&(n=e.key,r=g(n));var o=(0,l.parsePath)(t);return(0,u.createLocation)(a({},o,{state:r}),void 0,n)},n=function(e){var t=_+e;return t>=0&&t<h.length},r=function(e){if(e&&n(e)){_+=e;var r=t();c.transitionTo(a({},r,{action:f.POP}))}},o=function(e){_+=1,_<h.length&&h.splice(_),h.push(e),y(e.key,e.state)},i=function(e){h[_]=e,y(e.key,e.state)},c=(0,d.default)(a({},e,{getCurrentLocation:t,pushLocation:o,replaceLocation:i,go:r})),m=Line truncated
|
|
||||||
this.wrappedInstance},render:function(){var t=this,n=this.props.router||this.context.router;if(!n)return u.a.createElement(e,this.props);var r=n.params,o=n.location,i=n.routes,s=p({},this.props,{router:n,params:r,location:o,routes:i});return a&&(s.ref=function(e){t.wrappedInstance=e}),u.a.createElement(e,s)}});return o.displayName="withRouter("+r(e)+")",o.WrappedComponent=e,c()(o,e)}var o=n(47),i=n.n(o),s=n(0),u=n.n(s),l=n(451),c=n.n(l),d=n(801),f=n(802);t.a=a;var p=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}},function(e,t,n){"use strict";e.exports=function(e){return encodeURIComponent(e).replace(/[!'()*]/g,function(e){return"%"+e.charCodeAt(0).toString(16).toUpperCase()})}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var s=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},l=n(0),c=r(l),d=n(148),f=r(d),p=n(242),m=n(28),h=n(144),_=n(447),v=r(_),y=n(1014),g=r(y),b=n(448),M=r(b),L=n(25),k=n(453),w=r(k),E=[M.default],T="object"===("undefined"==typeof window?"undefined":u(window))&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__({}):h.compose,S=T(h.applyMiddleware.apply(void 0,E)),D="production",x=(0,h.createStore)(v.default,D&&"production"==D?h.applyMiddleware.apply(void 0,E):S),Y=function(e){function t(){return a(this,t),o(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return i(t,e),s(t,[{key:"componentDidMount",value:function(){var e=navigator.language.substring(0,2);fetch("/locales/"+e+".json").then(function(e){return 200==e.status?e.json():{}}).then(function(t){w.default.init({lng:e,resources:t},function(){x.dispatch((0,L.set_i18n)(w.default))})})}},{key:"render",value:function(){return c.default.createElement(m.Provider,{store:x},c.default.createElement(p.Router,{history:p.browserHistory,routes:g.default}))}}]),t}(c.default.Component);f.default.render(c.default.createElement(Y,null),document.getElementById("app"))}]);
|
|
||||||
@@ -1,39 +0,0 @@
|
|||||||
!function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var n={};return t.m=e,t.c=n,t.i=function(e){return e},t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=1111)}([function(e,t,n){"use strict";e.exports=n(73)},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}t.__esModule=!0;var o=n(465),a=r(o);t.default=a.default||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}},function(e,t,n){"use strict";var r=n(855);n.d(t,"l",function(){return r.a});var o=n(858);n.d(t,"q",function(){return o});var a=n(859);n.d(t,"a",function(){return a.a}),n.d(t,"f",function(){return a.b}),n.d(t,"h",function(){return a.d}),n.d(t,"e",function(){return a.c}),n.d(t,"s",function(){return a.f}),n.d(t,"i",function(){return a.e});var i=(n(860),n(861));n.d(t,"m",function(){return i.a});var s=n(862);n.d(t,"g",function(){return s.a}),n.d(t,"j",function(){return s.b}),n.d(t,"k",function(){return s.c}),n.d(t,"r",function(){return s.d}),n.d(t,"t",function(){return s.e});var c=n(864);n.d(t,"b",function(){return c.a});var u=n(863);n.d(t,"c",function(){return u.a});var l=n(404);n.d(t,"o",function(){return l.a});var d=(n(405),n(856));n.d(t,"d",function(){return d});var p=n(857);n.d(t,"u",function(){return p});var f=n(865);n.d(t,"n",function(){return f.a});var h=(n(222),n(866));n.d(t,"p",function(){return h.a})},function(e,t,n){var r,o;/*!
|
|
||||||
Copyright (c) 2016 Jed Watson.
|
|
||||||
Licensed under the MIT License (MIT), see
|
|
||||||
http://jedwatson.github.io/classnames
|
|
||||||
*/
|
|
||||||
!function(){"use strict";function n(){for(var e=[],t=0;t<arguments.length;t++){var r=arguments[t];if(r){var o=typeof r;if("string"===o||"number"===o)e.push(r);else if(Array.isArray(r))e.push(n.apply(null,r));else if("object"===o)for(var i in r)a.call(r,i)&&r[i]&&e.push(i)}}return e.join(" ")}var a={}.hasOwnProperty;"undefined"!=typeof e&&e.exports?e.exports=n:(r=[],o=function(){return n}.apply(t,r),!(void 0!==o&&(e.exports=o)))}()},function(e,t){function n(e){return null==e}e.exports=n},,function(e,t,n){"use strict";function r(e,t,n,r,a,i,s,c){if(o(t),!e){var u;if(void 0===t)u=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var l=[n,r,a,i,s,c],d=0;u=new Error(t.replace(/%s/g,function(){return l[d++]})),u.name="Invariant Violation"}throw u.framesToPop=1,u}}var o=function(e){};e.exports=r},function(e,t,n){"use strict";var r=n(29),o=r;e.exports=o},function(e,t,n){"use strict";t.__esModule=!0,t.default=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}t.__esModule=!0;var o=n(244),a=r(o);t.default=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),(0,a.default)(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}()},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}t.__esModule=!0;var o=n(469),a=r(o),i=n(466),s=r(i),c=n(61),u=r(c);t.default=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+("undefined"==typeof t?"undefined":(0,u.default)(t)));e.prototype=(0,s.default)(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(a.default?(0,a.default)(e,t):e.__proto__=t)}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}t.__esModule=!0;var o=n(61),a=r(o);t.default=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!==("undefined"==typeof t?"undefined":(0,a.default)(t))&&"function"!=typeof t?e:t}},function(e,t,n){"use strict";function r(e){for(var t=arguments.length-1,n="Minified React error #"+e+"; visit http://facebook.github.io/react/docs/error-decoder.html?invariant="+e,r=0;r<t;r++)n+="&args[]="+encodeURIComponent(arguments[r+1]);n+=" for the full message or use the non-minified dev environment for full errors and additional helpful warnings.";var o=new Error(n);throw o.name="Invariant Violation",o.framesToPop=1,o}e.exports=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(819);n.d(t,"Confirm",function(){return r.a});var o=n(136);n.d(t,"Portal",function(){return o.a});var a=n(212);n.d(t,"Radio",function(){return a.a});var i=n(361);n.d(t,"Select",function(){return i.a});var s=n(362);n.d(t,"TextArea",function(){return s.a});var c=n(825);n.d(t,"Breadcrumb",function(){return c.a});var u=n(363);n.d(t,"BreadcrumbDivider",function(){return u.a});var l=n(364);n.d(t,"BreadcrumbSection",function(){return l.a});var d=n(827);n.d(t,"Form",function(){return d.a});var p=n(365);n.d(t,"FormButton",function(){return p.a});var f=n(366);n.d(t,"FormCheckbox",function(){return f.a});var h=n(367);n.d(t,"FormDropdown",function(){return h.a});var v=n(41);n.d(t,"FormField",function(){return v.a});var m=n(368);n.d(t,"FormGroup",function(){return m.a});var g=n(369);n.d(t,"FormInput",function(){return g.a});var y=n(370);n.d(t,"FormRadio",function(){return y.a});var b=n(371);n.d(t,"FormSelect",function(){return b.a});var _=n(372);n.d(t,"FormTextArea",function(){return _.a});var E=n(829);n.d(t,"Grid",function(){return E.a});var x=n(373);n.d(t,"GridColumn",function(){return x.a});var C=n(374);n.d(t,"GridRow",function(){return C.a});var w=n(831);n.d(t,"Menu",function(){return w.a});var O=n(375);n.d(t,"MenuHeader",function(){return O.a});var N=n(376);n.d(t,"MenuItem",function(){return N.a});var P=n(377);n.d(t,"MenuMenu",function(){return P.a});var k=n(833);n.d(t,"Message",function(){return k.a});var S=n(378);n.d(t,"MessageContent",function(){return S.a});var T=n(379);n.d(t,"MessageHeader",function(){return T.a});var I=n(213);n.d(t,"MessageItem",function(){return I.a});var M=n(380);n.d(t,"MessageList",function(){return M.a});var A=n(835);n.d(t,"Table",function(){return A.a});var j=n(381);n.d(t,"TableBody",function(){return j.a});var L=n(137);n.d(t,"TableCell",function(){return L.a});var D=n(382);n.d(t,"TableFooter",function(){return D.a});var R=n(214);n.d(t,"TableHeader",function(){return R.a});var F=n(383);n.d(t,"TableHeaderCell",function(){return F.a});var U=n(384);n.d(t,"TableRow",function(){return U.a});var B=n(385);n.d(t,"Button",function(){return B.a});var W=n(386);n.d(t,"ButtonContent",function(){return W.a});var V=n(387);n.d(t,"ButtonGLine truncated
|
|
||||||
object-assign
|
|
||||||
(c) Sindre Sorhus
|
|
||||||
@license MIT
|
|
||||||
*/
|
|
||||||
var a=Object.getOwnPropertySymbols,i=Object.prototype.hasOwnProperty,s=Object.prototype.propertyIsEnumerable;e.exports=o()?Object.assign:function(e,t){for(var n,o,c=r(e),u=1;u<arguments.length;u++){n=Object(arguments[u]);for(var l in n)i.call(n,l)&&(c[l]=n[l]);if(a){o=a(n);for(var d=0;d<o.length;d++)s.call(n,o[d])&&(c[o[d]]=n[o[d]])}}return c}},function(e,t){e.exports={}},function(e,t,n){function r(e,t,n){return o(a,e,t,n)}var o=n(686),a=n(688);e.exports=r},function(e,t,n){"use strict";function r(e,t){return 1===e.nodeType&&e.getAttribute(h)===String(t)||8===e.nodeType&&e.nodeValue===" react-text: "+t+" "||8===e.nodeType&&e.nodeValue===" react-empty: "+t+" "}function o(e){for(var t;t=e._renderedComponent;)e=t;return e}function a(e,t){var n=o(e);n._hostNode=t,t[m]=n}function i(e){var t=e._hostNode;t&&(delete t[m],e._hostNode=null)}function s(e,t){if(!(e._flags&v.hasCachedChildNodes)){var n=e._renderedChildren,i=t.firstChild;e:for(var s in n)if(n.hasOwnProperty(s)){var c=n[s],u=o(c)._domID;if(0!==u){for(;null!==i;i=i.nextSibling)if(r(i,u)){a(c,i);continue e}d("32",u)}}e._flags|=v.hasCachedChildNodes}}function c(e){if(e[m])return e[m];for(var t=[];!e[m];){if(t.push(e),!e.parentNode)return null;e=e.parentNode}for(var n,r;e&&(r=e[m]);e=t.pop())n=r,t.length&&s(r,e);return n}function u(e){var t=c(e);return null!=t&&t._hostNode===e?t:null}function l(e){if(void 0===e._hostNode?d("33"):void 0,e._hostNode)return e._hostNode;for(var t=[];!e._hostNode;)t.push(e),e._hostParent?void 0:d("34"),e=e._hostParent;for(;t.length;e=t.pop())s(e,e._hostNode);return e._hostNode}var d=n(12),p=n(71),f=n(330),h=(n(6),p.ID_ATTRIBUTE_NAME),v=f,m="__reactInternalInstance$"+Math.random().toString(36).slice(2),g={getClosestInstanceFromNode:c,getInstanceFromNode:u,getNodeFromInstance:l,precacheChildNodes:s,precacheNode:a,uncacheNode:i};e.exports=g},function(e,t,n){function r(e,t){var n=s(e)?o:i;return n(e,a(t,3))}var o=n(36),a=n(30),i=n(275),s=n(14);e.exports=r},function(e,t,n){"use strict";var r=n(138);n.d(t,"a",function(){return r.a})},function(e,t,n){"use strict";var r=!("undefined"==typeof window||!window.document||!window.document.createElement),o={canUseDOM:r,canUseWorkers:"undefined"!=typeof Worker,canUseEventListeners:r&&!(!window.addEventListener&&!window.attachEvent),canUseViewport:r&&!!window.screen,isInWorker:!r};e.exports=o},function(e,t,n){var r=n(286),o="object"==typeof self&&self&&self.Object===Object&&self,a=r||o||Function("return this")();e.exports=a},function(e,t){function n(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}e.exports=n},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=t.add_dialog_msg=function(e,t){return{type:"dialog_addmsg",msg:e,act:t||null}},o=(t.remove_dialog_msg=function(){return{type:"dialog_remove_first"}},t.set_i18n=function(e){return{type:"i18n_set_ctx",i18n:e}},t.toggle_menu=function(e){return{type:e?"ui_show_menu":"ui_hide_menu"}},t.toggle_loading=function(e){return{type:e?"ui_show_loading":"ui_hide_loading"}}),a=t.getRequest=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t={method:"post",headers:{Accept:"application/json","Content-Type":"application/json"},mode:"cors"},n=sessionStorage.getItem("token");return n&&(t.headers["x-auth-token"]=n),t.body=JSON.stringify({data:e}),t},i=t.get_network_info=function(){return function(e){return e(o(1)),fetch("/api/system/getnetwork",a()).then(function(e){return e.json()}).then(function(t){if(e(o(0)),1!=t.status)return e(r(t.message));var n={};return"data"in t&&"record"in t.data&&t.data.record.length>0&&(n=t.data.record[0]),e(s(n))})}},s=function(e){return{type:"network_info",network:e}},c=(t.set_network_info=function(e,t,n,s,c){return function(u){u(o(1));var l=e?"dhcp":"manual",d=a(),p={data:{type:l,ip:t,netmask:n,gateway:s,dns:c}};return d.body=JSON.stringify(p),fetch("/api/system/updatenetwork",d).then(function(e){return e.json()}).then(function(e){return u(o(0)),u(1!=e.status?r(e.message):i())})}},t.get_system_time=function(){return function(e){return e(o(1)),fetch("/api/system/gettime",a()).then(function(e){return e.json()}).then(function(t){if(e(o(0)),1!=t.status)return e(r(t.message));var n="";return"data"in t&&"record"in t.data&&t.data.record.length>0&&(n=t.data.record[0].time),e(u(n))})}}),u=function(e){return{type:"system_time",time:e}},l=(t.set_system_time=function(e){return function(t){t(o(1));var n=a({time:e});return fetch("/api/system/updatetime",n).then(function(e){return e.json()}).then(function(e){return t(o(0)),t(1!=e.status?r(e.message):c())})}},t.get_user_list=function(){return function(e){e(o(1));var t=a();return fetch("/api/system/getuserlist",t).then(function(e){return e.json()}).then(function(t){return e(o(0)),e(1!=t.status?r(t.message):d(t.data.record))})}}),d=function(e){return{type:"user_list",user:e}},p=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function(n){n(o(1));var i=a(t);return fetch(e,i).then(function(e){retLine truncated
|
|
||||||
u.createElement),h=u.createFactory,v=u.cloneElement,m=r,g={Children:{map:o.map,forEach:o.forEach,count:o.count,toArray:o.toArray,only:p},Component:a,PureComponent:i,createElement:f,cloneElement:v,isValidElement:u.isValidElement,PropTypes:l,createClass:s.createClass,createFactory:h,createMixin:function(e){return e},DOM:c,version:d,__spread:m};e.exports=g},function(e,t,n){"use strict";function r(e){return void 0!==e.ref}function o(e){return void 0!==e.key}var a=n(16),i=n(40),s=(n(7),n(356),Object.prototype.hasOwnProperty),c=n(354),u={key:!0,ref:!0,__self:!0,__source:!0},l=function(e,t,n,r,o,a,i){var s={$$typeof:c,type:e,key:t,ref:n,props:i,_owner:a};return s};l.createElement=function(e,t,n){var a,c={},d=null,p=null,f=null,h=null;if(null!=t){r(t)&&(p=t.ref),o(t)&&(d=""+t.key),f=void 0===t.__self?null:t.__self,h=void 0===t.__source?null:t.__source;for(a in t)s.call(t,a)&&!u.hasOwnProperty(a)&&(c[a]=t[a])}var v=arguments.length-2;if(1===v)c.children=n;else if(v>1){for(var m=Array(v),g=0;g<v;g++)m[g]=arguments[g+2];c.children=m}if(e&&e.defaultProps){var y=e.defaultProps;for(a in y)void 0===c[a]&&(c[a]=y[a])}return l(e,d,p,f,h,i.current,c)},l.createFactory=function(e){var t=l.createElement.bind(null,e);return t.type=e,t},l.cloneAndReplaceKey=function(e,t){var n=l(e.type,t,e.ref,e._self,e._source,e._owner,e.props);return n},l.cloneElement=function(e,t,n){var c,d=a({},e.props),p=e.key,f=e.ref,h=e._self,v=e._source,m=e._owner;if(null!=t){r(t)&&(f=t.ref,m=i.current),o(t)&&(p=""+t.key);var g;e.type&&e.type.defaultProps&&(g=e.type.defaultProps);for(c in t)s.call(t,c)&&!u.hasOwnProperty(c)&&(void 0===t[c]&&void 0!==g?d[c]=g[c]:d[c]=t[c])}var y=arguments.length-2;if(1===y)d.children=n;else if(y>1){for(var b=Array(y),_=0;_<y;_++)b[_]=arguments[_+2];d.children=b}return l(e.type,p,f,h,v,m,d)},l.isValidElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===c},e.exports=l},function(e,t,n){"use strict";function r(e){for(var t=arguments.length-1,n="Minified React error #"+e+"; visit http://facebook.github.io/react/docs/error-decoder.html?invariant="+e,r=0;r<t;r++)n+="&args[]="+encodeURIComponent(arguments[r+1]);n+=" for the full message or use the non-minified dev environment for full errors and additional helpful warnings.";var o=new Error(n);throw o.name="Invariant Violation",o.framesToPop=1,o}e.exports=r},function(e,t,n){"use strict";var r=n(393);n.d(t,"a",function(){return r.a})},function(e,t){e.exports=function(e){return"object"==typeof e?null!==e:"function"==typeof e}},function(e,t){e.exports={}},function(e,t,n){var r=n(252),o=n(153);e.exports=Object.keys||function(e){return r(e,o)}},function(e,t){e.exports=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}}},function(e,t,n){"use strict";var r={};e.exports=r},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var o=function(){function e(){r(this,e),this.observers={}}return e.prototype.on=function(e,t){var n=this;e.split(" ").forEach(function(e){n.observers[e]=n.observers[e]||[],n.observers[e].push(t)})},e.prototype.off=function(e,t){var n=this;this.observers[e]&&this.observers[e].forEach(function(){if(t){var r=n.observers[e].indexOf(t);r>-1&&n.observers[e].splice(r,1)}else delete n.observers[e]})},e.prototype.emit=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];if(this.observers[e]){var o=[].concat(this.observers[e]);o.forEach(function(e){e.apply(void 0,n)})}if(this.observers["*"]){var a=[].concat(this.observers["*"]);a.forEach(function(t){var r;t.apply(t,(r=[e]).concat.apply(r,n))})}},e}();t.a=o},function(e,t,n){"use strict";function r(e){return null==e?"":""+e}function o(e,t,n){e.forEach(function(e){t[e]&&(n[e]=t[e])})}function a(e,t,n){function r(e){return e&&e.indexOf("###")>-1?e.replace(/###/g,"."):e}for(var o="string"!=typeof t?[].concat(t):t.split(".");o.length>1;){if(!e)return{};var a=r(o.shift());!e[a]&&n&&(e[a]=new n),e=e[a]}return e?{obj:e,k:r(o.shift())}:{}}function i(e,t,n){var r=a(e,t,Object),o=r.obj,i=r.k;o[i]=n}function s(e,t,n,r){var o=a(e,t,Object),i=o.obj,s=o.k;i[s]=i[s]||[],r&&(i[s]=i[s].concat(n)),r||i[s].push(n)}function c(e,t){var n=a(e,t),r=n.obj,o=n.k;if(r)return r[o]}function u(e,t,n){for(var r in t)r in e?"string"==typeof e[r]||e[r]instanceof String||"string"==typeof t[r]||t[r]instanceof String?n&&(e[r]=t[r]):u(e[r],t[r],n):e[r]=t[r];return e}function l(e){return e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}function d(e){return"string"==typeof e?e.replace(/[&<>"'\/]/g,function(e){return p[e]}):e}t.f=r,t.a=o,t.g=i,t.b=s,t.c=c,t.h=u,t.e=l,t.d=d;var p={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"}},function(e,t){function n(e,t){for(var n=-1,r=null==e?0:e.length;++n<r&&t(e[n],n,e)!==!1;);return e}e.exports=n},function(e,t,n){var r=n(24),o=Object.create,a=function(){function e(){}return function(t){if(!r(t))return{};if(o)return o(t);e.prototype=t;var n=neLine truncated
|
|
||||||
}var o=n(99),a=n(663),i=n(664),s=n(665),c=n(666),u=n(667);r.prototype.clear=a,r.prototype.delete=i,r.prototype.get=s,r.prototype.has=c,r.prototype.set=u,e.exports=r},function(e,t){function n(e,t,n){for(var r=-1,o=null==e?0:e.length;++r<o;)if(n(t,e[r]))return!0;return!1}e.exports=n},function(e,t){function n(e,t){for(var n=-1,r=t.length,o=e.length;++n<r;)e[o+n]=t[n];return e}e.exports=n},function(e,t,n){function r(e,t,n){"__proto__"==t&&o?o(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}var o=n(284);e.exports=r},function(e,t,n){function r(e,t,n,P,k,S){var T,A=t&C,j=t&w,D=t&O;if(n&&(T=k?n(e,P,k,S):n(e)),void 0!==T)return T;if(!E(e))return e;var R=b(e);if(R){if(T=m(e),!A)return l(e,T)}else{var F=v(e),U=F==I||F==M;if(_(e))return u(e,A);if(F==L||F==N||U&&!k){if(T=j||U?{}:y(e),!A)return j?p(e,c(T,e)):d(e,s(T,e))}else{if(!J[F])return k?e:{};T=g(e,F,r,A)}}S||(S=new o);var B=S.get(e);if(B)return B;S.set(e,T);var W=D?j?h:f:j?keysIn:x,V=R?void 0:W(e);return a(V||e,function(o,a){V&&(a=o,o=e[a]),i(T,a,r(o,t,n,a,e,S))}),T}var o=n(171),a=n(84),i=n(104),s=n(269),c=n(560),u=n(597),l=n(111),d=n(606),p=n(607),f=n(287),h=n(288),v=n(184),m=n(636),g=n(637),y=n(638),b=n(14),_=n(90),E=n(24),x=n(27),C=1,w=2,O=4,N="[object Arguments]",P="[object Array]",k="[object Boolean]",S="[object Date]",T="[object Error]",I="[object Function]",M="[object GeneratorFunction]",A="[object Map]",j="[object Number]",L="[object Object]",D="[object RegExp]",R="[object Set]",F="[object String]",U="[object Symbol]",B="[object WeakMap]",W="[object ArrayBuffer]",V="[object DataView]",z="[object Float32Array]",H="[object Float64Array]",q="[object Int8Array]",Y="[object Int16Array]",K="[object Int32Array]",G="[object Uint8Array]",$="[object Uint8ClampedArray]",X="[object Uint16Array]",Q="[object Uint32Array]",J={};J[N]=J[P]=J[W]=J[V]=J[k]=J[S]=J[z]=J[H]=J[q]=J[Y]=J[K]=J[A]=J[j]=J[L]=J[D]=J[R]=J[F]=J[U]=J[G]=J[$]=J[X]=J[Q]=!0,J[T]=J[I]=J[B]=!1,e.exports=r},function(e,t,n){function r(e,t){return e&&o(e,t,a)}var o=n(564),a=n(27);e.exports=r},function(e,t,n){function r(e,t,n,i,s){return e===t||(null==e||null==t||!a(e)&&!a(t)?e!==e&&t!==t:o(e,t,n,i,r,s))}var o=n(571),a=n(34);e.exports=r},function(e,t,n){function r(e){if(!o(e))return a(e);var t=[];for(var n in Object(e))s.call(e,n)&&"constructor"!=n&&t.push(n);return t}var o=n(87),a=n(655),i=Object.prototype,s=i.hasOwnProperty;e.exports=r},function(e,t){function n(){}e.exports=n},function(e,t,n){function r(e){var t=new e.constructor(e.byteLength);return new o(t).set(new o(e)),t}var o=n(264);e.exports=r},function(e,t,n){var r=n(297),o=n(319),a=r?function(e){return r.get(e)}:o;e.exports=a},function(e,t){function n(e){var t=e;return t.placeholder}e.exports=n},function(e,t,n){var r=n(266),o=n(323),a=Object.prototype,i=a.propertyIsEnumerable,s=Object.getOwnPropertySymbols,c=s?function(e){return null==e?[]:(e=Object(e),r(s(e),function(t){return i.call(e,t)}))}:o;e.exports=c},function(e,t,n){var r=n(552),o=n(169),a=n(554),i=n(263),s=n(265),c=n(48),u=n(305),l="[object Map]",d="[object Object]",p="[object Promise]",f="[object Set]",h="[object WeakMap]",v="[object DataView]",m=u(r),g=u(o),y=u(a),b=u(i),_=u(s),E=c;(r&&E(new r(new ArrayBuffer(1)))!=v||o&&E(new o)!=l||a&&E(a.resolve())!=p||i&&E(new i)!=f||s&&E(new s)!=h)&&(E=function(e){var t=c(e),n=t==d?e.constructor:void 0,r=n?u(n):"";if(r)switch(r){case m:return v;case g:return l;case y:return p;case b:return f;case _:return h}return t}),e.exports=E},function(e,t,n){function r(e,t){if(o(e))return!1;var n=typeof e;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=e&&!a(e))||(s.test(e)||!i.test(e)||null!=t&&e in Object(t))}var o=n(14),a=n(59),i=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,s=/^\w*$/;e.exports=r},function(e,t,n){var r=n(588),o=n(303),a=o(r);e.exports=a},function(e,t,n){function r(e,t){var n=s(e)?o:a;return n(e,i(t,3))}var o=n(266),a=n(563),i=n(30),s=n(14);e.exports=r},function(e,t,n){var r=n(617),o=n(309),a=r(o);e.exports=a},function(e,t,n){function r(e){if(null==e)return!0;if(c(e)&&(s(e)||"string"==typeof e||"function"==typeof e.splice||u(e)||d(e)||i(e)))return!e.length;var t=a(e);if(t==p||t==f)return!e.size;if(l(e))return!o(e).length;for(var n in e)if(v.call(e,n))return!1;return!0}var o=n(178),a=n(184),i=n(122),s=n(14),c=n(33),u=n(90),l=n(87),d=n(125),p="[object Map]",f="[object Set]",h=Object.prototype,v=h.hasOwnProperty;e.exports=r},function(e,t,n){function r(e,t){return o(e,t)}var o=n(177);e.exports=r},function(e,t){function n(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=r}var r=9007199254740991;e.exports=n},function(e,t,n){function r(e){return null==e?[]:o(e,a(e))}var o=n(594),a=n(27);e.exports=r},function(e,t,n){"use strict";function r(e,t){return Array.isArray(t)&&(t=t[1]),t?t.nextSibling:e.firstChild}function o(e,t,n){l.insertTreeBefore(e,t,n)}function a(e,t,n){Array.isArray(t)?s(e,t[0],t[1],n):v(e,t,n)}function i(e,t){if(Array.isArray(t)){var n=t[1];t=t[0],c(e,t,n),e.removeChild(n)}e.removeChild(t)}function s(e,t,n,r){for(vLine truncated
|
|
||||||
* Checks if an event is supported in the current execution environment.
|
|
||||||
*
|
|
||||||
* NOTE: This will not work correctly for non-generic events such as `change`,
|
|
||||||
* `reset`, `load`, `error`, and `select`.
|
|
||||||
*
|
|
||||||
* Borrows from Modernizr.
|
|
||||||
*
|
|
||||||
* @param {string} eventNameSuffix Event name, e.g. "click".
|
|
||||||
* @param {?boolean} capture Check if the capture phase is supported.
|
|
||||||
* @return {boolean} True if the event is supported.
|
|
||||||
* @internal
|
|
||||||
* @license Modernizr 3.0.0pre (Custom Build) | MIT
|
|
||||||
*/
|
|
||||||
function r(e,t){if(!a.canUseDOM||t&&!("addEventListener"in document))return!1;var n="on"+e,r=n in document;if(!r){var i=document.createElement("div");i.setAttribute(n,"return;"),r="function"==typeof i[n]}return!r&&o&&"wheel"===e&&(r=document.implementation.hasFeature("Events.wheel","3.0")),r}var o,a=n(22);a.canUseDOM&&(o=document.implementation&&document.implementation.hasFeature&&document.implementation.hasFeature("","")!==!0),e.exports=r},function(e,t,n){"use strict";function r(e,t){var n=null===e||e===!1,r=null===t||t===!1;if(n||r)return n===r;var o=typeof e,a=typeof t;return"string"===o||"number"===o?"string"===a||"number"===a:"object"===a&&e.type===t.type&&e.key===t.key}e.exports=r},function(e,t,n){"use strict";var r=(n(16),n(29)),o=(n(7),r);e.exports=o},function(e,t,n){"use strict";function r(e){"undefined"!=typeof console&&"function"==typeof console.error&&console.error(e);try{throw new Error(e)}catch(e){}}t.a=r},function(e,t,n){"use strict";function r(e,t,n){this.props=e,this.context=t,this.refs=i,this.updater=n||a}var o=n(75),a=n(211),i=(n(356),n(81));n(6),n(7);r.prototype.isReactComponent={},r.prototype.setState=function(e,t){"object"!=typeof e&&"function"!=typeof e&&null!=e?o("85"):void 0,this.updater.enqueueSetState(this,e),t&&this.updater.enqueueCallback(this,t,"setState")},r.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this),e&&this.updater.enqueueCallback(this,e,"forceUpdate")};e.exports=r},function(e,t,n){"use strict";function r(e,t){}var o=(n(7),{isMounted:function(e){return!1},enqueueCallback:function(e,t){},enqueueForceUpdate:function(e){r(e,"forceUpdate")},enqueueReplaceState:function(e,t){r(e,"replaceState")},enqueueSetState:function(e,t){r(e,"setState")}});e.exports=o},function(e,t,n){"use strict";var r=n(821);n.d(t,"a",function(){return r.a})},function(e,t,n){"use strict";function r(e){var t=e.children,o=e.className,i=e.content,c=u()("content",o),l=n.i(p.b)(r,e),f=n.i(p.c)(r,e);return d.a.createElement(f,a()({},l,{className:c}),s()(t)?i:t)}var o=n(1),a=n.n(o),i=n(4),s=n.n(i),c=n(3),u=n.n(c),l=n(0),d=n.n(l),p=n(2);r.handledProps=["as","children","className","content"],r._meta={name:"MessageItem",parent:"Message",type:p.d.TYPES.COLLECTION},r.defaultProps={as:"li"},r.create=n.i(p.g)(r,function(e){return{content:e}},!0),t.a=r},function(e,t,n){"use strict";function r(e){var t=e.children,o=e.className,i=e.fullWidth,c=s()(n.i(l.a)(i,"full-width"),o),d=n.i(l.b)(r,e),p=n.i(l.c)(r,e);return u.a.createElement(p,a()({},d,{className:c}),t)}var o=n(1),a=n.n(o),i=n(3),s=n.n(i),c=n(0),u=n.n(c),l=n(2);r.handledProps=["as","children","className","fullWidth"],r._meta={name:"TableHeader",type:l.d.TYPES.COLLECTION,parent:"Table"},r.defaultProps={as:"thead"},t.a=r},function(e,t,n){"use strict";var r=n(385);n.d(t,"a",function(){return r.a})},function(e,t,n){"use strict";var r=n(843);n.d(t,"a",function(){return r.a})},function(e,t,n){"use strict";var r=n(1),o=n.n(r),a=n(8),i=n.n(a),s=n(9),c=n.n(s),u=n(11),l=n.n(u),d=n(10),p=n.n(d),f=n(126),h=n.n(f),v=n(4),m=n.n(v),g=n(3),y=n.n(g),b=n(0),_=n.n(b),E=n(2),x=n(138),C=n(393),w=n(395),O=n(396),N=function(e){function t(){var e,n,r,o;i()(this,t);for(var a=arguments.length,s=Array(a),c=0;c<a;c++)s[c]=arguments[c];return n=r=l()(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(s))),r.handleClick=function(e){var t=r.props.onClick;t&&t(e,r.props)},r.handleRemove=function(e){var t=r.props.onRemove;t&&t(e,r.props)},o=n,l()(r,o)}return p()(t,e),c()(t,[{key:"render",value:function(){var e=this.props,r=e.active,a=e.attached,i=e.basic,s=e.children,c=e.circular,u=e.className,l=e.color,d=e.content,p=e.corner,f=e.detail,v=e.empty,g=e.floating,b=e.horizontal,O=e.icon,N=e.image,P=e.onRemove,k=e.pointing,S=e.removeIcon,T=e.ribbon,I=e.size,M=e.tag,A=k===!0&&"pointing"||("left"===k||"right"===k)&&k+" pointing"||("above"===k||"below"===k)&&"pointing "+k,j=y()("ui",l,A,I,n.i(E.a)(r,"active"),n.i(E.a)(i,"basic"),n.i(E.a)(c,"circular"),n.i(E.a)(v,"empty"),n.i(E.a)(g,"floating"),n.i(E.a)(b,"horizontal"),n.i(E.a)(N===!0,"image"),n.i(E.a)(M,"tag"),n.i(E.h)(p,"corner"),n.i(E.h)(T,"ribbon"),n.i(E.f)(a,"attached"),"label",u),L=n.i(E.b)(t,this.props),D=n.i(E.c)(t,this.props);if(!m()(s))return _.a.createElement(D,o()({},L,{className:j,onClick:this.handleClick}),s);var R=h()(S)?"delete":S;return _.a.createElement(D,o()({className:j,onClick:this.handleClick},L),x.a.create(O),"boolean"!=typeof N&&C.a.create(N),d,n.i(E.j)(w.a,function(e){return{content:e}},f),P&&x.a.create(R,{onClick:this.handleRemove}))}}]),t}(b.Component);N._meta={name:"Label",type:E.d.TYPES.ELEMENT},N.Detail=w.a,N.Group=O.a,t.a=N,N.handledProps=["active","as","attached","basic","children","circular","className","color","content","corner","detail","empty","floating","horizontal","icon","image","onClick","onRemove","pointing","removeIcon","ribbon","size","tag"],N.create=n.i(E.g)(N,function(e){return{content:e}})},function(e,t,n){"use strict";function r(e){var t=e.children,o=e.classNameLine truncated
|
|
||||||
},borderBottom:{borderBottomWidth:!0,borderBottomStyle:!0,borderBottomColor:!0},borderLeft:{borderLeftWidth:!0,borderLeftStyle:!0,borderLeftColor:!0},borderRight:{borderRightWidth:!0,borderRightStyle:!0,borderRightColor:!0},borderTop:{borderTopWidth:!0,borderTopStyle:!0,borderTopColor:!0},font:{fontStyle:!0,fontVariant:!0,fontWeight:!0,fontSize:!0,lineHeight:!0,fontFamily:!0},outline:{outlineWidth:!0,outlineStyle:!0,outlineColor:!0}},s={isUnitlessNumber:o,shorthandPropertyExpansions:i};e.exports=s},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var o=n(12),a=n(60),i=(n(6),function(){function e(t){r(this,e),this._callbacks=null,this._contexts=null,this._arg=t}return e.prototype.enqueue=function(e,t){this._callbacks=this._callbacks||[],this._callbacks.push(e),this._contexts=this._contexts||[],this._contexts.push(t)},e.prototype.notifyAll=function(){var e=this._callbacks,t=this._contexts,n=this._arg;if(e&&t){e.length!==t.length?o("24"):void 0,this._callbacks=null,this._contexts=null;for(var r=0;r<e.length;r++)e[r].call(t[r],n);e.length=0,t.length=0}},e.prototype.checkpoint=function(){return this._callbacks?this._callbacks.length:0},e.prototype.rollback=function(e){this._callbacks&&this._contexts&&(this._callbacks.length=e,this._contexts.length=e)},e.prototype.reset=function(){this._callbacks=null,this._contexts=null},e.prototype.destructor=function(){this.reset()},e}());e.exports=a.addPoolingTo(i)},function(e,t,n){"use strict";function r(e){return!!u.hasOwnProperty(e)||!c.hasOwnProperty(e)&&(s.test(e)?(u[e]=!0,!0):(c[e]=!0,!1))}function o(e,t){return null==t||e.hasBooleanValue&&!t||e.hasNumericValue&&isNaN(t)||e.hasPositiveNumericValue&&t<1||e.hasOverloadedBooleanValue&&t===!1}var a=n(71),i=(n(19),n(31),n(790)),s=(n(7),new RegExp("^["+a.ATTRIBUTE_NAME_START_CHAR+"]["+a.ATTRIBUTE_NAME_CHAR+"]*$")),c={},u={},l={createMarkupForID:function(e){return a.ID_ATTRIBUTE_NAME+"="+i(e)},setAttributeForID:function(e,t){e.setAttribute(a.ID_ATTRIBUTE_NAME,t)},createMarkupForRoot:function(){return a.ROOT_ATTRIBUTE_NAME+'=""'},setAttributeForRoot:function(e){e.setAttribute(a.ROOT_ATTRIBUTE_NAME,"")},createMarkupForProperty:function(e,t){var n=a.properties.hasOwnProperty(e)?a.properties[e]:null;if(n){if(o(n,t))return"";var r=n.attributeName;return n.hasBooleanValue||n.hasOverloadedBooleanValue&&t===!0?r+'=""':r+"="+i(t)}return a.isCustomAttribute(e)?null==t?"":e+"="+i(t):null},createMarkupForCustomAttribute:function(e,t){return r(e)&&null!=t?e+"="+i(t):""},setValueForProperty:function(e,t,n){var r=a.properties.hasOwnProperty(t)?a.properties[t]:null;if(r){var i=r.mutationMethod;if(i)i(e,n);else{if(o(r,n))return void this.deleteValueForProperty(e,t);if(r.mustUseProperty)e[r.propertyName]=n;else{var s=r.attributeName,c=r.attributeNamespace;c?e.setAttributeNS(c,s,""+n):r.hasBooleanValue||r.hasOverloadedBooleanValue&&n===!0?e.setAttribute(s,""):e.setAttribute(s,""+n)}}}else if(a.isCustomAttribute(t))return void l.setValueForAttribute(e,t,n)},setValueForAttribute:function(e,t,n){if(r(t)){null==n?e.removeAttribute(t):e.setAttribute(t,""+n)}},deleteValueForAttribute:function(e,t){e.removeAttribute(t)},deleteValueForProperty:function(e,t){var n=a.properties.hasOwnProperty(t)?a.properties[t]:null;if(n){var r=n.mutationMethod;if(r)r(e,void 0);else if(n.mustUseProperty){var o=n.propertyName;n.hasBooleanValue?e[o]=!1:e[o]=""}else e.removeAttribute(n.attributeName)}else a.isCustomAttribute(t)&&e.removeAttribute(t)}};e.exports=l},function(e,t,n){"use strict";var r={hasCachedChildNodes:1};e.exports=r},function(e,t,n){"use strict";function r(){if(this._rootNodeID&&this._wrapperState.pendingUpdate){this._wrapperState.pendingUpdate=!1;var e=this._currentElement.props,t=s.getValue(e);null!=t&&o(this,Boolean(e.multiple),t)}}function o(e,t,n){var r,o,a=c.getNodeFromInstance(e).options;if(t){for(r={},o=0;o<n.length;o++)r[""+n[o]]=!0;for(o=0;o<a.length;o++){var i=r.hasOwnProperty(a[o].value);a[o].selected!==i&&(a[o].selected=i)}}else{for(r=""+n,o=0;o<a.length;o++)if(a[o].value===r)return void(a[o].selected=!0);a.length&&(a[0].selected=!0)}}function a(e){var t=this._currentElement.props,n=s.executeOnChange(t,e);return this._rootNodeID&&(this._wrapperState.pendingUpdate=!0),u.asap(r,this),n}var i=n(16),s=n(198),c=n(19),u=n(35),l=(n(7),!1),d={getHostProps:function(e,t){return i({},t,{onChange:e._wrapperState.onChange,value:void 0})},mountWrapper:function(e,t){var n=s.getValue(t);e._wrapperState={pendingUpdate:!1,initialValue:null!=n?n:t.defaultValue,listeners:null,onChange:a.bind(e),wasMultiple:Boolean(t.multiple)},void 0===t.value||void 0===t.defaultValue||l||(l=!0)},getSelectValueContext:function(e){return e._wrapperState.initialValue},postUpdateWrapper:function(e){var t=e._currentElement.props;e._wrapperState.initialValue=void 0;var n=e._wrapperState.wasMultiple;e._wrapperState.wasMultiple=Boolean(t.multiple);var r=s.getValue(t);null!=r?(e._wrapperState.pendingUpdate=!1,o(e,BLine truncated
|
|
||||||
return u.a.createElement(C,a()({},x,{className:E}),t)}var o=n(1),a=n.n(o),i=n(3),s=n.n(i),c=n(0),u=n.n(c),l=n(2);r.handledProps=["as","children","className","color","computer","floated","largeScreen","mobile","only","stretched","tablet","textAlign","verticalAlign","widescreen","width"],r._meta={name:"GridColumn",parent:"Grid",type:l.d.TYPES.COLLECTION},t.a=r},function(e,t,n){"use strict";function r(e){var t=e.centered,o=e.children,a=e.className,s=e.color,u=e.columns,p=e.divided,f=e.only,h=e.reversed,v=e.stretched,m=e.textAlign,g=e.verticalAlign,y=c()(s,n.i(d.a)(t,"centered"),n.i(d.a)(p,"divided"),n.i(d.a)(v,"stretched"),n.i(d.s)(m),n.i(d.f)(f,"only"),n.i(d.f)(h,"reversed"),n.i(d.i)(g),n.i(d.e)(u,"column",!0),"row",a),b=n.i(d.b)(r,e),_=n.i(d.c)(r,e);return l.a.createElement(_,i()({},b,{className:y}),o)}var o=n(53),a=(n.n(o),n(1)),i=n.n(a),s=n(3),c=n.n(s),u=n(0),l=n.n(u),d=n(2);r.handledProps=["as","centered","children","className","color","columns","divided","only","reversed","stretched","textAlign","verticalAlign"],r._meta={name:"GridRow",parent:"Grid",type:d.d.TYPES.COLLECTION},t.a=r},function(e,t,n){"use strict";function r(e){var t=e.children,o=e.className,i=e.content,c=u()("header",o),l=n.i(p.b)(r,e),f=n.i(p.c)(r,e);return d.a.createElement(f,a()({},l,{className:c}),s()(t)?i:t)}var o=n(1),a=n.n(o),i=n(4),s=n.n(i),c=n(3),u=n.n(c),l=n(0),d=n.n(l),p=n(2);r.handledProps=["as","children","className","content"],r._meta={name:"MenuHeader",type:p.d.TYPES.COLLECTION,parent:"Menu"},t.a=r},function(e,t,n){"use strict";var r=n(1),o=n.n(r),a=n(8),i=n.n(a),s=n(9),c=n.n(s),u=n(11),l=n.n(u),d=n(10),p=n.n(d),f=n(717),h=n.n(f),v=n(4),m=n.n(v),g=n(3),y=n.n(g),b=n(0),_=n.n(b),E=n(2),x=n(21),C=function(e){function t(){var e,n,r,o;i()(this,t);for(var a=arguments.length,s=Array(a),c=0;c<a;c++)s[c]=arguments[c];return n=r=l()(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(s))),r.handleClick=function(e){var t=r.props.onClick;t&&t(e,r.props)},o=n,l()(r,o)}return p()(t,e),c()(t,[{key:"render",value:function(){var e=this.props,r=e.active,a=e.children,i=e.className,s=e.color,c=e.content,u=e.fitted,l=e.header,d=e.icon,p=e.link,f=e.name,v=e.onClick,g=e.position,b=y()(s,g,n.i(E.a)(r,"active"),n.i(E.a)(d===!0||d&&!(f||c),"icon"),n.i(E.a)(l,"header"),n.i(E.a)(p,"link"),n.i(E.h)(u,"fitted"),"item",i),C=n.i(E.c)(t,this.props,function(){if(v)return"a"}),w=n.i(E.b)(t,this.props);return m()(a)?_.a.createElement(C,o()({},w,{className:b,onClick:this.handleClick}),x.a.create(d),c||h()(f)):_.a.createElement(C,o()({},w,{className:b,onClick:this.handleClick}),a)}}]),t}(b.Component);C._meta={name:"MenuItem",type:E.d.TYPES.COLLECTION,parent:"Menu"},t.a=C,C.handledProps=["active","as","children","className","color","content","fitted","header","icon","index","link","name","onClick","position"],C.create=n.i(E.g)(C,function(e){return{content:e,name:e}},!0)},function(e,t,n){"use strict";function r(e){var t=e.children,o=e.className,i=e.position,c=s()(i,"menu",o),d=n.i(l.b)(r,e),p=n.i(l.c)(r,e);return u.a.createElement(p,a()({},d,{className:c}),t)}var o=n(1),a=n.n(o),i=n(3),s=n.n(i),c=n(0),u=n.n(c),l=n(2);r.handledProps=["as","children","className","position"],r._meta={name:"MenuMenu",type:l.d.TYPES.COLLECTION,parent:"Menu"},t.a=r},function(e,t,n){"use strict";function r(e){var t=e.children,o=e.className,i=s()("content",o),c=n.i(l.b)(r,e),d=n.i(l.c)(r,e);return u.a.createElement(d,a()({},c,{className:i}),t)}var o=n(1),a=n.n(o),i=n(3),s=n.n(i),c=n(0),u=n.n(c),l=n(2);r.handledProps=["as","children","className"],r._meta={name:"MessageContent",parent:"Message",type:l.d.TYPES.COLLECTION},t.a=r},function(e,t,n){"use strict";function r(e){var t=e.children,o=e.className,i=e.content,c=u()("header",o),l=n.i(p.b)(r,e),f=n.i(p.c)(r,e);return d.a.createElement(f,a()({},l,{className:c}),s()(t)?i:t)}var o=n(1),a=n.n(o),i=n(4),s=n.n(i),c=n(3),u=n.n(c),l=n(0),d=n.n(l),p=n(2);r.handledProps=["as","children","className","content"],r._meta={name:"MessageHeader",parent:"Message",type:p.d.TYPES.COLLECTION},r.create=n.i(p.g)(r,function(e){return{content:e}}),t.a=r},function(e,t,n){"use strict";function r(e){var t=e.children,o=e.className,i=e.items,c=d()("list",o),l=n.i(h.b)(r,e),p=n.i(h.c)(r,e);return f.a.createElement(p,a()({},l,{className:c}),u()(t)?s()(i,v.a.create):t)}var o=n(1),a=n.n(o),i=n(20),s=n.n(i),c=n(4),u=n.n(c),l=n(3),d=n.n(l),p=n(0),f=n.n(p),h=n(2),v=n(213);r.handledProps=["as","children","className","items"],r._meta={name:"MessageList",parent:"Message",type:h.d.TYPES.COLLECTION},r.defaultProps={as:"ul"},r.create=n.i(h.g)(r,function(e){return{items:e}}),t.a=r},function(e,t,n){"use strict";function r(e){var t=e.children,o=e.className,i=s()(o),c=n.i(l.b)(r,e),d=n.i(l.c)(r,e);return u.a.createElement(d,a()({},c,{className:i}),t)}var o=n(1),a=n.n(o),i=n(3),s=n.n(i),c=n(0),u=n.n(c),l=n(2);r.handledProps=["as","children","className"],r._meta={name:"TableBody",type:l.d.TYPES.COLLECTION,parent:"Table"},r.defaultProps={as:"tbody"},t.a=r},function(Line truncated
|
|
||||||
r._meta={name:"SearchResults",parent:"Search",type:l.d.TYPES.MODULE},t.a=r},function(e,t,n){"use strict";function r(e){var t=e.className,o=e.children,i=s()("pushable",t),c=n.i(l.b)(r,e),d=n.i(l.c)(r,e);return u.a.createElement(d,a()({},c,{className:i}),o)}var o=n(1),a=n.n(o),i=n(3),s=n.n(i),c=n(0),u=n.n(c),l=n(2);r.handledProps=["as","children","className"],r._meta={name:"SidebarPushable",type:l.d.TYPES.MODULE,parent:"Sidebar"},t.a=r},function(e,t,n){"use strict";function r(e){var t=e.className,o=e.dimmed,i=e.children,c=s()("pusher",n.i(l.a)(o,"dimmed"),t),d=n.i(l.b)(r,e),p=n.i(l.c)(r,e);return u.a.createElement(p,a()({},d,{className:c}),i)}var o=n(1),a=n.n(o),i=n(3),s=n.n(i),c=n(0),u=n.n(c),l=n(2);r.handledProps=["as","children","className","dimmed"],r._meta={name:"SidebarPusher",type:l.d.TYPES.MODULE,parent:"Sidebar"},t.a=r},function(e,t,n){"use strict";var r=n(1),o=n.n(r),a=n(8),i=n.n(a),s=n(9),c=n.n(s),u=n(11),l=n.n(u),d=n(10),p=n.n(d),f=n(4),h=n.n(f),v=n(3),m=n.n(v),g=n(0),y=n.n(g),b=n(2),_=n(76),E=n(428),x=n(224),C=n(429),w=n(225),O=n(226),N=function(e){function t(){var e,n,r,o;i()(this,t);for(var a=arguments.length,s=Array(a),c=0;c<a;c++)s[c]=arguments[c];return n=r=l()(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(s))),r.handleClick=function(e){var t=r.props.onClick;t&&t(e,r.props)},o=n,l()(r,o)}return p()(t,e),c()(t,[{key:"render",value:function(){var e=this.props,r=e.centered,a=e.children,i=e.className,s=e.color,c=e.description,u=e.extra,l=e.fluid,d=e.header,p=e.href,f=e.image,v=e.meta,g=e.onClick,x=e.raised,C=m()("ui",s,n.i(b.a)(r,"centered"),n.i(b.a)(l,"fluid"),n.i(b.a)(x,"raised"),"card",i),w=n.i(b.b)(t,this.props),O=n.i(b.c)(t,this.props,function(){if(g)return"a"});return h()(a)?y.a.createElement(O,o()({},w,{className:C,href:p,onClick:this.handleClick}),_.a.create(f),(c||d||v)&&y.a.createElement(E.a,{description:c,header:d,meta:v}),u&&y.a.createElement(E.a,{extra:!0},u)):y.a.createElement(O,o()({},w,{className:C,href:p,onClick:this.handleClick}),a)}}]),t}(g.Component);N._meta={name:"Card",type:b.d.TYPES.VIEW},N.Content=E.a,N.Description=x.a,N.Group=C.a,N.Header=w.a,N.Meta=O.a,t.a=N,N.handledProps=["as","centered","children","className","color","description","extra","fluid","header","href","image","meta","onClick","raised"]},function(e,t,n){"use strict";function r(e){var t=e.children,o=e.className,i=e.description,c=e.extra,l=e.header,m=e.meta,g=u()(o,n.i(p.a)(c,"extra"),"content"),y=n.i(p.b)(r,e),b=n.i(p.c)(r,e);return s()(t)?d.a.createElement(b,a()({},y,{className:g}),n.i(p.j)(h.a,function(e){return{content:e}},l),n.i(p.j)(v.a,function(e){return{content:e}},m),n.i(p.j)(f.a,function(e){return{content:e}},i)):d.a.createElement(b,a()({},y,{className:g}),t)}var o=n(1),a=n.n(o),i=n(4),s=n.n(i),c=n(3),u=n.n(c),l=n(0),d=n.n(l),p=n(2),f=n(224),h=n(225),v=n(226);r.handledProps=["as","children","className","description","extra","header","meta"],r._meta={name:"CardContent",parent:"Card",type:p.d.TYPES.VIEW},t.a=r},function(e,t,n){"use strict";function r(e){var t=e.children,o=e.className,i=e.doubling,c=e.items,l=e.itemsPerRow,p=e.stackable,m=d()("ui",n.i(h.a)(i,"doubling"),n.i(h.a)(p,"stackable"),n.i(h.e)(l),o,"cards"),g=n.i(h.b)(r,e),y=n.i(h.c)(r,e);if(!u()(t))return f.a.createElement(y,a()({},g,{className:m}),t);var b=s()(c,function(e){var t=e.key||[e.header,e.description].join("-");return f.a.createElement(v.a,a()({key:t},e))});return f.a.createElement(y,a()({},g,{className:m}),b)}var o=n(1),a=n.n(o),i=n(20),s=n.n(i),c=n(4),u=n.n(c),l=n(3),d=n.n(l),p=n(0),f=n.n(p),h=n(2),v=n(427);r.handledProps=["as","children","className","doubling","items","itemsPerRow","stackable"],r._meta={name:"CardGroup",parent:"Card",type:h.d.TYPES.VIEW},t.a=r},function(e,t,n){"use strict";function r(e){var t=e.active,o=e.className,i=e.children,c=s()(n.i(l.a)(t,"active"),o),d=n.i(l.b)(r,e),p=n.i(l.c)(r,e);return u.a.createElement(p,a()({},d,{className:c}),i)}var o=n(1),a=n.n(o),i=n(3),s=n.n(i),c=n(0),u=n.n(c),l=n(2);r.handledProps=["active","as","children","className"],r._meta={name:"CommentAction",parent:"Comment",type:l.d.TYPES.VIEW},r.defaultProps={as:"a"},t.a=r},function(e,t,n){"use strict";function r(e){var t=e.className,o=e.children,i=s()("actions",t),c=n.i(l.b)(r,e),d=n.i(l.c)(r,e);return u.a.createElement(d,a()({},c,{className:i}),o)}var o=n(1),a=n.n(o),i=n(3),s=n.n(i),c=n(0),u=n.n(c),l=n(2);r.handledProps=["as","children","className"],r._meta={name:"CommentActions",parent:"Comment",type:l.d.TYPES.VIEW},t.a=r},function(e,t,n){"use strict";function r(e){var t=e.className,o=e.children,i=s()("author",t),c=n.i(l.b)(r,e),d=n.i(l.c)(r,e);return u.a.createElement(d,a()({},c,{className:i}),o)}var o=n(1),a=n.n(o),i=n(3),s=n.n(i),c=n(0),u=n.n(c),l=n(2);r.handledProps=["as","children","className"],r._meta={name:"CommentAuthor",parent:"Comment",type:l.d.TYPES.VIEW},t.a=r},function(e,t,n){"use strict";function r(e){var t=e.className,o=e.src,i=s()("avatar",t),c=n.i(l.b)(r,e),d=n.i(l.c)(r,e);return u.a.creaLine truncated
|
|
||||||
}function a(e){var n=this.useColors;if(e[0]=(n?"%c":"")+this.namespace+(n?" %c":" ")+e[0]+(n?"%c ":" ")+"+"+t.humanize(this.diff),n){var r="color: "+this.color;e.splice(1,0,r,"color: inherit");var o=0,a=0;e[0].replace(/%[a-zA-Z%]/g,function(e){"%%"!==e&&(o++,"%c"===e&&(a=o))}),e.splice(a,0,r)}}function i(){return"object"==typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)}function s(e){try{null==e?t.storage.removeItem("debug"):t.storage.debug=e}catch(e){}}function c(){try{return t.storage.debug}catch(e){}if("undefined"!=typeof r&&"env"in r)return n.i({NODE_ENV:"production"}).DEBUG}function u(){try{return window.localStorage}catch(e){}}t=e.exports=n(518),t.log=i,t.formatArgs=a,t.save=s,t.load=c,t.useColors=o,t.storage="undefined"!=typeof chrome&&"undefined"!=typeof chrome.storage?chrome.storage.local:u(),t.colors=["lightseagreen","forestgreen","goldenrod","dodgerblue","darkorchid","crimson"],t.formatters.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}},t.enable(c())}).call(t,n(130))},function(e,t,n){function r(e){var n,r=0;for(n in e)r=(r<<5)-r+e.charCodeAt(n),r|=0;return t.colors[Math.abs(r)%t.colors.length]}function o(e){function n(){if(n.enabled){var e=n,r=+new Date,o=r-(u||r);e.diff=o,e.prev=u,e.curr=r,u=r;for(var a=new Array(arguments.length),i=0;i<a.length;i++)a[i]=arguments[i];a[0]=t.coerce(a[0]),"string"!=typeof a[0]&&a.unshift("%O");var s=0;a[0]=a[0].replace(/%([a-zA-Z%])/g,function(n,r){if("%%"===n)return n;s++;var o=t.formatters[r];if("function"==typeof o){var i=a[s];n=o.call(e,i),a.splice(s,1),s--}return n}),t.formatArgs.call(e,a);var c=n.log||t.log||console.log.bind(console);c.apply(e,a)}}return n.namespace=e,n.enabled=t.enabled(e),n.useColors=t.useColors(),n.color=r(e),"function"==typeof t.init&&t.init(n),n}function a(e){t.save(e),t.names=[],t.skips=[];for(var n=(e||"").split(/[\s,]+/),r=n.length,o=0;o<r;o++)n[o]&&(e=n[o].replace(/\*/g,".*?"),"-"===e[0]?t.skips.push(new RegExp("^"+e.substr(1)+"$")):t.names.push(new RegExp("^"+e+"$")))}function i(){t.enable("")}function s(e){var n,r;for(n=0,r=t.skips.length;n<r;n++)if(t.skips[n].test(e))return!1;for(n=0,r=t.names.length;n<r;n++)if(t.names[n].test(e))return!0;return!1}function c(e){return e instanceof Error?e.stack||e.message:e}t=e.exports=o.debug=o.default=o,t.coerce=c,t.disable=i,t.enable=a,t.enabled=s,t.humanize=n(727),t.names=[],t.skips=[],t.formatters={};var u},function(e,t,n){"use strict";function r(e){return e.replace(o,function(e,t){return t.toUpperCase()})}var o=/-(.)/g;e.exports=r},function(e,t,n){"use strict";function r(e){return o(e.replace(a,"ms-"))}var o=n(519),a=/^-ms-/;e.exports=r},function(e,t,n){"use strict";function r(e,t){return!(!e||!t)&&(e===t||!o(e)&&(o(t)?r(e,t.parentNode):"contains"in e?e.contains(t):!!e.compareDocumentPosition&&!!(16&e.compareDocumentPosition(t))))}var o=n(529);e.exports=r},function(e,t,n){"use strict";function r(e){var t=e.length;if(Array.isArray(e)||"object"!=typeof e&&"function"!=typeof e?i(!1):void 0,"number"!=typeof t?i(!1):void 0,0===t||t-1 in e?void 0:i(!1),"function"==typeof e.callee?i(!1):void 0,e.hasOwnProperty)try{return Array.prototype.slice.call(e)}catch(e){}for(var n=Array(t),r=0;r<t;r++)n[r]=e[r];return n}function o(e){return!!e&&("object"==typeof e||"function"==typeof e)&&"length"in e&&!("setInterval"in e)&&"number"!=typeof e.nodeType&&(Array.isArray(e)||"callee"in e||"item"in e)}function a(e){return o(e)?Array.isArray(e)?e.slice():r(e):[e]}var i=n(6);e.exports=a},function(e,t,n){"use strict";function r(e){var t=e.match(l);return t&&t[1].toLowerCase()}function o(e,t){var n=u;u?void 0:c(!1);var o=r(e),a=o&&s(o);if(a){n.innerHTML=a[1]+e+a[2];for(var l=a[0];l--;)n=n.lastChild}else n.innerHTML=e;var d=n.getElementsByTagName("script");d.length&&(t?void 0:c(!1),i(d).forEach(t));for(var p=Array.from(n.childNodes);n.lastChild;)n.removeChild(n.lastChild);return p}var a=n(22),i=n(522),s=n(524),c=n(6),u=a.canUseDOM?document.createElement("div"):null,l=/^\s*<(\w+)/;e.exports=o},function(e,t,n){"use strict";function r(e){return i?void 0:a(!1),p.hasOwnProperty(e)||(e="*"),s.hasOwnProperty(e)||("*"===e?i.innerHTML="<link />":i.innerHTML="<"+e+"></"+e+">",s[e]=!i.firstChild),s[e]?p[e]:null}var o=n(22),a=n(6),i=o.canUseDOM?document.createElement("div"):null,s={},c=[1,'<select multiple="true">',"</select>"],u=[1,"<table>","</table>"],l=[3,"<table><tbody><tr>","</tr></tbody></table>"],d=[1,'<svg xmlns="http://www.w3.org/2000/svg">',"</svg>"],p={"*":[1,"?<div>","</div>"],area:[1,"<map>","</map>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],legend:[1,"<fieldset>","</fieldset>"],param:[1,"<object>","</object>"],tr:[2,"<table><tbody>","</tbody></table>"],optgroup:c,option:c,caption:u,colgroup:u,tbody:u,tfoot:u,thead:u,td:l,th:l},f=["circle","clipPath","defs","ellipse","g","image","line","linearGradient","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","text","tspan"];f.forELine truncated
|
|
||||||
var s=void 0!==n.count&&"string"!=typeof n.count,c=void 0!==n.context&&"string"==typeof n.context&&""!==n.context,u=n.lngs?n.lngs:t.languageUtils.toResolveHierarchy(n.lng||t.language);i.forEach(function(e){t.isValidLookup(r)||u.forEach(function(o){if(!t.isValidLookup(r)){var i=a,u=[i],l=void 0;s&&(l=t.pluralResolver.getSuffix(o,n.count)),s&&c&&u.push(i+l),c&&u.push(i+=""+t.options.contextSeparator+n.context),s&&u.push(i+=l);for(var d=void 0;d=u.pop();)t.isValidLookup(r)||(r=t.getResource(o,e,d,n))}})})}}),r},t.prototype.isValidLookup=function(e){return!(void 0===e||!this.options.returnNull&&null===e||!this.options.returnEmptyString&&""===e)},t.prototype.getResource=function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return this.resourceStore.getResource(e,t,n,r)},t}(c.a);t.a=h},function(e,t,n){"use strict";function r(){return{debug:!1,initImmediate:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,whitelist:!1,nonExplicitWhitelist:!1,load:"all",preload:!1,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",saveMissing:!1,saveMissingTo:"fallback",missingKeyHandler:!1,postProcess:!1,returnNull:!0,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:function(){},parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:function(e){return{defaultValue:e[1]}},interpolation:{escapeValue:!0,format:function(e,t,n){return e},prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",defaultVariables:void 0}}}function o(e){return"string"==typeof e.ns&&(e.ns=[e.ns]),"string"==typeof e.fallbackLng&&(e.fallbackLng=[e.fallbackLng]),"string"==typeof e.fallbackNS&&(e.fallbackNS=[e.fallbackNS]),e.whitelist&&e.whitelist.indexOf("cimode")<0&&e.whitelist.push("cimode"),e}t.b=r,t.a=o},function(e,t,n){"use strict";function r(e,t){for(var n=Object.getOwnPropertyNames(t),r=0;r<n.length;r++){var o=n[r],a=Object.getOwnPropertyDescriptor(t,o);a&&a.configurable&&void 0===e[o]&&Object.defineProperty(e,o,a)}return e}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):r(e,t))}function s(){}var c=n(46),u=n(82),l=n(540),d=n(541),p=n(538),f=n(539),h=n(537),v=n(535),m=n(536),g=n(542),y=n(261),b=n(260),_="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},E=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},x=function(e){function t(){var r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=arguments[1];o(this,t);var s=a(this,e.call(this));return s.options=n.i(g.a)(r),s.services={},s.logger=c.a,s.modules={},!i||s.isInitialized||r.isClone||s.init(r,i),s}return i(t,e),t.prototype.init=function(e,t){function r(e){if(e)return"function"==typeof e?new e:e}var o=this;if("function"==typeof e&&(t=e,e={}),e||(e={}),"v1"===e.compatibilityAPI?this.options=E({},n.i(g.b)(),n.i(g.a)(b.a(e)),{}):"v1"===e.compatibilityJSON?this.options=E({},n.i(g.b)(),n.i(g.a)(b.b(e)),{}):this.options=E({},n.i(g.b)(),this.options,n.i(g.a)(e)),t||(t=s),!this.options.isClone){this.modules.logger?c.a.init(r(this.modules.logger),this.options):c.a.init(null,this.options);var a=new p.a(this.options);this.store=new l.a(this.options.resources,this.options);var i=this.services;i.logger=c.a,i.resourceStore=this.store,i.resourceStore.on("added removed",function(e,t){i.cacheConnector.save()}),i.languageUtils=a,i.pluralResolver=new f.a(a,{prepend:this.options.pluralSeparator,compatibilityJSON:this.options.compatibilityJSON}),i.interpolator=new h.a(this.options),i.backendConnector=new v.a(r(this.modules.backend),i.resourceStore,i,this.options),i.backendConnector.on("*",function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];o.emit.apply(o,[e].concat(n))}),i.backendConnector.on("loaded",function(e){i.cacheConnector.save()}),i.cacheConnector=new m.a(r(this.modules.cache),i.resourceStore,i,this.options),i.cacheConnector.on("*",function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];o.emit.apply(o,[e].concat(n))}),this.modules.languageDetector&&(i.languageDetector=r(this.modules.languageDetector),i.languageDetector.init(i,this.options.detection,this.options)),this.trLine truncated
|
|
||||||
var r=n(298),o=r(Object.keys,Object);e.exports=o},function(e,t){function n(e){var t=[];if(null!=e)for(var n in Object(e))t.push(n);return t}e.exports=n},function(e,t,n){(function(e){var r=n(286),o="object"==typeof t&&t&&!t.nodeType&&t,a=o&&"object"==typeof e&&e&&!e.nodeType&&e,i=a&&a.exports===o,s=i&&r.process,c=function(){try{return s&&s.binding&&s.binding("util")}catch(e){}}();e.exports=c}).call(t,n(95)(e))},function(e,t){function n(e){return o.call(e)}var r=Object.prototype,o=r.toString;e.exports=n},function(e,t){var n={};e.exports=n},function(e,t,n){function r(e,t){for(var n=e.length,r=i(t.length,n),s=o(e);r--;){var c=t[r];e[r]=a(c,n)?s[c]:void 0}return e}var o=n(111),a=n(86),i=Math.min;e.exports=r},function(e,t){function n(e){return this.__data__.set(e,r),this}var r="__lodash_hash_undefined__";e.exports=n},function(e,t){function n(e){return this.__data__.has(e)}e.exports=n},function(e,t,n){function r(){this.__data__=new o,this.size=0}var o=n(99);e.exports=r},function(e,t){function n(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}e.exports=n},function(e,t){function n(e){return this.__data__.get(e)}e.exports=n},function(e,t){function n(e){return this.__data__.has(e)}e.exports=n},function(e,t,n){function r(e,t){var n=this.__data__;if(n instanceof o){var r=n.__data__;if(!a||r.length<s-1)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new i(r)}return n.set(e,t),this.size=n.size,this}var o=n(99),a=n(169),i=n(170),s=200;e.exports=r},function(e,t){function n(e,t,n){for(var r=n-1,o=e.length;++r<o;)if(e[r]===t)return r;return-1}e.exports=n},function(e,t,n){function r(e){return a(e)?i(e):o(e)}var o=n(558),a=n(292),i=n(670);e.exports=r},function(e,t){function n(e){return e.match(x)||[]}var r="\\ud800-\\udfff",o="\\u0300-\\u036f",a="\\ufe20-\\ufe2f",i="\\u20d0-\\u20ff",s=o+a+i,c="\\ufe0e\\ufe0f",u="["+r+"]",l="["+s+"]",d="\\ud83c[\\udffb-\\udfff]",p="(?:"+l+"|"+d+")",f="[^"+r+"]",h="(?:\\ud83c[\\udde6-\\uddff]){2}",v="[\\ud800-\\udbff][\\udc00-\\udfff]",m="\\u200d",g=p+"?",y="["+c+"]?",b="(?:"+m+"(?:"+[f,h,v].join("|")+")"+y+g+")*",_=y+g+b,E="(?:"+[f+l+"?",l,h,v,u].join("|")+")",x=RegExp(d+"(?="+d+")|"+E+_,"g");e.exports=n},function(e,t){function n(e){return e.match(V)||[]}var r="\\ud800-\\udfff",o="\\u0300-\\u036f",a="\\ufe20-\\ufe2f",i="\\u20d0-\\u20ff",s=o+a+i,c="\\u2700-\\u27bf",u="a-z\\xdf-\\xf6\\xf8-\\xff",l="\\xac\\xb1\\xd7\\xf7",d="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",p="\\u2000-\\u206f",f=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",h="A-Z\\xc0-\\xd6\\xd8-\\xde",v="\\ufe0e\\ufe0f",m=l+d+p+f,g="['’]",y="["+m+"]",b="["+s+"]",_="\\d+",E="["+c+"]",x="["+u+"]",C="[^"+r+m+_+c+u+h+"]",w="\\ud83c[\\udffb-\\udfff]",O="(?:"+b+"|"+w+")",N="[^"+r+"]",P="(?:\\ud83c[\\udde6-\\uddff]){2}",k="[\\ud800-\\udbff][\\udc00-\\udfff]",S="["+h+"]",T="\\u200d",I="(?:"+x+"|"+C+")",M="(?:"+S+"|"+C+")",A="(?:"+g+"(?:d|ll|m|re|s|t|ve))?",j="(?:"+g+"(?:D|LL|M|RE|S|T|VE))?",L=O+"?",D="["+v+"]?",R="(?:"+T+"(?:"+[N,P,k].join("|")+")"+D+L+")*",F="\\d*(?:(?:1st|2nd|3rd|(?![123])\\dth)\\b)",U="\\d*(?:(?:1ST|2ND|3RD|(?![123])\\dTH)\\b)",B=D+L+R,W="(?:"+[E,P,k].join("|")+")"+B,V=RegExp([S+"?"+x+"+"+A+"(?="+[y,S,"$"].join("|")+")",M+"+"+j+"(?="+[y,S+I,"$"].join("|")+")",S+"?"+I+"+"+A,S+"+"+j,U,F,_,W].join("|"),"g");e.exports=n},function(e,t,n){function r(e,t){return o(v,function(n){var r="_."+n[0];t&n[1]&&!a(e,r)&&e.push(r)}),e.sort()}var o=n(84),a=n(102),i=1,s=2,c=8,u=16,l=32,d=64,p=128,f=256,h=512,v=[["ary",p],["bind",i],["bindKey",s],["curry",c],["curryRight",u],["flip",h],["partial",l],["partialRight",d],["rearg",f]];e.exports=r},function(e,t,n){function r(e){if(e instanceof o)return e.clone();var t=new a(e.__wrapped__,e.__chain__);return t.__actions__=i(e.__actions__),t.__index__=e.__index__,t.__values__=e.__values__,t}var o=n(167),a=n(168),i=n(111);e.exports=r},function(e,t,n){function r(e,t,n){return t=n?void 0:t,t=e&&null==t?e.length:t,o(e,a,void 0,void 0,void 0,void 0,t)}var o=n(113),a=128;e.exports=r},function(e,t,n){var r=n(104),o=n(67),a=n(610),i=n(33),s=n(87),c=n(27),u=Object.prototype,l=u.hasOwnProperty,d=a(function(e,t){if(s(t)||i(t))return void o(t,c(t),e);for(var n in t)l.call(t,n)&&r(e,n,t[n])});e.exports=d},function(e,t,n){function r(e,t,n){return void 0===n&&(n=t,t=void 0),void 0!==n&&(n=a(n),n=n===n?n:0),void 0!==t&&(t=a(t),t=t===t?t:0),o(a(e),t,n)}var o=n(270),a=n(129);e.exports=r},function(e,t,n){function r(e){return o(e,a)}var o=n(175),a=4;e.exports=r},function(e,t){function n(e){return function(){return e}}e.exports=n},function(e,t,n){function r(e){return e=a(e),e&&e.replace(i,o).replace(p,"")}var o=n(623),a=n(52),i=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,s="\\u0300-\\u036f",c="\\ufe20-\\ufe2f",u="\\u20d0-\\u20ff",l=s+c+u,d="["+l+"]",p=RegExp(d,"g");e.exports=r},function(e,t,n){var r=n(271),o=n(106),a=n(49),i=n(123),s=a(function(e,t){return i(e)?r(e,o(t,1,i,!0))Line truncated
|
|
||||||
allowFullScreen:a,allowTransparency:0,alt:0,as:0,async:a,autoComplete:0,autoPlay:a,capture:a,cellPadding:0,cellSpacing:0,charSet:0,challenge:0,checked:o|a,cite:0,classID:0,className:0,cols:s,colSpan:0,content:0,contentEditable:0,contextMenu:0,controls:a,coords:0,crossOrigin:0,data:0,dateTime:0,default:a,defer:a,dir:0,disabled:a,download:c,draggable:0,encType:0,form:0,formAction:0,formEncType:0,formMethod:0,formNoValidate:a,formTarget:0,frameBorder:0,headers:0,height:0,hidden:a,high:0,href:0,hrefLang:0,htmlFor:0,httpEquiv:0,icon:0,id:0,inputMode:0,integrity:0,is:0,keyParams:0,keyType:0,kind:0,label:0,lang:0,list:0,loop:a,low:0,manifest:0,marginHeight:0,marginWidth:0,max:0,maxLength:0,media:0,mediaGroup:0,method:0,min:0,minLength:0,multiple:o|a,muted:o|a,name:0,nonce:0,noValidate:a,open:a,optimum:0,pattern:0,placeholder:0,playsInline:a,poster:0,preload:0,profile:0,radioGroup:0,readOnly:a,referrerPolicy:0,rel:0,required:a,reversed:a,role:0,rows:s,rowSpan:i,sandbox:0,scope:0,scoped:a,scrolling:0,seamless:a,selected:o|a,shape:0,size:s,sizes:0,span:s,spellCheck:0,src:0,srcDoc:0,srcLang:0,srcSet:0,start:i,step:0,style:0,summary:0,tabIndex:0,target:0,title:0,type:0,useMap:0,value:0,width:0,wmode:0,wrap:0,about:0,datatype:0,inlist:0,prefix:0,property:0,resource:0,typeof:0,vocab:0,autoCapitalize:0,autoCorrect:0,autoSave:0,color:0,itemProp:0,itemScope:a,itemType:0,itemID:0,itemRef:0,results:0,security:0,unselectable:0},DOMAttributeNames:{acceptCharset:"accept-charset",className:"class",htmlFor:"for",httpEquiv:"http-equiv"},DOMPropertyNames:{}};e.exports=u},function(e,t,n){"use strict";(function(t){function r(e,t,n,r){var o=void 0===e[n];null!=t&&o&&(e[n]=a(t,!0))}var o=n(72),a=n(343),i=(n(197),n(207)),s=n(346);n(7);"undefined"!=typeof t&&n.i({NODE_ENV:"production"}),1;var c={instantiateChildren:function(e,t,n,o){if(null==e)return null;var a={};return s(e,r,a),a},updateChildren:function(e,t,n,r,s,c,u,l,d){if(t||e){var p,f;for(p in t)if(t.hasOwnProperty(p)){f=e&&e[p];var h=f&&f._currentElement,v=t[p];if(null!=f&&i(h,v))o.receiveComponent(f,v,s,l),t[p]=f;else{f&&(r[p]=o.getHostNode(f),o.unmountComponent(f,!1));var m=a(v,!0);t[p]=m;var g=o.mountComponent(m,s,c,u,l,d);n.push(g)}}for(p in e)!e.hasOwnProperty(p)||t&&t.hasOwnProperty(p)||(f=e[p],r[p]=o.getHostNode(f),o.unmountComponent(f,!1))}},unmountChildren:function(e,t){for(var n in e)if(e.hasOwnProperty(n)){var r=e[n];o.unmountComponent(r,t)}}};e.exports=c}).call(t,n(130))},function(e,t,n){"use strict";var r=n(193),o=n(746),a={processChildrenUpdates:o.dangerouslyProcessChildrenUpdates,replaceNodeWithMarkup:r.dangerouslyReplaceNodeWithMarkup};e.exports=a},function(e,t,n){"use strict";function r(e){}function o(e,t){}function a(e){return!(!e.prototype||!e.prototype.isReactComponent)}function i(e){return!(!e.prototype||!e.prototype.isPureReactComponent)}var s=n(12),c=n(16),u=n(73),l=n(199),d=n(40),p=n(200),f=n(93),h=(n(31),n(337)),v=n(72),m=n(81),g=(n(6),n(165)),y=n(207),b=(n(7),{ImpureClass:0,PureClass:1,StatelessFunctional:2});r.prototype.render=function(){var e=f.get(this)._currentElement.type,t=e(this.props,this.context,this.updater);return o(e,t),t};var _=1,E={construct:function(e){this._currentElement=e,this._rootNodeID=0,this._compositeType=null,this._instance=null,this._hostParent=null,this._hostContainerInfo=null,this._updateBatchNumber=null,this._pendingElement=null,this._pendingStateQueue=null,this._pendingReplaceState=!1,this._pendingForceUpdate=!1,this._renderedNodeType=null,this._renderedComponent=null,this._context=null,this._mountOrder=0,this._topLevelWrapper=null,this._pendingCallbacks=null,this._calledComponentWillUnmount=!1},mountComponent:function(e,t,n,c){this._context=c,this._mountOrder=_++,this._hostParent=t,this._hostContainerInfo=n;var l,d=this._currentElement.props,p=this._processContext(c),h=this._currentElement.type,v=e.getUpdateQueue(),g=a(h),y=this._constructComponent(g,d,p,v);g||null!=y&&null!=y.render?i(h)?this._compositeType=b.PureClass:this._compositeType=b.ImpureClass:(l=y,o(h,l),null===y||y===!1||u.isValidElement(y)?void 0:s("105",h.displayName||h.name||"Component"),y=new r(h),this._compositeType=b.StatelessFunctional);y.props=d,y.context=p,y.refs=m,y.updater=v,this._instance=y,f.set(y,this);var E=y.state;void 0===E&&(y.state=E=null),"object"!=typeof E||Array.isArray(E)?s("106",this.getName()||"ReactCompositeComponent"):void 0,this._pendingStateQueue=null,this._pendingReplaceState=!1,this._pendingForceUpdate=!1;var x;return x=y.unstable_handleError?this.performInitialMountWithErrorHandling(l,t,n,e,c):this.performInitialMount(l,t,n,e,c),y.componentDidMount&&e.getReactMountReady().enqueue(y.componentDidMount,y),x},_constructComponent:function(e,t,n,r){return this._constructComponentWithoutOwner(e,t,n,r)},_constructComponentWithoutOwner:function(e,t,n,r){var o=this._currentElement.type;return e?new o(t,n,r):o(t,n,r)},performInitialMountWithErrorHandling:function(e,t,n,r,o){var a,i=r.checkpoint();try{a=this.performInitialMount(e,t,n,r,o)}catcLine truncated
|
|
||||||
handleTopLevel:function(e,t,n,a){var i=o.extractEvents(e,t,n,a);r(i)}};e.exports=a},function(e,t,n){"use strict";function r(e){for(;e._hostParent;)e=e._hostParent;var t=d.getNodeFromInstance(e),n=t.parentNode;return d.getClosestInstanceFromNode(n)}function o(e,t){this.topLevelType=e,this.nativeEvent=t,this.ancestors=[]}function a(e){var t=f(e.nativeEvent),n=d.getClosestInstanceFromNode(t),o=n;do e.ancestors.push(o),o=o&&r(o);while(o);for(var a=0;a<e.ancestors.length;a++)n=e.ancestors[a],v._handleTopLevel(e.topLevelType,n,e.nativeEvent,f(e.nativeEvent))}function i(e){var t=h(window);e(t)}var s=n(16),c=n(257),u=n(22),l=n(60),d=n(19),p=n(35),f=n(205),h=n(525);s(o.prototype,{destructor:function(){this.topLevelType=null,this.nativeEvent=null,this.ancestors.length=0}}),l.addPoolingTo(o,l.twoArgumentPooler);var v={_enabled:!0,_handleTopLevel:null,WINDOW_HANDLE:u.canUseDOM?window:null,setHandleTopLevel:function(e){v._handleTopLevel=e},setEnabled:function(e){v._enabled=!!e},isEnabled:function(){return v._enabled},trapBubbledEvent:function(e,t,n){return n?c.listen(n,t,v.dispatchEvent.bind(null,e)):null},trapCapturedEvent:function(e,t,n){return n?c.capture(n,t,v.dispatchEvent.bind(null,e)):null},monitorScrollValue:function(e){var t=i.bind(null,e);c.listen(window,"scroll",t)},dispatchEvent:function(e,t){if(v._enabled){var n=o.getPooled(e,t);try{p.batchedUpdates(a,n)}finally{o.release(n)}}}};e.exports=v},function(e,t,n){"use strict";var r=n(71),o=n(91),a=n(196),i=n(199),s=n(332),c=n(131),u=n(334),l=n(35),d={Component:i.injection,DOMProperty:r.injection,EmptyComponent:s.injection,EventPluginHub:o.injection,EventPluginUtils:a.injection,EventEmitter:c.injection,HostComponent:u.injection,Updates:l.injection};e.exports=d},function(e,t,n){"use strict";var r=n(781),o=/\/?>/,a=/^<\!\-\-/,i={CHECKSUM_ATTR_NAME:"data-react-checksum",addChecksumToMarkup:function(e){var t=r(e);return a.test(e)?e:e.replace(o," "+i.CHECKSUM_ATTR_NAME+'="'+t+'"$&')},canReuseMarkup:function(e,t){var n=t.getAttribute(i.CHECKSUM_ATTR_NAME);n=n&&parseInt(n,10);var o=r(e);return o===n}};e.exports=i},function(e,t,n){"use strict";function r(e,t,n){return{type:"INSERT_MARKUP",content:e,fromIndex:null,fromNode:null,toIndex:n,afterNode:t}}function o(e,t,n){return{type:"MOVE_EXISTING",content:null,fromIndex:e._mountIndex,fromNode:p.getHostNode(e),toIndex:n,afterNode:t}}function a(e,t){return{type:"REMOVE_NODE",content:null,fromIndex:e._mountIndex,fromNode:t,toIndex:null,afterNode:null}}function i(e){return{type:"SET_MARKUP",content:e,fromIndex:null,fromNode:null,toIndex:null,afterNode:null}}function s(e){return{type:"TEXT_CONTENT",content:e,fromIndex:null,fromNode:null,toIndex:null,afterNode:null}}function c(e,t){return t&&(e=e||[],e.push(t)),e}function u(e,t){d.processChildrenUpdates(e,t)}var l=n(12),d=n(199),p=(n(93),n(31),n(40),n(72)),f=n(738),h=(n(29),n(784)),v=(n(6),{Mixin:{_reconcilerInstantiateChildren:function(e,t,n){return f.instantiateChildren(e,t,n)},_reconcilerUpdateChildren:function(e,t,n,r,o,a){var i,s=0;return i=h(t,s),f.updateChildren(e,i,n,r,o,this,this._hostContainerInfo,a,s),i},mountChildren:function(e,t,n){var r=this._reconcilerInstantiateChildren(e,t,n);this._renderedChildren=r;var o=[],a=0;for(var i in r)if(r.hasOwnProperty(i)){var s=r[i],c=0,u=p.mountComponent(s,t,this,this._hostContainerInfo,n,c);s._mountIndex=a++,o.push(u)}return o},updateTextContent:function(e){var t=this._renderedChildren;f.unmountChildren(t,!1);for(var n in t)t.hasOwnProperty(n)&&l("118");var r=[s(e)];u(this,r)},updateMarkup:function(e){var t=this._renderedChildren;f.unmountChildren(t,!1);for(var n in t)t.hasOwnProperty(n)&&l("118");var r=[i(e)];u(this,r)},updateChildren:function(e,t,n){this._updateChildren(e,t,n)},_updateChildren:function(e,t,n){var r=this._renderedChildren,o={},a=[],i=this._reconcilerUpdateChildren(r,e,a,o,t,n);if(i||r){var s,l=null,d=0,f=0,h=0,v=null;for(s in i)if(i.hasOwnProperty(s)){var m=r&&r[s],g=i[s];m===g?(l=c(l,this.moveChild(m,v,d,f)),f=Math.max(m._mountIndex,f),m._mountIndex=d):(m&&(f=Math.max(m._mountIndex,f)),l=c(l,this._mountChildAtIndex(g,a[h],v,d,t,n)),h++),d++,v=p.getHostNode(g)}for(s in o)o.hasOwnProperty(s)&&(l=c(l,this._unmountChild(r[s],o[s])));l&&u(this,l),this._renderedChildren=i}},unmountChildren:function(e){var t=this._renderedChildren;f.unmountChildren(t,e),this._renderedChildren=null},moveChild:function(e,t,n,r){if(e._mountIndex<r)return o(e,t,n)},createChild:function(e,t,n){return r(n,t,e._mountIndex)},removeChild:function(e,t){return a(e,t)},_mountChildAtIndex:function(e,t,n,r,o,a){return e._mountIndex=r,this.createChild(e,n,t)},_unmountChild:function(e,t){var n=this.removeChild(e,t);return e._mountIndex=null,n}}});e.exports=v},function(e,t,n){"use strict";function r(e){return!(!e||"function"!=typeof e.attachRef||"function"!=typeof e.detachRef)}var o=n(12),a=(n(6),{addComponentAsRefTo:function(e,t,n){r(n)?void 0:o("119"),n.attachRef(t,e)},removeComponentAsRefFrom:function(e,t,n){r(n)?void 0:o("120");var a=n.getPublicInstLine truncated
|
|
||||||
E.hasOwnProperty(a))E[a](e,i);else{var l=_.hasOwnProperty(a),d="function"==typeof i,f=d&&!l&&!s&&t.autobind!==!1;if(f)r.push(a,i),n[a]=i;else if(s){var h=_[a];!l||"DEFINE_MANY_MERGED"!==h&&"DEFINE_MANY"!==h?p("77",h,a):void 0,"DEFINE_MANY_MERGED"===h?n[a]=c(n[a],i):"DEFINE_MANY"===h&&(n[a]=u(n[a],i))}else n[a]=i}}}else;}function i(e,t){if(t)for(var n in t){var r=t[n];if(t.hasOwnProperty(n)){var o=n in E;o?p("78",n):void 0;var a=n in e;a?p("79",n):void 0,e[n]=r}}}function s(e,t){e&&t&&"object"==typeof e&&"object"==typeof t?void 0:p("80");for(var n in t)t.hasOwnProperty(n)&&(void 0!==e[n]?p("81",n):void 0,e[n]=t[n]);return e}function c(e,t){return function(){var n=e.apply(this,arguments),r=t.apply(this,arguments);if(null==n)return r;if(null==r)return n;var o={};return s(o,n),s(o,r),o}}function u(e,t){return function(){e.apply(this,arguments),t.apply(this,arguments)}}function l(e,t){var n=t.bind(e);return n}function d(e){for(var t=e.__reactAutoBindPairs,n=0;n<t.length;n+=2){var r=t[n],o=t[n+1];e[r]=l(e,o)}}var p=n(75),f=n(16),h=n(210),v=n(74),m=(n(355),n(211)),g=n(81),y=(n(6),n(7),"mixins"),b=[],_={mixins:"DEFINE_MANY",statics:"DEFINE_MANY",propTypes:"DEFINE_MANY",contextTypes:"DEFINE_MANY",childContextTypes:"DEFINE_MANY",getDefaultProps:"DEFINE_MANY_MERGED",getInitialState:"DEFINE_MANY_MERGED",getChildContext:"DEFINE_MANY_MERGED",render:"DEFINE_ONCE",componentWillMount:"DEFINE_MANY",componentDidMount:"DEFINE_MANY",componentWillReceiveProps:"DEFINE_MANY",shouldComponentUpdate:"DEFINE_ONCE",componentWillUpdate:"DEFINE_MANY",componentDidUpdate:"DEFINE_MANY",componentWillUnmount:"DEFINE_MANY",updateComponent:"OVERRIDE_BASE"},E={displayName:function(e,t){e.displayName=t},mixins:function(e,t){if(t)for(var n=0;n<t.length;n++)a(e,t[n])},childContextTypes:function(e,t){e.childContextTypes=f({},e.childContextTypes,t)},contextTypes:function(e,t){e.contextTypes=f({},e.contextTypes,t)},getDefaultProps:function(e,t){e.getDefaultProps?e.getDefaultProps=c(e.getDefaultProps,t):e.getDefaultProps=t},propTypes:function(e,t){e.propTypes=f({},e.propTypes,t)},statics:function(e,t){i(e,t)},autobind:function(){}},x={replaceState:function(e,t){this.updater.enqueueReplaceState(this,e),t&&this.updater.enqueueCallback(this,t,"replaceState")},isMounted:function(){return this.updater.isMounted(this)}},C=function(){};f(C.prototype,h.prototype,x);var w={createClass:function(e){var t=r(function(e,n,r){this.__reactAutoBindPairs.length&&d(this),this.props=e,this.context=n,this.refs=g,this.updater=r||m,this.state=null;var o=this.getInitialState?this.getInitialState():null;"object"!=typeof o||Array.isArray(o)?p("82",t.displayName||"ReactCompositeComponent"):void 0,this.state=o});t.prototype=new C,t.prototype.constructor=t,t.prototype.__reactAutoBindPairs=[],b.forEach(a.bind(null,t)),a(t,e),t.getDefaultProps&&(t.defaultProps=t.getDefaultProps()),t.prototype.render?void 0:p("83");for(var n in _)t.prototype[n]||(t.prototype[n]=null);return t},injection:{injectMixin:function(e){b.push(e)}}};e.exports=w},function(e,t,n){"use strict";var r=n(74),o=r.createFactory,a={a:o("a"),abbr:o("abbr"),address:o("address"),area:o("area"),article:o("article"),aside:o("aside"),audio:o("audio"),b:o("b"),base:o("base"),bdi:o("bdi"),bdo:o("bdo"),big:o("big"),blockquote:o("blockquote"),body:o("body"),br:o("br"),button:o("button"),canvas:o("canvas"),caption:o("caption"),cite:o("cite"),code:o("code"),col:o("col"),colgroup:o("colgroup"),data:o("data"),datalist:o("datalist"),dd:o("dd"),del:o("del"),details:o("details"),dfn:o("dfn"),dialog:o("dialog"),div:o("div"),dl:o("dl"),dt:o("dt"),em:o("em"),embed:o("embed"),fieldset:o("fieldset"),figcaption:o("figcaption"),figure:o("figure"),footer:o("footer"),form:o("form"),h1:o("h1"),h2:o("h2"),h3:o("h3"),h4:o("h4"),h5:o("h5"),h6:o("h6"),head:o("head"),header:o("header"),hgroup:o("hgroup"),hr:o("hr"),html:o("html"),i:o("i"),iframe:o("iframe"),img:o("img"),input:o("input"),ins:o("ins"),kbd:o("kbd"),keygen:o("keygen"),label:o("label"),legend:o("legend"),li:o("li"),link:o("link"),main:o("main"),map:o("map"),mark:o("mark"),menu:o("menu"),menuitem:o("menuitem"),meta:o("meta"),meter:o("meter"),nav:o("nav"),noscript:o("noscript"),object:o("object"),ol:o("ol"),optgroup:o("optgroup"),option:o("option"),output:o("output"),p:o("p"),param:o("param"),picture:o("picture"),pre:o("pre"),progress:o("progress"),q:o("q"),rp:o("rp"),rt:o("rt"),ruby:o("ruby"),s:o("s"),samp:o("samp"),script:o("script"),section:o("section"),select:o("select"),small:o("small"),source:o("source"),span:o("span"),strong:o("strong"),style:o("style"),sub:o("sub"),summary:o("summary"),sup:o("sup"),table:o("table"),tbody:o("tbody"),td:o("td"),textarea:o("textarea"),tfoot:o("tfoot"),th:o("th"),thead:o("thead"),time:o("time"),title:o("title"),tr:o("tr"),track:o("track"),u:o("u"),ul:o("ul"),var:o("var"),video:o("video"),wbr:o("wbr"),circle:o("circle"),clipPath:o("clipPath"),defs:o("defs"),ellipse:o("ellipse"),g:o("g"),image:o("image"),line:o("line"),linearGradient:o("linearGradient")Line truncated
|
|
||||||
}}]),t}(y.Component);N._meta={name:"Message",type:_.d.TYPES.COLLECTION},N.Content=x.a,N.Header=C.a,N.List=w.a,N.Item=O.a,t.a=N,N.handledProps=["as","attached","children","className","color","compact","content","error","floating","header","hidden","icon","info","list","negative","onDismiss","positive","size","success","visible","warning"]},function(e,t,n){"use strict";var r=n(832);n.d(t,"a",function(){return r.a})},function(e,t,n){"use strict";function r(e){var t=e.attached,o=e.basic,i=e.celled,s=e.children,u=e.className,d=e.collapsing,f=e.color,g=e.columns,_=e.compact,x=e.definition,C=e.fixed,w=e.footerRow,O=e.headerRow,N=e.inverted,P=e.padded,k=e.renderBodyRow,S=e.selectable,T=e.singleLine,I=e.size,M=e.sortable,A=e.stackable,j=e.striped,L=e.structured,D=e.tableData,R=e.unstackable,F=p()("ui",f,I,n.i(v.a)(i,"celled"),n.i(v.a)(d,"collapsing"),n.i(v.a)(x,"definition"),n.i(v.a)(C,"fixed"),n.i(v.a)(N,"inverted"),n.i(v.a)(S,"selectable"),n.i(v.a)(T,"single line"),n.i(v.a)(M,"sortable"),n.i(v.a)(A,"stackable"),n.i(v.a)(j,"striped"),n.i(v.a)(L,"structured"),n.i(v.a)(R,"unstackable"),n.i(v.h)(t,"attached"),n.i(v.h)(o,"basic"),n.i(v.h)(_,"compact"),n.i(v.h)(P,"padded"),n.i(v.e)(g,"column"),"table",u),U=n.i(v.b)(r,e),B=n.i(v.c)(r,e);return l()(s)?h.a.createElement(B,a()({},U,{className:F}),O&&h.a.createElement(b.a,null,E.a.create(O,{cellAs:"th"})),h.a.createElement(m.a,null,k&&c()(D,function(e,t){return E.a.create(k(e,t))})),w&&h.a.createElement(y.a,null,E.a.create(w))):h.a.createElement(B,a()({},U,{className:F}),s)}var o=n(1),a=n.n(o),i=n(15),s=(n.n(i),n(20)),c=n.n(s),u=n(4),l=n.n(u),d=n(3),p=n.n(d),f=n(0),h=n.n(f),v=n(2),m=n(381),g=n(137),y=n(382),b=n(214),_=n(383),E=n(384);r.handledProps=["as","attached","basic","celled","children","className","collapsing","color","columns","compact","definition","fixed","footerRow","headerRow","inverted","padded","renderBodyRow","selectable","singleLine","size","sortable","stackable","striped","structured","tableData","unstackable"],r._meta={name:"Table",type:v.d.TYPES.COLLECTION},r.defaultProps={as:"table"},r.Body=m.a,r.Cell=g.a,r.Footer=y.a,r.Header=b.a,r.HeaderCell=_.a,r.Row=E.a,t.a=r},function(e,t,n){"use strict";var r=n(834);n.d(t,"a",function(){return r.a})},function(e,t,n){"use strict";function r(e){var t=e.children,o=e.className,i=e.fluid,c=e.text,d=e.textAlign,p=s()("ui",n.i(l.a)(c,"text"),n.i(l.a)(i,"fluid"),n.i(l.s)(d),"container",o),f=n.i(l.b)(r,e),h=n.i(l.c)(r,e);return u.a.createElement(h,a()({},f,{className:p}),t)}var o=n(1),a=n.n(o),i=n(3),s=n.n(i),c=n(0),u=n.n(c),l=n(2);r.handledProps=["as","children","className","fluid","text","textAlign"],r._meta={name:"Container",type:l.d.TYPES.ELEMENT},t.a=r},function(e,t,n){"use strict";var r=n(836);n.d(t,"a",function(){return r.a})},function(e,t,n){"use strict";function r(e){var t=e.children,o=e.className,i=e.clearing,c=e.fitted,d=e.hidden,p=e.horizontal,f=e.inverted,h=e.section,v=e.vertical,m=s()("ui",n.i(l.a)(i,"clearing"),n.i(l.a)(c,"fitted"),n.i(l.a)(d,"hidden"),n.i(l.a)(p,"horizontal"),n.i(l.a)(f,"inverted"),n.i(l.a)(h,"section"),n.i(l.a)(v,"vertical"),"divider",o),g=n.i(l.b)(r,e),y=n.i(l.c)(r,e);return u.a.createElement(y,a()({},g,{className:m}),t)}var o=n(1),a=n.n(o),i=n(3),s=n.n(i),c=n(0),u=n.n(c),l=n(2);r.handledProps=["as","children","className","clearing","fitted","hidden","horizontal","inverted","section","vertical"],r._meta={name:"Divider",type:l.d.TYPES.ELEMENT},t.a=r},function(e,t,n){"use strict";var r=n(838);n.d(t,"a",function(){return r.a})},function(e,t,n){"use strict";function r(e){var t=e.className,o=e.name,i=s()(o,"flag",t),c=n.i(l.b)(r,e),d=n.i(l.c)(r,e);return u.a.createElement(d,a()({},c,{className:i}))}var o=n(1),a=n.n(o),i=n(3),s=n.n(i),c=n(0),u=n.n(c),l=n(2);r.handledProps=["as","className","name"],r._meta={name:"Flag",type:l.d.TYPES.ELEMENT},r.defaultProps={as:"i"},r.create=n.i(l.g)(r,function(e){return{name:e}}),t.a=r},function(e,t,n){"use strict";function r(e){var t=e.attached,o=e.block,i=e.children,s=e.className,u=e.color,d=e.content,y=e.disabled,b=e.dividing,_=e.floated,E=e.icon,x=e.image,C=e.inverted,w=e.size,O=e.sub,N=e.subheader,P=e.textAlign,k=l()("ui",u,w,n.i(f.a)(o,"block"),n.i(f.a)(y,"disabled"),n.i(f.a)(b,"dividing"),n.i(f.f)(_,"floated"),n.i(f.a)(E===!0,"icon"),n.i(f.a)(x===!0,"image"),n.i(f.a)(C,"inverted"),n.i(f.a)(O,"sub"),n.i(f.h)(t,"attached"),n.i(f.s)(P),"header",s),S=n.i(f.b)(r,e),T=n.i(f.c)(r,e);if(!c()(i))return p.a.createElement(T,a()({},S,{className:k}),i);var I=h.a.create(E),M=v.a.create(x),A=m.a.create(N);return I||M?p.a.createElement(T,a()({},S,{className:k}),I||M,(d||A)&&p.a.createElement(g.a,null,d,A)):p.a.createElement(T,a()({},S,{className:k}),d,A)}var o=n(1),a=n.n(o),i=n(15),s=(n.n(i),n(4)),c=n.n(s),u=n(3),l=n.n(u),d=n(0),p=n.n(d),f=n(2),h=n(21),v=n(76),m=n(391),g=n(390);r.handledProps=["as","attached","block","children","className","color","content","disabled","dividing","floated","icon","image","inverted","size","sub","subheader","textAlign"],r._meta={name:"HeadLine truncated
|
|
||||||
33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",41:"Select",42:"Print",43:"Execute",44:"PrintScreen",45:"Insert",46:"Delete",48:["0",")"],49:["1","!"],50:["2","@"],51:["3","#"],52:["4","$"],53:["5","%"],54:["6","^"],55:["7","&"],56:["8","*"],57:["9","("],91:"OS",93:"ContextMenu",144:"NumLock",145:"ScrollLock",181:"VolumeMute",182:"VolumeDown",183:"VolumeUp",186:[";",":"],187:["=","+"],188:[",","<"],189:["-","_"],190:[".",">"],191:["/","?"],192:["`","~"],219:["[","{"],220:["\\","|"],221:["]","}"],222:["'",'"'],224:"Meta",225:"AltGraph",246:"Attn",247:"CrSel",248:"ExSel",249:"EraseEof",250:"Play",251:"ZoomOut"};i()(24,function(e){return s[112+e]="F"+(e+1)}),i()(26,function(e){var t=e+65;s[t]=[String.fromCharCode(t+32),String.fromCharCode(t)]});var c={codes:s,getCode:function(e){return o()(e)?e.keyCode||e.which||this[e.key]:this[e]},getName:function(e){var t=o()(e),n=s[t?e.keyCode||e.which:e];return Array.isArray(n)&&(n=t?n[e.shiftKey?1:0]:n[0]),n},Cancel:3,Help:6,Backspace:8,Tab:9,Clear:12,Enter:13,Shift:16,Control:17,Alt:18,Pause:19,CapsLock:20,Escape:27,Convert:28,NonConvert:29,Accept:30,ModeChange:31," ":32,PageUp:33,PageDown:34,End:35,Home:36,ArrowLeft:37,ArrowUp:38,ArrowRight:39,ArrowDown:40,Select:41,Print:42,Execute:43,PrintScreen:44,Insert:45,Delete:46,0:48,")":48,1:49,"!":49,2:50,"@":50,3:51,"#":51,4:52,$:52,5:53,"%":53,6:54,"^":54,7:55,"&":55,8:56,"*":56,9:57,"(":57,a:65,A:65,b:66,B:66,c:67,C:67,d:68,D:68,e:69,E:69,f:70,F:70,g:71,G:71,h:72,H:72,i:73,I:73,j:74,J:74,k:75,K:75,l:76,L:76,m:77,M:77,n:78,N:78,o:79,O:79,p:80,P:80,q:81,Q:81,r:82,R:82,s:83,S:83,t:84,T:84,u:85,U:85,v:86,V:86,w:87,W:87,x:88,X:88,y:89,Y:89,z:90,Z:90,OS:91,ContextMenu:93,F1:112,F2:113,F3:114,F4:115,F5:116,F6:117,F7:118,F8:119,F9:120,F10:121,F11:122,F12:123,F13:124,F14:125,F15:126,F16:127,F17:128,F18:129,F19:130,F20:131,F21:132,F22:133,F23:134,F24:135,NumLock:144,ScrollLock:145,VolumeMute:181,VolumeDown:182,VolumeUp:183,";":186,":":186,"=":187,"+":187,",":188,"<":188,"-":189,_:189,".":190,">":190,"/":191,"?":191,"`":192,"~":192,"[":219,"{":219,"\\":220,"|":220,"]":221,"}":221,"'":222,'"':222,Meta:224,AltGraph:225,Attn:246,CrSel:247,ExSel:248,EraseEof:249,Play:250,ZoomOut:251};c.Spacebar=c[" "],c.Digit0=c[0],c.Digit1=c[1],c.Digit2=c[2],c.Digit3=c[3],c.Digit4=c[4],c.Digit5=c[5],c.Digit6=c[6],c.Digit7=c[7],c.Digit8=c[8],c.Digit9=c[9],c.Tilde=c["~"],c.GraveAccent=c["`"],c.ExclamationPoint=c["!"],c.AtSign=c["@"],c.PoundSign=c["#"],c.PercentSign=c["%"],c.Caret=c["^"],c.Ampersand=c["&"],c.PlusSign=c["+"],c.MinusSign=c["-"],c.EqualsSign=c["="],c.DivisionSign=c["/"],c.MultiplicationSign=c["*"],c.Comma=c[","],c.Decimal=c["."],c.Colon=c[":"],c.Semicolon=c[";"],c.Pipe=c["|"],c.BackSlash=c["\\"],c.QuestionMark=c["?"],c.SingleQuote=c['"'],c.DoubleQuote=c['"'],c.LeftCurlyBrace=c["{"],c.RightCurlyBrace=c["}"],c.LeftParenthesis=c["("],c.RightParenthesis=c[")"],c.LeftAngleBracket=c["<"],c.RightAngleBracket=c[">"],c.LeftSquareBracket=c["["],c.RightSquareBracket=c["]"],t.a=c},function(e,t,n){"use strict";var r=n(190),o=n.n(r),a=n(69),i=n.n(a),s=n(722),c=n.n(s);n.d(t,"a",function(){return u});var u=function(e,t){return c()(e,function(e,n,r){i()(t,r)?o()(n,t[r])||(e[r]=t[r]):e[r]="[DELETED]"},{})}},function(e,t,n){"use strict";var r=n(61),o=n.n(r),a=n(1),i=n.n(a),s=n(53),c=n.n(s),u=n(8),l=n.n(u),d=n(9),p=n.n(d),f=n(11),h=n.n(f),v=n(10),m=n.n(v),g=n(27),y=n.n(g),b=n(127),_=n.n(b),E=n(121),x=n.n(E),C=n(69),w=n.n(C),O=n(15),N=n.n(O),P=n(89),k=n.n(P),S=n(3),T=n.n(S),I=n(0),M=n.n(I),A=n(2),j=n(21),L=n(406),D=n(407),R=function(e){function t(){var e;l()(this,t);for(var r=arguments.length,a=Array(r),s=0;s<r;s++)a[s]=arguments[s];var u=h()(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(a)));return u.state={},u.handleTitleClick=function(e,t){var n=u.props,r=n.onTitleClick,o=n.exclusive,a=u.state.activeIndex,i=void 0;i=o?t===a?-1:t:k()(a,t)?N()(a,t):[].concat(c()(a),[t]),u.trySetState({activeIndex:i}),r&&r(e,t)},u.isIndexActive=function(e){var t=u.props.exclusive,n=u.state.activeIndex;return t?n===e:k()(n,e)},u.renderChildren=function(){var e=u.props.children,t=0,r=0;return I.Children.map(e,function(e){var a=e.type===D.a,s=e.type===L.a;if(a){var c=function(){var r=t,o=w()(e,"props.active")?e.props.active:u.isIndexActive(t),a=function(t){u.handleTitleClick(t,r),e.props.onClick&&e.props.onClick(t,r)};return t++,{v:n.i(I.cloneElement)(e,i()({},e.props,{active:o,onClick:a}))}}();if("object"===("undefined"==typeof c?"undefined":o()(c)))return c.v}if(s){var l=w()(e,"props.active")?e.props.active:u.isIndexActive(r);return r++,n.i(I.cloneElement)(e,i()({},e.props,{active:l}))}return e})},u.renderPanels=function(){var e=u.props.panels,t=[];return x()(e,function(e,n){var r=w()(e,"active")?e.active:u.isIndexActive(n),o=function(t){u.handleTitleClick(t,n),e.onClick&&e.onClick(t,n)};t.push(M.a.createElement(D.a,{key:e.title+"-title",active:r,onClick:o},M.a.createElement(j.a,{name:"dropdown"})Line truncated
|
|
||||||
function t(){var e,n,r,o;i()(this,t);for(var a=arguments.length,s=Array(a),c=0;c<a;c++)s[c]=arguments[c];return n=r=l()(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(s))),r.state={},r.hideOnScroll=function(e){r.setState({closed:!0}),window.removeEventListener("scroll",r.hideOnScroll),setTimeout(function(){return r.setState({closed:!1})},50)},r.handleClose=function(e){R("handleClose()");var t=r.props.onClose;t&&t(e,r.props)},r.handleOpen=function(e){R("handleOpen()"),r.coords=e.currentTarget.getBoundingClientRect();var t=r.props.onOpen;t&&t(e,r.props)},r.handlePortalMount=function(e){R("handlePortalMount()"),r.props.hideOnScroll&&window.addEventListener("scroll",r.hideOnScroll);var t=r.props.onMount;t&&t(e,r.props)},r.handlePortalUnmount=function(e){R("handlePortalUnmount()");var t=r.props.onUnmount;t&&t(e,r.props)},r.popupMounted=function(e){R("popupMounted()"),r.popupCoords=e?e.getBoundingClientRect():null,r.setPopupStyle()},o=n,l()(r,o)}return p()(t,e),c()(t,[{key:"computePopupStyle",value:function(e){var t={position:"absolute"};if(!A.o)return t;var n=this.props.offset,r=window,o=r.pageYOffset,a=r.pageXOffset,i=document.documentElement,s=i.clientWidth,c=i.clientHeight;if(N()(e,"right"))t.right=Math.round(s-(this.coords.right+a)),t.left="auto";else if(N()(e,"left"))t.left=Math.round(this.coords.left+a),t.right="auto";else{var u=(this.coords.width-this.popupCoords.width)/2;t.left=Math.round(this.coords.left+u+a),t.right="auto"}if(N()(e,"top"))t.bottom=Math.round(c-(this.coords.top+o)),t.top="auto";else if(N()(e,"bottom"))t.top=Math.round(this.coords.bottom+o),t.bottom="auto";else{var l=(this.coords.height+this.popupCoords.height)/2;t.top=Math.round(this.coords.bottom+o-l),t.bottom="auto";var d=this.popupCoords.width+8;N()(e,"right")?t.right-=d:t.left-=d}return n&&(w()(t.right)?t.right-=n:t.left-=n),t}},{key:"isStyleInViewport",value:function(e){var t=window,n=t.pageYOffset,r=t.pageXOffset,o=document.documentElement,a=o.clientWidth,i=o.clientHeight,s={top:e.top,left:e.left,width:this.popupCoords.width,height:this.popupCoords.height};return w()(e.right)&&(s.left=a-e.right-s.width),w()(e.bottom)&&(s.top=i-e.bottom-s.height),!(s.top<n)&&(!(s.top+s.height>n+i)&&(!(s.left<r)&&!(s.left+s.width>r+a)))}},{key:"setPopupStyle",value:function(){if(this.coords&&this.popupCoords){for(var e=this.props.positioning,t=this.computePopupStyle(e),n=k()(F,e),r=0;!this.isStyleInViewport(t)&&r<n.length;r++)t=this.computePopupStyle(n[r]),e=n[r];t=x()(t,function(e){return w()(e)?e+"px":e}),this.setState({style:t,positioning:e})}}},{key:"getPortalProps",value:function(){var e={},t=this.props,n=t.on,r=t.hoverable;return r&&(e.closeOnPortalMouseLeave=!0,e.mouseLeaveDelay=300),"click"===n?(e.openOnTriggerClick=!0,e.closeOnTriggerClick=!0,e.closeOnDocumentClick=!0):"focus"===n?(e.openOnTriggerFocus=!0,e.closeOnTriggerBlur=!0):"hover"===n&&(e.openOnTriggerMouseEnter=!0,e.closeOnTriggerMouseLeave=!0,e.mouseLeaveDelay=70,e.mouseEnterDelay=50),e}},{key:"render",value:function(){var e=this.props,r=e.basic,a=e.children,i=e.className,s=e.content,c=e.flowing,u=e.header,l=e.inverted,d=e.size,p=e.trigger,f=e.wide,v=this.state,g=v.positioning,b=v.closed,E=_()({},this.state.style,this.props.style),x=T()("ui",g,d,n.i(A.h)(f,"wide"),n.i(A.a)(r,"basic"),n.i(A.a)(c,"flowing"),n.i(A.a)(l,"inverted"),"popup transition visible",i);if(b)return p;var C=n.i(A.b)(t,this.props),w=j.a.handledProps,O=y()(C,w),N=m()(C,w),P=n.i(A.c)(t,this.props),k=M.a.createElement(P,o()({},O,{className:x,style:E,ref:this.popupMounted}),a,h()(a)&&D.a.create(u),h()(a)&&L.a.create(s)),S=o()({},this.getPortalProps(),N);return R("portal props:",S),M.a.createElement(j.a,o()({},S,{trigger:p,onClose:this.handleClose,onMount:this.handlePortalMount,onOpen:this.handleOpen,onUnmount:this.handlePortalUnmount}),k)}}]),t}(I.Component);U.defaultProps={positioning:"top left",on:"hover"},U._meta={name:"Popup",type:A.d.TYPES.MODULE},U.Content=L.a,U.Header=D.a,t.a=U,U.handledProps=["basic","children","className","content","flowing","header","hideOnScroll","hoverable","inverted","offset","on","onClose","onMount","onOpen","onUnmount","positioning","size","style","trigger","wide"]},function(e,t,n){"use strict";var r=n(874);n.d(t,"a",function(){return r.a})},function(e,t,n){"use strict";var r=n(1),o=n.n(r),a=n(8),i=n.n(a),s=n(9),c=n.n(s),u=n(11),l=n.n(u),d=n(10),p=n.n(d),f=n(308),h=n.n(f),v=n(715),m=n.n(v),g=n(676),y=n.n(g),b=n(126),_=n.n(b),E=n(15),x=(n.n(E),n(3)),C=n.n(x),w=n(0),O=n.n(w),N=n(2),P=function(e){function t(){var e,n,r,o;i()(this,t);for(var a=arguments.length,s=Array(a),c=0;c<a;c++)s[c]=arguments[c];return n=r=l()(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(s))),r.calculatePercent=function(){var e=r.props,t=e.percent,n=e.total,o=e.value;return _()(t)?_()(n)||_()(o)?void 0:o/n*100:t},r.getPercent=function(){var e=r.props.precision,t=y()(r.calculatePercent(),0,100);return _()(e)?t:m()(t,e)},r.isAutoSuccess=function(){var e=r.props,t=Line truncated
|
|
||||||
+13
-8
@@ -74,8 +74,8 @@
|
|||||||
},
|
},
|
||||||
"dio": {
|
"dio": {
|
||||||
"title": {
|
"title": {
|
||||||
"di": "DigitInput",
|
"di": "DigitalInput",
|
||||||
"do": "DigitOutput"
|
"do": "DigitalOutput"
|
||||||
},
|
},
|
||||||
"form": {
|
"form": {
|
||||||
"label": {
|
"label": {
|
||||||
@@ -255,7 +255,7 @@
|
|||||||
},
|
},
|
||||||
"status": {
|
"status": {
|
||||||
"leone": "無回應(網路問題或是IP/密碼錯誤)",
|
"leone": "無回應(網路問題或是IP/密碼錯誤)",
|
||||||
"digitinput": "觸發"
|
"digitalinput": "觸發"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"menu": {
|
"menu": {
|
||||||
@@ -270,7 +270,12 @@
|
|||||||
"iocmd": "IO CMD",
|
"iocmd": "IO CMD",
|
||||||
"schedule": "排程控制",
|
"schedule": "排程控制",
|
||||||
"modbus": "Modbus",
|
"modbus": "Modbus",
|
||||||
|
"modbus_preview": "Modbus 總覽",
|
||||||
|
"modbuscmd": "Modbus CMD",
|
||||||
|
"modbuslog": "Modbus Log",
|
||||||
"link": "連動",
|
"link": "連動",
|
||||||
|
"ipcam": "網路攝影機",
|
||||||
|
"wristband": "藍芽手環",
|
||||||
"logout": "登出"
|
"logout": "登出"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -338,17 +343,17 @@
|
|||||||
"sun": "週日"
|
"sun": "週日"
|
||||||
},
|
},
|
||||||
"porttype": [
|
"porttype": [
|
||||||
{"code": "1", "name":"DigitOutput"},
|
{ "code": "1", "name": "DigitalOutput" },
|
||||||
{"code": "2", "name":"DigitInput"},
|
{ "code": "2", "name": "DigitalInput" },
|
||||||
{"code": "3", "name":"AnalogyOutput"},
|
{ "code": "3", "name": "AnalogOutput" },
|
||||||
{"code": "4", "name":"AnalogyInput"}
|
{ "code": "4", "name": "AnalogInput" }
|
||||||
],
|
],
|
||||||
"select": {
|
"select": {
|
||||||
"select_action": "請選擇動作",
|
"select_action": "請選擇動作",
|
||||||
"dev_type": "請選擇裝置類型",
|
"dev_type": "請選擇裝置類型",
|
||||||
"dev_name": "請選擇裝置",
|
"dev_name": "請選擇裝置",
|
||||||
"action": "請選擇動作",
|
"action": "請選擇動作",
|
||||||
"digitoutput": "DigitOutput",
|
"digitaloutput": "DigitalOutput",
|
||||||
"leone": "LeOne",
|
"leone": "LeOne",
|
||||||
"iogroup": "IOGroup"
|
"iogroup": "IOGroup"
|
||||||
}
|
}
|
||||||
|
|||||||
+15
-2
@@ -2,8 +2,10 @@ const errList = require('../includes/errorManager');
|
|||||||
|
|
||||||
function send(req, res) {
|
function send(req, res) {
|
||||||
if ('db' in res && typeof res.db == 'object' && 'close' in res.db && typeof res.db.close == 'function') res.db.close();
|
if ('db' in res && typeof res.db == 'object' && 'close' in res.db && typeof res.db.close == 'function') res.db.close();
|
||||||
|
if ('db' in res && typeof res.db == 'object' && 'release' in res.db && typeof res.db.release == 'function') res.db.release();
|
||||||
|
|
||||||
let lngs = req.headers['accept-language'].split(',');
|
let lngs = req.headers['accept-language'] || '';
|
||||||
|
lngs = lngs.split(',');
|
||||||
let lng = null;
|
let lng = null;
|
||||||
if (lngs.length > 0) {
|
if (lngs.length > 0) {
|
||||||
lng = lngs[0].substring(0, 2);
|
lng = lngs[0].substring(0, 2);
|
||||||
@@ -30,7 +32,18 @@ function send(req, res) {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if('sys_err' in res) {
|
||||||
|
json.sys_err = res.sys_err
|
||||||
|
}
|
||||||
|
|
||||||
res.send(json);
|
res.send(json);
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = { send: send };
|
const err = (res, err, n, code = null) => {
|
||||||
|
if(process.env.NODE_ENV != 'production') res.sys_err = 'toString' in err && typeof err.toString == 'function' ? err.toString() : err;
|
||||||
|
|
||||||
|
if(!code) return n();
|
||||||
|
return n(code);
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = { send, err };
|
||||||
+12
-27
@@ -3,7 +3,7 @@ const router = express.Router();
|
|||||||
const rt = require('../ResTool');
|
const rt = require('../ResTool');
|
||||||
const config = require('../../config.json');
|
const config = require('../../config.json');
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
const mysql = require('../../libs/mysql_cls');
|
const mysql = require('../../libs/mysql_pool');
|
||||||
const tool = require('../../includes/apiTool');
|
const tool = require('../../includes/apiTool');
|
||||||
const exec = require('child_process').exec;
|
const exec = require('child_process').exec;
|
||||||
const so = require('../../includes/storeObject');
|
const so = require('../../includes/storeObject');
|
||||||
@@ -13,6 +13,15 @@ router
|
|||||||
.get('/', (req, res) => {
|
.get('/', (req, res) => {
|
||||||
res.send({ name: 'WebIO DIO Api' });
|
res.send({ name: 'WebIO DIO Api' });
|
||||||
})
|
})
|
||||||
|
.post('*', async(req,res,n) => {
|
||||||
|
try{
|
||||||
|
res.db = await mysql.getConn();
|
||||||
|
}catch(e){
|
||||||
|
console.log(`Get DB Connection ERROR ${e}`);
|
||||||
|
return n('ERR8100');
|
||||||
|
}
|
||||||
|
n();
|
||||||
|
})
|
||||||
.post('/getio', (req, res, n) => {
|
.post('/getio', (req, res, n) => {
|
||||||
if (!config.permission.dio) return n('ERR9000');
|
if (!config.permission.dio) return n('ERR9000');
|
||||||
|
|
||||||
@@ -77,14 +86,6 @@ router
|
|||||||
record: []
|
record: []
|
||||||
};
|
};
|
||||||
|
|
||||||
res.db = new mysql();
|
|
||||||
res.db.user = config.db.user;
|
|
||||||
res.db.password = config.db.pass;
|
|
||||||
res.db.host = config.db.host;
|
|
||||||
res.db.port = config.db.port;
|
|
||||||
res.db.database = config.db.db1;
|
|
||||||
res.db.connect();
|
|
||||||
|
|
||||||
let obj = so.get(req.headers['x-auth-token']);
|
let obj = so.get(req.headers['x-auth-token']);
|
||||||
let u = '';
|
let u = '';
|
||||||
if (obj != null && 'user' in obj && 'account' in obj.user) u = obj.user.account;
|
if (obj != null && 'user' in obj && 'account' in obj.user) u = obj.user.account;
|
||||||
@@ -104,14 +105,6 @@ router
|
|||||||
.post('/getdioinfo', (req, res, n) => {
|
.post('/getdioinfo', (req, res, n) => {
|
||||||
if (!config.permission.dio) return n('ERR9000');
|
if (!config.permission.dio) return n('ERR9000');
|
||||||
|
|
||||||
res.db = new mysql();
|
|
||||||
res.db.user = config.db.user;
|
|
||||||
res.db.password = config.db.pass;
|
|
||||||
res.db.host = config.db.host;
|
|
||||||
res.db.port = config.db.port;
|
|
||||||
res.db.database = config.db.db1;
|
|
||||||
res.db.connect();
|
|
||||||
|
|
||||||
let q = "select * from ??.??";
|
let q = "select * from ??.??";
|
||||||
let pdi = tool.promiseQuery(res, q, [config.db.db1, 'dilist'], 'di');
|
let pdi = tool.promiseQuery(res, q, [config.db.db1, 'dilist'], 'di');
|
||||||
let pdo = tool.promiseQuery(res, q, [config.db.db1, 'dolist'], 'do');
|
let pdo = tool.promiseQuery(res, q, [config.db.db1, 'dolist'], 'do');
|
||||||
@@ -132,7 +125,7 @@ router
|
|||||||
}
|
}
|
||||||
return n();
|
return n();
|
||||||
})
|
})
|
||||||
.catch(e => n('ERR8000'));
|
.catch(e => rt.err(res,e, n,'ERR8000'));
|
||||||
})
|
})
|
||||||
.post('/setdioinfo', (req,res,n) => {
|
.post('/setdioinfo', (req,res,n) => {
|
||||||
if(!config.permission.dio) return n('ERR9000');
|
if(!config.permission.dio) return n('ERR9000');
|
||||||
@@ -146,14 +139,6 @@ router
|
|||||||
record: []
|
record: []
|
||||||
}
|
}
|
||||||
|
|
||||||
res.db = new mysql();
|
|
||||||
res.db.user = config.db.user;
|
|
||||||
res.db.password = config.db.pass;
|
|
||||||
res.db.host = config.db.host;
|
|
||||||
res.db.port = config.db.port;
|
|
||||||
res.db.database = config.db.db1;
|
|
||||||
res.db.connect();
|
|
||||||
|
|
||||||
let query = "update ??.?? set ?? = unix_timestamp() , ";
|
let query = "update ??.?? set ?? = unix_timestamp() , ";
|
||||||
let sub = " ?? = case ?? ";
|
let sub = " ?? = case ?? ";
|
||||||
let dos = [];
|
let dos = [];
|
||||||
@@ -192,7 +177,7 @@ router
|
|||||||
|
|
||||||
Promise.all([pdi, pdo])
|
Promise.all([pdi, pdo])
|
||||||
.then(r => n())
|
.then(r => n())
|
||||||
.catch(e => n('ERR8002'))
|
.catch(e => rt.err(res,e,n,'ERR8002'))
|
||||||
})
|
})
|
||||||
.all('*', rt.send);
|
.all('*', rt.send);
|
||||||
|
|
||||||
|
|||||||
+19
-9
@@ -2,24 +2,25 @@ const express = require('express');
|
|||||||
const router = express.Router();
|
const router = express.Router();
|
||||||
const errMng = require('../../includes/errorManager');
|
const errMng = require('../../includes/errorManager');
|
||||||
const so = require('../../includes/storeObject');
|
const so = require('../../includes/storeObject');
|
||||||
|
const mysql = require('../../libs/mysql_pool');
|
||||||
|
|
||||||
router
|
router
|
||||||
.get('/', (req, res) => {
|
.get('/', (req, res) => {
|
||||||
res.send({ name: 'WebIO API System' });
|
res.send({ name: 'WebIO API System' });
|
||||||
})
|
})
|
||||||
.all('*', (req,res,n)=>{
|
.all('*', (req, res, n) => {
|
||||||
if('x-auth-token' in req.headers) {
|
if ('x-auth-token' in req.headers) {
|
||||||
let token = req.headers['x-auth-token'];
|
let token = req.headers['x-auth-token'];
|
||||||
if(so.chkKey(token)){
|
if (so.chkKey(token)) {
|
||||||
let obj = so.get(token);
|
let obj = so.get(token);
|
||||||
if(obj != null) {
|
if (obj != null) {
|
||||||
so.set(token, obj);
|
so.set(token, obj);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
n();
|
n();
|
||||||
})
|
})
|
||||||
.get('/showallso', (req,res)=>{
|
.get('/showallso', (req, res) => {
|
||||||
res.send(so.show());
|
res.send(so.show());
|
||||||
})
|
})
|
||||||
.use('/system', require('./system.js'))
|
.use('/system', require('./system.js'))
|
||||||
@@ -30,22 +31,31 @@ router
|
|||||||
.use('/schedule', require('./schedule.js'))
|
.use('/schedule', require('./schedule.js'))
|
||||||
.use('/dio', require('./dio.js'))
|
.use('/dio', require('./dio.js'))
|
||||||
.use('/link', require('./link.js'))
|
.use('/link', require('./link.js'))
|
||||||
.use('/modbus', require('./modbus.js'));
|
.use('/modbus', require('./modbus.js'))
|
||||||
|
.use('/ipcam', require('./ipcam.js'))
|
||||||
|
.use('/server', require('./server.js'))
|
||||||
|
.use('/wristband', require('./wristband.js'));
|
||||||
|
|
||||||
// api error handler
|
// api error handler
|
||||||
router.use((err, req, res, n) => {
|
router.use((err, req, res, n) => {
|
||||||
if ('db' in res && typeof res.db == 'object' && 'close' in res.db && typeof res.db.close == 'function') res.db.close();
|
if ('db' in res && typeof res.db == 'object' && 'close' in res.db && typeof res.db.close == 'function') res.db.close();
|
||||||
|
if ('db' in res && typeof res.db == 'object' && 'release' in res.db && typeof res.db.release == 'function') res.db.release();
|
||||||
|
|
||||||
let lngs = req.headers['accept-language'].split(',');
|
let lngs = req.headers['accept-language'] || '';
|
||||||
|
lngs = lngs.split(',');
|
||||||
let lng = null;
|
let lng = null;
|
||||||
if (lngs.length > 0) {
|
if (lngs.length > 0) {
|
||||||
lng = lngs[0].substring(0, 2);
|
lng = lngs[0].substring(0, 2);
|
||||||
}
|
}
|
||||||
res.send({
|
let json = {
|
||||||
errorCode: (typeof err != 'string' ? err.toString() : err),
|
errorCode: (typeof err != 'string' ? err.toString() : err),
|
||||||
message: errMng(err, lng),
|
message: errMng(err, lng),
|
||||||
status: 0
|
status: 0
|
||||||
});
|
};
|
||||||
|
|
||||||
|
if ('sys_err' in res && process.env.NODE_ENV != 'production') json.sys_err = res.sys_err;
|
||||||
|
|
||||||
|
res.send(json);
|
||||||
})
|
})
|
||||||
|
|
||||||
module.exports = router;
|
module.exports = router;
|
||||||
+10
-10
@@ -2,7 +2,7 @@ const express = require('express');
|
|||||||
const router = express.Router();
|
const router = express.Router();
|
||||||
const rt = require('../ResTool');
|
const rt = require('../ResTool');
|
||||||
const config = require('../../config.json');
|
const config = require('../../config.json');
|
||||||
const mysql = require('../../libs/mysql_cls');
|
const mysql = require('../../libs/mysql_pool');
|
||||||
const tool = require('../../includes/apiTool');
|
const tool = require('../../includes/apiTool');
|
||||||
const exec = require('child_process').exec;
|
const exec = require('child_process').exec;
|
||||||
const execSync = require('child_process').execSync;
|
const execSync = require('child_process').execSync;
|
||||||
@@ -12,6 +12,15 @@ router
|
|||||||
.get('/', (req, res) => {
|
.get('/', (req, res) => {
|
||||||
res.send({ name: 'WebIO IOCmd API' });
|
res.send({ name: 'WebIO IOCmd API' });
|
||||||
})
|
})
|
||||||
|
.post('*', async(req,res,n) => {
|
||||||
|
try{
|
||||||
|
res.db = await mysql.getConn();
|
||||||
|
}catch(e){
|
||||||
|
console.log(`Get DB Connection ERROR ${e}`);
|
||||||
|
return n('ERR8100');
|
||||||
|
}
|
||||||
|
n();
|
||||||
|
})
|
||||||
.post('/iocmd', (req, res, n) => {
|
.post('/iocmd', (req, res, n) => {
|
||||||
if (!config.permission.iocmd) return n('ERR9000');
|
if (!config.permission.iocmd) return n('ERR9000');
|
||||||
if (!tool.checkPermission(req)) return n('ERR9000');
|
if (!tool.checkPermission(req)) return n('ERR9000');
|
||||||
@@ -30,15 +39,6 @@ router
|
|||||||
data.record = [];
|
data.record = [];
|
||||||
res.api_res = data;
|
res.api_res = data;
|
||||||
|
|
||||||
|
|
||||||
res.db = new mysql();
|
|
||||||
res.db.user = config.db.user;
|
|
||||||
res.db.password = config.db.pass;
|
|
||||||
res.db.host = config.db.host;
|
|
||||||
res.db.port = config.db.port;
|
|
||||||
res.db.database = config.db.db1;
|
|
||||||
res.db.connect();
|
|
||||||
|
|
||||||
let dos = [];
|
let dos = [];
|
||||||
let les = [];
|
let les = [];
|
||||||
let ios = [];
|
let ios = [];
|
||||||
|
|||||||
+15
-38
@@ -2,13 +2,22 @@ const express = require('express');
|
|||||||
const router = express.Router();
|
const router = express.Router();
|
||||||
const rt = require('../ResTool');
|
const rt = require('../ResTool');
|
||||||
const config = require('../../config.json');
|
const config = require('../../config.json');
|
||||||
const mysql = require('../../libs/mysql_cls');
|
const mysql = require('../../libs/mysql_pool');
|
||||||
const tool = require('../../includes/apiTool');
|
const tool = require('../../includes/apiTool');
|
||||||
|
|
||||||
router
|
router
|
||||||
.get('/', (req, res) => {
|
.get('/', (req, res) => {
|
||||||
res.send({ name: 'WebIO IOGroup API' });
|
res.send({ name: 'WebIO IOGroup API' });
|
||||||
})
|
})
|
||||||
|
.post('*', async(req,res,n) => {
|
||||||
|
try{
|
||||||
|
res.db = await mysql.getConn();
|
||||||
|
}catch(e){
|
||||||
|
console.log(`Get DB Connection ERROR ${e}`);
|
||||||
|
return n('ERR8100');
|
||||||
|
}
|
||||||
|
n();
|
||||||
|
})
|
||||||
.post(['/getiogrouplist', '/getiogroup'], (req, res, n) => {
|
.post(['/getiogrouplist', '/getiogroup'], (req, res, n) => {
|
||||||
if (!config.permission.iogroup) return n('ERR9000');
|
if (!config.permission.iogroup) return n('ERR9000');
|
||||||
let s = false;
|
let s = false;
|
||||||
@@ -19,14 +28,6 @@ router
|
|||||||
if (!arr.data.id) return n('ERR0028');
|
if (!arr.data.id) return n('ERR0028');
|
||||||
}
|
}
|
||||||
|
|
||||||
res.db = new mysql();
|
|
||||||
res.db.user = config.db.user;
|
|
||||||
res.db.password = config.db.pass;
|
|
||||||
res.db.host = config.db.host;
|
|
||||||
res.db.port = config.db.port;
|
|
||||||
res.db.database = config.db.db1;
|
|
||||||
res.db.connect();
|
|
||||||
|
|
||||||
let query = "select * from ??.?? ";
|
let query = "select * from ??.?? ";
|
||||||
let order = " order by `iogroupuid` desc ";
|
let order = " order by `iogroupuid` desc ";
|
||||||
let param = [config.db.db1, 'iogroup'];
|
let param = [config.db.db1, 'iogroup'];
|
||||||
@@ -36,7 +37,7 @@ router
|
|||||||
}
|
}
|
||||||
|
|
||||||
res.db.query(query + order, param, (err, row) => {
|
res.db.query(query + order, param, (err, row) => {
|
||||||
if (err) return n('ERR8000');
|
if (err) return rt.err(res,err,n,'ERR8000');
|
||||||
|
|
||||||
let dos = [];
|
let dos = [];
|
||||||
let les = [];
|
let les = [];
|
||||||
@@ -87,7 +88,7 @@ router
|
|||||||
return n();
|
return n();
|
||||||
})
|
})
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
if (err) return n('ERR8000');
|
if (err) return rt.err(res,err,n,'ERR8000');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
@@ -99,19 +100,11 @@ router
|
|||||||
if (!arr.data.name) return n('ERR0026');
|
if (!arr.data.name) return n('ERR0026');
|
||||||
if (!arr.data.devs) return n('ERR0029');
|
if (!arr.data.devs) return n('ERR0029');
|
||||||
|
|
||||||
res.db = new mysql();
|
|
||||||
res.db.user = config.db.user;
|
|
||||||
res.db.password = config.db.pass;
|
|
||||||
res.db.host = config.db.host;
|
|
||||||
res.db.port = config.db.port;
|
|
||||||
res.db.database = config.db.db1;
|
|
||||||
res.db.connect();
|
|
||||||
|
|
||||||
let query = "insert into ??.?? (`iogroupname`,`iogroupid`,`iogroup_add_date`) values (?, ?, unix_timestamp())";
|
let query = "insert into ??.?? (`iogroupname`,`iogroupid`,`iogroup_add_date`) values (?, ?, unix_timestamp())";
|
||||||
let param = [config.db.db1, 'iogroup', arr.data.name, arr.data.devs];
|
let param = [config.db.db1, 'iogroup', arr.data.name, arr.data.devs];
|
||||||
|
|
||||||
res.db.query(query, param, (err, row) => {
|
res.db.query(query, param, (err, row) => {
|
||||||
if (err) return n('ERR8001');
|
if (err) return rt.err(res,err,n,'ERR8001');
|
||||||
|
|
||||||
let data = {};
|
let data = {};
|
||||||
data.record = [];
|
data.record = [];
|
||||||
@@ -128,14 +121,6 @@ router
|
|||||||
if (!arr.data.name) return n('ERR0026');
|
if (!arr.data.name) return n('ERR0026');
|
||||||
if (!arr.data.devs) return n('ERR0029');
|
if (!arr.data.devs) return n('ERR0029');
|
||||||
|
|
||||||
res.db = new mysql();
|
|
||||||
res.db.user = config.db.user;
|
|
||||||
res.db.password = config.db.pass;
|
|
||||||
res.db.host = config.db.host;
|
|
||||||
res.db.port = config.db.port;
|
|
||||||
res.db.database = config.db.db1;
|
|
||||||
res.db.connect();
|
|
||||||
|
|
||||||
let query = "update ??.?? set \
|
let query = "update ??.?? set \
|
||||||
`iogroupname` = ?, \
|
`iogroupname` = ?, \
|
||||||
`iogroupid` = ?, \
|
`iogroupid` = ?, \
|
||||||
@@ -144,7 +129,7 @@ router
|
|||||||
`iogroupuid` = ?";
|
`iogroupuid` = ?";
|
||||||
let param = [config.db.db1, 'iogroup', arr.data.name, arr.data.devs, arr.data.id];
|
let param = [config.db.db1, 'iogroup', arr.data.name, arr.data.devs, arr.data.id];
|
||||||
res.db.query(query, param, (err, row) => {
|
res.db.query(query, param, (err, row) => {
|
||||||
if (err) return n('ERR8002');
|
if (err) return rt.err(res,err,n,'ERR8002');
|
||||||
|
|
||||||
let data = {};
|
let data = {};
|
||||||
data.record = [];
|
data.record = [];
|
||||||
@@ -159,18 +144,10 @@ router
|
|||||||
if (!arr.data) return n('ERR0000');
|
if (!arr.data) return n('ERR0000');
|
||||||
if (!arr.data.id) return n('ERR0028');
|
if (!arr.data.id) return n('ERR0028');
|
||||||
|
|
||||||
res.db = new mysql();
|
|
||||||
res.db.user = config.db.user;
|
|
||||||
res.db.password = config.db.pass;
|
|
||||||
res.db.host = config.db.host;
|
|
||||||
res.db.port = config.db.port;
|
|
||||||
res.db.database = config.db.db1;
|
|
||||||
res.db.connect();
|
|
||||||
|
|
||||||
let query = "delete from ??.?? where `iogroupuid` = ? ";
|
let query = "delete from ??.?? where `iogroupuid` = ? ";
|
||||||
let param = [config.db.db1, 'iogroup', arr.data.id];
|
let param = [config.db.db1, 'iogroup', arr.data.id];
|
||||||
res.db.query(query, param, (err, row) => {
|
res.db.query(query, param, (err, row) => {
|
||||||
if (err) return n('ERR8003');
|
if (err) return rt.err(res,err,n,'ERR8003');
|
||||||
|
|
||||||
let data = {};
|
let data = {};
|
||||||
data.record = [];
|
data.record = [];
|
||||||
|
|||||||
@@ -0,0 +1,322 @@
|
|||||||
|
const express = require('express');
|
||||||
|
const router = express.Router();
|
||||||
|
const rt = require('../ResTool');
|
||||||
|
const config = require('../../config.json');
|
||||||
|
const fs = require('fs');
|
||||||
|
const mysql = require('../../libs/mysql_pool');
|
||||||
|
const tool = require('../../includes/apiTool');
|
||||||
|
const exec = require('child_process').exec;
|
||||||
|
const so = require('../../includes/storeObject');
|
||||||
|
const crypt = require('../../libs/crypto');
|
||||||
|
const path = require('path');
|
||||||
|
|
||||||
|
router
|
||||||
|
.get('/', (req, res, n) => {
|
||||||
|
res.send({ name: 'WebIO IPCam API' });
|
||||||
|
})
|
||||||
|
.post('*', async(req, res, n) => {
|
||||||
|
try {
|
||||||
|
res.db = await mysql.getConn();
|
||||||
|
} catch (e) {
|
||||||
|
console.log(`Get DB Connection ERROR ${e}`);
|
||||||
|
return n('ERR8100');
|
||||||
|
}
|
||||||
|
n();
|
||||||
|
})
|
||||||
|
.post('/getipcamlist', (req, res, n) => {
|
||||||
|
if (!config.permission.ipcam) return n('ERR9000');
|
||||||
|
|
||||||
|
let query = "select * from ??.?? where `delete` = 0 order by `ctime`";
|
||||||
|
let param = [config.db.db1, 'jcioccamset'];
|
||||||
|
res.db.query(query, param, (err, row) => {
|
||||||
|
if (err) return rt.err(res, err, n, 'ERR8000');
|
||||||
|
|
||||||
|
res.api_res = {
|
||||||
|
record: tool.checkArray(row)
|
||||||
|
}
|
||||||
|
|
||||||
|
n();
|
||||||
|
});
|
||||||
|
})
|
||||||
|
.post('/addipcam', (req, res, n) => {
|
||||||
|
if (!config.permission.ipcam) return n('ERR9000');
|
||||||
|
if (!tool.checkPermission(req)) return n('ERR9000');
|
||||||
|
let arr = req.body;
|
||||||
|
if (!arr.data) return n('ERR0000');
|
||||||
|
if (!arr.data.ip) return n("ERR0010");
|
||||||
|
if (!arr.data.name) return n('ERR0026');
|
||||||
|
if (!arr.data.model) return n('ERR0067');
|
||||||
|
if (!arr.data.maxevents) return n('ERR0068');
|
||||||
|
if (!arr.data.maximg) return n('ERR0069');
|
||||||
|
if (!/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/.test(arr.data.ip)) return n('ERR0025');
|
||||||
|
|
||||||
|
let u = '';
|
||||||
|
let obj = so.get(req.headers['x-auth-token'] || '');
|
||||||
|
if (obj != null && 'user' in obj && 'account' in obj.user) u = obj.user.account;
|
||||||
|
|
||||||
|
let active = arr.data.active == 1 ? 1 : 0;
|
||||||
|
|
||||||
|
!async function runSync() {
|
||||||
|
// data flag 0 is insert, 1 is update
|
||||||
|
let flag = 0;
|
||||||
|
let idx = 1;
|
||||||
|
// query db data
|
||||||
|
try {
|
||||||
|
let query = "select `uid` from ??.?? order by `uid` desc limit 1";
|
||||||
|
let param = [config.db.db1, 'jcioccamset'];
|
||||||
|
let id = await tool.promiseQuery(res, query, param);
|
||||||
|
|
||||||
|
if (id.data.length > 0 && id.data[0].uid) idx = id.data[0].uid + 1;
|
||||||
|
if (idx > config.ipcam_limit) {
|
||||||
|
query = "select `uid` from ??.?? where `delete` = 1 limit 1";
|
||||||
|
flag = 1;
|
||||||
|
let id = await tool.promiseQuery(res, query, param);
|
||||||
|
if (id.data.length > 0 && id.data[0].uid) idx = id.data[0].uid;
|
||||||
|
else return n('ERR0070');
|
||||||
|
}
|
||||||
|
|
||||||
|
query = "select count(*) as c from ??.?? where `ip` = ?";
|
||||||
|
param = [config.db.db1, 'jcioccamset', arr.data.ip];
|
||||||
|
let count = await tool.promiseQuery(res, query, param);
|
||||||
|
if (count.data.length == 0) return n('ERR8000');
|
||||||
|
if (count.data[0].c >= 1) return n('ERR0027');
|
||||||
|
} catch (e) {
|
||||||
|
return rt.err(res, e, n, 'ERR8000');
|
||||||
|
}
|
||||||
|
if (flag == 1) {
|
||||||
|
try {
|
||||||
|
let query = "update ??.?? set \
|
||||||
|
`ip` = ?, \
|
||||||
|
`name` = ?, \
|
||||||
|
`model` = ?, \
|
||||||
|
`maxevents` = ?, \
|
||||||
|
`maximg` = ?, \
|
||||||
|
`active` = ?, \
|
||||||
|
`delete` = 0, \
|
||||||
|
`cuser` = ?, \
|
||||||
|
`ctime` = unix_timestamp(), \
|
||||||
|
`muser` = ?, \
|
||||||
|
`mtime` = unix_timestamp() \
|
||||||
|
where \
|
||||||
|
`uid` = ?";
|
||||||
|
let param = [config.db.db1, 'jcioccamset', arr.data.ip, arr.data.name, arr.data.model, arr.data.maxevents, arr.data.maximg, active, u, u, idx];
|
||||||
|
await tool.promiseQuery(res, query, param);
|
||||||
|
} catch (e) {
|
||||||
|
return rt.err(res, e, n, 'ERR8002');
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
try {
|
||||||
|
let query = "insert into ??.?? (`uid`, `ip`, `name`, `model`, `maxevents`, `maximg`, `active`, `cuser`, `muser`, `ctime`, `mtime` ) \
|
||||||
|
values (?, ?, ?, ?, ?, ?, ?, ?, ?, unix_timestamp(), unix_timestamp())";
|
||||||
|
let param = [config.db.db1, 'jcioccamset', idx, arr.data.ip, arr.data.name, arr.data.model, arr.data.maxevents, arr.data.maximg, active, u, u];
|
||||||
|
await tool.promiseQuery(res, query, param);
|
||||||
|
} catch (e) {
|
||||||
|
return rt.err(res, e, n, 'ERR8001');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
res.api_res = {
|
||||||
|
record: []
|
||||||
|
}
|
||||||
|
return n();
|
||||||
|
}()
|
||||||
|
|
||||||
|
})
|
||||||
|
.post('/editipcam', (req, res, n) => {
|
||||||
|
if (!config.permission.ipcam) return n('ERR9000');
|
||||||
|
if (!tool.checkPermission(req)) return n('ERR9000');
|
||||||
|
let arr = req.body;
|
||||||
|
if (!arr.data) return n('ERR0000');
|
||||||
|
if (!arr.data.id) return n('ERR0028');
|
||||||
|
if (!arr.data.ip) return n("ERR0010");
|
||||||
|
if (!arr.data.name) return n('ERR0026');
|
||||||
|
if (!arr.data.model) return n('ERR0067');
|
||||||
|
if (!arr.data.maxevents) return n('ERR0068');
|
||||||
|
if (!arr.data.maximg) return n('ERR0069');
|
||||||
|
if (!/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/.test(arr.data.ip)) return n('ERR0025');
|
||||||
|
|
||||||
|
let u = '';
|
||||||
|
let obj = so.get(req.headers['x-auth-token'] || '');
|
||||||
|
if (obj != null && 'user' in obj && 'account' in obj.user) u = obj.user.account;
|
||||||
|
|
||||||
|
let active = arr.data.active == 1 ? 1 : 0;
|
||||||
|
|
||||||
|
let query = "select count(*) as c from ??.?? where `ip` = ? and `uid` != ?";
|
||||||
|
let param = [config.db.db1, 'jcioccamset', arr.data.ip, arr.data.id];
|
||||||
|
|
||||||
|
res.db.query(query, param, (err, row) => {
|
||||||
|
if (err || row.length == 0) return rt.err(res, err, n, 'ERR8000');
|
||||||
|
|
||||||
|
if (row[0].c >= 1) return n('ERR0027');
|
||||||
|
|
||||||
|
let query = "update ??.?? set \
|
||||||
|
`ip` = ?, \
|
||||||
|
`name` = ?, \
|
||||||
|
`model` = ?, \
|
||||||
|
`maxevents` = ?, \
|
||||||
|
`maximg` = ?, \
|
||||||
|
`active` = ?, \
|
||||||
|
`muser` = ?, \
|
||||||
|
`mtime` = unix_timestamp() \
|
||||||
|
where \
|
||||||
|
`uid` = ?";
|
||||||
|
let param = [config.db.db1, 'jcioccamset', arr.data.ip, arr.data.name, arr.data.model, arr.data.maxevents, arr.data.maximg, active, u, arr.data.id];
|
||||||
|
res.db.query(query, param, (err, row) => {
|
||||||
|
if (err) return rt.err(res, err, n, 'ERR8002');
|
||||||
|
|
||||||
|
res.api_res = {
|
||||||
|
record: []
|
||||||
|
}
|
||||||
|
n();
|
||||||
|
})
|
||||||
|
});
|
||||||
|
})
|
||||||
|
.post('/delipcam', (req, res, n) => {
|
||||||
|
if (!config.permission.ipcam) return n('ERR9000');
|
||||||
|
if (!tool.checkPermission(req)) return n('ERR9000');
|
||||||
|
let arr = req.body;
|
||||||
|
if (!arr.data) return n('ERR0000');
|
||||||
|
if (!arr.data.id) return n('ERR0028');
|
||||||
|
|
||||||
|
let u = '';
|
||||||
|
let obj = so.get(req.headers['x-auth-token'] || '');
|
||||||
|
if (obj != null && 'user' in obj && 'account' in obj.user) u = obj.user.account;
|
||||||
|
|
||||||
|
res.db.query(`use ${config.db.db1}`);
|
||||||
|
let query = "update ??.?? set \
|
||||||
|
`delete` = 1, \
|
||||||
|
`muser` = ?, \
|
||||||
|
`mtime` = unix_timestamp() \
|
||||||
|
where `uid` = ?";
|
||||||
|
let param = [config.db.db1, 'jcioccamset', u, arr.data.id];
|
||||||
|
|
||||||
|
res.db.query(query, param, (err, row) => {
|
||||||
|
if (err) return rt.err(res, err, n, 'ERR8003');
|
||||||
|
|
||||||
|
res.api_res = {
|
||||||
|
record: []
|
||||||
|
}
|
||||||
|
n();
|
||||||
|
})
|
||||||
|
})
|
||||||
|
.post('/swipcamactive', (req, res, n) => {
|
||||||
|
if (!config.permission.ipcam) return n('ERR9000');
|
||||||
|
if (!tool.checkPermission(req)) return n('ERR9000');
|
||||||
|
let arr = req.body;
|
||||||
|
if (!arr.data) return n('ERR0000');
|
||||||
|
if (!arr.data.id) return n('ERR0028');
|
||||||
|
|
||||||
|
let query = "update ??.?? set \
|
||||||
|
`active` = case when `active` = 1 then 0 else 1 end \
|
||||||
|
where \
|
||||||
|
`uid` = ?";
|
||||||
|
let param = [config.db.db1, 'jcioccamset', arr.data.id];
|
||||||
|
|
||||||
|
res.db.query(query, param, (err, row) => {
|
||||||
|
if (err) return rt.err(res, err, n, 'ERR8002');
|
||||||
|
|
||||||
|
res.api_res = {
|
||||||
|
record: []
|
||||||
|
}
|
||||||
|
n();
|
||||||
|
})
|
||||||
|
})
|
||||||
|
.post('/getevents', async(req, res, n) => {
|
||||||
|
if (!config.permission.ipcam) return n('ERR9000');
|
||||||
|
if (!tool.checkPermission(req)) return n('ERR9000');
|
||||||
|
let arr = req.body;
|
||||||
|
if (!arr.data) return n('ERR0000');
|
||||||
|
if (!arr.data.id) return n('ERR0028');
|
||||||
|
|
||||||
|
try {
|
||||||
|
let query = "select * from ??.?? where `uid` = ? and `delete` = 0";
|
||||||
|
let param = [config.db.db1, 'jcioccamset', arr.data.id];
|
||||||
|
let cam = await tool.promiseQuery(res, query, param);
|
||||||
|
if (cam.length == 0) return n('ERR0071');
|
||||||
|
} catch (e) {
|
||||||
|
return rt.err(res, e, n, 'ERR8000');
|
||||||
|
}
|
||||||
|
let rp = config.cmdpath.ipcamsave;
|
||||||
|
let dirs = [];
|
||||||
|
|
||||||
|
try {
|
||||||
|
let dirls = await new Promise((resolve, reject) => {
|
||||||
|
fs.readdir(rp, (err, list) => {
|
||||||
|
if (err) return reject(err);
|
||||||
|
return resolve(list);
|
||||||
|
})
|
||||||
|
})
|
||||||
|
for (let i of dirls) {
|
||||||
|
let tmp = i.split('-');
|
||||||
|
if (tmp.length != 2) continue;
|
||||||
|
if (tmp[0] == arr.data.id) dirs.push({
|
||||||
|
name: i,
|
||||||
|
files: {
|
||||||
|
img: [],
|
||||||
|
video: []
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
for (let i in dirs) {
|
||||||
|
let p = path.resolve(rp, dirs[i].name);
|
||||||
|
let idx = i;
|
||||||
|
let files = await new Promise((resolve, reject) => {
|
||||||
|
fs.readdir(p, (err, list) => {
|
||||||
|
if (err) return reject(err);
|
||||||
|
return resolve(list);
|
||||||
|
})
|
||||||
|
})
|
||||||
|
for (let j of files) {
|
||||||
|
if (/^img/.test(j)) {
|
||||||
|
dirs[idx].files.img.push(j);
|
||||||
|
} else if (/^vid/.test(j)) {
|
||||||
|
dirs[idx].files.video.push(j);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (e) {
|
||||||
|
return rt.err(res, e, n, 'ERR0072');
|
||||||
|
}
|
||||||
|
|
||||||
|
res.api_res = {
|
||||||
|
record: tool.checkArray(dirs)
|
||||||
|
}
|
||||||
|
return n();
|
||||||
|
})
|
||||||
|
.post('/delevent', async(req, res, n) => {
|
||||||
|
if (!config.permission.ipcam) return n('ERR9000');
|
||||||
|
if (!tool.checkPermission(req)) return n('ERR9000');
|
||||||
|
let arr = req.body;
|
||||||
|
if (!arr.data) return n('ERR0000');
|
||||||
|
if (!arr.data.dir) return n('ERR0073');
|
||||||
|
|
||||||
|
let rp = config.cmdpath.ipcamsave;
|
||||||
|
let dp = path.resolve(rp, arr.data.dir);
|
||||||
|
try {
|
||||||
|
let stat = await new Promise((resolve, reject) => {
|
||||||
|
fs.stat(dp, (err, stats) => {
|
||||||
|
if (err) return reject(err);
|
||||||
|
return resolve(stats);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
if (dp.split(' ')[0] == '/') return n('ERR0073');
|
||||||
|
await new Promise((resolve, reject) => {
|
||||||
|
exec(`rm -rf ${dp}`, (err, sout, serr) => {
|
||||||
|
if (err) return reject(err);
|
||||||
|
return resolve(null);
|
||||||
|
})
|
||||||
|
})
|
||||||
|
} catch (e) {
|
||||||
|
return rt.err(res, e, n, 'ERR0072');
|
||||||
|
}
|
||||||
|
|
||||||
|
res.api_res = {
|
||||||
|
record: []
|
||||||
|
}
|
||||||
|
return n();
|
||||||
|
})
|
||||||
|
.all('*', rt.send);
|
||||||
|
|
||||||
|
module.exports = router;
|
||||||
+22
-68
@@ -3,7 +3,7 @@ const router = express.Router();
|
|||||||
const rt = require('../ResTool');
|
const rt = require('../ResTool');
|
||||||
const config = require('../../config.json');
|
const config = require('../../config.json');
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
const mysql = require('../../libs/mysql_cls');
|
const mysql = require('../../libs/mysql_pool');
|
||||||
const tool = require('../../includes/apiTool');
|
const tool = require('../../includes/apiTool');
|
||||||
const exec = require('child_process').exec;
|
const exec = require('child_process').exec;
|
||||||
|
|
||||||
@@ -11,6 +11,15 @@ router
|
|||||||
.get('/', (req, res) => {
|
.get('/', (req, res) => {
|
||||||
res.send({name: 'WebIO Leone API'});
|
res.send({name: 'WebIO Leone API'});
|
||||||
})
|
})
|
||||||
|
.post('*', async(req,res,n) => {
|
||||||
|
try{
|
||||||
|
res.db = await mysql.getConn();
|
||||||
|
}catch(e){
|
||||||
|
console.log(`Get DB Connection ERROR ${e}`);
|
||||||
|
return n('ERR8100');
|
||||||
|
}
|
||||||
|
n();
|
||||||
|
})
|
||||||
.post('/scanleone', (req, res, n) => {
|
.post('/scanleone', (req, res, n) => {
|
||||||
if (!config.permission.leone) return n('ERR9000');
|
if (!config.permission.leone) return n('ERR9000');
|
||||||
if (!tool.checkPermission(req)) return n('ERR9000');
|
if (!tool.checkPermission(req)) return n('ERR9000');
|
||||||
@@ -38,18 +47,11 @@ router
|
|||||||
! function chkEnd() {
|
! function chkEnd() {
|
||||||
fs.exists(config.cmdpath.scanleone_end, exists => {
|
fs.exists(config.cmdpath.scanleone_end, exists => {
|
||||||
if (exists) {
|
if (exists) {
|
||||||
res.db = new mysql();
|
|
||||||
res.db.user = config.db.user;
|
|
||||||
res.db.password = config.db.pass;
|
|
||||||
res.db.host = config.db.host;
|
|
||||||
res.db.port = config.db.port;
|
|
||||||
res.db.database = config.db.db1;
|
|
||||||
res.db.connect();
|
|
||||||
|
|
||||||
let query = "select `leonename`, `leoneip`, `leonelistuid` from ??.?? where `temporary` = '1' ";
|
let query = "select `leonename`, `leoneip`, `leonelistuid` from ??.?? where `temporary` = '1' ";
|
||||||
let param = [config.db.db1, 'leonelist'];
|
let param = [config.db.db1, 'leonelist'];
|
||||||
res.db.query(query, param, (err, row) => {
|
res.db.query(query, param, (err, row) => {
|
||||||
if (err) return n('ERR8000');
|
if (err) return rt.err(res,err,n,'ERR8000');
|
||||||
|
|
||||||
let data = {};
|
let data = {};
|
||||||
data.record = tool.checkArray(row);
|
data.record = tool.checkArray(row);
|
||||||
@@ -73,14 +75,6 @@ router
|
|||||||
if (!arr.data.id) return n('ERR0028');
|
if (!arr.data.id) return n('ERR0028');
|
||||||
}
|
}
|
||||||
|
|
||||||
res.db = new mysql();
|
|
||||||
res.db.user = config.db.user;
|
|
||||||
res.db.password = config.db.pass;
|
|
||||||
res.db.host = config.db.host;
|
|
||||||
res.db.port = config.db.port;
|
|
||||||
res.db.database = config.db.db1;
|
|
||||||
res.db.connect();
|
|
||||||
|
|
||||||
let query = "select * from ??.?? where `temporary` = '0' ";
|
let query = "select * from ??.?? where `temporary` = '0' ";
|
||||||
let param = [config.db.db1, 'leonelist'];
|
let param = [config.db.db1, 'leonelist'];
|
||||||
if (s) {
|
if (s) {
|
||||||
@@ -89,7 +83,7 @@ router
|
|||||||
}
|
}
|
||||||
let order = " order by `leonelistuid` desc ";
|
let order = " order by `leonelistuid` desc ";
|
||||||
res.db.query(query + order, param, (err, row) => {
|
res.db.query(query + order, param, (err, row) => {
|
||||||
if (err) return n('ERR8000');
|
if (err) return rt.err(res,err,n,'ERR8000');
|
||||||
|
|
||||||
tool.getLeoneRT(rts => {
|
tool.getLeoneRT(rts => {
|
||||||
let data = {};
|
let data = {};
|
||||||
@@ -110,30 +104,22 @@ router
|
|||||||
if (!arr.data.ip) return n('ERR0010');
|
if (!arr.data.ip) return n('ERR0010');
|
||||||
if (!arr.data.password) return n('ERR0017');
|
if (!arr.data.password) return n('ERR0017');
|
||||||
|
|
||||||
res.db = new mysql();
|
|
||||||
res.db.user = config.db.user;
|
|
||||||
res.db.password = config.db.pass;
|
|
||||||
res.db.host = config.db.host;
|
|
||||||
res.db.port = config.db.port;
|
|
||||||
res.db.database = config.db.db1;
|
|
||||||
res.db.connect();
|
|
||||||
|
|
||||||
let query = "select count(*) as num from ??.?? where `temporary` = '0' ";
|
let query = "select count(*) as num from ??.?? where `temporary` = '0' ";
|
||||||
let param = [config.db.db1, 'leonelist'];
|
let param = [config.db.db1, 'leonelist'];
|
||||||
res.db.query(query, param, (err, row) => {
|
res.db.query(query, param, (err, row) => {
|
||||||
if (err || row.length == 0) return n('ERR8000');
|
if (err || row.length == 0) return rt.err(res,err,n,'ERR8000');
|
||||||
if (row[0].num >= config.leone_limit) return n('ERR0048');
|
if (row[0].num >= config.leone_limit) return n('ERR0056');
|
||||||
|
|
||||||
let query = "select count(*) from ??.?? where `leoneip` = ? ";
|
let query = "select count(*) from ??.?? where `leoneip` = ? ";
|
||||||
let p = [...param, arr.data.ip];
|
let p = [...param, arr.data.ip];
|
||||||
res.db.query(query, p, (err, row) => {
|
res.db.query(query, p, (err, row) => {
|
||||||
if (err || row.length == 0) return n('ERR8000');
|
if (err || row.length == 0) return rt.err(res,err,n,'ERR8000');
|
||||||
if (row[0].num > 0) return n('ERR0027');
|
if (row[0].num > 0) return n('ERR0027');
|
||||||
|
|
||||||
let query = "insert into ??.?? (`leoneip`,`leonename`,`leonepassword`,`leone_add_date`,`leone_modify_date`) values (?,?,?,unix_timestamp(),unix_timestamp())";
|
let query = "insert into ??.?? (`leoneip`,`leonename`,`leonepassword`,`leone_add_date`,`leone_modify_date`) values (?,?,?,unix_timestamp(),unix_timestamp())";
|
||||||
let p = [...param, arr.data.ip, arr.data.name, arr.data.password];
|
let p = [...param, arr.data.ip, arr.data.name, arr.data.password];
|
||||||
res.db.query(query, p, (err, row) => {
|
res.db.query(query, p, (err, row) => {
|
||||||
if (err) return n('ERR8001');
|
if (err) return rt.err(res,err,n,'ERR8001');
|
||||||
|
|
||||||
let data = {};
|
let data = {};
|
||||||
data.record = [];
|
data.record = [];
|
||||||
@@ -150,18 +136,10 @@ router
|
|||||||
if (!arr.data) return n('ERR0000');
|
if (!arr.data) return n('ERR0000');
|
||||||
if (!arr.data.id) return n('ERR0028');
|
if (!arr.data.id) return n('ERR0028');
|
||||||
|
|
||||||
res.db = new mysql();
|
|
||||||
res.db.user = config.db.user;
|
|
||||||
res.db.password = config.db.pass;
|
|
||||||
res.db.host = config.db.host;
|
|
||||||
res.db.port = config.db.port;
|
|
||||||
res.db.database = config.db.db1;
|
|
||||||
res.db.connect();
|
|
||||||
|
|
||||||
let query = "delete from ??.?? where `leonelistuid` = ? ";
|
let query = "delete from ??.?? where `leonelistuid` = ? ";
|
||||||
let param = [config.db.db1, 'leonelist', arr.data.id];
|
let param = [config.db.db1, 'leonelist', arr.data.id];
|
||||||
res.db.query(query, param, (err, row) => {
|
res.db.query(query, param, (err, row) => {
|
||||||
if (err) return n('ERR8003');
|
if (err) return rt.err(res,err,n,'ERR8003');
|
||||||
let data = {};
|
let data = {};
|
||||||
data.record = [];
|
data.record = [];
|
||||||
res.api_res = data;
|
res.api_res = data;
|
||||||
@@ -177,14 +155,6 @@ router
|
|||||||
if (!arr.data.name) return n("ERR0026");
|
if (!arr.data.name) return n("ERR0026");
|
||||||
if (!arr.data.password) return n('ERR0017');
|
if (!arr.data.password) return n('ERR0017');
|
||||||
|
|
||||||
res.db = new mysql();
|
|
||||||
res.db.user = config.db.user;
|
|
||||||
res.db.password = config.db.pass;
|
|
||||||
res.db.host = config.db.host;
|
|
||||||
res.db.port = config.db.port;
|
|
||||||
res.db.database = config.db.db1;
|
|
||||||
res.db.connect();
|
|
||||||
|
|
||||||
let query = "update ??.?? set \
|
let query = "update ??.?? set \
|
||||||
`leonename` = ?,\
|
`leonename` = ?,\
|
||||||
`leonepassword` = ?,\
|
`leonepassword` = ?,\
|
||||||
@@ -193,7 +163,7 @@ router
|
|||||||
`leonelistuid` = ? ";
|
`leonelistuid` = ? ";
|
||||||
let param = [config.db.db1, 'leonelist', arr.data.name, arr.data.password, arr.data.id];
|
let param = [config.db.db1, 'leonelist', arr.data.name, arr.data.password, arr.data.id];
|
||||||
res.db.query(query, param, (err, row) => {
|
res.db.query(query, param, (err, row) => {
|
||||||
if (err) return n('ERR8002');
|
if (err) return rt.err(res,err,n,'ERR8002');
|
||||||
|
|
||||||
let data = {};
|
let data = {};
|
||||||
data.record = [];
|
data.record = [];
|
||||||
@@ -202,7 +172,7 @@ router
|
|||||||
let query = "select * from ??.?? where `leonelistuid` = ? ";
|
let query = "select * from ??.?? where `leonelistuid` = ? ";
|
||||||
let param = [config.db.db1, 'leonelist', arr.data.id];
|
let param = [config.db.db1, 'leonelist', arr.data.id];
|
||||||
res.db.query(query, param, (err, row) => {
|
res.db.query(query, param, (err, row) => {
|
||||||
if (err) return n();
|
if (err) return rt.err(res,err,n);
|
||||||
if (row.length == 0) return n();
|
if (row.length == 0) return n();
|
||||||
|
|
||||||
let { leoneip, leonename, leonepassword } = row[0];
|
let { leoneip, leonename, leonepassword } = row[0];
|
||||||
@@ -220,14 +190,6 @@ router
|
|||||||
if (!arr.data) return n('ERR0000');
|
if (!arr.data) return n('ERR0000');
|
||||||
if (!arr.data.id || !Array.isArray(arr.data.id)) return n('ERR0028');
|
if (!arr.data.id || !Array.isArray(arr.data.id)) return n('ERR0028');
|
||||||
|
|
||||||
res.db = new mysql();
|
|
||||||
res.db.user = config.db.user;
|
|
||||||
res.db.password = config.db.pass;
|
|
||||||
res.db.host = config.db.host;
|
|
||||||
res.db.port = config.db.port;
|
|
||||||
res.db.database = config.db.db1;
|
|
||||||
res.db.connect();
|
|
||||||
|
|
||||||
let ids = [];
|
let ids = [];
|
||||||
for (var i in arr.data.id) {
|
for (var i in arr.data.id) {
|
||||||
let t = arr.data.id[i];
|
let t = arr.data.id[i];
|
||||||
@@ -245,12 +207,12 @@ router
|
|||||||
let query = "select count(*) as num from ??.?? where `temporary` = '0' or `leonelistuid` in (?)";
|
let query = "select count(*) as num from ??.?? where `temporary` = '0' or `leonelistuid` in (?)";
|
||||||
let param = [config.db.db1, 'leonelist', ids];
|
let param = [config.db.db1, 'leonelist', ids];
|
||||||
res.db.query(query, param, (err, row) => {
|
res.db.query(query, param, (err, row) => {
|
||||||
if (err || row.length == 0) return n('ERR8000');
|
if (err || row.length == 0) return rt.err(res,err,n,'ERR8000');
|
||||||
if (row[0].num >= config.leone_limit) return n('ERR0048');
|
if (row[0].num >= config.leone_limit) return n('ERR0056');
|
||||||
|
|
||||||
let query = "update ??.?? set `temporary` = '0', `leone_modify_date` = unix_timestamp() where `leonelistuid` in (?)";
|
let query = "update ??.?? set `temporary` = '0', `leone_modify_date` = unix_timestamp() where `leonelistuid` in (?)";
|
||||||
res.db.query(query, param, (err, row) => {
|
res.db.query(query, param, (err, row) => {
|
||||||
if (err) return n('ERR8002');
|
if (err) return rt.err(res,err,n,'ERR8002');
|
||||||
let data = {};
|
let data = {};
|
||||||
data.record = [];
|
data.record = [];
|
||||||
res.api_res = data;
|
res.api_res = data;
|
||||||
@@ -262,14 +224,6 @@ router
|
|||||||
if (!config.permission.leone) return n('ERR9000');
|
if (!config.permission.leone) return n('ERR9000');
|
||||||
if (!tool.checkPermission(req)) return n('ERR9000');
|
if (!tool.checkPermission(req)) return n('ERR9000');
|
||||||
|
|
||||||
res.db = new mysql();
|
|
||||||
res.db.user = config.db.user;
|
|
||||||
res.db.password = config.db.pass;
|
|
||||||
res.db.host = config.db.host;
|
|
||||||
res.db.port = config.db.port;
|
|
||||||
res.db.database = config.db.db1;
|
|
||||||
res.db.connect();
|
|
||||||
|
|
||||||
let query = "delete from ??.?? where `temporary` = '1'";
|
let query = "delete from ??.?? where `temporary` = '1'";
|
||||||
let param = [config.db.db1, 'leonelist'];
|
let param = [config.db.db1, 'leonelist'];
|
||||||
res.db.query(query, param, (err, row) => {
|
res.db.query(query, param, (err, row) => {
|
||||||
|
|||||||
+19
-49
@@ -2,24 +2,25 @@ const express = require('express');
|
|||||||
const router = express.Router();
|
const router = express.Router();
|
||||||
const rt = require('../ResTool');
|
const rt = require('../ResTool');
|
||||||
const config = require('../../config.json');
|
const config = require('../../config.json');
|
||||||
const mysql = require('../../libs/mysql_cls');
|
const mysql = require('../../libs/mysql_pool');
|
||||||
const tool = require('../../includes/apiTool');
|
const tool = require('../../includes/apiTool');
|
||||||
|
|
||||||
router
|
router
|
||||||
.get('/', (req, res) => {
|
.get('/', (req, res) => {
|
||||||
res.send({ name: 'WebIO Link API' });
|
res.send({ name: 'WebIO Link API' });
|
||||||
})
|
})
|
||||||
|
.post('*', async(req,res,n) => {
|
||||||
|
try{
|
||||||
|
res.db = await mysql.getConn();
|
||||||
|
}catch(e){
|
||||||
|
console.log(`Get DB Connection ERROR ${e}`);
|
||||||
|
return n('ERR8100');
|
||||||
|
}
|
||||||
|
n();
|
||||||
|
})
|
||||||
.post('/getlinklist', (req, res, n) => {
|
.post('/getlinklist', (req, res, n) => {
|
||||||
if (!config.permission.link) return n('ERR9000');
|
if (!config.permission.link) return n('ERR9000');
|
||||||
|
|
||||||
res.db = new mysql();
|
|
||||||
res.db.user = config.db.user;
|
|
||||||
res.db.password = config.db.pass;
|
|
||||||
res.db.host = config.db.host;
|
|
||||||
res.db.port = config.db.port;
|
|
||||||
res.db.database = config.db.db8;
|
|
||||||
res.db.connect();
|
|
||||||
|
|
||||||
let query = "select * from ??.?? \
|
let query = "select * from ??.?? \
|
||||||
where \
|
where \
|
||||||
`jcioclntuid` not in ( \
|
`jcioclntuid` not in ( \
|
||||||
@@ -35,7 +36,7 @@ router
|
|||||||
let param = [config.db.db8, 'jcioclnt', config.db.db8, 'jcioclnt', config.db.db8, 'jcioclnt'];
|
let param = [config.db.db8, 'jcioclnt', config.db.db8, 'jcioclnt', config.db.db8, 'jcioclnt'];
|
||||||
|
|
||||||
res.db.query(query, param, (err, row) => {
|
res.db.query(query, param, (err, row) => {
|
||||||
if (err) return n('ERR8000');
|
if (err) return rt.err(res,err,n,'ERR8000');
|
||||||
|
|
||||||
res.api_res = {
|
res.api_res = {
|
||||||
record: tool.checkArray(row)
|
record: tool.checkArray(row)
|
||||||
@@ -50,14 +51,6 @@ router
|
|||||||
if (!arr.data) return n('ERR0000');
|
if (!arr.data) return n('ERR0000');
|
||||||
if (!arr.data.id) return n('ERR0028');
|
if (!arr.data.id) return n('ERR0028');
|
||||||
|
|
||||||
res.db = new mysql();
|
|
||||||
res.db.user = config.db.user;
|
|
||||||
res.db.password = config.db.pass;
|
|
||||||
res.db.host = config.db.host;
|
|
||||||
res.db.port = config.db.port;
|
|
||||||
res.db.database = config.db.db8;
|
|
||||||
res.db.connect();
|
|
||||||
|
|
||||||
res.api_res = {
|
res.api_res = {
|
||||||
record: [{ root: arr.data.id }],
|
record: [{ root: arr.data.id }],
|
||||||
rt: {
|
rt: {
|
||||||
@@ -70,7 +63,7 @@ router
|
|||||||
let param = [config.db.db8, 'getLink', arr.data.id];
|
let param = [config.db.db8, 'getLink', arr.data.id];
|
||||||
|
|
||||||
res.db.query(query, param, (err, row) => {
|
res.db.query(query, param, (err, row) => {
|
||||||
if (err || row.length == 0) return n('ERR8000');
|
if (err || row.length == 0) return rt.err(res,err,n,'ERR8000');
|
||||||
|
|
||||||
let ids = row[0].ids;
|
let ids = row[0].ids;
|
||||||
let id = ids.split(',');
|
let id = ids.split(',');
|
||||||
@@ -111,7 +104,7 @@ router
|
|||||||
}
|
}
|
||||||
return n();
|
return n();
|
||||||
})
|
})
|
||||||
.catch(err => n('ERR8000'));
|
.catch(err => rt.err(res,err,n,'ERR8000'));
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.post('/addlink', (req, res, n) => {
|
.post('/addlink', (req, res, n) => {
|
||||||
@@ -119,18 +112,10 @@ router
|
|||||||
if (!tool.checkPermission(req)) return n('ERR9000');
|
if (!tool.checkPermission(req)) return n('ERR9000');
|
||||||
let arr = req.body;
|
let arr = req.body;
|
||||||
if (!arr.data) return n('ERR0000');
|
if (!arr.data) return n('ERR0000');
|
||||||
if (!arr.data.link || Object.keys(arr.data.link).length == 0) return n('ERR0049');
|
if (!arr.data.link || Object.keys(arr.data.link).length == 0) return n('ERR0057');
|
||||||
if (!('active' in arr.data)) return n('ERR0032');
|
if (!('active' in arr.data)) return n('ERR0032');
|
||||||
if (!arr.data.action) return n('ERR0030');
|
if (!arr.data.action) return n('ERR0030');
|
||||||
|
|
||||||
res.db = new mysql();
|
|
||||||
res.db.user = config.db.user;
|
|
||||||
res.db.password = config.db.pass;
|
|
||||||
res.db.host = config.db.host;
|
|
||||||
res.db.port = config.db.port;
|
|
||||||
res.db.database = config.db.db8;
|
|
||||||
res.db.connect();
|
|
||||||
|
|
||||||
! function runLoop(unit, cb) {
|
! function runLoop(unit, cb) {
|
||||||
if (typeof unit != 'object' || Object.keys(unit).length == 0) return cb(0);
|
if (typeof unit != 'object' || Object.keys(unit).length == 0) return cb(0);
|
||||||
if (unit.type == 'ln') {
|
if (unit.type == 'ln') {
|
||||||
@@ -188,7 +173,7 @@ router
|
|||||||
let param = [config.db.db8, 'jcioclnt', (arr.data.active == 1 ? 1 : 0), arr.data.action, id.substr(2)];
|
let param = [config.db.db8, 'jcioclnt', (arr.data.active == 1 ? 1 : 0), arr.data.action, id.substr(2)];
|
||||||
|
|
||||||
res.db.query(query, param, (err, row) => {
|
res.db.query(query, param, (err, row) => {
|
||||||
if (err) return n('ERR8002');
|
if (err) return rt.err(res,err,n,'ERR8002');
|
||||||
|
|
||||||
res.api_res = {
|
res.api_res = {
|
||||||
record: []
|
record: []
|
||||||
@@ -204,14 +189,6 @@ router
|
|||||||
if (!arr.data) return n('ERR0000');
|
if (!arr.data) return n('ERR0000');
|
||||||
if (!arr.data.id) return n('ERR0028');
|
if (!arr.data.id) return n('ERR0028');
|
||||||
|
|
||||||
res.db = new mysql();
|
|
||||||
res.db.user = config.db.user;
|
|
||||||
res.db.password = config.db.pass;
|
|
||||||
res.db.host = config.db.host;
|
|
||||||
res.db.port = config.db.port;
|
|
||||||
res.db.database = config.db.db8;
|
|
||||||
res.db.connect();
|
|
||||||
|
|
||||||
let query = "update ??.?? set \
|
let query = "update ??.?? set \
|
||||||
`lnactive` = (case when `lnactive` = 1 then 0 else 1 end), \
|
`lnactive` = (case when `lnactive` = 1 then 0 else 1 end), \
|
||||||
`lnmodtst` = unix_timestamp() \
|
`lnmodtst` = unix_timestamp() \
|
||||||
@@ -220,7 +197,7 @@ router
|
|||||||
let param = [config.db.db8, 'jcioclnt', arr.data.id];
|
let param = [config.db.db8, 'jcioclnt', arr.data.id];
|
||||||
|
|
||||||
res.db.query(query, param, (err, row) => {
|
res.db.query(query, param, (err, row) => {
|
||||||
if (err) return n('ERR8002');
|
if (err) return rt.err(res,err,n,'ERR8002');
|
||||||
|
|
||||||
res.api_res = {
|
res.api_res = {
|
||||||
record: []
|
record: []
|
||||||
@@ -237,19 +214,11 @@ router
|
|||||||
if (!arr.data) return n('ERR0000');
|
if (!arr.data) return n('ERR0000');
|
||||||
if (!arr.data.id) return n('ERR0028');
|
if (!arr.data.id) return n('ERR0028');
|
||||||
|
|
||||||
res.db = new mysql();
|
|
||||||
res.db.user = config.db.user;
|
|
||||||
res.db.password = config.db.pass;
|
|
||||||
res.db.host = config.db.host;
|
|
||||||
res.db.port = config.db.port;
|
|
||||||
res.db.database = config.db.db8;
|
|
||||||
res.db.connect();
|
|
||||||
|
|
||||||
let query = "select ??.??(?) as ids";
|
let query = "select ??.??(?) as ids";
|
||||||
let param = [config.db.db8, 'getLink', arr.data.id];
|
let param = [config.db.db8, 'getLink', arr.data.id];
|
||||||
|
|
||||||
res.db.query(query, param, (err, row) => {
|
res.db.query(query, param, (err, row) => {
|
||||||
if (err || row.length == 0) return n('ERR8000');
|
if (err || row.length == 0) return rt.err(res,err,n,'ERR8000');
|
||||||
let ids = row[0].ids;
|
let ids = row[0].ids;
|
||||||
let id = ids.split(',');
|
let id = ids.split(',');
|
||||||
id.splice(0, 1);
|
id.splice(0, 1);
|
||||||
@@ -258,6 +227,7 @@ router
|
|||||||
if (t != '') return t;
|
if (t != '') return t;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
res.db.query(`use ${config.db.db8}`);
|
||||||
let query = "delete c,n from ??.?? n \
|
let query = "delete c,n from ??.?? n \
|
||||||
left join ??.?? c \
|
left join ??.?? c \
|
||||||
on \
|
on \
|
||||||
@@ -273,7 +243,7 @@ router
|
|||||||
n.`jcioclntuid` in (?)";
|
n.`jcioclntuid` in (?)";
|
||||||
let param = [config.db.db8, 'jcioclnt', config.db.db7, 'jcioclct', ida];
|
let param = [config.db.db8, 'jcioclnt', config.db.db7, 'jcioclct', ida];
|
||||||
res.db.query(query, param, (err, row) => {
|
res.db.query(query, param, (err, row) => {
|
||||||
if (err) return n('ERR8003');
|
if (err) return rt.err(res,err,n,'ERR8003');
|
||||||
|
|
||||||
res.api_res = {
|
res.api_res = {
|
||||||
record: []
|
record: []
|
||||||
|
|||||||
+13
-12
@@ -2,37 +2,38 @@ const express = require('express');
|
|||||||
const router = express.Router();
|
const router = express.Router();
|
||||||
const rt = require('../ResTool');
|
const rt = require('../ResTool');
|
||||||
const config = require('../../config.json');
|
const config = require('../../config.json');
|
||||||
const mysql = require('../../libs/mysql_cls');
|
const mysql = require('../../libs/mysql_pool');
|
||||||
const tool = require('../../includes/apiTool');
|
const tool = require('../../includes/apiTool');
|
||||||
|
|
||||||
router
|
router
|
||||||
.get('/', (req, res) => {
|
.get('/', (req, res) => {
|
||||||
res.send({ name: 'WebIO Log API' })
|
res.send({ name: 'WebIO Log API' })
|
||||||
})
|
})
|
||||||
|
.post('*', async(req,res,n) => {
|
||||||
|
try{
|
||||||
|
res.db = await mysql.getConn();
|
||||||
|
}catch(e){
|
||||||
|
console.log(`Get DB Connection ERROR ${e}`);
|
||||||
|
return n('ERR8100');
|
||||||
|
}
|
||||||
|
n();
|
||||||
|
})
|
||||||
.post('/getlog', (req, res, n) => {
|
.post('/getlog', (req, res, n) => {
|
||||||
if(!config.permission.log) return n('ERR9000');
|
if(!config.permission.log) return n('ERR9000');
|
||||||
let arr = req.body;
|
let arr = req.body;
|
||||||
let p = arr.data && arr.data.p && isFinite(arr.data.p) && arr.data.p > 0 ? arr.data.p : 1;
|
let p = arr.data && arr.data.p && isFinite(arr.data.p) && arr.data.p > 0 ? arr.data.p : 1;
|
||||||
let per = arr.data && arr.data.perpage && isFinite(arr.data.perpage) && arr.data.perpage > 0 ? arr.data.perpage : config.perpage;
|
let per = arr.data && arr.data.perpage && isFinite(arr.data.perpage) && arr.data.perpage > 0 ? arr.data.perpage : config.perpage;
|
||||||
|
|
||||||
res.db = new mysql();
|
|
||||||
res.db.user = config.db.user;
|
|
||||||
res.db.password = config.db.pass;
|
|
||||||
res.db.host = config.db.host;
|
|
||||||
res.db.port = config.db.port;
|
|
||||||
res.db.database = config.db.db2;
|
|
||||||
res.db.connect();
|
|
||||||
|
|
||||||
let query = "select count(*) as num from ??.??";
|
let query = "select count(*) as num from ??.??";
|
||||||
let param = [config.db.db2, 'jciocert'];
|
let param = [config.db.db2, 'jciocert'];
|
||||||
res.db.query(query, param, (err, row) => {
|
res.db.query(query, param, (err, row) => {
|
||||||
if(err || row.length == 0) return n('ERR0023');
|
if(err || row.length == 0) return rt.err(res,err,n,'ERR0023');
|
||||||
let page = res.db.recordPage(row[0].num, p, per);
|
let page = mysql.recordPage(row[0].num, p, per);
|
||||||
|
|
||||||
let query = "select * from ??.?? order by `ioeventtst` desc ";
|
let query = "select * from ??.?? order by `ioeventtst` desc ";
|
||||||
let limit = ` limit ${page.rec_start} , ${per} `;
|
let limit = ` limit ${page.rec_start} , ${per} `;
|
||||||
res.db.query(query + limit, param, (err, row) => {
|
res.db.query(query + limit, param, (err, row) => {
|
||||||
if(err) return n('ERR8000');
|
if(err) return rt.err(res,err,n,'ERR8000');
|
||||||
let data = {};
|
let data = {};
|
||||||
data.page = page;
|
data.page = page;
|
||||||
data.record = tool.checkArray(row);
|
data.record = tool.checkArray(row);
|
||||||
|
|||||||
+262
-162
@@ -2,33 +2,32 @@ const express = require('express');
|
|||||||
const router = express.Router();
|
const router = express.Router();
|
||||||
const rt = require('../ResTool');
|
const rt = require('../ResTool');
|
||||||
const config = require('../../config.json');
|
const config = require('../../config.json');
|
||||||
const fs = require('fs');
|
const mysql = require('../../libs/mysql_pool');
|
||||||
const mysql = require('../../libs/mysql_cls');
|
|
||||||
const tool = require('../../includes/apiTool');
|
const tool = require('../../includes/apiTool');
|
||||||
const exec = require('child_process').exec;
|
const exec = require('child_process').exec;
|
||||||
const so = require('../../includes/storeObject');
|
const so = require('../../includes/storeObject');
|
||||||
const crypt = require('../../libs/crypto');
|
|
||||||
|
|
||||||
router
|
router
|
||||||
.get('/', (req, res) => {
|
.get('/', (req, res) => {
|
||||||
res.send({ name: 'WebIO Modbus API' });
|
res.send({ name: 'WebIO Modbus API' });
|
||||||
})
|
})
|
||||||
|
.post('*', async(req, res, n) => {
|
||||||
|
try {
|
||||||
|
res.db = await mysql.getConn();
|
||||||
|
} catch (e) {
|
||||||
|
console.log(`Get DB Connection ERROR ${e}`);
|
||||||
|
return n('ERR8100');
|
||||||
|
}
|
||||||
|
n();
|
||||||
|
})
|
||||||
.post('/getmodbuslist', (req, res, n) => {
|
.post('/getmodbuslist', (req, res, n) => {
|
||||||
if (!config.permission.modbus) return n('ERR9000');
|
if (!config.permission.modbus) return n('ERR9000');
|
||||||
|
|
||||||
res.db = new mysql();
|
|
||||||
res.db.user = config.db.user;
|
|
||||||
res.db.password = config.db.pass;
|
|
||||||
res.db.host = config.db.host;
|
|
||||||
res.db.port = config.db.port;
|
|
||||||
res.db.database = config.db.db5;
|
|
||||||
res.db.connect();
|
|
||||||
|
|
||||||
let query = "select * from ??.?? order by `uid` desc";
|
let query = "select * from ??.?? order by `uid` desc";
|
||||||
let param = [config.db.db5, 'device'];
|
let param = [config.db.db5, 'device'];
|
||||||
|
|
||||||
res.db.query(query, param, (err, row) => {
|
res.db.query(query, param, (err, row) => {
|
||||||
if (err) return n('ERR8000');
|
if (err) return rt.err(res, err, n, 'ERR8000');
|
||||||
|
|
||||||
res.api_res = {
|
res.api_res = {
|
||||||
record: tool.checkArray(row)
|
record: tool.checkArray(row)
|
||||||
@@ -44,19 +43,11 @@ router
|
|||||||
if (!arr.data) return n('ERR0000');
|
if (!arr.data) return n('ERR0000');
|
||||||
if (!arr.data.id) return n('ERR0028');
|
if (!arr.data.id) return n('ERR0028');
|
||||||
|
|
||||||
res.db = new mysql();
|
|
||||||
res.db.user = config.db.user;
|
|
||||||
res.db.password = config.db.pass;
|
|
||||||
res.db.host = config.db.host;
|
|
||||||
res.db.port = config.db.port;
|
|
||||||
res.db.database = config.db.db5;
|
|
||||||
res.db.connect();
|
|
||||||
|
|
||||||
let query = "select * from ??.?? where `uid` = ?";
|
let query = "select * from ??.?? where `uid` = ?";
|
||||||
let param = [config.db.db5, 'device', arr.data.id];
|
let param = [config.db.db5, 'device', arr.data.id];
|
||||||
|
|
||||||
res.db.query(query, param, (err, row) => {
|
res.db.query(query, param, (err, row) => {
|
||||||
if (err || row.length == 0) return n('ERR8000');
|
if (err || row.length == 0) return rt.err(res, err, n, 'ERR8000');
|
||||||
|
|
||||||
res.api_res = {
|
res.api_res = {
|
||||||
record: tool.checkArray(row),
|
record: tool.checkArray(row),
|
||||||
@@ -89,25 +80,17 @@ router
|
|||||||
}
|
}
|
||||||
return n();
|
return n();
|
||||||
})
|
})
|
||||||
.catch(err => n('ERR8000'));
|
.catch(err => rt.err(res, err, n, 'ERR8000'));
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.post('/getporttype', (req, res, n) => {
|
.post('/getporttype', (req, res, n) => {
|
||||||
if (!config.permission.modbus) return n('ERR9000');
|
if (!config.permission.modbus) return n('ERR9000');
|
||||||
|
|
||||||
res.db = new mysql();
|
|
||||||
res.db.user = config.db.user;
|
|
||||||
res.db.password = config.db.pass;
|
|
||||||
res.db.host = config.db.host;
|
|
||||||
res.db.port = config.db.port;
|
|
||||||
res.db.database = config.db.db5;
|
|
||||||
res.db.connect();
|
|
||||||
|
|
||||||
let query = "select * from ??.?? order by `uid` ";
|
let query = "select * from ??.?? order by `uid` ";
|
||||||
let param = [config.db.db5, 'porttype'];
|
let param = [config.db.db5, 'porttype'];
|
||||||
|
|
||||||
res.db.query(query, param, (err, row) => {
|
res.db.query(query, param, (err, row) => {
|
||||||
if (err) return n('ERR8000');
|
if (err) return rt.err(res, err, n, 'ERR8000');
|
||||||
res.api_res = {
|
res.api_res = {
|
||||||
record: tool.checkArray(row)
|
record: tool.checkArray(row)
|
||||||
};
|
};
|
||||||
@@ -122,23 +105,17 @@ router
|
|||||||
if (!arr.data.name) return n('ERR0026');
|
if (!arr.data.name) return n('ERR0026');
|
||||||
if (!('node' in arr.data)) return n('ERR0038');
|
if (!('node' in arr.data)) return n('ERR0038');
|
||||||
|
|
||||||
res.db = new mysql();
|
let type = arr.data.type && isFinite(arr.data.type) ? arr.data.type : 0;
|
||||||
res.db.user = config.db.user;
|
|
||||||
res.db.password = config.db.pass;
|
|
||||||
res.db.host = config.db.host;
|
|
||||||
res.db.port = config.db.port;
|
|
||||||
res.db.database = config.db.db5;
|
|
||||||
res.db.connect();
|
|
||||||
|
|
||||||
let u = '';
|
let u = '';
|
||||||
let obj = so.get(req.headers['x-auth-token']);
|
let obj = so.get(req.headers['x-auth-token']);
|
||||||
if (obj != null && 'user' in obj && 'account' in obj.user) u = obj.user.account;
|
if (obj != null && 'user' in obj && 'account' in obj.user) u = obj.user.account;
|
||||||
|
|
||||||
let query = "insert into ??.?? (`name`, `node`, `adduser`, `moduser`, `ctime`, `mtime`) values (?,?,?,?, unix_timestamp(), unix_timestamp())";
|
let query = "insert into ??.?? (`name`, `node`, `type`, `adduser`, `moduser`, `ctime`, `mtime`) values (?,?,?,?,?, unix_timestamp(), unix_timestamp())";
|
||||||
let param = [config.db.db5, 'device', arr.data.name, arr.data.node, u, u];
|
let param = [config.db.db5, 'device', arr.data.name, arr.data.node, type, u, u];
|
||||||
|
|
||||||
res.db.query(query, param, (err, row) => {
|
res.db.query(query, param, (err, row) => {
|
||||||
if (err) return n('ERR8001');
|
if (err) return rt.err(res, err, n, 'ERR8001');
|
||||||
|
|
||||||
res.api_res = {
|
res.api_res = {
|
||||||
record: []
|
record: []
|
||||||
@@ -156,18 +133,12 @@ router
|
|||||||
if (!arr.data.name) return n('ERR0026');
|
if (!arr.data.name) return n('ERR0026');
|
||||||
if (!('node' in arr.data) || !('original_node' in arr.data)) return n('ERR0038');
|
if (!('node' in arr.data) || !('original_node' in arr.data)) return n('ERR0038');
|
||||||
|
|
||||||
res.db = new mysql();
|
let type = arr.data.type && isFinite(arr.data.type) ? arr.data.type : 0;
|
||||||
res.db.user = config.db.user;
|
|
||||||
res.db.password = config.db.pass;
|
|
||||||
res.db.host = config.db.host;
|
|
||||||
res.db.port = config.db.port;
|
|
||||||
res.db.database = config.db.db5;
|
|
||||||
res.db.connect();
|
|
||||||
|
|
||||||
let query = "select count(*) as num from ??.?? where `node` = ? and `uid` != ?";
|
let query = "select count(*) as num from ??.?? where `node` = ? and `uid` != ?";
|
||||||
let param = [config.db.db5, 'device', arr.data.node, arr.data.id];
|
let param = [config.db.db5, 'device', arr.data.node, arr.data.id];
|
||||||
res.db.query(query, param, (err, row) => {
|
res.db.query(query, param, (err, row) => {
|
||||||
if (err || row.length == 0) return n('ERR8000');
|
if (err || row.length == 0) return rt.err(res, err, n, 'ERR8000');
|
||||||
if (row[0].num > 0) return n('ERR0047');
|
if (row[0].num > 0) return n('ERR0047');
|
||||||
|
|
||||||
let u = '';
|
let u = '';
|
||||||
@@ -177,13 +148,14 @@ router
|
|||||||
let query = "update ??.?? set \
|
let query = "update ??.?? set \
|
||||||
`name` = ?, \
|
`name` = ?, \
|
||||||
`node` = ?, \
|
`node` = ?, \
|
||||||
|
`type` = ?, \
|
||||||
`moduser` = ?, \
|
`moduser` = ?, \
|
||||||
`mtime` = unix_timestamp() \
|
`mtime` = unix_timestamp() \
|
||||||
where \
|
where \
|
||||||
`uid` = ?";
|
`uid` = ?";
|
||||||
let param = [config.db.db5, 'device', arr.data.name, arr.data.node, u, arr.data.id];
|
let param = [config.db.db5, 'device', arr.data.name, arr.data.node, type, u, arr.data.id];
|
||||||
res.db.query(query, param, (err, row) => {
|
res.db.query(query, param, (err, row) => {
|
||||||
if (err) return n('ERR8002');
|
if (err) return rt.err(res, err, n, 'ERR8002');
|
||||||
|
|
||||||
let q = "delete from ??.?? where `node` in (?)";
|
let q = "delete from ??.?? where `node` in (?)";
|
||||||
let p = [config.db.db6, 'jcmbrt', [arr.data.node, arr.data.original_node]];
|
let p = [config.db.db6, 'jcmbrt', [arr.data.node, arr.data.original_node]];
|
||||||
@@ -204,13 +176,7 @@ router
|
|||||||
if (!arr.data) return n('ERR0000');
|
if (!arr.data) return n('ERR0000');
|
||||||
if (!arr.data.id) return n('ERR0028');
|
if (!arr.data.id) return n('ERR0028');
|
||||||
|
|
||||||
res.db = new mysql();
|
res.db.query(`use ${config.db.db5}`);
|
||||||
res.db.user = config.db.user;
|
|
||||||
res.db.password = config.db.pass;
|
|
||||||
res.db.host = config.db.host;
|
|
||||||
res.db.port = config.db.port;
|
|
||||||
res.db.database = config.db.db5;
|
|
||||||
res.db.connect();
|
|
||||||
|
|
||||||
let query = "delete d,i,s,rt from ??.?? d \
|
let query = "delete d,i,s,rt from ??.?? d \
|
||||||
left join ??.?? i \
|
left join ??.?? i \
|
||||||
@@ -223,7 +189,7 @@ router
|
|||||||
d.`uid` = ?";
|
d.`uid` = ?";
|
||||||
let param = [config.db.db5, 'device', config.db.db5, 'iolist', config.db.db5, 'aioset', config.db.db6, 'jcmbrt', arr.data.id];
|
let param = [config.db.db5, 'device', config.db.db5, 'iolist', config.db.db5, 'aioset', config.db.db6, 'jcmbrt', arr.data.id];
|
||||||
res.db.query(query, param, (err, row) => {
|
res.db.query(query, param, (err, row) => {
|
||||||
if (err) return n('ERR8003');
|
if (err) return rt.err(res, err, n, 'ERR8003');
|
||||||
res.api_res = {
|
res.api_res = {
|
||||||
record: []
|
record: []
|
||||||
};
|
};
|
||||||
@@ -237,27 +203,24 @@ router
|
|||||||
if (!arr.data.id) return n('ERR0028');
|
if (!arr.data.id) return n('ERR0028');
|
||||||
if (!arr.data.type) return n('ERR0009');
|
if (!arr.data.type) return n('ERR0009');
|
||||||
|
|
||||||
res.db = new mysql();
|
let query = "select rt.*, a.`name` as name from ??.?? rt \
|
||||||
res.db.user = config.db.user;
|
|
||||||
res.db.password = config.db.pass;
|
|
||||||
res.db.host = config.db.host;
|
|
||||||
res.db.port = config.db.port;
|
|
||||||
res.db.database = config.db.db5;
|
|
||||||
res.db.connect();
|
|
||||||
|
|
||||||
let query = "select rt.* from ??.?? rt \
|
|
||||||
left join ??.?? d \
|
left join ??.?? d \
|
||||||
on d.`node` = rt.`node` \
|
on d.`node` = rt.`node` \
|
||||||
left join ??.?? i \
|
left join ??.?? i \
|
||||||
on i.`devuid` = d.`uid` and i.`type` = ? \
|
on i.`devuid` = d.`uid` and i.`type` = ? \
|
||||||
|
left join ??.?? a \
|
||||||
|
on a.`iouid` = i.`uid` \
|
||||||
|
and a.`portnum` = rt.`port`\
|
||||||
where \
|
where \
|
||||||
d.`uid` = ? \
|
d.`uid` = ? \
|
||||||
and rt.`type` = ? \
|
and rt.`type` = ? \
|
||||||
and i.`uid` is not null ";
|
and i.`uid` is not null \
|
||||||
let param = [config.db.db6, 'jcmbrt', config.db.db5, 'device', config.db.db5, 'iolist', arr.data.type, arr.data.id, arr.data.type];
|
and ( a.`name` is not null or rt.`type` in (1,2)) \
|
||||||
|
order by rt.`port` asc";
|
||||||
|
let param = [config.db.db6, 'jcmbrt', config.db.db5, 'device', config.db.db5, 'iolist', arr.data.type, config.db.db5, 'aioset', arr.data.id, arr.data.type];
|
||||||
|
|
||||||
res.db.query(query, param, (err, row) => {
|
res.db.query(query, param, (err, row) => {
|
||||||
if (err) return n('ERR8000');
|
if (err) return rt.err(res, err, n, 'ERR8000');
|
||||||
|
|
||||||
res.api_res = {
|
res.api_res = {
|
||||||
record: tool.checkArray(row)
|
record: tool.checkArray(row)
|
||||||
@@ -265,24 +228,65 @@ router
|
|||||||
return n();
|
return n();
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
|
.post('/getalliostatus', (req, res, n) => {
|
||||||
|
if (!config.permission.modbus) return n('ERR9000');
|
||||||
|
|
||||||
|
let pros = [];
|
||||||
|
|
||||||
|
let query = "select rt.*, a.`name` as name \
|
||||||
|
from ??.?? rt \
|
||||||
|
left join ??.?? d \
|
||||||
|
on d.`node` = rt.`node` \
|
||||||
|
left join ??.?? i \
|
||||||
|
on i.`devuid` = d.`uid` \
|
||||||
|
and i.`type` = rt.`type` \
|
||||||
|
left join ??.?? a \
|
||||||
|
on a.`iouid` = i.`uid` \
|
||||||
|
and a.`portnum` = rt.`port`\
|
||||||
|
where \
|
||||||
|
i.`uid` is not null \
|
||||||
|
and ( a.`name` is not null or rt.`type` in (1,2)) \
|
||||||
|
order by rt.`type` asc, rt.`port` asc";
|
||||||
|
let param = [config.db.db6, 'jcmbrt', config.db.db5, 'device', config.db.db5, 'iolist', config.db.db5, 'aioset'];
|
||||||
|
|
||||||
|
pros.push(tool.promiseQuery(res, query, param, 'record'));
|
||||||
|
|
||||||
|
let rtq = "select * from ??.?? ";
|
||||||
|
let rtp = [config.db.db5, 'device'];
|
||||||
|
|
||||||
|
pros.push(tool.promiseQuery(res, rtq, rtp, 'rt'));
|
||||||
|
|
||||||
|
res.api_res = {
|
||||||
|
record: [],
|
||||||
|
rt: {
|
||||||
|
device: []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Promise.all(pros)
|
||||||
|
.then(d => {
|
||||||
|
for (let i in d) {
|
||||||
|
if (d[i].key == 'record') {
|
||||||
|
res.api_res.record = tool.checkArray(d[i].data);
|
||||||
|
}
|
||||||
|
if (d[i].key == 'rt') {
|
||||||
|
res.api_res.rt.device = tool.checkArray(d[i].data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
n();
|
||||||
|
})
|
||||||
|
.catch(err => rt.err(res, err, n, 'ERR8000'));
|
||||||
|
})
|
||||||
.post('/getiolist', (req, res, n) => {
|
.post('/getiolist', (req, res, n) => {
|
||||||
if (!config.permission.modbus) return n('ERR9000');
|
if (!config.permission.modbus) return n('ERR9000');
|
||||||
let arr = req.body;
|
let arr = req.body;
|
||||||
if (!arr.data) return n('ERR0000');
|
if (!arr.data) return n('ERR0000');
|
||||||
if (!arr.data.id) return n('ERR0028');
|
if (!arr.data.id) return n('ERR0028');
|
||||||
|
|
||||||
res.db = new mysql();
|
|
||||||
res.db.user = config.db.user;
|
|
||||||
res.db.password = config.db.pass;
|
|
||||||
res.db.host = config.db.host;
|
|
||||||
res.db.port = config.db.port;
|
|
||||||
res.db.database = config.db.db5;
|
|
||||||
res.db.connect();
|
|
||||||
|
|
||||||
let query = "select * from ??.?? where `uid` = ? ";
|
let query = "select * from ??.?? where `uid` = ? ";
|
||||||
let param = [config.db.db5, 'iolist', arr.data.id];
|
let param = [config.db.db5, 'iolist', arr.data.id];
|
||||||
res.db.query(query, param, (err, row) => {
|
res.db.query(query, param, (err, row) => {
|
||||||
if (err) return n('ERR8000');
|
if (err) return rt.err(res, err, n, 'ERR8000');
|
||||||
|
|
||||||
res.api_res = {
|
res.api_res = {
|
||||||
record: tool.checkArray(row)
|
record: tool.checkArray(row)
|
||||||
@@ -301,13 +305,7 @@ router
|
|||||||
if (!arr.data.addr) return n('ERR0048');
|
if (!arr.data.addr) return n('ERR0048');
|
||||||
if (!arr.data.num) return n('ERR0049');
|
if (!arr.data.num) return n('ERR0049');
|
||||||
|
|
||||||
res.db = new mysql();
|
let dlen = arr.data.datalen || 2;
|
||||||
res.db.user = config.db.user;
|
|
||||||
res.db.password = config.db.pass;
|
|
||||||
res.db.host = config.db.host;
|
|
||||||
res.db.port = config.db.port;
|
|
||||||
res.db.database = config.db.db5;
|
|
||||||
res.db.connect();
|
|
||||||
|
|
||||||
let query = "select count(*) as c from ??.?? \
|
let query = "select count(*) as c from ??.?? \
|
||||||
where \
|
where \
|
||||||
@@ -316,14 +314,14 @@ router
|
|||||||
and `addr` = ?";
|
and `addr` = ?";
|
||||||
let param = [config.db.db5, 'iolist', arr.data.id, arr.data.type, arr.data.addr];
|
let param = [config.db.db5, 'iolist', arr.data.id, arr.data.type, arr.data.addr];
|
||||||
res.db.query(query, param, (err, row) => {
|
res.db.query(query, param, (err, row) => {
|
||||||
if (err || row.length == 0) return n('ERR8000');
|
if (err || row.length == 0) return rt.err(res, err, n, 'ERR8000');
|
||||||
|
|
||||||
if (row[0].c > 0) return n('ERR0054');
|
if (row[0].c > 0) return n('ERR0054');
|
||||||
|
|
||||||
let query = "insert into ??.?? (`devuid`,`type`,`addr`,`num`,`ctime`,`mtime`) values (?, ?, ?, ?, unix_timestamp(), unix_timestamp())";
|
let query = "insert into ??.?? (`devuid`,`type`,`addr`,`num`,`datalen`,`ctime`,`mtime`) values (?, ?, ?, ?, ?, unix_timestamp(), unix_timestamp())";
|
||||||
let param = [config.db.db5, 'iolist', arr.data.id, arr.data.type, arr.data.addr, arr.data.num];
|
let param = [config.db.db5, 'iolist', arr.data.id, arr.data.type, arr.data.addr, arr.data.num, dlen];
|
||||||
res.db.query(query, param, (err, row) => {
|
res.db.query(query, param, (err, row) => {
|
||||||
if (err) return n('ERR8001');
|
if (err) return rt.err(res, err, n, 'ERR8001');
|
||||||
|
|
||||||
res.api_res = {
|
res.api_res = {
|
||||||
record: []
|
record: []
|
||||||
@@ -341,15 +339,9 @@ router
|
|||||||
if (!arr.data.addr) return n('ERR0048');
|
if (!arr.data.addr) return n('ERR0048');
|
||||||
if (!arr.data.num) return n('ERR0049');
|
if (!arr.data.num) return n('ERR0049');
|
||||||
|
|
||||||
res.db = new mysql();
|
let dlen = arr.data.datalen || 2;
|
||||||
res.db.user = config.db.user;
|
|
||||||
res.db.password = config.db.pass;
|
|
||||||
res.db.host = config.db.host;
|
|
||||||
res.db.port = config.db.port;
|
|
||||||
res.db.database = config.db.db5;
|
|
||||||
res.db.connect();
|
|
||||||
|
|
||||||
let query = "select count(*) sa c from ??.?? i \
|
let query = "select count(*) as c from ??.?? i \
|
||||||
left join ??.?? i2 \
|
left join ??.?? i2 \
|
||||||
on i2.`type` = i.`type` \
|
on i2.`type` = i.`type` \
|
||||||
and i2.`addr` = ? \
|
and i2.`addr` = ? \
|
||||||
@@ -360,18 +352,19 @@ router
|
|||||||
and i2.`uid` is not null ";
|
and i2.`uid` is not null ";
|
||||||
let param = [config.db.db5, 'iolist', config.db.db5, 'iolist', arr.data.addr, arr.data.id, arr.data.id];
|
let param = [config.db.db5, 'iolist', config.db.db5, 'iolist', arr.data.addr, arr.data.id, arr.data.id];
|
||||||
res.db.query(query, param, (err, row) => {
|
res.db.query(query, param, (err, row) => {
|
||||||
if (err || row.length == 0) return n('ERR8000');
|
if (err || row.length == 0) return rt.err(res, err, n, 'ERR8000');
|
||||||
if (row[0].c > 0) return n('ERR0054');
|
if (row[0].c > 0) return n('ERR0054');
|
||||||
|
|
||||||
let q = "update ??.?? set \
|
let q = "update ??.?? set \
|
||||||
`addr` = ?, \
|
`addr` = ?, \
|
||||||
`num` = ?, \
|
`num` = ?, \
|
||||||
|
`datalen` = ?, \
|
||||||
`mtime` = unix_timestamp() \
|
`mtime` = unix_timestamp() \
|
||||||
where \
|
where \
|
||||||
`uid` = ?";
|
`uid` = ?";
|
||||||
let p = [config.db.db5, 'iolist', arr.data.addr, arr.data.num, arr.data.id];
|
let p = [config.db.db5, 'iolist', arr.data.addr, arr.data.num, dlen, arr.data.id];
|
||||||
res.db.query(q, p, (err, row) => {
|
res.db.query(q, p, (err, row) => {
|
||||||
if (err) return n('ERR8002');
|
if (err) return rt.err(res, err, n, 'ERR8002');
|
||||||
|
|
||||||
res.api_res = {
|
res.api_res = {
|
||||||
record: []
|
record: []
|
||||||
@@ -387,13 +380,7 @@ router
|
|||||||
if (!arr.data) return n('ERR0000');
|
if (!arr.data) return n('ERR0000');
|
||||||
if (!arr.data.id) return n('ERR0028');
|
if (!arr.data.id) return n('ERR0028');
|
||||||
|
|
||||||
res.db = new mysql();
|
res.db.query(`use ${config.db.db5}`);
|
||||||
res.db.user = config.db.user;
|
|
||||||
res.db.password = config.db.pass;
|
|
||||||
res.db.host = config.db.host;
|
|
||||||
res.db.port = config.db.port;
|
|
||||||
res.db.database = config.db.db5;
|
|
||||||
res.db.connect();
|
|
||||||
|
|
||||||
let query = "delete i, a from ??.?? i \
|
let query = "delete i, a from ??.?? i \
|
||||||
left join ??.?? a \
|
left join ??.?? a \
|
||||||
@@ -402,7 +389,7 @@ router
|
|||||||
i.`uid` = ?";
|
i.`uid` = ?";
|
||||||
let param = [config.db.db5, 'iolist', config.db.db5, 'aioset', arr.data.id];
|
let param = [config.db.db5, 'iolist', config.db.db5, 'aioset', arr.data.id];
|
||||||
res.db.query(query, param, (err, row) => {
|
res.db.query(query, param, (err, row) => {
|
||||||
if (err) return n('ERR8003');
|
if (err) return rt.err(res, err, n, 'ERR8003');
|
||||||
|
|
||||||
res.api_res = {
|
res.api_res = {
|
||||||
record: []
|
record: []
|
||||||
@@ -416,14 +403,6 @@ router
|
|||||||
if (!arr.data) return n('ERR0000');
|
if (!arr.data) return n('ERR0000');
|
||||||
if (!arr.data.id) return n('ERR0028');
|
if (!arr.data.id) return n('ERR0028');
|
||||||
|
|
||||||
res.db = new mysql();
|
|
||||||
res.db.user = config.db.user;
|
|
||||||
res.db.password = config.db.pass;
|
|
||||||
res.db.host = config.db.host;
|
|
||||||
res.db.port = config.db.port;
|
|
||||||
res.db.database = config.db.db5;
|
|
||||||
res.db.connect();
|
|
||||||
|
|
||||||
let query = "select a.* from ??.?? a \
|
let query = "select a.* from ??.?? a \
|
||||||
left join ??.?? i \
|
left join ??.?? i \
|
||||||
on a.`iouid` = i.`uid` \
|
on a.`iouid` = i.`uid` \
|
||||||
@@ -431,7 +410,7 @@ router
|
|||||||
i.`uid` = ?";
|
i.`uid` = ?";
|
||||||
let param = [config.db.db5, 'aioset', config.db.db5, 'iolist', arr.data.id];
|
let param = [config.db.db5, 'aioset', config.db.db5, 'iolist', arr.data.id];
|
||||||
res.db.query(query, param, (err, row) => {
|
res.db.query(query, param, (err, row) => {
|
||||||
if (err) return n('ERR8000');
|
if (err) return rt.err(res, err, n, 'ERR8000');
|
||||||
|
|
||||||
res.api_res = {
|
res.api_res = {
|
||||||
record: tool.checkArray(row)
|
record: tool.checkArray(row)
|
||||||
@@ -445,18 +424,10 @@ router
|
|||||||
if (!arr.data) return n('ERR0000');
|
if (!arr.data) return n('ERR0000');
|
||||||
if (!arr.data.id) return n('ERR0028');
|
if (!arr.data.id) return n('ERR0028');
|
||||||
|
|
||||||
res.db = new mysql();
|
|
||||||
res.db.user = config.db.user;
|
|
||||||
res.db.password = config.db.pass;
|
|
||||||
res.db.host = config.db.host;
|
|
||||||
res.db.port = config.db.port;
|
|
||||||
res.db.database = config.db.db5;
|
|
||||||
res.db.connect();
|
|
||||||
|
|
||||||
let query = "select * from ??.?? where `uid` = ?";
|
let query = "select * from ??.?? where `uid` = ?";
|
||||||
let param = [config.db.db5, 'aioset', arr.data.id];
|
let param = [config.db.db5, 'aioset', arr.data.id];
|
||||||
res.db.query(query, param, (err, row) => {
|
res.db.query(query, param, (err, row) => {
|
||||||
if (err) return n('ERR8000');
|
if (err) return rt.err(res, err, n, 'ERR8000');
|
||||||
|
|
||||||
res.api_res = {
|
res.api_res = {
|
||||||
record: tool.checkArray(row)
|
record: tool.checkArray(row)
|
||||||
@@ -471,18 +442,10 @@ router
|
|||||||
if (!arr.data) return n('ERR0000');
|
if (!arr.data) return n('ERR0000');
|
||||||
if (!arr.data.id) return n('ERR0028');
|
if (!arr.data.id) return n('ERR0028');
|
||||||
|
|
||||||
res.db = new mysql();
|
|
||||||
res.db.user = config.db.user;
|
|
||||||
res.db.password = config.db.pass;
|
|
||||||
res.db.host = config.db.host;
|
|
||||||
res.db.port = config.db.port;
|
|
||||||
res.db.database = config.db.db5;
|
|
||||||
res.db.connect();
|
|
||||||
|
|
||||||
let query = "delete from ??.?? where `uid` = ?";
|
let query = "delete from ??.?? where `uid` = ?";
|
||||||
let param = [config.db.db5, 'aioset', arr.data.id];
|
let param = [config.db.db5, 'aioset', arr.data.id];
|
||||||
res.db.query(query, param, (err, row) => {
|
res.db.query(query, param, (err, row) => {
|
||||||
if (err) return n('ERR8003');
|
if (err) return rt.err(res, err, n, 'ERR8003');
|
||||||
res.api_res = {
|
res.api_res = {
|
||||||
record: []
|
record: []
|
||||||
};
|
};
|
||||||
@@ -497,31 +460,24 @@ router
|
|||||||
if (!arr.data.iouid) return n('ERR0028');
|
if (!arr.data.iouid) return n('ERR0028');
|
||||||
if (!arr.data.name) return n('ERR0026');
|
if (!arr.data.name) return n('ERR0026');
|
||||||
if (!('portnum' in arr.data)) return n('ERR0048');
|
if (!('portnum' in arr.data)) return n('ERR0048');
|
||||||
|
if (!('type' in arr.data)) return n('ERR0009');
|
||||||
if (!('range_min' in arr.data)) return n('ERR0050');
|
if (!('range_min' in arr.data)) return n('ERR0050');
|
||||||
if (!('range_max' in arr.data)) return n('ERR0051');
|
if (!('range_max' in arr.data)) return n('ERR0051');
|
||||||
if (!('scale_min' in arr.data)) return n('ERR0052');
|
if (!('scale_min' in arr.data)) return n('ERR0052');
|
||||||
if (!('scale_max' in arr.data)) return n('ERR0053');
|
if (!('scale_max' in arr.data)) return n('ERR0053');
|
||||||
|
|
||||||
res.db = new mysql();
|
|
||||||
res.db.user = config.db.user;
|
|
||||||
res.db.password = config.db.pass;
|
|
||||||
res.db.host = config.db.host;
|
|
||||||
res.db.port = config.db.port;
|
|
||||||
res.db.database = config.db.db5;
|
|
||||||
res.db.connect();
|
|
||||||
|
|
||||||
let query = "select count(*) as count from ??.?? where `iouid` = ? and `portnum` = ?";
|
let query = "select count(*) as count from ??.?? where `iouid` = ? and `portnum` = ?";
|
||||||
let param = [config.db.db5, 'aioset', arr.data.iouid, arr.data.portnum];
|
let param = [config.db.db5, 'aioset', arr.data.iouid, arr.data.portnum];
|
||||||
res.db.query(query, param, (err, row) => {
|
res.db.query(query, param, (err, row) => {
|
||||||
if (err || row.length == 0) return n('ERR8000');
|
if (err || row.length == 0) return rt.err(res, err, n, 'ERR8000');
|
||||||
|
|
||||||
if (row[0].count > 0) return n('ERR0054');
|
if (row[0].count > 0) return n('ERR0054');
|
||||||
|
|
||||||
let q = "insert into ??.?? (`iouid`, `name`, `portnum`, `range_min`, `range_max`, `scale_min`, `scale_max`, `ctime`, `mtime`) values \
|
let q = "insert into ??.?? (`iouid`, `name`, `portnum`, `type`, `range_min`, `range_max`, `scale_min`, `scale_max`, `ctime`, `mtime`) values \
|
||||||
(?, ?, ?, ?, ?, ?, ?, unix_timestamp(), unix_timestamp())";
|
(?, ?, ?, ?, ?, ?, ?, ?, unix_timestamp(), unix_timestamp())";
|
||||||
let p = [config.db.db5, 'aioset', arr.data.iouid, arr.data.name, arr.data.portnum, arr.data.range_min, arr.data.range_max, arr.data.scale_min, arr.data.scale_max];
|
let p = [config.db.db5, 'aioset', arr.data.iouid, arr.data.name, arr.data.portnum, arr.data.type, arr.data.range_min, arr.data.range_max, arr.data.scale_min, arr.data.scale_max];
|
||||||
res.db.query(q, p, (err, row) => {
|
res.db.query(q, p, (err, row) => {
|
||||||
if (err) return n('ERR8001');
|
if (err) return rt.err(res, err, n, 'ERR8001');
|
||||||
|
|
||||||
res.api_res = {
|
res.api_res = {
|
||||||
record: []
|
record: []
|
||||||
@@ -539,20 +495,13 @@ router
|
|||||||
if (!arr.data.id) return n('ERR0028');
|
if (!arr.data.id) return n('ERR0028');
|
||||||
if (!arr.data.iouid) return n('ERR0028');
|
if (!arr.data.iouid) return n('ERR0028');
|
||||||
if (!arr.data.name) return n('ERR0026');
|
if (!arr.data.name) return n('ERR0026');
|
||||||
if (!arr.data.portnum) return n('ERR0048');
|
if (!('portnum' in arr.data)) return n('ERR0048');
|
||||||
|
if (!('type' in arr.data)) return n('ERR0009');
|
||||||
if (!('range_min' in arr.data)) return n('ERR0050');
|
if (!('range_min' in arr.data)) return n('ERR0050');
|
||||||
if (!('range_max' in arr.data)) return n('ERR0051');
|
if (!('range_max' in arr.data)) return n('ERR0051');
|
||||||
if (!('scale_min' in arr.data)) return n('ERR0052');
|
if (!('scale_min' in arr.data)) return n('ERR0052');
|
||||||
if (!('scale_max' in arr.data)) return n('ERR0053');
|
if (!('scale_max' in arr.data)) return n('ERR0053');
|
||||||
|
|
||||||
res.db = new mysql();
|
|
||||||
res.db.user = config.db.user;
|
|
||||||
res.db.password = config.db.pass;
|
|
||||||
res.db.host = config.db.host;
|
|
||||||
res.db.port = config.db.port;
|
|
||||||
res.db.database = config.db.db5;
|
|
||||||
res.db.connect();
|
|
||||||
|
|
||||||
let query = "select count(*) as count from ??.?? \
|
let query = "select count(*) as count from ??.?? \
|
||||||
where \
|
where \
|
||||||
`iouid` = ? \
|
`iouid` = ? \
|
||||||
@@ -560,21 +509,22 @@ router
|
|||||||
and `uid` != ?";
|
and `uid` != ?";
|
||||||
let param = [config.db.db5, 'aioset', arr.data.iouid, arr.data.portnum, arr.data.id];
|
let param = [config.db.db5, 'aioset', arr.data.iouid, arr.data.portnum, arr.data.id];
|
||||||
res.db.query(query, param, (err, row) => {
|
res.db.query(query, param, (err, row) => {
|
||||||
if (err || row.length == 0) return n('ERR8000');
|
if (err || row.length == 0) return rt.err(res, err, n, 'ERR8000');
|
||||||
if (row[0].length > 0) return n('ERR0054');
|
if (row[0].length > 0) return n('ERR0054');
|
||||||
|
|
||||||
let query = "update ??.?? set \
|
let query = "update ??.?? set \
|
||||||
`name` = ?, \
|
`name` = ?, \
|
||||||
`portnum` = ?, \
|
`portnum` = ?, \
|
||||||
|
`type` = ?, \
|
||||||
`range_min` = ?, \
|
`range_min` = ?, \
|
||||||
`range_max` = ?, \
|
`range_max` = ?, \
|
||||||
`scale_min` = ?, \
|
`scale_min` = ?, \
|
||||||
`scale_max` = ?, \
|
`scale_max` = ?, \
|
||||||
`mtime` = unix_timestamp() \
|
`mtime` = unix_timestamp() \
|
||||||
where `uid` = ?";
|
where `uid` = ?";
|
||||||
let param = [config.db.db5, 'aioset', arr.data.name, arr.data.portnum, arr.data.range_min, arr.data.range_max, arr.data.scale_min, arr.data.scale_max, arr.data.id];
|
let param = [config.db.db5, 'aioset', arr.data.name, arr.data.portnum, arr.data.type, arr.data.range_min, arr.data.range_max, arr.data.scale_min, arr.data.scale_max, arr.data.id];
|
||||||
res.db.query(query, param, (err, row) => {
|
res.db.query(query, param, (err, row) => {
|
||||||
if (err) return n('ERR8002');
|
if (err) return rt.err(res, err, n, 'ERR8002');
|
||||||
|
|
||||||
res.api_res = {
|
res.api_res = {
|
||||||
record: []
|
record: []
|
||||||
@@ -583,6 +533,156 @@ router
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
|
.post('/modbuscmd', (req, res, n) => {
|
||||||
|
if (!config.permission.modbus) return n('ERR9000');
|
||||||
|
if (!tool.checkPermission(req)) return n('ERR9000');
|
||||||
|
let arr = req.body;
|
||||||
|
if (!arr.data) return n('ERR0000');
|
||||||
|
if (!arr.data.ip) return n('ERR0010');
|
||||||
|
if (!('node' in arr.data) || arr.data.node.length == 0) return n('ERR0038');
|
||||||
|
if (!('func' in arr.data) || arr.data.func.length == 0) return n('ERR0055');
|
||||||
|
if (!('addr' in arr.data) || arr.data.addr.length == 0) return n('ERR0048');
|
||||||
|
if (!('value' in arr.data) || arr.data.value.length == 0) return n('ERR0049');
|
||||||
|
if (arr.data.value > 65535) return n('ERR0049');
|
||||||
|
|
||||||
|
let cmd = `mbtcpm ${arr.data.ip} ${arr.data.node} ${arr.data.func} ${arr.data.addr} ${arr.data.value}`;
|
||||||
|
res.api_res = {
|
||||||
|
record: []
|
||||||
|
};
|
||||||
|
exec(cmd, (err, stdout, stderr) => {
|
||||||
|
let msg = err ? err.toString() : `${stdout}${stderr}`;
|
||||||
|
res.api_res.record.push({ msg });
|
||||||
|
|
||||||
|
n();
|
||||||
|
})
|
||||||
|
})
|
||||||
|
.post('/getmodbuslog', (req, res, n) => {
|
||||||
|
if (!config.permission.modbus) return n('ERR9000');
|
||||||
|
let arr = req.body;
|
||||||
|
if (!arr.data) return n('ERR0000');
|
||||||
|
if (!arr.data.ids || !Array.isArray(arr.data.ids)) return n('ERR0028');
|
||||||
|
if (!arr.data.stime || !arr.data.etime) return n('ERR0015');
|
||||||
|
|
||||||
|
let query = "select log.`node`, log.`type`, log.`port`, log.`value2` as value, log.`tst`, dev.`name` as devname, aio.`name` as aioname \
|
||||||
|
from ??.?? log \
|
||||||
|
left join ??.?? dev \
|
||||||
|
on dev.`node` = log.`node`\
|
||||||
|
left join ??.?? io \
|
||||||
|
on io.`devuid` = dev.`uid` \
|
||||||
|
and io.`type` = log.`type` \
|
||||||
|
left join ??.?? aio \
|
||||||
|
on aio.`iouid` = io.`uid` \
|
||||||
|
and aio.`portnum` = log.`port` \
|
||||||
|
where \
|
||||||
|
dev.`uid` in (?) \
|
||||||
|
and ( log.`tst` >= ? \
|
||||||
|
and log.`tst` <= ? ) \
|
||||||
|
and io.`uid` is not null \
|
||||||
|
and ( aio.`name` is not null or log.`type` in (1,2)) \
|
||||||
|
order by log.`uid` desc, log.`tst` desc \
|
||||||
|
limit 0, 100";
|
||||||
|
let param = [config.db.db10, 'jcmbrt', config.db.db5, 'device', config.db.db5, 'iolist', config.db.db5, 'aioset', arr.data.ids, arr.data.stime, arr.data.etime];
|
||||||
|
|
||||||
|
res.db.query(query, param, (err, row) => {
|
||||||
|
if (err) return rt.err(res, err, n, 'ERR8000');
|
||||||
|
res.api_res = {
|
||||||
|
record: tool.checkArray(row)
|
||||||
|
}
|
||||||
|
n();
|
||||||
|
})
|
||||||
|
})
|
||||||
|
.post('/getmodbustype', (req, res, n) => {
|
||||||
|
if (!config.permission.modbus) return n('ERR9000');
|
||||||
|
let arr = req.body;
|
||||||
|
if (!arr.data) return n('ERR0000');
|
||||||
|
if (!arr.data.id) return n('ERR0028');
|
||||||
|
|
||||||
|
let query = "select io.`type` \
|
||||||
|
from ??.?? io \
|
||||||
|
left join ??.?? dev \
|
||||||
|
on dev.`uid` = io.`devuid` \
|
||||||
|
where \
|
||||||
|
dev.`uid` = ? \
|
||||||
|
group by io.`type` \
|
||||||
|
order by io.`type` ";
|
||||||
|
let param = [config.db.db5, 'iolist', config.db.db5, 'device', arr.data.id];
|
||||||
|
|
||||||
|
res.db.query(query, param, (err, row) => {
|
||||||
|
if (err) return rt.err(res, err, n, 'ERR8000');
|
||||||
|
|
||||||
|
res.api_res = {
|
||||||
|
record: tool.checkArray(row)
|
||||||
|
}
|
||||||
|
|
||||||
|
n();
|
||||||
|
})
|
||||||
|
})
|
||||||
|
.post('/getmodbusport', (req, res, n) => {
|
||||||
|
if (!config.permission.modbus) return n('ERR9000')
|
||||||
|
let arr = req.body;
|
||||||
|
if (!arr.data) return n('ERR0000');
|
||||||
|
if (!arr.data.id) return n('ERR0028');
|
||||||
|
if (!arr.data.type) return n('ERR0009');
|
||||||
|
|
||||||
|
let type = arr.data.type;
|
||||||
|
if (type == 5) type = 1;
|
||||||
|
if (type == 6) type = 3;
|
||||||
|
|
||||||
|
if (type == 3 || type == 4) {
|
||||||
|
let query = "select a.`name`, a.`portnum` \
|
||||||
|
from ??.?? a \
|
||||||
|
left join ??.?? io \
|
||||||
|
on io.`uid` = a.`iouid` \
|
||||||
|
left join ??.?? dev \
|
||||||
|
on dev.`uid` = io.`devuid` \
|
||||||
|
where \
|
||||||
|
io.`type` = ? \
|
||||||
|
and dev.`uid` = ? ";
|
||||||
|
let param = [config.db.db5, 'aioset', config.db.db5, 'iolist', config.db.db5, 'device', type, arr.data.id];
|
||||||
|
|
||||||
|
res.db.query(query, param, (err, row) => {
|
||||||
|
if (err) return rt.err(res, err, n, 'ERR8000');
|
||||||
|
|
||||||
|
res.api_res = {
|
||||||
|
record: tool.checkArray(row)
|
||||||
|
}
|
||||||
|
|
||||||
|
n();
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (type == 1 || type == 2) {
|
||||||
|
let query = "select * \
|
||||||
|
from ??.?? io \
|
||||||
|
left join ??.?? dev \
|
||||||
|
on dev.`uid` = io.`devuid` \
|
||||||
|
where \
|
||||||
|
dev.`uid` = ? \
|
||||||
|
and io.`type` = ?";
|
||||||
|
let param = [config.db.db5, 'iolist', config.db.db5, 'device', arr.data.id, type];
|
||||||
|
|
||||||
|
res.db.query(query, param, (err, row) => {
|
||||||
|
if (err) return rt.err(res, err, n, 'ERR8000');
|
||||||
|
let arr = [];
|
||||||
|
let num = 0;
|
||||||
|
for (let i in row) {
|
||||||
|
num += parseInt(row[i].num);
|
||||||
|
}
|
||||||
|
for (let i = 0; i < num; i++) {
|
||||||
|
arr.push({ portnum: (i + 1), name: '' })
|
||||||
|
}
|
||||||
|
|
||||||
|
res.api_res = {
|
||||||
|
record: arr
|
||||||
|
}
|
||||||
|
n();
|
||||||
|
})
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
return n('ERR0009');
|
||||||
|
})
|
||||||
.all('*', rt.send);
|
.all('*', rt.send);
|
||||||
|
|
||||||
module.exports = router;
|
module.exports = router;
|
||||||
+16
-47
@@ -3,7 +3,7 @@ const router = express.Router();
|
|||||||
const rt = require('../ResTool');
|
const rt = require('../ResTool');
|
||||||
const config = require('../../config.json');
|
const config = require('../../config.json');
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
const mysql = require('../../libs/mysql_cls');
|
const mysql = require('../../libs/mysql_pool');
|
||||||
const tool = require('../../includes/apiTool');
|
const tool = require('../../includes/apiTool');
|
||||||
const exec = require('child_process').exec;
|
const exec = require('child_process').exec;
|
||||||
const so = require('../../includes/storeObject');
|
const so = require('../../includes/storeObject');
|
||||||
@@ -13,6 +13,15 @@ router
|
|||||||
.get('/', (req, res) => {
|
.get('/', (req, res) => {
|
||||||
res.send({ name: 'WebIO Schedule API' });
|
res.send({ name: 'WebIO Schedule API' });
|
||||||
})
|
})
|
||||||
|
.post('*', async(req,res,n) => {
|
||||||
|
try{
|
||||||
|
res.db = await mysql.getConn();
|
||||||
|
}catch(e){
|
||||||
|
console.log(`Get DB Connection ERROR ${e}`);
|
||||||
|
return n('ERR8100');
|
||||||
|
}
|
||||||
|
n();
|
||||||
|
})
|
||||||
.post(['/getschedulelist', '/getschedule'], (req, res, n) => {
|
.post(['/getschedulelist', '/getschedule'], (req, res, n) => {
|
||||||
if (!config.permission.schedule) return n('ERR9000');
|
if (!config.permission.schedule) return n('ERR9000');
|
||||||
let s = false;
|
let s = false;
|
||||||
@@ -23,14 +32,6 @@ router
|
|||||||
if (!arr.data.id) return n('ERR0028');
|
if (!arr.data.id) return n('ERR0028');
|
||||||
}
|
}
|
||||||
|
|
||||||
res.db = new mysql();
|
|
||||||
res.db.user = config.db.user;
|
|
||||||
res.db.password = config.db.pass;
|
|
||||||
res.db.host = config.db.host;
|
|
||||||
res.db.port = config.db.port;
|
|
||||||
res.db.database = config.db.db1;
|
|
||||||
res.db.connect();
|
|
||||||
|
|
||||||
let query = "select * from ??.?? ";
|
let query = "select * from ??.?? ";
|
||||||
let order = " order by `ioscheduleuid` desc ";
|
let order = " order by `ioscheduleuid` desc ";
|
||||||
let param = [config.db.db1, 'ioschedulet'];
|
let param = [config.db.db1, 'ioschedulet'];
|
||||||
@@ -40,7 +41,7 @@ router
|
|||||||
}
|
}
|
||||||
|
|
||||||
res.db.query(query + order, param, (err, row) => {
|
res.db.query(query + order, param, (err, row) => {
|
||||||
if (err) return n('ERR8000');
|
if (err) return rt.err(res,err,n,'ERR8000');
|
||||||
|
|
||||||
res.api_res = {
|
res.api_res = {
|
||||||
record: tool.checkArray(row),
|
record: tool.checkArray(row),
|
||||||
@@ -105,7 +106,7 @@ router
|
|||||||
return n();
|
return n();
|
||||||
})
|
})
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
return n();
|
return rt.err(res,err,n);
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
@@ -116,19 +117,11 @@ router
|
|||||||
if (!arr.data) return n('ERR0000');
|
if (!arr.data) return n('ERR0000');
|
||||||
if (!arr.data.id) return n('ERR0028');
|
if (!arr.data.id) return n('ERR0028');
|
||||||
|
|
||||||
res.db = new mysql();
|
|
||||||
res.db.user = config.db.user;
|
|
||||||
res.db.password = config.db.pass;
|
|
||||||
res.db.host = config.db.host;
|
|
||||||
res.db.port = config.db.port;
|
|
||||||
res.db.database = config.db.db1;
|
|
||||||
res.db.connect();
|
|
||||||
|
|
||||||
let query = "delete from ??.?? where `ioscheduleuid` = ? ";
|
let query = "delete from ??.?? where `ioscheduleuid` = ? ";
|
||||||
let param = [config.db.db1, 'ioschedulet', arr.data.id];
|
let param = [config.db.db1, 'ioschedulet', arr.data.id];
|
||||||
|
|
||||||
res.db.query(query, param, (err, row) => {
|
res.db.query(query, param, (err, row) => {
|
||||||
if (err) return n('ERR8003');
|
if (err) return rt.err(res,err,n,'ERR8003');
|
||||||
|
|
||||||
res.api_res = {
|
res.api_res = {
|
||||||
record: []
|
record: []
|
||||||
@@ -145,19 +138,11 @@ router
|
|||||||
|
|
||||||
// let active = arr.data.active == 1 ? 1 : 0;
|
// let active = arr.data.active == 1 ? 1 : 0;
|
||||||
|
|
||||||
res.db = new mysql();
|
|
||||||
res.db.user = config.db.user;
|
|
||||||
res.db.password = config.db.pass;
|
|
||||||
res.db.host = config.db.host;
|
|
||||||
res.db.port = config.db.port;
|
|
||||||
res.db.database = config.db.db1;
|
|
||||||
res.db.connect();
|
|
||||||
|
|
||||||
let query = "update ??.?? set `ioscheduleactive` = (case when `ioscheduleactive` = '1' then '0' else '1' end) where `ioscheduleuid` = ? ";
|
let query = "update ??.?? set `ioscheduleactive` = (case when `ioscheduleactive` = '1' then '0' else '1' end) where `ioscheduleuid` = ? ";
|
||||||
let param = [config.db.db1, 'ioschedulet', arr.data.id];
|
let param = [config.db.db1, 'ioschedulet', arr.data.id];
|
||||||
|
|
||||||
res.db.query(query, param, (err, row) => {
|
res.db.query(query, param, (err, row) => {
|
||||||
if (err) return n('ERR8002');
|
if (err) return rt.err(res,err,n,'ERR8002');
|
||||||
|
|
||||||
res.api_res = {
|
res.api_res = {
|
||||||
record: []
|
record: []
|
||||||
@@ -184,14 +169,6 @@ router
|
|||||||
let tmp = arr.data.action.split(',');
|
let tmp = arr.data.action.split(',');
|
||||||
if (tmp.length != 2) return n('ERR0030');
|
if (tmp.length != 2) return n('ERR0030');
|
||||||
|
|
||||||
res.db = new mysql();
|
|
||||||
res.db.user = config.db.user;
|
|
||||||
res.db.password = config.db.pass;
|
|
||||||
res.db.host = config.db.host;
|
|
||||||
res.db.port = config.db.port;
|
|
||||||
res.db.database = config.db.db1;
|
|
||||||
res.db.connect();
|
|
||||||
|
|
||||||
let active = arr.data.active == 1 ? 1 : 0;
|
let active = arr.data.active == 1 ? 1 : 0;
|
||||||
|
|
||||||
let d = '';
|
let d = '';
|
||||||
@@ -221,7 +198,7 @@ router
|
|||||||
let param = [config.db.db1, 'ioschedulet', arr.data.name, active, arr.data.devs, arr.data.action, arr.data.min, arr.data.hour, d, m, w];
|
let param = [config.db.db1, 'ioschedulet', arr.data.name, active, arr.data.devs, arr.data.action, arr.data.min, arr.data.hour, d, m, w];
|
||||||
|
|
||||||
res.db.query(query, param, (err, row) => {
|
res.db.query(query, param, (err, row) => {
|
||||||
if (err) return n('ERR8001');
|
if (err) return rt.err(res,err,n,'ERR8001');
|
||||||
|
|
||||||
res.api_res = {
|
res.api_res = {
|
||||||
record: []
|
record: []
|
||||||
@@ -249,14 +226,6 @@ router
|
|||||||
let tmp = arr.data.action.split(',');
|
let tmp = arr.data.action.split(',');
|
||||||
if (tmp.length != 2) return n('ERR0030');
|
if (tmp.length != 2) return n('ERR0030');
|
||||||
|
|
||||||
res.db = new mysql();
|
|
||||||
res.db.user = config.db.user;
|
|
||||||
res.db.password = config.db.pass;
|
|
||||||
res.db.host = config.db.host;
|
|
||||||
res.db.port = config.db.port;
|
|
||||||
res.db.database = config.db.db1;
|
|
||||||
res.db.connect();
|
|
||||||
|
|
||||||
let active = arr.data.active == 1 ? 1 : 0;
|
let active = arr.data.active == 1 ? 1 : 0;
|
||||||
|
|
||||||
let d = '';
|
let d = '';
|
||||||
@@ -288,7 +257,7 @@ router
|
|||||||
let param = [config.db.db1, 'ioschedulet', arr.data.name, active, arr.data.devs, arr.data.action, arr.data.min, arr.data.hour, d, m, w, arr.data.id];
|
let param = [config.db.db1, 'ioschedulet', arr.data.name, active, arr.data.devs, arr.data.action, arr.data.min, arr.data.hour, d, m, w, arr.data.id];
|
||||||
|
|
||||||
res.db.query(query, param, (err, row) => {
|
res.db.query(query, param, (err, row) => {
|
||||||
if (err) return n('ERR8002');
|
if (err) return rt.err(res,err,n,'ERR8002');
|
||||||
|
|
||||||
res.api_res = {
|
res.api_res = {
|
||||||
record: []
|
record: []
|
||||||
|
|||||||
@@ -0,0 +1,362 @@
|
|||||||
|
const express = require('express');
|
||||||
|
const router = express.Router();
|
||||||
|
const rt = require('../ResTool');
|
||||||
|
const config = require('../../config.json');
|
||||||
|
const fs = require('fs');
|
||||||
|
const mysql = require('../../libs/mysql_pool');
|
||||||
|
const tool = require('../../includes/apiTool');
|
||||||
|
const exec = require('child_process').exec;
|
||||||
|
const so = require('../../includes/storeObject');
|
||||||
|
const crypt = require('../../libs/crypto');
|
||||||
|
|
||||||
|
router
|
||||||
|
.get('/', (req, res, n) => {
|
||||||
|
res.send({ name: 'WebIO Server IPMI/SNMP API' });
|
||||||
|
})
|
||||||
|
.post('*', async(req, res, n) => {
|
||||||
|
try {
|
||||||
|
res.db = await mysql.getConn();
|
||||||
|
} catch (e) {
|
||||||
|
console.log(`Get DB Connection ERROR ${e}`);
|
||||||
|
return n('ERR8100');
|
||||||
|
}
|
||||||
|
n();
|
||||||
|
})
|
||||||
|
.post('/getdevicelist', (req, res, n) => {
|
||||||
|
if (!config.permission.server) return n('ERR9000');
|
||||||
|
|
||||||
|
let query = "select * from ??.??";
|
||||||
|
let param = [config.db.db11, 'dev'];
|
||||||
|
|
||||||
|
res.db.query(query, param, (err, row) => {
|
||||||
|
if (err) return rt.err(res, err, n, 'ERR8000');
|
||||||
|
res.api_res = {
|
||||||
|
record: tool.checkArray(row)
|
||||||
|
}
|
||||||
|
n();
|
||||||
|
})
|
||||||
|
})
|
||||||
|
.post('/getdevice', async(req, res, n) => {
|
||||||
|
if (!config.permission.server) return n('ERR9000');
|
||||||
|
let arr = req.body;
|
||||||
|
if (!arr.data) return n('ERR0000');
|
||||||
|
if (!arr.data.id) return n('ERR0028');
|
||||||
|
|
||||||
|
let query = "select * from ??.?? where `devuid` = ?";
|
||||||
|
let param = [config.db.db11, 'dev', arr.data.id];
|
||||||
|
try {
|
||||||
|
let dev = await tool.promiseQuery(res, query, param);
|
||||||
|
if (dev.data.length == 0) return n('ERR8000');
|
||||||
|
|
||||||
|
let ipmi_param = [config.db.db11, 'ipmi', arr.data.id];
|
||||||
|
let ipmi = await tool.promiseQuery(res, query, ipmi_param);
|
||||||
|
|
||||||
|
let snmp_param = [config.db.db11, 'snmp', arr.data.id];
|
||||||
|
let snmp = await tool.promiseQuery(res, query, snmp_param);
|
||||||
|
|
||||||
|
res.api_res = {
|
||||||
|
record: tool.checkArray(dev.data),
|
||||||
|
rt: {
|
||||||
|
ipmi: tool.checkArray(ipmi.data),
|
||||||
|
snmp: tool.checkArray(snmp.data)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (e) {
|
||||||
|
return rt.err(res, e, n, 'ERR8000');
|
||||||
|
}
|
||||||
|
|
||||||
|
n();
|
||||||
|
})
|
||||||
|
.post('/adddevice', 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.name) return n('ERR0026');
|
||||||
|
|
||||||
|
let u = '';
|
||||||
|
let obj = so.get(req.headers['x-auth-token'] || '');
|
||||||
|
if (obj != null && 'user' in obj && 'account' in obj.user) u = obj.user.account;
|
||||||
|
|
||||||
|
try {
|
||||||
|
let query = "insert into ??.?? (`name`, `ctime`, `cuser`, `mtime`, `muser`) values \
|
||||||
|
(?, unix_timestamp(), ?, unix_timestamp(), ?)";
|
||||||
|
let param = [config.db.db11, 'dev', arr.data.name, u, u];
|
||||||
|
|
||||||
|
await tool.promiseQuery(res, query, param);
|
||||||
|
} catch (e) {
|
||||||
|
return rt.err(res, e, n, 'ERR8001');
|
||||||
|
}
|
||||||
|
|
||||||
|
res.api_res = {
|
||||||
|
record: []
|
||||||
|
};
|
||||||
|
n();
|
||||||
|
})
|
||||||
|
.post('/editdevice', 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.id) return n('ERR0028');
|
||||||
|
if (!arr.data.name) return n('ERR0026');
|
||||||
|
|
||||||
|
let u = '';
|
||||||
|
let obj = so.get(req.headers['x-auth-token'] || '');
|
||||||
|
if (obj != null && 'user' in obj && 'account' in obj.user) u = obj.user.account;
|
||||||
|
|
||||||
|
try {
|
||||||
|
let query = "update ??.?? set \
|
||||||
|
`name` = ?, \
|
||||||
|
`muser` = ?, \
|
||||||
|
`mtime` = unix_timestamp() \
|
||||||
|
where \
|
||||||
|
`devuid` = ?";
|
||||||
|
let param = [config.db.db11, 'dev', arr.data.name, u, arr.data.id];
|
||||||
|
await tool.promiseQuery(res, query, param);
|
||||||
|
} catch (e) {
|
||||||
|
return rt.err(res, e, n, 'ERR8002');
|
||||||
|
}
|
||||||
|
|
||||||
|
res.api_res = {
|
||||||
|
record: []
|
||||||
|
};
|
||||||
|
n();
|
||||||
|
})
|
||||||
|
.post('/deldevice', 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.id) return n('ERR0028');
|
||||||
|
|
||||||
|
try {
|
||||||
|
let query = "delete from ??.?? where `devuid` = ?";
|
||||||
|
let param = [config.db.db11, 'dev', arr.data.id];
|
||||||
|
await tool.promiseQuery(res, query, param);
|
||||||
|
} catch (err) {
|
||||||
|
return rt.err(res, err, n, 'ERR8003');
|
||||||
|
}
|
||||||
|
|
||||||
|
res.api_res = {
|
||||||
|
record: []
|
||||||
|
}
|
||||||
|
return n();
|
||||||
|
})
|
||||||
|
.post('/addipmi', 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.devuid) return n('ERR0028');
|
||||||
|
if (!arr.data.account) return n('ERR0016');
|
||||||
|
if (!arr.data.password) return n('ERR0017');
|
||||||
|
if (!arr.data.ip) return n('ERR0010');
|
||||||
|
|
||||||
|
try {
|
||||||
|
let query = "select count(*) as c from ??.?? where `ip` = ?";
|
||||||
|
let param = [config.db.db11, 'ipmi', arr.data.ip];
|
||||||
|
let c = await tool.promiseQuery(res, query, param);
|
||||||
|
if (c.data.length > 0 && c.data.c > 0) return n('ERR0027');
|
||||||
|
} catch (err) {
|
||||||
|
return rt.err(res, err, n, 'ERR8000');
|
||||||
|
}
|
||||||
|
|
||||||
|
let u = '';
|
||||||
|
let obj = so.get(req.headers['x-auth-token'] || '');
|
||||||
|
if (obj != null && 'user' in obj && 'account' in obj.user) u = obj.user.account;
|
||||||
|
|
||||||
|
try {
|
||||||
|
let query = "insert into ??.?? (`devuid`, `ip`, `account`, `password`, `cuser`, `ctime`, `muser`, `mtime`) values \
|
||||||
|
(?, ?, ?, ?, ?, unix_timestamp(), ?, unix_timestamp())";
|
||||||
|
let param = [config.db.db11, 'ipmi', arr.data.devuid, arr.data.ip, arr.data.account, arr.data.password, u, u];
|
||||||
|
await tool.promiseQuery(res, query, param);
|
||||||
|
} catch (err) {
|
||||||
|
return rt.err(res, err, n, 'ERR8001');
|
||||||
|
}
|
||||||
|
|
||||||
|
res.api_res = {
|
||||||
|
record: []
|
||||||
|
};
|
||||||
|
return n();
|
||||||
|
})
|
||||||
|
.post('/editipmi', 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.id) return n('ERR0028');
|
||||||
|
if (!arr.data.account) return n('ERR0016');
|
||||||
|
if (!arr.data.password) return n('ERR0017');
|
||||||
|
if (!arr.data.ip) return n('ERR0010');
|
||||||
|
|
||||||
|
try {
|
||||||
|
let query = "select count(*) as c from ??.?? where `ipmuid` != ? and `ip` = ?";
|
||||||
|
let param = [config.db.db11, 'ipmi', arr.data.id, arr.data.ip];
|
||||||
|
let c = await tool.promiseQuery(res, query, param);
|
||||||
|
if (c.data.length > 0 && c.data.c > 0) return n('ERR0027');
|
||||||
|
} catch (err) {
|
||||||
|
return rt.err(res, err, n, 'ERR8000');
|
||||||
|
}
|
||||||
|
|
||||||
|
let u = '';
|
||||||
|
let obj = so.get(req.headers['x-auth-token'] || '');
|
||||||
|
if (obj != null && 'user' in obj && 'account' in obj.user) u = obj.user.account;
|
||||||
|
|
||||||
|
try {
|
||||||
|
let query = "update ??.?? set \
|
||||||
|
`account` = ?, \
|
||||||
|
`password` = ?, \
|
||||||
|
`ip` = ?, \
|
||||||
|
`muser` = ?, \
|
||||||
|
`mtime` = unix_timestamp() \
|
||||||
|
where \
|
||||||
|
`ipmuid` = ?";
|
||||||
|
let param = [config.db.db11, 'ipmi', arr.data.account, arr.data.password, arr.data.ip, u, arr.data.id];
|
||||||
|
await tool.promiseQuery(res, query, param);
|
||||||
|
} catch (err) {
|
||||||
|
return rt.err(res, err, n, 'ERR8002');
|
||||||
|
}
|
||||||
|
|
||||||
|
res.api_res = {
|
||||||
|
record: []
|
||||||
|
};
|
||||||
|
return n();
|
||||||
|
})
|
||||||
|
.post('/delipmi', 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.id) return n('ERR0028');
|
||||||
|
|
||||||
|
try {
|
||||||
|
let query = "delete from ??.?? where `ipmuid` = ?";
|
||||||
|
let param = [config.db.db11, 'ipmi', arr.data.id];
|
||||||
|
|
||||||
|
await tool.promiseQuery(res, query, param);
|
||||||
|
} catch (err) {
|
||||||
|
return rt.err(res, err, n, 'ERR8003');
|
||||||
|
}
|
||||||
|
|
||||||
|
res.api_res = {
|
||||||
|
record: []
|
||||||
|
};
|
||||||
|
return n();
|
||||||
|
})
|
||||||
|
.post('/getipmiinfo', async(req, res, n) => {
|
||||||
|
if (!config.permission.server) return n('ERR9000');
|
||||||
|
let arr = req.body;
|
||||||
|
if (!arr.data) return n('ERR0000');
|
||||||
|
if (!arr.data.id) return n('ERR0028');
|
||||||
|
|
||||||
|
res.api_res = {
|
||||||
|
record: [],
|
||||||
|
rt: {
|
||||||
|
log: [],
|
||||||
|
sensor: [],
|
||||||
|
bmcgroup: [],
|
||||||
|
bmcdata: []
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
try {
|
||||||
|
let query = "select * from ??.?? where `ipmuid` = ?";
|
||||||
|
let param = [config.db.db11, 'ipmi', arr.data.id];
|
||||||
|
let ipmi = await tool.promiseQuery(res, query, param);
|
||||||
|
if (ipmi.data.length == 0) return n('ERR8000');
|
||||||
|
delete ipmi.data[0].password;
|
||||||
|
res.api_res.record = tool.checkArray(ipmi.data);
|
||||||
|
|
||||||
|
query = "select * from ??.?? order by `guid`";
|
||||||
|
param = [config.db.db11, 'bmg'];
|
||||||
|
let bmg = await tool.promiseQuery(res, query, param);
|
||||||
|
res.api_res.rt.bmcgroup = tool.checkArray(bmg.data);
|
||||||
|
|
||||||
|
query = "select * from ??.?? where `ipmuid` = ?";
|
||||||
|
param = [config.db.db11, 'bmrt', arr.data.id];
|
||||||
|
let bmrt = await tool.promiseQuery(res, query, param);
|
||||||
|
res.api_res.rt.bmcdata = tool.checkArray(bmrt.data);
|
||||||
|
|
||||||
|
query = "select * from ??.?? where `ipmuid` = ?";
|
||||||
|
param = [config.db.db11, 'ipmilogrt', arr.data.id];
|
||||||
|
let log = await tool.promiseQuery(res, query, param);
|
||||||
|
res.api_res.rt.log = tool.checkArray(log.data);
|
||||||
|
|
||||||
|
query = "select * from ??.?? where `ipmuid` = ?";
|
||||||
|
param = [config.db.db11, 'ipmisenrt', arr.data.id];
|
||||||
|
let sensor = await tool.promiseQuery(res, query, param);
|
||||||
|
res.api_res.rt.sensor = tool.checkArray(sensor.data);
|
||||||
|
|
||||||
|
} catch (err) {
|
||||||
|
return rt.err(res, err, n, 'ERR8000');
|
||||||
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
+96
-61
@@ -3,7 +3,7 @@ const router = express.Router();
|
|||||||
const rt = require('../ResTool');
|
const rt = require('../ResTool');
|
||||||
const config = require('../../config.json');
|
const config = require('../../config.json');
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
const mysql = require('../../libs/mysql_cls');
|
const mysql = require('../../libs/mysql_pool');
|
||||||
const tool = require('../../includes/apiTool');
|
const tool = require('../../includes/apiTool');
|
||||||
const exec = require('child_process').exec;
|
const exec = require('child_process').exec;
|
||||||
const so = require('../../includes/storeObject');
|
const so = require('../../includes/storeObject');
|
||||||
@@ -21,6 +21,15 @@ router
|
|||||||
|
|
||||||
res.send({ name: 'WebIO System API' });
|
res.send({ name: 'WebIO System API' });
|
||||||
})
|
})
|
||||||
|
.post('*', async(req,res,n) => {
|
||||||
|
try{
|
||||||
|
res.db = await mysql.getConn();
|
||||||
|
}catch(e){
|
||||||
|
console.log(`Get DB Connection ERROR ${e}`);
|
||||||
|
return n('ERR8100');
|
||||||
|
}
|
||||||
|
n();
|
||||||
|
})
|
||||||
.post('/getnetwork', (req, res, n) => {
|
.post('/getnetwork', (req, res, n) => {
|
||||||
fs.exists(config.cmdpath.sysinfo, (exists) => {
|
fs.exists(config.cmdpath.sysinfo, (exists) => {
|
||||||
if (!exists) return n('ERR0014');
|
if (!exists) return n('ERR0014');
|
||||||
@@ -101,17 +110,9 @@ router
|
|||||||
if (!arr.data.account) return n('ERR0016');
|
if (!arr.data.account) return n('ERR0016');
|
||||||
if (!arr.data.password) return n('ERR0017');
|
if (!arr.data.password) return n('ERR0017');
|
||||||
|
|
||||||
res.db = new mysql();
|
|
||||||
res.db.user = config.db.user;
|
|
||||||
res.db.password = config.db.pass;
|
|
||||||
res.db.host = config.db.host;
|
|
||||||
res.db.port = config.db.port;
|
|
||||||
res.db.database = config.db.db1;
|
|
||||||
res.db.connect();
|
|
||||||
|
|
||||||
let query = "select * from ??.?? where `account` = ? and `user_password` = ?";
|
let query = "select * from ??.?? where `account` = ? and `user_password` = ?";
|
||||||
res.db.query(query, [config.db.db1, 'userlist', arr.data.account, arr.data.password], (err, row) => {
|
res.db.query(query, [config.db.db1, 'userlist', arr.data.account, arr.data.password], (err, row) => {
|
||||||
if (err) return n('ERR8000');
|
if (err) return rt.err(res, err, n, 'ERR8000');
|
||||||
if (row.length == 0) return n('ERR0019');
|
if (row.length == 0) return n('ERR0019');
|
||||||
delete row[0]['user_password'];
|
delete row[0]['user_password'];
|
||||||
|
|
||||||
@@ -159,13 +160,6 @@ router
|
|||||||
if (!arr.data) return n('ERR0000');
|
if (!arr.data) return n('ERR0000');
|
||||||
if (!arr.data.account) return n('ERR0016');
|
if (!arr.data.account) return n('ERR0016');
|
||||||
}
|
}
|
||||||
res.db = new mysql();
|
|
||||||
res.db.user = config.db.user;
|
|
||||||
res.db.password = config.db.pass;
|
|
||||||
res.db.host = config.db.host;
|
|
||||||
res.db.port = config.db.port;
|
|
||||||
res.db.database = config.db.db1;
|
|
||||||
res.db.connect();
|
|
||||||
|
|
||||||
let query = "select * from ??.??";
|
let query = "select * from ??.??";
|
||||||
let param = [config.db.db1, 'userlist']
|
let param = [config.db.db1, 'userlist']
|
||||||
@@ -176,7 +170,7 @@ router
|
|||||||
}
|
}
|
||||||
|
|
||||||
res.db.query(query, param, (err, row) => {
|
res.db.query(query, param, (err, row) => {
|
||||||
if (err) return n('ERR8000');
|
if (err) return rt.err(res, err, n, 'ERR8000');
|
||||||
|
|
||||||
for (var i in row) {
|
for (var i in row) {
|
||||||
delete row[i]['user_password'];
|
delete row[i]['user_password'];
|
||||||
@@ -195,18 +189,10 @@ router
|
|||||||
if (!arr.data.account) return n('ERR0016');
|
if (!arr.data.account) return n('ERR0016');
|
||||||
if (arr.data.account == 'admin') return n('ERR0037');
|
if (arr.data.account == 'admin') return n('ERR0037');
|
||||||
|
|
||||||
res.db = new mysql();
|
|
||||||
res.db.user = config.db.user;
|
|
||||||
res.db.password = config.db.pass;
|
|
||||||
res.db.host = config.db.host;
|
|
||||||
res.db.port = config.db.port;
|
|
||||||
res.db.database = config.db.db1;
|
|
||||||
res.db.connect();
|
|
||||||
|
|
||||||
let query = "delete from ??.?? where `account` = ?";
|
let query = "delete from ??.?? where `account` = ?";
|
||||||
let param = [config.db.db1, 'userlist', arr.data.account];
|
let param = [config.db.db1, 'userlist', arr.data.account];
|
||||||
res.db.query(query, param, (err, row) => {
|
res.db.query(query, param, (err, row) => {
|
||||||
if (err) return n('ERR0020');
|
if (err) return rt.err(res,err, n, 'ERR0020');
|
||||||
|
|
||||||
let data = {};
|
let data = {};
|
||||||
data.record = [];
|
data.record = [];
|
||||||
@@ -229,14 +215,6 @@ router
|
|||||||
r = 1;
|
r = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
res.db = new mysql();
|
|
||||||
res.db.user = config.db.user;
|
|
||||||
res.db.password = config.db.pass;
|
|
||||||
res.db.host = config.db.host;
|
|
||||||
res.db.port = config.db.port;
|
|
||||||
res.db.database = config.db.db1;
|
|
||||||
res.db.connect();
|
|
||||||
|
|
||||||
let query = "update ??.?? set `write_privilege` = ? , `read_privilege` = ? " +
|
let query = "update ??.?? set `write_privilege` = ? , `read_privilege` = ? " +
|
||||||
(pass.length > 0 ? " , `user_password` = ? " : "") + " where `account` = ? ";
|
(pass.length > 0 ? " , `user_password` = ? " : "") + " where `account` = ? ";
|
||||||
let param = [config.db.db1, 'userlist', w.toString(), r.toString()];
|
let param = [config.db.db1, 'userlist', w.toString(), r.toString()];
|
||||||
@@ -244,7 +222,7 @@ router
|
|||||||
param.push(arr.data.account);
|
param.push(arr.data.account);
|
||||||
|
|
||||||
res.db.query(query, param, (err, row) => {
|
res.db.query(query, param, (err, row) => {
|
||||||
if (err) return n('ERR0021');
|
if (err) return rt.err(res,err,n,'ERR0021');
|
||||||
let data = {};
|
let data = {};
|
||||||
data.record = [];
|
data.record = [];
|
||||||
res.api_res = data;
|
res.api_res = data;
|
||||||
@@ -261,19 +239,11 @@ router
|
|||||||
let w = arr.data.write_privilege && arr.data.write_privilege == '1' ? 1 : 0;
|
let w = arr.data.write_privilege && arr.data.write_privilege == '1' ? 1 : 0;
|
||||||
let r = arr.data.read_privilege && arr.data.read_privilege == '1' ? 1 : 0;
|
let r = arr.data.read_privilege && arr.data.read_privilege == '1' ? 1 : 0;
|
||||||
|
|
||||||
res.db = new mysql();
|
|
||||||
res.db.user = config.db.user;
|
|
||||||
res.db.password = config.db.pass;
|
|
||||||
res.db.host = config.db.host;
|
|
||||||
res.db.port = config.db.port;
|
|
||||||
res.db.database = config.db.db1;
|
|
||||||
res.db.connect();
|
|
||||||
|
|
||||||
let query = "insert into ??.?? (`account`,`user_password`,`write_privilege`,`read_privilege`,`user_add_date`) values (?,?,?,?,unix_timestamp())";
|
let query = "insert into ??.?? (`account`,`user_password`,`write_privilege`,`read_privilege`,`user_add_date`) values (?,?,?,?,unix_timestamp())";
|
||||||
let param = [config.db.db1, 'userlist', arr.data.account, arr.data.password, w.toString(), r.toString()];
|
let param = [config.db.db1, 'userlist', arr.data.account, arr.data.password, w.toString(), r.toString()];
|
||||||
|
|
||||||
res.db.query(query, param, (err, row) => {
|
res.db.query(query, param, (err, row) => {
|
||||||
if (err) return n('ERR0022');
|
if (err) return rt.err(res,err,n,'ERR0022');
|
||||||
|
|
||||||
let data = {};
|
let data = {};
|
||||||
data.record = [];
|
data.record = [];
|
||||||
@@ -282,13 +252,6 @@ router
|
|||||||
});
|
});
|
||||||
})
|
})
|
||||||
.post('/dashboard', (req, res, n) => {
|
.post('/dashboard', (req, res, n) => {
|
||||||
res.db = new mysql();
|
|
||||||
res.db.user = config.db.user;
|
|
||||||
res.db.password = config.db.pass;
|
|
||||||
res.db.host = config.db.host;
|
|
||||||
res.db.port = config.db.port;
|
|
||||||
res.db.database = config.db.db1;
|
|
||||||
res.db.connect();
|
|
||||||
|
|
||||||
let data = {
|
let data = {
|
||||||
record: [],
|
record: [],
|
||||||
@@ -391,7 +354,7 @@ router
|
|||||||
return n();
|
return n();
|
||||||
})
|
})
|
||||||
.catch(e => {
|
.catch(e => {
|
||||||
return n();
|
return rt.err(res, e, n);
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.post('/getselectlist', (req, res, n) => {
|
.post('/getselectlist', (req, res, n) => {
|
||||||
@@ -399,14 +362,6 @@ router
|
|||||||
if (!arr.data) return n('ERR0000');
|
if (!arr.data) return n('ERR0000');
|
||||||
if (!arr.data.type) return n('ERR0009');
|
if (!arr.data.type) return n('ERR0009');
|
||||||
|
|
||||||
res.db = new mysql();
|
|
||||||
res.db.user = config.db.user;
|
|
||||||
res.db.password = config.db.pass;
|
|
||||||
res.db.host = config.db.host;
|
|
||||||
res.db.port = config.db.port;
|
|
||||||
res.db.database = config.db.db1;
|
|
||||||
res.db.connect();
|
|
||||||
|
|
||||||
res.api_res = {
|
res.api_res = {
|
||||||
record: []
|
record: []
|
||||||
};
|
};
|
||||||
@@ -415,25 +370,35 @@ router
|
|||||||
let q, p;
|
let q, p;
|
||||||
switch (arr.data.type) {
|
switch (arr.data.type) {
|
||||||
case 'do':
|
case 'do':
|
||||||
|
if(!config.permission.dio) return n('ERR9000');
|
||||||
q = "select `doname` as name, `douid` as id from ??.??";
|
q = "select `doname` as name, `douid` as id from ??.??";
|
||||||
p = [config.db.db1, 'dolist'];
|
p = [config.db.db1, 'dolist'];
|
||||||
pro = tool.promiseQuery(res, q, p, '');
|
pro = tool.promiseQuery(res, q, p, '');
|
||||||
break;
|
break;
|
||||||
case 'di':
|
case 'di':
|
||||||
|
if(!config.permission.dio) return n('ERR9000');
|
||||||
q = "select `diname` as name, `diuid` as id from ??.??";
|
q = "select `diname` as name, `diuid` as id from ??.??";
|
||||||
p = [config.db.db1, 'dilist'];
|
p = [config.db.db1, 'dilist'];
|
||||||
pro = tool.promiseQuery(res, q, p, '');
|
pro = tool.promiseQuery(res, q, p, '');
|
||||||
break;
|
break;
|
||||||
case 'leone':
|
case 'leone':
|
||||||
|
if(!config.permission.leone) return n('ERR9000');
|
||||||
q = "select `leonename` as name, `leonelistuid` as id from ??.??";
|
q = "select `leonename` as name, `leonelistuid` as id from ??.??";
|
||||||
p = [config.db.db1, 'leonelist'];
|
p = [config.db.db1, 'leonelist'];
|
||||||
pro = tool.promiseQuery(res, q, p, '');
|
pro = tool.promiseQuery(res, q, p, '');
|
||||||
break;
|
break;
|
||||||
case 'iogroup':
|
case 'iogroup':
|
||||||
|
if(!config.permission.iogroup) return n('ERR9000');
|
||||||
q = "select `iogroupname` as name, `iogroupuid` as id from ??.??";
|
q = "select `iogroupname` as name, `iogroupuid` as id from ??.??";
|
||||||
p = [config.db.db1, 'iogroup'];
|
p = [config.db.db1, 'iogroup'];
|
||||||
pro = tool.promiseQuery(res, q, p, '');
|
pro = tool.promiseQuery(res, q, p, '');
|
||||||
break;
|
break;
|
||||||
|
case 'modbus':
|
||||||
|
if(!config.permission.modbus) return n('ERR9000');
|
||||||
|
q = "select `name`, `uid` as id from ??.??";
|
||||||
|
p = [config.db.db5, 'device'];
|
||||||
|
pro = tool.promiseQuery(res,q,p, '');
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
return n();
|
return n();
|
||||||
}
|
}
|
||||||
@@ -447,6 +412,76 @@ router
|
|||||||
return n();
|
return n();
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
.post('/chklogin', (req,res,n) => {
|
||||||
|
if(!tool.checkPermission(req)) return n('ERR9001');
|
||||||
|
res.api_res = {
|
||||||
|
record: []
|
||||||
|
}
|
||||||
|
n();
|
||||||
|
})
|
||||||
|
.post('/gettimezonelist', (req,res,n) => {
|
||||||
|
exec('timedatectl list-timezones', (err, stdout, stderr) => {
|
||||||
|
if(err) return n("ERR8000");
|
||||||
|
|
||||||
|
let zones = stdout.split(/\n/);
|
||||||
|
let json = {
|
||||||
|
zone: []
|
||||||
|
};
|
||||||
|
|
||||||
|
for(let i in zones){
|
||||||
|
let str = zones[i].trim();
|
||||||
|
if(!str) continue;
|
||||||
|
let tz = str.split('/');
|
||||||
|
if(tz.length != 2) continue;
|
||||||
|
let flag = false;
|
||||||
|
for(let j in json.zone){
|
||||||
|
if(json.zone[j].name == tz[0]) {
|
||||||
|
flag = true;
|
||||||
|
json.zone[j].location.push(tz[1]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(!flag) json.zone.push({name: tz[0], location: [tz[1]]})
|
||||||
|
}
|
||||||
|
|
||||||
|
res.api_res = {
|
||||||
|
record: tool.checkArray(json.zone)
|
||||||
|
}
|
||||||
|
n();
|
||||||
|
})
|
||||||
|
})
|
||||||
|
.post('/gettimezoneset', (req,res,n) => {
|
||||||
|
let query = "select * from ??.?? where `type` = ? limit 1";
|
||||||
|
let param = [config.db.db1, 'system', 'timezone'];
|
||||||
|
res.db.query(query, param, (err, row) => {
|
||||||
|
if(err) return rt.err(res,err,n, 'ERR8000');
|
||||||
|
res.api_res = {
|
||||||
|
record: tool.checkArray(row)
|
||||||
|
}
|
||||||
|
|
||||||
|
return n();
|
||||||
|
});
|
||||||
|
})
|
||||||
|
.post('/settimezone', (req,res,n) => {
|
||||||
|
if(!tool.checkPermission(req)) return n('ERR9000');
|
||||||
|
let arr = req.body;
|
||||||
|
if(!arr.data) return n('ERR0000');
|
||||||
|
if(!arr.data.timezone) return n('ERR0058');
|
||||||
|
|
||||||
|
let cmd = `timedatectl set-timezone ${arr.data.timezone}`;
|
||||||
|
exec(cmd, (err, stdout, stderr) => {
|
||||||
|
if(err) return rt.err(res,err, n, 'ERR0059');
|
||||||
|
|
||||||
|
let query = "update ??.?? set `value` = ? where `type` = ?";
|
||||||
|
let param = [config.db.db1, 'system', arr.data.timezone, 'timezone'];
|
||||||
|
res.db.query(query, param, (err, row) => {
|
||||||
|
if(err ) return rt.err(res, err, n, 'ERR8002');
|
||||||
|
res.api_res = {
|
||||||
|
record: []
|
||||||
|
}
|
||||||
|
n();
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
.all('*', rt.send);
|
.all('*', rt.send);
|
||||||
|
|
||||||
module.exports = router;
|
module.exports = router;
|
||||||
@@ -0,0 +1,500 @@
|
|||||||
|
const express = require('express');
|
||||||
|
const router = express.Router();
|
||||||
|
const rt = require('../ResTool');
|
||||||
|
const config = require('../../config.json');
|
||||||
|
const fs = require('fs');
|
||||||
|
const mysql = require('../../libs/mysql_pool');
|
||||||
|
const tool = require('../../includes/apiTool');
|
||||||
|
const exec = require('child_process').exec;
|
||||||
|
const so = require('../../includes/storeObject');
|
||||||
|
const crypt = require('../../libs/crypto');
|
||||||
|
|
||||||
|
router
|
||||||
|
.get('/', (req, res) => {
|
||||||
|
res.send({ name: 'WebIO Wristband API' });
|
||||||
|
})
|
||||||
|
.get('/pushdata', async(req, res, n) => {
|
||||||
|
try {
|
||||||
|
res.db = await mysql.getConn();
|
||||||
|
} catch (e) {
|
||||||
|
console.log(`Get DB Connection ERROR ${e}`);
|
||||||
|
return n('ERR8100');
|
||||||
|
}
|
||||||
|
|
||||||
|
let arr = req.query;
|
||||||
|
if (!arr.mac) return n('ERR0000');
|
||||||
|
if (!arr.devid) return n('ERR0000');
|
||||||
|
let query = "insert into ??.?? values (null, ?, ?,?,?,?,?,?,?,?,?,?,?,?,unix_timestamp())";
|
||||||
|
let param = [
|
||||||
|
config.db.db9,
|
||||||
|
'rawdata',
|
||||||
|
arr.devid || '',
|
||||||
|
arr.mac || '',
|
||||||
|
arr.val2 || '',
|
||||||
|
arr.val3 || '',
|
||||||
|
arr.val4 || '',
|
||||||
|
arr.val5 || '',
|
||||||
|
arr.val6 || '',
|
||||||
|
arr.val7 || '',
|
||||||
|
arr.val8 || '',
|
||||||
|
arr.val9 || '',
|
||||||
|
arr.val10 || '',
|
||||||
|
arr.val11 || '',
|
||||||
|
arr.timestamp || '',
|
||||||
|
];
|
||||||
|
res.db.query(query, param, (err, row) => {
|
||||||
|
if (err) return n('ERR8001');
|
||||||
|
res.api_res = {
|
||||||
|
record: []
|
||||||
|
};
|
||||||
|
let q = "select count(*) as c from ??.?? where `mac` = ?";
|
||||||
|
let p = [config.db.db9, 'wristband', arr.mac];
|
||||||
|
res.db.query(q, p, (err, row) => {
|
||||||
|
let pros = [];
|
||||||
|
if (!(err || row.length == 0 || row[0].c > 0)) {
|
||||||
|
let q = "insert into ??.?? (`mac`, `name`, `cuser`, `muser`, `ctime`, `mtime`) values (?, '', 'API', 'API', unix_timestamp(), unix_timestamp())";
|
||||||
|
let p = [config.db.db9, 'wristband', arr.mac];
|
||||||
|
pros.push(tool.promiseQuery(res, q, p, 'q1'));
|
||||||
|
}
|
||||||
|
|
||||||
|
let lq = "insert into ??.?? (`mac`, `devid`, `val2`, `val3`, `val4`, `val5`, `val6`, `val7`, `val8`, `val9`, `val10`, `val11`, `timestamp`, `ctime`, `mtime`) values \
|
||||||
|
(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, unix_timestamp(), unix_timestamp()) ON DUPLICATE KEY \
|
||||||
|
update \
|
||||||
|
`devid` = ?, \
|
||||||
|
`val2` = ?, \
|
||||||
|
`val3` = ?, \
|
||||||
|
`val4` = ?, \
|
||||||
|
`val5` = ?, \
|
||||||
|
`val6` = ?, \
|
||||||
|
`val7` = ?, \
|
||||||
|
`val8` = ?, \
|
||||||
|
`val9` = ?, \
|
||||||
|
`val10` = ?, \
|
||||||
|
`val11` = ?, \
|
||||||
|
`timestamp` = ?, \
|
||||||
|
`mtime` = unix_timestamp()";
|
||||||
|
let lp = [config.db.db9, 'lastdata',
|
||||||
|
arr.mac,
|
||||||
|
arr.devid,
|
||||||
|
arr.val2 || '',
|
||||||
|
arr.val3 || '',
|
||||||
|
arr.val4 || '',
|
||||||
|
arr.val5 || '',
|
||||||
|
arr.val6 || '',
|
||||||
|
arr.val7 || '',
|
||||||
|
arr.val8 || '',
|
||||||
|
arr.val9 || '',
|
||||||
|
arr.val10 || '',
|
||||||
|
arr.val11 || '',
|
||||||
|
arr.timestamp || '',
|
||||||
|
arr.devid,
|
||||||
|
arr.val2 || '',
|
||||||
|
arr.val3 || '',
|
||||||
|
arr.val4 || '',
|
||||||
|
arr.val5 || '',
|
||||||
|
arr.val6 || '',
|
||||||
|
arr.val7 || '',
|
||||||
|
arr.val8 || '',
|
||||||
|
arr.val9 || '',
|
||||||
|
arr.val10 || '',
|
||||||
|
arr.val11 || '',
|
||||||
|
arr.timestamp || ''
|
||||||
|
]
|
||||||
|
|
||||||
|
pros.push(tool.promiseQuery(res, lq, lp, 'q2'));
|
||||||
|
|
||||||
|
Promise.all(pros)
|
||||||
|
.then(r => {
|
||||||
|
n()
|
||||||
|
})
|
||||||
|
.catch(err => {
|
||||||
|
console.log(err);
|
||||||
|
n();
|
||||||
|
})
|
||||||
|
|
||||||
|
})
|
||||||
|
// n();
|
||||||
|
})
|
||||||
|
})
|
||||||
|
.post('*', async(req, res, n) => {
|
||||||
|
try {
|
||||||
|
res.db = await mysql.getConn();
|
||||||
|
} catch (e) {
|
||||||
|
console.log(`Get DB Connection ERROR ${e}`);
|
||||||
|
return n('ERR8100');
|
||||||
|
}
|
||||||
|
n();
|
||||||
|
})
|
||||||
|
.post('/getstatus', (req, res, n) => {
|
||||||
|
if (!config.permission.wristband) return n('ERR9000');
|
||||||
|
|
||||||
|
let query = "select w.`name`, w.`mac` as wristband, \
|
||||||
|
coalesce(l.`name`, l2.`name`) as locname, \
|
||||||
|
coalesce(case when tmp2.`wlocrtloc` = 'NG' then null else tmp2.`wlocrtloc` end, ll.`devid`) as locid, \
|
||||||
|
case when tmp2.`wlocrtloc` = 'NG' then 1 else 0 end as loss, \
|
||||||
|
ll.* \
|
||||||
|
from ??.?? w \
|
||||||
|
left join ??.?? tmp2 \
|
||||||
|
on tmp2.`wlocrtmac` = w.`mac` \
|
||||||
|
left join ??.?? ll \
|
||||||
|
on ll.`mac` = w.`mac` \
|
||||||
|
left join ??.?? l \
|
||||||
|
on \
|
||||||
|
l.`serialnumber` = tmp2.`wlocrtloc` \
|
||||||
|
and tmp2.`wlocrtloc` != 'NG' \
|
||||||
|
left join ??.?? l2\
|
||||||
|
on \
|
||||||
|
l2.`serialnumber` = ll.`devid` \
|
||||||
|
where \
|
||||||
|
w.`switch` = 1 ";
|
||||||
|
let param = [config.db.db9, 'wristband', config.db.db9, 'wlocationrt', config.db.db9, 'lastdata', config.db.db9, 'location', config.db.db9, 'location', ];
|
||||||
|
|
||||||
|
let sortfield = '';
|
||||||
|
let sortorder = '';
|
||||||
|
|
||||||
|
if (req.body.data && req.body.data.sort) {
|
||||||
|
if (req.body.data.sort.field) sortfield = req.body.data.sort.field;
|
||||||
|
if (req.body.data.sort.order) sortorder = req.body.data.sort.order;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (sortfield) {
|
||||||
|
case 'mac':
|
||||||
|
case 'val2':
|
||||||
|
case 'val3':
|
||||||
|
case 'val4':
|
||||||
|
case 'val5':
|
||||||
|
case 'val6':
|
||||||
|
case 'val7':
|
||||||
|
case 'val8':
|
||||||
|
case 'val9':
|
||||||
|
case 'val10':
|
||||||
|
case 'val11':
|
||||||
|
query += `order by ll.${sortfield} ${sortorder}`;
|
||||||
|
break;
|
||||||
|
case 'loc':
|
||||||
|
query += `order by locname ${sortorder}`;
|
||||||
|
break;
|
||||||
|
case 'time':
|
||||||
|
query += 'order by ll.`timestamp` ' + sortorder;
|
||||||
|
break;
|
||||||
|
case 'name':
|
||||||
|
query += `order by w.name ${sortorder}`;
|
||||||
|
default:
|
||||||
|
query += 'order by w.`uid`';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
res.db.query(query, param, (err, row) => {
|
||||||
|
if (err) return rt.err(res, err, n, 'ERR8000');
|
||||||
|
|
||||||
|
res.api_res = {
|
||||||
|
record: tool.checkArray(row)
|
||||||
|
}
|
||||||
|
n();
|
||||||
|
})
|
||||||
|
})
|
||||||
|
.post('/getwristbandlist', (req, res, n) => {
|
||||||
|
if (!config.permission.wristband) return n('ERR9000');
|
||||||
|
|
||||||
|
let query = "select * from ??.?? ";
|
||||||
|
let param = [config.db.db9, 'wristband'];
|
||||||
|
|
||||||
|
res.db.query(query, param, (err, row) => {
|
||||||
|
if (err) return rt.err(res, err, n, 'ERR8000');
|
||||||
|
|
||||||
|
res.api_res = {
|
||||||
|
record: tool.checkArray(row)
|
||||||
|
};
|
||||||
|
|
||||||
|
n();
|
||||||
|
})
|
||||||
|
})
|
||||||
|
.post('/delwristband', (req, res, n) => {
|
||||||
|
if (!config.permission.wristband) return n('ERR9000');
|
||||||
|
if (!tool.checkPermission(req)) return n('ERR9000');
|
||||||
|
let arr = req.body;
|
||||||
|
if (!arr.data) return n('ERR0000');
|
||||||
|
if (!arr.data.id) return n('ERR0028');
|
||||||
|
|
||||||
|
res.db.query(`use ${config.db.db9}`);
|
||||||
|
let query = "delete from ??.?? where `uid` = ?";
|
||||||
|
let param = [config.db.db9, 'wristband', arr.data.id];
|
||||||
|
|
||||||
|
res.db.query(query, param, (err, row) => {
|
||||||
|
if (err) return rt.err(res, err, n, 'ERR8003');
|
||||||
|
|
||||||
|
res.api_res = {
|
||||||
|
record: []
|
||||||
|
};
|
||||||
|
n();
|
||||||
|
});
|
||||||
|
})
|
||||||
|
.post('/addwristband', (req, res, n) => {
|
||||||
|
if (!config.permission.wristband) return n('ERR9000');
|
||||||
|
if (!tool.checkPermission(req)) return n('ERR9000');
|
||||||
|
let arr = req.body;
|
||||||
|
if (!arr.data) return n('ERR0000')
|
||||||
|
if (!arr.data.mac) return n('ERR0060');
|
||||||
|
|
||||||
|
let query = "select count(*) as c from ??.?? where `mac` = ?";
|
||||||
|
let param = [config.db.db9, 'wristband', arr.data.mac];
|
||||||
|
|
||||||
|
res.db.query(query, param, (err, row) => {
|
||||||
|
if (err || row.length == 0) return rt.err(res, err, n, "ERR8000");
|
||||||
|
if (row[0].c > 0) return n("ERR0061");
|
||||||
|
|
||||||
|
let name = arr.data.name || '';
|
||||||
|
let identity = arr.data.identity || 0;
|
||||||
|
let monitor = arr.data.monitor || 0;
|
||||||
|
let notify = arr.data.notify || 0;
|
||||||
|
let sw = arr.data.switch || 0;
|
||||||
|
|
||||||
|
let u = '';
|
||||||
|
let obj = so.get(req.headers['x-auth-token']);
|
||||||
|
if (obj != null && 'user' in obj && 'account' in obj.user) {
|
||||||
|
u = obj.user.account;
|
||||||
|
}
|
||||||
|
|
||||||
|
let query = "insert into ??.?? (`mac`, `name`, `identity`, `monitor`, `notify`, `switch`, `cuser`, `muser`, `ctime`, `mtime`) values \
|
||||||
|
( ?, ?, ?, ?, ?, ?, ?, ?, unix_timestamp(), unix_timestamp() )";
|
||||||
|
let param = [config.db.db9, 'wristband', arr.data.mac, name, identity, monitor, notify, sw, u, u];
|
||||||
|
|
||||||
|
res.db.query(query, param, (err, row) => {
|
||||||
|
if (err) return rt.err(res, err, n, 'ERR8001');
|
||||||
|
|
||||||
|
res.api_res = {
|
||||||
|
record: []
|
||||||
|
};
|
||||||
|
n();
|
||||||
|
});
|
||||||
|
})
|
||||||
|
})
|
||||||
|
.post('/editwristband', (req, res, n) => {
|
||||||
|
if (!config.permission.wristband) return n('ERR9000');
|
||||||
|
if (!tool.checkPermission(req)) return n('ERR9000');
|
||||||
|
let arr = req.body;
|
||||||
|
if (!arr.data) return n('ERR0000');
|
||||||
|
if (!arr.data.id) return n('ERR0028');
|
||||||
|
|
||||||
|
let name = arr.data.name || '';
|
||||||
|
let identity = arr.data.identity || 0;
|
||||||
|
let monitor = arr.data.monitor || 0;
|
||||||
|
let notify = arr.data.notify || 0;
|
||||||
|
let sw = arr.data.switch || 0;
|
||||||
|
|
||||||
|
let u = '';
|
||||||
|
let obj = so.get(req.headers['x-auth-token']);
|
||||||
|
if (obj != null && 'user' in obj && 'account' in obj.user) {
|
||||||
|
u = obj.user.account;
|
||||||
|
}
|
||||||
|
|
||||||
|
let query = "update ??.?? set \
|
||||||
|
`name` = ?, \
|
||||||
|
`identity` = ?, \
|
||||||
|
`monitor` = ?, \
|
||||||
|
`notify` = ?, \
|
||||||
|
`switch` = ?, \
|
||||||
|
`muser` = ?, \
|
||||||
|
`mtime` = unix_timestamp() \
|
||||||
|
where \
|
||||||
|
`uid` = ?";
|
||||||
|
let param = [config.db.db9, 'wristband', name, identity, monitor, notify, sw, u, arr.data.id];
|
||||||
|
res.db.query(query, param, (err, row) => {
|
||||||
|
if (err) return rt.err(res, err, n, 'ERR8002');
|
||||||
|
|
||||||
|
res.api_res = {
|
||||||
|
record: []
|
||||||
|
}
|
||||||
|
n();
|
||||||
|
})
|
||||||
|
})
|
||||||
|
.post('/getwristbandlocpath', (req, res, n) => {
|
||||||
|
if (!config.permission.wristband) return n('ERR9000');
|
||||||
|
let arr = req.body;
|
||||||
|
if (!arr.data) return n('ERR0000');
|
||||||
|
if (!arr.data.mac) return n('ERR0060');
|
||||||
|
if (!arr.data.stime || !arr.data.etime) return n('ERR0015');
|
||||||
|
|
||||||
|
let pros = [];
|
||||||
|
let query = "select log.*, dev.`name` as devname \
|
||||||
|
from ??.?? log \
|
||||||
|
left join ??.?? dev \
|
||||||
|
on dev.`serialnumber` = log.`wloclogloc` \
|
||||||
|
where \
|
||||||
|
log.`wloclogmac` = ? \
|
||||||
|
and log.`wloclogtst` >= ? \
|
||||||
|
and log.`wloclogtst` <= ? \
|
||||||
|
order by log.`wloclogtst` desc";
|
||||||
|
let param = [config.db.db9, 'wlocationlog', config.db.db9, 'location', arr.data.mac, arr.data.stime, arr.data.etime];
|
||||||
|
pros.push(tool.promiseQuery(res, query, param, 'record'));
|
||||||
|
|
||||||
|
let rtq = "select * from ??.?? where `mac` = ?";
|
||||||
|
let rtp = [config.db.db9, 'wristband', arr.data.mac];
|
||||||
|
pros.push(tool.promiseQuery(res, rtq, rtp, 'rt'));
|
||||||
|
|
||||||
|
res.api_res = {
|
||||||
|
record: [],
|
||||||
|
rt: {
|
||||||
|
wristband: []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Promise.all(pros)
|
||||||
|
.then(d => {
|
||||||
|
for (let i in d) {
|
||||||
|
let tmp = d[i];
|
||||||
|
if (tmp.key == 'rt') {
|
||||||
|
res.api_res.rt.wristband = tool.checkArray(tmp.data);
|
||||||
|
}
|
||||||
|
if (tmp.key == 'record') {
|
||||||
|
res.api_res.record = tool.checkArray(tmp.data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return n();
|
||||||
|
})
|
||||||
|
.catch(err => rt.err(res, err, n, 'ERR8000'));
|
||||||
|
|
||||||
|
})
|
||||||
|
.post('/getwristbandhealthinfo', (req, res, n) => {
|
||||||
|
if (!config.permission.wristband) return n('ERR9000');
|
||||||
|
let arr = req.body;
|
||||||
|
if (!arr.data) return n('ERR0000');
|
||||||
|
if (!arr.data.mac) return n('ERR0060');
|
||||||
|
if (!arr.data.stime || !arr.data.etime) return n('ERR0015');
|
||||||
|
|
||||||
|
let pros = [];
|
||||||
|
let query = "select log.* \
|
||||||
|
from ??.?? log \
|
||||||
|
where \
|
||||||
|
log.`wphylogmac` = ? \
|
||||||
|
and log.`wphylogtst` >= ? \
|
||||||
|
and log.`wphylogtst` <= ? \
|
||||||
|
order by log.`wphylogtst` desc";
|
||||||
|
let param = [config.db.db9, 'wphylog', arr.data.mac, arr.data.stime, arr.data.etime];
|
||||||
|
pros.push(tool.promiseQuery(res, query, param, 'record'));
|
||||||
|
|
||||||
|
let rtq = "select * from ??.?? where `mac` = ?";
|
||||||
|
let rtp = [config.db.db9, 'wristband', arr.data.mac];
|
||||||
|
pros.push(tool.promiseQuery(res, rtq, rtp, 'rt'));
|
||||||
|
|
||||||
|
res.api_res = {
|
||||||
|
record: [],
|
||||||
|
rt: {
|
||||||
|
wristband: []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Promise.all(pros)
|
||||||
|
.then(d => {
|
||||||
|
for (let i in d) {
|
||||||
|
let tmp = d[i];
|
||||||
|
if (tmp.key == 'rt') {
|
||||||
|
res.api_res.rt.wristband = tool.checkArray(tmp.data);
|
||||||
|
}
|
||||||
|
if (tmp.key == 'record') {
|
||||||
|
res.api_res.record = tool.checkArray(tmp.data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return n();
|
||||||
|
})
|
||||||
|
.catch(err => rt.err(res, err, n, 'ERR8000'));
|
||||||
|
})
|
||||||
|
.post('/getlocationlist', (req, res, n) => {
|
||||||
|
if (!config.permission.wristband) return n('ERR9000');
|
||||||
|
|
||||||
|
let query = "select * from ??.??";
|
||||||
|
let param = [config.db.db9, 'location'];
|
||||||
|
|
||||||
|
res.db.query(query, param, (err, row) => {
|
||||||
|
if (err) return rt.err(res, err, n, "ERR8000");
|
||||||
|
|
||||||
|
res.api_res = {
|
||||||
|
record: tool.checkArray(row)
|
||||||
|
}
|
||||||
|
n();
|
||||||
|
});
|
||||||
|
})
|
||||||
|
.post('/addlocation', (req, res, n) => {
|
||||||
|
if (!config.permission.wristband) return n('ERR9000');
|
||||||
|
if (!tool.checkPermission(req)) return n('ERR9000');
|
||||||
|
let arr = req.body;
|
||||||
|
if (!arr.data) return n('ERR0000');
|
||||||
|
if (!arr.data.sn) return n("ERR0062");
|
||||||
|
if (!arr.data.name) return n('ERR0026');
|
||||||
|
|
||||||
|
let query = "select count(*) as c from ??.?? where `serialnumber` = ?";
|
||||||
|
let param = [config.db.db9, 'location', arr.data.sn];
|
||||||
|
|
||||||
|
res.db.query(query, param, (err, row) => {
|
||||||
|
if (err || row.length == 0) return rt.err(res, err, n, 'ERR8000');
|
||||||
|
if (row[0].c > 0) return n('ERR0063');
|
||||||
|
|
||||||
|
let u = '';
|
||||||
|
let obj = so.get(req.headers['x-auth-token']);
|
||||||
|
if (obj != null && 'user' in obj && 'account' in obj.user) {
|
||||||
|
u = obj.user.account;
|
||||||
|
}
|
||||||
|
|
||||||
|
let query = "insert into ??.?? (`name`, `serialnumber`, `cuser`, `ctime`, `muser`, `mtime`) values (?, ?, ?, unix_timestamp(), ?, unix_timestamp())";
|
||||||
|
let param = [config.db.db9, 'location', arr.data.name, arr.data.sn, u, u];
|
||||||
|
res.db.query(query, param, (err, row) => {
|
||||||
|
if (err) return rt.err(res, err, n, 'ERR8001');
|
||||||
|
res.api_res = {
|
||||||
|
record: []
|
||||||
|
}
|
||||||
|
n();
|
||||||
|
});
|
||||||
|
})
|
||||||
|
})
|
||||||
|
.post('/editlocation', (req, res, n) => {
|
||||||
|
if (!config.permission.wristband) return n('ERR9000');
|
||||||
|
if (!tool.checkPermission(req)) return n('ERR9000');
|
||||||
|
let arr = req.body;
|
||||||
|
if (!arr.data) return n('ERR0000');
|
||||||
|
if (!arr.data.id) return n('ERR0028');
|
||||||
|
if (!arr.data.name) return n('ERR0026');
|
||||||
|
|
||||||
|
let u = '';
|
||||||
|
let obj = so.get(req.headers['x-auth-token']);
|
||||||
|
if (obj != null && 'user' in obj && 'account' in obj.user) {
|
||||||
|
u = obj.user.account;
|
||||||
|
}
|
||||||
|
|
||||||
|
let query = "update ??.?? set \
|
||||||
|
`name` = ?, \
|
||||||
|
`muser` = ?, \
|
||||||
|
`mtime` = unix_timestamp() \
|
||||||
|
where \
|
||||||
|
`uid` = ? ";
|
||||||
|
let param = [config.db.db9, 'location', arr.data.name, u, arr.data.id];
|
||||||
|
res.db.query(query, param, (err, row) => {
|
||||||
|
if (err) return rt.err(res, err, n, 'ERR8002');
|
||||||
|
|
||||||
|
res.api_res = {
|
||||||
|
record: []
|
||||||
|
};
|
||||||
|
n();
|
||||||
|
})
|
||||||
|
})
|
||||||
|
.post('/dellocation', (req, res, n) => {
|
||||||
|
if (!config.permission.wristband) return n('ERR9000');
|
||||||
|
if (!tool.checkPermission(req)) return n('ERR9000');
|
||||||
|
let arr = req.body;
|
||||||
|
if (!arr.data) return n('ERR0000');
|
||||||
|
if (!arr.data.id) return n('ERR0028');
|
||||||
|
|
||||||
|
res.db.query(`use ${config.db.db9}`);
|
||||||
|
|
||||||
|
let query = "delete from ??.?? where `uid` = ?";
|
||||||
|
let param = [config.db.db9, 'location', arr.data.id];
|
||||||
|
res.db.query(query, param, (err, row) => {
|
||||||
|
if (err) return rt.err(res, err, n, 'ERR8003');
|
||||||
|
res.api_res = {
|
||||||
|
record: []
|
||||||
|
}
|
||||||
|
n();
|
||||||
|
})
|
||||||
|
})
|
||||||
|
.all('*', rt.send);
|
||||||
|
|
||||||
|
module.exports = router;
|
||||||
+74
-48
@@ -3,7 +3,7 @@
|
|||||||
* @param {string} msg
|
* @param {string} msg
|
||||||
* @param {function} act
|
* @param {function} act
|
||||||
*/
|
*/
|
||||||
export const add_dialog_msg =(msg, act) => ({
|
export const add_dialog_msg = (msg, act) => ({
|
||||||
type: 'dialog_addmsg',
|
type: 'dialog_addmsg',
|
||||||
msg: msg,
|
msg: msg,
|
||||||
act: act || null
|
act: act || null
|
||||||
@@ -16,6 +16,16 @@ export const remove_dialog_msg = () => ({
|
|||||||
type: 'dialog_remove_first'
|
type: 'dialog_remove_first'
|
||||||
});
|
});
|
||||||
|
|
||||||
|
export const add_confirm = (msg, act = null) => ({
|
||||||
|
type: 'confirm_addmsg',
|
||||||
|
msg,
|
||||||
|
act
|
||||||
|
})
|
||||||
|
|
||||||
|
export const remove_confirm = () => ({
|
||||||
|
type: 'confirm_remove'
|
||||||
|
})
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* set i18next object
|
* set i18next object
|
||||||
* @param {object} i18n i18next object
|
* @param {object} i18n i18next object
|
||||||
@@ -52,12 +62,12 @@ export const getRequest = (data = {}) => {
|
|||||||
'Accept': 'application/json',
|
'Accept': 'application/json',
|
||||||
'Content-Type': 'application/json'
|
'Content-Type': 'application/json'
|
||||||
},
|
},
|
||||||
mode:'cors'
|
mode: 'cors'
|
||||||
};
|
};
|
||||||
let token = sessionStorage.getItem('token');
|
let token = sessionStorage.getItem('token');
|
||||||
if(token) json.headers['x-auth-token'] = token;
|
if (token) json.headers['x-auth-token'] = token;
|
||||||
|
|
||||||
json.body = JSON.stringify({data});
|
json.body = JSON.stringify({ data });
|
||||||
|
|
||||||
return json;
|
return json;
|
||||||
}
|
}
|
||||||
@@ -68,11 +78,11 @@ export const get_network_info = () => dispatch => {
|
|||||||
.then(response => response.json())
|
.then(response => response.json())
|
||||||
.then(json => {
|
.then(json => {
|
||||||
dispatch(toggle_loading(0));
|
dispatch(toggle_loading(0));
|
||||||
if(json.status != 1){
|
if (json.status != 1) {
|
||||||
return dispatch(add_dialog_msg(json.message));
|
return dispatch(add_dialog_msg(json.message));
|
||||||
}
|
}
|
||||||
let j = {};
|
let j = {};
|
||||||
if('data' in json && 'record' in json.data && json.data.record.length > 0) j = json.data.record[0];
|
if ('data' in json && 'record' in json.data && json.data.record.length > 0) j = json.data.record[0];
|
||||||
return dispatch(network_info(j));
|
return dispatch(network_info(j));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -87,7 +97,7 @@ export const set_network_info = (dhcpMode, ip, netmask, gateway, dns) => dispatc
|
|||||||
let type = dhcpMode ? 'dhcp' : 'manual';
|
let type = dhcpMode ? 'dhcp' : 'manual';
|
||||||
let req = getRequest();
|
let req = getRequest();
|
||||||
let json = {
|
let json = {
|
||||||
data:{
|
data: {
|
||||||
type,
|
type,
|
||||||
ip,
|
ip,
|
||||||
netmask,
|
netmask,
|
||||||
@@ -100,7 +110,7 @@ export const set_network_info = (dhcpMode, ip, netmask, gateway, dns) => dispatc
|
|||||||
.then(response => response.json())
|
.then(response => response.json())
|
||||||
.then(json => {
|
.then(json => {
|
||||||
dispatch(toggle_loading(0));
|
dispatch(toggle_loading(0));
|
||||||
if(json.status != 1) return dispatch(add_dialog_msg(json.message));
|
if (json.status != 1) return dispatch(add_dialog_msg(json.message));
|
||||||
return dispatch(get_network_info());
|
return dispatch(get_network_info());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -111,11 +121,11 @@ export const get_system_time = () => dispatch => {
|
|||||||
.then(response => response.json())
|
.then(response => response.json())
|
||||||
.then(json => {
|
.then(json => {
|
||||||
dispatch(toggle_loading(0));
|
dispatch(toggle_loading(0));
|
||||||
if(json.status != 1){
|
if (json.status != 1) {
|
||||||
return dispatch(add_dialog_msg(json.message));
|
return dispatch(add_dialog_msg(json.message));
|
||||||
}
|
}
|
||||||
let t = '';
|
let t = '';
|
||||||
if('data' in json && 'record' in json.data && json.data.record.length > 0) t = json.data.record[0].time;
|
if ('data' in json && 'record' in json.data && json.data.record.length > 0) t = json.data.record[0].time;
|
||||||
return dispatch(system_time(t));
|
return dispatch(system_time(t));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -127,12 +137,12 @@ const system_time = (time) => ({
|
|||||||
|
|
||||||
export const set_system_time = time => dispatch => {
|
export const set_system_time = time => dispatch => {
|
||||||
dispatch(toggle_loading(1));
|
dispatch(toggle_loading(1));
|
||||||
let req = getRequest({time});
|
let req = getRequest({ time });
|
||||||
return fetch('/api/system/updatetime', req)
|
return fetch('/api/system/updatetime', req)
|
||||||
.then(response => response.json())
|
.then(response => response.json())
|
||||||
.then(json => {
|
.then(json => {
|
||||||
dispatch(toggle_loading(0));
|
dispatch(toggle_loading(0));
|
||||||
if(json.status != 1) return dispatch(add_dialog_msg(json.message));
|
if (json.status != 1) return dispatch(add_dialog_msg(json.message));
|
||||||
return dispatch(get_system_time());
|
return dispatch(get_system_time());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -144,7 +154,7 @@ export const get_user_list = () => dispatch => {
|
|||||||
.then(response => response.json())
|
.then(response => response.json())
|
||||||
.then(json => {
|
.then(json => {
|
||||||
dispatch(toggle_loading(0));
|
dispatch(toggle_loading(0));
|
||||||
if(json.status != 1) return dispatch(add_dialog_msg(json.message));
|
if (json.status != 1) return dispatch(add_dialog_msg(json.message));
|
||||||
return dispatch(user_list(json.data.record));
|
return dispatch(user_list(json.data.record));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -161,7 +171,7 @@ const userApi = (url, data = {}) => dispatch => {
|
|||||||
.then(response => response.json())
|
.then(response => response.json())
|
||||||
.then(json => {
|
.then(json => {
|
||||||
dispatch(toggle_loading(0));
|
dispatch(toggle_loading(0));
|
||||||
if(json.status != 1) return dispatch(add_dialog_msg(json.message));
|
if (json.status != 1) return dispatch(add_dialog_msg(json.message));
|
||||||
return dispatch(get_user_list());
|
return dispatch(get_user_list());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -184,7 +194,7 @@ export const get_dio_info = () => dispatch => {
|
|||||||
.then(response => response.json())
|
.then(response => response.json())
|
||||||
.then(json => {
|
.then(json => {
|
||||||
dispatch(toggle_loading(0));
|
dispatch(toggle_loading(0));
|
||||||
if(json.status != 1) return dispatch(add_dialog_msg(json.message));
|
if (json.status != 1) return dispatch(add_dialog_msg(json.message));
|
||||||
return dispatch(dioinfo(json.data.rt.do || [], json.data.rt.di || []));
|
return dispatch(dioinfo(json.data.rt.do || [], json.data.rt.di || []));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -193,7 +203,7 @@ export const get_dio_status = () => dispatch => {
|
|||||||
return fetch('/api/dio/getio', getRequest())
|
return fetch('/api/dio/getio', getRequest())
|
||||||
.then(response => response.json())
|
.then(response => response.json())
|
||||||
.then(json => {
|
.then(json => {
|
||||||
if(json.status != 1) return dispatch(add_dialog_msg(json.message));
|
if (json.status != 1) return dispatch(add_dialog_msg(json.message));
|
||||||
return dispatch(diostatus(json.data.rt.do, json.data.rt.di));
|
return dispatch(diostatus(json.data.rt.do, json.data.rt.di));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -202,7 +212,7 @@ export const set_do_status = (data) => dispatch => {
|
|||||||
return fetch('/api/dio/dotrun', getRequest(data))
|
return fetch('/api/dio/dotrun', getRequest(data))
|
||||||
.then(response => response.json())
|
.then(response => response.json())
|
||||||
.then(json => {
|
.then(json => {
|
||||||
if(json.status != 1) return dispatch(add_dialog_msg(json.message));
|
if (json.status != 1) return dispatch(add_dialog_msg(json.message));
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -212,7 +222,7 @@ export const set_dio_info = (data) => dispatch => {
|
|||||||
.then(response => response.json())
|
.then(response => response.json())
|
||||||
.then(json => {
|
.then(json => {
|
||||||
dispatch(toggle_loading(0));
|
dispatch(toggle_loading(0));
|
||||||
if(json.status != 1) return dispatch(add_dialog_msg(json.message));
|
if (json.status != 1) return dispatch(add_dialog_msg(json.message));
|
||||||
return dispatch(get_dio_info());
|
return dispatch(get_dio_info());
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -229,11 +239,11 @@ const dioinfo = (dod, did) => ({
|
|||||||
|
|
||||||
export const get_log_list = (p = 1) => dispatch => {
|
export const get_log_list = (p = 1) => dispatch => {
|
||||||
dispatch(toggle_loading(1));
|
dispatch(toggle_loading(1));
|
||||||
return fetch('/api/log/getlog', getRequest({p}))
|
return fetch('/api/log/getlog', getRequest({ p }))
|
||||||
.then(response => response.json())
|
.then(response => response.json())
|
||||||
.then(json => {
|
.then(json => {
|
||||||
dispatch(toggle_loading(0));
|
dispatch(toggle_loading(0));
|
||||||
if(json.status != 1) return dispatch(add_dialog_msg(json.message));
|
if (json.status != 1) return dispatch(add_dialog_msg(json.message));
|
||||||
return dispatch(loglist(json.data.record, json.data.page));
|
return dispatch(loglist(json.data.record, json.data.page));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -251,9 +261,9 @@ export const scan_leone = (data) => (dispatch, getState) => {
|
|||||||
.then(response => response.json())
|
.then(response => response.json())
|
||||||
.then(json => {
|
.then(json => {
|
||||||
dispatch(toggle_loading(0));
|
dispatch(toggle_loading(0));
|
||||||
if(json.status != 1) return dispatch(add_dialog_msg(json.message));
|
if (json.status != 1) return dispatch(add_dialog_msg(json.message));
|
||||||
let {i18n} = getState();
|
let { i18n } = getState();
|
||||||
if(json.data.record.length == 0) return dispatch(add_dialog_msg(i18n&&i18n.t? i18n.t('tip.scan_empty') : ''));
|
if (json.data.record.length == 0) return dispatch(add_dialog_msg(i18n && i18n.t ? i18n.t('tip.scan_empty') : ''));
|
||||||
return dispatch(show_scan_leone(json.data.record));
|
return dispatch(show_scan_leone(json.data.record));
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -264,7 +274,7 @@ export const clear_scan_leone = (clrRemote = false) => dispatch => {
|
|||||||
return fetch('/api/leone/clearscanleone', getRequest())
|
return fetch('/api/leone/clearscanleone', getRequest())
|
||||||
.then(response => response.json())
|
.then(response => response.json())
|
||||||
.then(json => {
|
.then(json => {
|
||||||
return ;
|
return;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -276,18 +286,18 @@ export const add_scan_leone = (data) => dispatch => {
|
|||||||
.then(json => {
|
.then(json => {
|
||||||
dispatch(toggle_loading(0));
|
dispatch(toggle_loading(0));
|
||||||
dispatch(clear_scan());
|
dispatch(clear_scan());
|
||||||
if(json.status != 1) return dispatch(add_dialog_msg(json.message));
|
if (json.status != 1) return dispatch(add_dialog_msg(json.message));
|
||||||
return dispatch(get_leone_list());
|
return dispatch(get_leone_list());
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
export const get_leone_list = (showLoading = true) => dispatch => {
|
export const get_leone_list = (showLoading = true) => dispatch => {
|
||||||
if(showLoading) dispatch(toggle_loading(1));
|
if (showLoading) dispatch(toggle_loading(1));
|
||||||
return fetch('/api/leone/getleonelist', getRequest())
|
return fetch('/api/leone/getleonelist', getRequest())
|
||||||
.then(response => response.json())
|
.then(response => response.json())
|
||||||
.then(json => {
|
.then(json => {
|
||||||
dispatch(toggle_loading(0));
|
dispatch(toggle_loading(0));
|
||||||
if(json.status != 1) return dispatch(add_dialog_msg(json.message));
|
if (json.status != 1) return dispatch(add_dialog_msg(json.message));
|
||||||
return dispatch(leone_list(json.data.record, json.data.rt.status));
|
return dispatch(leone_list(json.data.record, json.data.rt.status));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -310,7 +320,7 @@ const leone_api = (url, data) => dispatch => {
|
|||||||
.then(response => response.json())
|
.then(response => response.json())
|
||||||
.then(json => {
|
.then(json => {
|
||||||
dispatch(toggle_loading(0));
|
dispatch(toggle_loading(0));
|
||||||
if(json.status != 1) return dispatch(add_dialog_msg(json.message));
|
if (json.status != 1) return dispatch(add_dialog_msg(json.message));
|
||||||
return dispatch(get_leone_list());
|
return dispatch(get_leone_list());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -340,8 +350,8 @@ export const io_cmd = (data, cb = null) => dispatch => {
|
|||||||
.then(response => response.json())
|
.then(response => response.json())
|
||||||
.then(json => {
|
.then(json => {
|
||||||
dispatch(toggle_loading(0));
|
dispatch(toggle_loading(0));
|
||||||
if(json.status != 1) return dispatch(add_dialog_msg(json.message));
|
if (json.status != 1) return dispatch(add_dialog_msg(json.message));
|
||||||
if(cb && typeof cb == 'function') return cb();
|
if (cb && typeof cb == 'function') return cb();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -351,7 +361,7 @@ export const get_iogroup_list = () => dispatch => {
|
|||||||
.then(response => response.json())
|
.then(response => response.json())
|
||||||
.then(json => {
|
.then(json => {
|
||||||
dispatch(toggle_loading(0));
|
dispatch(toggle_loading(0));
|
||||||
if(json.status != 1) return dispatch(add_dialog_msg(json.message));
|
if (json.status != 1) return dispatch(add_dialog_msg(json.message));
|
||||||
return dispatch(iogroup_list(json.data.record, json.data.rt.do, json.data.rt.leone));
|
return dispatch(iogroup_list(json.data.record, json.data.rt.do, json.data.rt.leone));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -369,7 +379,7 @@ const group_api = (url, data) => dispatch => {
|
|||||||
.then(response => response.json())
|
.then(response => response.json())
|
||||||
.then(json => {
|
.then(json => {
|
||||||
dispatch(toggle_loading(0));
|
dispatch(toggle_loading(0));
|
||||||
if(json.status != 1) return dispatch(add_dialog_msg(json.message));
|
if (json.status != 1) return dispatch(add_dialog_msg(json.message));
|
||||||
return dispatch(get_iogroup_list());
|
return dispatch(get_iogroup_list());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -390,7 +400,7 @@ export const get_select_list = (data) => dispatch => {
|
|||||||
return fetch('/api/system/getselectlist', getRequest(data))
|
return fetch('/api/system/getselectlist', getRequest(data))
|
||||||
.then(response => response.json())
|
.then(response => response.json())
|
||||||
.then(json => {
|
.then(json => {
|
||||||
if(json.status != 1) return dispatch(add_dialog_msg(json.message));
|
if (json.status != 1) return dispatch(add_dialog_msg(json.message));
|
||||||
return dispatch(select_list(json.data.record || []));
|
return dispatch(select_list(json.data.record || []));
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -409,7 +419,7 @@ const schedule_api = (url, data) => dispatch => {
|
|||||||
.then(response => response.json())
|
.then(response => response.json())
|
||||||
.then(json => {
|
.then(json => {
|
||||||
dispatch(toggle_loading(0));
|
dispatch(toggle_loading(0));
|
||||||
if(json.status != 1) return dispatch(add_dialog_msg(json.message));
|
if (json.status != 1) return dispatch(add_dialog_msg(json.message));
|
||||||
return dispatch(get_schedule_list());
|
return dispatch(get_schedule_list());
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -428,7 +438,7 @@ export const get_schedule_list = () => dispatch => {
|
|||||||
.then(response => response.json())
|
.then(response => response.json())
|
||||||
.then(json => {
|
.then(json => {
|
||||||
dispatch(toggle_loading(0));
|
dispatch(toggle_loading(0));
|
||||||
if(json.status != 1) return dispatch(add_dialog_msg(json.message));
|
if (json.status != 1) return dispatch(add_dialog_msg(json.message));
|
||||||
return dispatch(schedule_list(json.data.record || [], json.data.rt.do || [], json.data.rt.leone || [], json.data.rt.iogroup || []));
|
return dispatch(schedule_list(json.data.record || [], json.data.rt.do || [], json.data.rt.leone || [], json.data.rt.iogroup || []));
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -452,7 +462,7 @@ export const clear_userlist = () => ({
|
|||||||
export const clear_dio = () => ({
|
export const clear_dio = () => ({
|
||||||
type: 'clear_dio'
|
type: 'clear_dio'
|
||||||
});
|
});
|
||||||
export const clear_leone =() => ({
|
export const clear_leone = () => ({
|
||||||
type: 'clear_leone'
|
type: 'clear_leone'
|
||||||
});
|
});
|
||||||
export const clear_log = () => ({
|
export const clear_log = () => ({
|
||||||
@@ -471,7 +481,7 @@ export const get_modbus_list = () => dispatch => {
|
|||||||
.then(response => response.json())
|
.then(response => response.json())
|
||||||
.then(json => {
|
.then(json => {
|
||||||
dispatch(toggle_loading(0));
|
dispatch(toggle_loading(0));
|
||||||
if(json.status != 1 ) return dispatch(add_dialog_msg(json.message));
|
if (json.status != 1) return dispatch(add_dialog_msg(json.message));
|
||||||
dispatch(modbus_list(json.data.record || []));
|
dispatch(modbus_list(json.data.record || []));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -491,7 +501,7 @@ const modbus_api = (url, data) => dispatch => {
|
|||||||
.then(response => response.json())
|
.then(response => response.json())
|
||||||
.then(json => {
|
.then(json => {
|
||||||
dispatch(toggle_loading(0));
|
dispatch(toggle_loading(0));
|
||||||
if(json.status != 1) return dispatch(add_dialog_msg(json.message));
|
if (json.status != 1) return dispatch(add_dialog_msg(json.message));
|
||||||
dispatch(get_modbus_list());
|
dispatch(get_modbus_list());
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -514,7 +524,7 @@ export const get_mb_data = data => dispatch => {
|
|||||||
.then(response => response.json())
|
.then(response => response.json())
|
||||||
.then(json => {
|
.then(json => {
|
||||||
dispatch(toggle_loading(0));
|
dispatch(toggle_loading(0));
|
||||||
if(json.status != 1) return dispatch(add_dialog_msg(json.message));
|
if (json.status != 1) return dispatch(add_dialog_msg(json.message));
|
||||||
dispatch(mb_data(data.id, json.data.rt.iolist || [], json.data.rt.aioset || []));
|
dispatch(mb_data(data.id, json.data.rt.iolist || [], json.data.rt.aioset || []));
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -530,7 +540,7 @@ export const get_mb_iostatus = data => dispatch => {
|
|||||||
return fetch('/api/modbus/getiostatus', getRequest(data))
|
return fetch('/api/modbus/getiostatus', getRequest(data))
|
||||||
.then(response => response.json())
|
.then(response => response.json())
|
||||||
.then(json => {
|
.then(json => {
|
||||||
if(json.status != 1) return dispatch(add_dialog_msg(json.message));
|
if (json.status != 1) return dispatch(add_dialog_msg(json.message));
|
||||||
dispatch(mb_iostatus(data.id, data.type, json.data.record || []));
|
dispatch(mb_iostatus(data.id, data.type, json.data.record || []));
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -548,8 +558,8 @@ const mb_iolist_api = (url, data) => dispatch => {
|
|||||||
.then(response => response.json())
|
.then(response => response.json())
|
||||||
.then(json => {
|
.then(json => {
|
||||||
dispatch(toggle_loading(0));
|
dispatch(toggle_loading(0));
|
||||||
if(json.status != 1) return dispatch(add_dialog_msg(json.message));
|
if (json.status != 1) return dispatch(add_dialog_msg(json.message));
|
||||||
dispatch(get_mb_data({id: data.devuid}));
|
dispatch(get_mb_data({ id: data.devuid }));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -559,8 +569,8 @@ const mb_aio_api = (url, data) => dispatch => {
|
|||||||
.then(response => response.json())
|
.then(response => response.json())
|
||||||
.then(json => {
|
.then(json => {
|
||||||
dispatch(toggle_loading(0));
|
dispatch(toggle_loading(0));
|
||||||
if(json.status != 1) return dispatch(add_dialog_msg(json.message));
|
if (json.status != 1) return dispatch(add_dialog_msg(json.message));
|
||||||
dispatch(get_mb_data({id: data.devuid}));
|
dispatch(get_mb_data({ id: data.devuid }));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -584,13 +594,29 @@ export const del_mb_aio = data => dispatch => {
|
|||||||
return dispatch(mb_aio_api('/api/modbus/delaioset', data));
|
return dispatch(mb_aio_api('/api/modbus/delaioset', data));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const get_mb_log = data => dispatch => {
|
||||||
|
dispatch(toggle_loading(1));
|
||||||
|
return fetch('/api/modbus/getmodbuslog', getRequest(data))
|
||||||
|
.then(response => response.json())
|
||||||
|
.then(json => {
|
||||||
|
dispatch(toggle_loading(0));
|
||||||
|
if (json.status != 1) return dispatch(add_dialog_msg(json.message));
|
||||||
|
dispatch(mb_log(json.data.record || []));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
const mb_log = (list) => ({
|
||||||
|
type: 'mb_log',
|
||||||
|
list
|
||||||
|
});
|
||||||
|
|
||||||
export const get_link_list = () => dispatch => {
|
export const get_link_list = () => dispatch => {
|
||||||
dispatch(toggle_loading(1));
|
dispatch(toggle_loading(1));
|
||||||
return fetch('/api/link/getlinklist', getRequest())
|
return fetch('/api/link/getlinklist', getRequest())
|
||||||
.then(response => response.json())
|
.then(response => response.json())
|
||||||
.then(json => {
|
.then(json => {
|
||||||
dispatch(toggle_loading(0));
|
dispatch(toggle_loading(0));
|
||||||
if(json.status != 1) return dispatch(add_dialog_msg(json.message));
|
if (json.status != 1) return dispatch(add_dialog_msg(json.message));
|
||||||
dispatch(link_list(json.data.record || []))
|
dispatch(link_list(json.data.record || []))
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -607,7 +633,7 @@ const link_api = (url, data) => dispatch => {
|
|||||||
return fetch(url, getRequest(data))
|
return fetch(url, getRequest(data))
|
||||||
.then(response => response.json())
|
.then(response => response.json())
|
||||||
.then(json => {
|
.then(json => {
|
||||||
if(json.status != 1) return dispatch(add_dialog_msg(json.message));
|
if (json.status != 1) return dispatch(add_dialog_msg(json.message));
|
||||||
dispatch(get_link_list());
|
dispatch(get_link_list());
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -626,9 +652,9 @@ export const get_dashboard = () => dispatch => {
|
|||||||
return fetch('/api/system/dashboard', getRequest())
|
return fetch('/api/system/dashboard', getRequest())
|
||||||
.then(response => response.json())
|
.then(response => response.json())
|
||||||
.then(json => {
|
.then(json => {
|
||||||
if(json.status != 1) return dispatch(add_dialog_msg(json.message));
|
if (json.status != 1) return dispatch(add_dialog_msg(json.message));
|
||||||
let rt = json.data.rt;
|
let rt = json.data.rt;
|
||||||
dispatch(dashboard(rt.ip[0]? rt.ip[0].ip : '', rt.version[0]? rt.version[0].version : '', rt.di, rt.leone))
|
dispatch(dashboard(rt.ip[0] ? rt.ip[0].ip : '', rt.version[0] ? rt.version[0].version : '', rt.di, rt.leone))
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+9
-1
@@ -8,6 +8,7 @@ import routes from './routes';
|
|||||||
import thunk from 'redux-thunk';
|
import thunk from 'redux-thunk';
|
||||||
import {set_i18n} from './actions';
|
import {set_i18n} from './actions';
|
||||||
import i18next from 'i18next';
|
import i18next from 'i18next';
|
||||||
|
import {getRequest} from './actions';
|
||||||
|
|
||||||
const middleware = [thunk];
|
const middleware = [thunk];
|
||||||
|
|
||||||
@@ -34,7 +35,12 @@ const store = createStore(reducers, NODE_ENV && NODE_ENV == 'production' ? apply
|
|||||||
class PageRoot extends React.Component {
|
class PageRoot extends React.Component {
|
||||||
|
|
||||||
componentDidMount(){
|
componentDidMount(){
|
||||||
let lang = navigator
|
fetch('/api/system/chklogin', getRequest())
|
||||||
|
.then(response=>response.json())
|
||||||
|
.then(json => {
|
||||||
|
if(json.status != 1) return location.replace('/');
|
||||||
|
let slang = sessionStorage.getItem('lang');
|
||||||
|
let lang = slang || navigator
|
||||||
.language
|
.language
|
||||||
.substring(0, 2);
|
.substring(0, 2);
|
||||||
fetch(`/locales/${lang}.json`).then(response => {
|
fetch(`/locales/${lang}.json`).then(response => {
|
||||||
@@ -42,6 +48,7 @@ class PageRoot extends React.Component {
|
|||||||
return response.json();
|
return response.json();
|
||||||
return {}
|
return {}
|
||||||
}).then(json => {
|
}).then(json => {
|
||||||
|
let lang = Object.keys(json)[0] || '';
|
||||||
i18next.init({
|
i18next.init({
|
||||||
lng: lang,
|
lng: lang,
|
||||||
resources: json
|
resources: json
|
||||||
@@ -49,6 +56,7 @@ class PageRoot extends React.Component {
|
|||||||
store.dispatch(set_i18n(i18next));
|
store.dispatch(set_i18n(i18next));
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
|||||||
@@ -1,127 +0,0 @@
|
|||||||
import React from 'react';
|
|
||||||
import {Form, Button, Input, Segment} from 'semantic-ui-react';
|
|
||||||
|
|
||||||
class ActionSelect extends React.Component{
|
|
||||||
state = {
|
|
||||||
showTemp: false,
|
|
||||||
temp: '0'
|
|
||||||
}
|
|
||||||
|
|
||||||
checkShowTemp = (cmd = '') => {
|
|
||||||
let c = cmd;
|
|
||||||
let cs = c.split(' ');
|
|
||||||
let showTemp = false;
|
|
||||||
if(cs[0] == 2) {
|
|
||||||
showTemp = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.setState({
|
|
||||||
showTemp
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
updateTemp = (temp) => {
|
|
||||||
this.setState({
|
|
||||||
temp
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
render(){
|
|
||||||
let {i18n,list, unit, getList, addAction} = this.props;
|
|
||||||
let actlist = i18n&&i18n.getResource&&i18n.language ? i18n.getResource(i18n.language + '.translation.action_list') : [];
|
|
||||||
return (
|
|
||||||
<Form.Field>
|
|
||||||
<label>加入動作</label>
|
|
||||||
<Segment color="green" className="clearfix">
|
|
||||||
<Form.Group inline>
|
|
||||||
<Form.Field>
|
|
||||||
<label>選擇裝置</label>
|
|
||||||
<select ref="devType" onChange={e=>{
|
|
||||||
getList(unit, e.target.value);
|
|
||||||
}}>
|
|
||||||
<option value="">選擇裝置類型</option>
|
|
||||||
<option value="do">DigitOutput</option>
|
|
||||||
<option value="leone">LeOne</option>
|
|
||||||
<option value="iogroup">IOGroup</option>
|
|
||||||
</select>
|
|
||||||
</Form.Field>
|
|
||||||
<Form.Field>
|
|
||||||
<select ref="devName">
|
|
||||||
<option value="">選擇裝置</option>
|
|
||||||
{
|
|
||||||
list.map((t,idx)=>(<option key={idx} value={t.id}>{t.name}</option>))
|
|
||||||
}
|
|
||||||
</select>
|
|
||||||
</Form.Field>
|
|
||||||
</Form.Group>
|
|
||||||
<Form.Group inline>
|
|
||||||
<Form.Field>
|
|
||||||
<label>選擇動作</label>
|
|
||||||
<select ref="act" onChange={e=>{
|
|
||||||
this.checkShowTemp(e.target.value);
|
|
||||||
}}>
|
|
||||||
<option value="">選擇動作</option>
|
|
||||||
{
|
|
||||||
actlist.map((t,idx) => (
|
|
||||||
<option key={idx} value={t.cmd}>{t.name}</option>
|
|
||||||
))
|
|
||||||
}
|
|
||||||
</select>
|
|
||||||
</Form.Field>
|
|
||||||
{
|
|
||||||
this.state.showTemp ?
|
|
||||||
(
|
|
||||||
<Form.Field>
|
|
||||||
<Input size="mini" placeholder="請輸入溫度" value={this.state.temp} onChange={(e,d) => {
|
|
||||||
this.updateTemp(d.value);
|
|
||||||
}} />
|
|
||||||
</Form.Field>
|
|
||||||
) : null
|
|
||||||
}
|
|
||||||
</Form.Group>
|
|
||||||
<Button floated="right" content="加入動作" size="tiny" basic color="orange" onClick={()=>{
|
|
||||||
let type = this.refs.devType.value;
|
|
||||||
let dev = this.refs.devName.value;
|
|
||||||
let devName = this.refs.devName.options[this.refs.devName.selectedIndex].innerHTML;
|
|
||||||
let act = this.refs.act.value;
|
|
||||||
let actName = this.refs.act.options[this.refs.act.selectedIndex].innerHTML;
|
|
||||||
let temp = this.state.temp;
|
|
||||||
let prefix = '';
|
|
||||||
|
|
||||||
switch(type){
|
|
||||||
case 'do':
|
|
||||||
prefix = 'do';
|
|
||||||
break;
|
|
||||||
case 'leone':
|
|
||||||
prefix = 'le';
|
|
||||||
break;
|
|
||||||
case 'iogroup':
|
|
||||||
prefix = 'iogroup';
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
return addAction(null);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!act) return addAction(null);
|
|
||||||
if(act == 2) {
|
|
||||||
act = `${act} ${temp}`;
|
|
||||||
actName += ` ${temp}`;
|
|
||||||
}
|
|
||||||
|
|
||||||
let data = {
|
|
||||||
id: `${prefix}${dev}`,
|
|
||||||
act,
|
|
||||||
actName,
|
|
||||||
devName
|
|
||||||
};
|
|
||||||
|
|
||||||
return addAction(data);
|
|
||||||
|
|
||||||
}} />
|
|
||||||
</Segment>
|
|
||||||
</Form.Field>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export default ActionSelect;
|
|
||||||
@@ -1,279 +0,0 @@
|
|||||||
import React from 'react';
|
|
||||||
import {Grid, Form, Segment, Input} from 'semantic-ui-react';
|
|
||||||
|
|
||||||
const ops = [
|
|
||||||
{
|
|
||||||
"code": "0",
|
|
||||||
"name": "等於"
|
|
||||||
}, {
|
|
||||||
"code": "1",
|
|
||||||
"name": "大於"
|
|
||||||
}, {
|
|
||||||
"code": "2",
|
|
||||||
"name": "小於"
|
|
||||||
}, {
|
|
||||||
"code": "3",
|
|
||||||
"name": "大於等於"
|
|
||||||
}, {
|
|
||||||
"code": "4",
|
|
||||||
"name": "小於等於"
|
|
||||||
}, {
|
|
||||||
"code": "5",
|
|
||||||
"name": "不等於"
|
|
||||||
}, {
|
|
||||||
"code": "8",
|
|
||||||
"name": "AND"
|
|
||||||
}, {
|
|
||||||
"code": "9",
|
|
||||||
"name": "OR"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
|
|
||||||
const stype = {
|
|
||||||
di: {
|
|
||||||
prefix: 'di',
|
|
||||||
dev: '',
|
|
||||||
op: '',
|
|
||||||
value: '',
|
|
||||||
mode: 'di_status'
|
|
||||||
},
|
|
||||||
leone: {
|
|
||||||
prefix: 'le',
|
|
||||||
dev: '',
|
|
||||||
op: '',
|
|
||||||
value: '',
|
|
||||||
mode: ''
|
|
||||||
},
|
|
||||||
unit: {
|
|
||||||
dev: ''
|
|
||||||
},
|
|
||||||
time: {
|
|
||||||
op: '',
|
|
||||||
dev: 'dt0',
|
|
||||||
mode: 'mode0',
|
|
||||||
year: '-',
|
|
||||||
week: '-',
|
|
||||||
month: '-',
|
|
||||||
day: '-',
|
|
||||||
hour: '-',
|
|
||||||
min: '-'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class UnitItem extends React.Component {
|
|
||||||
|
|
||||||
state = {
|
|
||||||
st: '',
|
|
||||||
data:{}
|
|
||||||
}
|
|
||||||
|
|
||||||
handleDataChange = (tag, value) => {
|
|
||||||
let {data} = this.state;
|
|
||||||
let {updateData} = this.props;
|
|
||||||
if(tag in data) {
|
|
||||||
data[tag] = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.setState({
|
|
||||||
data
|
|
||||||
}, () => {
|
|
||||||
let {data} = this.state
|
|
||||||
let d = {...this.props.data.data}
|
|
||||||
let {st} = this.props.data;
|
|
||||||
|
|
||||||
if(st == 'di' || st == 'leone'){
|
|
||||||
d.id = `${data.prefix}${data.dev},${data.mode}`;
|
|
||||||
d.op = data.op;
|
|
||||||
d.value = data.value;
|
|
||||||
}
|
|
||||||
if(st == 'unit') {
|
|
||||||
d.dev = data.dev;
|
|
||||||
}
|
|
||||||
if(st == 'time') {
|
|
||||||
d.id = `${data.dev},${data.mode}`;
|
|
||||||
d.op = data.op;
|
|
||||||
d.value = `${data.min}|${data.hour}|${data.day}|${data.month}|${data.week}|${data.year}`;
|
|
||||||
}
|
|
||||||
|
|
||||||
updateData(this.props.unit, d);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
componentWillReceiveProps(np) {
|
|
||||||
let data = {...this.state.data};
|
|
||||||
|
|
||||||
if(np.data.st != this.state.st){
|
|
||||||
|
|
||||||
if(np.data.st in stype) {
|
|
||||||
data = {...stype[np.data.st]};
|
|
||||||
}else {
|
|
||||||
data = {}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
this.setState({
|
|
||||||
data,
|
|
||||||
st: np.data.st
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
render() {
|
|
||||||
let {unit, data, getList} = this.props;
|
|
||||||
|
|
||||||
return (
|
|
||||||
<Grid.Column>
|
|
||||||
<Segment>
|
|
||||||
<Form.Field>
|
|
||||||
<label>選擇元件</label>
|
|
||||||
<select
|
|
||||||
value={data.st}
|
|
||||||
onChange={e => {
|
|
||||||
getList(unit, e.target.value);
|
|
||||||
}}>
|
|
||||||
<option value="">請選擇元件</option>
|
|
||||||
<option value="leone">LeOne</option>
|
|
||||||
<option value="di">DigitInput</option>
|
|
||||||
<option value="time">時間</option>
|
|
||||||
<option value="unit">已建立群組</option>
|
|
||||||
</select>
|
|
||||||
</Form.Field>
|
|
||||||
{
|
|
||||||
!data.st
|
|
||||||
? null
|
|
||||||
: (<UnitPanel data={data} state={this.state.data} dataChange={this.handleDataChange}/>)
|
|
||||||
}
|
|
||||||
</Segment>
|
|
||||||
</Grid.Column>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const UnitPanel = ({data, state, dataChange}) => {
|
|
||||||
if (data.st == 'di') {
|
|
||||||
return (
|
|
||||||
<div>
|
|
||||||
<select value={state.dev} onChange={(e) => {
|
|
||||||
dataChange('dev', e.target.value);
|
|
||||||
}}>
|
|
||||||
<option value="">選擇裝置</option>
|
|
||||||
{
|
|
||||||
data.list.map((t, idx) => (
|
|
||||||
<option key={idx} value={t.id}>{t.name}</option>
|
|
||||||
))
|
|
||||||
}
|
|
||||||
</select>
|
|
||||||
<select value={state.op} onChange={e => {
|
|
||||||
dataChange('op', e.target.value);
|
|
||||||
}}>
|
|
||||||
<option value="">選擇條件</option>
|
|
||||||
{
|
|
||||||
ops.map((t,idx) => {
|
|
||||||
if(t.code == 8 || t.code == 9) return ;
|
|
||||||
return (<option key={idx} value={t.code}>{t.name}</option>)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
</select>
|
|
||||||
<select value={state.value} onChange={e => {
|
|
||||||
dataChange('value', e.target.value);
|
|
||||||
}}>
|
|
||||||
<option value="">選擇狀態</option>
|
|
||||||
<option value="0">0</option>
|
|
||||||
<option value="1">1</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
if(data.st == 'leone') {
|
|
||||||
return (
|
|
||||||
<div>
|
|
||||||
<select value={state.dev} onChange={e => {
|
|
||||||
dataChange('dev', e.target.value);
|
|
||||||
}}>
|
|
||||||
<option value="">選擇裝置</option>
|
|
||||||
{
|
|
||||||
data.list.map((t, idx) => (
|
|
||||||
<option key={idx} value={t.id}>{t.name}</option>
|
|
||||||
))
|
|
||||||
}
|
|
||||||
</select>
|
|
||||||
<select value={state.mode} onChange={e => {
|
|
||||||
dataChange('mode', e.target.value);
|
|
||||||
}}>
|
|
||||||
<option value="">選擇感測器</option>
|
|
||||||
<option value="leone_ttrigger1">溫度</option>
|
|
||||||
<option value="leone_htrigger1">濕度</option>
|
|
||||||
</select>
|
|
||||||
<select value={state.op} onChange={e => {
|
|
||||||
dataChange('op', e.target.value);
|
|
||||||
}}>
|
|
||||||
<option value="">選擇條件</option>
|
|
||||||
{
|
|
||||||
ops.map((t,idx) => {
|
|
||||||
if(t.code == 8 || t.code == 9) return ;
|
|
||||||
return (<option key={idx} value={t.code}>{t.name}</option>)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
</select>
|
|
||||||
<Input size="mini" placeholder="請輸入數值" value={state.value} onChange={(e,d) => {
|
|
||||||
dataChange('value', d.value);
|
|
||||||
}} />
|
|
||||||
</div>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
if(data.st == 'unit') {
|
|
||||||
return (
|
|
||||||
<div>
|
|
||||||
<select value={state.dev} onChange={e => {
|
|
||||||
dataChange('dev', e.target.value);
|
|
||||||
}}>
|
|
||||||
<option value="">選擇群組</option>
|
|
||||||
{
|
|
||||||
data.list.map((t,idx) => (
|
|
||||||
<option key={idx} value={t.id}>{t.name}</option>
|
|
||||||
))
|
|
||||||
}
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
if(data.st == 'time') {
|
|
||||||
return (
|
|
||||||
<div>
|
|
||||||
<select value={state.op} onChange={e => {
|
|
||||||
dataChange('op', e.target.value);
|
|
||||||
}}>
|
|
||||||
<option value="">選擇條件</option>
|
|
||||||
{
|
|
||||||
ops.map((t,idx) => {
|
|
||||||
if(t.code == 8 || t.code == 9) return ;
|
|
||||||
return (<option key={idx} value={t.code}>{t.name}</option>)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
</select>
|
|
||||||
<Input size="mini" placeholder="年(不指定請留空)" value={state.year == '-' ? '' : state.year} onChange={(e,d) => {
|
|
||||||
dataChange('year', d.value.length == 0 ? '-' : d.value);
|
|
||||||
}} />
|
|
||||||
<Input size="mini" placeholder="週(不指定請留空)" value={state.week == '-' ? '' : state.week} onChange={(e,d) => {
|
|
||||||
dataChange('week', d.value.length == 0 ? '-' : d.value);
|
|
||||||
}} />
|
|
||||||
<Input size="mini" placeholder="月(不指定請留空)" value={state.month == '-' ? '' : state.month} onChange={(e,d) => {
|
|
||||||
dataChange('month', d.value.length == 0 ? '-' : d.value);
|
|
||||||
}} />
|
|
||||||
<Input size="mini" placeholder="日(不指定請留空)" value={state.day == '-' ? '' : state.day} onChange={(e,d) => {
|
|
||||||
dataChange('day', d.value.length == 0 ? '-' : d.value);
|
|
||||||
}} />
|
|
||||||
<Input size="mini" placeholder="時(不指定請留空)" value={state.hour == '-' ? '' : state.hour} onChange={(e,d) => {
|
|
||||||
dataChange('hour', d.value.length == 0 ? '-' : d.value);
|
|
||||||
}} />
|
|
||||||
<Input size="mini" placeholder="分(不指定請留空)" value={state.min == '-' ? '' : state.min} onChange={(e,d) => {
|
|
||||||
dataChange('min', d.value.length == 0 ? '-' : d.value);
|
|
||||||
}} />
|
|
||||||
</div>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
export default UnitItem;
|
|
||||||
@@ -1,41 +0,0 @@
|
|||||||
import React from 'react';
|
|
||||||
import {Modal, Form, Button} from 'semantic-ui-react';
|
|
||||||
|
|
||||||
const ViewTree = ({i18n, open, data, closeView, removeNode}) => {
|
|
||||||
let seNode = null;
|
|
||||||
let nodeKey = Object.keys(data);
|
|
||||||
return (
|
|
||||||
<Modal open={open} onClose={()=>{closeView()}} >
|
|
||||||
<Modal.Header content="連動群組資料" />
|
|
||||||
<Modal.Content>
|
|
||||||
<Form as="div">
|
|
||||||
<Form.Group inline>
|
|
||||||
<Form.Field>
|
|
||||||
<label>刪除節點</label>
|
|
||||||
<select ref={node=>seNode=node}>
|
|
||||||
{
|
|
||||||
nodeKey.map((t,idx)=>(
|
|
||||||
<option key={idx} value={t}>{data[t].name}</option>
|
|
||||||
))
|
|
||||||
}
|
|
||||||
</select>
|
|
||||||
</Form.Field>
|
|
||||||
<Form.Field>
|
|
||||||
<Button type="button" basic size="tiny" content="刪除節點" onClick={()=>{
|
|
||||||
if(!seNode) return ;
|
|
||||||
removeNode(seNode.value);
|
|
||||||
}} />
|
|
||||||
</Form.Field>
|
|
||||||
</Form.Group>
|
|
||||||
</Form>
|
|
||||||
<pre>
|
|
||||||
{
|
|
||||||
JSON.stringify(data, null, 4)
|
|
||||||
}
|
|
||||||
</pre>
|
|
||||||
</Modal.Content>
|
|
||||||
</Modal>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
export default ViewTree;
|
|
||||||
@@ -1,353 +0,0 @@
|
|||||||
import React from 'react';
|
|
||||||
import {
|
|
||||||
Container,
|
|
||||||
Segment,
|
|
||||||
Form,
|
|
||||||
Input,
|
|
||||||
Button,
|
|
||||||
Checkbox,
|
|
||||||
Grid,
|
|
||||||
Menu,
|
|
||||||
List
|
|
||||||
} from 'semantic-ui-react';
|
|
||||||
import {getRequest} from '../../../actions';
|
|
||||||
import UnitItem from './UnitItem';
|
|
||||||
import ActionSelect from './ActionSelect';
|
|
||||||
import ActionItem from './ActionItem';
|
|
||||||
import ViewTree from './ViewTreeModal';
|
|
||||||
|
|
||||||
const defState = () => ({
|
|
||||||
gidx: 0,
|
|
||||||
groups: {},
|
|
||||||
active: false,
|
|
||||||
edit: {
|
|
||||||
name: '',
|
|
||||||
type: 'ln',
|
|
||||||
op: '',
|
|
||||||
id1: {
|
|
||||||
st: '',
|
|
||||||
list: [],
|
|
||||||
data: {}
|
|
||||||
},
|
|
||||||
id2: {
|
|
||||||
st: '',
|
|
||||||
list: [],
|
|
||||||
data: {}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
actDevlist: [],
|
|
||||||
items: [],
|
|
||||||
showTree: false
|
|
||||||
})
|
|
||||||
const gtype = {
|
|
||||||
lc: {
|
|
||||||
type: 'lc',
|
|
||||||
id: '',
|
|
||||||
op: '',
|
|
||||||
value: ''
|
|
||||||
},
|
|
||||||
ln: {
|
|
||||||
type: 'ln',
|
|
||||||
dev: ''
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class ActionLinkAdd extends React.Component {
|
|
||||||
state = {
|
|
||||||
...defState()
|
|
||||||
}
|
|
||||||
|
|
||||||
getSelectList = (unit, type = '') => {
|
|
||||||
if (!unit) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if(unit != 'act'){
|
|
||||||
let edit = {
|
|
||||||
...this.state.edit
|
|
||||||
};
|
|
||||||
if (!(unit in edit)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
edit[unit].st = type;
|
|
||||||
edit[unit].data = {
|
|
||||||
...gtype.lc
|
|
||||||
}
|
|
||||||
if (type != 'di' && type != 'leone' && type != 'unit') {
|
|
||||||
return this.setState({edit});
|
|
||||||
}
|
|
||||||
|
|
||||||
if (type == 'di' || type == 'leone') {
|
|
||||||
this.props.toggleLoading(1);
|
|
||||||
let json = {
|
|
||||||
type
|
|
||||||
};
|
|
||||||
fetch('/api/system/getselectlist', getRequest(json))
|
|
||||||
.then(response => response.json())
|
|
||||||
.then(json => {
|
|
||||||
if (json.status != 1)
|
|
||||||
return this.props.showDialog(json.message);
|
|
||||||
edit[unit].list = json.data.record || [];
|
|
||||||
this.setState({edit}, () => {
|
|
||||||
this.props.toggleLoading(0);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
if(type == 'unit') {
|
|
||||||
let list = [];
|
|
||||||
for(let i in this.state.groups){
|
|
||||||
list.push({id: i, name: this.state.groups[i].name});
|
|
||||||
}
|
|
||||||
edit[unit].list = list;
|
|
||||||
edit[unit].data = {
|
|
||||||
...gtype.ln
|
|
||||||
}
|
|
||||||
this.setState({edit})
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
let actDevlist = [];
|
|
||||||
if(!type) {
|
|
||||||
this.setState({
|
|
||||||
actDevlist
|
|
||||||
});
|
|
||||||
return ;
|
|
||||||
}
|
|
||||||
this.props.toggleLoading(1);
|
|
||||||
fetch('/api/system/getselectlist', getRequest({type}))
|
|
||||||
.then(response => response.json())
|
|
||||||
.then(json => {
|
|
||||||
if (json.status != 1)
|
|
||||||
return this.props.showDialog(json.message);
|
|
||||||
actDevlist = json.data.record || []
|
|
||||||
this.setState({
|
|
||||||
actDevlist
|
|
||||||
}, ()=>{
|
|
||||||
this.props.toggleLoading(0);
|
|
||||||
})
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
updateData = (unit, data) => {
|
|
||||||
let {edit} = this.state;
|
|
||||||
if(!(unit in edit)) return ;
|
|
||||||
edit[unit].data = data;
|
|
||||||
|
|
||||||
this.setState({
|
|
||||||
edit
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
updateEditData = (tag, value) => {
|
|
||||||
let {edit} = this.state;
|
|
||||||
if(tag in edit){
|
|
||||||
edit[tag] = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.setState({
|
|
||||||
edit
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
updateActive = (active = false) => {
|
|
||||||
this.setState({
|
|
||||||
active: active ? 1 : 0
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
joinUnit = () => {
|
|
||||||
let {edit} = this.state;
|
|
||||||
let {i18n} = this.props;
|
|
||||||
if(!edit.name || edit.op.length == 0 || Object.keys(edit.id1.data).length == 0 || Object.keys(edit.id2.data).length == 0) return this.props.showDialog(i18n&&i18n.t ? i18n.t('tip.input_empty') : '');
|
|
||||||
if(edit.id1.data.type == 'lc' && (edit.id1.data.id.length == 0 || edit.id1.data.op.length == 0 || edit.id1.data.value.length == 0)) return this.props.showDialog(i18n&&i18n.t ? i18n.t('tip.input_empty') : '');
|
|
||||||
if(edit.id2.data.type == 'lc' && (edit.id2.data.id.length == 0 || edit.id2.data.op.length == 0 || edit.id2.data.value.length == 0)) return this.props.showDialog(i18n&&i18n.t ? i18n.t('tip.input_empty') : '');
|
|
||||||
if(edit.id1.data.type == 'ln' && edit.id1.data.dev.length == 0) return this.props.showDialog(i18n&&i18n.t ? i18n.t('tip.input_empty') : '');
|
|
||||||
if(edit.id2.data.type == 'ln' && edit.id2.data.dev.length == 0) return this.props.showDialog(i18n&&i18n.t ? i18n.t('tip.input_empty') : '');
|
|
||||||
|
|
||||||
let unitKey = [];
|
|
||||||
if(edit.id1.data.type == 'lc'){
|
|
||||||
edit.id1 = {
|
|
||||||
...edit.id1.data
|
|
||||||
}
|
|
||||||
}else if(edit.id1.data.type == 'ln'){
|
|
||||||
unitKey.push(edit.id1.data.dev)
|
|
||||||
edit.id1 = {
|
|
||||||
...this.state.groups[edit.id1.data.dev]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(edit.id2.data.type == 'lc'){
|
|
||||||
edit.id2 = {
|
|
||||||
...edit.id2.data
|
|
||||||
}
|
|
||||||
}else if(edit.id2.data.type == 'ln'){
|
|
||||||
unitKey.push(edit.id2.data.dev)
|
|
||||||
edit.id2 = {
|
|
||||||
...this.state.groups[edit.id2.data.dev]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
let groups = {...this.state.groups};
|
|
||||||
for(let i in unitKey){
|
|
||||||
if(unitKey[i] in groups) delete groups[unitKey[i]];
|
|
||||||
}
|
|
||||||
|
|
||||||
groups[`unit${this.state.gidx}`] = {
|
|
||||||
...edit
|
|
||||||
}
|
|
||||||
|
|
||||||
this.setState({
|
|
||||||
gidx: this.state.gidx+1,
|
|
||||||
groups: {...groups}
|
|
||||||
}, ()=>{
|
|
||||||
this.resetEdit()
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
resetEdit = () => {
|
|
||||||
this.setState({
|
|
||||||
edit:{
|
|
||||||
...defState().edit
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
addAction = (item) => {
|
|
||||||
if(!item) return this.props.showDialog('動作請選擇完整');
|
|
||||||
let cmds = item.act.split(' ');
|
|
||||||
if(cmds.length != 2) return this.props.showDialog('動作選擇錯誤');
|
|
||||||
if(cmds[0] == 2 && (cmds[1] < 16 || cmds[1] > 30)) return this.props.showDialog('溫度範圍錯誤(16-30)');
|
|
||||||
|
|
||||||
this.setState({
|
|
||||||
items: [...this.state.items, item]
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
removeAction = (idx) => {
|
|
||||||
let items = [...this.state.items];
|
|
||||||
items.splice(idx, 1);
|
|
||||||
this.setState({
|
|
||||||
items
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
toggleView = (sw = false) => {
|
|
||||||
this.setState({
|
|
||||||
showTree: sw ? true : false
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
removeNode = (node) => {
|
|
||||||
if(!node) return ;
|
|
||||||
let groups = {...this.state.groups};
|
|
||||||
if(node in groups){
|
|
||||||
delete groups[node];
|
|
||||||
this.setState({
|
|
||||||
groups: {...groups}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
saveLink = () => {
|
|
||||||
if(Object.keys(this.state.groups).length == 0) return this.props.showDialog('請先建立群組');
|
|
||||||
if(Object.keys(this.state.groups).length > 1) return this.props.showDialog('根節點數量大於一');
|
|
||||||
if(this.state.items.length == 0) return this.props.showDialog('請選擇動作');
|
|
||||||
let json = {
|
|
||||||
active: this.state.active,
|
|
||||||
link: this.state.groups[Object.keys(this.state.groups)[0]],
|
|
||||||
action: ''
|
|
||||||
}
|
|
||||||
|
|
||||||
let acts = this.state.items.map(t => {
|
|
||||||
return `${t.id},${t.act.replace(' ', ',')},0`
|
|
||||||
})
|
|
||||||
|
|
||||||
json.action = acts.join('|')
|
|
||||||
|
|
||||||
this.props.toggleLoading(1);
|
|
||||||
fetch('/api/link/addlink', getRequest(json))
|
|
||||||
.then(response => response.json())
|
|
||||||
.then(json => {
|
|
||||||
this.props.toggleLoading(0);
|
|
||||||
if(json.status != 1) return this.props.showDialog(json.message);
|
|
||||||
this.resetAll();
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
resetAll = () => {
|
|
||||||
this.setState({
|
|
||||||
...defState()
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
render() {
|
|
||||||
let {i18n} = this.props;
|
|
||||||
return (
|
|
||||||
<Container>
|
|
||||||
<Menu >
|
|
||||||
<Menu.Menu position="right">
|
|
||||||
<Menu.Item content="ShowTree" onClick={()=>{
|
|
||||||
this.toggleView(1)
|
|
||||||
}}/>
|
|
||||||
<Menu.Item content="Save" onClick={()=>{
|
|
||||||
this.saveLink();
|
|
||||||
}}/>
|
|
||||||
</Menu.Menu>
|
|
||||||
</Menu>
|
|
||||||
<Form as={Segment}>
|
|
||||||
<Form.Field>
|
|
||||||
<Checkbox label="啟用連動" checked={this.state.active == 1} onChange={(e,d) =>{
|
|
||||||
this.updateActive(d.checked ? 1 : 0);
|
|
||||||
}}/>
|
|
||||||
</Form.Field>
|
|
||||||
<Form.Field>
|
|
||||||
<label>建立條件群組</label>
|
|
||||||
<Segment color="red">
|
|
||||||
<Form.Field>
|
|
||||||
<Input label="節點名稱" value={this.state.edit.name} onChange={(e,d) => {
|
|
||||||
this.updateEditData('name', d.value);
|
|
||||||
}}/>
|
|
||||||
</Form.Field>
|
|
||||||
<Form.Field>
|
|
||||||
<label>觸發條件</label>
|
|
||||||
<select value={this.state.edit.op} onChange={(e) => {
|
|
||||||
this.updateEditData('op', e.target.value);
|
|
||||||
}}>
|
|
||||||
<option value="">請選擇觸發條件</option>
|
|
||||||
<option value="8">AND</option>
|
|
||||||
<option value="9">OR</option>
|
|
||||||
</select>
|
|
||||||
</Form.Field>
|
|
||||||
<Grid columns={2} padded>
|
|
||||||
<UnitItem unit="id1" data={this.state.edit.id1} getList={this.getSelectList} updateData={this.updateData}/>
|
|
||||||
<UnitItem unit="id2" data={this.state.edit.id2} getList={this.getSelectList} updateData={this.updateData}/>
|
|
||||||
</Grid>
|
|
||||||
<div
|
|
||||||
style={{
|
|
||||||
textAlign: 'right'
|
|
||||||
}}>
|
|
||||||
<Button type="button" basic size="tiny" color="blue" content="加入" onClick={()=>{
|
|
||||||
this.joinUnit();
|
|
||||||
}}/>
|
|
||||||
<Button type="button" basic size="tiny" color="green" content="清除" onClick={()=>{this.resetEdit()}}/>
|
|
||||||
</div>
|
|
||||||
</Segment>
|
|
||||||
</Form.Field>
|
|
||||||
<ActionSelect i18n={i18n} unit="act" list={this.state.actDevlist} getList={this.getSelectList} addAction={this.addAction} />
|
|
||||||
<Form.Field>
|
|
||||||
<label>裝置動作列表</label>
|
|
||||||
<Segment color="blue">
|
|
||||||
<List>
|
|
||||||
{
|
|
||||||
this.state.items.map((t,idx) => (
|
|
||||||
<ActionItem key={idx} i18n={i18n} data={t} idx={idx} removeAction={this.removeAction}/>
|
|
||||||
))
|
|
||||||
}
|
|
||||||
</List>
|
|
||||||
</Segment>
|
|
||||||
</Form.Field>
|
|
||||||
</Form>
|
|
||||||
<ViewTree i18n={i18n} data={this.state.groups} open={this.state.showTree} closeView={this.toggleView} removeNode={this.removeNode} />
|
|
||||||
</Container>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export default ActionLinkAdd;
|
|
||||||
+3
-3
@@ -1,17 +1,17 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import {List, Label, Button} from 'semantic-ui-react';
|
import {List, Label, Button} from 'semantic-ui-react';
|
||||||
|
|
||||||
const ActionItem = ({i18n, data, idx, removeAction}) => {
|
const ListItem = ({ i18n, data, idx, removeAction }) => {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<List.Item>
|
<List.Item>
|
||||||
<Label basic content={`裝置名稱`} /><span>{data.devName}</span>
|
<Label basic content={`裝置名稱`} /><span>{data.devName}</span>
|
||||||
<Label basic content={`動作`} /><span>{data.actName}</span>
|
<Label basic content={`動作`} /><span>{data.actName}</span>
|
||||||
<Button floated="right" color="red" basic size="tiny" content="Delete" type="button" onClick={()=>{
|
<Button floated="right" color="red" basic size="tiny" content="Delete" type="button" onClick={()=>{
|
||||||
removeAction(idx);
|
removeAction(idx)
|
||||||
}}/>
|
}}/>
|
||||||
</List.Item>
|
</List.Item>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
export default ActionItem;
|
export default ListItem;
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import {Segment, List} from 'semantic-ui-react';
|
||||||
|
import ListItem from './ListItem';
|
||||||
|
|
||||||
|
const ActionList = ({ i18n, list, removeAction }) => {
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Segment color="blue">
|
||||||
|
<List divided>
|
||||||
|
{
|
||||||
|
list.map((t,idx) => (
|
||||||
|
<ListItem key={idx} i18n={i18n} data={t} idx={idx} removeAction={removeAction} />
|
||||||
|
))
|
||||||
|
}
|
||||||
|
</List>
|
||||||
|
</Segment>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default ActionList;
|
||||||
@@ -0,0 +1,74 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import {Modal, Input, Button, Form, Grid} from 'semantic-ui-react';
|
||||||
|
|
||||||
|
const CalModal = ({ i18n, onClose, onSubmit }) => {
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Modal open={true}>
|
||||||
|
<Modal.Header content="數值換算" />
|
||||||
|
<Modal.Content>
|
||||||
|
<Form onSubmit={(e,d) => {
|
||||||
|
e.preventDefault();
|
||||||
|
onSubmit(d.formData);
|
||||||
|
}} serializer={e=>{
|
||||||
|
let json = {
|
||||||
|
r1: '',
|
||||||
|
r2: '',
|
||||||
|
s1: '',
|
||||||
|
s2: '',
|
||||||
|
val: ''
|
||||||
|
}
|
||||||
|
|
||||||
|
let r1 = e.querySelector('input[name="r1"]');
|
||||||
|
if(r1 && 'value' in r1) json.r1 = r1.value;
|
||||||
|
let r2 = e.querySelector('input[name="r2"]');
|
||||||
|
if(r2 && 'value' in r2) json.r2 = r2.value;
|
||||||
|
let s1 = e.querySelector('input[name="s1"]');
|
||||||
|
if(s1 && 'value' in s1) json.s1 = s1.value;
|
||||||
|
let s2 = e.querySelector('input[name="s2"]');
|
||||||
|
if(s2 && 'value' in s2) json.s2 = s2.value;
|
||||||
|
let val = e.querySelector('input[name="val"]');
|
||||||
|
if(val && 'value' in val) json.val = val.value;
|
||||||
|
|
||||||
|
return json;
|
||||||
|
}}>
|
||||||
|
<Form.Field>
|
||||||
|
<label>Range</label>
|
||||||
|
<Grid columns={2}>
|
||||||
|
<Grid.Column>
|
||||||
|
<Input label="RangeMin" name="r1" />
|
||||||
|
</Grid.Column>
|
||||||
|
<Grid.Column>
|
||||||
|
<Input label="RangeMax" name="r2" />
|
||||||
|
</Grid.Column>
|
||||||
|
</Grid>
|
||||||
|
</Form.Field>
|
||||||
|
<Form.Field>
|
||||||
|
<label>Scale</label>
|
||||||
|
<Grid columns={2}>
|
||||||
|
<Grid.Column>
|
||||||
|
<Input label="ScaleMin" name="s1" />
|
||||||
|
</Grid.Column>
|
||||||
|
<Grid.Column>
|
||||||
|
<Input label="ScaleMax" name="s2" />
|
||||||
|
</Grid.Column>
|
||||||
|
</Grid>
|
||||||
|
</Form.Field>
|
||||||
|
<Form.Field>
|
||||||
|
<Input label="輸入數值" name="val" />
|
||||||
|
</Form.Field>
|
||||||
|
<Grid columns={2}>
|
||||||
|
<Grid.Column>
|
||||||
|
<Button fluid content="送出" basic />
|
||||||
|
</Grid.Column>
|
||||||
|
<Grid.Column>
|
||||||
|
<Button fluid type="button" content="取消" basic onClick={()=>{onClose()}} />
|
||||||
|
</Grid.Column>
|
||||||
|
</Grid>
|
||||||
|
</Form>
|
||||||
|
</Modal.Content>
|
||||||
|
</Modal>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default CalModal;
|
||||||
@@ -0,0 +1,84 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import {Form, Input} from 'semantic-ui-react';
|
||||||
|
|
||||||
|
class StdAction extends React.Component{
|
||||||
|
state = {
|
||||||
|
name: '',
|
||||||
|
act: '',
|
||||||
|
temp: ''
|
||||||
|
}
|
||||||
|
|
||||||
|
changeState = (tag, value) => {
|
||||||
|
let data = {...this.state};
|
||||||
|
if(tag == 'act'){
|
||||||
|
data.name = value.name || '';
|
||||||
|
data.act = value.act || '';
|
||||||
|
}
|
||||||
|
if(tag == 'temp'){
|
||||||
|
data.temp = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.setState({
|
||||||
|
...data
|
||||||
|
}, () => {
|
||||||
|
this.updateAct();
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
showTemp = () => {
|
||||||
|
if(this.state.act == '2'){
|
||||||
|
return (
|
||||||
|
<Form.Field>
|
||||||
|
<Input label="請輸入溫度"
|
||||||
|
placeholder="溫度請介於16-30間"
|
||||||
|
value={this.state.temp}
|
||||||
|
onChange={(e,d) => {this.changeState('temp', d.value)}} />
|
||||||
|
</Form.Field>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
updateAct = ()=>{
|
||||||
|
let {updateAct} = this.props;
|
||||||
|
let act = this.state.act;
|
||||||
|
let temp = this.state.temp;
|
||||||
|
|
||||||
|
if(act == '2') act = `${act},${temp}`;
|
||||||
|
updateAct(act, this.state.name)
|
||||||
|
}
|
||||||
|
|
||||||
|
render(){
|
||||||
|
let {i18n} = this.props;
|
||||||
|
let actlist = i18n&&i18n.getResource&&i18n.language ? i18n.getResource(i18n.language + '.translation.action_list') : [];
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
<Form.Field>
|
||||||
|
<label>選擇動作</label>
|
||||||
|
<select value={this.state.act} onChange={e=>{
|
||||||
|
let el = e.target;
|
||||||
|
let json = {
|
||||||
|
name: '',
|
||||||
|
act: ''
|
||||||
|
}
|
||||||
|
json.act = el.value;
|
||||||
|
json.name = el.options[el.selectedIndex].innerHTML;
|
||||||
|
|
||||||
|
this.changeState('act', json);
|
||||||
|
}}>
|
||||||
|
<option value="">選擇動作</option>
|
||||||
|
{
|
||||||
|
actlist.map((t,idx) => (
|
||||||
|
<option key={idx} value={t.cmd.replace(' ', ',')}>{t.name}</option>
|
||||||
|
))
|
||||||
|
}
|
||||||
|
</select>
|
||||||
|
</Form.Field>
|
||||||
|
{this.showTemp()}
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default StdAction;
|
||||||
@@ -0,0 +1,98 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import {Form, Input} from 'semantic-ui-react';
|
||||||
|
import { getRequest } from '../../../../actions';
|
||||||
|
import StdAction from './StdAction';
|
||||||
|
|
||||||
|
class UnitLeone extends React.Component {
|
||||||
|
state = {
|
||||||
|
list: [],
|
||||||
|
data: {
|
||||||
|
dev: '',
|
||||||
|
devName: '',
|
||||||
|
act: '',
|
||||||
|
actName: ''
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
componentDidMount() {
|
||||||
|
let { showDialog } = this.props;
|
||||||
|
fetch('/api/system/getselectlist', getRequest({ type: 'do' }))
|
||||||
|
.then(response => response.json())
|
||||||
|
.then(json => {
|
||||||
|
if (json.status != 1) return showDialog(json.message);
|
||||||
|
this.setState({
|
||||||
|
list: json.data.record || []
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
changeState = (tag, value) =>{
|
||||||
|
let data = {...this.state.data};
|
||||||
|
|
||||||
|
if(tag == 'act') {
|
||||||
|
data.actName = value.name;
|
||||||
|
data.act = value.act;
|
||||||
|
}
|
||||||
|
if(tag == 'dev'){
|
||||||
|
data.dev = value.dev == '' ? '' : `do${value.dev}`;
|
||||||
|
data.devName = value.name;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.setState({
|
||||||
|
data:{
|
||||||
|
...data
|
||||||
|
}
|
||||||
|
}, ()=>{
|
||||||
|
this.updateData()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
updateData = () => {
|
||||||
|
let data = {...this.state.data};
|
||||||
|
data.type = 'do';
|
||||||
|
|
||||||
|
this.props.updateData(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
updateAct = (act, name) => {
|
||||||
|
this.changeState('act', {act, name});
|
||||||
|
}
|
||||||
|
|
||||||
|
render() {
|
||||||
|
let {i18n} = this.props;
|
||||||
|
let dev = '';
|
||||||
|
let m = this.state.data.dev.match(/(\d+)/);
|
||||||
|
if(m!=null && m.length > 1){
|
||||||
|
dev = m[1];
|
||||||
|
}
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
<Form.Field>
|
||||||
|
<label>選擇裝置</label>
|
||||||
|
<select value={dev} onChange={e=>{
|
||||||
|
let el = e.target;
|
||||||
|
let json = {
|
||||||
|
dev: '',
|
||||||
|
name: ''
|
||||||
|
};
|
||||||
|
|
||||||
|
json.dev = el.value;
|
||||||
|
json.name = el.options[el.selectedIndex].innerHTML;
|
||||||
|
|
||||||
|
this.changeState('dev', json);
|
||||||
|
}}>
|
||||||
|
<option value="">選擇裝置</option>
|
||||||
|
{
|
||||||
|
this.state.list.map((t,idx) => (
|
||||||
|
<option key={idx} value={t.id}>{t.name}</option>
|
||||||
|
))
|
||||||
|
}
|
||||||
|
</select>
|
||||||
|
</Form.Field>
|
||||||
|
<StdAction i18n={i18n} updateAct={this.updateAct} />
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default UnitLeone;
|
||||||
@@ -0,0 +1,98 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import {Form, Input} from 'semantic-ui-react';
|
||||||
|
import { getRequest } from '../../../../actions';
|
||||||
|
import StdAction from './StdAction';
|
||||||
|
|
||||||
|
class UnitLeone extends React.Component {
|
||||||
|
state = {
|
||||||
|
list: [],
|
||||||
|
data: {
|
||||||
|
dev: '',
|
||||||
|
devName: '',
|
||||||
|
act: '',
|
||||||
|
actName: ''
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
componentDidMount() {
|
||||||
|
let { showDialog } = this.props;
|
||||||
|
fetch('/api/system/getselectlist', getRequest({ type: 'iogroup' }))
|
||||||
|
.then(response => response.json())
|
||||||
|
.then(json => {
|
||||||
|
if (json.status != 1) return showDialog(json.message);
|
||||||
|
this.setState({
|
||||||
|
list: json.data.record || []
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
changeState = (tag, value) =>{
|
||||||
|
let data = {...this.state.data};
|
||||||
|
|
||||||
|
if(tag == 'act') {
|
||||||
|
data.actName = value.name;
|
||||||
|
data.act = value.act;
|
||||||
|
}
|
||||||
|
if(tag == 'dev'){
|
||||||
|
data.dev = value.dev == '' ? '' : `iogroup${value.dev}`;
|
||||||
|
data.devName = value.name;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.setState({
|
||||||
|
data:{
|
||||||
|
...data
|
||||||
|
}
|
||||||
|
}, ()=>{
|
||||||
|
this.updateData()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
updateData = () => {
|
||||||
|
let data = {...this.state.data};
|
||||||
|
data.type = 'iogroup';
|
||||||
|
|
||||||
|
this.props.updateData(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
updateAct = (act, name) => {
|
||||||
|
this.changeState('act', {act, name});
|
||||||
|
}
|
||||||
|
|
||||||
|
render() {
|
||||||
|
let {i18n} = this.props;
|
||||||
|
let dev = '';
|
||||||
|
let m = this.state.data.dev.match(/(\d+)/);
|
||||||
|
if(m!=null && m.length > 1){
|
||||||
|
dev = m[1];
|
||||||
|
}
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
<Form.Field>
|
||||||
|
<label>選擇裝置</label>
|
||||||
|
<select value={dev} onChange={e=>{
|
||||||
|
let el = e.target;
|
||||||
|
let json = {
|
||||||
|
dev: '',
|
||||||
|
name: ''
|
||||||
|
};
|
||||||
|
|
||||||
|
json.dev = el.value;
|
||||||
|
json.name = el.options[el.selectedIndex].innerHTML;
|
||||||
|
|
||||||
|
this.changeState('dev', json);
|
||||||
|
}}>
|
||||||
|
<option value="">選擇裝置</option>
|
||||||
|
{
|
||||||
|
this.state.list.map((t,idx) => (
|
||||||
|
<option key={idx} value={t.id}>{t.name}</option>
|
||||||
|
))
|
||||||
|
}
|
||||||
|
</select>
|
||||||
|
</Form.Field>
|
||||||
|
<StdAction i18n={i18n} updateAct={this.updateAct} />
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default UnitLeone;
|
||||||
@@ -0,0 +1,98 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import {Form, Input} from 'semantic-ui-react';
|
||||||
|
import { getRequest } from '../../../../actions';
|
||||||
|
import StdAction from './StdAction';
|
||||||
|
|
||||||
|
class UnitLeone extends React.Component {
|
||||||
|
state = {
|
||||||
|
list: [],
|
||||||
|
data: {
|
||||||
|
dev: '',
|
||||||
|
devName: '',
|
||||||
|
act: '',
|
||||||
|
actName: ''
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
componentDidMount() {
|
||||||
|
let { showDialog } = this.props;
|
||||||
|
fetch('/api/system/getselectlist', getRequest({ type: 'leone' }))
|
||||||
|
.then(response => response.json())
|
||||||
|
.then(json => {
|
||||||
|
if (json.status != 1) return showDialog(json.message);
|
||||||
|
this.setState({
|
||||||
|
list: json.data.record || []
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
changeState = (tag, value) =>{
|
||||||
|
let data = {...this.state.data};
|
||||||
|
|
||||||
|
if(tag == 'act') {
|
||||||
|
data.actName = value.name;
|
||||||
|
data.act = value.act;
|
||||||
|
}
|
||||||
|
if(tag == 'dev'){
|
||||||
|
data.dev = value.dev == '' ? '' : `le${value.dev}`;
|
||||||
|
data.devName = value.name;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.setState({
|
||||||
|
data:{
|
||||||
|
...data
|
||||||
|
}
|
||||||
|
}, ()=>{
|
||||||
|
this.updateData()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
updateData = () => {
|
||||||
|
let data = {...this.state.data};
|
||||||
|
data.type = 'leone';
|
||||||
|
|
||||||
|
this.props.updateData(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
updateAct = (act, name) => {
|
||||||
|
this.changeState('act', {act, name});
|
||||||
|
}
|
||||||
|
|
||||||
|
render() {
|
||||||
|
let {i18n} = this.props;
|
||||||
|
let dev = '';
|
||||||
|
let m = this.state.data.dev.match(/(\d+)/);
|
||||||
|
if(m!=null && m.length > 1){
|
||||||
|
dev = m[1];
|
||||||
|
}
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
<Form.Field>
|
||||||
|
<label>選擇裝置</label>
|
||||||
|
<select value={dev} onChange={e=>{
|
||||||
|
let el = e.target;
|
||||||
|
let json = {
|
||||||
|
dev: '',
|
||||||
|
name: ''
|
||||||
|
};
|
||||||
|
|
||||||
|
json.dev = el.value;
|
||||||
|
json.name = el.options[el.selectedIndex].innerHTML;
|
||||||
|
|
||||||
|
this.changeState('dev', json);
|
||||||
|
}}>
|
||||||
|
<option value="">選擇裝置</option>
|
||||||
|
{
|
||||||
|
this.state.list.map((t,idx) => (
|
||||||
|
<option key={idx} value={t.id}>{t.name}</option>
|
||||||
|
))
|
||||||
|
}
|
||||||
|
</select>
|
||||||
|
</Form.Field>
|
||||||
|
<StdAction i18n={i18n} updateAct={this.updateAct} />
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default UnitLeone;
|
||||||
@@ -0,0 +1,185 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import {Form, Input} from 'semantic-ui-react';
|
||||||
|
import { getRequest } from '../../../../actions';
|
||||||
|
import CalModal from './CalModal';
|
||||||
|
|
||||||
|
class UnitLeone extends React.Component {
|
||||||
|
state = {
|
||||||
|
list: [],
|
||||||
|
data: {
|
||||||
|
dev: '',
|
||||||
|
devName: '',
|
||||||
|
func: '',
|
||||||
|
funcName: '',
|
||||||
|
addr: '',
|
||||||
|
value: ''
|
||||||
|
},
|
||||||
|
modal: false
|
||||||
|
}
|
||||||
|
|
||||||
|
componentDidMount() {
|
||||||
|
let { showDialog } = this.props;
|
||||||
|
fetch('/api/system/getselectlist', getRequest({ type: 'modbus' }))
|
||||||
|
.then(response => response.json())
|
||||||
|
.then(json => {
|
||||||
|
if (json.status != 1) return showDialog(json.message);
|
||||||
|
this.setState({
|
||||||
|
list: json.data.record || []
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
renderModal = () => {
|
||||||
|
let {i18n} = this.props;
|
||||||
|
return (
|
||||||
|
this.state.modal ?
|
||||||
|
(
|
||||||
|
<CalModal i18n={i18n} onClose={this.closeModal} onSubmit={this.submitModal} />
|
||||||
|
): null
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
closeModal = () => {
|
||||||
|
this.setState({
|
||||||
|
modal: false
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
submitModal = (data) => {
|
||||||
|
if(!data) return ;
|
||||||
|
let {showDialog} = this.props;
|
||||||
|
let {r1, r2, s1, s2, val} = data;
|
||||||
|
if(!isFinite(r1) || !isFinite(r2) || !isFinite(s1) || !isFinite(s2) || !isFinite(val)) return showDialog('請勿輸入數字以外的內容');
|
||||||
|
|
||||||
|
let value = Math.round(((val - r1) * (s2 - s1)) / (r2 - r1));
|
||||||
|
|
||||||
|
this.setState({
|
||||||
|
data:{
|
||||||
|
...this.state.data,
|
||||||
|
value
|
||||||
|
}
|
||||||
|
}, ()=>{this.closeModal()})
|
||||||
|
}
|
||||||
|
|
||||||
|
changeState = (tag, value) =>{
|
||||||
|
let data = {...this.state.data};
|
||||||
|
|
||||||
|
if(tag == 'func') {
|
||||||
|
data.funcName = value.name;
|
||||||
|
data.func = value.func;
|
||||||
|
}
|
||||||
|
if(tag == 'dev'){
|
||||||
|
data.dev = value.dev == '' ? '' : `mb${value.dev}`;
|
||||||
|
data.devName = value.name;
|
||||||
|
}
|
||||||
|
if(tag == 'addr'){
|
||||||
|
data.addr = value;
|
||||||
|
}
|
||||||
|
if(tag == 'value'){
|
||||||
|
data.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.setState({
|
||||||
|
data:{
|
||||||
|
...data
|
||||||
|
}
|
||||||
|
}, ()=>{
|
||||||
|
this.updateData()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
updateData = () => {
|
||||||
|
let data = {...this.state.data};
|
||||||
|
data.type = 'modbus';
|
||||||
|
|
||||||
|
data.act = `${data.func},${data.addr},${data.value}`;
|
||||||
|
data.actName = `${data.funcName} Addr:${data.addr} Value:${data.value}`;
|
||||||
|
|
||||||
|
delete data.func;
|
||||||
|
delete data.funcName;
|
||||||
|
delete data.addr;
|
||||||
|
delete data.value;
|
||||||
|
|
||||||
|
this.props.updateData(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
updateAct = (act, name) => {
|
||||||
|
this.changeState('act', {act, name});
|
||||||
|
}
|
||||||
|
|
||||||
|
render() {
|
||||||
|
let {i18n} = this.props;
|
||||||
|
let dev = '';
|
||||||
|
let m = this.state.data.dev.match(/(\d+)/);
|
||||||
|
|
||||||
|
if(m!=null && m.length > 1){
|
||||||
|
dev = m[1];
|
||||||
|
}
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
<Form.Field>
|
||||||
|
<label>選擇裝置</label>
|
||||||
|
<select value={dev} onChange={e=>{
|
||||||
|
let el = e.target;
|
||||||
|
let json = {
|
||||||
|
dev: '',
|
||||||
|
name: ''
|
||||||
|
};
|
||||||
|
|
||||||
|
json.dev = el.value;
|
||||||
|
json.name = el.options[el.selectedIndex].innerHTML;
|
||||||
|
|
||||||
|
this.changeState('dev', json);
|
||||||
|
}}>
|
||||||
|
<option value="">選擇裝置</option>
|
||||||
|
{
|
||||||
|
this.state.list.map((t,idx) => (
|
||||||
|
<option key={idx} value={t.id}>{t.name}</option>
|
||||||
|
))
|
||||||
|
}
|
||||||
|
</select>
|
||||||
|
</Form.Field>
|
||||||
|
<Form.Field>
|
||||||
|
<label>選擇輸出類型</label>
|
||||||
|
<select value={this.state.data.func} onChange={e=>{
|
||||||
|
let el = e.target;
|
||||||
|
let json = {
|
||||||
|
func: '',
|
||||||
|
name: ''
|
||||||
|
};
|
||||||
|
|
||||||
|
json.func = el.value;
|
||||||
|
json.name = el.options[el.selectedIndex].innerHTML;
|
||||||
|
|
||||||
|
this.changeState('func', json);
|
||||||
|
}}>
|
||||||
|
<option value="">輸出類型</option>
|
||||||
|
<option value="5">DigitalOutput</option>
|
||||||
|
<option value="6">AnalogOutput</option>
|
||||||
|
</select>
|
||||||
|
</Form.Field>
|
||||||
|
<Form.Field>
|
||||||
|
<Input label="輸入位址" value={this.state.data.addr} onChange={(e,d) => {this.changeState('addr', d.value)}} />
|
||||||
|
</Form.Field>
|
||||||
|
<Form.Field>
|
||||||
|
<Input label="輸入數值"
|
||||||
|
value={this.state.data.value}
|
||||||
|
onChange={(e,d) => {this.changeState('value', d.value)}}
|
||||||
|
action={{
|
||||||
|
content:"數值換算",
|
||||||
|
basic: true,
|
||||||
|
onClick: ()=>{
|
||||||
|
this.setState({
|
||||||
|
modal: true
|
||||||
|
})
|
||||||
|
},
|
||||||
|
type: 'button'
|
||||||
|
}} />
|
||||||
|
</Form.Field>
|
||||||
|
{this.renderModal()}
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default UnitLeone;
|
||||||
@@ -0,0 +1,135 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import {Segment, Button, Form, Input} from 'semantic-ui-react';
|
||||||
|
import UnitLeone from './UnitLeone';
|
||||||
|
import UnitDigitalOutput from './UnitDigitalOutput';
|
||||||
|
import UnitIOGroup from './UnitIOGroup';
|
||||||
|
import UnitModbus from './UnitModbus';
|
||||||
|
|
||||||
|
const stateDefault = () => ({
|
||||||
|
unit: '',
|
||||||
|
act: {
|
||||||
|
type: '',
|
||||||
|
dev: '',
|
||||||
|
devName: '',
|
||||||
|
act: '',
|
||||||
|
actName: ''
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
class ActionSelect extends React.Component {
|
||||||
|
|
||||||
|
state = {
|
||||||
|
...stateDefault()
|
||||||
|
}
|
||||||
|
|
||||||
|
changeUnit = (unit) => {
|
||||||
|
this.setState({
|
||||||
|
unit
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
getUnitComponent = () => {
|
||||||
|
let {unit} = this.state;
|
||||||
|
let {i18n, showDialog, toggleLoading} = this.props;
|
||||||
|
|
||||||
|
switch(unit){
|
||||||
|
case 'leone':
|
||||||
|
return (
|
||||||
|
<UnitLeone i18n={i18n}
|
||||||
|
data={this.state.act}
|
||||||
|
showDialog={showDialog}
|
||||||
|
toggleLoading={toggleLoading}
|
||||||
|
updateData={this.updateData} />
|
||||||
|
)
|
||||||
|
case 'do':
|
||||||
|
return (
|
||||||
|
<UnitDigitalOutput i18n={i18n}
|
||||||
|
data={this.state.act}
|
||||||
|
showDialog={showDialog}
|
||||||
|
toggleLoading={toggleLoading}
|
||||||
|
updateData={this.updateData} />
|
||||||
|
)
|
||||||
|
case 'iogroup':
|
||||||
|
return (
|
||||||
|
<UnitIOGroup i18n={i18n}
|
||||||
|
data={this.state.act}
|
||||||
|
showDialog={showDialog}
|
||||||
|
toggleLoading={toggleLoading}
|
||||||
|
updateData={this.updateData} />
|
||||||
|
)
|
||||||
|
case 'modbus':
|
||||||
|
return (
|
||||||
|
<UnitModbus i18n={i18n}
|
||||||
|
data={this.state.act}
|
||||||
|
showDialog={showDialog}
|
||||||
|
toggleLoading={toggleLoading}
|
||||||
|
updateData={this.updateData} />
|
||||||
|
)
|
||||||
|
default:
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
updateData = (data) => {
|
||||||
|
let {act} = this.state;
|
||||||
|
for(let i in act){
|
||||||
|
act[i] = data[i] || ''
|
||||||
|
}
|
||||||
|
this.setState({
|
||||||
|
act
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
addAction = () => {
|
||||||
|
let {dev, devName, act, actName, type} = this.state.act;
|
||||||
|
let {showDialog} = this.props;
|
||||||
|
if(!dev || !act) return showDialog('請選擇動作資料');
|
||||||
|
if(type != 'modbus'){
|
||||||
|
let acts = act.split(',');
|
||||||
|
if(acts.length != 2 ) return showDialog('請選擇正確的動作');
|
||||||
|
if(acts[0] == '2'){
|
||||||
|
if(acts[1] < 16 || acts[1] > 30) return showDialog('冷氣溫度請介於16-30間');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(type == 'modbus'){
|
||||||
|
let acts = act.split(',');
|
||||||
|
if(acts.length != 3) return showDialog('請把動作資料填寫完成');
|
||||||
|
if(acts[0] == '' || acts[1] == '' || acts[2] == '') return showDialog('請把動作資料填寫完成');
|
||||||
|
}
|
||||||
|
|
||||||
|
this.props.addNewAction({
|
||||||
|
dev,devName,act,actName,type
|
||||||
|
}, this.clearField);
|
||||||
|
}
|
||||||
|
|
||||||
|
clearField = () => {
|
||||||
|
this.setState({
|
||||||
|
...stateDefault()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
render() {
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Segment color="green">
|
||||||
|
<Form.Field>
|
||||||
|
<label>選擇裝置類型</label>
|
||||||
|
<select value={this.state.unit} onChange={e=>{this.changeUnit(e.target.value)}}>
|
||||||
|
<option value="">裝置類型</option>
|
||||||
|
<option value="leone">LeOne</option>
|
||||||
|
<option value="do">DigitalOutput</option>
|
||||||
|
<option value="iogroup">IOGroup</option>
|
||||||
|
<option value="modbus">Modbus</option>
|
||||||
|
</select>
|
||||||
|
</Form.Field>
|
||||||
|
{this.getUnitComponent()}
|
||||||
|
<div style={{textAlign:'right', marginTop: '20px'}}>
|
||||||
|
<Button content="加入" basic size="mini" color="blue" onClick={()=>{ this.addAction() }} />
|
||||||
|
<Button content="清除" basic size="mini" color="red" onClick={()=>{this.clearField()}} />
|
||||||
|
</div>
|
||||||
|
</Segment>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default ActionSelect;
|
||||||
@@ -0,0 +1,105 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import {Input} from 'semantic-ui-react';
|
||||||
|
import {getRequest} from '../../../../../actions';
|
||||||
|
|
||||||
|
class UnitDigitalInput extends React.Component {
|
||||||
|
state = {
|
||||||
|
list: [],
|
||||||
|
data: {
|
||||||
|
id: '',
|
||||||
|
op: '',
|
||||||
|
value: ''
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
componentDidMount(){
|
||||||
|
let {showDialog, toggleLoading} = this.props;
|
||||||
|
|
||||||
|
toggleLoading(1);
|
||||||
|
fetch('/api/system/getselectlist', getRequest({type: 'di'}))
|
||||||
|
.then(response=>response.json())
|
||||||
|
.then(json=>{
|
||||||
|
toggleLoading(0);
|
||||||
|
if(json.status != 1) return showDialog(json.message);
|
||||||
|
this.setState({
|
||||||
|
list: json.data.record || []
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
componentWillReceiveProps(np) {
|
||||||
|
let data = {...this.state.data};
|
||||||
|
if(np.data.id != data.id) data.id = np.data.id;
|
||||||
|
if(np.data.op != data.op) data.op = np.data.op;
|
||||||
|
if(np.data.value != data.value) data.value = np.data.op;
|
||||||
|
|
||||||
|
this.setState({
|
||||||
|
data: {...data}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
changeState = (key, value) => {
|
||||||
|
let data = {
|
||||||
|
...this.state.data
|
||||||
|
}
|
||||||
|
if(key == 'dev') {
|
||||||
|
data.id = value == '' ? '' : `di${value},di_status`;
|
||||||
|
}
|
||||||
|
if(key == 'op'){
|
||||||
|
data.op = value;
|
||||||
|
}
|
||||||
|
if(key == 'value') {
|
||||||
|
data.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.setState({
|
||||||
|
data: {...data}
|
||||||
|
}, ()=>{ this.sendUpdate() });
|
||||||
|
}
|
||||||
|
|
||||||
|
sendUpdate = () => {
|
||||||
|
this.props.updateData({...this.props.data, ...this.state.data});
|
||||||
|
}
|
||||||
|
|
||||||
|
render() {
|
||||||
|
let {ops} = this.props;
|
||||||
|
let id = '';
|
||||||
|
if(this.state.data.id != '') {
|
||||||
|
let m = this.state.data.id.match(/(\d+)/);
|
||||||
|
if(m != null && m.length > 1){
|
||||||
|
id = m[1];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
<select value={id} onChange={e => {this.changeState('dev', e.target.value)}}>
|
||||||
|
<option value="">選擇裝置</option>
|
||||||
|
{
|
||||||
|
this.state.list.map((t,idx) => (
|
||||||
|
<option key={idx} value={t.id}>{t.name}</option>
|
||||||
|
))
|
||||||
|
}
|
||||||
|
</select>
|
||||||
|
<select value={this.state.data.op} onChange={e => {this.changeState('op', e.target.value)}}>
|
||||||
|
<option value="">選擇條件</option>
|
||||||
|
{
|
||||||
|
ops.map((t,idx) => {
|
||||||
|
if(t.code != 8 && t.code != 9) {
|
||||||
|
return (
|
||||||
|
<option value={t.code} key={idx}>{t.name}</option>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
</select>
|
||||||
|
<select value={this.state.data.value} onChange={e => {this.changeState('value', e.target.value)}}>
|
||||||
|
<option value="">選擇狀態</option>
|
||||||
|
<option value="0">0</option>
|
||||||
|
<option value="1">1</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default UnitDigitalInput;
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import {Input} from 'semantic-ui-react';
|
||||||
|
import {getRequest} from '../../../../../actions';
|
||||||
|
|
||||||
|
class UnitGroups extends React.Component {
|
||||||
|
|
||||||
|
render() {
|
||||||
|
let {groups, data, updateData } = this.props;
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
<select value={data.dev} onChange={e => {
|
||||||
|
updateData({...data, dev: e.target.value});
|
||||||
|
}}>
|
||||||
|
<option value="">選擇群組</option>
|
||||||
|
{
|
||||||
|
Object.keys(groups).map((t,idx) => (
|
||||||
|
<option key={idx} value={t}>{groups[t].name}</option>
|
||||||
|
))
|
||||||
|
}
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default UnitGroups;
|
||||||
@@ -0,0 +1,117 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import {Input} from 'semantic-ui-react';
|
||||||
|
import {getRequest} from '../../../../../actions';
|
||||||
|
|
||||||
|
class UnitLeone extends React.Component {
|
||||||
|
state = {
|
||||||
|
list: [],
|
||||||
|
data: {
|
||||||
|
id: '',
|
||||||
|
op: '',
|
||||||
|
mode: '',
|
||||||
|
value: ''
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
componentDidMount(){
|
||||||
|
let {showDialog, toggleLoading} = this.props;
|
||||||
|
|
||||||
|
toggleLoading(1);
|
||||||
|
fetch('/api/system/getselectlist', getRequest({type: 'leone'}))
|
||||||
|
.then(response=>response.json())
|
||||||
|
.then(json=>{
|
||||||
|
toggleLoading(0);
|
||||||
|
if(json.status != 1) return showDialog(json.message);
|
||||||
|
this.setState({
|
||||||
|
list: json.data.record || []
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
componentWillReceiveProps(np) {
|
||||||
|
let data = {...this.state.data};
|
||||||
|
if(np.data.op != data.op) data.op = np.data.op;
|
||||||
|
if(np.data.value != data.value) data.value = np.data.op;
|
||||||
|
|
||||||
|
let id = np.data.id.split(',')[0];
|
||||||
|
let mode = np.data.id.split(',')[1];
|
||||||
|
if(id != data.id) data.id = id;
|
||||||
|
if(mode != data.mode) data.mode = mode;
|
||||||
|
|
||||||
|
this.setState({
|
||||||
|
data: {...data}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
changeState = (key, value) => {
|
||||||
|
let data = {
|
||||||
|
...this.state.data
|
||||||
|
}
|
||||||
|
if(key == 'dev') {
|
||||||
|
data.id = value == '' ? '' : `le${value}`;
|
||||||
|
}
|
||||||
|
if(key == 'mode'){
|
||||||
|
data.mode = value;
|
||||||
|
}
|
||||||
|
if(key == 'op'){
|
||||||
|
data.op = value;
|
||||||
|
}
|
||||||
|
if(key == 'value') {
|
||||||
|
data.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.setState({
|
||||||
|
data: {...data}
|
||||||
|
}, ()=>{ this.sendUpdate() });
|
||||||
|
}
|
||||||
|
|
||||||
|
sendUpdate = () => {
|
||||||
|
let data = {...this.state.data};
|
||||||
|
data.id = `${data.id},${data.mode}`;
|
||||||
|
delete data.mode;
|
||||||
|
this.props.updateData({...this.props.data, ...data});
|
||||||
|
}
|
||||||
|
|
||||||
|
render() {
|
||||||
|
let {ops} = this.props;
|
||||||
|
let id = '';
|
||||||
|
if(this.state.data.id != '') {
|
||||||
|
let m = this.state.data.id.match(/(\d+)/);
|
||||||
|
if(m != null && m.length > 1){
|
||||||
|
id = m[1];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
<select value={id} onChange={e => {this.changeState('dev', e.target.value)}}>
|
||||||
|
<option value="">選擇裝置</option>
|
||||||
|
{
|
||||||
|
this.state.list.map((t,idx) => (
|
||||||
|
<option key={idx} value={t.id}>{t.name}</option>
|
||||||
|
))
|
||||||
|
}
|
||||||
|
</select>
|
||||||
|
<select value={this.state.data.mode} onChange={e=>{this.changeState('mode', e.target.value)}}>
|
||||||
|
<option value="">選擇感測器</option>
|
||||||
|
<option value="leone_ttrigger1">溫度</option>
|
||||||
|
<option value="leone_htrigger1">濕度</option>
|
||||||
|
</select>
|
||||||
|
<select value={this.state.data.op} onChange={e=>{this.changeState('op', e.target.value)}}>
|
||||||
|
<option value="">選擇條件</option>
|
||||||
|
{
|
||||||
|
ops.map((t,idx) => {
|
||||||
|
if(t.code != 8 && t.code != 9) {
|
||||||
|
return (
|
||||||
|
<option value={t.code} key={idx}>{t.name}</option>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
</select>
|
||||||
|
<Input placeholder="請輸入數值" value={this.state.data.value} onChange={(e, d)=>{this.changeState('value', d.value)}} />
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default UnitLeone;
|
||||||
@@ -0,0 +1,200 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import {Input} from 'semantic-ui-react';
|
||||||
|
import {getRequest} from '../../../../../actions';
|
||||||
|
|
||||||
|
class UnitDigitalInput extends React.Component {
|
||||||
|
state = {
|
||||||
|
list: [],
|
||||||
|
typelist: [],
|
||||||
|
portlist: [],
|
||||||
|
data: {
|
||||||
|
id: '',
|
||||||
|
op: '',
|
||||||
|
type: '',
|
||||||
|
port: '',
|
||||||
|
value: ''
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
componentDidMount(){
|
||||||
|
let {showDialog, toggleLoading} = this.props;
|
||||||
|
|
||||||
|
toggleLoading(1);
|
||||||
|
fetch('/api/system/getselectlist', getRequest({type: 'modbus'}))
|
||||||
|
.then(response=>response.json())
|
||||||
|
.then(json=>{
|
||||||
|
toggleLoading(0);
|
||||||
|
if(json.status != 1) return showDialog(json.message);
|
||||||
|
this.setState({
|
||||||
|
list: json.data.record || []
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
componentWillReceiveProps(np) {
|
||||||
|
let data = {...this.state.data};
|
||||||
|
// if(np.data.id != data.id) data.id = np.data.id;
|
||||||
|
if(np.data.op != data.op) data.op = np.data.op;
|
||||||
|
if(np.data.value != data.value) data.value = np.data.op;
|
||||||
|
|
||||||
|
let id = (np.data.id || '').split(',')[0];
|
||||||
|
let type = ((np.data.id || '').split(',')[1] || '').split('|')[0] || '';
|
||||||
|
let port = ((np.data.id || '').split(',')[1] || '').split('|')[1] || '';
|
||||||
|
|
||||||
|
if(data.id != id ) data.id = id;
|
||||||
|
if(data.type != type ) data.type = type;
|
||||||
|
if(data.port != port ) data.port = port;
|
||||||
|
|
||||||
|
this.setState({
|
||||||
|
data: {...data}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
getDevTypes = (id) => {
|
||||||
|
if(!id) return ;
|
||||||
|
let {i18n, showDialog} = this.props;
|
||||||
|
let typelist = i18n&&i18n.getResource&&i18n.language ? i18n.getResource(i18n.language + '.translation.porttype') : [];
|
||||||
|
fetch('/api/modbus/getmodbustype', getRequest({id}))
|
||||||
|
.then(response=>response.json())
|
||||||
|
.then(json => {
|
||||||
|
if(json.status != 1) return showDialog(json.message);
|
||||||
|
let arr = json.data.record || [];
|
||||||
|
for(let i in arr){
|
||||||
|
for(let j in typelist) {
|
||||||
|
if(arr[i].type == typelist[j].code){
|
||||||
|
arr[i].name = typelist[j].name;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.setState({
|
||||||
|
typelist: arr,
|
||||||
|
portlist: [],
|
||||||
|
data: {
|
||||||
|
...this.state.data,
|
||||||
|
type: '',
|
||||||
|
port: ''
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
getDevPorts = (id, type) => {
|
||||||
|
if(!id || !type) return ;
|
||||||
|
let {i18n, showDialog} = this.props;
|
||||||
|
let mid = '';
|
||||||
|
let m = id.match(/(\d+)/);
|
||||||
|
if(m != null && m.length>1) mid = m[1];
|
||||||
|
fetch('/api/modbus/getmodbusport', getRequest({id: mid, type}))
|
||||||
|
.then(response=>response.json())
|
||||||
|
.then(json => {
|
||||||
|
if(json.status != 1) return showDialog(json.message);
|
||||||
|
let arr = json.data.record || [];
|
||||||
|
|
||||||
|
this.setState({
|
||||||
|
portlist: arr,
|
||||||
|
data: {
|
||||||
|
...this.state.data,
|
||||||
|
port: ''
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
changeState = (key, value) => {
|
||||||
|
let data = {
|
||||||
|
...this.state.data
|
||||||
|
}
|
||||||
|
if(key == 'dev') {
|
||||||
|
data.id = value == '' ? '' : `mb${value}`;
|
||||||
|
}
|
||||||
|
if(key == 'op'){
|
||||||
|
data.op = value;
|
||||||
|
}
|
||||||
|
if(key == 'type') {
|
||||||
|
data.type = value
|
||||||
|
}
|
||||||
|
if(key == 'port') {
|
||||||
|
data.port = value
|
||||||
|
}
|
||||||
|
if(key == 'value') {
|
||||||
|
data.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.setState({
|
||||||
|
data: {...data}
|
||||||
|
}, ()=>{
|
||||||
|
if(key == 'dev'){
|
||||||
|
this.getDevTypes(value);
|
||||||
|
}
|
||||||
|
if(key == 'type'){
|
||||||
|
this.getDevPorts(this.state.data.id, this.state.data.type)
|
||||||
|
}
|
||||||
|
this.sendUpdate()
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
sendUpdate = () => {
|
||||||
|
let data = {...this.state.data};
|
||||||
|
data.id = `${data.id},${data.type}|${data.port}`;
|
||||||
|
delete data.type;
|
||||||
|
delete data.port;
|
||||||
|
delete data.dev;
|
||||||
|
this.props.updateData({...this.props.data, ...data});
|
||||||
|
}
|
||||||
|
|
||||||
|
render() {
|
||||||
|
let {ops, i18n} = this.props;
|
||||||
|
let id = '';
|
||||||
|
if(this.state.data.id != '') {
|
||||||
|
let m = this.state.data.id.match(/(\d+)/);
|
||||||
|
if(m != null && m.length > 1){
|
||||||
|
id = m[1];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
<select value={id} onChange={e => {this.changeState('dev', e.target.value)}}>
|
||||||
|
<option value="">選擇裝置</option>
|
||||||
|
{
|
||||||
|
this.state.list.map((t,idx) => (
|
||||||
|
<option key={idx} value={t.id}>{t.name}</option>
|
||||||
|
))
|
||||||
|
}
|
||||||
|
</select>
|
||||||
|
<select value={this.state.data.type} onChange={e => {this.changeState('type', e.target.value)}}>
|
||||||
|
<option value="">接口類型</option>
|
||||||
|
{
|
||||||
|
this.state.typelist.map((t,idx) => (
|
||||||
|
<option key={idx} value={t.type}>{t.name}</option>
|
||||||
|
))
|
||||||
|
}
|
||||||
|
</select>
|
||||||
|
<select value={this.state.data.port} onChange={e => {this.changeState('port', e.target.value)}}>
|
||||||
|
<option value="">接口</option>
|
||||||
|
{
|
||||||
|
this.state.portlist.map((t,idx) => (
|
||||||
|
<option key={idx} value={t.portnum}>{`Port ${t.portnum} ${t.name ? ` - ${t.name}` : '' }`}</option>
|
||||||
|
))
|
||||||
|
}
|
||||||
|
</select>
|
||||||
|
<select value={this.state.data.op} onChange={e => {this.changeState('op', e.target.value)}}>
|
||||||
|
<option value="">選擇條件</option>
|
||||||
|
{
|
||||||
|
ops.map((t,idx) => {
|
||||||
|
if(t.code != 8 && t.code != 9) {
|
||||||
|
return (
|
||||||
|
<option value={t.code} key={idx}>{t.name}</option>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
</select>
|
||||||
|
<Input label="請輸入數值" value={this.state.data.value} onChange={(e,d)=>{this.changeState('value', d.value)}} />
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default UnitDigitalInput;
|
||||||
@@ -0,0 +1,119 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import {Input} from 'semantic-ui-react';
|
||||||
|
import {getRequest} from '../../../../../actions';
|
||||||
|
|
||||||
|
class UnitTime extends React.Component {
|
||||||
|
state = {
|
||||||
|
list: [],
|
||||||
|
data: {
|
||||||
|
op: '',
|
||||||
|
id: 'dt0,mode0',
|
||||||
|
year: '-',
|
||||||
|
week: '-',
|
||||||
|
month: '-',
|
||||||
|
day: '-',
|
||||||
|
hour: '-',
|
||||||
|
min: '-'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
componentWillReceiveProps(np) {
|
||||||
|
let data = {...this.state.data};
|
||||||
|
if(np.data.op != data.op) data.op = np.data.op;
|
||||||
|
|
||||||
|
let year = np.data.value.split('|')[5] || '-';
|
||||||
|
let week = np.data.value.split('|')[4] || '-';
|
||||||
|
let month = np.data.value.split('|')[3] || '-';
|
||||||
|
let day = np.data.value.split('|')[2] || '-';
|
||||||
|
let hour = np.data.value.split('|')[1] || '-';
|
||||||
|
let min = np.data.value.split('|')[0] || '-';
|
||||||
|
|
||||||
|
if(year != data.year) data.year = year;
|
||||||
|
if(week != data.week) data.week = week;
|
||||||
|
if(month != data.month) data.month = month;
|
||||||
|
if(day != data.day) data.day = day;
|
||||||
|
if(hour != data.hour) data.hour = hour;
|
||||||
|
if(min != data.min) data.min = min;
|
||||||
|
|
||||||
|
this.setState({
|
||||||
|
data: {...data}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
changeState = (key, value) => {
|
||||||
|
let data = {
|
||||||
|
...this.state.data
|
||||||
|
}
|
||||||
|
if(key == 'op'){
|
||||||
|
data.op = value;
|
||||||
|
}
|
||||||
|
if(key == 'year') {
|
||||||
|
data.year = value == '' ? '-' : value;
|
||||||
|
}
|
||||||
|
if(key == 'week') {
|
||||||
|
data.week = value == '' ? '-' : value;
|
||||||
|
}
|
||||||
|
if(key == 'month') {
|
||||||
|
data.month = value == '' ? '-' : value;
|
||||||
|
}
|
||||||
|
if(key == 'day') {
|
||||||
|
data.day = value == '' ? '-' : value;
|
||||||
|
}
|
||||||
|
if(key == 'hour') {
|
||||||
|
data.hour = value == '' ? '-' : value;
|
||||||
|
}
|
||||||
|
if(key == 'min') {
|
||||||
|
data.min = value == '' ? '-' : value;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.setState({
|
||||||
|
data: {...data}
|
||||||
|
}, ()=>{ this.sendUpdate() });
|
||||||
|
}
|
||||||
|
|
||||||
|
sendUpdate = () => {
|
||||||
|
let data = {...this.state.data};
|
||||||
|
data.value = `${data.min}|${data.hour}|${data.day}|${data.month}|${data.week}|${data.year}`;
|
||||||
|
delete data.year;
|
||||||
|
delete data.week;
|
||||||
|
delete data.month;
|
||||||
|
delete data.day;
|
||||||
|
delete data.hour;
|
||||||
|
delete data.min;
|
||||||
|
this.props.updateData({...this.props.data, ...data});
|
||||||
|
}
|
||||||
|
|
||||||
|
render() {
|
||||||
|
let {ops} = this.props;
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
<select value={this.state.data.op} onChange={e=>{this.changeState('op', e.target.value)}}>
|
||||||
|
<option value="">選擇條件</option>
|
||||||
|
{
|
||||||
|
ops.map((t,idx) => {
|
||||||
|
if(t.code != 8 && t.code != 9) {
|
||||||
|
return (
|
||||||
|
<option value={t.code} key={idx}>{t.name}</option>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
</select>
|
||||||
|
<Input size="mini" placeholder="年(不指定請留空)" value={this.state.data.year == '-' ? '' : this.state.data.year}
|
||||||
|
onChange={(e,d) => {this.changeState('year', d.value)}} />
|
||||||
|
<Input size="mini" placeholder="週(不指定請留空)" value={this.state.data.week == '-' ? '' : this.state.data.week}
|
||||||
|
onChange={(e,d) => {this.changeState('week', d.value)}} />
|
||||||
|
<Input size="mini" placeholder="月(不指定請留空)" value={this.state.data.month == '-' ? '' : this.state.data.month}
|
||||||
|
onChange={(e,d) => {this.changeState('month', d.value)}} />
|
||||||
|
<Input size="mini" placeholder="日(不指定請留空)" value={this.state.data.day == '-' ? '' : this.state.data.day}
|
||||||
|
onChange={(e,d) => {this.changeState('day', d.value)}} />
|
||||||
|
<Input size="mini" placeholder="時(不指定請留空)" value={this.state.data.hour == '-' ? '' : this.state.data.hour}
|
||||||
|
onChange={(e,d) => {this.changeState('hour', d.value)}} />
|
||||||
|
<Input size="mini" placeholder="分(不指定請留空)" value={this.state.data.min == '-' ? '' : this.state.data.min}
|
||||||
|
onChange={(e,d) => {this.changeState('min', d.value)}} />
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default UnitTime;
|
||||||
@@ -0,0 +1,63 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import {Segment, Input, Form} from 'semantic-ui-react';
|
||||||
|
import UnitLeone from './UnitLeone';
|
||||||
|
import UnitDigitalInput from './UnitDigitalInput';
|
||||||
|
import UnitTime from './UnitTime';
|
||||||
|
import UnitGroups from './UnitGroups';
|
||||||
|
import UnitModbus from './UnitModbus';
|
||||||
|
|
||||||
|
class Unit extends React.Component {
|
||||||
|
|
||||||
|
handleChangeUnit = (val) => {
|
||||||
|
this.props.changeUnitType(this.props.id, val);
|
||||||
|
}
|
||||||
|
|
||||||
|
getUnitComponent = () => {
|
||||||
|
|
||||||
|
let {data, ops, i18n, showDialog, toggleLoading, groups} = this.props;
|
||||||
|
|
||||||
|
switch(data.unit){
|
||||||
|
case 'leone':
|
||||||
|
return <UnitLeone ops={ops} data={data.data} i18n={i18n} showDialog={showDialog} toggleLoading={toggleLoading} updateData={this.updateData} />
|
||||||
|
case 'di':
|
||||||
|
return <UnitDigitalInput ops={ops} data={data.data} i18n={i18n} showDialog={showDialog} toggleLoading={toggleLoading} updateData={this.updateData} />
|
||||||
|
case 'modbus':
|
||||||
|
return <UnitModbus ops={ops} data={data.data} i18n={i18n} showDialog={showDialog} toggleLoading={toggleLoading} updateData={this.updateData} />
|
||||||
|
case 'time':
|
||||||
|
return <UnitTime ops={ops} data={data.data} i18n={i18n} showDialog={showDialog} toggleLoading={toggleLoading} updateData={this.updateData} />
|
||||||
|
case 'unit':
|
||||||
|
return <UnitGroups i18n={i18n} data={data.data} groups={groups} updateData={this.updateData} />
|
||||||
|
default:
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
updateData = (data) => {
|
||||||
|
console.log(data);
|
||||||
|
this.props.updateData(this.props.id, data);
|
||||||
|
}
|
||||||
|
|
||||||
|
render() {
|
||||||
|
let {ops, id} = this.props;
|
||||||
|
return (
|
||||||
|
<Segment>
|
||||||
|
<Form.Field>
|
||||||
|
<label>選擇元件</label>
|
||||||
|
<select value={this.props.data.unit} onChange={e => {
|
||||||
|
this.handleChangeUnit(e.target.value);
|
||||||
|
}}>
|
||||||
|
<option value="">請選擇元件</option>
|
||||||
|
<option value="leone">LeOne</option>
|
||||||
|
<option value="di">DigitalInput</option>
|
||||||
|
<option value="modbus">Modbus</option>
|
||||||
|
<option value="time">時間</option>
|
||||||
|
<option value="unit">已建立群組</option>
|
||||||
|
</select>
|
||||||
|
</Form.Field>
|
||||||
|
{this.getUnitComponent()}
|
||||||
|
</Segment>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default Unit;
|
||||||
@@ -0,0 +1,225 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import { Segment, Input, Button, Form, Grid } from 'semantic-ui-react';
|
||||||
|
import Unit from './Unit';
|
||||||
|
|
||||||
|
const ops = [
|
||||||
|
{
|
||||||
|
"code": "0",
|
||||||
|
"name": "等於"
|
||||||
|
}, {
|
||||||
|
"code": "1",
|
||||||
|
"name": "大於"
|
||||||
|
}, {
|
||||||
|
"code": "2",
|
||||||
|
"name": "小於"
|
||||||
|
}, {
|
||||||
|
"code": "3",
|
||||||
|
"name": "大於等於"
|
||||||
|
}, {
|
||||||
|
"code": "4",
|
||||||
|
"name": "小於等於"
|
||||||
|
}, {
|
||||||
|
"code": "5",
|
||||||
|
"name": "不等於"
|
||||||
|
}, {
|
||||||
|
"code": "8",
|
||||||
|
"name": "AND"
|
||||||
|
}, {
|
||||||
|
"code": "9",
|
||||||
|
"name": "OR"
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
const stateDefault = () => ({
|
||||||
|
id1: {
|
||||||
|
unit: '',
|
||||||
|
data: {}
|
||||||
|
},
|
||||||
|
id2: {
|
||||||
|
unit: '',
|
||||||
|
data: {}
|
||||||
|
},
|
||||||
|
name: '',
|
||||||
|
op: ''
|
||||||
|
})
|
||||||
|
|
||||||
|
const lcDef = () => ({
|
||||||
|
type: 'lc',
|
||||||
|
id: '',
|
||||||
|
op: '',
|
||||||
|
value: ''
|
||||||
|
})
|
||||||
|
|
||||||
|
const lnDef = () => ({
|
||||||
|
type: 'ln',
|
||||||
|
dev: ''
|
||||||
|
})
|
||||||
|
|
||||||
|
class ConditionField extends React.Component {
|
||||||
|
state = {
|
||||||
|
...stateDefault()
|
||||||
|
}
|
||||||
|
|
||||||
|
changeUnitType = (id, type) => {
|
||||||
|
let st = this.state;
|
||||||
|
if(id in st){
|
||||||
|
st[id].unit = type;
|
||||||
|
if(type == ''){
|
||||||
|
st[id].data = {}
|
||||||
|
}else if(type == 'unit'){
|
||||||
|
st[id].data = {...lnDef()}
|
||||||
|
}else {
|
||||||
|
st[id].data = {...lcDef()}
|
||||||
|
}
|
||||||
|
this.setState({
|
||||||
|
...st
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
updateData = (id, data) => {
|
||||||
|
let st = this.state;
|
||||||
|
if(id in st) {
|
||||||
|
st[id].data = data;
|
||||||
|
this.setState({
|
||||||
|
...st
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
clearField = () => {
|
||||||
|
this.setState({
|
||||||
|
...stateDefault()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
joinGroup = () => {
|
||||||
|
let id1 = {...this.state.id1};
|
||||||
|
let id2 = {...this.state.id2};
|
||||||
|
let {showDialog, addNewGroup} = this.props;
|
||||||
|
if(!('type' in id1.data)){
|
||||||
|
showDialog('請選擇元件');
|
||||||
|
}else{
|
||||||
|
if(id1.data.type == 'lc') {
|
||||||
|
let chk = this.checkLC(id1.data);
|
||||||
|
if(chk.status != 1) return showDialog(chk.message);
|
||||||
|
}else{
|
||||||
|
let chk = this.checkLN(id1.data);
|
||||||
|
if(chk.status != 1) return showDialog(chk.message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!('type' in id2.data)){
|
||||||
|
showDialog('請選擇元件');
|
||||||
|
}else{
|
||||||
|
if(id2.data.type == 'lc') {
|
||||||
|
let chk = this.checkLC(id2.data);
|
||||||
|
if(chk.status != 1) return showDialog(chk.message);
|
||||||
|
}else{
|
||||||
|
let chk = this.checkLN(id2.data);
|
||||||
|
if(chk.status != 1) return showDialog(chk.message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!this.state.op) return showDialog('請選擇條件');
|
||||||
|
if(!this.state.name) return showDialog('請輸入名稱');
|
||||||
|
|
||||||
|
addNewGroup({
|
||||||
|
name: this.state.name,
|
||||||
|
op: this.state.op,
|
||||||
|
type: 'ln',
|
||||||
|
id1: id1.data,
|
||||||
|
id2: id2.data
|
||||||
|
}, this.clearField);
|
||||||
|
}
|
||||||
|
|
||||||
|
changeState = (tag, value) => {
|
||||||
|
if(!tag) return ;
|
||||||
|
if(tag == 'name'){
|
||||||
|
this.setState({
|
||||||
|
name: value
|
||||||
|
})
|
||||||
|
}
|
||||||
|
if(tag == 'op'){
|
||||||
|
this.setState({
|
||||||
|
op: value
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
checkLC = (data) => {
|
||||||
|
let json = {
|
||||||
|
status: 0,
|
||||||
|
message: ''
|
||||||
|
};
|
||||||
|
if(typeof data != 'object' || Object.keys(data).length == 0) return {...json, message: '請選擇元件'};
|
||||||
|
if(!data.id) return {...json, message: '請選擇裝置'};
|
||||||
|
if(!('op' in data) || data.op == '') return {...json, message: '請選擇條件'};
|
||||||
|
if(!('value' in data) || data.value == '') return {...json, message: '請輸入數值'};
|
||||||
|
return {...json, status: 1}
|
||||||
|
}
|
||||||
|
|
||||||
|
checkLN = (data) => {
|
||||||
|
let json = {
|
||||||
|
status: 0,
|
||||||
|
message: ''
|
||||||
|
};
|
||||||
|
if(typeof data != 'object' || Object.keys(data).length == 0) return {...json, message: '請選擇元件'};
|
||||||
|
if(!data.dev) return {...json, message: '請選擇群組'};
|
||||||
|
return {...json, status: 1};
|
||||||
|
}
|
||||||
|
|
||||||
|
render() {
|
||||||
|
let {i18n, showDialog, toggleLoading} = this.props;
|
||||||
|
return (
|
||||||
|
<Segment color="red">
|
||||||
|
<Form.Field>
|
||||||
|
<Input label="節點名稱" value={this.state.name} onChange={(e,d)=>{ this.changeState('name', d.value) }} />
|
||||||
|
</Form.Field>
|
||||||
|
<Form.Field>
|
||||||
|
<label>觸發條件</label>
|
||||||
|
<select value={this.state.op} onChange={e=>{this.changeState('op', e.target.value)}}>
|
||||||
|
<option value="">請選擇觸發條件</option>
|
||||||
|
{
|
||||||
|
ops.map((t,idx) => {
|
||||||
|
if(t.code == 8 || t.code == 9) {
|
||||||
|
return (
|
||||||
|
<option key={idx} value={t.code}>{t.name}</option>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
</select>
|
||||||
|
</Form.Field>
|
||||||
|
<Grid columns={2} padded>
|
||||||
|
<Grid.Column>
|
||||||
|
<Unit i18n={i18n} id="id1"
|
||||||
|
data={this.state.id1}
|
||||||
|
groups={this.props.groups}
|
||||||
|
ops={ops}
|
||||||
|
toggleLoading={toggleLoading}
|
||||||
|
showDialog={showDialog}
|
||||||
|
updateData={this.updateData}
|
||||||
|
changeUnitType={this.changeUnitType}/>
|
||||||
|
</Grid.Column>
|
||||||
|
<Grid.Column>
|
||||||
|
<Unit i18n={i18n} id="id2"
|
||||||
|
data={this.state.id2}
|
||||||
|
groups={this.props.groups}
|
||||||
|
ops={ops}
|
||||||
|
toggleLoading={toggleLoading}
|
||||||
|
showDialog={showDialog}
|
||||||
|
updateData={this.updateData}
|
||||||
|
changeUnitType={this.changeUnitType}/>
|
||||||
|
</Grid.Column>
|
||||||
|
</Grid>
|
||||||
|
<div style={{textAlign: 'right'}}>
|
||||||
|
<Button content="加入" basic size="mini" color="blue" onClick={()=>{this.joinGroup()}} />
|
||||||
|
<Button content="清除" basic size="mini" color="red" onClick={()=>{this.clearField()}} />
|
||||||
|
</div>
|
||||||
|
</Segment>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default ConditionField;
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import { Modal, Header, Button, Form } from 'semantic-ui-react';
|
||||||
|
|
||||||
|
const ShowTree = ({ i18n, open, data, onClose, delItem }) => {
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Modal open={open} onClose={()=>{onClose(0)}}>
|
||||||
|
<Modal.Header content="連動群組資料" />
|
||||||
|
<Modal.Content>
|
||||||
|
<Form onSubmit={(e,d)=>{
|
||||||
|
e.preventDefault();
|
||||||
|
delItem(d.formData.key);
|
||||||
|
}} serializer={e=>{
|
||||||
|
let json = {key:''};
|
||||||
|
let key = e.querySelector('select[name="key"]');
|
||||||
|
if(key && 'value' in key) json.key = key.value;
|
||||||
|
|
||||||
|
return json;
|
||||||
|
}}>
|
||||||
|
<Form.Group inline>
|
||||||
|
<Form.Field>
|
||||||
|
<label>選擇要刪除的群組</label>
|
||||||
|
<select name="key">
|
||||||
|
<option value="">選擇群組</option>
|
||||||
|
{
|
||||||
|
Object.keys(data).map((t,idx) => (
|
||||||
|
<option key={idx} value={t}>{data[t].name}</option>
|
||||||
|
))
|
||||||
|
}
|
||||||
|
</select>
|
||||||
|
</Form.Field>
|
||||||
|
<Form.Field>
|
||||||
|
<Button type="submit" basic size="mini" content="刪除群組" />
|
||||||
|
</Form.Field>
|
||||||
|
</Form.Group>
|
||||||
|
</Form>
|
||||||
|
<pre>
|
||||||
|
{
|
||||||
|
JSON.stringify(data, null, 4)
|
||||||
|
}
|
||||||
|
</pre>
|
||||||
|
</Modal.Content>
|
||||||
|
</Modal>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default ShowTree;
|
||||||
@@ -0,0 +1,175 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import {
|
||||||
|
Container,
|
||||||
|
Segment,
|
||||||
|
Form,
|
||||||
|
Input,
|
||||||
|
Button,
|
||||||
|
Checkbox,
|
||||||
|
Grid,
|
||||||
|
Menu,
|
||||||
|
List
|
||||||
|
} from 'semantic-ui-react';
|
||||||
|
import {getRequest} from '../../../actions';
|
||||||
|
import ConditionField from './Condition';
|
||||||
|
import ActionSelect from './ActionSelect';
|
||||||
|
import ActionList from './ActionList';
|
||||||
|
import ShowTree from './ShowTree';
|
||||||
|
|
||||||
|
const stateDefault = ()=>({
|
||||||
|
groups: {},
|
||||||
|
idx: 0,
|
||||||
|
active: 0,
|
||||||
|
actions: [],
|
||||||
|
showTree: false
|
||||||
|
})
|
||||||
|
|
||||||
|
class ActionLinkAdd extends React.Component {
|
||||||
|
state = {
|
||||||
|
...stateDefault()
|
||||||
|
}
|
||||||
|
|
||||||
|
changeState = (tag, value) => {
|
||||||
|
if(tag == 'active'){
|
||||||
|
this.setState({
|
||||||
|
active: value?1:0
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
addNewGroup = (data, cb = null) => {
|
||||||
|
let devs = [];
|
||||||
|
let {groups} = this.state
|
||||||
|
if(data.id1.type == 'ln') devs.push(data.id1.dev)
|
||||||
|
if(data.id2.type == 'ln') devs.push(data.id2.dev)
|
||||||
|
|
||||||
|
data.id1 = {...data.id1, ...groups[data.id1.dev]}
|
||||||
|
data.id2 = {...data.id2, ...groups[data.id2.dev]}
|
||||||
|
delete data.id1.dev;
|
||||||
|
delete data.id2.dev;
|
||||||
|
|
||||||
|
for(let i in devs){
|
||||||
|
if(devs[i] in groups) delete groups[devs[i]];
|
||||||
|
}
|
||||||
|
|
||||||
|
let idx = this.state.idx + 1;
|
||||||
|
groups[`unit${idx}`] = data;
|
||||||
|
|
||||||
|
this.setState({
|
||||||
|
groups,
|
||||||
|
idx
|
||||||
|
}, ()=>{
|
||||||
|
if(cb && typeof cb == 'function') cb();
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
addNewAction = (data, cb=null) => {
|
||||||
|
this.setState({
|
||||||
|
actions: [...this.state.actions, data]
|
||||||
|
}, ()=>{
|
||||||
|
if(cb && typeof cb == 'function') cb();
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
removeAction = (idx) => {
|
||||||
|
let {actions} = this.state;
|
||||||
|
actions.splice(idx, 1);
|
||||||
|
this.setState({
|
||||||
|
actions
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
toggleShowTree = (flag) => {
|
||||||
|
this.setState({
|
||||||
|
showTree: flag ? true : false
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
delGroup = (key) => {
|
||||||
|
if(!key) return ;
|
||||||
|
let {groups} = this.state;
|
||||||
|
if(key in groups) delete groups[key];
|
||||||
|
|
||||||
|
this.setState({
|
||||||
|
groups
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
saveLink = () => {
|
||||||
|
let {showDialog, toggleLoading} = this.props;
|
||||||
|
if(this.state.actions.length == 0) return showDialog('請至少加入一個動作');
|
||||||
|
if(Object.keys(this.state.groups).length == 0) return showDialog('請建立群組');
|
||||||
|
if(Object.keys(this.state.groups).length > 1) return showDialog('根群組數量大於一,請合併或刪除');
|
||||||
|
|
||||||
|
let data = {
|
||||||
|
active: this.state.active,
|
||||||
|
action: '',
|
||||||
|
link: {}
|
||||||
|
}
|
||||||
|
|
||||||
|
let act = [];
|
||||||
|
for(let i in this.state.actions) {
|
||||||
|
let tmp = this.state.actions[i];
|
||||||
|
act.push(`${tmp.dev},${tmp.act},0`);
|
||||||
|
}
|
||||||
|
|
||||||
|
data.action = act.join('|');
|
||||||
|
|
||||||
|
data.link = this.state.groups[Object.keys(this.state.groups)[0]];
|
||||||
|
|
||||||
|
fetch('/api/link/addlink', getRequest(data))
|
||||||
|
.then(response=>response.json())
|
||||||
|
.then(json=>{
|
||||||
|
if(json.status != 1) return showDialog(json.message);
|
||||||
|
showDialog('新增完成');
|
||||||
|
this.resetData()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
resetData = ()=>{
|
||||||
|
this.setState({
|
||||||
|
...stateDefault()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
render() {
|
||||||
|
let {i18n, showDialog, toggleLoading} = this.props;
|
||||||
|
return (
|
||||||
|
<Container>
|
||||||
|
<Menu>
|
||||||
|
<Menu.Menu position="right">
|
||||||
|
<Menu.Item content="ShowTree" onClick={()=>{ this.toggleShowTree(1) }}/>
|
||||||
|
<Menu.Item content="Save" onClick={()=>{this.saveLink()}}/>
|
||||||
|
</Menu.Menu>
|
||||||
|
</Menu>
|
||||||
|
<Form as={Segment}>
|
||||||
|
<Form.Field>
|
||||||
|
<Checkbox label="啟用連動" checked={this.state.active == 1} onChange={(e,d)=>{this.changeState('active', d.checked)}} />
|
||||||
|
</Form.Field>
|
||||||
|
<Form.Field>
|
||||||
|
<label>建立條件群組</label>
|
||||||
|
<ConditionField i18n={i18n}
|
||||||
|
showDialog={showDialog}
|
||||||
|
toggleLoading={toggleLoading}
|
||||||
|
groups={this.state.groups}
|
||||||
|
addNewGroup={this.addNewGroup} />
|
||||||
|
</Form.Field>
|
||||||
|
<Form.Field>
|
||||||
|
<label>加入動作</label>
|
||||||
|
<ActionSelect i18n={i18n}
|
||||||
|
showDialog={showDialog}
|
||||||
|
toggleLoading={toggleLoading}
|
||||||
|
addNewAction={this.addNewAction} />
|
||||||
|
</Form.Field>
|
||||||
|
<Form.Field>
|
||||||
|
<label>已選擇動作</label>
|
||||||
|
<ActionList i18n={i18n} list={this.state.actions} removeAction={this.removeAction} />
|
||||||
|
</Form.Field>
|
||||||
|
</Form>
|
||||||
|
<ShowTree i18n={i18n} open={this.state.showTree} data={this.state.groups} onClose={this.toggleShowTree} delItem={this.delGroup} />
|
||||||
|
</Container>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default ActionLinkAdd;
|
||||||
@@ -0,0 +1,82 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import { Modal, Grid, List, Menu, Icon, Message } from 'semantic-ui-react';
|
||||||
|
import {convertTime} from '../../../tools';
|
||||||
|
import ImgGrid from './EvtImgGrid';
|
||||||
|
|
||||||
|
const EventModal = ({ i18n, open, name, list, sel, closeEventModal, changeSelectEvent,refreshEvt, delEvent }) => {
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Modal open={open} onClose={()=>{closeEventModal()}} size="fullscreen">
|
||||||
|
<Modal.Header content={`IPCam: ${name}`} />
|
||||||
|
<Modal.Content>
|
||||||
|
<Grid>
|
||||||
|
<Grid.Column width={4}>
|
||||||
|
<Menu vertical>
|
||||||
|
<Menu.Item>
|
||||||
|
<Menu.Header>
|
||||||
|
事件列表
|
||||||
|
<Icon name="refresh" style={{
|
||||||
|
cursor: "pointer",
|
||||||
|
float: 'right'
|
||||||
|
}} onClick={()=>{refreshEvt(-1)}}/>
|
||||||
|
</Menu.Header>
|
||||||
|
<Menu.Menu>
|
||||||
|
{
|
||||||
|
list.map((t,idx) =>{
|
||||||
|
let n = t.name;
|
||||||
|
let time = n.split('-')[1];
|
||||||
|
return (
|
||||||
|
<Menu.Item key={idx} active={sel == idx} >
|
||||||
|
<span onClick={()=>{changeSelectEvent(idx)}}
|
||||||
|
style={{cursor: "pointer"}}>{convertTime(time, true)}</span>
|
||||||
|
<Icon name="download" title="下載事件" style={{
|
||||||
|
cursor: "pointer",
|
||||||
|
float: 'right'
|
||||||
|
}} onClick={()=>{window.open(`/dlevent/${t.name}`, '_blank')}}/>
|
||||||
|
<Icon name="trash" title="刪除事件" style={{
|
||||||
|
cursor: "pointer",
|
||||||
|
float: 'right'
|
||||||
|
}} onClick={()=>{delEvent(t.name)}}/>
|
||||||
|
</Menu.Item>
|
||||||
|
)})
|
||||||
|
}
|
||||||
|
</Menu.Menu>
|
||||||
|
</Menu.Item>
|
||||||
|
</Menu>
|
||||||
|
</Grid.Column>
|
||||||
|
<Grid.Column width={12}>
|
||||||
|
{
|
||||||
|
sel != -1 && list[sel].files.video.length > 0 ? (
|
||||||
|
<Message>
|
||||||
|
<Message.Header>影片下載</Message.Header>
|
||||||
|
<p>
|
||||||
|
{
|
||||||
|
list[sel].files.video.map((t, idx) => {
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div key={idx}>
|
||||||
|
<a href={`/dlcamvideo/${list[sel].name}/${t}`} target="_blank">{t}</a>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
</p>
|
||||||
|
</Message>
|
||||||
|
) :null
|
||||||
|
}
|
||||||
|
{
|
||||||
|
sel != -1 ?
|
||||||
|
(
|
||||||
|
<ImgGrid i18n={i18n}
|
||||||
|
dname={list[sel].name}
|
||||||
|
list={list[sel].files.img} />
|
||||||
|
) : null
|
||||||
|
}
|
||||||
|
</Grid.Column>
|
||||||
|
</Grid>
|
||||||
|
</Modal.Content>
|
||||||
|
</Modal>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default EventModal;
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import {Grid, Image} from 'semantic-ui-react';
|
||||||
|
|
||||||
|
const EvtImgGrid = ({ i18n, dname, list }) => {
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Grid columns={3}>
|
||||||
|
{
|
||||||
|
list.map((t,idx) => {
|
||||||
|
return (
|
||||||
|
<Grid.Column key={idx}>
|
||||||
|
<Image fluid src={`/viewcamimg/${dname}/${t}`} href={`/viewcamimg/${dname}/${t}`} target="_blank"/>
|
||||||
|
</Grid.Column>
|
||||||
|
)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
</Grid>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default EvtImgGrid;
|
||||||
@@ -0,0 +1,68 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import { Modal, Form, Grid, Button, Input, Checkbox } from 'semantic-ui-react';
|
||||||
|
|
||||||
|
const IPCamModal = ({ i18n, open, type, data, closeModal, submitModal }) => {
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Modal open={open}>
|
||||||
|
<Modal.Header content={type == 1 ? '修改資料' : '新增資料'} />
|
||||||
|
<Modal.Content>
|
||||||
|
<Form onSubmit={(e,d) => {
|
||||||
|
e.preventDefault();
|
||||||
|
submitModal(type, d.formData);
|
||||||
|
}} serializer={e=>{
|
||||||
|
let json = {};
|
||||||
|
|
||||||
|
let name = e.querySelector('input[name="name"]');
|
||||||
|
if(name && 'value' in name) json.name = name.value;
|
||||||
|
let ip = e.querySelector('input[name="ip"]');
|
||||||
|
if(ip && 'value' in ip) json.ip = ip.value;
|
||||||
|
let model = e.querySelector('select[name="model"]');
|
||||||
|
if(model && 'value' in model) json.model = model.value;
|
||||||
|
let maxevents = e.querySelector('input[name="maxevents"]');
|
||||||
|
if(maxevents && 'value' in maxevents) json.maxevents = maxevents.value;
|
||||||
|
let maximg = e.querySelector('input[name="maximg"]');
|
||||||
|
if(maximg && 'value' in maximg) json.maximg = maximg.value;
|
||||||
|
let active = e.querySelector('input[type="checkbox"]');
|
||||||
|
if(active && 'checked' in active) json.active = active.checked;
|
||||||
|
if(type == 1) json.id = data.uid;
|
||||||
|
|
||||||
|
return json;
|
||||||
|
}}>
|
||||||
|
<Form.Field>
|
||||||
|
<Checkbox label="啟用裝置" defaultChecked={data.active == 1} name="active" />
|
||||||
|
</Form.Field>
|
||||||
|
<Form.Field>
|
||||||
|
<Input name="name" label="名稱" defaultValue={data.name} />
|
||||||
|
</Form.Field>
|
||||||
|
<Form.Field>
|
||||||
|
<Input name="ip" label="IP" defaultValue={data.ip} />
|
||||||
|
</Form.Field>
|
||||||
|
<Form.Field>
|
||||||
|
<select defaultValue={data.model} name="model">
|
||||||
|
<option value="">請選擇型號</option>
|
||||||
|
<option value="AXIS-M1124">AXIS-M1124</option>
|
||||||
|
<option value="GRANDSTREAM-GXV3610_HD">GRANDSTREAM-GXV3610_HD</option>
|
||||||
|
</select>
|
||||||
|
</Form.Field>
|
||||||
|
<Form.Field>
|
||||||
|
<Input name="maxevents" label="最大儲存事件數量(1-10)" defaultValue={data.maxevents} />
|
||||||
|
</Form.Field>
|
||||||
|
<Form.Field>
|
||||||
|
<Input name="maximg" label="最大儲存圖片數量(1-20)" defaultValue={data.maximg} />
|
||||||
|
</Form.Field>
|
||||||
|
<Grid columns={2}>
|
||||||
|
<Grid.Column>
|
||||||
|
<Button type="submit" fluid content="送出" />
|
||||||
|
</Grid.Column>
|
||||||
|
<Grid.Column>
|
||||||
|
<Button type="button" fluid content="取消" onClick={()=>{closeModal()}} />
|
||||||
|
</Grid.Column>
|
||||||
|
</Grid>
|
||||||
|
</Form>
|
||||||
|
</Modal.Content>
|
||||||
|
</Modal>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default IPCamModal;
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import {Table, Button} from 'semantic-ui-react';
|
||||||
|
|
||||||
|
const ListItem = ({ i18n, data, swActive, openModal, delIPCam, getEvents }) => {
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Table.Row>
|
||||||
|
<Table.Cell>
|
||||||
|
<Button basic content="修改" type="button" onClick={()=>openModal(1, data)} />
|
||||||
|
<Button basic content="刪除" type="button" onClick={()=>delIPCam(data.uid)}/>
|
||||||
|
<Button basic content={data.active == 1 ? '停用' : '啟用'} type="button" onClick={()=>swActive(data.uid)} />
|
||||||
|
<Button basic content="事件紀錄" type="button" onClick={()=>getEvents(data.uid, data.name)} />
|
||||||
|
</Table.Cell>
|
||||||
|
<Table.Cell>{data.name}</Table.Cell>
|
||||||
|
<Table.Cell>{data.ip}</Table.Cell>
|
||||||
|
<Table.Cell>{data.model}</Table.Cell>
|
||||||
|
<Table.Cell>{data.model == 'AXIS-M1124' ? `/${data.model}-${data.uid}` : '/'}</Table.Cell>
|
||||||
|
<Table.Cell>{data.active == 1? '啟用' : '停用'}</Table.Cell>
|
||||||
|
</Table.Row>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default ListItem;
|
||||||
@@ -0,0 +1,222 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import { Container, Segment, Table, Button, Label, Message } from 'semantic-ui-react';
|
||||||
|
import {getRequest} from '../../../actions';
|
||||||
|
import ListItem from './ListItem';
|
||||||
|
import IPCamModal from './IPCamModal';
|
||||||
|
import EvtModal from './EventModal';
|
||||||
|
|
||||||
|
const stateDefault = ()=>({
|
||||||
|
list: [],
|
||||||
|
modal: {
|
||||||
|
type: 0,
|
||||||
|
open: false,
|
||||||
|
data: {}
|
||||||
|
},
|
||||||
|
evt: {
|
||||||
|
open: false,
|
||||||
|
list: [],
|
||||||
|
name: '',
|
||||||
|
sel: -1,
|
||||||
|
id: -1
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
class IPCamPage extends React.Component {
|
||||||
|
state = {
|
||||||
|
...stateDefault()
|
||||||
|
}
|
||||||
|
|
||||||
|
componentDidMount(){
|
||||||
|
this.getList();
|
||||||
|
}
|
||||||
|
|
||||||
|
getList = () => {
|
||||||
|
let {toggleLoading, showDialog} = this.props;
|
||||||
|
toggleLoading(1);
|
||||||
|
fetch('/api/ipcam/getipcamlist', getRequest())
|
||||||
|
.then(response => response.json())
|
||||||
|
.then(json => {
|
||||||
|
toggleLoading(0);
|
||||||
|
if(json.status != 1) return showDialog(json.message);
|
||||||
|
let list = json.data.record || [];
|
||||||
|
this.setState({
|
||||||
|
list
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
swActive = (id) => {
|
||||||
|
if(!id) return ;
|
||||||
|
let {toggleLoading, showDialog} = this.props;
|
||||||
|
toggleLoading(1);
|
||||||
|
fetch('/api/ipcam/swipcamactive', getRequest({id}))
|
||||||
|
.then(response=>response.json())
|
||||||
|
.then(json => {
|
||||||
|
toggleLoading(0);
|
||||||
|
if(json.status != 1) return showDialog(json.message);
|
||||||
|
this.getList();
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
openModal = (type, data = {}) => {
|
||||||
|
this.setState({
|
||||||
|
modal: {
|
||||||
|
type,
|
||||||
|
data,
|
||||||
|
open: true
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
closeModal = () => {
|
||||||
|
this.setState({
|
||||||
|
modal: {
|
||||||
|
...stateDefault().modal
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
submitModal = (type, data = {}) => {
|
||||||
|
let {toggleLoading,showDialog} = this.props;
|
||||||
|
if(type == 1 && !data.id) return showDialog('資料讀取錯誤');
|
||||||
|
if(!data.maxevents || data.maxevents < 1 || data.maxevents > 10) return showDialog('事件數量請介於1-5間');
|
||||||
|
if(!data.maximg || data.maximg < 1 || data.maximg > 20) return showDialog('圖片數量請介於1-5間');
|
||||||
|
if(!data.name) return showDialog('請輸入名稱');
|
||||||
|
if(!data.ip) return showDialog('請輸入IP');
|
||||||
|
if(!data.model) return showDialog('請選擇型號');
|
||||||
|
|
||||||
|
toggleLoading(1);
|
||||||
|
let url = type == 1 ? '/api/ipcam/editipcam' : '/api/ipcam/addipcam';
|
||||||
|
fetch(url, getRequest(data))
|
||||||
|
.then(response=>response.json())
|
||||||
|
.then(json => {
|
||||||
|
toggleLoading(0);
|
||||||
|
if(json.status != 1) return showDialog(json.message);
|
||||||
|
this.closeModal();
|
||||||
|
this.getList();
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
delIPCam = (id) => {
|
||||||
|
if(!id) return ;
|
||||||
|
let {callConfirm, toggleLoading, showDialog} = this.props;
|
||||||
|
callConfirm('確定要刪除此筆資料?', ()=>{
|
||||||
|
fetch('/api/ipcam/delipcam', getRequest({id}))
|
||||||
|
.then(response=>response.json())
|
||||||
|
.then(json => {
|
||||||
|
if(json.status != 1) return showDialog(json.message);
|
||||||
|
this.getList();
|
||||||
|
})
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
getEvents = (id, name = '') => {
|
||||||
|
if(!id) return ;
|
||||||
|
if(id==-1) id = this.state.evt.id;
|
||||||
|
let {callConfirm, toggleLoading, showDialog} = this.props;
|
||||||
|
toggleLoading(1);
|
||||||
|
fetch('/api/ipcam/getevents', getRequest({id}))
|
||||||
|
.then(response=>response.json())
|
||||||
|
.then(json => {
|
||||||
|
toggleLoading(0);
|
||||||
|
if(json.status != 1) return showDialog(json.message);
|
||||||
|
this.setState({
|
||||||
|
evt: {
|
||||||
|
open: true,
|
||||||
|
list: json.data.record || [],
|
||||||
|
name: name != '' ? name : this.state.evt.name,
|
||||||
|
sel: -1,
|
||||||
|
id
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
closeEventModal = () => {
|
||||||
|
this.setState({
|
||||||
|
evt: {
|
||||||
|
...stateDefault().evt
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
changeSelectEvent = (idx) => {
|
||||||
|
if(!isFinite(idx) || idx < 0) return ;
|
||||||
|
this.setState({
|
||||||
|
evt:{
|
||||||
|
...this.state.evt,
|
||||||
|
sel: idx
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
delEvent = (dir) => {
|
||||||
|
if(!dir) return ;
|
||||||
|
let {callConfirm, toggleLoading, showDialog} = this.props;
|
||||||
|
callConfirm('確定刪除這筆事件?', ()=>{
|
||||||
|
toggleLoading(1);
|
||||||
|
fetch('/api/ipcam/delevent', getRequest({dir}))
|
||||||
|
.then(response=>response.json())
|
||||||
|
.then(json => {
|
||||||
|
toggleLoading(0);
|
||||||
|
if(json.status != 1) return showDialog(json.message);
|
||||||
|
this.getEvents(-1);
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
render() {
|
||||||
|
let {i18n} = this.props;
|
||||||
|
return (
|
||||||
|
<Container>
|
||||||
|
<Segment className="clearfix">
|
||||||
|
<Message>
|
||||||
|
<Message.Header>攝影機事件通知位址</Message.Header>
|
||||||
|
<p>
|
||||||
|
{`${location.protocol}//${location.host}/camevent`}
|
||||||
|
</p>
|
||||||
|
</Message>
|
||||||
|
<Button basic content="新增" icon="plus" floated="right" type="button" style={{marginBottom: '15px'}} color="green" onClick={()=>{this.openModal(0)}} />
|
||||||
|
<Table>
|
||||||
|
<Table.Header>
|
||||||
|
<Table.Row>
|
||||||
|
<Table.HeaderCell>操作</Table.HeaderCell>
|
||||||
|
<Table.HeaderCell>名稱</Table.HeaderCell>
|
||||||
|
<Table.HeaderCell>IP</Table.HeaderCell>
|
||||||
|
<Table.HeaderCell>型號</Table.HeaderCell>
|
||||||
|
<Table.HeaderCell>FTP路徑</Table.HeaderCell>
|
||||||
|
<Table.HeaderCell>啟用狀態</Table.HeaderCell>
|
||||||
|
</Table.Row>
|
||||||
|
</Table.Header>
|
||||||
|
<Table.Body>
|
||||||
|
{
|
||||||
|
this.state.list.map((t,idx) => (
|
||||||
|
<ListItem key={idx}
|
||||||
|
i18n={i18n}
|
||||||
|
data={t}
|
||||||
|
swActive={this.swActive}
|
||||||
|
delIPCam={this.delIPCam}
|
||||||
|
openModal={this.openModal}
|
||||||
|
getEvents={this.getEvents} />
|
||||||
|
))
|
||||||
|
}
|
||||||
|
</Table.Body>
|
||||||
|
</Table>
|
||||||
|
</Segment>
|
||||||
|
<IPCamModal i18n={i18n}
|
||||||
|
open={this.state.modal.open}
|
||||||
|
data={this.state.modal.data}
|
||||||
|
type={this.state.modal.type}
|
||||||
|
closeModal={this.closeModal}
|
||||||
|
submitModal={this.submitModal} />
|
||||||
|
<EvtModal i18n={i18n}
|
||||||
|
open={this.state.evt.open}
|
||||||
|
list={this.state.evt.list}
|
||||||
|
sel={this.state.evt.sel}
|
||||||
|
name={this.state.evt.name}
|
||||||
|
refreshEvt={this.getEvents}
|
||||||
|
closeEventModal={this.closeEventModal}
|
||||||
|
changeSelectEvent={this.changeSelectEvent}
|
||||||
|
delEvent={this.delEvent} />
|
||||||
|
</Container>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default IPCamPage;
|
||||||
@@ -5,7 +5,8 @@ const AIOForm = ({i18n, open, type, data, onSubmit, onClose}) => {
|
|||||||
if(!open) return null;
|
if(!open) return null;
|
||||||
let input = {
|
let input = {
|
||||||
name: data.name || '',
|
name: data.name || '',
|
||||||
portnum: data.portnum || '',
|
portnum: data.portnum,
|
||||||
|
type: data.type,
|
||||||
scale_min: data.scale_min || 0,
|
scale_min: data.scale_min || 0,
|
||||||
scale_max: data.scale_max || 0,
|
scale_max: data.scale_max || 0,
|
||||||
range_min: data.range_min || 0,
|
range_min: data.range_min || 0,
|
||||||
@@ -14,7 +15,8 @@ const AIOForm = ({i18n, open, type, data, onSubmit, onClose}) => {
|
|||||||
return (
|
return (
|
||||||
<Table.Row>
|
<Table.Row>
|
||||||
<Table.Cell><Input name="name" onChange={(e,d)=>{input.name = d.value}} defaultValue={data.name || ''}/></Table.Cell>
|
<Table.Cell><Input name="name" onChange={(e,d)=>{input.name = d.value}} defaultValue={data.name || ''}/></Table.Cell>
|
||||||
<Table.Cell><Input name="portnum" onChange={(e,d)=>{input.portnum = d.value}} defaultValue={data.portnum || ''}/></Table.Cell>
|
<Table.Cell><Input name="portnum" onChange={(e,d)=>{input.portnum = d.value}} defaultValue={data.portnum}/></Table.Cell>
|
||||||
|
<Table.Cell><Input name="type" onChange={(e,d)=>{input.type = d.value}} defaultValue={data.type}/></Table.Cell>
|
||||||
<Table.Cell>
|
<Table.Cell>
|
||||||
<Input name="range_min" size="small" label="Min" onChange={(e,d)=>{input.range_min = d.value}} defaultValue={data.range_min || '0'}/>
|
<Input name="range_min" size="small" label="Min" onChange={(e,d)=>{input.range_min = d.value}} defaultValue={data.range_min || '0'}/>
|
||||||
<Input name="range_max" size="small" label="Max" onChange={(e,d)=>{input.range_max = d.value}} defaultValue={data.range_max || '0'}/>
|
<Input name="range_max" size="small" label="Max" onChange={(e,d)=>{input.range_max = d.value}} defaultValue={data.range_max || '0'}/>
|
||||||
|
|||||||
@@ -6,7 +6,8 @@ const AIOListItem = ({i18n, data, editAIO, delAIO}) => {
|
|||||||
return (
|
return (
|
||||||
<Table.Row>
|
<Table.Row>
|
||||||
<Table.Cell>{data.name || ''}</Table.Cell>
|
<Table.Cell>{data.name || ''}</Table.Cell>
|
||||||
<Table.Cell>{data.portnum || ''}</Table.Cell>
|
<Table.Cell>{data.portnum}</Table.Cell>
|
||||||
|
<Table.Cell>{data.type}</Table.Cell>
|
||||||
<Table.Cell>{data.range_min || 0} ~ {data.range_max || 0}</Table.Cell>
|
<Table.Cell>{data.range_min || 0} ~ {data.range_max || 0}</Table.Cell>
|
||||||
<Table.Cell>{data.scale_min || 0} ~ {data.scale_max || 0}</Table.Cell>
|
<Table.Cell>{data.scale_min || 0} ~ {data.scale_max || 0}</Table.Cell>
|
||||||
<Table.Cell>
|
<Table.Cell>
|
||||||
|
|||||||
@@ -47,6 +47,7 @@ class AIOModal extends React.Component {
|
|||||||
<Table.Row>
|
<Table.Row>
|
||||||
<Table.HeaderCell>名稱</Table.HeaderCell>
|
<Table.HeaderCell>名稱</Table.HeaderCell>
|
||||||
<Table.HeaderCell>接口號碼</Table.HeaderCell>
|
<Table.HeaderCell>接口號碼</Table.HeaderCell>
|
||||||
|
<Table.HeaderCell>資料類型</Table.HeaderCell>
|
||||||
<Table.HeaderCell>Range(Min-Max)</Table.HeaderCell>
|
<Table.HeaderCell>Range(Min-Max)</Table.HeaderCell>
|
||||||
<Table.HeaderCell>Scale(Min-Max)</Table.HeaderCell>
|
<Table.HeaderCell>Scale(Min-Max)</Table.HeaderCell>
|
||||||
<Table.HeaderCell>操作</Table.HeaderCell>
|
<Table.HeaderCell>操作</Table.HeaderCell>
|
||||||
|
|||||||
@@ -5,13 +5,16 @@ const DeviceListItem = ({i18n, idx, data, delModbus, editModbus, showDev, select
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<List.Item active={data.uid == showDev}>
|
<List.Item active={data.uid == showDev}>
|
||||||
<span style={{cursor: 'pointer'}} onClick={() => {
|
<Icon style={{cursor: 'pointer'}} name="trash" title="Delete" onClick={()=>{delModbus(data.uid || '')}}/>
|
||||||
|
<Icon style={{cursor: 'pointer'}} name="write" title="Edit" onClick={()=>{editModbus(1, data)}}/>
|
||||||
|
<List.Content style={{cursor: 'pointer'}} onClick={() => {
|
||||||
selectDevToShow(data.uid);
|
selectDevToShow(data.uid);
|
||||||
}}>
|
}}>
|
||||||
{data.name} / Node:{data.node}
|
<List.Header>
|
||||||
</span>
|
{data.name}
|
||||||
<Icon style={{cursor: 'pointer'}} name="trash" onClick={()=>{delModbus(data.uid || '')}}/>
|
</List.Header>
|
||||||
<Icon style={{cursor: 'pointer'}} name="write" onClick={()=>{editModbus(1, data)}}/>
|
Node: {data.node} / Type: {data.type}
|
||||||
|
</List.Content>
|
||||||
</List.Item>
|
</List.Item>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ const IOModal = ({i18n, open, type, data, onSubmit, onClose}) => {
|
|||||||
id: data.uid || '',
|
id: data.uid || '',
|
||||||
addr: '',
|
addr: '',
|
||||||
num: '',
|
num: '',
|
||||||
|
datalen: '',
|
||||||
type: ''
|
type: ''
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -26,6 +27,8 @@ const IOModal = ({i18n, open, type, data, onSubmit, onClose}) => {
|
|||||||
if(num && 'value' in num) json.num = num.value;
|
if(num && 'value' in num) json.num = num.value;
|
||||||
let type = e.querySelector('select[name="io_type"]');
|
let type = e.querySelector('select[name="io_type"]');
|
||||||
if(type && 'value' in type) json.type = type.value;
|
if(type && 'value' in type) json.type = type.value;
|
||||||
|
let len = e.querySelector('input[name="datalen"]');
|
||||||
|
if(len && 'value' in len) json.datalen = len.value;
|
||||||
|
|
||||||
return json;
|
return json;
|
||||||
}}>
|
}}>
|
||||||
@@ -41,10 +44,13 @@ const IOModal = ({i18n, open, type, data, onSubmit, onClose}) => {
|
|||||||
</select>
|
</select>
|
||||||
</Form.Field>
|
</Form.Field>
|
||||||
<Form.Field>
|
<Form.Field>
|
||||||
<Input name="addr" label="起始位址" defaultValue={data.addr || ''} />
|
<Input name="addr" label="起始位址" defaultValue={data.addr} />
|
||||||
</Form.Field>
|
</Form.Field>
|
||||||
<Form.Field>
|
<Form.Field>
|
||||||
<Input name="num" label="數量" defaultValue={data.num || ''} />
|
<Input name="num" label="數量" defaultValue={data.num} />
|
||||||
|
</Form.Field>
|
||||||
|
<Form.Field>
|
||||||
|
<Input name="datalen" label="資料長度" defaultValue={data.datalen} placeholder="長度不填則預設2"/>
|
||||||
</Form.Field>
|
</Form.Field>
|
||||||
<Grid columns={2}>
|
<Grid columns={2}>
|
||||||
<Grid.Column>
|
<Grid.Column>
|
||||||
|
|||||||
@@ -41,10 +41,10 @@ class IOPanel extends React.Component {
|
|||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<Menu attached="top" tabular>
|
<Menu attached="top" tabular>
|
||||||
<Menu.Item content="DigitOutput" name="1" active={this.state.tabIdx == "1"} onClick={this.tabItemClick} />
|
<Menu.Item content="DigitalOutput" name="1" active={this.state.tabIdx == "1"} onClick={this.tabItemClick} />
|
||||||
<Menu.Item content="DigitInput" name="2" active={this.state.tabIdx == "2"} onClick={this.tabItemClick} />
|
<Menu.Item content="DigitalInput" name="2" active={this.state.tabIdx == "2"} onClick={this.tabItemClick} />
|
||||||
<Menu.Item content="AnalogyOutput" name="3" active={this.state.tabIdx == "3"} onClick={this.tabItemClick} />
|
<Menu.Item content="AnalogOutput" name="3" active={this.state.tabIdx == "3"} onClick={this.tabItemClick} />
|
||||||
<Menu.Item content="AnalogyInput" name="4" active={this.state.tabIdx == "4"} onClick={this.tabItemClick} />
|
<Menu.Item content="AnalogInput" name="4" active={this.state.tabIdx == "4"} onClick={this.tabItemClick} />
|
||||||
<Menu.Menu position="right">
|
<Menu.Menu position="right">
|
||||||
<Menu.Item content="AddIO" icon="plus" onClick={()=>{ioModal(0)}}/>
|
<Menu.Item content="AddIO" icon="plus" onClick={()=>{ioModal(0)}}/>
|
||||||
</Menu.Menu>
|
</Menu.Menu>
|
||||||
@@ -54,7 +54,8 @@ class IOPanel extends React.Component {
|
|||||||
<Table.Header>
|
<Table.Header>
|
||||||
<Table.Row>
|
<Table.Row>
|
||||||
<Table.HeaderCell>起始位置</Table.HeaderCell>
|
<Table.HeaderCell>起始位置</Table.HeaderCell>
|
||||||
<Table.HeaderCell>接口數量</Table.HeaderCell>
|
<Table.HeaderCell>讀取數量</Table.HeaderCell>
|
||||||
|
<Table.HeaderCell>資料長度</Table.HeaderCell>
|
||||||
<Table.HeaderCell>操作</Table.HeaderCell>
|
<Table.HeaderCell>操作</Table.HeaderCell>
|
||||||
</Table.Row>
|
</Table.Row>
|
||||||
</Table.Header>
|
</Table.Header>
|
||||||
@@ -72,6 +73,7 @@ class IOPanel extends React.Component {
|
|||||||
{
|
{
|
||||||
ss.map((t,idx) => (
|
ss.map((t,idx) => (
|
||||||
<div key={idx}>
|
<div key={idx}>
|
||||||
|
<Label basic color="olive" content={`SetName:${t.name}`} />
|
||||||
<Label basic color="blue" content={`PortNum:${t.port}`}/>
|
<Label basic color="blue" content={`PortNum:${t.port}`}/>
|
||||||
<Label basic color="blue" content={`原始數值:${t.value}`}/>
|
<Label basic color="blue" content={`原始數值:${t.value}`}/>
|
||||||
<Label basic color="blue" content={`轉換數值:${t.value2}`}/>
|
<Label basic color="blue" content={`轉換數值:${t.value2}`}/>
|
||||||
|
|||||||
@@ -5,8 +5,9 @@ const IOPanelListItem = ({i18n, data, ioModal, delIOList, showAIOSet}) => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<Table.Row>
|
<Table.Row>
|
||||||
<Table.Cell>{data.addr || ''}</Table.Cell>
|
<Table.Cell>{data.addr}</Table.Cell>
|
||||||
<Table.Cell>{data.num || ''}</Table.Cell>
|
<Table.Cell>{data.num}</Table.Cell>
|
||||||
|
<Table.Cell>{data.datalen}</Table.Cell>
|
||||||
<Table.Cell>
|
<Table.Cell>
|
||||||
<Button type="button" basic content="修改" onClick={()=>{ioModal(1, data)}}/>
|
<Button type="button" basic content="修改" onClick={()=>{ioModal(1, data)}}/>
|
||||||
<Button type="button" basic content="刪除" onClick={()=>{delIOList(data.uid || '')}}/>
|
<Button type="button" basic content="刪除" onClick={()=>{delIOList(data.uid || '')}}/>
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ const ModbusModal = ({i18n, open, type, data, onSubmit, onClose}) => {
|
|||||||
let json = {
|
let json = {
|
||||||
name: '',
|
name: '',
|
||||||
node: '',
|
node: '',
|
||||||
|
type: '',
|
||||||
id: data.uid || '',
|
id: data.uid || '',
|
||||||
original_node: data.node || ''
|
original_node: data.node || ''
|
||||||
};
|
};
|
||||||
@@ -23,6 +24,8 @@ const ModbusModal = ({i18n, open, type, data, onSubmit, onClose}) => {
|
|||||||
if(n && 'value' in n) json.name = n.value;
|
if(n && 'value' in n) json.name = n.value;
|
||||||
let nn = e.querySelector('input[name="node"]');
|
let nn = e.querySelector('input[name="node"]');
|
||||||
if(nn && 'value' in nn) json.node = nn.value;
|
if(nn && 'value' in nn) json.node = nn.value;
|
||||||
|
let type = e.querySelector('input[name="type"]');
|
||||||
|
if(type && 'value' in type) json.type = type.value;
|
||||||
|
|
||||||
return json ;
|
return json ;
|
||||||
}}>
|
}}>
|
||||||
@@ -30,7 +33,10 @@ const ModbusModal = ({i18n, open, type, data, onSubmit, onClose}) => {
|
|||||||
<Input name="name" defaultValue={data.name || ''} label="Name"/>
|
<Input name="name" defaultValue={data.name || ''} label="Name"/>
|
||||||
</Form.Field>
|
</Form.Field>
|
||||||
<Form.Field>
|
<Form.Field>
|
||||||
<Input name="node" defaultValue={data.node || ''} label="Node"/>
|
<Input name="node" defaultValue={data.node} label="Node"/>
|
||||||
|
</Form.Field>
|
||||||
|
<Form.Field>
|
||||||
|
<Input name="type" defaultValue={data.type} label="Type" placeholder="預設請留空"/>
|
||||||
</Form.Field>
|
</Form.Field>
|
||||||
<Grid columns={2}>
|
<Grid columns={2}>
|
||||||
<Grid.Column>
|
<Grid.Column>
|
||||||
|
|||||||
@@ -101,6 +101,7 @@ class ModbusPage extends React.Component {
|
|||||||
submitIOModal = (type, data) => {
|
submitIOModal = (type, data) => {
|
||||||
let {i18n} = this.props;
|
let {i18n} = this.props;
|
||||||
if((type == 1 && !data.id) || !('addr' in data) || !('num' in data) || !('type' in data)) return this.props.showDialog(i18n.t('tip.input_empty'));
|
if((type == 1 && !data.id) || !('addr' in data) || !('num' in data) || !('type' in data)) return this.props.showDialog(i18n.t('tip.input_empty'));
|
||||||
|
if(data.datalen == 0) return this.props.showDialog('資料長度不能為0');
|
||||||
|
|
||||||
data.devuid = this.state.showDev;
|
data.devuid = this.state.showDev;
|
||||||
if(type == 1){
|
if(type == 1){
|
||||||
|
|||||||
@@ -0,0 +1,74 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import {Modal, Input, Button, Form, Grid} from 'semantic-ui-react';
|
||||||
|
|
||||||
|
const CalModal = ({ i18n, onClose, onSubmit }) => {
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Modal open={true}>
|
||||||
|
<Modal.Header content="數值換算" />
|
||||||
|
<Modal.Content>
|
||||||
|
<Form onSubmit={(e,d) => {
|
||||||
|
e.preventDefault();
|
||||||
|
onSubmit(d.formData);
|
||||||
|
}} serializer={e=>{
|
||||||
|
let json = {
|
||||||
|
r1: '',
|
||||||
|
r2: '',
|
||||||
|
s1: '',
|
||||||
|
s2: '',
|
||||||
|
val: ''
|
||||||
|
}
|
||||||
|
|
||||||
|
let r1 = e.querySelector('input[name="r1"]');
|
||||||
|
if(r1 && 'value' in r1) json.r1 = r1.value;
|
||||||
|
let r2 = e.querySelector('input[name="r2"]');
|
||||||
|
if(r2 && 'value' in r2) json.r2 = r2.value;
|
||||||
|
let s1 = e.querySelector('input[name="s1"]');
|
||||||
|
if(s1 && 'value' in s1) json.s1 = s1.value;
|
||||||
|
let s2 = e.querySelector('input[name="s2"]');
|
||||||
|
if(s2 && 'value' in s2) json.s2 = s2.value;
|
||||||
|
let val = e.querySelector('input[name="val"]');
|
||||||
|
if(val && 'value' in val) json.val = val.value;
|
||||||
|
|
||||||
|
return json;
|
||||||
|
}}>
|
||||||
|
<Form.Field>
|
||||||
|
<label>Range</label>
|
||||||
|
<Grid columns={2}>
|
||||||
|
<Grid.Column>
|
||||||
|
<Input label="RangeMin" name="r1" />
|
||||||
|
</Grid.Column>
|
||||||
|
<Grid.Column>
|
||||||
|
<Input label="RangeMax" name="r2" />
|
||||||
|
</Grid.Column>
|
||||||
|
</Grid>
|
||||||
|
</Form.Field>
|
||||||
|
<Form.Field>
|
||||||
|
<label>Scale</label>
|
||||||
|
<Grid columns={2}>
|
||||||
|
<Grid.Column>
|
||||||
|
<Input label="ScaleMin" name="s1" />
|
||||||
|
</Grid.Column>
|
||||||
|
<Grid.Column>
|
||||||
|
<Input label="ScaleMax" name="s2" />
|
||||||
|
</Grid.Column>
|
||||||
|
</Grid>
|
||||||
|
</Form.Field>
|
||||||
|
<Form.Field>
|
||||||
|
<Input label="輸入數值" name="val" />
|
||||||
|
</Form.Field>
|
||||||
|
<Grid columns={2}>
|
||||||
|
<Grid.Column>
|
||||||
|
<Button fluid content="送出" basic />
|
||||||
|
</Grid.Column>
|
||||||
|
<Grid.Column>
|
||||||
|
<Button fluid type="button" content="取消" basic onClick={()=>{onClose()}} />
|
||||||
|
</Grid.Column>
|
||||||
|
</Grid>
|
||||||
|
</Form>
|
||||||
|
</Modal.Content>
|
||||||
|
</Modal>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default CalModal;
|
||||||
@@ -0,0 +1,132 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import {Container, Segment, Input, Form, Button} from 'semantic-ui-react';
|
||||||
|
import {getRequest} from '../../../actions';
|
||||||
|
import CalModal from './CalModal';
|
||||||
|
|
||||||
|
class ModbusCmdPage extends React.Component {
|
||||||
|
|
||||||
|
state = {
|
||||||
|
res: '',
|
||||||
|
value: '',
|
||||||
|
modal: false
|
||||||
|
}
|
||||||
|
|
||||||
|
handleSubmit = (data) => {
|
||||||
|
let {i18n} = this.props;
|
||||||
|
if(data.ip == '' || data.node == '' || data.func == '' || data.addr == '' || data.value == '') return this.props.showDialog(i18n&&i18n.t?i18n.t('tip.input_empty'):'');
|
||||||
|
this.props.toggleLoading(1);
|
||||||
|
this.setState({res:''})
|
||||||
|
fetch('/api/modbus/modbuscmd', getRequest(data))
|
||||||
|
.then(response=>response.json())
|
||||||
|
.then(json=>{
|
||||||
|
this.props.toggleLoading(0);
|
||||||
|
if(json.status != 1) return this.props.showDialog(json.message);
|
||||||
|
this.setState({
|
||||||
|
res: json.data.record[0].msg || ''
|
||||||
|
})
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
renderModal = () => {
|
||||||
|
let {i18n} = this.props;
|
||||||
|
return (
|
||||||
|
this.state.modal ?
|
||||||
|
(
|
||||||
|
<CalModal i18n={i18n} onClose={this.closeModal} onSubmit={this.submitModal} />
|
||||||
|
): null
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
closeModal = () => {
|
||||||
|
this.setState({
|
||||||
|
modal: false
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
submitModal = (data) => {
|
||||||
|
if(!data) return ;
|
||||||
|
let {showDialog} = this.props;
|
||||||
|
let {r1, r2, s1, s2, val} = data;
|
||||||
|
if(!isFinite(r1) || !isFinite(r2) || !isFinite(s1) || !isFinite(s2) || !isFinite(val)) return showDialog('請勿輸入數字以外的內容');
|
||||||
|
|
||||||
|
let value = Math.round(((val - r1) * (s2 - s1)) / (r2 - r1));
|
||||||
|
|
||||||
|
this.setState({
|
||||||
|
value
|
||||||
|
}, ()=>{this.closeModal()})
|
||||||
|
}
|
||||||
|
|
||||||
|
render() {
|
||||||
|
return (
|
||||||
|
<Container>
|
||||||
|
<Segment>
|
||||||
|
<Form onSubmit={(e,d)=>{
|
||||||
|
e.preventDefault();
|
||||||
|
this.handleSubmit(d.formData);
|
||||||
|
}} serializer={e=>{
|
||||||
|
let json = {
|
||||||
|
ip: '',
|
||||||
|
node: '',
|
||||||
|
func: '',
|
||||||
|
addr: '',
|
||||||
|
value: ''
|
||||||
|
};
|
||||||
|
|
||||||
|
let ip = e.querySelector('input[name="ip"]');
|
||||||
|
if(ip && 'value' in ip) json.ip = ip.value;
|
||||||
|
let node = e.querySelector('input[name="node"]');
|
||||||
|
if(node && 'value' in node) json.node = node.value;
|
||||||
|
let func = e.querySelector('input[name="func"]');
|
||||||
|
if(func && 'value' in func) json.func = func.value;
|
||||||
|
let addr = e.querySelector('input[name="addr"]');
|
||||||
|
if(addr && 'value' in addr) json.addr = addr.value;
|
||||||
|
let val = e.querySelector('input[name="val"]');
|
||||||
|
if(val && 'value' in val) json.value = val.value;
|
||||||
|
|
||||||
|
return json;
|
||||||
|
}}>
|
||||||
|
<Form.Field>
|
||||||
|
<Input name="ip" label="請輸入IP" defaultValue="127.0.0.1" />
|
||||||
|
</Form.Field>
|
||||||
|
<Form.Field>
|
||||||
|
<Input name="node" label="請輸入節點" />
|
||||||
|
</Form.Field>
|
||||||
|
<Form.Field>
|
||||||
|
<Input name="func" label="請輸入FunctionCode" />
|
||||||
|
</Form.Field>
|
||||||
|
<Form.Field>
|
||||||
|
<Input name="addr" label="請輸入位址" />
|
||||||
|
</Form.Field>
|
||||||
|
<Form.Field>
|
||||||
|
<Input name="val"
|
||||||
|
label="請輸入數值"
|
||||||
|
action={{
|
||||||
|
content: "數值換算",
|
||||||
|
basic: true,
|
||||||
|
type: 'button',
|
||||||
|
onClick: ()=>{
|
||||||
|
this.setState({
|
||||||
|
modal: true
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
value={this.state.value}
|
||||||
|
onChange={(e,d) => {this.setState({value: d.value})}} />
|
||||||
|
</Form.Field>
|
||||||
|
<Button type="submit" content="送出" fluid />
|
||||||
|
</Form>
|
||||||
|
</Segment>
|
||||||
|
<Segment>
|
||||||
|
{
|
||||||
|
this.state.res.split(/\n/).map((t,idx) => (
|
||||||
|
<div key={idx}>{t}</div>
|
||||||
|
))
|
||||||
|
}
|
||||||
|
</Segment>
|
||||||
|
{this.renderModal()}
|
||||||
|
</Container>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default ModbusCmdPage;
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import {Menu, Header} from 'semantic-ui-react';
|
||||||
|
import ListItem from './DeviceListItem';
|
||||||
|
|
||||||
|
const DeviceList = ({i18n, list, selected, toggleSelect}) => {
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Menu vertical={true}>
|
||||||
|
<Menu.Item>
|
||||||
|
<Menu.Header content="裝置列表" />
|
||||||
|
<Menu.Menu>
|
||||||
|
{
|
||||||
|
list.map((t, idx) => {
|
||||||
|
return (
|
||||||
|
<ListItem key={idx}
|
||||||
|
i18n={i18n}
|
||||||
|
data={t}
|
||||||
|
toggleSelect={toggleSelect}
|
||||||
|
checked={selected.indexOf(t.uid) == -1 ? false : true} />
|
||||||
|
)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
</Menu.Menu>
|
||||||
|
</Menu.Item>
|
||||||
|
</Menu>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default DeviceList;
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import {Menu, Checkbox} from 'semantic-ui-react';
|
||||||
|
|
||||||
|
const ListItem = ({i18n, data, checked, toggleSelect}) => {
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Menu.Item>
|
||||||
|
<Checkbox label={data.name} checked={checked} onChange={(e,d)=>{ toggleSelect(data.uid) }}/>
|
||||||
|
</Menu.Item>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default ListItem;
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import {Table} from 'semantic-ui-react';
|
||||||
|
import {convertTime} from '../../../tools'
|
||||||
|
|
||||||
|
const ListItem = ({i18n, data}) => {
|
||||||
|
let iotype = i18n&&i18n.getResource&&i18n.language ? i18n.getResource(i18n.language + '.translation.porttype') : [];
|
||||||
|
|
||||||
|
let t = '';
|
||||||
|
for(let i in iotype) {
|
||||||
|
if(data.type == iotype[i].code) t = iotype[i].name;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Table.Row>
|
||||||
|
<Table.Cell>{data.devname}</Table.Cell>
|
||||||
|
<Table.Cell>{data.aioname}</Table.Cell>
|
||||||
|
<Table.Cell>{data.port}</Table.Cell>
|
||||||
|
<Table.Cell>{t}</Table.Cell>
|
||||||
|
<Table.Cell>{data.value}</Table.Cell>
|
||||||
|
<Table.Cell>{convertTime(data.tst)}</Table.Cell>
|
||||||
|
</Table.Row>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default ListItem;
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import {Table, Segment} from 'semantic-ui-react';
|
||||||
|
import ListItem from './LogListItem';
|
||||||
|
|
||||||
|
const LogPanel = ({i18n, log}) => {
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Segment>
|
||||||
|
<Table>
|
||||||
|
<Table.Header>
|
||||||
|
<Table.Row>
|
||||||
|
<Table.HeaderCell>裝置名稱</Table.HeaderCell>
|
||||||
|
<Table.HeaderCell>接口名稱</Table.HeaderCell>
|
||||||
|
<Table.HeaderCell>接口號碼</Table.HeaderCell>
|
||||||
|
<Table.HeaderCell>接口類型</Table.HeaderCell>
|
||||||
|
<Table.HeaderCell>數值</Table.HeaderCell>
|
||||||
|
<Table.HeaderCell>時間</Table.HeaderCell>
|
||||||
|
</Table.Row>
|
||||||
|
</Table.Header>
|
||||||
|
<Table.Body>
|
||||||
|
{
|
||||||
|
log.map((t,idx)=>{
|
||||||
|
return (
|
||||||
|
<ListItem key={idx} i18n={i18n}
|
||||||
|
data={t} />
|
||||||
|
)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
</Table.Body>
|
||||||
|
</Table>
|
||||||
|
</Segment>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default LogPanel;
|
||||||
@@ -0,0 +1,101 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import {Container, Menu, Grid, Button, Input, Segment, Table} from 'semantic-ui-react';
|
||||||
|
import DeviceList from './DeviceList';
|
||||||
|
import {convertTime} from '../../../tools';
|
||||||
|
import Datetime from 'react-datetime';
|
||||||
|
import LogPanel from './LogPanel';
|
||||||
|
|
||||||
|
let getDayTime = () => {
|
||||||
|
let date = new Date();
|
||||||
|
date.setHours(0,0,0,0);
|
||||||
|
return date.getTime();
|
||||||
|
}
|
||||||
|
|
||||||
|
class ModbusLogPage extends React.Component {
|
||||||
|
state = {
|
||||||
|
selected: [],
|
||||||
|
stime: getDayTime(),
|
||||||
|
etime: Date.now()
|
||||||
|
}
|
||||||
|
|
||||||
|
toggleSelect = (id) => {
|
||||||
|
let selected = [...this.state.selected];
|
||||||
|
let idx = selected.indexOf(id);
|
||||||
|
if(idx == -1) selected.push(id);
|
||||||
|
else selected.splice(idx, 1);
|
||||||
|
|
||||||
|
this.setState({
|
||||||
|
selected
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
getLogList = () => {
|
||||||
|
let ids = [...this.state.selected];
|
||||||
|
let data = {
|
||||||
|
ids,
|
||||||
|
stime: Math.floor(this.state.stime /1000),
|
||||||
|
etime: Math.floor(this.state.etime)
|
||||||
|
}
|
||||||
|
|
||||||
|
if(ids.length == 0) return this.props.showDialog('請選擇裝置');
|
||||||
|
|
||||||
|
this.props.getMBLog(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
componentDidMount(){
|
||||||
|
this.props.getList();
|
||||||
|
|
||||||
|
this.props.router.setRouteLeaveHook(this.props.route, () => {
|
||||||
|
this.props.clearList();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
render(){
|
||||||
|
let {i18n, list, log} = this.props;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Container>
|
||||||
|
<Menu>
|
||||||
|
<Menu.Item>
|
||||||
|
<Input label="起始時間" input={
|
||||||
|
<Datetime dateFormat="YYYY-MM-DD"
|
||||||
|
timeFormat="HH:mm"
|
||||||
|
value={convertTime(this.state.stime)}
|
||||||
|
input={true}
|
||||||
|
onChange={(e)=>{ this.setState({stime: e.valueOf()}) }} />
|
||||||
|
}/>
|
||||||
|
</Menu.Item>
|
||||||
|
<Menu.Item>
|
||||||
|
<Input label="結束時間" input={
|
||||||
|
<Datetime dateFormat="YYYY-MM-DD"
|
||||||
|
timeFormat="HH:mm"
|
||||||
|
value={convertTime(this.state.etime)}
|
||||||
|
input={true}
|
||||||
|
onChange={(e)=>{ this.setState({etime: e.valueOf()}) }} />
|
||||||
|
}/>
|
||||||
|
</Menu.Item>
|
||||||
|
<Menu.Menu position="right">
|
||||||
|
<Menu.Item>
|
||||||
|
<Button type="button" content="搜尋" size="tiny" basic onClick={()=>{this.getLogList()}} />
|
||||||
|
</Menu.Item>
|
||||||
|
</Menu.Menu>
|
||||||
|
</Menu>
|
||||||
|
<Grid>
|
||||||
|
<Grid.Column width={4}>
|
||||||
|
<DeviceList i18n={i18n}
|
||||||
|
list={list}
|
||||||
|
selected={this.state.selected}
|
||||||
|
toggleSelect={this.toggleSelect}
|
||||||
|
/>
|
||||||
|
</Grid.Column>
|
||||||
|
<Grid.Column width={12}>
|
||||||
|
<LogPanel i18n={i18n}
|
||||||
|
log={log} />
|
||||||
|
</Grid.Column>
|
||||||
|
</Grid>
|
||||||
|
</Container>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default ModbusLogPage;
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import {Grid, Segment, Header, List} from 'semantic-ui-react';
|
||||||
|
import StatusItem from './StatusItem';
|
||||||
|
|
||||||
|
const DevField = ({ i18n, data }) => {
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Grid.Column>
|
||||||
|
<Header as="h4" content={`Name: ${data.name} / Node: ${data.node}`} />
|
||||||
|
<Segment style={{height: '400px', overflow: 'auto'}}>
|
||||||
|
<List divided>
|
||||||
|
{
|
||||||
|
data.list.map((t,idx) => (
|
||||||
|
<StatusItem key={idx} i18n={i18n} data={t} />
|
||||||
|
))
|
||||||
|
}
|
||||||
|
</List>
|
||||||
|
</Segment>
|
||||||
|
</Grid.Column>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default DevField;
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import { List, Label } from 'semantic-ui-react';
|
||||||
|
import {convertTime} from '../../../tools'
|
||||||
|
|
||||||
|
const StatusItem = ({ i18n, data }) => {
|
||||||
|
let iotype = i18n&&i18n.getResource&&i18n.language ? i18n.getResource(i18n.language + '.translation.porttype') : [];
|
||||||
|
let iot = {};
|
||||||
|
for(let i in iotype){
|
||||||
|
iot[iotype[i].code] = iotype[i].name;
|
||||||
|
}
|
||||||
|
let tc = {
|
||||||
|
"1": "orange",
|
||||||
|
"2": "green",
|
||||||
|
"3": "violet",
|
||||||
|
"4": "brown"
|
||||||
|
}
|
||||||
|
return (
|
||||||
|
<List.Item>
|
||||||
|
<Label basic size="small" color="teal" content={`Port: ${data.port}`} />
|
||||||
|
<Label basic size="small" color={tc[data.type] || 'blue'} content={`Type: ${iot[data.type]}`} />
|
||||||
|
{
|
||||||
|
data.type == 3 || data.type == 4 ?
|
||||||
|
(<Label basic size="small" color="teal" content={`Name: ${data.name}`} />) :
|
||||||
|
null
|
||||||
|
}
|
||||||
|
<Label basic size="small" color="blue" content={`數值: ${data.value2}`}/>
|
||||||
|
<List.Description style={{textAlign: 'right'}}>
|
||||||
|
{`最後更新於: ${convertTime(data.tst, true)}`}
|
||||||
|
</List.Description>
|
||||||
|
</List.Item>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default StatusItem;
|
||||||
@@ -0,0 +1,64 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import {Container, Segment, Grid, List, Label} from 'semantic-ui-react';
|
||||||
|
import DevField from './DeviceField';
|
||||||
|
|
||||||
|
class ModbusPreview extends React.Component {
|
||||||
|
state = {
|
||||||
|
list: []
|
||||||
|
}
|
||||||
|
|
||||||
|
tick = null
|
||||||
|
|
||||||
|
componentDidMount(){
|
||||||
|
this.getList()
|
||||||
|
this.tick = setInterval(this.runTick, 10000);
|
||||||
|
}
|
||||||
|
|
||||||
|
componentWillUnmount(){
|
||||||
|
clearInterval(this.tick);
|
||||||
|
}
|
||||||
|
|
||||||
|
runTick = () => {
|
||||||
|
this.getList();
|
||||||
|
}
|
||||||
|
|
||||||
|
getList = () => {
|
||||||
|
let {getRequest, showDialog} = this.props;
|
||||||
|
fetch('/api/modbus/getalliostatus', getRequest())
|
||||||
|
.then(response=>response.json())
|
||||||
|
.then(json => {
|
||||||
|
if(json.status != 1) return showDialog(json.message);
|
||||||
|
let dev = json.data.rt.device || [];
|
||||||
|
let status = json.data.record || [];
|
||||||
|
for(let i in dev) {
|
||||||
|
dev[i].list = [];
|
||||||
|
for(let j in status){
|
||||||
|
if(status[j].node == dev[i].node){
|
||||||
|
dev[i].list.push(status[j]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.setState({
|
||||||
|
list: dev
|
||||||
|
});
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
render() {
|
||||||
|
let {i18n} = this.props;
|
||||||
|
return (
|
||||||
|
<Container fluid style={{paddingLeft: '10px', paddingRight: '10px'}}>
|
||||||
|
<Grid columns={3}>
|
||||||
|
{
|
||||||
|
this.state.list.map((t,idx) => (
|
||||||
|
<DevField key={idx} i18n={i18n} data={t} />
|
||||||
|
))
|
||||||
|
}
|
||||||
|
</Grid>
|
||||||
|
</Container>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default ModbusPreview;
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import { Menu, List, Icon } from 'semantic-ui-react';
|
||||||
|
|
||||||
|
|
||||||
|
class DevList extends React.Component {
|
||||||
|
|
||||||
|
|
||||||
|
render() {
|
||||||
|
let {list, sel,selectDevice, openModal, delData} = this.props;
|
||||||
|
return (
|
||||||
|
<Menu vertical>
|
||||||
|
<Menu.Item>
|
||||||
|
<Menu.Header className="clearfix">
|
||||||
|
裝置列表
|
||||||
|
<Icon name="plus"
|
||||||
|
style={{float: 'right',cursor:'pointer'}}
|
||||||
|
onClick={()=>openModal('device')} />
|
||||||
|
</Menu.Header>
|
||||||
|
<Menu.Menu>
|
||||||
|
{
|
||||||
|
list.map((t,idx)=>(
|
||||||
|
<Menu.Item key={idx} active={sel == t.devuid}>
|
||||||
|
<span style={{cursor:'pointer'}} onClick={()=>selectDevice(t.devuid)}>{t.name}</span>
|
||||||
|
<Icon name="trash"
|
||||||
|
style={{cursor:'pointer'}}
|
||||||
|
onClick={()=>delData('device', t.devuid)} />
|
||||||
|
<Icon name="edit"
|
||||||
|
style={{cursor:'pointer'}}
|
||||||
|
onClick={()=>openModal('device', 1, t)} />
|
||||||
|
</Menu.Item>
|
||||||
|
))
|
||||||
|
}
|
||||||
|
</Menu.Menu>
|
||||||
|
</Menu.Item>
|
||||||
|
</Menu>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default DevList;
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import {Table, Button} from 'semantic-ui-react';
|
||||||
|
|
||||||
|
const SetListItem = ({ i18n, data, openModal, delData, bmctl, runbmctl }) => {
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Table.Row>
|
||||||
|
<Table.Cell>
|
||||||
|
<Button content="修改" basic onClick={()=>openModal('ipmi', 1, data)} />
|
||||||
|
<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>
|
||||||
|
</Table.Row>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default SetListItem;
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import {Container, Segment, Button, Table} from 'semantic-ui-react';
|
||||||
|
import SelListItem from './SetListItem';
|
||||||
|
|
||||||
|
const IPMIPage = ({i18n, list, openModal, delData, bmctl, runbmctl}) => {
|
||||||
|
return (
|
||||||
|
<Container>
|
||||||
|
<Segment className="clearfix">
|
||||||
|
<Button content="新增設定"
|
||||||
|
icon="plus"
|
||||||
|
floated="right"
|
||||||
|
basic
|
||||||
|
color="green"
|
||||||
|
style={{marginBottom: '15px'}}
|
||||||
|
onClick={()=>openModal('ipmi')} />
|
||||||
|
<Table>
|
||||||
|
<Table.Header>
|
||||||
|
<Table.Row>
|
||||||
|
<Table.HeaderCell>操作</Table.HeaderCell>
|
||||||
|
<Table.HeaderCell>設備操作</Table.HeaderCell>
|
||||||
|
<Table.HeaderCell>IP</Table.HeaderCell>
|
||||||
|
<Table.HeaderCell>帳號</Table.HeaderCell>
|
||||||
|
<Table.HeaderCell>MAC Address</Table.HeaderCell>
|
||||||
|
</Table.Row>
|
||||||
|
</Table.Header>
|
||||||
|
<Table.Body>
|
||||||
|
{
|
||||||
|
list.map((t,idx) => {
|
||||||
|
return (
|
||||||
|
<SelListItem key={idx}
|
||||||
|
i18n={i18n}
|
||||||
|
data={t}
|
||||||
|
openModal={openModal}
|
||||||
|
delData={delData}
|
||||||
|
bmctl={bmctl}
|
||||||
|
runbmctl={runbmctl} />
|
||||||
|
)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
</Table.Body>
|
||||||
|
</Table>
|
||||||
|
</Segment>
|
||||||
|
</Container>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default IPMIPage;
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import {Modal, Form, Input, Button, Grid} from 'semantic-ui-react';
|
||||||
|
|
||||||
|
const DevModel = ({ i18n, open, type, data, closeModal, submitModal }) => {
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Modal open={open}>
|
||||||
|
<Modal.Header content={type == 1 ? '修改裝置' : '新增裝置'} />
|
||||||
|
<Modal.Content>
|
||||||
|
<Form onSubmit={(e,d) => {
|
||||||
|
e.preventDefault();
|
||||||
|
submitModal('device', type, d.formData);
|
||||||
|
}} serializer={e=>{
|
||||||
|
let json = {};
|
||||||
|
let name = e.querySelector('input[name="name"]');
|
||||||
|
if(name && 'value' in name) json.name = name.value;
|
||||||
|
|
||||||
|
if(type == 1) json.id = data.devuid;
|
||||||
|
|
||||||
|
return json;
|
||||||
|
}}>
|
||||||
|
<Form.Field>
|
||||||
|
<Input label="裝置名稱" name="name" defaultValue={data.name} />
|
||||||
|
</Form.Field>
|
||||||
|
|
||||||
|
<Grid columns={2}>
|
||||||
|
<Grid.Column>
|
||||||
|
<Button type="submit" content="送出" basic fluid/>
|
||||||
|
</Grid.Column>
|
||||||
|
<Grid.Column>
|
||||||
|
<Button type="button" fluid content="取消" basic onClick={()=>closeModal('device')} />
|
||||||
|
</Grid.Column>
|
||||||
|
</Grid>
|
||||||
|
</Form>
|
||||||
|
</Modal.Content>
|
||||||
|
</Modal>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default DevModel;
|
||||||
@@ -0,0 +1,150 @@
|
|||||||
|
import React from '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){
|
||||||
|
this.setState({...stateDefault()})
|
||||||
|
}else{
|
||||||
|
this.setState({
|
||||||
|
open: true
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
changeIdx = (idx) => {
|
||||||
|
this.setState({
|
||||||
|
tabIdx: idx
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
getInfoView = () => {
|
||||||
|
switch(this.state.tabIdx){
|
||||||
|
case 1:
|
||||||
|
return <BMCContent group={this.props.bmcgroup} data={this.props.bmcdata} />
|
||||||
|
case 2:
|
||||||
|
return <SensorContent sensor={this.props.sensor} />
|
||||||
|
case 3:
|
||||||
|
return <LogContent log={this.props.log} />
|
||||||
|
default:
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
render() {
|
||||||
|
let {closeModal} = this.props;
|
||||||
|
return (
|
||||||
|
<Modal size="fullscreen" open={this.state.open} onClose={()=>closeModal('ipmiinfo')}>
|
||||||
|
<Modal.Header content="IPMI Info" />
|
||||||
|
<Modal.Content>
|
||||||
|
<Menu attached="top" tabular>
|
||||||
|
<Menu.Item name="BMC Info" active={this.state.tabIdx == 1} onClick={()=>this.changeIdx(1)} />
|
||||||
|
<Menu.Item name="Sensor" active={this.state.tabIdx == 2} onClick={()=>this.changeIdx(2)} />
|
||||||
|
<Menu.Item name="Log" active={this.state.tabIdx == 3} onClick={()=>this.changeIdx(3)} />
|
||||||
|
</Menu>
|
||||||
|
<Segment attached="bottom">
|
||||||
|
{this.getInfoView()}
|
||||||
|
</Segment>
|
||||||
|
</Modal.Content>
|
||||||
|
</Modal>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const BMCContent = ({group, data}) => {
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Container fluid>
|
||||||
|
{
|
||||||
|
group.map((t,idx) => (
|
||||||
|
<Segment key={idx}>
|
||||||
|
<Header as="h3" color="blue">
|
||||||
|
{t.name}
|
||||||
|
<Header.Subheader>{t.value}</Header.Subheader>
|
||||||
|
</Header>
|
||||||
|
<List>
|
||||||
|
{
|
||||||
|
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>
|
||||||
|
))
|
||||||
|
}
|
||||||
|
</Container>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
const LogContent = ({log}) => {
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Container fluid>
|
||||||
|
<Table>
|
||||||
|
<Table.Header>
|
||||||
|
<Table.Row>
|
||||||
|
<Table.HeaderCell>行號</Table.HeaderCell>
|
||||||
|
<Table.HeaderCell>時間</Table.HeaderCell>
|
||||||
|
<Table.HeaderCell>內容</Table.HeaderCell>
|
||||||
|
</Table.Row>
|
||||||
|
</Table.Header>
|
||||||
|
<Table.Body>
|
||||||
|
{
|
||||||
|
log.map((t,idx) => (
|
||||||
|
<Table.Row>
|
||||||
|
<Table.Cell>{t.line}</Table.Cell>
|
||||||
|
<Table.Cell>{convertTime(t.time, true)}</Table.Cell>
|
||||||
|
<Table.Cell>{t.content}</Table.Cell>
|
||||||
|
</Table.Row>
|
||||||
|
))
|
||||||
|
}
|
||||||
|
</Table.Body>
|
||||||
|
</Table>
|
||||||
|
</Container>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
const SensorContent = ({sensor}) => {
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Container fluid>
|
||||||
|
<Table>
|
||||||
|
<Table.Header>
|
||||||
|
<Table.Row>
|
||||||
|
<Table.HeaderCell>名稱</Table.HeaderCell>
|
||||||
|
<Table.HeaderCell>數值</Table.HeaderCell>
|
||||||
|
<Table.HeaderCell>單位</Table.HeaderCell>
|
||||||
|
<Table.HeaderCell>狀態</Table.HeaderCell>
|
||||||
|
</Table.Row>
|
||||||
|
</Table.Header>
|
||||||
|
<Table.Body>
|
||||||
|
{
|
||||||
|
sensor.map((t,idx) => (
|
||||||
|
<Table.Row>
|
||||||
|
<Table.Cell>{t.name}</Table.Cell>
|
||||||
|
<Table.Cell>{t.value}</Table.Cell>
|
||||||
|
<Table.Cell>{t.unit}</Table.Cell>
|
||||||
|
<Table.Cell>{t.status}</Table.Cell>
|
||||||
|
</Table.Row>
|
||||||
|
))
|
||||||
|
}
|
||||||
|
</Table.Body>
|
||||||
|
</Table>
|
||||||
|
</Container>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default IPMIInfoModal;
|
||||||
@@ -0,0 +1,50 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import {Modal, Form, Grid, Input, Button } from 'semantic-ui-react';
|
||||||
|
|
||||||
|
const IPMIModal = ({ i18n, open, type, data, closeModal, submitModal }) => {
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Modal open={open}>
|
||||||
|
<Modal.Header content={type == 1 ? '修改設定' : '新增設定'} />
|
||||||
|
<Modal.Content>
|
||||||
|
<Form onSubmit={(e,d) => {
|
||||||
|
e.preventDefault();
|
||||||
|
submitModal('ipmi', type, d.formData);
|
||||||
|
}} serializer={e=>{
|
||||||
|
let json ={};
|
||||||
|
|
||||||
|
let ip = e.querySelector('input[name="ip"]');
|
||||||
|
if(ip && 'value' in ip) json.ip = ip.value;
|
||||||
|
let account = e.querySelector('input[name="account"]');
|
||||||
|
if(account && 'value' in account) json.account = account.value;
|
||||||
|
let pass = e.querySelector('input[name="password"]');
|
||||||
|
if(pass && 'value' in pass) json.password = pass.value;
|
||||||
|
if(type == 1 ) json.id = data.ipmuid;
|
||||||
|
|
||||||
|
return json;
|
||||||
|
}}>
|
||||||
|
<Form.Field>
|
||||||
|
<Input label="IP" name="ip" defaultValue={data.ip} />
|
||||||
|
</Form.Field>
|
||||||
|
<Form.Field>
|
||||||
|
<Input label="帳號" name="account" defaultValue={data.account} />
|
||||||
|
</Form.Field>
|
||||||
|
<Form.Field>
|
||||||
|
<Input label="密碼" name="password" defaultValue={data.password} />
|
||||||
|
</Form.Field>
|
||||||
|
|
||||||
|
<Grid columns={2}>
|
||||||
|
<Grid.Column>
|
||||||
|
<Button type="submit" content="送出" basic fluid/>
|
||||||
|
</Grid.Column>
|
||||||
|
<Grid.Column>
|
||||||
|
<Button type="button" fluid content="取消" basic onClick={()=>closeModal('ipmi')} />
|
||||||
|
</Grid.Column>
|
||||||
|
</Grid>
|
||||||
|
</Form>
|
||||||
|
</Modal.Content>
|
||||||
|
</Modal>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default IPMIModal;
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import {Container, Segment} from 'semantic-ui-react';
|
||||||
|
|
||||||
|
class SNMPPage extends React.Component {
|
||||||
|
|
||||||
|
render() {
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Container>
|
||||||
|
<Segment>
|
||||||
|
|
||||||
|
</Segment>
|
||||||
|
</Container>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default SNMPPage;
|
||||||
@@ -0,0 +1,333 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import { Container, Segment, Menu, List, Grid } from 'semantic-ui-react';
|
||||||
|
import {getRequest} from '../../../actions';
|
||||||
|
import DevList from './DevList';
|
||||||
|
import IPMIPage from './IPMIPage';
|
||||||
|
import DevModal from './Modals/DevModal';
|
||||||
|
import IPMIModal from './Modals/IPMIModal';
|
||||||
|
import IPMIInfoModal from './Modals/IPMIInfoModal';
|
||||||
|
|
||||||
|
const stateDefault = ()=>({
|
||||||
|
list: [],
|
||||||
|
bmctl: [],
|
||||||
|
devSel: {
|
||||||
|
id: null,
|
||||||
|
type: null,
|
||||||
|
data: {
|
||||||
|
snmp: [],
|
||||||
|
ipmi: []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
devModal: {
|
||||||
|
open: false,
|
||||||
|
type: 0,
|
||||||
|
data: {}
|
||||||
|
},
|
||||||
|
ipmiModal: {
|
||||||
|
open: false,
|
||||||
|
type: 0,
|
||||||
|
data: {}
|
||||||
|
},
|
||||||
|
ipmiInfo: {
|
||||||
|
open: false,
|
||||||
|
ipmi: [],
|
||||||
|
log: [],
|
||||||
|
sensor: [],
|
||||||
|
bmcdata: [],
|
||||||
|
bmcgroup: []
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
class ServerPage extends React.Component {
|
||||||
|
state = {...stateDefault()}
|
||||||
|
|
||||||
|
componentDidMount(){
|
||||||
|
this.getDevList();
|
||||||
|
this.getBMCtl();
|
||||||
|
}
|
||||||
|
|
||||||
|
getDevList = () => {
|
||||||
|
let {showDialog, toggleLoading} = this.props;
|
||||||
|
toggleLoading(1);
|
||||||
|
fetch('/api/server/getdevicelist', getRequest())
|
||||||
|
.then(response => response.json())
|
||||||
|
.then(json => {
|
||||||
|
toggleLoading(0);
|
||||||
|
if(json.status != 1) return showDialog(json.message);
|
||||||
|
this.setState({
|
||||||
|
list: json.data.record || []
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
toggleLoading(1);
|
||||||
|
fetch('/api/server/getdevice', getRequest({id}))
|
||||||
|
.then(response=>response.json())
|
||||||
|
.then(json => {
|
||||||
|
toggleLoading(0);
|
||||||
|
if(json.status != 1) return showDialog(json.message);
|
||||||
|
let ipmi = json.data.rt.ipmi || [];
|
||||||
|
let snmp = json.data.rt.snmp || [];
|
||||||
|
|
||||||
|
let jdata = {
|
||||||
|
...stateDefault().devSel,
|
||||||
|
id,
|
||||||
|
data: {
|
||||||
|
ipmi,
|
||||||
|
snmp
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
if(refresh) jdata.type = this.state.devSel.type;
|
||||||
|
|
||||||
|
this.setState({
|
||||||
|
devSel: jdata
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
selectDataType = (type) => {
|
||||||
|
this.setState({
|
||||||
|
devSel: {
|
||||||
|
...this.state.devSel,
|
||||||
|
type: type
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
genSubPage = () => {
|
||||||
|
let {i18n, showDialog, toggleLoading, callConfirm} = this.props;
|
||||||
|
switch(this.state.devSel.type){
|
||||||
|
case 'ipmi':
|
||||||
|
return <IPMIPage i18n={i18n}
|
||||||
|
showDialog={showDialog}
|
||||||
|
toggleLoading={toggleLoading}
|
||||||
|
callConfirm={callConfirm}
|
||||||
|
list={this.state.devSel.data.ipmi}
|
||||||
|
openModal={this.openModal}
|
||||||
|
closeModal={this.closeModal}
|
||||||
|
delData={this.delData}
|
||||||
|
bmctl={this.state.bmctl}
|
||||||
|
runbmctl={this.runbmctl} />
|
||||||
|
|
||||||
|
default:
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
openModal = (mtype, type = 0, data = {}) => {
|
||||||
|
switch(mtype){
|
||||||
|
case 'device':
|
||||||
|
this.setState({
|
||||||
|
devModal: {
|
||||||
|
open: true,
|
||||||
|
type,
|
||||||
|
data
|
||||||
|
}
|
||||||
|
})
|
||||||
|
break;
|
||||||
|
case 'ipmi':
|
||||||
|
this.setState({
|
||||||
|
ipmiModal:{
|
||||||
|
open: true,
|
||||||
|
type,
|
||||||
|
data
|
||||||
|
}
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
case 'ipmiinfo':
|
||||||
|
this.getIPMIData(data.id);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
closeModal = (mtype, cb = null) => {
|
||||||
|
switch(mtype){
|
||||||
|
case 'device':
|
||||||
|
this.setState({devModal: {...stateDefault().devModal}});
|
||||||
|
break;
|
||||||
|
case 'ipmi':
|
||||||
|
this.setState({ipmiModal:{...stateDefault().ipmiModal}});
|
||||||
|
break;
|
||||||
|
case 'ipmiinfo':
|
||||||
|
this.setState({ipmiInfo: {...stateDefault().ipmiInfo}});
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(cb && typeof cb == 'function') cb();
|
||||||
|
}
|
||||||
|
|
||||||
|
submitModal = (mtype, type = 0, data = {}) => {
|
||||||
|
if(!mtype) return ;
|
||||||
|
let {i18n, showDialog, toggleLoading, callConfirm} = this.props;
|
||||||
|
let url = '';
|
||||||
|
switch(mtype){
|
||||||
|
case 'device':
|
||||||
|
if(type == 1 && !data.id) return showDialog('資料讀取錯誤');
|
||||||
|
if(!data.name) return showDialog('請填寫設備名稱');
|
||||||
|
url = type == 1 ? '/api/server/editdevice' : '/api/server/adddevice';
|
||||||
|
fetch(url, getRequest(data))
|
||||||
|
.then(response => response.json())
|
||||||
|
.then(json => {
|
||||||
|
if(json.status != 1) return showDialog(json.message);
|
||||||
|
this.closeModal(mtype, ()=>{this.getDevList()});
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
case 'ipmi':
|
||||||
|
if(type == 1 && !data.id) return showDialog('資料讀取錯誤');
|
||||||
|
if(!data.ip) return showDialog('請填寫IP');
|
||||||
|
if(!data.account) return showDialog('請填寫帳號');
|
||||||
|
if(!data.password) return showDialog('請填寫密碼');
|
||||||
|
data.devuid = this.state.devSel.id;
|
||||||
|
url = type == 1 ? '/api/server/editipmi' : '/api/server/addipmi';
|
||||||
|
fetch(url, getRequest(data))
|
||||||
|
.then(response=>response.json())
|
||||||
|
.then(json => {
|
||||||
|
if(json.status != 1) return showDialog(json.message);
|
||||||
|
this.closeModal(mtype, ()=>{ this.selectDevice(this.state.devSel.id, true); })
|
||||||
|
})
|
||||||
|
default :
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
delData = (mtype, id) => {
|
||||||
|
if(!mtype || !id) return ;
|
||||||
|
let {i18n, showDialog, toggleLoading, callConfirm} = this.props;
|
||||||
|
switch(mtype) {
|
||||||
|
case 'device':
|
||||||
|
callConfirm('確定刪除此裝置?', ()=>{
|
||||||
|
fetch('/api/server/deldevice', getRequest({id}))
|
||||||
|
.then(response=>response.json())
|
||||||
|
.then(json => {
|
||||||
|
if(json.status != 1) return showDialog(json.message);
|
||||||
|
this.getDevList();
|
||||||
|
})
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
case 'ipmi':
|
||||||
|
callConfirm('確定刪除此筆設定?', ()=>{
|
||||||
|
fetch('/api/server/delipmi', getRequest({id}))
|
||||||
|
.then(response=>response.json())
|
||||||
|
.then(json => {
|
||||||
|
if(json.status != 1) return showDialog(json.message);
|
||||||
|
this.selectDevice(this.state.devSel.id, true);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
getIPMIData = (id) => {
|
||||||
|
if(!id) return ;
|
||||||
|
let {i18n, showDialog, toggleLoading, callConfirm} = this.props;
|
||||||
|
toggleLoading(1);
|
||||||
|
fetch('/api/server/getipmiinfo', getRequest({id}))
|
||||||
|
.then(response=>response.json())
|
||||||
|
.then(json => {
|
||||||
|
toggleLoading(0);
|
||||||
|
if(json.status != 1) return showDialog(json.message);
|
||||||
|
let ipmi = json.data.record || [];
|
||||||
|
let sensor = json.data.rt.sensor || [];
|
||||||
|
let log = json.data.rt.log || [];
|
||||||
|
let bmcgroup = json.data.rt.bmcgroup || [];
|
||||||
|
let bmcdata = json.data.rt.bmcdata || [];
|
||||||
|
|
||||||
|
this.setState({
|
||||||
|
ipmiInfo: {
|
||||||
|
open: true,
|
||||||
|
log,
|
||||||
|
sensor,
|
||||||
|
ipmi,
|
||||||
|
bmcdata,
|
||||||
|
bmcgroup
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
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 (
|
||||||
|
<Container fluid>
|
||||||
|
<Grid>
|
||||||
|
<Grid.Column width={3}>
|
||||||
|
<DevList i18n={i18n}
|
||||||
|
toggleLoading={toggleLoading}
|
||||||
|
showDialog={showDialog}
|
||||||
|
callConfirm={callConfirm}
|
||||||
|
sel={this.state.devSel.id}
|
||||||
|
selectDevice={this.selectDevice}
|
||||||
|
list={this.state.list}
|
||||||
|
openModal={this.openModal}
|
||||||
|
delData={this.delData} />
|
||||||
|
</Grid.Column>
|
||||||
|
<Grid.Column width={13}>
|
||||||
|
{
|
||||||
|
this.state.devSel.id != null ?
|
||||||
|
(
|
||||||
|
<Container style={{marginBottom: '10px'}}>
|
||||||
|
<Menu fluid widths={2}>
|
||||||
|
<Menu.Item name="SNMP"
|
||||||
|
active={this.state.devSel.type == 'snmp'}
|
||||||
|
onClick={()=>this.selectDataType('snmp')}/>
|
||||||
|
<Menu.Item name="IPMI"
|
||||||
|
active={this.state.devSel.type == 'ipmi'}
|
||||||
|
onClick={()=>this.selectDataType('ipmi')}/>
|
||||||
|
</Menu>
|
||||||
|
</Container>
|
||||||
|
) : null
|
||||||
|
}
|
||||||
|
{this.genSubPage()}
|
||||||
|
</Grid.Column>
|
||||||
|
</Grid>
|
||||||
|
<DevModal i18n={i18n}
|
||||||
|
open={this.state.devModal.open}
|
||||||
|
type={this.state.devModal.type}
|
||||||
|
data={this.state.devModal.data}
|
||||||
|
closeModal={this.closeModal}
|
||||||
|
submitModal={this.submitModal} />
|
||||||
|
<IPMIModal i18n={i18n}
|
||||||
|
open={this.state.ipmiModal.open}
|
||||||
|
type={this.state.ipmiModal.type}
|
||||||
|
data={this.state.ipmiModal.data}
|
||||||
|
closeModal={this.closeModal}
|
||||||
|
submitModal={this.submitModal} />
|
||||||
|
<IPMIInfoModal i18n={i18n}
|
||||||
|
{...this.state.ipmiInfo}
|
||||||
|
closeModal={this.closeModal} />
|
||||||
|
</Container>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default ServerPage;
|
||||||
@@ -0,0 +1,117 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import {Form, Input, Button, Label, Message} from 'semantic-ui-react';
|
||||||
|
import {getRequest} from '../../../actions';
|
||||||
|
|
||||||
|
class TimezoneForm extends React.Component {
|
||||||
|
state = {
|
||||||
|
zones: [],
|
||||||
|
zone: '',
|
||||||
|
loc: '',
|
||||||
|
selZone: null,
|
||||||
|
selLoc: null
|
||||||
|
}
|
||||||
|
|
||||||
|
componentDidMount(){
|
||||||
|
this.getZones();
|
||||||
|
this.getZoneSet();
|
||||||
|
}
|
||||||
|
|
||||||
|
getZones = () => {
|
||||||
|
fetch('/api/system/gettimezonelist', getRequest())
|
||||||
|
.then(response=>response.json())
|
||||||
|
.then(json => {
|
||||||
|
if(json.status != 1) return this.props.showDialog(json.message);
|
||||||
|
this.setState({
|
||||||
|
zones: json.data.record || []
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
getZoneSet = () => {
|
||||||
|
fetch('/api/system/gettimezoneset', getRequest())
|
||||||
|
.then(response=>response.json())
|
||||||
|
.then(json => {
|
||||||
|
if(json.status != 1) return this.props.showDialog(json.message);
|
||||||
|
let tz = (json.data.record[0].value || '').split('/');
|
||||||
|
this.setState({
|
||||||
|
zone: tz[0] || '',
|
||||||
|
loc: tz[1] || ''
|
||||||
|
});
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
zonesChange = (data) => {
|
||||||
|
this.setState({
|
||||||
|
selZone: data == '' ? null : data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
handleSubmit = () => {
|
||||||
|
if(this.state.selZone == null || this.state.selLoc == null ) return this.props.showDialog('請選擇區域與城市');
|
||||||
|
let zone = this.state.zones[this.state.selZone].name;
|
||||||
|
let loc = this.state.zones[this.state.selZone].location[this.state.selLoc];
|
||||||
|
|
||||||
|
fetch('/api/system/settimezone', getRequest({timezone: `${zone}/${loc}`}))
|
||||||
|
.then(response=>response.json())
|
||||||
|
.then(json => {
|
||||||
|
if(json.status != 1) return this.props.showDialog(json.message);
|
||||||
|
this.setState({
|
||||||
|
selZone: null,
|
||||||
|
selLoc: null
|
||||||
|
}, () => {
|
||||||
|
this.getZoneSet();
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
render(){
|
||||||
|
return (
|
||||||
|
<Form onSubmit={(e,d) => {
|
||||||
|
e.preventDefault();
|
||||||
|
this.handleSubmit();
|
||||||
|
}} serializer={e=>{
|
||||||
|
return {};
|
||||||
|
}}>
|
||||||
|
<Form.Field inline>
|
||||||
|
{/*<Input label="系統Timezone"
|
||||||
|
value={`${this.state.zone}${this.state.zone.length > 0 ? '/' : ''}${this.state.loc}`}
|
||||||
|
disabled />*/}
|
||||||
|
<label>系統Timezone</label>
|
||||||
|
<Label content={`${this.state.zone}${this.state.zone.length > 0 ? '/' : ''}${this.state.loc}`} basic/>
|
||||||
|
</Form.Field>
|
||||||
|
<Form.Group inline>
|
||||||
|
<Form.Field>
|
||||||
|
<label>設定Timezone</label>
|
||||||
|
<select value={this.state.selZone == null ? '' : this.state.selZone} onChange={e=>{ this.zonesChange(e.target.value); }}>
|
||||||
|
<option value="">選擇區域</option>
|
||||||
|
{
|
||||||
|
this.state.zones.map((t,idx)=>(
|
||||||
|
<option key={idx} value={idx}>{t.name}</option>
|
||||||
|
))
|
||||||
|
}
|
||||||
|
</select>
|
||||||
|
</Form.Field>
|
||||||
|
{
|
||||||
|
this.state.selZone == null ? null :
|
||||||
|
(
|
||||||
|
<Form.Field>
|
||||||
|
<select value={this.state.selLoc == null ? '' : this.state.selLoc}
|
||||||
|
onChange={e => { this.setState({selLoc: e.target.value == '' ? null : e.target.value}) }}>
|
||||||
|
<option value="">選擇城市</option>
|
||||||
|
{
|
||||||
|
this.state.zones[this.state.selZone].location.map((t,idx) => (
|
||||||
|
<option key={idx} value={idx}>{t}</option>
|
||||||
|
))
|
||||||
|
}
|
||||||
|
</select>
|
||||||
|
</Form.Field>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
</Form.Group>
|
||||||
|
<Button type="submit" fluid content="更新Timezone" />
|
||||||
|
</Form>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default TimezoneForm;
|
||||||
@@ -4,6 +4,7 @@ import Datetime from 'react-datetime';
|
|||||||
import {Container, Segment, Form, Header, Menu, Grid, Table, Input} from 'semantic-ui-react';
|
import {Container, Segment, Form, Header, Menu, Grid, Table, Input} from 'semantic-ui-react';
|
||||||
import NetForm from './NetForm';
|
import NetForm from './NetForm';
|
||||||
import TimeForm from './TimeForm';
|
import TimeForm from './TimeForm';
|
||||||
|
import TimezoneForm from './TimezoneForm';
|
||||||
import {convertTime,padding} from '../../../tools';
|
import {convertTime,padding} from '../../../tools';
|
||||||
|
|
||||||
class SysInfo extends React.Component {
|
class SysInfo extends React.Component {
|
||||||
@@ -37,6 +38,11 @@ class SysInfo extends React.Component {
|
|||||||
dispatch(set_system_time(dstr));
|
dispatch(set_system_time(dstr));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
showDialog = (msg) => {
|
||||||
|
let {dispatch} = this.props;
|
||||||
|
dispatch(add_dialog_msg(msg));
|
||||||
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
let {i18n, network, time} = this.props;
|
let {i18n, network, time} = this.props;
|
||||||
return (
|
return (
|
||||||
@@ -45,6 +51,10 @@ class SysInfo extends React.Component {
|
|||||||
<Header as="h2" content={i18n && 't' in i18n ? i18n.t('page.system_info.title.sysinfo') : ''} />
|
<Header as="h2" content={i18n && 't' in i18n ? i18n.t('page.system_info.title.sysinfo') : ''} />
|
||||||
<NetForm i18n={i18n} network={network} onSubmit={this.netSubmit}/>
|
<NetForm i18n={i18n} network={network} onSubmit={this.netSubmit}/>
|
||||||
</Segment>
|
</Segment>
|
||||||
|
<Segment>
|
||||||
|
<Header as="h2" content="Time Zone" />
|
||||||
|
<TimezoneForm i18n={i18n} showDialog={this.showDialog} />
|
||||||
|
</Segment>
|
||||||
<Segment style={{marginBottom: '100px'}}>
|
<Segment style={{marginBottom: '100px'}}>
|
||||||
<Header as="h2" content={i18n && 't' in i18n ? i18n.t('page.system_info.title.timeinfo') : ''} />
|
<Header as="h2" content={i18n && 't' in i18n ? i18n.t('page.system_info.title.timeinfo') : ''} />
|
||||||
<TimeForm i18n={i18n} time={time} onSubmit={this.timeSubmit}/>
|
<TimeForm i18n={i18n} time={time} onSubmit={this.timeSubmit}/>
|
||||||
|
|||||||
@@ -0,0 +1,24 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import {Table} from 'semantic-ui-react';
|
||||||
|
import {convertTime, padding} from '../../../../tools';
|
||||||
|
|
||||||
|
const ListItem = ({i18n, data}) => {
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Table.Row style={{color: data.loss != 0 ? '#f00' : 'inherit'}}>
|
||||||
|
<Table.Cell>{data.wristband}</Table.Cell>
|
||||||
|
<Table.Cell>{data.name}</Table.Cell>
|
||||||
|
<Table.Cell>{data.locname}</Table.Cell>
|
||||||
|
<Table.Cell>{data.val3 ? parseInt(data.val3, 16) : ''}</Table.Cell>
|
||||||
|
<Table.Cell>{data.val4 ? `${parseInt(data.val4, 16)}%` : ''}</Table.Cell>
|
||||||
|
<Table.Cell>{data.val2 ? `${parseInt(data.val2, 16)}` : ''}</Table.Cell>
|
||||||
|
<Table.Cell>{data.val5 ? `${parseInt(data.val5, 16)}` : ''}</Table.Cell>
|
||||||
|
<Table.Cell>{data.val6 ? `${parseInt(data.val6, 16)}` : ''}</Table.Cell>
|
||||||
|
<Table.Cell>{data.val7 ? `${parseInt(data.val7, 16)}` : ''}</Table.Cell>
|
||||||
|
<Table.Cell>{data.val9 ? `${parseInt(data.val9, 16)}` : ''}</Table.Cell>
|
||||||
|
<Table.Cell>{data.timestamp ? convertTime(data.timestamp, true) : ''}</Table.Cell>
|
||||||
|
</Table.Row>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default ListItem;
|
||||||
@@ -0,0 +1,172 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import {Container, Segment, Table, Label, Checkbox, Icon} from 'semantic-ui-react';
|
||||||
|
import {getRequest} from '../../../../actions';
|
||||||
|
import ListItem from './ListItem';
|
||||||
|
|
||||||
|
const sort_icon = {
|
||||||
|
"asc": "caret down",
|
||||||
|
"desc": "caret up"
|
||||||
|
}
|
||||||
|
|
||||||
|
class LocStatus extends React.Component{
|
||||||
|
state = {
|
||||||
|
autoRefresh: true,
|
||||||
|
list: [],
|
||||||
|
sort: {
|
||||||
|
field: '',
|
||||||
|
order: ''
|
||||||
|
}
|
||||||
|
}
|
||||||
|
tick = null
|
||||||
|
|
||||||
|
componentDidMount(){
|
||||||
|
this.getList();
|
||||||
|
this.checkRefresh();
|
||||||
|
}
|
||||||
|
|
||||||
|
componentWillUnmount(){
|
||||||
|
clearInterval(this.tick);
|
||||||
|
}
|
||||||
|
|
||||||
|
changeRefresh = () => {
|
||||||
|
this.setState({
|
||||||
|
autoRefresh: !this.state.autoRefresh
|
||||||
|
}, ()=>{
|
||||||
|
this.checkRefresh();
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
checkRefresh = () => {
|
||||||
|
if(this.state.autoRefresh) {
|
||||||
|
this.tick = setInterval(this.runTick, 5000);
|
||||||
|
}else{
|
||||||
|
clearInterval(this.tick);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
runTick = () => {
|
||||||
|
this.getList();
|
||||||
|
}
|
||||||
|
|
||||||
|
getList = () => {
|
||||||
|
let {toggleLoading, showDialog} = this.props;
|
||||||
|
let json = {
|
||||||
|
sort: this.state.sort
|
||||||
|
};
|
||||||
|
|
||||||
|
fetch('/api/wristband/getstatus', getRequest(json))
|
||||||
|
.then(response=>response.json())
|
||||||
|
.then(json => {
|
||||||
|
if(json.status != 1) return showDialog(json.message);
|
||||||
|
this.setState({
|
||||||
|
list: [...(json.data.record || [])]
|
||||||
|
})
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
handlerSort = (tag) => {
|
||||||
|
if(!tag) return ;
|
||||||
|
let sort = this.state.sort;
|
||||||
|
if(tag == sort.field){
|
||||||
|
if(sort.order == 'asc') sort.order = 'desc';
|
||||||
|
else sort.order = 'asc';
|
||||||
|
}else{
|
||||||
|
sort.field = tag;
|
||||||
|
sort.order = 'asc';
|
||||||
|
}
|
||||||
|
|
||||||
|
this.setState({
|
||||||
|
sort
|
||||||
|
}, () => {
|
||||||
|
this.getList();
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
renderSortIcon = (tag) => {
|
||||||
|
if(this.state.sort.field == tag)
|
||||||
|
return (<Icon size="large" name={sort_icon[this.state.sort.order]} />);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
render (){
|
||||||
|
let {i18n} = this.props;
|
||||||
|
console.log(this.state.list);
|
||||||
|
return (
|
||||||
|
<Container fluid>
|
||||||
|
<Segment className="clearfix">
|
||||||
|
<Checkbox toggle checked={this.state.autoRefresh} onChange={(e,d) => {this.changeRefresh()}} label="自動更新" />
|
||||||
|
<Table>
|
||||||
|
<Table.Header>
|
||||||
|
<Table.Row>
|
||||||
|
<Table.HeaderCell className="pointer" onClick={()=>{ this.handlerSort('mac') }}>
|
||||||
|
手環ID
|
||||||
|
{
|
||||||
|
this.renderSortIcon('mac')
|
||||||
|
}
|
||||||
|
</Table.HeaderCell>
|
||||||
|
<Table.HeaderCell className="pointer" onClick={()=>{ this.handlerSort('name') }}>
|
||||||
|
手環名稱
|
||||||
|
{
|
||||||
|
this.renderSortIcon('name')
|
||||||
|
}
|
||||||
|
</Table.HeaderCell>
|
||||||
|
<Table.HeaderCell className="pointer" onClick={()=>{this.handlerSort('loc')}}>
|
||||||
|
地點
|
||||||
|
{this.renderSortIcon('loc')}
|
||||||
|
</Table.HeaderCell>
|
||||||
|
<Table.HeaderCell className="pointer" onClick={()=>{this.handlerSort('val3')}}>
|
||||||
|
步數
|
||||||
|
{
|
||||||
|
this.renderSortIcon('val3')
|
||||||
|
}
|
||||||
|
</Table.HeaderCell>
|
||||||
|
<Table.HeaderCell className="pointer" onClick={()=>{this.handlerSort('val4')}}>
|
||||||
|
剩餘電量
|
||||||
|
{
|
||||||
|
this.renderSortIcon('val4')
|
||||||
|
}
|
||||||
|
</Table.HeaderCell>
|
||||||
|
<Table.HeaderCell className="pointer" onClick={()=>{this.handlerSort('val2')}}>
|
||||||
|
HR
|
||||||
|
{this.renderSortIcon('val2')}
|
||||||
|
</Table.HeaderCell>
|
||||||
|
<Table.HeaderCell className="pointer" onClick={()=>{this.handlerSort('val5')}}>
|
||||||
|
SBP
|
||||||
|
{this.renderSortIcon('val5')}
|
||||||
|
</Table.HeaderCell>
|
||||||
|
<Table.HeaderCell className="pointer" onClick={()=>{this.handlerSort('val6')}}>
|
||||||
|
DBP
|
||||||
|
{this.renderSortIcon('val6')}
|
||||||
|
</Table.HeaderCell>
|
||||||
|
<Table.HeaderCell className="pointer" onClick={()=>{this.handlerSort('val7')}}>
|
||||||
|
卡路里
|
||||||
|
{this.renderSortIcon('val7')}
|
||||||
|
</Table.HeaderCell>
|
||||||
|
<Table.HeaderCell className="pointer" onClick={()=>{this.handlerSort('val9')}}>
|
||||||
|
SOS
|
||||||
|
{this.renderSortIcon('val9')}
|
||||||
|
</Table.HeaderCell>
|
||||||
|
<Table.HeaderCell className="pointer" onClick={()=>{this.handlerSort('time')}}>
|
||||||
|
更新時間
|
||||||
|
{this.renderSortIcon('time')}
|
||||||
|
</Table.HeaderCell>
|
||||||
|
{/*<Table.HeaderCell></Table.HeaderCell>*/}
|
||||||
|
</Table.Row>
|
||||||
|
</Table.Header>
|
||||||
|
<Table.Body>
|
||||||
|
{
|
||||||
|
this.state.list.map((t,idx)=>(
|
||||||
|
<ListItem key={idx}
|
||||||
|
i18n={i18n}
|
||||||
|
data={t} />
|
||||||
|
))
|
||||||
|
}
|
||||||
|
</Table.Body>
|
||||||
|
</Table>
|
||||||
|
</Segment>
|
||||||
|
</Container>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default LocStatus;
|
||||||
@@ -0,0 +1,120 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import {Grid, Header, Container, Segment, List, Label} from 'semantic-ui-react';
|
||||||
|
import {getRequest} from '../../../../actions';
|
||||||
|
import {padding} from '../../../../tools'
|
||||||
|
|
||||||
|
class LocStatusWloc extends React.Component {
|
||||||
|
state = {
|
||||||
|
loc: [],
|
||||||
|
ui: {
|
||||||
|
colLoading: false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
tick = null
|
||||||
|
|
||||||
|
componentDidMount() {
|
||||||
|
this.getLocList();
|
||||||
|
}
|
||||||
|
componentWillUnmount(){
|
||||||
|
clearInterval(this.tick);
|
||||||
|
}
|
||||||
|
|
||||||
|
runTick = ()=>{
|
||||||
|
this.getStatus();
|
||||||
|
}
|
||||||
|
|
||||||
|
getLocList = ()=>{
|
||||||
|
let {toggleLoading, showDialog} = this.props;
|
||||||
|
toggleLoading(1);
|
||||||
|
fetch('/api/wristband/getlocationlist', getRequest())
|
||||||
|
.then(response=>response.json())
|
||||||
|
.then(json=>{
|
||||||
|
toggleLoading(0);
|
||||||
|
if(json.status != 1) return showDialog(json.message);
|
||||||
|
this.setState({
|
||||||
|
loc: json.data.record || []
|
||||||
|
}, ()=>{
|
||||||
|
this.setState({
|
||||||
|
ui:{
|
||||||
|
colLoading: true
|
||||||
|
}}, ()=>{})
|
||||||
|
this.getStatus();
|
||||||
|
this.tick = setInterval(this.runTick, 5000);
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
getStatus = () => {
|
||||||
|
let {toggleLoading, showDialog} = this.props;
|
||||||
|
|
||||||
|
fetch('/api/wristband/getstatus', getRequest({
|
||||||
|
sort: {
|
||||||
|
field: 'time',
|
||||||
|
order: 'desc'
|
||||||
|
}
|
||||||
|
}))
|
||||||
|
.then(response=>response.json())
|
||||||
|
.then(json => {
|
||||||
|
if(json.status != 1) return showDialog(json.message);
|
||||||
|
let record = json.data.record || [];
|
||||||
|
let locs = this.state.loc;
|
||||||
|
for(let i in locs){
|
||||||
|
locs[i].list = [];
|
||||||
|
}
|
||||||
|
for(let i in record) {
|
||||||
|
let tmp = record[i];
|
||||||
|
if(!tmp.locid) continue;
|
||||||
|
for(let j in locs) {
|
||||||
|
if(locs[j].serialnumber == tmp.locid) {
|
||||||
|
locs[j].list.push(tmp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.setState({
|
||||||
|
loc: locs,
|
||||||
|
ui:{
|
||||||
|
colLoading: false
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
render() {
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Container fluid>
|
||||||
|
<Grid columns={3}>
|
||||||
|
{
|
||||||
|
this.state.loc.map((t,idx) => (
|
||||||
|
<Grid.Column key={idx} className="clearfix" >
|
||||||
|
<Header as="h5" content={t.name} />
|
||||||
|
<Segment style={{height: '400px', overflow: 'auto'}} loading={this.state.ui.colLoading}>
|
||||||
|
<List>
|
||||||
|
{
|
||||||
|
t.list ?
|
||||||
|
t.list.map((tt, idx) => {
|
||||||
|
let isExpire = tt.loss == 1 ? true : false;
|
||||||
|
return (<List.Item key={idx}>
|
||||||
|
{
|
||||||
|
tt.name ? (
|
||||||
|
<Label basic color={isExpire ? 'red' : 'blue'} size="tiny" content={tt.name}/>
|
||||||
|
) : null
|
||||||
|
}
|
||||||
|
<Label basic color={isExpire ? 'red' : 'teal'} size="tiny" content={tt.mac}/>
|
||||||
|
</List.Item>)
|
||||||
|
})
|
||||||
|
: null
|
||||||
|
}
|
||||||
|
</List>
|
||||||
|
</Segment>
|
||||||
|
</Grid.Column>
|
||||||
|
))
|
||||||
|
}
|
||||||
|
</Grid>
|
||||||
|
</Container>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default LocStatusWloc;
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import { Table, Button } from 'semantic-ui-react';
|
||||||
|
|
||||||
|
const ListItem = ({ i18n, data, delLocation, editLocation }) => {
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Table.Row>
|
||||||
|
<Table.Cell>
|
||||||
|
<Button content="Edit" basic onClick={()=>{editLocation(1, data)}} />
|
||||||
|
<Button content="Delete" basic onClick={()=>{delLocation(data.uid)}} />
|
||||||
|
</Table.Cell>
|
||||||
|
<Table.Cell>{data.serialnumber}</Table.Cell>
|
||||||
|
<Table.Cell>{data.name}</Table.Cell>
|
||||||
|
</Table.Row>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default ListItem;
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import { Modal, Form, Input, Button, Checkbox, Grid } from 'semantic-ui-react';
|
||||||
|
|
||||||
|
const WristbandModal = ({ i18n, open, type, data, closeModal, submitModal }) => {
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Modal open={open}>
|
||||||
|
<Modal.Header content={type == 1 ? '修改資料' : '新增資料'} />
|
||||||
|
<Modal.Content>
|
||||||
|
<Form onSubmit={(e,d)=>{
|
||||||
|
e.preventDefault();
|
||||||
|
submitModal(type, d.formData);
|
||||||
|
}} serializer={e => {
|
||||||
|
let json = {
|
||||||
|
name: '',
|
||||||
|
sn: '',
|
||||||
|
id: type == 1 ? data.uid : ''
|
||||||
|
};
|
||||||
|
|
||||||
|
let name = e.querySelector('input[name="name"]');
|
||||||
|
if(name && 'value' in name) json.name = name.value;
|
||||||
|
let sn = e.querySelector('input[name="serialnumber"]');
|
||||||
|
if(sn && 'value' in sn) json.sn = sn.value;
|
||||||
|
|
||||||
|
return json;
|
||||||
|
}}>
|
||||||
|
<Form.Field>
|
||||||
|
<Input label="裝置序號" name="serialnumber" defaultValue={data.serialnumber} disabled={type == 1} />
|
||||||
|
</Form.Field>
|
||||||
|
<Form.Field>
|
||||||
|
<Input label="名稱" name="name" defaultValue={data.name} />
|
||||||
|
</Form.Field>
|
||||||
|
<Grid columns={2}>
|
||||||
|
<Grid.Column>
|
||||||
|
<Button content="送出" fluid type="submit" />
|
||||||
|
</Grid.Column>
|
||||||
|
<Grid.Column>
|
||||||
|
<Button content="取消" fluid type="button" onClick={()=>{ closeModal() }} />
|
||||||
|
</Grid.Column>
|
||||||
|
</Grid>
|
||||||
|
</Form>
|
||||||
|
</Modal.Content>
|
||||||
|
</Modal>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
export default WristbandModal;
|
||||||
@@ -0,0 +1,128 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import {Container, Segment, Button, Table} from 'semantic-ui-react';
|
||||||
|
import {getRequest} from '../../../../actions';
|
||||||
|
import ListItem from './ListItem';
|
||||||
|
import LocationModal from './LocationModal';
|
||||||
|
|
||||||
|
const stateDefault = ()=>({
|
||||||
|
list: [],
|
||||||
|
modal: {
|
||||||
|
open: false,
|
||||||
|
type: 0,
|
||||||
|
data: {}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
class Location extends React.Component {
|
||||||
|
|
||||||
|
state = {
|
||||||
|
...stateDefault()
|
||||||
|
}
|
||||||
|
|
||||||
|
componentDidMount() {
|
||||||
|
this.getList();
|
||||||
|
}
|
||||||
|
|
||||||
|
getList = () => {
|
||||||
|
let {showDialog, toggleLoading} = this.props;
|
||||||
|
toggleLoading(1);
|
||||||
|
fetch('/api/wristband/getlocationlist', getRequest())
|
||||||
|
.then(response=>response.json())
|
||||||
|
.then(json => {
|
||||||
|
toggleLoading(0);
|
||||||
|
if(json.status != 1) return showDialog(json.message);
|
||||||
|
this.setState({
|
||||||
|
list: json.data.record || []
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
openModal = (type, data = {}) =>{
|
||||||
|
this.setState({
|
||||||
|
modal: {
|
||||||
|
open: true,
|
||||||
|
type,
|
||||||
|
data
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
closeModal = () => {
|
||||||
|
this.setState({
|
||||||
|
modal:{
|
||||||
|
...stateDefault().modal
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
submitModal = (type, data) => {
|
||||||
|
let {showDialog} = this.props;
|
||||||
|
if(type == 1 && !data.id) return showDialog('資料取得失敗');
|
||||||
|
if(type == 0 && !data.sn) return showDialog('請填寫裝置序號');
|
||||||
|
|
||||||
|
let url = type == 1 ? '/api/wristband/editlocation' : '/api/wristband/addlocation';
|
||||||
|
fetch(url, getRequest(data))
|
||||||
|
.then(response => response.json())
|
||||||
|
.then(json => {
|
||||||
|
if(json.status != 1) return showDialog(json.message);
|
||||||
|
this.setState({
|
||||||
|
modal: {
|
||||||
|
...stateDefault().modal
|
||||||
|
}
|
||||||
|
}, ()=>{
|
||||||
|
this.getList();
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
delLocation = (id) => {
|
||||||
|
if(!id) return ;
|
||||||
|
let {showDialog, callConfirm} = this.props;
|
||||||
|
callConfirm('確定要刪除這筆定位點資料?', ()=>{
|
||||||
|
fetch('/api/wristband/dellocation', getRequest({id}))
|
||||||
|
.then(response => response.json())
|
||||||
|
.then(json => {
|
||||||
|
if(json.status != 1) return showDialog(json.message);
|
||||||
|
this.getList();
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
render() {
|
||||||
|
let {i18n} = this.props;
|
||||||
|
return (
|
||||||
|
<Container fluid>
|
||||||
|
<Segment className="clearfix">
|
||||||
|
<Button floated="right" basic color="green" style={{marginBottom: '15px'}} content="新增" icon="plus" onClick={()=>{this.openModal(0)}} />
|
||||||
|
<Table>
|
||||||
|
<Table.Header>
|
||||||
|
<Table.Row>
|
||||||
|
<Table.HeaderCell>操作</Table.HeaderCell>
|
||||||
|
<Table.HeaderCell>裝置序號</Table.HeaderCell>
|
||||||
|
<Table.HeaderCell>裝置名稱</Table.HeaderCell>
|
||||||
|
</Table.Row>
|
||||||
|
</Table.Header>
|
||||||
|
<Table.Body>
|
||||||
|
{
|
||||||
|
this.state.list.map((t,idx) => (
|
||||||
|
<ListItem key={idx}
|
||||||
|
i18n={i18n}
|
||||||
|
data={t}
|
||||||
|
delLocation={this.delLocation}
|
||||||
|
editLocation={this.openModal} />
|
||||||
|
))
|
||||||
|
}
|
||||||
|
</Table.Body>
|
||||||
|
</Table>
|
||||||
|
</Segment>
|
||||||
|
<LocationModal
|
||||||
|
i18n={i18n}
|
||||||
|
open={this.state.modal.open}
|
||||||
|
type={this.state.modal.type}
|
||||||
|
data={this.state.modal.data}
|
||||||
|
closeModal={this.closeModal}
|
||||||
|
submitModal={this.submitModal} />
|
||||||
|
</Container>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default Location;
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import { Table, Button } from 'semantic-ui-react';
|
||||||
|
|
||||||
|
const ListItem = ({ i18n, data, delWristband, editWristband, showPathInfo, showHealthInfo }) => {
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Table.Row>
|
||||||
|
<Table.Cell>
|
||||||
|
<Button content="Edit" basic onClick={()=>{editWristband(1, data)}} />
|
||||||
|
<Button content="Delete" basic onClick={()=>{delWristband(data.uid)}} />
|
||||||
|
<Button content="地點紀錄" basic onClick={()=>{showPathInfo(data.mac, data.name)}} />
|
||||||
|
<Button content="生理資訊紀錄" basic onClick={()=>{showHealthInfo(data.mac, data.name)}} />
|
||||||
|
</Table.Cell>
|
||||||
|
<Table.Cell>{data.mac}</Table.Cell>
|
||||||
|
<Table.Cell>{data.name}</Table.Cell>
|
||||||
|
<Table.Cell>{data.identity}</Table.Cell>
|
||||||
|
<Table.Cell>{data.monitor == 1 ? '啟用' : '停用'}</Table.Cell>
|
||||||
|
<Table.Cell>{data.notify == 1 ? '啟用' : '停用'}</Table.Cell>
|
||||||
|
<Table.Cell>{data.switch == 1 ? '啟用' : '停用'}</Table.Cell>
|
||||||
|
</Table.Row>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default ListItem;
|
||||||
@@ -0,0 +1,150 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import ReactDOM from 'react-dom';
|
||||||
|
import { Modal, List, Menu, Button, Input, Label, Table } from 'semantic-ui-react';
|
||||||
|
import Datetime from 'react-datetime';
|
||||||
|
import {convertTime, padding} from '../../../../tools'
|
||||||
|
|
||||||
|
const getDayTime = ()=>{
|
||||||
|
let d = new Date();
|
||||||
|
d.setHours(0, 0, 0, 0);
|
||||||
|
return d.getTime();
|
||||||
|
}
|
||||||
|
|
||||||
|
class WristbandPathInfo extends React.Component{
|
||||||
|
state = {
|
||||||
|
list: [],
|
||||||
|
page: 1,
|
||||||
|
maxPage: 1,
|
||||||
|
stime: (getDayTime()),
|
||||||
|
etime: (Date.now())
|
||||||
|
}
|
||||||
|
|
||||||
|
componentDidMount(){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
closeView = () => {
|
||||||
|
this.setState({
|
||||||
|
list: [],
|
||||||
|
page: 1,
|
||||||
|
maxPage: 1,
|
||||||
|
stime: (getDayTime()),
|
||||||
|
etime: (Date.now())
|
||||||
|
}, ()=>{
|
||||||
|
this.props.closeModal();
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
getList = () => {
|
||||||
|
let {mac, showDialog, getRequest} = this.props;
|
||||||
|
fetch('/api/wristband/getwristbandhealthinfo', getRequest({
|
||||||
|
mac,
|
||||||
|
stime: Math.floor(this.state.stime / 1000),
|
||||||
|
etime: Math.floor(this.state.etime / 1000)
|
||||||
|
}))
|
||||||
|
.then(response=>response.json())
|
||||||
|
.then(json => {
|
||||||
|
if(json.status != 1) return showDialog(json.message);
|
||||||
|
let l = json.data.record || [];
|
||||||
|
this.setState({
|
||||||
|
list: l,
|
||||||
|
page: 1,
|
||||||
|
maxPage: Math.ceil(l.length / 20)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
nextPage = () => {
|
||||||
|
let {page, maxPage} = this.state;
|
||||||
|
this.setState({
|
||||||
|
page: page >= maxPage ? maxPage : page+1
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
prevPage = () => {
|
||||||
|
let {page} = this.state;
|
||||||
|
this.setState({
|
||||||
|
page: page <= 1 ? 1 : page-1
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
render() {
|
||||||
|
let {closeModal, open} = this.props;
|
||||||
|
|
||||||
|
let tmpList = this.state.list.slice((this.state.page - 1) * 20, ((this.state.page - 1) * 20 + 20))
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Modal open={open} onClose={()=>{this.closeView()}}>
|
||||||
|
<Modal.Header>
|
||||||
|
手環名稱: {this.props.wbname}
|
||||||
|
</Modal.Header>
|
||||||
|
<Modal.Content>
|
||||||
|
<Menu>
|
||||||
|
<Menu.Item>
|
||||||
|
<Input label="起始時間" input={
|
||||||
|
<Datetime dateFormat="YYYY-MM-DD"
|
||||||
|
timeFormat="HH:mm"
|
||||||
|
value={this.state.stime}
|
||||||
|
input={true}
|
||||||
|
onChange={(e)=>{ this.setState({stime: (e.valueOf())}) }} />
|
||||||
|
}/>
|
||||||
|
</Menu.Item>
|
||||||
|
<Menu.Item>
|
||||||
|
<Input label="結束時間" input={
|
||||||
|
<Datetime dateFormat="YYYY-MM-DD"
|
||||||
|
timeFormat="HH:mm"
|
||||||
|
value={this.state.etime}
|
||||||
|
input={true}
|
||||||
|
onChange={(e)=>{ this.setState({etime: (e.valueOf())}) }} />
|
||||||
|
}/>
|
||||||
|
</Menu.Item>
|
||||||
|
<Menu.Menu position="right">
|
||||||
|
<Menu.Item>
|
||||||
|
<Button type="button" content="搜尋" size="tiny" basic onClick={()=>{this.getList()}} />
|
||||||
|
</Menu.Item>
|
||||||
|
</Menu.Menu>
|
||||||
|
</Menu>
|
||||||
|
|
||||||
|
<div style={{textAlign: 'center'}}>
|
||||||
|
<Button content="上一頁" size="small" labelPosition="left" basic={true} color="black" icon="arrow left" onClick={() => {this.prevPage()}} />
|
||||||
|
<Label basic={true} color="blue" content={`${this.state.page || 1} / ${this.state.maxPage || 1}`} />
|
||||||
|
<Button content="下一頁" size="small" labelPosition="right" basic={true} color="black" icon="arrow right" onClick={() => {this.nextPage()}} />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<Table>
|
||||||
|
<Table.Header>
|
||||||
|
<Table.Row>
|
||||||
|
<Table.HeaderCell>HR</Table.HeaderCell>
|
||||||
|
<Table.HeaderCell>步數</Table.HeaderCell>
|
||||||
|
<Table.HeaderCell>SBP</Table.HeaderCell>
|
||||||
|
<Table.HeaderCell>DBP</Table.HeaderCell>
|
||||||
|
<Table.HeaderCell>卡路里</Table.HeaderCell>
|
||||||
|
<Table.HeaderCell>SOS</Table.HeaderCell>
|
||||||
|
<Table.HeaderCell>更新時間</Table.HeaderCell>
|
||||||
|
</Table.Row>
|
||||||
|
</Table.Header>
|
||||||
|
<Table.Body>
|
||||||
|
{
|
||||||
|
tmpList.map((t,idx) => {
|
||||||
|
return (
|
||||||
|
<Table.Row key={idx}>
|
||||||
|
<Table.Cell>{parseInt(t.wphyloghr, 16)}</Table.Cell>
|
||||||
|
<Table.Cell>{parseInt(t.wphylogsteps, 16)}</Table.Cell>
|
||||||
|
<Table.Cell>{parseInt(t.wphylogsbp, 16)}</Table.Cell>
|
||||||
|
<Table.Cell>{parseInt(t.wphylogdbp, 16)}</Table.Cell>
|
||||||
|
<Table.Cell>{parseInt(t.wphylogcal, 16)}</Table.Cell>
|
||||||
|
<Table.Cell>{parseInt(t.wphylogsos, 16)}</Table.Cell>
|
||||||
|
<Table.Cell>{convertTime(t.wphylogtst, true)}</Table.Cell>
|
||||||
|
</Table.Row>
|
||||||
|
)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
</Table.Body>
|
||||||
|
</Table>
|
||||||
|
</Modal.Content>
|
||||||
|
</Modal>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default WristbandPathInfo;
|
||||||
@@ -0,0 +1,70 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import { Modal, Form, Input, Button, Checkbox, Grid } from 'semantic-ui-react';
|
||||||
|
|
||||||
|
const WristbandModal = ({ i18n, open, type, data, closeModal, submitModal }) => {
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Modal open={open}>
|
||||||
|
<Modal.Header content={type == 1 ? '修改資料' : '新增資料'} />
|
||||||
|
<Modal.Content>
|
||||||
|
<Form onSubmit={(e,d)=>{
|
||||||
|
e.preventDefault();
|
||||||
|
submitModal(type, d.formData);
|
||||||
|
}} serializer={e => {
|
||||||
|
let json = {
|
||||||
|
name: '',
|
||||||
|
identity: '',
|
||||||
|
monitor: 0,
|
||||||
|
notify: 0,
|
||||||
|
id: type == 1 ? data.uid : '',
|
||||||
|
mac: '',
|
||||||
|
switch: 0
|
||||||
|
};
|
||||||
|
|
||||||
|
let mac = e.querySelector('input[name="mac"]');
|
||||||
|
if(mac && 'value' in mac) json.mac = mac.value;
|
||||||
|
let name = e.querySelector('input[name="name"]');
|
||||||
|
if(name && 'value' in name) json.name = name.value;
|
||||||
|
let identity = e.querySelector('input[name="identity"]');
|
||||||
|
if(identity && 'value' in identity) json.identity = identity.value;
|
||||||
|
let monitor = e.querySelector('input[name="monitor"]');
|
||||||
|
if(monitor && 'checked' in monitor) json.monitor = monitor.checked ? 1 : 0;
|
||||||
|
let notify = e.querySelector('input[name="notify"]');
|
||||||
|
if(notify && 'checked' in notify) json.notify = notify.checked ? 1 : 0;
|
||||||
|
let sw = e.querySelector('input[name="switch"]');
|
||||||
|
if(sw && 'checked' in sw) json.switch = sw.checked ? 1 : 0;
|
||||||
|
|
||||||
|
return json;
|
||||||
|
}}>
|
||||||
|
<Form.Field>
|
||||||
|
<Input label="手環ID" name="mac" defaultValue={data.mac} disabled={type == 1} />
|
||||||
|
</Form.Field>
|
||||||
|
<Form.Field>
|
||||||
|
<Input label="名稱" name="name" defaultValue={data.name} />
|
||||||
|
</Form.Field>
|
||||||
|
<Form.Field>
|
||||||
|
<Input label="身份" name="identity" defaultValue={data.identity} />
|
||||||
|
</Form.Field>
|
||||||
|
<Form.Field>
|
||||||
|
<Checkbox label="監控" name="monitor" defaultChecked={data.monitor == 1} />
|
||||||
|
</Form.Field>
|
||||||
|
<Form.Field>
|
||||||
|
<Checkbox label="通知" name="notify" defaultChecked={data.notify == 1} />
|
||||||
|
</Form.Field>
|
||||||
|
<Form.Field>
|
||||||
|
<Checkbox label="啟用" name="switch" defaultChecked={data.switch == 1} />
|
||||||
|
</Form.Field>
|
||||||
|
<Grid columns={2}>
|
||||||
|
<Grid.Column>
|
||||||
|
<Button content="送出" fluid type="submit" />
|
||||||
|
</Grid.Column>
|
||||||
|
<Grid.Column>
|
||||||
|
<Button content="取消" fluid type="button" onClick={()=>{ closeModal() }} />
|
||||||
|
</Grid.Column>
|
||||||
|
</Grid>
|
||||||
|
</Form>
|
||||||
|
</Modal.Content>
|
||||||
|
</Modal>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
export default WristbandModal;
|
||||||
@@ -0,0 +1,135 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import ReactDOM from 'react-dom';
|
||||||
|
import { Modal, List, Menu, Button, Input, Label } from 'semantic-ui-react';
|
||||||
|
import Datetime from 'react-datetime';
|
||||||
|
import {convertTime, padding} from '../../../../tools'
|
||||||
|
|
||||||
|
const getDayTime = ()=>{
|
||||||
|
let d = new Date();
|
||||||
|
d.setHours(0, 0, 0, 0);
|
||||||
|
return d.getTime();
|
||||||
|
}
|
||||||
|
|
||||||
|
class WristbandPathInfo extends React.Component{
|
||||||
|
state = {
|
||||||
|
list: [],
|
||||||
|
page: 1,
|
||||||
|
maxPage: 1,
|
||||||
|
stime: (getDayTime()),
|
||||||
|
etime: (Date.now())
|
||||||
|
}
|
||||||
|
|
||||||
|
componentDidMount(){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
closeView = () => {
|
||||||
|
this.setState({
|
||||||
|
list: [],
|
||||||
|
page: 1,
|
||||||
|
maxPage: 1,
|
||||||
|
stime: (getDayTime()),
|
||||||
|
etime: (Date.now())
|
||||||
|
}, ()=>{
|
||||||
|
this.props.closeModal();
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
getList = () => {
|
||||||
|
let {mac, showDialog, getRequest} = this.props;
|
||||||
|
fetch('/api/wristband/getwristbandlocpath', getRequest({
|
||||||
|
mac,
|
||||||
|
stime: Math.floor(this.state.stime / 1000),
|
||||||
|
etime: Math.floor(this.state.etime / 1000)
|
||||||
|
}))
|
||||||
|
.then(response=>response.json())
|
||||||
|
.then(json => {
|
||||||
|
if(json.status != 1) return showDialog(json.message);
|
||||||
|
let l = json.data.record || [];
|
||||||
|
this.setState({
|
||||||
|
list: l,
|
||||||
|
page: 1,
|
||||||
|
maxPage: Math.ceil(l.length / 20)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
nextPage = () => {
|
||||||
|
let {page, maxPage} = this.state;
|
||||||
|
this.setState({
|
||||||
|
page: page >= maxPage ? maxPage : page+1
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
prevPage = () => {
|
||||||
|
let {page} = this.state;
|
||||||
|
this.setState({
|
||||||
|
page: page <= 1 ? 1 : page-1
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
render() {
|
||||||
|
let {closeModal, open} = this.props;
|
||||||
|
|
||||||
|
let tmpList = this.state.list.slice((this.state.page - 1) * 20, ((this.state.page - 1) * 20 + 20))
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Modal open={open} onClose={()=>{this.closeView()}}>
|
||||||
|
<Modal.Header>
|
||||||
|
手環名稱: {this.props.wbname}
|
||||||
|
</Modal.Header>
|
||||||
|
<Modal.Content>
|
||||||
|
<Menu>
|
||||||
|
<Menu.Item>
|
||||||
|
<Input label="起始時間" input={
|
||||||
|
<Datetime dateFormat="YYYY-MM-DD"
|
||||||
|
timeFormat="HH:mm"
|
||||||
|
value={this.state.stime}
|
||||||
|
input={true}
|
||||||
|
onChange={(e)=>{ this.setState({stime: (e.valueOf())}) }} />
|
||||||
|
}/>
|
||||||
|
</Menu.Item>
|
||||||
|
<Menu.Item>
|
||||||
|
<Input label="結束時間" input={
|
||||||
|
<Datetime dateFormat="YYYY-MM-DD"
|
||||||
|
timeFormat="HH:mm"
|
||||||
|
value={this.state.etime}
|
||||||
|
input={true}
|
||||||
|
onChange={(e)=>{ this.setState({etime: (e.valueOf())}) }} />
|
||||||
|
}/>
|
||||||
|
</Menu.Item>
|
||||||
|
<Menu.Menu position="right">
|
||||||
|
<Menu.Item>
|
||||||
|
<Button type="button" content="搜尋" size="tiny" basic onClick={()=>{this.getList()}} />
|
||||||
|
</Menu.Item>
|
||||||
|
</Menu.Menu>
|
||||||
|
</Menu>
|
||||||
|
|
||||||
|
<div style={{textAlign: 'center'}}>
|
||||||
|
<Button content="上一頁" size="small" labelPosition="left" basic={true} color="black" icon="arrow left" onClick={() => {this.prevPage()}} />
|
||||||
|
<Label basic={true} color="blue" content={`${this.state.page || 1} / ${this.state.maxPage || 1}`} />
|
||||||
|
<Button content="下一頁" size="small" labelPosition="right" basic={true} color="black" icon="arrow right" onClick={() => {this.nextPage()}} />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<List divided>
|
||||||
|
{
|
||||||
|
tmpList.map((t,idx) => {
|
||||||
|
return (
|
||||||
|
<List.Item key={idx}>
|
||||||
|
{
|
||||||
|
t.devname ?
|
||||||
|
`時間 ${convertTime(t.wloclogtst, true)} 位於 ${t.devname} 附近` :
|
||||||
|
`時間 ${convertTime(t.wloclogtst, true)} 不在範圍內`
|
||||||
|
}
|
||||||
|
</List.Item>
|
||||||
|
)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
</List>
|
||||||
|
</Modal.Content>
|
||||||
|
</Modal>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default WristbandPathInfo;
|
||||||
@@ -0,0 +1,195 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import { Container, Segment, Table, Button } from 'semantic-ui-react';
|
||||||
|
import {getRequest} from '../../../../actions';
|
||||||
|
import ListItem from './ListItem';
|
||||||
|
import WristbandModal from './WristbandModal';
|
||||||
|
import WristbandPathInfo from './WristbandPathInfo';
|
||||||
|
import WristbandHealthInfo from './WristbandHealthInfo';
|
||||||
|
|
||||||
|
const stateDefault = ()=>({
|
||||||
|
list: [],
|
||||||
|
modal: {
|
||||||
|
open: false,
|
||||||
|
type: 0,
|
||||||
|
data: {}
|
||||||
|
},
|
||||||
|
pathinfo: {
|
||||||
|
open: false,
|
||||||
|
mac: '',
|
||||||
|
name: ''
|
||||||
|
},
|
||||||
|
healthinfo: {
|
||||||
|
open: false,
|
||||||
|
mac: '',
|
||||||
|
name: ''
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
class WristbandInfo extends React.Component {
|
||||||
|
state = {
|
||||||
|
...stateDefault()
|
||||||
|
}
|
||||||
|
|
||||||
|
componentDidMount(){
|
||||||
|
this.getList();
|
||||||
|
}
|
||||||
|
|
||||||
|
getList = () => {
|
||||||
|
let {showDialog, toggleLoading} = this.props;
|
||||||
|
toggleLoading(1);
|
||||||
|
fetch('/api/wristband/getwristbandlist', getRequest())
|
||||||
|
.then(response=>response.json())
|
||||||
|
.then(json =>{
|
||||||
|
toggleLoading(0);
|
||||||
|
if(json.status != 1) return showDialog(json.message);
|
||||||
|
this.setState({
|
||||||
|
list: json.data.record || []
|
||||||
|
})
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
delWristband = (id) => {
|
||||||
|
if(!id) return ;
|
||||||
|
let {showDialog, callConfirm} = this.props;
|
||||||
|
|
||||||
|
callConfirm('確定要刪除這筆手環資料?', ()=>{
|
||||||
|
fetch('/api/wristband/delwristband', getRequest({id}))
|
||||||
|
.then(response=>response.json())
|
||||||
|
.then(json=>{
|
||||||
|
if(json.status!=1) return showDialog(json.message);
|
||||||
|
this.getList();
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
openModal = (type, data = {}) => {
|
||||||
|
this.setState({
|
||||||
|
modal: {
|
||||||
|
type,
|
||||||
|
data,
|
||||||
|
open: true
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
closeModal = () => {
|
||||||
|
this.setState({
|
||||||
|
modal: {
|
||||||
|
...stateDefault().modal
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
submitModal = (type, data = {}) => {
|
||||||
|
let {showDialog, toggleLoading} = this.props;
|
||||||
|
if(type == 1 && !data.id) return showDialog('資料取得失敗');
|
||||||
|
if(type == 0 && !data.mac) return showDialog('請填寫手環ID');
|
||||||
|
|
||||||
|
let url = type == 1 ? '/api/wristband/editwristband' : '/api/wristband/addwristband';
|
||||||
|
|
||||||
|
fetch(url, getRequest(data))
|
||||||
|
.then(response=>response.json())
|
||||||
|
.then(json => {
|
||||||
|
if(json.status != 1) return showDialog(json.message);
|
||||||
|
this.setState({
|
||||||
|
modal: {...stateDefault().modal}
|
||||||
|
}, ()=>{
|
||||||
|
this.getList();
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
showPathInfo = (mac, name) => {
|
||||||
|
if(!mac) return ;
|
||||||
|
this.setState({
|
||||||
|
pathinfo:{
|
||||||
|
open: true,
|
||||||
|
mac,
|
||||||
|
name
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
closePathInfo = () => {
|
||||||
|
this.setState({
|
||||||
|
pathinfo: {
|
||||||
|
...stateDefault().pathinfo
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
showHealthInfo = (mac, name) => {
|
||||||
|
if(!mac) return ;
|
||||||
|
this.setState({
|
||||||
|
healthinfo:{
|
||||||
|
open: true,
|
||||||
|
mac,
|
||||||
|
name
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
closeHealthInfo = () => {
|
||||||
|
this.setState({
|
||||||
|
healthinfo: {
|
||||||
|
...stateDefault().healthinfo
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
render() {
|
||||||
|
let { i18n } = this.props;
|
||||||
|
return (
|
||||||
|
<Container fluid>
|
||||||
|
<Segment className="clearfix">
|
||||||
|
<Button basic color="green" icon="plus" content="新增" floated="right" onClick={()=>{this.openModal(0)}} style={{marginBottom: '15px'}} />
|
||||||
|
<Table>
|
||||||
|
<Table.Header>
|
||||||
|
<Table.Row>
|
||||||
|
<Table.HeaderCell>操作</Table.HeaderCell>
|
||||||
|
<Table.HeaderCell>手環ID</Table.HeaderCell>
|
||||||
|
<Table.HeaderCell>手環名稱</Table.HeaderCell>
|
||||||
|
<Table.HeaderCell>身份</Table.HeaderCell>
|
||||||
|
<Table.HeaderCell>監控</Table.HeaderCell>
|
||||||
|
<Table.HeaderCell>通知</Table.HeaderCell>
|
||||||
|
<Table.HeaderCell>啟用</Table.HeaderCell>
|
||||||
|
</Table.Row>
|
||||||
|
</Table.Header>
|
||||||
|
<Table.Body>
|
||||||
|
{
|
||||||
|
this.state.list.map((t,idx) => (
|
||||||
|
<ListItem key={idx} data={t}
|
||||||
|
i18n={i18n}
|
||||||
|
delWristband={this.delWristband}
|
||||||
|
editWristband={this.openModal}
|
||||||
|
showPathInfo={this.showPathInfo}
|
||||||
|
showHealthInfo={this.showHealthInfo} />
|
||||||
|
))
|
||||||
|
}
|
||||||
|
</Table.Body>
|
||||||
|
</Table>
|
||||||
|
</Segment>
|
||||||
|
<WristbandModal i18n={i18n}
|
||||||
|
open={this.state.modal.open}
|
||||||
|
type={this.state.modal.type}
|
||||||
|
data={this.state.modal.data}
|
||||||
|
closeModal={this.closeModal}
|
||||||
|
submitModal={this.submitModal} />
|
||||||
|
<WristbandPathInfo i18n={i18n}
|
||||||
|
open={this.state.pathinfo.open}
|
||||||
|
mac={this.state.pathinfo.mac}
|
||||||
|
wbname={this.state.pathinfo.name}
|
||||||
|
closeModal={this.closePathInfo}
|
||||||
|
showDialog={this.props.showDialog}
|
||||||
|
getRequest={getRequest} />
|
||||||
|
<WristbandHealthInfo i18n={i18n}
|
||||||
|
open={this.state.healthinfo.open}
|
||||||
|
mac={this.state.healthinfo.mac}
|
||||||
|
wbname={this.state.healthinfo.name}
|
||||||
|
closeModal={this.closeHealthInfo}
|
||||||
|
showDialog={this.props.showDialog}
|
||||||
|
getRequest={getRequest} />
|
||||||
|
</Container>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default WristbandInfo;
|
||||||
@@ -0,0 +1,70 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import {Grid, Container, Segment, Menu, List} from 'semantic-ui-react';
|
||||||
|
import LocStatus from '../../../containers/AdminPage/Wristband/LocStatus';
|
||||||
|
import WristbandInfo from '../../../containers/AdminPage/Wristband/WristbandInfo';
|
||||||
|
import Location from '../../../containers/AdminPage/Wristband/Location';
|
||||||
|
import LocStatusWloc from '../../../containers/AdminPage/Wristband/LocStatusWloc';
|
||||||
|
|
||||||
|
class WristbandPage extends React.Component{
|
||||||
|
state = {
|
||||||
|
page: ''
|
||||||
|
}
|
||||||
|
|
||||||
|
changePage = (page) => {
|
||||||
|
this.setState({
|
||||||
|
page
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
getRenderPage = () => {
|
||||||
|
let {i18n} = this.props;
|
||||||
|
switch(this.state.page) {
|
||||||
|
case 'locstatus':
|
||||||
|
return <LocStatus/>;
|
||||||
|
case 'locstatus_wloc':
|
||||||
|
return <LocStatusWloc />;
|
||||||
|
case 'wristband':
|
||||||
|
return <WristbandInfo />;
|
||||||
|
case 'location':
|
||||||
|
return <Location />
|
||||||
|
default:
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
render(){
|
||||||
|
let {i18n} = this.props;
|
||||||
|
return (
|
||||||
|
<Container fluid style={{paddingLeft: '10px', paddingRight: '10px'}}>
|
||||||
|
<Grid>
|
||||||
|
<Grid.Column width={4}>
|
||||||
|
<Menu vertical={true} fluid>
|
||||||
|
<Menu.Item>
|
||||||
|
<Menu.Header>主選單</Menu.Header>
|
||||||
|
<Menu.Menu>
|
||||||
|
<Menu.Item active={this.state.page == 'wristband'} onClick={()=>{this.changePage('wristband')}}>
|
||||||
|
手環名稱設定
|
||||||
|
</Menu.Item>
|
||||||
|
<Menu.Item active={this.state.page == 'location'} onClick={()=>{this.changePage('location')}}>
|
||||||
|
定位點設定
|
||||||
|
</Menu.Item>
|
||||||
|
<Menu.Item active={this.state.page == 'locstatus'} onClick={()=>{ this.changePage('locstatus'); }}>
|
||||||
|
即時資訊總覽
|
||||||
|
</Menu.Item>
|
||||||
|
<Menu.Item active={this.state.page == 'locstatus_wloc'} onClick={()=>{ this.changePage('locstatus_wloc'); }}>
|
||||||
|
位置資訊
|
||||||
|
</Menu.Item>
|
||||||
|
</Menu.Menu>
|
||||||
|
</Menu.Item>
|
||||||
|
</Menu>
|
||||||
|
</Grid.Column>
|
||||||
|
<Grid.Column width={12}>
|
||||||
|
{this.getRenderPage()}
|
||||||
|
</Grid.Column>
|
||||||
|
</Grid>
|
||||||
|
</Container>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default WristbandPage;
|
||||||
@@ -14,7 +14,7 @@ const DeviceSelect = ({i18n, querySelectList, page, permissions, devs, addSelect
|
|||||||
<option value="">{i18n&&i18n.t?i18n.t('select.dev_type') : ''}</option>
|
<option value="">{i18n&&i18n.t?i18n.t('select.dev_type') : ''}</option>
|
||||||
{
|
{
|
||||||
permissions.dio ?
|
permissions.dio ?
|
||||||
<option value="do">{i18n&&i18n.t ? i18n.t('select.digitoutput') : ''}</option> : null
|
<option value="do">{i18n&&i18n.t ? i18n.t('select.digitaloutput') : ''}</option> : null
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
permissions.leone ?
|
permissions.leone ?
|
||||||
|
|||||||
@@ -0,0 +1,15 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import {Modal, Button} from 'semantic-ui-react';
|
||||||
|
|
||||||
|
const ConfirmBox = ({obj, getNext}) => (
|
||||||
|
<Modal open={obj && obj.msg != '' ? true : false} onClose={() => getNext()} style={{zIndex: "2001"}}>
|
||||||
|
<Modal.Content>{obj && obj.msg ? obj.msg : ''}</Modal.Content>
|
||||||
|
<Modal.Actions>
|
||||||
|
<Button onClick={() => getNext(true, obj.act)} content="Submit" />
|
||||||
|
<Button onClick={() => getNext()} content="Cancel" />
|
||||||
|
</Modal.Actions>
|
||||||
|
</Modal>
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
export default ConfirmBox;
|
||||||
@@ -6,14 +6,14 @@ const AlertItem = ({i18n, name, type}) => {
|
|||||||
return (
|
return (
|
||||||
<Grid.Row columns={3} color="red">
|
<Grid.Row columns={3} color="red">
|
||||||
<Grid.Column>
|
<Grid.Column>
|
||||||
<Label basic content={type == 'di' ? "DigitInput" : "LeOne"} />
|
<Label basic content={type == 'di' ? "DigitalInput" : "LeOne"} />
|
||||||
</Grid.Column>
|
</Grid.Column>
|
||||||
<Grid.Column>
|
<Grid.Column>
|
||||||
<Label basic content={i18n&&i18n.t ? i18n.t('dashboard.label.name') : ''} />{name}
|
<Label basic content={i18n&&i18n.t ? i18n.t('dashboard.label.name') : ''} />{name}
|
||||||
</Grid.Column>
|
</Grid.Column>
|
||||||
<Grid.Column>
|
<Grid.Column>
|
||||||
<Label basic content={i18n&&i18n.t ? i18n.t('dashboard.label.status') : ''} />
|
<Label basic content={i18n&&i18n.t ? i18n.t('dashboard.label.status') : ''} />
|
||||||
{i18n&&i18n.t ? ( type == 'di' ? i18n.t('dashboard.status.digitinput') : i18n.t('dashboard.status.leone') ): ''}
|
{i18n&&i18n.t ? ( type == 'di' ? i18n.t('dashboard.status.digitalinput') : i18n.t('dashboard.status.leone') ): ''}
|
||||||
</Grid.Column>
|
</Grid.Column>
|
||||||
</Grid.Row>
|
</Grid.Row>
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ const loginForm = ({i18n, page, onSubmit}) => {
|
|||||||
}}>
|
}}>
|
||||||
<Segment stacked={true} >
|
<Segment stacked={true} >
|
||||||
<Form.Field>
|
<Form.Field>
|
||||||
<Input icon="user" iconPosition="left" name="acc" placeholder={typeof i18n.t == 'function' ? i18n.t(`${page}.input.placeholder.account`) : ''} />
|
<Input icon="user" iconPosition="left" autoFocus={true} name="acc" placeholder={typeof i18n.t == 'function' ? i18n.t(`${page}.input.placeholder.account`) : ''} />
|
||||||
</Form.Field>
|
</Form.Field>
|
||||||
<Form.Field>
|
<Form.Field>
|
||||||
<Input icon="lock" iconPosition="left" name="pass" type="password" placeholder={typeof i18n.t == 'function' ? i18n.t(`${page}.input.placeholder.password`) : ''} />
|
<Input icon="lock" iconPosition="left" name="pass" type="password" placeholder={typeof i18n.t == 'function' ? i18n.t(`${page}.input.placeholder.password`) : ''} />
|
||||||
|
|||||||
Loaded 100 of 120 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user