Merge branch 'master' of https://git.loafle.net/overflow/overflow_app
This commit is contained in:
commit
6d7652d6f5
|
@ -48,6 +48,7 @@ module.exports = WebpackMerge(configBase, {
|
|||
Path.resolve(__dirname, '../../node_modules/')
|
||||
]
|
||||
},
|
||||
{ test: /\.jpg$/, loader: 'file' },
|
||||
// {
|
||||
// test: /\.tsx?$/,
|
||||
// loaders: [
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
"test": "yarn run jest",
|
||||
"test:watch": "yarn run jest -- --watch",
|
||||
"jest": "PWD=$(pwd) NODE_ENV=test ./node_modules/.bin/jest -w 1 --coverage",
|
||||
"prebuild": "./node_modules/.bin/check-dependencies && yarn run clean",
|
||||
"build": "set NODE_ENV=production && ./node_modules/.bin/webpack-dashboard -m -- ./node_modules/.bin/webpack --progress --profile --colors --config ./config/webpack/webpack.config.prod.js",
|
||||
"lint": "./node_modules/.bin/tslint -c tslint.json 'src/ts/**/*.{ts,tsx}' && ./node_modules/.bin/sass-lint 'src/**/*.scss'",
|
||||
"stats": "set NODE_ENV=production && webpack --progress --config ./config/webpack/webpack.config.stats.js --profile --json > ./config/webpack/stats/stats.json"
|
||||
|
@ -87,7 +86,8 @@
|
|||
"redux-saga": "^0.15.4",
|
||||
"reflect-metadata": "^0.1.10",
|
||||
"reselect": "^3.0.1",
|
||||
"semantic-ui-react": "^0.71.1"
|
||||
"semantic-ui-react": "^0.71.1",
|
||||
"image-webpack-loader": "^3.3.1"
|
||||
},
|
||||
"jest": {
|
||||
"moduleFileExtensions": [
|
||||
|
|
|
@ -4,9 +4,11 @@ import {
|
|||
Header,
|
||||
Container,
|
||||
Popup,
|
||||
Image,
|
||||
} from 'semantic-ui-react';
|
||||
import { Notification } from '@overflow/commons/react/component/Notification';
|
||||
|
||||
|
||||
export class LogoBar extends React.Component<any, any> {
|
||||
|
||||
constructor(props: any, context: any) {
|
||||
|
|
|
@ -35,7 +35,6 @@ export class AppLayout extends React.Component<Props, State> {
|
|||
<LeftMenu />
|
||||
<Segment vertical style={{ margin: '0 0 0 210px', padding: '0' }}>
|
||||
<Header />
|
||||
<div>ddddddddddddd</div>
|
||||
<Route exact path={`${this.props.match.url}/tablesort`} component={TableSortView} />
|
||||
<Footer />
|
||||
</Segment>
|
||||
|
|
|
@ -1,19 +0,0 @@
|
|||
import * as React from 'react';
|
||||
import { RouteComponentProps } from 'react-router';
|
||||
import SensorDetailContainer from '@overflow/sensor/react/SensorDetail';
|
||||
|
||||
class SensorDetail extends React.Component<RouteComponentProps<object>, object> {
|
||||
|
||||
public constructor(props?: RouteComponentProps<object>, context?: object) {
|
||||
super(props, context);
|
||||
}
|
||||
|
||||
public render(): JSX.Element {
|
||||
return (
|
||||
<SensorDetailContainer />
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
export default SensorDetail;
|
|
@ -142,14 +142,14 @@ export class SensorItemTree extends React.Component<SensorItemTreeProps, SensorI
|
|||
SensorJsonData.map((data: any, idx: number) => {
|
||||
let sensorItem: MetaSensorItem = data;
|
||||
|
||||
if (this.itemMap.has(sensorItem.metaSensorItemType.id)) {
|
||||
this.itemMap.get(sensorItem.metaSensorItemType.id).metaSensorItemList.push(sensorItem);
|
||||
if (this.itemMap.has(sensorItem.itemType.id)) {
|
||||
this.itemMap.get(sensorItem.itemType.id).metaSensorItemList.push(sensorItem);
|
||||
} else {
|
||||
let item: TreeItem = { metaSensorItemList: null, metaSensorItemType: null };
|
||||
item.metaSensorItemList = [];
|
||||
item.metaSensorItemList.push(sensorItem);
|
||||
item.metaSensorItemType = this.GetMetaSensorItemType(sensorItem.metaSensorItemType.id);
|
||||
this.itemMap.set(sensorItem.metaSensorItemType.id, item);
|
||||
item.metaSensorItemType = this.GetMetaSensorItemType(sensorItem.itemType.id);
|
||||
this.itemMap.set(sensorItem.itemType.id, item);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -103,7 +103,7 @@ export class ProbeHost extends React.Component<Props, State> {
|
|||
<Table.Cell collapsing>
|
||||
<Header size='small'>OS vendor type</Header>
|
||||
</Table.Cell>
|
||||
<Table.Cell>{this.state.host.os.vendor.type.name}</Table.Cell>
|
||||
<Table.Cell>{this.state.host.os.vendor.infraType.name}</Table.Cell>
|
||||
</Table.Row>
|
||||
</Table.Body>
|
||||
</Table>
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
import Service from '@overflow/commons/api/Service';
|
||||
import Sensor from '../model/Sensor';
|
||||
import Target from '@overflow/target/api/model/Target';
|
||||
import Probe from '@overflow/probe/api/model/Probe';
|
||||
import Domain from '@overflow/domain/api/model/Domain';
|
||||
|
||||
export class SensorService extends Service {
|
||||
|
||||
|
@ -10,11 +12,19 @@ export class SensorService extends Service {
|
|||
}
|
||||
|
||||
public regist(sensor:Sensor): Promise<Sensor> {
|
||||
return null;
|
||||
return this.send<Sensor>('regist', [sensor]);
|
||||
}
|
||||
|
||||
public readAllByTarget(target:Target): Promise<Sensor[]> {
|
||||
return null;
|
||||
return this.send<Sensor[]>('readAllByTarget', [target]);
|
||||
}
|
||||
|
||||
public readAllByProbe(probe: Probe): Promise<Sensor[]> {
|
||||
return this.send<Sensor[]>('readAllByProbe', [probe]);
|
||||
}
|
||||
|
||||
public readAllByDomain(domain: Domain): Promise<Sensor[]> {
|
||||
return this.send<Sensor[]>('readAllByDomain', [domain]);
|
||||
}
|
||||
|
||||
public read(id:number): Promise<Sensor> {
|
||||
|
|
|
@ -1,28 +0,0 @@
|
|||
import { connect, Dispatch } from 'react-redux';
|
||||
import {
|
||||
SensorDetail,
|
||||
SensorDetailStateProps,
|
||||
SensorDetailDispatchProps,
|
||||
} from './components/SensorDetail';
|
||||
import State from '../redux/state/Read';
|
||||
|
||||
import * as ReadActions from '../redux/action/read';
|
||||
import Target from '@overflow/target/api/model/Target';
|
||||
import Sensor from '@overflow/sensor/api/model/Sensor';
|
||||
|
||||
export function mapStateToProps(state: any): SensorDetailStateProps {
|
||||
return {
|
||||
sensor:state.sensor,
|
||||
};
|
||||
}
|
||||
|
||||
export function mapDispatchToProps(dispatch: Dispatch<any>): SensorDetailDispatchProps {
|
||||
return {
|
||||
onRead: (id: number) => {
|
||||
dispatch(ReadActions.request(id));
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
export default connect(mapStateToProps, mapDispatchToProps)(SensorDetail);
|
|
@ -1,194 +0,0 @@
|
|||
import * as React from 'react';
|
||||
import { Button, Table, Label, Segment, Header, Container } from 'semantic-ui-react';
|
||||
import { DetailContainer } from '@overflow/commons/react/component/DetailContainer';
|
||||
import { SensorDetailItems } from './SensorDetailItems';
|
||||
import Sensor from '@overflow/sensor/api/model/Sensor';
|
||||
import Probe from '@overflow/probe/api/model/Probe';
|
||||
|
||||
export interface SensorDetailStateProps {
|
||||
sensor?: Sensor;
|
||||
probe?: Probe;
|
||||
}
|
||||
|
||||
export interface SensorDetailDispatchProps {
|
||||
onRead?(id: number): void;
|
||||
}
|
||||
|
||||
|
||||
export type SensorDetailProps = SensorDetailStateProps & SensorDetailDispatchProps;
|
||||
|
||||
export interface SensorDetailsState {
|
||||
|
||||
}
|
||||
|
||||
|
||||
export class SensorDetail extends React.Component<SensorDetailProps, SensorDetailsState> {
|
||||
|
||||
constructor(props: SensorDetailProps, context: SensorDetailsState) {
|
||||
super(props, context);
|
||||
this.state = {
|
||||
};
|
||||
}
|
||||
|
||||
public componentWillMount(): void {
|
||||
console.log('');
|
||||
}
|
||||
|
||||
public render(): JSX.Element {
|
||||
const items = [
|
||||
{ name: 'Info', child: <SensorBasicInfo sensor={this.props.sensor} /> },
|
||||
{ name: 'Sensor Items', child: <SensorDetailItems sensor={this.props.sensor} /> },
|
||||
];
|
||||
const data = { 'probe': this.props.probe };
|
||||
return (
|
||||
<DetailContainer panes={items} data={data} />
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
export interface SensorBasicInfoProps {
|
||||
sensor?: Sensor;
|
||||
probe?: Probe;
|
||||
onBack?(): void;
|
||||
}
|
||||
|
||||
export interface SensorBasicInfoState {
|
||||
sensor: Sensor;
|
||||
}
|
||||
|
||||
export class SensorBasicInfo extends React.Component<SensorBasicInfoProps, SensorBasicInfoState> {
|
||||
|
||||
constructor(props: SensorBasicInfoProps, context: SensorBasicInfoState) {
|
||||
super(props, context);
|
||||
this.state = {
|
||||
sensor: SensorDetailJson,
|
||||
};
|
||||
}
|
||||
|
||||
public handleStartStop(event: any, data: any): void {
|
||||
console.log(event);
|
||||
}
|
||||
public handleDiscovery(event: any, data: any): void {
|
||||
alert('Discovery');
|
||||
}
|
||||
|
||||
public handleBack(event: any, data: any): void {
|
||||
this.props.onBack();
|
||||
}
|
||||
|
||||
public componentWillMount(): void {
|
||||
console.log('');
|
||||
}
|
||||
|
||||
|
||||
public showStartStopBtn(): JSX.Element {
|
||||
if (this.state.sensor.status.name === 'STARTED') {
|
||||
return <Button content='Stop' icon='stop' labelPosition='left' color={'blue'} floated={'right'} onClick={this.handleStartStop} />;
|
||||
} else {
|
||||
return <Button content='Start' icon='play' labelPosition='left' color={'blue'} floated={'right'} onClick={this.handleStartStop} />;
|
||||
}
|
||||
}
|
||||
|
||||
public render(): JSX.Element {
|
||||
return (
|
||||
<Container fluid>
|
||||
<Table celled>
|
||||
<Table.Body>
|
||||
<Table.Row>
|
||||
<Table.Cell>
|
||||
<Header size='small'>Name</Header>
|
||||
</Table.Cell>
|
||||
<Table.Cell>{this.state.sensor.target.infra.type.name}</Table.Cell>
|
||||
</Table.Row>
|
||||
<Table.Row>
|
||||
<Table.Cell>
|
||||
<Header size='small'>Status</Header>
|
||||
</Table.Cell>
|
||||
<Table.Cell>{this.state.sensor.status.name}</Table.Cell>
|
||||
</Table.Row>
|
||||
<Table.Row>
|
||||
<Table.Cell>
|
||||
<Header size='small'>Crawler</Header>
|
||||
</Table.Cell>
|
||||
<Table.Cell>{this.state.sensor.crawler.name}</Table.Cell>
|
||||
</Table.Row>
|
||||
<Table.Row>
|
||||
<Table.Cell>
|
||||
<Header size='small'>Item Count</Header>
|
||||
</Table.Cell>
|
||||
<Table.Cell>{44}</Table.Cell>
|
||||
</Table.Row>
|
||||
<Table.Row>
|
||||
<Table.Cell>
|
||||
<Header size='small'>Created at</Header>
|
||||
</Table.Cell>
|
||||
<Table.Cell>{this.state.sensor.createDate}</Table.Cell>
|
||||
</Table.Row>
|
||||
<Table.Row>
|
||||
<Table.Cell>
|
||||
<Header size='small'>Created by</Header>
|
||||
</Table.Cell>
|
||||
<Table.Cell>test Snoop</Table.Cell>
|
||||
</Table.Row>
|
||||
</Table.Body>
|
||||
</Table>
|
||||
|
||||
<Button content='Back' icon='left arrow' labelPosition='left' onClick={this.handleBack.bind(this)} />
|
||||
<Button content='Discovery' icon='search' labelPosition='left' floated={'right'} positive onClick={this.handleDiscovery} />
|
||||
{/*{this.showStartStopBtn()}*/}
|
||||
|
||||
</Container>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const SensorDetailJson: any = {
|
||||
'id': 1,
|
||||
'createDate': 1498475947009,
|
||||
'description': 'My sensor',
|
||||
'status': {
|
||||
'id': 1,
|
||||
'name': 'RUNNING',
|
||||
},
|
||||
'target': {
|
||||
'id': 1,
|
||||
'createDate': 1498448242854,
|
||||
'probe': {
|
||||
'id': 1,
|
||||
'status': {
|
||||
'id': 1,
|
||||
'name': 'INITIAL',
|
||||
},
|
||||
'description': 'snoop probe',
|
||||
'createDate': 1498448699813,
|
||||
'lastPollingDate': null,
|
||||
'nextPollingDate': null,
|
||||
'domain': {
|
||||
'id': 1,
|
||||
'name': 'overFlow\'s domain',
|
||||
'createDate': 1498443944866,
|
||||
},
|
||||
'probeKey': 'a1e1710557de11e78799080027658d13',
|
||||
'encryptionKey': '9c8d41ab57de11e7a2c9080027658d13',
|
||||
},
|
||||
'infra': {
|
||||
'id': 1,
|
||||
'type': {
|
||||
'id': 1,
|
||||
'name': 'MACHINE',
|
||||
'createDate': 1498379502770,
|
||||
},
|
||||
'childId': 0,
|
||||
'createDate': 1498446731809,
|
||||
},
|
||||
},
|
||||
'crawler': {
|
||||
'id': 1,
|
||||
'createDate': 1498794968791,
|
||||
'name': 'ACTIVEDIRECTORY_CRAWLER',
|
||||
'description': 'ACTIVEDIRECTORY',
|
||||
},
|
||||
'crawlerInputItems': null,
|
||||
};
|
|
@ -62,7 +62,7 @@ export class SensorDetailInfo extends React.Component<SensorDetailInfoProps, Sen
|
|||
<Table.Cell>
|
||||
<Header size='small'>Name</Header>
|
||||
</Table.Cell>
|
||||
<Table.Cell>{this.state.sensor.target.infra.type.name}</Table.Cell>
|
||||
<Table.Cell>{this.state.sensor.target.displayName}</Table.Cell>
|
||||
</Table.Row>
|
||||
<Table.Row>
|
||||
<Table.Cell>
|
||||
|
|
|
@ -52,7 +52,7 @@ export class SensorDetailItems extends React.Component<Props, State> {
|
|||
return (
|
||||
<Table.Row key={idx}>
|
||||
<Table.Cell>{idx}</Table.Cell>
|
||||
<Table.Cell>{sensorItem.item.metaSensorItemType.name}</Table.Cell>
|
||||
<Table.Cell>{sensorItem.item.itemType.name}</Table.Cell>
|
||||
<Table.Cell>{sensorItem.item.name}</Table.Cell>
|
||||
<Table.Cell>{sensorItem.item.key}</Table.Cell>
|
||||
</Table.Row>
|
||||
|
|
25
src/ts/@overflow/sensor/redux/reducer/read_all_by_target.ts
Normal file
25
src/ts/@overflow/sensor/redux/reducer/read_all_by_target.ts
Normal file
|
@ -0,0 +1,25 @@
|
|||
/**
|
||||
* Created by geek on 17. 7. 3.
|
||||
*/
|
||||
|
||||
import Action from '@overflow/commons/redux/Action';
|
||||
import { ReducersMapObject } from 'redux';
|
||||
import Target from '@overflow/target/api/model/Target';
|
||||
|
||||
import * as ReadAllByDomainActionTypes from '../action/read_all_by_domain';
|
||||
import ReadAllByTargetState, { defaultState as readAllByTargetDefaultState } from '../state/ReadAllByTarget';
|
||||
|
||||
const reducer: ReducersMapObject = {
|
||||
[ReadAllByDomainActionTypes.REQUEST_SUCCESS]:
|
||||
(state: ReadAllByTargetState = readAllByTargetDefaultState, action: Action<Target>):
|
||||
ReadAllByTargetState => {
|
||||
return state;
|
||||
},
|
||||
[ReadAllByDomainActionTypes.REQUEST_FAILURE]:
|
||||
(state: ReadAllByTargetState = readAllByTargetDefaultState, action: Action<Error>):
|
||||
ReadAllByTargetState => {
|
||||
return state;
|
||||
},
|
||||
};
|
||||
|
||||
export default reducer;
|
|
@ -1,3 +0,0 @@
|
|||
/**
|
||||
* Created by geek on 17. 7. 3.
|
||||
*/
|
38
src/ts/@overflow/sensor/redux/saga/read_all_by_domain.ts
Normal file
38
src/ts/@overflow/sensor/redux/saga/read_all_by_domain.ts
Normal file
|
@ -0,0 +1,38 @@
|
|||
import { SagaIterator } from 'redux-saga';
|
||||
import { call, Effect, fork, put, takeLatest } from 'redux-saga/effects';
|
||||
|
||||
import AppContext from '@overflow/commons/context/AppContext';
|
||||
import Action from '@overflow/commons/redux/Action';
|
||||
|
||||
import Sensor from '../../api/model/Sensor';
|
||||
import SensorService from '../../api/service/SensorService';
|
||||
import * as ReadAllByDomainActions from '../action/read_all_by_domain';
|
||||
import ReadAllByDomainPayload from '../payload/ReadAllByDomainPayload';
|
||||
|
||||
function* readAllByDomain(action: Action<ReadAllByDomainPayload>): SagaIterator {
|
||||
try {
|
||||
const {domain} = action.payload;
|
||||
// yield put({
|
||||
// type: types.SENDING_REQUEST,
|
||||
// payload: {sendingRequest: true},
|
||||
// });
|
||||
let sensorService = AppContext.getInstance().getPouch(SensorService);
|
||||
const ret = yield call({context: sensorService, fn: sensorService.readAllByDomain}, domain);
|
||||
|
||||
// if (responseBody.token === undefined) {
|
||||
// throw new Error(MESSAGES.UNABLE_TO_FIND_TOKEN_IN_LOGIN_RESPONSE);
|
||||
// }
|
||||
yield put(ReadAllByDomainActions.requestSuccess(ret));
|
||||
} catch (e) {
|
||||
yield put(ReadAllByDomainActions.requestFailure(e));
|
||||
} finally {
|
||||
// yield put({
|
||||
// type: types.SENDING_REQUEST,
|
||||
// payload: {sendingRequest: false},
|
||||
// });
|
||||
}
|
||||
}
|
||||
|
||||
export function* watchReadAllByTarget(): SagaIterator {
|
||||
yield takeLatest(ReadAllByDomainActions.REQUEST, readAllByDomain);
|
||||
}
|
|
@ -8,7 +8,7 @@ export interface StateProps {
|
|||
}
|
||||
|
||||
export interface DispatchProps {
|
||||
columnClick?(col:any):void;
|
||||
onBodyRowClick?(row:any):void;
|
||||
}
|
||||
|
||||
export type Props = StateProps & DispatchProps;
|
||||
|
@ -63,7 +63,7 @@ const tableData = [
|
|||
];
|
||||
|
||||
export class TableSort extends React.Component<Props, State> {
|
||||
constructor(props: any, context: any) {
|
||||
constructor(props: Props, context: State) {
|
||||
super(props, context);
|
||||
|
||||
this.state = {
|
||||
|
@ -91,8 +91,11 @@ export class TableSort extends React.Component<Props, State> {
|
|||
let column:Map<string, string> = new Map();
|
||||
for (let obj in tem) {
|
||||
if (tem.hasOwnProperty(obj)) {
|
||||
Object.keys(tem[obj]).map((key:string, index:number ) => {
|
||||
Object.keys(tem[obj]).map((key:string ) => {
|
||||
if (tem[obj].hasOwnProperty(key)) {
|
||||
if (column.get(key) != null ) {
|
||||
return column;
|
||||
}
|
||||
column.set(key, key);
|
||||
}
|
||||
});
|
||||
|
@ -117,7 +120,7 @@ export class TableSort extends React.Component<Props, State> {
|
|||
private renderHeaderCells = ():JSX.Element[] => {
|
||||
const { column, data, direction } = this.state;
|
||||
let te = this.getHeaderValue();
|
||||
let arr = new Array();
|
||||
let arr = [];
|
||||
te.forEach((value:string, key:string ) => {
|
||||
|
||||
arr.push(
|
||||
|
@ -130,7 +133,7 @@ export class TableSort extends React.Component<Props, State> {
|
|||
}
|
||||
|
||||
private generationBodyRow(): JSX.Element[] {
|
||||
let arr = new Array<JSX.Element>();
|
||||
let arr = [];
|
||||
let idx:number = 0;
|
||||
for(let temp of this.state.data) {
|
||||
arr.push( <Table.Row key={idx++}> { this.renderBodyCells(temp) } </Table.Row> );
|
||||
|
@ -140,7 +143,7 @@ export class TableSort extends React.Component<Props, State> {
|
|||
|
||||
private renderBodyCells = (temp:any): JSX.Element[] => {
|
||||
let te = this.getHeaderValue();
|
||||
let arr = new Array();
|
||||
let arr = [];
|
||||
|
||||
te.forEach((value:string, key:string ) => {
|
||||
|
||||
|
@ -148,6 +151,8 @@ export class TableSort extends React.Component<Props, State> {
|
|||
});
|
||||
return arr;
|
||||
}
|
||||
|
||||
|
||||
private handleSort = (clickedColumn:string) => ():void => {
|
||||
const {column, data, direction} = this.state;
|
||||
|
||||
|
|
|
@ -16,8 +16,8 @@ export function mapStateToProps(state: any): StateProps {
|
|||
|
||||
export function mapDispatchToProps(dispatch: Dispatch<any>): DispatchProps {
|
||||
return {
|
||||
columnClick: (col: any) => {
|
||||
console.log(col);
|
||||
onBodyRowClick: (row: any) => {
|
||||
console.log(row);
|
||||
},
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user