aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/src/main/js/apps/web-api
diff options
context:
space:
mode:
authorStas Vilchik <stas.vilchik@sonarsource.com>2017-08-29 11:38:53 +0200
committerStas Vilchik <stas.vilchik@sonarsource.com>2017-09-13 13:53:58 +0200
commit793e86fce66f356099792b7231c9a1d949ff875e (patch)
tree8bd08099539c3cb1ff159823ee1d1f74a5f2c979 /server/sonar-web/src/main/js/apps/web-api
parent736e89cc1629e1e52db00f67e4650f1b88695de9 (diff)
downloadsonarqube-793e86fce66f356099792b7231c9a1d949ff875e.tar.gz
sonarqube-793e86fce66f356099792b7231c9a1d949ff875e.zip
update prettier
Diffstat (limited to 'server/sonar-web/src/main/js/apps/web-api')
-rw-r--r--server/sonar-web/src/main/js/apps/web-api/components/Action.tsx38
-rw-r--r--server/sonar-web/src/main/js/apps/web-api/components/ActionChangelog.tsx8
-rw-r--r--server/sonar-web/src/main/js/apps/web-api/components/DeprecatedBadge.tsx4
-rw-r--r--server/sonar-web/src/main/js/apps/web-api/components/Domain.tsx23
-rw-r--r--server/sonar-web/src/main/js/apps/web-api/components/InternalBadge.tsx4
-rw-r--r--server/sonar-web/src/main/js/apps/web-api/components/Menu.tsx9
-rw-r--r--server/sonar-web/src/main/js/apps/web-api/components/Params.tsx95
-rw-r--r--server/sonar-web/src/main/js/apps/web-api/components/ResponseExample.tsx5
-rw-r--r--server/sonar-web/src/main/js/apps/web-api/components/WebApiApp.tsx9
9 files changed, 91 insertions, 104 deletions
diff --git a/server/sonar-web/src/main/js/apps/web-api/components/Action.tsx b/server/sonar-web/src/main/js/apps/web-api/components/Action.tsx
index 92cea769d0a..06bce67949d 100644
--- a/server/sonar-web/src/main/js/apps/web-api/components/Action.tsx
+++ b/server/sonar-web/src/main/js/apps/web-api/components/Action.tsx
@@ -84,7 +84,7 @@ export default class Action extends React.PureComponent<Props, State> {
if (action.params || action.hasResponseExample || action.changelog.length > 0) {
return (
<ul className="web-api-action-actions tabs">
- {action.params &&
+ {action.params && (
<li>
<a
className={classNames({ selected: showParams })}
@@ -92,9 +92,10 @@ export default class Action extends React.PureComponent<Props, State> {
onClick={this.handleShowParamsClick}>
{translate('api_documentation.parameters')}
</a>
- </li>}
+ </li>
+ )}
- {action.hasResponseExample &&
+ {action.hasResponseExample && (
<li>
<a
className={classNames({ selected: showResponse })}
@@ -102,9 +103,10 @@ export default class Action extends React.PureComponent<Props, State> {
onClick={this.handleShowResponseClick}>
{translate('api_documentation.response_example')}
</a>
- </li>}
+ </li>
+ )}
- {action.changelog.length > 0 &&
+ {action.changelog.length > 0 && (
<li>
<a
className={classNames({ selected: showChangelog })}
@@ -112,7 +114,8 @@ export default class Action extends React.PureComponent<Props, State> {
onClick={this.handleChangelogClick}>
{translate('api_documentation.changelog')}
</a>
- </li>}
+ </li>
+ )}
</ul>
);
}
@@ -139,20 +142,23 @@ export default class Action extends React.PureComponent<Props, State> {
{verb}&nbsp;{actionKey}
</h3>
- {action.internal &&
+ {action.internal && (
<span className="spacer-left">
<InternalBadge />
- </span>}
+ </span>
+ )}
- {action.since &&
+ {action.since && (
<span className="spacer-left badge">
{translateWithParameters('since_x', action.since)}
- </span>}
+ </span>
+ )}
- {action.deprecatedSince &&
+ {action.deprecatedSince && (
<span className="spacer-left">
<DeprecatedBadge since={action.deprecatedSince} />
- </span>}
+ </span>
+ )}
</header>
<div
@@ -163,16 +169,16 @@ export default class Action extends React.PureComponent<Props, State> {
{this.renderTabs()}
{showParams &&
- action.params &&
+ action.params && (
<Params
params={action.params}
showDeprecated={this.props.showDeprecated}
showInternal={this.props.showInternal}
- />}
+ />
+ )}
{showResponse &&
- action.hasResponseExample &&
- <ResponseExample domain={domain} action={action} />}
+ action.hasResponseExample && <ResponseExample domain={domain} action={action} />}
{showChangelog && <ActionChangelog changelog={action.changelog} />}
</div>
diff --git a/server/sonar-web/src/main/js/apps/web-api/components/ActionChangelog.tsx b/server/sonar-web/src/main/js/apps/web-api/components/ActionChangelog.tsx
index 7e33e9719ae..25df7b9a993 100644
--- a/server/sonar-web/src/main/js/apps/web-api/components/ActionChangelog.tsx
+++ b/server/sonar-web/src/main/js/apps/web-api/components/ActionChangelog.tsx
@@ -27,14 +27,12 @@ interface Props {
export default function ActionChangelog({ changelog }: Props) {
return (
<ul className="big-spacer-top">
- {changelog.map((item, index) =>
+ {changelog.map((item, index) => (
<li key={index} className="spacer-top">
- <span className="spacer-right badge">
- {item.version}
- </span>
+ <span className="spacer-right badge">{item.version}</span>
{item.description}
</li>
- )}
+ ))}
</ul>
);
}
diff --git a/server/sonar-web/src/main/js/apps/web-api/components/DeprecatedBadge.tsx b/server/sonar-web/src/main/js/apps/web-api/components/DeprecatedBadge.tsx
index 504d0553823..c2a786f62b2 100644
--- a/server/sonar-web/src/main/js/apps/web-api/components/DeprecatedBadge.tsx
+++ b/server/sonar-web/src/main/js/apps/web-api/components/DeprecatedBadge.tsx
@@ -27,9 +27,7 @@ export default function DeprecatedBadge({ since }: { since?: string }) {
: translate('api_documentation.depracated');
return (
<Tooltip overlay={translate('api_documentation.deprecation_tooltip')}>
- <span className="badge badge-warning">
- {label}
- </span>
+ <span className="badge badge-warning">{label}</span>
</Tooltip>
);
}
diff --git a/server/sonar-web/src/main/js/apps/web-api/components/Domain.tsx b/server/sonar-web/src/main/js/apps/web-api/components/Domain.tsx
index 8e70e2ed767..492027a232a 100644
--- a/server/sonar-web/src/main/js/apps/web-api/components/Domain.tsx
+++ b/server/sonar-web/src/main/js/apps/web-api/components/Domain.tsx
@@ -39,29 +39,30 @@ export default function Domain({ domain, showInternal, showDeprecated, searchQue
return (
<div className="web-api-domain">
<header className="web-api-domain-header">
- <h2 className="web-api-domain-title">
- {domain.path}
- </h2>
+ <h2 className="web-api-domain-title">{domain.path}</h2>
- {domain.deprecated &&
+ {domain.deprecated && (
<span className="spacer-left">
<DeprecatedBadge />
- </span>}
+ </span>
+ )}
- {domain.internal &&
+ {domain.internal && (
<span className="spacer-left">
<InternalBadge />
- </span>}
+ </span>
+ )}
</header>
- {domain.description &&
+ {domain.description && (
<div
className="web-api-domain-description markdown"
dangerouslySetInnerHTML={{ __html: domain.description }}
- />}
+ />
+ )}
<div className="web-api-domain-actions">
- {filteredActions.map(action =>
+ {filteredActions.map(action => (
<Action
key={getActionKey(domain.path, action.key)}
action={action}
@@ -69,7 +70,7 @@ export default function Domain({ domain, showInternal, showDeprecated, searchQue
showDeprecated={showDeprecated}
showInternal={showInternal}
/>
- )}
+ ))}
</div>
</div>
);
diff --git a/server/sonar-web/src/main/js/apps/web-api/components/InternalBadge.tsx b/server/sonar-web/src/main/js/apps/web-api/components/InternalBadge.tsx
index 4b7ed15fede..34a66309f7e 100644
--- a/server/sonar-web/src/main/js/apps/web-api/components/InternalBadge.tsx
+++ b/server/sonar-web/src/main/js/apps/web-api/components/InternalBadge.tsx
@@ -24,9 +24,7 @@ import { translate } from '../../../helpers/l10n';
export default function InternalBadge() {
return (
<Tooltip overlay={translate('api_documentation.internal_tooltip')}>
- <span className="badge badge-danger">
- {translate('internal')}
- </span>
+ <span className="badge badge-danger">{translate('internal')}</span>
</Tooltip>
);
}
diff --git a/server/sonar-web/src/main/js/apps/web-api/components/Menu.tsx b/server/sonar-web/src/main/js/apps/web-api/components/Menu.tsx
index d33ddade68b..2b5218293d8 100644
--- a/server/sonar-web/src/main/js/apps/web-api/components/Menu.tsx
+++ b/server/sonar-web/src/main/js/apps/web-api/components/Menu.tsx
@@ -47,7 +47,7 @@ export default function Menu(props: Props) {
return (
<div className="api-documentation-results panel">
<div className="list-group">
- {filteredDomains.map(domain =>
+ {filteredDomains.map(domain => (
<Link
key={domain.path}
className={classNames('list-group-item', {
@@ -59,13 +59,14 @@ export default function Menu(props: Props) {
{domain.deprecated && <DeprecatedBadge />}
{domain.internal && <InternalBadge />}
</h3>
- {domain.description &&
+ {domain.description && (
<div
className="list-group-item-text markdown"
dangerouslySetInnerHTML={{ __html: domain.description }}
- />}
+ />
+ )}
</Link>
- )}
+ ))}
</div>
</div>
);
diff --git a/server/sonar-web/src/main/js/apps/web-api/components/Params.tsx b/server/sonar-web/src/main/js/apps/web-api/components/Params.tsx
index e0691804e7d..9f32210fc63 100644
--- a/server/sonar-web/src/main/js/apps/web-api/components/Params.tsx
+++ b/server/sonar-web/src/main/js/apps/web-api/components/Params.tsx
@@ -37,46 +37,47 @@ export default function Params({ params, showDeprecated, showInternal }: Props)
<div className="web-api-params">
<table>
<tbody>
- {displayedParameters.map(param =>
+ {displayedParameters.map(param => (
<tr key={param.key}>
<td className="markdown" style={{ width: 180 }}>
- <code>
- {param.key}
- </code>
+ <code>{param.key}</code>
- {param.internal &&
+ {param.internal && (
<div className="little-spacer-top">
<InternalBadge />
- </div>}
+ </div>
+ )}
- {param.deprecatedSince &&
+ {param.deprecatedSince && (
<div className="little-spacer-top">
<DeprecatedBadge since={param.deprecatedSince} />
- </div>}
+ </div>
+ )}
{showDeprecated &&
- param.deprecatedKey &&
+ param.deprecatedKey && (
<div className="little-spacer-top">
- <code>
- {param.deprecatedKey}
- </code>
- </div>}
+ <code>{param.deprecatedKey}</code>
+ </div>
+ )}
{showDeprecated &&
- param.deprecatedKey &&
- param.deprecatedKeySince &&
+ param.deprecatedKey &&
+ param.deprecatedKeySince && (
<div className="little-spacer-top">
<DeprecatedBadge since={param.deprecatedKeySince} />
- </div>}
+ </div>
+ )}
<div className="note little-spacer-top">
{param.required ? 'required' : 'optional'}
</div>
- {param.since &&
+ {param.since && (
<div className="note little-spacer-top">
{translateWithParameters('since_x', param.since)}
- </div>}
+ </div>
+ )}
</td>
<td>
@@ -84,54 +85,42 @@ export default function Params({ params, showDeprecated, showInternal }: Props)
</td>
<td style={{ width: 250 }}>
- {param.possibleValues &&
+ {param.possibleValues && (
<div>
- <h4>
- {translate('api_documentation.possible_values')}
- </h4>
+ <h4>{translate('api_documentation.possible_values')}</h4>
<ul className="list-styled">
- {param.possibleValues.map(value =>
+ {param.possibleValues.map(value => (
<li key={value} className="little-spacer-top">
- <code>
- {value}
- </code>
+ <code>{value}</code>
</li>
- )}
+ ))}
</ul>
- </div>}
+ </div>
+ )}
- {param.defaultValue &&
+ {param.defaultValue && (
<div className="little-spacer-top">
- <h4>
- {translate('api_documentation.default_values')}
- </h4>
- <code>
- {param.defaultValue}
- </code>
- </div>}
+ <h4>{translate('api_documentation.default_values')}</h4>
+ <code>{param.defaultValue}</code>
+ </div>
+ )}
- {param.exampleValue &&
+ {param.exampleValue && (
<div className="little-spacer-top">
- <h4>
- {translate('api_documentation.example_values')}
- </h4>
- <code>
- {param.exampleValue}
- </code>
- </div>}
+ <h4>{translate('api_documentation.example_values')}</h4>
+ <code>{param.exampleValue}</code>
+ </div>
+ )}
- {param.maxValuesAllowed != null &&
+ {param.maxValuesAllowed != null && (
<div className="little-spacer-top">
- <h4>
- {translate('api_documentation.max_values')}
- </h4>
- <code>
- {param.maxValuesAllowed}
- </code>
- </div>}
+ <h4>{translate('api_documentation.max_values')}</h4>
+ <code>{param.maxValuesAllowed}</code>
+ </div>
+ )}
</td>
</tr>
- )}
+ ))}
</tbody>
</table>
</div>
diff --git a/server/sonar-web/src/main/js/apps/web-api/components/ResponseExample.tsx b/server/sonar-web/src/main/js/apps/web-api/components/ResponseExample.tsx
index 746fb398e11..c20fc9c7515 100644
--- a/server/sonar-web/src/main/js/apps/web-api/components/ResponseExample.tsx
+++ b/server/sonar-web/src/main/js/apps/web-api/components/ResponseExample.tsx
@@ -65,10 +65,7 @@ export default class ResponseExample extends React.PureComponent<Props, State> {
return (
<div className="web-api-response">
- {responseExample &&
- <pre style={{ whiteSpace: 'pre-wrap' }}>
- {responseExample.example}
- </pre>}
+ {responseExample && <pre style={{ whiteSpace: 'pre-wrap' }}>{responseExample.example}</pre>}
</div>
);
}
diff --git a/server/sonar-web/src/main/js/apps/web-api/components/WebApiApp.tsx b/server/sonar-web/src/main/js/apps/web-api/components/WebApiApp.tsx
index 68cb7e591d4..3a69c4bc4c6 100644
--- a/server/sonar-web/src/main/js/apps/web-api/components/WebApiApp.tsx
+++ b/server/sonar-web/src/main/js/apps/web-api/components/WebApiApp.tsx
@@ -147,9 +147,7 @@ export default class WebApiApp extends React.PureComponent<Props, State> {
<div className="layout-page-filters">
<div className="web-api-page-header">
<Link to="/web_api/">
- <h1>
- {translate('api_documentation.page')}
- </h1>
+ <h1>{translate('api_documentation.page')}</h1>
</Link>
</div>
@@ -175,14 +173,15 @@ export default class WebApiApp extends React.PureComponent<Props, State> {
<div className="layout-page-main">
<div className="layout-page-main-inner">
- {domain &&
+ {domain && (
<Domain
key={domain.path}
domain={domain}
showDeprecated={showDeprecated}
showInternal={showInternal}
searchQuery={searchQuery}
- />}
+ />
+ )}
</div>
</div>
</div>