diff options
author | Grégoire Aubert <gregoire.aubert@sonarsource.com> | 2018-08-07 16:11:31 +0200 |
---|---|---|
committer | SonarTech <sonartech@sonarsource.com> | 2018-08-09 20:20:50 +0200 |
commit | e92f595ae8795ffc8906d84d95b2cc634ff34b72 (patch) | |
tree | 730b1b86600f8c3f258208314aba4c87bed1dad5 /server/sonar-web/src/main/js/apps/quality-profiles | |
parent | a8f14ced18503abb466fefead861ea3d60f7115a (diff) | |
download | sonarqube-e92f595ae8795ffc8906d84d95b2cc634ff34b72.tar.gz sonarqube-e92f595ae8795ffc8906d84d95b2cc634ff34b72.zip |
SONAR-11090 Use rulesUpdatedAt date for stagnant quality profiles
Diffstat (limited to 'server/sonar-web/src/main/js/apps/quality-profiles')
12 files changed, 29 insertions, 31 deletions
diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileExporters.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileExporters.tsx index 5338b2197b7..922d57fd12b 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileExporters.tsx +++ b/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileExporters.tsx @@ -59,9 +59,9 @@ export default class ProfileExporters extends React.PureComponent<Props> { <ul> {exportersForLanguage.map((exporter, index) => ( <li - key={exporter.key} + className={index > 0 ? 'spacer-top' : undefined} data-key={exporter.key} - className={index > 0 ? 'spacer-top' : undefined}> + key={exporter.key}> <a href={this.getExportUrl(exporter)} target="_blank"> {exporter.name} </a> diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileHeader.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileHeader.tsx index d658ab13be7..2315bfcb57b 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileHeader.tsx +++ b/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileHeader.tsx @@ -44,7 +44,7 @@ export default class ProfileHeader extends React.PureComponent<Props> { const { profile } = this.props; let inner = ( <span> - {translate('quality_profiles.updated_')} <ProfileDate date={profile.userUpdatedAt} /> + {translate('quality_profiles.updated_')} <ProfileDate date={profile.rulesUpdatedAt} /> </span> ); if (isStagnant(profile)) { @@ -73,13 +73,13 @@ export default class ProfileHeader extends React.PureComponent<Props> { return ( <header className="page-header quality-profile-header"> <div className="note spacer-bottom"> - <IndexLink to={getProfilesPath(organization)} className="text-muted"> + <IndexLink className="text-muted" to={getProfilesPath(organization)}> {translate('quality_profiles.page')} </IndexLink> {' / '} <Link - to={getProfilesForLanguagePath(profile.language, organization)} - className="text-muted"> + className="text-muted" + to={getProfilesForLanguagePath(profile.language, organization)}> {profile.languageName} </Link> </div> @@ -103,8 +103,8 @@ export default class ProfileHeader extends React.PureComponent<Props> { {this.renderUsageDate()} <li> <Link - to={getProfileChangelogPath(profile.name, profile.language, organization)} - className="button"> + className="button" + to={getProfileChangelogPath(profile.name, profile.language, organization)}> {translate('changelog')} </Link> </li> 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 08e39200ed6..6db2eeb7e33 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 @@ -95,14 +95,14 @@ export default class ProfilePermissionsFormSelect extends React.PureComponent<Pr autoFocus={true} className="Select-big" clearable={false} - isLoading={this.state.loading} // disable default react-select filtering filterOptions={identity} + isLoading={this.state.loading} noResultsText={noResultsText} - optionRenderer={optionRenderer} - options={options} onChange={this.props.onChange} onInputChange={this.handleInputChange} + optionRenderer={optionRenderer} + options={options} placeholder="" searchable={true} value={this.props.selected && getStringValue(this.props.selected)} 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 261f5998c75..a5866f1cc8a 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 @@ -173,8 +173,8 @@ export default class ProfileRules extends React.PureComponent<Props, State> { /> {TYPES.map(type => ( <ProfileRulesRowOfType - key={type} count={this.getRulesCountForType(type)} + key={type} organization={organization} qprofile={profile.key} total={this.getRulesTotalForType(type)} @@ -188,7 +188,7 @@ export default class ProfileRules extends React.PureComponent<Props, State> { profile.actions.edit && !profile.isBuiltIn && ( <div className="text-right big-spacer-top"> - <Link to={activateMoreUrl} className="button js-activate-rules"> + <Link className="button js-activate-rules" to={activateMoreUrl}> {translate('quality_profiles.activate_more')} </Link> </div> @@ -207,8 +207,8 @@ export default class ProfileRules extends React.PureComponent<Props, State> { language={profile.language} organization={organization} profile={profile.key} - sonarway={compareToSonarWay.profile} sonarWayMissingRules={compareToSonarWay.missingRuleCount} + sonarway={compareToSonarWay.profile} /> )} </div> diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileRulesRowOfType.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileRulesRowOfType.tsx index 659e9a2a961..1fe8ab53480 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileRulesRowOfType.tsx +++ b/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileRulesRowOfType.tsx @@ -50,7 +50,7 @@ export default function ProfileRulesRowOfType(props: Props) { <tr> <td> <span> - <IssueTypeIcon query={props.type} className="little-spacer-right" /> + <IssueTypeIcon className="little-spacer-right" query={props.type} /> {translate('issue.type', props.type, 'plural')} </span> </td> @@ -62,7 +62,7 @@ export default function ProfileRulesRowOfType(props: Props) { <td className="thin nowrap text-right"> {inactiveCount != null && (inactiveCount > 0 ? ( - <Link to={inactiveRulesUrl} className="small text-muted"> + <Link className="small text-muted" to={inactiveRulesUrl}> {formatMeasure(inactiveCount, 'SHORT_INT', null)} </Link> ) : ( diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileRulesRowTotal.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileRulesRowTotal.tsx index e75e2b5cd9d..8027c625e0a 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileRulesRowTotal.tsx +++ b/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileRulesRowTotal.tsx @@ -59,7 +59,7 @@ export default function ProfileRulesRowTotal(props: Props) { <td className="thin nowrap text-right"> {inactiveCount != null && (inactiveCount > 0 ? ( - <Link to={inactiveRulesUrl} className="small text-muted"> + <Link className="small text-muted" to={inactiveRulesUrl}> <strong>{formatMeasure(inactiveCount, 'SHORT_INT', null)}</strong> </Link> ) : ( diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/ProfileRulesSonarWayComparison-test.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/ProfileRulesSonarWayComparison-test.tsx index 223c1495e76..0df4f130d58 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/ProfileRulesSonarWayComparison-test.tsx +++ b/server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/ProfileRulesSonarWayComparison-test.tsx @@ -28,8 +28,8 @@ it('should render correctly', () => { language="Java" organization="foo" profile="bar" - sonarway="baz" sonarWayMissingRules={158} + sonarway="baz" /> ) ).toMatchSnapshot(); diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/home/EvolutionDeprecated.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/home/EvolutionDeprecated.tsx index 993afcd1d8e..19323d0685d 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/home/EvolutionDeprecated.tsx +++ b/server/sonar-web/src/main/js/apps/quality-profiles/home/EvolutionDeprecated.tsx @@ -54,7 +54,7 @@ export default function EvolutionDeprecated(props: Props) { </div> <ul> {sortedProfiles.map(profile => ( - <li key={profile.key} className="spacer-top"> + <li className="spacer-top" key={profile.key}> <div className="text-ellipsis"> <ProfileLink className="link-no-underline" @@ -68,8 +68,8 @@ export default function EvolutionDeprecated(props: Props) { {profile.languageName} {', '} <Link - to={getDeprecatedActiveRulesUrl({ qprofile: profile.key }, props.organization)} - className="text-muted"> + className="text-muted" + to={getDeprecatedActiveRulesUrl({ qprofile: profile.key }, props.organization)}> {translateWithParameters( 'quality_profile.x_rules', profile.activeDeprecatedRuleCount diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/home/EvolutionStagnant.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/home/EvolutionStagnant.tsx index 5a9415f8c74..dc6d9fcef31 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/home/EvolutionStagnant.tsx +++ b/server/sonar-web/src/main/js/apps/quality-profiles/home/EvolutionStagnant.tsx @@ -30,9 +30,7 @@ interface Props { } export default function EvolutionStagnant(props: Props) { - // TODO filter built-in out - - const outdated = props.profiles.filter(isStagnant); + const outdated = props.profiles.filter(profile => !profile.isBuiltIn && isStagnant(profile)); if (outdated.length === 0) { return null; @@ -48,7 +46,7 @@ export default function EvolutionStagnant(props: Props) { </div> <ul> {outdated.map(profile => ( - <li key={profile.key} className="spacer-top"> + <li className="spacer-top" key={profile.key}> <div className="text-ellipsis"> <ProfileLink className="link-no-underline" 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 b5be91be330..05faaa8ef8f 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 @@ -80,8 +80,8 @@ 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"> + <div className="boxed-group boxed-group-inner quality-profiles-table" key={languageKey}> + <table className="data zebra zebra-hover" data-language={languageKey}> {profiles !== undefined && this.renderHeader(languageKey, profiles.length)} <tbody>{profiles !== undefined && this.renderProfiles(profiles)}</tbody> </table> diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/home/ProfilesListRow.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/home/ProfilesListRow.tsx index 69fbf16ae2e..5fb2c5e1fac 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/home/ProfilesListRow.tsx +++ b/server/sonar-web/src/main/js/apps/quality-profiles/home/ProfilesListRow.tsx @@ -96,7 +96,7 @@ export default class ProfilesListRow extends React.PureComponent<Props> { {profile.activeDeprecatedRuleCount > 0 && ( <span className="spacer-right"> <Tooltip overlay={translate('quality_profiles.deprecated_rules')}> - <Link to={deprecatedRulesUrl} className="badge badge-normal-size badge-danger-light"> + <Link className="badge badge-normal-size badge-danger-light" to={deprecatedRulesUrl}> {profile.activeDeprecatedRuleCount} </Link> </Tooltip> @@ -109,7 +109,7 @@ export default class ProfilesListRow extends React.PureComponent<Props> { } renderUpdateDate() { - const date = <ProfileDate date={this.props.profile.userUpdatedAt} />; + const date = <ProfileDate date={this.props.profile.rulesUpdatedAt} />; if (isStagnant(this.props.profile)) { return <span className="badge badge-normal-size badge-focus">{date}</span>; } else { diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/utils.ts b/server/sonar-web/src/main/js/apps/quality-profiles/utils.ts index c0e23eeaf9f..e8f7c146052 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/utils.ts +++ b/server/sonar-web/src/main/js/apps/quality-profiles/utils.ts @@ -67,8 +67,8 @@ export function createFakeProfile(overrides?: any) { } export function isStagnant(profile: Profile): boolean { - if (profile.userUpdatedAt) { - const updateDate = parseDate(profile.userUpdatedAt); + if (profile.rulesUpdatedAt) { + const updateDate = parseDate(profile.rulesUpdatedAt); if (isValidDate(updateDate)) { return differenceInYears(new Date(), updateDate) >= 1; } |