This commit is contained in:
Jay 2017-03-24 11:22:18 +08:00
parent 7aed87a053
commit c5236f9ad3
6 changed files with 115 additions and 11 deletions

View File

@ -7127,6 +7127,16 @@ var sw_link_active = exports.sw_link_active = function sw_link_active(data) {
};
};
var get_dashboard = exports.get_dashboard = function get_dashboard() {
return function (dispatch) {
return fetch('/api/system/dashboard', getRequest()).then(function (response) {
return response.json();
}).then(function (json) {
if (json.status != 1) return dispatch(add_dialog_msg(json.message));
});
};
};
/***/ }),
/* 30 */
/***/ (function(module, exports, __webpack_require__) {
@ -34796,11 +34806,22 @@ Object.defineProperty(exports, "__esModule", {
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var sysinfoReducer = function sysinfoReducer() {
var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {
var defState = function defState() {
return {
network: {},
time: ''
time: '',
dashboard: {
time: '',
ip: '',
version: '',
di: [],
leone: []
}
};
};
var sysinfoReducer = function sysinfoReducer() {
var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : defState();
var action = arguments[1];
switch (action.type) {
@ -80887,7 +80908,7 @@ var UnitItem = function (_React$Component) {
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;
d.value = data.min + '|' + data.hour + '|' + data.day + '|' + data.month + '|' + data.week + '|' + data.year;
}
updateData(_this.props.unit, d);

View File

@ -2820,6 +2820,16 @@ var sw_link_active = exports.sw_link_active = function sw_link_active(data) {
};
};
var get_dashboard = exports.get_dashboard = function get_dashboard() {
return function (dispatch) {
return fetch('/api/system/dashboard', getRequest()).then(function (response) {
return response.json();
}).then(function (json) {
if (json.status != 1) return dispatch(add_dialog_msg(json.message));
});
};
};
/***/ }),
/* 30 */
/***/ (function(module, exports, __webpack_require__) {
@ -28739,11 +28749,22 @@ Object.defineProperty(exports, "__esModule", {
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var sysinfoReducer = function sysinfoReducer() {
var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {
var defState = function defState() {
return {
network: {},
time: ''
time: '',
dashboard: {
time: '',
ip: '',
version: '',
di: [],
leone: []
}
};
};
var sysinfoReducer = function sysinfoReducer() {
var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : defState();
var action = arguments[1];
switch (action.type) {

View File

@ -620,4 +620,13 @@ export const del_link = (data) => dispatch => {
}
export const sw_link_active = (data) => dispatch => {
dispatch(link_api('/api/link/swlinkactive', data));
}
export const get_dashboard = () => dispatch => {
return fetch('/api/system/dashboard', getRequest())
.then(response => response.json())
.then(json => {
if(json.status != 1) return dispatch(add_dialog_msg(json.message));
})
}

View File

@ -92,7 +92,7 @@ class UnitItem extends React.Component {
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}`;
d.value = `${data.min}|${data.hour}|${data.day}|${data.month}|${data.week}|${data.year}`;
}
updateData(this.props.unit, d);

View File

@ -0,0 +1,44 @@
import React from 'react';
import {Container, Segment, Divider, Grid, Label} from 'semantic-ui-react';
class DashBoardUnit extends React.Component {
tick = null;
runTick = () => {
}
componentDidMount(){
this.tick = setInterval(this.runTick, 1000)
}
render(){
let {i18n} = this.props;
return (
<Container style={{fontSize: '20px'}}>
<Segment>
<Divider horizontal>{i18n&&i18n.t ? i18n.t('dashboard.sysinfo') : ''}</Divider>
<Grid columns={3}>
<Grid.Column textAlign="center">
<Label basic size="large" content={i18n&&i18n.t?i18n.t('dashboard.systime') : ''} />
<br />
</Grid.Column>
<Grid.Column textAlign="center">
<Label basic size="large" content={i18n&&i18n.t?i18n.t('dashboard.sysip') : ''} />
<br />
</Grid.Column>
<Grid.Column textAlign="center">
<Label basic size="large" content={i18n&&i18n.t?i18n.t('dashboard.sysversion') : ''} />
<br />
</Grid.Column>
</Grid>
<Divider horizontal>{i18n&&i18n.t ? i18n.t('dashboard.devstats') : ''}</Divider>
</Segment>
</Container>
)
}
}
export default DashBoardUnit;

View File

@ -1,7 +1,16 @@
const sysinfoReducer = (state = {
const defState = () => ({
network: {},
time: ''
}, action) => {
time: '',
dashboard: {
time: '',
ip: '',
version: '',
di: [],
leone: []
}
})
const sysinfoReducer = (state = defState(), action) => {
switch(action.type) {
case 'network_info':
return {...state, network: action.network};