ibm-apiconnect / devportal-addons

Example addon modules and themes for the API Connect Developer Portal
GNU General Public License v2.0
1 stars 2 forks source link

Redirect uri label is rendered twice #5

Closed alaincroisetiere closed 5 years ago

alaincroisetiere commented 5 years ago

Redirect uri label is rendered twice in apiconnect-explorer@4.1.97 when application does not have redirect uri.

Div with class name labelText must be rendered only if uriSelector is rendered.

TestToolRedirectUri.js

  render() {
    let {
      t,
      value
    } = this.props;

    let {
      redirectUri
    } = this.state;

    let redirectUris = value.redirectUris;
    let uriSelector;
    let uriInput;

   if (redirectUris.length > 0 && redirectUris[0] !== "") {
       // need a dropdown
      uriSelector = (
          <Select onChange={this.handleChange} id="redirectUri-select" defaultValue={redirectUris[0]} hideLabel>
            {redirectUris.map(param => {
             return <SelectItem key={param} value={param} text={param}/>
            })}
            <SelectItem key={""} value={""} text={t('other')}/>
          </Select>)
    }
    if (redirectUris[0] === "" || redirectUris.indexOf(redirectUri)=== -1)
    {
      uriInput = <TextInput className="redirectUriField" type="input" labelText={t('explorer_redirect_uri')}
                            id="redirectUriField" value={redirectUri} onChange={this.handleChange}/>;
    }

    return (
      <div className="redirectUri">
        <div className="labelText">
          {t('explorer_redirect_uri')}
        </div>
        {uriSelector}
        {uriInput}

      </div>
    );
  }
redlanne commented 5 years ago

not quite - just need to hide the label on the component. Will be fixed in the next release of apiconnect-explorer