noauth
This commit is contained in:
parent
e00a63915a
commit
558797b755
|
@ -22,15 +22,15 @@ export function mapDispatchToProps(dispatch: Dispatch<any>): NoAuthProbeListDisp
|
||||||
onReadAllByDomain: (domain: Domain) => {
|
onReadAllByDomain: (domain: Domain) => {
|
||||||
dispatch(asyncRequestActions.request('NoAuthProbeService', 'readAllByDomain', noauthListActions.REQUEST, JSON.stringify(domain)));
|
dispatch(asyncRequestActions.request('NoAuthProbeService', 'readAllByDomain', noauthListActions.REQUEST, JSON.stringify(domain)));
|
||||||
},
|
},
|
||||||
acceptNoAuthProbe: (noauthProbes: NoAuthProbe[]) => {
|
acceptNoAuthProbe: (noauthProbe: NoAuthProbe) => {
|
||||||
dispatch(
|
dispatch(
|
||||||
asyncRequestActions.request(
|
asyncRequestActions.request(
|
||||||
'NoAuthProbeService', 'acceptNoAuthProbes', acceptActions.REQUEST, JSON.stringify(noauthProbes)));
|
'NoAuthProbeService', 'acceptNoAuthProbe', acceptActions.REQUEST, JSON.stringify(noauthProbe)));
|
||||||
},
|
},
|
||||||
denyNoAuthProbe: (noauthProbes: NoAuthProbe[]) => {
|
denyNoAuthProbe: (noauthProbe: NoAuthProbe) => {
|
||||||
dispatch(
|
dispatch(
|
||||||
asyncRequestActions.request(
|
asyncRequestActions.request(
|
||||||
'NoAuthProbeService', 'denyNoauthProbes', denyActions.REQUEST, JSON.stringify(noauthProbes)));
|
'NoAuthProbeService', 'denyNoauthProbe', denyActions.REQUEST, JSON.stringify(noauthProbe)));
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,14 +21,14 @@ export interface StateProps {
|
||||||
|
|
||||||
export interface DispatchProps {
|
export interface DispatchProps {
|
||||||
onReadAllByDomain?(domain: Domain): void;
|
onReadAllByDomain?(domain: Domain): void;
|
||||||
acceptNoAuthProbe?(noauthProbe: NoAuthProbe[]): void;
|
acceptNoAuthProbe?(noauthProbe: NoAuthProbe): void;
|
||||||
denyNoAuthProbe?(noauthProbe: NoAuthProbe[]): void;
|
denyNoAuthProbe?(noauthProbe: NoAuthProbe): void;
|
||||||
}
|
}
|
||||||
|
|
||||||
export type Props = StateProps & DispatchProps;
|
export type Props = StateProps & DispatchProps;
|
||||||
|
|
||||||
export interface State {
|
export interface State {
|
||||||
selected: NoAuthProbe[];
|
selected: NoAuthProbe;
|
||||||
modalVisible: boolean;
|
modalVisible: boolean;
|
||||||
actionDisabled: boolean;
|
actionDisabled: boolean;
|
||||||
isDeny: boolean;
|
isDeny: boolean;
|
||||||
|
@ -37,17 +37,15 @@ export interface State {
|
||||||
export class NoauthProbeList extends React.Component<Props, State> {
|
export class NoauthProbeList extends React.Component<Props, State> {
|
||||||
|
|
||||||
private data: any;
|
private data: any;
|
||||||
private selectedIds: NoAuthProbe[];
|
|
||||||
|
|
||||||
constructor(props: Props, context: State) {
|
constructor(props: Props, context: State) {
|
||||||
super(props, context);
|
super(props, context);
|
||||||
this.state = {
|
this.state = {
|
||||||
selected: [],
|
selected: null,
|
||||||
modalVisible: false,
|
modalVisible: false,
|
||||||
actionDisabled: true,
|
actionDisabled: true,
|
||||||
isDeny: false,
|
isDeny: false,
|
||||||
};
|
};
|
||||||
this.selectedIds = new Array();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public componentWillMount(): void {
|
public componentWillMount(): void {
|
||||||
|
@ -58,14 +56,14 @@ export class NoauthProbeList extends React.Component<Props, State> {
|
||||||
}
|
}
|
||||||
|
|
||||||
public handleSelect(probe: NoAuthProbe): void {
|
public handleSelect(probe: NoAuthProbe): void {
|
||||||
let idx = this.selectedIds.indexOf(probe);
|
// let idx = this.selectedIds.indexOf(probe);
|
||||||
if (idx === -1) {
|
// if (idx === -1) {
|
||||||
this.selectedIds.push(probe);
|
// this.selectedIds.push(probe);
|
||||||
} else {
|
// } else {
|
||||||
this.selectedIds.splice(idx, 1);
|
// this.selectedIds.splice(idx, 1);
|
||||||
}
|
// }
|
||||||
this.setState({
|
this.setState({
|
||||||
selected: this.selectedIds,
|
selected: probe,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -73,18 +71,15 @@ export class NoauthProbeList extends React.Component<Props, State> {
|
||||||
public handleSearch = (result: any[]): void => {
|
public handleSearch = (result: any[]): void => {
|
||||||
}
|
}
|
||||||
|
|
||||||
public checkExist(probe: NoAuthProbe): boolean {
|
// public checkExist(probe: NoAuthProbe): boolean {
|
||||||
if (this.state.selected.indexOf(probe) === -1) {
|
// if (this.state.selected.indexOf(probe) === -1) {
|
||||||
return false;
|
// return false;
|
||||||
}
|
// }
|
||||||
return true;
|
// return true;
|
||||||
}
|
// }
|
||||||
|
|
||||||
public handleActionDisable(): boolean {
|
public handleActionDisable(): boolean {
|
||||||
if (this.state.selected === null || this.state.selected === undefined) {
|
if (this.state.selected === null) {
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (this.state.selected.length === 0) {
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -111,40 +106,19 @@ export class NoauthProbeList extends React.Component<Props, State> {
|
||||||
}
|
}
|
||||||
|
|
||||||
public handleRowActive(probe: NoAuthProbe): boolean {
|
public handleRowActive(probe: NoAuthProbe): boolean {
|
||||||
if (this.state.selected.indexOf(probe) === -1) {
|
if (this.state.selected === probe) {
|
||||||
return false;
|
return true;
|
||||||
}
|
}
|
||||||
return true;
|
return false;
|
||||||
}
|
|
||||||
public showList(): JSX.Element[] {
|
|
||||||
|
|
||||||
let elem: Array<JSX.Element> = new Array();
|
|
||||||
|
|
||||||
this.state.selected.map((probe: NoAuthProbe, index: number) => {
|
|
||||||
|
|
||||||
let map: any = JSON.parse(probe.description);
|
|
||||||
|
|
||||||
elem.push(
|
|
||||||
<div key={index}>
|
|
||||||
{map.network.address}
|
|
||||||
</div>,
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
return elem;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public render(): JSX.Element {
|
public render(): JSX.Element {
|
||||||
let noauth =
|
let noauth =
|
||||||
<Container fluid>
|
<Container fluid>
|
||||||
<Table celled selectable striped>
|
<Table celled selectable>
|
||||||
<Table.Header>
|
<Table.Header>
|
||||||
<Table.Row>
|
<Table.Row>
|
||||||
<Table.HeaderCell />
|
|
||||||
<Table.HeaderCell textAlign={'center'}>No.</Table.HeaderCell>
|
<Table.HeaderCell textAlign={'center'}>No.</Table.HeaderCell>
|
||||||
{/*<Table.HeaderCell textAlign={'center'}>Host IP</Table.HeaderCell>
|
|
||||||
<Table.HeaderCell textAlign={'center'}>Host Mac</Table.HeaderCell>
|
|
||||||
<Table.HeaderCell textAlign={'center'}>Host Name</Table.HeaderCell>*/}
|
|
||||||
<Table.HeaderCell textAlign={'center'}>Description</Table.HeaderCell>
|
<Table.HeaderCell textAlign={'center'}>Description</Table.HeaderCell>
|
||||||
<Table.HeaderCell textAlign={'center'}>Created At</Table.HeaderCell>
|
<Table.HeaderCell textAlign={'center'}>Created At</Table.HeaderCell>
|
||||||
<Table.HeaderCell textAlign={'center'}>API Key</Table.HeaderCell>
|
<Table.HeaderCell textAlign={'center'}>API Key</Table.HeaderCell>
|
||||||
|
@ -171,7 +145,6 @@ export class NoauthProbeList extends React.Component<Props, State> {
|
||||||
<Header icon='certificate' content='Confirm' />
|
<Header icon='certificate' content='Confirm' />
|
||||||
<Modal.Content>
|
<Modal.Content>
|
||||||
Are you sure?
|
Are you sure?
|
||||||
{this.showList()}
|
|
||||||
</Modal.Content>
|
</Modal.Content>
|
||||||
<Modal.Actions>
|
<Modal.Actions>
|
||||||
<Button color='red' onClick={() => this.setState({ modalVisible: false })}>
|
<Button color='red' onClick={() => this.setState({ modalVisible: false })}>
|
||||||
|
@ -200,7 +173,7 @@ export class NoauthProbeList extends React.Component<Props, State> {
|
||||||
|
|
||||||
if (this.props.noauthList.length === 0) {
|
if (this.props.noauthList.length === 0) {
|
||||||
return <Table.Row error >
|
return <Table.Row error >
|
||||||
<Table.Cell textAlign='center' colSpan='6'>No results found.</Table.Cell>
|
<Table.Cell textAlign='center' colSpan='4'>No results found.</Table.Cell>
|
||||||
</Table.Row>;
|
</Table.Row>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -220,17 +193,14 @@ export class NoauthProbeList extends React.Component<Props, State> {
|
||||||
|
|
||||||
elem.push(
|
elem.push(
|
||||||
<Table.Row key={index} onClick={this.handleSelect.bind(this, probe)} active={this.handleRowActive(probe)}>
|
<Table.Row key={index} onClick={this.handleSelect.bind(this, probe)} active={this.handleRowActive(probe)}>
|
||||||
<Table.Cell collapsing>
|
|
||||||
<Checkbox checked={this.checkExist(probe)} />
|
|
||||||
</Table.Cell>
|
|
||||||
<Table.Cell textAlign={'center'}>{index + 1}</Table.Cell>
|
<Table.Cell textAlign={'center'}>{index + 1}</Table.Cell>
|
||||||
{/*<Table.Cell textAlign={'center'}>ipv4 - {ipv4} <br/> ipv6 - {ipv6}</Table.Cell>
|
{/*<Table.Cell textAlign={'center'}>ipv4 - {ipv4} <br/> ipv6 - {ipv6}</Table.Cell>
|
||||||
<Table.Cell textAlign={'center'}>{map.network.macAddress}</Table.Cell>
|
<Table.Cell textAlign={'center'}>{map.network.macAddress}</Table.Cell>
|
||||||
<Table.Cell>{map.host.name}</Table.Cell>*/}
|
<Table.Cell>{map.host.name}</Table.Cell>*/}
|
||||||
<Table.Cell fontSize='2'><JSONPretty json={ JSON.stringify(map) } /></Table.Cell>
|
< Table.Cell fontSize='2' > <JSONPretty json={JSON.stringify(map)} /></Table.Cell >
|
||||||
<Table.Cell textAlign={'center'}>{Utils.date2date(probe.createDate)}</Table.Cell>
|
<Table.Cell textAlign={'center'}>{Utils.date2date(probe.createDate)}</Table.Cell>
|
||||||
<Table.Cell textAlign={'center'}>{probe.apiKey}</Table.Cell>
|
<Table.Cell textAlign={'center'}>{probe.apiKey}</Table.Cell>
|
||||||
</Table.Row>,
|
</Table.Row >,
|
||||||
);
|
);
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue
Block a user