fixed auth_crawler by select_type
This commit is contained in:
parent
2b21d74d63
commit
4d1eb970ce
|
@ -47,9 +47,9 @@ export class CrawlerAuthInputs extends React.Component<CrawlerAuthInputsProps, C
|
||||||
}
|
}
|
||||||
|
|
||||||
public componentWillReceiveProps?(nextProps: Readonly<CrawlerAuthInputsProps>, nextContext: any): void {
|
public componentWillReceiveProps?(nextProps: Readonly<CrawlerAuthInputsProps>, nextContext: any): void {
|
||||||
if(nextProps.metaCrawlerInputItemList !== this.props.metaCrawlerInputItemList) {
|
if (nextProps.metaCrawlerInputItemList !== this.props.metaCrawlerInputItemList) {
|
||||||
this.setState({authJson: {}});
|
this.setState({ authJson: {} });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -96,8 +96,8 @@ export class CrawlerAuthInputs extends React.Component<CrawlerAuthInputsProps, C
|
||||||
this.props.onVerifyCrawler(sd.infra.id, sd.crawler, sd.crawlerAuth);
|
this.props.onVerifyCrawler(sd.infra.id, sd.crawler, sd.crawlerAuth);
|
||||||
|
|
||||||
let authCrawler: AuthCrawler = {
|
let authCrawler: AuthCrawler = {
|
||||||
crawler: {id:sd.crawler.id},
|
crawler: { id: sd.crawler.id },
|
||||||
target: {id:sd.infra.target.id},
|
target: { id: sd.infra.target.id },
|
||||||
authJson: JSON.stringify(sd.crawlerAuth),
|
authJson: JSON.stringify(sd.crawlerAuth),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -108,6 +108,8 @@ export class CrawlerAuthInputs extends React.Component<CrawlerAuthInputsProps, C
|
||||||
let newJson: any = _.clone(this.state.authJson);
|
let newJson: any = _.clone(this.state.authJson);
|
||||||
newJson[key] = data;
|
newJson[key] = data;
|
||||||
this.setState({ authJson: newJson });
|
this.setState({ authJson: newJson });
|
||||||
|
|
||||||
|
console.log(newJson);
|
||||||
}
|
}
|
||||||
|
|
||||||
public renderRow(item: MetaCrawlerInputItem, index: number): JSX.Element {
|
public renderRow(item: MetaCrawlerInputItem, index: number): JSX.Element {
|
||||||
|
@ -122,22 +124,31 @@ export class CrawlerAuthInputs extends React.Component<CrawlerAuthInputsProps, C
|
||||||
(event: React.SyntheticEvent<HTMLInputElement>, data: InputOnChangeData) => {
|
(event: React.SyntheticEvent<HTMLInputElement>, data: InputOnChangeData) => {
|
||||||
this.onChangeAuth(item.name, data.value);
|
this.onChangeAuth(item.name, data.value);
|
||||||
}} />);
|
}} />);
|
||||||
} else if (item.inputType.name === 'Radio') {
|
} else if (item.inputType.name === 'SELECT_TYPE') {
|
||||||
let itemValues = item.keyValue.split('|');
|
let itemValues = item.keyValue.split('|');
|
||||||
let idx = 0;
|
let idx = 0;
|
||||||
for (let itemValue of itemValues) {
|
elem.push(<Label pointing='below'>{item.name}</Label>);
|
||||||
elem.push(<Form.Radio
|
|
||||||
key={idx++}
|
if(this.state.authJson[item.name] === undefined) {
|
||||||
label={itemValue}
|
this.onChangeAuth(item.name, item.defaultValue);
|
||||||
name='radioGroup'
|
|
||||||
value={itemValue}
|
|
||||||
onChange={
|
|
||||||
(event: React.FormEvent<HTMLInputElement>, data: CheckboxProps) => {
|
|
||||||
this.onChangeAuth(item.name, itemValue);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/>);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (let itemValue of itemValues) {
|
||||||
|
elem.push(
|
||||||
|
<Form.Radio
|
||||||
|
key={idx++}
|
||||||
|
label={itemValue}
|
||||||
|
name={'radioGroup' + String(item.id)}
|
||||||
|
value={itemValue}
|
||||||
|
checked={this.state.authJson[item.name] ? this.state.authJson[item.name] === itemValue : itemValue === item.defaultValue}
|
||||||
|
defaultChecked={itemValue === item.defaultValue ? true : false}
|
||||||
|
onChange={
|
||||||
|
(event: React.FormEvent<HTMLInputElement>, data: CheckboxProps) => {
|
||||||
|
this.onChangeAuth(item.name, itemValue);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/>);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
Loading…
Reference in New Issue
Block a user