noauth
This commit is contained in:
parent
e00a63915a
commit
558797b755
|
@ -22,15 +22,15 @@ export function mapDispatchToProps(dispatch: Dispatch<any>): NoAuthProbeListDisp
|
|||
onReadAllByDomain: (domain: Domain) => {
|
||||
dispatch(asyncRequestActions.request('NoAuthProbeService', 'readAllByDomain', noauthListActions.REQUEST, JSON.stringify(domain)));
|
||||
},
|
||||
acceptNoAuthProbe: (noauthProbes: NoAuthProbe[]) => {
|
||||
acceptNoAuthProbe: (noauthProbe: NoAuthProbe) => {
|
||||
dispatch(
|
||||
asyncRequestActions.request(
|
||||
'NoAuthProbeService', 'acceptNoAuthProbes', acceptActions.REQUEST, JSON.stringify(noauthProbes)));
|
||||
'NoAuthProbeService', 'acceptNoAuthProbe', acceptActions.REQUEST, JSON.stringify(noauthProbe)));
|
||||
},
|
||||
denyNoAuthProbe: (noauthProbes: NoAuthProbe[]) => {
|
||||
denyNoAuthProbe: (noauthProbe: NoAuthProbe) => {
|
||||
dispatch(
|
||||
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 {
|
||||
onReadAllByDomain?(domain: Domain): void;
|
||||
acceptNoAuthProbe?(noauthProbe: NoAuthProbe[]): void;
|
||||
denyNoAuthProbe?(noauthProbe: NoAuthProbe[]): void;
|
||||
acceptNoAuthProbe?(noauthProbe: NoAuthProbe): void;
|
||||
denyNoAuthProbe?(noauthProbe: NoAuthProbe): void;
|
||||
}
|
||||
|
||||
export type Props = StateProps & DispatchProps;
|
||||
|
||||
export interface State {
|
||||
selected: NoAuthProbe[];
|
||||
selected: NoAuthProbe;
|
||||
modalVisible: boolean;
|
||||
actionDisabled: boolean;
|
||||
isDeny: boolean;
|
||||
|
@ -37,17 +37,15 @@ export interface State {
|
|||
export class NoauthProbeList extends React.Component<Props, State> {
|
||||
|
||||
private data: any;
|
||||
private selectedIds: NoAuthProbe[];
|
||||
|
||||
constructor(props: Props, context: State) {
|
||||
super(props, context);
|
||||
this.state = {
|
||||
selected: [],
|
||||
selected: null,
|
||||
modalVisible: false,
|
||||
actionDisabled: true,
|
||||
isDeny: false,
|
||||
};
|
||||
this.selectedIds = new Array();
|
||||
}
|
||||
|
||||
public componentWillMount(): void {
|
||||
|
@ -58,14 +56,14 @@ export class NoauthProbeList extends React.Component<Props, State> {
|
|||
}
|
||||
|
||||
public handleSelect(probe: NoAuthProbe): void {
|
||||
let idx = this.selectedIds.indexOf(probe);
|
||||
if (idx === -1) {
|
||||
this.selectedIds.push(probe);
|
||||
} else {
|
||||
this.selectedIds.splice(idx, 1);
|
||||
}
|
||||
// let idx = this.selectedIds.indexOf(probe);
|
||||
// if (idx === -1) {
|
||||
// this.selectedIds.push(probe);
|
||||
// } else {
|
||||
// this.selectedIds.splice(idx, 1);
|
||||
// }
|
||||
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 checkExist(probe: NoAuthProbe): boolean {
|
||||
if (this.state.selected.indexOf(probe) === -1) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
// public checkExist(probe: NoAuthProbe): boolean {
|
||||
// if (this.state.selected.indexOf(probe) === -1) {
|
||||
// return false;
|
||||
// }
|
||||
// return true;
|
||||
// }
|
||||
|
||||
public handleActionDisable(): boolean {
|
||||
if (this.state.selected === null || this.state.selected === undefined) {
|
||||
return true;
|
||||
}
|
||||
if (this.state.selected.length === 0) {
|
||||
if (this.state.selected === null) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
@ -111,40 +106,19 @@ export class NoauthProbeList extends React.Component<Props, State> {
|
|||
}
|
||||
|
||||
public handleRowActive(probe: NoAuthProbe): boolean {
|
||||
if (this.state.selected.indexOf(probe) === -1) {
|
||||
return false;
|
||||
if (this.state.selected === probe) {
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
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;
|
||||
return false;
|
||||
}
|
||||
|
||||
public render(): JSX.Element {
|
||||
let noauth =
|
||||
<Container fluid>
|
||||
<Table celled selectable striped>
|
||||
<Table celled selectable>
|
||||
<Table.Header>
|
||||
<Table.Row>
|
||||
<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'}>Created At</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' />
|
||||
<Modal.Content>
|
||||
Are you sure?
|
||||
{this.showList()}
|
||||
</Modal.Content>
|
||||
<Modal.Actions>
|
||||
<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) {
|
||||
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>;
|
||||
}
|
||||
|
||||
|
@ -220,17 +193,14 @@ export class NoauthProbeList extends React.Component<Props, State> {
|
|||
|
||||
elem.push(
|
||||
<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'}>ipv4 - {ipv4} <br/> ipv6 - {ipv6}</Table.Cell>
|
||||
<Table.Cell textAlign={'center'}>{map.network.macAddress}</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'}>{probe.apiKey}</Table.Cell>
|
||||
</Table.Row>,
|
||||
</Table.Row >,
|
||||
);
|
||||
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue
Block a user