import {
CellComponent,
ContentCell,
+ FlagMessage,
Link,
Note,
Table,
} from 'design-system';
import { sortBy } from 'lodash';
import * as React from 'react';
-import { useIntl } from 'react-intl';
+import { FormattedMessage, useIntl } from 'react-intl';
import DateTimeFormatter from '../../../components/intl/DateTimeFormatter';
import { CleanCodeAttributePill } from '../../../components/shared/CleanCodeAttributePill';
import SoftwareImpactPill from '../../../components/shared/SoftwareImpactPill';
(e) => e.action,
);
+ const isSameEventDate = (thisEvent: ProfileChangelogEvent, otherEvent?: ProfileChangelogEvent) =>
+ otherEvent !== undefined && isSameMinute(parseDate(otherEvent.date), parseDate(thisEvent.date));
+
+ const isSameEventGroup = (thisEvent: ProfileChangelogEvent, otherEvent?: ProfileChangelogEvent) =>
+ otherEvent !== undefined &&
+ isSameEventDate(thisEvent, otherEvent) &&
+ otherEvent.authorName === thisEvent.authorName &&
+ otherEvent.action === thisEvent.action;
+
const rows = sortedRows.map((event, index) => {
- const prev = index > 0 ? sortedRows[index - 1] : null;
- const isSameDate = prev != null && isSameMinute(parseDate(prev.date), parseDate(event.date));
- const isBulkChange =
- prev != null &&
- isSameDate &&
- prev.authorName === event.authorName &&
- prev.action === event.action;
+ const prev = sortedRows[index - 1];
+ const isBulkChange = isSameEventGroup(event, prev);
+
+ const nextEventInDifferentGroup = sortedRows
+ .slice(index + 1)
+ .find((e) => !isSameEventGroup(event, e));
+
+ const isNewSonarQubeVersion =
+ !isBulkChange &&
+ nextEventInDifferentGroup !== undefined &&
+ nextEventInDifferentGroup.sonarQubeVersion !== event.sonarQubeVersion;
return (
<TableRowInteractive key={index}>
- <ContentCell className="sw-whitespace-nowrap sw-align-top">
- {!isBulkChange && <DateTimeFormatter date={event.date} />}
+ <ContentCell className="sw-align-top">
+ {!isBulkChange && (
+ <div>
+ <span className="sw-whitespace-nowrap">
+ <DateTimeFormatter date={event.date} />
+ </span>
+
+ {isNewSonarQubeVersion && (
+ <div className="sw-mt-2 sw-whitespace-nowrap">
+ <FlagMessage variant="info">
+ <FormattedMessage
+ id="quality_profiles.changelog.sq_upgrade"
+ values={{
+ sqVersion: event.sonarQubeVersion,
+ }}
+ />
+ </FlagMessage>
+ </div>
+ )}
+ </div>
+ )}
</ContentCell>
<ContentCell className="sw-whitespace-nowrap sw-align-top sw-max-w-[120px]">
quality_profiles.changelog.impact_changed=Software impact set to {newSoftwareQuality} with severity {newSeverity}, was {oldSoftwareQuality} with severity {oldSeverity}
quality_profiles.changelog.impact_added=Software impact {newSoftwareQuality} with severity {newSeverity} was added
quality_profiles.changelog.impact_removed=Software impact {oldSoftwareQuality} with severity {oldSeverity} was removed
+quality_profiles.changelog.sq_upgrade=Instance upgraded to SonarQube {sqVersion}
quality_profiles.deleted_profile=The profile {0} doesn't exist anymore
quality_profiles.projects_for_default=Every project not specifically associated with a quality profile will be associated to this one by default.
quality_profile.x_rules={count} rule(s)