Merge branch 'master' into fix-api-key-in-titleization

This commit is contained in:
Roman Hotsiy 2019-05-12 22:33:50 +03:00 committed by GitHub
commit f424843e58
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 15 additions and 5 deletions

View File

@ -5,7 +5,7 @@ import { Markdown } from '../Markdown/Markdown';
import { OptionsContext } from '../OptionsProvider'; import { OptionsContext } from '../OptionsProvider';
import { SelectOnClick } from '../SelectOnClick/SelectOnClick'; import { SelectOnClick } from '../SelectOnClick/SelectOnClick';
import { getBasePath } from '../../utils'; import {getBasePath, removeQueryString} from '../../utils';
import { import {
EndpointInfo, EndpointInfo,
HttpVerb, HttpVerb,
@ -68,7 +68,7 @@ export class Endpoint extends React.Component<EndpointProps, EndpointState> {
<span> <span>
{hideHostname || options.hideHostname {hideHostname || options.hideHostname
? getBasePath(server.url) ? getBasePath(server.url)
: server.url} : removeQueryString(server.url)}
</span> </span>
{operation.path} {operation.path}
</ServerUrl> </ServerUrl>

View File

@ -17,9 +17,11 @@ export class EnumValues extends React.PureComponent<EnumValuesProps> {
<div> <div>
<FieldLabel> <FieldLabel>
{type === 'array' ? 'Items' : ''} {values.length === 1 ? 'Value' : 'Enum'}: {type === 'array' ? 'Items' : ''} {values.length === 1 ? 'Value' : 'Enum'}:
</FieldLabel> </FieldLabel>{' '}
{values.map((value, idx) => ( {values.map((value, idx) => (
<ExampleValue key={idx}>{JSON.stringify(value)} </ExampleValue> <ExampleValue key={idx}>
{JSON.stringify(value)}
</ExampleValue>
))} ))}
</div> </div>
); );

View File

@ -14,7 +14,9 @@ export class FieldDetail extends React.PureComponent<FieldDetailProps> {
return ( return (
<div> <div>
<FieldLabel> {this.props.label} </FieldLabel>{' '} <FieldLabel> {this.props.label} </FieldLabel>{' '}
<ExampleValue> {JSON.stringify(this.props.value)} </ExampleValue> <ExampleValue>
{JSON.stringify(this.props.value)}
</ExampleValue>
</div> </div>
); );
} }

View File

@ -169,3 +169,9 @@ export function getBasePath(serverUrl: string): string {
export function titleize(text: string) { export function titleize(text: string) {
return text.charAt(0).toUpperCase() + text.slice(1); return text.charAt(0).toUpperCase() + text.slice(1);
} }
export function removeQueryString(serverUrl: string): string {
const url = new URL(serverUrl);
url.search = '';
return url.toString();
}