aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/src/main/js/apps/settings
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/settings
parent736e89cc1629e1e52db00f67e4650f1b88695de9 (diff)
downloadsonarqube-793e86fce66f356099792b7231c9a1d949ff875e.tar.gz
sonarqube-793e86fce66f356099792b7231c9a1d949ff875e.zip
update prettier
Diffstat (limited to 'server/sonar-web/src/main/js/apps/settings')
-rw-r--r--server/sonar-web/src/main/js/apps/settings/components/App.js45
-rw-r--r--server/sonar-web/src/main/js/apps/settings/components/CategoriesList.js6
-rw-r--r--server/sonar-web/src/main/js/apps/settings/components/Definition.js25
-rw-r--r--server/sonar-web/src/main/js/apps/settings/components/DefinitionDefaults.js26
-rw-r--r--server/sonar-web/src/main/js/apps/settings/components/DefinitionsList.js4
-rw-r--r--server/sonar-web/src/main/js/apps/settings/components/EmailForm.js18
-rw-r--r--server/sonar-web/src/main/js/apps/settings/components/PageHeader.js8
-rw-r--r--server/sonar-web/src/main/js/apps/settings/components/SubCategoryDefinitionsList.js13
-rw-r--r--server/sonar-web/src/main/js/apps/settings/components/inputs/InputForBoolean.js5
-rw-r--r--server/sonar-web/src/main/js/apps/settings/components/inputs/InputForPassword.js4
-rw-r--r--server/sonar-web/src/main/js/apps/settings/components/inputs/MultiValueInput.js5
-rw-r--r--server/sonar-web/src/main/js/apps/settings/components/inputs/PropertySetInput.js20
-rw-r--r--server/sonar-web/src/main/js/apps/settings/components/inputs/__tests__/MultiValueInput-test.js10
-rw-r--r--server/sonar-web/src/main/js/apps/settings/encryption/EncryptionApp.js14
-rw-r--r--server/sonar-web/src/main/js/apps/settings/encryption/EncryptionForm.js5
-rw-r--r--server/sonar-web/src/main/js/apps/settings/encryption/GenerateSecretKeyForm.js99
-rw-r--r--server/sonar-web/src/main/js/apps/settings/licenses/LicenseChangeForm.js17
-rw-r--r--server/sonar-web/src/main/js/apps/settings/licenses/LicenseRow.js17
-rw-r--r--server/sonar-web/src/main/js/apps/settings/licenses/LicensesAppHeader.js4
-rw-r--r--server/sonar-web/src/main/js/apps/settings/licenses/LicensesList.js24
-rw-r--r--server/sonar-web/src/main/js/apps/settings/licenses/__tests__/LicensesList-test.js14
-rw-r--r--server/sonar-web/src/main/js/apps/settings/serverId/ServerIdApp.js24
22 files changed, 193 insertions, 214 deletions
diff --git a/server/sonar-web/src/main/js/apps/settings/components/App.js b/server/sonar-web/src/main/js/apps/settings/components/App.js
index 4f466e19461..866830fbb69 100644
--- a/server/sonar-web/src/main/js/apps/settings/components/App.js
+++ b/server/sonar-web/src/main/js/apps/settings/components/App.js
@@ -89,27 +89,29 @@ export default class App extends React.PureComponent {
<div id="settings-page" className="page page-limited">
<Helmet title={translate('settings.page')} />
- {branchName
- ? <div className="alert alert-info">
- <FormattedMessage
- defaultMessage={translate('branches.settings_hint')}
- id="branches.settings_hint"
- values={{
- link: (
- <Link
- to={{
- pathname: '/project/branches',
- query: { id: this.props.component && this.props.component.key }
- }}>
- {translate('branches.settings_hint_tab')}
- </Link>
- )
- }}
- />
- </div>
- : <PageHeader branch={branchName} component={this.props.component} />}
+ {branchName ? (
+ <div className="alert alert-info">
+ <FormattedMessage
+ defaultMessage={translate('branches.settings_hint')}
+ id="branches.settings_hint"
+ values={{
+ link: (
+ <Link
+ to={{
+ pathname: '/project/branches',
+ query: { id: this.props.component && this.props.component.key }
+ }}>
+ {translate('branches.settings_hint_tab')}
+ </Link>
+ )
+ }}
+ />
+ </div>
+ ) : (
+ <PageHeader branch={branchName} component={this.props.component} />
+ )}
<div className="side-tabs-layout settings-layout">
- {branchName == null &&
+ {branchName == null && (
<div className="side-tabs-side">
<AllCategoriesList
branch={branchName}
@@ -117,7 +119,8 @@ export default class App extends React.PureComponent {
selectedCategory={selectedCategory}
defaultCategory={this.props.defaultCategory}
/>
- </div>}
+ </div>
+ )}
<div className="side-tabs-main">
<CategoryDefinitionsList
branch={branchName}
diff --git a/server/sonar-web/src/main/js/apps/settings/components/CategoriesList.js b/server/sonar-web/src/main/js/apps/settings/components/CategoriesList.js
index b9f61bfc68c..8cbda6596c7 100644
--- a/server/sonar-web/src/main/js/apps/settings/components/CategoriesList.js
+++ b/server/sonar-web/src/main/js/apps/settings/components/CategoriesList.js
@@ -75,11 +75,7 @@ export default class CategoriesList extends React.PureComponent {
return (
<ul className="side-tabs-menu">
- {sortedCategories.map(category =>
- <li key={category.key}>
- {this.renderLink(category)}
- </li>
- )}
+ {sortedCategories.map(category => <li key={category.key}>{this.renderLink(category)}</li>)}
</ul>
);
}
diff --git a/server/sonar-web/src/main/js/apps/settings/components/Definition.js b/server/sonar-web/src/main/js/apps/settings/components/Definition.js
index 3ae60c1afcc..91eec4f2433 100644
--- a/server/sonar-web/src/main/js/apps/settings/components/Definition.js
+++ b/server/sonar-web/src/main/js/apps/settings/components/Definition.js
@@ -155,14 +155,15 @@ class Definition extends React.PureComponent {
<div className="settings-definition-right">
<div className="settings-definition-state">
- {loading &&
+ {loading && (
<span className="text-info">
<i className="spinner spacer-right" />
{translate('settings.state.saving')}
- </span>}
+ </span>
+ )}
{!loading &&
- this.props.validationMessage != null &&
+ this.props.validationMessage != null && (
<span className="text-danger">
<i className="icon-alert-error spacer-right" />
<span>
@@ -171,30 +172,34 @@ class Definition extends React.PureComponent {
this.props.validationMessage
)}
</span>
- </span>}
+ </span>
+ )}
{!loading &&
- this.state.success &&
+ this.state.success && (
<span className="text-success">
<i className="icon-check spacer-right" />
{translate('settings.state.saved')}
- </span>}
+ </span>
+ )}
</div>
<Input setting={setting} value={effectiveValue} onChange={this.handleChange.bind(this)} />
- {!hasValueChanged &&
+ {!hasValueChanged && (
<DefinitionDefaults
setting={setting}
isDefault={isDefault}
onReset={() => this.handleReset()}
- />}
+ />
+ )}
- {hasValueChanged &&
+ {hasValueChanged && (
<DefinitionChanges
onSave={this.handleSave.bind(this)}
onCancel={this.handleCancel.bind(this)}
- />}
+ />
+ )}
</div>
</div>
);
diff --git a/server/sonar-web/src/main/js/apps/settings/components/DefinitionDefaults.js b/server/sonar-web/src/main/js/apps/settings/components/DefinitionDefaults.js
index 8c2061a9b7c..563b0dc59a1 100644
--- a/server/sonar-web/src/main/js/apps/settings/components/DefinitionDefaults.js
+++ b/server/sonar-web/src/main/js/apps/settings/components/DefinitionDefaults.js
@@ -64,20 +64,14 @@ export default class DefinitionDefaults extends React.PureComponent {
overlayClassName="modal-overlay"
onRequestClose={this.handleClose}>
<header className="modal-head">
- <h2>
- {header}
- </h2>
+ <h2>{header}</h2>
</header>
<form onSubmit={this.handleSubmit}>
<div className="modal-body">
- <p>
- {translate('settings.reset_confirm.description')}
- </p>
+ <p>{translate('settings.reset_confirm.description')}</p>
</div>
<footer className="modal-foot">
- <button className="button-red">
- {translate('reset_verb')}
- </button>
+ <button className="button-red">{translate('reset_verb')}</button>
<button type="reset" className="button-link" onClick={this.handleClose}>
{translate('cancel')}
</button>
@@ -95,22 +89,22 @@ export default class DefinitionDefaults extends React.PureComponent {
return (
<div>
- {isDefault &&
+ {isDefault && (
<div className="spacer-top note" style={{ lineHeight: '24px' }}>
{translate('settings._default')}
- </div>}
+ </div>
+ )}
- {isExplicitlySet &&
+ {isExplicitlySet && (
<div className="spacer-top nowrap">
- <button onClick={this.handleReset}>
- {translate('reset_verb')}
- </button>
+ <button onClick={this.handleReset}>{translate('reset_verb')}</button>
<span className="spacer-left note">
{translate('default')}
{': '}
{getDefaultValue(setting)}
</span>
- </div>}
+ </div>
+ )}
{this.state.reseting && this.renderModal()}
</div>
);
diff --git a/server/sonar-web/src/main/js/apps/settings/components/DefinitionsList.js b/server/sonar-web/src/main/js/apps/settings/components/DefinitionsList.js
index f8e6230a52b..7cb111b297a 100644
--- a/server/sonar-web/src/main/js/apps/settings/components/DefinitionsList.js
+++ b/server/sonar-web/src/main/js/apps/settings/components/DefinitionsList.js
@@ -32,7 +32,7 @@ export default class DefinitionsList extends React.PureComponent {
render() {
return (
<ul className="settings-definitions-list">
- {this.props.settings.map(setting =>
+ {this.props.settings.map(setting => (
<li key={setting.definition.key}>
<Definition
branch={this.props.branch}
@@ -40,7 +40,7 @@ export default class DefinitionsList extends React.PureComponent {
setting={setting}
/>
</li>
- )}
+ ))}
</ul>
);
}
diff --git a/server/sonar-web/src/main/js/apps/settings/components/EmailForm.js b/server/sonar-web/src/main/js/apps/settings/components/EmailForm.js
index 89e821bc5fb..8e0e37737f9 100644
--- a/server/sonar-web/src/main/js/apps/settings/components/EmailForm.js
+++ b/server/sonar-web/src/main/js/apps/settings/components/EmailForm.js
@@ -50,12 +50,10 @@ class EmailForm extends React.PureComponent {
render() {
return (
<div className="huge-spacer-top">
- <h3 className="spacer-bottom">
- {translate('email_configuration.test.title')}
- </h3>
+ <h3 className="spacer-bottom">{translate('email_configuration.test.title')}</h3>
<form style={{ marginLeft: 201 }} onSubmit={e => this.handleFormSubmit(e)}>
- {this.state.success &&
+ {this.state.success && (
<div className="modal-field">
<div className="alert alert-success">
{translateWithParameters(
@@ -63,14 +61,14 @@ class EmailForm extends React.PureComponent {
this.state.recipient
)}
</div>
- </div>}
+ </div>
+ )}
- {this.state.error != null &&
+ {this.state.error != null && (
<div className="modal-field">
- <div className="alert alert-danger">
- {this.state.error}
- </div>
- </div>}
+ <div className="alert alert-danger">{this.state.error}</div>
+ </div>
+ )}
<div className="modal-field">
<label htmlFor="test-email-to">
diff --git a/server/sonar-web/src/main/js/apps/settings/components/PageHeader.js b/server/sonar-web/src/main/js/apps/settings/components/PageHeader.js
index e7bc08f10e3..d70bb1e1b13 100644
--- a/server/sonar-web/src/main/js/apps/settings/components/PageHeader.js
+++ b/server/sonar-web/src/main/js/apps/settings/components/PageHeader.js
@@ -41,12 +41,8 @@ export default class PageHeader extends React.PureComponent {
return (
<header className="page-header">
- <h1 className="page-title">
- {title}
- </h1>
- <div className="page-description">
- {description}
- </div>
+ <h1 className="page-title">{title}</h1>
+ <div className="page-description">{description}</div>
</header>
);
}
diff --git a/server/sonar-web/src/main/js/apps/settings/components/SubCategoryDefinitionsList.js b/server/sonar-web/src/main/js/apps/settings/components/SubCategoryDefinitionsList.js
index ca8443fbfc1..e779f1105c9 100644
--- a/server/sonar-web/src/main/js/apps/settings/components/SubCategoryDefinitionsList.js
+++ b/server/sonar-web/src/main/js/apps/settings/components/SubCategoryDefinitionsList.js
@@ -53,16 +53,15 @@ export default class SubCategoryDefinitionsList extends React.PureComponent {
return (
<ul className="settings-sub-categories-list">
- {sortedSubCategories.map(subCategory =>
+ {sortedSubCategories.map(subCategory => (
<li key={subCategory.key}>
- <h2 className="settings-sub-category-name">
- {subCategory.name}
- </h2>
- {subCategory.description != null &&
+ <h2 className="settings-sub-category-name">{subCategory.name}</h2>
+ {subCategory.description != null && (
<div
className="settings-sub-category-description markdown"
dangerouslySetInnerHTML={{ __html: subCategory.description }}
- />}
+ />
+ )}
<DefinitionsList
branch={this.props.branch}
component={this.props.component}
@@ -70,7 +69,7 @@ export default class SubCategoryDefinitionsList extends React.PureComponent {
/>
{this.renderEmailForm(subCategory.key)}
</li>
- )}
+ ))}
</ul>
);
}
diff --git a/server/sonar-web/src/main/js/apps/settings/components/inputs/InputForBoolean.js b/server/sonar-web/src/main/js/apps/settings/components/inputs/InputForBoolean.js
index fa95e12b7b1..e7f6d002ed9 100644
--- a/server/sonar-web/src/main/js/apps/settings/components/inputs/InputForBoolean.js
+++ b/server/sonar-web/src/main/js/apps/settings/components/inputs/InputForBoolean.js
@@ -37,10 +37,7 @@ export default class InputForBoolean extends React.PureComponent {
<div className="display-inline-block text-top">
<Toggle name={this.props.name} value={displayedValue} onChange={this.props.onChange} />
- {!hasValue &&
- <span className="spacer-left note">
- {translate('settings.not_set')}
- </span>}
+ {!hasValue && <span className="spacer-left note">{translate('settings.not_set')}</span>}
</div>
);
}
diff --git a/server/sonar-web/src/main/js/apps/settings/components/inputs/InputForPassword.js b/server/sonar-web/src/main/js/apps/settings/components/inputs/InputForPassword.js
index 0d95d4d5c17..9f7a35f3f4e 100644
--- a/server/sonar-web/src/main/js/apps/settings/components/inputs/InputForPassword.js
+++ b/server/sonar-web/src/main/js/apps/settings/components/inputs/InputForPassword.js
@@ -66,9 +66,7 @@ export default class InputForPassword extends React.PureComponent {
onChange={e => this.handleInputChange(e)}
/>
- <button className="spacer-left button-success">
- {translate('save')}
- </button>
+ <button className="spacer-left button-success">{translate('save')}</button>
<a className="spacer-left" href="#" onClick={e => this.handleCancelChangeClick(e)}>
{translate('cancel')}
diff --git a/server/sonar-web/src/main/js/apps/settings/components/inputs/MultiValueInput.js b/server/sonar-web/src/main/js/apps/settings/components/inputs/MultiValueInput.js
index 668f9fe5720..14b98fceadb 100644
--- a/server/sonar-web/src/main/js/apps/settings/components/inputs/MultiValueInput.js
+++ b/server/sonar-web/src/main/js/apps/settings/components/inputs/MultiValueInput.js
@@ -67,14 +67,15 @@ export default class MultiValueInput extends React.PureComponent {
onChange={this.handleSingleInputChange.bind(this, index)}
/>
- {!isLast &&
+ {!isLast && (
<div className="display-inline-block spacer-left">
<button
className="js-remove-value button-clean"
onClick={e => this.handleDeleteValue(e, index)}>
<i className="icon-delete" />
</button>
- </div>}
+ </div>
+ )}
</li>
);
}
diff --git a/server/sonar-web/src/main/js/apps/settings/components/inputs/PropertySetInput.js b/server/sonar-web/src/main/js/apps/settings/components/inputs/PropertySetInput.js
index a77603fb388..845ca62d952 100644
--- a/server/sonar-web/src/main/js/apps/settings/components/inputs/PropertySetInput.js
+++ b/server/sonar-web/src/main/js/apps/settings/components/inputs/PropertySetInput.js
@@ -59,7 +59,7 @@ export default class PropertySetInput extends React.PureComponent {
return (
<tr key={index}>
- {setting.definition.fields.map(field =>
+ {setting.definition.fields.map(field => (
<td key={field.key}>
<PrimitiveInput
name={this.getFieldName(field)}
@@ -68,14 +68,15 @@ export default class PropertySetInput extends React.PureComponent {
onChange={this.handleInputChange.bind(this, index, field.key)}
/>
</td>
- )}
+ ))}
<td className="thin nowrap">
- {!isLast &&
+ {!isLast && (
<button
className="js-remove-value button-link"
onClick={e => this.handleDeleteValue(e, index)}>
<i className="icon-delete" />
- </button>}
+ </button>
+ )}
</td>
</tr>
);
@@ -93,15 +94,14 @@ export default class PropertySetInput extends React.PureComponent {
style={{ width: 'auto', minWidth: 480, marginTop: -12 }}>
<thead>
<tr>
- {setting.definition.fields.map(field =>
+ {setting.definition.fields.map(field => (
<th key={field.key}>
{field.name}
- {field.description != null &&
- <span className="spacer-top small">
- {field.description}
- </span>}
+ {field.description != null && (
+ <span className="spacer-top small">{field.description}</span>
+ )}
</th>
- )}
+ ))}
<th>&nbsp;</th>
</tr>
</thead>
diff --git a/server/sonar-web/src/main/js/apps/settings/components/inputs/__tests__/MultiValueInput-test.js b/server/sonar-web/src/main/js/apps/settings/components/inputs/__tests__/MultiValueInput-test.js
index 5742801f356..725d60db935 100644
--- a/server/sonar-web/src/main/js/apps/settings/components/inputs/__tests__/MultiValueInput-test.js
+++ b/server/sonar-web/src/main/js/apps/settings/components/inputs/__tests__/MultiValueInput-test.js
@@ -64,7 +64,10 @@ it('should change existing value', () => {
const multiValueInput = shallow(
<MultiValueInput setting={{ definition }} value={['foo', 'bar', 'baz']} onChange={onChange} />
);
- multiValueInput.find(PrimitiveInput).at(1).prop('onChange')('qux');
+ multiValueInput
+ .find(PrimitiveInput)
+ .at(1)
+ .prop('onChange')('qux');
expect(onChange).toBeCalledWith(['foo', 'qux', 'baz']);
});
@@ -73,6 +76,9 @@ it('should add new value', () => {
const multiValueInput = shallow(
<MultiValueInput setting={{ definition }} value={['foo']} onChange={onChange} />
);
- multiValueInput.find(PrimitiveInput).at(1).prop('onChange')('bar');
+ multiValueInput
+ .find(PrimitiveInput)
+ .at(1)
+ .prop('onChange')('bar');
expect(onChange).toBeCalledWith(['foo', 'bar']);
});
diff --git a/server/sonar-web/src/main/js/apps/settings/encryption/EncryptionApp.js b/server/sonar-web/src/main/js/apps/settings/encryption/EncryptionApp.js
index e9f59b8c2df..7c9727e99f4 100644
--- a/server/sonar-web/src/main/js/apps/settings/encryption/EncryptionApp.js
+++ b/server/sonar-web/src/main/js/apps/settings/encryption/EncryptionApp.js
@@ -46,25 +46,25 @@ export default class EncryptionApp extends React.PureComponent {
<div id="encryption-page" className="page page-limited">
<Helmet title={translate('property.category.security.encryption')} />
<header className="page-header">
- <h1 className="page-title">
- {translate('property.category.security.encryption')}
- </h1>
+ <h1 className="page-title">{translate('property.category.security.encryption')}</h1>
{this.props.loading && <i className="spinner" />}
</header>
{!this.props.loading &&
- !this.props.secretKeyAvailable &&
+ !this.props.secretKeyAvailable && (
<GenerateSecretKeyForm
secretKey={this.props.secretKey}
generateSecretKey={this.props.generateSecretKey}
- />}
+ />
+ )}
- {this.props.secretKeyAvailable &&
+ {this.props.secretKeyAvailable && (
<EncryptionForm
encryptedValue={this.props.encryptedValue}
encryptValue={this.props.encryptValue}
generateSecretKey={this.props.startGeneration}
- />}
+ />
+ )}
</div>
);
}
diff --git a/server/sonar-web/src/main/js/apps/settings/encryption/EncryptionForm.js b/server/sonar-web/src/main/js/apps/settings/encryption/EncryptionForm.js
index c3301970686..e62b431277c 100644
--- a/server/sonar-web/src/main/js/apps/settings/encryption/EncryptionForm.js
+++ b/server/sonar-web/src/main/js/apps/settings/encryption/EncryptionForm.js
@@ -62,7 +62,7 @@ export default class EncryptionForm extends React.PureComponent {
<button className="spacer-left">Encrypt</button>
</form>
- {this.props.encryptedValue != null &&
+ {this.props.encryptedValue != null && (
<div>
Encrypted Value:{' '}
<input
@@ -72,7 +72,8 @@ export default class EncryptionForm extends React.PureComponent {
readOnly={true}
value={this.props.encryptedValue}
/>
- </div>}
+ </div>
+ )}
<div className="huge-spacer-top bordered-top">
<div className="big-spacer-top spacer-bottom">
diff --git a/server/sonar-web/src/main/js/apps/settings/encryption/GenerateSecretKeyForm.js b/server/sonar-web/src/main/js/apps/settings/encryption/GenerateSecretKeyForm.js
index 79166acc968..899c60dcaf0 100644
--- a/server/sonar-web/src/main/js/apps/settings/encryption/GenerateSecretKeyForm.js
+++ b/server/sonar-web/src/main/js/apps/settings/encryption/GenerateSecretKeyForm.js
@@ -34,58 +34,59 @@ export default class GenerateSecretKeyForm extends React.PureComponent {
render() {
return (
<div id="generate-secret-key-form-container">
- {this.props.secretKey != null
- ? <div>
- <div className="big-spacer-bottom">
- <h3 className="spacer-bottom">Secret Key</h3>
- <input
- id="secret-key"
- className="input-large"
- type="text"
- readOnly={true}
- value={this.props.secretKey}
- />
- </div>
+ {this.props.secretKey != null ? (
+ <div>
+ <div className="big-spacer-bottom">
+ <h3 className="spacer-bottom">Secret Key</h3>
+ <input
+ id="secret-key"
+ className="input-large"
+ type="text"
+ readOnly={true}
+ value={this.props.secretKey}
+ />
+ </div>
- <h3 className="spacer-bottom">How To Use</h3>
+ <h3 className="spacer-bottom">How To Use</h3>
- <ul className="list-styled markdown">
- <li className="spacer-bottom">
- Store the secret key in the file <code>~/.sonar/sonar-secret.txt</code> of the
- server. This file can be relocated by defining the property{' '}
- <code>sonar.secretKeyPath</code> in <code>conf/sonar.properties</code>
- </li>
- <li className="spacer-bottom">
- Restrict access to this file by making it readable and by owner only
- </li>
- <li className="spacer-bottom">
- Restart the server if the property <code>sonar.secretKeyPath</code> has been set
- or changed.
- </li>
- <li className="spacer-bottom">
- Copy this file on all the machines that execute code inspection. Define the{' '}
- property <code>sonar.secretKeyPath</code> on those machines if the path is not{' '}
- <code>~/.sonar/sonar-secret.txt</code>.
- </li>
- <li>
- For each property that you want to encrypt, generate the encrypted value and{' '}
- replace the original value wherever it is stored (configuration files, command
- lines).
- </li>
- </ul>
- </div>
- : <div>
- <p className="spacer-bottom">
- Secret key is required to be able to encrypt properties.{' '}
- <a href="https://redirect.sonarsource.com/doc/settings-encryption.html">
- More information
- </a>
- </p>
+ <ul className="list-styled markdown">
+ <li className="spacer-bottom">
+ Store the secret key in the file <code>~/.sonar/sonar-secret.txt</code> of the
+ server. This file can be relocated by defining the property{' '}
+ <code>sonar.secretKeyPath</code> in <code>conf/sonar.properties</code>
+ </li>
+ <li className="spacer-bottom">
+ Restrict access to this file by making it readable and by owner only
+ </li>
+ <li className="spacer-bottom">
+ Restart the server if the property <code>sonar.secretKeyPath</code> has been set or
+ changed.
+ </li>
+ <li className="spacer-bottom">
+ Copy this file on all the machines that execute code inspection. Define the property{' '}
+ <code>sonar.secretKeyPath</code> on those machines if the path is not{' '}
+ <code>~/.sonar/sonar-secret.txt</code>.
+ </li>
+ <li>
+ For each property that you want to encrypt, generate the encrypted value and replace
+ the original value wherever it is stored (configuration files, command lines).
+ </li>
+ </ul>
+ </div>
+ ) : (
+ <div>
+ <p className="spacer-bottom">
+ Secret key is required to be able to encrypt properties.{' '}
+ <a href="https://redirect.sonarsource.com/doc/settings-encryption.html">
+ More information
+ </a>
+ </p>
- <form id="generate-secret-key-form" onSubmit={e => this.handleSubmit(e)}>
- <button>Generate Secret Key</button>
- </form>
- </div>}
+ <form id="generate-secret-key-form" onSubmit={e => this.handleSubmit(e)}>
+ <button>Generate Secret Key</button>
+ </form>
+ </div>
+ )}
</div>
);
}
diff --git a/server/sonar-web/src/main/js/apps/settings/licenses/LicenseChangeForm.js b/server/sonar-web/src/main/js/apps/settings/licenses/LicenseChangeForm.js
index 36fa5ff8a70..afea2682e97 100644
--- a/server/sonar-web/src/main/js/apps/settings/licenses/LicenseChangeForm.js
+++ b/server/sonar-web/src/main/js/apps/settings/licenses/LicenseChangeForm.js
@@ -68,7 +68,7 @@ export default class LicenseChangeForm extends React.PureComponent {
<button className="js-change" onClick={e => this.onClick(e)}>
{translate('update_verb')}
- {this.state.modalOpen &&
+ {this.state.modalOpen && (
<Modal
isOpen={true}
contentLabel="license update"
@@ -77,14 +77,10 @@ export default class LicenseChangeForm extends React.PureComponent {
onRequestClose={this.closeModal}>
<form onSubmit={this.handleSubmit}>
<div className="modal-head">
- <h2>
- {translateWithParameters('licenses.update_license_for_x', productName)}
- </h2>
+ <h2>{translateWithParameters('licenses.update_license_for_x', productName)}</h2>
</div>
<div className="modal-body">
- <label htmlFor="license-input">
- {translate('licenses.license_input_label')}
- </label>
+ <label htmlFor="license-input">{translate('licenses.license_input_label')}</label>
<textarea
autoFocus={true}
className="width-100 spacer-top"
@@ -93,9 +89,7 @@ export default class LicenseChangeForm extends React.PureComponent {
id="license-input"
defaultValue={license.value}
/>
- <div className="spacer-top note">
- {translate('licenses.license_input_note')}
- </div>
+ <div className="spacer-top note">{translate('licenses.license_input_note')}</div>
</div>
<div className="modal-foot">
{this.state.loading && <i className="js-modal-spinner spinner spacer-right" />}
@@ -107,7 +101,8 @@ export default class LicenseChangeForm extends React.PureComponent {
</a>
</div>
</form>
- </Modal>}
+ </Modal>
+ )}
</button>
);
}
diff --git a/server/sonar-web/src/main/js/apps/settings/licenses/LicenseRow.js b/server/sonar-web/src/main/js/apps/settings/licenses/LicenseRow.js
index d6b26fd3a75..56529f76c33 100644
--- a/server/sonar-web/src/main/js/apps/settings/licenses/LicenseRow.js
+++ b/server/sonar-web/src/main/js/apps/settings/licenses/LicenseRow.js
@@ -44,22 +44,17 @@ export default class LicenseRow extends React.PureComponent {
{license.name || license.key}
</div>
</td>
- <td className="js-organization text-middle">
- {license.organization}
- </td>
+ <td className="js-organization text-middle">{license.organization}</td>
<td className="js-expiration text-middle">
- {license.expiration != null &&
+ {license.expiration != null && (
<div className={license.invalidExpiration ? 'text-danger' : null}>
<DateFormatter date={license.expiration} long={true} />
- </div>}
- </td>
- <td className="js-type text-middle">
- {license.type}
+ </div>
+ )}
</td>
+ <td className="js-type text-middle">{license.type}</td>
<td className="js-server-id text-middle">
- <div className={license.invalidServerId ? 'text-danger' : null}>
- {license.serverId}
- </div>
+ <div className={license.invalidServerId ? 'text-danger' : null}>{license.serverId}</div>
</td>
<td className="text-right">
<LicenseChangeForm license={license} onChange={this.handleSet} />
diff --git a/server/sonar-web/src/main/js/apps/settings/licenses/LicensesAppHeader.js b/server/sonar-web/src/main/js/apps/settings/licenses/LicensesAppHeader.js
index c512f32a770..153efb04fa5 100644
--- a/server/sonar-web/src/main/js/apps/settings/licenses/LicensesAppHeader.js
+++ b/server/sonar-web/src/main/js/apps/settings/licenses/LicensesAppHeader.js
@@ -23,9 +23,7 @@ import { translate } from '../../../helpers/l10n';
export default function LicensesAppHeader() {
return (
<header className="page-header">
- <h1 className="page-title">
- {translate('property.category.licenses')}
- </h1>
+ <h1 className="page-title">{translate('property.category.licenses')}</h1>
<div
className="page-description"
dangerouslySetInnerHTML={{ __html: translate('property.category.licenses.description') }}
diff --git a/server/sonar-web/src/main/js/apps/settings/licenses/LicensesList.js b/server/sonar-web/src/main/js/apps/settings/licenses/LicensesList.js
index 91fcdcb1889..da90958613b 100644
--- a/server/sonar-web/src/main/js/apps/settings/licenses/LicensesList.js
+++ b/server/sonar-web/src/main/js/apps/settings/licenses/LicensesList.js
@@ -40,28 +40,18 @@ export default class LicensesList extends React.PureComponent {
<thead>
<tr>
<th width={40}>&nbsp;</th>
- <th>
- {translate('licenses.list.product')}
- </th>
- <th width={150}>
- {translate('licenses.list.organization')}
- </th>
- <th width={150}>
- {translate('licenses.list.expiration')}
- </th>
- <th width={150}>
- {translate('licenses.list.type')}
- </th>
- <th width={150}>
- {translate('licenses.list.server')}
- </th>
+ <th>{translate('licenses.list.product')}</th>
+ <th width={150}>{translate('licenses.list.organization')}</th>
+ <th width={150}>{translate('licenses.list.expiration')}</th>
+ <th width={150}>{translate('licenses.list.type')}</th>
+ <th width={150}>{translate('licenses.list.server')}</th>
<th width={80}>&nbsp;</th>
</tr>
</thead>
<tbody>
- {this.props.licenses.map(licenseKey =>
+ {this.props.licenses.map(licenseKey => (
<LicenseRowContainer key={licenseKey} licenseKey={licenseKey} />
- )}
+ ))}
</tbody>
</table>
);
diff --git a/server/sonar-web/src/main/js/apps/settings/licenses/__tests__/LicensesList-test.js b/server/sonar-web/src/main/js/apps/settings/licenses/__tests__/LicensesList-test.js
index a1335084928..220d0707360 100644
--- a/server/sonar-web/src/main/js/apps/settings/licenses/__tests__/LicensesList-test.js
+++ b/server/sonar-web/src/main/js/apps/settings/licenses/__tests__/LicensesList-test.js
@@ -36,6 +36,16 @@ it('should fetch licenses', () => {
it('should render rows', () => {
const list = shallow(<LicensesList licenses={['foo', 'bar']} fetchLicenses={jest.fn()} />);
expect(list.find(LicenseRowContainer).length).toBe(2);
- expect(list.find(LicenseRowContainer).at(0).prop('licenseKey')).toBe('foo');
- expect(list.find(LicenseRowContainer).at(1).prop('licenseKey')).toBe('bar');
+ expect(
+ list
+ .find(LicenseRowContainer)
+ .at(0)
+ .prop('licenseKey')
+ ).toBe('foo');
+ expect(
+ list
+ .find(LicenseRowContainer)
+ .at(1)
+ .prop('licenseKey')
+ ).toBe('bar');
});
diff --git a/server/sonar-web/src/main/js/apps/settings/serverId/ServerIdApp.js b/server/sonar-web/src/main/js/apps/settings/serverId/ServerIdApp.js
index a6adaec83b9..2edff5822cd 100644
--- a/server/sonar-web/src/main/js/apps/settings/serverId/ServerIdApp.js
+++ b/server/sonar-web/src/main/js/apps/settings/serverId/ServerIdApp.js
@@ -80,16 +80,12 @@ export default class ServerIdApp extends React.PureComponent {
<div id="server-id-page" className="page page-limited">
<Helmet title={translate('property.category.server_id')} />
<header className="page-header">
- <h1 className="page-title">
- {translate('property.category.server_id')}
- </h1>
+ <h1 className="page-title">{translate('property.category.server_id')}</h1>
{this.state.loading && <i className="spinner" />}
- <div className="page-description">
- {translate('server_id_configuration.information')}
- </div>
+ <div className="page-description">{translate('server_id_configuration.information')}</div>
</header>
- {this.state.serverId != null &&
+ {this.state.serverId != null && (
<div className={this.state.invalidServerId ? 'panel panel-danger' : 'panel'}>
Server ID:
<input
@@ -99,11 +95,11 @@ export default class ServerIdApp extends React.PureComponent {
readOnly={true}
value={this.state.serverId}
/>
- {!!this.state.invalidServerId &&
- <span className="spacer-left">
- {translate('server_id_configuration.bad_key')}
- </span>}
- </div>}
+ {!!this.state.invalidServerId && (
+ <span className="spacer-left">{translate('server_id_configuration.bad_key')}</span>
+ )}
+ </div>
+ )}
<div className="panel">
<form id="server-id-form" onSubmit={e => this.handleSubmit(e)}>
@@ -143,11 +139,11 @@ export default class ServerIdApp extends React.PureComponent {
<div className="modal-field-description">
{translate('server_id_configuration.ip.desc')}
<ul className="list-styled">
- {this.state.validIpAddresses.map(ip =>
+ {this.state.validIpAddresses.map(ip => (
<li key={ip} className="little-spacer-top">
{ip}
</li>
- )}
+ ))}
</ul>
</div>
</div>