diff options
author | Stas Vilchik <stas.vilchik@sonarsource.com> | 2017-10-25 16:53:22 +0200 |
---|---|---|
committer | Stas Vilchik <stas.vilchik@sonarsource.com> | 2017-10-30 09:20:37 +0100 |
commit | e4ef72e885308b113d89a7826d1b300c093134cf (patch) | |
tree | d747d066447c0924cf2cfb108bf107a8effd0144 /server/sonar-web/src/main/js/apps/quality-profiles | |
parent | eea79d51b8894ef98f1cd02388d06062df343e4d (diff) | |
download | sonarqube-e4ef72e885308b113d89a7826d1b300c093134cf.tar.gz sonarqube-e4ef72e885308b113d89a7826d1b300c093134cf.zip |
update web dependencies (#2752)
Diffstat (limited to 'server/sonar-web/src/main/js/apps/quality-profiles')
24 files changed, 173 insertions, 149 deletions
diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/changelog/ChangelogContainer.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/changelog/ChangelogContainer.tsx index 9d05395586e..77329207900 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/changelog/ChangelogContainer.tsx +++ b/server/sonar-web/src/main/js/apps/quality-profiles/changelog/ChangelogContainer.tsx @@ -185,9 +185,9 @@ export default class ChangelogContainer extends React.PureComponent<Props, State {this.state.events != null && this.state.events.length === 0 && <ChangelogEmpty />} {this.state.events != null && - this.state.events.length > 0 && ( - <Changelog events={this.state.events} organization={this.props.organization} /> - )} + this.state.events.length > 0 && ( + <Changelog events={this.state.events} organization={this.props.organization} /> + )} {shouldDisplayFooter && ( <footer className="text-center spacer-top small"> diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/changelog/ParameterChange.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/changelog/ParameterChange.tsx index e8d2ec75551..40e0fa89018 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/changelog/ParameterChange.tsx +++ b/server/sonar-web/src/main/js/apps/quality-profiles/changelog/ParameterChange.tsx @@ -28,11 +28,12 @@ interface Props { export default function ParameterChange({ name, value }: Props) { return ( <div className="quality-profile-changelog-parameter"> - {value == null ? ( - translateWithParameters('quality_profiles.changelog.parameter_reset_to_default_value', name) - ) : ( - translateWithParameters('quality_profiles.parameter_set_to', name, value) - )} + {value == null + ? translateWithParameters( + 'quality_profiles.changelog.parameter_reset_to_default_value', + name + ) + : translateWithParameters('quality_profiles.parameter_set_to', name, value)} </div> ); } diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/compare/ComparisonContainer.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/compare/ComparisonContainer.tsx index a71123b1927..173d1d0dbb3 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/compare/ComparisonContainer.tsx +++ b/server/sonar-web/src/main/js/apps/quality-profiles/compare/ComparisonContainer.tsx @@ -126,21 +126,21 @@ export default class ComparisonContainer extends React.PureComponent<Props, Stat </header> {left != null && - inLeft != null && - right != null && - inRight != null && - modified != null && ( - <div className="spacer-top"> - <ComparisonResults - left={left} - right={right} - inLeft={inLeft} - inRight={inRight} - modified={modified} - organization={this.props.organization} - /> - </div> - )} + inLeft != null && + right != null && + inRight != null && + modified != null && ( + <div className="spacer-top"> + <ComparisonResults + left={left} + right={right} + inLeft={inLeft} + inRight={inRight} + modified={modified} + organization={this.props.organization} + /> + </div> + )} </div> ); } diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/compare/ComparisonForm.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/compare/ComparisonForm.tsx index bee2e948e07..384c0cf3525 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/compare/ComparisonForm.tsx +++ b/server/sonar-web/src/main/js/apps/quality-profiles/compare/ComparisonForm.tsx @@ -18,7 +18,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import * as React from 'react'; -import * as Select from 'react-select'; +import Select from 'react-select'; import { translate } from '../../../helpers/l10n'; import { Profile } from '../types'; diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/components/CopyProfileForm.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/components/CopyProfileForm.tsx index 70f58f01ea6..963b09cd24e 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/components/CopyProfileForm.tsx +++ b/server/sonar-web/src/main/js/apps/quality-profiles/components/CopyProfileForm.tsx @@ -18,7 +18,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import * as React from 'react'; -import Modal from 'react-modal'; +import * as Modal from 'react-modal'; import { copyProfile } from '../../../api/quality-profiles'; import { translate, translateWithParameters } from '../../../helpers/l10n'; import { Profile } from '../types'; diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/components/DeleteProfileForm.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/components/DeleteProfileForm.tsx index 9a25f9c3007..99b85e7aad9 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/components/DeleteProfileForm.tsx +++ b/server/sonar-web/src/main/js/apps/quality-profiles/components/DeleteProfileForm.tsx @@ -18,7 +18,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import * as React from 'react'; -import Modal from 'react-modal'; +import * as Modal from 'react-modal'; import { deleteProfile } from '../../../api/quality-profiles'; import { translate, translateWithParameters } from '../../../helpers/l10n'; import { Profile } from '../types'; diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/components/ProfileActions.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/components/ProfileActions.tsx index 164943c43c4..8906db09a3b 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/components/ProfileActions.tsx +++ b/server/sonar-web/src/main/js/apps/quality-profiles/components/ProfileActions.tsx @@ -134,11 +134,11 @@ export default class ProfileActions extends React.PureComponent<Props, State> { return ( <ul className="dropdown-menu dropdown-menu-right"> {actions.edit && - !profile.isBuiltIn && ( - <li> - <Link to={activateMoreUrl}>{translate('quality_profiles.activate_more_rules')}</Link> - </li> - )} + !profile.isBuiltIn && ( + <li> + <Link to={activateMoreUrl}>{translate('quality_profiles.activate_more_rules')}</Link> + </li> + )} {!profile.isBuiltIn && ( <li> <a id="quality-profile-backup" href={backupUrl}> @@ -161,30 +161,30 @@ export default class ProfileActions extends React.PureComponent<Props, State> { </li> )} {actions.edit && - !profile.isBuiltIn && ( - <li> - <a id="quality-profile-rename" href="#" onClick={this.handleRenameClick}> - {translate('rename')} - </a> - </li> - )} + !profile.isBuiltIn && ( + <li> + <a id="quality-profile-rename" href="#" onClick={this.handleRenameClick}> + {translate('rename')} + </a> + </li> + )} {actions.setAsDefault && - !profile.isDefault && ( - <li> - <a id="quality-profile-set-as-default" href="#" onClick={this.handleSetDefaultClick}> - {translate('set_as_default')} - </a> - </li> - )} + !profile.isDefault && ( + <li> + <a id="quality-profile-set-as-default" href="#" onClick={this.handleSetDefaultClick}> + {translate('set_as_default')} + </a> + </li> + )} {actions.edit && - !profile.isDefault && - !profile.isBuiltIn && ( - <li> - <a id="quality-profile-delete" href="#" onClick={this.handleDeleteClick}> - {translate('delete')} - </a> - </li> - )} + !profile.isDefault && + !profile.isBuiltIn && ( + <li> + <a id="quality-profile-delete" href="#" onClick={this.handleDeleteClick}> + {translate('delete')} + </a> + </li> + )} {this.state.copyFormOpen && ( <CopyProfileForm diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/components/RenameProfileForm.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/components/RenameProfileForm.tsx index d8c4951f02c..33cc3e4c9f8 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/components/RenameProfileForm.tsx +++ b/server/sonar-web/src/main/js/apps/quality-profiles/components/RenameProfileForm.tsx @@ -18,7 +18,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import * as React from 'react'; -import Modal from 'react-modal'; +import * as Modal from 'react-modal'; import { renameProfile } from '../../../api/quality-profiles'; import { translate, translateWithParameters } from '../../../helpers/l10n'; import { Profile } from '../types'; diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/details/ChangeParentForm.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/details/ChangeParentForm.tsx index 2327cd7acc0..204d6ff0348 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/details/ChangeParentForm.tsx +++ b/server/sonar-web/src/main/js/apps/quality-profiles/details/ChangeParentForm.tsx @@ -18,8 +18,8 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import * as React from 'react'; -import Modal from 'react-modal'; -import * as Select from 'react-select'; +import * as Modal from 'react-modal'; +import Select from 'react-select'; import { sortBy } from 'lodash'; import { changeProfileParent } from '../../../api/quality-profiles'; import { translate } from '../../../helpers/l10n'; @@ -120,11 +120,9 @@ export default class ChangeParentForm extends React.PureComponent<Props, State> onChange={this.handleSelectChange} options={options} value={ - this.state.selected != null ? ( - this.state.selected - ) : ( - this.props.profile.parentKey || '' - ) + this.state.selected != null + ? this.state.selected + : this.props.profile.parentKey || '' } /> </div> diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/details/ChangeProjectsForm.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/details/ChangeProjectsForm.tsx index 3467fb01b19..6e1095c4eac 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/details/ChangeProjectsForm.tsx +++ b/server/sonar-web/src/main/js/apps/quality-profiles/details/ChangeProjectsForm.tsx @@ -18,7 +18,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import * as React from 'react'; -import Modal from 'react-modal'; +import * as Modal from 'react-modal'; import * as escapeHtml from 'escape-html'; import SelectList from '../../../components/SelectList'; import { translate } from '../../../helpers/l10n'; diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileDetails.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileDetails.tsx index 524a148dadd..4ffed5d56cc 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileDetails.tsx +++ b/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileDetails.tsx @@ -43,10 +43,13 @@ export default function ProfileDetails(props: Props) { <ProfileRules {...props} /> <ProfileExporters {...props} /> {profile.actions && - profile.actions.edit && - !profile.isBuiltIn && ( - <ProfilePermissions organization={props.organization || undefined} profile={profile} /> - )} + profile.actions.edit && + !profile.isBuiltIn && ( + <ProfilePermissions + organization={props.organization || undefined} + profile={profile} + /> + )} </div> <div className="quality-profile-grid-right"> <ProfileInheritance {...props} /> diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileInheritance.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileInheritance.tsx index 77f8a92a7f1..290ea8f3bb0 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileInheritance.tsx +++ b/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileInheritance.tsx @@ -120,14 +120,16 @@ export default class ProfileInheritance extends React.PureComponent<Props, State return ( <div className="boxed-group quality-profile-inheritance"> {profile.actions && - profile.actions.edit && - !profile.isBuiltIn && ( - <div className="boxed-group-actions"> - <button className="pull-right js-change-parent" onClick={this.handleChangeParentClick}> - {translate('quality_profiles.change_parent')} - </button> - </div> - )} + profile.actions.edit && + !profile.isBuiltIn && ( + <div className="boxed-group-actions"> + <button + className="pull-right js-change-parent" + onClick={this.handleChangeParentClick}> + {translate('quality_profiles.change_parent')} + </button> + </div> + )} <header className="boxed-group-header"> <h2>{translate('quality_profiles.profile_inheritance')}</h2> diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfilePermissionsForm.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfilePermissionsForm.tsx index 8d892127fc7..2431856c53c 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfilePermissionsForm.tsx +++ b/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfilePermissionsForm.tsx @@ -18,7 +18,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import * as React from 'react'; -import Modal from 'react-modal'; +import * as Modal from 'react-modal'; import ProfilePermissionsFormSelect from './ProfilePermissionsFormSelect'; import { searchUsers, diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfilePermissionsFormSelect.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfilePermissionsFormSelect.tsx index 911bf55cca4..fcf87c6cbe7 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfilePermissionsFormSelect.tsx +++ b/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfilePermissionsFormSelect.tsx @@ -18,7 +18,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import * as React from 'react'; -import * as Select from 'react-select'; +import Select from 'react-select'; import { debounce, identity } from 'lodash'; import { User, Group } from './ProfilePermissions'; import Avatar from '../../../components/ui/Avatar'; diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileProjects.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileProjects.tsx index b809abd6a6f..9b1acd46c8e 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileProjects.tsx +++ b/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileProjects.tsx @@ -130,14 +130,14 @@ export default class ProfileProjects extends React.PureComponent<Props, State> { return ( <div className="boxed-group quality-profile-projects"> {profile.actions && - profile.actions.edit && - !profile.isDefault && ( - <div className="boxed-group-actions"> - <button className="js-change-projects" onClick={this.handleChangeClick}> - {translate('quality_profiles.change_projects')} - </button> - </div> - )} + profile.actions.edit && + !profile.isDefault && ( + <div className="boxed-group-actions"> + <button className="js-change-projects" onClick={this.handleChangeClick}> + {translate('quality_profiles.change_projects')} + </button> + </div> + )} <header className="boxed-group-header"> <h2>{translate('projects')}</h2> diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileRules.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileRules.tsx index b2ab6732921..facde0a4a34 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileRules.tsx +++ b/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileRules.tsx @@ -184,14 +184,14 @@ export default class ProfileRules extends React.PureComponent<Props, State> { </table> {profile.actions && - profile.actions.edit && - !profile.isBuiltIn && ( - <div className="text-right big-spacer-top"> - <Link to={activateMoreUrl} className="button js-activate-rules"> - {translate('quality_profiles.activate_more')} - </Link> - </div> - )} + profile.actions.edit && + !profile.isBuiltIn && ( + <div className="text-right big-spacer-top"> + <Link to={activateMoreUrl} className="button js-activate-rules"> + {translate('quality_profiles.activate_more')} + </Link> + </div> + )} </div> {profile.activeDeprecatedRuleCount > 0 && ( <ProfileRulesDeprecatedWarning @@ -201,15 +201,15 @@ export default class ProfileRules extends React.PureComponent<Props, State> { /> )} {compareToSonarWay != null && - compareToSonarWay.missingRuleCount > 0 && ( - <ProfileRulesSonarWayComparison - language={profile.language} - organization={organization} - profile={profile.key} - sonarway={compareToSonarWay.profile} - sonarWayMissingRules={compareToSonarWay.missingRuleCount} - /> - )} + compareToSonarWay.missingRuleCount > 0 && ( + <ProfileRulesSonarWayComparison + language={profile.language} + organization={organization} + profile={profile.key} + sonarway={compareToSonarWay.profile} + sonarWayMissingRules={compareToSonarWay.missingRuleCount} + /> + )} </div> ); } diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/__snapshots__/ProfilePermissions-test.tsx.snap b/server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/__snapshots__/ProfilePermissions-test.tsx.snap index 806ca57c73c..9dd2c1d6c47 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/__snapshots__/ProfilePermissions-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/__snapshots__/ProfilePermissions-test.tsx.snap @@ -45,6 +45,7 @@ exports[`renders 2`] = ` className="big-spacer-top" > <ProfilePermissionsUser + key="luke" onDelete={[Function]} profile={ Object { @@ -65,6 +66,7 @@ exports[`renders 2`] = ` "name": "Lambda", } } + key="Lambda" onDelete={[Function]} profile={ Object { diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/__snapshots__/ProfilePermissionsForm-test.tsx.snap b/server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/__snapshots__/ProfilePermissionsForm-test.tsx.snap index d8b0f2354d0..7acbdb7e005 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/__snapshots__/ProfilePermissionsForm-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/__snapshots__/ProfilePermissionsForm-test.tsx.snap @@ -12,7 +12,9 @@ exports[`adds group 1`] = ` overlayClassName="modal-overlay" parentSelector={[Function]} portalClassName="ReactModalPortal" + shouldCloseOnEsc={true} shouldCloseOnOverlayClick={true} + shouldFocusAfterRender={true} > <header className="modal-head" @@ -72,7 +74,9 @@ exports[`adds group 2`] = ` overlayClassName="modal-overlay" parentSelector={[Function]} portalClassName="ReactModalPortal" + shouldCloseOnEsc={true} shouldCloseOnOverlayClick={true} + shouldFocusAfterRender={true} > <header className="modal-head" @@ -137,7 +141,9 @@ exports[`adds group 3`] = ` overlayClassName="modal-overlay" parentSelector={[Function]} portalClassName="ReactModalPortal" + shouldCloseOnEsc={true} shouldCloseOnOverlayClick={true} + shouldFocusAfterRender={true} > <header className="modal-head" @@ -205,7 +211,9 @@ exports[`adds user 1`] = ` overlayClassName="modal-overlay" parentSelector={[Function]} portalClassName="ReactModalPortal" + shouldCloseOnEsc={true} shouldCloseOnOverlayClick={true} + shouldFocusAfterRender={true} > <header className="modal-head" @@ -265,7 +273,9 @@ exports[`adds user 2`] = ` overlayClassName="modal-overlay" parentSelector={[Function]} portalClassName="ReactModalPortal" + shouldCloseOnEsc={true} shouldCloseOnOverlayClick={true} + shouldFocusAfterRender={true} > <header className="modal-head" @@ -330,7 +340,9 @@ exports[`adds user 3`] = ` overlayClassName="modal-overlay" parentSelector={[Function]} portalClassName="ReactModalPortal" + shouldCloseOnEsc={true} shouldCloseOnOverlayClick={true} + shouldFocusAfterRender={true} > <header className="modal-head" diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/__snapshots__/ProfilePermissionsFormSelect-test.tsx.snap b/server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/__snapshots__/ProfilePermissionsFormSelect-test.tsx.snap index 10e1ea582f7..818fc5af342 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/__snapshots__/ProfilePermissionsFormSelect-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/__snapshots__/ProfilePermissionsFormSelect-test.tsx.snap @@ -13,6 +13,7 @@ exports[`renders 1`] = ` clearRenderer={[Function]} clearValueText="Clear value" clearable={false} + closeOnSelect={true} deleteRemoves={true} delimiter="," disabled={false} @@ -34,6 +35,8 @@ exports[`renders 1`] = ` onChange={[Function]} onCloseResetsInput={true} onInputChange={[Function]} + onSelectResetsInput={true} + openOnClick={true} optionComponent={[Function]} optionRenderer={[Function]} options={Array []} diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/__snapshots__/ProfileRules-test.tsx.snap b/server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/__snapshots__/ProfileRules-test.tsx.snap index 315e117ffba..6d92fb9ab26 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/__snapshots__/ProfileRules-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/__snapshots__/ProfileRules-test.tsx.snap @@ -28,12 +28,14 @@ exports[`should render the quality profiles rules with sonarway comparison 1`] = <tbody> <ProfileRulesRowTotal count={68} + key="all" organization="foo" qprofile="foo" total={243} /> <ProfileRulesRowOfType count={68} + key="BUG" organization="foo" qprofile="foo" total={68} @@ -41,6 +43,7 @@ exports[`should render the quality profiles rules with sonarway comparison 1`] = /> <ProfileRulesRowOfType count={0} + key="VULNERABILITY" organization="foo" qprofile="foo" total={7} @@ -48,6 +51,7 @@ exports[`should render the quality profiles rules with sonarway comparison 1`] = /> <ProfileRulesRowOfType count={0} + key="CODE_SMELL" organization="foo" qprofile="foo" total={168} diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/home/CreateProfileForm.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/home/CreateProfileForm.tsx index ed4dbb325ac..a58a721f00e 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/home/CreateProfileForm.tsx +++ b/server/sonar-web/src/main/js/apps/quality-profiles/home/CreateProfileForm.tsx @@ -18,8 +18,8 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import * as React from 'react'; -import Modal from 'react-modal'; -import * as Select from 'react-select'; +import * as Modal from 'react-modal'; +import Select from 'react-select'; import { sortBy } from 'lodash'; import { getImporters, createQualityProfile } from '../../../api/quality-profiles'; import { translate } from '../../../helpers/l10n'; diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/home/EvolutionRules.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/home/EvolutionRules.tsx index 9ff9410a37c..bc4c085d89e 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/home/EvolutionRules.tsx +++ b/server/sonar-web/src/main/js/apps/quality-profiles/home/EvolutionRules.tsx @@ -121,18 +121,16 @@ export default class EvolutionRules extends React.PureComponent<Props, State> { {rule.name} </Link> <div className="note"> - {rule.activations ? ( - translateWithParameters( - 'quality_profiles.latest_new_rules.activated', - rule.langName, - rule.activations - ) - ) : ( - translateWithParameters( - 'quality_profiles.latest_new_rules.not_activated', - rule.langName - ) - )} + {rule.activations + ? translateWithParameters( + 'quality_profiles.latest_new_rules.activated', + rule.langName, + rule.activations + ) + : translateWithParameters( + 'quality_profiles.latest_new_rules.not_activated', + rule.langName + )} </div> </div> </li> diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/home/ProfilesList.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/home/ProfilesList.tsx index 49674ef4d46..da5b8b61732 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/home/ProfilesList.tsx +++ b/server/sonar-web/src/main/js/apps/quality-profiles/home/ProfilesList.tsx @@ -71,6 +71,17 @@ export default class ProfilesList extends React.PureComponent<Props> { ); } + renderLanguage = (languageKey: string, profiles: Profile[] | undefined) => { + return ( + <div key={languageKey} className="boxed-group boxed-group-inner quality-profiles-table"> + <table data-language={languageKey} className="data zebra zebra-hover"> + {profiles !== undefined && this.renderHeader(languageKey, profiles.length)} + <tbody>{profiles !== undefined && this.renderProfiles(profiles)}</tbody> + </table> + </div> + ); + }; + render() { const { profiles, languages } = this.props; const { language } = this.props.location.query; @@ -80,9 +91,7 @@ export default class ProfilesList extends React.PureComponent<Props> { profile => profile.language ); - const profilesToShow: { [language: string]: Profile[] } = language - ? pick(profilesIndex, language) - : profilesIndex; + const profilesToShow = language ? pick(profilesIndex, language) : profilesIndex; const languagesToShow = sortBy(Object.keys(profilesToShow)); @@ -98,19 +107,9 @@ export default class ProfilesList extends React.PureComponent<Props> { <div className="alert alert-warning spacer-top">{translate('no_results')}</div> )} - {languagesToShow.map(languageKey => ( - <div key={languageKey} className="boxed-group boxed-group-inner quality-profiles-table"> - <table data-language={languageKey} className="data zebra zebra-hover"> - {profilesToShow[languageKey] != null && - this.renderHeader(languageKey, profilesToShow[languageKey].length)} - - <tbody> - {profilesToShow[languageKey] != null && - this.renderProfiles(profilesToShow[languageKey])} - </tbody> - </table> - </div> - ))} + {languagesToShow.map(languageKey => + this.renderLanguage(languageKey, profilesToShow[languageKey]) + )} </div> ); } diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/home/RestoreProfileForm.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/home/RestoreProfileForm.tsx index 021f5951af8..b63924e5a28 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/home/RestoreProfileForm.tsx +++ b/server/sonar-web/src/main/js/apps/quality-profiles/home/RestoreProfileForm.tsx @@ -18,7 +18,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import * as React from 'react'; -import Modal from 'react-modal'; +import * as Modal from 'react-modal'; import { restoreQualityProfile } from '../../../api/quality-profiles'; import { translate, translateWithParameters } from '../../../helpers/l10n'; @@ -102,23 +102,25 @@ export default class RestoreProfileForm extends React.PureComponent<Props, State </div> <div className="modal-body"> - {profile != null && ruleSuccesses != null ? ruleFailures ? ( - <div className="alert alert-warning"> - {translateWithParameters( - 'quality_profiles.restore_profile.warning', - profile.name, - ruleSuccesses, - ruleFailures - )} - </div> - ) : ( - <div className="alert alert-success"> - {translateWithParameters( - 'quality_profiles.restore_profile.success', - profile.name, - ruleSuccesses - )} - </div> + {profile != null && ruleSuccesses != null ? ( + ruleFailures ? ( + <div className="alert alert-warning"> + {translateWithParameters( + 'quality_profiles.restore_profile.warning', + profile.name, + ruleSuccesses, + ruleFailures + )} + </div> + ) : ( + <div className="alert alert-success"> + {translateWithParameters( + 'quality_profiles.restore_profile.success', + profile.name, + ruleSuccesses + )} + </div> + ) ) : ( <div className="modal-field"> <label htmlFor="restore-profile-backup"> |