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 {
 | 
			
		||||
      if(nextProps.metaCrawlerInputItemList !== this.props.metaCrawlerInputItemList) {
 | 
			
		||||
        this.setState({authJson: {}});
 | 
			
		||||
      }
 | 
			
		||||
    if (nextProps.metaCrawlerInputItemList !== this.props.metaCrawlerInputItemList) {
 | 
			
		||||
      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);
 | 
			
		||||
 | 
			
		||||
    let authCrawler: AuthCrawler = {
 | 
			
		||||
      crawler: {id:sd.crawler.id},
 | 
			
		||||
      target: {id:sd.infra.target.id},
 | 
			
		||||
      crawler: { id: sd.crawler.id },
 | 
			
		||||
      target: { id: sd.infra.target.id },
 | 
			
		||||
      authJson: JSON.stringify(sd.crawlerAuth),
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
@ -108,6 +108,8 @@ export class CrawlerAuthInputs extends React.Component<CrawlerAuthInputsProps, C
 | 
			
		||||
    let newJson: any = _.clone(this.state.authJson);
 | 
			
		||||
    newJson[key] = data;
 | 
			
		||||
    this.setState({ authJson: newJson });
 | 
			
		||||
 | 
			
		||||
    console.log(newJson);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  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) => {
 | 
			
		||||
          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 idx = 0;
 | 
			
		||||
      for (let itemValue of itemValues) {
 | 
			
		||||
        elem.push(<Form.Radio
 | 
			
		||||
          key={idx++}
 | 
			
		||||
          label={itemValue}
 | 
			
		||||
          name='radioGroup'
 | 
			
		||||
          value={itemValue}
 | 
			
		||||
          onChange={
 | 
			
		||||
            (event: React.FormEvent<HTMLInputElement>, data: CheckboxProps) => {
 | 
			
		||||
              this.onChangeAuth(item.name, itemValue);
 | 
			
		||||
            }
 | 
			
		||||
          }
 | 
			
		||||
        />);
 | 
			
		||||
      elem.push(<Label pointing='below'>{item.name}</Label>);
 | 
			
		||||
 | 
			
		||||
      if(this.state.authJson[item.name] === undefined) {
 | 
			
		||||
         this.onChangeAuth(item.name, item.defaultValue);
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      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 (
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user