diff --git a/src/ts/@overflow/noauthprobe/react/NoauthProbeList.tsx b/src/ts/@overflow/noauthprobe/react/NoauthProbeList.tsx new file mode 100644 index 0000000..2c9b76e --- /dev/null +++ b/src/ts/@overflow/noauthprobe/react/NoauthProbeList.tsx @@ -0,0 +1,26 @@ +import { connect, Dispatch } from 'react-redux'; +import { + NoauthProbeList, + StateProps as ProbeListStateProps, + DispatchProps as ProbeListDispatchProps, +} from './components/NoauthProbeList'; +import Domain from '@overflow/domain/api/model/Domain'; + +import * as probeListActions from '../redux/action/read_all_by_domain'; + + +export function mapStateToProps(state: any): ProbeListStateProps { + return { + + }; +} + +export function mapDispatchToProps(dispatch: Dispatch): ProbeListDispatchProps { + return { + onReadAllByDomain: (domain: Domain) => { + dispatch(probeListActions.request(domain)); + }, + }; +} + +export default connect(mapStateToProps, mapDispatchToProps)(NoauthProbeList); diff --git a/src/ts/@overflow/noauthprobe/react/Read.tsx b/src/ts/@overflow/noauthprobe/react/Read.tsx deleted file mode 100644 index e69de29..0000000 diff --git a/src/ts/@overflow/noauthprobe/react/components/NoauthProbeList.tsx b/src/ts/@overflow/noauthprobe/react/components/NoauthProbeList.tsx new file mode 100644 index 0000000..ac41032 --- /dev/null +++ b/src/ts/@overflow/noauthprobe/react/components/NoauthProbeList.tsx @@ -0,0 +1,153 @@ +import * as React from 'react'; +import { Table, + Checkbox, + Button, + Header, + Container, +} from 'semantic-ui-react'; +import NoAuthProbe from '@overflow/noauthprobe/api/model/NoAuthProbe'; +import Domain from '@overflow/domain/api/model/Domain'; + +export interface StateProps { +} + +export interface DispatchProps { + onReadAllByDomain(domain: Domain): void; +} + +export type Props = StateProps & DispatchProps; + +export interface State { + selected: NoAuthProbe[]; +} + +export class NoauthProbeList extends React.Component { + + private data: any; + private selectedIds: Array; + + constructor(props: Props, context: State) { + super(props, context); + this.state = { + selected: [], + }; + this.selectedIds = new Array(); + } + + public componentWillMount(): void { + this.data = [ + { + 'id': '11', + 'MetaNoAuthProbeStatus': { + 'name': 'NORMAL', + }, + 'hostName': 'insanity windows', + 'macAddress': '14:fe:b5:9d:54:7e', + 'ipAddress': '192.168.1.105', + 'tempProbeKey': '45374d4egsdfw332', + 'apiKey': '45374d4egsdfw332', + 'domain': { + + }, + 'probe': { + + }, + }, + { + 'id': '22', + 'MetaNoAuthProbeStatus': { + 'name': 'NORMAL', + }, + 'hostName': 'insanity ubuntu', + 'macAddress': '14:fe:b5:9d:54:7e', + 'ipAddress': '192.168.1.105', + 'tempProbeKey': '45374d4egsdfw332', + 'apiKey': '45374d4egsdfw332', + 'domain': { + + }, + 'probe': { + + }, + }, + ]; + } + + public handleSelect(id: string): void { + let idx = this.selectedIds.indexOf(id); + if (idx === -1) { + this.selectedIds.push(id); + } else { + this.selectedIds.splice(idx, 1); + } + this.setState({ + selected: this.selectedIds, + }); + } + + public checkExist(id: string): boolean { + if (this.state.selected.indexOf(id) === -1) { + return false; + } + return true; + } + + public handleAccept(): void { + alert(this.state.selected); + } + + public handleDeny(): void { + alert(this.state.selected); + } + + public handleRowActive(id: string):boolean { + if (this.state.selected.indexOf(id) === -1) { + return false; + } + return true; + } + + public render(): JSX.Element { + + return ( + +
Noauth Probes
+ + + + + No. + Host IP + Host Mac + Host Name + Created At + API Key + + + + + {this.data.map((probe: any, index: number) => ( + + + + + {index + 1} + {probe.ipAddress} + {probe.macAddress} + {probe.hostName} + + {probe.apiKey} + + ))} + +
+ + + +
+ ); + } +} + + + diff --git a/src/ts/@overflow/noauthprobe/react/components/Read.tsx b/src/ts/@overflow/noauthprobe/react/components/Read.tsx deleted file mode 100644 index e69de29..0000000