aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/src/main/js/apps/audit-logs
diff options
context:
space:
mode:
authorPhilippe Perrin <philippe.perrin@sonarsource.com>2022-11-02 11:08:39 +0100
committersonartech <sonartech@sonarsource.com>2022-11-02 20:03:01 +0000
commit2ab6fc273ecbf405f7c126fab11ddc0b9bf516da (patch)
treea6e005b4f57fb488d3e551b7df52399e69b0674c /server/sonar-web/src/main/js/apps/audit-logs
parent60e4b88e4567c1af3051b6cdc4c8858f8b0fca21 (diff)
downloadsonarqube-2ab6fc273ecbf405f7c126fab11ddc0b9bf516da.tar.gz
sonarqube-2ab6fc273ecbf405f7c126fab11ddc0b9bf516da.zip
SONAR-13368 Bump to prettier@2.7.1
Diffstat (limited to 'server/sonar-web/src/main/js/apps/audit-logs')
-rw-r--r--server/sonar-web/src/main/js/apps/audit-logs/components/AuditApp.tsx6
-rw-r--r--server/sonar-web/src/main/js/apps/audit-logs/components/AuditAppRenderer.tsx14
-rw-r--r--server/sonar-web/src/main/js/apps/audit-logs/components/DownloadButton.tsx9
-rw-r--r--server/sonar-web/src/main/js/apps/audit-logs/components/__tests__/AuditApp-it.tsx18
-rw-r--r--server/sonar-web/src/main/js/apps/audit-logs/utils.ts4
5 files changed, 27 insertions, 24 deletions
diff --git a/server/sonar-web/src/main/js/apps/audit-logs/components/AuditApp.tsx b/server/sonar-web/src/main/js/apps/audit-logs/components/AuditApp.tsx
index 7cce3ac91ed..bda03c0d5ce 100644
--- a/server/sonar-web/src/main/js/apps/audit-logs/components/AuditApp.tsx
+++ b/server/sonar-web/src/main/js/apps/audit-logs/components/AuditApp.tsx
@@ -45,7 +45,7 @@ export class AuditApp extends React.PureComponent<Props, State> {
this.state = {
downloadStarted: false,
housekeepingPolicy: HousekeepingPolicy.Monthly,
- selection: RangeOption.Today
+ selection: RangeOption.Today,
};
}
@@ -60,13 +60,13 @@ export class AuditApp extends React.PureComponent<Props, State> {
this.setState({
housekeepingPolicy:
- (result?.value as HousekeepingPolicy | undefined) ?? HousekeepingPolicy.Monthly
+ (result?.value as HousekeepingPolicy | undefined) ?? HousekeepingPolicy.Monthly,
});
};
hasGovernanceExtension = () => {
return Boolean(
- this.props.adminPages?.find(e => e.key === AdminPageExtension.GovernanceConsole)
+ this.props.adminPages?.find((e) => e.key === AdminPageExtension.GovernanceConsole)
);
};
diff --git a/server/sonar-web/src/main/js/apps/audit-logs/components/AuditAppRenderer.tsx b/server/sonar-web/src/main/js/apps/audit-logs/components/AuditAppRenderer.tsx
index d191cc46fb3..caeed7a6f8b 100644
--- a/server/sonar-web/src/main/js/apps/audit-logs/components/AuditAppRenderer.tsx
+++ b/server/sonar-web/src/main/js/apps/audit-logs/components/AuditAppRenderer.tsx
@@ -49,7 +49,7 @@ const HOUSEKEEPING_POLICY_VALUES = {
[HousekeepingPolicy.Weekly]: 7,
[HousekeepingPolicy.Monthly]: 30,
[HousekeepingPolicy.Trimestrial]: 90,
- [HousekeepingPolicy.Yearly]: 365
+ [HousekeepingPolicy.Yearly]: 365,
};
const getRangeOptions = (housekeepingPolicy: HousekeepingPolicy) => {
@@ -93,11 +93,12 @@ export default function AuditAppRenderer(props: AuditAppRendererProps) {
to={{
pathname: '/admin/settings',
search: queryToSearch({ category: 'housekeeping' }),
- hash: '#auditLogs'
- }}>
+ hash: '#auditLogs',
+ }}
+ >
{translate('audit_logs.page.description.link')}
</Link>
- )
+ ),
}}
/>
</p>
@@ -106,12 +107,13 @@ export default function AuditAppRenderer(props: AuditAppRendererProps) {
<h2 className="big-spacer-bottom">{translate('audit_logs.download')}</h2>
<ul>
- {getRangeOptions(housekeepingPolicy).map(option => (
+ {getRangeOptions(housekeepingPolicy).map((option) => (
<li key={option} className="spacer-bottom">
<Radio
checked={selection === option}
onCheck={props.handleOptionSelection}
- value={option}>
+ value={option}
+ >
{translate('audit_logs.range_option', option)}
</Radio>
</li>
diff --git a/server/sonar-web/src/main/js/apps/audit-logs/components/DownloadButton.tsx b/server/sonar-web/src/main/js/apps/audit-logs/components/DownloadButton.tsx
index ae80edbfffa..d31623b4729 100644
--- a/server/sonar-web/src/main/js/apps/audit-logs/components/DownloadButton.tsx
+++ b/server/sonar-web/src/main/js/apps/audit-logs/components/DownloadButton.tsx
@@ -37,7 +37,7 @@ const RANGE_OPTION_START = {
[RangeOption.Today]: () => now(),
[RangeOption.Week]: () => subDays(now(), 7),
[RangeOption.Month]: () => subDays(now(), 30),
- [RangeOption.Trimester]: () => subDays(now(), 90)
+ [RangeOption.Trimester]: () => subDays(now(), 90),
};
const toISODateString = (date: Date) => date.toISOString();
@@ -53,13 +53,13 @@ function getRangeParams(selection: RangeOption, dateRange?: { from?: Date; to?:
return new URLSearchParams({
from: toISODateString(startOfDay(dateRange.from)),
- to: toISODateString(endOfDay(dateRange.to))
+ to: toISODateString(endOfDay(dateRange.to)),
}).toString();
}
return new URLSearchParams({
from: toISODateString(startOfDay(RANGE_OPTION_START[selection]())),
- to: toISODateString(now())
+ to: toISODateString(now()),
}).toString();
}
@@ -84,7 +84,8 @@ export default function DownloadButton(props: DownloadButtonProps) {
onClick={downloadDisabled ? undefined : props.onStartDownload}
href={downloadUrl}
rel="noopener noreferrer"
- target="_blank">
+ target="_blank"
+ >
{translate('download_verb')}
</a>
diff --git a/server/sonar-web/src/main/js/apps/audit-logs/components/__tests__/AuditApp-it.tsx b/server/sonar-web/src/main/js/apps/audit-logs/components/__tests__/AuditApp-it.tsx
index 1130413e4d6..a98d3f2933c 100644
--- a/server/sonar-web/src/main/js/apps/audit-logs/components/__tests__/AuditApp-it.tsx
+++ b/server/sonar-web/src/main/js/apps/audit-logs/components/__tests__/AuditApp-it.tsx
@@ -36,7 +36,7 @@ jest.mock('../../../../api/settings');
const extensions = [
{ key: AdminPageExtension.GovernanceConsole, name: 'Portfolios' },
{ key: 'license/app', name: 'License Manager' },
- { key: 'license/support', name: 'Support' }
+ { key: 'license/support', name: 'Support' },
];
jest.mock('date-fns', () => {
@@ -44,15 +44,15 @@ jest.mock('date-fns', () => {
const dateFns = jest.requireActual('date-fns');
return {
...dateFns,
- endOfDay: jest.fn().mockImplementation(d => d),
- startOfDay: jest.fn().mockImplementation(d => d)
+ endOfDay: jest.fn().mockImplementation((d) => d),
+ startOfDay: jest.fn().mockImplementation((d) => d),
};
});
jest.mock('../../../../helpers/dates', () => {
return {
...jest.requireActual('../../../../helpers/dates'),
- now: jest.fn(() => new Date('2020-07-21T12:00:00Z'))
+ now: jest.fn(() => new Date('2020-07-21T12:00:00Z')),
};
});
@@ -66,7 +66,7 @@ const ui = {
customRadio: byRole('radio', { name: 'audit_logs.range_option.custom' }),
downloadSentenceStart: byText('audit_logs.download_start.sentence.1'),
startDateInput: byPlaceholderText('start_date'),
- endDateInput: byPlaceholderText('end_date')
+ endDateInput: byPlaceholderText('end_date'),
};
let handler: SettingsServiceMock;
@@ -116,19 +116,19 @@ it('should handle download button click', async () => {
await user.click(ui.startDateInput.get());
await selectEvent.select(screen.getByRole('textbox', { name: 'select_month' }), [
- getShortMonthName(getMonth(startDay))
+ getShortMonthName(getMonth(startDay)),
]);
await selectEvent.select(screen.getByRole('textbox', { name: 'select_year' }), [
- getYear(startDay)
+ getYear(startDay),
]);
await user.click(screen.getByText(getDate(startDay)));
await user.click(ui.endDateInput.get());
await selectEvent.select(screen.getByRole('textbox', { name: 'select_month' }), [
- getShortMonthName(getMonth(endDate))
+ getShortMonthName(getMonth(endDate)),
]);
await selectEvent.select(screen.getByRole('textbox', { name: 'select_year' }), [
- getYear(endDate)
+ getYear(endDate),
]);
await user.click(screen.getByText(getDate(endDate)));
diff --git a/server/sonar-web/src/main/js/apps/audit-logs/utils.ts b/server/sonar-web/src/main/js/apps/audit-logs/utils.ts
index b59b65ff7ec..28e64eabdbc 100644
--- a/server/sonar-web/src/main/js/apps/audit-logs/utils.ts
+++ b/server/sonar-web/src/main/js/apps/audit-logs/utils.ts
@@ -21,7 +21,7 @@ export enum HousekeepingPolicy {
Weekly = 'Weekly',
Monthly = 'Monthly',
Trimestrial = 'Trimestrial',
- Yearly = 'Yearly'
+ Yearly = 'Yearly',
}
export enum RangeOption {
@@ -29,5 +29,5 @@ export enum RangeOption {
Week = '7days',
Month = '30days',
Trimester = '90days',
- Custom = 'custom'
+ Custom = 'custom',
}