From: 7PH Date: Tue, 3 Oct 2023 09:15:37 +0000 (+0200) Subject: SONAR-20366 Migrate profile changelog page to MIUI X-Git-Tag: 10.3.0.82913~290 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=de7a6f1b14703043705718aa4a74b460cdd817b2;p=sonarqube.git SONAR-20366 Migrate profile changelog page to MIUI --- diff --git a/server/sonar-web/design-system/src/components/input/DateRangePicker.tsx b/server/sonar-web/design-system/src/components/input/DateRangePicker.tsx index 393946732ea..8c917da71b2 100644 --- a/server/sonar-web/design-system/src/components/input/DateRangePicker.tsx +++ b/server/sonar-web/design-system/src/components/input/DateRangePicker.tsx @@ -21,6 +21,7 @@ import classNames from 'classnames'; import { max, min } from 'date-fns'; import * as React from 'react'; import { PopupZLevel } from '../../helpers'; +import { InputSizeKeys } from '../../types'; import { LightLabel } from '../Text'; import { DatePicker } from './DatePicker'; @@ -34,6 +35,7 @@ interface Props { className?: string; clearButtonLabel: string; fromLabel: string; + inputSize?: InputSizeKeys; maxDate?: Date; minDate?: Date; onChange: (date: DateRange) => void; @@ -75,6 +77,7 @@ export class DateRangePicker extends React.PureComponent { alignEndDateCalandarRight, clearButtonLabel, fromLabel, + inputSize = 'full', minDate, maxDate, separatorText, @@ -95,7 +98,7 @@ export class DateRangePicker extends React.PureComponent { minDate={minDate} onChange={this.handleFromChange} placeholder={fromLabel} - size="full" + size={inputSize} value={this.from} valueFormatter={valueFormatter} zLevel={zLevel} @@ -115,7 +118,7 @@ export class DateRangePicker extends React.PureComponent { minDate={minDate && this.from ? max([minDate, this.from]) : minDate ?? this.from} onChange={this.handleToChange} placeholder={toLabel} - size="full" + size={inputSize} value={this.to} valueFormatter={valueFormatter} zLevel={zLevel} diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/changelog/Changelog.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/changelog/Changelog.tsx index f5c9c7fac3d..28ecbf03029 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/changelog/Changelog.tsx +++ b/server/sonar-web/src/main/js/apps/quality-profiles/changelog/Changelog.tsx @@ -18,12 +18,12 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import { isSameMinute } from 'date-fns'; +import { ContentCell, Link, Note, Table, TableRow, TableRowInteractive } from 'design-system'; import { sortBy } from 'lodash'; import * as React from 'react'; -import Link from '../../../components/common/Link'; +import { useIntl } from 'react-intl'; import DateTimeFormatter from '../../../components/intl/DateTimeFormatter'; import { parseDate } from '../../../helpers/dates'; -import { translate } from '../../../helpers/l10n'; import { getRulesUrl } from '../../../helpers/urls'; import { ProfileChangelogEvent } from '../types'; import ChangesList from './ChangesList'; @@ -33,6 +33,8 @@ interface Props { } export default function Changelog(props: Props) { + const intl = useIntl(); + let isEvenRow = false; const sortedRows = sortBy( props.events, @@ -54,46 +56,44 @@ export default function Changelog(props: Props) { isEvenRow = !isEvenRow; } - const className = 'js-profile-changelog-event ' + (isEvenRow ? 'even' : 'odd'); - return ( - - {!isBulkChange && } + + + {!isBulkChange && } + - - {!isBulkChange && - (event.authorName ? ( - {event.authorName} - ) : ( - System - ))} - + + {!isBulkChange && (event.authorName ? event.authorName : System)} + - - {!isBulkChange && translate('quality_profiles.changelog', event.action)} - + + {!isBulkChange && + intl.formatMessage({ id: `quality_profiles.changelog.${event.action}` })} + - + {event.ruleName} - + - {event.params && } - + {event.params && } + ); }); return ( - - - - - - - - - - - {rows} -
{translate('date')}{translate('user')}{translate('action')}{translate('rule')}{translate('parameters')}
+ + {intl.formatMessage({ id: 'date' })} + {intl.formatMessage({ id: 'user' })} + {intl.formatMessage({ id: 'action' })} + {intl.formatMessage({ id: 'rule' })} + {intl.formatMessage({ id: 'updates' })} + + } + > + {rows} +
); } 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 4d0507c2dea..b78462000cc 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 @@ -17,10 +17,10 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ +import { ButtonSecondary, Spinner } from 'design-system'; import * as React from 'react'; import { ChangelogResponse, getProfileChangelog } from '../../../api/quality-profiles'; import { Location, Router, withRouter } from '../../../components/hoc/withRouter'; -import Spinner from '../../../components/ui/Spinner'; import { parseDate, toISO8601WithOffsetString } from '../../../helpers/dates'; import { translate } from '../../../helpers/l10n'; import { withQualityProfilesContext } from '../qualityProfilesContext'; @@ -137,8 +137,8 @@ class ChangelogContainer extends React.PureComponent { this.state.events.length < this.state.total; return ( -
-
+
+
{ onDateRangeChange={this.handleDateRangeChange} onReset={this.handleReset} /> - +
{this.state.events != null && this.state.events.length === 0 && } @@ -157,10 +157,10 @@ class ChangelogContainer extends React.PureComponent { )} {shouldDisplayFooter && ( -
diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/changelog/ChangelogEmpty.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/changelog/ChangelogEmpty.tsx index 9c51644b1f5..2159594477f 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/changelog/ChangelogEmpty.tsx +++ b/server/sonar-web/src/main/js/apps/quality-profiles/changelog/ChangelogEmpty.tsx @@ -18,8 +18,10 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import * as React from 'react'; -import { translate } from '../../../helpers/l10n'; +import { useIntl } from 'react-intl'; export default function ChangelogEmpty() { - return
{translate('no_results')}
; + const intl = useIntl(); + + return
{intl.formatMessage({ id: 'no_results' })}
; } diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/changelog/ChangelogSearch.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/changelog/ChangelogSearch.tsx index 6cb2ad54a74..8fcec92577b 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/changelog/ChangelogSearch.tsx +++ b/server/sonar-web/src/main/js/apps/quality-profiles/changelog/ChangelogSearch.tsx @@ -17,10 +17,9 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ +import { ButtonSecondary, DateRangePicker } from 'design-system'; import * as React from 'react'; -import { Button } from '../../../components/controls/buttons'; -import DateRangeInput from '../../../components/controls/DateRangeInput'; -import { translate } from '../../../helpers/l10n'; +import { useIntl } from 'react-intl'; interface ChangelogSearchProps { dateRange: { from?: Date; to?: Date } | undefined; @@ -30,12 +29,23 @@ interface ChangelogSearchProps { export default function ChangelogSearch(props: ChangelogSearchProps) { const { dateRange } = props; + + const intl = useIntl(); + return ( -
- - +
+ + + {intl.formatMessage({ id: 'reset_verb' })} +
); } diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/changelog/ChangesList.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/changelog/ChangesList.tsx index 047c2ccb2cf..c1ea0b8b39e 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/changelog/ChangesList.tsx +++ b/server/sonar-web/src/main/js/apps/quality-profiles/changelog/ChangesList.tsx @@ -33,7 +33,7 @@ export default function ChangesList({ changes }: Props) { }; return ( -
    +
      {Object.keys(changes).map((key) => (
    • {key === 'severity' ? ( 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 b289c2c799d..68b7abb92f3 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 @@ -27,13 +27,13 @@ interface Props { export default function ParameterChange({ name, value }: Props) { return ( -
      +

      {value == null ? translateWithParameters( 'quality_profiles.changelog.parameter_reset_to_default_value', name, ) : translateWithParameters('quality_profiles.parameter_set_to', name, value)} -

      +

      ); } diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/changelog/__tests__/ChangelogContainer-it.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/changelog/__tests__/ChangelogContainer-it.tsx index 7af855cbbfb..6f6c1e489f3 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/changelog/__tests__/ChangelogContainer-it.tsx +++ b/server/sonar-web/src/main/js/apps/quality-profiles/changelog/__tests__/ChangelogContainer-it.tsx @@ -33,7 +33,7 @@ const ui = { row: byRole('row'), link: byRole('link'), emptyPage: byText('no_results'), - showMore: byRole('link', { name: 'show_more' }), + showMore: byRole('button', { name: 'show_more' }), startDate: byRole('textbox', { name: 'start_date' }), endDate: byRole('textbox', { name: 'end_date' }), reset: byRole('button', { name: 'reset_verb' }), 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 f877e5b1ad6..ee7041557f5 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 @@ -94,14 +94,16 @@ export default function ProfileHeader(props: Props) {
-
- - {translate('see_changelog')} - -
+ {!isChangeLogPage && ( +
+ + {translate('see_changelog')} + +
+ )} )} diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/styles.css b/server/sonar-web/src/main/js/apps/quality-profiles/styles.css index 291324828b8..e22d2dea61f 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/styles.css +++ b/server/sonar-web/src/main/js/apps/quality-profiles/styles.css @@ -18,15 +18,6 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -.quality-profile-changelog-rule-cell { - line-height: 1.5; -} - -.quality-profile-changelog-parameter { - max-width: 270px; - word-break: break-word; -} - #create-profile-form .radio-card { width: 244px; background-color: var(--neutral50); diff --git a/sonar-core/src/main/resources/org/sonar/l10n/core.properties b/sonar-core/src/main/resources/org/sonar/l10n/core.properties index c76c2d6bb7d..e9a392af9b6 100644 --- a/sonar-core/src/main/resources/org/sonar/l10n/core.properties +++ b/sonar-core/src/main/resources/org/sonar/l10n/core.properties @@ -236,6 +236,7 @@ unknown=Unknown unresolved=Unresolved updated=Updated updated_on=Updated on +updates=Updates update_verb=Update updating=Updating unselected=Unselected