diff --git a/.prettierrc.js b/.prettierrc.js index b6fe7a2808c..f7b0b645a6e 100644 --- a/.prettierrc.js +++ b/.prettierrc.js @@ -1,5 +1,5 @@ module.exports = { - trailingComma: 'es5', + trailingComma: 'none', arrowParens: 'always', singleQuote: true, } diff --git a/www/front_src/src/App/endpoint.ts b/www/front_src/src/App/endpoint.ts index 627ca559c93..8322374673d 100644 --- a/www/front_src/src/App/endpoint.ts +++ b/www/front_src/src/App/endpoint.ts @@ -12,5 +12,5 @@ export { externalTranslationEndpoint, internalTranslationEndpoint, aclEndpoint, - userEndpoint, + userEndpoint }; diff --git a/www/front_src/src/App/index.tsx b/www/front_src/src/App/index.tsx index 81b38504e6e..591f2798be9 100755 --- a/www/front_src/src/App/index.tsx +++ b/www/front_src/src/App/index.tsx @@ -19,23 +19,23 @@ const useStyles = makeStyles((theme) => ({ overflow: 'hidden', position: 'relative', transition: 'all 0.3s', - width: '100%', + width: '100%' }, fullScreenWrapper: { flexGrow: 1, height: '100%', overflow: 'hidden', - width: '100%', + width: '100%' }, fullscreenButton: { bottom: '10px', position: 'absolute', right: '20px', - zIndex: 1500, + zIndex: 1500 }, mainContent: { height: `calc(100vh - ${theme.spacing(headerHeight)})`, - width: '100%', + width: '100%' }, wrapper: { alignItems: 'stretch', @@ -43,8 +43,8 @@ const useStyles = makeStyles((theme) => ({ display: 'flex', fontFamily: theme.typography.fontFamily, height: '100%', - overflow: 'hidden', - }, + overflow: 'hidden' + } })); const MainRouter = lazy(() => import('../components/mainRouter')); diff --git a/www/front_src/src/App/useApp.ts b/www/front_src/src/App/useApp.ts index 8a5ae4ee440..88afecb4308 100644 --- a/www/front_src/src/App/useApp.ts +++ b/www/front_src/src/App/useApp.ts @@ -10,7 +10,7 @@ import { aclAtom, Actions, downtimeAtom, - refreshIntervalAtom, + refreshIntervalAtom } from '@centreon/ui-context'; import { getData, useRequest, useSnackbar, postData } from '@centreon/ui'; @@ -44,17 +44,17 @@ const useApp = (): UseAppState => { const { sendRequest: keepAliveRequest } = useRequest({ httpCodesBypassErrorSnackbar: [401], - request: getData, + request: getData }); const { sendRequest: getParameters } = useRequest({ - request: getData, + request: getData }); const { sendRequest: getAcl } = useRequest({ - request: getData, + request: getData }); const { sendRequest: logoutRequest } = useRequest({ - request: postData, + request: postData }); const setDowntime = useUpdateAtom(downtimeAtom); @@ -69,7 +69,7 @@ const useApp = (): UseAppState => { setAreUserParametersLoaded(false); logoutRequest({ data: {}, - endpoint: logoutEndpoint, + endpoint: logoutEndpoint }).then(() => { showErrorMessage(t(labelYouAreDisconnected)); navigate(reactRoutes.login); @@ -81,24 +81,24 @@ const useApp = (): UseAppState => { Promise.all([ getParameters({ - endpoint: parametersEndpoint, + endpoint: parametersEndpoint }), getAcl({ - endpoint: aclEndpoint, - }), + endpoint: aclEndpoint + }) ]) .then(([retrievedParameters, retrievedAcl]) => { setDowntime({ duration: parseInt( retrievedParameters.monitoring_default_downtime_duration, - 10, + 10 ), fixed: retrievedParameters.monitoring_default_downtime_fixed, with_services: - retrievedParameters.monitoring_default_downtime_with_services, + retrievedParameters.monitoring_default_downtime_with_services }); setRefreshInterval( - parseInt(retrievedParameters.monitoring_default_refresh_interval, 10), + parseInt(retrievedParameters.monitoring_default_refresh_interval, 10) ); setAcl({ actions: retrievedAcl }); setAcknowledgement({ @@ -109,7 +109,7 @@ const useApp = (): UseAppState => { retrievedParameters.monitoring_default_acknowledgement_persistent, sticky: retrievedParameters.monitoring_default_acknowledgement_sticky, with_services: - retrievedParameters.monitoring_default_acknowledgement_with_services, + retrievedParameters.monitoring_default_acknowledgement_with_services }); }) .catch((error) => { @@ -123,7 +123,7 @@ const useApp = (): UseAppState => { const keepAlive = (): void => { keepAliveRequest({ - endpoint: keepAliveEndpoint, + endpoint: keepAliveEndpoint }).catch((error) => { if (not(pathEq(['response', 'status'], 401, error))) { return; @@ -145,7 +145,7 @@ const useApp = (): UseAppState => { }, []); return { - hasMinArgument, + hasMinArgument }; }; diff --git a/www/front_src/src/App/usePendo.ts b/www/front_src/src/App/usePendo.ts index 4397e2b37a4..2f6845c7ee0 100644 --- a/www/front_src/src/App/usePendo.ts +++ b/www/front_src/src/App/usePendo.ts @@ -13,17 +13,17 @@ const oneDayInMs = 24 * 60 * 60 * 1000; const centreonPlatformDataAtom = atomWithStorage( 'centreonPlatformData', - null, + null ); const usePendo = (): void => { const [isCeipEnabled, setIsCeipEnabled] = useState(false); const { sendRequest } = useRequest({ - request: getData, + request: getData }); const [centreonPlatformData, setCentreonPlatformData] = useAtom( - centreonPlatformDataAtom, + centreonPlatformDataAtom ); const sendCeipInfo = (isOnline: boolean): void => { @@ -32,7 +32,7 @@ const usePendo = (): void => { } sendRequest({ - endpoint: './api/internal.php?object=centreon_ceip&action=ceipInfo', + endpoint: './api/internal.php?object=centreon_ceip&action=ceipInfo' }).then((data) => { if (not(data?.ceip)) { setCentreonPlatformData({ ceip: false }); @@ -47,7 +47,7 @@ const usePendo = (): void => { cacheGenerationDate: Date.now(), ceip: true, excludeAllText: data.excludeAllText, - visitor: data.visitor, + visitor: data.visitor }; setCentreonPlatformData(platformData); }); @@ -63,7 +63,7 @@ const usePendo = (): void => { try { const isCacheOutdated = gte( (centreonPlatformData?.cacheGenerationDate || 0) + oneDayInMs, - Date.now(), + Date.now() ); if (not(isCacheOutdated)) { diff --git a/www/front_src/src/Authentication/FormButtons.tsx b/www/front_src/src/Authentication/FormButtons.tsx index aee365801bd..ce449793d1b 100644 --- a/www/front_src/src/Authentication/FormButtons.tsx +++ b/www/front_src/src/Authentication/FormButtons.tsx @@ -12,7 +12,7 @@ import { ConfirmDialog, SaveButton, useMemoComponent, - UnsavedChangesDialog, + UnsavedChangesDialog } from '@centreon/ui'; import { @@ -22,7 +22,7 @@ import { labelResetTheForm, labelSave, labelSaved, - labelSaving, + labelSaving } from './Local/translatedLabels'; import { tabAtom, appliedTabAtom } from './tabAtoms'; @@ -33,8 +33,8 @@ const useStyles = makeStyles((theme) => ({ display: 'flex', flexDirection: 'row', justifyContent: 'flex-end', - marginTop: theme.spacing(2), - }, + marginTop: theme.spacing(2) + } })); const FormButtons = (): JSX.Element => { @@ -148,8 +148,8 @@ const FormButtons = (): JSX.Element => { askingBeforeReset, tab, unsavedDialogOpened, - classes, - ], + classes + ] }); }; diff --git a/www/front_src/src/Authentication/Local/Form/Attempts.tsx b/www/front_src/src/Authentication/Local/Form/Attempts.tsx index 74036bab121..f7e132406fe 100644 --- a/www/front_src/src/Authentication/Local/Form/Attempts.tsx +++ b/www/front_src/src/Authentication/Local/Form/Attempts.tsx @@ -14,7 +14,7 @@ import { labelNumberOfAttemptsBeforeUserIsBlocked, labelStrong, labelUnknown, - labelWeak, + labelWeak } from '../translatedLabels'; import StrengthProgress from '../StrengthProgress'; @@ -24,8 +24,8 @@ export const attemptsFieldName = 'attempts'; const useStyles = makeStyles((theme) => ({ input: { - maxWidth: theme.spacing(43), - }, + maxWidth: theme.spacing(43) + } })); const Attempts = (): JSX.Element => { @@ -46,17 +46,17 @@ const Attempts = (): JSX.Element => { setFieldValue(attemptsFieldName, parseInt(value, 10)); }, - [attemptsFieldName], + [attemptsFieldName] ); const attemptsError = getField({ field: attemptsFieldName, - object: errors, + object: errors }); const attemptsValue = getField({ field: attemptsFieldName, - object: values, + object: values }); const thresholds = useMemo( @@ -64,14 +64,14 @@ const Attempts = (): JSX.Element => { { color: theme.palette.success.main, label: labelStrong, value: 0 }, { color: theme.palette.warning.main, label: labelGood, value: 3 }, { color: theme.palette.error.main, label: labelWeak, value: 6 }, - { color: theme.palette.grey[500], label: labelUnknown, value: 11 }, + { color: theme.palette.grey[500], label: labelUnknown, value: 11 } ], - [], + [] ); const displayStrengthProgress = useMemo( () => isNil(attemptsError) && not(isNil(attemptsValue)), - [attemptsError, attemptsValue], + [attemptsError, attemptsValue] ); return useMemoComponent({ @@ -83,7 +83,7 @@ const Attempts = (): JSX.Element => { helperText={attemptsError} inputProps={{ 'aria-label': t(labelNumberOfAttemptsBeforeUserIsBlocked), - min: 1, + min: 1 }} label={t(labelNumberOfAttemptsBeforeUserIsBlocked)} name={attemptsFieldName} @@ -101,7 +101,7 @@ const Attempts = (): JSX.Element => { )} ), - memoProps: [attemptsError, attemptsValue], + memoProps: [attemptsError, attemptsValue] }); }; diff --git a/www/front_src/src/Authentication/Local/Form/BlockingDuration.tsx b/www/front_src/src/Authentication/Local/Form/BlockingDuration.tsx index dc8808f9ce1..071ad3b6840 100644 --- a/www/front_src/src/Authentication/Local/Form/BlockingDuration.tsx +++ b/www/front_src/src/Authentication/Local/Form/BlockingDuration.tsx @@ -16,14 +16,14 @@ import { labelGood, labelStrong, labelThisWillNotBeUsedBecauseNumberOfAttemptsIsNotDefined, - labelWeak, + labelWeak } from '../translatedLabels'; import StrengthProgress from '../StrengthProgress'; import { goodBlockingDuration, sevenDays, strongBlockingDuration, - weakBlockingDuration, + weakBlockingDuration } from '../timestamps'; import { TimeInputConfiguration } from '../models'; @@ -34,8 +34,8 @@ const blockingDurationFieldName = 'blockingDuration'; const useStyles = makeStyles({ passwordBlockingDuration: { - maxWidth: 'fit-content', - }, + maxWidth: 'fit-content' + } }); const BlockingDuration = (): JSX.Element => { @@ -51,17 +51,17 @@ const BlockingDuration = (): JSX.Element => { const blockingDurationValue = getField({ field: blockingDurationFieldName, - object: values, + object: values }); const blockingDurationError = getField({ field: blockingDurationFieldName, - object: errors, + object: errors }); const attemptsValue = getField({ field: attemptsFieldName, - object: values, + object: values }); const thresholds = useMemo( @@ -69,20 +69,20 @@ const BlockingDuration = (): JSX.Element => { { color: theme.palette.error.main, label: labelWeak, - value: weakBlockingDuration, + value: weakBlockingDuration }, { color: theme.palette.warning.main, label: labelGood, - value: goodBlockingDuration, + value: goodBlockingDuration }, { color: theme.palette.success.main, label: labelStrong, - value: strongBlockingDuration, - }, + value: strongBlockingDuration + } ], - [], + [] ); const areAttemptsEmpty = isNil(attemptsValue); @@ -92,7 +92,7 @@ const BlockingDuration = (): JSX.Element => { isNil(blockingDurationError) && not(isNil(blockingDurationValue)) && not(areAttemptsEmpty), - [blockingDurationError, blockingDurationValue, areAttemptsEmpty], + [blockingDurationError, blockingDurationValue, areAttemptsEmpty] ); const maxHoursAndMinutesOption = useMemo( @@ -100,13 +100,13 @@ const BlockingDuration = (): JSX.Element => { lte(dayjs.duration({ days: 7 }).asMilliseconds(), blockingDurationValue) ? 0 : undefined, - [blockingDurationValue], + [blockingDurationValue] ); const timeInputConfigurations: Array = [ { maxOption: 7, unit: 'days' }, { maxOption: maxHoursAndMinutesOption, unit: 'hours' }, - { maxOption: maxHoursAndMinutesOption, unit: 'minutes' }, + { maxOption: maxHoursAndMinutesOption, unit: 'minutes' } ]; return useMemoComponent({ @@ -138,7 +138,7 @@ const BlockingDuration = (): JSX.Element => { )} ), - memoProps: [blockingDurationValue, blockingDurationError, attemptsValue], + memoProps: [blockingDurationValue, blockingDurationError, attemptsValue] }); }; diff --git a/www/front_src/src/Authentication/Local/Form/CaseButtons/index.tsx b/www/front_src/src/Authentication/Local/Form/CaseButtons/index.tsx index cab61c59712..a552ac2dc78 100644 --- a/www/front_src/src/Authentication/Local/Form/CaseButtons/index.tsx +++ b/www/front_src/src/Authentication/Local/Form/CaseButtons/index.tsx @@ -9,7 +9,7 @@ import { ButtonProps, Stack, Typography, - useTheme, + useTheme } from '@mui/material'; import makeStyles from '@mui/styles/makeStyles'; @@ -28,7 +28,7 @@ import { labelSpecialCharacters, labelStrong, labelUpperCase, - labelWeak, + labelWeak } from '../../translatedLabels'; import StrengthProgress from '../../StrengthProgress'; import { getFields } from '../utils'; @@ -36,7 +36,7 @@ import { getFields } from '../utils'; import LabelWithTooltip from './LabelWithTooltip'; const activeButtonProps = { - variant: 'contained', + variant: 'contained' } as ButtonProps; const hasLowerCaseName = 'hasLowerCase'; const hasUpperCaseName = 'hasUpperCase'; @@ -45,17 +45,17 @@ const hasSpecialCharacterName = 'hasSpecialCharacter'; const useStyles = makeStyles((theme) => ({ button: { - minWidth: theme.spacing(4), + minWidth: theme.spacing(4) }, caseButtonsContainer: { display: 'flex', flexDirection: 'column', rowGap: theme.spacing(0.5), - width: 'fit-content', + width: 'fit-content' }, lowerCaseButton: { - textTransform: 'none', - }, + textTransform: 'none' + } })); const CaseButtons = (): JSX.Element => { @@ -75,25 +75,25 @@ const CaseButtons = (): JSX.Element => { hasLowerCaseName, hasUpperCaseName, hasNumberName, - hasSpecialCharacterName, + hasSpecialCharacterName ], - object: values, + object: values }); const thresholds = useMemo( () => [ { color: theme.palette.error.main, label: labelWeak, value: 2 }, { color: theme.palette.warning.main, label: labelGood, value: 3 }, - { color: theme.palette.success.main, label: labelStrong, value: 4 }, + { color: theme.palette.success.main, label: labelStrong, value: 4 } ], - [], + [] ); const thresholdValue = [ hasLowerCase, hasUpperCase, hasNumber, - hasSpecialCharacter, + hasSpecialCharacter ].filter(Boolean).length; return useMemoComponent({ @@ -169,7 +169,7 @@ const CaseButtons = (): JSX.Element => { /> ), - memoProps: [hasLowerCase, hasUpperCase, hasNumber, hasSpecialCharacter], + memoProps: [hasLowerCase, hasUpperCase, hasNumber, hasSpecialCharacter] }); }; diff --git a/www/front_src/src/Authentication/Local/Form/PasswordExpiration/ExcludedUsers.tsx b/www/front_src/src/Authentication/Local/Form/PasswordExpiration/ExcludedUsers.tsx index a712fe6cfde..a9f847534c7 100644 --- a/www/front_src/src/Authentication/Local/Form/PasswordExpiration/ExcludedUsers.tsx +++ b/www/front_src/src/Authentication/Local/Form/PasswordExpiration/ExcludedUsers.tsx @@ -8,14 +8,14 @@ import { IconButton, ListItemText, Tooltip, - TypographyProps, + TypographyProps } from '@mui/material'; import { makeStyles } from '@mui/styles'; import SupervisorAccountIcon from '@mui/icons-material/SupervisorAccount'; import { MultiConnectedAutocompleteField, - buildListingEndpoint, + buildListingEndpoint } from '@centreon/ui'; import { labelAdmin, labelExcludedUsers } from '../../translatedLabels'; @@ -28,16 +28,16 @@ const excludedUsersFieldName = 'passwordExpiration.excludedUsers'; const useStyles = makeStyles((theme) => ({ excludedUsersAutocomplete: { height: 'auto', - width: theme.spacing(32), + width: theme.spacing(32) }, option: { alignItems: 'center', display: 'flex', - width: theme.spacing(25), + width: theme.spacing(25) }, tooltip: { - zIndex: inc(theme.zIndex.tooltip), - }, + zIndex: inc(theme.zIndex.tooltip) + } })); const optionTypographyProps = { component: 'span' } as TypographyProps; @@ -57,14 +57,14 @@ const ExcludedUsers = (): JSX.Element => { { field: 'provider_name', values: { - $eq: 'local', - }, + $eq: 'local' + } }, - ...(search?.conditions || []), - ].filter(Boolean), + ...(search?.conditions || []) + ].filter(Boolean) }, - sort: { alias: 'ASC' }, - }, + sort: { alias: 'ASC' } + } }); const getRenderedOptionText = useCallback((option): JSX.Element => { @@ -81,7 +81,7 @@ const ExcludedUsers = (): JSX.Element => { {isAdmin && ( { const excludedUsers = getField>({ field: excludedUsersFieldName, - object: values, + object: values }); const formattedUsers = useMemo( () => map((user) => ({ alias: user, id: user, name: user }), excludedUsers), - [excludedUsers], + [excludedUsers] ); return ( diff --git a/www/front_src/src/Authentication/Local/Form/PasswordExpiration/index.tsx b/www/front_src/src/Authentication/Local/Form/PasswordExpiration/index.tsx index ca0cd84fd02..ae6e6e92468 100644 --- a/www/front_src/src/Authentication/Local/Form/PasswordExpiration/index.tsx +++ b/www/front_src/src/Authentication/Local/Form/PasswordExpiration/index.tsx @@ -22,11 +22,11 @@ const useStyles = makeStyles((theme) => ({ container: { alignItems: 'flex-end', display: 'grid', - gridTemplateColumns: 'repeat(2, 1fr)', + gridTemplateColumns: 'repeat(2, 1fr)' }, passwordExpiration: { - marginTop: theme.spacing(1), - }, + marginTop: theme.spacing(1) + } })); const PasswordExpiration = (): JSX.Element => { @@ -41,39 +41,39 @@ const PasswordExpiration = (): JSX.Element => { const passwordExpirationValue = getField({ field: passwordExpirationFieldName, - object: values, + object: values }); const passwordExpirationError = getField({ field: passwordExpirationFieldName, - object: errors, + object: errors }); const minDaysOption = useMemo( (): number | undefined => lte( dayjs.duration({ months: 1 }).asMilliseconds(), - passwordExpirationValue, + passwordExpirationValue ) ? undefined : 7, - [passwordExpirationValue], + [passwordExpirationValue] ); const maxDaysOption = useMemo( (): number | undefined => lte( dayjs.duration({ years: 1 }).asMilliseconds(), - passwordExpirationValue, + passwordExpirationValue ) ? 0 : undefined, - [passwordExpirationValue], + [passwordExpirationValue] ); const timeInputConfiguration: Array = [ { unit: 'months' }, - { maxOption: maxDaysOption, minOption: minDaysOption, unit: 'days' }, + { maxOption: maxDaysOption, minOption: minDaysOption, unit: 'days' } ]; return useMemoComponent({ @@ -93,7 +93,7 @@ const PasswordExpiration = (): JSX.Element => { )} ), - memoProps: [passwordExpirationValue, passwordExpirationError, classes], + memoProps: [passwordExpirationValue, passwordExpirationError, classes] }); }; diff --git a/www/front_src/src/Authentication/Local/Form/TimeBeforeNewPassword.tsx b/www/front_src/src/Authentication/Local/Form/TimeBeforeNewPassword.tsx index 7b44dbfce7c..309611c7791 100644 --- a/www/front_src/src/Authentication/Local/Form/TimeBeforeNewPassword.tsx +++ b/www/front_src/src/Authentication/Local/Form/TimeBeforeNewPassword.tsx @@ -29,28 +29,28 @@ const TimeBeforeNewPassword = (): JSX.Element => { const delayBeforeNewPasswordValue = getField({ field: delayBeforeNewPasswordFieldName, - object: values, + object: values }); const delayBeforeNewPasswordError = getField({ field: delayBeforeNewPasswordFieldName, - object: errors, + object: errors }); const maxHoursOption = useMemo( (): number | undefined => lte( dayjs.duration({ days: 7 }).asMilliseconds(), - delayBeforeNewPasswordValue, + delayBeforeNewPasswordValue ) ? 0 : undefined, - [delayBeforeNewPasswordValue], + [delayBeforeNewPasswordValue] ); const timeInputConfigurations: Array = [ { maxOption: 7, unit: 'days' }, - { maxOption: maxHoursOption, unit: 'hours' }, + { maxOption: maxHoursOption, unit: 'hours' } ]; return useMemoComponent({ @@ -70,7 +70,7 @@ const TimeBeforeNewPassword = (): JSX.Element => { )} ), - memoProps: [delayBeforeNewPasswordValue, delayBeforeNewPasswordError], + memoProps: [delayBeforeNewPasswordValue, delayBeforeNewPasswordError] }); }; diff --git a/www/front_src/src/Authentication/Local/Form/index.tsx b/www/front_src/src/Authentication/Local/Form/index.tsx index 4774a89c042..6dce842bde6 100644 --- a/www/front_src/src/Authentication/Local/Form/index.tsx +++ b/www/front_src/src/Authentication/Local/Form/index.tsx @@ -9,7 +9,7 @@ import { labelPasswordBlockingPolicy, labelPasswordCasePolicy, labelPasswordExpirationPolicy, - labelPasswordPasswordSecurityPolicySaved, + labelPasswordPasswordSecurityPolicySaved } from '../translatedLabels'; import { putPasswordPasswordSecurityPolicy } from '../../api'; import FormButtons from '../../FormButtons'; @@ -25,22 +25,22 @@ interface Props { const groups: Array = [ { name: labelPasswordCasePolicy, - order: 1, + order: 1 }, { name: labelPasswordExpirationPolicy, - order: 2, + order: 2 }, { name: labelPasswordBlockingPolicy, - order: 3, - }, + order: 3 + } ]; const PasswordSecurityPolicyForm = ({ initialValues, isLoading, - loadPasswordSecurityPolicy, + loadPasswordSecurityPolicy }: Props): JSX.Element => { const validationSchema = useValidationSchema(); const { showSuccessMessage } = useSnackbar(); @@ -48,12 +48,12 @@ const PasswordSecurityPolicyForm = ({ const { sendRequest } = useRequest({ defaultFailureMessage: t(labelFailedToSavePasswordPasswordSecurityPolicy), - request: putPasswordPasswordSecurityPolicy, + request: putPasswordPasswordSecurityPolicy }); const submit = ( values: PasswordSecurityPolicy, - { setSubmitting }, + { setSubmitting } ): Promise => sendRequest(values) .then(() => { diff --git a/www/front_src/src/Authentication/Local/Form/inputs.tsx b/www/front_src/src/Authentication/Local/Form/inputs.tsx index 963144cf32e..7fd03ddc953 100644 --- a/www/front_src/src/Authentication/Local/Form/inputs.tsx +++ b/www/front_src/src/Authentication/Local/Form/inputs.tsx @@ -5,7 +5,7 @@ import { labelMinimumPasswordLength, labelPasswordBlockingPolicy, labelPasswordCasePolicy, - labelPasswordExpirationPolicy, + labelPasswordExpirationPolicy } from '../translatedLabels'; import Attempts from './Attempts'; @@ -25,23 +25,23 @@ const inputs: Array = [ fieldName: 'passwordMinLength', label: labelMinimumPasswordLength, text: { - type: 'number', + type: 'number' }, - type: InputType.Text, + type: InputType.Text }, { custom: { - Component: CaseButtons, + Component: CaseButtons }, fieldName: '', label: '', - type: InputType.Custom, - }, - ], + type: InputType.Custom + } + ] }, group: labelPasswordCasePolicy, label: '', - type: InputType.Grid, + type: InputType.Grid }, { fieldName: '', @@ -50,60 +50,60 @@ const inputs: Array = [ columns: [ { custom: { - Component: PasswordExpiration, + Component: PasswordExpiration }, fieldName: '', label: '', - type: InputType.Custom, + type: InputType.Custom }, { custom: { - Component: ExcludedUsers, + Component: ExcludedUsers }, fieldName: '', label: '', - type: InputType.Custom, - }, + type: InputType.Custom + } ], - gridTemplateColumns: 'repeat(2, 1fr)', + gridTemplateColumns: 'repeat(2, 1fr)' }, group: labelPasswordExpirationPolicy, label: '', - type: InputType.Grid, + type: InputType.Grid }, { custom: { - Component: TimeBeforeNewPassword, + Component: TimeBeforeNewPassword }, fieldName: '', group: labelPasswordExpirationPolicy, label: '', - type: InputType.Custom, + type: InputType.Custom }, { fieldName: 'canReusePasswords', group: labelPasswordExpirationPolicy, label: labelLast3PasswordsCanBeReused, - type: InputType.Switch, + type: InputType.Switch }, { custom: { - Component: Attempts, + Component: Attempts }, fieldName: '', group: labelPasswordBlockingPolicy, label: '', - type: InputType.Custom, + type: InputType.Custom }, { custom: { - Component: BlockingDuration, + Component: BlockingDuration }, fieldName: '', group: labelPasswordBlockingPolicy, label: '', - type: InputType.Custom, - }, + type: InputType.Custom + } ]; export default inputs; diff --git a/www/front_src/src/Authentication/Local/LoadingSkeleton.tsx b/www/front_src/src/Authentication/Local/LoadingSkeleton.tsx index 7ccac009319..255f62ae3cb 100644 --- a/www/front_src/src/Authentication/Local/LoadingSkeleton.tsx +++ b/www/front_src/src/Authentication/Local/LoadingSkeleton.tsx @@ -9,28 +9,28 @@ const useStyles = makeStyles((theme) => ({ display: 'grid', gridTemplateColumns: 'repeat(2, 77px)', justifyContent: 'flex-end', - marginTop: theme.spacing(1), + marginTop: theme.spacing(1) }, formContainer: { - margin: theme.spacing(2, 1), + margin: theme.spacing(2, 1) }, formGroup: { marginBottom: theme.spacing(1), - marginTop: theme.spacing(0.5), + marginTop: theme.spacing(0.5) }, passwordCaseGroup: { columnGap: theme.spacing(4), display: 'grid', gridTemplateColumns: 'repeat(2, 1fr)', marginTop: theme.spacing(1), - width: theme.spacing(60), + width: theme.spacing(60) }, passwordExpirationAndBlockingGroups: { display: 'flex', flexDirection: 'column', marginTop: theme.spacing(1), - rowGap: theme.spacing(1), - }, + rowGap: theme.spacing(1) + } })); const AuthenticationLoadingSkeleton = (): JSX.Element => { diff --git a/www/front_src/src/Authentication/Local/StrengthProgress.tsx b/www/front_src/src/Authentication/Local/StrengthProgress.tsx index 5102b1b2201..4b4c3b2422d 100644 --- a/www/front_src/src/Authentication/Local/StrengthProgress.tsx +++ b/www/front_src/src/Authentication/Local/StrengthProgress.tsx @@ -22,31 +22,31 @@ interface Props { } const useStyles = makeStyles((theme) => ({ linear: { - backgroundColor: ({ color }): string => color, + backgroundColor: ({ color }): string => color }, linearBackground: { backgroundColor: ({ color }): string => alpha(color, 0.3), - width: '100%', + width: '100%' }, progressContainer: { alignItems: 'center', columnGap: theme.spacing(1), display: 'flex', - width: '100%', - }, + width: '100%' + } })); const StrengthProgress = ({ thresholds, max, value, - isInverted = false, + isInverted = false }: Props): JSX.Element => { const currentThreshold = useMemo( () => findLast((threshold) => value >= threshold.value, thresholds) || thresholds[0], - [thresholds, value], + [thresholds, value] ); const classes = useStyles(currentThreshold); const { t } = useTranslation(); @@ -69,7 +69,7 @@ const StrengthProgress = ({ aria-label={t(label)} classes={{ bar: classes.linear, - root: classes.linearBackground, + root: classes.linearBackground }} value={progressValue} variant="determinate" @@ -83,5 +83,5 @@ const StrengthProgress = ({ export default memoizeComponent({ Component: StrengthProgress, - memoProps: ['thresholds', 'max', 'value'], + memoProps: ['thresholds', 'max', 'value'] }); diff --git a/www/front_src/src/Authentication/Local/TimeInputs/TimeInput.tsx b/www/front_src/src/Authentication/Local/TimeInputs/TimeInput.tsx index a6ca9f52b9e..29582eb94be 100644 --- a/www/front_src/src/Authentication/Local/TimeInputs/TimeInput.tsx +++ b/www/front_src/src/Authentication/Local/TimeInputs/TimeInput.tsx @@ -15,7 +15,7 @@ import { getDaysOptions, getHoursOptions, getMinutesOptions, - getMonthsOptions, + getMonthsOptions } from './options'; const weeksUnit = 'weeks'; @@ -29,7 +29,7 @@ const getTimeOptions = { days: getDaysOptions, hours: getHoursOptions, minutes: getMinutesOptions, - months: getMonthsOptions, + months: getMonthsOptions }; interface Labels { @@ -55,14 +55,14 @@ export interface TimeInputProps { const useStyles = makeStyles((theme) => ({ small: { fontSize: 'small', - padding: theme.spacing(0.75), + padding: theme.spacing(0.75) }, timeInput: { alignItems: 'center', columnGap: theme.spacing(0.5), display: 'grid', - gridTemplateColumns: `${theme.spacing(8)} auto`, - }, + gridTemplateColumns: `${theme.spacing(8)} auto` + } })); const TimeInput = ({ @@ -76,7 +76,7 @@ const TimeInput = ({ inputLabel, maxOption, minOption, - maxDuration, + maxDuration }: TimeInputProps): JSX.Element => { const classes = useStyles(); const { t } = useTranslation(); @@ -98,7 +98,7 @@ const TimeInput = ({ const currentDuration = dayjs.duration(timeValue || 0); const previousValue = Math.floor( - currentDuration[functionGetDurationValue](unit), + currentDuration[functionGetDurationValue](unit) ); if (Number.isNaN(value)) { @@ -116,10 +116,7 @@ const TimeInput = ({ if ( and( equals(unit, 'months'), - equals( - currentDuration.clone().add(diffDuration, unit).asMonths(), - 12, - ), + equals(currentDuration.clone().add(diffDuration, unit).asMonths(), 12) ) ) { const newDuration = currentDuration @@ -138,7 +135,7 @@ const TimeInput = ({ .asMilliseconds(); onChange(normalizeDuration(newDuration)); }, - [functionGetDurationValue, unit, timeValue], + [functionGetDurationValue, unit, timeValue] ); const normalizedValue = useMemo( @@ -146,9 +143,9 @@ const TimeInput = ({ normalizeValue({ functionGetDurationValue, unit, - value: timeValue || 0, + value: timeValue || 0 }), - [functionGetDurationValue, unit, timeValue], + [functionGetDurationValue, unit, timeValue] ); const inputValue = Math.floor(normalizedValue); @@ -159,7 +156,7 @@ const TimeInput = ({
{ name: 'input', onChange: mockChange, timeValue: 0, - unit: 'minutes', + unit: 'minutes' }); userEvent.click(screen.getByLabelText(`input ${labelMinute}`)); @@ -36,7 +36,7 @@ describe('Time input', () => { name: 'input', onChange: mockChange, timeValue: 0, - unit: 'minutes', + unit: 'minutes' }); userEvent.click(screen.getByLabelText(`input ${labelMinute}`)); @@ -53,7 +53,7 @@ describe('Time input', () => { name: 'input', onChange: mockChange, timeValue: 0, - unit: 'minutes', + unit: 'minutes' }); expect(screen.getByText(labelMinute)).toBeInTheDocument(); @@ -66,7 +66,7 @@ describe('Time input', () => { name: 'input', onChange: mockChange, timeValue: 60000, - unit: 'minutes', + unit: 'minutes' }); expect(screen.getByText(labelMinute)).toBeInTheDocument(); @@ -79,7 +79,7 @@ describe('Time input', () => { name: 'input', onChange: mockChange, timeValue: 120000, - unit: 'minutes', + unit: 'minutes' }); expect(screen.getByText(labelMinutes)).toBeInTheDocument(); diff --git a/www/front_src/src/Authentication/Local/TimeInputs/index.tsx b/www/front_src/src/Authentication/Local/TimeInputs/index.tsx index 73c1f570026..443ef13957b 100644 --- a/www/front_src/src/Authentication/Local/TimeInputs/index.tsx +++ b/www/front_src/src/Authentication/Local/TimeInputs/index.tsx @@ -12,7 +12,7 @@ import { labelMinutes, labelMonth, labelMonths, - labelSecond, + labelSecond } from '../translatedLabels'; import { TimeInputConfiguration } from '../models'; @@ -24,8 +24,8 @@ const useStyles = makeStyles((theme) => ({ display: 'flex', flexDirection: 'row', marginBottom: theme.spacing(0.5), - marginTop: theme.spacing(0.5), - }, + marginTop: theme.spacing(0.5) + } })); interface UnitAndLabels { @@ -39,7 +39,7 @@ const mapUnitAndLabels: Array = [ { pluralLabel: labelMinutes, singularLabel: labelMinute, unit: 'minutes' }, { pluralLabel: labelHours, singularLabel: labelHour, unit: 'hours' }, { pluralLabel: labelDays, singularLabel: labelDay, unit: 'days' }, - { pluralLabel: labelMonths, singularLabel: labelMonth, unit: 'months' }, + { pluralLabel: labelMonths, singularLabel: labelMonth, unit: 'months' } ]; interface Props { @@ -57,7 +57,7 @@ const TimeInputs = ({ onChange, timeValue, inputLabel, - maxDuration, + maxDuration }: Props): JSX.Element => { const classes = useStyles(); @@ -66,7 +66,7 @@ const TimeInputs = ({ {timeInputConfigurations.map(({ unit, maxOption, minOption }, idx) => { const { pluralLabel, singularLabel } = find( propEq('unit', unit), - mapUnitAndLabels, + mapUnitAndLabels ) as UnitAndLabels; return ( @@ -76,7 +76,7 @@ const TimeInputs = ({ key={singularLabel} labels={{ plural: pluralLabel, - singular: singularLabel, + singular: singularLabel }} maxDuration={maxDuration} maxOption={maxOption} diff --git a/www/front_src/src/Authentication/Local/TimeInputs/options.ts b/www/front_src/src/Authentication/Local/TimeInputs/options.ts index 62b2519f99b..362b2d37dca 100644 --- a/www/front_src/src/Authentication/Local/TimeInputs/options.ts +++ b/www/front_src/src/Authentication/Local/TimeInputs/options.ts @@ -4,45 +4,45 @@ import { PartialUnitValueLimit, UnitValueLimit } from '../models'; const commonEntry = { id: 0, - name: '0', + name: '0' }; const getTimeInputOptions = ({ max, - min, + min }: UnitValueLimit): Array => [ commonEntry, ...Array(max - min + 1) .fill(0) - .map((_, index) => ({ id: min + index, name: `${min + index}` })), + .map((_, index) => ({ id: min + index, name: `${min + index}` })) ]; export const getMonthsOptions = ({ max = 12, - min = 1, + min = 1 }: PartialUnitValueLimit): Array => getTimeInputOptions({ max, min }); export const getDaysOptions = ({ max = 30, - min = 1, + min = 1 }: PartialUnitValueLimit): Array => getTimeInputOptions({ max, min }); export const getHoursOptions = ({ max = 23, - min = 1, + min = 1 }: PartialUnitValueLimit): Array => getTimeInputOptions({ max, min }); export const getMinutesOptions = ({ max = 59, - min = 1, + min = 1 }: PartialUnitValueLimit): Array => getTimeInputOptions({ max, min }); export const getSecondsOptions = ({ max = 59, - min = 1, + min = 1 }: PartialUnitValueLimit): Array => getTimeInputOptions({ max, min }); diff --git a/www/front_src/src/Authentication/Local/defaults.ts b/www/front_src/src/Authentication/Local/defaults.ts index ba4a22c4ac5..27dcfa2dd90 100644 --- a/www/front_src/src/Authentication/Local/defaults.ts +++ b/www/front_src/src/Authentication/Local/defaults.ts @@ -2,14 +2,14 @@ import { adaptPasswordSecurityPolicyToAPI } from '../api/adapters'; import { PasswordSecurityPolicyFromAPI, - PasswordSecurityPolicyToAPI, + PasswordSecurityPolicyToAPI } from './models'; import { fifteenMinutes, oneDay, oneHour, sevenDays, - twelveMonths, + twelveMonths } from './timestamps'; export const defaultPasswordSecurityPolicy: PasswordSecurityPolicyFromAPI = { @@ -24,10 +24,10 @@ export const defaultPasswordSecurityPolicy: PasswordSecurityPolicyFromAPI = { hasUpperCase: true, passwordExpiration: { excludedUsers: [], - expirationDelay: sevenDays, + expirationDelay: sevenDays }, - passwordMinLength: 12, - }, + passwordMinLength: 12 + } }; export const defaultPasswordSecurityPolicyWithNullValues: PasswordSecurityPolicyToAPI = @@ -43,15 +43,15 @@ export const defaultPasswordSecurityPolicyWithNullValues: PasswordSecurityPolicy has_uppercase: false, password_expiration: { excluded_users: [], - expiration_delay: null, + expiration_delay: null }, - password_min_length: 12, - }, + password_min_length: 12 + } }; export const defaultPasswordSecurityPolicyAPI: PasswordSecurityPolicyToAPI = adaptPasswordSecurityPolicyToAPI( - defaultPasswordSecurityPolicy.password_security_policy, + defaultPasswordSecurityPolicy.password_security_policy ); export const retrievedPasswordSecurityPolicyAPI: PasswordSecurityPolicyToAPI = @@ -66,9 +66,9 @@ export const retrievedPasswordSecurityPolicyAPI: PasswordSecurityPolicyToAPI = hasUpperCase: false, passwordExpiration: { excludedUsers: [], - expirationDelay: sevenDays, + expirationDelay: sevenDays }, - passwordMinLength: 42, + passwordMinLength: 42 }); export const securityPolicyWithInvalidPasswordExpiration: PasswordSecurityPolicyToAPI = @@ -83,9 +83,9 @@ export const securityPolicyWithInvalidPasswordExpiration: PasswordSecurityPolicy hasUpperCase: true, passwordExpiration: { excludedUsers: [], - expirationDelay: twelveMonths + oneDay, + expirationDelay: twelveMonths + oneDay }, - passwordMinLength: 12, + passwordMinLength: 12 }); export const securityPolicyWithInvalidDelayBeforeNewPassword: PasswordSecurityPolicyToAPI = @@ -100,9 +100,9 @@ export const securityPolicyWithInvalidDelayBeforeNewPassword: PasswordSecurityPo hasUpperCase: true, passwordExpiration: { excludedUsers: [], - expirationDelay: sevenDays, + expirationDelay: sevenDays }, - passwordMinLength: 12, + passwordMinLength: 12 }); export const securityPolicyWithInvalidBlockingDuration: PasswordSecurityPolicyToAPI = @@ -117,7 +117,7 @@ export const securityPolicyWithInvalidBlockingDuration: PasswordSecurityPolicyTo hasUpperCase: true, passwordExpiration: { excludedUsers: [], - expirationDelay: sevenDays, + expirationDelay: sevenDays }, - passwordMinLength: 12, + passwordMinLength: 12 }); diff --git a/www/front_src/src/Authentication/Local/index.test.tsx b/www/front_src/src/Authentication/Local/index.test.tsx index 28aaff4f5ec..239619fffe3 100644 --- a/www/front_src/src/Authentication/Local/index.test.tsx +++ b/www/front_src/src/Authentication/Local/index.test.tsx @@ -10,12 +10,12 @@ import { TestQueryProvider, resetMocks, mockResponseOnce, - getFetchCall, + getFetchCall } from '@centreon/ui'; import { authenticationProvidersEndpoint, - contactsEndpoint, + contactsEndpoint } from '../api/endpoints'; import { Provider } from '../models'; @@ -51,7 +51,7 @@ import { labelChooseAValueBetween1and10, labelThisWillNotBeUsedBecauseNumberOfAttemptsIsNotDefined, labelBlockingDurationMustBeLessThanOrEqualTo7Days, - labelDay, + labelDay } from './translatedLabels'; import { defaultPasswordSecurityPolicyAPI, @@ -59,7 +59,7 @@ import { defaultPasswordSecurityPolicyWithNullValues, securityPolicyWithInvalidDelayBeforeNewPassword, securityPolicyWithInvalidPasswordExpiration, - securityPolicyWithInvalidBlockingDuration, + securityPolicyWithInvalidBlockingDuration } from './defaults'; import { PasswordSecurityPolicyToAPI } from './models'; @@ -74,23 +74,23 @@ const cancelTokenRequestParam = { cancelToken: {} }; const cancelTokenPutParams = { ...cancelTokenRequestParam, headers: { - 'Content-Type': 'application/x-www-form-urlencoded', - }, + 'Content-Type': 'application/x-www-form-urlencoded' + } }; const renderAuthentication = (): RenderResult => render( - , + ); const mockGetPasswordSecurityPolicy = ( - securityPolicy: PasswordSecurityPolicyToAPI, + securityPolicy: PasswordSecurityPolicyToAPI ): void => { mockedAxios.get.mockReset(); mockedAxios.get.mockResolvedValue({ - data: securityPolicy, + data: securityPolicy }); }; @@ -98,7 +98,7 @@ describe('Authentication', () => { beforeEach(() => { mockedAxios.put.mockReset(); mockedAxios.put.mockResolvedValue({ - data: {}, + data: {} }); }); @@ -107,13 +107,13 @@ describe('Authentication', () => { renderAuthentication(); expect( - screen.getByText(labelDefinePasswordPasswordSecurityPolicy), + screen.getByText(labelDefinePasswordPasswordSecurityPolicy) ).toBeInTheDocument(); await waitFor(() => { expect(mockedAxios.get).toHaveBeenCalledWith( authenticationProvidersEndpoint(Provider.Local), - cancelTokenRequestParam, + cancelTokenRequestParam ); }); @@ -129,7 +129,7 @@ describe('Authentication', () => { userEvent.type( screen.getByLabelText(labelMinimumPasswordLength), - '{selectall}{backspace}45', + '{selectall}{backspace}45' ); await waitFor(() => { @@ -144,10 +144,10 @@ describe('Authentication', () => { { password_security_policy: { ...defaultPasswordSecurityPolicyAPI.password_security_policy, - password_min_length: 45, - }, + password_min_length: 45 + } }, - cancelTokenPutParams, + cancelTokenPutParams ); }); }); @@ -157,13 +157,13 @@ describe('Authentication', () => { renderAuthentication(); expect( - screen.getByText(labelDefinePasswordPasswordSecurityPolicy), + screen.getByText(labelDefinePasswordPasswordSecurityPolicy) ).toBeInTheDocument(); await waitFor(() => { expect(mockedAxios.get).toHaveBeenCalledWith( authenticationProvidersEndpoint(Provider.Local), - cancelTokenRequestParam, + cancelTokenRequestParam ); }); @@ -179,12 +179,12 @@ describe('Authentication', () => { userEvent.type( screen.getByLabelText(labelMinimumPasswordLength), - '{selectall}{backspace}45', + '{selectall}{backspace}45' ); userEvent.type( screen.getByLabelText(labelNumberOfAttemptsBeforeUserIsBlocked), - '{selectall}{backspace}8', + '{selectall}{backspace}8' ); await waitFor(() => { @@ -211,13 +211,13 @@ describe('Authentication', () => { renderAuthentication(); expect( - screen.getByText(labelDefinePasswordPasswordSecurityPolicy), + screen.getByText(labelDefinePasswordPasswordSecurityPolicy) ).toBeInTheDocument(); await waitFor(() => { expect(mockedAxios.get).toHaveBeenCalledWith( authenticationProvidersEndpoint(Provider.Local), - cancelTokenRequestParam, + cancelTokenRequestParam ); }); @@ -233,7 +233,7 @@ describe('Authentication', () => { userEvent.type( screen.getByLabelText(labelNumberOfAttemptsBeforeUserIsBlocked), - '{selectall}{backspace}2', + '{selectall}{backspace}2' ); await waitFor(() => { @@ -248,10 +248,10 @@ describe('Authentication', () => { { password_security_policy: { ...retrievedPasswordSecurityPolicyAPI.password_security_policy, - attempts: 2, - }, + attempts: 2 + } }, - cancelTokenPutParams, + cancelTokenPutParams ); }); }); @@ -267,7 +267,7 @@ describe('Password case policy', () => { await waitFor(() => { expect( - screen.getByLabelText(labelMinimumPasswordLength), + screen.getByLabelText(labelMinimumPasswordLength) ).toBeInTheDocument(); }); @@ -277,16 +277,16 @@ describe('Password case policy', () => { expect(screen.getByLabelText(labelMinimumPasswordLength)).toHaveValue(12); expect( - screen.getAllByLabelText(labelPasswordMustContainLowerCase)[0], + screen.getAllByLabelText(labelPasswordMustContainLowerCase)[0] ).toBeInTheDocument(); expect( - screen.getAllByLabelText(labelPasswordMustContainUpperCase)[0], + screen.getAllByLabelText(labelPasswordMustContainUpperCase)[0] ).toBeInTheDocument(); expect( - screen.getAllByLabelText(labelPasswordMustContainNumbers)[0], + screen.getAllByLabelText(labelPasswordMustContainNumbers)[0] ).toBeInTheDocument(); expect( - screen.getAllByLabelText(labelPasswordMustContainSpecialCharacters)[0], + screen.getAllByLabelText(labelPasswordMustContainSpecialCharacters)[0] ).toBeInTheDocument(); expect(screen.getByText(labelStrong)).toBeInTheDocument(); }); @@ -296,13 +296,13 @@ describe('Password case policy', () => { await waitFor(() => { expect( - screen.getByLabelText(labelMinimumPasswordLength), + screen.getByLabelText(labelMinimumPasswordLength) ).toBeInTheDocument(); }); userEvent.type( screen.getByLabelText(labelMinimumPasswordLength), - '{selectall}{backspace}45', + '{selectall}{backspace}45' ); await waitFor(() => { @@ -316,28 +316,28 @@ describe('Password case policy', () => { await waitFor(() => { expect( - screen.getByLabelText(labelMinimumPasswordLength), + screen.getByLabelText(labelMinimumPasswordLength) ).toBeInTheDocument(); }); userEvent.click( - screen.getAllByLabelText(labelPasswordMustContainLowerCase)[0], + screen.getAllByLabelText(labelPasswordMustContainLowerCase)[0] ); userEvent.click( - screen.getAllByLabelText(labelPasswordMustContainUpperCase)[0], + screen.getAllByLabelText(labelPasswordMustContainUpperCase)[0] ); userEvent.click( - screen.getAllByLabelText(labelPasswordMustContainNumbers)[0], + screen.getAllByLabelText(labelPasswordMustContainNumbers)[0] ); userEvent.click( - screen.getAllByLabelText(labelPasswordMustContainSpecialCharacters)[0], + screen.getAllByLabelText(labelPasswordMustContainSpecialCharacters)[0] ); await waitFor(() => { expect(screen.getByText(labelStrong)).toBeInTheDocument(); }); userEvent.click( - screen.getAllByLabelText(labelPasswordMustContainSpecialCharacters)[0], + screen.getAllByLabelText(labelPasswordMustContainSpecialCharacters)[0] ); await waitFor(() => { @@ -345,7 +345,7 @@ describe('Password case policy', () => { }); userEvent.click( - screen.getAllByLabelText(labelPasswordMustContainNumbers)[0], + screen.getAllByLabelText(labelPasswordMustContainNumbers)[0] ); await waitFor(() => { @@ -360,22 +360,22 @@ const retrievedContacts = { page: 1, search: {}, sort_by: {}, - total: 2, + total: 2 }, result: [ { alias: 'admin', email: 'admin@admin.com', id: 1, - is_admin: true, + is_admin: true }, { alias: 'user', email: 'user@admin.com', id: 2, - is_admin: false, - }, - ], + is_admin: false + } + ] }; describe('Password expiration policy', () => { @@ -384,7 +384,7 @@ describe('Password expiration policy', () => { mockResponseOnce({ data: retrievedContacts }); mockedAxios.get.mockReset(); mockedAxios.get.mockResolvedValueOnce({ - data: defaultPasswordSecurityPolicyAPI, + data: defaultPasswordSecurityPolicyAPI }); }); @@ -393,7 +393,7 @@ describe('Password expiration policy', () => { await waitFor(() => { expect( - screen.getByText(labelPasswordExpirationPolicy), + screen.getByText(labelPasswordExpirationPolicy) ).toBeInTheDocument(); }); @@ -402,25 +402,25 @@ describe('Password expiration policy', () => { }); expect( - screen.getByLabelText(`${labelPasswordExpiresAfter} ${labelMonth}`), + screen.getByLabelText(`${labelPasswordExpiresAfter} ${labelMonth}`) ).toBeInTheDocument(); expect(screen.getByText(labelMonth)).toBeInTheDocument(); expect( - screen.getByLabelText(`${labelPasswordExpiresAfter} ${labelDays}`), + screen.getByLabelText(`${labelPasswordExpiresAfter} ${labelDays}`) ).toHaveTextContent('7'); expect(screen.getByText(labelDays)).toBeInTheDocument(); expect( - screen.getByText(labelMinimumTimeBetweenPasswordChanges), + screen.getByText(labelMinimumTimeBetweenPasswordChanges) ).toBeInTheDocument(); expect( screen.getByLabelText( - `${labelMinimumTimeBetweenPasswordChanges} ${labelHour}`, - ), + `${labelMinimumTimeBetweenPasswordChanges} ${labelHour}` + ) ).toHaveTextContent('1'); expect(screen.getByText(labelExcludedUsers)).toBeInTheDocument(); @@ -431,7 +431,7 @@ describe('Password expiration policy', () => { await waitFor(() => { expect( - screen.getByText(labelPasswordExpirationPolicy), + screen.getByText(labelPasswordExpirationPolicy) ).toBeInTheDocument(); }); @@ -441,37 +441,37 @@ describe('Password expiration policy', () => { userEvent.type( screen.getByLabelText(`${labelPasswordExpiresAfter} ${labelDays}`), - '{selectall}{backspace}', + '{selectall}{backspace}' ); await waitFor(() => { expect( - screen.queryByText(labelChooseADurationBetween7DaysAnd12Months), + screen.queryByText(labelChooseADurationBetween7DaysAnd12Months) ).not.toBeInTheDocument(); }); }); it('displays an error message when the delay before new password time is outside the bounds', async () => { mockGetPasswordSecurityPolicy( - securityPolicyWithInvalidDelayBeforeNewPassword, + securityPolicyWithInvalidDelayBeforeNewPassword ); renderAuthentication(); await waitFor(() => { expect( - screen.getByText(labelPasswordExpirationPolicy), + screen.getByText(labelPasswordExpirationPolicy) ).toBeInTheDocument(); }); await waitFor(() => { expect( - screen.getByText(labelMinimumTimeBetweenPasswordChanges), + screen.getByText(labelMinimumTimeBetweenPasswordChanges) ).toBeInTheDocument(); }); await waitFor(() => { expect( - screen.getByText(labelChooseADurationBetween1HourAnd1Week), + screen.getByText(labelChooseADurationBetween1HourAnd1Week) ).toBeInTheDocument(); }); @@ -480,7 +480,7 @@ describe('Password expiration policy', () => { await waitFor(() => { expect( - screen.getByText(labelChooseADurationBetween7DaysAnd12Months), + screen.getByText(labelChooseADurationBetween7DaysAnd12Months) ).toBeInTheDocument(); }); }); @@ -490,26 +490,26 @@ describe('Password expiration policy', () => { await waitFor(() => { expect( - screen.getByText(labelPasswordExpirationPolicy), + screen.getByText(labelPasswordExpirationPolicy) ).toBeInTheDocument(); }); await waitFor(() => { expect( - screen.getByText(labelMinimumTimeBetweenPasswordChanges), + screen.getByText(labelMinimumTimeBetweenPasswordChanges) ).toBeInTheDocument(); }); userEvent.type( screen.getByLabelText( - `${labelMinimumTimeBetweenPasswordChanges} ${labelHour}`, + `${labelMinimumTimeBetweenPasswordChanges} ${labelHour}` ), - '{selectall}{backspace}', + '{selectall}{backspace}' ); await waitFor(() => { expect( - screen.queryByText(labelChooseADurationBetween1HourAnd1Week), + screen.queryByText(labelChooseADurationBetween1HourAnd1Week) ).not.toBeInTheDocument(); }); }); @@ -519,13 +519,13 @@ describe('Password expiration policy', () => { await waitFor(() => { expect( - screen.getByText(labelPasswordExpirationPolicy), + screen.getByText(labelPasswordExpirationPolicy) ).toBeInTheDocument(); }); await waitFor(() => { expect( - screen.getByText(labelLast3PasswordsCanBeReused), + screen.getByText(labelLast3PasswordsCanBeReused) ).toBeInTheDocument(); }); @@ -533,7 +533,7 @@ describe('Password expiration policy', () => { await waitFor(() => { expect( - screen.getByLabelText(labelLast3PasswordsCanBeReused), + screen.getByLabelText(labelLast3PasswordsCanBeReused) ).toBeChecked(); }); }); @@ -543,7 +543,7 @@ describe('Password expiration policy', () => { await waitFor(() => { expect( - screen.getByText(labelPasswordExpirationPolicy), + screen.getByText(labelPasswordExpirationPolicy) ).toBeInTheDocument(); }); @@ -564,15 +564,15 @@ describe('Password expiration policy', () => { { field: 'provider_name', values: { - $eq: 'local', - }, - }, - ].filter(Boolean), + $eq: 'local' + } + } + ].filter(Boolean) }, - sort: { alias: 'ASC' }, - }, + sort: { alias: 'ASC' } + } }), - cancelTokenRequestParam, + cancelTokenRequestParam ); }); @@ -602,22 +602,22 @@ describe('Password Blocking Policy', () => { await waitFor(() => { expect( - screen.getByLabelText(labelNumberOfAttemptsBeforeUserIsBlocked), + screen.getByLabelText(labelNumberOfAttemptsBeforeUserIsBlocked) ).toBeInTheDocument(); }); expect( - screen.getByLabelText(labelNumberOfAttemptsBeforeUserIsBlocked), + screen.getByLabelText(labelNumberOfAttemptsBeforeUserIsBlocked) ).toHaveValue(5); expect( - screen.getByText(labelTimeThatMustPassBeforeNewConnection), + screen.getByText(labelTimeThatMustPassBeforeNewConnection) ).toBeInTheDocument(); expect( screen.getByLabelText( - `${labelTimeThatMustPassBeforeNewConnection} ${labelMinutes}`, - ), + `${labelTimeThatMustPassBeforeNewConnection} ${labelMinutes}` + ) ).toHaveTextContent('15'); expect(screen.getByText(labelWeak)).toBeInTheDocument(); @@ -632,40 +632,40 @@ describe('Password Blocking Policy', () => { await waitFor(() => { expect( - screen.getByLabelText(labelNumberOfAttemptsBeforeUserIsBlocked), + screen.getByLabelText(labelNumberOfAttemptsBeforeUserIsBlocked) ).toBeInTheDocument(); }); userEvent.type( screen.getByLabelText(labelNumberOfAttemptsBeforeUserIsBlocked), - '0', + '0' ); await waitFor(() => { expect( - screen.getByText(labelChooseAValueBetween1and10), + screen.getByText(labelChooseAValueBetween1and10) ).toBeInTheDocument(); }); userEvent.type( screen.getByLabelText(labelNumberOfAttemptsBeforeUserIsBlocked), - '{selectall}{backspace}8', + '{selectall}{backspace}8' ); await waitFor(() => { expect( - screen.queryByText(labelChooseAValueBetween1and10), + screen.queryByText(labelChooseAValueBetween1and10) ).not.toBeInTheDocument(); }); userEvent.type( screen.getByLabelText(labelNumberOfAttemptsBeforeUserIsBlocked), - '11', + '11' ); await waitFor(() => { expect( - screen.getByText(labelChooseAValueBetween1and10), + screen.getByText(labelChooseAValueBetween1and10) ).toBeInTheDocument(); }); }); @@ -679,20 +679,20 @@ describe('Password Blocking Policy', () => { await waitFor(() => { expect( - screen.getByLabelText(labelNumberOfAttemptsBeforeUserIsBlocked), + screen.getByLabelText(labelNumberOfAttemptsBeforeUserIsBlocked) ).toBeInTheDocument(); }); userEvent.type( screen.getByLabelText(labelNumberOfAttemptsBeforeUserIsBlocked), - '{selectall}{backspace}', + '{selectall}{backspace}' ); await waitFor(() => { expect( screen.getByText( - labelThisWillNotBeUsedBecauseNumberOfAttemptsIsNotDefined, - ), + labelThisWillNotBeUsedBecauseNumberOfAttemptsIsNotDefined + ) ).toBeInTheDocument(); }); }); @@ -707,7 +707,7 @@ describe('Password Blocking Policy', () => { await waitFor(() => { expect( - screen.getByText(labelBlockingDurationMustBeLessThanOrEqualTo7Days), + screen.getByText(labelBlockingDurationMustBeLessThanOrEqualTo7Days) ).toBeInTheDocument(); }); }); @@ -721,13 +721,13 @@ describe('Password Blocking Policy', () => { await waitFor(() => { expect( - screen.getByLabelText(labelNumberOfAttemptsBeforeUserIsBlocked), + screen.getByLabelText(labelNumberOfAttemptsBeforeUserIsBlocked) ).toBeInTheDocument(); }); userEvent.type( screen.getByLabelText(labelNumberOfAttemptsBeforeUserIsBlocked), - '{selectall}{backspace}2', + '{selectall}{backspace}2' ); await waitFor(() => { @@ -736,7 +736,7 @@ describe('Password Blocking Policy', () => { userEvent.type( screen.getByLabelText(labelNumberOfAttemptsBeforeUserIsBlocked), - '{selectall}{backspace}4', + '{selectall}{backspace}4' ); await waitFor(() => { @@ -754,15 +754,15 @@ describe('Password Blocking Policy', () => { await waitFor(() => { expect( screen.getByLabelText( - `${labelTimeThatMustPassBeforeNewConnection} ${labelDay}`, - ), + `${labelTimeThatMustPassBeforeNewConnection} ${labelDay}` + ) ).toBeInTheDocument(); }); userEvent.click( screen.getByLabelText( - `${labelTimeThatMustPassBeforeNewConnection} ${labelDay}`, - ), + `${labelTimeThatMustPassBeforeNewConnection} ${labelDay}` + ) ); userEvent.click(screen.getByText('6')); @@ -772,15 +772,15 @@ describe('Password Blocking Policy', () => { userEvent.click( screen.getByLabelText( - `${labelTimeThatMustPassBeforeNewConnection} ${labelDays}`, - ), + `${labelTimeThatMustPassBeforeNewConnection} ${labelDays}` + ) ); userEvent.click(screen.getByText('3')); userEvent.click( screen.getByLabelText( - `${labelTimeThatMustPassBeforeNewConnection} ${labelMinutes}`, - ), + `${labelTimeThatMustPassBeforeNewConnection} ${labelMinutes}` + ) ); userEvent.click(screen.getAllByText('0')[1]); diff --git a/www/front_src/src/Authentication/Local/index.tsx b/www/front_src/src/Authentication/Local/index.tsx index d99d378e20c..ea4db37ffa9 100644 --- a/www/front_src/src/Authentication/Local/index.tsx +++ b/www/front_src/src/Authentication/Local/index.tsx @@ -15,8 +15,8 @@ import { PasswordSecurityPolicy } from './models'; const useStyles = makeStyles((theme: Theme) => ({ loading: { - height: theme.spacing(0.5), - }, + height: theme.spacing(0.5) + } })); const LocalAuthentication = (): JSX.Element => { @@ -26,12 +26,12 @@ const LocalAuthentication = (): JSX.Element => { const { sendingGetPasswordPasswordSecurityPolicy, initialPasswordPasswordSecurityPolicy, - loadPasswordPasswordSecurityPolicy, + loadPasswordPasswordSecurityPolicy } = useAuthentication(); const isPasswordSecurityPolicyEmpty = useMemo( () => isNil(initialPasswordPasswordSecurityPolicy), - [initialPasswordPasswordSecurityPolicy], + [initialPasswordPasswordSecurityPolicy] ); useTab(isPasswordSecurityPolicyEmpty); diff --git a/www/front_src/src/Authentication/Local/useAuthentication.ts b/www/front_src/src/Authentication/Local/useAuthentication.ts index 0e63fa5f6b5..22bcdd2b293 100644 --- a/www/front_src/src/Authentication/Local/useAuthentication.ts +++ b/www/front_src/src/Authentication/Local/useAuthentication.ts @@ -17,19 +17,19 @@ interface UseAuthenticationState { const useAuthentication = (): UseAuthenticationState => { const [ initialPasswordPasswordSecurityPolicy, - setInitialPasswordSecurityPolicy, + setInitialPasswordSecurityPolicy ] = useState(null); const { sendRequest, sending } = useRequest({ decoder: securityPolicyDecoder, - request: getPasswordPasswordSecurityPolicy, + request: getPasswordPasswordSecurityPolicy }); const loadPasswordPasswordSecurityPolicy = (): void => { sendRequest() .then((securityPolicy) => setInitialPasswordSecurityPolicy( - adaptPasswordSecurityPolicyFromAPI(securityPolicy), - ), + adaptPasswordSecurityPolicyFromAPI(securityPolicy) + ) ) .catch(() => undefined); }; @@ -41,7 +41,7 @@ const useAuthentication = (): UseAuthenticationState => { return { initialPasswordPasswordSecurityPolicy, loadPasswordPasswordSecurityPolicy, - sendingGetPasswordPasswordSecurityPolicy: sending, + sendingGetPasswordPasswordSecurityPolicy: sending }; }; diff --git a/www/front_src/src/Authentication/Local/useValidationSchema.ts b/www/front_src/src/Authentication/Local/useValidationSchema.ts index 8136c904306..7130cf754ac 100644 --- a/www/front_src/src/Authentication/Local/useValidationSchema.ts +++ b/www/front_src/src/Authentication/Local/useValidationSchema.ts @@ -10,7 +10,7 @@ import { labelMaximum128Characters, labelMinimum8Characters, labelRequired, - labelBlockingDurationMustBeLessThanOrEqualTo7Days, + labelBlockingDurationMustBeLessThanOrEqualTo7Days } from './translatedLabels'; const useValidationSchema = (): Yup.SchemaOf => { @@ -42,12 +42,12 @@ const useValidationSchema = (): Yup.SchemaOf => { .min(sevenDays, t(labelChooseADurationBetween7DaysAnd12Months)) .max(twelveMonths, t(labelChooseADurationBetween7DaysAnd12Months)) .nullable() - .defined(), + .defined() }), passwordMinLength: Yup.number() .min(8, t(labelMinimum8Characters)) .max(128, t(labelMaximum128Characters)) - .defined(t(labelRequired)), + .defined(t(labelRequired)) }); }; diff --git a/www/front_src/src/Authentication/Openid/Form/index.tsx b/www/front_src/src/Authentication/Openid/Form/index.tsx index fd6a1935bb2..c8ff48f9c80 100644 --- a/www/front_src/src/Authentication/Openid/Form/index.tsx +++ b/www/front_src/src/Authentication/Openid/Form/index.tsx @@ -8,7 +8,7 @@ import useValidationSchema from '../useValidationSchema'; import { labelFailedToSaveOpenidConfiguration, labelOpenIDConnectConfigurationSaved, - labelRequired, + labelRequired } from '../translatedLabels'; import { putProviderConfiguration } from '../../api'; import { OpenidConfiguration, OpenidConfigurationToAPI } from '../models'; @@ -30,7 +30,7 @@ const isNilOrEmpty = (value): boolean => or(isNil(value), isEmpty(value)); const OpenidForm = ({ initialValues, loadOpenidConfiguration, - isLoading, + isLoading }: Props): JSX.Element => { const { t } = useTranslation(); @@ -39,7 +39,7 @@ const OpenidForm = ({ request: putProviderConfiguration< OpenidConfiguration, OpenidConfigurationToAPI - >({ adapter: adaptOpenidConfigurationToAPI, type: Provider.Openid }), + >({ adapter: adaptOpenidConfigurationToAPI, type: Provider.Openid }) }); const { showSuccessMessage } = useSnackbar(); @@ -47,7 +47,7 @@ const OpenidForm = ({ const submit = ( formikValues: OpenidConfiguration, - { setSubmitting }, + { setSubmitting } ): Promise => sendRequest(formikValues) .then(() => { @@ -60,7 +60,7 @@ const OpenidForm = ({ const isUserInfoOrIntrospectionTokenEmpty = pipe( pick(['introspectionTokenEndpoint', 'userinfoEndpoint']), values, - all(isNilOrEmpty), + all(isNilOrEmpty) )(formikValues); if (not(isUserInfoOrIntrospectionTokenEmpty)) { @@ -69,7 +69,7 @@ const OpenidForm = ({ return { introspectionTokenEndpoint: t(labelRequired), - userinfoEndpoint: t(labelRequired), + userinfoEndpoint: t(labelRequired) }; }; diff --git a/www/front_src/src/Authentication/Openid/Form/inputs.ts b/www/front_src/src/Authentication/Openid/Form/inputs.ts index adadc938dbe..8438b6e5ffd 100644 --- a/www/front_src/src/Authentication/Openid/Form/inputs.ts +++ b/www/front_src/src/Authentication/Openid/Form/inputs.ts @@ -49,7 +49,7 @@ import { labelContactGroup, labelGroupValue, labelDefinedTheRelationBetweenGroupsAndContactGroups, - labelGroupsAttributePath, + labelGroupsAttributePath } from '../translatedLabels'; import { AuthenticationType, EndpointType } from '../models'; import { @@ -57,12 +57,12 @@ import { labelAutoImportUsers, labelAuthenticationConditions, labelIdentityProvider, - labelGroupsMapping, + labelGroupsMapping } from '../../translatedLabels'; import { accessGroupsEndpoint, contactGroupsEndpoint, - contactTemplatesEndpoint, + contactTemplatesEndpoint } from '../../api/endpoints'; const isAutoImportDisabled = (values: FormikValues): boolean => @@ -77,41 +77,41 @@ const hideCustomEndpoint = !pathEq( [rootObject, 'endpoint', 'type'], EndpointType.CustomEndpoint, - values, + values ); const authenticationConditions: Array = [ { autocomplete: { creatable: true, - options: [], + options: [] }, fieldName: 'authenticationConditions.trustedClientAddresses', group: labelAuthenticationConditions, label: labelTrustedClientAddresses, - type: InputType.MultiAutocomplete, + type: InputType.MultiAutocomplete }, { autocomplete: { creatable: true, - options: [], + options: [] }, fieldName: 'authenticationConditions.blacklistClientAddresses', group: labelAuthenticationConditions, label: labelBlacklistClientAddresses, - type: InputType.MultiAutocomplete, + type: InputType.MultiAutocomplete }, { fieldName: 'authenticationConditions.isEnabled', group: labelAuthenticationConditions, label: labelEnableConditionsOnIdentityProvider, - type: InputType.Switch, + type: InputType.Switch }, { fieldName: 'authenticationConditions.attributePath', group: labelAuthenticationConditions, label: labelConditionsAttributePath, - type: InputType.Text, + type: InputType.Text }, { fieldName: 'authenticationConditions.endpoint.type', @@ -121,26 +121,26 @@ const authenticationConditions: Array = [ options: [ { label: labelIntrospectionEndpoint, - value: EndpointType.IntrospectionEndpoint, + value: EndpointType.IntrospectionEndpoint }, { label: labelUserIformation, - value: EndpointType.UserInformationEndpoint, + value: EndpointType.UserInformationEndpoint }, { label: labelOther, - value: EndpointType.CustomEndpoint, - }, - ], + value: EndpointType.CustomEndpoint + } + ] }, - type: InputType.Radio, + type: InputType.Radio }, { fieldName: 'authenticationConditions.endpoint.customEndpoint', group: labelAuthenticationConditions, hideInput: hideCustomEndpoint('authenticationConditions'), label: labelDefineYourEndpoint, - type: InputType.Text, + type: InputType.Text }, { fieldName: 'authenticationConditions.authorizedValues', @@ -149,19 +149,19 @@ const authenticationConditions: Array = [ { fieldName: '', label: labelConditionValue, - type: InputType.Text, - }, + type: InputType.Text + } ], defaultRowValue: { - conditionValue: '', + conditionValue: '' }, deleteLabel: labelDeleteRelation, - hasSingleValue: true, + hasSingleValue: true }, group: labelAuthenticationConditions, label: labelDefineAuthorizedConditionsValues, - type: InputType.FieldsTable, - }, + type: InputType.FieldsTable + } ]; const rolesMapping: Array = [ @@ -169,20 +169,20 @@ const rolesMapping: Array = [ fieldName: 'rolesMapping.isEnabled', group: labelRolesMapping, label: labelEnableAutoManagement, - type: InputType.Switch, + type: InputType.Switch }, { fieldName: 'rolesMapping.applyOnlyFirstRole', group: labelRolesMapping, label: labelApplyOnlyFirtsRole, - type: InputType.Switch, + type: InputType.Switch }, { fieldName: 'rolesMapping.attributePath', group: labelRolesMapping, label: labelRolesAttributePath, - type: InputType.Text, + type: InputType.Text }, { fieldName: 'rolesMapping.endpoint.type', @@ -192,26 +192,26 @@ const rolesMapping: Array = [ options: [ { label: labelIntrospectionEndpoint, - value: EndpointType.IntrospectionEndpoint, + value: EndpointType.IntrospectionEndpoint }, { label: labelUserIformation, - value: EndpointType.UserInformationEndpoint, + value: EndpointType.UserInformationEndpoint }, { label: labelOther, - value: EndpointType.CustomEndpoint, - }, - ], + value: EndpointType.CustomEndpoint + } + ] }, - type: InputType.Radio, + type: InputType.Radio }, { fieldName: 'rolesMapping.endpoint.customEndpoint', group: labelRolesMapping, hideInput: hideCustomEndpoint('rolesMapping'), label: labelDefineYourEndpoint, - type: InputType.Text, + type: InputType.Text }, { fieldName: 'rolesMapping.relations', @@ -220,28 +220,28 @@ const rolesMapping: Array = [ { fieldName: 'claimValue', label: labelRoleValue, - type: InputType.Text, + type: InputType.Text }, { connectedAutocomplete: { additionalConditionParameters: [], - endpoint: accessGroupsEndpoint, + endpoint: accessGroupsEndpoint }, fieldName: 'accessGroup', label: labelAclAccessGroup, - type: InputType.SingleConnectedAutocomplete, - }, + type: InputType.SingleConnectedAutocomplete + } ], defaultRowValue: { accessGroup: null, - claimValue: '', + claimValue: '' }, - deleteLabel: labelDeleteRelation, + deleteLabel: labelDeleteRelation }, group: labelRolesMapping, label: labelDefineRelationBetweenRolesAndAcl, - type: InputType.FieldsTable, - }, + type: InputType.FieldsTable + } ]; const groupsMapping: Array = [ @@ -249,13 +249,13 @@ const groupsMapping: Array = [ fieldName: 'groupsMapping.isEnabled', group: labelGroupsMapping, label: labelEnableAutoManagement, - type: InputType.Switch, + type: InputType.Switch }, { fieldName: 'groupsMapping.attributePath', group: labelGroupsMapping, label: labelGroupsAttributePath, - type: InputType.Text, + type: InputType.Text }, { fieldName: 'groupsMapping.endpoint.type', @@ -265,26 +265,26 @@ const groupsMapping: Array = [ options: [ { label: labelIntrospectionEndpoint, - value: EndpointType.IntrospectionEndpoint, + value: EndpointType.IntrospectionEndpoint }, { label: labelUserIformation, - value: EndpointType.UserInformationEndpoint, + value: EndpointType.UserInformationEndpoint }, { label: labelOther, - value: EndpointType.CustomEndpoint, - }, - ], + value: EndpointType.CustomEndpoint + } + ] }, - type: InputType.Radio, + type: InputType.Radio }, { fieldName: 'groupsMapping.endpoint.customEndpoint', group: labelGroupsMapping, hideInput: hideCustomEndpoint('groupsMapping'), label: labelDefineYourEndpoint, - type: InputType.Text, + type: InputType.Text }, { fieldName: 'groupsMapping.relations', @@ -293,28 +293,28 @@ const groupsMapping: Array = [ { fieldName: 'groupValue', label: labelGroupValue, - type: InputType.Text, + type: InputType.Text }, { connectedAutocomplete: { additionalConditionParameters: [], - endpoint: contactGroupsEndpoint, + endpoint: contactGroupsEndpoint }, fieldName: 'contactGroup', label: labelContactGroup, - type: InputType.SingleConnectedAutocomplete, - }, + type: InputType.SingleConnectedAutocomplete + } ], defaultRowValue: { contactGroup: null, - groupValue: '', + groupValue: '' }, - deleteLabel: labelDeleteRelation, + deleteLabel: labelDeleteRelation }, group: labelGroupsMapping, label: labelDefinedTheRelationBetweenGroupsAndContactGroups, - type: InputType.FieldsTable, - }, + type: InputType.FieldsTable + } ]; export const inputs: Array = [ @@ -322,7 +322,7 @@ export const inputs: Array = [ fieldName: 'isActive', group: labelActivation, label: labelEnableOpenIDConnectAuthentication, - type: InputType.Switch, + type: InputType.Switch }, { fieldName: 'isForced', @@ -332,85 +332,85 @@ export const inputs: Array = [ options: [ { label: labelOpenIDConnectOnly, - value: true, + value: true }, { label: labelMixed, - value: false, - }, - ], + value: false + } + ] }, - type: InputType.Radio, + type: InputType.Radio }, { fieldName: 'baseUrl', group: labelIdentityProvider, label: labelBaseUrl, required: true, - type: InputType.Text, + type: InputType.Text }, { fieldName: 'authorizationEndpoint', group: labelIdentityProvider, label: labelAuthorizationEndpoint, required: true, - type: InputType.Text, + type: InputType.Text }, { fieldName: 'tokenEndpoint', group: labelIdentityProvider, label: labelTokenEndpoint, required: true, - type: InputType.Text, + type: InputType.Text }, { fieldName: 'clientId', group: labelIdentityProvider, label: labelClientID, required: true, - type: InputType.Text, + type: InputType.Text }, { fieldName: 'clientSecret', group: labelIdentityProvider, label: labelClientSecret, required: true, - type: InputType.Password, + type: InputType.Password }, { autocomplete: { creatable: true, - options: [], + options: [] }, fieldName: 'connectionScopes', group: labelIdentityProvider, label: labelScopes, - type: InputType.MultiAutocomplete, + type: InputType.MultiAutocomplete }, { fieldName: 'loginClaim', group: labelIdentityProvider, label: labelLoginAttributePath, - type: InputType.Text, + type: InputType.Text }, { fieldName: 'endSessionEndpoint', group: labelIdentityProvider, label: labelEndSessionEndpoint, - type: InputType.Text, + type: InputType.Text }, { additionalLabel: labelAtLeastOneOfTheTwoFollowingFieldsMustBeFilled, fieldName: 'introspectionTokenEndpoint', group: labelIdentityProvider, label: labelIntrospectionTokenEndpoint, - type: InputType.Text, + type: InputType.Text }, { fieldName: 'userinfoEndpoint', group: labelIdentityProvider, label: labelUserInformationEndpoint, - type: InputType.Text, + type: InputType.Text }, { change: ({ setFieldValue, value }): void => { @@ -418,7 +418,7 @@ export const inputs: Array = [ 'authenticationType', value ? AuthenticationType.ClientSecretBasic - : AuthenticationType.ClientSecretPost, + : AuthenticationType.ClientSecretPost ); }, fieldName: 'authenticationType', @@ -426,33 +426,33 @@ export const inputs: Array = [ label: labelUseBasicAuthenticatonForTokenEndpointAuthentication, switchInput: { getChecked: (value): boolean => - equals(AuthenticationType.ClientSecretBasic, value), + equals(AuthenticationType.ClientSecretBasic, value) }, - type: InputType.Switch, + type: InputType.Switch }, { fieldName: 'verifyPeer', group: labelIdentityProvider, label: labelDisableVerifyPeer, - type: InputType.Switch, + type: InputType.Switch }, { fieldName: 'autoImport', group: labelAutoImportUsers, label: labelEnableAutoImport, - type: InputType.Switch, + type: InputType.Switch }, { connectedAutocomplete: { additionalConditionParameters: [], - endpoint: contactTemplatesEndpoint, + endpoint: contactTemplatesEndpoint }, fieldName: 'contactTemplate', getDisabled: isAutoImportDisabled, getRequired: isAutoImportEnabled, group: labelAutoImportUsers, label: labelContactTemplate, - type: InputType.SingleConnectedAutocomplete, + type: InputType.SingleConnectedAutocomplete }, { fieldName: 'emailBindAttribute', @@ -460,7 +460,7 @@ export const inputs: Array = [ getRequired: isAutoImportEnabled, group: labelAutoImportUsers, label: labelEmailAttributePath, - type: InputType.Text, + type: InputType.Text }, { fieldName: 'fullnameBindAttribute', @@ -468,9 +468,9 @@ export const inputs: Array = [ getRequired: isAutoImportEnabled, group: labelAutoImportUsers, label: labelFullnameAttributePath, - type: InputType.Text, + type: InputType.Text }, ...authenticationConditions, ...rolesMapping, - ...groupsMapping, + ...groupsMapping ]; diff --git a/www/front_src/src/Authentication/Openid/index.test.tsx b/www/front_src/src/Authentication/Openid/index.test.tsx index a12760f5be2..76cfe442ced 100644 --- a/www/front_src/src/Authentication/Openid/index.test.tsx +++ b/www/front_src/src/Authentication/Openid/index.test.tsx @@ -10,7 +10,7 @@ import { resetMocks, screen, TestQueryProvider, - waitFor, + waitFor } from '@centreon/ui'; import { Provider } from '../models'; @@ -18,13 +18,13 @@ import { accessGroupsEndpoint, authenticationProvidersEndpoint, contactGroupsEndpoint, - contactTemplatesEndpoint, + contactTemplatesEndpoint } from '../api/endpoints'; import { labelDoYouWantToResetTheForm, labelReset, labelResetTheForm, - labelSave, + labelSave } from '../Local/translatedLabels'; import { labelActivation } from '../translatedLabels'; @@ -66,7 +66,7 @@ import { labelTokenEndpoint, labelTrustedClientAddresses, labelUseBasicAuthenticatonForTokenEndpointAuthentication, - labelUserInformationEndpoint, + labelUserInformationEndpoint } from './translatedLabels'; import OpenidConfigurationForm from '.'; @@ -80,15 +80,15 @@ const cancelTokenRequestParam = { cancelToken: {} }; const cancelTokenPutParams = { ...cancelTokenRequestParam, headers: { - 'Content-Type': 'application/x-www-form-urlencoded', - }, + 'Content-Type': 'application/x-www-form-urlencoded' + } }; const renderOpenidConfigurationForm = (): RenderResult => render( - , + ); const retrievedOpenidConfiguration = { @@ -98,10 +98,10 @@ const retrievedOpenidConfiguration = { blacklist_client_addresses: ['127.0.0.1'], endpoint: { custom_endpoint: null, - type: 'introspection_endpoint', + type: 'introspection_endpoint' }, is_enabled: false, - trusted_client_addresses: ['127.0.0.1'], + trusted_client_addresses: ['127.0.0.1'] }, authentication_type: 'client_secret_post', authorization_endpoint: '/authorize', @@ -118,10 +118,10 @@ const retrievedOpenidConfiguration = { attribute_path: 'group attribute path', endpoint: { custom_endpoint: '/group/endpoint', - type: 'custom_endpoint', + type: 'custom_endpoint' }, is_enabled: true, - relations: [], + relations: [] }, introspection_token_endpoint: '/introspect', is_active: true, @@ -132,32 +132,32 @@ const retrievedOpenidConfiguration = { attribute_path: 'role attribute path', endpoint: { custom_endpoint: '/role/endpoint', - type: 'custom_endpoint', + type: 'custom_endpoint' }, is_enabled: false, - relations: [], + relations: [] }, token_endpoint: '/token', userinfo_endpoint: '/userinfo', - verify_peer: false, + verify_peer: false }; const getRetrievedEntities = (label: string): unknown => ({ meta: { limit: 10, page: 1, - total: 30, + total: 30 }, result: [ { id: 1, - name: `${label} 1`, + name: `${label} 1` }, { id: 2, - name: `${label} 2`, - }, - ], + name: `${label} 2` + } + ] }); const retrievedAccessGroups = getRetrievedEntities('Access Group'); @@ -168,7 +168,7 @@ const mockGetBasicRequests = (): void => { resetMocks(); mockedAxios.get.mockReset(); mockedAxios.get.mockResolvedValue({ - data: retrievedOpenidConfiguration, + data: retrievedOpenidConfiguration }); }; @@ -178,7 +178,7 @@ describe('Openid configuration form', () => { mockedAxios.put.mockReset(); mockedAxios.put.mockResolvedValue({ - data: {}, + data: {} }); }); @@ -186,13 +186,13 @@ describe('Openid configuration form', () => { renderOpenidConfigurationForm(); expect( - screen.getByText(labelDefineOpenIDConnectConfiguration), + screen.getByText(labelDefineOpenIDConnectConfiguration) ).toBeInTheDocument(); await waitFor(() => { expect(mockedAxios.get).toHaveBeenCalledWith( authenticationProvidersEndpoint(Provider.Openid), - cancelTokenRequestParam, + cancelTokenRequestParam ); }); @@ -202,85 +202,85 @@ describe('Openid configuration form', () => { await waitFor(() => { expect( - screen.getByLabelText(labelEnableOpenIDConnectAuthentication), + screen.getByLabelText(labelEnableOpenIDConnectAuthentication) ).toBeChecked(); }); expect(screen.getByLabelText(labelOpenIDConnectOnly)).not.toBeChecked(); expect(screen.getByLabelText(labelMixed)).toBeChecked(); expect( - screen.getByLabelText(`${labelTrustedClientAddresses}`), + screen.getByLabelText(`${labelTrustedClientAddresses}`) ).toBeInTheDocument(); expect( - screen.getByLabelText(`${labelBlacklistClientAddresses}`), + screen.getByLabelText(`${labelBlacklistClientAddresses}`) ).toBeInTheDocument(); expect(screen.getAllByText('127.0.0.1')).toHaveLength(2); expect(screen.getByLabelText(labelBaseUrl)).toHaveValue( - 'https://localhost:8080', + 'https://localhost:8080' ); expect(screen.getByLabelText(labelAuthorizationEndpoint)).toHaveValue( - '/authorize', + '/authorize' ); expect(screen.getByLabelText(labelTokenEndpoint)).toHaveValue('/token'); expect(screen.getByLabelText(labelIntrospectionTokenEndpoint)).toHaveValue( - '/introspect', + '/introspect' ); expect( - screen.getByLabelText(labelUserInformationEndpoint), + screen.getByLabelText(labelUserInformationEndpoint) ).toBeInTheDocument(); expect(screen.getByLabelText(labelEndSessionEndpoint)).toHaveValue( - '/logout', + '/logout' ); expect(screen.getByLabelText(`${labelScopes}`)).toBeInTheDocument(); expect(screen.getByText('openid')).toBeInTheDocument(); expect(screen.getByLabelText(labelLoginAttributePath)).toHaveValue('sub'); expect(screen.getByLabelText(labelClientID)).toHaveValue('client_id'); expect(screen.getByLabelText(labelClientSecret)).toHaveValue( - 'client_secret', + 'client_secret' ); expect( screen.getByLabelText( - labelUseBasicAuthenticatonForTokenEndpointAuthentication, - ), + labelUseBasicAuthenticatonForTokenEndpointAuthentication + ) ).not.toBeChecked(); expect(screen.getByLabelText(labelDisableVerifyPeer)).not.toBeChecked(); expect(screen.getByLabelText(labelEnableAutoImport)).not.toBeChecked(); expect(screen.getByLabelText(labelEmailAttributePath)).toHaveValue('email'); expect(screen.getByLabelText(labelFullnameAttributePath)).toHaveValue( - 'lastname', + 'lastname' ); expect( - screen.getByLabelText(labelEnableConditionsOnIdentityProvider), + screen.getByLabelText(labelEnableConditionsOnIdentityProvider) ).not.toBeChecked(); expect(screen.getByLabelText(labelConditionsAttributePath)).toHaveValue( - 'auth attribute path', + 'auth attribute path' ); expect( - head(screen.getAllByLabelText(labelIntrospectionEndpoint)), + head(screen.getAllByLabelText(labelIntrospectionEndpoint)) ).toBeChecked(); expect(head(screen.getAllByLabelText(labelConditionValue))).toHaveValue( - 'authorized', + 'authorized' ); expect( - head(screen.getAllByLabelText(labelEnableAutoManagement)), + head(screen.getAllByLabelText(labelEnableAutoManagement)) ).not.toBeChecked(); expect(screen.getByLabelText(labelApplyOnlyFirtsRole)).toBeChecked(); expect(screen.getByLabelText(labelRolesAttributePath)).toHaveValue( - 'role attribute path', + 'role attribute path' ); expect(screen.getAllByLabelText(labelOther).at(1)).toBeChecked(); expect(head(screen.getAllByLabelText(labelDefineYourEndpoint))).toHaveValue( - '/role/endpoint', + '/role/endpoint' ); expect( - last(screen.getAllByLabelText(labelEnableAutoManagement)), + last(screen.getAllByLabelText(labelEnableAutoManagement)) ).toBeChecked(); expect(screen.getByLabelText(labelGroupsAttributePath)).toHaveValue( - 'group attribute path', + 'group attribute path' ); expect(last(screen.getAllByLabelText(labelOther))).toBeChecked(); expect(last(screen.getAllByLabelText(labelDefineYourEndpoint))).toHaveValue( - '/group/endpoint', + '/group/endpoint' ); }); @@ -290,7 +290,7 @@ describe('Openid configuration form', () => { await waitFor(() => { expect(mockedAxios.get).toHaveBeenCalledWith( authenticationProvidersEndpoint(Provider.Openid), - cancelTokenRequestParam, + cancelTokenRequestParam ); }); @@ -300,7 +300,7 @@ describe('Openid configuration form', () => { userEvent.type( screen.getByLabelText(labelBaseUrl), - '{selectall}{backspace}invalid base url', + '{selectall}{backspace}invalid base url' ); userEvent.tab(); @@ -310,25 +310,25 @@ describe('Openid configuration form', () => { userEvent.type( screen.getByLabelText(`${labelTrustedClientAddresses}`), - 'invalid domain', + 'invalid domain' ); userEvent.keyboard('{Enter}'); await waitFor(() => { expect( - screen.getByText(`invalid domain: ${labelInvalidIPAddress}`), + screen.getByText(`invalid domain: ${labelInvalidIPAddress}`) ).toBeInTheDocument(); }); userEvent.type( screen.getByLabelText(`${labelBlacklistClientAddresses}`), - '127.0.0.1111', + '127.0.0.1111' ); userEvent.keyboard('{Enter}'); await waitFor(() => { expect( - screen.getByText(`127.0.0.1111: ${labelInvalidIPAddress}`), + screen.getByText(`127.0.0.1111: ${labelInvalidIPAddress}`) ).toBeInTheDocument(); }); @@ -340,13 +340,13 @@ describe('Openid configuration form', () => { renderOpenidConfigurationForm(); mockResponseOnce({ - data: retrievedContactGroups, + data: retrievedContactGroups }); await waitFor(() => { expect(mockedAxios.get).toHaveBeenCalledWith( authenticationProvidersEndpoint(Provider.Openid), - cancelTokenRequestParam, + cancelTokenRequestParam ); }); @@ -356,7 +356,7 @@ describe('Openid configuration form', () => { userEvent.type( screen.getByLabelText(labelBaseUrl), - '{selectall}{backspace}http://localhost:8081/login', + '{selectall}{backspace}http://localhost:8081/login' ); userEvent.tab(); @@ -374,7 +374,7 @@ describe('Openid configuration form', () => { userEvent.type( head(screen.getAllByLabelText(labelGroupValue)) as HTMLElement, - 'groupValue', + 'groupValue' ); userEvent.click(screen.getByText(labelSave)); @@ -387,17 +387,17 @@ describe('Openid configuration form', () => { base_url: 'http://localhost:8081/login', groups_mapping: { ...retrievedOpenidConfiguration.groups_mapping, - relations: [{ contact_group_id: 2, group_value: 'groupValue' }], - }, + relations: [{ contact_group_id: 2, group_value: 'groupValue' }] + } }, - cancelTokenPutParams, + cancelTokenPutParams ); }); await waitFor(() => { expect(mockedAxios.get).toHaveBeenCalledWith( authenticationProvidersEndpoint(Provider.Openid), - cancelTokenRequestParam, + cancelTokenRequestParam ); }); }); @@ -408,7 +408,7 @@ describe('Openid configuration form', () => { await waitFor(() => { expect(mockedAxios.get).toHaveBeenCalledWith( authenticationProvidersEndpoint(Provider.Openid), - cancelTokenRequestParam, + cancelTokenRequestParam ); }); @@ -418,7 +418,7 @@ describe('Openid configuration form', () => { userEvent.type( screen.getByLabelText(labelBaseUrl), - '{selectall}{backspace}http://localhost:8081/login', + '{selectall}{backspace}http://localhost:8081/login' ); userEvent.tab(); @@ -438,7 +438,7 @@ describe('Openid configuration form', () => { await waitFor(() => { expect(screen.getByLabelText(labelBaseUrl)).toHaveValue( - 'https://localhost:8080', + 'https://localhost:8080' ); }); }); @@ -449,13 +449,13 @@ describe('Openid configuration form', () => { await waitFor(() => { expect(mockedAxios.get).toHaveBeenCalledWith( authenticationProvidersEndpoint(Provider.Openid), - cancelTokenRequestParam, + cancelTokenRequestParam ); }); await waitFor(() => { expect( - screen.getByLabelText(labelEmailAttributePath), + screen.getByLabelText(labelEmailAttributePath) ).toBeInTheDocument(); }); @@ -478,22 +478,22 @@ describe('Openid configuration form', () => { retrievedContactTemplates, contactTemplatesEndpoint, labelContactTemplate, - 'Contact Template 2', + 'Contact Template 2' ], [ 'access group', retrievedAccessGroups, accessGroupsEndpoint, labelAclAccessGroup, - 'Access Group 2', + 'Access Group 2' ], [ 'contact group', retrievedContactGroups, contactGroupsEndpoint, labelContactGroup, - 'Contact Group 2', - ], + 'Contact Group 2' + ] ])( 'updates the %p field when an option is selected from the retrieved options', async (_, retrievedOptions, endpoint, label, value) => { @@ -501,13 +501,13 @@ describe('Openid configuration form', () => { renderOpenidConfigurationForm(); mockResponseOnce({ - data: retrievedOptions, + data: retrievedOptions }); await waitFor(() => { expect(mockedAxios.get).toHaveBeenCalledWith( authenticationProvidersEndpoint(Provider.Openid), - cancelTokenRequestParam, + cancelTokenRequestParam ); }); @@ -522,8 +522,8 @@ describe('Openid configuration form', () => { await waitFor(() => { expect(getFetchCall(0)).toEqual( `${endpoint}?page=1&sort_by=${encodeURIComponent( - '{"name":"ASC"}', - )}&search=${encodeURIComponent('{"$and":[]}')}`, + '{"name":"ASC"}' + )}&search=${encodeURIComponent('{"$and":[]}')}` ); }); @@ -536,7 +536,7 @@ describe('Openid configuration form', () => { await waitFor(() => { expect(screen.getAllByLabelText(label)[0]).toHaveValue(value); }); - }, + } ); it('disables the save button when the "Groups mapping" custom endpoint field is cleared', async () => { @@ -545,7 +545,7 @@ describe('Openid configuration form', () => { await waitFor(() => { expect(mockedAxios.get).toHaveBeenCalledWith( authenticationProvidersEndpoint(Provider.Openid), - cancelTokenRequestParam, + cancelTokenRequestParam ); }); @@ -555,7 +555,7 @@ describe('Openid configuration form', () => { userEvent.type( screen.getByLabelText(labelBaseUrl), - '{selectall}{backspace}http://localhost:8081/login', + '{selectall}{backspace}http://localhost:8081/login' ); await waitFor(() => { @@ -564,7 +564,7 @@ describe('Openid configuration form', () => { userEvent.type( last(screen.getAllByLabelText(labelDefineYourEndpoint)) as HTMLElement, - '{selectall}{backspace}', + '{selectall}{backspace}' ); await waitFor(() => { @@ -576,13 +576,13 @@ describe('Openid configuration form', () => { renderOpenidConfigurationForm(); mockResponseOnce({ - data: retrievedContactGroups, + data: retrievedContactGroups }); await waitFor(() => { expect(mockedAxios.get).toHaveBeenCalledWith( authenticationProvidersEndpoint(Provider.Openid), - cancelTokenRequestParam, + cancelTokenRequestParam ); }); @@ -595,8 +595,8 @@ describe('Openid configuration form', () => { await waitFor(() => { expect(getFetchCall(0)).toEqual( `${contactGroupsEndpoint}?page=1&sort_by=${encodeURIComponent( - '{"name":"ASC"}', - )}&search=${encodeURIComponent('{"$and":[]}')}`, + '{"name":"ASC"}' + )}&search=${encodeURIComponent('{"$and":[]}')}` ); }); @@ -608,7 +608,7 @@ describe('Openid configuration form', () => { await waitFor(() => { expect(screen.getAllByLabelText(labelContactGroup)[0]).toHaveValue( - 'Contact Group 2', + 'Contact Group 2' ); }); @@ -637,7 +637,7 @@ describe('Openid configuration form', () => { userEvent.type( screen.getAllByLabelText(labelConditionValue)[1], - 'some text', + 'some text' ); expect(screen.getAllByLabelText(labelConditionValue)).toHaveLength(3); @@ -651,7 +651,7 @@ describe('Openid configuration form', () => { userEvent.type( screen.getAllByLabelText(labelConditionValue)[1], - 'some text', + 'some text' ); expect(screen.getAllByLabelText(labelDeleteRelation)).toHaveLength(2); diff --git a/www/front_src/src/Authentication/Openid/index.tsx b/www/front_src/src/Authentication/Openid/index.tsx index dd5864a6be2..d6d0393b72c 100644 --- a/www/front_src/src/Authentication/Openid/index.tsx +++ b/www/front_src/src/Authentication/Openid/index.tsx @@ -15,8 +15,8 @@ import { OpenidConfiguration } from './models'; const useStyles = makeStyles((theme) => ({ loading: { - height: theme.spacing(0.5), - }, + height: theme.spacing(0.5) + } })); const OpenidConfigurationForm = (): JSX.Element => { @@ -26,12 +26,12 @@ const OpenidConfigurationForm = (): JSX.Element => { const { sendingGetOpenidConfiguration, initialOpenidConfiguration, - loadOpenidConfiguration, + loadOpenidConfiguration } = useOpenid(); const isOpenidConfigurationEmpty = useMemo( () => isNil(initialOpenidConfiguration), - [initialOpenidConfiguration], + [initialOpenidConfiguration] ); useTab(isOpenidConfigurationEmpty); diff --git a/www/front_src/src/Authentication/Openid/models.ts b/www/front_src/src/Authentication/Openid/models.ts index c2623edb79c..fc8907355fc 100644 --- a/www/front_src/src/Authentication/Openid/models.ts +++ b/www/front_src/src/Authentication/Openid/models.ts @@ -1,7 +1,7 @@ export enum EndpointType { CustomEndpoint = 'custom_endpoint', IntrospectionEndpoint = 'introspection_endpoint', - UserInformationEndpoint = 'user_information_endpoint', + UserInformationEndpoint = 'user_information_endpoint' } export interface NamedEntity { @@ -137,5 +137,5 @@ export interface OpenidConfigurationToAPI { export enum AuthenticationType { ClientSecretBasic = 'client_secret_basic', - ClientSecretPost = 'client_secret_post', + ClientSecretPost = 'client_secret_post' } diff --git a/www/front_src/src/Authentication/Openid/useOpenid.ts b/www/front_src/src/Authentication/Openid/useOpenid.ts index 43d5b557125..30121c1a1fc 100644 --- a/www/front_src/src/Authentication/Openid/useOpenid.ts +++ b/www/front_src/src/Authentication/Openid/useOpenid.ts @@ -19,7 +19,7 @@ const useOpenid = (): UseOpenidState => { useState(null); const { sendRequest, sending } = useRequest({ decoder: openidConfigurationDecoder, - request: getProviderConfiguration(Provider.Openid), + request: getProviderConfiguration(Provider.Openid) }); const loadOpenidConfiguration = (): void => { @@ -31,7 +31,7 @@ const useOpenid = (): UseOpenidState => { return { initialOpenidConfiguration, loadOpenidConfiguration, - sendingGetOpenidConfiguration: sending, + sendingGetOpenidConfiguration: sending }; }; diff --git a/www/front_src/src/Authentication/Openid/useValidationSchema.ts b/www/front_src/src/Authentication/Openid/useValidationSchema.ts index b85e23f2b6e..9b1ea639b60 100644 --- a/www/front_src/src/Authentication/Openid/useValidationSchema.ts +++ b/www/front_src/src/Authentication/Openid/useValidationSchema.ts @@ -5,7 +5,7 @@ import { OpenidConfiguration, NamedEntity, EndpointType } from './models'; import { labelRequired, labelInvalidURL, - labelInvalidIPAddress, + labelInvalidIPAddress } from './translatedLabels'; const IPAddressRegexp = /^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}(\/\d{1,3})?$/; @@ -17,17 +17,17 @@ const useValidationSchema = (): Yup.SchemaOf => { const namedEntitySchema: Yup.SchemaOf = Yup.object({ id: Yup.number().required(t(labelRequired)), - name: Yup.string().required(t(labelRequired)), + name: Yup.string().required(t(labelRequired)) }); const rolesRelationSchema = Yup.object({ accessGroup: namedEntitySchema.nullable().required(t(labelRequired)), - claimValue: Yup.string().required(t(labelRequired)), + claimValue: Yup.string().required(t(labelRequired)) }); const groupsRelationSchema = Yup.object({ contactGroup: namedEntitySchema.nullable().required(t(labelRequired)), - groupValue: Yup.string().required(t(labelRequired)), + groupValue: Yup.string().required(t(labelRequired)) }); const endpointTypeSchema = Yup.mixed() @@ -38,9 +38,9 @@ const useValidationSchema = (): Yup.SchemaOf => { customEndpoint: Yup.string().when('type', { is: EndpointType.CustomEndpoint, otherwise: (schema) => schema.nullable(), - then: (schema) => schema.required(t(labelRequired)), + then: (schema) => schema.required(t(labelRequired)) }), - type: endpointTypeSchema, + type: endpointTypeSchema }); return Yup.object({ @@ -50,15 +50,15 @@ const useValidationSchema = (): Yup.SchemaOf => { blacklistClientAddresses: Yup.array().of( Yup.string() .matches(IPAddressRegexp, t(labelInvalidIPAddress)) - .required(t(labelRequired)), + .required(t(labelRequired)) ), endpoint: endpointSchema, isEnabled: switchSchema, trustedClientAddresses: Yup.array().of( Yup.string() .matches(IPAddressRegexp, t(labelInvalidIPAddress)) - .required(t(labelRequired)), - ), + .required(t(labelRequired)) + ) }), authenticationType: Yup.string().required(t(labelRequired)), authorizationEndpoint: Yup.string().nullable().required(t(labelRequired)), @@ -84,7 +84,7 @@ const useValidationSchema = (): Yup.SchemaOf => { return autoImport ? schema.nullable().required(t(labelRequired)) : schema.nullable(); - }, + } ), endSessionEndpoint: Yup.string().nullable(), fullnameBindAttribute: Yup.string().when( @@ -93,13 +93,13 @@ const useValidationSchema = (): Yup.SchemaOf => { return autoImport ? schema.nullable().required(t(labelRequired)) : schema.nullable(); - }, + } ), groupsMapping: Yup.object({ attributePath: Yup.string(), endpoint: endpointSchema, isEnabled: switchSchema, - relations: Yup.array().of(groupsRelationSchema), + relations: Yup.array().of(groupsRelationSchema) }), introspectionTokenEndpoint: Yup.string().nullable(), isActive: switchSchema, @@ -110,11 +110,11 @@ const useValidationSchema = (): Yup.SchemaOf => { attributePath: Yup.string(), endpoint: endpointSchema, isEnabled: switchSchema, - relations: Yup.array().of(rolesRelationSchema), + relations: Yup.array().of(rolesRelationSchema) }), tokenEndpoint: Yup.string().nullable().required(t(labelRequired)), userinfoEndpoint: Yup.string().nullable(), - verifyPeer: switchSchema, + verifyPeer: switchSchema }); }; diff --git a/www/front_src/src/Authentication/WebSSO/Form/index.tsx b/www/front_src/src/Authentication/WebSSO/Form/index.tsx index 56152ebc5fe..e1fe4970fb7 100644 --- a/www/front_src/src/Authentication/WebSSO/Form/index.tsx +++ b/www/front_src/src/Authentication/WebSSO/Form/index.tsx @@ -5,7 +5,7 @@ import { useRequest, useSnackbar, Form } from '@centreon/ui'; import useValidationSchema from '../useValidationSchema'; import { labelFailedToSaveWebSSOConfiguration, - labelWebSSOConfigurationSaved, + labelWebSSOConfigurationSaved } from '../translatedLabels'; import { putProviderConfiguration } from '../../api'; import { WebSSOConfiguration, WebSSOConfigurationToAPI } from '../models'; @@ -25,7 +25,7 @@ interface Props { const WebSSOForm = ({ initialValues, loadWebSSOonfiguration, - isLoading, + isLoading }: Props): JSX.Element => { const { t } = useTranslation(); @@ -36,8 +36,8 @@ const WebSSOForm = ({ WebSSOConfigurationToAPI >({ adapter: adaptWebSSOConfigurationToAPI, - type: Provider.WebSSO, - }), + type: Provider.WebSSO + }) }); const { showSuccessMessage } = useSnackbar(); @@ -45,7 +45,7 @@ const WebSSOForm = ({ const submit = ( values: WebSSOConfiguration, - { setSubmitting }, + { setSubmitting } ): Promise => sendRequest(values) .then(() => { diff --git a/www/front_src/src/Authentication/WebSSO/Form/inputs.ts b/www/front_src/src/Authentication/WebSSO/Form/inputs.ts index eedcd0391e0..5508a11bd3c 100644 --- a/www/front_src/src/Authentication/WebSSO/Form/inputs.ts +++ b/www/front_src/src/Authentication/WebSSO/Form/inputs.ts @@ -9,12 +9,12 @@ import { labelPatternMatchLogin, labelPatternReplaceLogin, labelEnableWebSSOAuthentication, - labelAuthenticationMode, + labelAuthenticationMode } from '../translatedLabels'; import { labelActivation, labelClientAddresses, - labelIdentityProvider, + labelIdentityProvider } from '../../translatedLabels'; export const inputs: Array = [ @@ -22,7 +22,7 @@ export const inputs: Array = [ fieldName: 'isActive', group: labelActivation, label: labelEnableWebSSOAuthentication, - type: InputType.Switch, + type: InputType.Switch }, { fieldName: 'isForced', @@ -32,53 +32,53 @@ export const inputs: Array = [ options: [ { label: labelWebSSOOnly, - value: true, + value: true }, { label: labelMixed, - value: false, - }, - ], + value: false + } + ] }, - type: InputType.Radio, + type: InputType.Radio }, { autocomplete: { creatable: true, - options: [], + options: [] }, fieldName: 'trustedClientAddresses', group: labelClientAddresses, label: labelTrustedClientAddresses, - type: InputType.MultiAutocomplete, + type: InputType.MultiAutocomplete }, { autocomplete: { creatable: true, - options: [], + options: [] }, fieldName: 'blacklistClientAddresses', group: labelClientAddresses, label: labelBlacklistClientAddresses, - type: InputType.MultiAutocomplete, + type: InputType.MultiAutocomplete }, { fieldName: 'loginHeaderAttribute', group: labelIdentityProvider, label: labelLoginHeaderAttributeName, required: true, - type: InputType.Text, + type: InputType.Text }, { fieldName: 'patternMatchingLogin', group: labelIdentityProvider, label: labelPatternMatchLogin, - type: InputType.Text, + type: InputType.Text }, { fieldName: 'patternReplaceLogin', group: labelIdentityProvider, label: labelPatternReplaceLogin, - type: InputType.Text, - }, + type: InputType.Text + } ]; diff --git a/www/front_src/src/Authentication/WebSSO/index.test.tsx b/www/front_src/src/Authentication/WebSSO/index.test.tsx index fcfc1c3724f..d0b9e3cb4e7 100644 --- a/www/front_src/src/Authentication/WebSSO/index.test.tsx +++ b/www/front_src/src/Authentication/WebSSO/index.test.tsx @@ -9,7 +9,7 @@ import { labelDoYouWantToResetTheForm, labelReset, labelResetTheForm, - labelSave, + labelSave } from '../Local/translatedLabels'; import { labelActivation } from '../translatedLabels'; @@ -24,7 +24,7 @@ import { labelPatternMatchLogin, labelPatternReplaceLogin, labelTrustedClientAddresses, - labelWebSSOOnly, + labelWebSSOOnly } from './translatedLabels'; import WebSSOConfigurationForm from '.'; @@ -38,8 +38,8 @@ const cancelTokenRequestParam = { cancelToken: {} }; const cancelTokenPutParams = { ...cancelTokenRequestParam, headers: { - 'Content-Type': 'application/x-www-form-urlencoded', - }, + 'Content-Type': 'application/x-www-form-urlencoded' + } }; const renderWebSSOConfigurationForm = (): RenderResult => @@ -52,19 +52,19 @@ const retrievedWebSSOConfiguration = { login_header_attribute: '', pattern_matching_login: null, pattern_replace_login: null, - trusted_client_addresses: ['127.0.0.1'], + trusted_client_addresses: ['127.0.0.1'] }; describe('Web SSOconfiguration form', () => { beforeEach(() => { mockedAxios.get.mockReset(); mockedAxios.get.mockResolvedValue({ - data: retrievedWebSSOConfiguration, + data: retrievedWebSSOConfiguration }); mockedAxios.put.mockReset(); mockedAxios.put.mockResolvedValue({ - data: {}, + data: {} }); }); @@ -72,13 +72,13 @@ describe('Web SSOconfiguration form', () => { renderWebSSOConfigurationForm(); expect( - screen.getByText(labelDefineWebSSOConfiguration), + screen.getByText(labelDefineWebSSOConfiguration) ).toBeInTheDocument(); await waitFor(() => { expect(mockedAxios.get).toHaveBeenCalledWith( authenticationProvidersEndpoint(Provider.WebSSO), - cancelTokenRequestParam, + cancelTokenRequestParam ); }); @@ -88,21 +88,21 @@ describe('Web SSOconfiguration form', () => { await waitFor(() => { expect( - screen.getByLabelText(labelEnableWebSSOAuthentication), + screen.getByLabelText(labelEnableWebSSOAuthentication) ).toBeChecked(); }); expect(screen.getByLabelText(labelWebSSOOnly)).not.toBeChecked(); expect(screen.getByLabelText(labelMixed)).toBeChecked(); expect( - screen.getByLabelText(`${labelTrustedClientAddresses}`), + screen.getByLabelText(`${labelTrustedClientAddresses}`) ).toBeInTheDocument(); expect( - screen.getByLabelText(`${labelBlacklistClientAddresses}`), + screen.getByLabelText(`${labelBlacklistClientAddresses}`) ).toBeInTheDocument(); expect(screen.getAllByText('127.0.0.1')).toHaveLength(2); expect(screen.getByLabelText(labelLoginHeaderAttributeName)).toHaveValue( - '', + '' ); expect(screen.getByLabelText(labelPatternMatchLogin)).toHaveValue(''); expect(screen.getByLabelText(labelPatternReplaceLogin)).toHaveValue(''); @@ -114,7 +114,7 @@ describe('Web SSOconfiguration form', () => { await waitFor(() => { expect(mockedAxios.get).toHaveBeenCalledWith( authenticationProvidersEndpoint(Provider.WebSSO), - cancelTokenRequestParam, + cancelTokenRequestParam ); }); @@ -124,13 +124,13 @@ describe('Web SSOconfiguration form', () => { await waitFor(() => { expect( - screen.getByLabelText(labelEnableWebSSOAuthentication), + screen.getByLabelText(labelEnableWebSSOAuthentication) ).toBeChecked(); }); userEvent.type( screen.getByLabelText(labelPatternMatchLogin), - '{selectall}{backspace}invalid-pattern^', + '{selectall}{backspace}invalid-pattern^' ); userEvent.tab(); @@ -140,7 +140,7 @@ describe('Web SSOconfiguration form', () => { userEvent.type( screen.getByLabelText(labelPatternReplaceLogin), - '{selectall}{backspace}$invalid-pattern', + '{selectall}{backspace}$invalid-pattern' ); userEvent.tab(); @@ -150,25 +150,25 @@ describe('Web SSOconfiguration form', () => { userEvent.type( screen.getByLabelText(`${labelTrustedClientAddresses}`), - 'invalid domain', + 'invalid domain' ); userEvent.keyboard('{Enter}'); await waitFor(() => { expect( - screen.getByText(`invalid domain: ${labelInvalidIPAddress}`), + screen.getByText(`invalid domain: ${labelInvalidIPAddress}`) ).toBeInTheDocument(); }); userEvent.type( screen.getByLabelText(`${labelBlacklistClientAddresses}`), - '127.0.0.1111', + '127.0.0.1111' ); userEvent.keyboard('{Enter}'); await waitFor(() => { expect( - screen.getByText(`127.0.0.1111: ${labelInvalidIPAddress}`), + screen.getByText(`127.0.0.1111: ${labelInvalidIPAddress}`) ).toBeInTheDocument(); }); @@ -182,7 +182,7 @@ describe('Web SSOconfiguration form', () => { await waitFor(() => { expect(mockedAxios.get).toHaveBeenCalledWith( authenticationProvidersEndpoint(Provider.WebSSO), - cancelTokenRequestParam, + cancelTokenRequestParam ); }); @@ -192,13 +192,13 @@ describe('Web SSOconfiguration form', () => { await waitFor(() => { expect( - screen.getByLabelText(labelEnableWebSSOAuthentication), + screen.getByLabelText(labelEnableWebSSOAuthentication) ).toBeChecked(); }); userEvent.type( screen.getByLabelText(labelLoginHeaderAttributeName), - 'admin', + 'admin' ); userEvent.tab(); @@ -213,16 +213,16 @@ describe('Web SSOconfiguration form', () => { authenticationProvidersEndpoint(Provider.WebSSO), { ...retrievedWebSSOConfiguration, - login_header_attribute: 'admin', + login_header_attribute: 'admin' }, - cancelTokenPutParams, + cancelTokenPutParams ); }); await waitFor(() => { expect(mockedAxios.get).toHaveBeenCalledWith( authenticationProvidersEndpoint(Provider.WebSSO), - cancelTokenRequestParam, + cancelTokenRequestParam ); }); }); @@ -233,7 +233,7 @@ describe('Web SSOconfiguration form', () => { await waitFor(() => { expect(mockedAxios.get).toHaveBeenCalledWith( authenticationProvidersEndpoint(Provider.WebSSO), - cancelTokenRequestParam, + cancelTokenRequestParam ); }); @@ -243,13 +243,13 @@ describe('Web SSOconfiguration form', () => { await waitFor(() => { expect( - screen.getByLabelText(labelEnableWebSSOAuthentication), + screen.getByLabelText(labelEnableWebSSOAuthentication) ).toBeChecked(); }); userEvent.type( screen.getByLabelText(labelLoginHeaderAttributeName), - 'admin', + 'admin' ); userEvent.tab(); @@ -269,7 +269,7 @@ describe('Web SSOconfiguration form', () => { await waitFor(() => { expect(screen.getByLabelText(labelLoginHeaderAttributeName)).toHaveValue( - '', + '' ); }); }); diff --git a/www/front_src/src/Authentication/WebSSO/index.tsx b/www/front_src/src/Authentication/WebSSO/index.tsx index 609345e1ed6..5728247c6ca 100644 --- a/www/front_src/src/Authentication/WebSSO/index.tsx +++ b/www/front_src/src/Authentication/WebSSO/index.tsx @@ -15,14 +15,14 @@ import { WebSSOConfiguration } from './models'; const useStyles = makeStyles((theme) => ({ container: { - width: 'fit-content', + width: 'fit-content' }, loading: { - height: theme.spacing(0.5), + height: theme.spacing(0.5) }, paper: { - padding: theme.spacing(2), - }, + padding: theme.spacing(2) + } })); const WebSSOConfigurationForm = (): JSX.Element => { @@ -32,12 +32,12 @@ const WebSSOConfigurationForm = (): JSX.Element => { const { sendingGetWebSSOConfiguration, initialWebSSOConfiguration, - loadWebSSOonfiguration, + loadWebSSOonfiguration } = useWebSSO(); const isWebSSOConfigurationEmpty = useMemo( () => isNil(initialWebSSOConfiguration), - [initialWebSSOConfiguration], + [initialWebSSOConfiguration] ); useTab(isWebSSOConfigurationEmpty); diff --git a/www/front_src/src/Authentication/WebSSO/useValidationSchema.ts b/www/front_src/src/Authentication/WebSSO/useValidationSchema.ts index d045be3d3c5..fe26078a10e 100644 --- a/www/front_src/src/Authentication/WebSSO/useValidationSchema.ts +++ b/www/front_src/src/Authentication/WebSSO/useValidationSchema.ts @@ -5,7 +5,7 @@ import { WebSSOConfiguration } from './models'; import { labelRequired, labelInvalidIPAddress, - labelInvalidRegex, + labelInvalidRegex } from './translatedLabels'; const IPAddressRegexp = /^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}(\/\d{1,3})?$/; @@ -18,7 +18,7 @@ const useValidationSchema = (): Yup.SchemaOf => { blacklistClientAddresses: Yup.array().of( Yup.string() .matches(IPAddressRegexp, t(labelInvalidIPAddress)) - .required(t(labelRequired)), + .required(t(labelRequired)) ), isActive: Yup.boolean().required(t(labelRequired)), isForced: Yup.boolean().required(t(labelRequired)), @@ -32,8 +32,8 @@ const useValidationSchema = (): Yup.SchemaOf => { trustedClientAddresses: Yup.array().of( Yup.string() .matches(IPAddressRegexp, t(labelInvalidIPAddress)) - .required(t(labelRequired)), - ), + .required(t(labelRequired)) + ) }); }; diff --git a/www/front_src/src/Authentication/WebSSO/useWebSSO.ts b/www/front_src/src/Authentication/WebSSO/useWebSSO.ts index 293c54a3730..ad5cb57e041 100644 --- a/www/front_src/src/Authentication/WebSSO/useWebSSO.ts +++ b/www/front_src/src/Authentication/WebSSO/useWebSSO.ts @@ -19,7 +19,7 @@ const useWebSSO = (): UseWebSSOState => { useState(null); const { sendRequest, sending } = useRequest({ decoder: webSSOConfigurationDecoder, - request: getProviderConfiguration(Provider.WebSSO), + request: getProviderConfiguration(Provider.WebSSO) }); const loadWebSSOonfiguration = (): void => { @@ -31,7 +31,7 @@ const useWebSSO = (): UseWebSSOState => { return { initialWebSSOConfiguration, loadWebSSOonfiguration, - sendingGetWebSSOConfiguration: sending, + sendingGetWebSSOConfiguration: sending }; }; diff --git a/www/front_src/src/Authentication/api/adapters.ts b/www/front_src/src/Authentication/api/adapters.ts index 237254e4728..f9c67e738b8 100644 --- a/www/front_src/src/Authentication/api/adapters.ts +++ b/www/front_src/src/Authentication/api/adapters.ts @@ -2,7 +2,7 @@ import { map } from 'ramda'; import { PasswordSecurityPolicy, - PasswordSecurityPolicyToAPI, + PasswordSecurityPolicyToAPI } from '../Local/models'; import { OpenidConfiguration, @@ -18,15 +18,15 @@ import { GroupsMapping, GroupsMappingToAPI, GroupsRelation, - GroupsRelationToAPI, + GroupsRelationToAPI } from '../Openid/models'; import { WebSSOConfiguration, - WebSSOConfigurationToAPI, + WebSSOConfigurationToAPI } from '../WebSSO/models'; export const adaptPasswordSecurityPolicyFromAPI = ( - securityPolicy: PasswordSecurityPolicy, + securityPolicy: PasswordSecurityPolicy ): PasswordSecurityPolicy => { return { ...securityPolicy, @@ -40,8 +40,8 @@ export const adaptPasswordSecurityPolicyFromAPI = ( ...securityPolicy.passwordExpiration, expirationDelay: securityPolicy.passwordExpiration.expirationDelay ? securityPolicy.passwordExpiration.expirationDelay * 1000 - : null, - }, + : null + } }; }; @@ -55,7 +55,7 @@ export const adaptPasswordSecurityPolicyToAPI = ({ hasLowerCase, hasUpperCase, attempts, - blockingDuration, + blockingDuration }: PasswordSecurityPolicy): PasswordSecurityPolicyToAPI => { return { password_security_policy: { @@ -73,17 +73,17 @@ export const adaptPasswordSecurityPolicyToAPI = ({ excluded_users: passwordExpiration.excludedUsers, expiration_delay: passwordExpiration.expirationDelay ? passwordExpiration.expirationDelay / 1000 - : null, + : null }, - password_min_length: passwordMinLength, - }, + password_min_length: passwordMinLength + } }; }; const adaptEndpoint = ({ customEndpoint, type }: Endpoint): EndpointToAPI => { return { custom_endpoint: customEndpoint, - type, + type }; }; @@ -93,7 +93,7 @@ const adaptAuthentificationConditions = ({ attributePath, endpoint, isEnabled, - authorizedValues, + authorizedValues }: AuthConditions): AuthConditionsToApi => { return { attribute_path: attributePath, @@ -101,19 +101,19 @@ const adaptAuthentificationConditions = ({ blacklist_client_addresses: blacklistClientAddresses, endpoint: adaptEndpoint(endpoint), is_enabled: isEnabled, - trusted_client_addresses: trustedClientAddresses, + trusted_client_addresses: trustedClientAddresses }; }; const adaptRolesRelationsToAPI = ( - relations: Array, + relations: Array ): Array => map( ({ claimValue, accessGroup }) => ({ access_group_id: accessGroup.id, - claim_value: claimValue, + claim_value: claimValue }), - relations, + relations ); const adaptRolesMapping = ({ @@ -121,39 +121,39 @@ const adaptRolesMapping = ({ attributePath, endpoint, isEnabled, - relations, + relations }: RolesMapping): RolesMappingToApi => { return { apply_only_first_role: applyOnlyFirstRole, attribute_path: attributePath, endpoint: adaptEndpoint(endpoint), is_enabled: isEnabled, - relations: adaptRolesRelationsToAPI(relations), + relations: adaptRolesRelationsToAPI(relations) }; }; const adaptGroupsRelationsToAPI = ( - relations: Array, + relations: Array ): Array => map( ({ groupValue, contactGroup }) => ({ contact_group_id: contactGroup.id, - group_value: groupValue, + group_value: groupValue }), - relations, + relations ); const adaptGroupsMapping = ({ attributePath, endpoint, isEnabled, - relations, + relations }: GroupsMapping): GroupsMappingToAPI => { return { attribute_path: attributePath, endpoint: adaptEndpoint(endpoint), is_enabled: isEnabled, - relations: adaptGroupsRelationsToAPI(relations), + relations: adaptGroupsRelationsToAPI(relations) }; }; @@ -178,10 +178,10 @@ export const adaptOpenidConfigurationToAPI = ({ fullnameBindAttribute, authenticationConditions, rolesMapping, - groupsMapping, + groupsMapping }: OpenidConfiguration): OpenidConfigurationToAPI => ({ authentication_conditions: adaptAuthentificationConditions( - authenticationConditions, + authenticationConditions ), authentication_type: authenticationType || null, authorization_endpoint: authorizationEndpoint || null, @@ -202,7 +202,7 @@ export const adaptOpenidConfigurationToAPI = ({ roles_mapping: adaptRolesMapping(rolesMapping), token_endpoint: tokenEndpoint || null, userinfo_endpoint: userinfoEndpoint || null, - verify_peer: verifyPeer, + verify_peer: verifyPeer }); export const adaptWebSSOConfigurationToAPI = ({ @@ -212,7 +212,7 @@ export const adaptWebSSOConfigurationToAPI = ({ blacklistClientAddresses, isActive, isForced, - trustedClientAddresses, + trustedClientAddresses }: WebSSOConfiguration): WebSSOConfigurationToAPI => ({ blacklist_client_addresses: blacklistClientAddresses, is_active: isActive, @@ -220,5 +220,5 @@ export const adaptWebSSOConfigurationToAPI = ({ login_header_attribute: loginHeaderAttribute || null, pattern_matching_login: patternMatchingLogin || null, pattern_replace_login: patternReplaceLogin || null, - trusted_client_addresses: trustedClientAddresses, + trusted_client_addresses: trustedClientAddresses }); diff --git a/www/front_src/src/Authentication/api/decoders.ts b/www/front_src/src/Authentication/api/decoders.ts index 7fbaf1e5639..40fdb230634 100644 --- a/www/front_src/src/Authentication/api/decoders.ts +++ b/www/front_src/src/Authentication/api/decoders.ts @@ -10,20 +10,20 @@ import { NamedEntity, OpenidConfiguration, RolesMapping, - RolesRelation, + RolesRelation } from '../Openid/models'; import { WebSSOConfiguration } from '../WebSSO/models'; const passwordExpirationDecoder = JsonDecoder.object( { excludedUsers: JsonDecoder.array(JsonDecoder.string, 'excludedUsers'), - expirationDelay: JsonDecoder.nullable(JsonDecoder.number), + expirationDelay: JsonDecoder.nullable(JsonDecoder.number) }, 'PasswordExpiration', { excludedUsers: 'excluded_users', - expirationDelay: 'expiration_delay', - }, + expirationDelay: 'expiration_delay' + } ); export const securityPolicyDecoder = JsonDecoder.object( @@ -37,7 +37,7 @@ export const securityPolicyDecoder = JsonDecoder.object( hasSpecialCharacter: JsonDecoder.boolean, hasUpperCase: JsonDecoder.boolean, passwordExpiration: passwordExpirationDecoder, - passwordMinLength: JsonDecoder.number, + passwordMinLength: JsonDecoder.number }, 'PasswordSecurityPolicy', { @@ -49,54 +49,54 @@ export const securityPolicyDecoder = JsonDecoder.object( hasSpecialCharacter: 'has_special_character', hasUpperCase: 'has_uppercase', passwordExpiration: 'password_expiration', - passwordMinLength: 'password_min_length', - }, + passwordMinLength: 'password_min_length' + } ); const getNamedEntityDecoder = ( - title: string, + title: string ): JsonDecoder.Decoder => JsonDecoder.object( { id: JsonDecoder.number, - name: JsonDecoder.string, + name: JsonDecoder.string }, - title, + title ); const endpointDecoder = JsonDecoder.object( { customEndpoint: JsonDecoder.nullable(JsonDecoder.string), - type: JsonDecoder.enumeration(EndpointType, 'type'), + type: JsonDecoder.enumeration(EndpointType, 'type') }, 'Endpoint', { - customEndpoint: 'custom_endpoint', - }, + customEndpoint: 'custom_endpoint' + } ); const rolesRelation = JsonDecoder.object( { accessGroup: getNamedEntityDecoder('Access group'), - claimValue: JsonDecoder.string, + claimValue: JsonDecoder.string }, 'Role Relation', { accessGroup: 'access_group', - claimValue: 'claim_value', - }, + claimValue: 'claim_value' + } ); const groupsRelationDecoder = JsonDecoder.object( { contactGroup: getNamedEntityDecoder('Contact group'), - groupValue: JsonDecoder.string, + groupValue: JsonDecoder.string }, 'Group Relation', { contactGroup: 'contact_group', - groupValue: 'group_value', - }, + groupValue: 'group_value' + } ); const authConditions = JsonDecoder.object( @@ -104,18 +104,18 @@ const authConditions = JsonDecoder.object( attributePath: JsonDecoder.string, authorizedValues: JsonDecoder.array( JsonDecoder.string, - 'condition authorized value', + 'condition authorized value' ), blacklistClientAddresses: JsonDecoder.array( JsonDecoder.string, - 'blacklist client addresses', + 'blacklist client addresses' ), endpoint: endpointDecoder, isEnabled: JsonDecoder.boolean, trustedClientAddresses: JsonDecoder.array( JsonDecoder.string, - 'trusted client addresses', - ), + 'trusted client addresses' + ) }, 'Authentication conditions', { @@ -123,8 +123,8 @@ const authConditions = JsonDecoder.object( authorizedValues: 'authorized_values', blacklistClientAddresses: 'blacklist_client_addresses', isEnabled: 'is_enabled', - trustedClientAddresses: 'trusted_client_addresses', - }, + trustedClientAddresses: 'trusted_client_addresses' + } ); const rolesMapping = JsonDecoder.object( @@ -133,14 +133,14 @@ const rolesMapping = JsonDecoder.object( attributePath: JsonDecoder.string, endpoint: endpointDecoder, isEnabled: JsonDecoder.boolean, - relations: JsonDecoder.array(rolesRelation, 'Roles relation'), + relations: JsonDecoder.array(rolesRelation, 'Roles relation') }, 'Roles mapping', { applyOnlyFirstRole: 'apply_only_first_role', attributePath: 'attribute_path', - isEnabled: 'is_enabled', - }, + isEnabled: 'is_enabled' + } ); const groupsMappingDecoder = JsonDecoder.object( @@ -148,13 +148,13 @@ const groupsMappingDecoder = JsonDecoder.object( attributePath: JsonDecoder.string, endpoint: endpointDecoder, isEnabled: JsonDecoder.boolean, - relations: JsonDecoder.array(groupsRelationDecoder, 'Groups relation'), + relations: JsonDecoder.array(groupsRelationDecoder, 'Groups relation') }, 'Groups mapping', { attributePath: 'attribute_path', - isEnabled: 'is_enabled', - }, + isEnabled: 'is_enabled' + } ); export const openidConfigurationDecoder = @@ -170,10 +170,10 @@ export const openidConfigurationDecoder = clientSecret: JsonDecoder.nullable(JsonDecoder.string), connectionScopes: JsonDecoder.array( JsonDecoder.string, - 'connectionScopes', + 'connectionScopes' ), contactTemplate: JsonDecoder.nullable( - getNamedEntityDecoder('Contact template'), + getNamedEntityDecoder('Contact template') ), emailBindAttribute: JsonDecoder.nullable(JsonDecoder.string), endSessionEndpoint: JsonDecoder.nullable(JsonDecoder.string), @@ -189,7 +189,7 @@ export const openidConfigurationDecoder = tokenEndpoint: JsonDecoder.nullable(JsonDecoder.string), userinfoEndpoint: JsonDecoder.nullable(JsonDecoder.string), - verifyPeer: JsonDecoder.boolean, + verifyPeer: JsonDecoder.boolean }, 'Open ID Configuration', { @@ -213,8 +213,8 @@ export const openidConfigurationDecoder = rolesMapping: 'roles_mapping', tokenEndpoint: 'token_endpoint', userinfoEndpoint: 'userinfo_endpoint', - verifyPeer: 'verify_peer', - }, + verifyPeer: 'verify_peer' + } ); export const webSSOConfigurationDecoder = @@ -222,23 +222,23 @@ export const webSSOConfigurationDecoder = { blacklistClientAddresses: JsonDecoder.array( JsonDecoder.string, - 'blacklist client addresses', + 'blacklist client addresses' ), isActive: JsonDecoder.boolean, isForced: JsonDecoder.boolean, loginHeaderAttribute: JsonDecoder.optional( - JsonDecoder.nullable(JsonDecoder.string), + JsonDecoder.nullable(JsonDecoder.string) ), patternMatchingLogin: JsonDecoder.optional( - JsonDecoder.nullable(JsonDecoder.string), + JsonDecoder.nullable(JsonDecoder.string) ), patternReplaceLogin: JsonDecoder.optional( - JsonDecoder.nullable(JsonDecoder.string), + JsonDecoder.nullable(JsonDecoder.string) ), trustedClientAddresses: JsonDecoder.array( JsonDecoder.string, - 'trusted client addresses', - ), + 'trusted client addresses' + ) }, 'Web SSO Configuration', { @@ -248,6 +248,6 @@ export const webSSOConfigurationDecoder = loginHeaderAttribute: 'login_header_attribute', patternMatchingLogin: 'pattern_matching_login', patternReplaceLogin: 'pattern_replace_login', - trustedClientAddresses: 'trusted_client_addresses', - }, + trustedClientAddresses: 'trusted_client_addresses' + } ); diff --git a/www/front_src/src/Authentication/api/index.ts b/www/front_src/src/Authentication/api/index.ts index a7cae0eae0b..60277fbe7a8 100644 --- a/www/front_src/src/Authentication/api/index.ts +++ b/www/front_src/src/Authentication/api/index.ts @@ -5,7 +5,7 @@ import { getData, putData } from '@centreon/ui'; import { PasswordSecurityPolicy, PasswordSecurityPolicyFromAPI, - PasswordSecurityPolicyToAPI, + PasswordSecurityPolicyToAPI } from '../Local/models'; import { Provider } from '../models'; @@ -15,10 +15,10 @@ import { adaptPasswordSecurityPolicyToAPI } from './adapters'; export const getPasswordPasswordSecurityPolicy = (cancelToken: CancelToken) => (): Promise => getData(cancelToken)({ - endpoint: authenticationProvidersEndpoint(Provider.Local), + endpoint: authenticationProvidersEndpoint(Provider.Local) }).then( (securityPolicy): PasswordSecurityPolicy => - securityPolicy.password_security_policy, + securityPolicy.password_security_policy ); export const putPasswordPasswordSecurityPolicy = @@ -26,7 +26,7 @@ export const putPasswordPasswordSecurityPolicy = (securityPolicy: PasswordSecurityPolicy): Promise => putData(cancelToken)({ data: adaptPasswordSecurityPolicyToAPI(securityPolicy), - endpoint: authenticationProvidersEndpoint(Provider.Local), + endpoint: authenticationProvidersEndpoint(Provider.Local) }); export const getProviderConfiguration = @@ -34,7 +34,7 @@ export const getProviderConfiguration = (cancelToken: CancelToken) => (): Promise => getData(cancelToken)({ - endpoint: authenticationProvidersEndpoint(type), + endpoint: authenticationProvidersEndpoint(type) }); interface PutProviderConfiguration { @@ -45,11 +45,11 @@ interface PutProviderConfiguration { export const putProviderConfiguration = ({ type, - adapter, + adapter }: PutProviderConfiguration) => (cancelToken: CancelToken) => (configuration: Configuration): Promise => putData(cancelToken)({ data: adapter(configuration), - endpoint: authenticationProvidersEndpoint(type), + endpoint: authenticationProvidersEndpoint(type) }); diff --git a/www/front_src/src/Authentication/index.tsx b/www/front_src/src/Authentication/index.tsx index ff9213cb220..18e2105c7ea 100644 --- a/www/front_src/src/Authentication/index.tsx +++ b/www/front_src/src/Authentication/index.tsx @@ -16,7 +16,7 @@ import LocalAuthentication from './Local'; import { labelPasswordSecurityPolicy } from './Local/translatedLabels'; import { labelOpenIDConnectConfiguration, - labelRolesMapping, + labelRolesMapping } from './Openid/translatedLabels'; import OpenidConfiguration from './Openid'; import WebSSOConfigurationForm from './WebSSO'; @@ -27,7 +27,7 @@ import { labelAuthenticationConditions, labelIdentityProvider, labelClientAddresses, - labelGroupsMapping, + labelGroupsMapping } from './translatedLabels'; import { tabAtom, appliedTabAtom } from './tabAtoms'; import passwordPadlockLogo from './logos/passwordPadlock.svg'; @@ -38,68 +38,68 @@ const panels = [ Component: LocalAuthentication, image: passwordPadlockLogo, title: labelPasswordSecurityPolicy, - value: Provider.Local, + value: Provider.Local }, { Component: OpenidConfiguration, image: providerPadlockLogo, title: labelOpenIDConnectConfiguration, - value: Provider.Openid, + value: Provider.Openid }, { Component: WebSSOConfigurationForm, image: providerPadlockLogo, title: labelWebSSOConfiguration, - value: Provider.WebSSO, - }, + value: Provider.WebSSO + } ]; export const groups: Array = [ { name: labelActivation, - order: 1, + order: 1 }, { name: labelIdentityProvider, - order: 2, + order: 2 }, { name: labelAuthenticationConditions, - order: 3, + order: 3 }, { name: labelClientAddresses, - order: 4, + order: 4 }, { name: labelAutoImportUsers, - order: 5, + order: 5 }, { name: labelRolesMapping, - order: 6, + order: 6 }, { name: labelGroupsMapping, - order: 7, - }, + order: 7 + } ]; const useStyles = makeStyles((theme) => ({ box: { - overflowY: 'hidden', + overflowY: 'hidden' }, container: { maxHeight: `calc(100vh - ${theme.spacing(12)})`, maxWidth: theme.spacing(125), - overflowY: 'hidden', + overflowY: 'hidden' }, formContainer: { display: 'grid', gridTemplateColumns: '1.2fr 0.6fr', justifyItems: 'center', overflowY: 'hidden', - padding: theme.spacing(3), + padding: theme.spacing(3) }, image: { height: '200px', @@ -107,15 +107,15 @@ const useStyles = makeStyles((theme) => ({ padding: theme.spacing(0, 5), position: 'sticky', top: 0, - width: '200px', + width: '200px' }, panel: { overflowY: 'auto', - padding: 0, + padding: 0 }, tabList: { - boxShadow: theme.shadows[2], - }, + boxShadow: theme.shadows[2] + } })); const scrollMargin = 8; @@ -159,7 +159,7 @@ const Authentication = (): JSX.Element => { panels.map(({ title, value }) => ( )), - [], + [] ); const tabPanels = useMemo( @@ -170,7 +170,7 @@ const Authentication = (): JSX.Element => { ref={formContainerRef} sx={{ height: `${formContainerHeight}px`, - overflowY: 'auto', + overflowY: 'auto' }} >
@@ -180,7 +180,7 @@ const Authentication = (): JSX.Element => { )), - [themeMode, formContainerHeight], + [themeMode, formContainerHeight] ); return ( diff --git a/www/front_src/src/Authentication/models.tsx b/www/front_src/src/Authentication/models.tsx index 530782bc128..7a828c29e87 100644 --- a/www/front_src/src/Authentication/models.tsx +++ b/www/front_src/src/Authentication/models.tsx @@ -1,5 +1,5 @@ export enum Provider { Local = 'local', Openid = 'openid', - WebSSO = 'web-sso', + WebSSO = 'web-sso' } diff --git a/www/front_src/src/BreadcrumbTrail/Breadcrumb.tsx b/www/front_src/src/BreadcrumbTrail/Breadcrumb.tsx index 9c8de038c94..8b6fe8b2814 100644 --- a/www/front_src/src/BreadcrumbTrail/Breadcrumb.tsx +++ b/www/front_src/src/BreadcrumbTrail/Breadcrumb.tsx @@ -8,12 +8,12 @@ import { Breadcrumb as BreadcrumbModel } from './models'; const useStyles = makeStyles(() => ({ link: { '&:hover': { - textDecoration: 'underline', + textDecoration: 'underline' }, color: 'inherit', fontSize: 'small', - textDecoration: 'none', - }, + textDecoration: 'none' + } })); interface Props { diff --git a/www/front_src/src/BreadcrumbTrail/getBreadcrumbsByPath/index.test.tsx b/www/front_src/src/BreadcrumbTrail/getBreadcrumbsByPath/index.test.tsx index 3b6b829afc3..f489392ead4 100644 --- a/www/front_src/src/BreadcrumbTrail/getBreadcrumbsByPath/index.test.tsx +++ b/www/front_src/src/BreadcrumbTrail/getBreadcrumbsByPath/index.test.tsx @@ -12,25 +12,25 @@ describe('breadcrumbSelector', () => { label: 'Custom Views', options: null, page: '103', - url: '/home/customViews', - }, + url: '/home/customViews' + } ], is_react: false, label: 'Home', options: null, page: '1', - url: './include/home/home.php', - }, - ], + url: './include/home/home.php' + } + ] }; const breadcrumbs = getBreadcrumbsByPath(navigation.result); expect(breadcrumbs).toEqual({ '/home/customViews': [ { label: 'Home', link: '/main.php?p=1' }, - { label: 'Custom Views', link: '/home/customViews' }, + { label: 'Custom Views', link: '/home/customViews' } ], - '/main.php?p=1': [{ label: 'Home', link: '/main.php?p=1' }], + '/main.php?p=1': [{ label: 'Home', link: '/main.php?p=1' }] }); }); @@ -48,17 +48,17 @@ describe('breadcrumbSelector', () => { label: 'Hosts', options: null, page: '20101', - url: '/configuration/hosts', - }, + url: '/configuration/hosts' + } ], - label: 'hosts', - }, + label: 'hosts' + } ], is_react: false, label: 'Hosts', options: null, page: '201', - url: null, + url: null }, { groups: [ @@ -69,26 +69,26 @@ describe('breadcrumbSelector', () => { label: 'Services', options: null, page: '20102', - url: '/configuration/services', - }, + url: '/configuration/services' + } ], - label: 'services', - }, + label: 'services' + } ], is_react: false, label: 'Services', options: null, page: '202', - url: null, - }, + url: null + } ], is_react: false, label: 'Configuration', options: null, page: '2', - url: './include/home/home.php', - }, - ], + url: './include/home/home.php' + } + ] }; const breadcrumbs = getBreadcrumbsByPath(navigation.result); @@ -96,14 +96,14 @@ describe('breadcrumbSelector', () => { '/configuration/hosts': [ { label: 'Configuration', link: '/main.php?p=2' }, { label: 'Hosts', link: '/configuration/hosts' }, - { label: 'Hosts', link: '/configuration/hosts' }, + { label: 'Hosts', link: '/configuration/hosts' } ], '/configuration/services': [ { label: 'Configuration', link: '/main.php?p=2' }, { label: 'Services', link: '/configuration/services' }, - { label: 'Services', link: '/configuration/services' }, + { label: 'Services', link: '/configuration/services' } ], - '/main.php?p=2': [{ label: 'Configuration', link: '/main.php?p=2' }], + '/main.php?p=2': [{ label: 'Configuration', link: '/main.php?p=2' }] }); }); }); diff --git a/www/front_src/src/BreadcrumbTrail/getBreadcrumbsByPath/index.ts b/www/front_src/src/BreadcrumbTrail/getBreadcrumbsByPath/index.ts index f3565dc15d8..1ff7aa3c284 100644 --- a/www/front_src/src/BreadcrumbTrail/getBreadcrumbsByPath/index.ts +++ b/www/front_src/src/BreadcrumbTrail/getBreadcrumbsByPath/index.ts @@ -60,7 +60,7 @@ const getBreadcrumbStep = (item): Breadcrumb | null => { return availableUrl ? { label: item.label, - link: availableUrl, + link: availableUrl } : null; }; @@ -77,8 +77,8 @@ const getBreadcrumbsByPath = (navigation: Array): BreadcrumbsByPath => { breadcrumbs[stepLvl1.link] = [ { label: stepLvl1.label, - link: stepLvl1.link, - }, + link: stepLvl1.link + } ]; // build level 2 breadcrumbs @@ -91,12 +91,12 @@ const getBreadcrumbsByPath = (navigation: Array): BreadcrumbsByPath => { breadcrumbs[stepLvl2.link] = [ { label: stepLvl1.label, - link: stepLvl1.link, + link: stepLvl1.link }, { label: stepLvl2.label, - link: stepLvl2.link, - }, + link: stepLvl2.link + } ]; // build level 3 breadcrumbs @@ -111,16 +111,16 @@ const getBreadcrumbsByPath = (navigation: Array): BreadcrumbsByPath => { breadcrumbs[stepLvl3.link] = [ { label: stepLvl1.label, - link: stepLvl1.link, + link: stepLvl1.link }, { label: stepLvl2.label, - link: stepLvl2.link, + link: stepLvl2.link }, { label: stepLvl3.label, - link: stepLvl3.link, - }, + link: stepLvl3.link + } ]; }); } diff --git a/www/front_src/src/BreadcrumbTrail/index.tsx b/www/front_src/src/BreadcrumbTrail/index.tsx index 270a6a50b3c..c7486c6365d 100644 --- a/www/front_src/src/BreadcrumbTrail/index.tsx +++ b/www/front_src/src/BreadcrumbTrail/index.tsx @@ -15,11 +15,11 @@ import getBreadcrumbsByPath from './getBreadcrumbsByPath'; const useStyles = makeStyles((theme) => ({ item: { - display: 'flex', + display: 'flex' }, root: { - padding: theme.spacing(0.5, 3), - }, + padding: theme.spacing(0.5, 3) + } })); interface Props { @@ -29,7 +29,7 @@ interface Props { const getBreadcrumbs = ({ breadcrumbsByPath, - path, + path }): Array => { if (breadcrumbsByPath[path]) { return breadcrumbsByPath[path]; @@ -49,7 +49,7 @@ const BreadcrumbTrail = ({ breadcrumbsByPath, path }: Props): JSX.Element => { const breadcrumbs = useMemo( () => getBreadcrumbs({ breadcrumbsByPath, path }), - [breadcrumbsByPath, path], + [breadcrumbsByPath, path] ); return ( diff --git a/www/front_src/src/Extensions/Filter/Criterias/Criteria.tsx b/www/front_src/src/Extensions/Filter/Criterias/Criteria.tsx index 82646d9a339..ddfcee5e5ed 100644 --- a/www/front_src/src/Extensions/Filter/Criterias/Criteria.tsx +++ b/www/front_src/src/Extensions/Filter/Criterias/Criteria.tsx @@ -4,12 +4,12 @@ import { useAtomValue, useUpdateAtom } from 'jotai/utils'; import { PopoverMultiAutocompleteField, SelectEntry, - useMemoComponent, + useMemoComponent } from '@centreon/ui'; import { filterWithParsedSearchDerivedAtom, - setFilterCriteriaDerivedAtom, + setFilterCriteriaDerivedAtom } from '../filterAtoms'; import { criteriaValueNameById, selectableCriterias } from './models'; @@ -27,7 +27,7 @@ const CriteriaContent = ({ name, value }: Props): JSX.Element => { const getTranslated = (values: Array): Array => { return values.map((entry) => ({ id: entry.id, - name: t(entry.name), + name: t(entry.name) })); }; @@ -38,14 +38,14 @@ const CriteriaContent = ({ name, value }: Props): JSX.Element => { const getUntranslated = (values): Array => { return values.map(({ id }) => ({ id, - name: criteriaValueNameById[id], + name: criteriaValueNameById[id] })); }; const { label, options } = selectableCriterias[name]; const commonProps = { - label: t(label), + label: t(label) }; const translatedValues = getTranslated(value); @@ -66,12 +66,12 @@ const CriteriaContent = ({ name, value }: Props): JSX.Element => { const Criteria = ({ value, name }: Props): JSX.Element => { const filterWithParsedSearch = useAtomValue( - filterWithParsedSearchDerivedAtom, + filterWithParsedSearchDerivedAtom ); return useMemoComponent({ Component: , - memoProps: [value, name, filterWithParsedSearch], + memoProps: [value, name, filterWithParsedSearch] }); }; diff --git a/www/front_src/src/Extensions/Filter/Criterias/default.ts b/www/front_src/src/Extensions/Filter/Criterias/default.ts index 9feacb18a46..10b6edb160e 100644 --- a/www/front_src/src/Extensions/Filter/Criterias/default.ts +++ b/www/front_src/src/Extensions/Filter/Criterias/default.ts @@ -10,22 +10,22 @@ interface DefaultCriteriaValues { const getDefaultCriterias = ( { statuses = [], types = [] }: DefaultCriteriaValues = { statuses: [], - types: [], - }, + types: [] + } ): Array => { return [ { name: 'statuses', - value: statuses, + value: statuses }, { name: 'types', - value: types, + value: types }, { name: 'search', - value: '', - }, + value: '' + } ]; }; diff --git a/www/front_src/src/Extensions/Filter/Criterias/index.tsx b/www/front_src/src/Extensions/Filter/Criterias/index.tsx index eeb8ab9e887..f5bf3af0942 100644 --- a/www/front_src/src/Extensions/Filter/Criterias/index.tsx +++ b/www/front_src/src/Extensions/Filter/Criterias/index.tsx @@ -11,29 +11,29 @@ import { PopoverMenu, SelectEntry, useMemoComponent } from '@centreon/ui'; import { labelClear, labelSearch, - labelSearchOptions, + labelSearchOptions } from '../../translatedLabels'; import { applyCurrentFilterDerivedAtom, clearFilterDerivedAtom, - filterWithParsedSearchDerivedAtom, + filterWithParsedSearchDerivedAtom } from '../filterAtoms'; import Criteria from './Criteria'; import { CriteriaDisplayProps, selectableCriterias, - Criteria as CriteriaModel, + Criteria as CriteriaModel } from './models'; import { criteriaNameSortOrder } from './searchQueryLanguage/models'; const useStyles = makeStyles((theme) => ({ container: { - padding: theme.spacing(2), + padding: theme.spacing(2) }, searchButton: { - marginTop: theme.spacing(1), - }, + marginTop: theme.spacing(1) + } })); const getSelectableCriteriaByName = (name: string): CriteriaDisplayProps => @@ -48,13 +48,13 @@ const CriteriasContent = (): JSX.Element => { const { t } = useTranslation(); const filterWithParsedSearch = useAtomValue( - filterWithParsedSearchDerivedAtom, + filterWithParsedSearchDerivedAtom ); const getSelectableCriterias = (): Array => { const criterias = sortBy( ({ name }) => criteriaNameSortOrder[name], - filterWithParsedSearch, + filterWithParsedSearch ); return reject(isNonSelectableCriteria)(criterias); @@ -110,12 +110,12 @@ const CriteriasContent = (): JSX.Element => { const Criterias = (): JSX.Element => { const filterWithParsedSearch = useAtomValue( - filterWithParsedSearchDerivedAtom, + filterWithParsedSearchDerivedAtom ); return useMemoComponent({ Component: , - memoProps: [filterWithParsedSearch], + memoProps: [filterWithParsedSearch] }); }; diff --git a/www/front_src/src/Extensions/Filter/Criterias/models.ts b/www/front_src/src/Extensions/Filter/Criterias/models.ts index 21c72c0054b..059f9a2a1cf 100644 --- a/www/front_src/src/Extensions/Filter/Criterias/models.ts +++ b/www/front_src/src/Extensions/Filter/Criterias/models.ts @@ -8,7 +8,7 @@ import { labelUpToDate, labelType, labelStatus, - labelWidget, + labelWidget } from '../../translatedLabels'; export type CriteriaValue = Array | string; @@ -24,7 +24,7 @@ const criteriaValueNameById = { OUTDATED: labelOutdated, UNINSTALLED: labelUninstalled, UPTODATE: labelUpToDate, - WIDGET: labelWidget, + WIDGET: labelWidget }; const installedId = 'INSTALLED'; @@ -33,7 +33,7 @@ const installed = { id: installedId, name: criteriaValueNameById[installedId] }; const uninstalledId = 'UNINSTALLED'; const uninstalled = { id: uninstalledId, - name: criteriaValueNameById[uninstalledId], + name: criteriaValueNameById[uninstalledId] }; const outdatedId = 'OUTDATED'; @@ -62,23 +62,23 @@ export interface CriteriaById { export enum CriteriaNames { statuses = 'statuses', - types = 'types', + types = 'types' } const selectableCriterias: CriteriaById = { [CriteriaNames.statuses]: { label: labelStatus, - options: selectableStatuses, + options: selectableStatuses }, [CriteriaNames.types]: { label: labelType, - options: selectableTypes, - }, + options: selectableTypes + } }; export { criteriaValueNameById, selectableStatuses, selectableCriterias, - selectableTypes, + selectableTypes }; diff --git a/www/front_src/src/Extensions/Filter/Criterias/searchQueryLanguage/index.ts b/www/front_src/src/Extensions/Filter/Criterias/searchQueryLanguage/index.ts index 630723d18dc..968ce2b7ed7 100644 --- a/www/front_src/src/Extensions/Filter/Criterias/searchQueryLanguage/index.ts +++ b/www/front_src/src/Extensions/Filter/Criterias/searchQueryLanguage/index.ts @@ -27,7 +27,7 @@ import { startsWith, trim, without, - __, + __ } from 'ramda'; import pluralize from 'pluralize'; @@ -36,7 +36,7 @@ import { SelectEntry } from '@centreon/ui'; import { Criteria, criteriaValueNameById, - selectableCriterias, + selectableCriterias } from '../models'; import getDefaultCriterias from '../default'; @@ -46,7 +46,7 @@ import { criteriaNameSortOrder, CriteriaValueSuggestionsProps, AutocompleteSuggestionProps, - getSelectableCriteriasByName, + getSelectableCriteriasByName } from './models'; const singular = pluralize.singular as (string) => string; @@ -68,14 +68,14 @@ const isCriteriaPart = pipe( head, getCriteriaNameFromQueryLanguageName, pluralize, - isIn(selectableCriteriaNames), + isIn(selectableCriteriaNames) ); const isFilledCriteria = pipe(endsWith(':'), not); const parse = (search: string): Array => { const [criteriaParts, rawSearchParts] = partition( allPass([includes(':'), isCriteriaPart, isFilledCriteria]), - search.split(' '), + search.split(' ') ); const criterias: Array = criteriaParts.map((criteria) => { @@ -90,9 +90,9 @@ const parse = (search: string): Array => { return { id, - name: criteriaValueNameById[id], + name: criteriaValueNameById[id] }; - }), + }) }; }); @@ -100,8 +100,8 @@ const parse = (search: string): Array => { ...criterias, { name: 'search', - value: rawSearchParts.join(' ').trim(), - }, + value: rawSearchParts.join(' ').trim() + } ]; const toNames = map(prop('name')); @@ -115,7 +115,7 @@ const parse = (search: string): Array => { return sortBy( ({ name }) => criteriaNameSortOrder[name], - [...defaultCriterias, ...criteriasWithSearch], + [...defaultCriterias, ...criteriasWithSearch] ); }; @@ -135,11 +135,11 @@ const build = (criterias: Array): string => { const values = value as Array; const formattedValues = values.map( - pipe(({ id }) => id as string, getCriteriaQueryLanguageName), + pipe(({ id }) => id as string, getCriteriaQueryLanguageName) ); const criteriaName = compose( getCriteriaQueryLanguageName, - singular, + singular )(name); return `${criteriaName}:${formattedValues.join(',')}`; @@ -156,7 +156,7 @@ const build = (criterias: Array): string => { const getCriteriaNameSuggestions = (word: string): Array => { const criteriaNames = map( compose(getCriteriaQueryLanguageName, pluralize.singular), - selectableCriteriaNames, + selectableCriteriaNames ); if (isEmpty(word)) { @@ -170,10 +170,10 @@ const getCriteriaNameSuggestions = (word: string): Array => { const getCriteriaValueSuggestions = ({ selectedValues, - criterias, + criterias }: CriteriaValueSuggestionsProps): Array => { const criteriaNames = map( - compose(getCriteriaQueryLanguageName, prop('id')), + compose(getCriteriaQueryLanguageName, prop('id')) )(criterias); return without(selectedValues, criteriaNames); @@ -181,7 +181,7 @@ const getCriteriaValueSuggestions = ({ const getIsNextCharacterEmpty = ({ search, - cursorPosition, + cursorPosition }: AutocompleteSuggestionProps): boolean => { const nextCharacter = search[cursorPosition]; @@ -196,36 +196,36 @@ interface CriteriaExpression { const getCriteriaAndExpression = ({ search, - cursorPosition, + cursorPosition }: AutocompleteSuggestionProps): CriteriaExpression => { const searchBeforeCursor = slice(0, cursorPosition + 1, search); const expressionBeforeCursor = pipe( trim, split(' '), - last, + last )(searchBeforeCursor) as string; const expressionCriteria = expressionBeforeCursor.split(':'); const criteriaQueryLanguageName = head(expressionCriteria) as string; const criteriaName = getCriteriaNameFromQueryLanguageName( - criteriaQueryLanguageName, + criteriaQueryLanguageName ); const expressionCriteriaValues = pipe(last, split(','))(expressionCriteria); return { criteriaName, expressionBeforeCursor, - expressionCriteriaValues, + expressionCriteriaValues }; }; const getAutocompleteSuggestions = ({ search, - cursorPosition, + cursorPosition }: AutocompleteSuggestionProps): Array => { const isNextCharacterEmpty = getIsNextCharacterEmpty({ cursorPosition, - search, + search }); if (isNil(cursorPosition) || !isNextCharacterEmpty) { @@ -245,12 +245,12 @@ const getAutocompleteSuggestions = ({ const criteriaValueSuggestions = getCriteriaValueSuggestions({ criterias, - selectedValues: expressionCriteriaValues, + selectedValues: expressionCriteriaValues }); const isLastValueInSuggestions = getCriteriaValueSuggestions({ criterias, - selectedValues: [], + selectedValues: [] }).includes(lastCriteriaValue); return isLastValueInSuggestions diff --git a/www/front_src/src/Extensions/Filter/Criterias/searchQueryLanguage/models.ts b/www/front_src/src/Extensions/Filter/Criterias/searchQueryLanguage/models.ts index ef757e290d8..4fd36ebd7ce 100644 --- a/www/front_src/src/Extensions/Filter/Criterias/searchQueryLanguage/models.ts +++ b/www/front_src/src/Extensions/Filter/Criterias/searchQueryLanguage/models.ts @@ -13,7 +13,7 @@ export interface CriteriaValueSuggestionsProps { export const criteriaNameSortOrder = { [CriteriaNames.types]: 1, - [CriteriaNames.statuses]: 2, + [CriteriaNames.statuses]: 2 }; export interface AutocompleteSuggestionProps { @@ -35,16 +35,16 @@ const typeNameToQueryLanguageName = selectableTypes export const criteriaNameToQueryLanguageName = { ...statusNameToQueryLanguageName, - ...typeNameToQueryLanguageName, + ...typeNameToQueryLanguageName }; const staticCriteriaValuesByName = { status: selectableStatuses, - type: selectableTypes, + type: selectableTypes }; export const getSelectableCriteriasByName = ( - name: string, + name: string ): Array<{ id: string; name: string }> => { return staticCriteriaValuesByName[name]; }; diff --git a/www/front_src/src/Extensions/Filter/filterAtoms.ts b/www/front_src/src/Extensions/Filter/filterAtoms.ts index b2cd52f6c7b..d9094c46505 100644 --- a/www/front_src/src/Extensions/Filter/filterAtoms.ts +++ b/www/front_src/src/Extensions/Filter/filterAtoms.ts @@ -9,14 +9,14 @@ import { build, parse } from './Criterias/searchQueryLanguage'; export const getFilterDefaultCriteriasDerivedAtom = atom( () => (): Array => { return getDefaultCriterias(); - }, + } ); export const currentFilterCriteriasAtom = atomWithDefault>( - (get) => get(getFilterDefaultCriteriasDerivedAtom)(), + (get) => get(getFilterDefaultCriteriasDerivedAtom)() ); export const appliedFilterCriteriasAtom = atomWithDefault>( - (get) => get(getFilterDefaultCriteriasDerivedAtom)(), + (get) => get(getFilterDefaultCriteriasDerivedAtom)() ); export const searchAtom = atom(''); @@ -30,13 +30,13 @@ export const getUpToDateFilterCriteriaDerivedAtom = atom( (get) => ({ name, value }): Array => { const index = findIndex(propEq('name', name))( - get(filterWithParsedSearchDerivedAtom), + get(filterWithParsedSearchDerivedAtom) ); const lens = lensPath([index, 'value']); return update(lens, value, get(filterWithParsedSearchDerivedAtom)); - }, + } ); export const applyFilterDerivedAtom = atom( @@ -45,7 +45,7 @@ export const applyFilterDerivedAtom = atom( set(currentFilterCriteriasAtom, criterias); set(appliedFilterCriteriasAtom, criterias); set(searchAtom, build(criterias)); - }, + } ); export const setFilterCriteriaDerivedAtom = atom( @@ -64,7 +64,7 @@ export const setFilterCriteriaDerivedAtom = atom( } set(currentFilterCriteriasAtom, upToDateFilter); - }, + } ); export const applyCurrentFilterDerivedAtom = atom(null, (get, set) => { diff --git a/www/front_src/src/Extensions/Filter/index.tsx b/www/front_src/src/Extensions/Filter/index.tsx index 66abe7e731e..00dd961b9eb 100644 --- a/www/front_src/src/Extensions/Filter/index.tsx +++ b/www/front_src/src/Extensions/Filter/index.tsx @@ -5,7 +5,7 @@ import { Suspense, useEffect, useRef, - useState, + useState } from 'react'; import { @@ -16,7 +16,7 @@ import { length, dec, isNil, - dropLast, + dropLast } from 'ramda'; import { useTranslation } from 'react-i18next'; import { useAtomValue, useUpdateAtom } from 'jotai/utils'; @@ -30,7 +30,7 @@ import { MemoizedFilter, SearchField, IconButton, - LoadingSkeleton, + LoadingSkeleton } from '@centreon/ui'; import { labelSearch, labelClearFilter } from '../translatedLabels'; @@ -40,12 +40,12 @@ import { currentFilterCriteriasAtom, applyCurrentFilterDerivedAtom, clearFilterDerivedAtom, - searchAtom, + searchAtom } from './filterAtoms'; const useStyles = makeStyles((theme) => ({ autocompletePopper: { - zIndex: theme.zIndex.tooltip, + zIndex: theme.zIndex.tooltip }, container: { alignItems: 'center', @@ -53,9 +53,9 @@ const useStyles = makeStyles((theme) => ({ gridAutoFlow: 'column', gridGap: theme.spacing(2), gridTemplateColumns: '20px auto', - width: '100%', + width: '100%' }, - loader: { display: 'flex', justifyContent: 'center' }, + loader: { display: 'flex', justifyContent: 'center' } })); const Criterias = lazy(() => import('./Criterias')); @@ -116,8 +116,8 @@ const Filter = (): JSX.Element => { setAutoCompleteSuggestions( getAutocompleteSuggestions({ cursorPosition, - search, - }), + search + }) ); }, [search, cursorPosition]); @@ -167,7 +167,7 @@ const Filter = (): JSX.Element => { const completedWord = acceptedSuggestion.slice( expressionAfterSeparator.length, - acceptedSuggestion.length, + acceptedSuggestion.length ); const cursorCompletionShift = @@ -185,7 +185,7 @@ const Filter = (): JSX.Element => { ? searchBeforeCompletedWord.trim() : dropLast( expressionAfterSeparator.length, - searchBeforeCompletedWord.trim(), + searchBeforeCompletedWord.trim() ); const suggestion = isEmpty(expressionAfterSeparator.trim()) @@ -196,7 +196,7 @@ const Filter = (): JSX.Element => { searchBeforeSuggestion, suggestion, searchAfterCompletedWord.trim() === '' ? '' : ' ', - searchAfterCompletedWord, + searchAfterCompletedWord ].join(''); setCursorPosition(cursorPosition + cursorCompletionShift); @@ -220,8 +220,8 @@ const Filter = (): JSX.Element => { .replace(expressionToShiftToTheEnd, '') .trim(), ' ', - expressionToShiftToTheEnd, - ].join(''), + expressionToShiftToTheEnd + ].join('') ); }; @@ -307,7 +307,7 @@ const Filter = (): JSX.Element => { autoCompleteSuggestions, open, selectedSuggestionIndex, - currentFilter, + currentFilter ]; return ( @@ -342,7 +342,7 @@ const Filter = (): JSX.Element => { className={classes.autocompletePopper} open={open} style={{ - width: searchRef?.current?.clientWidth, + width: searchRef?.current?.clientWidth }} > diff --git a/www/front_src/src/Extensions/Listing/ExtensionDeleteDialog/index.tsx b/www/front_src/src/Extensions/Listing/ExtensionDeleteDialog/index.tsx index 31b785773ba..ebc4a6fd53e 100644 --- a/www/front_src/src/Extensions/Listing/ExtensionDeleteDialog/index.tsx +++ b/www/front_src/src/Extensions/Listing/ExtensionDeleteDialog/index.tsx @@ -12,7 +12,7 @@ interface Props { const ExtensionDeletePopup = ({ deletingEntity, onConfirm, - onCancel, + onCancel }: Props): JSX.Element => { const confirmDelete = (): void => { onConfirm(deletingEntity.id, deletingEntity.type); diff --git a/www/front_src/src/Extensions/Listing/ExtensionDetailsDialog/LoadingSkeleton.tsx b/www/front_src/src/Extensions/Listing/ExtensionDetailsDialog/LoadingSkeleton.tsx index e3374e9a6f7..b915eb48c64 100644 --- a/www/front_src/src/Extensions/Listing/ExtensionDetailsDialog/LoadingSkeleton.tsx +++ b/www/front_src/src/Extensions/Listing/ExtensionDetailsDialog/LoadingSkeleton.tsx @@ -5,8 +5,8 @@ import { headerHeight } from '../../../Header'; const useStyles = makeStyles((theme) => ({ nextContent: { - marginTop: theme.spacing(1.5), - }, + marginTop: theme.spacing(1.5) + } })); interface Props { @@ -22,7 +22,7 @@ const BaseSkeleton = ({ export const SliderSkeleton = ({ animate = true, - width, + width }: Props & { width }): JSX.Element => { const theme = useTheme(); diff --git a/www/front_src/src/Extensions/Listing/ExtensionDetailsDialog/index.tsx b/www/front_src/src/Extensions/Listing/ExtensionDetailsDialog/index.tsx index 783c1c35c38..622fe7caee9 100644 --- a/www/front_src/src/Extensions/Listing/ExtensionDetailsDialog/index.tsx +++ b/www/front_src/src/Extensions/Listing/ExtensionDetailsDialog/index.tsx @@ -12,7 +12,7 @@ import { Grid, Button, Link, - CircularProgress, + CircularProgress } from '@mui/material'; import UpdateIcon from '@mui/icons-material/SystemUpdateAlt'; import DeleteIcon from '@mui/icons-material/Delete'; @@ -25,7 +25,7 @@ import { labelDescription, labelLastUpdate, labelInstall, - labelDelete, + labelDelete } from '../../translatedLabels'; import { Entity, ExtensionDetails } from '../models'; import { buildEndPoint } from '../api/endpoint'; @@ -34,7 +34,7 @@ import { SliderSkeleton, HeaderSkeleton, ContentSkeleton, - ReleaseNoteSkeleton, + ReleaseNoteSkeleton } from './LoadingSkeleton'; interface Props { @@ -59,7 +59,7 @@ const ExtensionDetailPopup = ({ onDelete, onInstall, onUpdate, - isLoading, + isLoading }: Props): JSX.Element | null => { const { t } = useTranslation(); const [extensionDetails, setExtensionDetails] = useState(null); @@ -67,7 +67,7 @@ const ExtensionDetailPopup = ({ const { sendRequest: sendExtensionDetailsValueRequests } = useRequest({ - request: getData, + request: getData }); useEffect(() => { @@ -75,8 +75,8 @@ const ExtensionDetailPopup = ({ endpoint: buildEndPoint({ action: 'details', id, - type, - }), + type + }) }).then((data) => { const { result } = data; if (result.images) { @@ -105,7 +105,7 @@ const ExtensionDetailPopup = ({ onDelete( extensionDetails.id, extensionDetails.type, - extensionDetails.title, + extensionDetails.title ); }; @@ -130,7 +130,7 @@ const ExtensionDetailPopup = ({ height={imageHeight} indicators={!hasOneImage(extensionDetails.images)} navButtonsAlwaysInvisible={hasOneImage( - extensionDetails.images, + extensionDetails.images )} > {extensionDetails.images?.map((image) => ( diff --git a/www/front_src/src/Extensions/Listing/ExtensionsHolder/index.tsx b/www/front_src/src/Extensions/Listing/ExtensionsHolder/index.tsx index 0a23a2ba43f..4e5b8b10772 100644 --- a/www/front_src/src/Extensions/Listing/ExtensionsHolder/index.tsx +++ b/www/front_src/src/Extensions/Listing/ExtensionsHolder/index.tsx @@ -21,7 +21,7 @@ import { Grid, Chip, LinearProgress, - Divider, + Divider } from '@mui/material'; import { userAtom } from '@centreon/ui-context'; @@ -31,34 +31,34 @@ import { labelLicenseRequired, labelLicenseEndDate, labelLicenseExpired, - labelLicenseNotValid, + labelLicenseNotValid } from '../../translatedLabels'; const useStyles = makeStyles((theme) => ({ contentWrapper: { [theme.breakpoints.up(767)]: { - padding: theme.spacing(1.5, 1.5, 1.5, 0), + padding: theme.spacing(1.5, 1.5, 1.5, 0) }, boxSizing: 'border-box', margin: theme.spacing(0, 'auto'), - padding: theme.spacing(1.5, 2.5, 0, 0), + padding: theme.spacing(1.5, 2.5, 0, 0) }, extensionsTypes: { - color: theme.palette.text.primary, + color: theme.palette.text.primary }, license: { alignItems: 'center', cursor: 'pointer', display: 'flex', justifyContent: 'center', - minHeight: '20px', + minHeight: '20px' }, licenseInvalid: { - backgroundColor: theme.palette.error.main, + backgroundColor: theme.palette.error.main }, licenseValid: { - backgroundColor: theme.palette.success.main, - }, + backgroundColor: theme.palette.success.main + } })); interface Props { @@ -84,7 +84,7 @@ const ExtensionsHolder = ({ updating, installing, deletingEntityId, - type, + type }: Props): JSX.Element => { const classes = useStyles(); const { t } = useTranslation(); @@ -103,14 +103,14 @@ const ExtensionsHolder = ({ if (isNil(licenseInfo.expiration_date)) { return { isInvalid: true, - label: t(labelLicenseRequired), + label: t(labelLicenseRequired) }; } if (Number.isNaN(Date.parse(licenseInfo.expiration_date))) { return { isInvalid: true, - label: t(labelLicenseNotValid), + label: t(labelLicenseNotValid) }; } @@ -121,13 +121,13 @@ const ExtensionsHolder = ({ if (isLicenseExpired) { return { isInvalid: true, - label: t(labelLicenseExpired), + label: t(labelLicenseExpired) }; } return { isInvalid: false, - label: `${t(labelLicenseEndDate)} ${toDate(licenseInfo.expiration_date)}`, + label: `${t(labelLicenseEndDate)} ${toDate(licenseInfo.expiration_date)}` }; }; @@ -195,7 +195,7 @@ const ExtensionsHolder = ({ { e.preventDefault(); @@ -215,7 +215,7 @@ const ExtensionsHolder = ({ backgroundColor: entity.version.outdated ? '#FF9A13' : '#84BD00', - color: '#FFFFFF', + color: '#FFFFFF' }} onDelete={(): void => onDelete(entity.id, type, entity.description) @@ -252,12 +252,12 @@ const ExtensionsHolder = ({ className={clsx(classes.license, { [classes.licenseValid]: equals( licenseInfo?.isInvalid, - false, + false ), [classes.licenseInvalid]: equals( licenseInfo?.isInvalid, - true, - ), + true + ) })} elevation={0} > diff --git a/www/front_src/src/Extensions/Listing/api/endpoint.ts b/www/front_src/src/Extensions/Listing/api/endpoint.ts index 746000a1321..6d0c601356d 100644 --- a/www/front_src/src/Extensions/Listing/api/endpoint.ts +++ b/www/front_src/src/Extensions/Listing/api/endpoint.ts @@ -23,7 +23,7 @@ const buildEndPoint = ({ action, id, type }: Parameter): string => { const buildExtensionEndPoint = ({ action, - criteriaStatus, + criteriaStatus }: ParameterWithFilter): string => { let params = `${baseEndpoint}action=${action}`; diff --git a/www/front_src/src/Extensions/Listing/api/index.ts b/www/front_src/src/Extensions/Listing/api/index.ts index 4e40544b4ce..3927512dc04 100644 --- a/www/front_src/src/Extensions/Listing/api/index.ts +++ b/www/front_src/src/Extensions/Listing/api/index.ts @@ -19,8 +19,8 @@ const deleteExtension = buildEndPoint({ action: 'remove', id: parameters.id, - type: parameters.type, - }), + type: parameters.type + }) ); }; diff --git a/www/front_src/src/Extensions/Listing/index.tsx b/www/front_src/src/Extensions/Listing/index.tsx index 0d67f8d31d2..ae1d2ea482c 100644 --- a/www/front_src/src/Extensions/Listing/index.tsx +++ b/www/front_src/src/Extensions/Listing/index.tsx @@ -16,7 +16,7 @@ import { postData, SelectEntry, useSnackbar, - Responsive, + Responsive } from '@centreon/ui'; import FederatedComponents from '../../components/FederatedComponents'; @@ -35,19 +35,19 @@ import { ExtensionsStatus, ExtensionResult, InstallOrUpdateExtensionResult, - EntityDeleting, + EntityDeleting } from './models'; import { buildEndPoint, buildExtensionEndPoint } from './api/endpoint'; const useStyles = makeStyles((theme) => ({ contentWrapper: { [theme.breakpoints.up(767)]: { - padding: theme.spacing(1.5, 1.5, 1.5, 0), + padding: theme.spacing(1.5, 1.5, 1.5, 0) }, boxSizing: 'border-box', margin: theme.spacing(0, 'auto'), - padding: theme.spacing(1.5, 2.5, 0, 0), - }, + padding: theme.spacing(1.5, 2.5, 0, 0) + } })); interface Props { @@ -64,11 +64,11 @@ const ExtensionsManager = ({ reloadNavigation }: Props): JSX.Element => { const [extensions, setExtension] = useState({ module: { - entities: [], + entities: [] }, widget: { - entities: [], - }, + entities: [] + } }); const [modulesActive, setModulesActive] = useState(false); @@ -77,7 +77,7 @@ const ExtensionsManager = ({ reloadNavigation }: Props): JSX.Element => { const [entityDetails, setEntityDetails] = useState(null); const [entityDeleting, setEntityDeleting] = useState( - null, + null ); const [extensionsInstallingStatus, setExtensionsInstallingStatus] = @@ -91,27 +91,27 @@ const ExtensionsManager = ({ reloadNavigation }: Props): JSX.Element => { >(null); const { sendRequest: sendExtensionsRequests } = useRequest({ - request: getData, + request: getData }); const { sendRequest: sendUpdateOrInstallExtensionRequests } = useRequest({ - request: postData, + request: postData }); const { sendRequest: sendDeleteExtensionRequests } = useRequest({ - request: deleteExtension, + request: deleteExtension }); const getAppliedFilterCriteriasAtom = useAtomValue( - appliedFilterCriteriasAtom, + appliedFilterCriteriasAtom ); useEffect(() => { const types = find(propEq('name', 'types'), getAppliedFilterCriteriasAtom); const statuses = find( propEq('name', 'statuses'), - getAppliedFilterCriteriasAtom, + getAppliedFilterCriteriasAtom ); if (types && types.value) { @@ -123,8 +123,8 @@ const ExtensionsManager = ({ reloadNavigation }: Props): JSX.Element => { sendExtensionsRequests({ endpoint: buildExtensionEndPoint({ action: 'list', - criteriaStatus: statuses, - }), + criteriaStatus: statuses + }) }).then(({ status, result }) => { if (status) { setExtension(result as Extensions); @@ -139,7 +139,7 @@ const ExtensionsManager = ({ reloadNavigation }: Props): JSX.Element => { const getEntitiesByKeyAndVersionParam = ( param, equals, - key, + key ): Array => { const resArray: Array = []; if (extensions) { @@ -148,7 +148,7 @@ const ExtensionsManager = ({ reloadNavigation }: Props): JSX.Element => { if (entity.version[param] === equals) { resArray.push({ id: entity.id, - type: key, + type: key }); } } @@ -164,7 +164,7 @@ const ExtensionsManager = ({ reloadNavigation }: Props): JSX.Element => { ) { return [ ...getEntitiesByKeyAndVersionParam(param, equals, 'module'), - ...getEntitiesByKeyAndVersionParam(param, equals, 'widget'), + ...getEntitiesByKeyAndVersionParam(param, equals, 'widget') ]; } if (modulesActive) { @@ -200,8 +200,8 @@ const ExtensionsManager = ({ reloadNavigation }: Props): JSX.Element => { endpoint: buildEndPoint({ action: 'update', id, - type, - }), + type + }) }) .then(({ status, result }) => { if (!status) { @@ -215,9 +215,9 @@ const ExtensionsManager = ({ reloadNavigation }: Props): JSX.Element => { action: 'list', criteriaStatus: find( propEq('name', 'statuses'), - getAppliedFilterCriteriasAtom, - ), - }), + getAppliedFilterCriteriasAtom + ) + }) }); }) .then(({ status, result }) => { @@ -235,8 +235,8 @@ const ExtensionsManager = ({ reloadNavigation }: Props): JSX.Element => { endpoint: buildEndPoint({ action: 'install', id, - type, - }), + type + }) }) .then(({ status, result }) => { if (!status) { @@ -250,9 +250,9 @@ const ExtensionsManager = ({ reloadNavigation }: Props): JSX.Element => { action: 'list', criteriaStatus: find( propEq('name', 'statuses'), - getAppliedFilterCriteriasAtom, - ), - }), + getAppliedFilterCriteriasAtom + ) + }) }); }) .then(({ status, result }) => { @@ -266,24 +266,24 @@ const ExtensionsManager = ({ reloadNavigation }: Props): JSX.Element => { const setExtensionsUpdatingStatusByIds = ( id: string, - updating: boolean, + updating: boolean ): void => { let statuses = extensionsUpdatingStatus; statuses = { ...statuses, - [id]: updating, + [id]: updating }; setExtensionsUpdatingStatus(statuses); }; const setExtensionsInstallingStatusByIds = ( id: string, - installing: boolean, + installing: boolean ): void => { let statuses = extensionsInstallingStatus; statuses = { ...statuses, - [id]: installing, + [id]: installing }; setExtensionsInstallingStatus(statuses); }; @@ -291,7 +291,7 @@ const ExtensionsManager = ({ reloadNavigation }: Props): JSX.Element => { const activateExtensionsDetails = (id: string, type: string): void => { setEntityDetails({ id, - type, + type }); }; @@ -302,12 +302,12 @@ const ExtensionsManager = ({ reloadNavigation }: Props): JSX.Element => { const toggleDeleteModal = ( id: string, type: string, - description: string, + description: string ): void => { setEntityDeleting({ description, id, - type, + type }); }; @@ -320,7 +320,7 @@ const ExtensionsManager = ({ reloadNavigation }: Props): JSX.Element => { setEntityDeleting(null); sendDeleteExtensionRequests({ id, - type, + type }) .then(({ status, result }) => { setConfirmedDeletingEntityId(null); @@ -335,9 +335,9 @@ const ExtensionsManager = ({ reloadNavigation }: Props): JSX.Element => { action: 'list', criteriaStatus: find( propEq('name', 'statuses'), - getAppliedFilterCriteriasAtom, - ), - }), + getAppliedFilterCriteriasAtom + ) + }) }); }) .then(({ status, result }) => { @@ -349,19 +349,19 @@ const ExtensionsManager = ({ reloadNavigation }: Props): JSX.Element => { }; const allModulesInstalled = isEmpty( - filter(pathEq(['version', 'installed'], false), extensions.module.entities), + filter(pathEq(['version', 'installed'], false), extensions.module.entities) ); const allWidgetsInstalled = isEmpty( - filter(pathEq(['version', 'installed'], false), extensions.widget.entities), + filter(pathEq(['version', 'installed'], false), extensions.widget.entities) ); const allWidgetsUpToDate = isEmpty( - filter(pathEq(['version', 'outdated'], true), extensions.module.entities), + filter(pathEq(['version', 'outdated'], true), extensions.module.entities) ); const allModulesUpToDate = isEmpty( - filter(pathEq(['version', 'outdated'], true), extensions.widget.entities), + filter(pathEq(['version', 'outdated'], true), extensions.widget.entities) ); const disableUpdate = allWidgetsUpToDate && allModulesUpToDate; diff --git a/www/front_src/src/Extensions/index.tsx b/www/front_src/src/Extensions/index.tsx index 51173df619d..5abc197d45b 100755 --- a/www/front_src/src/Extensions/index.tsx +++ b/www/front_src/src/Extensions/index.tsx @@ -8,7 +8,7 @@ const Listing = lazy(() => import('./Listing')); const Extensions = (): JSX.Element => { return useMemoComponent({ Component: } listing={} />, - memoProps: [], + memoProps: [] }); }; diff --git a/www/front_src/src/FallbackPages/NotAllowedPage/index.tsx b/www/front_src/src/FallbackPages/NotAllowedPage/index.tsx index 046984ecbb1..2c12b45db53 100644 --- a/www/front_src/src/FallbackPages/NotAllowedPage/index.tsx +++ b/www/front_src/src/FallbackPages/NotAllowedPage/index.tsx @@ -4,7 +4,7 @@ import { FallbackPage } from '@centreon/ui'; import { labelLostInSpace, - labelYouAreNotAllowedToSeeThisPage, + labelYouAreNotAllowedToSeeThisPage } from './translatedLabels'; const NotAllowedPage = (): JSX.Element => { diff --git a/www/front_src/src/Header/Clock/index.tsx b/www/front_src/src/Header/Clock/index.tsx index 955a104393c..968ad0a9b04 100755 --- a/www/front_src/src/Header/Clock/index.tsx +++ b/www/front_src/src/Header/Clock/index.tsx @@ -11,11 +11,11 @@ const useStyles = makeStyles((theme) => ({ display: 'flex', flexDirection: 'column', height: '100%', - justifyContent: 'space-between', + justifyContent: 'space-between' }, nowrap: { - whiteSpace: 'nowrap', - }, + whiteSpace: 'nowrap' + } })); const Clock = (): JSX.Element => { @@ -24,7 +24,7 @@ const Clock = (): JSX.Element => { const refreshIntervalRef = useRef(); const [dateTime, setDateTime] = useState({ date: '', - time: '', + time: '' }); const { format, toTime } = centreonUi.useLocaleDateTimeFormat(); @@ -44,7 +44,7 @@ const Clock = (): JSX.Element => { const thirtySeconds = 30 * 1000; refreshIntervalRef.current = window.setInterval( updateDateTime, - thirtySeconds, + thirtySeconds ); return (): void => { diff --git a/www/front_src/src/Header/PollerMenu/ExportConfiguration/index.test.tsx b/www/front_src/src/Header/PollerMenu/ExportConfiguration/index.test.tsx index c557ba41470..6ab582f2df9 100644 --- a/www/front_src/src/Header/PollerMenu/ExportConfiguration/index.test.tsx +++ b/www/front_src/src/Header/PollerMenu/ExportConfiguration/index.test.tsx @@ -7,7 +7,7 @@ import { waitFor, RenderResult, screen, - SnackbarProvider, + SnackbarProvider } from '@centreon/ui'; import { refreshIntervalAtom, userAtom } from '@centreon/ui-context'; @@ -16,7 +16,7 @@ import { labelConfigurationExportedAndReloaded, labelExportAndReload, labelExportConfiguration, - labelExportingAndReloadingTheConfiguration, + labelExportingAndReloadingTheConfiguration } from '../translatedLabels'; import { exportAndReloadConfigurationEndpoint } from './api/endpoints'; @@ -28,7 +28,7 @@ const mockedAxios = axios as jest.Mocked; const mockUser = { isExportButtonEnabled: true, locale: 'en', - timezone: 'Europe/Paris', + timezone: 'Europe/Paris' }; const mockRefreshInterval = 60; const toggleDetailedView = jest.fn(); @@ -46,19 +46,19 @@ const renderExportConfiguration = (): RenderResult => - , + ); describe(ExportConfiguration, () => { beforeEach(() => { mockedAxios.get.mockReset(); mockedAxios.get.mockResolvedValueOnce({ - data: {}, + data: {} }); }); @@ -72,19 +72,19 @@ describe(ExportConfiguration, () => { await waitFor(() => { expect(mockedAxios.get).toHaveBeenCalledWith( exportAndReloadConfigurationEndpoint, - cancelTokenRequestParam, + cancelTokenRequestParam ); }); expect(toggleDetailedView).toHaveBeenCalled(); expect( - screen.getByText(labelExportingAndReloadingTheConfiguration), + screen.getByText(labelExportingAndReloadingTheConfiguration) ).toBeInTheDocument(); await waitFor(() => { expect( - screen.getByText(labelConfigurationExportedAndReloaded), + screen.getByText(labelConfigurationExportedAndReloaded) ).toBeInTheDocument(); }); }); diff --git a/www/front_src/src/Header/PollerMenu/ExportConfiguration/index.tsx b/www/front_src/src/Header/PollerMenu/ExportConfiguration/index.tsx index d22f03588b5..b24d67fbf16 100644 --- a/www/front_src/src/Header/PollerMenu/ExportConfiguration/index.tsx +++ b/www/front_src/src/Header/PollerMenu/ExportConfiguration/index.tsx @@ -18,7 +18,7 @@ import { labelExportConfiguration, labelExportingAndReloadingTheConfiguration, labelFailedToExportAndReloadConfiguration, - labelThisWillExportAndReloadOnAllOfYourPlatform, + labelThisWillExportAndReloadOnAllOfYourPlatform } from '../translatedLabels'; import { exportAndReloadConfigurationEndpoint } from './api/endpoints'; @@ -31,7 +31,7 @@ interface Props { const useStyles = makeStyles((theme) => ({ exportButton: { '&:hover': { - background: theme.palette.grey[500], + background: theme.palette.grey[500] }, backgroundColor: equals(theme.palette.mode, ThemeMode.dark) ? theme.palette.background.default @@ -40,20 +40,20 @@ const useStyles = makeStyles((theme) => ({ color: theme.palette.common.white, display: 'flex', fontSize: theme.typography.body2.fontSize, - marginTop: theme.spacing(1), + marginTop: theme.spacing(1) }, pollerText: { - margin: theme.spacing(0), + margin: theme.spacing(0) }, pollersList: { maxHeight: '50vh', - overflowY: 'auto', - }, + overflowY: 'auto' + } })); const ExportConfiguration = ({ setIsExportingConfiguration, - toggleDetailedView, + toggleDetailedView }: Props): JSX.Element | null => { const classes = useStyles(); const { t } = useTranslation(); @@ -61,7 +61,7 @@ const ExportConfiguration = ({ useState(false); const { sendRequest, sending } = useRequest({ defaultFailureMessage: t(labelFailedToExportAndReloadConfiguration), - request: getData, + request: getData }); const { showInfoMessage, showSuccessMessage } = useSnackbar(); @@ -78,7 +78,7 @@ const ExportConfiguration = ({ toggleDetailedView(); showInfoMessage(t(labelExportingAndReloadingTheConfiguration)); sendRequest({ - endpoint: exportAndReloadConfigurationEndpoint, + endpoint: exportAndReloadConfigurationEndpoint }).then(() => { showSuccessMessage(t(labelConfigurationExportedAndReloaded)); }); diff --git a/www/front_src/src/Header/PollerMenu/PollerStatusIcon/index.tsx b/www/front_src/src/Header/PollerMenu/PollerStatusIcon/index.tsx index aca4712843d..8db46f1c05f 100644 --- a/www/front_src/src/Header/PollerMenu/PollerStatusIcon/index.tsx +++ b/www/front_src/src/Header/PollerMenu/PollerStatusIcon/index.tsx @@ -13,7 +13,7 @@ import { labelDatabaseNotActive, labelDatabaseUpdateAndActive, labelLatencyDetected, - labelNoLatencyDetected, + labelNoLatencyDetected } from '../translatedLabels'; import { Issues } from '../models'; @@ -41,36 +41,36 @@ const useStatusStyles = makeStyles((theme) => { const getSeverityColor = (severityCode): CreateCSSProperties => ({ background: getStatusColors({ severityCode, - theme, + theme }).backgroundColor, color: getStatusColors({ severityCode, - theme, - }).color, + theme + }).color }); return { avatar: { fontSize: theme.typography.body1.fontSize, height: theme.spacing(2.5), - width: theme.spacing(2.5), + width: theme.spacing(2.5) }, container: { display: 'flex', gap: theme.spacing(0.5), [theme.breakpoints.down(768)]: { bottom: 0, - right: theme.spacing(1), - }, + right: theme.spacing(1) + } }, database: ({ databaseSeverity }): CreateCSSProperties => getSeverityColor(databaseSeverity), icon: { height: theme.spacing(1.75), - width: theme.spacing(1.75), + width: theme.spacing(1.75) }, latency: ({ latencySeverity }): CreateCSSProperties => - getSeverityColor(latencySeverity), + getSeverityColor(latencySeverity) }; }); diff --git a/www/front_src/src/Header/PollerMenu/index.tsx b/www/front_src/src/Header/PollerMenu/index.tsx index 9bb5ca3a690..28285079951 100755 --- a/www/front_src/src/Header/PollerMenu/index.tsx +++ b/www/front_src/src/Header/PollerMenu/index.tsx @@ -15,7 +15,7 @@ import { getData, useRequest, IconHeader, - IconToggleSubmenu, + IconToggleSubmenu } from '@centreon/ui'; import { refreshIntervalAtom, ThemeMode } from '@centreon/ui-context'; @@ -28,7 +28,7 @@ import { labelDatabaseUpdatesNotActive, labelLatencyDetected, labelPoller, - labelPollerNotRunning, + labelPollerNotRunning } from './translatedLabels'; import ExportConfiguration from './ExportConfiguration'; import PollerStatusIcon from './PollerStatusIcon'; @@ -38,7 +38,7 @@ export const pollerConfigurationPageNumber = '60901'; const pollerIssueKeyToMessage = { database: labelDatabaseUpdatesNotActive, latency: labelLatencyDetected, - stability: labelPollerNotRunning, + stability: labelPollerNotRunning }; interface PollerData { @@ -49,7 +49,7 @@ interface PollerData { const useStyles = makeStyles((theme) => ({ confButton: { '&:hover': { - background: theme.palette.grey[500], + background: theme.palette.grey[500] }, backgroundColor: equals(theme.palette.mode, ThemeMode.dark) ? theme.palette.background.default @@ -58,16 +58,16 @@ const useStyles = makeStyles((theme) => ({ color: theme.palette.common.white, display: 'flex', fontSize: theme.typography.body2.fontSize, - marginTop: theme.spacing(1), + marginTop: theme.spacing(1) }, container: { borderRight: '1px solid white', display: 'flex', paddingRight: theme.spacing(3), [theme.breakpoints.down(768)]: { - paddingRight: theme.spacing(1), + paddingRight: theme.spacing(1) }, - position: 'relative', + position: 'relative' }, iconToggleMenu: { alignItems: 'flex-end', @@ -76,11 +76,11 @@ const useStyles = makeStyles((theme) => ({ alignItems: 'center', justifyContent: 'center', position: 'relative', - right: theme.spacing(0.5), - }, + right: theme.spacing(0.5) + } }, link: { - textDecoration: 'none', + textDecoration: 'none' }, pollarHeaderRight: { display: 'flex', @@ -88,16 +88,16 @@ const useStyles = makeStyles((theme) => ({ justifyContent: 'space-between', [theme.breakpoints.down(768)]: { flexDirection: 'row', - gap: theme.spacing(0.5), - }, + gap: theme.spacing(0.5) + } }, pollerDetailRow: { borderBottom: '1px solid', display: 'flex', - justifyContent: 'space-between', + justifyContent: 'space-between' }, pollerDetailTitle: { - flexGrow: 1, + flexGrow: 1 }, subMenuToggle: { backgroundColor: theme.palette.background.default, @@ -111,11 +111,11 @@ const useStyles = makeStyles((theme) => ({ textAlign: 'left', top: `calc(100% + ${theme.spacing(1.25)})`, width: theme.spacing(20), - zIndex: theme.zIndex.mobileStepper, + zIndex: theme.zIndex.mobileStepper }, subMenuToggleActive: { - display: 'block', - }, + display: 'block' + } })); const PollerMenu = (): JSX.Element | null => { @@ -124,7 +124,7 @@ const PollerMenu = (): JSX.Element | null => { const { t } = useTranslation(); const { allowedPages } = useNavigation(); const allowPollerConfiguration = allowedPages?.includes( - pollerConfigurationPageNumber, + pollerConfigurationPageNumber ); const [issues, setIssues] = useState(null); @@ -136,7 +136,7 @@ const PollerMenu = (): JSX.Element | null => { const navigate = useNavigate(); const { sendRequest } = useRequest({ httpCodesBypassErrorSnackbar: [401], - request: getData, + request: getData }); const refreshInterval = useAtomValue(refreshIntervalAtom); @@ -226,7 +226,7 @@ const PollerMenu = (): JSX.Element | null => {
{!isEmpty(issues) ? ( diff --git a/www/front_src/src/Header/RessourceStatusCounter/Host/index.test.tsx b/www/front_src/src/Header/RessourceStatusCounter/Host/index.test.tsx index 1058bb72538..e07837af63b 100644 --- a/www/front_src/src/Header/RessourceStatusCounter/Host/index.test.tsx +++ b/www/front_src/src/Header/RessourceStatusCounter/Host/index.test.tsx @@ -17,7 +17,7 @@ describe(HostStatusCounter, () => { data: { down: { total: 3, - unhandled: 3, + unhandled: 3 }, ok: 1, pending: 0, @@ -25,15 +25,15 @@ describe(HostStatusCounter, () => { total: 5, unreachable: { total: 2, - unhandled: 2, - }, - }, + unhandled: 2 + } + } }); const { getByText, getAllByText } = render( - , + ); await waitFor(() => { @@ -46,42 +46,42 @@ describe(HostStatusCounter, () => { fireEvent.click(getByText('3')); expect(decodeURI(window.location.href)).toBe( - 'http://localhost/monitoring/resources?filter={"criterias":[{"name":"resource_types","value":[{"id":"host","name":"Host"}]},{"name":"statuses","value":[{"id":"DOWN","name":"Down"}]},{"name":"states","value":[{"id":"unhandled_problems","name":"Unhandled"}]},{"name":"search","value":""}]}&fromTopCounter=true', + 'http://localhost/monitoring/resources?filter={"criterias":[{"name":"resource_types","value":[{"id":"host","name":"Host"}]},{"name":"statuses","value":[{"id":"DOWN","name":"Down"}]},{"name":"states","value":[{"id":"unhandled_problems","name":"Unhandled"}]},{"name":"search","value":""}]}&fromTopCounter=true' ); fireEvent.click(getByText('2')); expect(decodeURI(window.location.href)).toBe( - 'http://localhost/monitoring/resources?filter={"criterias":[{"name":"resource_types","value":[{"id":"host","name":"Host"}]},{"name":"statuses","value":[{"id":"UNREACHABLE","name":"Unreachable"}]},{"name":"states","value":[{"id":"unhandled_problems","name":"Unhandled"}]},{"name":"search","value":""}]}&fromTopCounter=true', + 'http://localhost/monitoring/resources?filter={"criterias":[{"name":"resource_types","value":[{"id":"host","name":"Host"}]},{"name":"statuses","value":[{"id":"UNREACHABLE","name":"Unreachable"}]},{"name":"states","value":[{"id":"unhandled_problems","name":"Unhandled"}]},{"name":"search","value":""}]}&fromTopCounter=true' ); fireEvent.click(getAllByText('1')[0]); expect(decodeURI(window.location.href)).toBe( - 'http://localhost/monitoring/resources?filter={"criterias":[{"name":"resource_types","value":[{"id":"host","name":"Host"}]},{"name":"statuses","value":[{"id":"UP","name":"Up"}]},{"name":"states","value":[]},{"name":"search","value":""}]}&fromTopCounter=true', + 'http://localhost/monitoring/resources?filter={"criterias":[{"name":"resource_types","value":[{"id":"host","name":"Host"}]},{"name":"statuses","value":[{"id":"UP","name":"Up"}]},{"name":"states","value":[]},{"name":"search","value":""}]}&fromTopCounter=true' ); fireEvent.click(getByText('All')); expect(decodeURI(window.location.href)).toBe( - 'http://localhost/monitoring/resources?filter={"criterias":[{"name":"resource_types","value":[{"id":"host","name":"Host"}]},{"name":"statuses","value":[]},{"name":"states","value":[]},{"name":"search","value":""}]}&fromTopCounter=true', + 'http://localhost/monitoring/resources?filter={"criterias":[{"name":"resource_types","value":[{"id":"host","name":"Host"}]},{"name":"statuses","value":[]},{"name":"states","value":[]},{"name":"search","value":""}]}&fromTopCounter=true' ); fireEvent.click(getByText('Down')); expect(decodeURI(window.location.href)).toBe( - 'http://localhost/monitoring/resources?filter={"criterias":[{"name":"resource_types","value":[{"id":"host","name":"Host"}]},{"name":"statuses","value":[{"id":"DOWN","name":"Down"}]},{"name":"states","value":[{"id":"unhandled_problems","name":"Unhandled"}]},{"name":"search","value":""}]}&fromTopCounter=true', + 'http://localhost/monitoring/resources?filter={"criterias":[{"name":"resource_types","value":[{"id":"host","name":"Host"}]},{"name":"statuses","value":[{"id":"DOWN","name":"Down"}]},{"name":"states","value":[{"id":"unhandled_problems","name":"Unhandled"}]},{"name":"search","value":""}]}&fromTopCounter=true' ); fireEvent.click(getByText('Unreachable')); expect(decodeURI(window.location.href)).toBe( - 'http://localhost/monitoring/resources?filter={"criterias":[{"name":"resource_types","value":[{"id":"host","name":"Host"}]},{"name":"statuses","value":[{"id":"UNREACHABLE","name":"Unreachable"}]},{"name":"states","value":[{"id":"unhandled_problems","name":"Unhandled"}]},{"name":"search","value":""}]}&fromTopCounter=true', + 'http://localhost/monitoring/resources?filter={"criterias":[{"name":"resource_types","value":[{"id":"host","name":"Host"}]},{"name":"statuses","value":[{"id":"UNREACHABLE","name":"Unreachable"}]},{"name":"states","value":[{"id":"unhandled_problems","name":"Unhandled"}]},{"name":"search","value":""}]}&fromTopCounter=true' ); fireEvent.click(getByText('Up')); expect(decodeURI(window.location.href)).toBe( - 'http://localhost/monitoring/resources?filter={"criterias":[{"name":"resource_types","value":[{"id":"host","name":"Host"}]},{"name":"statuses","value":[{"id":"UP","name":"Up"}]},{"name":"states","value":[]},{"name":"search","value":""}]}&fromTopCounter=true', + 'http://localhost/monitoring/resources?filter={"criterias":[{"name":"resource_types","value":[{"id":"host","name":"Host"}]},{"name":"statuses","value":[{"id":"UP","name":"Up"}]},{"name":"states","value":[]},{"name":"search","value":""}]}&fromTopCounter=true' ); fireEvent.click(getByText('Pending')); expect(decodeURI(window.location.href)).toBe( - 'http://localhost/monitoring/resources?filter={"criterias":[{"name":"resource_types","value":[{"id":"host","name":"Host"}]},{"name":"statuses","value":[{"id":"PENDING","name":"Pending"}]},{"name":"states","value":[]},{"name":"search","value":""}]}&fromTopCounter=true', + 'http://localhost/monitoring/resources?filter={"criterias":[{"name":"resource_types","value":[{"id":"host","name":"Host"}]},{"name":"statuses","value":[{"id":"PENDING","name":"Pending"}]},{"name":"states","value":[]},{"name":"search","value":""}]}&fromTopCounter=true' ); }); }); diff --git a/www/front_src/src/Header/RessourceStatusCounter/Host/index.tsx b/www/front_src/src/Header/RessourceStatusCounter/Host/index.tsx index b91a07584dd..6cb9936d473 100755 --- a/www/front_src/src/Header/RessourceStatusCounter/Host/index.tsx +++ b/www/front_src/src/Header/RessourceStatusCounter/Host/index.tsx @@ -18,7 +18,7 @@ import { upCriterias, pendingCriterias, unhandledStateCriterias, - hostCriterias, + hostCriterias } from '../getResourcesUrl'; import RessourceStatusCounter from '..'; import getDefaultCriterias from '../../../Resources/Filter/Criterias/default'; @@ -31,7 +31,7 @@ const numberFormat = yup.number().required().integer(); const statusSchema = yup.object().shape({ down: yup.object().shape({ total: numberFormat, - unhandled: numberFormat, + unhandled: numberFormat }), ok: numberFormat, pending: numberFormat, @@ -39,8 +39,8 @@ const statusSchema = yup.object().shape({ total: numberFormat, unreachable: yup.object().shape({ total: numberFormat, - unhandled: numberFormat, - }), + unhandled: numberFormat + }) }); interface HostData { @@ -75,39 +75,39 @@ const HostStatusCounter = (): JSX.Element => { const unhandledDownHostsCriterias = getDefaultCriterias({ resourceTypes: hostCriterias.value, states: unhandledStateCriterias.value, - statuses: downCriterias.value as Array, + statuses: downCriterias.value as Array }); const unhandledDownHostsLink = use_deprecated_pages ? '/main.php?p=20202&o=h_down&search=' : getHostResourcesUrl({ stateCriterias: unhandledStateCriterias, - statusCriterias: downCriterias, + statusCriterias: downCriterias }); const unhandledUnreachableHostsCriterias = getDefaultCriterias({ resourceTypes: hostCriterias.value, states: unhandledStateCriterias.value, - statuses: unreachableCriterias.value as Array, + statuses: unreachableCriterias.value as Array }); const unhandledUnreachableHostsLink = use_deprecated_pages ? '/main.php?p=20202&o=h_unreachable&search=' : getHostResourcesUrl({ stateCriterias: unhandledStateCriterias, - statusCriterias: unreachableCriterias, + statusCriterias: unreachableCriterias }); const upHostsCriterias = getDefaultCriterias({ resourceTypes: hostCriterias.value, - statuses: upCriterias.value as Array, + statuses: upCriterias.value as Array }); const upHostsLink = use_deprecated_pages ? '/main.php?p=20202&o=h_up&search=' : getHostResourcesUrl({ - statusCriterias: upCriterias, + statusCriterias: upCriterias }); const hostsCriterias = getDefaultCriterias({ - resourceTypes: hostCriterias.value, + resourceTypes: hostCriterias.value }); const hostsLink = use_deprecated_pages ? '/main.php?p=20202&o=h&search=' @@ -115,12 +115,12 @@ const HostStatusCounter = (): JSX.Element => { const pendingHostsCriterias = getDefaultCriterias({ resourceTypes: hostCriterias.value, - statuses: pendingCriterias.value as Array, + statuses: pendingCriterias.value as Array }); const pendingHostsLink = use_deprecated_pages ? '/main.php?p=20202&o=h_pending&search=' : getHostResourcesUrl({ - statusCriterias: pendingCriterias, + statusCriterias: pendingCriterias }); const changeFilterAndNavigate = @@ -149,43 +149,43 @@ const HostStatusCounter = (): JSX.Element => { count: data.down.unhandled, onClick: changeFilterAndNavigate({ criterias: unhandledDownHostsCriterias, - link: unhandledDownHostsLink, + link: unhandledDownHostsLink }), severityCode: SeverityCode.High, testId: 'Hosts Down', - to: unhandledDownHostsLink, + to: unhandledDownHostsLink }, { count: data.unreachable.unhandled, onClick: changeFilterAndNavigate({ criterias: unhandledUnreachableHostsCriterias, - link: unhandledUnreachableHostsLink, + link: unhandledUnreachableHostsLink }), severityCode: SeverityCode.Low, testId: 'Hosts Unreachable', - to: unhandledUnreachableHostsLink, + to: unhandledUnreachableHostsLink }, { count: data.ok, onClick: changeFilterAndNavigate({ criterias: upHostsCriterias, - link: upHostsLink, + link: upHostsLink }), severityCode: SeverityCode.Ok, testId: 'Hosts Up', - to: upHostsLink, - }, + to: upHostsLink + } ]} hasPending={hasPending} iconHeader={{ Icon: HostIcon, iconName: t('Hosts'), - onClick: toggleDetailedView, + onClick: toggleDetailedView }} iconToggleSubmenu={{ onClick: toggleDetailedView, rotate: toggled, - testid: 'submenu-hosts', + testid: 'submenu-hosts' }} submenuItems={[ { @@ -193,69 +193,69 @@ const HostStatusCounter = (): JSX.Element => { onClick: changeFilterAndNavigate({ criterias: hostsCriterias, link: hostsLink, - toggle: toggleDetailedView, + toggle: toggleDetailedView }), submenuCount: numeral(data.total).format('0a'), submenuTitle: t('All'), titleTestId: 'submenu hosts title all', - to: hostsLink, + to: hostsLink }, { countTestId: 'submenu hosts count down', onClick: changeFilterAndNavigate({ criterias: unhandledDownHostsCriterias, link: unhandledDownHostsLink, - toggle: toggleDetailedView, + toggle: toggleDetailedView }), severityCode: SeverityCode.High, submenuCount: `${numeral(data.down.unhandled).format( - '0a', + '0a' )}/${numeral(data.down.total).format('0a')}`, submenuTitle: t('Down'), titleTestId: 'submenu hosts title down', - to: unhandledDownHostsLink, + to: unhandledDownHostsLink }, { countTestId: 'submenu hosts count unreachable', onClick: changeFilterAndNavigate({ criterias: unhandledUnreachableHostsCriterias, link: unhandledUnreachableHostsLink, - toggle: toggleDetailedView, + toggle: toggleDetailedView }), severityCode: SeverityCode.Low, submenuCount: `${numeral(data.unreachable.unhandled).format( - '0a', + '0a' )}/${numeral(data.unreachable.total).format('0a')}`, submenuTitle: t('Unreachable'), titleTestId: 'submenu hosts title unreachable', - to: unhandledUnreachableHostsLink, + to: unhandledUnreachableHostsLink }, { countTestId: 'submenu hosts count ok', onClick: changeFilterAndNavigate({ criterias: upHostsCriterias, link: upHostsLink, - toggle: toggleDetailedView, + toggle: toggleDetailedView }), severityCode: SeverityCode.Ok, submenuCount: numeral(data.ok).format('0a'), submenuTitle: t('Up'), titleTestId: 'submenu hosts title ok', - to: upHostsLink, + to: upHostsLink }, { countTestId: 'submenu hosts count pending', onClick: changeFilterAndNavigate({ criterias: pendingHostsCriterias, link: pendingHostsLink, - toggle: toggleDetailedView, + toggle: toggleDetailedView }), severityCode: SeverityCode.Pending, submenuCount: numeral(data.pending).format('0a'), submenuTitle: t('Pending'), titleTestId: 'submenu hosts title pending', - to: pendingHostsLink, - }, + to: pendingHostsLink + } ]} toggled={toggled} /> diff --git a/www/front_src/src/Header/RessourceStatusCounter/Service/index.test.tsx b/www/front_src/src/Header/RessourceStatusCounter/Service/index.test.tsx index 24815adeb48..d40e18ceb03 100644 --- a/www/front_src/src/Header/RessourceStatusCounter/Service/index.test.tsx +++ b/www/front_src/src/Header/RessourceStatusCounter/Service/index.test.tsx @@ -16,7 +16,7 @@ describe(ServiceStatusCounter, () => { data: { critical: { total: 4, - unhandled: 4, + unhandled: 4 }, ok: 1, pending: 0, @@ -24,19 +24,19 @@ describe(ServiceStatusCounter, () => { total: 9, unknown: { total: 2, - unhandled: 2, + unhandled: 2 }, warning: { total: 3, - unhandled: 3, - }, - }, + unhandled: 3 + } + } }); const { getByText, getAllByText } = render( - , + ); await waitFor(() => { @@ -49,52 +49,52 @@ describe(ServiceStatusCounter, () => { fireEvent.click(getByText('4')); expect(decodeURI(window.location.href)).toBe( - 'http://localhost/monitoring/resources?filter={"criterias":[{"name":"resource_types","value":[{"id":"service","name":"Service"}]},{"name":"statuses","value":[{"id":"CRITICAL","name":"Critical"}]},{"name":"states","value":[{"id":"unhandled_problems","name":"Unhandled"}]},{"name":"search","value":""}]}&fromTopCounter=true', + 'http://localhost/monitoring/resources?filter={"criterias":[{"name":"resource_types","value":[{"id":"service","name":"Service"}]},{"name":"statuses","value":[{"id":"CRITICAL","name":"Critical"}]},{"name":"states","value":[{"id":"unhandled_problems","name":"Unhandled"}]},{"name":"search","value":""}]}&fromTopCounter=true' ); fireEvent.click(getByText('3')); expect(decodeURI(window.location.href)).toBe( - 'http://localhost/monitoring/resources?filter={"criterias":[{"name":"resource_types","value":[{"id":"service","name":"Service"}]},{"name":"statuses","value":[{"id":"WARNING","name":"Warning"}]},{"name":"states","value":[{"id":"unhandled_problems","name":"Unhandled"}]},{"name":"search","value":""}]}&fromTopCounter=true', + 'http://localhost/monitoring/resources?filter={"criterias":[{"name":"resource_types","value":[{"id":"service","name":"Service"}]},{"name":"statuses","value":[{"id":"WARNING","name":"Warning"}]},{"name":"states","value":[{"id":"unhandled_problems","name":"Unhandled"}]},{"name":"search","value":""}]}&fromTopCounter=true' ); fireEvent.click(getByText('2')); expect(decodeURI(window.location.href)).toBe( - 'http://localhost/monitoring/resources?filter={"criterias":[{"name":"resource_types","value":[{"id":"service","name":"Service"}]},{"name":"statuses","value":[{"id":"UNKNOWN","name":"Unknown"}]},{"name":"states","value":[{"id":"unhandled_problems","name":"Unhandled"}]},{"name":"search","value":""}]}&fromTopCounter=true', + 'http://localhost/monitoring/resources?filter={"criterias":[{"name":"resource_types","value":[{"id":"service","name":"Service"}]},{"name":"statuses","value":[{"id":"UNKNOWN","name":"Unknown"}]},{"name":"states","value":[{"id":"unhandled_problems","name":"Unhandled"}]},{"name":"search","value":""}]}&fromTopCounter=true' ); fireEvent.click(getAllByText('1')[0]); expect(decodeURI(window.location.href)).toBe( - 'http://localhost/monitoring/resources?filter={"criterias":[{"name":"resource_types","value":[{"id":"service","name":"Service"}]},{"name":"statuses","value":[{"id":"OK","name":"Ok"}]},{"name":"states","value":[]},{"name":"search","value":""}]}&fromTopCounter=true', + 'http://localhost/monitoring/resources?filter={"criterias":[{"name":"resource_types","value":[{"id":"service","name":"Service"}]},{"name":"statuses","value":[{"id":"OK","name":"Ok"}]},{"name":"states","value":[]},{"name":"search","value":""}]}&fromTopCounter=true' ); fireEvent.click(getByText('All')); expect(decodeURI(window.location.href)).toBe( - 'http://localhost/monitoring/resources?filter={"criterias":[{"name":"resource_types","value":[{"id":"service","name":"Service"}]},{"name":"statuses","value":[]},{"name":"states","value":[]},{"name":"search","value":""}]}&fromTopCounter=true', + 'http://localhost/monitoring/resources?filter={"criterias":[{"name":"resource_types","value":[{"id":"service","name":"Service"}]},{"name":"statuses","value":[]},{"name":"states","value":[]},{"name":"search","value":""}]}&fromTopCounter=true' ); fireEvent.click(getByText('Critical')); expect(decodeURI(window.location.href)).toBe( - 'http://localhost/monitoring/resources?filter={"criterias":[{"name":"resource_types","value":[{"id":"service","name":"Service"}]},{"name":"statuses","value":[{"id":"CRITICAL","name":"Critical"}]},{"name":"states","value":[{"id":"unhandled_problems","name":"Unhandled"}]},{"name":"search","value":""}]}&fromTopCounter=true', + 'http://localhost/monitoring/resources?filter={"criterias":[{"name":"resource_types","value":[{"id":"service","name":"Service"}]},{"name":"statuses","value":[{"id":"CRITICAL","name":"Critical"}]},{"name":"states","value":[{"id":"unhandled_problems","name":"Unhandled"}]},{"name":"search","value":""}]}&fromTopCounter=true' ); fireEvent.click(getByText('Warning')); expect(decodeURI(window.location.href)).toBe( - 'http://localhost/monitoring/resources?filter={"criterias":[{"name":"resource_types","value":[{"id":"service","name":"Service"}]},{"name":"statuses","value":[{"id":"WARNING","name":"Warning"}]},{"name":"states","value":[{"id":"unhandled_problems","name":"Unhandled"}]},{"name":"search","value":""}]}&fromTopCounter=true', + 'http://localhost/monitoring/resources?filter={"criterias":[{"name":"resource_types","value":[{"id":"service","name":"Service"}]},{"name":"statuses","value":[{"id":"WARNING","name":"Warning"}]},{"name":"states","value":[{"id":"unhandled_problems","name":"Unhandled"}]},{"name":"search","value":""}]}&fromTopCounter=true' ); fireEvent.click(getByText('Unknown')); expect(decodeURI(window.location.href)).toBe( - 'http://localhost/monitoring/resources?filter={"criterias":[{"name":"resource_types","value":[{"id":"service","name":"Service"}]},{"name":"statuses","value":[{"id":"UNKNOWN","name":"Unknown"}]},{"name":"states","value":[{"id":"unhandled_problems","name":"Unhandled"}]},{"name":"search","value":""}]}&fromTopCounter=true', + 'http://localhost/monitoring/resources?filter={"criterias":[{"name":"resource_types","value":[{"id":"service","name":"Service"}]},{"name":"statuses","value":[{"id":"UNKNOWN","name":"Unknown"}]},{"name":"states","value":[{"id":"unhandled_problems","name":"Unhandled"}]},{"name":"search","value":""}]}&fromTopCounter=true' ); fireEvent.click(getByText('Ok')); expect(decodeURI(window.location.href)).toBe( - 'http://localhost/monitoring/resources?filter={"criterias":[{"name":"resource_types","value":[{"id":"service","name":"Service"}]},{"name":"statuses","value":[{"id":"OK","name":"Ok"}]},{"name":"states","value":[]},{"name":"search","value":""}]}&fromTopCounter=true', + 'http://localhost/monitoring/resources?filter={"criterias":[{"name":"resource_types","value":[{"id":"service","name":"Service"}]},{"name":"statuses","value":[{"id":"OK","name":"Ok"}]},{"name":"states","value":[]},{"name":"search","value":""}]}&fromTopCounter=true' ); fireEvent.click(getByText('Pending')); expect(decodeURI(window.location.href)).toBe( - 'http://localhost/monitoring/resources?filter={"criterias":[{"name":"resource_types","value":[{"id":"service","name":"Service"}]},{"name":"statuses","value":[{"id":"PENDING","name":"Pending"}]},{"name":"states","value":[]},{"name":"search","value":""}]}&fromTopCounter=true', + 'http://localhost/monitoring/resources?filter={"criterias":[{"name":"resource_types","value":[{"id":"service","name":"Service"}]},{"name":"statuses","value":[{"id":"PENDING","name":"Pending"}]},{"name":"states","value":[]},{"name":"search","value":""}]}&fromTopCounter=true' ); }); }); diff --git a/www/front_src/src/Header/RessourceStatusCounter/Service/index.tsx b/www/front_src/src/Header/RessourceStatusCounter/Service/index.tsx index e32d42e3264..111a0e54d26 100755 --- a/www/front_src/src/Header/RessourceStatusCounter/Service/index.tsx +++ b/www/front_src/src/Header/RessourceStatusCounter/Service/index.tsx @@ -19,7 +19,7 @@ import { okCriterias, pendingCriterias, unhandledStateCriterias, - serviceCriteria, + serviceCriteria } from '../getResourcesUrl'; import RessourceStatusCounter from '..'; import { Criteria } from '../../../Resources/Filter/Criterias/models'; @@ -32,7 +32,7 @@ const numberFormat = yup.number().required().integer(); const statusSchema = yup.object().shape({ critical: yup.object().shape({ total: numberFormat, - unhandled: numberFormat, + unhandled: numberFormat }), ok: numberFormat, pending: numberFormat, @@ -40,12 +40,12 @@ const statusSchema = yup.object().shape({ total: numberFormat, unknown: yup.object().shape({ total: numberFormat, - unhandled: numberFormat, + unhandled: numberFormat }), warning: yup.object().shape({ total: numberFormat, - unhandled: numberFormat, - }), + unhandled: numberFormat + }) }); interface SelectResourceProps { @@ -65,49 +65,49 @@ const ServiceStatusCounter = (): JSX.Element => { const unhandledCriticalServicesCriterias = getDefaultCriterias({ resourceTypes: serviceCriteria.value, states: unhandledStateCriterias.value, - statuses: criticalCriterias.value as Array, + statuses: criticalCriterias.value as Array }); const unhandledCriticalServicesLink = use_deprecated_pages ? '/main.php?p=20201&o=svc_unhandled&statusFilter=critical&search=' : getServiceResourcesUrl({ stateCriterias: unhandledStateCriterias, - statusCriterias: criticalCriterias, + statusCriterias: criticalCriterias }); const unhandledWarningServicesCriterias = getDefaultCriterias({ resourceTypes: serviceCriteria.value, states: unhandledStateCriterias.value, - statuses: warningCriterias.value as Array, + statuses: warningCriterias.value as Array }); const unhandledWarningServicesLink = use_deprecated_pages ? '/main.php?p=20201&o=svc_unhandled&statusFilter=warning&search=' : getServiceResourcesUrl({ stateCriterias: unhandledStateCriterias, - statusCriterias: warningCriterias, + statusCriterias: warningCriterias }); const unhandledUnknownServicesCriterias = getDefaultCriterias({ resourceTypes: serviceCriteria.value, states: unhandledStateCriterias.value, - statuses: unknownCriterias.value as Array, + statuses: unknownCriterias.value as Array }); const unhandledUnknownServicesLink = use_deprecated_pages ? '/main.php?p=20201&o=svc_unhandled&statusFilter=unknown&search=' : getServiceResourcesUrl({ stateCriterias: unhandledStateCriterias, - statusCriterias: unknownCriterias, + statusCriterias: unknownCriterias }); const okServicesCriterias = getDefaultCriterias({ resourceTypes: serviceCriteria.value, - statuses: okCriterias.value as Array, + statuses: okCriterias.value as Array }); const okServicesLink = use_deprecated_pages ? '/main.php?p=20201&o=svc&statusFilter=ok&search=' : getServiceResourcesUrl({ statusCriterias: okCriterias }); const servicesCriterias = getDefaultCriterias({ - resourceTypes: serviceCriteria.value, + resourceTypes: serviceCriteria.value }); const servicesLink = use_deprecated_pages ? '/main.php?p=20201&o=svc&statusFilter=&search=' @@ -115,12 +115,12 @@ const ServiceStatusCounter = (): JSX.Element => { const pendingServicesCriterias = getDefaultCriterias({ resourceTypes: serviceCriteria.value, - statuses: pendingCriterias.value as Array, + statuses: pendingCriterias.value as Array }); const pendingServicesLink = use_deprecated_pages ? '/main.php?p=20201&o=svc&statusFilter=&search=' : getServiceResourcesUrl({ - statusCriterias: pendingCriterias, + statusCriterias: pendingCriterias }); const changeFilterAndNavigate = @@ -149,56 +149,56 @@ const ServiceStatusCounter = (): JSX.Element => { count: data.critical.unhandled, onClick: changeFilterAndNavigate({ criterias: unhandledCriticalServicesCriterias, - link: unhandledCriticalServicesLink, + link: unhandledCriticalServicesLink }), severityCode: SeverityCode.High, testId: 'Services Critical', - to: unhandledCriticalServicesLink, + to: unhandledCriticalServicesLink }, { count: data.warning.unhandled, onClick: changeFilterAndNavigate({ criterias: unhandledWarningServicesCriterias, - link: unhandledWarningServicesLink, + link: unhandledWarningServicesLink }), severityCode: SeverityCode.Medium, testId: 'Services Warning', - to: unhandledWarningServicesLink, + to: unhandledWarningServicesLink }, { count: data.unknown.unhandled, onClick: changeFilterAndNavigate({ criterias: unhandledUnknownServicesCriterias, - link: unhandledUnknownServicesLink, + link: unhandledUnknownServicesLink }), severityCode: SeverityCode.Low, testId: 'Services Unknown', - to: unhandledUnknownServicesLink, + to: unhandledUnknownServicesLink }, { count: data.ok, onClick: changeFilterAndNavigate({ criterias: okServicesCriterias, - link: okServicesLink, + link: okServicesLink }), severityCode: SeverityCode.Ok, testId: 'Services Ok', - to: okServicesLink, - }, + to: okServicesLink + } ]} hasPending={hasPending} iconHeader={{ Icon: ServiceIcon, iconName: t('Services'), - onClick: toggleDetailedView, + onClick: toggleDetailedView }} iconToggleSubmenu={{ onClick: toggleDetailedView, rotate: toggled, - testid: 'submenu-service', + testid: 'submenu-service' }} submenuItems={[ { @@ -206,82 +206,82 @@ const ServiceStatusCounter = (): JSX.Element => { onClick: changeFilterAndNavigate({ criterias: servicesCriterias, link: servicesLink, - toggle: toggleDetailedView, + toggle: toggleDetailedView }), submenuCount: numeral(data.total).format('0a'), submenuTitle: t('All'), titleTestId: 'submenu hosts title all', - to: servicesLink, + to: servicesLink }, { countTestId: 'submenu services count critical', onClick: changeFilterAndNavigate({ criterias: unhandledCriticalServicesCriterias, link: unhandledCriticalServicesLink, - toggle: toggleDetailedView, + toggle: toggleDetailedView }), severityCode: SeverityCode.High, submenuCount: `${numeral(data.critical.unhandled).format( - '0a', + '0a' )}/${numeral(data.critical.total).format('0a')}`, submenuTitle: t('Critical'), titleTestId: 'submenu services title critical', - to: unhandledCriticalServicesLink, + to: unhandledCriticalServicesLink }, { countTestId: 'submenu services count warning', onClick: changeFilterAndNavigate({ criterias: unhandledWarningServicesCriterias, link: unhandledWarningServicesLink, - toggle: toggleDetailedView, + toggle: toggleDetailedView }), severityCode: SeverityCode.Medium, submenuCount: `${numeral(data.warning.unhandled).format( - '0a', + '0a' )}/${numeral(data.warning.total).format('0a')}`, submenuTitle: t('Warning'), titleTestId: 'submenu services title warning', - to: unhandledWarningServicesLink, + to: unhandledWarningServicesLink }, { countTestId: 'submenu services count unknown', onClick: changeFilterAndNavigate({ criterias: unhandledUnknownServicesCriterias, link: unhandledUnknownServicesLink, - toggle: toggleDetailedView, + toggle: toggleDetailedView }), severityCode: SeverityCode.Low, submenuCount: `${numeral(data.unknown.unhandled).format( - '0a', + '0a' )}/${numeral(data.unknown.total).format('0a')}`, submenuTitle: t('Unknown'), titleTestId: 'submenu services title unknown', - to: unhandledUnknownServicesLink, + to: unhandledUnknownServicesLink }, { countTestId: 'submenu services count ok', onClick: changeFilterAndNavigate({ criterias: okServicesCriterias, link: okServicesLink, - toggle: toggleDetailedView, + toggle: toggleDetailedView }), severityCode: SeverityCode.Ok, submenuCount: numeral(data.ok).format('0a'), submenuTitle: t('Ok'), titleTestId: 'submenu services title ok', - to: okServicesLink, + to: okServicesLink }, { onClick: changeFilterAndNavigate({ criterias: pendingServicesCriterias, link: pendingServicesLink, - toggle: toggleDetailedView, + toggle: toggleDetailedView }), severityCode: SeverityCode.Pending, submenuCount: numeral(data.pending).format('0a'), submenuTitle: t('Pending'), - to: pendingServicesLink, - }, + to: pendingServicesLink + } ]} toggled={toggled} /> diff --git a/www/front_src/src/Header/RessourceStatusCounter/getResourcesUrl.ts b/www/front_src/src/Header/RessourceStatusCounter/getResourcesUrl.ts index ebfaf1318d7..1c8f5376ecb 100644 --- a/www/front_src/src/Header/RessourceStatusCounter/getResourcesUrl.ts +++ b/www/front_src/src/Header/RessourceStatusCounter/getResourcesUrl.ts @@ -2,11 +2,11 @@ import { CriteriaValue } from '../../Resources/Filter/Criterias/models'; const hostCriterias = { name: 'resource_types', - value: [{ id: 'host', name: 'Host' }], + value: [{ id: 'host', name: 'Host' }] }; const serviceCriteria = { name: 'resource_types', - value: [{ id: 'service', name: 'Service' }], + value: [{ id: 'service', name: 'Service' }] }; interface StatusCriterias { @@ -21,13 +21,13 @@ const getStatusCriterias = (status): StatusCriterias => { const downCriterias = getStatusCriterias({ id: 'DOWN', name: 'Down' }); const unreachableCriterias = getStatusCriterias({ id: 'UNREACHABLE', - name: 'Unreachable', + name: 'Unreachable' }); const upCriterias = getStatusCriterias({ id: 'UP', name: 'Up' }); const pendingCriterias = getStatusCriterias({ id: 'PENDING', name: 'Pending' }); const criticalCriterias = getStatusCriterias({ id: 'CRITICAL', - name: 'Critical', + name: 'Critical' }); const warningCriterias = getStatusCriterias({ id: 'WARNING', name: 'Warning' }); const unknownCriterias = getStatusCriterias({ id: 'UNKNOWN', name: 'Unknown' }); @@ -35,25 +35,25 @@ const okCriterias = getStatusCriterias({ id: 'OK', name: 'Ok' }); const unhandledStateCriterias = { name: 'states', - value: [{ id: 'unhandled_problems', name: 'Unhandled' }], + value: [{ id: 'unhandled_problems', name: 'Unhandled' }] }; const getResourcesUrl = ({ resourceTypeCriterias, statusCriterias, - stateCriterias, + stateCriterias }): string => { const filterQueryParameter = { criterias: [ resourceTypeCriterias, statusCriterias, stateCriterias, - { name: 'search', value: '' }, - ], + { name: 'search', value: '' } + ] }; return `/monitoring/resources?filter=${JSON.stringify( - filterQueryParameter, + filterQueryParameter )}&fromTopCounter=true`; }; @@ -64,23 +64,23 @@ interface Criterias { const getHostResourcesUrl = ({ statusCriterias = { name: 'statuses', value: [] }, - stateCriterias = { name: 'states', value: [] }, + stateCriterias = { name: 'states', value: [] } }: Criterias = {}): string => { return getResourcesUrl({ resourceTypeCriterias: hostCriterias, stateCriterias, - statusCriterias, + statusCriterias }); }; const getServiceResourcesUrl = ({ statusCriterias = { name: 'statuses', value: [] }, - stateCriterias = { name: 'states', value: [] }, + stateCriterias = { name: 'states', value: [] } }: Criterias = {}): string => { return getResourcesUrl({ resourceTypeCriterias: serviceCriteria, stateCriterias, - statusCriterias, + statusCriterias }); }; @@ -97,5 +97,5 @@ export { warningCriterias, okCriterias, unhandledStateCriterias, - getServiceResourcesUrl, + getServiceResourcesUrl }; diff --git a/www/front_src/src/Header/RessourceStatusCounter/index.tsx b/www/front_src/src/Header/RessourceStatusCounter/index.tsx index b20ed3885d5..a6d29e82f5b 100644 --- a/www/front_src/src/Header/RessourceStatusCounter/index.tsx +++ b/www/front_src/src/Header/RessourceStatusCounter/index.tsx @@ -19,12 +19,12 @@ interface Props { const RessourceStatusCounter = < StatusCount extends { pending: number; - }, + } >({ endpoint, schema, children, - loaderWidth, + loaderWidth }: Props): JSX.Element | null => { const [data, setData] = useState(); const [toggled, setToggled] = useState(); diff --git a/www/front_src/src/Header/SwitchThemeMode/index.tsx b/www/front_src/src/Header/SwitchThemeMode/index.tsx index d17c8dc1723..1132c9f8e2a 100644 --- a/www/front_src/src/Header/SwitchThemeMode/index.tsx +++ b/www/front_src/src/Header/SwitchThemeMode/index.tsx @@ -13,35 +13,35 @@ import useSwitchThemeMode from './useSwitchThemeMode'; const useStyles = makeStyles((theme) => ({ container: { '& .MuiSwitch-thumb': { - backgroundColor: 'white', + backgroundColor: 'white' }, '& .MuiSwitch-track, & .Mui-checked + .MuiSwitch-track': { backgroundColor: theme.palette.text.primary, - opacity: 0.5, + opacity: 0.5 }, alignItems: 'center', - display: 'flex', + display: 'flex' }, containerMode: { display: 'flex', - justifyContent: 'space-around', + justifyContent: 'space-around' }, containerSwitch: { '&.Mui-checked': { '&:hover': { - backgroundColor: 'unset', - }, + backgroundColor: 'unset' + } }, '&:hover': { - backgroundColor: 'unset', - }, + backgroundColor: 'unset' + } }, disabledMode: { - opacity: 0.5, + opacity: 0.5 }, mode: { - paddingLeft: theme.spacing(1), - }, + paddingLeft: theme.spacing(1) + } })); const SwitchThemeMode = (): JSX.Element => { @@ -52,7 +52,7 @@ const SwitchThemeMode = (): JSX.Element => { const [isDark, setIsDark] = useState(isDarkMode); const { sendRequest } = useRequest({ - request: patchData, + request: patchData }); const switchEndPoint = './api/latest/configuration/users/current/parameters'; @@ -63,7 +63,7 @@ const SwitchThemeMode = (): JSX.Element => { updateUser(); sendRequest({ data: { theme: themeMode }, - endpoint: switchEndPoint, + endpoint: switchEndPoint }).then(() => { if (isCurrentPageLegacy) { window.location.reload(); @@ -90,7 +90,7 @@ const SwitchThemeMode = (): JSX.Element => { Dark diff --git a/www/front_src/src/Header/SwitchThemeMode/useSwitchThemeMode.tsx b/www/front_src/src/Header/SwitchThemeMode/useSwitchThemeMode.tsx index f25adff71f7..9aec7d834a9 100644 --- a/www/front_src/src/Header/SwitchThemeMode/useSwitchThemeMode.tsx +++ b/www/front_src/src/Header/SwitchThemeMode/useSwitchThemeMode.tsx @@ -9,7 +9,7 @@ const useSwitchThemeMode = (): [ isDarkMode: boolean, isPending: boolean, themeMode: ThemeMode, - updateUser: () => void, + updateUser: () => void ] => { const [user, setUser] = useAtom(userAtom); const isDarkMode = equals(user.themeMode, ThemeMode.dark); @@ -20,7 +20,7 @@ const useSwitchThemeMode = (): [ startTransition(() => { setUser({ ...user, - themeMode, + themeMode }); }); diff --git a/www/front_src/src/Header/helpers/index.ts b/www/front_src/src/Header/helpers/index.ts index 62d01d70451..12187b20759 100644 --- a/www/front_src/src/Header/helpers/index.ts +++ b/www/front_src/src/Header/helpers/index.ts @@ -1,5 +1,5 @@ import { useLocaleDateTimeFormat } from '@centreon/ui'; export const centreonUi = { - useLocaleDateTimeFormat, + useLocaleDateTimeFormat }; diff --git a/www/front_src/src/Header/index.tsx b/www/front_src/src/Header/index.tsx index 6bc09bac91e..5fffae1adad 100755 --- a/www/front_src/src/Header/index.tsx +++ b/www/front_src/src/Header/index.tsx @@ -27,22 +27,22 @@ const useStyles = makeStyles((theme) => ({ : theme.palette.primary.dark, display: 'flex', height: theme.spacing(headerHeight), - padding: `0 ${theme.spacing(3)}`, + padding: `0 ${theme.spacing(3)}` }, item: { - flex: '1 0 120px', + flex: '1 0 120px' }, leftContainer: { alignItems: 'center', display: 'flex', gap: theme.spacing(2), [theme.breakpoints.up(768)]: { - gap: theme.spacing(3), - }, + gap: theme.spacing(3) + } }, userMenuContainer: { - marginLeft: 'auto', - }, + marginLeft: 'auto' + } })); const Header = (): JSX.Element => { diff --git a/www/front_src/src/Header/userMenu/index.cypress.spec.tsx b/www/front_src/src/Header/userMenu/index.cypress.spec.tsx index 5d87a1ded3f..b6b2bf392a5 100644 --- a/www/front_src/src/Header/userMenu/index.cypress.spec.tsx +++ b/www/front_src/src/Header/userMenu/index.cypress.spec.tsx @@ -17,12 +17,12 @@ describe('User Menu', () => { cy.route('GET', '**/internal.php?**', '@user').as('getUser'); cy.intercept('PATCH', 'parameters', { - theme: 'dark', + theme: 'dark' }).as('updateTheme'); cy.stub(centreonUi, 'useLocaleDateTimeFormat').returns({ format: (): string => 'April 28,2022', - toTime: (): string => '4:20 PM', + toTime: (): string => '4:20 PM' }); cy.mount( @@ -30,7 +30,7 @@ describe('User Menu', () => {
- , + ); }); diff --git a/www/front_src/src/Header/userMenu/index.test.tsx b/www/front_src/src/Header/userMenu/index.test.tsx index 2878468f19a..8307fe8e984 100644 --- a/www/front_src/src/Header/userMenu/index.test.tsx +++ b/www/front_src/src/Header/userMenu/index.test.tsx @@ -19,7 +19,7 @@ import UserMenu from '.'; window.document.execCommand = jest.fn(); jest.mock('@centreon/ui-context', () => - jest.requireActual('centreon-frontend/packages/ui-context'), + jest.requireActual('centreon-frontend/packages/ui-context') ); const mockedAxios = axios as jest.Mocked; @@ -31,7 +31,7 @@ const retrievedUser = { locale: 'en_US.UTF8', name: 'Admin', timezone: 'Europe/Paris', - use_deprecated_pages: false, + use_deprecated_pages: false }; mockdate.set('2022-01-01T12:20:00Z'); @@ -41,24 +41,24 @@ const renderUserMenu = (): RenderResult => - , + ); const retrievedUserData = { fullname: 'Admin admin', - username: 'admin', + username: 'admin' }; const retrievedUserDataAutologinKey = { autologinkey: 'autologinKey', fullname: 'Admin admin', - username: 'admin', + username: 'admin' }; const cancelTokenRequestParam = { cancelToken: {} }; @@ -98,7 +98,7 @@ describe('User Menu', () => { await waitFor(() => { expect(mockedAxios.get).toHaveBeenCalledWith( userEndpoint, - cancelTokenRequestParam, + cancelTokenRequestParam ); }); @@ -168,9 +168,9 @@ describe('User Menu', () => { { ...cancelTokenRequestParam, headers: { - 'Content-Type': 'application/x-www-form-urlencoded', - }, - }, + 'Content-Type': 'application/x-www-form-urlencoded' + } + } ); }); diff --git a/www/front_src/src/Header/userMenu/index.tsx b/www/front_src/src/Header/userMenu/index.tsx index b87afb4339d..8ee30de0c64 100755 --- a/www/front_src/src/Header/userMenu/index.tsx +++ b/www/front_src/src/Header/userMenu/index.tsx @@ -15,7 +15,7 @@ import { ListItemText, Popper, ListItemButton, - Fade, + Fade } from '@mui/material'; import UserIcon from '@mui/icons-material/Person'; import FileCopyIcon from '@mui/icons-material/FileCopy'; @@ -30,7 +30,7 @@ import { getData, useRequest, useSnackbar, - useLocaleDateTimeFormat, + useLocaleDateTimeFormat } from '@centreon/ui'; import { ThemeMode } from '@centreon/ui-context'; @@ -43,7 +43,7 @@ import reactRoutes from '../../reactRoutes/routeMap'; import { passwordResetInformationsAtom } from '../../ResetPassword/passwordResetInformationsAtom'; import { selectedNavigationItemsAtom, - hoveredNavigationItemsAtom, + hoveredNavigationItemsAtom } from '../../Navigation/Sidebar/sideBarAtoms'; import { userEndpoint } from './api/endpoint'; @@ -53,7 +53,7 @@ import { labelLogout, labelPasswordWillExpireIn, labelProfile, - labelYouHaveBeenLoggedOut, + labelYouHaveBeenLoggedOut } from './translatedLabels'; const editProfileTopologyPage = '50104'; @@ -80,40 +80,40 @@ const useStyles = makeStyles((theme) => ({ fontSize: theme.typography.body1.fontSize, height: theme.spacing(2.5), justifyContent: 'spaceBetween', - minWidth: theme.spacing(2.5), + minWidth: theme.spacing(2.5) }, clock: { display: 'none', [theme.breakpoints.up(648)]: { - display: 'block', - }, + display: 'block' + } }, containerList: { color: theme.palette.text.primary, - padding: 0, + padding: 0 }, fullname: { overflow: 'hidden', textOverflow: 'ellipsis', - whiteSpace: 'nowrap', + whiteSpace: 'nowrap' }, hiddenInput: { height: theme.spacing(0), opacity: 0, position: 'absolute', top: theme.spacing(-13), - width: theme.spacing(0), + width: theme.spacing(0) }, icon: { - marginRight: theme.spacing(1), + marginRight: theme.spacing(1) }, icons: { borderLeft: `1px solid ${theme.palette.common.white}`, - paddingLeft: theme.spacing(3), + paddingLeft: theme.spacing(3) }, listItem: { '&:first-child': { - borderBottom: `1px solid ${theme.palette.divider}`, + borderBottom: `1px solid ${theme.palette.divider}` }, '&:hover': { background: equals(theme.palette.mode, ThemeMode.dark) @@ -121,18 +121,18 @@ const useStyles = makeStyles((theme) => ({ : theme.palette.primary.light, color: equals(theme.palette.mode, ThemeMode.dark) ? theme.palette.common.white - : theme.palette.primary.main, + : theme.palette.primary.main }, '&:last-child': { - borderTop: `1px solid ${theme.palette.divider}`, + borderTop: `1px solid ${theme.palette.divider}` }, - padding: theme.spacing(1), + padding: theme.spacing(1) }, listItemButton: { '&:hover': { - background: 'none', + background: 'none' }, - padding: 0, + padding: 0 }, menu: { backgroundColor: theme.palette.background.default, @@ -140,35 +140,35 @@ const useStyles = makeStyles((theme) => ({ borderRadius: 0, boxShadow: theme.shadows[3], fontSize: theme.typography.body2.fontSize, - minWidth: 190, + minWidth: 190 }, passwordExpiration: { - color: theme.palette.warning.main, + color: theme.palette.warning.main }, popper: { - zIndex: theme.zIndex.tooltip, + zIndex: theme.zIndex.tooltip }, switchItem: { - padding: theme.spacing(0, 2, 0.25, 11 / 8), + padding: theme.spacing(0, 2, 0.25, 11 / 8) }, text: { margin: 0, overflow: 'hidden', textOverflow: 'ellipsis', - whiteSpace: 'nowrap', + whiteSpace: 'nowrap' }, userIcon: { color: theme.palette.common.white, cursor: 'pointer', - fontSize: theme.spacing(4), + fontSize: theme.spacing(4) }, wrapper: { alignItems: 'center', display: 'flex', gap: theme.spacing(3), height: '100%', - justifyContent: 'flex-end', - }, + justifyContent: 'flex-end' + } })); interface Props { headerRef?: RefObject; @@ -189,10 +189,10 @@ const UserMenu = ({ headerRef }: Props): JSX.Element => { const refreshTimeout = useRef(); const userIconRef = useRef(null); const { sendRequest: logoutRequest } = useRequest({ - request: postData, + request: postData }); const { sendRequest } = useRequest({ - request: getData, + request: getData }); const navigate = useNavigate(); @@ -201,7 +201,7 @@ const UserMenu = ({ headerRef }: Props): JSX.Element => { const setAreUserParametersLoaded = useUpdateAtom(areUserParametersLoadedAtom); const setPasswordResetInformationsAtom = useUpdateAtom( - passwordResetInformationsAtom, + passwordResetInformationsAtom ); const setSelectedNavigationItems = useUpdateAtom(selectedNavigationItemsAtom); const setHoveredNavigationItems = useUpdateAtom(hoveredNavigationItemsAtom); @@ -222,7 +222,7 @@ const UserMenu = ({ headerRef }: Props): JSX.Element => { const logout = (): void => { logoutRequest({ data: {}, - endpoint: logoutEndpoint, + endpoint: logoutEndpoint }).then(() => { setAreUserParametersLoaded(false); setPasswordResetInformationsAtom(null); @@ -335,11 +335,11 @@ const UserMenu = ({ headerRef }: Props): JSX.Element => { isGreaterThanSevenDays(data.password_remaining_time); const formattedPasswordRemainingTime = toHumanizedDuration( - data.password_remaining_time as number, + data.password_remaining_time as number ); const primaryTypographyProps = { - className: classes.text, + className: classes.text }; return ( @@ -354,7 +354,7 @@ const UserMenu = ({ headerRef }: Props): JSX.Element => { passwordIsNotYetAboutToExpire ? '' : `${t( - labelPasswordWillExpireIn, + labelPasswordWillExpireIn )}: ${formattedPasswordRemainingTime}` } > @@ -382,9 +382,9 @@ const UserMenu = ({ headerRef }: Props): JSX.Element => { { name: 'offset', options: { - offset: [0, anchorHeight], - }, - }, + offset: [0, anchorHeight] + } + } ]} open={not(isNil(anchorEl))} placement="bottom-end" @@ -395,7 +395,7 @@ const UserMenu = ({ headerRef }: Props): JSX.Element => { className={classes.menu} ref={userMenu as RefObject} sx={{ - display: isNil(anchorEl) ? 'none' : 'block', + display: isNil(anchorEl) ? 'none' : 'block' }} > diff --git a/www/front_src/src/Login/Copyright.tsx b/www/front_src/src/Login/Copyright.tsx index ff7b5618c85..fb631ddef09 100644 --- a/www/front_src/src/Login/Copyright.tsx +++ b/www/front_src/src/Login/Copyright.tsx @@ -6,8 +6,8 @@ import { useLocaleDateTimeFormat } from '@centreon/ui'; const useStyles = makeStyles({ copyright: { alignItems: 'center', - display: 'flex', - }, + display: 'flex' + } }); const Copyright = (): JSX.Element => { @@ -16,7 +16,7 @@ const Copyright = (): JSX.Element => { const year = format({ date: new Date(), - formatString: 'YYYY', + formatString: 'YYYY' }); return ( diff --git a/www/front_src/src/Login/ExternalProviders.tsx b/www/front_src/src/Login/ExternalProviders.tsx index 1da0ea86773..6a013e50a7e 100644 --- a/www/front_src/src/Login/ExternalProviders.tsx +++ b/www/front_src/src/Login/ExternalProviders.tsx @@ -17,12 +17,12 @@ const useStyles = makeStyles((theme) => ({ flexDirection: 'column', marginTop: theme.spacing(1), rowGap: theme.spacing(1), - width: '100%', - }, + width: '100%' + } })); const ExternalProviders = ({ - providersConfiguration, + providersConfiguration }: Props): JSX.Element | null => { const classes = useStyles(); const { t } = useTranslation(); diff --git a/www/front_src/src/Login/Form.tsx b/www/front_src/src/Login/Form.tsx index c7448daa307..7cad8c3db43 100644 --- a/www/front_src/src/Login/Form.tsx +++ b/www/front_src/src/Login/Form.tsx @@ -22,8 +22,8 @@ const useStyles = makeStyles((theme) => ({ display: 'flex', flexDirection: 'column', rowGap: theme.spacing(2), - width: '100%', - }, + width: '100%' + } })); const getTouchedError = ({ fieldName, errors, touched }): string | undefined => @@ -41,7 +41,7 @@ const LoginForm = (): JSX.Element => { handleBlur, dirty, isSubmitting, - handleSubmit, + handleSubmit } = useFormikContext(); const changeVisibility = (): void => { @@ -52,13 +52,13 @@ const LoginForm = (): JSX.Element => { const aliasError = getTouchedError({ errors, fieldName: aliasFieldName, - touched, + touched }); const passwordValue = prop(passwordFieldName, values); const passwordError = getTouchedError({ errors, fieldName: passwordFieldName, - touched, + touched }); const isDisabled = not(isEmpty(errors)) || isSubmitting || not(dirty); @@ -69,7 +69,7 @@ const LoginForm = (): JSX.Element => { isVisible={isVisible} /> ), - [isVisible], + [isVisible] ); return ( diff --git a/www/front_src/src/Login/Logo.tsx b/www/front_src/src/Login/Logo.tsx index 39c164e8694..3222fa9d3b6 100644 --- a/www/front_src/src/Login/Logo.tsx +++ b/www/front_src/src/Login/Logo.tsx @@ -17,12 +17,12 @@ const useStyles = makeStyles({ centreonLogo: { height: '100%', objectFit: 'contain', - width: '100%', + width: '100%' }, centreonLogoWhite: { height: 57, - width: 250, - }, + width: 250 + } }); const Logo = (): JSX.Element => { @@ -38,12 +38,12 @@ const Logo = (): JSX.Element => { alt={t(labelCentreonLogo)} aria-label={t(labelCentreonLogo)} className={clsx(classes.centreonLogo, { - [classes.centreonLogoWhite]: isDarkMode, + [classes.centreonLogoWhite]: isDarkMode })} src={logo} /> ), - memoProps: [isDarkMode], + memoProps: [isDarkMode] }); }; diff --git a/www/front_src/src/Login/PasswordEndAdornment.tsx b/www/front_src/src/Login/PasswordEndAdornment.tsx index 7d419bcef23..fe41016ab70 100644 --- a/www/front_src/src/Login/PasswordEndAdornment.tsx +++ b/www/front_src/src/Login/PasswordEndAdornment.tsx @@ -8,7 +8,7 @@ import { IconButton } from '@centreon/ui'; import { labelDisplayThePassword, - labelHideThePassword, + labelHideThePassword } from './translatedLabels'; interface Props { @@ -18,7 +18,7 @@ interface Props { const PasswordEndAdornment = ({ isVisible, - changeVisibility, + changeVisibility }: Props): JSX.Element => { const { t } = useTranslation(); diff --git a/www/front_src/src/Login/api/decoder.ts b/www/front_src/src/Login/api/decoder.ts index 20622473a2b..7d682da253d 100644 --- a/www/front_src/src/Login/api/decoder.ts +++ b/www/front_src/src/Login/api/decoder.ts @@ -5,13 +5,13 @@ import { ProviderConfiguration, Redirect } from '../models'; export const redirectDecoder = JsonDecoder.object( { passwordIsExpired: JsonDecoder.optional(JsonDecoder.boolean), - redirectUri: JsonDecoder.string, + redirectUri: JsonDecoder.string }, 'Redirect Decoder', { passwordIsExpired: 'password_is_expired', - redirectUri: 'redirect_uri', - }, + redirectUri: 'redirect_uri' + } ); const providerConfigurationDecoder = JsonDecoder.object( @@ -20,17 +20,17 @@ const providerConfigurationDecoder = JsonDecoder.object( id: JsonDecoder.number, isActive: JsonDecoder.boolean, isForced: JsonDecoder.optional(JsonDecoder.boolean), - name: JsonDecoder.string, + name: JsonDecoder.string }, 'Provider Condifugration', { authenticationUri: 'authentication_uri', isActive: 'is_active', - isForced: 'is_forced', - }, + isForced: 'is_forced' + } ); export const providersConfigurationDecoder = JsonDecoder.array( providerConfigurationDecoder, - 'Providers Configuration List', + 'Providers Configuration List' ); diff --git a/www/front_src/src/Login/index.test.tsx b/www/front_src/src/Login/index.test.tsx index 9764e62e78e..1b0a429a747 100644 --- a/www/front_src/src/Login/index.test.tsx +++ b/www/front_src/src/Login/index.test.tsx @@ -9,7 +9,7 @@ import { RenderResult, screen, waitFor, - SnackbarProvider, + SnackbarProvider } from '@centreon/ui'; import { areUserParametersLoadedAtom } from '../Main/useUser'; @@ -27,7 +27,7 @@ import { labelRequired, labelHideThePassword, labelLoginWith, - labelPasswordHasExpired, + labelPasswordHasExpired } from './translatedLabels'; import { loginEndpoint, providersConfigurationEndpoint } from './api/endpoint'; @@ -43,7 +43,7 @@ jest.mock('../assets/centreon-wallpaper-lg.jpg'); jest.mock('../assets/centreon-wallpaper-sm.jpg'); jest.mock('@centreon/ui-context', () => - jest.requireActual('centreon-frontend/packages/ui-context'), + jest.requireActual('centreon-frontend/packages/ui-context') ); const mockNow = '2020-01-01'; @@ -55,13 +55,13 @@ const retrievedUser = { locale: 'fr_FR.UTF8', name: 'Admin', timezone: 'Europe/Paris', - use_deprecated_pages: false, + use_deprecated_pages: false }; const retrievedWeb = { web: { - version: '21.10.1', - }, + version: '21.10.1' + } }; const retrievedProvidersConfiguration = [ @@ -70,28 +70,28 @@ const retrievedProvidersConfiguration = [ '/centreon/authentication/providers/configurations/local', id: 1, is_active: true, - name: 'local', + name: 'local' }, { authentication_uri: '/centreon/authentication/providers/configurations/openid', id: 2, is_active: true, - name: 'openid', + name: 'openid' }, { authentication_uri: '/centreon/authentication/providers/configurations/ldap', id: 3, is_active: false, - name: 'ldap', - }, + name: 'ldap' + } ]; const retrievedTranslations = { en: { - hello: 'Hello', - }, + hello: 'Hello' + } }; const TestComponent = (): JSX.Element => ( @@ -102,9 +102,9 @@ const TestComponent = (): JSX.Element => ( [areUserParametersLoadedAtom, false], [ platformInstallationStatusAtom, - { availableVersion: null, installedVersion: '21.10.1' }, + { availableVersion: null, installedVersion: '21.10.1' } ], - [platformVersionsAtom, retrievedWeb], + [platformVersionsAtom, retrievedWeb] ]} > @@ -118,8 +118,8 @@ const renderLoginPage = (): RenderResult => render(); const mockPostLoginSuccess = (): void => { mockedAxios.post.mockResolvedValue({ data: { - redirect_uri: '/monitoring/resources', - }, + redirect_uri: '/monitoring/resources' + } }); }; @@ -127,8 +127,8 @@ const mockPostLoginInvalidCredentials = (): void => { mockedAxios.post.mockRejectedValueOnce({ response: { data: { code: 401, message: labelInvalidCredentials }, - status: 401, - }, + status: 401 + } }); }; @@ -137,10 +137,10 @@ const mockPostLoginPasswordExpired = (): void => { response: { data: { password_is_expired: true, - redirect_uri: '/monitoring/resources', + redirect_uri: '/monitoring/resources' }, - status: 401, - }, + status: 401 + } }); }; @@ -150,10 +150,10 @@ const mockPostLoginServerError = (): void => { mockedAxios.post.mockRejectedValue({ response: { data: { - message: labelError, + message: labelError }, - status: 500, - }, + status: 500 + } }); }; @@ -164,13 +164,13 @@ describe('Login Page', () => { mockDate.set(mockNow); mockedAxios.get .mockResolvedValueOnce({ - data: retrievedTranslations, + data: retrievedTranslations }) .mockResolvedValueOnce({ - data: retrievedProvidersConfiguration, + data: retrievedProvidersConfiguration }) .mockResolvedValue({ - data: retrievedUser, + data: retrievedUser }); window.history.pushState({}, '', '/'); }); @@ -188,7 +188,7 @@ describe('Login Page', () => { await waitFor(() => { expect(mockedAxios.get).toHaveBeenCalledWith( providersConfigurationEndpoint, - cancelTokenRequestParam, + cancelTokenRequestParam ); }); @@ -205,11 +205,11 @@ describe('Login Page', () => { await waitFor(() => { expect(screen.getByText(`${labelLoginWith} openid`)).toHaveAttribute( 'href', - '/centreon/authentication/providers/configurations/openid', + '/centreon/authentication/providers/configurations/openid' ); }); expect( - screen.queryByText(`${labelLoginWith} ldap`), + screen.queryByText(`${labelLoginWith} ldap`) ).not.toBeInTheDocument(); expect(screen.getByText('Copyright © 2005 - 2020')).toBeInTheDocument(); }); @@ -225,12 +225,12 @@ describe('Login Page', () => { await waitFor(() => { expect(mockedAxios.post).toHaveBeenCalledWith(loginEndpoint, { login: 'admin', - password: 'centreon', + password: 'centreon' }); }); expect(mockedAxios.get).toHaveBeenCalledWith( userEndpoint, - cancelTokenRequestParam, + cancelTokenRequestParam ); await waitFor(() => { @@ -251,12 +251,12 @@ describe('Login Page', () => { await waitFor(() => { expect(mockedAxios.post).toHaveBeenCalledWith(loginEndpoint, { login: 'invalid_alias', - password: 'invalid_pwd', + password: 'invalid_pwd' }); }); expect(mockedAxios.get).not.toHaveBeenCalledWith( userEndpoint, - cancelTokenRequestParam, + cancelTokenRequestParam ); await waitFor(() => { @@ -281,7 +281,7 @@ describe('Login Page', () => { userEvent.type(screen.getByLabelText(labelAlias), '{selectall}{backspace}'); userEvent.type( screen.getByLabelText(labelPassword), - '{selectall}{backspace}', + '{selectall}{backspace}' ); await waitFor(() => { @@ -297,12 +297,12 @@ describe('Login Page', () => { renderLoginPage(); userEvent.click( - screen.getByLabelText(labelDisplayThePassword).firstChild as HTMLElement, + screen.getByLabelText(labelDisplayThePassword).firstChild as HTMLElement ); expect(screen.getByLabelText(labelPassword)).toHaveAttribute( 'type', - 'text', + 'text' ); expect(screen.getByLabelText(labelHideThePassword)).toBeInTheDocument(); }); diff --git a/www/front_src/src/Login/index.tsx b/www/front_src/src/Login/index.tsx index 1b11a606b65..cd2c563b2ec 100644 --- a/www/front_src/src/Login/index.tsx +++ b/www/front_src/src/Login/index.tsx @@ -35,10 +35,10 @@ const useStyles = makeStyles((theme) => ({ alignItems: 'center', display: 'flex', flexDirection: 'column', - rowGap: theme.spacing(0.5), + rowGap: theme.spacing(0.5) }, copyrightSkeleton: { - width: theme.spacing(16), + width: theme.spacing(16) }, loginBackground: { alignItems: 'center', @@ -49,7 +49,7 @@ const useStyles = makeStyles((theme) => ({ height: '100vh', justifyContent: 'center', rowGap: theme.spacing(2), - width: '100%', + width: '100%' }, loginPaper: { alignItems: 'center', @@ -59,13 +59,13 @@ const useStyles = makeStyles((theme) => ({ minWidth: theme.spacing(30), padding: theme.spacing(4, 5), rowGap: theme.spacing(4), - width: '17%', - }, + width: '17%' + } })); const initialValues: LoginFormValues = { alias: '', - password: '', + password: '' }; const LoginPage = (): JSX.Element => { diff --git a/www/front_src/src/Login/useLogin.ts b/www/front_src/src/Login/useLogin.ts index 4834c99e020..93c4355aa85 100644 --- a/www/front_src/src/Login/useLogin.ts +++ b/www/front_src/src/Login/useLogin.ts @@ -13,7 +13,7 @@ import { reject, path, pathEq, - equals, + equals } from 'ramda'; import { useUpdateAtom } from 'jotai/utils'; @@ -30,14 +30,14 @@ import postLogin from './api'; import { providersConfigurationDecoder, redirectDecoder } from './api/decoder'; import { labelLoginSucceeded, - labelPasswordHasExpired, + labelPasswordHasExpired } from './translatedLabels'; import { providersConfigurationEndpoint } from './api/endpoint'; import { LoginFormValues, Redirect, RedirectAPI, - ProviderConfiguration, + ProviderConfiguration } from './models'; interface UseLoginState { @@ -46,7 +46,7 @@ interface UseLoginState { sendLogin: (values) => Promise; submitLoginForm: ( values: LoginFormValues, - { setSubmitting }: Pick, 'setSubmitting'>, + { setSubmitting }: Pick, 'setSubmitting'> ) => void; } @@ -58,14 +58,14 @@ const useLogin = (): UseLoginState => { const { sendRequest: sendLogin } = useRequest({ decoder: redirectDecoder, httpCodesBypassErrorSnackbar: [401], - request: postLogin, + request: postLogin }); const { sendRequest: getProvidersConfiguration } = useRequest< Array >({ decoder: providersConfigurationDecoder, - request: getData, + request: getData }); const { getInternalTranslation, getExternalTranslation } = @@ -78,7 +78,7 @@ const useLogin = (): UseLoginState => { const [platformInstallationStatus] = useAtom(platformInstallationStatusAtom); const setPasswordResetInformations = useUpdateAtom( - passwordResetInformationsAtom, + passwordResetInformationsAtom ); const checkPasswordExpiration = useCallback( @@ -87,12 +87,12 @@ const useLogin = (): UseLoginState => { const { password_is_expired: passwordIsExpired } = path( ['response', 'data'], - error, + error ) as RedirectAPI; if (isUserNotAllowed && passwordIsExpired) { setPasswordResetInformations({ - alias, + alias }); navigate(routeMap.resetPassword); showWarningMessage(t(labelPasswordHasExpired)); @@ -103,25 +103,25 @@ const useLogin = (): UseLoginState => { setSubmitting(false); showErrorMessage(path(['response', 'data', 'message'], error) as string); }, - [], + [] ); const submitLoginForm = ( values: LoginFormValues, - { setSubmitting }, + { setSubmitting } ): void => { sendLogin({ login: values.alias, - password: values.password, + password: values.password }) .then(({ redirectUri }) => { showSuccessMessage(t(labelLoginSucceeded)); getInternalTranslation().finally(() => - loadUser()?.then(() => navigate(redirectUri)), + loadUser()?.then(() => navigate(redirectUri)) ); }) .catch((error) => - checkPasswordExpiration({ alias: values.alias, error, setSubmitting }), + checkPasswordExpiration({ alias: values.alias, error, setSubmitting }) ); }; @@ -129,18 +129,18 @@ const useLogin = (): UseLoginState => { useEffect(() => { getExternalTranslation().then(() => - i18n.changeLanguage?.(getBrowserLocale()), + i18n.changeLanguage?.(getBrowserLocale()) ); getProvidersConfiguration({ - endpoint: providersConfigurationEndpoint, + endpoint: providersConfigurationEndpoint }).then((providers) => { const forcedProviders = filter( (provider): boolean => not(isNil(provider.isForced)) && (provider.isForced as boolean) && not(equals(provider.name, 'local')), - providers || [], + providers || [] ); if (not(isEmpty(forcedProviders))) { @@ -151,12 +151,12 @@ const useLogin = (): UseLoginState => { const externalProviders = reject( propEq('name', 'local'), - providers, + providers ); const activeProviders = filter( propEq('isActive', true), - externalProviders || [], + externalProviders || [] ); setProvidersConfiguration(activeProviders); @@ -167,7 +167,7 @@ const useLogin = (): UseLoginState => { platformInstallationStatus, providersConfiguration, sendLogin, - submitLoginForm, + submitLoginForm }; }; diff --git a/www/front_src/src/Login/validationSchema.ts b/www/front_src/src/Login/validationSchema.ts index f1df614c4ea..f86abb42588 100644 --- a/www/front_src/src/Login/validationSchema.ts +++ b/www/front_src/src/Login/validationSchema.ts @@ -9,7 +9,7 @@ const useValidationSchema = (): Yup.SchemaOf => { const schema = Yup.object().shape({ alias: Yup.string().required(t(labelRequired)), - password: Yup.string().required(t(labelRequired)), + password: Yup.string().required(t(labelRequired)) }); return schema; diff --git a/www/front_src/src/Main/InitializationPage/index.tsx b/www/front_src/src/Main/InitializationPage/index.tsx index f616e7d3aae..7b40c12450f 100644 --- a/www/front_src/src/Main/InitializationPage/index.tsx +++ b/www/front_src/src/Main/InitializationPage/index.tsx @@ -17,7 +17,7 @@ const InitializationPage = (): JSX.Element => { const [areUserParametersLoaded] = useAtom(areUserParametersLoadedAtom); const user = useAtomValue(userAtom); const platformInstallationStatus = useAtomValue( - platformInstallationStatusAtom, + platformInstallationStatusAtom ); const canDisplayApp = diff --git a/www/front_src/src/Main/MainLoader.tsx b/www/front_src/src/Main/MainLoader.tsx index 96c40791bc8..095d1be09d1 100644 --- a/www/front_src/src/Main/MainLoader.tsx +++ b/www/front_src/src/Main/MainLoader.tsx @@ -17,8 +17,8 @@ const useStyles = makeStyles((theme) => ({ height: '100vh', justifyContent: 'center', rowGap: theme.spacing(2), - width: '100%', - }, + width: '100%' + } })); export const MainLoader = (): JSX.Element => { diff --git a/www/front_src/src/Main/index.test.tsx b/www/front_src/src/Main/index.test.tsx index 064d6c84f20..b059c6ba6ef 100644 --- a/www/front_src/src/Main/index.test.tsx +++ b/www/front_src/src/Main/index.test.tsx @@ -5,14 +5,14 @@ import { render, RenderResult, waitFor, screen } from '@centreon/ui'; import { platformInstallationStatusEndpoint, - userEndpoint, + userEndpoint } from '../api/endpoint'; import { labelConnect } from '../Login/translatedLabels'; import { aclEndpoint, parametersEndpoint, externalTranslationEndpoint, - internalTranslationEndpoint, + internalTranslationEndpoint } from '../App/endpoint'; import { retrievedNavigation } from '../Navigation/mocks'; import { retrievedFederatedModule } from '../federatedModules/mocks'; @@ -29,7 +29,7 @@ const cancelTokenRequestParam = { cancelToken: {} }; jest.mock('../Navigation/Sidebar/Logo/centreon.png'); jest.mock('@centreon/ui-context', () => - jest.requireActual('centreon-frontend/packages/ui-context'), + jest.requireActual('centreon-frontend/packages/ui-context') ); const retrievedUser = { @@ -39,39 +39,39 @@ const retrievedUser = { locale: 'fr_FR.UTF8', name: 'Admin', timezone: 'Europe/Paris', - use_deprecated_pages: false, + use_deprecated_pages: false }; const retrievedParameters = { monitoring_default_acknowledgement_persistent: true, monitoring_default_acknowledgement_sticky: true, monitoring_default_downtime_duration: 3600, - monitoring_default_refresh_interval: 15, + monitoring_default_refresh_interval: 15 }; const retrievedActionsAcl = { host: { acknowledgement: true, check: true, - downtime: true, + downtime: true }, service: { acknowledgement: true, check: true, - downtime: true, - }, + downtime: true + } }; const retrievedTranslations = { en: { - hello: 'Hello', - }, + hello: 'Hello' + } }; const retrievedWeb = { web: { - version: '21.10.1', - }, + version: '21.10.1' + } }; const retrievedProvidersConfiguration = [ @@ -80,8 +80,8 @@ const retrievedProvidersConfiguration = [ '/centreon/authentication/providers/configurations/local', id: 1, is_active: true, - name: 'local', - }, + name: 'local' + } ]; jest.mock('../Header', () => { @@ -91,7 +91,7 @@ jest.mock('../Header', () => { return { __esModule: true, - default: Header, + default: Header }; }); @@ -102,7 +102,7 @@ jest.mock('../components/mainRouter', () => { return { __esModule: true, - default: MainRouter, + default: MainRouter }; }); @@ -110,162 +110,162 @@ const renderMain = (): RenderResult => render(
- , + ); const mockDefaultGetRequests = (): void => { mockedAxios.get .mockResolvedValueOnce({ - data: retrievedWeb, + data: retrievedWeb }) .mockResolvedValueOnce({ data: { has_upgrade_available: false, - is_installed: true, - }, + is_installed: true + } }) .mockResolvedValueOnce({ - data: retrievedUser, + data: retrievedUser }) .mockResolvedValueOnce({ - data: retrievedTranslations, + data: retrievedTranslations }) .mockResolvedValueOnce({ - data: retrievedNavigation, + data: retrievedNavigation }) .mockResolvedValueOnce({ - data: retrievedFederatedModule, + data: retrievedFederatedModule }) .mockResolvedValueOnce({ - data: retrievedParameters, + data: retrievedParameters }) .mockResolvedValueOnce({ - data: retrievedActionsAcl, + data: retrievedActionsAcl }) .mockResolvedValueOnce({ - data: null, + data: null }); }; const mockRedirectFromLoginPageGetRequests = (): void => { mockedAxios.get .mockResolvedValueOnce({ - data: retrievedWeb, + data: retrievedWeb }) .mockResolvedValueOnce({ data: { has_upgrade_available: false, - is_installed: true, - }, + is_installed: true + } }) .mockResolvedValueOnce({ - data: retrievedUser, + data: retrievedUser }) .mockResolvedValueOnce({ - data: retrievedTranslations, + data: retrievedTranslations }) .mockResolvedValueOnce({ - data: retrievedProvidersConfiguration, + data: retrievedProvidersConfiguration }) .mockResolvedValueOnce({ - data: retrievedTranslations, + data: retrievedTranslations }) .mockResolvedValueOnce({ - data: retrievedNavigation, + data: retrievedNavigation }) .mockResolvedValueOnce({ - data: retrievedParameters, + data: retrievedParameters }) .mockResolvedValueOnce({ - data: retrievedActionsAcl, + data: retrievedActionsAcl }) .mockResolvedValue({ - data: null, + data: null }); }; const mockNotConnectedGetRequests = (): void => { mockedAxios.get .mockResolvedValueOnce({ - data: retrievedWeb, + data: retrievedWeb }) .mockResolvedValueOnce({ data: { has_upgrade_available: false, - is_installed: true, - }, + is_installed: true + } }) .mockRejectedValueOnce({ - response: { status: 403 }, + response: { status: 403 } }) .mockResolvedValueOnce({ - data: retrievedTranslations, + data: retrievedTranslations }) .mockResolvedValueOnce({ - data: retrievedProvidersConfiguration, + data: retrievedProvidersConfiguration }); }; const mockInstallGetRequests = (): void => { mockedAxios.get .mockResolvedValueOnce({ - data: retrievedWeb, + data: retrievedWeb }) .mockResolvedValueOnce({ data: { has_upgrade_available: false, - is_installed: false, - }, + is_installed: false + } }) .mockRejectedValueOnce({ - response: { status: 403 }, + response: { status: 403 } }); }; const mockUpgradeAndUserDisconnectedGetRequests = (): void => { mockedAxios.get .mockResolvedValueOnce({ - data: retrievedWeb, + data: retrievedWeb }) .mockResolvedValueOnce({ data: { has_upgrade_available: true, - is_installed: true, - }, + is_installed: true + } }) .mockRejectedValueOnce({ - response: { status: 403 }, + response: { status: 403 } }); }; const mockUpgradeAndUserConnectedGetRequests = (): void => { mockedAxios.get .mockResolvedValueOnce({ - data: retrievedWeb, + data: retrievedWeb }) .mockResolvedValueOnce({ data: { has_upgrade_available: true, - is_installed: true, - }, + is_installed: true + } }) .mockResolvedValueOnce({ - data: retrievedUser, + data: retrievedUser }) .mockResolvedValueOnce({ - data: retrievedTranslations, + data: retrievedTranslations }) .mockResolvedValueOnce({ - data: retrievedNavigation, + data: retrievedNavigation }) .mockResolvedValueOnce({ - data: retrievedParameters, + data: retrievedParameters }) .mockResolvedValueOnce({ - data: retrievedActionsAcl, + data: retrievedActionsAcl }) .mockResolvedValueOnce({ - data: null, + data: null }); }; @@ -286,21 +286,21 @@ describe('Main', () => { await waitFor(() => { expect(mockedAxios.get).toHaveBeenCalledWith( platformInstallationStatusEndpoint, - cancelTokenRequestParam, + cancelTokenRequestParam ); }); await waitFor(() => { expect(mockedAxios.get).toHaveBeenCalledWith( externalTranslationEndpoint, - cancelTokenRequestParam, + cancelTokenRequestParam ); }); await waitFor(() => { expect(mockedAxios.get).toHaveBeenCalledWith( userEndpoint, - cancelTokenRequestParam, + cancelTokenRequestParam ); }); @@ -322,20 +322,20 @@ describe('Main', () => { await waitFor(() => { expect(mockedAxios.get).toHaveBeenCalledWith( platformInstallationStatusEndpoint, - cancelTokenRequestParam, + cancelTokenRequestParam ); }); await waitFor(() => { expect(mockedAxios.get).toHaveBeenCalledWith( userEndpoint, - cancelTokenRequestParam, + cancelTokenRequestParam ); }); await waitFor(() => { expect(decodeURI(window.location.href)).toBe( - 'http://localhost/install/install.php', + 'http://localhost/install/install.php' ); }); }); @@ -351,20 +351,20 @@ describe('Main', () => { await waitFor(() => { expect(mockedAxios.get).toHaveBeenCalledWith( platformInstallationStatusEndpoint, - cancelTokenRequestParam, + cancelTokenRequestParam ); }); await waitFor(() => { expect(mockedAxios.get).toHaveBeenCalledWith( userEndpoint, - cancelTokenRequestParam, + cancelTokenRequestParam ); }); await waitFor(() => { expect(decodeURI(window.location.href)).toBe( - 'http://localhost/install/upgrade.php', + 'http://localhost/install/upgrade.php' ); }); }); @@ -380,20 +380,20 @@ describe('Main', () => { await waitFor(() => { expect(mockedAxios.get).toHaveBeenCalledWith( platformInstallationStatusEndpoint, - cancelTokenRequestParam, + cancelTokenRequestParam ); }); await waitFor(() => { expect(mockedAxios.get).toHaveBeenCalledWith( userEndpoint, - cancelTokenRequestParam, + cancelTokenRequestParam ); }); await waitFor(() => { expect(decodeURI(window.location.href)).toBe( - 'http://localhost/monitoring/resources', + 'http://localhost/monitoring/resources' ); }); }); @@ -409,37 +409,37 @@ describe('Main', () => { await waitFor(() => { expect(mockedAxios.get).toHaveBeenCalledWith( platformInstallationStatusEndpoint, - cancelTokenRequestParam, + cancelTokenRequestParam ); }); await waitFor(() => { expect(mockedAxios.get).toHaveBeenCalledWith( userEndpoint, - cancelTokenRequestParam, + cancelTokenRequestParam ); }); await waitFor(() => { expect(mockedAxios.get).toHaveBeenCalledWith( navigationEndpoint, - cancelTokenRequestParam, + cancelTokenRequestParam ); }); expect(mockedAxios.get).toHaveBeenCalledWith( parametersEndpoint, - cancelTokenRequestParam, + cancelTokenRequestParam ); expect(mockedAxios.get).toHaveBeenCalledWith( aclEndpoint, - cancelTokenRequestParam, + cancelTokenRequestParam ); expect(mockedAxios.get).toHaveBeenCalledWith( internalTranslationEndpoint, - cancelTokenRequestParam, + cancelTokenRequestParam ); }); @@ -454,20 +454,20 @@ describe('Main', () => { await waitFor(() => { expect(mockedAxios.get).toHaveBeenCalledWith( platformInstallationStatusEndpoint, - cancelTokenRequestParam, + cancelTokenRequestParam ); }); await waitFor(() => { expect(mockedAxios.get).toHaveBeenCalledWith( aclEndpoint, - cancelTokenRequestParam, + cancelTokenRequestParam ); }); await waitFor(() => { expect(window.location.href).toBe( - 'http://localhost/monitoring/resources', + 'http://localhost/monitoring/resources' ); }); }); @@ -476,7 +476,7 @@ describe('Main', () => { window.history.pushState( {}, '', - '/?authenticationError=Authentication%20failed', + '/?authenticationError=Authentication%20failed' ); mockDefaultGetRequests(); diff --git a/www/front_src/src/Main/index.tsx b/www/front_src/src/Main/index.tsx index ced6ea239e3..5d72ba6a5ab 100644 --- a/www/front_src/src/Main/index.tsx +++ b/www/front_src/src/Main/index.tsx @@ -49,7 +49,7 @@ const Main = (): JSX.Element => { const [areUserParametersLoaded] = useAtom(areUserParametersLoadedAtom); const platformInstallationStatus = useAtomValue( - platformInstallationStatusAtom, + platformInstallationStatusAtom ); const navigateTo = (path: string): void => { @@ -70,7 +70,7 @@ const Main = (): JSX.Element => { const canUpgrade = and( platformInstallationStatus.hasUpgradeAvailable, - not(areUserParametersLoaded), + not(areUserParametersLoaded) ); if (canUpgrade) { diff --git a/www/front_src/src/Main/useInitializeTranslation.ts b/www/front_src/src/Main/useInitializeTranslation.ts index 9ee8d8cfe74..43101e811d7 100644 --- a/www/front_src/src/Main/useInitializeTranslation.ts +++ b/www/front_src/src/Main/useInitializeTranslation.ts @@ -10,7 +10,7 @@ import { userAtom } from '@centreon/ui-context'; import { externalTranslationEndpoint, - internalTranslationEndpoint, + internalTranslationEndpoint } from '../App/endpoint'; interface UseInitializeTranslationState { @@ -24,7 +24,7 @@ interface UseInitializeTranslationState { const useInitializeTranslation = (): UseInitializeTranslationState => { const { sendRequest: getTranslations } = useRequest({ httpCodesBypassErrorSnackbar: [500], - request: getData, + request: getData }); const { locale } = useAtomValue(userAtom); @@ -42,15 +42,15 @@ const useInitializeTranslation = (): UseInitializeTranslationState => { reduce( (acc, [language, values]) => mergeAll([acc, { [language]: { translation: values } }]), - {}, - ), - )(retrievedTranslations) as Resource, + {} + ) + )(retrievedTranslations) as Resource }); }; const getTranslation = (endpoint: string): Promise => { return getTranslations({ - endpoint, + endpoint }) .then((retrievedTranslations) => { initializeI18n(retrievedTranslations); @@ -75,7 +75,7 @@ const useInitializeTranslation = (): UseInitializeTranslationState => { getExternalTranslation, getInternalTranslation, i18next, - initializeI18n, + initializeI18n }; }; diff --git a/www/front_src/src/Main/useMain.ts b/www/front_src/src/Main/useMain.ts index 0c5414bf154..9bce2a06ced 100644 --- a/www/front_src/src/Main/useMain.ts +++ b/www/front_src/src/Main/useMain.ts @@ -23,7 +23,7 @@ const useMain = (): void => { const { sendRequest: getPlatformInstallationStatus } = useRequest({ decoder: platformInstallationStatusDecoder, - request: getData, + request: getData }); const { showErrorMessage } = useSnackbar(); @@ -31,7 +31,7 @@ const useMain = (): void => { useInitializeTranslation(); const setPlatformInstallationStatus = useSetAtom( - platformInstallationStatusAtom, + platformInstallationStatusAtom ); const user = useAtomValue(userAtom); const areUserParametersLoaded = useAtomValue(areUserParametersLoadedAtom); @@ -59,7 +59,7 @@ const useMain = (): void => { getPlatformVersions(); getPlatformInstallationStatus({ - endpoint: platformInstallationStatusEndpoint, + endpoint: platformInstallationStatusEndpoint }).then((retrievedPlatformInstallationStatus) => { setPlatformInstallationStatus(retrievedPlatformInstallationStatus); }); @@ -80,7 +80,7 @@ const useMain = (): void => { useEffect(() => { const canChangeToBrowserLanguage = and( isNil(areUserParametersLoaded), - i18next.isInitialized, + i18next.isInitialized ); if (canChangeToBrowserLanguage) { i18next?.changeLanguage(getBrowserLocale()); @@ -88,7 +88,7 @@ const useMain = (): void => { const canRedirectToUserDefaultPage = and( areUserParametersLoaded, - includes(location.pathname, [reactRoutes.login, '/']), + includes(location.pathname, [reactRoutes.login, '/']) ); if (not(canRedirectToUserDefaultPage)) { diff --git a/www/front_src/src/Main/usePlatformVersions.ts b/www/front_src/src/Main/usePlatformVersions.ts index 00f845d18a3..f0f4d2b2638 100644 --- a/www/front_src/src/Main/usePlatformVersions.ts +++ b/www/front_src/src/Main/usePlatformVersions.ts @@ -17,14 +17,14 @@ interface UsePlatformVersionsState { const usePlatformVersions = (): UsePlatformVersionsState => { const { sendRequest: sendPlatformVersions } = useRequest({ - request: getData, + request: getData }); const [platformVersions, setPlatformVersions] = useAtom(platformVersionsAtom); const getPlatformVersions = useCallback((): void => { sendPlatformVersions({ endpoint: platformVersionsEndpoint }).then( - setPlatformVersions, + setPlatformVersions ); }, []); @@ -38,7 +38,7 @@ const usePlatformVersions = (): UsePlatformVersionsState => { return { getModules, - getPlatformVersions, + getPlatformVersions }; }; diff --git a/www/front_src/src/Main/useUser.ts b/www/front_src/src/Main/useUser.ts index 6dabdbde478..3d05042a129 100644 --- a/www/front_src/src/Main/useUser.ts +++ b/www/front_src/src/Main/useUser.ts @@ -14,11 +14,11 @@ const useUser = (): (() => null | Promise) => { const { sendRequest: getUser } = useRequest({ decoder: userDecoder, httpCodesBypassErrorSnackbar: [403, 401, 500], - request: getData, + request: getData }); const [areUserParametersLoaded, setAreUserParametersLoaded] = useAtom( - areUserParametersLoadedAtom, + areUserParametersLoadedAtom ); const setUser = useUpdateAtom(userAtom); @@ -28,7 +28,7 @@ const useUser = (): (() => null | Promise) => { } return getUser({ - endpoint: userEndpoint, + endpoint: userEndpoint }) .then((retrievedUser) => { if (isNil(retrievedUser)) { @@ -43,7 +43,7 @@ const useUser = (): (() => null | Promise) => { themeMode, timezone, use_deprecated_pages: useDeprecatedPages, - default_page: defaultPage, + default_page: defaultPage } = retrievedUser as User; setUser({ @@ -54,7 +54,7 @@ const useUser = (): (() => null | Promise) => { name, themeMode, timezone, - use_deprecated_pages: useDeprecatedPages, + use_deprecated_pages: useDeprecatedPages }); setAreUserParametersLoaded(true); }) diff --git a/www/front_src/src/Navigation/Sidebar/Logo/LogoMini/index.tsx b/www/front_src/src/Navigation/Sidebar/Logo/LogoMini/index.tsx index 7cd3c2e8c1b..3f51cfd1719 100644 --- a/www/front_src/src/Navigation/Sidebar/Logo/LogoMini/index.tsx +++ b/www/front_src/src/Navigation/Sidebar/Logo/LogoMini/index.tsx @@ -8,8 +8,8 @@ interface Props { const useStyles = makeStyles((theme) => ({ miniLogo: { height: theme.spacing(5), - width: theme.spacing(3), - }, + width: theme.spacing(3) + } })); const MiniLogo = ({ onClick }: Props): JSX.Element => { diff --git a/www/front_src/src/Navigation/Sidebar/Logo/index.tsx b/www/front_src/src/Navigation/Sidebar/Logo/index.tsx index f6006ee7e59..2f39dd12ac9 100644 --- a/www/front_src/src/Navigation/Sidebar/Logo/index.tsx +++ b/www/front_src/src/Navigation/Sidebar/Logo/index.tsx @@ -8,8 +8,8 @@ interface Props { const useStyles = makeStyles((theme) => ({ logo: { height: theme.spacing(5), - width: theme.spacing(16.9), - }, + width: theme.spacing(16.9) + } })); const Logo = ({ onClick }: Props): JSX.Element => { diff --git a/www/front_src/src/Navigation/Sidebar/Menu/CollapsibleItems.tsx b/www/front_src/src/Navigation/Sidebar/Menu/CollapsibleItems.tsx index cfc0c7bbd12..9db2432b480 100644 --- a/www/front_src/src/Navigation/Sidebar/Menu/CollapsibleItems.tsx +++ b/www/front_src/src/Navigation/Sidebar/Menu/CollapsibleItems.tsx @@ -4,7 +4,7 @@ import { SetStateAction, useEffect, useRef, - useState, + useState } from 'react'; import { equals } from 'ramda'; @@ -22,7 +22,7 @@ import { Page } from '../../models'; import { selectedNavigationItemsAtom, hoveredNavigationItemsAtom, - setHoveredNavigationItemsDerivedAtom, + setHoveredNavigationItemsDerivedAtom } from '../sideBarAtoms'; import MenuItems from './MenuItems'; @@ -52,16 +52,16 @@ const collapseWidth = 24; const useStyles = makeStyles((theme) => ({ label: { - fontWeight: 'bold', + fontWeight: 'bold' }, root: { '& .MuiListItemIcon-root': { color: theme.palette.text.primary, minWidth: theme.spacing(2.25), - padding: theme.spacing(0, 0.25, 0, 0.1), + padding: theme.spacing(0, 0.25, 0, 0.1) }, boxShadow: theme.shadows[3], - outline: 'none', + outline: 'none' }, subHeader: { backgroundColor: 'rgba(0,0,0,.05)', @@ -70,20 +70,20 @@ const useStyles = makeStyles((theme) => ({ fontWeight: 'bold', lineHeight: 1, padding: theme.spacing(1), - textAlign: 'center', + textAlign: 'center' }, toggled: { '&::-webkit-scrollbar': { - width: theme.spacing(1), + width: theme.spacing(1) }, '&::-webkit-scrollbar-corner': { - backgroundColor: theme.palette.background.default, + backgroundColor: theme.palette.background.default }, '&::-webkit-scrollbar-thumb': { - backgroundColor: theme.palette.action.disabled, + backgroundColor: theme.palette.action.disabled }, '&::-webkit-scrollbar-track': { - border: `solid ${theme.palette.action.hover} 0.5px`, + border: `solid ${theme.palette.action.hover} 0.5px` }, backgroundColor: theme.palette.background.default, left: ({ currentWidth }: StyleProps): string => theme.spacing(currentWidth), @@ -100,8 +100,8 @@ const useStyles = makeStyles((theme) => ({ top: ({ currentTop }: StyleProps): number | undefined => currentTop, whiteSpace: 'normal', width: theme.spacing(collapseWidth), - zIndex: theme.zIndex.mobileStepper, - }, + zIndex: theme.zIndex.mobileStepper + } })); const CollapsibleItems = ({ @@ -115,13 +115,13 @@ const CollapsibleItems = ({ collapseScrollMaxHeight, collapseScrollMaxWidth, setCollapseScrollMaxWidth, - setCollapseScrollMaxHeight, + setCollapseScrollMaxHeight }: Props): JSX.Element => { const classes = useStyles({ collapseScrollMaxHeight, collapseScrollMaxWidth, currentTop, - currentWidth, + currentWidth }); const [hoveredIndex, setHoveredIndex] = useState(null); const [itemTop, setItemTop] = useState(); @@ -133,7 +133,7 @@ const CollapsibleItems = ({ const hoveredNavigationItems = useAtomValue(hoveredNavigationItemsAtom); const selectedNavigationItems = useAtomValue(selectedNavigationItemsAtom); const setHoveredNavigationItems = useUpdateAtom( - setHoveredNavigationItemsDerivedAtom, + setHoveredNavigationItemsDerivedAtom ); const levelName = `level_${level}`; @@ -151,7 +151,7 @@ const CollapsibleItems = ({ const isItemHovered = ({ navigationItem, levelTitle, - currentPage, + currentPage }): boolean => { if (navigationItem && navigationItem[levelTitle]) { return ( @@ -189,7 +189,7 @@ const CollapsibleItems = ({ const updateCollapseSize = (el: HTMLElement): void => { const rect = el.getBoundingClientRect(); setCollapseScrollMaxHeight( - (window.innerHeight - rect.top) / 8 - minimumMarginBottom, + (window.innerHeight - rect.top) / 8 - minimumMarginBottom ); setCollapseScrollMaxWidth((window.innerWidth - rect.left) / 8); }; @@ -221,7 +221,7 @@ const CollapsibleItems = ({ isItemHovered({ currentPage: item, levelTitle: levelName, - navigationItem: selectedNavigationItems, + navigationItem: selectedNavigationItems }) || equals(hoveredIndex, index); const mouseEnterItem = (e: MouseEvent): void => @@ -257,17 +257,17 @@ const CollapsibleItems = ({ const nestedIndex = getNestedIndex({ childIndex: ind, content: data, - itemIndex: index, + itemIndex: index }); const nestedHover = isItemHovered({ currentPage: content, levelTitle: levelName, - navigationItem: selectedNavigationItems, + navigationItem: selectedNavigationItems }) || equals(hoveredIndex, nestedIndex); const mouseEnterContent = ( - e: MouseEvent, + e: MouseEvent ): void => hoverItem({ currentPage: content, e, index: nestedIndex }); @@ -329,7 +329,7 @@ const CollapsibleItems = ({ } />
- ), + ) ) )} @@ -345,8 +345,8 @@ const CollapsibleItems = ({ nestedScrollCollapsMaxWidth, hoveredIndex, selectedNavigationItems, - hoveredNavigationItems, - ], + hoveredNavigationItems + ] }); }; diff --git a/www/front_src/src/Navigation/Sidebar/Menu/MenuItems.tsx b/www/front_src/src/Navigation/Sidebar/Menu/MenuItems.tsx index 8bca6f57c51..46b177c7316 100644 --- a/www/front_src/src/Navigation/Sidebar/Menu/MenuItems.tsx +++ b/www/front_src/src/Navigation/Sidebar/Menu/MenuItems.tsx @@ -3,14 +3,14 @@ import { MouseEvent, MouseEventHandler, ReactNode, - useMemo, + useMemo } from 'react'; import clsx from 'clsx'; import { useAtomValue } from 'jotai/utils'; import { Link as RouterLink, - LinkProps as RouterLinkProps, + LinkProps as RouterLinkProps } from 'react-router-dom'; import { equals } from 'ramda'; @@ -28,7 +28,7 @@ import { searchUrlFromEntry } from '../helpers/getUrlFromEntry'; import { Page } from '../../models'; import { hoveredNavigationItemsAtom, - selectedNavigationItemsAtom, + selectedNavigationItemsAtom } from '../sideBarAtoms'; import ArrowIcon from './ArrowIcon'; @@ -53,19 +53,19 @@ const useStyles = makeStyles((theme) => ({ activated: ({ isRoot }): CreateCSSProperties => ({ '& .MuiListItemText-root': { '& .MuiTypography-root': { - color: 'inherit', - }, + color: 'inherit' + } }, '& .MuiSvgIcon-root': { color: isDarkMode(theme) ? theme.palette.common.white - : theme.palette.primary.main, + : theme.palette.primary.main }, '&:hover': { backgroundColor: isDarkMode(theme) && isRoot ? theme.palette.primary.main - : theme.palette.primary.light, + : theme.palette.primary.light }, backgroundColor: isDarkMode(theme) && isRoot @@ -74,33 +74,33 @@ const useStyles = makeStyles((theme) => ({ color: isDarkMode(theme) && isRoot ? theme.palette.common.white - : theme.palette.primary.main, + : theme.palette.primary.main }), arrowIcon: { - color: 'inherit', + color: 'inherit' }, iconButton: { alignItems: 'center', color: theme.palette.common.white, - height: theme.spacing(rootHeightItem / 8), + height: theme.spacing(rootHeightItem / 8) }, iconWrapper: { alignItems: 'center', color: 'inherit', - minWidth: theme.spacing(5.75), + minWidth: theme.spacing(5.75) }, label: { '& .MuiTypography-root': { color: 'inherit', - lineHeight: 1, + lineHeight: 1 }, color: theme.palette.text.primary, - margin: theme.spacing(0), + margin: theme.spacing(0) }, rootLabel: { color: 'inherit', - margin: theme.spacing(0), - }, + margin: theme.spacing(0) + } })); const MenuItems = ({ @@ -114,7 +114,7 @@ const MenuItems = ({ data, isDrawerOpen, isRoot, - isDoubleClickedFromRoot, + isDoubleClickedFromRoot }: Props): JSX.Element => { const classes = useStyles({ isRoot }); const user = useAtomValue(userAtom); @@ -127,7 +127,7 @@ const MenuItems = ({ const memoizedUrl = useMemo(() => searchUrlFromEntry(data) as string, [data]); const ItemLink = forwardRef>( - (props, ref) => , + (props, ref) => ); const handleClickItem = (e: MouseEvent): void => { @@ -145,7 +145,7 @@ const MenuItems = ({ ({ icon: { - fontSize: 26, + fontSize: 26 }, list: { '&.MuiList-root': { - padding: 0, - }, - }, + padding: 0 + } + } })); const NavigationMenu = ({ isDrawerOpen, - navigationData, + navigationData }: Props): JSX.Element => { const classes = useStyles(); const navigate = useNavigate(); @@ -62,15 +62,15 @@ const NavigationMenu = ({ const timeoutRef = useRef(null); const menuRef = useRef(null); const [selectedNavigationItems, setSelectedNavigationItems] = useAtom( - selectedNavigationItemsAtom, + selectedNavigationItemsAtom ); const [hoveredNavigationItems, setHoveredNavigationItems] = useAtom( - hoveredNavigationItemsAtom, + hoveredNavigationItemsAtom ); const user = useAtomValue(userAtom); const setHoveredNavigationItemsDerived = useUpdateAtom( - setHoveredNavigationItemsDerivedAtom, + setHoveredNavigationItemsDerivedAtom ); const levelName = 'level_0'; @@ -133,10 +133,10 @@ const NavigationMenu = ({ (previousItem, currentItem, currentIndex) => { return { ...previousItem, - [`level_${currentIndex}`]: currentItem, + [`level_${currentIndex}`]: currentItem }; }, - {}, + {} ); setSelectedNavigationItems(selectedNavigationItemsToAdd); @@ -271,7 +271,7 @@ const NavigationMenu = ({ iframe.addEventListener('load', () => { iframe.contentWindow?.document?.addEventListener( 'mousemove', - closeMenu, + closeMenu ); }); } else { @@ -290,7 +290,7 @@ const NavigationMenu = ({ pathname, search, setCollapseScrollMaxHeight, - setCollapseScrollMaxWidth, + setCollapseScrollMaxWidth }; return useMemoComponent({ @@ -307,7 +307,7 @@ const NavigationMenu = ({ isItemHovered({ currentPage: item, level: levelName, - navigationItem: selectedNavigationItems, + navigationItem: selectedNavigationItems }) || equals(hoveredIndex, index); return ( @@ -351,8 +351,8 @@ const NavigationMenu = ({ selectedNavigationItems, user, hoveredNavigationItems, - navigationData, - ], + navigationData + ] }); }; diff --git a/www/front_src/src/Navigation/Sidebar/helpers/getUrlFromEntry.ts b/www/front_src/src/Navigation/Sidebar/helpers/getUrlFromEntry.ts index b2335dfd611..b0bcde892f7 100644 --- a/www/front_src/src/Navigation/Sidebar/helpers/getUrlFromEntry.ts +++ b/www/front_src/src/Navigation/Sidebar/helpers/getUrlFromEntry.ts @@ -6,7 +6,7 @@ export const getUrlFromEntry = ({ page, options, is_react, - url, + url }: Page): string | null | undefined => { const currentPage = isNil(page) ? '' : page; const currentOptions = isNil(options) ? '' : options; diff --git a/www/front_src/src/Navigation/Sidebar/index.cypress.spec.tsx b/www/front_src/src/Navigation/Sidebar/index.cypress.spec.tsx index 8fd4c2d05b5..336c0d244c2 100644 --- a/www/front_src/src/Navigation/Sidebar/index.cypress.spec.tsx +++ b/www/front_src/src/Navigation/Sidebar/index.cypress.spec.tsx @@ -14,7 +14,7 @@ describe('Navigation menu', () => { cy.mount( - , + ); }); diff --git a/www/front_src/src/Navigation/Sidebar/index.tsx b/www/front_src/src/Navigation/Sidebar/index.tsx index 20779554c63..4f9d6ff5d26 100644 --- a/www/front_src/src/Navigation/Sidebar/index.tsx +++ b/www/front_src/src/Navigation/Sidebar/index.tsx @@ -25,38 +25,38 @@ const openedMixin = (theme: Theme): CSSObject => ({ overflowX: 'hidden', transition: theme.transitions.create('width', { duration: theme.transitions.duration.enteringScreen, - easing: theme.transitions.easing.sharp, + easing: theme.transitions.easing.sharp }), - width: theme.spacing(openedDrawerWidth / 8), + width: theme.spacing(openedDrawerWidth / 8) }); const closedMixin = (theme: Theme): CSSObject => ({ overflowX: 'hidden', transition: theme.transitions.create('width', { duration: theme.transitions.duration.leavingScreen, - easing: theme.transitions.easing.sharp, + easing: theme.transitions.easing.sharp }), - width: theme.spacing(closedDrawerWidth), + width: theme.spacing(closedDrawerWidth) }); const DrawerHeader = styled('div')(({ theme }) => ({ '&:hover': { - cursor: 'pointer', + cursor: 'pointer' }, alignItems: 'center', display: 'flex', height: theme.spacing(headerHeight), - justifyContent: 'center', + justifyContent: 'center' })); const Drawer = styled(MuiDrawer, { - shouldForwardProp: (prop) => !equals(prop, 'open'), + shouldForwardProp: (prop) => !equals(prop, 'open') })(({ theme, open }) => ({ '& .MuiPaper-root': { backgroundColor: isDarkMode(theme) ? theme.palette.common.black : theme.palette.primary.dark, - border: 'none', + border: 'none' }, boxSizing: 'border-box', flexShrink: 0, @@ -64,12 +64,12 @@ const Drawer = styled(MuiDrawer, { width: theme.spacing(openedDrawerWidth / 8), ...(open && { ...openedMixin(theme), - '& .MuiDrawer-paper': openedMixin(theme), + '& .MuiDrawer-paper': openedMixin(theme) }), ...(!open && { ...closedMixin(theme), - '& .MuiDrawer-paper': closedMixin(theme), - }), + '& .MuiDrawer-paper': closedMixin(theme) + }) })); export interface Props { diff --git a/www/front_src/src/Navigation/Sidebar/sideBarAtoms.ts b/www/front_src/src/Navigation/Sidebar/sideBarAtoms.ts index 4e8b9fbc642..3c5552808fa 100644 --- a/www/front_src/src/Navigation/Sidebar/sideBarAtoms.ts +++ b/www/front_src/src/Navigation/Sidebar/sideBarAtoms.ts @@ -10,7 +10,7 @@ export const selectedNavigationItemsAtom = atomWithStorage | null>('selectedNavigationItems', null); export const hoveredNavigationItemsAtom = atom | null>( - null, + null ); export const setHoveredNavigationItemsDerivedAtom = atom( @@ -19,20 +19,20 @@ export const setHoveredNavigationItemsDerivedAtom = atom( const navigationKeysToRemove = keys(get(hoveredNavigationItemsAtom)).filter( (navigationItem) => { return navigationItem > levelName; - }, + } ); if (isNil(navigationKeysToRemove)) { set(hoveredNavigationItemsAtom, { ...get(hoveredNavigationItemsAtom), - [levelName]: currentPage, + [levelName]: currentPage }); return; } set(hoveredNavigationItemsAtom, { ...omit(navigationKeysToRemove, get(hoveredNavigationItemsAtom)), - [levelName]: currentPage, + [levelName]: currentPage }); - }, + } ); diff --git a/www/front_src/src/Navigation/index.tsx b/www/front_src/src/Navigation/index.tsx index 20c5eb07301..ee66a06b9d4 100755 --- a/www/front_src/src/Navigation/index.tsx +++ b/www/front_src/src/Navigation/index.tsx @@ -8,7 +8,7 @@ const Navigation = (): JSX.Element => { return useMemoComponent({ Component: , - memoProps: [menu], + memoProps: [menu] }); }; diff --git a/www/front_src/src/Navigation/mocks.ts b/www/front_src/src/Navigation/mocks.ts index 68b2cf6819a..a9c90ab672f 100644 --- a/www/front_src/src/Navigation/mocks.ts +++ b/www/front_src/src/Navigation/mocks.ts @@ -3,7 +3,7 @@ import Navigation from './models'; export const retrievedNavigationWithAnEmptySet: Navigation = { result: [], - status: true, + status: true }; export const retrievedNavigation: Navigation = { @@ -17,7 +17,7 @@ export const retrievedNavigation: Navigation = { options: null, page: '200', show: true, - url: '/monitoring/resources', + url: '/monitoring/resources' }, { groups: [ @@ -29,7 +29,7 @@ export const retrievedNavigation: Navigation = { options: '&o=svcOV_pb', page: '20204', show: true, - url: './include/monitoring/status/monitoringService.php', + url: './include/monitoring/status/monitoringService.php' }, { is_react: false, @@ -37,19 +37,19 @@ export const retrievedNavigation: Navigation = { options: '&o=svcOVHG_pb', page: '20209', show: true, - url: './include/monitoring/status/monitoringService.php', - }, + url: './include/monitoring/status/monitoringService.php' + } ], - label: 'By Status', - }, + label: 'By Status' + } ], is_react: false, label: 'Status Details', options: null, page: '202', show: true, - url: null, - }, + url: null + } ], color: '85B446', icon: 'monitoring', @@ -59,7 +59,7 @@ export const retrievedNavigation: Navigation = { options: '', page: '2', show: true, - url: null, + url: null }, { children: [ @@ -73,7 +73,7 @@ export const retrievedNavigation: Navigation = { options: null, page: '60101', show: true, - url: './include/configuration/configObject/host/host.php', + url: './include/configuration/configObject/host/host.php' }, { is_react: false, @@ -81,7 +81,7 @@ export const retrievedNavigation: Navigation = { options: null, page: '60102', show: true, - url: './include/configuration/configObject/hostgroup/hostGroup.php', + url: './include/configuration/configObject/hostgroup/hostGroup.php' }, { is_react: false, @@ -89,7 +89,7 @@ export const retrievedNavigation: Navigation = { options: null, page: '60103', show: true, - url: './include/configuration/configObject/host_template_model/hostTemplateModel.php', + url: './include/configuration/configObject/host_template_model/hostTemplateModel.php' }, { is_react: false, @@ -97,18 +97,18 @@ export const retrievedNavigation: Navigation = { options: null, page: '60104', show: true, - url: './include/configuration/configObject/host_categories/hostCategories.php', - }, + url: './include/configuration/configObject/host_categories/hostCategories.php' + } ], - label: 'Hosts', - }, + label: 'Hosts' + } ], is_react: false, label: 'Hosts', options: null, page: '601', show: true, - url: null, + url: null }, { groups: [ @@ -120,10 +120,10 @@ export const retrievedNavigation: Navigation = { options: null, page: '60401', show: true, - url: './include/configuration/configObject/escalation/escalation.php', - }, + url: './include/configuration/configObject/escalation/escalation.php' + } ], - label: 'Escalations', + label: 'Escalations' }, { children: [ @@ -133,7 +133,7 @@ export const retrievedNavigation: Navigation = { options: null, page: '60407', show: true, - url: './include/configuration/configObject/host_dependency/hostDependency.php', + url: './include/configuration/configObject/host_dependency/hostDependency.php' }, { is_react: false, @@ -141,7 +141,7 @@ export const retrievedNavigation: Navigation = { options: null, page: '60408', show: true, - url: './include/configuration/configObject/hostgroup_dependency/hostGroupDependency.php', + url: './include/configuration/configObject/hostgroup_dependency/hostGroupDependency.php' }, { is_react: false, @@ -149,7 +149,7 @@ export const retrievedNavigation: Navigation = { options: null, page: '60409', show: true, - url: './include/configuration/configObject/service_dependency/serviceDependency.php', + url: './include/configuration/configObject/service_dependency/serviceDependency.php' }, { is_react: false, @@ -157,7 +157,7 @@ export const retrievedNavigation: Navigation = { options: null, page: '60410', show: true, - url: './include/configuration/configObject/servicegroup_dependency/serviceGroupDependency.php', + url: './include/configuration/configObject/servicegroup_dependency/serviceGroupDependency.php' }, { is_react: false, @@ -165,19 +165,19 @@ export const retrievedNavigation: Navigation = { options: null, page: '60411', show: true, - url: './include/configuration/configObject/metaservice_dependency/MetaServiceDependency.php', - }, + url: './include/configuration/configObject/metaservice_dependency/MetaServiceDependency.php' + } ], - label: 'Dependencies', - }, + label: 'Dependencies' + } ], is_react: false, label: 'Notifications', options: null, page: '604', show: true, - url: null, - }, + url: null + } ], color: '319ED5', icon: 'configuration', @@ -187,10 +187,10 @@ export const retrievedNavigation: Navigation = { options: null, page: '6', show: true, - url: null, - }, + url: null + } ], - status: true, + status: true }; export const allowedPages = [ @@ -211,9 +211,9 @@ export const allowedPages = [ '60410', '60411', '604', - '6', + '6' ]; export const reactRoutes = { - '/monitoring/resources': '200', + '/monitoring/resources': '200' }; diff --git a/www/front_src/src/Navigation/useNavigation.ts b/www/front_src/src/Navigation/useNavigation.ts index ec44af8ca99..5faf773924a 100644 --- a/www/front_src/src/Navigation/useNavigation.ts +++ b/www/front_src/src/Navigation/useNavigation.ts @@ -18,7 +18,7 @@ import { pipe, prop, propEq, - T, + T } from 'ramda'; import { getData, useRequest } from '@centreon/ui'; @@ -44,25 +44,25 @@ const getAllowedPages = ({ page, newAccumulator }): Array => { return cond([ [ propEq('is_react', true) as (obj: Page) => boolean, - always(append(page.url as string, newAccumulator)), + always(append(page.url as string, newAccumulator)) ], [ propExists('page'), - always(append(page.page as string, newAccumulator)), + always(append(page.page as string, newAccumulator)) ], - [T, always(newAccumulator)], + [T, always(newAccumulator)] ])(page); }; const useNavigation = (): UseNavigationState => { const { sendRequest } = useRequest({ - request: getData, + request: getData }); const [navigation, setNavigation] = useAtom(navigationAtom); const getNavigation = (): void => { sendRequest({ - endpoint: navigationEndpoint, + endpoint: navigationEndpoint }).then(setNavigation); }; @@ -76,14 +76,14 @@ const useNavigation = (): UseNavigationState => { return page[property].reduce(reduceAllowedPages, []); }), - filter(isDefined), + filter(isDefined) )(['groups', 'children']) as Array; const newAccumulator = [...acc, ...flatten(children)]; return getAllowedPages({ newAccumulator, page }); }, - [], + [] ); const filterShowableElements = (acc, page): Array => { @@ -99,15 +99,15 @@ const useNavigation = (): UseNavigationState => { return { ...page, - [property]: page[property].reduce(filterShowableElements, []), + [property]: page[property].reduce(filterShowableElements, []) }; }, - ['groups', 'children'], + ['groups', 'children'] ); const getShowablePages = cond([ [any(isDefined), find(isDefined)], - [T, always(page)], + [T, always(page)] ]); return [...acc, getShowablePages(pages)]; @@ -127,8 +127,8 @@ const useNavigation = (): UseNavigationState => { ...acc, { ...page, - children: page.children.reduce(removeEmptyGroups, []), - }, + children: page.children.reduce(removeEmptyGroups, []) + } ]; } @@ -137,8 +137,8 @@ const useNavigation = (): UseNavigationState => { ...acc, { ...page, - groups: page.groups.filter(filterNotEmptyGroup), - }, + groups: page.groups.filter(filterNotEmptyGroup) + } ]; } @@ -163,7 +163,7 @@ const useNavigation = (): UseNavigationState => { const newAccumulator = { ...acc, ...(filteredChildren?.children || {}), - ...(filteredChildren?.groups || {}), + ...(filteredChildren?.groups || {}) }; if (equals(page.is_react, false) || isNil(page.url)) { @@ -172,10 +172,10 @@ const useNavigation = (): UseNavigationState => { return { ...newAccumulator, - [page.url as string]: page.page as string, + [page.url as string]: page.page as string }; }, - [], + [] ); const allowedPages = useMemo( @@ -183,7 +183,7 @@ const useNavigation = (): UseNavigationState => { isNil(navigation) ? undefined : navigation.result.reduce(reduceAllowedPages, [] as Array), - [navigation], + [navigation] ); const menu = useMemo( @@ -193,7 +193,7 @@ const useNavigation = (): UseNavigationState => { : navigation.result .reduce(filterShowableElements, []) .reduce(removeEmptyGroups, []), - [navigation], + [navigation] ); const reactRoutes = useMemo( @@ -201,14 +201,14 @@ const useNavigation = (): UseNavigationState => { isNil(navigation) ? undefined : navigation.result.reduce(findReactRoutes, {}), - [navigation], + [navigation] ); return { allowedPages, getNavigation, menu, - reactRoutes, + reactRoutes }; }; diff --git a/www/front_src/src/PollerWizard/LoadingSkeleton.tsx b/www/front_src/src/PollerWizard/LoadingSkeleton.tsx index 22feeeac24c..c79ecc8f380 100644 --- a/www/front_src/src/PollerWizard/LoadingSkeleton.tsx +++ b/www/front_src/src/PollerWizard/LoadingSkeleton.tsx @@ -4,14 +4,14 @@ import makeStyles from '@mui/styles/makeStyles'; const useStyles = makeStyles((theme) => ({ skeleton: { height: theme.spacing(5), - width: '100%', + width: '100%' }, skeletonContainer: { columnGap: theme.spacing(3), display: 'flex', flexDirection: 'column', - width: '100%', - }, + width: '100%' + } })); const LoadingSkeleton = (): JSX.Element => { diff --git a/www/front_src/src/PollerWizard/forms/baseWizard.tsx b/www/front_src/src/PollerWizard/forms/baseWizard.tsx index d858d877f37..9ddb37e5ee3 100644 --- a/www/front_src/src/PollerWizard/forms/baseWizard.tsx +++ b/www/front_src/src/PollerWizard/forms/baseWizard.tsx @@ -8,8 +8,8 @@ const useStyles = makeStyles((theme) => ({ height: 'fit-content', margin: '0 auto', padding: theme.spacing(2, 0), - width: '40%', - }, + width: '40%' + } })); interface Props { diff --git a/www/front_src/src/PollerWizard/forms/wizardButtons.tsx b/www/front_src/src/PollerWizard/forms/wizardButtons.tsx index c4ae26f407d..79053861938 100644 --- a/www/front_src/src/PollerWizard/forms/wizardButtons.tsx +++ b/www/front_src/src/PollerWizard/forms/wizardButtons.tsx @@ -16,7 +16,7 @@ interface Props { const WizardButtons = ({ goToPreviousStep, disabled, - type, + type }: Props): JSX.Element => { const classes = useStyles(); const { t } = useTranslation(); diff --git a/www/front_src/src/PollerWizard/models.ts b/www/front_src/src/PollerWizard/models.ts index f292f60f222..37e158be776 100644 --- a/www/front_src/src/PollerWizard/models.ts +++ b/www/front_src/src/PollerWizard/models.ts @@ -1,12 +1,12 @@ export enum ServerType { Base = 'base', Poller = 'poller', - Remote = 'remote', + Remote = 'remote' } export enum WizardButtonsTypes { 'Next', - 'Apply', + 'Apply' } export interface WizardFormProps { diff --git a/www/front_src/src/PollerWizard/pollerAtoms.ts b/www/front_src/src/PollerWizard/pollerAtoms.ts index 36a67dfc31f..05057ddfa50 100644 --- a/www/front_src/src/PollerWizard/pollerAtoms.ts +++ b/www/front_src/src/PollerWizard/pollerAtoms.ts @@ -36,5 +36,5 @@ export const setRemoteServerWizardDerivedAtom = atom( null, (get, set, data: RemoteServerData) => { set(remoteServerAtom, { ...get(remoteServerAtom), ...data }); - }, + } ); diff --git a/www/front_src/src/PollerWizard/pollerStep1/index.tsx b/www/front_src/src/PollerWizard/pollerStep1/index.tsx index 1c518d50f6e..a0e9b88e6a9 100755 --- a/www/front_src/src/PollerWizard/pollerStep1/index.tsx +++ b/www/front_src/src/PollerWizard/pollerStep1/index.tsx @@ -20,7 +20,7 @@ import { labelServerIp, labelCentreonCentralIp, labelSelectPollerIp, - labelRequired, + labelRequired } from '../translatedLabels'; import { Props, WaitList, WizardButtonsTypes } from '../models'; import WizardButtons from '../forms/wizardButtons'; @@ -34,7 +34,7 @@ interface StepOneFormData { const PollerWizardStepOne = ({ goToNextStep, - goToPreviousStep, + goToPreviousStep }: Props): JSX.Element => { const classes = useStyles(); const { t } = useTranslation(); @@ -45,17 +45,17 @@ const PollerWizardStepOne = ({ const [stepOneFormData, setStepOneFormData] = useState({ centreon_central_ip: '', server_ip: '', - server_name: '', + server_name: '' }); const [error, setError] = useState({ centreon_central_ip: '', server_ip: '', - server_name: '', + server_name: '' }); const { sendRequest } = useRequest>({ - request: postData, + request: postData }); const setWizard = useUpdateAtom(setWizardDerivedAtom); @@ -63,7 +63,7 @@ const PollerWizardStepOne = ({ const getWaitList = (): void => { sendRequest({ data: null, - endpoint: pollerWaitListEndpoint, + endpoint: pollerWaitListEndpoint }) .then((data): void => { setWaitList(data); @@ -83,12 +83,12 @@ const PollerWizardStepOne = ({ setError({ ...error, - [name]: isEmpty(value.trim()) ? t(labelRequired) : '', + [name]: isEmpty(value.trim()) ? t(labelRequired) : '' }); setStepOneFormData({ ...stepOneFormData, - [name]: value, + [name]: value }); }; @@ -97,7 +97,7 @@ const PollerWizardStepOne = ({ setError({ ...error, - [name]: isEmpty(value.trim()) ? t(labelRequired) : '', + [name]: isEmpty(value.trim()) ? t(labelRequired) : '' }); }; @@ -123,12 +123,12 @@ const PollerWizardStepOne = ({ useEffect(() => { if (waitList) { const platform = waitList.find( - (server) => server.ip === stepOneFormData.server_ip, + (server) => server.ip === stepOneFormData.server_ip ); if (platform) { setStepOneFormData({ ...stepOneFormData, - server_name: platform.server_name, + server_name: platform.server_name }); } } diff --git a/www/front_src/src/PollerWizard/pollerStep2/index.tsx b/www/front_src/src/PollerWizard/pollerStep2/index.tsx index b3abc6779c9..2b23d69db92 100755 --- a/www/front_src/src/PollerWizard/pollerStep2/index.tsx +++ b/www/front_src/src/PollerWizard/pollerStep2/index.tsx @@ -12,7 +12,7 @@ import { useRequest, MultiAutocompleteField, SelectField, - SelectEntry, + SelectEntry } from '@centreon/ui'; import { pollerAtom, setWizardDerivedAtom, PollerData } from '../pollerAtoms'; @@ -22,7 +22,7 @@ import { labelAdvancedServerConfiguration, labelLinkedRemoteMaster, labelLinkedadditionalRemote, - labelOpenBrokerFlow, + labelOpenBrokerFlow } from '../translatedLabels'; import { Props, PollerRemoteList, WizardButtonsTypes } from '../models'; import WizardButtons from '../forms/wizardButtons'; @@ -35,31 +35,31 @@ interface StepTwoFormData { } const PollerWizardStepTwo = ({ goToNextStep, - goToPreviousStep, + goToPreviousStep }: Props): JSX.Element => { const classes = useStyles(); const { t } = useTranslation(); const navigate = useNavigate(); const [remoteServers, setRemoteServers] = useState>( - [], + [] ); const [stepTwoFormData, setStepTwoFormData] = useState({ linked_remote_master: '', linked_remote_slaves: [], - open_broker_flow: false, + open_broker_flow: false }); const { sendRequest: getRemoteServersRequest } = useRequest< Array >({ - request: postData, + request: postData }); const { sendRequest: postWizardFormRequest, sending: loading } = useRequest<{ success: boolean; }>({ - request: postData, + request: postData }); const pollerData = useAtomValue(pollerAtom); @@ -68,7 +68,7 @@ const PollerWizardStepTwo = ({ const getRemoteServers = (): void => { getRemoteServersRequest({ data: null, - endpoint: remoteServersEndpoint, + endpoint: remoteServersEndpoint }).then(setRemoteServers); }; @@ -78,21 +78,21 @@ const PollerWizardStepTwo = ({ if (name === 'open_broker_flow') { setStepTwoFormData({ ...stepTwoFormData, - open_broker_flow: !stepTwoFormData.open_broker_flow, + open_broker_flow: !stepTwoFormData.open_broker_flow }); return; } setStepTwoFormData({ ...stepTwoFormData, - [name]: value, + [name]: value }); }; const changeValue = (_, slaves): void => { setStepTwoFormData({ ...stepTwoFormData, - linked_remote_slaves: slaves, + linked_remote_slaves: slaves }); }; @@ -101,15 +101,15 @@ const PollerWizardStepTwo = ({ const data = { ...stepTwoFormData, linked_remote_slaves: stepTwoFormData.linked_remote_slaves.map( - ({ id }) => id, - ), + ({ id }) => id + ) }; const dataToPost = { ...data, ...pollerData }; dataToPost.server_type = 'poller'; postWizardFormRequest({ data: dataToPost, - endpoint: wizardFormEndpoint, + endpoint: wizardFormEndpoint }) .then(({ success }) => { setWizard({ submitStatus: success }); @@ -126,8 +126,7 @@ const PollerWizardStepTwo = ({ const linkedRemoteSlavesOption = remoteServers .filter( - (remoteServer) => - remoteServer.id !== stepTwoFormData.linked_remote_master, + (remoteServer) => remoteServer.id !== stepTwoFormData.linked_remote_master ) .map(pick(['id', 'name'])); diff --git a/www/front_src/src/PollerWizard/remoteServerStep1/index.tsx b/www/front_src/src/PollerWizard/remoteServerStep1/index.tsx index d84e9c75caf..e4cd5b4034e 100755 --- a/www/front_src/src/PollerWizard/remoteServerStep1/index.tsx +++ b/www/front_src/src/PollerWizard/remoteServerStep1/index.tsx @@ -24,7 +24,7 @@ import { labelServerIp, labelCheckCertificate, labelServerConfiguration, - labelRequired, + labelRequired } from '../translatedLabels'; import { Props, WaitList, WizardButtonsTypes } from '../models'; import WizardButtons from '../forms/wizardButtons'; @@ -52,7 +52,7 @@ interface RemoteServerStepOneFormDataError { const RemoteServerWizardStepOne = ({ goToNextStep, - goToPreviousStep, + goToPreviousStep }: Props): JSX.Element => { const classes = useStyles(); const { t } = useTranslation(); @@ -69,7 +69,7 @@ const RemoteServerWizardStepOne = ({ no_check_certificate: false, no_proxy: false, server_ip: '', - server_name: '', + server_name: '' }); const [error, setError] = useState({ @@ -78,11 +78,11 @@ const RemoteServerWizardStepOne = ({ db_password: '', db_user: '', server_ip: '', - server_name: '', + server_name: '' }); const { sendRequest } = useRequest>({ - request: postData, + request: postData }); const setWizard = useUpdateAtom(setRemoteServerWizardDerivedAtom); @@ -90,7 +90,7 @@ const RemoteServerWizardStepOne = ({ const getWaitList = (): void => { sendRequest({ data: null, - endpoint: remoteServerWaitListEndpoint, + endpoint: remoteServerWaitListEndpoint }) .then((data): void => { setWaitList(data); @@ -111,7 +111,7 @@ const RemoteServerWizardStepOne = ({ if (name === 'no_check_certificate' || name === 'no_proxy') { setStepOneFormData({ ...stepOneFormData, - [name]: !stepOneFormData[name], + [name]: !stepOneFormData[name] }); return; @@ -119,12 +119,12 @@ const RemoteServerWizardStepOne = ({ setError({ ...error, - [name]: isEmpty(value.trim()) ? t(labelRequired) : '', + [name]: isEmpty(value.trim()) ? t(labelRequired) : '' }); setStepOneFormData({ ...stepOneFormData, - [name]: value, + [name]: value }); }; @@ -133,7 +133,7 @@ const RemoteServerWizardStepOne = ({ setError({ ...error, - [name]: isEmpty(value.trim()) ? t(labelRequired) : '', + [name]: isEmpty(value.trim()) ? t(labelRequired) : '' }); }; @@ -159,12 +159,12 @@ const RemoteServerWizardStepOne = ({ useEffect(() => { if (waitList) { const platform = waitList.find( - (server) => server.ip === stepOneFormData.server_ip, + (server) => server.ip === stepOneFormData.server_ip ); if (platform) { setStepOneFormData({ ...stepOneFormData, - server_name: platform.server_name, + server_name: platform.server_name }); } } diff --git a/www/front_src/src/PollerWizard/remoteServerStep2/index.tsx b/www/front_src/src/PollerWizard/remoteServerStep2/index.tsx index eb38ef1187e..8d11fb9952a 100755 --- a/www/front_src/src/PollerWizard/remoteServerStep2/index.tsx +++ b/www/front_src/src/PollerWizard/remoteServerStep2/index.tsx @@ -12,7 +12,7 @@ import { postData, useRequest, SelectEntry, - MultiAutocompleteField, + MultiAutocompleteField } from '@centreon/ui'; import WizardButtons from '../forms/wizardButtons'; @@ -20,18 +20,18 @@ import { useStyles } from '../../styles/partials/form/PollerWizardStyle'; import routeMap from '../../reactRoutes/routeMap'; import { remoteServerAtom, - setRemoteServerWizardDerivedAtom, + setRemoteServerWizardDerivedAtom } from '../pollerAtoms'; import { labelAdvancedServerConfiguration, - labelRemoteServers, + labelRemoteServers } from '../translatedLabels'; import { Props, WizardButtonsTypes, Poller } from '../models'; import { pollersEndpoint, wizardFormEndpoint } from '../api/endpoints'; const RemoteServerWizardStepTwo = ({ goToNextStep, - goToPreviousStep, + goToPreviousStep }: Props): JSX.Element => { const classes = useStyles(); const { t } = useTranslation(); @@ -42,14 +42,14 @@ const RemoteServerWizardStepTwo = ({ const { sendRequest: getPollersRequest } = useRequest<{ items: Array; }>({ - request: getData, + request: getData }); const { sendRequest: postWizardFormRequest, sending: loading } = useRequest<{ s; success: boolean; task_id: number | string | null; }>({ - request: postData, + request: postData }); const pollerData = useAtomValue(remoteServerAtom); @@ -62,14 +62,14 @@ const RemoteServerWizardStepTwo = ({ const getPollers = (): void => { getPollersRequest({ data: null, - endpoint: pollersEndpoint, + endpoint: pollersEndpoint }).then(({ items }) => { setPollers( isEmpty(items) ? null : filterOutDefaultPoller( - items.map(({ id, text }) => ({ id, name: text })), - ), + items.map(({ id, text }) => ({ id, name: text })) + ) ); }); }; @@ -84,19 +84,19 @@ const RemoteServerWizardStepTwo = ({ event.preventDefault(); const dataToPost = { ...pollerData, - linked_pollers: linkedPollers.map(({ id }) => id), + linked_pollers: linkedPollers.map(({ id }) => id) }; dataToPost.server_type = 'remote'; postWizardFormRequest({ data: dataToPost, - endpoint: wizardFormEndpoint, + endpoint: wizardFormEndpoint }) .then(({ success, task_id }) => { if (success && task_id) { setWizard({ submitStatus: success, - taskId: task_id, + taskId: task_id }); goToNextStep(); @@ -108,7 +108,7 @@ const RemoteServerWizardStepTwo = ({ }; const pollersOptions = pollers?.map( - pick(['id', 'name']), + pick(['id', 'name']) ) as Array; useEffect(() => { diff --git a/www/front_src/src/PollerWizard/remoteServerStep3/index.tsx b/www/front_src/src/PollerWizard/remoteServerStep3/index.tsx index 59a9e69309b..d75ca58de9a 100755 --- a/www/front_src/src/PollerWizard/remoteServerStep3/index.tsx +++ b/www/front_src/src/PollerWizard/remoteServerStep3/index.tsx @@ -12,7 +12,7 @@ import routeMap from '../../reactRoutes/routeMap'; import { remoteServerAtom, RemoteServerData } from '../pollerAtoms'; import { labelExportGenerationTimeout, - labelFinalStep, + labelFinalStep } from '../translatedLabels'; import { exportTaskEndpoint } from '../api/endpoints'; @@ -26,7 +26,7 @@ const RemoteServerWizardStepThree = (): JSX.Element => { status: string | null; success: boolean; }>({ - request: postData, + request: postData }); const navigate = useNavigate(); @@ -35,7 +35,7 @@ const RemoteServerWizardStepThree = (): JSX.Element => { const remainingGenerationTimeoutRef = useRef(30); const pollerData = useAtomValue( - remoteServerAtom, + remoteServerAtom ) as RemoteServerData; const refreshGeneration = (): void => { @@ -43,7 +43,7 @@ const RemoteServerWizardStepThree = (): JSX.Element => { getExportTask({ data: { task_id: taskId }, - endpoint: exportTaskEndpoint, + endpoint: exportTaskEndpoint }) .then((data) => { if (not(data.success)) { diff --git a/www/front_src/src/PollerWizard/serverConfigurationWizard/index.tsx b/www/front_src/src/PollerWizard/serverConfigurationWizard/index.tsx index 91a4e151d65..d2873071291 100755 --- a/www/front_src/src/PollerWizard/serverConfigurationWizard/index.tsx +++ b/www/front_src/src/PollerWizard/serverConfigurationWizard/index.tsx @@ -12,7 +12,7 @@ import { labelAddACentreonPoller, labelAddACentreonRemoteServer, labelNext, - labelChoseServerType, + labelChoseServerType } from '../translatedLabels'; import { ServerType } from '../models'; import { useStyles } from '../../styles/partials/form/PollerWizardStyle'; @@ -24,7 +24,7 @@ interface Props { const ServerConfigurationWizard = ({ changeServerType, - goToNextStep, + goToNextStep }: Props): JSX.Element => { const classes = useStyles(); const { t } = useTranslation(); @@ -47,12 +47,12 @@ const ServerConfigurationWizard = ({ const configurationTypes = [ { label: labelAddACentreonRemoteServer, - value: 1, + value: 1 }, { label: labelAddACentreonPoller, - value: 2, - }, + value: 2 + } ]; return ( diff --git a/www/front_src/src/ResetPassword/Form.tsx b/www/front_src/src/ResetPassword/Form.tsx index a13261bae80..f8c506ac21e 100644 --- a/www/front_src/src/ResetPassword/Form.tsx +++ b/www/front_src/src/ResetPassword/Form.tsx @@ -4,7 +4,7 @@ import { FormikErrors, FormikTouched, FormikValues, - useFormikContext, + useFormikContext } from 'formik'; import { equals, isEmpty, not, prop } from 'ramda'; import { useTranslation } from 'react-i18next'; @@ -20,7 +20,7 @@ import { labelCurrentPassword, labelNewPassword, labelNewPasswordConfirmation, - labelResetPassword, + labelResetPassword } from './translatedLabels'; const oldPasswordFieldName = 'oldPassword'; @@ -41,7 +41,7 @@ const contentLayout = [ getValue: (values: FormikValues): string => prop(oldPasswordFieldName, values), label: labelCurrentPassword, - name: oldPasswordFieldName, + name: oldPasswordFieldName }, { getError: ({ errors, touched }: GetErrorProps): string | undefined => @@ -51,7 +51,7 @@ const contentLayout = [ getValue: (values: FormikValues): string => prop(newPasswordFieldName, values), label: labelNewPassword, - name: newPasswordFieldName, + name: newPasswordFieldName }, { getError: ({ errors, touched }: GetErrorProps): string | undefined => @@ -61,8 +61,8 @@ const contentLayout = [ getValue: (values: FormikValues): string => prop(newPasswordConfirmationFieldName, values), label: labelNewPasswordConfirmation, - name: newPasswordConfirmationFieldName, - }, + name: newPasswordConfirmationFieldName + } ]; const useStyles = makeStyles((theme) => ({ @@ -70,8 +70,8 @@ const useStyles = makeStyles((theme) => ({ display: 'flex', flexDirection: 'column', marginTop: theme.spacing(3), - rowGap: theme.spacing(2), - }, + rowGap: theme.spacing(2) + } })); const Form = (): JSX.Element => { @@ -81,7 +81,7 @@ const Form = (): JSX.Element => { const [passwordVisibility, setPasswordVisibility] = useState({ [newPasswordConfirmationFieldName]: false, [newPasswordFieldName]: false, - [oldPasswordFieldName]: false, + [oldPasswordFieldName]: false }); const { @@ -92,13 +92,13 @@ const Form = (): JSX.Element => { touched, handleBlur, isSubmitting, - dirty, + dirty } = useFormikContext(); const changeVisibility = (fieldName: string): void => { setPasswordVisibility((currentPasswordVisibility) => ({ ...currentPasswordVisibility, - [fieldName]: !currentPasswordVisibility[fieldName], + [fieldName]: !currentPasswordVisibility[fieldName] })); }; diff --git a/www/front_src/src/ResetPassword/index.test.tsx b/www/front_src/src/ResetPassword/index.test.tsx index bb5d9fabc35..771dd99ee0c 100644 --- a/www/front_src/src/ResetPassword/index.test.tsx +++ b/www/front_src/src/ResetPassword/index.test.tsx @@ -8,7 +8,7 @@ import { RenderResult, screen, waitFor, - SnackbarProvider, + SnackbarProvider } from '@centreon/ui'; import { labelCentreonLogo } from '../Login/translatedLabels'; @@ -21,12 +21,12 @@ import { labelResetPassword, labelTheNewPasswordIstheSameAsTheOldPassword, labelNewPasswordsMustMatch, - labelPasswordRenewed, + labelPasswordRenewed } from './translatedLabels'; import { getResetPasswordEndpoint } from './api/endpoint'; import { passwordResetInformationsAtom, - PasswordResetInformations, + PasswordResetInformations } from './passwordResetInformationsAtom'; import ResetPasswordPage from '.'; @@ -38,7 +38,7 @@ const cancelTokenRequestParam = { cancelToken: {} }; jest.mock('../Navigation/Sidebar/Logo/centreon.png'); jest.mock('@centreon/ui-context', () => - jest.requireActual('centreon-frontend/packages/ui-context'), + jest.requireActual('centreon-frontend/packages/ui-context') ); interface Props { @@ -52,23 +52,23 @@ const retrievedUser = { locale: 'fr_FR.UTF8', name: 'Admin', timezone: 'Europe/Paris', - use_deprecated_pages: false, + use_deprecated_pages: false }; const retrievedWeb = { web: { - version: '21.10.1', - }, + version: '21.10.1' + } }; const retrievedLogin = { - redirect_uri: '/monitoring/resources', + redirect_uri: '/monitoring/resources' }; const retrievedTranslations = { en: { - hello: 'Hello', - }, + hello: 'Hello' + } }; const TestComponent = ({ initialValues }: Props): JSX.Element => ( @@ -87,8 +87,8 @@ const alias = 'admin'; const renderResetPasswordPage = ( initialValues: PasswordResetInformations | null = { - alias, - }, + alias + } ): RenderResult => render(); const retrievedProvidersConfiguration = [ @@ -97,32 +97,32 @@ const retrievedProvidersConfiguration = [ '/centreon/authentication/providers/configurations/local', id: 1, is_active: true, - name: 'local', - }, + name: 'local' + } ]; describe('Reset password Page', () => { beforeEach(() => { mockedAxios.put.mockResolvedValue({ - data: null, + data: null }); mockedAxios.get .mockResolvedValueOnce({ - data: retrievedWeb, + data: retrievedWeb }) .mockResolvedValueOnce({ - data: retrievedProvidersConfiguration, + data: retrievedProvidersConfiguration }) .mockResolvedValueOnce({ - data: retrievedTranslations, + data: retrievedTranslations }) .mockResolvedValue({ - data: retrievedUser, + data: retrievedUser }); mockedAxios.post.mockResolvedValue({ - data: retrievedLogin, + data: retrievedLogin }); }); @@ -141,7 +141,7 @@ describe('Reset password Page', () => { expect(screen.getByLabelText(labelNewPassword)).toBeInTheDocument(); expect(screen.getByLabelText(labelNewPassword)).toBeInTheDocument(); expect( - screen.getByLabelText(labelNewPasswordConfirmation), + screen.getByLabelText(labelNewPasswordConfirmation) ).toBeInTheDocument(); expect(screen.getByLabelText(labelCentreonLogo)).toBeInTheDocument(); }); @@ -151,14 +151,14 @@ describe('Reset password Page', () => { userEvent.type( screen.getByLabelText(labelCurrentPassword), - 'current-password', + 'current-password' ); userEvent.type(screen.getByLabelText(labelNewPassword), 'current-password'); userEvent.tab(); await waitFor(() => { expect( - screen.getByText(labelTheNewPasswordIstheSameAsTheOldPassword), + screen.getByText(labelTheNewPasswordIstheSameAsTheOldPassword) ).toBeInTheDocument(); }); expect(screen.getByText(labelResetPassword)).toBeDisabled(); @@ -167,7 +167,7 @@ describe('Reset password Page', () => { userEvent.type(screen.getByLabelText(labelNewPassword), 'new-password'); userEvent.type( screen.getByLabelText(labelNewPasswordConfirmation), - 'new-password-2', + 'new-password-2' ); userEvent.tab(); @@ -190,12 +190,12 @@ describe('Reset password Page', () => { userEvent.type( screen.getByLabelText(labelCurrentPassword), - 'current-password', + 'current-password' ); userEvent.type(screen.getByLabelText(labelNewPassword), 'new-password'); userEvent.type( screen.getByLabelText(labelNewPasswordConfirmation), - 'new-password', + 'new-password' ); userEvent.click(screen.getByText(labelResetPassword)); @@ -205,21 +205,21 @@ describe('Reset password Page', () => { getResetPasswordEndpoint(alias), { new_password: 'new-password', - old_password: 'current-password', + old_password: 'current-password' }, { ...cancelTokenRequestParam, headers: { - 'Content-Type': 'application/x-www-form-urlencoded', - }, - }, + 'Content-Type': 'application/x-www-form-urlencoded' + } + } ); }); await waitFor(() => { expect(mockedAxios.post).toHaveBeenCalledWith(loginEndpoint, { login: alias, - password: 'new-password', + password: 'new-password' }); }); diff --git a/www/front_src/src/ResetPassword/index.tsx b/www/front_src/src/ResetPassword/index.tsx index b5f0608c170..4484b19cd3a 100644 --- a/www/front_src/src/ResetPassword/index.tsx +++ b/www/front_src/src/ResetPassword/index.tsx @@ -27,17 +27,17 @@ const useStyles = makeStyles((theme) => ({ height: '100vh', justifyContent: 'center', rowGap: theme.spacing(2), - width: '100vw', + width: '100vw' }, paper: { - padding: theme.spacing(4, 3), - }, + padding: theme.spacing(4, 3) + } })); const initialValues = { newPassword: '', newPasswordConfirmation: '', - oldPassword: '', + oldPassword: '' }; const ResetPassword = (): JSX.Element | null => { diff --git a/www/front_src/src/ResetPassword/useResetPassword.ts b/www/front_src/src/ResetPassword/useResetPassword.ts index 8bb5fbac77a..a38aa58770c 100644 --- a/www/front_src/src/ResetPassword/useResetPassword.ts +++ b/www/front_src/src/ResetPassword/useResetPassword.ts @@ -16,7 +16,7 @@ import { labelNewPasswordsMustMatch, labelPasswordRenewed, labelRequired, - labelTheNewPasswordIstheSameAsTheOldPassword, + labelTheNewPasswordIstheSameAsTheOldPassword } from './translatedLabels'; import { getResetPasswordEndpoint } from './api/endpoint'; import { passwordResetInformationsAtom } from './passwordResetInformationsAtom'; @@ -24,7 +24,7 @@ import { passwordResetInformationsAtom } from './passwordResetInformationsAtom'; interface UseResetPasswordState { submitResetPassword: ( values: ResetPasswordValues, - { setSubmitting }: Pick, 'setSubmitting'>, + { setSubmitting }: Pick, 'setSubmitting'> ) => void; validationSchema: Yup.SchemaOf; } @@ -43,7 +43,7 @@ const useResetPassword = (): UseResetPasswordState => { const { showSuccessMessage } = useSnackbar(); const { sendRequest } = useRequest({ - request: putData, + request: putData }); const passwordResetInformations = useAtomValue(passwordResetInformationsAtom); @@ -53,22 +53,22 @@ const useResetPassword = (): UseResetPasswordState => { const submitResetPassword = ( values: ResetPasswordValues, - { setSubmitting }: Pick, 'setSubmitting'>, + { setSubmitting }: Pick, 'setSubmitting'> ): void => { sendRequest({ data: { new_password: values.newPassword, - old_password: values.oldPassword, + old_password: values.oldPassword }, endpoint: getResetPasswordEndpoint( - passwordResetInformations?.alias as string, - ), + passwordResetInformations?.alias as string + ) }) .then(() => { showSuccessMessage(t(labelPasswordRenewed)); sendLogin({ login: passwordResetInformations?.alias as string, - password: values.newPassword, + password: values.newPassword }).then(({ redirectUri }) => { showSuccessMessage(t(labelLoginSucceeded)); loadUser()?.then(() => navigate(redirectUri)); @@ -84,18 +84,18 @@ const useResetPassword = (): UseResetPasswordState => { .test( 'match', t(labelTheNewPasswordIstheSameAsTheOldPassword), - differentPasswords, + differentPasswords ) .required(t(labelRequired)), newPasswordConfirmation: Yup.string() .test('match', t(labelNewPasswordsMustMatch), matchNewPasswords) .required(t(labelRequired)), - oldPassword: Yup.string().required(t(labelRequired)), + oldPassword: Yup.string().required(t(labelRequired)) }); return { submitResetPassword, - validationSchema, + validationSchema }; }; diff --git a/www/front_src/src/Resources/Actions/GlobalActionsSkeleton.tsx b/www/front_src/src/Resources/Actions/GlobalActionsSkeleton.tsx index b1b17f8e7fe..ae31d928289 100644 --- a/www/front_src/src/Resources/Actions/GlobalActionsSkeleton.tsx +++ b/www/front_src/src/Resources/Actions/GlobalActionsSkeleton.tsx @@ -7,8 +7,8 @@ const useStyles = makeStyles((theme) => ({ alignItems: 'center', columnGap: theme.spacing(2), display: 'grid', - gridTemplateColumns: 'repeat(2, min-content)', - }, + gridTemplateColumns: 'repeat(2, min-content)' + } })); const GlobalActionsSkeleton = (): JSX.Element => { diff --git a/www/front_src/src/Resources/Actions/Refresh/index.tsx b/www/front_src/src/Resources/Actions/Refresh/index.tsx index 7c2b01c3310..28b127fffc6 100644 --- a/www/front_src/src/Resources/Actions/Refresh/index.tsx +++ b/www/front_src/src/Resources/Actions/Refresh/index.tsx @@ -12,11 +12,11 @@ import { IconButton } from '@centreon/ui'; import { labelRefresh, labelDisableAutorefresh, - labelEnableAutorefresh, + labelEnableAutorefresh } from '../../translatedLabels'; import { enabledAutorefreshAtom, - sendingAtom, + sendingAtom } from '../../Listing/listingAtoms'; interface AutorefreshProps { @@ -26,7 +26,7 @@ interface AutorefreshProps { const AutorefreshButton = ({ enabledAutorefresh, - toggleAutorefresh, + toggleAutorefresh }: AutorefreshProps): JSX.Element => { const { t } = useTranslation(); @@ -54,7 +54,7 @@ const RefreshActions = ({ onRefresh }: Props): JSX.Element => { const { t } = useTranslation(); const [enabledAutorefresh, setEnabledAutorefresh] = useAtom( - enabledAutorefreshAtom, + enabledAutorefreshAtom ); const sending = useAtomValue(sendingAtom); diff --git a/www/front_src/src/Resources/Actions/Resource/Acknowledge/Dialog.tsx b/www/front_src/src/Resources/Actions/Resource/Acknowledge/Dialog.tsx index 7b736413d8e..a1fa2b1d74e 100644 --- a/www/front_src/src/Resources/Actions/Resource/Acknowledge/Dialog.tsx +++ b/www/front_src/src/Resources/Actions/Resource/Acknowledge/Dialog.tsx @@ -6,7 +6,7 @@ import { FormControlLabel, FormHelperText, Grid, - Alert, + Alert } from '@mui/material'; import makeStyles from '@mui/styles/makeStyles'; @@ -20,7 +20,7 @@ import { labelNotifyHelpCaption, labelAcknowledgeServices, labelSticky, - labelPersistent, + labelPersistent } from '../../../translatedLabels'; import { Resource } from '../../../models'; import useAclQuery from '../aclQuery'; @@ -39,8 +39,8 @@ interface Props extends Pick { const useStyles = makeStyles((theme) => ({ notify: { - marginBottom: theme.spacing(2), - }, + marginBottom: theme.spacing(2) + } })); const DialogAcknowledge = ({ @@ -51,7 +51,7 @@ const DialogAcknowledge = ({ errors, values, submitting, - handleChange, + handleChange }: Props): JSX.Element => { const classes = useStyles(); diff --git a/www/front_src/src/Resources/Actions/Resource/Acknowledge/index.tsx b/www/front_src/src/Resources/Actions/Resource/Acknowledge/index.tsx index 66b978eba34..8da0ce5fbbc 100644 --- a/www/front_src/src/Resources/Actions/Resource/Acknowledge/index.tsx +++ b/www/front_src/src/Resources/Actions/Resource/Acknowledge/index.tsx @@ -11,7 +11,7 @@ import { acknowledgementAtom, userAtom } from '@centreon/ui-context'; import { labelRequired, labelAcknowledgeCommandSent, - labelAcknowledgedBy, + labelAcknowledgedBy } from '../../../translatedLabels'; import { Resource } from '../../../models'; import { acknowledgeResources } from '../../api'; @@ -23,7 +23,7 @@ const validationSchema = Yup.object().shape({ force_active_checks: Yup.boolean(), is_sticky: Yup.boolean(), notify: Yup.boolean(), - persistent: Yup.boolean(), + persistent: Yup.boolean() }); interface Props { @@ -44,16 +44,16 @@ export interface AcknowledgeFormValues { const AcknowledgeForm = ({ resources, onClose, - onSuccess, + onSuccess }: Props): JSX.Element | null => { const { t } = useTranslation(); const { showSuccessMessage } = useSnackbar(); const { sendRequest: sendAcknowledgeResources, - sending: sendingAcknowledgeResources, + sending: sendingAcknowledgeResources } = useRequest({ - request: acknowledgeResources, + request: acknowledgeResources }); const { alias } = useAtomValue(userAtom); @@ -66,18 +66,18 @@ const AcknowledgeForm = ({ forceActiveChecks: acknowledgement.force_active_checks, isSticky: acknowledgement.sticky, notify: acknowledgement.notify, - persistent: acknowledgement.persistent, + persistent: acknowledgement.persistent }, onSubmit: (values): void => { sendAcknowledgeResources({ params: values, - resources, + resources }).then(() => { showSuccessMessage(t(labelAcknowledgeCommandSent)); onSuccess(); }); }, - validationSchema, + validationSchema }); useEffect(() => { diff --git a/www/front_src/src/Resources/Actions/Resource/ActionMenuItem.tsx b/www/front_src/src/Resources/Actions/Resource/ActionMenuItem.tsx index 0057a114345..d7e781fe70e 100644 --- a/www/front_src/src/Resources/Actions/Resource/ActionMenuItem.tsx +++ b/www/front_src/src/Resources/Actions/Resource/ActionMenuItem.tsx @@ -13,7 +13,7 @@ const ActionMenuItem = ({ permitted, label, onClick, - disabled, + disabled }: Props): JSX.Element => { const { t } = useTranslation(); diff --git a/www/front_src/src/Resources/Actions/Resource/Disacknowledge/api/index.ts b/www/front_src/src/Resources/Actions/Resource/Disacknowledge/api/index.ts index 53bf44714db..e9cd748276e 100644 --- a/www/front_src/src/Resources/Actions/Resource/Disacknowledge/api/index.ts +++ b/www/front_src/src/Resources/Actions/Resource/Disacknowledge/api/index.ts @@ -15,16 +15,16 @@ const disacknowledgeResources = (cancelToken: CancelToken) => ({ resources, - disacknowledgeAttachedResources, + disacknowledgeAttachedResources }: ResourcesWithDisacknowledgeParams): Promise> => { return axios.delete(disacknowledgeEndpoint, { cancelToken, data: { disacknowledgement: { - with_services: disacknowledgeAttachedResources, + with_services: disacknowledgeAttachedResources }, - resources: map(pick(['type', 'id', 'parent']), resources), - }, + resources: map(pick(['type', 'id', 'parent']), resources) + } }); }; diff --git a/www/front_src/src/Resources/Actions/Resource/Disacknowledge/index.tsx b/www/front_src/src/Resources/Actions/Resource/Disacknowledge/index.tsx index 468c42a5a1f..ec40e5291b0 100644 --- a/www/front_src/src/Resources/Actions/Resource/Disacknowledge/index.tsx +++ b/www/front_src/src/Resources/Actions/Resource/Disacknowledge/index.tsx @@ -11,7 +11,7 @@ import { labelCancel, labelDisacknowledgeServices, labelDisacknowledge, - labelDisacknowledgementCommandSent, + labelDisacknowledgementCommandSent } from '../../../translatedLabels'; import { Resource } from '../../../models'; import useAclQuery from '../aclQuery'; @@ -27,7 +27,7 @@ interface Props { const DisacknowledgeForm = ({ resources, onClose, - onSuccess, + onSuccess }: Props): JSX.Element | null => { const { t } = useTranslation(); const { showSuccessMessage } = useSnackbar(); @@ -36,9 +36,9 @@ const DisacknowledgeForm = ({ const { sendRequest: sendDisacknowledgeResources, - sending: sendingDisacknowledgeResources, + sending: sendingDisacknowledgeResources } = useRequest({ - request: disacknowledgeResources, + request: disacknowledgeResources }); const { getDisacknowledgementDeniedTypeAlert, canDisacknowledgeServices } = @@ -57,7 +57,7 @@ const DisacknowledgeForm = ({ const submitDisacknowledge = (): void => { sendDisacknowledgeResources({ disacknowledgeAttachedResources, - resources, + resources }).then(() => { showSuccessMessage(t(labelDisacknowledgementCommandSent)); onSuccess(); diff --git a/www/front_src/src/Resources/Actions/Resource/Downtime/Dialog.tsx b/www/front_src/src/Resources/Actions/Resource/Downtime/Dialog.tsx index e4709d5b8d7..53662593dd6 100644 --- a/www/front_src/src/Resources/Actions/Resource/Downtime/Dialog.tsx +++ b/www/front_src/src/Resources/Actions/Resource/Downtime/Dialog.tsx @@ -13,7 +13,7 @@ import { FormHelperText, Alert, TextFieldProps, - Stack, + Stack } from '@mui/material'; import { Box } from '@mui/system'; @@ -33,7 +33,7 @@ import { labelSetDowntime, labelSetDowntimeOnServices, labelTo, - labelStartTime, + labelStartTime } from '../../../translatedLabels'; import { Resource } from '../../../models'; import useAclQuery from '../aclQuery'; @@ -68,7 +68,7 @@ const renderDateTimePickerTextField = ...inputProps, 'aria-label': ariaLabel, ref: inputRef, - style: { padding: 8 }, + style: { padding: 8 } }} /> ); @@ -83,7 +83,7 @@ const DialogDowntime = ({ values, submitting, handleChange, - setFieldValue, + setFieldValue }: Props): JSX.Element => { const { t } = useTranslation(); @@ -95,7 +95,7 @@ const DialogDowntime = ({ const { Adapter, getDestinationAndConfiguredTimezoneOffset, - formatKeyboardValue, + formatKeyboardValue } = useDateTimePickerAdapter(); const open = resources.length > 0; @@ -118,8 +118,8 @@ const DialogDowntime = ({ : dayjs(formatKeyboardValue(keyBoardValue)) .add( dayjs.duration({ - hours: getDestinationAndConfiguredTimezoneOffset(), - }), + hours: getDestinationAndConfiguredTimezoneOffset() + }) ) .toDate(); @@ -198,16 +198,16 @@ const DialogDowntime = ({ options={[ { id: 'seconds', - name: t(labelSeconds), + name: t(labelSeconds) }, { id: 'minutes', - name: t(labelMinutes), + name: t(labelMinutes) }, { id: 'hours', - name: t(labelHours), - }, + name: t(labelHours) + } ]} selectedOptionId={values.duration.unit} onChange={handleChange('duration.unit')} diff --git a/www/front_src/src/Resources/Actions/Resource/Downtime/index.tsx b/www/front_src/src/Resources/Actions/Resource/Downtime/index.tsx index 0d781360b40..c2adc5d62c9 100644 --- a/www/front_src/src/Resources/Actions/Resource/Downtime/index.tsx +++ b/www/front_src/src/Resources/Actions/Resource/Downtime/index.tsx @@ -10,7 +10,7 @@ import { downtimeAtom, userAtom } from '@centreon/ui-context'; import { labelDowntimeCommandSent, - labelDowntimeBy, + labelDowntimeBy } from '../../../translatedLabels'; import { Resource } from '../../../models'; import { setDowntimeOnResources } from '../../api'; @@ -51,7 +51,7 @@ export interface DowntimeToPost { const DowntimeForm = ({ resources, onClose, - onSuccess, + onSuccess }: Props): JSX.Element | null => { const { t } = useTranslation(); const { showSuccessMessage } = useSnackbar(); @@ -60,9 +60,9 @@ const DowntimeForm = ({ const { sendRequest: sendSetDowntimeOnResources, - sending: sendingSetDowntingOnResources, + sending: sendingSetDowntingOnResources } = useRequest({ - request: setDowntimeOnResources, + request: setDowntimeOnResources }); const { alias } = useAtomValue(userAtom); @@ -78,12 +78,12 @@ const DowntimeForm = ({ comment: undefined, duration: { unit: 'seconds', - value: downtime.duration, + value: downtime.duration }, endTime: defaultEndDate, fixed: downtime.fixed, isDowntimeWithServices: downtime.with_services, - startTime: currentDate, + startTime: currentDate }, onSubmit: (values, { setSubmitting }) => { setSubmitting(true); @@ -93,7 +93,7 @@ const DowntimeForm = ({ const unitMultipliers = { hours: 3600, minutes: 60, - seconds: 1, + seconds: 1 }; const durationDivider = unitMultipliers?.[values.duration.unit] || 1; const duration = values.duration.value * durationDivider; @@ -103,15 +103,15 @@ const DowntimeForm = ({ ...values, duration, endTime: toIsoString(endTime), - startTime: toIsoString(startTime), + startTime: toIsoString(startTime) }, - resources, + resources }).then(() => { showSuccessMessage(t(labelDowntimeCommandSent)); onSuccess(); }); }, - validationSchema: getValidationSchema(t), + validationSchema: getValidationSchema(t) }); useEffect(() => { diff --git a/www/front_src/src/Resources/Actions/Resource/Downtime/validation/index.ts b/www/front_src/src/Resources/Actions/Resource/Downtime/validation/index.ts index 311b7ae686d..a29f167de06 100644 --- a/www/front_src/src/Resources/Actions/Resource/Downtime/validation/index.ts +++ b/www/front_src/src/Resources/Actions/Resource/Downtime/validation/index.ts @@ -6,7 +6,7 @@ import { labelEndDateGreaterThanStartDate, labelInvalidFormat, labelMaxDuration1Year, - labelRequired, + labelRequired } from '../../../../translatedLabels'; const getValidationSchema = (t: (string) => string): unknown => { @@ -21,7 +21,7 @@ const getValidationSchema = (t: (string) => string): unknown => { return !fixed ? schema.shape({ unit: Yup.string().required(t(labelRequired)), - value: Yup.string().required(t(labelRequired)), + value: Yup.string().required(t(labelRequired)) }) : schema; }), @@ -35,16 +35,16 @@ const getValidationSchema = (t: (string) => string): unknown => { return dateSchema .min( dayjs(startTime).add(dayjs.duration({ minutes: 1 })), - t(labelEndDateGreaterThanStartDate), + t(labelEndDateGreaterThanStartDate) ) .max( dayjs(startTime).add(dayjs.duration({ years: 1 })), - t(labelMaxDuration1Year), + t(labelMaxDuration1Year) ); - }, + } ), fixed: Yup.boolean(), - startTime: dateSchema, + startTime: dateSchema }); }; diff --git a/www/front_src/src/Resources/Actions/Resource/ResourceActionButton.tsx b/www/front_src/src/Resources/Actions/Resource/ResourceActionButton.tsx index 1f7fc15d8f9..3506f5ff15e 100644 --- a/www/front_src/src/Resources/Actions/Resource/ResourceActionButton.tsx +++ b/www/front_src/src/Resources/Actions/Resource/ResourceActionButton.tsx @@ -20,7 +20,7 @@ const ResourceActionButton = ({ label, onClick, disabled, - permitted = true, + permitted = true }: Props): JSX.Element => { const theme = useTheme(); const { t } = useTranslation(); diff --git a/www/front_src/src/Resources/Actions/Resource/SubmitStatus/api/index.ts b/www/front_src/src/Resources/Actions/Resource/SubmitStatus/api/index.ts index 4ffa985f0ac..81993c005ab 100644 --- a/www/front_src/src/Resources/Actions/Resource/SubmitStatus/api/index.ts +++ b/www/front_src/src/Resources/Actions/Resource/SubmitStatus/api/index.ts @@ -19,7 +19,7 @@ const submitResourceStatus = resource, statusId, output, - performanceData, + performanceData }: ResourceWithSubmitStatusParams): Promise> => { return axios.post( submitStatusEndpoint, @@ -33,11 +33,11 @@ const submitResourceStatus = parent: resource?.parent ? { id: resource.parent.id } : null, performance_data: performanceData, status: statusId, - type: ResourceCategory[resource.type], - }, - ], + type: ResourceCategory[resource.type] + } + ] }, - { cancelToken }, + { cancelToken } ); }; diff --git a/www/front_src/src/Resources/Actions/Resource/SubmitStatus/index.tsx b/www/front_src/src/Resources/Actions/Resource/SubmitStatus/index.tsx index 79b4d39b255..f8d9aee4121 100644 --- a/www/front_src/src/Resources/Actions/Resource/SubmitStatus/index.tsx +++ b/www/front_src/src/Resources/Actions/Resource/SubmitStatus/index.tsx @@ -9,7 +9,7 @@ import { Dialog, SelectField, useRequest, - TextField, + TextField } from '@centreon/ui'; import { Resource } from '../../../models'; @@ -27,7 +27,7 @@ import { labelOk, labelWarning, labelCritical, - labelUnknown, + labelUnknown } from '../../../translatedLabels'; import { submitResourceStatus } from './api'; @@ -41,7 +41,7 @@ interface Props { const SubmitStatusForm = ({ resource, onClose, - onSuccess, + onSuccess }: Props): JSX.Element => { const { t } = useTranslation(); const { showSuccessMessage } = useSnackbar(); @@ -53,34 +53,34 @@ const SubmitStatusForm = ({ const serviceStatuses = [ { id: 0, - name: t(labelOk), + name: t(labelOk) }, { id: 1, - name: t(labelWarning), + name: t(labelWarning) }, { id: 2, - name: t(labelCritical), + name: t(labelCritical) }, - { id: 3, name: t(labelUnknown) }, + { id: 3, name: t(labelUnknown) } ]; const statuses = { host: [ { id: 0, - name: t(labelUp), + name: t(labelUp) }, { id: 1, name: t(labelDown) }, - { id: 2, name: t(labelUnreachable) }, + { id: 2, name: t(labelUnreachable) } ], metaservice: serviceStatuses, - service: serviceStatuses, + service: serviceStatuses }; const { sendRequest, sending } = useRequest({ - request: submitResourceStatus, + request: submitResourceStatus }); const submitStatus = (): void => { @@ -88,7 +88,7 @@ const SubmitStatusForm = ({ output, performanceData, resource, - statusId: selectedStatusId, + statusId: selectedStatusId }).then(() => { showSuccessMessage(t(labelStatusSubmitted)); onSuccess(); diff --git a/www/front_src/src/Resources/Actions/Resource/aclQuery.ts b/www/front_src/src/Resources/Actions/Resource/aclQuery.ts index 1ceb62abade..ce2b905892b 100644 --- a/www/front_src/src/Resources/Actions/Resource/aclQuery.ts +++ b/www/front_src/src/Resources/Actions/Resource/aclQuery.ts @@ -12,7 +12,7 @@ import { always, equals, isEmpty, - reject, + reject } from 'ramda'; import { useTranslation } from 'react-i18next'; import { useAtomValue } from 'jotai/utils'; @@ -45,14 +45,14 @@ const useAclQuery = (): AclQuery => { const can = ({ resources, - action, + action }: { action: string; resources: Array; }): boolean => { return pipe( map(toType), - any((type) => pathEq(['actions', type, action], true)(acl)), + any((type) => pathEq(['actions', type, action], true)(acl)) )(resources); }; @@ -77,10 +77,10 @@ const useAclQuery = (): AclQuery => { ifElse( equals('host'), always(t(labelHostsDenied)), - always(t(labelServicesDenied)), - ), - ), - ), + always(t(labelServicesDenied)) + ) + ) + ) )(resources); }; @@ -89,7 +89,7 @@ const useAclQuery = (): AclQuery => { }; const getDowntimeDeniedTypeAlert = ( - resources: Array, + resources: Array ): string | undefined => { return getDeniedTypeAlert({ action: 'downtime', resources }); }; @@ -102,7 +102,7 @@ const useAclQuery = (): AclQuery => { }; const getAcknowledgementDeniedTypeAlert = ( - resources: Array, + resources: Array ): string | undefined => { return getDeniedTypeAlert({ action: 'acknowledgement', resources }); }; @@ -122,7 +122,7 @@ const useAclQuery = (): AclQuery => { pathEq(['actions', 'service', 'disacknowledgement'], true)(acl); const getDisacknowledgementDeniedTypeAlert = ( - resources: Array, + resources: Array ): string | undefined => { return getDeniedTypeAlert({ action: 'disacknowledgement', resources }); }; @@ -147,7 +147,7 @@ const useAclQuery = (): AclQuery => { canSubmitStatus, getAcknowledgementDeniedTypeAlert, getDisacknowledgementDeniedTypeAlert, - getDowntimeDeniedTypeAlert, + getDowntimeDeniedTypeAlert }; }; diff --git a/www/front_src/src/Resources/Actions/Resource/index.tsx b/www/front_src/src/Resources/Actions/Resource/index.tsx index 94971dbb349..bade65375d3 100644 --- a/www/front_src/src/Resources/Actions/Resource/index.tsx +++ b/www/front_src/src/Resources/Actions/Resource/index.tsx @@ -13,7 +13,7 @@ import { useCancelTokenSource, useSnackbar, SeverityCode, - PopoverMenu, + PopoverMenu } from '@centreon/ui'; import IconDowntime from '../../icons/Downtime'; @@ -26,7 +26,7 @@ import { labelDisacknowledge, labelSubmitStatus, labelAddComment, - labelMoreActions, + labelMoreActions } from '../../translatedLabels'; import { checkResources } from '../api'; import { Resource } from '../../models'; @@ -36,7 +36,7 @@ import { resourcesToCheckAtom, resourcesToDisacknowledgeAtom, resourcesToSetDowntimeAtom, - selectedResourcesAtom, + selectedResourcesAtom } from '../actionsAtoms'; import useAclQuery from './aclQuery'; @@ -49,12 +49,12 @@ import ActionMenuItem from './ActionMenuItem'; const useStyles = makeStyles((theme) => ({ action: { - marginRight: theme.spacing(1), + marginRight: theme.spacing(1) }, flex: { alignItems: 'center', - display: 'flex', - }, + display: 'flex' + } })); const ResourceActions = (): JSX.Element => { @@ -68,17 +68,17 @@ const ResourceActions = (): JSX.Element => { const [resourceToComment, setResourceToComment] = useState(); const [selectedResources, setSelectedResources] = useAtom( - selectedResourcesAtom, + selectedResourcesAtom ); const [resourcesToAcknowledge, setResourcesToAcknowledge] = useAtom( - resourcesToAcknowledgeAtom, + resourcesToAcknowledgeAtom ); const [resourcesToSetDowntime, setResourcesToSetDowntime] = useAtom( - resourcesToSetDowntimeAtom, + resourcesToSetDowntimeAtom ); const [resourcesToCheck, setResourcesToCheck] = useAtom(resourcesToCheckAtom); const [resourcesToDisacknowledge, setResourcesToDisacknowledge] = useAtom( - resourcesToDisacknowledgeAtom, + resourcesToDisacknowledgeAtom ); const { @@ -87,7 +87,7 @@ const ResourceActions = (): JSX.Element => { canCheck, canDisacknowledge, canSubmitStatus, - canComment, + canComment } = useAclQuery(); const hasResourcesToCheck = resourcesToCheck.length > 0; @@ -109,7 +109,7 @@ const ResourceActions = (): JSX.Element => { checkResources({ cancelToken: token, - resources: resourcesToCheck, + resources: resourcesToCheck }) .then(() => { confirmAction(); @@ -170,7 +170,7 @@ const ResourceActions = (): JSX.Element => { const areSelectedResourcesOk = all( pathEq(['status', 'severity_code'], SeverityCode.Ok), - selectedResources, + selectedResources ); const disableAcknowledge = diff --git a/www/front_src/src/Resources/Actions/ResourceActionsSkeleton.tsx b/www/front_src/src/Resources/Actions/ResourceActionsSkeleton.tsx index 5f136896b78..bc2b259e366 100644 --- a/www/front_src/src/Resources/Actions/ResourceActionsSkeleton.tsx +++ b/www/front_src/src/Resources/Actions/ResourceActionsSkeleton.tsx @@ -8,10 +8,10 @@ const useStyles = makeStyles((theme) => ({ columnGap: theme.spacing(1), display: 'grid', gridTemplateColumns: `${theme.spacing(18)} ${theme.spacing( - 17, + 17 )} ${theme.spacing(11)} min-content`, - gridTemplateRows: theme.spacing(3.5), - }, + gridTemplateRows: theme.spacing(3.5) + } })); const ResourceActionsSkeleton = (): JSX.Element => { diff --git a/www/front_src/src/Resources/Actions/api/endpoint.ts b/www/front_src/src/Resources/Actions/api/endpoint.ts index cc5b77a273a..a5e6ab920bc 100644 --- a/www/front_src/src/Resources/Actions/api/endpoint.ts +++ b/www/front_src/src/Resources/Actions/api/endpoint.ts @@ -9,5 +9,5 @@ export { acknowledgeEndpoint, downtimeEndpoint, checkEndpoint, - commentEndpoint, + commentEndpoint }; diff --git a/www/front_src/src/Resources/Actions/api/index.ts b/www/front_src/src/Resources/Actions/api/index.ts index 13b37d641ff..920e3255702 100644 --- a/www/front_src/src/Resources/Actions/api/index.ts +++ b/www/front_src/src/Resources/Actions/api/index.ts @@ -9,7 +9,7 @@ import { acknowledgeEndpoint, checkEndpoint, commentEndpoint, - downtimeEndpoint, + downtimeEndpoint } from './endpoint'; interface ResourcesWithAcknowledgeParams { @@ -22,12 +22,12 @@ const acknowledgeResources = (cancelToken: CancelToken) => ({ resources, - params, + params }: ResourcesWithAcknowledgeParams): Promise> => { const payload = resources.map(({ type, id, parent, service_id }) => ({ id: equals(type, ResourceType.anomalydetection) ? service_id : id, parent: parent ? { id: parent?.id } : null, - type: ResourceCategory[type], + type: ResourceCategory[type] })); return axios.post( @@ -38,11 +38,11 @@ const acknowledgeResources = is_notify_contacts: params.notify, is_persistent_comment: params.persistent, is_sticky: params.isSticky, - with_services: params.acknowledgeAttachedResources, + with_services: params.acknowledgeAttachedResources }, - resources: payload, + resources: payload }, - { cancelToken }, + { cancelToken } ); }; @@ -55,12 +55,12 @@ const setDowntimeOnResources = (cancelToken: CancelToken) => ({ resources, - params, + params }: ResourcesWithDowntimeParams): Promise => { const payload = resources.map(({ type, id, parent, service_id }) => ({ id: equals(type, ResourceType.anomalydetection) ? service_id : id, parent: parent ? { id: parent?.id } : null, - type: ResourceCategory[type], + type: ResourceCategory[type] })); return axios.post( @@ -72,11 +72,11 @@ const setDowntimeOnResources = end_time: params.endTime, is_fixed: params.fixed, start_time: params.startTime, - with_services: params.isDowntimeWithServices, + with_services: params.isDowntimeWithServices }, - resources: payload, + resources: payload }, - { cancelToken }, + { cancelToken } ); }; @@ -87,20 +87,20 @@ interface ResourcesWithRequestParams { const checkResources = ({ resources, - cancelToken, + cancelToken }: ResourcesWithRequestParams): Promise => { const payload = resources.map(({ type, id, parent, service_id }) => ({ id: equals(type, ResourceType.anomalydetection) ? service_id : id, parent: parent ? { id: parent?.id } : null, - type: ResourceCategory[type], + type: ResourceCategory[type] })); return axios.post( checkEndpoint, { - resources: payload, + resources: payload }, - { cancelToken }, + { cancelToken } ); }; @@ -118,7 +118,7 @@ const commentResources = (cancelToken: CancelToken) => ({ resources, - parameters, + parameters }: ResourcesWithCommentParams): Promise => { return axios.post( commentEndpoint, @@ -130,10 +130,10 @@ const commentResources = ? resource?.service_id : resource.id, parent: resource?.parent ? { id: resource?.parent?.id } : null, - type: ResourceCategory[resource.type], - })), + type: ResourceCategory[resource.type] + })) }, - { cancelToken }, + { cancelToken } ); }; @@ -141,5 +141,5 @@ export { acknowledgeResources, setDowntimeOnResources, checkResources, - commentResources, + commentResources }; diff --git a/www/front_src/src/Resources/Actions/index.test.tsx b/www/front_src/src/Resources/Actions/index.test.tsx index be66d786db3..64f79853345 100644 --- a/www/front_src/src/Resources/Actions/index.test.tsx +++ b/www/front_src/src/Resources/Actions/index.test.tsx @@ -12,14 +12,14 @@ import { fireEvent, act, SeverityCode, - screen, + screen } from '@centreon/ui'; import { acknowledgementAtom, aclAtom, downtimeAtom, refreshIntervalAtom, - userAtom, + userAtom } from '@centreon/ui-context'; import { @@ -55,7 +55,7 @@ import { labelEndDateGreaterThanStartDate, labelInvalidFormat, labelStartTime, - labelDuration, + labelDuration } from '../translatedLabels'; import useLoadResources from '../Listing/useLoadResources'; import useListing from '../Listing/useListing'; @@ -69,7 +69,7 @@ import useActions from '../testUtils/useActions'; import { acknowledgeEndpoint, downtimeEndpoint, - checkEndpoint, + checkEndpoint } from './api/endpoint'; import { disacknowledgeEndpoint } from './Resource/Disacknowledge/api'; import { submitStatusEndpoint } from './Resource/SubmitStatus/api'; @@ -81,20 +81,20 @@ const mockedAxios = axios as jest.Mocked; const onRefresh = jest.fn(); jest.mock('@centreon/ui-context', () => - jest.requireActual('centreon-frontend/packages/ui-context'), + jest.requireActual('centreon-frontend/packages/ui-context') ); const mockUser = { alias: 'admin', isExportButtonEnabled: true, locale: 'en', - timezone: 'Europe/Paris', + timezone: 'Europe/Paris' }; const mockRefreshInterval = 15; const mockDowntime = { duration: 7200, fixed: true, - with_services: false, + with_services: false }; const mockAcl = { actions: { @@ -104,7 +104,7 @@ const mockAcl = { comment: true, disacknowledgement: true, downtime: true, - submit_status: true, + submit_status: true }, service: { acknowledgement: true, @@ -112,16 +112,16 @@ const mockAcl = { comment: true, disacknowledgement: true, downtime: true, - submit_status: true, - }, - }, + submit_status: true + } + } }; const mockAcknowledgement = { force_active_checks: false, notify: false, persistent: true, sticky: true, - with_services: true, + with_services: true }; jest.mock('../icons/Downtime'); @@ -138,16 +138,16 @@ const host = { id: 0, parent: null, passive_checks: true, - type: 'host', + type: 'host' } as Resource; const service = { id: 1, parent: { - id: 1, + id: 1 }, passive_checks: true, - type: 'service', + type: 'service' } as Resource; const ActionsWithContext = (): JSX.Element => { @@ -162,7 +162,7 @@ const ActionsWithContext = (): JSX.Element => { ...detailsState, ...listingState, ...actionsState, - ...filterState, + ...filterState } as ResourceContext; return ( @@ -180,11 +180,11 @@ const renderActions = (aclAtions = mockAcl): RenderResult => { [refreshIntervalAtom, mockRefreshInterval], [downtimeAtom, mockDowntime], [aclAtom, aclAtions], - [acknowledgementAtom, mockAcknowledgement], + [acknowledgementAtom, mockAcknowledgement] ]} > - , + ); }; @@ -207,9 +207,9 @@ describe(Actions, () => { media: query, onchange: (): void => undefined, removeEventListener: (): void => undefined, - removeListener: (): void => undefined, + removeListener: (): void => undefined }), - writable: true, + writable: true }); mockedAxios.post.mockReset(); @@ -218,10 +218,10 @@ describe(Actions, () => { meta: { limit: 30, page: 1, - total: 0, + total: 0 }, - result: [], - }, + result: [] + } }); mockDate.set(mockNow); @@ -263,13 +263,13 @@ describe(Actions, () => { await waitFor(() => expect(mockedAxios.get).toHaveBeenCalled()); fireEvent.click( - getByLabelText(labelDisableAutorefresh).firstElementChild as HTMLElement, + getByLabelText(labelDisableAutorefresh).firstElementChild as HTMLElement ); expect(getByLabelText(labelEnableAutorefresh)).toBeTruthy(); fireEvent.click( - getByLabelText(labelEnableAutorefresh).firstElementChild as HTMLElement, + getByLabelText(labelEnableAutorefresh).firstElementChild as HTMLElement ); expect(getByLabelText(labelDisableAutorefresh)).toBeTruthy(); @@ -277,7 +277,7 @@ describe(Actions, () => { it.each([ [labelAcknowledge, labelAcknowledgedByAdmin, labelAcknowledge], - [labelSetDowntime, labelDowntimeByAdmin, labelSetDowntime], + [labelSetDowntime, labelDowntimeByAdmin, labelSetDowntime] ])( 'cannot send a %p request when the corresponding action is fired and the comment field is left empty', async (labelAction, labelComment, labelConfirmAction) => { @@ -290,7 +290,7 @@ describe(Actions, () => { }); await waitFor(() => - expect(context.selectedResources).toEqual(selectedResources), + expect(context.selectedResources).toEqual(selectedResources) ); fireEvent.click(getByText(labelAction)); @@ -301,10 +301,10 @@ describe(Actions, () => { await waitFor(() => expect( - last(getAllByText(labelConfirmAction)) as HTMLElement, - ).toBeDisabled(), + last(getAllByText(labelConfirmAction)) as HTMLElement + ).toBeDisabled() ); - }, + } ); it('sends an acknowledgement request when Resources are selected and the Ackowledgement action is clicked and confirmed', async () => { @@ -340,13 +340,13 @@ describe(Actions, () => { is_notify_contacts: true, is_persistent_comment: true, is_sticky: true, - with_services: true, + with_services: true }, - resources: map(pick(['type', 'id', 'parent']), selectedResources), + resources: map(pick(['type', 'id', 'parent']), selectedResources) }, - expect.anything(), - ), + expect.anything() + ) ); }); @@ -361,7 +361,7 @@ describe(Actions, () => { await waitFor(() => { expect( - getByLabelText(labelMoreActions).firstChild as HTMLElement, + getByLabelText(labelMoreActions).firstChild as HTMLElement ).toBeInTheDocument(); }); @@ -378,12 +378,12 @@ describe(Actions, () => { cancelToken: expect.anything(), data: { disacknowledgement: { - with_services: true, + with_services: true }, - resources: map(pick(['type', 'id', 'parent']), selectedResources), - }, - }), + resources: map(pick(['type', 'id', 'parent']), selectedResources) + } + }) ); }); @@ -418,7 +418,7 @@ describe(Actions, () => { await waitFor(() => { expect( - getByLabelText(labelMoreActions).firstChild as HTMLElement, + getByLabelText(labelMoreActions).firstChild as HTMLElement ).toBeInTheDocument(); }); @@ -442,7 +442,7 @@ describe(Actions, () => { await waitFor(() => { expect( - last(getAllByText(labelSetDowntime)) as HTMLElement, + last(getAllByText(labelSetDowntime)) as HTMLElement ).toBeInTheDocument(); }); @@ -456,13 +456,11 @@ describe(Actions, () => { fireEvent.click(getByLabelText(labelFixed)); fireEvent.change(getByLabelText(labelDuration), { - target: { value: '' }, + target: { value: '' } }); await waitFor(() => - expect( - last(getAllByText(labelSetDowntime)) as HTMLElement, - ).toBeDisabled(), + expect(last(getAllByText(labelSetDowntime)) as HTMLElement).toBeDisabled() ); }); @@ -478,7 +476,7 @@ describe(Actions, () => { await waitFor(() => { expect( - head(getAllByText(labelSetDowntime)) as HTMLElement, + head(getAllByText(labelSetDowntime)) as HTMLElement ).toBeInTheDocument(); }); @@ -490,9 +488,7 @@ describe(Actions, () => { userEvent.type(getByLabelText(labelEndTime), dayjs(mockNow).format('L LT')); await waitFor(() => - expect( - last(getAllByText(labelSetDowntime)) as HTMLElement, - ).toBeDisabled(), + expect(last(getAllByText(labelSetDowntime)) as HTMLElement).toBeDisabled() ); expect(getByText(labelEndDateGreaterThanStartDate)).toBeInTheDocument(); @@ -504,7 +500,7 @@ describe(Actions, () => { getAllByText, findByText, getByText, - findAllByText, + findAllByText } = renderActions(); const selectedResources = [host]; @@ -523,7 +519,7 @@ describe(Actions, () => { await waitFor(() => { expect( - last(getAllByText(labelSetDowntime)) as HTMLElement, + last(getAllByText(labelSetDowntime)) as HTMLElement ).toBeDisabled(); }); @@ -532,15 +528,13 @@ describe(Actions, () => { userEvent.type(getByLabelText(labelStartTime), '{backspace}M'); await waitFor(() => - expect(last(getAllByText(labelSetDowntime)) as HTMLElement).toBeEnabled(), + expect(last(getAllByText(labelSetDowntime)) as HTMLElement).toBeEnabled() ); userEvent.type(getByLabelText(labelEndTime), 'a'); await waitFor(() => - expect( - last(getAllByText(labelSetDowntime)) as HTMLElement, - ).toBeDisabled(), + expect(last(getAllByText(labelSetDowntime)) as HTMLElement).toBeDisabled() ); expect(getByText(labelInvalidFormat)).toBeInTheDocument(); @@ -548,7 +542,7 @@ describe(Actions, () => { userEvent.type(getByLabelText(labelEndTime), '{backspace}'); await waitFor(() => - expect(last(getAllByText(labelSetDowntime)) as HTMLElement).toBeEnabled(), + expect(last(getAllByText(labelSetDowntime)) as HTMLElement).toBeEnabled() ); }); @@ -563,7 +557,7 @@ describe(Actions, () => { await waitFor(() => { expect( - last(getAllByText(labelSetDowntime)) as HTMLElement, + last(getAllByText(labelSetDowntime)) as HTMLElement ).toBeInTheDocument(); }); @@ -590,12 +584,12 @@ describe(Actions, () => { end_time: '2020-01-01T02:00:00Z', is_fixed: true, start_time: '2020-01-01T00:00:00Z', - with_services: false, + with_services: false }, - resources: map(pick(['type', 'id', 'parent']), selectedResources), + resources: map(pick(['type', 'id', 'parent']), selectedResources) }, - expect.anything(), - ), + expect.anything() + ) ); }); @@ -622,9 +616,9 @@ describe(Actions, () => { expect(mockedAxios.post).toHaveBeenCalledWith( checkEndpoint, { - resources: map(pick(['type', 'id', 'parent']), selectedResources), + resources: map(pick(['type', 'id', 'parent']), selectedResources) }, - expect.anything(), + expect.anything() ); }); }); @@ -640,12 +634,12 @@ describe(Actions, () => { await waitFor(() => { expect( - getByLabelText(labelMoreActions).firstElementChild as HTMLElement, + getByLabelText(labelMoreActions).firstElementChild as HTMLElement ).toBeInTheDocument(); }); fireEvent.click( - getByLabelText(labelMoreActions).firstElementChild as HTMLElement, + getByLabelText(labelMoreActions).firstElementChild as HTMLElement ); fireEvent.click(getByText(labelSubmitStatus) as HTMLElement); @@ -665,14 +659,14 @@ describe(Actions, () => { fireEvent.change(getByLabelText(labelOutput), { target: { - value: output, - }, + value: output + } }); fireEvent.change(getByLabelText(labelPerformanceData), { target: { - value: performanceData, - }, + value: performanceData + } }); fireEvent.click(getByText(labelSubmit)); @@ -686,11 +680,11 @@ describe(Actions, () => { ...pick(['type', 'id', 'parent'], service), output, performance_data: performanceData, - status: 1, - }, - ], + status: 1 + } + ] }, - expect.anything(), + expect.anything() ); }); @@ -699,7 +693,7 @@ describe(Actions, () => { }); fireEvent.click( - getByLabelText(labelMoreActions).firstElementChild as HTMLElement, + getByLabelText(labelMoreActions).firstElementChild as HTMLElement ); fireEvent.click(getAllByText(labelSubmitStatus)[1] as HTMLElement); @@ -721,7 +715,7 @@ describe(Actions, () => { comment: false, disacknowledgement: false, downtime: false, - submit_status: false, + submit_status: false }, service: { acknowledgement: false, @@ -729,9 +723,9 @@ describe(Actions, () => { comment: false, disacknowledgement: false, downtime: false, - submit_status: false, - }, - }, + submit_status: false + } + } }); const selectedResources = [host, service]; @@ -750,7 +744,7 @@ describe(Actions, () => { expect(getByText(labelDisacknowledge)).toHaveAttribute( 'aria-disabled', - 'true', + 'true' ); expect(getByText(labelAddComment)).toHaveAttribute('aria-disabled', 'true'); }); @@ -760,9 +754,9 @@ describe(Actions, () => { ...mockAcl.actions, service: { ...mockAcl.actions.service, - downtime: false, - }, - }, + downtime: false + } + } }; const cannotAcknowledgeServicesAcl = { @@ -770,9 +764,9 @@ describe(Actions, () => { ...mockAcl.actions, service: { ...mockAcl.actions.service, - acknowledgement: false, - }, - }, + acknowledgement: false + } + } }; const cannotDisacknowledgeServicesAcl = { @@ -780,9 +774,9 @@ describe(Actions, () => { ...mockAcl.actions, service: { ...mockAcl.actions.service, - disacknowledgement: false, - }, - }, + disacknowledgement: false + } + } }; const cannotDowntimeHostsAcl = { @@ -790,9 +784,9 @@ describe(Actions, () => { ...mockAcl.actions, host: { ...mockAcl.actions.host, - downtime: false, - }, - }, + downtime: false + } + } }; const cannotAcknowledgeHostsAcl = { @@ -800,9 +794,9 @@ describe(Actions, () => { ...mockAcl.actions, host: { ...mockAcl.actions.host, - acknowledgement: false, - }, - }, + acknowledgement: false + } + } }; const cannotDisacknowledgeHostsAcl = { @@ -810,9 +804,9 @@ describe(Actions, () => { ...mockAcl.actions, host: { ...mockAcl.actions.host, - disacknowledgement: false, - }, - }, + disacknowledgement: false + } + } }; it.each([ @@ -820,20 +814,20 @@ describe(Actions, () => { labelSetDowntime, labelSetDowntime, labelHostsDenied, - cannotDowntimeHostsAcl, + cannotDowntimeHostsAcl ], [ labelAcknowledge, labelAcknowledge, labelHostsDenied, - cannotAcknowledgeHostsAcl, + cannotAcknowledgeHostsAcl ], [ labelDisacknowledge, labelDisacknowledge, labelHostsDenied, - cannotDisacknowledgeHostsAcl, - ], + cannotDisacknowledgeHostsAcl + ] ])( 'displays a warning message when trying to %p with limited ACL', async (_, labelAction, labelAclWarning, acl) => { @@ -847,12 +841,12 @@ describe(Actions, () => { await waitFor(() => { expect( - getByLabelText(labelMoreActions).firstChild as HTMLElement, + getByLabelText(labelMoreActions).firstChild as HTMLElement ).toBeInTheDocument(); }); fireEvent.click( - getByLabelText(labelMoreActions).firstChild as HTMLElement, + getByLabelText(labelMoreActions).firstChild as HTMLElement ); fireEvent.click(getByText(labelAction)); @@ -860,7 +854,7 @@ describe(Actions, () => { await waitFor(() => { expect(getByText(labelAclWarning)).toBeInTheDocument(); }); - }, + } ); it.each([ @@ -868,20 +862,20 @@ describe(Actions, () => { labelSetDowntime, labelSetDowntime, labelSetDowntimeOnServices, - cannotDowntimeServicesAcl, + cannotDowntimeServicesAcl ], [ labelAcknowledge, labelAcknowledge, labelAcknowledgeServices, - cannotAcknowledgeServicesAcl, + cannotAcknowledgeServicesAcl ], [ labelDisacknowledge, labelDisacknowledge, labelDisacknowledgeServices, - cannotDisacknowledgeServicesAcl, - ], + cannotDisacknowledgeServicesAcl + ] ])( 'disables services propagation option when trying to %p on hosts when ACL on services are not sufficient', async (_, labelAction, labelAppliesOnServices, acl) => { @@ -892,7 +886,7 @@ describe(Actions, () => { }); fireEvent.click( - getByLabelText(labelMoreActions).firstChild as HTMLElement, + getByLabelText(labelMoreActions).firstChild as HTMLElement ); fireEvent.click(getByText(labelAction)); @@ -900,11 +894,11 @@ describe(Actions, () => { await waitFor(() => { expect( getByText(labelAppliesOnServices).parentElement?.querySelector( - 'input[type="checkbox"]', - ), + 'input[type="checkbox"]' + ) ).toBeDisabled(); }); - }, + } ); it('disables the submit status action when one of the following condition is met: ACL are not sufficient, more than one resource is selected, selected resource is not passive', async () => { @@ -913,9 +907,9 @@ describe(Actions, () => { ...mockAcl.actions, host: { ...mockAcl.actions.host, - submit_status: false, - }, - }, + submit_status: false + } + } }); act(() => { @@ -927,7 +921,7 @@ describe(Actions, () => { await waitFor(() => { expect(getByText(labelSubmitStatus)).toHaveAttribute( 'aria-disabled', - 'true', + 'true' ); }); @@ -938,7 +932,7 @@ describe(Actions, () => { await waitFor(() => { expect(getByText(labelSubmitStatus)).toHaveAttribute( 'aria-disabled', - 'true', + 'true' ); }); @@ -957,7 +951,7 @@ describe(Actions, () => { await waitFor(() => { expect(getByText(labelSubmitStatus)).toHaveAttribute( 'aria-disabled', - 'true', + 'true' ); }); }); @@ -968,9 +962,9 @@ describe(Actions, () => { ...mockAcl.actions, host: { ...mockAcl.actions.host, - comment: false, - }, - }, + comment: false + } + } }); act(() => { @@ -982,7 +976,7 @@ describe(Actions, () => { await waitFor(() => { expect(getByText(labelAddComment)).toHaveAttribute( 'aria-disabled', - 'true', + 'true' ); }); @@ -993,7 +987,7 @@ describe(Actions, () => { await waitFor(() => { expect(getByText(labelAddComment)).toHaveAttribute( 'aria-disabled', - 'true', + 'true' ); }); @@ -1015,16 +1009,16 @@ describe(Actions, () => { ...host, status: { name: 'UP', - severity_code: SeverityCode.Ok, - }, + severity_code: SeverityCode.Ok + } }, { ...service, status: { name: 'OK', - severity_code: SeverityCode.Ok, - }, - }, + severity_code: SeverityCode.Ok + } + } ]); }); diff --git a/www/front_src/src/Resources/ChecksIcon.tsx b/www/front_src/src/Resources/ChecksIcon.tsx index 34b65a041f4..249ef3def46 100644 --- a/www/front_src/src/Resources/ChecksIcon.tsx +++ b/www/front_src/src/Resources/ChecksIcon.tsx @@ -8,7 +8,7 @@ import { Tooltip } from '@mui/material'; import { Resource } from './models'; import { labelChecksDisabled, - labelOnlyPassiveChecksEnabled, + labelOnlyPassiveChecksEnabled } from './translatedLabels'; interface IconProps { @@ -31,7 +31,7 @@ type Props = Pick; const ChecksIcon = ({ active_checks, - passive_checks, + passive_checks }: Props): JSX.Element | null => { if (equals(passive_checks, false) && equals(active_checks, false)) { return ; diff --git a/www/front_src/src/Resources/Chip/index.tsx b/www/front_src/src/Resources/Chip/index.tsx index 143f597b7fb..ec85d21b984 100644 --- a/www/front_src/src/Resources/Chip/index.tsx +++ b/www/front_src/src/Resources/Chip/index.tsx @@ -10,8 +10,8 @@ const Chip = ({ icon, color }: Props): JSX.Element => { {icon} diff --git a/www/front_src/src/Resources/Details/Header.tsx b/www/front_src/src/Resources/Details/Header.tsx index 0ec7b3b7d03..aae419942ae 100644 --- a/www/front_src/src/Resources/Details/Header.tsx +++ b/www/front_src/src/Resources/Details/Header.tsx @@ -8,7 +8,7 @@ import { Theme, Link, Tooltip, - Skeleton, + Skeleton } from '@mui/material'; import makeStyles from '@mui/styles/makeStyles'; import CopyIcon from '@mui/icons-material/FileCopy'; @@ -22,7 +22,7 @@ import { StatusChip, SeverityCode, IconButton, - useCopyToClipboard, + useCopyToClipboard } from '@centreon/ui'; import { @@ -32,7 +32,7 @@ import { labelLinkCopied, labelViewLogs, labelViewReport, - labelSomethingWentWrong, + labelSomethingWentWrong } from '../translatedLabels'; import { ResourceUris } from '../models'; import { replaceBasename } from '../helpers'; @@ -49,11 +49,11 @@ interface MakeStylesProps { const useStyles = makeStyles((theme) => ({ containerIcons: { alignItems: 'center', - display: 'flex', + display: 'flex' }, divider: { borderColor: theme.palette.text.secondary, - margin: theme.spacing(1, 0.5), + margin: theme.spacing(1, 0.5) }, header: ({ displaySeverity }): CreateCSSProperties => ({ alignItems: 'center', @@ -63,46 +63,46 @@ const useStyles = makeStyles((theme) => ({ displaySeverity ? 'auto' : '' } auto minmax(0, 1fr) auto`, height: 43, - padding: theme.spacing(0, 2.5, 0, 1), + padding: theme.spacing(0, 2.5, 0, 1) }), parent: { alignItems: 'center', display: 'grid', gridGap: theme.spacing(1), - gridTemplateColumns: 'auto minmax(0, 1fr)', + gridTemplateColumns: 'auto minmax(0, 1fr)' }, report: { - marginLeft: theme.spacing(0.5), + marginLeft: theme.spacing(0.5) }, resourceName: { alignItems: 'center', columnGap: theme.spacing(1), display: 'grid', gridTemplateColumns: 'minmax(auto, min-content) min-content', - height: '100%', + height: '100%' }, resourceNameConfigurationIcon: { alignSelf: 'center', display: 'flex', - minWidth: theme.spacing(2.5), + minWidth: theme.spacing(2.5) }, resourceNameConfigurationLink: { - height: theme.spacing(2.5), + height: theme.spacing(2.5) }, resourceNameContainer: { display: 'flex', flexDirection: 'column', height: '100%', - width: '100%', + width: '100%' }, resourceNameTooltip: { - maxWidth: 'none', + maxWidth: 'none' }, truncated: { overflow: 'hidden', textOverflow: 'ellipsis', - whiteSpace: 'nowrap', - }, + whiteSpace: 'nowrap' + } })); const LoadingSkeleton = (): JSX.Element => ( @@ -122,14 +122,14 @@ type Props = { const Header = ({ details, onSelectParent }: Props): JSX.Element => { const classes = useStyles({ - displaySeverity: not(isNil(details?.severity)), + displaySeverity: not(isNil(details?.severity)) }); const { t } = useTranslation(); const navigate = useNavigate(); const { copy } = useCopyToClipboard({ errorMessage: t(labelSomethingWentWrong), - successMessage: t(labelLinkCopied), + successMessage: t(labelLinkCopied) }); const copyLink = (): Promise => copy(window.location.href); @@ -137,12 +137,12 @@ const Header = ({ details, onSelectParent }: Props): JSX.Element => { onSelectParent(details as ResourceDetails); const navigateToResourceUris = ( - category: keyof ResourceUris, + category: keyof ResourceUris ): (() => void) => { return (): void => { const url = replaceBasename({ endpoint: prop(category, resourceUris) || '', - newWord: '/', + newWord: '/' }); navigate(`${url}`); @@ -155,7 +155,7 @@ const Header = ({ details, onSelectParent }: Props): JSX.Element => { const resourceUris = path( ['links', 'uris'], - details, + details ) as ResourceUris; const resourceConfigurationUri = prop('configuration', resourceUris); diff --git a/www/front_src/src/Resources/Details/InfiniteScroll/index.tsx b/www/front_src/src/Resources/Details/InfiniteScroll/index.tsx index b96f69d5852..2a4e6c743c1 100644 --- a/www/front_src/src/Resources/Details/InfiniteScroll/index.tsx +++ b/www/front_src/src/Resources/Details/InfiniteScroll/index.tsx @@ -10,7 +10,7 @@ import { gt, equals, not, - length, + length } from 'ramda'; import { useTranslation } from 'react-i18next'; import { useAtomValue } from 'jotai/utils'; @@ -20,7 +20,7 @@ import { Fab, Fade, LinearProgress, - Tooltip, + Tooltip } from '@mui/material'; import makeStyles from '@mui/styles/makeStyles'; import KeyboardArrowUpIcon from '@mui/icons-material/KeyboardArrowUp'; @@ -40,34 +40,34 @@ const useStyles = makeStyles((theme) => ({ display: 'grid', height: '100%', justifyItems: 'center', - width: '100%', + width: '100%' }, entities: { display: 'grid', gridAutoFlow: 'row', gridGap: theme.spacing(1), gridTemplateColumns: 'repeat(auto-fit, minmax(320px, 1fr))', - width: '100%', + width: '100%' }, entitiesContainer: { paddingBottom: theme.spacing(0.5), - width: '100%', + width: '100%' }, fab: { bottom: 0, display: 'flex', justifyContent: 'flex-end', marginRight: theme.spacing(1.5), - position: 'sticky', + position: 'sticky' }, filter: { marginTop: theme.spacing(), - width: '100%', + width: '100%' }, progress: { height: theme.spacing(0.5), marginBottom: theme.spacing(1), - width: '100%', + width: '100%' }, scrollableContainer: { bottom: 0, @@ -77,8 +77,8 @@ const useStyles = makeStyles((theme) => ({ paddingTop: theme.spacing(1), position: 'absolute', right: 0, - top: 0, - }, + top: 0 + } })); interface Props { @@ -104,7 +104,7 @@ const InfiniteScrollContent = ({ preventReloadWhen = false, sendListingRequest, children, - details, + details }: Props): JSX.Element => { const classes = useStyles(); const { t } = useTranslation(); @@ -121,8 +121,8 @@ const InfiniteScrollContent = ({ const listEntities = ( { atPage } = { - atPage: page, - }, + atPage: page + } ): Promise> | undefined => { return sendListingRequest?.({ atPage }) .then((retrievedListing) => { @@ -214,7 +214,7 @@ const InfiniteScrollContent = ({ const scrollToTop = (): void => { scrollableContainerRef.current?.scrollTo({ behavior: gt(length(entities as Array), 200) ? 'auto' : 'smooth', - top: 0, + top: 0 }); preventScrollingRef.current = true; setIsScrolling(false); @@ -224,7 +224,7 @@ const InfiniteScrollContent = ({ action: loadMoreEvents, loading, maxPage, - page, + page }); return ( @@ -247,8 +247,8 @@ const InfiniteScrollContent = ({ [isEmpty, always()], [ T, - always(<>{children({ entities, infiniteScrollTriggerRef })}), - ], + always(<>{children({ entities, infiniteScrollTriggerRef })}) + ] ])(entities)}
@@ -280,12 +280,12 @@ const MemoizedInfiniteScrollContent = memoizeComponent({ 'loading', 'preventReloadWhen', 'filter', - 'details', - ], + 'details' + ] }) as typeof InfiniteScrollContent; const InfiniteScroll = ( - props: Props, + props: Props ): JSX.Element => { return ; }; diff --git a/www/front_src/src/Resources/Details/LoadingSkeleton.tsx b/www/front_src/src/Resources/Details/LoadingSkeleton.tsx index d6694d07ffd..8d31cd4437e 100644 --- a/www/front_src/src/Resources/Details/LoadingSkeleton.tsx +++ b/www/front_src/src/Resources/Details/LoadingSkeleton.tsx @@ -7,12 +7,12 @@ const useStyles = makeStyles((theme) => ({ loadingSkeleton: { display: 'grid', gridTemplateRows: 'repeat(3, 67px)', - rowGap: theme.spacing(2), - }, + rowGap: theme.spacing(2) + } })); const CardSkeleton = styled(LoadingSkeleton)(() => ({ - transform: 'none', + transform: 'none' })); const DetailsLoadingSkeleton = (): JSX.Element => { diff --git a/www/front_src/src/Resources/Details/NoResultsMessage.tsx b/www/front_src/src/Resources/Details/NoResultsMessage.tsx index 2cc5e171baa..77c2266922e 100644 --- a/www/front_src/src/Resources/Details/NoResultsMessage.tsx +++ b/www/front_src/src/Resources/Details/NoResultsMessage.tsx @@ -7,8 +7,8 @@ import { labelNoResultsFound } from '../translatedLabels'; const useStyles = makeStyles((theme) => ({ container: { - padding: theme.spacing(1), - }, + padding: theme.spacing(1) + } })); const NoResultsMessage = (): JSX.Element => { diff --git a/www/front_src/src/Resources/Details/detailsAtoms.ts b/www/front_src/src/Resources/Details/detailsAtoms.ts index 3cf0407bf29..ae0eaf8d182 100644 --- a/www/front_src/src/Resources/Details/detailsAtoms.ts +++ b/www/front_src/src/Resources/Details/detailsAtoms.ts @@ -10,7 +10,7 @@ import { ResourceDetails, ServicesTabParameters, TabParameters, - ResourceDetailsAtom, + ResourceDetailsAtom } from './models'; import { detailsTabId } from './tabs'; import { CustomTimePeriod, TimePeriodId } from './tabs/Graph/models'; @@ -18,14 +18,14 @@ import { TabId } from './tabs/models'; export const panelWidthStorageAtom = atomWithStorage( 'centreon-resource-status-details-21.10', - 550, + 550 ); export const openDetailsTabIdAtom = atom(0); export const selectedResourceUuidAtom = atom(undefined); export const detailsAtom = atom(undefined); export const tabParametersAtom = atom({}); export const defaultSelectedTimePeriodIdAtom = atom( - undefined, + undefined ); export const defaultSelectedCustomTimePeriodAtom = atom< CustomTimePeriod | undefined @@ -40,9 +40,9 @@ export const selectResourceDerivedAtom = atom( parentResourceId: resource?.parent?.id, parentResourceType: resource?.parent?.type, resourceId: resource?.id, - resourcesDetailsEndpoint: resource?.links?.endpoints?.details, + resourcesDetailsEndpoint: resource?.links?.endpoints?.details }); - }, + } ); export const clearSelectedResourceDerivedAtom = atom(null, (_, set) => { @@ -54,14 +54,14 @@ export const setServicesTabParametersDerivedAtom = atom( null, (get, set, parameters: ServicesTabParameters) => { set(tabParametersAtom, { ...get(tabParametersAtom), services: parameters }); - }, + } ); export const setGraphTabParametersDerivedAtom = atom( null, (get, set, parameters: GraphTabParameters) => { set(tabParametersAtom, { ...get(tabParametersAtom), graph: parameters }); - }, + } ); export const selectedResourcesDetailsAtom = @@ -72,7 +72,7 @@ export const selectedResourceDetailsEndpointDerivedAtom = atom((get) => { const resourceDetailsEndPoint = replaceBasename({ endpoint: selectedResourceDetails?.resourcesDetailsEndpoint || '', - newWord: './', + newWord: './' }); if (!isNil(selectedResourceDetails?.parentResourceId)) { diff --git a/www/front_src/src/Resources/Details/index.test.tsx b/www/front_src/src/Resources/Details/index.test.tsx index 5795adc5b30..3fd243a15d6 100644 --- a/www/front_src/src/Resources/Details/index.test.tsx +++ b/www/front_src/src/Resources/Details/index.test.tsx @@ -14,7 +14,7 @@ import { setUrlQueryParameters, getUrlQueryParameters, screen, - getSearchQueryParameterValue, + getSearchQueryParameterValue } from '@centreon/ui'; import { refreshIntervalAtom, userAtom } from '@centreon/ui-context'; @@ -75,7 +75,7 @@ import { labelGraph, labelNotificationStatus, labelCategories, - labelExportToCSV, + labelExportToCSV } from '../translatedLabels'; import Context, { ResourceContext } from '../testUtils/Context'; import useListing from '../Listing/useListing'; @@ -101,8 +101,8 @@ jest.mock('../icons/Downtime'); Object.defineProperty(navigator, 'clipboard', { value: { - writeText: () => Promise.resolve(), - }, + writeText: () => Promise.resolve() + } }); jest.spyOn(navigator.clipboard, 'writeText'); @@ -111,8 +111,8 @@ jest.mock('@visx/visx', () => { return { ...(jest.requireActual('@visx/visx') as jest.Mocked), Responsive: { - ParentSize: ({ children }): JSX.Element => children({ width: 500 }), - }, + ParentSize: ({ children }): JSX.Element => children({ width: 500 }) + } }; }); @@ -125,16 +125,16 @@ const groups = [ { configuration_uri: '/centreon/main.php?p=60102&o=c&hg_id=53', id: 0, - name: 'Linux-servers', - }, + name: 'Linux-servers' + } ]; const categories = [ { configuration_uri: '/centreon/main.php?p=60102&o=c&hg_id=53', id: 0, - name: 'Windows', - }, + name: 'Windows' + } ]; const serviceDetailsUrlParameters = { @@ -143,7 +143,7 @@ const serviceDetailsUrlParameters = { 'api/latest/monitoring/resources/hosts/1/services/1', tab: 'details', type: 'service', - uuid: 'h1-s1', + uuid: 'h1-s1' }; const serviceDetailsGraphUrlParameters = { @@ -152,7 +152,7 @@ const serviceDetailsGraphUrlParameters = { parentType: 'host', tab: 'graph', type: 'service', - uuid: 'h1-s1', + uuid: 'h1-s1' }; const serviceDetailsTimelineUrlParameters = { @@ -161,7 +161,7 @@ const serviceDetailsTimelineUrlParameters = { parentType: 'host', tab: 'timeline', type: 'service', - uuid: 'h1-s1', + uuid: 'h1-s1' }; const hostDetailsServicesUrlParameters = { @@ -170,14 +170,14 @@ const hostDetailsServicesUrlParameters = { parentType: 'service', tab: 'services', type: 'host', - uuid: 'h1', + uuid: 'h1' }; const metaserviceDetailsMetricsUrlParameters = { id: 1, tab: 'metrics', type: 'metaservice', - uuid: 'ms1', + uuid: 'ms1' }; const serviceDetailsNotificationUrlParameters = { @@ -186,7 +186,7 @@ const serviceDetailsNotificationUrlParameters = { parentType: 'host', tab: 'notification', type: 'service', - uuid: 'h1-s1', + uuid: 'h1-s1' }; const retrievedNotificationContacts = { @@ -194,18 +194,18 @@ const retrievedNotificationContacts = { { alias: 'admin admin', configuration_uri: '/centreon/main.php?p=60301&o=c&cg_id=1', - name: 'admin', - }, + name: 'admin' + } ], contacts: [ { alias: 'Guest Guest', configuration_uri: '/centreon/main.php?p=60301&o=c&contact_id=1', email: 'localhost@centreon.com', - name: 'Guest', - }, + name: 'Guest' + } ], - is_notification_enabled: true, + is_notification_enabled: true }; const retrievedDetails = { @@ -215,7 +215,7 @@ const retrievedDetails = { comment: 'Acknowledged by Admin', entry_time: '2020-03-18T18:57:59Z', is_persistent: true, - is_sticky: true, + is_sticky: true }, active_checks: false, alias: 'Central-Centreon', @@ -228,15 +228,15 @@ const retrievedDetails = { comment: 'First downtime set by Admin', end_time: '2020-01-18T18:57:59Z', entry_time: '2020-01-18T17:57:59Z', - start_time: '2020-01-18T17:57:59Z', + start_time: '2020-01-18T17:57:59Z' }, { author_name: 'admin', comment: 'Second downtime set by Admin', end_time: '2020-02-18T18:57:59Z', entry_time: '2020-01-18T17:57:59Z', - start_time: '2020-02-18T17:57:59Z', - }, + start_time: '2020-02-18T17:57:59Z' + } ], duration: '22m', execution_time: 0.070906, @@ -258,17 +258,17 @@ const retrievedDetails = { notification_policy: 'notification_policy', performance_graph: 'performance_graph', timeline: 'timeline', - timeline_download: 'timeline/download', + timeline_download: 'timeline/download' }, externals: { action_url: undefined, - notes: undefined, + notes: undefined }, uris: { configuration: undefined, logs: undefined, - reporting: undefined, - }, + reporting: undefined + } }, monitoring_server_name: 'Poller', name: 'Central', @@ -279,23 +279,23 @@ const retrievedDetails = { links: { endpoints: { performance_graph: 'performance_graph', - timeline: 'timeline', + timeline: 'timeline' }, externals: { action_url: undefined, - notes: undefined, + notes: undefined }, uris: { configuration: undefined, logs: undefined, - reporting: undefined, - }, + reporting: undefined + } }, name: 'Centreon', short_type: 'h', status: { name: 'S1', severity_code: 1 }, type: resourceHostType, - uuid: 'h1', + uuid: 'h1' }, passive_checks: false, percent_state_change: 3.5, @@ -305,12 +305,12 @@ const retrievedDetails = { timezone: 'Europe/Paris', tries: '3/3 (Hard)', type: resourceServiceType, - uuid: resourceServiceUuid, + uuid: resourceServiceUuid }; const retrievedPerformanceGraphData = { global: { - title: 'Ping graph', + title: 'Ping graph' }, metrics: [ { @@ -321,27 +321,27 @@ const retrievedPerformanceGraphData = { ds_color_line: '#fff', ds_filled: false, ds_legend: 'Round-Trip-Time Average', - ds_transparency: 80, + ds_transparency: 80 }, legend: 'Round-Trip-Time Average (ms)', maximum_value: 2456, metric: 'rta', minimum_value: null, - unit: 'ms', - }, + unit: 'ms' + } ], times: [ '2020-06-19T07:30:00Z', '2020-06-20T06:55:00Z', - '2020-06-23T06:55:00Z', - ], + '2020-06-23T06:55:00Z' + ] }; const retrievedTimeline = { meta: { limit: 10, page: 1, - total: 5, + total: 5 }, result: [ { @@ -350,10 +350,10 @@ const retrievedTimeline = { id: 1, status: { name: 'UP', - severity_code: 5, + severity_code: 5 }, tries: 1, - type: 'event', + type: 'event' }, { content: 'INITIAL HOST STATE: Centreon-Server;DOWN;HARD;3;', @@ -361,114 +361,114 @@ const retrievedTimeline = { id: 2, status: { name: 'DOWN', - severity_code: 1, + severity_code: 1 }, tries: 3, - type: 'event', + type: 'event' }, { contact: { - name: 'admin', + name: 'admin' }, content: 'My little notification', date: '2020-01-20T07:40:00Z', id: 3, - type: 'notification', + type: 'notification' }, { contact: { - name: 'admin', + name: 'admin' }, content: 'My little ack', date: '2020-01-19T07:35:00Z', id: 4, - type: 'acknowledgement', + type: 'acknowledgement' }, { contact: { - name: 'admin', + name: 'admin' }, content: 'My little dt', date: '2020-01-19T07:30:00Z', end_date: '2020-01-21T07:33:00Z', id: 5, start_date: '2020-01-19T07:30:00Z', - type: 'downtime', + type: 'downtime' }, { contact: { - name: 'super_admin', + name: 'super_admin' }, content: 'My little ongoing dt', date: '2020-01-19T06:57:00Z', end_date: null, id: 6, start_date: '2020-01-19T07:30:00Z', - type: 'downtime', + type: 'downtime' }, { contact: { - name: 'admin', + name: 'admin' }, content: 'My little comment', date: '2020-01-19T06:55:00Z', end_date: '2020-01-21T07:33:00Z', id: 7, start_date: '2020-01-19T07:30:00Z', - type: 'comment', + type: 'comment' }, { contact: { - name: 'admin', + name: 'admin' }, content: 'My little comment two', date: '2020-01-18T06:55:00Z', end_date: null, id: 8, start_date: null, - type: 'comment', + type: 'comment' }, { contact: { - name: 'admin', + name: 'admin' }, content: 'My little comment three', date: '2020-01-01T06:55:00Z', end_date: null, id: 9, start_date: null, - type: 'comment', + type: 'comment' }, { contact: { - name: 'admin', + name: 'admin' }, content: 'My little comment four', date: '2019-06-10T06:55:00Z', end_date: null, id: 10, start_date: null, - type: 'comment', + type: 'comment' }, { contact: { - name: 'admin', + name: 'admin' }, content: 'My little comment five', date: '2018-10-10T06:55:00Z', end_date: null, id: 11, start_date: null, - type: 'comment', - }, - ], + type: 'comment' + } + ] }; const retrievedServices = { meta: { limit: 10, page: 1, - total: 2, + total: 2 }, result: [ { @@ -477,23 +477,23 @@ const retrievedServices = { information: 'OK - 127.0.0.1 rta 0ms lost 0%', links: { endpoints: { - performance_graph: 'ping-performance', + performance_graph: 'ping-performance' }, externals: { - action: 'action', + action: 'action' }, uris: { - configuration: 'configuration', - }, + configuration: 'configuration' + } }, name: 'Ping', short_type: 's', status: { name: 'Ok', - severity_code: 5, + severity_code: 5 }, type: 'service', - uuid: 'h1-s3', + uuid: 'h1-s3' }, { duration: '21m', @@ -501,22 +501,22 @@ const retrievedServices = { information: 'No output', links: { externals: { - action: 'action', + action: 'action' }, uris: { - configuration: 'configuration', - }, + configuration: 'configuration' + } }, name: 'Disk', short_type: 's', status: { name: 'Unknown', - severity_code: 6, + severity_code: 6 }, type: 'service', - uuid: 'h1-s4', - }, - ], + uuid: 'h1-s4' + } + ] }; const retrievedFilters = { @@ -524,10 +524,10 @@ const retrievedFilters = { meta: { limit: 30, page: 1, - total: 0, + total: 0 }, - result: [], - }, + result: [] + } }; const currentDateIsoString = '2020-01-21T06:00:00.000Z'; @@ -539,9 +539,9 @@ const mockedParametersDataTimeLineDownload = { field: 'date', values: { $gt: start, - $lt: currentDateIsoString, - }, - }, + $lt: currentDateIsoString + } + } ], lists: [ { @@ -551,10 +551,10 @@ const mockedParametersDataTimeLineDownload = { 'notification', 'comment', 'acknowledgement', - 'downtime', - ], - }, - ], + 'downtime' + ] + } + ] }; let context: ResourceContext; @@ -569,7 +569,7 @@ const DetailsTest = (): JSX.Element => { context = { ...listingState, ...detailState, - ...filterState, + ...filterState } as ResourceContext; return ( @@ -584,7 +584,7 @@ const DetailsTest = (): JSX.Element => { const mockUser = { isExportButtonEnabled: true, locale: 'en', - timezone: 'Europe/Paris', + timezone: 'Europe/Paris' }; const mockRefreshInterval = 60; @@ -592,7 +592,7 @@ const DetailsWithJotai = (): JSX.Element => ( @@ -607,7 +607,7 @@ const mockedNavigate = jest.fn(); jest.mock('react-router-dom', () => ({ ...jest.requireActual('react-router-dom'), - useNavigate: (): jest.Mock => mockedNavigate, + useNavigate: (): jest.Mock => mockedNavigate })); Storage.prototype.getItem = mockedLocalStorageGetItem; @@ -632,8 +632,8 @@ describe(Details, () => { setUrlQueryParameters([ { name: 'details', - value: serviceDetailsUrlParameters, - }, + value: serviceDetailsUrlParameters + } ]); const { getByText, queryByText, getAllByText, findByText } = @@ -642,7 +642,7 @@ describe(Details, () => { await waitFor(() => { expect(mockedAxios.get).toHaveBeenCalledWith( './api/latest/monitoring/resources/hosts/1/services/1' as string, - expect.anything(), + expect.anything() ); }); @@ -663,7 +663,7 @@ describe(Details, () => { expect(getByText('OK - 127.0.0.1 rta 0.99ms lost 0%')).toBeInTheDocument(); expect(getByText('OK - 127.0.0.1 rta 0.98ms lost 0%')).toBeInTheDocument(); expect( - queryByText('OK - 127.0.0.1 rta 0.97ms lost 0%'), + queryByText('OK - 127.0.0.1 rta 0.97ms lost 0%') ).not.toBeInTheDocument(); fireEvent.click(getByText(labelMore)); @@ -681,7 +681,7 @@ describe(Details, () => { expect(getByText(labelAcknowledgedBy)).toBeInTheDocument(); expect( - getByText(`Admin ${labelAt} 03/18/2020 7:57 PM`), + getByText(`Admin ${labelAt} 03/18/2020 7:57 PM`) ).toBeInTheDocument(); expect(getByText('Acknowledged by Admin')); @@ -728,8 +728,8 @@ describe(Details, () => { expect(getByText(labelPerformanceData)).toBeInTheDocument(); expect( getByText( - 'rta=0.025ms;200.000;400.000;0; rtmax=0.061ms;;;; rtmin=0.015ms;;;; pl=0%;20;50;0;100', - ), + 'rta=0.025ms;200.000;400.000;0; rtmax=0.061ms;;;; rtmin=0.015ms;;;; pl=0%;20;50;0;100' + ) ).toBeInTheDocument(); expect(getByText(labelCommand)).toBeInTheDocument(); @@ -739,7 +739,7 @@ describe(Details, () => { it.each([ [label1Day, '2020-01-20T06:00:00.000Z', 20], [label7Days, '2020-01-14T06:00:00.000Z', 100], - [label31Days, '2019-12-21T06:00:00.000Z', 500], + [label31Days, '2019-12-21T06:00:00.000Z', 500] ])( `queries performance graphs and timelines with %p period when the Graph tab is selected and "Display events" option is activated`, async (period, startIsoString, timelineEventsLimit) => { @@ -754,8 +754,8 @@ describe(Details, () => { setUrlQueryParameters([ { name: 'details', - value: serviceDetailsGraphUrlParameters, - }, + value: serviceDetailsGraphUrlParameters + } ]); const { getByText, findByText } = renderDetails(); @@ -769,7 +769,7 @@ describe(Details, () => { await waitFor(() => { expect(mockedAxios.get).toHaveBeenCalledWith( `${retrievedDetails.links.endpoints.performance_graph}?start=${startIsoString}&end=${currentDateIsoString}`, - expect.anything(), + expect.anything() ); }); @@ -788,17 +788,17 @@ describe(Details, () => { field: 'date', values: { $gt: startIsoString, - $lt: currentDateIsoString, - }, - }, - ], - }, - }, + $lt: currentDateIsoString + } + } + ] + } + } }), - expect.anything(), + expect.anything() ); }); - }, + } ); it('displays event annotations when the corresponding switch is triggered and the Graph tab is clicked', async () => { @@ -806,14 +806,14 @@ describe(Details, () => { .mockResolvedValueOnce({ data: retrievedDetails }) .mockResolvedValueOnce({ data: retrievedPerformanceGraphData }) .mockResolvedValueOnce({ - data: retrievedTimeline, + data: retrievedTimeline }); setUrlQueryParameters([ { name: 'details', - value: serviceDetailsGraphUrlParameters, - }, + value: serviceDetailsGraphUrlParameters + } ]); const { findAllByLabelText, queryByLabelText, getByText, findByText } = @@ -833,7 +833,7 @@ describe(Details, () => { const commentAnnotations = await findAllByLabelText(labelComment); const acknowledgementAnnotations = await findAllByLabelText( - labelAcknowledgement, + labelAcknowledgement ); const downtimeAnnotations = await findAllByLabelText(labelDowntime); @@ -848,8 +848,8 @@ describe(Details, () => { setUrlQueryParameters([ { name: 'details', - value: serviceDetailsUrlParameters, - }, + value: serviceDetailsUrlParameters + } ]); const { getByLabelText } = renderDetails(); @@ -862,8 +862,8 @@ describe(Details, () => { await waitFor(() => expect(navigator.clipboard.writeText).toHaveBeenCalledWith( - retrievedDetails.command_line, - ), + retrievedDetails.command_line + ) ); }); @@ -873,7 +873,7 @@ describe(Details, () => { mockedAxios.get.mockResolvedValueOnce({ data: retrievedTimeline }); setUrlQueryParameters([ - { name: 'details', value: serviceDetailsTimelineUrlParameters }, + { name: 'details', value: serviceDetailsTimelineUrlParameters } ]); const { getByText, getAllByLabelText, baseElement } = renderDetails(); @@ -891,21 +891,21 @@ describe(Details, () => { field: 'date', values: { $gt: '2020-01-20T06:00:00.000Z', - $lt: '2020-01-21T06:00:00.000Z', - }, - }, + $lt: '2020-01-21T06:00:00.000Z' + } + } ], lists: [ { field: 'type', - values: getTypeIds(), - }, - ], - }, - }, + values: getTypeIds() + } + ] + } + } }), - expect.anything(), - ), + expect.anything() + ) ); await waitFor(() => expect(getByText(labelToday)).toBeInTheDocument()); @@ -915,14 +915,14 @@ describe(Details, () => { expect(getByText('UP')).toBeInTheDocument(); expect(getByText('Tries: 1')).toBeInTheDocument(); expect( - getByText('INITIAL HOST STATE: Centreon-Server;UP;HARD;1;'), + getByText('INITIAL HOST STATE: Centreon-Server;UP;HARD;1;') ).toBeInTheDocument(); expect(getByText('Tuesday, January 21, 2020 9:35 AM')).toBeInTheDocument(); expect(getByText('DOWN')).toBeInTheDocument(); expect(getByText('Tries: 3')).toBeInTheDocument(); expect( - getByText('INITIAL HOST STATE: Centreon-Server;DOWN;HARD;3;'), + getByText('INITIAL HOST STATE: Centreon-Server;DOWN;HARD;3;') ).toBeInTheDocument(); expect(getByText(labelYesterday)).toBeInTheDocument(); @@ -938,13 +938,13 @@ describe(Details, () => { expect( getByText( - 'From Sunday, January 19, 2020 8:30 AM To Tuesday, January 21, 2020 8:33 AM', - ), + 'From Sunday, January 19, 2020 8:30 AM To Tuesday, January 21, 2020 8:33 AM' + ) ).toBeInTheDocument(); expect(getByText('My little dt')); expect( - getByText('From Sunday, January 19, 2020 8:30 AM'), + getByText('From Sunday, January 19, 2020 8:30 AM') ).toBeInTheDocument(); expect(getByText('My little ongoing dt')); @@ -953,7 +953,7 @@ describe(Details, () => { expect(getByText(labelLastWeek)).toBeInTheDocument(); expect( - getByText('From January 12, 2020 to January 18, 2020'), + getByText('From January 12, 2020 to January 18, 2020') ).toBeInTheDocument(); expect(getByText('Saturday, January 18, 2020 7:55 AM')).toBeInTheDocument(); @@ -961,7 +961,7 @@ describe(Details, () => { expect(getByText(labelLastMonth)).toBeInTheDocument(); expect( - getByText('From December 15, 2019 to January 11, 2020'), + getByText('From December 15, 2019 to January 11, 2020') ).toBeInTheDocument(); expect(getByText('Wednesday, January 1, 2020 7:55 AM')).toBeInTheDocument(); @@ -969,7 +969,7 @@ describe(Details, () => { expect(getByText(labelLastYear)).toBeInTheDocument(); expect( - getByText('From December 16, 2018 to December 14, 2019'), + getByText('From December 16, 2018 to December 14, 2019') ).toBeInTheDocument(); expect(getByText('Monday, June 10, 2019 8:55 AM')).toBeInTheDocument(); @@ -979,12 +979,12 @@ describe(Details, () => { expect(getByText('From December 15, 2018')).toBeInTheDocument(); expect( - getByText('Wednesday, October 10, 2018 8:55 AM'), + getByText('Wednesday, October 10, 2018 8:55 AM') ).toBeInTheDocument(); expect(getByText('My little comment five')); const removeEventIcon = baseElement.querySelectorAll( - 'svg[class*="deleteIcon"]', + 'svg[class*="deleteIcon"]' )[0]; fireEvent.click(removeEventIcon); @@ -1002,21 +1002,21 @@ describe(Details, () => { field: 'date', values: { $gt: '2020-01-20T06:00:00.000Z', - $lt: '2020-01-21T06:00:00.000Z', - }, - }, + $lt: '2020-01-21T06:00:00.000Z' + } + } ], lists: [ { field: 'type', - values: reject(equals('event'))(getTypeIds()), - }, - ], - }, - }, + values: reject(equals('event'))(getTypeIds()) + } + ] + } + } }), - expect.anything(), - ), + expect.anything() + ) ); }); @@ -1028,14 +1028,14 @@ describe(Details, () => { ...retrievedDetails.links, uris: { logs: 'logs', - reporting: 'reporting', - }, - }, - }, + reporting: 'reporting' + } + } + } }); setUrlQueryParameters([ - { name: 'details', value: serviceDetailsUrlParameters }, + { name: 'details', value: serviceDetailsUrlParameters } ]); const { getByLabelText, getByTestId } = renderDetails(); @@ -1045,7 +1045,7 @@ describe(Details, () => { }); await waitFor(() => - expect(getByLabelText(labelViewLogs)).toBeInTheDocument(), + expect(getByLabelText(labelViewLogs)).toBeInTheDocument() ); expect(getByLabelText(labelViewReport)).toBeInTheDocument(); @@ -1062,10 +1062,10 @@ describe(Details, () => { it('sets the details according to the details URL query parameter when given', async () => { mockedAxios.get .mockResolvedValueOnce({ - data: retrievedDetails, + data: retrievedDetails }) .mockResolvedValue({ - data: retrievedPerformanceGraphData, + data: retrievedPerformanceGraphData }); const retrievedServiceDetails = { @@ -1075,21 +1075,21 @@ describe(Details, () => { tab: 'details', tabParameters: { graph: { - options: defaultGraphOptions, + options: defaultGraphOptions }, services: { - options: defaultGraphOptions, - }, + options: defaultGraphOptions + } }, type: 'service', - uuid: 'h3-s2', + uuid: 'h3-s2' }; setUrlQueryParameters([ { name: 'details', - value: retrievedServiceDetails, - }, + value: retrievedServiceDetails + } ]); const { getByText } = renderDetails(); @@ -1097,7 +1097,7 @@ describe(Details, () => { await waitFor(() => { expect(mockedAxios.get).toHaveBeenCalledWith( './api/latest/monitoring/resources/hosts/1/services/2' as string, - expect.anything(), + expect.anything() ); }); @@ -1107,7 +1107,7 @@ describe(Details, () => { const tabFromUrlQueryParameters = path( ['details', 'tab'], - getUrlQueryParameters(), + getUrlQueryParameters() ); await waitFor(() => { @@ -1125,7 +1125,7 @@ describe(Details, () => { expect(updatedDetailsFromQueryParameters).toEqual({ customTimePeriod: { end: '2020-01-21T06:00:00.000Z', - start: '2020-01-14T06:00:00.000Z', + start: '2020-01-14T06:00:00.000Z' }, id: 2, resourcesDetailsEndpoint: @@ -1138,35 +1138,35 @@ describe(Details, () => { displayEvents: { id: 'displayEvents', label: labelDisplayEvents, - value: false, - }, - }, + value: false + } + } }, services: { options: { displayEvents: { id: 'displayEvents', label: labelDisplayEvents, - value: false, - }, - }, - }, + value: false + } + } + } }, - uuid: 'h3-s2', + uuid: 'h3-s2' }); }); }); it('copies the current URL when the copy resource link button is clicked', async () => { mockedAxios.get.mockResolvedValueOnce({ - data: retrievedDetails, + data: retrievedDetails }); setUrlQueryParameters([ { name: 'details', - value: serviceDetailsUrlParameters, - }, + value: serviceDetailsUrlParameters + } ]); const { getByLabelText } = renderDetails(); @@ -1176,18 +1176,18 @@ describe(Details, () => { }); await waitFor(() => - expect(getByLabelText(labelCopyLink)).toBeInTheDocument(), + expect(getByLabelText(labelCopyLink)).toBeInTheDocument() ); act(() => { fireEvent.click( - getByLabelText(labelCopyLink).firstElementChild as HTMLElement, + getByLabelText(labelCopyLink).firstElementChild as HTMLElement ); }); await waitFor(() => { expect(navigator.clipboard.writeText).toHaveBeenCalledWith( - window.location.href, + window.location.href ); }); }); @@ -1197,21 +1197,21 @@ describe(Details, () => { .mockResolvedValueOnce({ data: { ...retrievedDetails, - type: 'host', - }, + type: 'host' + } }) .mockResolvedValueOnce({ - data: retrievedServices, + data: retrievedServices }) .mockResolvedValueOnce({ - data: { ...retrievedDetails, type: 'service' }, + data: { ...retrievedDetails, type: 'service' } }); setUrlQueryParameters([ { name: 'details', - value: hostDetailsServicesUrlParameters, - }, + value: hostDetailsServicesUrlParameters + } ]); const { getByText, queryByText } = renderDetails(); @@ -1234,10 +1234,10 @@ describe(Details, () => { { field: 'h.name', values: { - $eq: retrievedDetails.name, - }, - }, - ], + $eq: retrievedDetails.name + } + } + ] }, serviceCategories: [], serviceGroups: [], @@ -1245,9 +1245,9 @@ describe(Details, () => { serviceSeverityLevels: [], states: [], statusTypes: [], - statuses: [], + statuses: [] }), - expect.anything(), + expect.anything() ); await waitFor(() => expect(getByText('Ok')).toBeInTheDocument()); @@ -1267,7 +1267,7 @@ describe(Details, () => { await waitFor(() => { expect(mockedAxios.get).toHaveBeenCalledWith( `./api/latest/monitoring/resources/services/${pingService.id}`, - expect.anything(), + expect.anything() ); }); @@ -1281,24 +1281,24 @@ describe(Details, () => { .mockResolvedValueOnce({ data: { ...retrievedDetails, - type: 'host', - }, + type: 'host' + } }) .mockResolvedValueOnce({ - data: retrievedServices, + data: retrievedServices }) .mockResolvedValueOnce({ - data: retrievedPerformanceGraphData, + data: retrievedPerformanceGraphData }) .mockResolvedValueOnce({ - data: retrievedPerformanceGraphData, + data: retrievedPerformanceGraphData }); setUrlQueryParameters([ { name: 'details', - value: serviceDetailsGraphUrlParameters, - }, + value: serviceDetailsGraphUrlParameters + } ]); const { findByText, getByText } = renderDetails(); @@ -1314,7 +1314,7 @@ describe(Details, () => { await waitFor(() => { expect(mockedAxios.get).toHaveBeenCalledWith( 'ping-performance?start=2020-01-14T06:00:00.000Z&end=2020-01-21T06:00:00.000Z', - cancelTokenRequestParam, + cancelTokenRequestParam ); }); }); @@ -1327,8 +1327,8 @@ describe(Details, () => { setUrlQueryParameters([ { name: 'details', - value: serviceDetailsGraphUrlParameters, - }, + value: serviceDetailsGraphUrlParameters + } ]); renderDetails(); @@ -1338,27 +1338,27 @@ describe(Details, () => { await waitFor(() => { expect(mockedAxios.get).toHaveBeenCalledWith( `${retrievedDetails.links.endpoints.performance_graph}?start=2020-01-20T06:00:00.000Z&end=2020-01-21T06:00:00.000Z`, - cancelTokenRequestParam, + cancelTokenRequestParam ); }); act(() => { context.changeCustomTimePeriod?.({ date: new Date(startISOString), - property: CustomTimePeriodProperty.start, + property: CustomTimePeriodProperty.start }); }); act(() => { context.changeCustomTimePeriod?.({ date: new Date(endISOString), - property: CustomTimePeriodProperty.end, + property: CustomTimePeriodProperty.end }); }); await waitFor(() => { expect(mockedAxios.get).toHaveBeenCalledWith( `${retrievedDetails.links.endpoints.performance_graph}?start=${startISOString}&end=${endISOString}`, - cancelTokenRequestParam, + cancelTokenRequestParam ); }); }); @@ -1372,8 +1372,8 @@ describe(Details, () => { setUrlQueryParameters([ { name: 'details', - value: serviceDetailsGraphUrlParameters, - }, + value: serviceDetailsGraphUrlParameters + } ]); const { getByText } = renderDetails(); @@ -1384,20 +1384,20 @@ describe(Details, () => { act(() => { context.changeCustomTimePeriod?.({ date: new Date(startISOString), - property: CustomTimePeriodProperty.start, + property: CustomTimePeriodProperty.start }); }); act(() => { context.changeCustomTimePeriod?.({ date: new Date(endISOString), - property: CustomTimePeriodProperty.end, + property: CustomTimePeriodProperty.end }); }); await waitFor(() => { expect(mockedAxios.get).toHaveBeenCalledWith( `${retrievedDetails.links.endpoints.performance_graph}?start=2020-01-20T06:00:00.000Z&end=2020-01-21T06:00:00.000Z`, - cancelTokenRequestParam, + cancelTokenRequestParam ); }); @@ -1412,7 +1412,7 @@ describe(Details, () => { await waitFor(() => { expect(mockedAxios.get).toHaveBeenCalledWith( `${retrievedDetails.links.endpoints.performance_graph}?start=2020-01-14T06:00:00.000Z&end=2020-01-21T06:00:00.000Z`, - cancelTokenRequestParam, + cancelTokenRequestParam ); }); }); @@ -1432,10 +1432,10 @@ describe(Details, () => { end: '2021-11-02T21:00:00.000Z', start: '2021-11-02T21:00:00.000Z', timelineLimit: 20, - xAxisTickFormat: 'LT', - }, - }, - }, + xAxisTickFormat: 'LT' + } + } + } ]); const { getByLabelText, getByText } = renderDetails(); @@ -1449,7 +1449,7 @@ describe(Details, () => { it.each([ [labelForward, '2020-01-20T18:00:00.000Z', '2020-01-21T18:00:00.000Z'], - [labelBackward, '2020-01-19T18:00:00.000Z', '2020-01-20T18:00:00.000Z'], + [labelBackward, '2020-01-19T18:00:00.000Z', '2020-01-20T18:00:00.000Z'] ])( `queries performance graphs with a custom timeperiod when the Graph tab is selected and the "%p" icon is clicked`, async (iconLabel, startISOString, endISOString) => { @@ -1461,8 +1461,8 @@ describe(Details, () => { setUrlQueryParameters([ { name: 'details', - value: serviceDetailsGraphUrlParameters, - }, + value: serviceDetailsGraphUrlParameters + } ]); const { getByLabelText } = renderDetails(); @@ -1470,26 +1470,26 @@ describe(Details, () => { act(() => { context.changeCustomTimePeriod?.({ date: new Date('2020-01-20T06:00:00.000Z'), - property: CustomTimePeriodProperty.start, + property: CustomTimePeriodProperty.start }); }); act(() => { context.changeCustomTimePeriod?.({ date: new Date('2020-01-21T06:00:00.000Z'), - property: CustomTimePeriodProperty.end, + property: CustomTimePeriodProperty.end }); }); await waitFor(() => { expect(mockedAxios.get).toHaveBeenCalledWith( `${retrievedDetails.links.endpoints.performance_graph}?start=2020-01-20T06:00:00.000Z&end=2020-01-21T06:00:00.000Z`, - cancelTokenRequestParam, + cancelTokenRequestParam ); }); await waitFor(() => - expect(getByLabelText(iconLabel)).toBeInTheDocument(), + expect(getByLabelText(iconLabel)).toBeInTheDocument() ); userEvent.click(getByLabelText(iconLabel)); @@ -1497,10 +1497,10 @@ describe(Details, () => { await waitFor(() => { expect(mockedAxios.get).toHaveBeenCalledWith( `${retrievedDetails.links.endpoints.performance_graph}?start=${startISOString}&end=${endISOString}`, - cancelTokenRequestParam, + cancelTokenRequestParam ); }); - }, + } ); it('displays retrieved metrics when the selected Resource is a meta service and the metrics tab is selected', async () => { @@ -1510,7 +1510,7 @@ describe(Details, () => { meta: { limit: 10, page: 1, - total: 1, + total: 1 }, result: [ { @@ -1518,27 +1518,27 @@ describe(Details, () => { name: 'pl', resource: service, unit: '%', - value: 3, - }, - ], + value: 3 + } + ] }; mockedAxios.get .mockResolvedValueOnce({ data: { ...retrievedDetails, - type: 'metaservice', - }, + type: 'metaservice' + } }) .mockResolvedValueOnce({ - data: retrievedMetrics, + data: retrievedMetrics }); setUrlQueryParameters([ { name: 'details', - value: metaserviceDetailsMetricsUrlParameters, - }, + value: metaserviceDetailsMetricsUrlParameters + } ]); const { getByText } = renderDetails(); @@ -1561,8 +1561,8 @@ describe(Details, () => { setUrlQueryParameters([ { name: 'details', - value: serviceDetailsGraphUrlParameters, - }, + value: serviceDetailsGraphUrlParameters + } ]); const { getByLabelText, getByText } = renderDetails(); @@ -1570,7 +1570,7 @@ describe(Details, () => { await waitFor(() => { expect(mockedAxios.get).toHaveBeenCalledWith( `${retrievedDetails.links.endpoints.performance_graph}?start=2020-01-20T06:00:00.000Z&end=2020-01-21T06:00:00.000Z`, - cancelTokenRequestParam, + cancelTokenRequestParam ); }); @@ -1584,14 +1584,14 @@ describe(Details, () => { it('filters on a group when the corresponding chip is clicked and the Details tab is selected', async () => { mockedAxios.get.mockResolvedValueOnce({ - data: retrievedDetails, + data: retrievedDetails }); setUrlQueryParameters([ { name: 'details', - value: serviceDetailsUrlParameters, - }, + value: serviceDetailsUrlParameters + } ]); const { getByLabelText } = renderDetails(); @@ -1601,7 +1601,7 @@ describe(Details, () => { }); await waitFor(() => - expect(getByLabelText('Linux-servers Chip')).toBeInTheDocument(), + expect(getByLabelText('Linux-servers Chip')).toBeInTheDocument() ); userEvent.hover(getByLabelText('Linux-servers Chip')); @@ -1609,7 +1609,7 @@ describe(Details, () => { await waitFor(() => { expect(context.getCriteriaValue?.(CriteriaNames.serviceGroups)).toEqual([ - { id: 0, name: 'Linux-servers' }, + { id: 0, name: 'Linux-servers' } ]); }); }); @@ -1623,17 +1623,17 @@ describe(Details, () => { uris: { configuration: '/configuration', logs: '/logs', - reporting: '/reporting', - }, - }, - }, + reporting: '/reporting' + } + } + } }); setUrlQueryParameters([ { name: 'details', - value: serviceDetailsUrlParameters, - }, + value: serviceDetailsUrlParameters + } ]); const { getByText, getByLabelText } = renderDetails(); @@ -1641,52 +1641,52 @@ describe(Details, () => { await waitFor(() => { expect(mockedAxios.get).toHaveBeenCalledWith( './api/latest/monitoring/resources/hosts/1/services/1', - expect.anything(), + expect.anything() ); }); await waitFor(() => - expect(getByText(retrievedDetails.name)).toBeInTheDocument(), + expect(getByText(retrievedDetails.name)).toBeInTheDocument() ); userEvent.hover(getByText(retrievedDetails.name)); expect( - getByLabelText(`${labelConfigure}_${retrievedDetails.name}`), + getByLabelText(`${labelConfigure}_${retrievedDetails.name}`) ).toBeInTheDocument(); expect( - getByLabelText(`${labelConfigure}_${retrievedDetails.name}`), + getByLabelText(`${labelConfigure}_${retrievedDetails.name}`) ).toHaveAttribute('href', '/configuration'); }); it('populates details tiles with values from localStorage if available', async () => { mockedAxios.get.mockResolvedValueOnce({ - data: retrievedDetails, + data: retrievedDetails }); setUrlQueryParameters([ { name: 'details', - value: serviceDetailsUrlParameters, - }, + value: serviceDetailsUrlParameters + } ]); const { getByText, queryByText } = renderDetails(); mockedLocalStorageGetItem.mockReturnValue( - JSON.stringify([labelMonitoringServer, labelStatusInformation]), + JSON.stringify([labelMonitoringServer, labelStatusInformation]) ); await waitFor(() => { expect(mockedAxios.get).toHaveBeenCalledWith( './api/latest/monitoring/resources/hosts/1/services/1', - expect.anything(), + expect.anything() ); }); await waitFor(() => - expect(getByText(labelMonitoringServer)).toBeInTheDocument(), + expect(getByText(labelMonitoringServer)).toBeInTheDocument() ); expect(getByText(labelStatusInformation)).toBeInTheDocument(); @@ -1706,8 +1706,8 @@ describe(Details, () => { setUrlQueryParameters([ { name: 'details', - value: serviceDetailsTimelineUrlParameters, - }, + value: serviceDetailsTimelineUrlParameters + } ]); const { getByText } = renderDetails(); @@ -1725,27 +1725,27 @@ describe(Details, () => { field: 'date', values: { $gt: '2020-01-20T06:00:00.000Z', - $lt: '2020-01-21T06:00:00.000Z', - }, - }, + $lt: '2020-01-21T06:00:00.000Z' + } + } ], lists: [ { field: 'type', - values: getTypeIds(), - }, - ], - }, - }, + values: getTypeIds() + } + ] + } + } }), - cancelTokenRequestParam, - ), + cancelTokenRequestParam + ) ); await waitFor(() => expect( - screen.getByText('INITIAL HOST STATE: Centreon-Server;UP;HARD;1;'), - ).toBeInTheDocument(), + screen.getByText('INITIAL HOST STATE: Centreon-Server;UP;HARD;1;') + ).toBeInTheDocument() ); userEvent.click(getByText(label7Days) as HTMLElement); @@ -1763,21 +1763,21 @@ describe(Details, () => { field: 'date', values: { $gt: '2020-01-14T06:00:00.000Z', - $lt: '2020-01-21T06:00:00.000Z', - }, - }, + $lt: '2020-01-21T06:00:00.000Z' + } + } ], lists: [ { field: 'type', - values: getTypeIds(), - }, - ], - }, - }, + values: getTypeIds() + } + ] + } + } }), - expect.anything(), - ), + expect.anything() + ) ); userEvent.click(getByText(labelGraph)); @@ -1785,7 +1785,7 @@ describe(Details, () => { await waitFor(() => { expect(mockedAxios.get).toHaveBeenCalledWith( `${retrievedDetails.links.endpoints.performance_graph}?start=2020-01-14T06:00:00.000Z&end=2020-01-21T06:00:00.000Z`, - cancelTokenRequestParam, + cancelTokenRequestParam ); }); }); @@ -1793,14 +1793,14 @@ describe(Details, () => { it('displays contacts and contact groups when the notification tab is clicked', async () => { mockedAxios.get.mockResolvedValueOnce({ data: retrievedDetails }); mockedAxios.get.mockResolvedValueOnce({ - data: retrievedNotificationContacts, + data: retrievedNotificationContacts }); setUrlQueryParameters([ { name: 'details', - value: serviceDetailsNotificationUrlParameters, - }, + value: serviceDetailsNotificationUrlParameters + } ]); const { getByText, getByTestId } = renderDetails(); @@ -1808,7 +1808,7 @@ describe(Details, () => { await waitFor(() => { expect(mockedAxios.get).toHaveBeenCalledWith( retrievedDetails.links.endpoints.notification_policy, - expect.anything(), + expect.anything() ); }); @@ -1836,11 +1836,11 @@ describe(Details, () => { const timelineDownloadEndpoint = path( ['links', 'endpoints', 'timeline_download'], - retrievedDetails, + retrievedDetails ); const parameters = getSearchQueryParameterValue( - mockedParametersDataTimeLineDownload, + mockedParametersDataTimeLineDownload ); const mockedOpen = jest.fn(); @@ -1849,8 +1849,8 @@ describe(Details, () => { setUrlQueryParameters([ { name: 'details', - value: serviceDetailsTimelineUrlParameters, - }, + value: serviceDetailsTimelineUrlParameters + } ]); const { getByTestId } = renderDetails(); @@ -1864,7 +1864,7 @@ describe(Details, () => { expect(mockedOpen).toHaveBeenCalledWith( `${timelineDownloadEndpoint}?search=${JSON.stringify(parameters)}`, 'noopener', - 'noreferrer', + 'noreferrer' ); }); }); diff --git a/www/front_src/src/Resources/Details/index.tsx b/www/front_src/src/Resources/Details/index.tsx index d13b05df928..73f1b88b62d 100644 --- a/www/front_src/src/Resources/Details/index.tsx +++ b/www/front_src/src/Resources/Details/index.tsx @@ -20,7 +20,7 @@ import { detailsAtom, openDetailsTabIdAtom, panelWidthStorageAtom, - selectResourceDerivedAtom, + selectResourceDerivedAtom } from './detailsAtoms'; export interface DetailsSectionProps { @@ -78,8 +78,8 @@ const Details = (): JSX.Element | null => { ({ condition }) => condition({ acknowledged: !isNil(acknowledgement), - in_downtime: pipe(defaultTo([]), isEmpty, not)(downtimes), - }), + in_downtime: pipe(defaultTo([]), isEmpty, not)(downtimes) + }) ); if (isNil(foundColorCondition)) { diff --git a/www/front_src/src/Resources/Details/models.ts b/www/front_src/src/Resources/Details/models.ts index 4be9cbf7cf3..edc0aec4995 100644 --- a/www/front_src/src/Resources/Details/models.ts +++ b/www/front_src/src/Resources/Details/models.ts @@ -7,7 +7,7 @@ import { ResourceLinks, NamedEntity, ResourceType, - Severity, + Severity } from '../models'; import { CustomTimePeriod, TimePeriodId } from './tabs/Graph/models'; diff --git a/www/front_src/src/Resources/Details/tabs/CompactStatusChip.tsx b/www/front_src/src/Resources/Details/tabs/CompactStatusChip.tsx index 61b78e39658..df8f5270ee0 100644 --- a/www/front_src/src/Resources/Details/tabs/CompactStatusChip.tsx +++ b/www/front_src/src/Resources/Details/tabs/CompactStatusChip.tsx @@ -6,8 +6,8 @@ const useStyles = makeStyles((theme) => ({ root: { fontSize: theme.typography.body2.fontSize, height: 18, - lineHeight: theme.spacing(2), - }, + lineHeight: theme.spacing(2) + } })); const CompactStatusChip = (props: StatusChipProps): JSX.Element => { diff --git a/www/front_src/src/Resources/Details/tabs/Details/Card.tsx b/www/front_src/src/Resources/Details/tabs/Details/Card.tsx index b8d6015a639..ac658618fc7 100644 --- a/www/front_src/src/Resources/Details/tabs/Details/Card.tsx +++ b/www/front_src/src/Resources/Details/tabs/Details/Card.tsx @@ -5,8 +5,8 @@ import makeStyles from '@mui/styles/makeStyles'; const useStyles = makeStyles((theme) => ({ content: { - padding: theme.spacing(1, 2, 2, 2), - }, + padding: theme.spacing(1, 2, 2, 2) + } })); interface Props { diff --git a/www/front_src/src/Resources/Details/tabs/Details/CommandLine/index.tsx b/www/front_src/src/Resources/Details/tabs/Details/CommandLine/index.tsx index ad5161d7186..e5689dee978 100644 --- a/www/front_src/src/Resources/Details/tabs/Details/CommandLine/index.tsx +++ b/www/front_src/src/Resources/Details/tabs/Details/CommandLine/index.tsx @@ -7,22 +7,22 @@ import { getCommandsWithArguments } from './utils'; const useStyles = makeStyles((theme) => ({ argument: { - marginRight: theme.spacing(0.5), + marginRight: theme.spacing(0.5) }, argumentWithValue: { display: 'flex', - marginLeft: theme.spacing(1), + marginLeft: theme.spacing(1) }, command: { - fontWeight: 'bold', + fontWeight: 'bold' }, pipe: { - marginRight: theme.spacing(1), + marginRight: theme.spacing(1) }, pipedCommand: { display: 'flex', - flexDirection: 'row', - }, + flexDirection: 'row' + } })); interface Props { diff --git a/www/front_src/src/Resources/Details/tabs/Details/CommandLine/utils/index.test.ts b/www/front_src/src/Resources/Details/tabs/Details/CommandLine/utils/index.test.ts index dbe2499110c..f6213e82a46 100644 --- a/www/front_src/src/Resources/Details/tabs/Details/CommandLine/utils/index.test.ts +++ b/www/front_src/src/Resources/Details/tabs/Details/CommandLine/utils/index.test.ts @@ -4,8 +4,8 @@ describe(getCommandsWithArguments, () => { it('parses the command and the associated arguments', () => { expect( getCommandsWithArguments( - "/usr/lib/centreon/plugins/centreon_ruckus_scg_snmp.pl --plugin=network::ruckus::scg::snmp::plugin --mode=memory --hostname=snmpsim.centreon.training --snmp-version='2c' --snmp-community='ruckus_scg' --warning-usage='80' --critical-usage='90' -d -p 50 | grep warning", - ), + "/usr/lib/centreon/plugins/centreon_ruckus_scg_snmp.pl --plugin=network::ruckus::scg::snmp::plugin --mode=memory --hostname=snmpsim.centreon.training --snmp-version='2c' --snmp-community='ruckus_scg' --warning-usage='80' --critical-usage='90' -d -p 50 | grep warning" + ) ).toEqual([ { arguments: [ @@ -17,14 +17,14 @@ describe(getCommandsWithArguments, () => { ["--warning-usage='80'"], ["--critical-usage='90'"], ['-d'], - ['-p', '50'], + ['-p', '50'] ], - command: '/usr/lib/centreon/plugins/centreon_ruckus_scg_snmp.pl', + command: '/usr/lib/centreon/plugins/centreon_ruckus_scg_snmp.pl' }, { arguments: [['warning']], - command: 'grep', - }, + command: 'grep' + } ]); }); }); diff --git a/www/front_src/src/Resources/Details/tabs/Details/CommandLine/utils/index.ts b/www/front_src/src/Resources/Details/tabs/Details/CommandLine/utils/index.ts index c72d57997c2..d104e0c3118 100644 --- a/www/front_src/src/Resources/Details/tabs/Details/CommandLine/utils/index.ts +++ b/www/front_src/src/Resources/Details/tabs/Details/CommandLine/utils/index.ts @@ -6,7 +6,7 @@ import { pipe, head, startsWith, - not, + not } from 'ramda'; import commandParser from 'string-argv'; @@ -20,7 +20,7 @@ interface CommandWithArguments { } const getCommandsWithArguments = ( - commandLine: string, + commandLine: string ): Array => { const pipedCommands = commandLine.split('|'); @@ -49,7 +49,7 @@ const getCommandWithArguments = (commandLine: string): CommandWithArguments => { const argumentWithValues = args.map((argument) => { const foundShortArgument = find( pipe(head, equals(argument)), - shortArgumentsWithValues, + shortArgumentsWithValues ); if (!isNil(foundShortArgument)) { @@ -68,7 +68,7 @@ const getCommandWithArguments = (commandLine: string): CommandWithArguments => { return { arguments: commandArguments, - command, + command }; }; diff --git a/www/front_src/src/Resources/Details/tabs/Details/CommandLine/utils/index.tsx b/www/front_src/src/Resources/Details/tabs/Details/CommandLine/utils/index.tsx index 02391813d85..b5fcb493d9e 100644 --- a/www/front_src/src/Resources/Details/tabs/Details/CommandLine/utils/index.tsx +++ b/www/front_src/src/Resources/Details/tabs/Details/CommandLine/utils/index.tsx @@ -32,7 +32,7 @@ const getCommandWithArguments = (commandLine: string): CommandWithArguments => { const argumentWithValues = args.map((argument) => { const foundShortArgument = find( pipe(head, equals(argument)), - shortArgumentsWithValues, + shortArgumentsWithValues ); if (!isNil(foundShortArgument)) { @@ -51,7 +51,7 @@ const getCommandWithArguments = (commandLine: string): CommandWithArguments => { return { arguments: commandArguments, - command, + command }; }; diff --git a/www/front_src/src/Resources/Details/tabs/Details/DetailsCard/AcknowledegmentCard.tsx b/www/front_src/src/Resources/Details/tabs/Details/DetailsCard/AcknowledegmentCard.tsx index 96961903426..bbf1e02bb4d 100644 --- a/www/front_src/src/Resources/Details/tabs/Details/DetailsCard/AcknowledegmentCard.tsx +++ b/www/front_src/src/Resources/Details/tabs/Details/DetailsCard/AcknowledegmentCard.tsx @@ -21,8 +21,8 @@ const AcknowledgementCard = ({ details }: Props): JSX.Element => { commentLine={details.acknowledgement?.comment || ''} contentLines={[ `${details.acknowledgement?.author_name} ${t(labelAt)} ${toDateTime( - details.acknowledgement?.entry_time || '', - )}`, + details.acknowledgement?.entry_time || '' + )}` ]} title={t(labelAcknowledgedBy)} /> diff --git a/www/front_src/src/Resources/Details/tabs/Details/DetailsCard/CommandLineCard.tsx b/www/front_src/src/Resources/Details/tabs/Details/DetailsCard/CommandLineCard.tsx index 0188d2d7899..09c261cdd10 100644 --- a/www/front_src/src/Resources/Details/tabs/Details/DetailsCard/CommandLineCard.tsx +++ b/www/front_src/src/Resources/Details/tabs/Details/DetailsCard/CommandLineCard.tsx @@ -12,7 +12,7 @@ import { labelCommand, labelCommandCopied, labelCopy, - labelSomethingWentWrong, + labelSomethingWentWrong } from '../../../../translatedLabels'; interface Props { @@ -21,8 +21,8 @@ interface Props { const useStyles = makeStyles((theme) => ({ commandLineCard: { - padding: theme.spacing(1, 2, 2, 2), - }, + padding: theme.spacing(1, 2, 2, 2) + } })); const CommandLineCard = ({ details }: Props): JSX.Element => { @@ -31,7 +31,7 @@ const CommandLineCard = ({ details }: Props): JSX.Element => { const { copy } = useCopyToClipboard({ errorMessage: t(labelSomethingWentWrong), - successMessage: t(labelCommandCopied), + successMessage: t(labelCommandCopied) }); const copyCommandLine = (): Promise => diff --git a/www/front_src/src/Resources/Details/tabs/Details/DetailsCard/DetailsLine.tsx b/www/front_src/src/Resources/Details/tabs/Details/DetailsCard/DetailsLine.tsx index 2cebd1b551f..054f45eb406 100644 --- a/www/front_src/src/Resources/Details/tabs/Details/DetailsCard/DetailsLine.tsx +++ b/www/front_src/src/Resources/Details/tabs/Details/DetailsCard/DetailsLine.tsx @@ -8,8 +8,8 @@ const useStyles = makeStyles((theme) => ({ fontSize: theme.typography.body2.fontSize, overflow: 'hidden', textOverflow: 'ellipsis', - whiteSpace: 'nowrap', - }, + whiteSpace: 'nowrap' + } })); interface Props { @@ -27,7 +27,7 @@ const DetailsLine = ({ line }: Props): JSX.Element => { className={classes.lineText} lineHeight={1} style={{ - maxWidth: width || 'unset', + maxWidth: width || 'unset' }} > {line} diff --git a/www/front_src/src/Resources/Details/tabs/Details/DetailsCard/DowntimesCard.tsx b/www/front_src/src/Resources/Details/tabs/Details/DetailsCard/DowntimesCard.tsx index 683392b16f2..82f15993198 100644 --- a/www/front_src/src/Resources/Details/tabs/Details/DetailsCard/DowntimesCard.tsx +++ b/www/front_src/src/Resources/Details/tabs/Details/DetailsCard/DowntimesCard.tsx @@ -7,7 +7,7 @@ import { useLocaleDateTimeFormat } from '@centreon/ui'; import { labelDowntimeDuration, labelFrom, - labelTo, + labelTo } from '../../../../translatedLabels'; import DowntimeChip from '../../../../Chip/Downtime'; import StateCard from '../StateCard'; @@ -20,8 +20,8 @@ interface Props { const useStyles = makeStyles((theme) => ({ downtimes: { display: 'grid', - rowGap: theme.spacing(1), - }, + rowGap: theme.spacing(1) + } })); const DowntimesCard = ({ details }: Props): JSX.Element => { @@ -38,8 +38,8 @@ const DowntimesCard = ({ details }: Props): JSX.Element => { contentLines={[ ...[ { prefix: t(labelFrom), time: start_time }, - { prefix: t(labelTo), time: end_time }, - ].map(({ prefix, time }) => `${prefix} ${toDateTime(time)}`), + { prefix: t(labelTo), time: end_time } + ].map(({ prefix, time }) => `${prefix} ${toDateTime(time)}`) ]} key={`downtime-${start_time}-${end_time}`} title={t(labelDowntimeDuration)} diff --git a/www/front_src/src/Resources/Details/tabs/Details/DetailsCard/GroupChip.tsx b/www/front_src/src/Resources/Details/tabs/Details/DetailsCard/GroupChip.tsx index dab932561e1..4304c152563 100644 --- a/www/front_src/src/Resources/Details/tabs/Details/DetailsCard/GroupChip.tsx +++ b/www/front_src/src/Resources/Details/tabs/Details/DetailsCard/GroupChip.tsx @@ -17,31 +17,31 @@ import { Group, Category } from '../../../models'; const useStyles = makeStyles((theme) => ({ chip: { alignSelf: 'center', - display: 'flex', + display: 'flex' }, chipHovered: { backgroundColor: theme.palette.primary.main, display: 'flex', gap: theme.spacing(0.25), - gridArea: '1/1', + gridArea: '1/1' }, chipIcon: { - color: theme.palette.common.white, + color: theme.palette.common.white }, chipLabelContainer: { display: 'grid', justifyItems: 'center', minWidth: theme.spacing(7), - overflow: 'hidden', + overflow: 'hidden' }, chipLabelContent: { gridArea: '1/1', maxWidth: theme.spacing(14), minWidth: theme.spacing(8), overflow: 'hidden', - textAlign: 'center', + textAlign: 'center' }, - chipLabelContentHovered: { color: 'transparent' }, + chipLabelContentHovered: { color: 'transparent' } })); interface Props { @@ -56,7 +56,7 @@ const GroupChip = ({ group, type }: Props): JSX.Element => { const [isHovered, setIsHovered] = useState(false); const setCriteriaAndNewFilter = useUpdateAtom( - setCriteriaAndNewFilterDerivedAtom, + setCriteriaAndNewFilterDerivedAtom ); const mouseEnter = (): void => { @@ -70,7 +70,7 @@ const GroupChip = ({ group, type }: Props): JSX.Element => { const filterByGroup = useCallback((): void => { setCriteriaAndNewFilter({ name: type, - value: [group], + value: [group] }); }, [group, type]); @@ -91,7 +91,7 @@ const GroupChip = ({ group, type }: Props): JSX.Element => { diff --git a/www/front_src/src/Resources/Details/tabs/Details/DetailsCard/GroupChips.tsx b/www/front_src/src/Resources/Details/tabs/Details/DetailsCard/GroupChips.tsx index 1c9479f14f6..d3034251d91 100644 --- a/www/front_src/src/Resources/Details/tabs/Details/DetailsCard/GroupChips.tsx +++ b/www/front_src/src/Resources/Details/tabs/Details/DetailsCard/GroupChips.tsx @@ -17,8 +17,8 @@ interface Props { const useStyles = makeStyles((theme) => ({ groups: { display: 'flex', - padding: theme.spacing(1), - }, + padding: theme.spacing(1) + } })); const GroupChips = ({ groups = [], title, getType }: Props): JSX.Element => { diff --git a/www/front_src/src/Resources/Details/tabs/Details/DetailsCard/PercentStateChangeCard.tsx b/www/front_src/src/Resources/Details/tabs/Details/DetailsCard/PercentStateChangeCard.tsx index b7b25ae557a..e491d1f97ef 100644 --- a/www/front_src/src/Resources/Details/tabs/Details/DetailsCard/PercentStateChangeCard.tsx +++ b/www/front_src/src/Resources/Details/tabs/Details/DetailsCard/PercentStateChangeCard.tsx @@ -6,7 +6,7 @@ import FlappingIcon from '@mui/icons-material/SwapCalls'; import { labelResourceFlapping, - labelFlapping, + labelFlapping } from '../../../../translatedLabels'; import { ResourceDetails } from '../../../models'; @@ -17,8 +17,8 @@ const useStyles = makeStyles((theme) => ({ alignItems: 'center', columnGap: theme.spacing(1), display: 'grid', - gridTemplateColumns: 'auto min-content', - }, + gridTemplateColumns: 'auto min-content' + } })); interface Props { diff --git a/www/front_src/src/Resources/Details/tabs/Details/DetailsCard/SeverityCard.tsx b/www/front_src/src/Resources/Details/tabs/Details/DetailsCard/SeverityCard.tsx index edb1e96f097..0b7c57d8139 100644 --- a/www/front_src/src/Resources/Details/tabs/Details/DetailsCard/SeverityCard.tsx +++ b/www/front_src/src/Resources/Details/tabs/Details/DetailsCard/SeverityCard.tsx @@ -12,17 +12,17 @@ const useStyles = makeStyles((theme) => ({ container: { display: 'flex', flexDirection: 'column', - padding: theme.spacing(1, 2, 2), + padding: theme.spacing(1, 2, 2) }, item: { alignItems: 'center', display: 'flex', - flexDirection: 'row', + flexDirection: 'row' }, label: { display: 'flex', - width: '10%', - }, + width: '10%' + } })); interface Props { diff --git a/www/front_src/src/Resources/Details/tabs/Details/DetailsCard/cards.tsx b/www/front_src/src/Resources/Details/tabs/Details/DetailsCard/cards.tsx index fbcca0bb868..1ef296bc2b1 100644 --- a/www/front_src/src/Resources/Details/tabs/Details/DetailsCard/cards.tsx +++ b/www/front_src/src/Resources/Details/tabs/Details/DetailsCard/cards.tsx @@ -27,7 +27,7 @@ import { labelCommand, labelLastCheckWithOkStatus, labelCategories, - labelSeverity, + labelSeverity } from '../../../../translatedLabels'; import { ResourceDetails } from '../../../models'; import ExpandableCard from '../ExpandableCard'; @@ -65,7 +65,7 @@ const getDetailCardLines = ({ toDateTime, t, expandedCards, - changeExpandedCards, + changeExpandedCards }: DetailCardLineProps): Array => { const checksDisabled = details.active_checks === false && details.passive_checks === false; @@ -87,118 +87,118 @@ const getDetailCardLines = ({ ), shouldBeDisplayed: !isNil(details.information), title: labelStatusInformation, - xs: 12, + xs: 12 }, { isCustomCard: true, line: , shouldBeDisplayed: !isEmpty(details.downtimes), title: labelDowntimeDuration, - xs: 12, + xs: 12 }, { isCustomCard: true, line: , shouldBeDisplayed: !isNil(details.acknowledgement), title: labelAcknowledgement, - xs: 12, + xs: 12 }, { isCustomCard: true, line: , shouldBeDisplayed: !isNil(details.severity), title: labelSeverity, - xs: 12, + xs: 12 }, { line: , shouldBeDisplayed: !isNil(details.fqdn), title: labelFqdn, - xs: 12, + xs: 12 }, { line: , shouldBeDisplayed: !isNil(details.alias), - title: labelAlias, + title: labelAlias }, { line: , shouldBeDisplayed: !isNil(details.monitoring_server_name), - title: labelMonitoringServer, + title: labelMonitoringServer }, { line: , shouldBeDisplayed: !isNil(details.timezone) && !isEmpty(details.timezone), - title: labelTimezone, + title: labelTimezone }, { line: , shouldBeDisplayed: !isNil(details.duration), - title: labelCurrentStatusDuration, + title: labelCurrentStatusDuration }, { line: , shouldBeDisplayed: !isNil(details.last_status_change), - title: labelLastStatusChange, + title: labelLastStatusChange }, { line: , shouldBeDisplayed: !isNil(details.last_check), - title: labelLastCheck, + title: labelLastCheck }, { line: , shouldBeDisplayed: !isNil(details.last_time_with_no_issue) && !equals(details.status.severity_code, SeverityCode.Ok), - title: labelLastCheckWithOkStatus, + title: labelLastCheckWithOkStatus }, { line: ( ), shouldBeDisplayed: displayChecksIcon, - title: labelCheck, + title: labelCheck }, { line: , shouldBeDisplayed: !isNil(details.next_check), - title: labelNextCheck, + title: labelNextCheck }, { line: , shouldBeDisplayed: !isNil(details.execution_time), - title: labelCheckDuration, + title: labelCheckDuration }, { line: , shouldBeDisplayed: !isNil(details.latency), - title: labelLatency, + title: labelLatency }, { line: , shouldBeDisplayed: !isNil(details.percent_state_change), - title: labelStatusChangePercentage, + title: labelStatusChangePercentage }, { line: , shouldBeDisplayed: !isNil(details.last_notification), - title: labelLastNotification, + title: labelLastNotification }, { line: , shouldBeDisplayed: !isNil(details.notification_number), - title: labelCurrentNotificationNumber, + title: labelCurrentNotificationNumber }, { line: , shouldBeDisplayed: !isNil(details.calculation_type), - title: labelCalculationType, + title: labelCalculationType }, { line: , shouldBeDisplayed: !isNil(details.calculation_type), - title: labelCalculationType, + title: labelCalculationType }, { isCustomCard: true, @@ -215,7 +215,7 @@ const getDetailCardLines = ({ ), shouldBeDisplayed: !isEmpty(details.groups), title: labelGroups, - xs: 12, + xs: 12 }, { isCustomCard: true, @@ -232,7 +232,7 @@ const getDetailCardLines = ({ ), shouldBeDisplayed: !isEmpty(details.categories), title: labelCategories, - xs: 12, + xs: 12 }, { isCustomCard: true, @@ -246,15 +246,15 @@ const getDetailCardLines = ({ ), shouldBeDisplayed: !isEmpty(details.performance_data), title: labelPerformanceData, - xs: 12, + xs: 12 }, { isCustomCard: true, line: , shouldBeDisplayed: !isNil(details.command_line), title: labelCommand, - xs: 12, - }, + xs: 12 + } ]; }; diff --git a/www/front_src/src/Resources/Details/tabs/Details/DetailsCard/index.tsx b/www/front_src/src/Resources/Details/tabs/Details/DetailsCard/index.tsx index 6e4c26e50e6..2338abfa45d 100644 --- a/www/front_src/src/Resources/Details/tabs/Details/DetailsCard/index.tsx +++ b/www/front_src/src/Resources/Details/tabs/Details/DetailsCard/index.tsx @@ -5,17 +5,17 @@ import Card from '../Card'; const useStyles = makeStyles((theme) => ({ active: { - color: theme.palette.success.main, + color: theme.palette.success.main }, container: { - overflow: 'hidden', + overflow: 'hidden' }, title: { display: 'flex', gridGap: theme.spacing(1), overflow: 'hidden', - textOverflow: 'ellipsis', - }, + textOverflow: 'ellipsis' + } })); interface Props { @@ -27,7 +27,7 @@ interface Props { const DetailsCard = ({ title, line, - isCustomCard = false, + isCustomCard = false }: Props): JSX.Element => { const classes = useStyles(); diff --git a/www/front_src/src/Resources/Details/tabs/Details/ExpandableCard.tsx b/www/front_src/src/Resources/Details/tabs/Details/ExpandableCard.tsx index 5b170e876c6..29455421e33 100644 --- a/www/front_src/src/Resources/Details/tabs/Details/ExpandableCard.tsx +++ b/www/front_src/src/Resources/Details/tabs/Details/ExpandableCard.tsx @@ -22,7 +22,7 @@ const useStyles = makeStyles((theme) => { const getStatusBackgroundColor = (severityCode): string => getStatusColors({ severityCode, - theme, + theme }).backgroundColor; return { @@ -30,12 +30,12 @@ const useStyles = makeStyles((theme) => { ...(severityCode && { borderColor: getStatusBackgroundColor(severityCode), borderStyle: 'solid', - borderWidth: 2, - }), + borderWidth: 2 + }) }), title: ({ severityCode }): CreateCSSProperties => ({ - ...(severityCode && { color: getStatusBackgroundColor(severityCode) }), - }), + ...(severityCode && { color: getStatusBackgroundColor(severityCode) }) + }) }; }); @@ -52,7 +52,7 @@ const ExpandableCard = ({ content, severityCode, expandedCard, - changeExpandedCards, + changeExpandedCards }: Props): JSX.Element => { const classes = useStyles({ severityCode }); const { t } = useTranslation(); diff --git a/www/front_src/src/Resources/Details/tabs/Details/SelectableResourceName.tsx b/www/front_src/src/Resources/Details/tabs/Details/SelectableResourceName.tsx index 94c847f1c4b..230dae148b7 100644 --- a/www/front_src/src/Resources/Details/tabs/Details/SelectableResourceName.tsx +++ b/www/front_src/src/Resources/Details/tabs/Details/SelectableResourceName.tsx @@ -6,8 +6,8 @@ const useStyles = makeStyles(() => ({ cursor: 'pointer', overflow: 'hidden', textOverflow: 'ellipsis', - whiteSpace: 'nowrap', - }, + whiteSpace: 'nowrap' + } })); interface Props { @@ -19,7 +19,7 @@ interface Props { const SelectableResourceName = ({ name, onSelect, - variant = 'body1', + variant = 'body1' }: Props): JSX.Element => { const classes = useStyles(); diff --git a/www/front_src/src/Resources/Details/tabs/Details/ServiceCard.tsx b/www/front_src/src/Resources/Details/tabs/Details/ServiceCard.tsx index b4ca11eaf8a..49f9ffb47df 100644 --- a/www/front_src/src/Resources/Details/tabs/Details/ServiceCard.tsx +++ b/www/front_src/src/Resources/Details/tabs/Details/ServiceCard.tsx @@ -21,18 +21,18 @@ const useStyles = makeStyles((theme) => ({ description: { display: 'grid', gridAutoFlow: 'row', - gridGap: theme.spacing(1), + gridGap: theme.spacing(1) }, serviceCard: { - padding: theme.spacing(1), + padding: theme.spacing(1) }, serviceDetails: { alignItems: 'center', display: 'grid', gridAutoFlow: 'columns', gridGap: theme.spacing(2), - gridTemplateColumns: 'auto 1fr auto', - }, + gridTemplateColumns: 'auto 1fr auto' + } })); const ServiceCard = ({ @@ -40,7 +40,7 @@ const ServiceCard = ({ status, information, subInformation, - onSelect, + onSelect }: Props): JSX.Element => { const classes = useStyles(); const { t } = useTranslation(); diff --git a/www/front_src/src/Resources/Details/tabs/Details/SortableCards/Content.tsx b/www/front_src/src/Resources/Details/tabs/Details/SortableCards/Content.tsx index c11de3f1275..d78dc8d0010 100644 --- a/www/front_src/src/Resources/Details/tabs/Details/SortableCards/Content.tsx +++ b/www/front_src/src/Resources/Details/tabs/Details/SortableCards/Content.tsx @@ -18,19 +18,19 @@ const useStyles = makeStyles((theme) => ({ alignItems: 'center', cursor: isDragging ? 'grabbing' : 'grab', display: 'flex', - height: '100%', + height: '100%' }), paper: { - height: '100%', + height: '100%' }, tile: { '&:hover': { - boxShadow: theme.shadows[3], + boxShadow: theme.shadows[3] }, display: 'grid', gridTemplateColumns: 'min-content auto', - height: '100%', - }, + height: '100%' + } })); interface ContentProps extends CardsLayout { @@ -51,7 +51,7 @@ const Content = ({ line, xs, isCustomCard, - width, + width }: ContentProps): JSX.Element => { const classes = useStyles({ isDragging }); const { t } = useTranslation(); diff --git a/www/front_src/src/Resources/Details/tabs/Details/SortableCards/index.tsx b/www/front_src/src/Resources/Details/tabs/Details/SortableCards/index.tsx index ac1eb7d8eb2..8bb3c973698 100644 --- a/www/front_src/src/Resources/Details/tabs/Details/SortableCards/index.tsx +++ b/www/front_src/src/Resources/Details/tabs/Details/SortableCards/index.tsx @@ -15,7 +15,7 @@ import { propEq, remove, difference, - uniq, + uniq } from 'ramda'; import { useAtom } from 'jotai'; @@ -25,7 +25,7 @@ import { SortableItems, useLocaleDateTimeFormat, RootComponentProps, - useMemoComponent, + useMemoComponent } from '@centreon/ui'; import getDetailCardLines, { DetailCardLine } from '../DetailsCard/cards'; @@ -47,11 +47,11 @@ interface MergeDefaultAndStoredCardsProps { const mergeDefaultAndStoredCards = ({ defaultCards, - storedCards, + storedCards }: MergeDefaultAndStoredCardsProps): Array => { const differenceBetweenDefaultAndStoredCards = difference( defaultCards, - storedCards, + storedCards ); return uniq([...storedCards, ...differenceBetweenDefaultAndStoredCards]); @@ -66,7 +66,7 @@ const SortableCards = ({ panelWidth, details }: Props): JSX.Element => { const changeExpandedCards = ({ action, - card, + card }: ChangeExpandedCardsProps): void => { if (equals(action, ExpandAction.add)) { setExpandedCards(append(card, expandedCards)); @@ -83,7 +83,7 @@ const SortableCards = ({ panelWidth, details }: Props): JSX.Element => { details, expandedCards, t, - toDateTime, + toDateTime }); const allDetailsCardsTitle = pluck('title', allDetailsCards); @@ -92,21 +92,21 @@ const SortableCards = ({ panelWidth, details }: Props): JSX.Element => { ? allDetailsCardsTitle : mergeDefaultAndStoredCards({ defaultCards: allDetailsCardsTitle, - storedCards: storedDetailsCards, + storedCards: storedDetailsCards }); const cards = map( (title) => ({ id: title, width: panelWidth, - ...(find(propEq('title', title), allDetailsCards) as DetailCardLine), + ...(find(propEq('title', title), allDetailsCards) as DetailCardLine) }), - defaultDetailsCardsLayout, + defaultDetailsCardsLayout ); const displayedCards = filter( ({ shouldBeDisplayed }) => shouldBeDisplayed, - cards, + cards ); const RootComponent = ({ children }: RootComponentProps): JSX.Element => ( @@ -133,7 +133,7 @@ const SortableCards = ({ panelWidth, details }: Props): JSX.Element => { 'xs', 'isCustomCard', 'width', - 'title', + 'title' ]} items={displayedCards} sortingStrategy={rectSortingStrategy} @@ -141,7 +141,7 @@ const SortableCards = ({ panelWidth, details }: Props): JSX.Element => { /> ), - memoProps: [panelWidth, expandedCards, details], + memoProps: [panelWidth, expandedCards, details] }); }; diff --git a/www/front_src/src/Resources/Details/tabs/Details/SortableCards/models.ts b/www/front_src/src/Resources/Details/tabs/Details/SortableCards/models.ts index 9305a53d90b..87e92444475 100644 --- a/www/front_src/src/Resources/Details/tabs/Details/SortableCards/models.ts +++ b/www/front_src/src/Resources/Details/tabs/Details/SortableCards/models.ts @@ -7,7 +7,7 @@ export interface CardsLayout extends DetailCardLine { export enum ExpandAction { add, - remove, + remove } export interface ChangeExpandedCardsProps { diff --git a/www/front_src/src/Resources/Details/tabs/Details/StateCard.tsx b/www/front_src/src/Resources/Details/tabs/Details/StateCard.tsx index df90d53b408..32d60613ca0 100644 --- a/www/front_src/src/Resources/Details/tabs/Details/StateCard.tsx +++ b/www/front_src/src/Resources/Details/tabs/Details/StateCard.tsx @@ -7,13 +7,13 @@ import { labelComment } from '../../../translatedLabels'; const useStyles = makeStyles((theme) => ({ chip: { - gridArea: 'chip', + gridArea: 'chip' }, comment: { - gridArea: 'comment', + gridArea: 'comment' }, commentTitle: { - gridArea: 'comment-title', + gridArea: 'comment-title' }, container: { display: 'grid', @@ -22,14 +22,14 @@ const useStyles = makeStyles((theme) => ({ 'content-title content chip' 'comment-title comment chip' `, - gridTemplateColumns: '1fr 2fr auto', + gridTemplateColumns: '1fr 2fr auto' }, content: { - gridArea: 'content', + gridArea: 'content' }, contentTitle: { - gridArea: 'content-title', - }, + gridArea: 'content-title' + } })); interface Props { @@ -49,7 +49,7 @@ const StateCard = ({ title, contentLines, commentLine, - chip, + chip }: Props): JSX.Element => { const classes = useStyles(); const { t } = useTranslation(); diff --git a/www/front_src/src/Resources/Details/tabs/Details/detailsCardsAtom.ts b/www/front_src/src/Resources/Details/tabs/Details/detailsCardsAtom.ts index af6a99daf53..b08b01baf96 100644 --- a/www/front_src/src/Resources/Details/tabs/Details/detailsCardsAtom.ts +++ b/www/front_src/src/Resources/Details/tabs/Details/detailsCardsAtom.ts @@ -2,5 +2,5 @@ import { atomWithStorage } from 'jotai/utils'; export const detailsCardsAtom = atomWithStorage>( 'centreon-resource-status-details-card-21.10', - [], + [] ); diff --git a/www/front_src/src/Resources/Details/tabs/Graph/HostGraph.tsx b/www/front_src/src/Resources/Details/tabs/Graph/HostGraph.tsx index 5a9b44fe29b..d8cebc64979 100644 --- a/www/front_src/src/Resources/Details/tabs/Graph/HostGraph.tsx +++ b/www/front_src/src/Resources/Details/tabs/Graph/HostGraph.tsx @@ -12,13 +12,13 @@ import { listResources } from '../../../Listing/api'; const HostGraph = ({ details }: TabProps): JSX.Element => { const { sendRequest, sending } = useRequest({ - request: listResources, + request: listResources }); const limit = 6; const sendListingRequest = ({ - atPage, + atPage }: { atPage?: number; }): Promise> => { @@ -32,11 +32,11 @@ const HostGraph = ({ details }: TabProps): JSX.Element => { { field: 'h.name', values: { - $eq: details?.name, - }, - }, - ], - }, + $eq: details?.name + } + } + ] + } }); }; diff --git a/www/front_src/src/Resources/Details/tabs/Graph/index.tsx b/www/front_src/src/Resources/Details/tabs/Graph/index.tsx index a886da4a09f..b5253f364a3 100644 --- a/www/front_src/src/Resources/Details/tabs/Graph/index.tsx +++ b/www/front_src/src/Resources/Details/tabs/Graph/index.tsx @@ -16,23 +16,23 @@ const useStyles = makeStyles((theme: Theme) => ({ container: { display: 'grid', gridRowGap: theme.spacing(2), - gridTemplateRows: 'auto 1fr', + gridTemplateRows: 'auto 1fr' }, exportToPngButton: { display: 'flex', justifyContent: 'space-between', - margin: theme.spacing(0, 1, 1, 2), + margin: theme.spacing(0, 1, 1, 2) }, graph: { height: '100%', margin: 'auto', - width: '100%', + width: '100%' }, graphContainer: { display: 'grid', gridTemplateRows: '1fr', - padding: theme.spacing(2, 1, 1), - }, + padding: theme.spacing(2, 1, 1) + } })); const GraphTabContent = ({ details }: TabProps): JSX.Element => { @@ -78,7 +78,7 @@ const GraphTabContent = ({ details }: TabProps): JSX.Element => { const MemoizedGraphTabContent = memoizeComponent({ Component: GraphTabContent, - memoProps: ['details', 'ariaLabel'], + memoProps: ['details', 'ariaLabel'] }); const GraphTab = ({ details }: TabProps): JSX.Element => { diff --git a/www/front_src/src/Resources/Details/tabs/Graph/models.ts b/www/front_src/src/Resources/Details/tabs/Graph/models.ts index ef6283dacfe..018481001b0 100644 --- a/www/front_src/src/Resources/Details/tabs/Graph/models.ts +++ b/www/front_src/src/Resources/Details/tabs/Graph/models.ts @@ -9,7 +9,7 @@ import { label7Days, labelLast7Days, label1Day, - labelLastDay, + labelLastDay } from '../../../translatedLabels'; export type TimePeriodId = 'last_24_h' | 'last_7_days' | 'last_31_days'; @@ -37,7 +37,7 @@ export interface StoredCustomTimePeriod { export enum CustomTimePeriodProperty { end = 'end', - start = 'start', + start = 'start' } export interface ChangeCustomTimePeriodProps { @@ -51,7 +51,7 @@ const lastDayPeriod: TimePeriod = { id: 'last_24_h', largeName: labelLastDay, name: label1Day, - timelineEventsLimit: 20, + timelineEventsLimit: 20 }; const last7Days: TimePeriod = { @@ -60,7 +60,7 @@ const last7Days: TimePeriod = { id: 'last_7_days', largeName: labelLast7Days, name: label7Days, - timelineEventsLimit: 100, + timelineEventsLimit: 100 }; const last31Days: TimePeriod = { @@ -69,7 +69,7 @@ const last31Days: TimePeriod = { id: 'last_31_days', largeName: labelLast31Days, name: label31Days, - timelineEventsLimit: 500, + timelineEventsLimit: 500 }; const timePeriods: Array = [lastDayPeriod, last7Days, last31Days]; diff --git a/www/front_src/src/Resources/Details/tabs/Metrics/Metrics.tsx b/www/front_src/src/Resources/Details/tabs/Metrics/Metrics.tsx index 80c9c96d6f6..117248d9995 100644 --- a/www/front_src/src/Resources/Details/tabs/Metrics/Metrics.tsx +++ b/www/front_src/src/Resources/Details/tabs/Metrics/Metrics.tsx @@ -23,24 +23,24 @@ const useStyles = makeStyles((theme) => ({ gridColumnGap: theme.spacing(2), gridTemplateColumns: '1fr 1fr auto', justifyItems: 'flex-start', - width: '100%', + width: '100%' }, container: { display: 'grid', - gridGap: theme.spacing(1), + gridGap: theme.spacing(1) }, iconValuePair: { alignItems: 'center', display: 'flex', flexDirection: 'row', - gridGap: theme.spacing(1), + gridGap: theme.spacing(1) }, resources: { display: 'flex', flexDirection: 'column', gridGap: theme.spacing(1), - overflow: 'hidden', - }, + overflow: 'hidden' + } })); interface Props { diff --git a/www/front_src/src/Resources/Details/tabs/Metrics/api/decoders.ts b/www/front_src/src/Resources/Details/tabs/Metrics/api/decoders.ts index 50a098dd333..aee003a12ee 100644 --- a/www/front_src/src/Resources/Details/tabs/Metrics/api/decoders.ts +++ b/www/front_src/src/Resources/Details/tabs/Metrics/api/decoders.ts @@ -11,15 +11,15 @@ const metaServiceMetricDecoder = JsonDecoder.object( name: JsonDecoder.string, resource: resourceDecoder, unit: JsonDecoder.string, - value: JsonDecoder.number, + value: JsonDecoder.number }, - 'MetaServiceMetric', + 'MetaServiceMetric' ); const metaServiceMetricListingDecoder = buildListingDecoder({ entityDecoder: metaServiceMetricDecoder, entityDecoderName: 'MetaServiceMetric', - listingDecoderName: 'MetaServiceMetricListing', + listingDecoderName: 'MetaServiceMetricListing' }); export { metaServiceMetricDecoder, metaServiceMetricListingDecoder }; diff --git a/www/front_src/src/Resources/Details/tabs/Metrics/api/index.ts b/www/front_src/src/Resources/Details/tabs/Metrics/api/index.ts index cd9f23f9523..1d805875ab6 100644 --- a/www/front_src/src/Resources/Details/tabs/Metrics/api/index.ts +++ b/www/front_src/src/Resources/Details/tabs/Metrics/api/index.ts @@ -11,21 +11,21 @@ interface ListMetaServiceMetricsProps { const buildListMetaServiceMetricsEndpoint = ({ endpoint, - parameters, + parameters }: ListMetaServiceMetricsProps): string => buildListingEndpoint({ baseEndpoint: endpoint, - parameters, + parameters }); const listMetaServiceMetrics = (cancelToken: CancelToken) => ({ endpoint, - parameters, + parameters }: ListMetaServiceMetricsProps): Promise => { return getData(cancelToken)({ - endpoint: buildListMetaServiceMetricsEndpoint({ endpoint, parameters }), + endpoint: buildListMetaServiceMetricsEndpoint({ endpoint, parameters }) }); }; diff --git a/www/front_src/src/Resources/Details/tabs/Metrics/index.tsx b/www/front_src/src/Resources/Details/tabs/Metrics/index.tsx index 41e91f8ad32..a812d739fa7 100644 --- a/www/front_src/src/Resources/Details/tabs/Metrics/index.tsx +++ b/www/front_src/src/Resources/Details/tabs/Metrics/index.tsx @@ -17,7 +17,7 @@ const limit = 30; const MetricsTab = (): JSX.Element => { const { sendRequest, sending } = useRequest({ decoder: metaServiceMetricListingDecoder, - request: listMetaServiceMetrics, + request: listMetaServiceMetrics }); const details = useAtomValue(detailsAtom); @@ -25,7 +25,7 @@ const MetricsTab = (): JSX.Element => { const endpoint = path(['links', 'endpoints', 'metrics'], details); const sendListingRequest = ({ - atPage, + atPage }: { atPage?: number; }): Promise => { @@ -33,8 +33,8 @@ const MetricsTab = (): JSX.Element => { endpoint, parameters: { limit, - page: atPage, - }, + page: atPage + } }); }; diff --git a/www/front_src/src/Resources/Details/tabs/Notifications/ContactCell.tsx b/www/front_src/src/Resources/Details/tabs/Notifications/ContactCell.tsx index 1955f0fe6ab..5f146af0150 100644 --- a/www/front_src/src/Resources/Details/tabs/Notifications/ContactCell.tsx +++ b/www/front_src/src/Resources/Details/tabs/Notifications/ContactCell.tsx @@ -14,7 +14,7 @@ const ContactCell = ({ paddingLeft, children }: Props): JSX.Element => { sx={{ overflow: 'hidden', paddingLeft, - textOverflow: 'ellipsis', + textOverflow: 'ellipsis' }} > {children} diff --git a/www/front_src/src/Resources/Details/tabs/Notifications/Contacts.tsx b/www/front_src/src/Resources/Details/tabs/Notifications/Contacts.tsx index 2aaf4e6d8c2..d88296bfa6a 100644 --- a/www/front_src/src/Resources/Details/tabs/Notifications/Contacts.tsx +++ b/www/front_src/src/Resources/Details/tabs/Notifications/Contacts.tsx @@ -9,13 +9,13 @@ import { IconButton, Paper, Tooltip, - Typography, + Typography } from '@mui/material'; import SettingsIcon from '@mui/icons-material/Settings'; import { labelConfigure, - labelNotAuthorizedToAccessConfiguration, + labelNotAuthorizedToAccessConfiguration } from '../../../translatedLabels'; import memoizeComponent from '../../../memoizedComponent'; @@ -34,7 +34,7 @@ const Contacts = ({ templateColumns, getColumns, headers, - noContactsMessage, + noContactsMessage }: Props): JSX.Element => { const goToUri = (uri): void => { window.location.href = uri as string; @@ -63,7 +63,7 @@ const Contacts = ({ ); }, - [], + [] ); if (isEmpty(contacts)) { @@ -73,7 +73,7 @@ const Contacts = ({ display="grid" sx={{ justifyContent: 'center', - py: 1, + py: 1 }} > {noContactsMessage} @@ -90,7 +90,7 @@ const Contacts = ({ gap: 1, gridTemplateColumns: templateColumns, justifyContent: 'center', - py: 1, + py: 1 }} > <> @@ -113,7 +113,7 @@ const Contacts = ({ const MemoizedConfigurationColumn = memoizeComponent({ Component: Contacts, - memoProps: ['contacts', 'getColumns', 'headers', 'templateColumns'], + memoProps: ['contacts', 'getColumns', 'headers', 'templateColumns'] }); export default MemoizedConfigurationColumn; diff --git a/www/front_src/src/Resources/Details/tabs/Notifications/ContactsLoadingSkeleton.tsx b/www/front_src/src/Resources/Details/tabs/Notifications/ContactsLoadingSkeleton.tsx index 40fcb68b2c0..75512fc2ccf 100644 --- a/www/front_src/src/Resources/Details/tabs/Notifications/ContactsLoadingSkeleton.tsx +++ b/www/front_src/src/Resources/Details/tabs/Notifications/ContactsLoadingSkeleton.tsx @@ -7,12 +7,12 @@ const useStyles = makeStyles((theme) => ({ loadingSkeleton: { display: 'grid', gridTemplateRows: 'repeat(3, 67px)', - rowGap: theme.spacing(2), - }, + rowGap: theme.spacing(2) + } })); const ContactsSkeleton = styled(LoadingSkeleton)(() => ({ - transform: 'none', + transform: 'none' })); const ContactsLoadingSkeleton = (): JSX.Element => { diff --git a/www/front_src/src/Resources/Details/tabs/Notifications/Notifications.tsx b/www/front_src/src/Resources/Details/tabs/Notifications/Notifications.tsx index 67201c38acc..55d4279c478 100644 --- a/www/front_src/src/Resources/Details/tabs/Notifications/Notifications.tsx +++ b/www/front_src/src/Resources/Details/tabs/Notifications/Notifications.tsx @@ -21,7 +21,7 @@ import { labelName, labelNoContactGroupsIsConfiguredForThisResource, labelNoContactIsConfiguredForThisResource, - labelNotificationStatus, + labelNotificationStatus } from '../../../translatedLabels'; import { Contact, ContactGroup, NotificationContacts } from './models'; @@ -36,7 +36,7 @@ const Notifications = (): JSX.Element => { useState(null); const { sendRequest } = useRequest({ - request: getData, + request: getData }); const details = useAtomValue(detailsAtom); @@ -65,7 +65,7 @@ const Notifications = (): JSX.Element => { ); }, - [], + [] ); useEffect(() => { diff --git a/www/front_src/src/Resources/Details/tabs/Notifications/api/decoder.ts b/www/front_src/src/Resources/Details/tabs/Notifications/api/decoder.ts index 47595081ddc..de100cfa650 100644 --- a/www/front_src/src/Resources/Details/tabs/Notifications/api/decoder.ts +++ b/www/front_src/src/Resources/Details/tabs/Notifications/api/decoder.ts @@ -4,7 +4,7 @@ import { ContactGroup, Contact, ContactsResult, - ContactGroupsResult, + ContactGroupsResult } from '../models'; const contactDecoder = JsonDecoder.object( @@ -13,17 +13,17 @@ const contactDecoder = JsonDecoder.object( configuration_uri: JsonDecoder.string, email: JsonDecoder.string, id: JsonDecoder.number, - name: JsonDecoder.string, + name: JsonDecoder.string }, - 'contact', + 'contact' ); const listContactsDecoder = JsonDecoder.array(contactDecoder, 'list contact'); export const contactsResultDecoder = JsonDecoder.object( { - contacts: listContactsDecoder, + contacts: listContactsDecoder }, - 'contacts result', + 'contacts result' ); const contactGroupsDecoder = JsonDecoder.object( @@ -31,20 +31,20 @@ const contactGroupsDecoder = JsonDecoder.object( alias: JsonDecoder.string, configuration_uri: JsonDecoder.string, id: JsonDecoder.number, - name: JsonDecoder.string, + name: JsonDecoder.string }, - 'contactGroups', + 'contactGroups' ); const listContactGroupsDecoder = JsonDecoder.array( contactGroupsDecoder, - 'list contact groups', + 'list contact groups' ); export const contactGroupsResultDecoder = JsonDecoder.object( { - contact_groups: listContactGroupsDecoder, + contact_groups: listContactGroupsDecoder }, - 'contact groups result', + 'contact groups result' ); diff --git a/www/front_src/src/Resources/Details/tabs/OutputInformation.tsx b/www/front_src/src/Resources/Details/tabs/OutputInformation.tsx index b0dfb424e6e..44f7573b4b1 100644 --- a/www/front_src/src/Resources/Details/tabs/OutputInformation.tsx +++ b/www/front_src/src/Resources/Details/tabs/OutputInformation.tsx @@ -11,8 +11,8 @@ type StylesProps = Pick; const useStyles = makeStyles(() => ({ information: ({ bold }): CreateCSSProperties => ({ - fontWeight: bold ? 600 : 'unset', - }), + fontWeight: bold ? 600 : 'unset' + }) })); interface Props { diff --git a/www/front_src/src/Resources/Details/tabs/Services/Graphs.tsx b/www/front_src/src/Resources/Details/tabs/Services/Graphs.tsx index 6ade3cc03eb..5e5f24e75e2 100644 --- a/www/front_src/src/Resources/Details/tabs/Services/Graphs.tsx +++ b/www/front_src/src/Resources/Details/tabs/Services/Graphs.tsx @@ -23,20 +23,20 @@ const useStyles = makeStyles((theme) => ({ columnGap: '8px', display: 'grid', gridTemplateColumns: `repeat(auto-fill, minmax(${theme.spacing( - 40, + 40 )}, auto))`, - rowGap: '8px', - }, + rowGap: '8px' + } })); const ServiceGraphs = ({ services, - infiniteScrollTriggerRef, + infiniteScrollTriggerRef }: Props): JSX.Element => { const classes = useStyles(); const servicesWithGraph = services.filter( - pipe(path(['links', 'endpoints', 'performance_graph']), isNil, not), + pipe(path(['links', 'endpoints', 'performance_graph']), isNil, not) ); return ( diff --git a/www/front_src/src/Resources/Details/tabs/Services/List.tsx b/www/front_src/src/Resources/Details/tabs/Services/List.tsx index 68f31c365ea..3db4738d43b 100644 --- a/www/front_src/src/Resources/Details/tabs/Services/List.tsx +++ b/www/front_src/src/Resources/Details/tabs/Services/List.tsx @@ -14,7 +14,7 @@ interface Props { const ServiceList = ({ services, onSelectService, - infiniteScrollTriggerRef, + infiniteScrollTriggerRef }: Props): JSX.Element => { return ( <> diff --git a/www/front_src/src/Resources/Details/tabs/Services/Listing.tsx b/www/front_src/src/Resources/Details/tabs/Services/Listing.tsx index e7de8e311d9..4ed7820fcab 100644 --- a/www/front_src/src/Resources/Details/tabs/Services/Listing.tsx +++ b/www/front_src/src/Resources/Details/tabs/Services/Listing.tsx @@ -7,8 +7,8 @@ import { IconButton } from '@centreon/ui'; const useStyles = makeStyles((theme) => ({ list: { display: 'grid', - gridGap: theme.spacing(1), - }, + gridGap: theme.spacing(1) + } })); interface Props { list: JSX.Element; @@ -21,7 +21,7 @@ const Listing = ({ list, switchButtonLabel, switchButtonIcon, - onSwitchButtonClick, + onSwitchButtonClick }: Props): JSX.Element => { const classes = useStyles(); const { t } = useTranslation(); diff --git a/www/front_src/src/Resources/Details/tabs/Services/LoadingSkeleton.tsx b/www/front_src/src/Resources/Details/tabs/Services/LoadingSkeleton.tsx index 1e8741e84a9..43f1b35bb11 100644 --- a/www/front_src/src/Resources/Details/tabs/Services/LoadingSkeleton.tsx +++ b/www/front_src/src/Resources/Details/tabs/Services/LoadingSkeleton.tsx @@ -5,12 +5,12 @@ const useStyles = makeStyles((theme) => ({ skeleton: { height: 62, transform: 'none', - width: '100%', + width: '100%' }, skeletons: { display: 'grid', - gridGap: theme.spacing(1), - }, + gridGap: theme.spacing(1) + } })); const LoadingSkeleton = (): JSX.Element => { diff --git a/www/front_src/src/Resources/Details/tabs/Services/index.tsx b/www/front_src/src/Resources/Details/tabs/Services/index.tsx index 129a6ccde39..3db99d5d925 100644 --- a/www/front_src/src/Resources/Details/tabs/Services/index.tsx +++ b/www/front_src/src/Resources/Details/tabs/Services/index.tsx @@ -12,7 +12,7 @@ import LoadingSkeleton from './LoadingSkeleton'; const ServicesTab = (): JSX.Element => { const { sendRequest, sending } = useRequest({ - request: listResources, + request: listResources }); const details = useAtomValue(detailsAtom); @@ -21,7 +21,7 @@ const ServicesTab = (): JSX.Element => { const limit = 30; const sendListingRequest = ({ - atPage, + atPage }: { atPage?: number; }): Promise> => { @@ -34,11 +34,11 @@ const ServicesTab = (): JSX.Element => { { field: 'h.name', values: { - $eq: details?.name, - }, - }, - ], - }, + $eq: details?.name + } + } + ] + } }); }; diff --git a/www/front_src/src/Resources/Details/tabs/Timeline/Event.tsx b/www/front_src/src/Resources/Details/tabs/Timeline/Event.tsx index d42fabe456f..51b46d6cfcd 100644 --- a/www/front_src/src/Resources/Details/tabs/Timeline/Event.tsx +++ b/www/front_src/src/Resources/Details/tabs/Timeline/Event.tsx @@ -27,12 +27,12 @@ import { labelLastMonth, labelLastYear, labelBeforeLastYear, - labelStatus, + labelStatus } from '../../../translatedLabels'; import DowntimeChip from '../../../Chip/Downtime'; import AcknowledgeChip from '../../../Chip/Acknowledge'; import CompactStatusChip, { - useCompactStatusChipStyles, + useCompactStatusChipStyles } from '../CompactStatusChip'; import OutputInformation from '../OutputInformation'; @@ -41,28 +41,28 @@ import { TimelineEvent, Type } from './models'; const types: Array = [ { id: 'event', - name: labelStatus, + name: labelStatus }, { id: 'notification', - name: labelNotification, + name: labelNotification }, { id: 'comment', - name: labelComment, + name: labelComment }, { id: 'acknowledgement', - name: labelAcknowledgement, + name: labelAcknowledgement }, { id: 'downtime', - name: labelDowntime, - }, + name: labelDowntime + } ]; const getTypeIds = (): Array => { @@ -71,14 +71,14 @@ const getTypeIds = (): Array => { const useStyles = makeStyles((theme) => ({ chip: { - display: 'flex', + display: 'flex' }, event: { alignItems: 'center', display: 'flex', flexDirection: 'row', flexWrap: 'wrap', - padding: theme.spacing(1), + padding: theme.spacing(1) }, eventTimeLineContainer: { alignItems: 'center', @@ -88,12 +88,12 @@ const useStyles = makeStyles((theme) => ({ justifyContent: 'space-between', marginBottom: theme.spacing(1), padding: theme.spacing(0, 1), - rowGap: theme.spacing(1), + rowGap: theme.spacing(1) }, info: { display: 'grid', gridAutoFlow: 'row', - gridGap: theme.spacing(1), + gridGap: theme.spacing(1) }, infoHeader: { alignItems: 'start', @@ -102,13 +102,13 @@ const useStyles = makeStyles((theme) => ({ gridGap: theme.spacing(2), gridTemplateColumns: 'minmax(80px, auto) auto 1fr', marginBottom: theme.spacing(1), - marginRight: theme.spacing(2), + marginRight: theme.spacing(2) }, outputContainer: { alignItems: 'center', display: 'flex', marginBottom: theme.spacing(1), - paddingLeft: theme.spacing(12 / 8), + paddingLeft: theme.spacing(12 / 8) }, title: { alignItems: 'center', @@ -116,8 +116,8 @@ const useStyles = makeStyles((theme) => ({ gridAutoColumns: 'auto', gridAutoFlow: 'column', gridGap: theme.spacing(2), - justifyContent: 'flex-start', - }, + justifyContent: 'flex-start' + } })); interface Props { @@ -217,7 +217,7 @@ const DowntimeTimelineEvent = ({ event }: Props): JSX.Element => { const getCaption = (): string => { const formattedStartDate = format({ date: event.startDate as string, - formatString: 'LLLL', + formatString: 'LLLL' }); const from = `${t(labelFrom)} ${formattedStartDate}`; @@ -228,7 +228,7 @@ const DowntimeTimelineEvent = ({ event }: Props): JSX.Element => { const formattedEndDate = format({ date: event.endDate as string, - formatString: 'LLLL', + formatString: 'LLLL' }); return `${from} ${t(labelTo)} ${formattedEndDate}`; @@ -268,7 +268,7 @@ const TimelineEventByType = { comment: CommentTimelineEvent, downtime: DowntimeTimelineEvent, event: EventTimelineEvent, - notification: NotificationTimelineEvent, + notification: NotificationTimelineEvent }; const TimelineIconByType = { @@ -286,12 +286,12 @@ const TimelineIconByType = { ), notification: (t: TFunction): JSX.Element => ( - ), + ) }; const sortEventsByDate = ( { date: prevDate }: TimelineEvent, - { date: nextDate }: TimelineEvent, + { date: nextDate }: TimelineEvent ): number => dayjs(nextDate).valueOf() - dayjs(prevDate).valueOf(); const getWeeksInDays = (weeks: number): number => weeks * -7; @@ -303,7 +303,7 @@ interface GetDateFromNowWithWeeksProps { const getDateFromNowWithWeeks = ({ weeks, - locale, + locale }: GetDateFromNowWithWeeksProps): Dayjs => dayjs().locale(locale).weekday(getWeeksInDays(weeks)); @@ -325,7 +325,7 @@ const getEventsByDateInWeeks = ({ locale, fromNumberOfWeeks, toNumberOfWeeks, - inclusionPolicy = '[)', + inclusionPolicy = '[)' }: GetEventsByDateInWeeksProps): Array => events .filter( @@ -334,9 +334,9 @@ const getEventsByDateInWeeks = ({ getDateFromNowWithWeeks({ locale, weeks: fromNumberOfWeeks }), getDateFromNowWithWeeks({ locale, weeks: toNumberOfWeeks }), 'day', - inclusionPolicy, + inclusionPolicy ), - events, + events ) .sort(sortEventsByDate); @@ -358,14 +358,14 @@ const eventsByDateDivisions: Array = [ events .filter(({ date }) => dayjs(date).isToday(), events) .sort(sortEventsByDate), - label: labelToday, + label: labelToday }, { getEventsByDate: ({ events }): Array => events .filter(({ date }) => dayjs(date).isYesterday(), events) .sort(sortEventsByDate), - label: labelYesterday, + label: labelYesterday }, { endDate: (): Dayjs => dayjs().subtract(2, 'day'), @@ -389,13 +389,13 @@ const eventsByDateDivisions: Array = [ .weekday(getWeeksInDays(thisWeek)), dayjs().subtract(2, 'day'), 'day', - '[]', + '[]' ); }, events) as Array ).sort(sortEventsByDate), label: labelThisWeek, startDate: (locale): Dayjs => - getDateFromNowWithWeeks({ locale, weeks: thisWeek }), + getDateFromNowWithWeeks({ locale, weeks: thisWeek }) }, { endDate: (locale: string): Dayjs => @@ -405,11 +405,11 @@ const eventsByDateDivisions: Array = [ ...props, fromNumberOfWeeks: lastWeek, inclusionPolicy: '[)', - toNumberOfWeeks: thisWeek, + toNumberOfWeeks: thisWeek }), label: labelLastWeek, startDate: (locale: string): Dayjs => - getDateFromNowWithWeeks({ locale, weeks: lastWeek }), + getDateFromNowWithWeeks({ locale, weeks: lastWeek }) }, { endDate: (locale: string): Dayjs => @@ -418,11 +418,11 @@ const eventsByDateDivisions: Array = [ getEventsByDateInWeeks({ ...props, fromNumberOfWeeks: lastMonth, - toNumberOfWeeks: lastWeek, + toNumberOfWeeks: lastWeek }), label: labelLastMonth, startDate: (locale: string): Dayjs => - getDateFromNowWithWeeks({ locale, weeks: lastMonth }), + getDateFromNowWithWeeks({ locale, weeks: lastMonth }) }, { endDate: (locale: string): Dayjs => @@ -431,11 +431,11 @@ const eventsByDateDivisions: Array = [ getEventsByDateInWeeks({ ...props, fromNumberOfWeeks: lastYear, - toNumberOfWeeks: lastMonth, + toNumberOfWeeks: lastMonth }), label: labelLastYear, startDate: (locale: string): Dayjs => - getDateFromNowWithWeeks({ locale, weeks: lastYear }), + getDateFromNowWithWeeks({ locale, weeks: lastYear }) }, { getEventsByDate: ({ events, locale }): Array => @@ -444,15 +444,15 @@ const eventsByDateDivisions: Array = [ ({ date }) => dayjs(date).isBefore( getDateFromNowWithWeeks({ locale, weeks: lastYear }), - 'day', + 'day' ), - events, + events ) as Array ).sort(sortEventsByDate), label: labelBeforeLastYear, startDate: (locale: string): Dayjs => - getDateFromNowWithWeeks({ locale, weeks: lastYear }).subtract(1, 'day'), - }, + getDateFromNowWithWeeks({ locale, weeks: lastYear }).subtract(1, 'day') + } ]; export { @@ -461,5 +461,5 @@ export { getTypeIds, TimelineIconByType, eventsByDateDivisions, - sortEventsByDate, + sortEventsByDate }; diff --git a/www/front_src/src/Resources/Details/tabs/Timeline/Events/index.tsx b/www/front_src/src/Resources/Details/tabs/Timeline/Events/index.tsx index 02b6efc8560..ffea446becd 100644 --- a/www/front_src/src/Resources/Details/tabs/Timeline/Events/index.tsx +++ b/www/front_src/src/Resources/Details/tabs/Timeline/Events/index.tsx @@ -12,7 +12,7 @@ import { TimelineContent, TimelineDot, TimelineItem, - TimelineSeparator, + TimelineSeparator } from '@mui/lab'; import { useLocaleDateTimeFormat } from '@centreon/ui'; @@ -24,51 +24,51 @@ import { eventsByDateDivisions, TimelineEventByType, TimelineIconByType, - sortEventsByDate, + sortEventsByDate } from '../Event'; const useStyles = makeStyles((theme) => ({ contentContainer: { paddingBottom: 0, - paddingTop: 0, + paddingTop: 0 }, divider: { - backgroundColor: theme.palette.action.disabled, + backgroundColor: theme.palette.action.disabled }, dividerContainer: { display: 'flex', height: 12, - paddingLeft: 18, + paddingLeft: 18 }, divisionSubtitle: { - marginLeft: theme.spacing(4), + marginLeft: theme.spacing(4) }, event: { '&:before': { flex: 0, - padding: 0, + padding: 0 }, alignItems: 'center', - minHeight: theme.spacing(7), + minHeight: theme.spacing(7) }, events: { display: 'grid', gridAutoFlow: 'row', - width: '100%', + width: '100%' }, header: { - paddingBottom: theme.spacing(1), + paddingBottom: theme.spacing(1) }, timeline: { - margin: 0, + margin: 0 }, timelineDot: { alignItems: 'center', display: 'grid', height: theme.spacing(3), justifyItems: 'center', - width: theme.spacing(3), - }, + width: theme.spacing(3) + } })); interface Props { @@ -93,11 +93,11 @@ const Events = ({ timeline, infiniteScrollTriggerRef }: Props): JSX.Element => { label, getEventsByDate, startDate, - endDate, + endDate }): JSX.Element | null => { const eventsByDate = getEventsByDate({ events: timeline, - locale: formattedLocale, + locale: formattedLocale }); if (isEmpty(eventsByDate)) { @@ -109,8 +109,8 @@ const Events = ({ timeline, infiniteScrollTriggerRef }: Props): JSX.Element => { t(labelFrom), format({ date: startDate(formattedLocale).toISOString(), - formatString: 'LL', - }), + formatString: 'LL' + }) ] : []; @@ -120,8 +120,8 @@ const Events = ({ timeline, infiniteScrollTriggerRef }: Props): JSX.Element => { t(labelTo).toLowerCase(), format({ date: endDate(formattedLocale).toISOString(), - formatString: 'LL', - }), + formatString: 'LL' + }) ] : formattedStartDate; @@ -132,7 +132,7 @@ const Events = ({ timeline, infiniteScrollTriggerRef }: Props): JSX.Element => { const eventDate = areStartAndEndDateEqual ? format({ date: (startDate?.(formattedLocale) as Dayjs)?.toISOString(), - formatString: 'LL', + formatString: 'LL' }) : formattedDivisionDates.join(' '); @@ -158,7 +158,7 @@ const Events = ({ timeline, infiniteScrollTriggerRef }: Props): JSX.Element => { const icon = TimelineIconByType[type]; const isNotLastEvent = not( - equals(event, last(eventsByDate)), + equals(event, last(eventsByDate)) ); return ( @@ -200,7 +200,7 @@ const Events = ({ timeline, infiniteScrollTriggerRef }: Props): JSX.Element => {
); - }, + } )} ); diff --git a/www/front_src/src/Resources/Details/tabs/Timeline/ExportToCsv.tsx b/www/front_src/src/Resources/Details/tabs/Timeline/ExportToCsv.tsx index 3ce87984a4d..f43d2b10175 100644 --- a/www/front_src/src/Resources/Details/tabs/Timeline/ExportToCsv.tsx +++ b/www/front_src/src/Resources/Details/tabs/Timeline/ExportToCsv.tsx @@ -14,7 +14,7 @@ interface Props { const ExportToCsv = ({ getSearch, - timelineDownloadEndpoint, + timelineDownloadEndpoint }: Props): JSX.Element => { const { t } = useTranslation(); @@ -23,7 +23,7 @@ const ExportToCsv = ({ const parameters = getSearchQueryParameterValue(data); const exportToCSVEndpoint = `${timelineDownloadEndpoint}?search=${JSON.stringify( - parameters, + parameters )}`; window.open(exportToCSVEndpoint, 'noopener', 'noreferrer'); diff --git a/www/front_src/src/Resources/Details/tabs/Timeline/LoadingSkeleton.tsx b/www/front_src/src/Resources/Details/tabs/Timeline/LoadingSkeleton.tsx index 529e2191066..ab1e7f95ce6 100644 --- a/www/front_src/src/Resources/Details/tabs/Timeline/LoadingSkeleton.tsx +++ b/www/front_src/src/Resources/Details/tabs/Timeline/LoadingSkeleton.tsx @@ -5,8 +5,8 @@ const useStyles = makeStyles((theme) => { return { skeleton: { display: 'grid', - gridGap: theme.spacing(1), - }, + gridGap: theme.spacing(1) + } }; }); diff --git a/www/front_src/src/Resources/Details/tabs/Timeline/api/decoders.ts b/www/front_src/src/Resources/Details/tabs/Timeline/api/decoders.ts index 9db465028a7..9e8bc455af9 100644 --- a/www/front_src/src/Resources/Details/tabs/Timeline/api/decoders.ts +++ b/www/front_src/src/Resources/Details/tabs/Timeline/api/decoders.ts @@ -6,15 +6,15 @@ import { statusDecoder } from '../../../../decoders'; import { TimelineEvent, WithName } from '../models'; const getWithNameDecoder = ( - decoderName: string, + decoderName: string ): JsonDecoder.Decoder => JsonDecoder.optional( JsonDecoder.object( { - name: JsonDecoder.string, + name: JsonDecoder.string }, - decoderName, - ), + decoderName + ) ); const entityDecoder = JsonDecoder.object( @@ -27,19 +27,19 @@ const entityDecoder = JsonDecoder.object( startDate: JsonDecoder.optional(JsonDecoder.string), status: JsonDecoder.optional(statusDecoder), tries: JsonDecoder.optional(JsonDecoder.number), - type: JsonDecoder.string, + type: JsonDecoder.string }, 'TimelineEvent', { endDate: 'end_date', - startDate: 'start_date', - }, + startDate: 'start_date' + } ); const listTimelineEventsDecoder = buildListingDecoder({ entityDecoder, entityDecoderName: 'TimelineEvent', - listingDecoderName: 'TimelineEvents', + listingDecoderName: 'TimelineEvents' }); export { listTimelineEventsDecoder }; diff --git a/www/front_src/src/Resources/Details/tabs/Timeline/api/index.ts b/www/front_src/src/Resources/Details/tabs/Timeline/api/index.ts index 848e1b402b3..e93ceeaf8ed 100644 --- a/www/front_src/src/Resources/Details/tabs/Timeline/api/index.ts +++ b/www/front_src/src/Resources/Details/tabs/Timeline/api/index.ts @@ -4,7 +4,7 @@ import { buildListingEndpoint, ListingModel, getData, - ListingParameters, + ListingParameters } from '@centreon/ui'; import { TimelineEvent } from '../models'; @@ -16,21 +16,21 @@ interface ListTimeLineEventsProps { const buildListTimelineEventsEndpoint = ({ endpoint, - parameters, + parameters }: ListTimeLineEventsProps): string => buildListingEndpoint({ baseEndpoint: endpoint, - parameters, + parameters }); const listTimelineEvents = (cancelToken: CancelToken) => ({ endpoint, - parameters, + parameters }: ListTimeLineEventsProps): Promise> => { return getData>(cancelToken)({ - endpoint: buildListTimelineEventsEndpoint({ endpoint, parameters }), + endpoint: buildListTimelineEventsEndpoint({ endpoint, parameters }) }); }; diff --git a/www/front_src/src/Resources/Details/tabs/Timeline/index.tsx b/www/front_src/src/Resources/Details/tabs/Timeline/index.tsx index 49da0cad7b7..87af1a38bab 100644 --- a/www/front_src/src/Resources/Details/tabs/Timeline/index.tsx +++ b/www/front_src/src/Resources/Details/tabs/Timeline/index.tsx @@ -11,7 +11,7 @@ import { useRequest, ListingModel, MultiAutocompleteField, - SearchParameter, + SearchParameter } from '@centreon/ui'; import { labelEvent } from '../../../translatedLabels'; @@ -21,7 +21,7 @@ import TimePeriodButtonGroup from '../../../Graph/Performance/TimePeriods'; import { customTimePeriodAtom, getDatesDerivedAtom, - selectedTimePeriodAtom, + selectedTimePeriodAtom } from '../../../Graph/Performance/TimePeriods/timePeriodAtoms'; import { types } from './Event'; @@ -38,8 +38,8 @@ const useStyles = makeStyles((theme) => ({ filterHeader: { alignItems: 'center', display: 'grid', - padding: theme.spacing(1), - }, + padding: theme.spacing(1) + } })); const TimelineTab = ({ details }: TabProps): JSX.Element => { @@ -48,7 +48,7 @@ const TimelineTab = ({ details }: TabProps): JSX.Element => { const translatedTypes = types.map((type) => ({ ...type, - name: t(type.name), + name: t(type.name) })) as Array; const [selectedTypes, setSelectedTypes] = @@ -56,7 +56,7 @@ const TimelineTab = ({ details }: TabProps): JSX.Element => { const { sendRequest, sending } = useRequest({ decoder: listTimelineEventsDecoder, - request: listTimelineEvents, + request: listTimelineEvents }); const getIntervalDates = useAtomValue(getDatesDerivedAtom); @@ -78,27 +78,27 @@ const TimelineTab = ({ details }: TabProps): JSX.Element => { field: 'date', values: { $gt: start, - $lt: end, - }, - }, + $lt: end + } + } ], lists: [ { field: 'type', - values: selectedTypes.map(prop('id')), - }, - ], + values: selectedTypes.map(prop('id')) + } + ] }; }; const timelineEndpoint = path(['links', 'endpoints', 'timeline'], details); const timelineDownloadEndpoint = path( ['links', 'endpoints', 'timeline_download'], - details, + details ); const listTimeline = ({ - atPage, + atPage }: { atPage?: number; }): Promise => { @@ -107,8 +107,8 @@ const TimelineTab = ({ details }: TabProps): JSX.Element => { parameters: { limit, page: atPage, - search: getSearch(), - }, + search: getSearch() + } }); }; @@ -147,7 +147,7 @@ const TimelineTab = ({ details }: TabProps): JSX.Element => { reloadDependencies={[ selectedTypes, selectedTimePeriod?.id || customTimePeriod, - timelineEndpoint, + timelineEndpoint ]} sendListingRequest={isNil(timelineEndpoint) ? undefined : listTimeline} > diff --git a/www/front_src/src/Resources/Details/tabs/index.tsx b/www/front_src/src/Resources/Details/tabs/index.tsx index 08d2edf7172..5b627632e99 100644 --- a/www/front_src/src/Resources/Details/tabs/index.tsx +++ b/www/front_src/src/Resources/Details/tabs/index.tsx @@ -10,7 +10,7 @@ import { labelTimeline, labelServices, labelMetrics, - labelNotification, + labelNotification } from '../../translatedLabels'; import { ResourceDetails } from '../models'; import DetailsLoadingSkeleton from '../LoadingSkeleton'; @@ -41,7 +41,7 @@ const tabs: Array = [ ariaLabel: labelDetails, getIsActive: (): boolean => true, id: detailsTabId, - title: labelDetails, + title: labelDetails }, { Component: ServicesTab, @@ -49,13 +49,13 @@ const tabs: Array = [ return details.type === 'host'; }, id: servicesTabId, - title: labelServices, + title: labelServices }, { Component: TimelineTab, getIsActive: (): boolean => true, id: timelineTabId, - title: labelTimeline, + title: labelTimeline }, { Component: GraphTab, @@ -71,7 +71,7 @@ const tabs: Array = [ return !isNil(path(['links', 'endpoints', 'performance_graph'], details)); }, id: graphTabId, - title: labelGraph, + title: labelGraph }, { Component: MetricsTab, @@ -83,21 +83,21 @@ const tabs: Array = [ return details.type === 'metaservice'; }, id: metricsTabId, - title: labelMetrics, + title: labelMetrics }, { Component: NotificationsTab, ariaLabel: labelNotification, getIsActive: (): boolean => true, id: notificationsTabId, - title: labelNotification, - }, + title: labelNotification + } ]; const useStyles = makeStyles((theme) => ({ container: { - padding: theme.spacing(2), - }, + padding: theme.spacing(2) + } })); interface TabByIdProps { @@ -125,7 +125,7 @@ const tabIdByLabel = { metrics: metricsTabId, notification: notificationsTabId, services: servicesTabId, - timeline: timelineTabId, + timeline: timelineTabId }; const getTabIdFromLabel = (label: string): TabId => { @@ -152,5 +152,5 @@ export { tabs, TabById, getTabIdFromLabel, - getTabLabelFromId, + getTabLabelFromId }; diff --git a/www/front_src/src/Resources/Details/tabs/models.ts b/www/front_src/src/Resources/Details/tabs/models.ts index bb73a40495e..6c635e5ade5 100644 --- a/www/front_src/src/Resources/Details/tabs/models.ts +++ b/www/front_src/src/Resources/Details/tabs/models.ts @@ -12,7 +12,7 @@ export enum TabId { timelineTabId = 2, graphTabId = 3, metricsTabId = 4, - notificationsTabId = 5, + notificationsTabId = 5 } export interface Tab { diff --git a/www/front_src/src/Resources/Details/useDetails.ts b/www/front_src/src/Resources/Details/useDetails.ts index 61a4e5a95ad..045cad8a1bd 100644 --- a/www/front_src/src/Resources/Details/useDetails.ts +++ b/www/front_src/src/Resources/Details/useDetails.ts @@ -8,7 +8,7 @@ import { getUrlQueryParameters, setUrlQueryParameters } from '@centreon/ui'; import { customTimePeriodAtom, - selectedTimePeriodAtom, + selectedTimePeriodAtom } from '../Graph/Performance/TimePeriods/timePeriodAtoms'; import useTimePeriod from '../Graph/Performance/TimePeriods/useTimePeriod'; @@ -21,30 +21,30 @@ import { selectedResourcesDetailsAtom, selectedResourceUuidAtom, sendingDetailsAtom, - tabParametersAtom, + tabParametersAtom } from './detailsAtoms'; const useDetails = (): void => { const [openDetailsTabId, setOpenDetailsTabId] = useAtom(openDetailsTabIdAtom); const [selectedResourceUuid, setSelectedResourceUuid] = useAtom( - selectedResourceUuidAtom, + selectedResourceUuidAtom ); const [selectedResource, setSelectedResource] = useAtom( - selectedResourcesDetailsAtom, + selectedResourcesDetailsAtom ); const [tabParameters, setTabParameters] = useAtom(tabParametersAtom); const customTimePeriod = useAtomValue(customTimePeriodAtom); const selectedTimePeriod = useAtomValue(selectedTimePeriodAtom); const sendingDetails = useAtomValue(sendingDetailsAtom); const setDefaultSelectedTimePeriodId = useUpdateAtom( - defaultSelectedTimePeriodIdAtom, + defaultSelectedTimePeriodIdAtom ); const setDefaultSelectedCustomTimePeriod = useUpdateAtom( - defaultSelectedCustomTimePeriodAtom, + defaultSelectedCustomTimePeriodAtom ); useTimePeriod({ - sending: sendingDetails, + sending: sendingDetails }); useEffect(() => { @@ -66,7 +66,7 @@ const useDetails = (): void => { tabParameters: tabParametersFromUrl, selectedTimePeriodId, customTimePeriod: customTimePeriodFromUrl, - resourcesDetailsEndpoint, + resourcesDetailsEndpoint } = detailsUrlQueryParameters; if (!isNil(tab)) { @@ -79,7 +79,7 @@ const useDetails = (): void => { parentResourceId: parentId, parentResourceType: parentType, resourceId: id, - resourcesDetailsEndpoint, + resourcesDetailsEndpoint }); setTabParameters(tabParametersFromUrl || {}); setDefaultSelectedTimePeriodId(selectedTimePeriodId); @@ -99,9 +99,9 @@ const useDetails = (): void => { selectedTimePeriodId: selectedTimePeriod?.id, tab: getTabLabelFromId(openDetailsTabId), tabParameters, - uuid: selectedResourceUuid, - }, - }, + uuid: selectedResourceUuid + } + } ]); }, [ openDetailsTabId, @@ -112,7 +112,7 @@ const useDetails = (): void => { tabParameters, selectedTimePeriod, customTimePeriod, - selectedResourceUuid, + selectedResourceUuid ]); }; diff --git a/www/front_src/src/Resources/Details/useLoadDetails.ts b/www/front_src/src/Resources/Details/useLoadDetails.ts index 3c5999aceb9..36ff8afd87e 100644 --- a/www/front_src/src/Resources/Details/useLoadDetails.ts +++ b/www/front_src/src/Resources/Details/useLoadDetails.ts @@ -9,14 +9,14 @@ import { useRequest, getData } from '@centreon/ui'; import { labelNoResourceFound, - labelSomethingWentWrong, + labelSomethingWentWrong } from '../translatedLabels'; import useTimePeriod from '../Graph/Performance/TimePeriods/useTimePeriod'; import { customTimePeriodAtom, getNewCustomTimePeriod, resourceDetailsUpdatedAtom, - selectedTimePeriodAtom, + selectedTimePeriodAtom } from '../Graph/Performance/TimePeriods/timePeriodAtoms'; import { ResourceDetails } from './models'; @@ -25,7 +25,7 @@ import { detailsAtom, selectedResourceDetailsEndpointDerivedAtom, selectedResourcesDetailsAtom, - selectedResourceUuidAtom, + selectedResourceUuidAtom } from './detailsAtoms'; import { ChangeCustomTimePeriodProps } from './tabs/Graph/models'; @@ -41,16 +41,16 @@ const useLoadDetails = (): DetailsState => { getErrorMessage: ifElse( pathEq(['response', 'status'], 404), always(t(labelNoResourceFound)), - pathOr(t(labelSomethingWentWrong), ['response', 'data', 'message']), + pathOr(t(labelSomethingWentWrong), ['response', 'data', 'message']) ), - request: getData, + request: getData }); const [customTimePeriod, setCustomTimePeriod] = useAtom(customTimePeriodAtom); const selectedResource = useAtomValue(selectedResourcesDetailsAtom); const selectedResourceUuid = useAtomValue(selectedResourceUuidAtom); const selectedResourceDetailsEndpoint = useAtomValue( - selectedResourceDetailsEndpointDerivedAtom, + selectedResourceDetailsEndpointDerivedAtom ); const setDetails = useUpdateAtom(detailsAtom); const clearSelectedResource = useUpdateAtom(clearSelectedResourceDerivedAtom); @@ -58,7 +58,7 @@ const useLoadDetails = (): DetailsState => { const setResourceDetailsUpdated = useUpdateAtom(resourceDetailsUpdatedAtom); useTimePeriod({ - sending, + sending }); const loadDetails = (): void => { @@ -67,7 +67,7 @@ const useLoadDetails = (): DetailsState => { } sendRequest({ - endpoint: selectedResourceDetailsEndpoint, + endpoint: selectedResourceDetailsEndpoint }) .then(setDetails) .catch(() => { @@ -78,7 +78,7 @@ const useLoadDetails = (): DetailsState => { const changeCustomTimePeriod = ({ date, property }): void => { const newCustomTimePeriod = getNewCustomTimePeriod({ ...customTimePeriod, - [property]: date, + [property]: date }); setCustomTimePeriod(newCustomTimePeriod); @@ -92,12 +92,12 @@ const useLoadDetails = (): DetailsState => { }, [ selectedResourceUuid, selectedResource?.parentResourceId, - selectedResource?.resourceId, + selectedResource?.resourceId ]); return { changeCustomTimePeriod, - loadDetails, + loadDetails }; }; diff --git a/www/front_src/src/Resources/Filter/Criterias/Criteria.tsx b/www/front_src/src/Resources/Filter/Criterias/Criteria.tsx index f157cccae33..bd6f1f876f6 100644 --- a/www/front_src/src/Resources/Filter/Criterias/Criteria.tsx +++ b/www/front_src/src/Resources/Filter/Criterias/Criteria.tsx @@ -6,12 +6,12 @@ import { PopoverMultiAutocompleteField, PopoverMultiConnectedAutocompleteField, SelectEntry, - useMemoComponent, + useMemoComponent } from '@centreon/ui'; import { filterWithParsedSearchDerivedAtom, - setCriteriaAndNewFilterDerivedAtom, + setCriteriaAndNewFilterDerivedAtom } from '../filterAtoms'; import useFilterByModule from '../useFilterByModule'; @@ -27,13 +27,13 @@ const CriteriaContent = ({ name, value }: Props): JSX.Element => { const { newSelectableCriterias } = useFilterByModule(); const setCriteriaAndNewFilter = useUpdateAtom( - setCriteriaAndNewFilterDerivedAtom, + setCriteriaAndNewFilterDerivedAtom ); const getTranslated = (values: Array): Array => { return values.map((entry) => ({ id: entry.id, - name: t(entry.name), + name: t(entry.name) })); }; @@ -44,7 +44,7 @@ const CriteriaContent = ({ name, value }: Props): JSX.Element => { const getUntranslated = (values): Array => { return values.map(({ id }) => ({ id, - name: criteriaValueNameById[id], + name: criteriaValueNameById[id] })); }; @@ -53,7 +53,7 @@ const CriteriaContent = ({ name, value }: Props): JSX.Element => { const commonProps = { label: t(label), - search: autocompleteSearch, + search: autocompleteSearch }; if (isNil(options)) { @@ -66,7 +66,7 @@ const CriteriaContent = ({ name, value }: Props): JSX.Element => { buildAutocompleteEndpoint({ limit: 10, page, - search, + search }); const displayedColumn = label.includes('level') ? 'level' : ''; @@ -105,12 +105,12 @@ const CriteriaContent = ({ name, value }: Props): JSX.Element => { const Criteria = ({ value, name }: Props): JSX.Element => { const filterWithParsedSearch = useAtomValue( - filterWithParsedSearchDerivedAtom, + filterWithParsedSearchDerivedAtom ); return useMemoComponent({ Component: , - memoProps: [value, name, filterWithParsedSearch], + memoProps: [value, name, filterWithParsedSearch] }); }; diff --git a/www/front_src/src/Resources/Filter/Criterias/default.ts b/www/front_src/src/Resources/Filter/Criterias/default.ts index 95d22c8dcac..c026b9f6a91 100644 --- a/www/front_src/src/Resources/Filter/Criterias/default.ts +++ b/www/front_src/src/Resources/Filter/Criterias/default.ts @@ -37,7 +37,7 @@ const getDefaultCriterias = ( monitoringServers = [], statusTypes = [], hostCategories = [], - serviceCategories = [], + serviceCategories = [] }: DefaultCriteriaValues = { hostCategories: [], hostGroups: [], @@ -51,100 +51,100 @@ const getDefaultCriterias = ( serviceSeverityLevels: [], states: [], statusTypes: [], - statuses: [], - }, + statuses: [] + } ): Array => { return [ { name: 'resource_types', object_type: null, type: 'multi_select', - value: resourceTypes, + value: resourceTypes }, { name: 'states', object_type: null, type: 'multi_select', - value: states, + value: states }, { name: 'statuses', object_type: null, type: 'multi_select', - value: statuses, + value: statuses }, { name: 'status_types', object_type: null, type: 'multi_select', - value: statusTypes, + value: statusTypes }, { name: 'host_groups', object_type: 'host_groups', type: 'multi_select', - value: hostGroups, + value: hostGroups }, { name: 'service_groups', object_type: 'service_groups', type: 'multi_select', - value: serviceGroups, + value: serviceGroups }, { name: 'monitoring_servers', object_type: 'monitoring_servers', type: 'multi_select', - value: monitoringServers, + value: monitoringServers }, { name: 'host_categories', object_type: 'host_categories', type: 'multi_select', - value: hostCategories, + value: hostCategories }, { name: 'service_categories', object_type: 'service_categories', type: 'multi_select', - value: serviceCategories, + value: serviceCategories }, { name: 'host_severities', object_type: 'host_severities', type: 'multi_select', - value: hostSeverities, + value: hostSeverities }, { name: 'host_severity_levels', object_type: 'host_severity_levels', type: 'multi_select', - value: hostSeverityLevels, + value: hostSeverityLevels }, { name: 'service_severities', object_type: 'service_severities', type: 'multi_select', - value: serviceSeverities, + value: serviceSeverities }, { name: 'service_severity_levels', object_type: 'service_severity_levels', type: 'multi_select', - value: serviceSeverityLevels, + value: serviceSeverityLevels }, { name: 'search', object_type: null, type: 'text', - value: '', + value: '' }, { name: 'sort', object_type: null, type: 'array', - value: [defaultSortField, defaultSortOrder], - }, + value: [defaultSortField, defaultSortOrder] + } ]; }; @@ -154,8 +154,8 @@ const getAllCriterias = (): Array => [ name: 'monitoring_servers', object_type: 'monitoring_servers', type: 'multi_select', - value: [], - }, + value: [] + } ]; export default getDefaultCriterias; diff --git a/www/front_src/src/Resources/Filter/Criterias/index.tsx b/www/front_src/src/Resources/Filter/Criterias/index.tsx index 4d15a76527d..9a7f331b5e7 100644 --- a/www/front_src/src/Resources/Filter/Criterias/index.tsx +++ b/www/front_src/src/Resources/Filter/Criterias/index.tsx @@ -11,13 +11,13 @@ import { PopoverMenu, SelectEntry, useMemoComponent } from '@centreon/ui'; import { labelClear, labelSearch, - labelSearchOptions, + labelSearchOptions } from '../../translatedLabels'; import { applyCurrentFilterDerivedAtom, clearFilterDerivedAtom, filterWithParsedSearchDerivedAtom, - filterByInstalledModulesWithParsedSearchDerivedAtom, + filterByInstalledModulesWithParsedSearchDerivedAtom } from '../filterAtoms'; import useFilterByModule from '../useFilterByModule'; @@ -27,11 +27,11 @@ import { criteriaNameSortOrder } from './searchQueryLanguage/models'; const useStyles = makeStyles((theme) => ({ container: { - padding: theme.spacing(2), + padding: theme.spacing(2) }, searchButton: { - marginTop: theme.spacing(1), - }, + marginTop: theme.spacing(1) + } })); const CriteriasContent = (): JSX.Element => { @@ -42,17 +42,17 @@ const CriteriasContent = (): JSX.Element => { const { newCriteriaValueName, newSelectableCriterias } = useFilterByModule(); const filterByInstalledModulesWithParsedSearch = useAtomValue( - filterByInstalledModulesWithParsedSearchDerivedAtom, + filterByInstalledModulesWithParsedSearchDerivedAtom ); const getSelectableCriterias = (): Array => { const criteriasValue = filterByInstalledModulesWithParsedSearch({ - criteriaName: newCriteriaValueName, + criteriaName: newCriteriaValueName }); const criterias = sortBy( ({ name }) => criteriaNameSortOrder[name], - criteriasValue.criterias, + criteriasValue.criterias ); return reject(isNonSelectableCriteria)(criterias); @@ -114,12 +114,12 @@ const CriteriasContent = (): JSX.Element => { const Criterias = (): JSX.Element => { const filterWithParsedSearch = useAtomValue( - filterWithParsedSearchDerivedAtom, + filterWithParsedSearchDerivedAtom ); return useMemoComponent({ Component: , - memoProps: [filterWithParsedSearch], + memoProps: [filterWithParsedSearch] }); }; diff --git a/www/front_src/src/Resources/Filter/Criterias/models.ts b/www/front_src/src/Resources/Filter/Criterias/models.ts index f09bbfd60bd..013a6846aed 100644 --- a/www/front_src/src/Resources/Filter/Criterias/models.ts +++ b/www/front_src/src/Resources/Filter/Criterias/models.ts @@ -31,7 +31,7 @@ import { labelHostSeverity, labelHostSeverityLevel, labelServiceSeverityLevel, - labelAnomalyDetection, + labelAnomalyDetection } from '../../translatedLabels'; import { buildHostGroupsEndpoint, @@ -40,7 +40,7 @@ import { buildMonitoringServersEndpoint, buildServiceGroupsEndpoint, buildHostServeritiesEndpoint, - buildServiceSeveritiesEndpoint, + buildServiceSeveritiesEndpoint } from '../api/endpoint'; export type CriteriaValue = Array | string | [string, SortOrder]; @@ -68,25 +68,25 @@ const criteriaValueNameById = { metaservice: labelMetaService, service: labelService, soft: labelSoft, - unhandled_problems: labelUnhandled, + unhandled_problems: labelUnhandled }; const unhandledStateId = 'unhandled_problems'; const unhandledState = { id: unhandledStateId, - name: criteriaValueNameById[unhandledStateId], + name: criteriaValueNameById[unhandledStateId] }; const acknowledgedStateId = 'acknowledged'; const acknowledgedState = { id: 'acknowledged', - name: criteriaValueNameById[acknowledgedStateId], + name: criteriaValueNameById[acknowledgedStateId] }; const inDowntimeStateId = 'in_downtime'; const inDowntimeState = { id: inDowntimeStateId, - name: criteriaValueNameById[inDowntimeStateId], + name: criteriaValueNameById[inDowntimeStateId] }; const selectableStates = [unhandledState, acknowledgedState, inDowntimeState]; @@ -94,25 +94,25 @@ const selectableStates = [unhandledState, acknowledgedState, inDowntimeState]; const hostResourceTypeId = 'host'; const hostResourceType = { id: hostResourceTypeId, - name: criteriaValueNameById[hostResourceTypeId], + name: criteriaValueNameById[hostResourceTypeId] }; const serviceResourceTypeId = 'service'; const serviceResourceType = { id: serviceResourceTypeId, - name: criteriaValueNameById[serviceResourceTypeId], + name: criteriaValueNameById[serviceResourceTypeId] }; const metaServiceResourceTypeId = 'metaservice'; const metaServiceResourceType = { id: metaServiceResourceTypeId, - name: criteriaValueNameById[metaServiceResourceTypeId], + name: criteriaValueNameById[metaServiceResourceTypeId] }; const selectableResourceTypes = [ hostResourceType, serviceResourceType, - metaServiceResourceType, + metaServiceResourceType ]; const okStatusId = 'OK'; @@ -124,37 +124,37 @@ const upStatus = { id: upStatusId, name: criteriaValueNameById[upStatusId] }; const warningStatusId = 'WARNING'; const warningStatus = { id: warningStatusId, - name: criteriaValueNameById[warningStatusId], + name: criteriaValueNameById[warningStatusId] }; const downStatusId = 'DOWN'; const downStatus = { id: downStatusId, - name: criteriaValueNameById[downStatusId], + name: criteriaValueNameById[downStatusId] }; const criticalStatusId = 'CRITICAL'; const criticalStatus = { id: criticalStatusId, - name: criteriaValueNameById[criticalStatusId], + name: criteriaValueNameById[criticalStatusId] }; const unreachableStatusId = 'UNREACHABLE'; const unreachableStatus = { id: unreachableStatusId, - name: criteriaValueNameById[unreachableStatusId], + name: criteriaValueNameById[unreachableStatusId] }; const unknownStatusId = 'UNKNOWN'; const unknownStatus = { id: unknownStatusId, - name: criteriaValueNameById[unknownStatusId], + name: criteriaValueNameById[unknownStatusId] }; const pendingStatusId = 'PENDING'; const pendingStatus = { id: pendingStatusId, - name: criteriaValueNameById[pendingStatusId], + name: criteriaValueNameById[pendingStatusId] }; const selectableStatuses = [ @@ -165,19 +165,19 @@ const selectableStatuses = [ criticalStatus, unreachableStatus, unknownStatus, - pendingStatus, + pendingStatus ]; const hardStateTypeId = 'hard'; const hardStateType = { id: hardStateTypeId, - name: criteriaValueNameById[hardStateTypeId], + name: criteriaValueNameById[hardStateTypeId] }; const softStateTypeId = 'soft'; const softStateType = { id: softStateTypeId, - name: criteriaValueNameById[softStateTypeId], + name: criteriaValueNameById[softStateTypeId] }; const selectableStateTypes = [hardStateType, softStateType]; @@ -206,69 +206,69 @@ export enum CriteriaNames { serviceSeverityLevels = 'service_severity_levels', states = 'states', statusTypes = 'status_types', - statuses = 'statuses', + statuses = 'statuses' } const selectableCriterias: CriteriaById = { [CriteriaNames.resourceTypes]: { label: labelType, - options: selectableResourceTypes, + options: selectableResourceTypes }, [CriteriaNames.states]: { label: labelState, - options: selectableStates, + options: selectableStates }, [CriteriaNames.statuses]: { label: labelStatus, - options: selectableStatuses, + options: selectableStatuses }, [CriteriaNames.statusTypes]: { label: labelStatusType, - options: selectableStateTypes, + options: selectableStateTypes }, [CriteriaNames.hostGroups]: { buildAutocompleteEndpoint: buildHostGroupsEndpoint, - label: labelHostGroup, + label: labelHostGroup }, [CriteriaNames.serviceGroups]: { buildAutocompleteEndpoint: buildServiceGroupsEndpoint, - label: labelServiceGroup, + label: labelServiceGroup }, [CriteriaNames.monitoringServers]: { autocompleteSearch: { conditions: [{ field: 'running', value: true }] }, buildAutocompleteEndpoint: buildMonitoringServersEndpoint, - label: labelMonitoringServer, + label: labelMonitoringServer }, [CriteriaNames.hostCategories]: { buildAutocompleteEndpoint: buildHostCategoriesEndpoint, - label: labelHostCategory, + label: labelHostCategory }, [CriteriaNames.serviceCategories]: { buildAutocompleteEndpoint: buildServiceCategoriesEndpoint, - label: labelServiceCategory, + label: labelServiceCategory }, [CriteriaNames.hostSeverities]: { buildAutocompleteEndpoint: buildHostServeritiesEndpoint, - label: labelHostSeverity, + label: labelHostSeverity }, [CriteriaNames.serviceSeverities]: { buildAutocompleteEndpoint: buildServiceSeveritiesEndpoint, - label: labelServiceSeverity, + label: labelServiceSeverity }, [CriteriaNames.hostSeverityLevels]: { buildAutocompleteEndpoint: buildHostServeritiesEndpoint, - label: labelHostSeverityLevel, + label: labelHostSeverityLevel }, [CriteriaNames.serviceSeverityLevels]: { buildAutocompleteEndpoint: buildServiceSeveritiesEndpoint, - label: labelServiceSeverityLevel, - }, + label: labelServiceSeverityLevel + } }; const authorizedFilterByModules = { 'centreon-anomaly-detection': { - 'anomaly-detection': labelAnomalyDetection, - }, + 'anomaly-detection': labelAnomalyDetection + } }; export { @@ -284,5 +284,5 @@ export { selectableStatuses, selectableCriterias, selectableStateTypes, - hardStateType, + hardStateType }; diff --git a/www/front_src/src/Resources/Filter/Criterias/searchQueryLanguage/index.test.ts b/www/front_src/src/Resources/Filter/Criterias/searchQueryLanguage/index.test.ts index 25d02aab15d..af6ee085b7d 100644 --- a/www/front_src/src/Resources/Filter/Criterias/searchQueryLanguage/index.test.ts +++ b/www/front_src/src/Resources/Filter/Criterias/searchQueryLanguage/index.test.ts @@ -15,14 +15,14 @@ const parsedSearch = [ type: 'multi_select', value: [ { id: 'host', name: 'Host' }, - { id: 'service', name: 'Service' }, - ], + { id: 'service', name: 'Service' } + ] }, { name: 'states', object_type: null, type: 'multi_select', - value: [{ id: 'unhandled_problems', name: 'Unhandled' }], + value: [{ id: 'unhandled_problems', name: 'Unhandled' }] }, { name: 'statuses', @@ -30,75 +30,75 @@ const parsedSearch = [ type: 'multi_select', value: [ { id: 'OK', name: 'Ok' }, - { id: 'UP', name: 'Up' }, - ], + { id: 'UP', name: 'Up' } + ] }, { name: 'status_types', object_type: null, type: 'multi_select', - value: [{ id: 'soft', name: labelSoft }], + value: [{ id: 'soft', name: labelSoft }] }, { name: 'host_groups', object_type: 'host_groups', type: 'multi_select', - value: [{ id: 0, name: 'Linux-Servers' }], + value: [{ id: 0, name: 'Linux-Servers' }] }, { name: 'service_groups', object_type: 'service_groups', type: 'multi_select', - value: [], + value: [] }, { name: 'monitoring_servers', object_type: 'monitoring_servers', type: 'multi_select', - value: [{ id: 0, name: 'Central' }], + value: [{ id: 0, name: 'Central' }] }, { name: 'host_categories', object_type: 'host_categories', type: 'multi_select', - value: [{ id: 0, name: 'Linux' }], + value: [{ id: 0, name: 'Linux' }] }, { name: 'service_categories', object_type: 'service_categories', type: 'multi_select', - value: [], + value: [] }, { name: 'host_severities', object_type: 'host_severities', type: 'multi_select', - value: [], + value: [] }, { name: 'host_severity_levels', object_type: 'host_severity_levels', type: 'multi_select', - value: [], + value: [] }, { name: 'service_severities', object_type: 'service_severities', type: 'multi_select', - value: [], + value: [] }, { name: 'service_severity_levels', object_type: 'service_severity_levels', type: 'multi_select', - value: [], + value: [] }, { name: 'search', object_type: null, type: 'text', - value: 'h.name:centreon', - }, + value: 'h.name:centreon' + } ]; describe('parse', () => { @@ -122,66 +122,66 @@ describe(getAutocompleteSuggestions, () => { { cursorPosition: 3, expectedResult: ['state:', 'status:', 'status_type:'], - inputSearch: 'sta', + inputSearch: 'sta' }, { cursorPosition: 6, expectedResult: ['unhandled', 'acknowledged', 'in_downtime'], - inputSearch: 'state:', + inputSearch: 'state:' }, { cursorPosition: 5, expectedResult: selectableResourceTypes.map(prop('id')), - inputSearch: 'type:', + inputSearch: 'type:' }, { cursorPosition: 15, expectedResult: [',acknowledged', ',in_downtime'], - inputSearch: 'state:unhandled', + inputSearch: 'state:unhandled' }, { cursorPosition: 16, expectedResult: ['acknowledged', 'in_downtime'], - inputSearch: 'state:unhandled,', + inputSearch: 'state:unhandled,' }, { cursorPosition: 22, expectedResult: ['status:', 'status_type:'], - inputSearch: 'state:unhandled statu', + inputSearch: 'state:unhandled statu' }, { cursorPosition: 23, expectedResult: selectableStatuses.map( pipe(prop('id'), toLower), - concat(','), + concat(',') ), - inputSearch: 'state:unhandled status:', + inputSearch: 'state:unhandled status:' }, { cursorPosition: 14, expectedResult: [], - inputSearch: 'service_group:', + inputSearch: 'service_group:' }, { cursorPosition: 11, expectedResult: [], - inputSearch: 'host_group:', + inputSearch: 'host_group:' }, { cursorPosition: 20, expectedResult: [], - inputSearch: 'monitoring_server:', + inputSearch: 'monitoring_server:' }, { cursorPosition: 18, expectedResult: [], - inputSearch: 'service_categorie:', + inputSearch: 'service_categorie:' }, { cursorPosition: 15, expectedResult: [], - inputSearch: 'host_categorie:', - }, + inputSearch: 'host_categorie:' + } ]; it.each(testCases)( @@ -190,9 +190,9 @@ describe(getAutocompleteSuggestions, () => { expect( getAutocompleteSuggestions({ cursorPosition, - search: inputSearch, - }), + search: inputSearch + }) ).toEqual(expectedResult); - }, + } ); }); diff --git a/www/front_src/src/Resources/Filter/Criterias/searchQueryLanguage/index.ts b/www/front_src/src/Resources/Filter/Criterias/searchQueryLanguage/index.ts index 18f4a1bc0c7..43ac123db5f 100644 --- a/www/front_src/src/Resources/Filter/Criterias/searchQueryLanguage/index.ts +++ b/www/front_src/src/Resources/Filter/Criterias/searchQueryLanguage/index.ts @@ -27,7 +27,7 @@ import { trim, without, __, - compose, + compose } from 'ramda'; import pluralize from 'pluralize'; @@ -37,7 +37,7 @@ import { Criteria, CriteriaDisplayProps, criteriaValueNameById, - selectableCriterias, + selectableCriterias } from '../models'; import getDefaultCriterias from '../default'; @@ -50,7 +50,7 @@ import { AutocompleteSuggestionProps, staticCriteriaNames, getSelectableCriteriasByName, - dynamicCriteriaValuesByName, + dynamicCriteriaValuesByName } from './models'; const singular = pluralize.singular as (string) => string; @@ -72,7 +72,7 @@ const isCriteriaPart = pipe( head, getCriteriaNameFromQueryLanguageName, pluralize, - isIn(selectableCriteriaNames), + isIn(selectableCriteriaNames) ); const isFilledCriteria = pipe(endsWith(':'), not); @@ -83,11 +83,11 @@ interface ParametersParse { const parse = ({ search, - criteriaName = criteriaValueNameById, + criteriaName = criteriaValueNameById }: ParametersParse): Array => { const [criteriaParts, rawSearchParts] = partition( allPass([includes(':'), isCriteriaPart, isFilledCriteria]), - search.split(' '), + search.split(' ') ); const criterias: Array = criteriaParts.map((criteria) => { @@ -97,7 +97,7 @@ const parse = ({ const defaultCriteria = find( propEq('name', pluralizedKey), - getDefaultCriterias(), + getDefaultCriterias() ); const objectType = defaultCriteria?.object_type || null; @@ -114,15 +114,15 @@ const parse = ({ return { id, - name: criteriaName[id], + name: criteriaName[id] }; } return { id: 0, - name: value, + name: value }; - }), + }) }; }); @@ -132,8 +132,8 @@ const parse = ({ name: 'search', object_type: null, type: 'text', - value: rawSearchParts.join(' ').trim(), - }, + value: rawSearchParts.join(' ').trim() + } ]; const toNames = map(prop('name')); @@ -149,8 +149,8 @@ const parse = ({ ({ name }) => criteriaNameSortOrder[name], reject(propEq('name', 'sort'), [ ...defaultCriterias, - ...criteriasWithSearch, - ]), + ...criteriasWithSearch + ]) ); }; @@ -167,7 +167,7 @@ const build = (criterias: Array): string => { const regularCriterias = pipe( rejectSearch, rejectSort, - rejectEmpty, + rejectEmpty )(criterias); const builtCriterias = regularCriterias @@ -178,13 +178,13 @@ const build = (criterias: Array): string => { const formattedValues = isStaticCriteria ? values.map( - pipe(({ id }) => id as string, getCriteriaQueryLanguageName), + pipe(({ id }) => id as string, getCriteriaQueryLanguageName) ) : values.map(({ name: valueName }) => `${valueName}`); const criteriaName = compose( getCriteriaQueryLanguageName, - singular, + singular )(name); return `${criteriaName}:${formattedValues.join(',')}`; @@ -201,7 +201,7 @@ const build = (criterias: Array): string => { const getCriteriaNameSuggestions = (word: string): Array => { const criteriaNames = map( compose(getCriteriaQueryLanguageName, pluralize.singular), - selectableCriteriaNames, + selectableCriteriaNames ); if (isEmpty(word)) { @@ -210,7 +210,7 @@ const getCriteriaNameSuggestions = (word: string): Array => { const suggestions = filter(startsWith(word), [ ...criteriaNames, - ...searchableFields, + ...searchableFields ]); return map(concat(__, ':'), suggestions); @@ -218,10 +218,10 @@ const getCriteriaNameSuggestions = (word: string): Array => { const getCriteriaValueSuggestions = ({ selectedValues, - criterias, + criterias }: CriteriaValueSuggestionsProps): Array => { const criteriaNames = map( - compose(getCriteriaQueryLanguageName, prop('id')), + compose(getCriteriaQueryLanguageName, prop('id')) )(criterias); return without(selectedValues, criteriaNames); @@ -229,7 +229,7 @@ const getCriteriaValueSuggestions = ({ const getIsNextCharacterEmpty = ({ search, - cursorPosition, + cursorPosition }: AutocompleteSuggestionProps): boolean => { const nextCharacter = search[cursorPosition]; @@ -244,26 +244,26 @@ interface CriteriaExpression { const getCriteriaAndExpression = ({ search, - cursorPosition, + cursorPosition }: AutocompleteSuggestionProps): CriteriaExpression => { const searchBeforeCursor = slice(0, cursorPosition + 1, search); const expressionBeforeCursor = pipe( trim, split(' '), - last, + last )(searchBeforeCursor) as string; const expressionCriteria = expressionBeforeCursor.split(':'); const criteriaQueryLanguageName = head(expressionCriteria) as string; const criteriaName = getCriteriaNameFromQueryLanguageName( - criteriaQueryLanguageName, + criteriaQueryLanguageName ); const expressionCriteriaValues = pipe(last, split(','))(expressionCriteria); return { criteriaName, expressionBeforeCursor, - expressionCriteriaValues, + expressionCriteriaValues }; }; @@ -275,11 +275,11 @@ interface DynamicCriteriaParametersAndValues { const getDynamicCriteriaParametersAndValue = ({ search, cursorPosition, - newSelectableCriterias = selectableCriterias, + newSelectableCriterias = selectableCriterias }: AutocompleteSuggestionProps): DynamicCriteriaParametersAndValues | null => { const isNextCharacterEmpty = getIsNextCharacterEmpty({ cursorPosition, - search, + search }); if (isNil(cursorPosition) || !isNextCharacterEmpty) { @@ -288,20 +288,20 @@ const getDynamicCriteriaParametersAndValue = ({ const { criteriaName, expressionCriteriaValues } = getCriteriaAndExpression({ cursorPosition, - search, + search }); const pluralizedCriteriaName = pluralize(criteriaName); const hasCriteriaDynamicValues = includes( pluralizedCriteriaName, - dynamicCriteriaValuesByName, + dynamicCriteriaValuesByName ); return hasCriteriaDynamicValues ? { criteria: newSelectableCriterias[pluralizedCriteriaName], - values: expressionCriteriaValues, + values: expressionCriteriaValues } : null; }; @@ -309,11 +309,11 @@ const getDynamicCriteriaParametersAndValue = ({ const getAutocompleteSuggestions = ({ search, cursorPosition, - newSelectableCriterias, + newSelectableCriterias }: AutocompleteSuggestionProps): Array => { const isNextCharacterEmpty = getIsNextCharacterEmpty({ cursorPosition, - search, + search }); if (isNil(cursorPosition) || !isNextCharacterEmpty) { @@ -344,12 +344,12 @@ const getAutocompleteSuggestions = ({ const criteriaValueSuggestions = getCriteriaValueSuggestions({ criterias: allCriterias, - selectedValues: expressionCriteriaValues, + selectedValues: expressionCriteriaValues }); const isLastValueInSuggestions = getCriteriaValueSuggestions({ criterias: allCriterias, - selectedValues: [], + selectedValues: [] }).includes(lastCriteriaValue); return isLastValueInSuggestions @@ -366,5 +366,5 @@ export { getAutocompleteSuggestions, getDynamicCriteriaParametersAndValue, searchableFields, - DynamicCriteriaParametersAndValues, + DynamicCriteriaParametersAndValues }; diff --git a/www/front_src/src/Resources/Filter/Criterias/searchQueryLanguage/models.ts b/www/front_src/src/Resources/Filter/Criterias/searchQueryLanguage/models.ts index 7cadeaed58c..7aad6df0d5e 100644 --- a/www/front_src/src/Resources/Filter/Criterias/searchQueryLanguage/models.ts +++ b/www/front_src/src/Resources/Filter/Criterias/searchQueryLanguage/models.ts @@ -6,7 +6,7 @@ import { selectableResourceTypes, selectableStates, selectableStateTypes, - selectableStatuses, + selectableStatuses } from '../models'; export interface CriteriaId { @@ -31,7 +31,7 @@ export const criteriaNameSortOrder = { [CriteriaNames.hostSeverities]: 10, [CriteriaNames.hostSeverityLevels]: 11, [CriteriaNames.serviceSeverities]: 12, - [CriteriaNames.serviceSeverityLevels]: 13, + [CriteriaNames.serviceSeverityLevels]: 13 }; export interface AutocompleteSuggestionProps { @@ -50,7 +50,7 @@ export const searchableFields = [ 'parent_name', 'parent_alias', 'fqdn', - 'information', + 'information' ]; const statusNameToQueryLanguageName = selectableStatuses @@ -62,14 +62,14 @@ const statusNameToQueryLanguageName = selectableStatuses export const criteriaNameToQueryLanguageName = { ...statusNameToQueryLanguageName, resource_type: 'type', - unhandled_problems: 'unhandled', + unhandled_problems: 'unhandled' }; const staticCriteriaValuesByName = { resource_type: selectableResourceTypes, state: selectableStates, status: selectableStatuses, - status_type: selectableStateTypes, + status_type: selectableStateTypes }; export const dynamicCriteriaValuesByName = [ @@ -81,11 +81,11 @@ export const dynamicCriteriaValuesByName = [ CriteriaNames.hostSeverities, CriteriaNames.serviceSeverities, CriteriaNames.hostSeverityLevels, - CriteriaNames.serviceSeverityLevels, + CriteriaNames.serviceSeverityLevels ]; export const getSelectableCriteriasByName = ( - name: string, + name: string ): Array<{ id: string; name: string }> => { return staticCriteriaValuesByName[name]; }; diff --git a/www/front_src/src/Resources/Filter/Edit/EditFilterCard.tsx b/www/front_src/src/Resources/Filter/Edit/EditFilterCard.tsx index 43638305fbf..e2f31684699 100644 --- a/www/front_src/src/Resources/Filter/Edit/EditFilterCard.tsx +++ b/www/front_src/src/Resources/Filter/Edit/EditFilterCard.tsx @@ -16,7 +16,7 @@ import { IconButton, useRequest, ConfirmDialog, - useSnackbar, + useSnackbar } from '@centreon/ui'; import { @@ -27,14 +27,14 @@ import { labelFilterUpdated, labelName, labelFilter, - labelNameCannotBeEmpty, + labelNameCannotBeEmpty } from '../../translatedLabels'; import { updateFilter, deleteFilter } from '../api'; import { Filter, newFilter } from '../models'; import { appliedFilterAtom, currentFilterAtom, - customFiltersAtom, + customFiltersAtom } from '../filterAtoms'; const useStyles = makeStyles((theme) => ({ @@ -43,8 +43,8 @@ const useStyles = makeStyles((theme) => ({ display: 'grid', gridAutoFlow: 'column', gridGap: theme.spacing(2), - gridTemplateColumns: 'auto 1fr', - }, + gridTemplateColumns: 'auto 1fr' + } })); interface Props { @@ -67,16 +67,16 @@ const EditFilterCard = ({ filter }: Props): JSX.Element => { const { sendRequest: sendUpdateFilterRequest, - sending: sendingUpdateFilterRequest, + sending: sendingUpdateFilterRequest } = useRequest({ - request: updateFilter, + request: updateFilter }); const { sendRequest: sendDeleteFilterRequest, - sending: sendingDeleteFilterRequest, + sending: sendingDeleteFilterRequest } = useRequest({ - request: deleteFilter, + request: deleteFilter }); const [currentFilter, setCurrentFilter] = useAtom(currentFilterAtom); @@ -86,20 +86,20 @@ const EditFilterCard = ({ filter }: Props): JSX.Element => { const { name, id } = filter; const validationSchema = Yup.object().shape({ - name: Yup.string().required(t(labelNameCannotBeEmpty)), + name: Yup.string().required(t(labelNameCannotBeEmpty)) }); const form = useFormik({ enableReinitialize: true, initialValues: { - name, + name }, onSubmit: (values) => { const updatedFilter = { ...filter, name: values.name }; sendUpdateFilterRequest({ filter: omit(['id'], updatedFilter), - id: updatedFilter.id, + id: updatedFilter.id }).then(() => { showSuccessMessage(t(labelFilterUpdated)); @@ -112,7 +112,7 @@ const EditFilterCard = ({ filter }: Props): JSX.Element => { setCustomFilters(update(index, updatedFilter, customFilters)); }); }, - validationSchema, + validationSchema }); const askDelete = (): void => { @@ -140,7 +140,7 @@ const EditFilterCard = ({ filter }: Props): JSX.Element => { const sendingRequest = any(equals(true), [ sendingDeleteFilterRequest, - sendingUpdateFilterRequest, + sendingUpdateFilterRequest ]); const canRename = all(equals(true), [form.isValid, form.dirty]); diff --git a/www/front_src/src/Resources/Filter/Edit/SortableContent.tsx b/www/front_src/src/Resources/Filter/Edit/SortableContent.tsx index 757db0b687e..a25b3ab1105 100644 --- a/www/front_src/src/Resources/Filter/Edit/SortableContent.tsx +++ b/www/front_src/src/Resources/Filter/Edit/SortableContent.tsx @@ -24,11 +24,11 @@ const useStyles = makeStyles((theme) => ({ display: 'grid', gridGap: theme.spacing(2), gridTemplateColumns: '1fr auto', - padding: theme.spacing(1), + padding: theme.spacing(1) }, filterCardHandler: ({ isDragging }): CreateCSSProperties => ({ - cursor: isDragging ? 'grabbing' : 'grab', - }), + cursor: isDragging ? 'grabbing' : 'grab' + }) })); const SortableContent = ({ @@ -39,7 +39,7 @@ const SortableContent = ({ criterias, id, name, - isDragging, + isDragging }: ContentProps): JSX.Element => { const classes = useStyles({ isDragging }); diff --git a/www/front_src/src/Resources/Filter/Edit/index.test.tsx b/www/front_src/src/Resources/Filter/Edit/index.test.tsx index 7f519210487..af138ab6ae4 100644 --- a/www/front_src/src/Resources/Filter/Edit/index.test.tsx +++ b/www/front_src/src/Resources/Filter/Edit/index.test.tsx @@ -24,7 +24,7 @@ const EditFilterPanelTest = (): JSX.Element => { @@ -43,7 +43,7 @@ const retrievedCustomFilters = { meta: { limit: 30, page: 1, - total: 1, + total: 1 }, result: [0, 1].map((index) => ({ criterias: [ @@ -51,60 +51,60 @@ const retrievedCustomFilters = { name: 'resource_types', object_type: null, type: 'multi_select', - value: [], + value: [] }, { name: 'states', object_type: null, type: 'multi_select', - value: [], + value: [] }, { name: 'statuses', object_type: null, type: 'multi_select', - value: [], + value: [] }, { name: 'host_groups', object_type: 'host_groups', type: 'multi_select', - value: [], + value: [] }, { name: 'service_groups', object_type: 'service_groups', type: 'multi_select', - value: [], + value: [] }, { name: 'host_categories', object_type: 'host_categories', type: 'multi_select', - value: [], + value: [] }, { name: 'service_categories', object_type: 'service_categories', type: 'multi_select', - value: [], + value: [] }, { name: 'search', object_type: null, type: 'text', - value: '', + value: '' }, { name: 'sort', object_type: null, type: 'array', - value: [defaultSortField, defaultSortOrder], - }, + value: [defaultSortField, defaultSortOrder] + } ], id: index, - name: `My filter ${index}`, - })), + name: `My filter ${index}` + })) }; const renderEditFilterPanel = (): RenderResult => @@ -146,22 +146,22 @@ describe(EditFilterPanel, () => { await waitFor(() => expect( - getByLabelText(`${labelFilter}-${firstFilter.id}-${labelName}`), - ).toBeInTheDocument(), + getByLabelText(`${labelFilter}-${firstFilter.id}-${labelName}`) + ).toBeInTheDocument() ); const renameFilterInput = getByLabelText( - `${labelFilter}-${firstFilter.id}-${labelName}`, + `${labelFilter}-${firstFilter.id}-${labelName}` ); fireEvent.change(renameFilterInput, { target: { - value: newName, - }, + value: newName + } }); fireEvent.keyDown(renameFilterInput, { - keyCode: 13, + keyCode: 13 }); await waitFor(() => { @@ -169,7 +169,7 @@ describe(EditFilterPanel, () => { expect(mockedAxios.put).toHaveBeenCalledWith( `${filterEndpoint}/${firstFilter.id}`, omit(['id'], { ...firstFilter, name: newName }), - expect.anything(), + expect.anything() ); }); }); @@ -191,17 +191,17 @@ describe(EditFilterPanel, () => { await waitFor(() => expect(getAllByLabelText(labelDelete)).toHaveLength(2)); fireEvent.click( - head(getAllByLabelText(labelDelete))?.firstElementChild as HTMLElement, + head(getAllByLabelText(labelDelete))?.firstElementChild as HTMLElement ); fireEvent.click(getByText(labelDelete) as HTMLElement); await waitFor(() => { expect(filterState.customFilters.map(prop('id'))).not.toContain( - firstFilter.id, + firstFilter.id ); expect(mockedAxios.delete).toHaveBeenCalledWith( `${filterEndpoint}/${firstFilter.id}`, - expect.anything(), + expect.anything() ); }); }); diff --git a/www/front_src/src/Resources/Filter/Edit/index.tsx b/www/front_src/src/Resources/Filter/Edit/index.tsx index 66bb2ba5275..bfc37cd9248 100644 --- a/www/front_src/src/Resources/Filter/Edit/index.tsx +++ b/www/front_src/src/Resources/Filter/Edit/index.tsx @@ -14,7 +14,7 @@ import { MemoizedSectionPanel as SectionPanel, useRequest, RootComponentProps, - SortableItems, + SortableItems } from '@centreon/ui'; import { labelEditFilters } from '../../translatedLabels'; @@ -27,26 +27,26 @@ import SortableContent from './SortableContent'; const useStyles = makeStyles((theme) => ({ container: { - width: '100%', + width: '100%' }, filters: { display: 'grid', gridAutoFlow: 'row', gridGap: theme.spacing(3), gridTemplateRows: '1fr', - width: '100%', + width: '100%' }, header: { alignItems: 'center', display: 'flex', height: '100%', - justifyContent: 'center', + justifyContent: 'center' }, loadingIndicator: { height: theme.spacing(1), marginBottom: theme.spacing(1), - width: '100%', - }, + width: '100%' + } })); const EditFiltersPanel = (): JSX.Element => { @@ -54,7 +54,7 @@ const EditFiltersPanel = (): JSX.Element => { const { t } = useTranslation(); const { sendRequest, sending } = useRequest({ - request: patchFilter, + request: patchFilter }); const [customFilters, setCustomFilters] = useAtom(customFiltersAtom); @@ -68,12 +68,12 @@ const EditFiltersPanel = (): JSX.Element => { const reorderedCutomFilters = map((id) => { const filter = find( (customFilter) => equals(Number(customFilter.id), Number(id)), - customFilters, + customFilters ) as Filter; return { ...filter, - order: items.indexOf(id), + order: items.indexOf(id) }; }, items); @@ -82,7 +82,7 @@ const EditFiltersPanel = (): JSX.Element => { const activeId = path(['active', 'id'], event); const destinationIndex = path( ['active', 'data', 'current', 'sortable', 'index'], - event, + event ) as number; sendRequest({ id: activeId, order: destinationIndex + 1 }); @@ -90,14 +90,14 @@ const EditFiltersPanel = (): JSX.Element => { const displayedFilters = map( ({ id, ...other }) => ({ ...other, id: `${id}` }), - customFilters, + customFilters ); const RootComponent = useCallback( ({ children }: RootComponentProps): JSX.Element => ( {children} ), - [], + [] ); const sections = [ @@ -124,8 +124,8 @@ const EditFiltersPanel = (): JSX.Element => { onDragEnd={dragEnd} /> - ), - }, + ) + } ]; const header = ( diff --git a/www/front_src/src/Resources/Filter/Fields/SelectFilter.tsx b/www/front_src/src/Resources/Filter/Fields/SelectFilter.tsx index d9bf561dbf7..94e3804dc6a 100644 --- a/www/front_src/src/Resources/Filter/Fields/SelectFilter.tsx +++ b/www/front_src/src/Resources/Filter/Fields/SelectFilter.tsx @@ -13,7 +13,7 @@ const SelectFilter = ({ options, selectedOptionId, onChange, - ariaLabel, + ariaLabel }: Props): JSX.Element => ( ({ Component: SelectFilter, - memoProps, + memoProps }); export default MemoizedSelectFilter; diff --git a/www/front_src/src/Resources/Filter/Save/CreateFilterDialog.tsx b/www/front_src/src/Resources/Filter/Save/CreateFilterDialog.tsx index ff998ad7d05..f578a77545b 100644 --- a/www/front_src/src/Resources/Filter/Save/CreateFilterDialog.tsx +++ b/www/front_src/src/Resources/Filter/Save/CreateFilterDialog.tsx @@ -12,7 +12,7 @@ import { labelCancel, labelName, labelNewFilter, - labelRequired, + labelRequired } from '../../translatedLabels'; import { createFilter } from '../api'; import { Filter } from '../models'; @@ -30,16 +30,16 @@ const CreateFilterDialog = ({ filter, onCreate, open, - onCancel, + onCancel }: Props): JSX.Element => { const { t } = useTranslation(); const { sendRequest, sending } = useRequest({ - request: createFilter, + request: createFilter }); const form = useFormik({ initialValues: { - name: '', + name: '' }, onSubmit: (values) => { sendRequest({ criterias: filter.criterias, name: values.name }) @@ -47,13 +47,13 @@ const CreateFilterDialog = ({ .catch((requestError) => { form.setFieldError( 'name', - path(['response', 'data', 'message'], requestError), + path(['response', 'data', 'message'], requestError) ); }); }, validationSchema: Yup.object().shape({ - name: Yup.string().required(labelRequired), - }), + name: Yup.string().required(labelRequired) + }) }); const submitFormOnEnterKey = (event: KeyboardEvent): void => { diff --git a/www/front_src/src/Resources/Filter/Save/index.test.tsx b/www/front_src/src/Resources/Filter/Save/index.test.tsx index f508a41e8b2..6b0d6e8b9dd 100644 --- a/www/front_src/src/Resources/Filter/Save/index.test.tsx +++ b/www/front_src/src/Resources/Filter/Save/index.test.tsx @@ -12,7 +12,7 @@ import { labelSaveFilter, labelSave, labelSaveAsNew, - labelName, + labelName } from '../../translatedLabels'; import { filterEndpoint } from '../api'; import { Filter } from '../models'; @@ -30,14 +30,14 @@ const SaveMenuTest = (): JSX.Element => { context = { ...listingState, - ...filterState, + ...filterState }; return ( @@ -67,9 +67,9 @@ const getFilter = ({ search = 'my search', name = 'MyFilter' }): Filter => ({ value: [ { id: 'host', - name: 'Host', - }, - ], + name: 'Host' + } + ] }, { name: 'states', @@ -78,9 +78,9 @@ const getFilter = ({ search = 'my search', name = 'MyFilter' }): Filter => ({ value: [ { id: 'unhandled_problems', - name: 'Unhandled', - }, - ], + name: 'Unhandled' + } + ] }, { name: 'statuses', @@ -89,9 +89,9 @@ const getFilter = ({ search = 'my search', name = 'MyFilter' }): Filter => ({ value: [ { id: 'OK', - name: 'Ok', - }, - ], + name: 'Ok' + } + ] }, { name: 'host_groups', @@ -100,9 +100,9 @@ const getFilter = ({ search = 'my search', name = 'MyFilter' }): Filter => ({ value: [ { id: 0, - name: 'Linux-servers', - }, - ], + name: 'Linux-servers' + } + ] }, { name: 'service_groups', @@ -111,15 +111,15 @@ const getFilter = ({ search = 'my search', name = 'MyFilter' }): Filter => ({ value: [ { id: 0, - name: 'Web-services', - }, - ], + name: 'Web-services' + } + ] }, { name: 'monitoring_servers', object_type: 'monitoring_servers', type: 'multi_select', - value: [], + value: [] }, { name: 'host_categories', @@ -128,9 +128,9 @@ const getFilter = ({ search = 'my search', name = 'MyFilter' }): Filter => ({ value: [ { id: 0, - name: 'Linux', - }, - ], + name: 'Linux' + } + ] }, { name: 'service_categories', @@ -139,34 +139,34 @@ const getFilter = ({ search = 'my search', name = 'MyFilter' }): Filter => ({ value: [ { id: 0, - name: 'web-services', - }, - ], + name: 'web-services' + } + ] }, { name: 'search', object_type: null, type: 'text', - value: search, + value: search }, { name: 'sort', object_type: null, type: 'array', - value: [defaultSortField, defaultSortOrder], - }, + value: [defaultSortField, defaultSortOrder] + } ], id: filterId, - name, + name }); const retrievedCustomFilters = { meta: { limit: 30, page: 1, - total: 1, + total: 1 }, - result: [getFilter({})], + result: [getFilter({})] }; describe(SaveMenu, () => { @@ -191,11 +191,11 @@ describe(SaveMenu, () => { expect(last(getAllByText(labelSaveAsNew))).toHaveAttribute( 'aria-disabled', - 'true', + 'true' ); expect( - last(getAllByText(labelSave))?.parentElement?.parentElement, + last(getAllByText(labelSave))?.parentElement?.parentElement ).toHaveAttribute('aria-disabled', 'true'); }); @@ -211,13 +211,13 @@ describe(SaveMenu, () => { getFilterWithUpdatedCriteria({ criteriaName: 'search', criteriaValue: 'toto', - filter, - }), + filter + }) ); }); expect( - last(getAllByText(labelSave))?.parentElement?.parentElement, + last(getAllByText(labelSave))?.parentElement?.parentElement ).not.toHaveAttribute('aria-disabled'); fireEvent.click(last(getAllByText(labelSaveAsNew)) as HTMLElement); @@ -225,8 +225,8 @@ describe(SaveMenu, () => { act(() => { fireEvent.change(getByLabelText(labelName), { target: { - value: 'My new filter', - }, + value: 'My new filter' + } }); }); @@ -236,7 +236,7 @@ describe(SaveMenu, () => { expect(mockedAxios.post).toHaveBeenCalledWith( filterEndpoint, omit(['id'], getFilter({ name: 'My new filter', search: 'toto' })), - expect.anything(), + expect.anything() ); }); }); @@ -259,13 +259,13 @@ describe(SaveMenu, () => { getFilterWithUpdatedCriteria({ criteriaName: 'search', criteriaValue: newSearch, - filter, - }), + filter + }) ); }); expect(last(getAllByText(labelSave))?.parentElement).not.toHaveAttribute( - 'aria-disabled', + 'aria-disabled' ); fireEvent.click(last(getAllByText(labelSave)) as HTMLElement); @@ -274,7 +274,7 @@ describe(SaveMenu, () => { expect(mockedAxios.put).toHaveBeenCalledWith( `${filterEndpoint}/${context.currentFilter.id}`, omit(['id'], getFilter({ search: newSearch })), - expect.anything(), + expect.anything() ); }); }); diff --git a/www/front_src/src/Resources/Filter/Save/index.tsx b/www/front_src/src/Resources/Filter/Save/index.tsx index c8b6b157fdd..cb104c6470e 100644 --- a/www/front_src/src/Resources/Filter/Save/index.tsx +++ b/www/front_src/src/Resources/Filter/Save/index.tsx @@ -9,7 +9,7 @@ import { find, propEq, pipe, - symmetricDifference, + symmetricDifference } from 'ramda'; import { useTranslation } from 'react-i18next'; import { useAtomValue, useUpdateAtom } from 'jotai/utils'; @@ -27,7 +27,7 @@ import { labelSave, labelFilterCreated, labelFilterSaved, - labelEditFilters, + labelEditFilters } from '../../translatedLabels'; import { listCustomFilters, updateFilter as updateFilterRequest } from '../api'; import { Filter } from '../models'; @@ -37,7 +37,7 @@ import { customFiltersAtom, editPanelOpenAtom, filtersDerivedAtom, - sendingFilterAtom, + sendingFilterAtom } from '../filterAtoms'; import { listCustomFiltersDecoder } from '../api/decoders'; @@ -50,8 +50,8 @@ const useStyles = makeStyles((theme) => ({ alignItems: 'center', display: 'grid', gridAutoFlow: 'column', - gridGap: theme.spacing(2), - }, + gridGap: theme.spacing(2) + } })); const SaveFilterMenu = (): JSX.Element => { @@ -64,14 +64,14 @@ const SaveFilterMenu = (): JSX.Element => { const { sendRequest: sendListCustomFiltersRequest, sending } = useRequest({ decoder: listCustomFiltersDecoder, - request: listCustomFilters, + request: listCustomFilters }); const { sendRequest: sendUpdateFilterRequest, - sending: sendingUpdateFilterRequest, + sending: sendingUpdateFilterRequest } = useRequest({ - request: updateFilterRequest, + request: updateFilterRequest }); const [customFilters, setCustomFilters] = useAtom(customFiltersAtom); @@ -125,7 +125,7 @@ const SaveFilterMenu = (): JSX.Element => { const updateFilter = (): void => { sendUpdateFilterRequest({ filter: omit(['id'], currentFilter), - id: currentFilter.id, + id: currentFilter.id }).then((savedFilter) => { closeSaveFilterMenu(); showSuccessMessage(t(labelFilterSaved)); @@ -144,7 +144,7 @@ const SaveFilterMenu = (): JSX.Element => { return !areValuesEqual( currentFilter.criterias, - retrievedFilter?.criterias || [], + retrievedFilter?.criterias || [] ); }; diff --git a/www/front_src/src/Resources/Filter/api/decoders.ts b/www/front_src/src/Resources/Filter/api/decoders.ts index 4448cd92519..a4bd5cdec7f 100644 --- a/www/front_src/src/Resources/Filter/api/decoders.ts +++ b/www/front_src/src/Resources/Filter/api/decoders.ts @@ -27,43 +27,43 @@ const entityDecoder = JsonDecoder.object( { id: JsonDecoder.oneOf( [JsonDecoder.number, JsonDecoder.string], - 'FilterCriteriaMultiSelectId', + 'FilterCriteriaMultiSelectId' ), - name: JsonDecoder.string, + name: JsonDecoder.string }, - 'FilterCriteriaMultiSelectValue', + 'FilterCriteriaMultiSelectValue' ), - 'FilterCriteriaValues', + 'FilterCriteriaValues' ), JsonDecoder.tuple( [ JsonDecoder.string, JsonDecoder.enumeration( SortOrder, - 'FilterCriteriaSortOrder', - ), + 'FilterCriteriaSortOrder' + ) ], - 'FilterCriteriaTuple', - ), + 'FilterCriteriaTuple' + ) ], - 'FilterCriteriaValue', - ), - ), + 'FilterCriteriaValue' + ) + ) }, - 'FilterCriterias', + 'FilterCriterias' ), - 'FilterCriterias', + 'FilterCriterias' ), id: JsonDecoder.number, - name: JsonDecoder.string, + name: JsonDecoder.string }, - 'CustomFilter', + 'CustomFilter' ); const listCustomFiltersDecoder = buildListingDecoder({ entityDecoder, entityDecoderName: 'CustomFilter', - listingDecoderName: 'CustomFilters', + listingDecoderName: 'CustomFilters' }); export { listCustomFiltersDecoder }; diff --git a/www/front_src/src/Resources/Filter/api/endpoint.ts b/www/front_src/src/Resources/Filter/api/endpoint.ts index c621b2e486b..aebbef26d1d 100644 --- a/www/front_src/src/Resources/Filter/api/endpoint.ts +++ b/www/front_src/src/Resources/Filter/api/endpoint.ts @@ -1,7 +1,7 @@ import { buildListingEndpoint, BuildListingEndpointParameters, - ListingParameters, + ListingParameters } from '@centreon/ui'; import { baseEndpoint } from '../../../api/endpoint'; @@ -18,56 +18,56 @@ const serviceSeveritiesEndpoint = `${monitoringEndpoint}/severities/service`; const buildHostGroupsEndpoint = (parameters: ListingParameters): string => { return buildListingEndpoint({ baseEndpoint: hostgroupsEndpoint, - parameters, + parameters }); }; const buildServiceGroupsEndpoint = ( - parameters: BuildListingEndpointParameters, + parameters: BuildListingEndpointParameters ): string => { return buildListingEndpoint({ baseEndpoint: serviceGroupsEndpoint, - parameters, + parameters }); }; const buildMonitoringServersEndpoint = ( - parameters: BuildListingEndpointParameters, + parameters: BuildListingEndpointParameters ): string => { return buildListingEndpoint({ baseEndpoint: monitoringServersEndpoint, - parameters, + parameters }); }; const buildHostCategoriesEndpoint = ( - parameters: BuildListingEndpointParameters, + parameters: BuildListingEndpointParameters ): string => { return buildListingEndpoint({ baseEndpoint: hostCategoriesEndpoint, - parameters, + parameters }); }; const buildServiceCategoriesEndpoint = ( - parameters: BuildListingEndpointParameters, + parameters: BuildListingEndpointParameters ): string => { return buildListingEndpoint({ baseEndpoint: serviceCategoriesEndpoint, - parameters, + parameters }); }; const buildHostServeritiesEndpoint = (parameters): string => { return buildListingEndpoint({ baseEndpoint: hostSeveritiesEndpoint, - parameters, + parameters }); }; const buildServiceSeveritiesEndpoint = (parameters): string => { return buildListingEndpoint({ baseEndpoint: serviceSeveritiesEndpoint, - parameters, + parameters }); }; @@ -78,5 +78,5 @@ export { buildServiceGroupsEndpoint, buildMonitoringServersEndpoint, buildHostServeritiesEndpoint, - buildServiceSeveritiesEndpoint, + buildServiceSeveritiesEndpoint }; diff --git a/www/front_src/src/Resources/Filter/api/index.ts b/www/front_src/src/Resources/Filter/api/index.ts index 1152d96ba23..9c127f7f9ba 100644 --- a/www/front_src/src/Resources/Filter/api/index.ts +++ b/www/front_src/src/Resources/Filter/api/index.ts @@ -7,7 +7,7 @@ import { postData, putData, deleteData, - patchData, + patchData } from '@centreon/ui'; import { baseEndpoint } from '../../../api/endpoint'; @@ -21,17 +21,17 @@ interface ListCustomFiltersProps { } const buildListCustomFiltersEndpoint = ( - parameters: ListCustomFiltersProps, + parameters: ListCustomFiltersProps ): string => buildListingEndpoint({ baseEndpoint: filterEndpoint, - parameters, + parameters }); const listCustomFilters = (cancelToken: CancelToken) => (): Promise> => getData>(cancelToken)({ - endpoint: buildListCustomFiltersEndpoint({ limit: 100, page: 1 }), + endpoint: buildListCustomFiltersEndpoint({ limit: 100, page: 1 }) }); type FilterWithoutId = Omit; @@ -41,7 +41,7 @@ const createFilter = (filter: FilterWithoutId): Promise => { return postData(cancelToken)({ data: filter, - endpoint: filterEndpoint, + endpoint: filterEndpoint }); }; @@ -55,7 +55,7 @@ const updateFilter = (parameters: UpdateFilterProps): Promise => { return putData(cancelToken)({ data: parameters.filter, - endpoint: `${filterEndpoint}/${parameters.id}`, + endpoint: `${filterEndpoint}/${parameters.id}` }); }; @@ -69,7 +69,7 @@ const patchFilter = (parameters: PatchFilterProps): Promise => { return patchData(cancelToken)({ data: { order: parameters.order }, - endpoint: `${filterEndpoint}/${parameters.id}`, + endpoint: `${filterEndpoint}/${parameters.id}` }); }; @@ -86,5 +86,5 @@ export { createFilter, updateFilter, patchFilter, - deleteFilter, + deleteFilter }; diff --git a/www/front_src/src/Resources/Filter/filterAtoms.ts b/www/front_src/src/Resources/Filter/filterAtoms.ts index d6310a02f3f..2389098e632 100644 --- a/www/front_src/src/Resources/Filter/filterAtoms.ts +++ b/www/front_src/src/Resources/Filter/filterAtoms.ts @@ -14,7 +14,7 @@ import { propEq, reduce, set as update, - values, + values } from 'ramda'; import { TFunction } from 'react-i18next'; @@ -30,7 +30,7 @@ import { isCustom, newFilter, resourceProblemsFilter, - unhandledProblemsFilter, + unhandledProblemsFilter } from './models'; import { build, parse } from './Criterias/searchQueryLanguage'; import { getStoredOrDefaultFilter } from './storedFilter'; @@ -39,7 +39,7 @@ export const filterKey = `${baseKey}filter`; export const storedFilterAtom = atomWithStorage( filterKey, - unhandledProblemsFilter, + unhandledProblemsFilter ); export const getDefaultFilterDerivedAtom = atom(() => (): Filter => { @@ -55,12 +55,12 @@ export const getDefaultFilterDerivedAtom = atom(() => (): Filter => { const mergedCriterias = pipe( map(indexBy(prop('name'))), reduce(mergeWith(mergeRight), {}), - values, + values )([allFilter.criterias, filterFromUrl.criterias]); return { ...mergeRight(newFilter, filterFromUrl), - criterias: mergedCriterias, + criterias: mergedCriterias }; } @@ -69,10 +69,10 @@ export const getDefaultFilterDerivedAtom = atom(() => (): Filter => { export const customFiltersAtom = atom>([]); export const currentFilterAtom = atomWithDefault((get) => - get(getDefaultFilterDerivedAtom)(), + get(getDefaultFilterDerivedAtom)() ); export const appliedFilterAtom = atomWithDefault((get) => - get(getDefaultFilterDerivedAtom)(), + get(getDefaultFilterDerivedAtom)() ); export const editPanelOpenAtom = atom(false); export const searchAtom = atom(''); @@ -82,8 +82,8 @@ export const filterWithParsedSearchDerivedAtom = atom((get) => ({ ...get(currentFilterAtom), criterias: [ ...parse({ search: get(searchAtom) }), - find(propEq('name', 'sort'), get(currentFilterAtom).criterias) as Criteria, - ], + find(propEq('name', 'sort'), get(currentFilterAtom).criterias) as Criteria + ] })); export const filterByInstalledModulesWithParsedSearchDerivedAtom = atom( @@ -95,36 +95,36 @@ export const filterByInstalledModulesWithParsedSearchDerivedAtom = atom( ...parse({ criteriaName, search: get(searchAtom) }), find( propEq('name', 'sort'), - get(currentFilterAtom).criterias, - ) as Criteria, - ], + get(currentFilterAtom).criterias + ) as Criteria + ] }; return result; - }, + } ); export const getFilterWithUpdatedCriteriaDerivedAtom = atom( (get) => ({ name, value }): Filter => { const index = findIndex(propEq('name', name))( - get(filterWithParsedSearchDerivedAtom).criterias, + get(filterWithParsedSearchDerivedAtom).criterias ); const lens = lensPath(['criterias', index, 'value']); return update(lens, value, get(filterWithParsedSearchDerivedAtom)); - }, + } ); export const setCriteriaDerivedAtom = atom( null, (get, set, { name, value = false }) => { const getFilterWithUpdatedCriteria = get( - getFilterWithUpdatedCriteriaDerivedAtom, + getFilterWithUpdatedCriteriaDerivedAtom ); set(currentFilterAtom, getFilterWithUpdatedCriteria({ name, value })); - }, + } ); export const applyFilterDerivedAtom = atom(null, (get, set, filter: Filter) => { @@ -138,13 +138,13 @@ export const setCriteriaAndNewFilterDerivedAtom = atom( (get, set, { name, value, apply = false }) => { const currentFilter = get(currentFilterAtom); const getFilterWithUpdatedCriteria = get( - getFilterWithUpdatedCriteriaDerivedAtom, + getFilterWithUpdatedCriteriaDerivedAtom ); const isCustomFilter = isCustom(currentFilter); const updatedFilter = { ...getFilterWithUpdatedCriteria({ name, value }), - ...(!isCustomFilter && newFilter), + ...(!isCustomFilter && newFilter) }; set(searchAtom, build(updatedFilter.criterias)); @@ -156,7 +156,7 @@ export const setCriteriaAndNewFilterDerivedAtom = atom( } set(currentFilterAtom, updatedFilter); - }, + } ); export const setNewFilterDerivedAtom = atom(null, (get, set, t: TFunction) => { @@ -169,7 +169,7 @@ export const setNewFilterDerivedAtom = atom(null, (get, set, t: TFunction) => { const emptyFilter = { criterias: currentFilter.criterias, id: '', - name: t(labelNewFilter), + name: t(labelNewFilter) }; set(currentFilterAtom, emptyFilter); @@ -181,7 +181,7 @@ export const getCriteriaValueDerivedAtom = atom( const filterWithParsedSearch = get(filterWithParsedSearchDerivedAtom); const criteria = find(propEq('name', name))( - filterWithParsedSearch.criterias, + filterWithParsedSearch.criterias ); if (isNil(criteria)) { @@ -189,7 +189,7 @@ export const getCriteriaValueDerivedAtom = atom( } return criteria.value; - }, + } ); export const applyCurrentFilterDerivedAtom = atom(null, (get, set) => { @@ -204,5 +204,5 @@ export const filtersDerivedAtom = atom((get) => [ unhandledProblemsFilter, allFilter, resourceProblemsFilter, - ...get(customFiltersAtom), + ...get(customFiltersAtom) ]); diff --git a/www/front_src/src/Resources/Filter/index.test.tsx b/www/front_src/src/Resources/Filter/index.test.tsx index 5a842ad4396..61169ed6bbd 100644 --- a/www/front_src/src/Resources/Filter/index.test.tsx +++ b/www/front_src/src/Resources/Filter/index.test.tsx @@ -14,7 +14,7 @@ import { act, TestQueryProvider, resetMocks, - mockResponseOnce, + mockResponseOnce } from '@centreon/ui'; import { refreshIntervalAtom, userAtom } from '@centreon/ui-context'; @@ -34,7 +34,7 @@ import { labelSearchOptions, labelStatusType, labelSoft, - labelType, + labelType } from '../translatedLabels'; import useListing from '../Listing/useListing'; import useActions from '../testUtils/useActions'; @@ -47,7 +47,7 @@ import { getFilterWithUpdatedCriteria, getListingEndpoint, searchableFields, - defaultStateTypes, + defaultStateTypes } from '../testUtils'; import useLoadDetails from '../testUtils/useLoadDetails'; import useDetails from '../Details/useDetails'; @@ -65,7 +65,7 @@ const mockedAxios = axios as jest.Mocked; const mockUser = { isExportButtonEnabled: true, locale: 'en', - timezone: 'Europe/Paris', + timezone: 'Europe/Paris' }; const mockRefreshInterval = 60; @@ -73,19 +73,19 @@ jest.useFakeTimers(); const linuxServersHostGroup = { id: 0, - name: 'Linux-servers', + name: 'Linux-servers' }; const webAccessServiceGroup = { id: 0, - name: 'Web-access', + name: 'Web-access' }; type FilterParameter = [ string, string, Record, - (() => void) | undefined, + (() => void) | undefined ]; const filterParams: Array = [ @@ -94,90 +94,90 @@ const filterParams: Array = [ labelState, labelAcknowledged, { - states: [...defaultStates, 'acknowledged'], + states: [...defaultStates, 'acknowledged'] }, - undefined, + undefined ], [ labelStatus, labelOk, { - statuses: [...defaultStatuses, 'OK'], + statuses: [...defaultStatuses, 'OK'] }, - undefined, + undefined ], [ labelStatusType, labelSoft, { - statusTypes: [...defaultStateTypes, 'soft'], + statusTypes: [...defaultStateTypes, 'soft'] }, - undefined, + undefined ], [ labelHostGroup, linuxServersHostGroup.name, { - hostGroups: [linuxServersHostGroup.name], + hostGroups: [linuxServersHostGroup.name] }, (): void => { mockResponseOnce({ data: { meta: { limit: 10, - total: 1, + total: 1 }, - result: [linuxServersHostGroup], - }, + result: [linuxServersHostGroup] + } }); - }, + } ], [ labelServiceGroup, webAccessServiceGroup.name, { - serviceGroups: [webAccessServiceGroup.name], + serviceGroups: [webAccessServiceGroup.name] }, (): void => { mockResponseOnce({ data: { meta: { limit: 10, - total: 1, + total: 1 }, - result: [webAccessServiceGroup], - }, + result: [webAccessServiceGroup] + } }); - }, - ], + } + ] ]; const filter = { criterias: [ { name: 'resource_types', - value: [{ id: 'host', name: labelHost }], + value: [{ id: 'host', name: labelHost }] }, { name: 'states', - value: [{ id: 'acknowledged', name: labelAcknowledged }], + value: [{ id: 'acknowledged', name: labelAcknowledged }] }, { name: 'statuses', value: [{ id: 'OK', name: labelOk }] }, { name: 'host_groups', object_type: 'host_groups', - value: [linuxServersHostGroup], + value: [linuxServersHostGroup] }, { name: 'service_groups', object_type: 'service_groups', - value: [webAccessServiceGroup], + value: [webAccessServiceGroup] }, { name: 'search', value: 'Search me' }, - { name: 'sort', value: [defaultSortField, defaultSortOrder] }, + { name: 'sort', value: [defaultSortField, defaultSortOrder] } ], id: 0, - name: 'My filter', + name: 'My filter' }; const hostGroupsData = { @@ -186,22 +186,22 @@ const hostGroupsData = { page: 1, search: {}, sort_by: {}, - total: 3, + total: 3 }, result: [ { id: 72, - name: 'ESX-Servers', + name: 'ESX-Servers' }, { id: 60, - name: 'Firewall', + name: 'Firewall' }, { id: 70, - name: 'IpCam-Hardware', - }, - ], + name: 'IpCam-Hardware' + } + ] }; const FilterWithLoading = (): JSX.Element => { @@ -225,7 +225,7 @@ const FilterTest = (): JSX.Element | null => { { ...listingState, ...actionsState, - ...detailsState, + ...detailsState } as ResourceContext } > @@ -239,7 +239,7 @@ const FilterTestWitJotai = (): JSX.Element => ( @@ -263,10 +263,10 @@ const dynamicCriteriaRequests = (): void => { meta: { limit: 30, page: 1, - total: 0, + total: 0 }, - result: [], - }, + result: [] + } }) .mockResolvedValueOnce({ data: {} }) .mockResolvedValue({ data: hostGroupsData }); @@ -280,10 +280,10 @@ describe(Filter, () => { meta: { limit: 30, page: 1, - total: 0, + total: 0 }, - result: [], - }, + result: [] + } }) .mockResolvedValue({ data: {} }); }); @@ -303,8 +303,8 @@ describe(Filter, () => { await waitFor(() => expect(mockedAxios.get).toHaveBeenCalledWith( getListingEndpoint({}), - cancelTokenRequestParam, - ), + cancelTokenRequestParam + ) ); }); @@ -326,7 +326,7 @@ describe(Filter, () => { mockedAxios.get.mockResolvedValueOnce({ data: {} }); userEvent.click( - getByLabelText(labelSearchOptions).firstElementChild as HTMLElement, + getByLabelText(labelSearchOptions).firstElementChild as HTMLElement ); fireEvent.click(getByText(labelSearch)); @@ -334,16 +334,16 @@ describe(Filter, () => { const endpoint = getListingEndpoint({ search: fieldSearchValue }); expect(decodeURIComponent(endpoint)).toContain( - `search={"$and":[{"${searchableField}":{"$rg":"${search}"}}]}`, + `search={"$and":[{"${searchableField}":{"$rg":"${search}"}}]}` ); await waitFor(() => expect(mockedAxios.get).toHaveBeenCalledWith( endpoint, - cancelTokenRequestParam, - ), + cancelTokenRequestParam + ) ); - }, + } ); it('executes a listing request with an "$or" search param containing all searchable fields when a string that does not correspond to any searchable field is typed in the search field', async () => { @@ -358,7 +358,7 @@ describe(Filter, () => { userEvent.type(getByPlaceholderText(labelSearch), searchValue); userEvent.click( - getByLabelText(labelSearchOptions).firstElementChild as HTMLElement, + getByLabelText(labelSearchOptions).firstElementChild as HTMLElement ); fireEvent.click(getByText(labelSearch)); @@ -366,18 +366,18 @@ describe(Filter, () => { const endpoint = getListingEndpoint({ search: searchValue }); const searchableFieldExpressions = searchableFields.map( - (searchableField) => `{"${searchableField}":{"$rg":"${searchValue}"}}`, + (searchableField) => `{"${searchableField}":{"$rg":"${searchValue}"}}` ); expect(decodeURIComponent(endpoint)).toContain( - `search={"$or":[${searchableFieldExpressions}]}`, + `search={"$or":[${searchableFieldExpressions}]}` ); await waitFor(() => expect(mockedAxios.get).toHaveBeenCalledWith( endpoint, - cancelTokenRequestParam, - ), + cancelTokenRequestParam + ) ); const searchInput = getByPlaceholderText(labelSearch); @@ -387,8 +387,8 @@ describe(Filter, () => { await waitFor(() => expect(mockedAxios.get).toHaveBeenCalledWith( endpoint, - cancelTokenRequestParam, - ), + cancelTokenRequestParam + ) ); }); @@ -399,8 +399,8 @@ describe(Filter, () => { resourceTypes: [], states: [], statusTypes: [], - statuses: defaultStatuses, - }, + statuses: defaultStatuses + } ], [ labelAll, @@ -408,9 +408,9 @@ describe(Filter, () => { resourceTypes: [], states: [], statusTypes: [], - statuses: [], - }, - ], + statuses: [] + } + ] ])( 'executes a listing request with "%p" parameters when "%p" filter is set', async (filterGroup, criterias) => { @@ -423,7 +423,7 @@ describe(Filter, () => { mockedAxios.get.mockResolvedValueOnce({ data: {} }); await waitFor(() => - expect(getByText(labelUnhandledProblems)).toBeInTheDocument(), + expect(getByText(labelUnhandledProblems)).toBeInTheDocument() ); userEvent.click(getByText(labelUnhandledProblems)); @@ -433,10 +433,10 @@ describe(Filter, () => { await waitFor(() => { expect(mockedAxios.get).toHaveBeenLastCalledWith( getListingEndpoint(criterias), - cancelTokenRequestParam, + cancelTokenRequestParam ); }); - }, + } ); it.each(filterParams)( @@ -445,7 +445,7 @@ describe(Filter, () => { criteriaName, optionToSelect, endpointParamChanged, - selectEndpointMockAction, + selectEndpointMockAction ) => { const { getByLabelText, getByPlaceholderText, findByText, getByText } = renderFilter(); @@ -460,7 +460,7 @@ describe(Filter, () => { userEvent.type(getByPlaceholderText(labelSearch), searchValue); fireEvent.click( - getByLabelText(labelSearchOptions).firstElementChild as HTMLElement, + getByLabelText(labelSearchOptions).firstElementChild as HTMLElement ); fireEvent.click(getByText(criteriaName)); @@ -474,12 +474,12 @@ describe(Filter, () => { expect(mockedAxios.get).toHaveBeenCalledWith( getListingEndpoint({ search: searchValue, - ...endpointParamChanged, + ...endpointParamChanged }), - cancelTokenRequestParam, + cancelTokenRequestParam ); }); - }, + } ); it.each([ @@ -488,8 +488,8 @@ describe(Filter, () => { 'enter', (): void => { userEvent.keyboard('{Enter}'); - }, - ], + } + ] ])( 'accepts the selected autocomplete suggestion when the beginning of a dynamic criteria is input and the %p key is pressed', async (_, keyboardAction) => { @@ -502,7 +502,7 @@ describe(Filter, () => { userEvent.type( getByPlaceholderText(labelSearch), - '{selectall}{backspace}host', + '{selectall}{backspace}host' ); keyboardAction(); @@ -520,11 +520,11 @@ describe(Filter, () => { conditions: [], regex: { fields: ['name'], - value: 'ESX', - }, - }, + value: 'ESX' + } + } }), - cancelTokenRequestParam, + cancelTokenRequestParam ); }); @@ -534,8 +534,8 @@ describe(Filter, () => { await waitFor(() => expect(getByPlaceholderText(labelSearch)).toHaveValue( - 'host_group:ESX-Servers', - ), + 'host_group:ESX-Servers' + ) ); userEvent.type(getByPlaceholderText(labelSearch), ','); @@ -549,16 +549,16 @@ describe(Filter, () => { conditions: [ { field: 'name', - values: { $ni: ['ESX-Servers'] }, - }, + values: { $ni: ['ESX-Servers'] } + } ], regex: { fields: ['name'], - value: '', - }, - }, + value: '' + } + } }), - cancelTokenRequestParam, + cancelTokenRequestParam ); }); @@ -570,10 +570,10 @@ describe(Filter, () => { await waitFor(() => expect(getByPlaceholderText(labelSearch)).toHaveValue( - 'host_group:ESX-Servers,Firewall', - ), + 'host_group:ESX-Servers,Firewall' + ) ); - }, + } ); it('accepts the selected autocomplete suggestion when the beginning of a criteria is input and the tab key is pressed', async () => { @@ -585,7 +585,7 @@ describe(Filter, () => { userEvent.type( getByPlaceholderText(labelSearch), - '{selectall}{backspace}stat', + '{selectall}{backspace}stat' ); userEvent.tab(); @@ -603,7 +603,7 @@ describe(Filter, () => { userEvent.tab(); expect(getByPlaceholderText(labelSearch)).toHaveValue( - 'state:unhandled status:', + 'state:unhandled status:' ); userEvent.type(getByPlaceholderText(labelSearch), ' type:'); @@ -613,7 +613,7 @@ describe(Filter, () => { userEvent.tab(); expect(getByPlaceholderText(labelSearch)).toHaveValue( - 'state:unhandled status: type:service', + 'state:unhandled status: type:service' ); }); @@ -628,10 +628,10 @@ describe(Filter, () => { meta: { limit: 30, page: 1, - total: 0, + total: 0 }, - result: [linuxServersHostGroup], - }, + result: [linuxServersHostGroup] + } }); mockResponseOnce({ @@ -639,10 +639,10 @@ describe(Filter, () => { meta: { limit: 30, page: 1, - total: 0, + total: 0 }, - result: [webAccessServiceGroup], - }, + result: [webAccessServiceGroup] + } }); mockedAxios.get @@ -651,20 +651,20 @@ describe(Filter, () => { meta: { limit: 30, page: 1, - total: 0, + total: 0 }, - result: [], - }, + result: [] + } }) .mockResolvedValueOnce({ data: { meta: { limit: 30, page: 1, - total: 0, + total: 0 }, - result: [], - }, + result: [] + } }); const renderResult = renderFilter(); @@ -674,7 +674,7 @@ describe(Filter, () => { queryByLabelText, findByPlaceholderText, getByLabelText, - findByText, + findByText } = renderResult; await waitFor(() => expect(mockedAxios.get).toHaveBeenCalledTimes(3)); @@ -688,11 +688,11 @@ describe(Filter, () => { const searchField = await findByPlaceholderText(labelSearch); expect(searchField).toHaveValue( - 'type:host state:acknowledged status:ok host_group:Linux-servers service_group:Web-access Search me', + 'type:host state:acknowledged status:ok host_group:Linux-servers service_group:Web-access Search me' ); userEvent.click( - getByLabelText(labelSearchOptions).firstElementChild as HTMLElement, + getByLabelText(labelSearchOptions).firstElementChild as HTMLElement ); userEvent.click(getByText(labelType)); @@ -719,7 +719,7 @@ describe(Filter, () => { await waitFor(() => expect(mockedAxios.get).toHaveBeenCalled()); const webAccessServiceGroupOption = await findByText( - webAccessServiceGroup.name, + webAccessServiceGroup.name ); expect(webAccessServiceGroupOption).toBeInTheDocument(); @@ -744,7 +744,7 @@ describe(Filter, () => { expect(mockedLocalStorageSetItem).toHaveBeenCalledWith( filterKey, - JSON.stringify(allFilter), + JSON.stringify(allFilter) ); const searchField = await findByPlaceholderText(labelSearch); @@ -758,10 +758,10 @@ describe(Filter, () => { getFilterWithUpdatedCriteria({ criteriaName: 'search', criteriaValue: 'searching...', - filter: { ...allFilter, id: '', name: labelNewFilter }, - }), - ), - ), + filter: { ...allFilter, id: '', name: labelNewFilter } + }) + ) + ) ); }); }); @@ -771,8 +771,8 @@ describe(Filter, () => { setUrlQueryParameters([ { name: 'filter', - value: filter, - }, + value: filter + } ]); mockResponseOnce({ @@ -780,10 +780,10 @@ describe(Filter, () => { meta: { limit: 30, page: 1, - total: 0, + total: 0 }, - result: [linuxServersHostGroup], - }, + result: [linuxServersHostGroup] + } }); mockResponseOnce({ @@ -791,10 +791,10 @@ describe(Filter, () => { meta: { limit: 30, page: 1, - total: 0, + total: 0 }, - result: [webAccessServiceGroup], - }, + result: [webAccessServiceGroup] + } }); mockedAxios.get @@ -803,27 +803,27 @@ describe(Filter, () => { meta: { limit: 30, page: 1, - total: 0, + total: 0 }, - result: [], - }, + result: [] + } }) .mockResolvedValueOnce({ data: { meta: { limit: 30, page: 1, - total: 0, + total: 0 }, - result: [], - }, + result: [] + } }); const { getByText, getByDisplayValue, getAllByPlaceholderText, - getByLabelText, + getByLabelText } = renderFilter(); await waitFor(() => { @@ -835,12 +835,12 @@ describe(Filter, () => { }); expect( getByDisplayValue( - 'type:host state:acknowledged status:ok host_group:Linux-servers service_group:Web-access Search me', - ), + 'type:host state:acknowledged status:ok host_group:Linux-servers service_group:Web-access Search me' + ) ).toBeInTheDocument(); fireEvent.click( - getByLabelText(labelSearchOptions).firstElementChild as HTMLElement, + getByLabelText(labelSearchOptions).firstElementChild as HTMLElement ); fireEvent.click(getByText(labelType)); @@ -857,7 +857,7 @@ describe(Filter, () => { await waitFor(() => expect(mockedAxios.get).toHaveBeenCalled()); await waitFor(() => - expect(getByText(linuxServersHostGroup.name)).toBeInTheDocument(), + expect(getByText(linuxServersHostGroup.name)).toBeInTheDocument() ); await waitFor(() => { @@ -869,7 +869,7 @@ describe(Filter, () => { await waitFor(() => expect(mockedAxios.get).toHaveBeenCalled()); await waitFor(() => - expect(getByText(webAccessServiceGroup.name)).toBeInTheDocument(), + expect(getByText(webAccessServiceGroup.name)).toBeInTheDocument() ); await waitFor(() => { @@ -877,7 +877,7 @@ describe(Filter, () => { }); fireEvent.change(getAllByPlaceholderText(labelSearch)[0], { - target: { value: 'Search me two' }, + target: { value: 'Search me two' } }); const filterFromUrlQueryParameters = getUrlQueryParameters() @@ -886,8 +886,8 @@ describe(Filter, () => { expect( getCriteriaValue({ filter: filterFromUrlQueryParameters, - name: 'search', - }), + name: 'search' + }) ).toEqual('Search me two'); }); @@ -900,9 +900,9 @@ describe(Filter, () => { { name: 'filter', value: { - criterias: [{ name: 'search', value: 'Search me' }], - }, - }, + criterias: [{ name: 'search', value: 'Search me' }] + } + } ]); const { getByDisplayValue, queryByText } = renderFilter(); @@ -912,7 +912,7 @@ describe(Filter, () => { }); await waitFor(() => - expect(getByDisplayValue('Search me')).toBeInTheDocument(), + expect(getByDisplayValue('Search me')).toBeInTheDocument() ); expect(queryByText(labelHost)).toBeNull(); expect(queryByText(labelAcknowledged)).toBeNull(); @@ -926,8 +926,8 @@ describe(Filter, () => { expect( getCriteriaValue({ filter: filterFromUrlQueryParameters, - name: 'search', - }), + name: 'search' + }) ).toEqual('Search me'); }); }); diff --git a/www/front_src/src/Resources/Filter/index.tsx b/www/front_src/src/Resources/Filter/index.tsx index e96bf2adf1f..9145a368842 100644 --- a/www/front_src/src/Resources/Filter/index.tsx +++ b/www/front_src/src/Resources/Filter/index.tsx @@ -5,7 +5,7 @@ import { useEffect, KeyboardEvent, Suspense, - RefObject, + RefObject } from 'react'; import { @@ -27,7 +27,7 @@ import { pipe, dropLast, or, - remove, + remove } from 'ramda'; import { useTranslation } from 'react-i18next'; import { useAtomValue, useUpdateAtom } from 'jotai/utils'; @@ -39,7 +39,7 @@ import { ClickAwayListener, MenuItem, Paper, - Popper, + Popper } from '@mui/material'; import makeStyles from '@mui/styles/makeStyles'; @@ -50,7 +50,7 @@ import { IconButton, getData, useRequest, - LoadingSkeleton, + LoadingSkeleton } from '@centreon/ui'; import { @@ -58,7 +58,7 @@ import { labelSearch, labelNewFilter, labelMyFilters, - labelClearFilter, + labelClearFilter } from '../translatedLabels'; import FilterLoadingSkeleton from './FilterLoadingSkeleton'; @@ -66,12 +66,12 @@ import { standardFilterById, unhandledProblemsFilter, resourceProblemsFilter, - allFilter, + allFilter } from './models'; import { getAutocompleteSuggestions, getDynamicCriteriaParametersAndValue, - DynamicCriteriaParametersAndValues, + DynamicCriteriaParametersAndValues } from './Criterias/searchQueryLanguage'; import { applyCurrentFilterDerivedAtom, @@ -81,7 +81,7 @@ import { customFiltersAtom, searchAtom, sendingFilterAtom, - setNewFilterDerivedAtom, + setNewFilterDerivedAtom } from './filterAtoms'; import useFilterByModule from './useFilterByModule'; @@ -106,7 +106,7 @@ interface DynamicCriteriaResult { const useStyles = makeStyles((theme) => ({ autocompletePopper: { - zIndex: theme.zIndex.tooltip, + zIndex: theme.zIndex.tooltip }, container: { alignItems: 'center', @@ -114,9 +114,9 @@ const useStyles = makeStyles((theme) => ({ gridAutoFlow: 'column', gridGap: theme.spacing(1), gridTemplateColumns: 'auto 175px auto 1fr', - width: '100%', + width: '100%' }, - loader: { display: 'flex', justifyContent: 'center' }, + loader: { display: 'flex', justifyContent: 'center' } })); const SaveFilter = lazy(() => import('./Save')); @@ -146,9 +146,9 @@ const Filter = (): JSX.Element => { const { sendRequest: sendDynamicCriteriaValueRequests, - sending: sendingDynamicCriteriaValueRequests, + sending: sendingDynamicCriteriaValueRequests } = useRequest({ - request: getData, + request: getData }); const [search, setSearch] = useAtom(searchAtom); @@ -171,7 +171,7 @@ const Filter = (): JSX.Element => { const loadDynamicCriteriaSuggestion = ({ criteria, - values, + values }: DynamicCriteriaParametersAndValues): void => { const { buildAutocompleteEndpoint, autocompleteSearch, label } = criteria; @@ -189,16 +189,16 @@ const Filter = (): JSX.Element => { not(isEmpty(selectedValues)) ? { field: 'name', - values: { $ni: selectedValues }, + values: { $ni: selectedValues } } - : {}, + : {} ], regex: { fields: ['name'], - value: lastValue, - }, - }, - }), + value: lastValue + } + } + }) }).then(({ result }): void => { const results = label.includes('severity level') ? pluck('level', result) @@ -213,7 +213,7 @@ const Filter = (): JSX.Element => { if (or(lastValueEqualsToAResult, isEmpty(formattedResult))) { const res = [ ...notSelectedValues, - ...map(concat(','), notSelectedValues), + ...map(concat(','), notSelectedValues) ]; setAutoCompleteSuggestions(res); @@ -226,7 +226,7 @@ const Filter = (): JSX.Element => { }; const debounceDynamicSuggestions = ( - props: DynamicCriteriaParametersAndValues, + props: DynamicCriteriaParametersAndValues ): void => { clearDebounceDynamicSuggestions(); @@ -249,12 +249,12 @@ const Filter = (): JSX.Element => { const dynamicCriteriaParameters = getDynamicCriteriaParametersAndValue({ cursorPosition, newSelectableCriterias, - search, + search }); if (isDefined(dynamicCriteriaParameters) && isSearchFieldFocus) { debounceDynamicSuggestions( - dynamicCriteriaParameters as DynamicCriteriaParametersAndValues, + dynamicCriteriaParameters as DynamicCriteriaParametersAndValues ); return; @@ -267,8 +267,8 @@ const Filter = (): JSX.Element => { getAutocompleteSuggestions({ cursorPosition, newSelectableCriterias, - search, - }), + search + }) ); }, [search, cursorPosition]); @@ -284,7 +284,7 @@ const Filter = (): JSX.Element => { const dynamicCriteriaParameters = getDynamicCriteriaParametersAndValue({ cursorPosition, newSelectableCriterias, - search, + search }); const isDynamicCriteria = isDefined(dynamicCriteriaParameters); @@ -334,7 +334,7 @@ const Filter = (): JSX.Element => { const completedWord = acceptedSuggestion.slice( expressionAfterSeparator.length, - acceptedSuggestion.length, + acceptedSuggestion.length ); const cursorCompletionShift = @@ -352,7 +352,7 @@ const Filter = (): JSX.Element => { ? searchBeforeCompletedWord.trim() : dropLast( expressionAfterSeparator.length, - searchBeforeCompletedWord.trim(), + searchBeforeCompletedWord.trim() ); const suggestion = isEmpty(expressionAfterSeparator.trim()) @@ -363,7 +363,7 @@ const Filter = (): JSX.Element => { searchBeforeSuggestion, suggestion, searchAfterCompletedWord.trim() === '' ? '' : ' ', - searchAfterCompletedWord, + searchAfterCompletedWord ].join(''); setCursorPosition(cursorPosition + cursorCompletionShift); @@ -388,8 +388,8 @@ const Filter = (): JSX.Element => { .replace(expressionToShiftToTheEnd, '') .trim(), ' ', - expressionToShiftToTheEnd, - ].join(''), + expressionToShiftToTheEnd + ].join('') ); }; @@ -477,7 +477,7 @@ const Filter = (): JSX.Element => { const translatedOptions = [ unhandledProblemsFilter, resourceProblemsFilter, - allFilter, + allFilter ].map(({ id, name }) => ({ id, name: t(name) })); const customFilterOptions = isEmpty(customFilters) @@ -486,20 +486,20 @@ const Filter = (): JSX.Element => { { id: 'my_filters', name: t(labelMyFilters), - type: 'header', + type: 'header' }, - ...customFilters, + ...customFilters ]; const options = [ { id: '', name: t(labelNewFilter) }, ...translatedOptions, - ...customFilterOptions, + ...customFilterOptions ]; const canDisplaySelectedFilter = find( propEq('id', currentFilter.id), - options, + options ); const closeSuggestionPopover = (): void => { @@ -514,7 +514,7 @@ const Filter = (): JSX.Element => { const dynamicCriteriaParameters = getDynamicCriteriaParametersAndValue({ cursorPosition, newSelectableCriterias, - search, + search }); const isDynamicCriteria = isDefined(dynamicCriteriaParameters); @@ -530,7 +530,7 @@ const Filter = (): JSX.Element => { currentFilter, isDynamicCriteria, sendingDynamicCriteriaValueRequests, - user, + user ]; return ( @@ -586,7 +586,7 @@ const Filter = (): JSX.Element => { className={classes.autocompletePopper} open={open} style={{ - width: searchRef?.current?.clientWidth, + width: searchRef?.current?.clientWidth }} > diff --git a/www/front_src/src/Resources/Filter/models.ts b/www/front_src/src/Resources/Filter/models.ts index 805b86ab318..d6f938a1048 100644 --- a/www/front_src/src/Resources/Filter/models.ts +++ b/www/front_src/src/Resources/Filter/models.ts @@ -4,7 +4,7 @@ import { labelAll, labelNewFilter, labelUnhandledProblems, - labelResourceProblems, + labelResourceProblems } from '../translatedLabels'; import getDefaultCriterias from './Criterias/default'; @@ -18,7 +18,7 @@ import { selectableStatuses, unhandledState, unknownStatus, - warningStatus, + warningStatus } from './Criterias/models'; export interface Filter { @@ -30,36 +30,36 @@ export interface Filter { const allFilter = { criterias: getDefaultCriterias(), id: 'all', - name: labelAll, + name: labelAll }; const newFilter = { id: '', - name: labelNewFilter, + name: labelNewFilter } as Filter; const unhandledProblemsFilter: Filter = { criterias: getDefaultCriterias({ states: [unhandledState], statusTypes: [hardStateType], - statuses: [warningStatus, downStatus, criticalStatus, unknownStatus], + statuses: [warningStatus, downStatus, criticalStatus, unknownStatus] }), id: 'unhandled_problems', - name: labelUnhandledProblems, + name: labelUnhandledProblems }; const resourceProblemsFilter: Filter = { criterias: getDefaultCriterias({ - statuses: [warningStatus, downStatus, criticalStatus, unknownStatus], + statuses: [warningStatus, downStatus, criticalStatus, unknownStatus] }), id: 'resource_problems', - name: labelResourceProblems, + name: labelResourceProblems }; const standardFilterById = { all: allFilter, resource_problems: resourceProblemsFilter, - unhandled_problems: unhandledProblemsFilter, + unhandled_problems: unhandledProblemsFilter }; const isCustom = ({ id }: Filter): boolean => { @@ -75,5 +75,5 @@ export { selectableStates, selectableStatuses, standardFilterById, - isCustom, + isCustom }; diff --git a/www/front_src/src/Resources/Filter/storedFilter.ts b/www/front_src/src/Resources/Filter/storedFilter.ts index 8f93ea52ae6..15889a7a17e 100644 --- a/www/front_src/src/Resources/Filter/storedFilter.ts +++ b/www/front_src/src/Resources/Filter/storedFilter.ts @@ -13,7 +13,7 @@ const getStoredOrDefaultFilter = (defaultValue: Filter): Filter => { key: filterKey, onCachedItemUpdate: (updatedItem) => { cachedFilter = updatedItem; - }, + } }); }; diff --git a/www/front_src/src/Resources/Filter/useFilter.ts b/www/front_src/src/Resources/Filter/useFilter.ts index 7fef8df4aac..0836bf1ed77 100644 --- a/www/front_src/src/Resources/Filter/useFilter.ts +++ b/www/front_src/src/Resources/Filter/useFilter.ts @@ -7,7 +7,7 @@ import { useAtomValue, useUpdateAtom } from 'jotai/utils'; import { useRequest, setUrlQueryParameters, - getUrlQueryParameters, + getUrlQueryParameters } from '@centreon/ui'; import { listCustomFilters } from './api'; @@ -22,7 +22,7 @@ import { getDefaultFilterDerivedAtom, searchAtom, sendingFilterAtom, - storedFilterAtom, + storedFilterAtom } from './filterAtoms'; import { CriteriaValue } from './Criterias/models'; @@ -41,12 +41,12 @@ export interface FilterState { const useFilter = (): void => { const { sendRequest: sendListCustomFiltersRequest, sending } = useRequest({ decoder: listCustomFiltersDecoder, - request: listCustomFilters, + request: listCustomFilters }); const currentFilter = useAtomValue(currentFilterAtom); const filterWithParsedSearch = useAtomValue( - filterWithParsedSearchDerivedAtom, + filterWithParsedSearchDerivedAtom ); const getDefaultFilter = useAtomValue(getDefaultFilterDerivedAtom); const setCustomFilters = useUpdateAtom(customFiltersAtom); @@ -81,8 +81,8 @@ const useFilter = (): void => { const queryParameters = [ { name: 'filter', - value: filterWithParsedSearch, - }, + value: filterWithParsedSearch + } ]; setUrlQueryParameters(queryParameters); @@ -96,8 +96,8 @@ const useFilter = (): void => { setUrlQueryParameters([ { name: 'fromTopCounter', - value: false, - }, + value: false + } ]); applyFilter(getDefaultFilter()); diff --git a/www/front_src/src/Resources/Filter/useFilterByModule.ts b/www/front_src/src/Resources/Filter/useFilterByModule.ts index 838565b30d0..bebfcb592d2 100644 --- a/www/front_src/src/Resources/Filter/useFilterByModule.ts +++ b/www/front_src/src/Resources/Filter/useFilterByModule.ts @@ -10,7 +10,7 @@ import { CriteriaNames, criteriaValueNameById, selectableCriterias, - selectableResourceTypes, + selectableResourceTypes } from './Criterias/models'; interface FilterByModule { @@ -44,14 +44,14 @@ const useFilterByModule = (): FilterByModule => { const criteriasNameById = Object.keys(item).reduce( (previousValue, key) => ({ ...previousValue, - [key]: item[key], + [key]: item[key] }), - { ...criteriaValueNameById }, + { ...criteriaValueNameById } ); return { ...prev, ...criteriasNameById }; }, - { ...criteriaValueNameById }, + { ...criteriaValueNameById } ); const newSelectableResourceTypes = filtersToAdd.reduce( @@ -64,30 +64,30 @@ const useFilterByModule = (): FilterByModule => { (previousValue, key) => { const serviceType = { id: key, - name: newCriteriaValueNameById[key], + name: newCriteriaValueNameById[key] }; return [...previousValue, serviceType]; }, - [...selectableResourceTypes], + [...selectableResourceTypes] ); return [...prev, ...selectableTypes]; }, - [...selectableResourceTypes], + [...selectableResourceTypes] ); const newSelectableCriterias = { ...selectableCriterias, [CriteriaNames.resourceTypes]: { ...selectableCriterias[CriteriaNames.resourceTypes], - options: [...new Set(newSelectableResourceTypes)] as Array, - }, + options: [...new Set(newSelectableResourceTypes)] as Array + } }; return { newCriteriaValueName: newCriteriaValueNameById, - newSelectableCriterias, + newSelectableCriterias }; }; diff --git a/www/front_src/src/Resources/Graph/Performance/AnomalyDetection/AnomalyDetectionEnvelopeThreshold.tsx b/www/front_src/src/Resources/Graph/Performance/AnomalyDetection/AnomalyDetectionEnvelopeThreshold.tsx index 7366f19204e..2094e8a0187 100644 --- a/www/front_src/src/Resources/Graph/Performance/AnomalyDetection/AnomalyDetectionEnvelopeThreshold.tsx +++ b/www/front_src/src/Resources/Graph/Performance/AnomalyDetection/AnomalyDetectionEnvelopeThreshold.tsx @@ -30,24 +30,14 @@ const AnomalyDetectionEnvelopeThreshold = ({ thirdUnit, timeSeries, graphHeight, - data, + data }: Props): JSX.Element => { const [ - { - metric: metricY1, - unit: unitY1, - invert: invertY1, - lineColor: lineColorY1, - }, + { metric: metricY1, unit: unitY1, invert: invertY1, lineColor: lineColorY1 } ] = regularLines.filter((item) => equals(item.name, 'Upper Threshold')); const [ - { - metric: metricY0, - unit: unitY0, - invert: invertY0, - lineColor: lineColorY0, - }, + { metric: metricY0, unit: unitY0, invert: invertY0, lineColor: lineColorY0 } ] = regularLines.filter((item) => equals(item.name, 'Lower Threshold')); const y1Scale = getYScale({ @@ -56,7 +46,7 @@ const AnomalyDetectionEnvelopeThreshold = ({ leftScale, rightScale, secondUnit, - unit: unitY1, + unit: unitY1 }); const y0Scale = getYScale({ @@ -65,7 +55,7 @@ const AnomalyDetectionEnvelopeThreshold = ({ leftScale, rightScale, secondUnit, - unit: unitY0, + unit: unitY0 }); const getXPoint = (timeValue): number => xScale(getTime(timeValue)) as number; @@ -86,7 +76,7 @@ const AnomalyDetectionEnvelopeThreshold = ({ thirdUnit, timeSeries, y0Scale, - y1Scale, + y1Scale }; if (data) { @@ -99,11 +89,11 @@ const AnomalyDetectionEnvelopeThreshold = ({ { const theme = useTheme(); @@ -56,7 +56,7 @@ const AnomalyDetectionEstimatedEnvelopeThreshold = ({ metricUpper, metricLower, item, - factors, + factors }: EnvelopeVariation): number => { return ( ((prop(metricUpper, item) as number) - @@ -70,7 +70,7 @@ const AnomalyDetectionEstimatedEnvelopeThreshold = ({ factors: data, item: timeValue, metricLower: metricY0, - metricUpper: metricY1, + metricUpper: metricY1 }); return y1Scale(prop(metricY1, timeValue) - diff) ?? null; @@ -81,7 +81,7 @@ const AnomalyDetectionEstimatedEnvelopeThreshold = ({ factors: data, item: timeValue, metricLower: metricY0, - metricUpper: metricY1, + metricUpper: metricY1 }); return y0Scale(prop(metricY0, timeValue) + diff) ?? null; @@ -93,7 +93,7 @@ const AnomalyDetectionEstimatedEnvelopeThreshold = ({ stroke: theme.palette.secondary.main, strokeDasharray: 5, strokeOpacity: 0.8, - x: getXPoint, + x: getXPoint }; return ( @@ -101,11 +101,11 @@ const AnomalyDetectionEstimatedEnvelopeThreshold = ({ { const { t } = useTranslation(); diff --git a/www/front_src/src/Resources/Graph/Performance/AnomalyDetection/AnomalyDetectionShapeCircle.tsx b/www/front_src/src/Resources/Graph/Performance/AnomalyDetection/AnomalyDetectionShapeCircle.tsx index cb9963cf85f..4cb32257bb1 100644 --- a/www/front_src/src/Resources/Graph/Performance/AnomalyDetection/AnomalyDetectionShapeCircle.tsx +++ b/www/front_src/src/Resources/Graph/Performance/AnomalyDetection/AnomalyDetectionShapeCircle.tsx @@ -26,7 +26,7 @@ const AnomalyDetectionShapeCircle = ({ pointYLower, pointYUpper, pointXUpper, - originMetric, + originMetric }: AnomalyDetectionShapeCircleProps): JSX.Element => { const setCountedRedCircles = useUpdateAtom(countedRedCirclesAtom); @@ -47,7 +47,7 @@ const AnomalyDetectionShapeCircle = ({ pointY1, pointX2, pointY2, - maxDistance, + maxDistance }: IsOnline): boolean => { const dxL = pointX2 - pointX1; const dyL = pointY2 - pointY1; @@ -78,7 +78,7 @@ const AnomalyDetectionShapeCircle = ({ pointX2, pointY, pointY1, - pointY2, + pointY2 }); const arePointsDefined = @@ -91,7 +91,7 @@ const AnomalyDetectionShapeCircle = ({ return { coordinate: { key: index.toString(), x: pointX, y: pointY }, - isCircleShown: !isPointBetweenPoint1Point2 && arePointsDefined, + isCircleShown: !isPointBetweenPoint1Point2 && arePointsDefined }; }); diff --git a/www/front_src/src/Resources/Graph/Performance/AnomalyDetection/AnomalyDetectionSlider.tsx b/www/front_src/src/Resources/Graph/Performance/AnomalyDetection/AnomalyDetectionSlider.tsx index bed424e41b4..40cf4c2c179 100644 --- a/www/front_src/src/Resources/Graph/Performance/AnomalyDetection/AnomalyDetectionSlider.tsx +++ b/www/front_src/src/Resources/Graph/Performance/AnomalyDetection/AnomalyDetectionSlider.tsx @@ -22,7 +22,7 @@ import { labelCancel, labelSave, labelUseDefaultValue, - labelPointsOutsideOfEnvelopeCount, + labelPointsOutsideOfEnvelopeCount } from '../../../translatedLabels'; import { ResourceDetails, Sensitivity } from '../../../Details/models'; @@ -32,59 +32,59 @@ import { CustomFactorsData } from './models'; const useStyles = makeStyles((theme) => ({ body: { display: 'flex', - flexDirection: 'column', + flexDirection: 'column' }, bodyContainer: { alignItems: 'center', display: 'flex', marginBottom: theme.spacing(2), - marginTop: theme.spacing(5), + marginTop: theme.spacing(5) }, confirmButton: { - marginLeft: theme.spacing(2), + marginLeft: theme.spacing(2) }, container: { display: 'flex', flexDirection: 'column', justifyContent: 'space-evenly', - padding: theme.spacing(2), + padding: theme.spacing(2) }, footer: { display: 'flex', - justifyContent: 'flex-end', + justifyContent: 'flex-end' }, header: { display: 'flex', - flexDirection: 'column', + flexDirection: 'column' }, icon: { display: 'flex', - flexDirection: 'column', + flexDirection: 'column' }, slider: { '& .MuiSlider-mark': { borderLeft: '1px solid', height: theme.spacing(2), - width: 0, + width: 0 }, '& .MuiSlider-thumb': { height: theme.spacing(3), - width: 1, + width: 1 }, '& .MuiSlider-valueLabel': { backgroundColor: theme.palette.primary.main, - borderRadius: '50%', + borderRadius: '50%' }, '& .MuiSlider-valueLabel:before': { - width: 0, + width: 0 }, '& .MuiSlider-valueLabelOpen': { - transform: 'translateY(-60%) scale(1)', + transform: 'translateY(-60%) scale(1)' }, display: 'flex', justifyContent: 'space-evenly', - width: theme.spacing(35), - }, + width: theme.spacing(35) + } })); interface Props { @@ -106,7 +106,7 @@ const AnomalyDetectionSlider = ({ isEnvelopeResizingCanceled, isResizeEnvelope, sendReloadGraphPerformance, - setIsResizeEnvelope, + setIsResizeEnvelope }: Props): JSX.Element => { const classes = useStyles(); const { t } = useTranslation(); @@ -116,27 +116,27 @@ const AnomalyDetectionSlider = ({ const [isResizingConfirmed, setIsResizingConfirmed] = useState(false); const [openTooltip, setOpenTooltip] = useState(false); const { sendRequest } = useRequest({ - request: putData, + request: putData }); const [countedRedCircles, setCountedRedCircles] = useAtom( - countedRedCirclesAtom, + countedRedCirclesAtom ); const tooltipMessage = `${countedRedCircles} ${t( - labelPointsOutsideOfEnvelopeCount, + labelPointsOutsideOfEnvelopeCount )}`; const step = 0.1; const sensitivityEndPoint = path( ['links', 'endpoints', 'sensitivity'], - details, + details ); const marks = [ { label: 'Default', - value: sensitivity.default_value, - }, + value: sensitivity.default_value + } ]; const isEnvelopeUpdateSliderEnabled = (): void => { @@ -184,7 +184,7 @@ const AnomalyDetectionSlider = ({ const resizeEnvelope = (): void => { sendRequest({ data: { sensitivity: currentValue }, - endpoint: sensitivityEndPoint, + endpoint: sensitivityEndPoint }); sendReloadGraphPerformance(true); @@ -227,7 +227,7 @@ const AnomalyDetectionSlider = ({ sendFactors({ currentFactor: sensitivity.current_value, isResizing: isResizingConfirmed, - simulatedFactor: currentValue, + simulatedFactor: currentValue }); }, [currentValue, isResizingConfirmed]); diff --git a/www/front_src/src/Resources/Graph/Performance/AnomalyDetection/EditAnomalyDetectionDataDialog.tsx b/www/front_src/src/Resources/Graph/Performance/AnomalyDetection/EditAnomalyDetectionDataDialog.tsx index 24dc9b36d60..3d089e8d8b0 100644 --- a/www/front_src/src/Resources/Graph/Performance/AnomalyDetection/EditAnomalyDetectionDataDialog.tsx +++ b/www/front_src/src/Resources/Graph/Performance/AnomalyDetection/EditAnomalyDetectionDataDialog.tsx @@ -18,33 +18,33 @@ import { countedRedCirclesAtom } from './anomalyDetectionAtom'; const useStyles = makeStyles((theme) => ({ close: { display: 'flex', - justifyContent: 'flex-end', + justifyContent: 'flex-end' }, container: { '& .MuiDialog-paper': { backgroundColor: theme.palette.background.default, maxWidth: '80%', padding: theme.spacing(2), - width: '100%', - }, + width: '100%' + } }, editEnvelopeSize: { display: 'flex', justifyContent: 'space-between', - width: '30%', + width: '30%' }, envelopeSize: { flex: 1, - marginRight: theme.spacing(1), + marginRight: theme.spacing(1) }, exclusionPeriod: { flex: 2, height: theme.spacing(20), - marginLeft: theme.spacing(1), + marginLeft: theme.spacing(1) }, spacing: { - paddingBottom: theme.spacing(1), - }, + paddingBottom: theme.spacing(1) + } })); interface PropsChildren { @@ -65,13 +65,13 @@ interface Props { const EditAnomalyDetectionDataDialog = ({ isOpen, setIsOpen, - children, + children }: Props): JSX.Element => { const classes = useStyles(); const { t } = useTranslation(); const [factorsData, setFactorsData] = useState( - null, + null ); const [isModalConfirmationOpened, setIsModalConfirmationOpened] = useState(false); @@ -118,7 +118,7 @@ const EditAnomalyDetectionDataDialog = ({ isEnvelopeResizingCanceled, isResizeEnvelope, openModalConfirmation, - setIsResizeEnvelope, + setIsResizeEnvelope })} diff --git a/www/front_src/src/Resources/Graph/Performance/ExportableGraphWithTimeline/GraphOptions.tsx b/www/front_src/src/Resources/Graph/Performance/ExportableGraphWithTimeline/GraphOptions.tsx index 8a08a43fdc7..03472db98b4 100644 --- a/www/front_src/src/Resources/Graph/Performance/ExportableGraphWithTimeline/GraphOptions.tsx +++ b/www/front_src/src/Resources/Graph/Performance/ExportableGraphWithTimeline/GraphOptions.tsx @@ -10,19 +10,19 @@ import { useMemoComponent } from '@centreon/ui'; import { GraphOption, GraphOptions } from '../../../Details/models'; import { setGraphTabParametersDerivedAtom, - tabParametersAtom, + tabParametersAtom } from '../../../Details/detailsAtoms'; import { changeGraphOptionsDerivedAtom, - graphOptionsAtom, + graphOptionsAtom } from './graphOptionsAtoms'; const useStyles = makeStyles(() => ({ optionLabel: { justifyContent: 'space-between', - margin: 0, - }, + margin: 0 + } })); const Options = (): JSX.Element => { @@ -38,13 +38,13 @@ const Options = (): JSX.Element => { const graphOptionsConfigurationValue = pluck( 'value', - graphOptionsConfiguration, + graphOptionsConfiguration ); const changeTabGraphOptions = (options: GraphOptions): void => { setGraphTabParameters({ ...tabParameters.graph, - options, + options }); }; @@ -62,7 +62,7 @@ const Options = (): JSX.Element => { onChange={(): void => changeGraphOptions({ changeTabGraphOptions, - graphOptionId: id, + graphOptionId: id }) } /> @@ -75,7 +75,7 @@ const Options = (): JSX.Element => { ))} ), - memoProps: [graphOptionsConfigurationValue], + memoProps: [graphOptionsConfigurationValue] }); }; diff --git a/www/front_src/src/Resources/Graph/Performance/ExportableGraphWithTimeline/exportToPng.ts b/www/front_src/src/Resources/Graph/Performance/ExportableGraphWithTimeline/exportToPng.ts index 0f308c7c332..8a6fcea431b 100644 --- a/www/front_src/src/Resources/Graph/Performance/ExportableGraphWithTimeline/exportToPng.ts +++ b/www/front_src/src/Resources/Graph/Performance/ExportableGraphWithTimeline/exportToPng.ts @@ -12,7 +12,7 @@ const exportToPng = async ({ element, title, ratio, - backgroundColor, + backgroundColor }: Props): Promise => { const dateTime = new Date().toISOString().substring(0, 19); @@ -28,9 +28,9 @@ const exportToPng = async ({ bgcolor: backgroundColor, height: element.offsetHeight * ratio, style: { - transform: `translate(-${translateX}px, -${translateY}px) scale(${ratio})`, + transform: `translate(-${translateX}px, -${translateY}px) scale(${ratio})` }, - width: element.offsetWidth * ratio, + width: element.offsetWidth * ratio }) .then((blob) => { return saveAs(blob, `${title}-${dateTime}.png`); diff --git a/www/front_src/src/Resources/Graph/Performance/ExportableGraphWithTimeline/graphOptionsAtoms.ts b/www/front_src/src/Resources/Graph/Performance/ExportableGraphWithTimeline/graphOptionsAtoms.ts index d0518701977..7e056c2920c 100644 --- a/www/front_src/src/Resources/Graph/Performance/ExportableGraphWithTimeline/graphOptionsAtoms.ts +++ b/www/front_src/src/Resources/Graph/Performance/ExportableGraphWithTimeline/graphOptionsAtoms.ts @@ -8,8 +8,8 @@ export const defaultGraphOptions = { [GraphOptionId.displayEvents]: { id: GraphOptionId.displayEvents, label: labelDisplayEvents, - value: false, - }, + value: false + } }; export const graphOptionsAtom = atom(defaultGraphOptions); @@ -23,10 +23,10 @@ export const changeGraphOptionsDerivedAtom = atom( ...graphOptions, [graphOptionId]: { ...graphOptions[graphOptionId], - value: !graphOptions[graphOptionId].value, - }, + value: !graphOptions[graphOptionId].value + } }; set(graphOptionsAtom, newGraphOptions); changeTabGraphOptions(newGraphOptions); - }, + } ); diff --git a/www/front_src/src/Resources/Graph/Performance/ExportableGraphWithTimeline/index.tsx b/www/front_src/src/Resources/Graph/Performance/ExportableGraphWithTimeline/index.tsx index 78bb8fae23b..b0670c961bb 100644 --- a/www/front_src/src/Resources/Graph/Performance/ExportableGraphWithTimeline/index.tsx +++ b/www/front_src/src/Resources/Graph/Performance/ExportableGraphWithTimeline/index.tsx @@ -25,7 +25,7 @@ import { getDatesDerivedAtom, graphQueryParametersDerivedAtom, resourceDetailsUpdatedAtom, - selectedTimePeriodAtom, + selectedTimePeriodAtom } from '../TimePeriods/timePeriodAtoms'; import { detailsAtom } from '../../../Details/detailsAtoms'; import EditAnomalyDetectionDataDialog from '../AnomalyDetection/EditAnomalyDetectionDataDialog'; @@ -36,14 +36,14 @@ const useStyles = makeStyles((theme: Theme) => ({ graph: { height: '100%', margin: 'auto', - width: '100%', + width: '100%' }, graphContainer: { display: 'grid', gridTemplateRows: '1fr', height: '93%', - padding: theme.spacing(2, 1, 1), - }, + padding: theme.spacing(2, 1, 1) + } })); interface Props { @@ -61,7 +61,7 @@ const ExportablePerformanceGraphWithTimeline = ({ limitLegendRows, isEditAnomalyDetectionDataDialogOpen, resizeEnvelopeData, - onReload, + onReload }: Props): JSX.Element => { const classes = useStyles(); const [timeline, setTimeline] = useState>(); @@ -73,7 +73,7 @@ const ExportablePerformanceGraphWithTimeline = ({ ListingModel >({ decoder: listTimelineEventsDecoder, - request: listTimelineEvents, + request: listTimelineEvents }); const { alias } = useAtomValue(userAtom); @@ -92,13 +92,13 @@ const ExportablePerformanceGraphWithTimeline = ({ const displayEventAnnotations = path( [GraphOptionId.displayEvents, 'value'], - graphOptions, + graphOptions ); const endpoint = path(['links', 'endpoints', 'performance_graph'], resource); const timelineEndpoint = path( ['links', 'endpoints', 'timeline'], - resource, + resource ); const retrieveTimeline = (): void => { @@ -122,12 +122,12 @@ const ExportablePerformanceGraphWithTimeline = ({ field: 'date', values: { $gt: start, - $lt: end, - }, - }, - ], - }, - }, + $lt: end + } + } + ] + } + } }).then(({ result }) => { setTimeline(result); }); @@ -153,14 +153,14 @@ const ExportablePerformanceGraphWithTimeline = ({ const graphQuerParameters = getGraphQueryParameters({ endDate: customTimePeriod.end, startDate: customTimePeriod.start, - timePeriod: selectedTimePeriod, + timePeriod: selectedTimePeriod }); return `${endpoint}${graphQuerParameters}`; }, [ customTimePeriod.start.toISOString(), customTimePeriod.end.toISOString(), - details, + details ]); const addCommentToTimeline = ({ date, comment }): void => { @@ -173,8 +173,8 @@ const ExportablePerformanceGraphWithTimeline = ({ content: comment, date, id, - type: 'comment', - }, + type: 'comment' + } ]); }; @@ -240,7 +240,7 @@ const ExportablePerformanceGraphWithTimeline = ({ openModalConfirmation, isEnvelopeResizingCanceled, isResizeEnvelope, - setIsResizeEnvelope, + setIsResizeEnvelope }): JSX.Element => ( <> {factorsData && ( diff --git a/www/front_src/src/Resources/Graph/Performance/Graph/AddCommentForm/index.test.tsx b/www/front_src/src/Resources/Graph/Performance/Graph/AddCommentForm/index.test.tsx index 780e58d8a20..86694edc6e1 100644 --- a/www/front_src/src/Resources/Graph/Performance/Graph/AddCommentForm/index.test.tsx +++ b/www/front_src/src/Resources/Graph/Performance/Graph/AddCommentForm/index.test.tsx @@ -22,9 +22,9 @@ describe(AddCommentForm, () => { const resource = { id: 0, parent: { - id: 1, + id: 1 }, - type: 'service', + type: 'service' } as Resource; const onSuccess = jest.fn(); @@ -35,7 +35,7 @@ describe(AddCommentForm, () => { resource={resource} onClose={jest.fn()} onSuccess={onSuccess} - />, + /> ); expect(screen.getByText(labelAdd)).toBeDisabled(); @@ -46,7 +46,7 @@ describe(AddCommentForm, () => { const commentParameters = { comment: 'plop', - date: '2020-11-26T15:49:39Z', + date: '2020-11-26T15:49:39Z' }; await waitFor(() => { @@ -56,11 +56,11 @@ describe(AddCommentForm, () => { resources: [ { ...resource, - ...commentParameters, - }, - ], + ...commentParameters + } + ] }, - expect.anything(), + expect.anything() ); expect(onSuccess).toHaveBeenCalledWith(commentParameters); diff --git a/www/front_src/src/Resources/Graph/Performance/Graph/AddCommentForm/index.tsx b/www/front_src/src/Resources/Graph/Performance/Graph/AddCommentForm/index.tsx index e0fa0df1647..7e25819cc78 100644 --- a/www/front_src/src/Resources/Graph/Performance/Graph/AddCommentForm/index.tsx +++ b/www/front_src/src/Resources/Graph/Performance/Graph/AddCommentForm/index.tsx @@ -10,7 +10,7 @@ import { TextField, useSnackbar, useRequest, - useLocaleDateTimeFormat, + useLocaleDateTimeFormat } from '@centreon/ui'; import { @@ -18,7 +18,7 @@ import { labelAddComment, labelComment, labelRequired, - labelCommentAdded, + labelCommentAdded } from '../../../../translatedLabels'; import { commentResources } from '../../../../Actions/api'; import { Resource } from '../../../../models'; @@ -35,7 +35,7 @@ const AddCommentForm = ({ onClose, onSuccess, resource, - date, + date }: Props): JSX.Element => { const { t } = useTranslation(); const { toIsoString, toDateTime } = useLocaleDateTimeFormat(); @@ -43,7 +43,7 @@ const AddCommentForm = ({ const [comment, setComment] = useState(); const { sendRequest, sending } = useRequest({ - request: commentResources, + request: commentResources }); const changeComment = (event: ChangeEvent): void => { @@ -53,12 +53,12 @@ const AddCommentForm = ({ const confirm = (): void => { const parameters = { comment, - date: toIsoString(date), + date: toIsoString(date) }; sendRequest({ parameters, - resources: [resource], + resources: [resource] }).then(() => { showSuccessMessage(t(labelCommentAdded)); onSuccess(parameters); diff --git a/www/front_src/src/Resources/Graph/Performance/Graph/Annotations/Annotation/Area.tsx b/www/front_src/src/Resources/Graph/Performance/Graph/Annotations/Annotation/Area.tsx index 751adf4062f..4c8d5c5e2cf 100644 --- a/www/front_src/src/Resources/Graph/Performance/Graph/Annotations/Annotation/Area.tsx +++ b/www/front_src/src/Resources/Graph/Performance/Graph/Annotations/Annotation/Area.tsx @@ -12,7 +12,7 @@ import { labelFrom, labelTo } from '../../../../../translatedLabels'; import { annotationHoveredAtom, getFillColorDerivedAtom, - getIconColorDerivedAtom, + getIconColorDerivedAtom } from '../../annotationsAtoms'; import Annotation, { Props as AnnotationProps, yMargin, iconSize } from '.'; @@ -30,9 +30,9 @@ type Props = { const useStyles = makeStyles((theme) => ({ icon: { transition: theme.transitions.create('color', { - duration: theme.transitions.duration.shortest, - }), - }, + duration: theme.transitions.duration.shortest + }) + } })); const AreaAnnotation = ({ @@ -50,7 +50,7 @@ const AreaAnnotation = ({ const classes = useStyles(); const [annotationHovered, setAnnotationHovered] = useAtom( - annotationHoveredAtom, + annotationHoveredAtom ); const getFillColor = useAtomValue(getFillColorDerivedAtom); const getIconColor = useAtomValue(getIconColorDerivedAtom); @@ -72,7 +72,7 @@ const AreaAnnotation = ({ onMouseEnter={(): void => setAnnotationHovered(() => ({ annotation, - resourceId: prop('resourceId', props), + resourceId: prop('resourceId', props) })) } onMouseLeave={(): void => setAnnotationHovered(() => undefined)} @@ -92,8 +92,8 @@ const AreaAnnotation = ({ style={{ color: getIconColor({ annotation, - color, - }), + color + }) }} width={iconSize} /> @@ -109,7 +109,7 @@ const AreaAnnotation = ({ {...props} /> ), - memoProps: [annotationHovered, xStart, xEnd], + memoProps: [annotationHovered, xStart, xEnd] }); }; diff --git a/www/front_src/src/Resources/Graph/Performance/Graph/Annotations/Annotation/Line.tsx b/www/front_src/src/Resources/Graph/Performance/Graph/Annotations/Annotation/Line.tsx index 2119fe33fd0..2782f081693 100644 --- a/www/front_src/src/Resources/Graph/Performance/Graph/Annotations/Annotation/Line.tsx +++ b/www/front_src/src/Resources/Graph/Performance/Graph/Annotations/Annotation/Line.tsx @@ -11,7 +11,7 @@ import { annotationHoveredAtom, getIconColorDerivedAtom, getStrokeOpacityDerivedAtom, - getStrokeWidthDerivedAtom, + getStrokeWidthDerivedAtom } from '../../annotationsAtoms'; import Annotation, { Props as AnnotationProps, yMargin, iconSize } from '.'; @@ -31,9 +31,9 @@ type Props = { const useStyles = makeStyles((theme) => ({ icon: { transition: theme.transitions.create('color', { - duration: theme.transitions.duration.shortest, - }), - }, + duration: theme.transitions.duration.shortest + }) + } })); const LineAnnotation = ({ @@ -80,8 +80,8 @@ const LineAnnotation = ({ style={{ color: getIconColor({ annotation, - color, - }), + color + }) }} width={iconSize} /> @@ -97,7 +97,7 @@ const LineAnnotation = ({ {...props} /> ), - memoProps: [annotationHovered, xIcon], + memoProps: [annotationHovered, xIcon] }); }; diff --git a/www/front_src/src/Resources/Graph/Performance/Graph/Annotations/Annotation/index.tsx b/www/front_src/src/Resources/Graph/Performance/Graph/Annotations/Annotation/index.tsx index e89917b666d..1cedeba2b58 100644 --- a/www/front_src/src/Resources/Graph/Performance/Graph/Annotations/Annotation/index.tsx +++ b/www/front_src/src/Resources/Graph/Performance/Graph/Annotations/Annotation/index.tsx @@ -14,11 +14,11 @@ const iconSize = 20; const useStyles = makeStyles((theme) => ({ tooltip: { - backgroundColor: 'transparent', + backgroundColor: 'transparent' }, tooltipContent: { - padding: theme.spacing(1), - }, + padding: theme.spacing(1) + } })); export interface Props { @@ -36,7 +36,7 @@ const Annotation = ({ event, xIcon, marker, - resourceId, + resourceId }: Props): JSX.Element => { const classes = useStyles(); const { t } = useTranslation(); diff --git a/www/front_src/src/Resources/Graph/Performance/Graph/Annotations/EventAnnotations.tsx b/www/front_src/src/Resources/Graph/Performance/Graph/Annotations/EventAnnotations.tsx index 062381211e1..793dddd8ad1 100644 --- a/www/front_src/src/Resources/Graph/Performance/Graph/Annotations/EventAnnotations.tsx +++ b/www/front_src/src/Resources/Graph/Performance/Graph/Annotations/EventAnnotations.tsx @@ -25,7 +25,7 @@ const EventAnnotations = ({ Icon, ariaLabel, color, - resourceId, + resourceId }: Props): JSX.Element => { const events = filter(propEq('type', type), timeline); @@ -39,7 +39,7 @@ const EventAnnotations = ({ event, graphHeight, resourceId, - xScale, + xScale }; if (isNil(event.startDate) && isNil(event.endDate)) { diff --git a/www/front_src/src/Resources/Graph/Performance/Graph/Annotations/index.tsx b/www/front_src/src/Resources/Graph/Performance/Graph/Annotations/index.tsx index 7424d4d39fc..9f72a1b6e8c 100644 --- a/www/front_src/src/Resources/Graph/Performance/Graph/Annotations/index.tsx +++ b/www/front_src/src/Resources/Graph/Performance/Graph/Annotations/index.tsx @@ -17,13 +17,13 @@ const Annotations = ({ xScale, timeline, graphHeight, - resourceId, + resourceId }: Props): JSX.Element => { const props = { graphHeight, resourceId, timeline, - xScale, + xScale }; return ( diff --git a/www/front_src/src/Resources/Graph/Performance/Graph/Axes/Y.tsx b/www/front_src/src/Resources/Graph/Performance/Graph/Axes/Y.tsx index da7b8fb050c..9d38f982f6a 100644 --- a/www/front_src/src/Resources/Graph/Performance/Graph/Axes/Y.tsx +++ b/www/front_src/src/Resources/Graph/Performance/Graph/Axes/Y.tsx @@ -39,7 +39,7 @@ const YAxes = ({ base, leftScale, rightScale, - graphHeight, + graphHeight }: Props): JSX.Element => { const formatTick = ({ unit }) => @@ -70,7 +70,7 @@ const YAxes = ({ ...commonTickLabelProps, dx: -2, dy: 4, - textAnchor: 'end', + textAnchor: 'end' })} tickLength={2} /> @@ -86,7 +86,7 @@ const YAxes = ({ ...commonTickLabelProps, dx: 4, dy: 4, - textAnchor: 'start', + textAnchor: 'start' })} tickLength={2} /> diff --git a/www/front_src/src/Resources/Graph/Performance/Graph/Axes/index.tsx b/www/front_src/src/Resources/Graph/Performance/Graph/Axes/index.tsx index b2364e0693f..4d1a707b7da 100644 --- a/www/front_src/src/Resources/Graph/Performance/Graph/Axes/index.tsx +++ b/www/front_src/src/Resources/Graph/Performance/Graph/Axes/index.tsx @@ -9,7 +9,7 @@ import YAxes from './Y'; const commonTickLabelProps = { fontFamily: 'Roboto, sans-serif', - fontSize: 10, + fontSize: 10 }; interface Props { @@ -33,7 +33,7 @@ const Axes = ({ xScale, xAxisTickFormat, isEditAnomalyDetectionDataDialogOpen, - base, + base }: Props): JSX.Element => { const { format } = useLocaleDateTimeFormat(); @@ -57,7 +57,7 @@ const Axes = ({ tickFormat={formatXAxisTick} tickLabelProps={(): Record => ({ ...commonTickLabelProps, - textAnchor: 'middle', + textAnchor: 'middle' })} top={graphHeight} /> diff --git a/www/front_src/src/Resources/Graph/Performance/Graph/TimeShiftZones/Icon.tsx b/www/front_src/src/Resources/Graph/Performance/Graph/TimeShiftZones/Icon.tsx index 7a9446274cc..c4ddb496974 100644 --- a/www/front_src/src/Resources/Graph/Performance/Graph/TimeShiftZones/Icon.tsx +++ b/www/front_src/src/Resources/Graph/Performance/Graph/TimeShiftZones/Icon.tsx @@ -19,8 +19,8 @@ interface Props { const useStyles = makeStyles({ icon: { - cursor: 'pointer', - }, + cursor: 'pointer' + } }); const TimeShiftIcon = ({ @@ -28,7 +28,7 @@ const TimeShiftIcon = ({ Icon, direction, directionHovered, - ariaLabel, + ariaLabel }: Props): JSX.Element => { const classes = useStyles(); const { t } = useTranslation(); @@ -50,7 +50,7 @@ const TimeShiftIcon = ({ }, width: timeShiftIconSize, x: xIcon, - y: graphHeight / 2 - timeShiftIconSize / 2 + marginTop, + y: graphHeight / 2 - timeShiftIconSize / 2 + marginTop }; return useMemoComponent({ @@ -72,8 +72,8 @@ const TimeShiftIcon = ({ ariaLabel, loading, directionHovered, - graphHeight, - ], + graphHeight + ] }); }; diff --git a/www/front_src/src/Resources/Graph/Performance/Graph/TimeShiftZones/Zone.tsx b/www/front_src/src/Resources/Graph/Performance/Graph/TimeShiftZones/Zone.tsx index 416469c5886..55b68dfd245 100644 --- a/www/front_src/src/Resources/Graph/Performance/Graph/TimeShiftZones/Zone.tsx +++ b/www/front_src/src/Resources/Graph/Performance/Graph/TimeShiftZones/Zone.tsx @@ -12,8 +12,8 @@ export const timeShiftZoneWidth = 50; const useStyles = makeStyles({ translationZone: { - cursor: 'pointer', - }, + cursor: 'pointer' + } }); interface Props { @@ -25,7 +25,7 @@ interface Props { const TimeShiftZone = ({ direction, onDirectionHover, - directionHovered, + directionHovered }: Props): JSX.Element => { const theme = useTheme(); const classes = useStyles(); @@ -60,8 +60,8 @@ const TimeShiftZone = ({ graphHeight, graphWidth, marginLeft, - marginTop, - ], + marginTop + ] }); }; diff --git a/www/front_src/src/Resources/Graph/Performance/Graph/TimeShiftZones/index.tsx b/www/front_src/src/Resources/Graph/Performance/Graph/TimeShiftZones/index.tsx index bafb67a48e8..f0f360d988e 100644 --- a/www/front_src/src/Resources/Graph/Performance/Graph/TimeShiftZones/index.tsx +++ b/www/front_src/src/Resources/Graph/Performance/Graph/TimeShiftZones/index.tsx @@ -13,7 +13,7 @@ import TimeShiftIcon, { timeShiftIconSize } from './Icon'; export enum TimeShiftDirection { backward, - forward, + forward } interface TimeShiftContextProps { diff --git a/www/front_src/src/Resources/Graph/Performance/Graph/annotationsAtoms.ts b/www/front_src/src/Resources/Graph/Performance/Graph/annotationsAtoms.ts index 093c9b89935..97370bbcbbf 100644 --- a/www/front_src/src/Resources/Graph/Performance/Graph/annotationsAtoms.ts +++ b/www/front_src/src/Resources/Graph/Performance/Graph/annotationsAtoms.ts @@ -17,7 +17,7 @@ import { pipe, Pred, T, - __, + __ } from 'ramda'; import { alpha } from '@mui/material'; @@ -53,7 +53,7 @@ interface AnnotationWithHoveredState { } export const annotationHoveredAtom = atom( - undefined, + undefined ); export const getIsBetween = ({ start, end }: GetIsBetweenProps): Pred => { @@ -73,12 +73,12 @@ export const changeAnnotationHoveredDerivedAtom = atom( mouseX, timeline, graphWidth, - resourceId, - }: ChangeAnnotationHoveredProps, + resourceId + }: ChangeAnnotationHoveredProps ) => { const isWithinErrorMargin = getIsBetween({ end: inc(mouseX), - start: dec(mouseX), + start: dec(mouseX) }); const annotationHovered = find( @@ -89,30 +89,30 @@ export const changeAnnotationHoveredDerivedAtom = atom( const isBetweenStartAndEndDate = getIsBetween({ end: xScale( - endDate ? new Date(endDate) : last(xScale.domain()) || graphWidth, + endDate ? new Date(endDate) : last(xScale.domain()) || graphWidth ), - start: xScale(new Date(startDate as string)), + start: xScale(new Date(startDate as string)) }); return isBetweenStartAndEndDate(mouseX); }, - timeline ?? [], + timeline ?? [] ); set(annotationHoveredAtom, { event: annotationHovered, - resourceId, + resourceId }); - }, + } ); const getIsNotHoveredOrNil = ({ hoveredAnnotation, - annotation, + annotation }: AnnotationWithHoveredState): boolean => or( isNil(hoveredAnnotation?.event), - not(equals(hoveredAnnotation?.resourceId, annotation?.resourceId)), + not(equals(hoveredAnnotation?.resourceId, annotation?.resourceId)) ); export const getStrokeWidthDerivedAtom = atom( @@ -122,11 +122,11 @@ export const getStrokeWidthDerivedAtom = atom( [ (hoveredAnnotation): boolean => getIsNotHoveredOrNil({ annotation, hoveredAnnotation }), - always(1), + always(1) ], [equals(annotation), always(3)], - [T, always(1)], - ])(get(annotationHoveredAtom)), + [T, always(1)] + ])(get(annotationHoveredAtom)) ); export const getStrokeOpacityDerivedAtom = atom( @@ -136,11 +136,11 @@ export const getStrokeOpacityDerivedAtom = atom( [ (hoveredAnnotation): boolean => getIsNotHoveredOrNil({ annotation, hoveredAnnotation }), - always(0.5), + always(0.5) ], [equals(annotation), always(0.7)], - [T, always(0.2)], - ])(get(annotationHoveredAtom)), + [T, always(0.2)] + ])(get(annotationHoveredAtom)) ); export const getFillColorDerivedAtom = atom( @@ -150,14 +150,14 @@ export const getFillColorDerivedAtom = atom( [ (hoveredAnnotation): boolean => getIsNotHoveredOrNil({ annotation, hoveredAnnotation }), - always(alpha(color, 0.3)), + always(alpha(color, 0.3)) ], [ equals(annotation), - always(alpha(color, 0.5)), + always(alpha(color, 0.5)) ], - [T, always(alpha(color, 0.1))], - ])(get(annotationHoveredAtom)), + [T, always(alpha(color, 0.1))] + ])(get(annotationHoveredAtom)) ); export const getIconColorDerivedAtom = atom( @@ -167,12 +167,12 @@ export const getIconColorDerivedAtom = atom( [ (hoveredAnnotation): boolean => getIsNotHoveredOrNil({ annotation, hoveredAnnotation }), - always(color), + always(color) ], [ pipe(equals(annotation), not), - always(alpha(color, 0.2)), + always(alpha(color, 0.2)) ], - [T, always(color)], - ])(get(annotationHoveredAtom)), + [T, always(color)] + ])(get(annotationHoveredAtom)) ); diff --git a/www/front_src/src/Resources/Graph/Performance/Graph/index.tsx b/www/front_src/src/Resources/Graph/Performance/Graph/index.tsx index 228840a6b21..bfc622fc1c9 100644 --- a/www/front_src/src/Resources/Graph/Performance/Graph/index.tsx +++ b/www/front_src/src/Resources/Graph/Performance/Graph/index.tsx @@ -11,7 +11,7 @@ import { gte, difference, lte, - length, + length } from 'ramda'; import { Shape, @@ -19,7 +19,7 @@ import { Scale, Group, Tooltip as VisxTooltip, - Event, + Event } from '@visx/visx'; import { bisector } from 'd3-array'; import { ScaleLinear } from 'd3-scale'; @@ -35,7 +35,7 @@ import { alpha, useTheme, CircularProgress, - Tooltip, + Tooltip } from '@mui/material'; import makeStyles from '@mui/styles/makeStyles'; import { grey } from '@mui/material/colors'; @@ -43,7 +43,7 @@ import { grey } from '@mui/material/colors'; import { dateTimeFormat, useLocaleDateTimeFormat, - useMemoComponent, + useMemoComponent } from '@centreon/ui'; import AnomalyDetectionEnvelopeThreshold from '../AnomalyDetection/AnomalyDetectionEnvelopeThreshold'; @@ -58,12 +58,12 @@ import { getMetricValuesForLines, getSortedStackedLines, getStackedMetricValues, - hasUnitStackedLines, + hasUnitStackedLines } from '../timeSeries'; import Lines from '../Lines'; import { labelActionNotPermitted, - labelAddComment, + labelAddComment } from '../../../translatedLabels'; import { TimelineEvent } from '../../../Details/tabs/Timeline/models'; import { Resource, ResourceType } from '../../../models'; @@ -78,17 +78,17 @@ import Annotations from './Annotations'; import Axes from './Axes'; import TimeShiftZones, { TimeShiftContext, - TimeShiftDirection, + TimeShiftDirection } from './TimeShiftZones'; import { changeMousePositionAndTimeValueDerivedAtom, changeTimeValueDerivedAtom, MousePosition, - mousePositionAtom, + mousePositionAtom } from './mouseTimeValueAtoms'; import { annotationHoveredAtom, - changeAnnotationHoveredDerivedAtom, + changeAnnotationHoveredDerivedAtom } from './annotationsAtoms'; const propsAreEqual = (prevProps, nextProps): boolean => @@ -119,7 +119,7 @@ interface Props { const useStyles = makeStyles>((theme) => ({ addCommentButton: { - fontSize: 10, + fontSize: 10 }, addCommentTooltip: { display: 'grid', @@ -127,38 +127,38 @@ const useStyles = makeStyles>((theme) => ({ gridAutoFlow: 'row', justifyItems: 'center', padding: theme.spacing(0.5), - position: 'absolute', + position: 'absolute' }, container: { '& .visx-axis-bottom': { '& .visx-axis-tick': { '& .visx-line': { - stroke: theme.palette.text.primary, - }, - }, + stroke: theme.palette.text.primary + } + } }, '& .visx-axis-line': { - stroke: theme.palette.text.primary, + stroke: theme.palette.text.primary }, '& .visx-axis-right': { '& .visx-axis-tick': { '& .visx-line': { - stroke: theme.palette.text.primary, - }, - }, + stroke: theme.palette.text.primary + } + } }, '& .visx-columns': { '& .visx-line': { - stroke: theme.palette.divider, - }, + stroke: theme.palette.divider + } }, '& .visx-rows': { '& .visx-line': { - stroke: theme.palette.divider, - }, + stroke: theme.palette.divider + } }, fill: theme.palette.text.primary, - position: 'relative', + position: 'relative' }, graphLoader: { alignItems: 'center', @@ -167,16 +167,16 @@ const useStyles = makeStyles>((theme) => ({ height: '100%', justifyContent: 'center', position: 'absolute', - width: '100%', + width: '100%' }, overlay: { cursor: ({ onAddComment }): string => - isNil(onAddComment) ? 'normal' : 'crosshair', + isNil(onAddComment) ? 'normal' : 'crosshair' }, tooltip: { padding: 12, - zIndex: theme.zIndex.tooltip, - }, + zIndex: theme.zIndex.tooltip + } })); interface ZoomBoundaries { @@ -215,7 +215,7 @@ interface GraphContentProps { const getScale = ({ values, height, - stackedValues, + stackedValues }): ScaleLinear => { const minValue = min(getMin(values), getMin(stackedValues)); const maxValue = max(getMax(values), getMax(stackedValues)); @@ -225,7 +225,7 @@ const getScale = ({ return Scale.scaleLinear({ domain: [minValue, maxValue], nice: true, - range: [height, upperRangeValue], + range: [height, upperRangeValue] }); }; @@ -256,7 +256,7 @@ const GraphContent = ({ isInViewport, isEditAnomalyDetectionDataDialogOpen, displayTimeValues, - resizeEnvelopeData, + resizeEnvelopeData }: GraphContentProps): JSX.Element => { const classes = useStyles({ onAddComment }); const { t } = useTranslation(); @@ -264,21 +264,21 @@ const GraphContent = ({ const [addingComment, setAddingComment] = useState(false); const [commentDate, setCommentDate] = useState(); const [zoomPivotPosition, setZoomPivotPosition] = useState( - null, + null ); const [zoomBoundaries, setZoomBoundaries] = useState( - null, + null ); const graphSvgRef = useRef(null); const { canComment } = useAclQuery(); const mousePosition = useAtomValue(mousePositionAtom); const changeMousePositionAndTimeValue = useUpdateAtom( - changeMousePositionAndTimeValueDerivedAtom, + changeMousePositionAndTimeValueDerivedAtom ); const changeTimeValue = useUpdateAtom(changeTimeValueDerivedAtom); const setAnnotationHovered = useUpdateAtom(annotationHoveredAtom); const changeAnnotationHovered = useUpdateAtom( - changeAnnotationHoveredDerivedAtom, + changeAnnotationHoveredDerivedAtom ); const theme = useTheme(); @@ -287,7 +287,7 @@ const GraphContent = ({ const graphHeight = height > 0 ? height - margin.top - margin.bottom : 0; const hideAddCommentTooltipOnEspcapePress = ( - event: globalThis.KeyboardEvent, + event: globalThis.KeyboardEvent ): void => { if (event.key === 'Escape') { hideAddCommentTooltip(); @@ -298,14 +298,14 @@ const GraphContent = ({ document.addEventListener( 'keydown', hideAddCommentTooltipOnEspcapePress, - false, + false ); return (): void => { document.removeEventListener( 'keydown', hideAddCommentTooltipOnEspcapePress, - false, + false ); }; }, []); @@ -315,11 +315,11 @@ const GraphContent = ({ Scale.scaleTime({ domain: [ getMin(timeSeries.map(getTime)), - getMax(timeSeries.map(getTime)), + getMax(timeSeries.map(getTime)) ], - range: [0, graphWidth], + range: [0, graphWidth] }), - [graphWidth, timeSeries], + [graphWidth, timeSeries] ); const [firstUnit, secondUnit, thirdUnit] = getUnits(lines); @@ -337,7 +337,7 @@ const GraphContent = ({ const stackedValues = firstUnitHasStackedLines ? getStackedMetricValues({ lines: getSortedStackedLines(lines), - timeSeries, + timeSeries }) : [0]; @@ -348,7 +348,7 @@ const GraphContent = ({ const values = getMetricValuesForUnit({ lines, timeSeries, - unit: secondUnit, + unit: secondUnit }); const secondUnitHasStackedLines = isNil(secondUnit) @@ -358,7 +358,7 @@ const GraphContent = ({ const stackedValues = secondUnitHasStackedLines ? getStackedMetricValues({ lines: getSortedStackedLines(lines), - timeSeries, + timeSeries }) : [0]; @@ -376,7 +376,7 @@ const GraphContent = ({ if (isNil(position)) { changeMousePositionAndTimeValue({ position: null, - timeValue: null, + timeValue: null }); return; @@ -389,7 +389,7 @@ const GraphContent = ({ const displayTooltip = (event: MouseEvent): void => { const { x, y } = Event.localPoint( graphSvgRef.current as SVGSVGElement, - event, + event ) || { x: 0, y: 0 }; const mouseX = x - margin.left; @@ -399,13 +399,13 @@ const GraphContent = ({ mouseX, resourceId: resource.uuid, timeline, - xScale, + xScale }); if (zoomPivotPosition) { setZoomBoundaries({ end: gte(mouseX, zoomPivotPosition) ? mouseX : zoomPivotPosition, - start: lt(mouseX, zoomPivotPosition) ? mouseX : zoomPivotPosition, + start: lt(mouseX, zoomPivotPosition) ? mouseX : zoomPivotPosition }); changeTimeValue({ isInViewport, newTimeValue: null }); @@ -442,7 +442,7 @@ const GraphContent = ({ if (zoomBoundaries?.start !== zoomBoundaries?.end) { applyZoom?.({ end: xScale.invert(zoomBoundaries?.end || graphWidth), - start: xScale.invert(zoomBoundaries?.start || 0), + start: xScale.invert(zoomBoundaries?.start || 0) }); return; @@ -459,7 +459,7 @@ const GraphContent = ({ showAddCommentTooltip({ tooltipLeft: displayLeft ? x - commentTooltipWidth : x, - tooltipTop: y, + tooltipTop: y }); }; @@ -484,7 +484,7 @@ const GraphContent = ({ setZoomPivotPosition(mouseX); setZoomBoundaries({ end: mouseX, - start: mouseX, + start: mouseX }); hideAddCommentTooltip(); }; @@ -495,7 +495,7 @@ const GraphContent = ({ const mousePositionY = (position?.[1] || 0) - margin.top; const zoomBarWidth = Math.abs( - (zoomBoundaries?.end || 0) - (zoomBoundaries?.start || 0), + (zoomBoundaries?.end || 0) - (zoomBoundaries?.start || 0) ); const mousePositionTimeTick = position @@ -526,7 +526,7 @@ const GraphContent = ({ secondUnit, thirdUnit, timeSeries, - xScale, + xScale }; return ( @@ -635,7 +635,7 @@ const GraphContent = ({ ) : ( ), - memoProps: [mousePosition], + memoProps: [mousePosition] })} {!isEditAnomalyDetectionDataDialogOpen && ( @@ -682,13 +682,13 @@ const GraphContent = ({ style={{ left: addCommentTooltipLeft, top: addCommentTooltipTop, - width: commentTooltipWidth, + width: commentTooltipWidth }} > {format({ date: new Date(commentDate as Date), - formatString: dateTimeFormat, + formatString: dateTimeFormat })} @@ -739,12 +739,12 @@ const memoProps = [ 'displayEventAnnotations', 'containsMetrics', 'isInViewport', - 'resizeEnvelopeData', + 'resizeEnvelopeData' ]; const MemoizedGraphContent = memoizeComponent({ Component: GraphContent, - memoProps, + memoProps }); const Graph = ( @@ -758,7 +758,7 @@ const Graph = ( | 'format' | 'changeMetricsValue' | 'isInViewport' - >, + > ): JSX.Element => { const { format } = useLocaleDateTimeFormat(); const { @@ -766,7 +766,7 @@ const Graph = ( tooltipTop: addCommentTooltipTop, tooltipOpen: addCommentTooltipOpen, showTooltip: showAddCommentTooltip, - hideTooltip: hideAddCommentTooltip, + hideTooltip: hideAddCommentTooltip } = VisxTooltip.useTooltip(); return ( diff --git a/www/front_src/src/Resources/Graph/Performance/Graph/mouseTimeValueAtoms.ts b/www/front_src/src/Resources/Graph/Performance/Graph/mouseTimeValueAtoms.ts index f415967db6a..36674848059 100644 --- a/www/front_src/src/Resources/Graph/Performance/Graph/mouseTimeValueAtoms.ts +++ b/www/front_src/src/Resources/Graph/Performance/Graph/mouseTimeValueAtoms.ts @@ -24,13 +24,13 @@ export const changeTimeValueDerivedAtom = atom( ( _, set, - { newTimeValue, isInViewport }: NewTimeValueInViewportState, + { newTimeValue, isInViewport }: NewTimeValueInViewportState ): void => { if (not(isInViewport)) { return; } set(timeValueAtom, newTimeValue); - }, + } ); export const changeMousePositionAndTimeValueDerivedAtom = atom( @@ -45,5 +45,5 @@ export const changeMousePositionAndTimeValueDerivedAtom = atom( set(mousePositionAtom, position); set(timeValueAtom, timeValue); - }, + } ); diff --git a/www/front_src/src/Resources/Graph/Performance/GraphActions.tsx b/www/front_src/src/Resources/Graph/Performance/GraphActions.tsx index 6704e9042a2..72da8f2f813 100644 --- a/www/front_src/src/Resources/Graph/Performance/GraphActions.tsx +++ b/www/front_src/src/Resources/Graph/Performance/GraphActions.tsx @@ -14,7 +14,7 @@ import WrenchIcon from '@mui/icons-material/Build'; import { ContentWithCircularLoading, useLocaleDateTimeFormat, - IconButton, + IconButton } from '@centreon/ui'; import { @@ -24,7 +24,7 @@ import { labelPerformancePage, labelSmallSize, labelPerformanceGraphAD, - labelCSV, + labelCSV } from '../../translatedLabels'; import { CustomTimePeriod } from '../../Details/tabs/Graph/models'; import { TimelineEvent } from '../../Details/tabs/Timeline/models'; @@ -35,7 +35,7 @@ import { detailsAtom } from '../../Details/detailsAtoms'; import exportToPng from './ExportableGraphWithTimeline/exportToPng'; import { getDatesDerivedAtom, - selectedTimePeriodAtom, + selectedTimePeriodAtom } from './TimePeriods/timePeriodAtoms'; interface Props { @@ -53,8 +53,8 @@ const useStyles = makeStyles((theme) => ({ alignItems: 'center', columnGap: theme.spacing(1), display: 'inline', - flexDirection: 'row', - }, + flexDirection: 'row' + } })); const GraphActions = ({ @@ -64,7 +64,7 @@ const GraphActions = ({ resourceType, timeline, performanceGraphRef, - getIsModalOpened, + getIsModalOpened }: Props): JSX.Element => { const classes = useStyles(); const theme = useTheme(); @@ -75,7 +75,7 @@ const GraphActions = ({ const navigate = useNavigate(); const isResourceAnomalyDetection = equals( resourceType, - ResourceType.anomalydetection, + ResourceType.anomalydetection ); const openSizeExportMenu = (event: MouseEvent): void => { setMenuAnchor(event.currentTarget); @@ -97,11 +97,11 @@ const GraphActions = ({ const goToPerformancePage = (): void => { const startTimestamp = format({ date: customTimePeriod?.start as Date, - formatString: 'X', + formatString: 'X' }); const endTimestamp = format({ date: customTimePeriod?.end as Date, - formatString: 'X', + formatString: 'X' }); const urlParameters = (): string => { @@ -109,7 +109,7 @@ const GraphActions = ({ end: endTimestamp, mode: '0', start: startTimestamp, - svc_id: `${resourceParentName};${resourceName}`, + svc_id: `${resourceParentName};${resourceName}` }); return params.toString(); @@ -125,7 +125,7 @@ const GraphActions = ({ backgroundColor: theme.palette.background.paper, element: performanceGraphRef.current as HTMLElement, ratio, - title: `${resourceName}-performance`, + title: `${resourceName}-performance` }).finally(() => { setExporting(false); }); @@ -224,8 +224,8 @@ const MemoizedGraphActions = memoizeComponent({ 'resourceParentName', 'resourceName', 'timeline', - 'performanceGraphRef', - ], + 'performanceGraphRef' + ] }); export default MemoizedGraphActions; diff --git a/www/front_src/src/Resources/Graph/Performance/Legend/Marker.tsx b/www/front_src/src/Resources/Graph/Performance/Legend/Marker.tsx index 0bee8750d1a..8b87252244f 100644 --- a/www/front_src/src/Resources/Graph/Performance/Legend/Marker.tsx +++ b/www/front_src/src/Resources/Graph/Performance/Legend/Marker.tsx @@ -7,7 +7,7 @@ import { CreateCSSProperties } from '@mui/styles'; export enum LegendMarkerVariant { 'dot', - 'bar', + 'bar' } interface StylesProps { @@ -17,15 +17,15 @@ interface StylesProps { const useStyles = makeStyles((theme) => ({ disabled: { - color: theme.palette.text.disabled, + color: theme.palette.text.disabled }, icon: ({ color, variant }): CreateCSSProperties => ({ backgroundColor: color, borderRadius: equals(LegendMarkerVariant.dot, variant) ? '50%' : 0, height: equals(LegendMarkerVariant.dot, variant) ? 9 : '100%', marginRight: theme.spacing(0.5), - width: 9, - }), + width: 9 + }) })); interface Props { @@ -37,7 +37,7 @@ interface Props { const LegendMarker = ({ disabled, color, - variant = LegendMarkerVariant.bar, + variant = LegendMarkerVariant.bar }: Props): JSX.Element => { const classes = useStyles({ color, variant }); diff --git a/www/front_src/src/Resources/Graph/Performance/Legend/index.tsx b/www/front_src/src/Resources/Graph/Performance/Legend/index.tsx index 074a5428dd4..f38ae46af62 100644 --- a/www/front_src/src/Resources/Graph/Performance/Legend/index.tsx +++ b/www/front_src/src/Resources/Graph/Performance/Legend/index.tsx @@ -11,7 +11,7 @@ import { length, slice, split, - isEmpty, + isEmpty } from 'ramda'; import { useTranslation } from 'react-i18next'; import { useAtomValue } from 'jotai/utils'; @@ -23,7 +23,7 @@ import { Theme, Tooltip, Box, - Button, + Button } from '@mui/material'; import makeStyles from '@mui/styles/makeStyles'; import BarChartIcon from '@mui/icons-material/BarChart'; @@ -36,7 +36,7 @@ import { labelAvg, labelDisplayCompleteGraph, labelMax, - labelMin, + labelMin } from '../../../translatedLabels'; import { timeValueAtom } from '../Graph/mouseTimeValueAtoms'; import { getLineForMetric, getMetrics } from '../timeSeries'; @@ -65,15 +65,15 @@ const useStyles = makeStyles((theme) => ({ maxWidth: 0.85 * panelWidth, overflow: 'hidden', textOverflow: 'ellipsis', - whiteSpace: 'nowrap', + whiteSpace: 'nowrap' }), highlight: { - color: theme.typography.body1.color, + color: theme.typography.body1.color }, item: { display: 'grid', gridTemplateColumns: 'min-content minmax(50px, 1fr)', - marginBottom: theme.spacing(1), + marginBottom: theme.spacing(1) }, items: ({ limitLegendRows }): CreateCSSProperties => ({ display: 'grid', @@ -82,49 +82,49 @@ const useStyles = makeStyles((theme) => ({ marginLeft: theme.spacing(0.5), maxHeight: limitLegendRows ? theme.spacing(19) : 'unset', overflowY: 'auto', - width: '100%', + width: '100%' }), legend: { maxHeight: theme.spacing(24), overflowX: 'hidden', overflowY: 'auto', - width: '100%', + width: '100%' }, legendData: { display: 'flex', - flexDirection: 'column', + flexDirection: 'column' }, legendName: { display: 'flex', flexDirection: 'row', justifyContent: 'start', overflow: 'hidden', - textOverflow: 'ellipsis', + textOverflow: 'ellipsis' }, legendUnit: { justifyContent: 'end', marginLeft: 'auto', marginRight: theme.spacing(0.5), overflow: 'hidden', - textOverflow: 'ellipsis', + textOverflow: 'ellipsis' }, legendValue: { - fontWeight: theme.typography.body1.fontWeight, + fontWeight: theme.typography.body1.fontWeight }, minMaxAvgContainer: { columnGap: theme.spacing(0.5), display: 'grid', gridAutoRows: theme.spacing(2), gridTemplateColumns: 'repeat(2, min-content)', - whiteSpace: 'nowrap', + whiteSpace: 'nowrap' }, minMaxAvgValue: { fontWeight: 600 }, normal: { - color: theme.palette.text.primary, + color: theme.palette.text.primary }, toggable: { - cursor: 'pointer', - }, + cursor: 'pointer' + } })); interface Props { @@ -159,7 +159,7 @@ const LegendContent = ({ displayCompleteGraph, timeSeries, displayTimeValues, - isEditAnomalyDetectionDataDialogOpen, + isEditAnomalyDetectionDataDialogOpen }: Props): JSX.Element => { const panelWidth = useAtomValue(panelWidthStorageAtom); const classes = useStyles({ limitLegendRows, panelWidth }); @@ -168,7 +168,7 @@ const LegendContent = ({ const timeValue = useAtomValue(timeValueAtom); const graphTimeValue = timeSeries.find((timeSerie) => - equals(timeSerie.timeTick, timeValue?.timeTick), + equals(timeSerie.timeTick, timeValue?.timeTick) ); const getLegendName = ({ legend, name, unit }: Line): JSX.Element => { @@ -212,11 +212,11 @@ const LegendContent = ({ formatMetricValue({ base, unit, - value, + value }) || 'N/A'; const getFormattedMetricData = ( - metric: string, + metric: string ): FormattedMetricData | null => { if (isNil(graphTimeValue)) { return null; @@ -225,20 +225,20 @@ const LegendContent = ({ const { color, name, unit } = getLineForMetric({ lines, - metric, + metric }) as Line; const formattedValue = formatMetricValue({ base, unit, - value, + value }); return { color, formattedValue, name, - unit, + unit }; }; @@ -260,7 +260,7 @@ const LegendContent = ({ name, display, metric: metricLine, - highlight, + highlight } = line; const markerColor = display @@ -278,16 +278,16 @@ const LegendContent = ({ const minMaxAvg = [ { label: labelMin, - value: line.minimum_value, + value: line.minimum_value }, { label: labelMax, - value: line.maximum_value, + value: line.maximum_value }, { label: labelAvg, - value: line.average_value, - }, + value: line.average_value + } ]; const selectMetricLine = (event: MouseEvent): void => { @@ -309,7 +309,7 @@ const LegendContent = ({ className={clsx( classes.item, highlight ? classes.highlight : classes.normal, - toggable && classes.toggable, + toggable && classes.toggable )} key={name} onClick={selectMetricLine} @@ -345,7 +345,7 @@ const LegendContent = ({ > {getMetricValue({ unit: line.unit, - value, + value })} @@ -379,12 +379,12 @@ const memoProps = [ 'toggable', 'timeSeries', 'displayTimeValues', - 'base', + 'base' ]; const MemoizedLegendContent = memoizeComponent({ Component: LegendContent, - memoProps, + memoProps }); const Legend = (props: Props): JSX.Element => { diff --git a/www/front_src/src/Resources/Graph/Performance/Lines/AnchorPoint/RegularAnchorPoint.tsx b/www/front_src/src/Resources/Graph/Performance/Lines/AnchorPoint/RegularAnchorPoint.tsx index 8145e44ee64..0b6ded6099f 100644 --- a/www/front_src/src/Resources/Graph/Performance/Lines/AnchorPoint/RegularAnchorPoint.tsx +++ b/www/front_src/src/Resources/Graph/Performance/Lines/AnchorPoint/RegularAnchorPoint.tsx @@ -25,7 +25,7 @@ const getYAnchorPoint = ({ timeTick, timeSeries, yScale, - metric, + metric }: Pick): number => { const index = bisectDate(getDates(timeSeries), timeTick); const timeValue = timeSeries[index]; @@ -42,7 +42,7 @@ const RegularAnchorPoint = ({ areaColor, transparency, lineColor, - displayTimeValues, + displayTimeValues }: Props): JSX.Element | null => { if (isNil(timeTick) || not(displayTimeValues)) { return null; @@ -53,7 +53,7 @@ const RegularAnchorPoint = ({ metric, timeSeries, timeTick, - yScale, + yScale }); if (isNil(yAnchorPoint)) { @@ -75,5 +75,5 @@ export default memo( RegularAnchorPoint, (prevProps, nextProps) => equals(prevProps.timeTick, nextProps.timeTick) && - equals(prevProps.timeSeries, nextProps.timeSeries), + equals(prevProps.timeSeries, nextProps.timeSeries) ); diff --git a/www/front_src/src/Resources/Graph/Performance/Lines/AnchorPoint/StackedAnchorPoint.tsx b/www/front_src/src/Resources/Graph/Performance/Lines/AnchorPoint/StackedAnchorPoint.tsx index b863974179b..9c39671bcfd 100644 --- a/www/front_src/src/Resources/Graph/Performance/Lines/AnchorPoint/StackedAnchorPoint.tsx +++ b/www/front_src/src/Resources/Graph/Performance/Lines/AnchorPoint/StackedAnchorPoint.tsx @@ -38,7 +38,7 @@ const getStackedDates = (stackValues: Array): Array => { const getYAnchorPoint = ({ timeTick, stackValues, - yScale, + yScale }: Pick): number => { const index = bisectDate(getStackedDates(stackValues), timeTick); const timeValue = stackValues[index]; @@ -54,7 +54,7 @@ const StackedAnchorPoint = ({ areaColor, transparency, lineColor, - displayTimeValues, + displayTimeValues }: Props): JSX.Element | null => { if (isNil(timeTick) || not(displayTimeValues)) { return null; @@ -64,7 +64,7 @@ const StackedAnchorPoint = ({ const yAnchorPoint = getYAnchorPoint({ stackValues, timeTick, - yScale, + yScale }); if (isNil(yAnchorPoint)) { @@ -86,5 +86,5 @@ export default memo( StackedAnchorPoint, (prevProps, nextProps) => equals(prevProps.timeTick, nextProps.timeTick) && - equals(prevProps.stackValues, nextProps.stackValues), + equals(prevProps.stackValues, nextProps.stackValues) ); diff --git a/www/front_src/src/Resources/Graph/Performance/Lines/AnchorPoint/index.tsx b/www/front_src/src/Resources/Graph/Performance/Lines/AnchorPoint/index.tsx index d8a25e00b3e..a03d80e0fa4 100644 --- a/www/front_src/src/Resources/Graph/Performance/Lines/AnchorPoint/index.tsx +++ b/www/front_src/src/Resources/Graph/Performance/Lines/AnchorPoint/index.tsx @@ -11,7 +11,7 @@ const Point = ({ lineColor, transparency, x, - y, + y }: Props): JSX.Element => ( { const strokeWidth = equals(metric, 'connection_lower_thresholds') || @@ -59,7 +59,7 @@ const RegularLine = ({ strokeWidth: isHighlighted, unit, x: (timeValue): number => xScale(getTime(timeValue)) as number, - y: (timeValue): number => yScale(prop(metric, timeValue)) ?? null, + y: (timeValue): number => yScale(prop(metric, timeValue)) ?? null }; if (filled) { @@ -88,13 +88,13 @@ export default memo(RegularLine, (prevProps, nextProps) => { timeSeries: prevTimeSeries, graphHeight: prevGraphHeight, highlight: prevHighlight, - xScale: prevXScale, + xScale: prevXScale } = prevProps; const { timeSeries: nextTimeSeries, graphHeight: nextGraphHeight, highlight: nextHighlight, - xScale: nextXScale, + xScale: nextXScale } = nextProps; const prevXScaleRange = prevXScale.range(); diff --git a/www/front_src/src/Resources/Graph/Performance/Lines/StackedLines.tsx b/www/front_src/src/Resources/Graph/Performance/Lines/StackedLines.tsx index 380115b5500..b51dafeafb1 100644 --- a/www/front_src/src/Resources/Graph/Performance/Lines/StackedLines.tsx +++ b/www/front_src/src/Resources/Graph/Performance/Lines/StackedLines.tsx @@ -6,7 +6,7 @@ import { Line, TimeValue } from '../models'; import { getTime } from '../timeSeries'; import StackedAnchorPoint, { - StackValue, + StackValue } from './AnchorPoint/StackedAnchorPoint'; import { getFillColor } from '.'; @@ -26,7 +26,7 @@ const StackLines = ({ yScale, xScale, timeTick, - displayTimeValues, + displayTimeValues }: Props): JSX.Element => ( { return pipe( map(prop('metric')) as (lines) => Array, - all((metric) => pipe(path(['data', metric]), isNil, not)(d)), + all((metric) => pipe(path(['data', metric]), isNil, not)(d)) )(lines); }} keys={map(prop('metric'), lines)} @@ -46,7 +46,7 @@ const StackLines = ({ return stacks.map((stack, index) => { const { areaColor, transparency, lineColor, highlight } = nth( index, - lines, + lines ) as Line; return ( diff --git a/www/front_src/src/Resources/Graph/Performance/Lines/index.tsx b/www/front_src/src/Resources/Graph/Performance/Lines/index.tsx index 0e771a9579f..1a5679119d1 100644 --- a/www/front_src/src/Resources/Graph/Performance/Lines/index.tsx +++ b/www/front_src/src/Resources/Graph/Performance/Lines/index.tsx @@ -15,7 +15,7 @@ import { getSortedStackedLines, getTimeSeriesForLines, getUnits, - getYScale, + getYScale } from '../timeSeries'; import RegularAnchorPoint from './AnchorPoint/RegularAnchorPoint'; @@ -43,15 +43,15 @@ interface YScales { const getStackedYScale = ({ leftScale, - rightScale, + rightScale }: YScales): ScaleLinear => { const minDomain = min( getMin(leftScale.domain()), - getMin(rightScale.domain()), + getMin(rightScale.domain()) ); const maxDomain = max( getMax(leftScale.domain()), - getMax(rightScale.domain()), + getMax(rightScale.domain()) ); const minRange = min(getMin(leftScale.range()), getMin(rightScale.range())); @@ -60,7 +60,7 @@ const getStackedYScale = ({ return Scale.scaleLinear({ domain: [minDomain, maxDomain], nice: true, - range: [maxRange, minRange], + range: [maxRange, minRange] }); }; @@ -71,7 +71,7 @@ interface FillColor { export const getFillColor = ({ transparency, - areaColor, + areaColor }: FillColor): string | undefined => transparency ? alpha(areaColor, 1 - transparency * 0.01) : undefined; @@ -86,7 +86,7 @@ const Lines = ({ displayTimeValues, isEditAnomalyDetectionDataDialogOpen, anomalyDetectionEnvelope, - anomalyDetectionResizeEnvelope, + anomalyDetectionResizeEnvelope }: Props): JSX.Element => { const [, secondUnit, thirdUnit] = getUnits(lines); @@ -95,13 +95,13 @@ const Lines = ({ const regularStackedLines = getNotInvertedStackedLines(lines); const regularStackedTimeSeries = getTimeSeriesForLines({ lines: regularStackedLines, - timeSeries, + timeSeries }); const invertedStackedLines = getInvertedStackedLines(lines); const invertedStackedTimeSeries = getTimeSeriesForLines({ lines: invertedStackedLines, - timeSeries, + timeSeries }); const stackedYScale = getStackedYScale({ leftScale, rightScale }); @@ -138,7 +138,7 @@ const Lines = ({ filled, unit, highlight, - invert, + invert }) => { const yScale = getYScale({ hasMoreThanTwoUnits: !isNil(thirdUnit), @@ -146,7 +146,7 @@ const Lines = ({ leftScale, rightScale, secondUnit, - unit, + unit }); return ( @@ -180,7 +180,7 @@ const Lines = ({ /> ); - }, + } )} diff --git a/www/front_src/src/Resources/Graph/Performance/LoadingSkeleton.tsx b/www/front_src/src/Resources/Graph/Performance/LoadingSkeleton.tsx index f0866261045..0a2b6938763 100644 --- a/www/front_src/src/Resources/Graph/Performance/LoadingSkeleton.tsx +++ b/www/front_src/src/Resources/Graph/Performance/LoadingSkeleton.tsx @@ -12,19 +12,19 @@ const useSkeletonStyles = makeStyles((theme) => ({ gridGap: theme.spacing(1), gridTemplateRows: ({ graphHeight, displayTitleSkeleton }: Props): string => `${displayTitleSkeleton ? '1fr' : ''} ${graphHeight}px ${theme.spacing( - 7, + 7 )}`, - height: '100%', + height: '100%' }, loadingSkeletonLine: { paddingBottom: theme.spacing(1), - transform: 'none', - }, + transform: 'none' + } })); const LoadingSkeleton = ({ graphHeight, - displayTitleSkeleton, + displayTitleSkeleton }: Props): JSX.Element => { const classes = useSkeletonStyles({ displayTitleSkeleton, graphHeight }); diff --git a/www/front_src/src/Resources/Graph/Performance/TimePeriods/CustomTimePeriodPickers.tsx b/www/front_src/src/Resources/Graph/Performance/TimePeriods/CustomTimePeriodPickers.tsx index bbcdace3d70..92abb2fb86c 100644 --- a/www/front_src/src/Resources/Graph/Performance/TimePeriods/CustomTimePeriodPickers.tsx +++ b/www/front_src/src/Resources/Graph/Performance/TimePeriods/CustomTimePeriodPickers.tsx @@ -20,11 +20,11 @@ import { labelEndDateGreaterThanStartDate, labelTo, labelCompactTimePeriod, - labelFrom, + labelFrom } from '../../../translatedLabels'; import { CustomTimePeriod, - CustomTimePeriodProperty, + CustomTimePeriodProperty } from '../../../Details/tabs/Graph/models'; import useDateTimePickerAdapter from '../../../useDateTimePickerAdapter'; @@ -46,77 +46,77 @@ dayjs.extend(isSameOrAfter); const useStyles = makeStyles((theme) => ({ button: { height: '100%', - padding: theme.spacing(0, 0.5), + padding: theme.spacing(0, 0.5) }, buttonContent: { alignItems: 'center', columnGap: theme.spacing(1), display: 'grid', - gridTemplateColumns: 'min-content auto', + gridTemplateColumns: 'min-content auto' }, compactFromTo: { display: 'flex', flexDirection: 'column', - padding: theme.spacing(0.5, 0, 0.5, 0), + padding: theme.spacing(0.5, 0, 0.5, 0) }, date: { - display: 'flex', + display: 'flex' }, dateLabel: { display: 'flex', flex: 1, - paddingRight: 4, + paddingRight: 4 }, error: { - textAlign: 'center', + textAlign: 'center' }, fromTo: { alignItems: 'center', columnGap: theme.spacing(0.5), display: 'grid', - gridTemplateColumns: 'repeat(2, auto)', + gridTemplateColumns: 'repeat(2, auto)' }, minimalFromTo: { display: 'grid', gridTemplateRows: 'repeat(2, min-content)', - rowGap: theme.spacing(0.3), + rowGap: theme.spacing(0.3) }, minimalPickers: { alignItems: 'center', columnGap: theme.spacing(1), display: 'grid', - gridTemplateColumns: 'min-content auto', + gridTemplateColumns: 'min-content auto' }, pickerText: { cursor: 'pointer', - lineHeight: '1.2', + lineHeight: '1.2' }, pickers: { alignItems: 'center', columnGap: theme.spacing(0.5), display: 'grid', gridTemplateColumns: `minmax(${theme.spacing(15)}, ${theme.spacing( - 17, - )}px) min-content minmax(${theme.spacing(15)}, ${theme.spacing(17)})`, + 17 + )}px) min-content minmax(${theme.spacing(15)}, ${theme.spacing(17)})` }, popover: { display: 'grid', gridTemplateRows: 'auto auto auto', justifyItems: 'center', padding: theme.spacing(1, 2), - rowGap: theme.spacing(1), + rowGap: theme.spacing(1) }, timeContainer: { alignItems: 'center', display: 'flex', - flexDirection: 'row', - }, + flexDirection: 'row' + } })); const CustomTimePeriodPickers = ({ customTimePeriod, acceptDate, - isCompact: isMinimalWidth, + isCompact: isMinimalWidth }: Props): JSX.Element => { const classes = useStyles(isMinimalWidth); const { t } = useTranslation(); @@ -136,12 +136,12 @@ const CustomTimePeriodPickers = ({ cond([ [ (): boolean => equals(CustomTimePeriodProperty.start, property), - (): void => setStart(date), + (): void => setStart(date) ], [ (): boolean => equals(CustomTimePeriodProperty.end, property), - (): void => setEnd(date), - ], + (): void => setEnd(date) + ] ])(); if ( @@ -153,7 +153,7 @@ const CustomTimePeriodPickers = ({ } acceptDate({ date, - property, + property }); }; @@ -161,7 +161,7 @@ const CustomTimePeriodPickers = ({ if ( and( dayjs(customTimePeriod.start).isSame(dayjs(start), 'minute'), - dayjs(customTimePeriod.end).isSame(dayjs(end), 'minute'), + dayjs(customTimePeriod.end).isSame(dayjs(end), 'minute') ) ) { return; @@ -205,7 +205,7 @@ const CustomTimePeriodPickers = ({ {format({ date: customTimePeriod.start, - formatString: dateTimeFormat, + formatString: dateTimeFormat })} @@ -218,7 +218,7 @@ const CustomTimePeriodPickers = ({ {format({ date: customTimePeriod.end, - formatString: dateTimeFormat, + formatString: dateTimeFormat })} @@ -230,12 +230,12 @@ const CustomTimePeriodPickers = ({ anchorEl={anchorEl} anchorOrigin={{ horizontal: 'center', - vertical: 'top', + vertical: 'top' }} open={displayPopover} transformOrigin={{ horizontal: 'center', - vertical: 'top', + vertical: 'top' }} onClose={closePopover} > diff --git a/www/front_src/src/Resources/Graph/Performance/TimePeriods/DateTimePickerInput.tsx b/www/front_src/src/Resources/Graph/Performance/TimePeriods/DateTimePickerInput.tsx index 1442700e57a..b76a37d4c81 100644 --- a/www/front_src/src/Resources/Graph/Performance/TimePeriods/DateTimePickerInput.tsx +++ b/www/front_src/src/Resources/Graph/Performance/TimePeriods/DateTimePickerInput.tsx @@ -29,7 +29,7 @@ const renderDateTimePickerTextField = inputProps={{ ...inputProps, ref: inputRef, - style: { padding: 8 }, + style: { padding: 8 } }} onBlur={blur} /> @@ -42,7 +42,7 @@ const DateTimePickerInput = ({ minDate, property, changeDate, - setDate, + setDate }: Props): JSX.Element => { const [isOpen, setIsOpen] = useState(false); const { getDestinationAndConfiguredTimezoneOffset, formatKeyboardValue } = @@ -50,7 +50,7 @@ const DateTimePickerInput = ({ const changeTime = ( newValue: dayjs.Dayjs | null, - keyBoardValue: string | undefined, + keyBoardValue: string | undefined ): void => { if (isOpen) { changeDate({ date: dayjs(newValue).toDate(), property }); @@ -59,7 +59,7 @@ const DateTimePickerInput = ({ } const value = dayjs(formatKeyboardValue(keyBoardValue)) .add( - dayjs.duration({ hours: getDestinationAndConfiguredTimezoneOffset() }), + dayjs.duration({ hours: getDestinationAndConfiguredTimezoneOffset() }) ) .toDate(); @@ -74,7 +74,7 @@ const DateTimePickerInput = ({ hideTabs PopperProps={{ - open: isOpen, + open: isOpen }} maxDate={maxDate && dayjs(maxDate)} minDate={minDate && dayjs(minDate)} diff --git a/www/front_src/src/Resources/Graph/Performance/TimePeriods/index.tsx b/www/front_src/src/Resources/Graph/Performance/TimePeriods/index.tsx index 334314c0c34..4acb73c5424 100644 --- a/www/front_src/src/Resources/Graph/Performance/TimePeriods/index.tsx +++ b/www/front_src/src/Resources/Graph/Performance/TimePeriods/index.tsx @@ -9,7 +9,7 @@ import { Button, useTheme, Tooltip, - Theme, + Theme } from '@mui/material'; import makeStyles from '@mui/styles/makeStyles'; import { CreateCSSProperties } from '@mui/styles'; @@ -25,7 +25,7 @@ import { changeCustomTimePeriodDerivedAtom, changeSelectedTimePeriodDerivedAtom, customTimePeriodAtom, - selectedTimePeriodAtom, + selectedTimePeriodAtom } from './timePeriodAtoms'; interface StylesProps { @@ -35,11 +35,11 @@ interface StylesProps { const useStyles = makeStyles((theme) => ({ button: { fontSize: theme.typography.body2.fontSize, - pointerEvents: 'all', + pointerEvents: 'all' }, buttonGroup: { alignSelf: 'center', - height: '100%', + height: '100%' }, header: ({ disablePaper }): CreateCSSProperties => ({ alignItems: 'center', @@ -51,8 +51,8 @@ const useStyles = makeStyles((theme) => ({ gridTemplateColumns: `repeat(3, auto)`, gridTemplateRows: '1fr', justifyContent: 'center', - padding: theme.spacing(1, 0.5), - }), + padding: theme.spacing(1, 0.5) + }) })); interface Props { @@ -66,7 +66,7 @@ const timePeriodOptions = map(pick(['id', 'name', 'largeName']), timePeriods); const TimePeriodButtonGroup = ({ disabled = false, disableGraphOptions = false, - disablePaper = false, + disablePaper = false }: Props): JSX.Element => { const classes = useStyles({ disablePaper }); const { t } = useTranslation(); @@ -77,16 +77,16 @@ const TimePeriodButtonGroup = ({ const { themeMode } = useAtomValue(userAtom); const changeCustomTimePeriod = useUpdateAtom( - changeCustomTimePeriodDerivedAtom, + changeCustomTimePeriodDerivedAtom ); const changeSelectedTimePeriod = useUpdateAtom( - changeSelectedTimePeriodDerivedAtom, + changeSelectedTimePeriodDerivedAtom ); const translatedTimePeriodOptions = timePeriodOptions.map((timePeriod) => ({ ...timePeriod, largeName: t(timePeriod.largeName), - name: t(timePeriod.name), + name: t(timePeriod.name) })); const changeDate = ({ property, date }): void => @@ -123,12 +123,12 @@ const TimePeriodButtonGroup = ({ > {cond([ [lte(theme.breakpoints.values.md), always(largeName)], - [T, always(name)], + [T, always(name)] ])(width)}
), - translatedTimePeriodOptions, + translatedTimePeriodOptions )} ( - defaultTimePeriod, + defaultTimePeriod ); export const getTimeperiodFromNow = ( - timePeriod: TimePeriod | null, + timePeriod: TimePeriod | null ): CustomTimePeriod => { return { end: new Date(Date.now()), - start: new Date(timePeriod?.getStart() || 0), + start: new Date(timePeriod?.getStart() || 0) }; }; export const customTimePeriodAtom = atom( - getTimeperiodFromNow(defaultTimePeriod), + getTimeperiodFromNow(defaultTimePeriod) ); interface GetNewCustomTimePeriodProps { @@ -46,7 +46,7 @@ interface GetNewCustomTimePeriodProps { export const getNewCustomTimePeriod = ({ start, - end, + end }: GetNewCustomTimePeriodProps): CustomTimePeriod => { const customTimePeriodInDay = dayjs .duration(dayjs(end).diff(dayjs(start))) @@ -57,14 +57,14 @@ export const getNewCustomTimePeriod = ({ const timelineLimit = cond([ [gte(1), always(20)], [gte(7), always(100)], - [T, always(500)], + [T, always(500)] ])(customTimePeriodInDay); return { end, start, timelineLimit, - xAxisTickFormat, + xAxisTickFormat }; }; @@ -76,15 +76,15 @@ export const getDatesDerivedAtom = atom( if (isNil(timePeriod)) { return [ customTimePeriod.start.toISOString(), - customTimePeriod.end.toISOString(), + customTimePeriod.end.toISOString() ]; } return [ timePeriod.getStart().toISOString(), - new Date(Date.now()).toISOString(), + new Date(Date.now()).toISOString() ]; - }, + } ); export const graphQueryParametersDerivedAtom = atom( @@ -99,7 +99,7 @@ export const graphQueryParametersDerivedAtom = atom( } return `?start=${startDate?.toISOString()}&end=${endDate?.toISOString()}`; - }, + } ); export const changeSelectedTimePeriodDerivedAtom = atom( @@ -113,7 +113,7 @@ export const changeSelectedTimePeriodDerivedAtom = atom( set(customTimePeriodAtom, newCustomTimePeriod); set(resourceDetailsUpdatedAtom, false); - }, + } ); export const changeCustomTimePeriodDerivedAtom = atom( @@ -123,13 +123,13 @@ export const changeCustomTimePeriodDerivedAtom = atom( const newCustomTimePeriod = getNewCustomTimePeriod({ ...customTimePeriod, - [property]: date, + [property]: date }); set(customTimePeriodAtom, newCustomTimePeriod); set(selectedTimePeriodAtom, null); set(resourceDetailsUpdatedAtom, false); - }, + } ); export const adjustTimePeriodDerivedAtom = atom( @@ -138,5 +138,5 @@ export const adjustTimePeriodDerivedAtom = atom( set(resourceDetailsUpdatedAtom, false); set(customTimePeriodAtom, getNewCustomTimePeriod(adjustTimePeriodProps)); set(selectedTimePeriodAtom, null); - }, + } ); diff --git a/www/front_src/src/Resources/Graph/Performance/TimePeriods/useTimePeriod.tsx b/www/front_src/src/Resources/Graph/Performance/TimePeriods/useTimePeriod.tsx index 7f7725687a4..4c3774d76c7 100644 --- a/www/front_src/src/Resources/Graph/Performance/TimePeriods/useTimePeriod.tsx +++ b/www/front_src/src/Resources/Graph/Performance/TimePeriods/useTimePeriod.tsx @@ -8,12 +8,12 @@ import { useAtomValue, useUpdateAtom } from 'jotai/utils'; import { getTimePeriodById, - TimePeriodId, + TimePeriodId } from '../../../Details/tabs/Graph/models'; import { defaultSelectedCustomTimePeriodAtom, defaultSelectedTimePeriodIdAtom, - detailsAtom, + detailsAtom } from '../../../Details/detailsAtoms'; import { @@ -21,7 +21,7 @@ import { getNewCustomTimePeriod, getTimeperiodFromNow, resourceDetailsUpdatedAtom, - selectedTimePeriodAtom, + selectedTimePeriodAtom } from './timePeriodAtoms'; dayjs.extend(duration); @@ -33,14 +33,14 @@ interface Props { const useTimePeriod = ({ sending = false }: Props): void => { const [customTimePeriod, setCustomTimePeriod] = useAtom(customTimePeriodAtom); const [selectedTimePeriod, setSelectedTimePeriod] = useAtom( - selectedTimePeriodAtom, + selectedTimePeriodAtom ); const details = useAtomValue(detailsAtom); const defaultSelectedTimePeriodId = useAtomValue( - defaultSelectedTimePeriodIdAtom, + defaultSelectedTimePeriodIdAtom ); const defaultSelectedCustomTimePeriod = useAtomValue( - defaultSelectedCustomTimePeriodAtom, + defaultSelectedCustomTimePeriodAtom ); const setResourceDetailsUpdated = useUpdateAtom(resourceDetailsUpdatedAtom); @@ -67,7 +67,7 @@ const useTimePeriod = ({ sending = false }: Props): void => { const newCustomTimePeriod = getNewCustomTimePeriod({ end: new Date(propOr(0, 'end', defaultSelectedCustomTimePeriod)), - start: new Date(propOr(0, 'start', defaultSelectedCustomTimePeriod)), + start: new Date(propOr(0, 'start', defaultSelectedCustomTimePeriod)) }); setCustomTimePeriod(newCustomTimePeriod); @@ -83,7 +83,7 @@ const useTimePeriod = ({ sending = false }: Props): void => { } const newTimePeriod = getTimePeriodById( - defaultSelectedTimePeriodId as TimePeriodId, + defaultSelectedTimePeriodId as TimePeriodId ); setSelectedTimePeriod(newTimePeriod); diff --git a/www/front_src/src/Resources/Graph/Performance/formatMetricValue/index.test.ts b/www/front_src/src/Resources/Graph/Performance/formatMetricValue/index.test.ts index ca7b3403fd0..1c1906bcd4b 100644 --- a/www/front_src/src/Resources/Graph/Performance/formatMetricValue/index.test.ts +++ b/www/front_src/src/Resources/Graph/Performance/formatMetricValue/index.test.ts @@ -9,13 +9,13 @@ describe(formatMetricValue, () => { [0.12232323445, '', 1000, '0.12'], [1024, 'B', 1000, '1K'], [1024, 'B', 1024, '1K'], - [null, 'B', 1024, null], + [null, 'B', 1024, null] ]; it.each(cases)( 'formats the given value to a human readable form according to the given unit and base', (value, unit, base, formattedResult) => { expect(formatMetricValue({ base, unit, value })).toEqual(formattedResult); - }, + } ); }); diff --git a/www/front_src/src/Resources/Graph/Performance/formatMetricValue/index.ts b/www/front_src/src/Resources/Graph/Performance/formatMetricValue/index.ts index 73f4cc29b39..b72b8a740b5 100644 --- a/www/front_src/src/Resources/Graph/Performance/formatMetricValue/index.ts +++ b/www/front_src/src/Resources/Graph/Performance/formatMetricValue/index.ts @@ -10,7 +10,7 @@ interface FormatMetricValueProps { const formatMetricValue = ({ value, unit, - base = 1000, + base = 1000 }: FormatMetricValueProps): string | null => { if (isNil(value)) { return null; @@ -25,7 +25,7 @@ const formatMetricValue = ({ 'o', 'octets', 'b/s', - 'b', + 'b' ]; const base1024 = base2Units.includes(unit) || Number(base) === 1024; diff --git a/www/front_src/src/Resources/Graph/Performance/index.tsx b/www/front_src/src/Resources/Graph/Performance/index.tsx index aa0a0cf2a56..56004947c2d 100644 --- a/www/front_src/src/Resources/Graph/Performance/index.tsx +++ b/www/front_src/src/Resources/Graph/Performance/index.tsx @@ -3,7 +3,7 @@ import { ReactNode, useEffect, useRef, - useState, + useState } from 'react'; import { Responsive } from '@visx/visx'; @@ -24,7 +24,7 @@ import { propEq, propOr, reject, - sortBy, + sortBy } from 'ramda'; import { useTranslation } from 'react-i18next'; @@ -35,7 +35,7 @@ import { getData, timeFormat, useLocaleDateTimeFormat, - useRequest, + useRequest } from '@centreon/ui'; import { labelNoDataForThisPeriod } from '../../translatedLabels'; @@ -45,7 +45,7 @@ import { CommentParameters } from '../../Actions/api'; import { ResourceDetails } from '../../Details/models'; import { CustomTimePeriod, - CustomTimePeriodProperty, + CustomTimePeriodProperty } from '../../Details/tabs/Graph/models'; import { selectedResourcesDetailsAtom } from '../../Details/detailsAtoms'; @@ -53,7 +53,7 @@ import { CustomFactorsData } from './AnomalyDetection/models'; import Graph from './Graph'; import { isListingGraphOpenAtom, - timeValueAtom, + timeValueAtom } from './Graph/mouseTimeValueAtoms'; import { TimeShiftDirection } from './Graph/TimeShiftZones'; import Legend from './Legend'; @@ -62,7 +62,7 @@ import { AdjustTimePeriodProps, GraphData, Line as LineModel, - TimeValue, + TimeValue } from './models'; import { getLineData, getMetrics, getTimeSeries } from './timeSeries'; @@ -74,7 +74,7 @@ interface Props { displayTitle?: boolean; endpoint?: string; getPerformanceGraphRef?: ( - value: MutableRefObject, + value: MutableRefObject ) => void; graphActions?: ReactNode; graphHeight: number; @@ -102,16 +102,16 @@ const useStyles = makeStyles((theme) => ({ gridGap: theme.spacing(0.5), gridTemplateRows: ({ graphHeight, displayTitle }): string => `${displayTitle ? 'min-content' : ''} ${theme.spacing( - 2, + 2 )} ${graphHeight}px min-content`, height: '100%', - width: 'auto', + width: 'auto' }, graphHeader: { display: 'grid', gridTemplateColumns: '0.4fr 1fr 0.4fr', justifyItems: 'end', - width: '100%', + width: '100%' }, graphTranslation: { columnGap: theme.spacing(1), @@ -121,25 +121,25 @@ const useStyles = makeStyles((theme) => ({ justifyContent: ({ canAdjustTimePeriod }): string => canAdjustTimePeriod ? 'space-between' : 'center', margin: theme.spacing(0, 1), - width: '90%', + width: '90%' }, loadingContainer: { height: theme.spacing(2), - width: theme.spacing(2), + width: theme.spacing(2) }, noDataContainer: { alignItems: 'center', display: 'flex', height: '100%', - justifyContent: 'center', + justifyContent: 'center' }, title: { maxWidth: '100%', overflow: 'hidden', placeSelf: 'center', textOverflow: 'ellipsis', - whiteSpace: 'nowrap', - }, + whiteSpace: 'nowrap' + } })); const shiftRatio = 2; @@ -164,12 +164,12 @@ const PerformanceGraph = ({ modal, graphActions, getPerformanceGraphRef, - resizeEnvelopeData, + resizeEnvelopeData }: Props): JSX.Element => { const classes = useStyles({ canAdjustTimePeriod: not(isNil(adjustTimePeriod)), displayTitle, - graphHeight, + graphHeight }); const { t } = useTranslation(); @@ -183,9 +183,9 @@ const PerformanceGraph = ({ const { sendRequest: sendGetGraphDataRequest, - sending: sendingGetGraphDataRequest, + sending: sendingGetGraphDataRequest } = useRequest({ - request: getData, + request: getData }); const selectedResource = useAtomValue(selectedResourcesDetailsAtom); @@ -201,7 +201,7 @@ const PerformanceGraph = ({ } sendGetGraphDataRequest({ - endpoint, + endpoint }) .then((graphData) => { setTimeSeries(getTimeSeries(graphData)); @@ -214,8 +214,8 @@ const PerformanceGraph = ({ newLineData.map((line) => ({ ...line, display: - find(propEq('name', line.name), lineData)?.display ?? true, - })), + find(propEq('name', line.name), lineData)?.display ?? true + })) ); return; @@ -281,7 +281,7 @@ const PerformanceGraph = ({ const originMetric = sortedLines.map(({ metric }) => metric.includes('_upper_thresholds') ? metric.replace('_upper_thresholds', '') - : null, + : null ); const lineOriginMetric = sortedLines.filter((item) => { @@ -291,7 +291,7 @@ const PerformanceGraph = ({ }); const linesThreshold = sortedLines.filter(({ metric }) => - metric.includes('thresholds'), + metric.includes('thresholds') ); const newSortedLines = equals(resource.type, ResourceType.anomalydetection) @@ -309,7 +309,7 @@ const PerformanceGraph = ({ setLineData([ ...reject(propEq('metric', metric), lineData), - { ...line, display: !line.display }, + { ...line, display: !line.display } ]); }; @@ -318,7 +318,7 @@ const PerformanceGraph = ({ setLineData([ ...reject(propEq('metric', metric), fadedLines), - { ...getLineByMetric(metric), highlight: true }, + { ...getLineByMetric(metric), highlight: true } ]); }; @@ -337,10 +337,10 @@ const PerformanceGraph = ({ map( (line) => ({ ...line, - display: true, + display: true }), - lineData, - ), + lineData + ) ); return; @@ -350,10 +350,10 @@ const PerformanceGraph = ({ map( (line) => ({ ...line, - display: equals(line, metricLine), + display: equals(line, metricLine) }), - lineData, - ), + lineData + ) ); }; @@ -366,8 +366,8 @@ const PerformanceGraph = ({ prop(property, timePeriod).getTime(), equals(direction, TimeShiftDirection.backward) ? negate(adjustTimePeriodProps) - : adjustTimePeriodProps, - ), + : adjustTimePeriodProps + ) ); }; @@ -380,20 +380,20 @@ const PerformanceGraph = ({ end: getShiftedDate({ direction, property: CustomTimePeriodProperty.end, - timePeriod: customTimePeriod, + timePeriod: customTimePeriod }), start: getShiftedDate({ direction, property: CustomTimePeriodProperty.start, - timePeriod: customTimePeriod, - }), + timePeriod: customTimePeriod + }) }); }; const timeTick = propOr( '', 'timeTick', - timeValue, + timeValue ); const metrics = getMetrics(timeValue as TimeValue); diff --git a/www/front_src/src/Resources/Graph/Performance/models.ts b/www/front_src/src/Resources/Graph/Performance/models.ts index 3d1fecef390..edc10d944ce 100644 --- a/www/front_src/src/Resources/Graph/Performance/models.ts +++ b/www/front_src/src/Resources/Graph/Performance/models.ts @@ -57,5 +57,5 @@ export interface AdjustTimePeriodProps { export enum GraphOptionId { displayEvents = 'displayEvents', - displayTooltips = 'displayTooltips', + displayTooltips = 'displayTooltips' } diff --git a/www/front_src/src/Resources/Graph/Performance/timeSeries/index.test.ts b/www/front_src/src/Resources/Graph/Performance/timeSeries/index.test.ts index 8657972c6b4..98b5a618760 100644 --- a/www/front_src/src/Resources/Graph/Performance/timeSeries/index.test.ts +++ b/www/front_src/src/Resources/Graph/Performance/timeSeries/index.test.ts @@ -17,13 +17,13 @@ describe('timeSeries', () => { ds_legend: 'Round-Trip-Time Average', ds_order: null, ds_stack: null, - ds_transparency: 80, + ds_transparency: 80 }, legend: 'Round-Trip-Time Average (ms)', maximum_value: 1.5, metric: 'rta', minimum_value: 0.5, - unit: 'ms', + unit: 'ms' }, { average_value: 1, @@ -36,13 +36,13 @@ describe('timeSeries', () => { ds_legend: 'Time', ds_order: null, ds_stack: null, - ds_transparency: 80, + ds_transparency: 80 }, legend: 'Time (ms)', maximum_value: 1.5, metric: 'time', minimum_value: 0.5, - unit: 'ms', + unit: 'ms' }, { average_value: 1, @@ -55,13 +55,13 @@ describe('timeSeries', () => { ds_legend: 'Average duration', ds_order: '2', ds_stack: '1', - ds_transparency: 80, + ds_transparency: 80 }, legend: 'Average duration (ms)', maximum_value: 1.5, metric: 'avgDuration', minimum_value: 0.5, - unit: 'ms', + unit: 'ms' }, { average_value: 1, @@ -74,13 +74,13 @@ describe('timeSeries', () => { ds_legend: 'Duration', ds_order: '1', ds_stack: '1', - ds_transparency: 80, + ds_transparency: 80 }, legend: 'Duration (ms)', maximum_value: 1.5, metric: 'duration', minimum_value: 0.5, - unit: 'ms', + unit: 'ms' }, { average_value: 1, @@ -93,16 +93,16 @@ describe('timeSeries', () => { ds_legend: 'Packet Loss', ds_order: null, ds_stack: null, - ds_transparency: 80, + ds_transparency: 80 }, legend: 'Packet Loss (%)', maximum_value: 1.5, metric: 'packet_loss', minimum_value: 0.5, - unit: '%', - }, + unit: '%' + } ], - times: ['2020-11-05T10:35:00Z', '2020-11-05T10:40:00Z'], + times: ['2020-11-05T10:35:00Z', '2020-11-05T10:40:00Z'] }; describe('getTimeSeries', () => { @@ -114,7 +114,7 @@ describe('timeSeries', () => { packet_loss: 0, rta: 0, time: 0.5, - timeTick: '2020-11-05T10:35:00Z', + timeTick: '2020-11-05T10:35:00Z' }, { avgDuration: 4, @@ -122,8 +122,8 @@ describe('timeSeries', () => { packet_loss: 1, rta: 1, time: 3, - timeTick: '2020-11-05T10:40:00Z', - }, + timeTick: '2020-11-05T10:40:00Z' + } ]); }); @@ -131,8 +131,8 @@ describe('timeSeries', () => { const graphDataWithLowerLimit = { ...graphData, global: { - 'lower-limit': 0.4, - }, + 'lower-limit': 0.4 + } }; expect(timeSeries.getTimeSeries(graphDataWithLowerLimit)).toEqual([ @@ -140,7 +140,7 @@ describe('timeSeries', () => { avgDuration: 6, duration: 12, time: 0.5, - timeTick: '2020-11-05T10:35:00Z', + timeTick: '2020-11-05T10:35:00Z' }, { avgDuration: 4, @@ -148,8 +148,8 @@ describe('timeSeries', () => { packet_loss: 1, rta: 1, time: 3, - timeTick: '2020-11-05T10:40:00Z', - }, + timeTick: '2020-11-05T10:40:00Z' + } ]); }); }); @@ -173,7 +173,7 @@ describe('timeSeries', () => { name: 'Round-Trip-Time Average (ms)', stackOrder: null, transparency: 80, - unit: 'ms', + unit: 'ms' }, { areaColor: 'blue', @@ -191,7 +191,7 @@ describe('timeSeries', () => { name: 'Time (ms)', stackOrder: null, transparency: 80, - unit: 'ms', + unit: 'ms' }, { areaColor: 'red', @@ -209,7 +209,7 @@ describe('timeSeries', () => { name: 'Average duration (ms)', stackOrder: 2, transparency: 80, - unit: 'ms', + unit: 'ms' }, { areaColor: 'yellow', @@ -227,7 +227,7 @@ describe('timeSeries', () => { name: 'Duration (ms)', stackOrder: 1, transparency: 80, - unit: 'ms', + unit: 'ms' }, { areaColor: 'yellow', @@ -245,8 +245,8 @@ describe('timeSeries', () => { name: 'Packet Loss (%)', stackOrder: null, transparency: 80, - unit: '%', - }, + unit: '%' + } ]); }); }); @@ -257,8 +257,8 @@ describe('timeSeries', () => { timeSeries.getMetrics({ rta: 1, time: 0, - timeTick: '2020-11-05T10:40:00Z', - }), + timeTick: '2020-11-05T10:40:00Z' + }) ).toEqual(['rta', 'time']); }); }); @@ -270,7 +270,7 @@ describe('timeSeries', () => { const unit = 'ms'; expect( - timeSeries.getMetricValuesForUnit({ lines, timeSeries: series, unit }), + timeSeries.getMetricValuesForUnit({ lines, timeSeries: series, unit }) ).toEqual([0, 1, 0.5, 3, 6, 4, 12, 25]); }); }); @@ -289,7 +289,7 @@ describe('timeSeries', () => { expect(timeSeries.getDates(series)).toEqual([ new Date('2020-11-05T10:35:00.000Z'), - new Date('2020-11-05T10:40:00.000Z'), + new Date('2020-11-05T10:40:00.000Z') ]); }); }); @@ -314,7 +314,7 @@ describe('timeSeries', () => { name: 'Round-Trip-Time Average (ms)', stackOrder: null, transparency: 80, - unit: 'ms', + unit: 'ms' }); }); }); @@ -325,7 +325,7 @@ describe('timeSeries', () => { const series = timeSeries.getTimeSeries(graphData); expect( - timeSeries.getMetricValuesForLines({ lines, timeSeries: series }), + timeSeries.getMetricValuesForLines({ lines, timeSeries: series }) ).toEqual([0, 1, 0.5, 3, 6, 4, 12, 25, 0, 1]); }); }); @@ -351,7 +351,7 @@ describe('timeSeries', () => { name: 'Duration (ms)', stackOrder: 1, transparency: 80, - unit: 'ms', + unit: 'ms' }, { areaColor: 'red', @@ -369,8 +369,8 @@ describe('timeSeries', () => { name: 'Average duration (ms)', stackOrder: 2, transparency: 80, - unit: 'ms', - }, + unit: 'ms' + } ]); }); }); @@ -383,8 +383,8 @@ describe('timeSeries', () => { expect( timeSeries.getStackedMetricValues({ lines: timeSeries.getSortedStackedLines(lines), - timeSeries: series, - }), + timeSeries: series + }) ).toEqual([18, 29]); }); }); @@ -397,19 +397,19 @@ describe('timeSeries', () => { expect( timeSeries.getTimeSeriesForLines({ lines: timeSeries.getSortedStackedLines(lines), - timeSeries: series, - }), + timeSeries: series + }) ).toEqual([ { avgDuration: 6, duration: 12, - timeTick: '2020-11-05T10:35:00Z', + timeTick: '2020-11-05T10:35:00Z' }, { avgDuration: 4, duration: 25, - timeTick: '2020-11-05T10:40:00Z', - }, + timeTick: '2020-11-05T10:40:00Z' + } ]); }); }); @@ -435,8 +435,8 @@ describe('timeSeries', () => { name: 'Duration (ms)', stackOrder: 1, transparency: 80, - unit: 'ms', - }, + unit: 'ms' + } ]); }); }); @@ -462,8 +462,8 @@ describe('timeSeries', () => { name: 'Average duration (ms)', stackOrder: 2, transparency: 80, - unit: 'ms', - }, + unit: 'ms' + } ]); }); }); @@ -473,11 +473,11 @@ describe('timeSeries', () => { const lines = timeSeries.getLineData(graphData); expect(timeSeries.hasUnitStackedLines({ lines, unit: 'ms' })).toEqual( - true, + true ); expect(timeSeries.hasUnitStackedLines({ lines, unit: '%' })).toEqual( - false, + false ); }); }); diff --git a/www/front_src/src/Resources/Graph/Performance/timeSeries/index.ts b/www/front_src/src/Resources/Graph/Performance/timeSeries/index.ts index 73534cce8e2..fb42aee10d7 100644 --- a/www/front_src/src/Resources/Graph/Performance/timeSeries/index.ts +++ b/www/front_src/src/Resources/Graph/Performance/timeSeries/index.ts @@ -19,7 +19,7 @@ import { sortBy, add, isEmpty, - any, + any } from 'ramda'; import { Metric, TimeValue, GraphData, Line } from '../models'; @@ -31,24 +31,24 @@ interface TimeTickWithMetrics { const toTimeTickWithMetrics = ({ metrics, - times, + times }): Array => map( (timeTick) => ({ metrics, - timeTick, + timeTick }), - times, + times ); const toTimeTickValue = ( { timeTick, metrics }: TimeTickWithMetrics, - timeIndex: number, + timeIndex: number ): TimeValue => { const getMetricsForIndex = (): Omit => { const addMetricForTimeIndex = (acc, { metric, data }): TimeValue => ({ ...acc, - [metric]: data[timeIndex], + [metric]: data[timeIndex] }); return reduce(addMetricForTimeIndex, {} as TimeValue, metrics); @@ -73,7 +73,7 @@ const getTimeSeries = (graphData: GraphData): Array => { ...metrics }: TimeValue): TimeValue => ({ ...filter(isGreaterThanLowerLimit, metrics), - timeTick, + timeTick }); const indexedMap = addIndex(map); @@ -81,7 +81,7 @@ const getTimeSeries = (graphData: GraphData): Array => { return pipe( toTimeTickWithMetrics, indexedMap(toTimeTickValue), - map(rejectLowerThanLimit), + map(rejectLowerThanLimit) )(graphData); }; @@ -92,7 +92,7 @@ const toLine = ({ unit, average_value, minimum_value, - maximum_value, + maximum_value }: Metric): Line => ({ areaColor: ds_data.ds_color_area, average_value, @@ -111,7 +111,7 @@ const toLine = ({ ? parseInt(ds_data.ds_order || '0', 10) : null, transparency: ds_data.ds_transparency, - unit, + unit }); const getLineData = (graphData: GraphData): Array => @@ -144,12 +144,12 @@ interface ValuesForUnitProps { const getMetricValuesForUnit = ({ lines, timeSeries, - unit, + unit }: ValuesForUnitProps): Array => { const getTimeSeriesValuesForMetric = (metric): Array => map( (timeValue) => getValueForMetric(timeValue)(metric), - timeSeries, + timeSeries ) as Array; return pipe( @@ -157,7 +157,7 @@ const getMetricValuesForUnit = ({ map(prop('metric')), map(getTimeSeriesValuesForMetric), flatten, - reject(isNil), + reject(isNil) )(lines) as Array; }; @@ -175,7 +175,7 @@ interface LineForMetricProps { const getLineForMetric = ({ lines, - metric, + metric }: LineForMetricProps): Line | undefined => find(propEq('metric', metric), lines); @@ -186,24 +186,24 @@ interface LinesTimeSeries { const getMetricValuesForLines = ({ lines, - timeSeries, + timeSeries }: LinesTimeSeries): Array => pipe( getUnits, map((unit) => getMetricValuesForUnit({ lines, timeSeries, unit })), - flatten, + flatten )(lines); const getStackedMetricValues = ({ lines, - timeSeries, + timeSeries }: LinesTimeSeries): Array => { const getTimeSeriesValuesForMetric = (metric): Array => map((timeValue) => getValueForMetric(timeValue)(metric), timeSeries); const metricsValues = pipe( map(prop('metric')) as (metric) => Array, - map(getTimeSeriesValuesForMetric) as () => Array>, + map(getTimeSeriesValuesForMetric) as () => Array> )(lines as Array); if (isEmpty(metricsValues) || isNil(metricsValues)) { @@ -214,33 +214,33 @@ const getStackedMetricValues = ({ reduce( (acc: number, metricValue: Array) => add(metricValue[index], acc), 0, - metricsValues, - ), + metricsValues + ) ); }; const getSortedStackedLines = (lines: Array): Array => pipe( reject(({ stackOrder }: Line): boolean => isNil(stackOrder)) as ( - lines, + lines ) => Array, - sortBy(prop('stackOrder')), + sortBy(prop('stackOrder')) )(lines); const getInvertedStackedLines = (lines: Array): Array => pipe( reject(({ invert }: Line): boolean => isNil(invert)) as ( - lines, + lines ) => Array, - getSortedStackedLines, + getSortedStackedLines )(lines); const getNotInvertedStackedLines = (lines: Array): Array => pipe( filter(({ invert }: Line): boolean => isNil(invert)) as ( - lines, + lines ) => Array, - getSortedStackedLines, + getSortedStackedLines )(lines); interface HasStackedLines { @@ -253,7 +253,7 @@ const hasUnitStackedLines = ({ lines, unit }: HasStackedLines): boolean => const getTimeSeriesForLines = ({ lines, - timeSeries, + timeSeries }: LinesTimeSeries): Array => { const metrics = map(prop('metric'), lines); @@ -262,14 +262,14 @@ const getTimeSeriesForLines = ({ ...reduce( (acc, metric): Omit => ({ ...acc, - [metric]: metricsValue[metric], + [metric]: metricsValue[metric] }), {}, - metrics, + metrics ), - timeTick, + timeTick }), - timeSeries, + timeSeries ); }; @@ -288,7 +288,7 @@ const getYScale = ({ secondUnit, leftScale, rightScale, - invert, + invert }: GetYScaleProps): ScaleLinear => { const isLeftScale = hasMoreThanTwoUnits || unit !== secondUnit; const scale = isLeftScale ? leftScale : rightScale; @@ -297,7 +297,7 @@ const getYScale = ({ ? Scale.scaleLinear({ domain: scale.domain().reverse(), nice: true, - range: scale.range().reverse(), + range: scale.range().reverse() }) : scale; }; @@ -321,5 +321,5 @@ export { getInvertedStackedLines, getNotInvertedStackedLines, hasUnitStackedLines, - getYScale, + getYScale }; diff --git a/www/front_src/src/Resources/Graph/Performance/useGraphIntersection.ts b/www/front_src/src/Resources/Graph/Performance/useGraphIntersection.ts index c669ec9d25f..1d25458c23a 100644 --- a/www/front_src/src/Resources/Graph/Performance/useGraphIntersection.ts +++ b/www/front_src/src/Resources/Graph/Performance/useGraphIntersection.ts @@ -19,8 +19,8 @@ export const useIntersection = (): GraphIntersectionState => { observer.current = new window.IntersectionObserver( ([newEntry]) => setEntry(newEntry), { - threshold: 0, - }, + threshold: 0 + } ); if (element) { @@ -34,6 +34,6 @@ export const useIntersection = (): GraphIntersectionState => { return { isInViewport: entry?.isIntersecting ?? true, - setElement, + setElement }; }; diff --git a/www/front_src/src/Resources/Listing/ApiNotFoundMessage.tsx b/www/front_src/src/Resources/Listing/ApiNotFoundMessage.tsx index f2aa061da5e..a86eb2b32d3 100644 --- a/www/front_src/src/Resources/Listing/ApiNotFoundMessage.tsx +++ b/www/front_src/src/Resources/Listing/ApiNotFoundMessage.tsx @@ -5,7 +5,7 @@ import { Link } from '@mui/material'; import { labelApiNotFoundNotUpToDate, labelApiNotFoundContactAdmin, - labelApiNotFoundDocumentation, + labelApiNotFoundDocumentation } from '../translatedLabels'; const ApiNotFoundMessage = (): JSX.Element => { @@ -16,7 +16,7 @@ const ApiNotFoundMessage = (): JSX.Element => {

{`${t(labelApiNotFoundNotUpToDate)}.`}

{`${t( - labelApiNotFoundContactAdmin, + labelApiNotFoundContactAdmin )} : /opt/rh/httpd24/root/etc/httpd/conf.d/10-centreon.conf`}

diff --git a/www/front_src/src/Resources/Listing/api/endpoint.ts b/www/front_src/src/Resources/Listing/api/endpoint.ts index 341c0e2c509..e9058e3d178 100644 --- a/www/front_src/src/Resources/Listing/api/endpoint.ts +++ b/www/front_src/src/Resources/Listing/api/endpoint.ts @@ -26,7 +26,7 @@ const buildResourcesEndpoint = (parameters: ListResourcesProps): string => { { name: 'states', value: parameters.states }, { name: 'status_types', - value: parameters.statusTypes, + value: parameters.statusTypes }, { name: 'types', value: parameters.resourceTypes }, { name: 'statuses', value: parameters.statuses }, @@ -37,17 +37,17 @@ const buildResourcesEndpoint = (parameters: ListResourcesProps): string => { { name: 'monitoring_server_names', value: parameters.monitoringServers }, { name: 'only_with_performance_data', - value: parameters.onlyWithPerformanceData, + value: parameters.onlyWithPerformanceData }, { name: 'service_severity_names', value: parameters.serviceSeverities }, { name: 'service_severity_levels', - value: parameters.serviceSeverityLevels, + value: parameters.serviceSeverityLevels }, { name: 'host_severity_names', value: parameters.hostSeverities }, - { name: 'host_severity_levels', value: parameters.hostSeverityLevels }, + { name: 'host_severity_levels', value: parameters.hostSeverityLevels } ], - parameters, + parameters }); }; diff --git a/www/front_src/src/Resources/Listing/api/index.ts b/www/front_src/src/Resources/Listing/api/index.ts index ab1bbd07659..65fde3acf6f 100644 --- a/www/front_src/src/Resources/Listing/api/index.ts +++ b/www/front_src/src/Resources/Listing/api/index.ts @@ -10,7 +10,7 @@ const listResources = (cancelToken: CancelToken) => (parameters: ListResourcesProps): Promise => getData(cancelToken)({ - endpoint: buildResourcesEndpoint(parameters), + endpoint: buildResourcesEndpoint(parameters) }); export { listResources }; diff --git a/www/front_src/src/Resources/Listing/columns/Graph.tsx b/www/front_src/src/Resources/Listing/columns/Graph.tsx index 84d97d8f370..1c06f130947 100644 --- a/www/front_src/src/Resources/Listing/columns/Graph.tsx +++ b/www/front_src/src/Resources/Listing/columns/Graph.tsx @@ -10,7 +10,7 @@ import IconGraph from '@mui/icons-material/BarChart'; import { IconButton, ComponentColumnProps, - LoadingSkeleton, + LoadingSkeleton } from '@centreon/ui'; import { labelGraph, labelServiceGraphs } from '../../translatedLabels'; @@ -18,7 +18,7 @@ import { ResourceDetails } from '../../Details/models'; import { Resource } from '../../models'; import { changeMousePositionAndTimeValueDerivedAtom, - isListingGraphOpenAtom, + isListingGraphOpenAtom } from '../../Graph/Performance/Graph/mouseTimeValueAtoms'; import { graphQueryParametersDerivedAtom } from '../../Graph/Performance/TimePeriods/timePeriodAtoms'; import { lastDayPeriod } from '../../Details/tabs/Graph/models'; @@ -33,8 +33,8 @@ const useStyles = makeStyles((theme) => ({ display: 'block', overflow: 'auto', padding: theme.spacing(1), - width: 575, - }, + width: 575 + } })); interface GraphProps { @@ -46,16 +46,16 @@ interface GraphProps { const Graph = ({ row, endpoint, - displayCompleteGraph, + displayCompleteGraph }: GraphProps): JSX.Element => { const getGraphQueryParameters = useAtomValue(graphQueryParametersDerivedAtom); const setIsListingGraphOpen = useUpdateAtom(isListingGraphOpenAtom); const changeMousePositionAndTimeValue = useUpdateAtom( - changeMousePositionAndTimeValueDerivedAtom, + changeMousePositionAndTimeValueDerivedAtom ); const graphQueryParameters = getGraphQueryParameters({ - timePeriod: lastDayPeriod, + timePeriod: lastDayPeriod }); useEffect(() => { @@ -97,13 +97,13 @@ const renderChip = ); const GraphColumn = ({ - onClick, + onClick }: { onClick: (row) => void; }): ((props: ComponentColumnProps) => JSX.Element | null) => { const GraphHoverChip = ({ row, - isHovered, + isHovered }: ComponentColumnProps): JSX.Element | null => { const classes = useStyles(); @@ -113,7 +113,7 @@ const GraphColumn = ({ const endpoint = path( ['links', 'endpoints', 'performance_graph'], - row, + row ); if (isNil(endpoint) && !isHost) { diff --git a/www/front_src/src/Resources/Listing/columns/HoverChip.tsx b/www/front_src/src/Resources/Listing/columns/HoverChip.tsx index 9d70aedd354..930acde0a5a 100644 --- a/www/front_src/src/Resources/Listing/columns/HoverChip.tsx +++ b/www/front_src/src/Resources/Listing/columns/HoverChip.tsx @@ -9,12 +9,12 @@ import { useMemoComponent } from '@centreon/ui'; const useStyles = makeStyles(() => ({ iconButton: { - padding: 0, + padding: 0 }, tooltip: { backgroundColor: 'transparent', - maxWidth: 'none', - }, + maxWidth: 'none' + } })); interface Props { @@ -30,7 +30,7 @@ const HoverChip = ({ Chip, label, onClick, - isHovered = false, + isHovered = false }: Props): JSX.Element => { const classes = useStyles(); @@ -54,7 +54,7 @@ const HoverChip = ({ onClick: (e): void => { e.preventDefault(); e.stopPropagation(); - }, + } }} aria-label={label} classes={{ tooltip: classes.tooltip }} @@ -78,7 +78,7 @@ const HoverChip = ({ ), - memoProps: [isHovered, isChipHovered, label], + memoProps: [isHovered, isChipHovered, label] }); }; diff --git a/www/front_src/src/Resources/Listing/columns/IconColumn.tsx b/www/front_src/src/Resources/Listing/columns/IconColumn.tsx index a67aa9371b4..fc8c096b7bb 100644 --- a/www/front_src/src/Resources/Listing/columns/IconColumn.tsx +++ b/www/front_src/src/Resources/Listing/columns/IconColumn.tsx @@ -10,8 +10,8 @@ const useStyles = makeStyles(() => ({ column: { display: 'flex', justifyContent: 'center', - width: '100%', - }, + width: '100%' + } })); const IconColumn = ({ children }: Props): JSX.Element => { diff --git a/www/front_src/src/Resources/Listing/columns/Notification.tsx b/www/front_src/src/Resources/Listing/columns/Notification.tsx index a2ecd5dda19..d2fe31d0b5a 100644 --- a/www/front_src/src/Resources/Listing/columns/Notification.tsx +++ b/www/front_src/src/Resources/Listing/columns/Notification.tsx @@ -16,7 +16,7 @@ interface NotificationTooltipProps { const NotificationTooltip = ({ Icon, - title, + title }: NotificationTooltipProps): JSX.Element => { const icon = ; @@ -24,7 +24,7 @@ const NotificationTooltip = ({ }; const NotificationColumn = ({ - row, + row }: ComponentColumnProps): JSX.Element | null => { const { t } = useTranslation(); diff --git a/www/front_src/src/Resources/Listing/columns/Parent.tsx b/www/front_src/src/Resources/Listing/columns/Parent.tsx index 7adbce21427..aaf3a7fca87 100644 --- a/www/front_src/src/Resources/Listing/columns/Parent.tsx +++ b/www/front_src/src/Resources/Listing/columns/Parent.tsx @@ -6,7 +6,7 @@ import { useColumnStyles } from '.'; const ParentResourceColumn = ({ row, - isHovered, + isHovered }: ComponentColumnProps): JSX.Element | null => { const classes = useColumnStyles({ isHovered }); diff --git a/www/front_src/src/Resources/Listing/columns/ParentAlias.tsx b/www/front_src/src/Resources/Listing/columns/ParentAlias.tsx index 2a88441a530..b1a12f62c63 100644 --- a/www/front_src/src/Resources/Listing/columns/ParentAlias.tsx +++ b/www/front_src/src/Resources/Listing/columns/ParentAlias.tsx @@ -6,7 +6,7 @@ import { useColumnStyles } from '.'; const ParentAliasColumn = ({ row, - isHovered, + isHovered }: ComponentColumnProps): JSX.Element | null => { const classes = useColumnStyles({ isHovered }); diff --git a/www/front_src/src/Resources/Listing/columns/Resource.tsx b/www/front_src/src/Resources/Listing/columns/Resource.tsx index 0fb964f6209..66767a29d5a 100644 --- a/www/front_src/src/Resources/Listing/columns/Resource.tsx +++ b/www/front_src/src/Resources/Listing/columns/Resource.tsx @@ -8,7 +8,7 @@ import { useColumnStyles } from '.'; const ResourceColumn = ({ row, - isHovered, + isHovered }: ComponentColumnProps): JSX.Element => { const classes = useColumnStyles({ isHovered }); diff --git a/www/front_src/src/Resources/Listing/columns/Severity.tsx b/www/front_src/src/Resources/Listing/columns/Severity.tsx index aa2eef9893e..4fb97afd715 100644 --- a/www/front_src/src/Resources/Listing/columns/Severity.tsx +++ b/www/front_src/src/Resources/Listing/columns/Severity.tsx @@ -11,24 +11,24 @@ import { Severity } from '../../models'; const useStyles = makeStyles((theme) => ({ container: { - display: 'flex', + display: 'flex' }, firstColumn: { display: 'flex', - minWidth: theme.spacing(5), + minWidth: theme.spacing(5) }, root: { display: 'flex', - flexDirection: 'column', + flexDirection: 'column' }, rowContainer: { alignItems: 'center', display: 'flex', - flexWrap: 'wrap', + flexWrap: 'wrap' }, text: { - display: 'flex', - }, + display: 'flex' + } })); interface Props { diff --git a/www/front_src/src/Resources/Listing/columns/State/DetailsTable/Acknowledgement.tsx b/www/front_src/src/Resources/Listing/columns/State/DetailsTable/Acknowledgement.tsx index c173c0ca9f3..9102d1b2eb9 100644 --- a/www/front_src/src/Resources/Listing/columns/State/DetailsTable/Acknowledgement.tsx +++ b/www/front_src/src/Resources/Listing/columns/State/DetailsTable/Acknowledgement.tsx @@ -14,7 +14,7 @@ import { labelComment, labelEntryTime, labelPersistent, - labelSticky, + labelSticky } from '../../../../translatedLabels'; import DetailsTable, { DetailsTableProps, getYesNoLabel } from '.'; @@ -24,8 +24,8 @@ const useStyles = makeStyles({ display: 'block', overflow: 'hidden', textOverflow: 'ellipsis', - whiteSpace: 'nowrap', - }, + whiteSpace: 'nowrap' + } }); interface AcknowledgementDetails { @@ -38,7 +38,7 @@ interface AcknowledgementDetails { } const AcknowledgementDetailsTable = ({ - endpoint, + endpoint }: Pick): JSX.Element => { const classes = useStyles(); const { t } = useTranslation(); @@ -52,7 +52,7 @@ const AcknowledgementDetailsTable = ({ id: 'author', label: t(labelAuthor), type: ColumnType.string, - width: 100, + width: 100 }, { getContent: ({ entry_time }: AcknowledgementDetails): string => @@ -60,7 +60,7 @@ const AcknowledgementDetailsTable = ({ id: 'entry_time', label: t(labelEntryTime), type: ColumnType.string, - width: 150, + width: 150 }, { getContent: ({ is_persistent_comment }: AcknowledgementDetails): string => @@ -68,7 +68,7 @@ const AcknowledgementDetailsTable = ({ id: 'is_persistent', label: t(labelPersistent), type: ColumnType.string, - width: 100, + width: 100 }, { getContent: ({ is_sticky }: AcknowledgementDetails): string => @@ -76,7 +76,7 @@ const AcknowledgementDetailsTable = ({ id: 'is_sticky', label: t(labelSticky), type: ColumnType.string, - width: 100, + width: 100 }, { @@ -91,8 +91,8 @@ const AcknowledgementDetailsTable = ({ id: 'comment', label: t(labelComment), type: ColumnType.string, - width: 250, - }, + width: 250 + } ]; return ( diff --git a/www/front_src/src/Resources/Listing/columns/State/DetailsTable/Downtime.tsx b/www/front_src/src/Resources/Listing/columns/State/DetailsTable/Downtime.tsx index 46ef4421132..bb297dbedb6 100644 --- a/www/front_src/src/Resources/Listing/columns/State/DetailsTable/Downtime.tsx +++ b/www/front_src/src/Resources/Listing/columns/State/DetailsTable/Downtime.tsx @@ -13,7 +13,7 @@ import { labelFixed, labelStartTime, labelEndTime, - labelComment, + labelComment } from '../../../../translatedLabels'; import DetailsTable, { getYesNoLabel } from '.'; @@ -23,8 +23,8 @@ const useStyles = makeStyles({ display: 'block', overflow: 'hidden', textOverflow: 'ellipsis', - whiteSpace: 'nowrap', - }, + whiteSpace: 'nowrap' + } }); interface DowntimeDetails { @@ -52,21 +52,21 @@ const DowntimeDetailsTable = ({ endpoint }: Props): JSX.Element => { id: 'author', label: t(labelAuthor), type: ColumnType.string, - width: 100, + width: 100 }, { getContent: ({ is_fixed }): string => t(getYesNoLabel(is_fixed)), id: 'is_fixed', label: t(labelFixed), type: ColumnType.string, - width: 100, + width: 100 }, { getContent: ({ start_time }): string => toDateTime(start_time), id: 'start_time', label: t(labelStartTime), type: ColumnType.string, - width: 150, + width: 150 }, { // eslint-disable-next-line react/no-unstable-nested-components @@ -76,7 +76,7 @@ const DowntimeDetailsTable = ({ endpoint }: Props): JSX.Element => { id: 'end_time', label: t(labelEndTime), type: ColumnType.string, - width: 150, + width: 150 }, { @@ -93,8 +93,8 @@ const DowntimeDetailsTable = ({ endpoint }: Props): JSX.Element => { id: 'comment', label: t(labelComment), type: ColumnType.component, - width: 250, - }, + width: 250 + } ]; return ( diff --git a/www/front_src/src/Resources/Listing/columns/State/DetailsTable/index.tsx b/www/front_src/src/Resources/Listing/columns/State/DetailsTable/index.tsx index 8b33065b962..959b000fa99 100644 --- a/www/front_src/src/Resources/Listing/columns/State/DetailsTable/index.tsx +++ b/www/front_src/src/Resources/Listing/columns/State/DetailsTable/index.tsx @@ -10,7 +10,7 @@ import { TableHead, TableCell, TableBody, - Skeleton, + Skeleton } from '@mui/material'; import { @@ -18,13 +18,13 @@ import { getData, ListingModel, Column, - ColumnType, + ColumnType } from '@centreon/ui'; import { labelSomethingWentWrong, labelYes, - labelNo, + labelNo } from '../../../../translatedLabels'; const getYesNoLabel = (value: boolean): string => (value ? labelYes : labelNo); @@ -44,17 +44,17 @@ export interface DetailsTableProps { const DetailsTable = ({ endpoint, - columns, + columns }: DetailsTableProps): JSX.Element => { const [details, setDetails] = useState | null>(); const { sendRequest } = useRequest>({ - request: getData, + request: getData }); useEffect(() => { sendRequest({ - endpoint, + endpoint }).then((retrievedDetails) => { setDetails(retrievedDetails.result); }); diff --git a/www/front_src/src/Resources/Listing/columns/State/index.tsx b/www/front_src/src/Resources/Listing/columns/State/index.tsx index 64c52b8a4aa..00b1c9037bf 100644 --- a/www/front_src/src/Resources/Listing/columns/State/index.tsx +++ b/www/front_src/src/Resources/Listing/columns/State/index.tsx @@ -26,7 +26,7 @@ const StateHoverChip = ({ endpoint, Chip, DetailsTable, - label, + label }: StateChipProps): JSX.Element => { return ( @@ -36,7 +36,7 @@ const StateHoverChip = ({ }; const DowntimeHoverChip = ({ - resource, + resource }: { resource: Resource; }): JSX.Element => { @@ -53,13 +53,13 @@ const DowntimeHoverChip = ({ }; const AcknowledgeHoverChip = ({ - resource, + resource }: { resource: Resource; }): JSX.Element => { const acknowledgementEndpoint = path( ['links', 'endpoints', 'acknowledgement'], - resource, + resource ); return ( diff --git a/www/front_src/src/Resources/Listing/columns/Status.tsx b/www/front_src/src/Resources/Listing/columns/Status.tsx index 9a85b6f5023..c30c725d4c2 100644 --- a/www/front_src/src/Resources/Listing/columns/Status.tsx +++ b/www/front_src/src/Resources/Listing/columns/Status.tsx @@ -9,7 +9,7 @@ import { ComponentColumnProps, SeverityCode, StatusChip, - IconButton, + IconButton } from '@centreon/ui'; import useAclQuery from '../../Actions/Resource/aclQuery'; @@ -19,7 +19,7 @@ import { labelActionNotPermitted, labelCheck, labelSetDowntime, - labelSetDowntimeOn, + labelSetDowntimeOn } from '../../translatedLabels'; import { ColumnProps } from '.'; @@ -30,13 +30,13 @@ const useStyles = makeStyles((theme) => ({ display: 'flex', flexWrap: 'nowrap', gridGap: theme.spacing(0.75), - justifyContent: 'center', + justifyContent: 'center' }, statusColumn: { alignItems: 'center', display: 'flex', - width: '100%', - }, + width: '100%' + } })); type StatusColumnProps = { @@ -45,7 +45,7 @@ type StatusColumnProps = { const StatusColumnOnHover = ({ actions, - row, + row }: StatusColumnProps): JSX.Element => { const classes = useStyles(); const { t } = useTranslation(); @@ -55,7 +55,7 @@ const StatusColumnOnHover = ({ const isResourceOk = pathEq( ['status', 'severity_code'], SeverityCode.Ok, - row, + row ); const isAcknowledePermitted = canAcknowledge([row]); @@ -84,7 +84,7 @@ const StatusColumnOnHover = ({ size="large" title={getActionTitle({ isActionPermitted: isAcknowledePermitted, - labelAction: labelAcknowledge, + labelAction: labelAcknowledge })} onClick={(): void => actions.onAcknowledge(row)} > @@ -97,7 +97,7 @@ const StatusColumnOnHover = ({ size="large" title={getActionTitle({ isActionPermitted: isDowntimePermitted, - labelAction: labelSetDowntime, + labelAction: labelSetDowntime })} onClick={(): void => actions.onDowntime(row)} > @@ -110,7 +110,7 @@ const StatusColumnOnHover = ({ size="large" title={getActionTitle({ isActionPermitted: isCheckPermitted, - labelAction: labelCheck, + labelAction: labelCheck })} onClick={(): void => actions.onCheck(row)} > @@ -122,7 +122,7 @@ const StatusColumnOnHover = ({ const StatusColumn = ({ actions, - t, + t }: ColumnProps): ((props: ComponentColumnProps) => JSX.Element) => { const Status = ({ row, isHovered }: ComponentColumnProps): JSX.Element => { const classes = useStyles(); diff --git a/www/front_src/src/Resources/Listing/columns/Url/Action.tsx b/www/front_src/src/Resources/Listing/columns/Url/Action.tsx index fa7709515d7..f19417db753 100644 --- a/www/front_src/src/Resources/Listing/columns/Url/Action.tsx +++ b/www/front_src/src/Resources/Listing/columns/Url/Action.tsx @@ -9,7 +9,7 @@ import UrlColumn from '.'; const ActionUrlColumn = ({ row }: ComponentColumnProps): JSX.Element => { const endpoint = path( ['links', 'externals', 'action_url'], - row, + row ); return ( diff --git a/www/front_src/src/Resources/Listing/columns/Url/Notes.tsx b/www/front_src/src/Resources/Listing/columns/Url/Notes.tsx index 309e4010a1c..fd5a8d3ea52 100644 --- a/www/front_src/src/Resources/Listing/columns/Url/Notes.tsx +++ b/www/front_src/src/Resources/Listing/columns/Url/Notes.tsx @@ -9,12 +9,12 @@ import UrlColumn from '.'; const NotesUrlColumn = ({ row }: ComponentColumnProps): JSX.Element => { const endpoint = path( ['links', 'externals', 'notes', 'url'], - row, + row ); const title = path( ['links', 'externals', 'notes', 'label'], - row, + row ); return ( diff --git a/www/front_src/src/Resources/Listing/columns/Url/index.tsx b/www/front_src/src/Resources/Listing/columns/Url/index.tsx index 3a0d62b93b2..a31fbc794cf 100644 --- a/www/front_src/src/Resources/Listing/columns/Url/index.tsx +++ b/www/front_src/src/Resources/Listing/columns/Url/index.tsx @@ -12,8 +12,8 @@ const useStyles = makeStyles((theme) => ({ backgroundColor: theme.palette.primary.main, fontSize: theme.typography.body2.fontSize, height: theme.spacing(2), - width: theme.spacing(2), - }, + width: theme.spacing(2) + } })); interface Props { @@ -27,7 +27,7 @@ const UrlColumn = ({ endpoint, title, icon, - avatarTitle, + avatarTitle }: Props): JSX.Element | null => { const classes = useStyles(); diff --git a/www/front_src/src/Resources/Listing/columns/index.tsx b/www/front_src/src/Resources/Listing/columns/index.tsx index b96f9756845..862d750a8ef 100644 --- a/www/front_src/src/Resources/Listing/columns/index.tsx +++ b/www/front_src/src/Resources/Listing/columns/index.tsx @@ -24,7 +24,7 @@ import { labelNotification, labelCheck, labelSeverity, - labelParentAlias, + labelParentAlias } from '../../translatedLabels'; import truncate from '../../truncate'; @@ -49,17 +49,15 @@ const useStyles = makeStyles((theme) => ({ alignItems: 'center', display: 'flex', flexWrap: 'nowrap', - padding: theme.spacing(0, 0.5), + padding: theme.spacing(0, 0.5) }, resourceNameItem: { marginLeft: theme.spacing(1), - whiteSpace: 'nowrap', + whiteSpace: 'nowrap' }, resourceNameText: ({ isHovered }): CreateCSSProperties => ({ - color: isHovered - ? theme.palette.text.primary - : theme.palette.text.secondary, - }), + color: isHovered ? theme.palette.text.primary : theme.palette.text.secondary + }) })); export interface ColumnProps { @@ -79,7 +77,7 @@ export const defaultSelectedColumnIds = [ 'tries', 'last_check', 'information', - 'state', + 'state' ]; export const getColumns = ({ actions, t }: ColumnProps): Array => [ @@ -92,7 +90,7 @@ export const getColumns = ({ actions, t }: ColumnProps): Array => [ shortLabel: 'S', sortField: 'severity_level', sortable: true, - type: ColumnType.component, + type: ColumnType.component }, { Component: StatusColumn({ actions, t }), @@ -105,7 +103,7 @@ export const getColumns = ({ actions, t }: ColumnProps): Array => [ sortField: 'status_severity_code', sortable: true, type: ColumnType.component, - width: 'minmax(100px, max-content)', + width: 'minmax(100px, max-content)' }, { Component: ResourceColumn, @@ -115,7 +113,7 @@ export const getColumns = ({ actions, t }: ColumnProps): Array => [ rowMemoProps: ['icon', 'short_type', 'name'], sortField: 'name', sortable: true, - type: ColumnType.component, + type: ColumnType.component }, { Component: ParentResourceColumn, @@ -125,7 +123,7 @@ export const getColumns = ({ actions, t }: ColumnProps): Array => [ rowMemoProps: ['parent'], sortField: 'parent_name', sortable: true, - type: ColumnType.component, + type: ColumnType.component }, { Component: NotesUrlColumn, @@ -135,7 +133,7 @@ export const getColumns = ({ actions, t }: ColumnProps): Array => [ rowMemoProps: ['links'], shortLabel: 'N', sortable: false, - type: ColumnType.component, + type: ColumnType.component }, { Component: ActionUrlColumn, @@ -145,7 +143,7 @@ export const getColumns = ({ actions, t }: ColumnProps): Array => [ rowMemoProps: ['links'], shortLabel: 'A', sortable: false, - type: ColumnType.component, + type: ColumnType.component }, { Component: GraphColumn({ onClick: actions.onDisplayGraph }), @@ -154,7 +152,7 @@ export const getColumns = ({ actions, t }: ColumnProps): Array => [ label: t(labelGraph), shortLabel: 'G', sortable: false, - type: ColumnType.component, + type: ColumnType.component }, { getFormattedString: ({ duration }): string => duration, @@ -162,34 +160,34 @@ export const getColumns = ({ actions, t }: ColumnProps): Array => [ label: t(labelDuration), sortField: 'last_status_change', sortable: true, - type: ColumnType.string, + type: ColumnType.string }, { getFormattedString: ({ tries }): string => tries, id: 'tries', label: t(labelTries), sortable: true, - type: ColumnType.string, + type: ColumnType.string }, { getFormattedString: ({ last_check }): string => last_check, id: 'last_check', label: t(labelLastCheck), sortable: true, - type: ColumnType.string, + type: ColumnType.string }, { getFormattedString: pipe( propOr('', 'information'), split('\n'), head, - truncate, + truncate ) as (row) => string, id: 'information', label: t(labelInformation), sortable: false, type: ColumnType.string, - width: 'minmax(50px, 1fr)', + width: 'minmax(50px, 1fr)' }, { Component: StateColumn, @@ -198,14 +196,14 @@ export const getColumns = ({ actions, t }: ColumnProps): Array => [ label: t(labelState), rowMemoProps: ['in_downtime', 'acknowledged', 'name', 'links'], sortable: false, - type: ColumnType.component, + type: ColumnType.component }, { getFormattedString: ({ alias }): string => alias, id: 'alias', label: t(labelAlias), sortable: true, - type: ColumnType.string, + type: ColumnType.string }, { Component: ParentAliasColumn, @@ -215,14 +213,14 @@ export const getColumns = ({ actions, t }: ColumnProps): Array => [ rowMemoProps: ['parent'], sortField: 'parent_alias', sortable: true, - type: ColumnType.component, + type: ColumnType.component }, { getFormattedString: ({ fqdn }): string => fqdn, id: 'fqdn', label: t(labelFqdn), sortable: true, - type: ColumnType.string, + type: ColumnType.string }, { getFormattedString: ({ monitoring_server_name }): string => @@ -230,7 +228,7 @@ export const getColumns = ({ actions, t }: ColumnProps): Array => [ id: 'monitoring_server_name', label: t(labelMonitoringServer), sortable: true, - type: ColumnType.string, + type: ColumnType.string }, { Component: NotificationColumn, @@ -239,7 +237,7 @@ export const getColumns = ({ actions, t }: ColumnProps): Array => [ label: t(labelNotification), rowMemoProps: ['notification_enabled'], shortLabel: 'Notif', - type: ColumnType.component, + type: ColumnType.component }, { Component: ChecksColumn, @@ -248,8 +246,8 @@ export const getColumns = ({ actions, t }: ColumnProps): Array => [ label: t(labelCheck), rowMemoProps: ['passive_checks', 'active_checks'], shortLabel: 'C', - type: ColumnType.component, - }, + type: ColumnType.component + } ]; export { useStyles as useColumnStyles }; diff --git a/www/front_src/src/Resources/Listing/index.test.tsx b/www/front_src/src/Resources/Listing/index.test.tsx index 52bfd2a182c..76acbb198c0 100644 --- a/www/front_src/src/Resources/Listing/index.test.tsx +++ b/www/front_src/src/Resources/Listing/index.test.tsx @@ -16,7 +16,7 @@ import { isNil, last, equals, - not, + not } from 'ramda'; import userEvent from '@testing-library/user-event'; import { Provider } from 'jotai'; @@ -28,7 +28,7 @@ import { fireEvent, Matcher, act, - Column, + Column } from '@centreon/ui'; import { refreshIntervalAtom, userAtom } from '@centreon/ui-context'; @@ -40,7 +40,7 @@ import { labelInDowntime, labelAcknowledged } from '../translatedLabels'; import { getListingEndpoint, cancelTokenRequestParam, - defaultSecondSortCriteria, + defaultSecondSortCriteria } from '../testUtils'; import { unhandledProblemsFilter } from '../Filter/models'; import useLoadDetails from '../testUtils/useLoadDetails'; @@ -53,7 +53,7 @@ import Listing from '.'; const columns = getColumns({ actions: { onAcknowledge: jest.fn() }, - t: identity, + t: identity }) as Array; const mockedAxios = axios as jest.Mocked; @@ -61,7 +61,7 @@ const mockedAxios = axios as jest.Mocked; const mockUser = { isExportButtonEnabled: true, locale: 'en', - timezone: 'Europe/Paris', + timezone: 'Europe/Paris' }; const mockRefreshInterval = 60; @@ -87,18 +87,18 @@ const fillEntities = (): Array => { metrics: 'endpoint', performance_graph: index % 6 === 0 ? 'endpoint' : undefined, status_graph: index % 3 === 0 ? 'endpoint' : undefined, - timeline: 'endpoint', + timeline: 'endpoint' }, externals: { notes: { - url: 'https://centreon.com', - }, + url: 'https://centreon.com' + } }, uris: { configuration: index % 7 === 0 ? 'uri' : undefined, logs: index % 4 === 0 ? 'uri' : undefined, - reporting: index % 3 === 0 ? 'uri' : undefined, - }, + reporting: index % 3 === 0 ? 'uri' : undefined + } }, name: `E${index}`, passive_checks: index % 8 === 0, @@ -106,11 +106,11 @@ const fillEntities = (): Array => { short_type: index % 4 === 0 ? 's' : 'h', status: { name: 'OK', - severity_code: 5, + severity_code: 5 }, tries: '1', type: index % 4 === 0 ? ResourceType.service : ResourceType.host, - uuid: `${index}`, + uuid: `${index}` })); }; @@ -121,9 +121,9 @@ const retrievedListing = { page: 1, search: {}, sort_by: {}, - total: entities.length, + total: entities.length }, - result: entities, + result: entities }; let context: ResourceContext; @@ -140,7 +140,7 @@ const ListingTest = (): JSX.Element => { ...listingState, ...actionsState, ...detailsState, - ...filterState, + ...filterState }; return ( @@ -154,7 +154,7 @@ const ListingTestWithJotai = (): JSX.Element => ( @@ -171,10 +171,10 @@ describe(Listing, () => { meta: { limit: 30, page: 1, - total: 0, + total: 0 }, - result: [], - }, + result: [] + } }) .mockResolvedValue({ data: retrievedListing }); }); @@ -191,10 +191,10 @@ describe(Listing, () => { meta: { limit: 30, page: 1, - total: 0, + total: 0 }, - result: [], - }, + result: [] + } }) .mockResolvedValueOnce({ data: retrievedListing }); @@ -206,7 +206,7 @@ describe(Listing, () => { const [resourcesWithMultipleLines, resourcesWithSingleLines] = partition( where({ information: includes('\n') }), - retrievedListing.result, + retrievedListing.result ); await waitFor(() => @@ -214,10 +214,10 @@ describe(Listing, () => { getByText( pipe, Matcher>( split('\n'), - head, - )(resourcesWithMultipleLines[0].information as string), - ), - ).toBeInTheDocument(), + head + )(resourcesWithMultipleLines[0].information as string) + ) + ).toBeInTheDocument() ); resourcesWithMultipleLines.forEach(({ information }) => { @@ -225,9 +225,9 @@ describe(Listing, () => { getByText( pipe, Matcher>( split('\n'), - head, - )(information as string), - ), + head + )(information as string) + ) ).toBeInTheDocument(); expect(queryByText(information as string)).not.toBeInTheDocument(); }); @@ -252,7 +252,7 @@ describe(Listing, () => { columns .filter(({ sortable }) => sortable !== false) .filter(({ id }) => includes(id, defaultSelectedColumnIds)) - .map(({ id, label, sortField }) => [id, label, sortField]), + .map(({ id, label, sortField }) => [id, label, sortField]) )( 'executes a listing request with sort_by param and stores the order parameter in the URL when %p column is clicked', async (id, label, sortField) => { @@ -277,10 +277,10 @@ describe(Listing, () => { getListingEndpoint({ sort: { [sortBy]: 'desc', - ...secondSortCriteria, - }, + ...secondSortCriteria + } }), - cancelTokenRequestParam, + cancelTokenRequestParam ); }); @@ -291,13 +291,13 @@ describe(Listing, () => { getListingEndpoint({ sort: { [sortBy]: 'asc', - ...secondSortCriteria, - }, + ...secondSortCriteria + } }), - cancelTokenRequestParam, - ), + cancelTokenRequestParam + ) ); - }, + } ); }); @@ -311,8 +311,8 @@ describe(Listing, () => { mockedAxios.get.mockResolvedValueOnce({ data: { ...retrievedListing, - meta: { ...retrievedListing.meta, page: 2 }, - }, + meta: { ...retrievedListing.meta, page: 2 } + } }); await waitFor(() => expect(getByLabelText('Next page')).toBeEnabled()); @@ -322,43 +322,43 @@ describe(Listing, () => { await waitFor(() => { expect(mockedAxios.get).toHaveBeenLastCalledWith( getListingEndpoint({ page: 2 }), - cancelTokenRequestParam, + cancelTokenRequestParam ); }); mockedAxios.get.mockResolvedValueOnce({ data: { ...retrievedListing, - meta: { ...retrievedListing.meta, page: 1 }, - }, + meta: { ...retrievedListing.meta, page: 1 } + } }); fireEvent.click(getByLabelText('Previous page')); expect(mockedAxios.get).toHaveBeenLastCalledWith( getListingEndpoint({ page: 1 }), - cancelTokenRequestParam, + cancelTokenRequestParam ); mockedAxios.get.mockResolvedValueOnce({ data: { ...retrievedListing, - meta: { ...retrievedListing.meta, page: 4 }, - }, + meta: { ...retrievedListing.meta, page: 4 } + } }); fireEvent.click(getByLabelText('Last page')); expect(mockedAxios.get).toHaveBeenLastCalledWith( getListingEndpoint({ page: 4 }), - cancelTokenRequestParam, + cancelTokenRequestParam ); mockedAxios.get.mockResolvedValueOnce({ data: { ...retrievedListing, - meta: { ...retrievedListing.meta, page: 4 }, - }, + meta: { ...retrievedListing.meta, page: 4 } + } }); fireEvent.click(getByLabelText('First page')); @@ -366,8 +366,8 @@ describe(Listing, () => { await waitFor(() => expect(mockedAxios.get).toHaveBeenLastCalledWith( getListingEndpoint({ page: 1 }), - cancelTokenRequestParam, - ), + cancelTokenRequestParam + ) ); }); @@ -377,14 +377,14 @@ describe(Listing, () => { mockedAxios.get.mockResolvedValueOnce({ data: retrievedListing }); fireEvent.change(getByDisplayValue('10'), { - target: { value: '20' }, + target: { value: '20' } }); await waitFor(() => expect(mockedAxios.get).toHaveBeenCalledWith( getListingEndpoint({ limit: 30 }), - cancelTokenRequestParam, - ), + cancelTokenRequestParam + ) ); }); @@ -402,16 +402,16 @@ describe(Listing, () => { end_time: '2020-02-28T08:18:16Z', id: 0, is_fixed: true, - start_time: '2020-02-28T08:16:16Z', - }, - ], - }, + start_time: '2020-02-28T08:16:16Z' + } + ] + } }); const chipLabel = `${entityInDowntime?.name} ${labelInDowntime}`; const chip = await findByLabelText(chipLabel, undefined, { - timeout: 10000, + timeout: 10000 }); fireEvent.mouseEnter(chip); @@ -420,8 +420,8 @@ describe(Listing, () => { await waitFor(() => expect(mockedAxios.get).toHaveBeenLastCalledWith( entityInDowntime?.links?.endpoints.downtime, - cancelTokenRequestParam, - ), + cancelTokenRequestParam + ) ); await waitFor(() => expect(getByText('admin')).toBeInTheDocument()); @@ -435,7 +435,7 @@ describe(Listing, () => { const { findByLabelText, getByText } = renderListing(); const acknowledgedEntity = entities.find( - ({ acknowledged }) => acknowledged, + ({ acknowledged }) => acknowledged ); mockedAxios.get.mockResolvedValueOnce({ @@ -447,16 +447,16 @@ describe(Listing, () => { entry_time: '2020-02-28T08:16:00Z', id: 0, is_persistent_comment: true, - is_sticky: false, - }, - ], - }, + is_sticky: false + } + ] + } }); const chipLabel = `${acknowledgedEntity?.name} ${labelAcknowledged}`; const chip = await findByLabelText(chipLabel, undefined, { - timeout: 10000, + timeout: 10000 }); fireEvent.mouseEnter(chip); @@ -465,8 +465,8 @@ describe(Listing, () => { await waitFor(() => expect(mockedAxios.get).toHaveBeenLastCalledWith( acknowledgedEntity?.links?.endpoints.acknowledgement, - cancelTokenRequestParam, - ), + cancelTokenRequestParam + ) ); await waitFor(() => expect(getByText('admin')).toBeInTheDocument()); @@ -480,7 +480,7 @@ describe(Listing, () => { const additionalIds = reject( includes(__, defaultSelectedColumnIds), - columnIds, + columnIds ); it.each(additionalIds)( @@ -510,12 +510,12 @@ describe(Listing, () => { const expectedLabelCount = hasShortLabel ? 1 : 2; expect(getAllByText(columnDisplayLabel).length).toEqual( - expectedLabelCount, + expectedLabelCount ); if (hasShortLabel) { expect(getByText(columnDisplayLabel)).toBeInTheDocument(); } - }, + } ); }); diff --git a/www/front_src/src/Resources/Listing/index.tsx b/www/front_src/src/Resources/Listing/index.tsx index 91fcc1dda48..7921f5f93d0 100644 --- a/www/front_src/src/Resources/Listing/index.tsx +++ b/www/front_src/src/Resources/Listing/index.tsx @@ -15,18 +15,18 @@ import { labelSelectAtLeastOneColumn, labelStatus } from '../translatedLabels'; import { openDetailsTabIdAtom, selectedResourceUuidAtom, - selectedResourcesDetailsAtom, + selectedResourcesDetailsAtom } from '../Details/detailsAtoms'; import { resourcesToAcknowledgeAtom, resourcesToCheckAtom, resourcesToSetDowntimeAtom, - selectedResourcesAtom, + selectedResourcesAtom } from '../Actions/actionsAtoms'; import { getCriteriaValueDerivedAtom, searchAtom, - setCriteriaAndNewFilterDerivedAtom, + setCriteriaAndNewFilterDerivedAtom } from '../Filter/filterAtoms'; import { getColumns, defaultSelectedColumnIds } from './columns'; @@ -37,7 +37,7 @@ import { listingAtom, pageAtom, selectedColumnIdsAtom, - sendingAtom, + sendingAtom } from './listingAtoms'; export const okStatuses = ['OK', 'UP']; @@ -48,17 +48,17 @@ const ResourceListing = (): JSX.Element => { const { showWarningMessage } = useSnackbar(); const [selectedResourceUuid, setSelectedResourceUuid] = useAtom( - selectedResourceUuidAtom, + selectedResourceUuidAtom ); const [page, setPage] = useAtom(pageAtom); const [selectedColumnIds, setSelectedColumnIds] = useAtom( - selectedColumnIdsAtom, + selectedColumnIdsAtom ); const [selectedResources, setSelectedResources] = useAtom( - selectedResourcesAtom, + selectedResourcesAtom ); const [selectedResourceDetails, setSelectedResourceDetails] = useAtom( - selectedResourcesDetailsAtom, + selectedResourcesDetailsAtom ); const listing = useAtomValue(listingAtom); const sending = useAtomValue(sendingAtom); @@ -72,7 +72,7 @@ const ResourceListing = (): JSX.Element => { const setResourcesToSetDowntime = useUpdateAtom(resourcesToSetDowntimeAtom); const setResourcesToCheck = useUpdateAtom(resourcesToCheckAtom); const setCriteriaAndNewFilter = useUpdateAtom( - setCriteriaAndNewFilterDerivedAtom, + setCriteriaAndNewFilterDerivedAtom ); const { initAutorefreshAndLoad } = useLoadResources(); @@ -81,7 +81,7 @@ const ResourceListing = (): JSX.Element => { setCriteriaAndNewFilter({ apply: true, name: 'sort', - value: [sortField, sortOrder], + value: [sortField, sortOrder] }); }; @@ -97,7 +97,7 @@ const ResourceListing = (): JSX.Element => { setSelectedResourceUuid(uuid); setSelectedResourceDetails({ resourceId: id, - resourcesDetailsEndpoint: links?.endpoints?.details, + resourcesDetailsEndpoint: links?.endpoints?.details }); }; @@ -114,7 +114,7 @@ const ResourceListing = (): JSX.Element => { ? equals(id, parentResourceId) : equals(id, selectedResourceDetails?.resourceId); }, - name: 'detailsOpen', + name: 'detailsOpen' }; const columns = getColumns({ @@ -132,16 +132,16 @@ const ResourceListing = (): JSX.Element => { }, onDowntime: (resource): void => { setResourcesToSetDowntime([resource]); - }, + } }, - t, + t }); const loading = sending; const [sortField, sortOrder] = getCriteriaValue('sort') as [ string, - SortOrder, + SortOrder ]; const getId = ({ uuid }: Resource): string => uuid; @@ -163,13 +163,13 @@ const ResourceListing = (): JSX.Element => { const predefinedRowsSelection = [ { label: `${t(labelStatus).toLowerCase()}:OK`, - rowCondition: ({ status }): boolean => includes(status.name, okStatuses), + rowCondition: ({ status }): boolean => includes(status.name, okStatuses) }, { label: `${t(labelStatus).toLowerCase()}:NOK`, rowCondition: ({ status }): boolean => - not(includes(status.name, okStatuses)), - }, + not(includes(status.name, okStatuses)) + } ]; return ( @@ -178,7 +178,7 @@ const ResourceListing = (): JSX.Element => { actions={} columnConfiguration={{ selectedColumnIds, - sortable: true, + sortable: true }} columns={columns} currentPage={(page || 1) - 1} @@ -195,12 +195,12 @@ const ResourceListing = (): JSX.Element => { selectedResourceUuid, sending, enabledAutoRefresh, - selectedResourceDetails, + selectedResourceDetails ]} predefinedRowsSelection={predefinedRowsSelection} rowColorConditions={[ resourceDetailsOpenCondition, - ...rowColorConditions(theme), + ...rowColorConditions(theme) ]} rows={listing?.result} selectedRows={selectedResources} diff --git a/www/front_src/src/Resources/Listing/listingAtoms.ts b/www/front_src/src/Resources/Listing/listingAtoms.ts index e42c59b6cf3..14e40760bfb 100644 --- a/www/front_src/src/Resources/Listing/listingAtoms.ts +++ b/www/front_src/src/Resources/Listing/listingAtoms.ts @@ -12,6 +12,6 @@ export const pageAtom = atom(undefined); export const enabledAutorefreshAtom = atom(true); export const selectedColumnIdsAtom = atomWithStorage( `${baseKey}column-ids`, - defaultSelectedColumnIds, + defaultSelectedColumnIds ); export const sendingAtom = atom(false); diff --git a/www/front_src/src/Resources/Listing/useListing.ts b/www/front_src/src/Resources/Listing/useListing.ts index 2d6227891df..b21c868561a 100644 --- a/www/front_src/src/Resources/Listing/useListing.ts +++ b/www/front_src/src/Resources/Listing/useListing.ts @@ -18,7 +18,7 @@ const useListing = (): ListingState => { return { page, setLimit, - setPage, + setPage }; }; diff --git a/www/front_src/src/Resources/Listing/useLoadResources/index.test.tsx b/www/front_src/src/Resources/Listing/useLoadResources/index.test.tsx index 1a06e129b0b..85ec9614f2d 100644 --- a/www/front_src/src/Resources/Listing/useLoadResources/index.test.tsx +++ b/www/front_src/src/Resources/Listing/useLoadResources/index.test.tsx @@ -15,7 +15,7 @@ const mockedAxios = axios as jest.Mocked; const mockUser = { locale: 'en', - timezone: 'Europe/Paris', + timezone: 'Europe/Paris' }; const mockRefreshInterval = 60; @@ -35,7 +35,7 @@ const TestComponent = (): JSX.Element => { context = { ...filterState, ...listingState, - ...detailsState, + ...detailsState } as ResourceContext; return ( @@ -49,7 +49,7 @@ const TestComponentWithJotai = (): JSX.Element => ( @@ -66,10 +66,10 @@ describe(useLoadResources, () => { meta: { limit: 30, page: 1, - total: 0, + total: 0 }, - result: [], - }, + result: [] + } }); }); @@ -81,77 +81,77 @@ describe(useLoadResources, () => { [ 'sort', (): void => context.setCriteria?.({ name: 'sort', value: ['a', 'asc'] }), - 2, + 2 ], ['limit', (): void => context.setLimit?.(20), 2], [ 'search', (): void => context.setCriteria?.({ name: 'search', value: 'toto' }), - 3, + 3 ], [ 'states', (): void => context.setCriteria?.({ name: 'states', - value: [{ id: 'unhandled', name: 'Unhandled problems' }], + value: [{ id: 'unhandled', name: 'Unhandled problems' }] }), - 3, + 3 ], [ 'statuses', (): void => context.setCriteria?.({ name: 'statuses', - value: [{ id: 'OK', name: 'Ok' }], + value: [{ id: 'OK', name: 'Ok' }] }), - 3, + 3 ], [ 'resourceTypes', (): void => context.setCriteria?.({ name: 'resource_types', - value: [{ id: 'host', name: 'Host' }], + value: [{ id: 'host', name: 'Host' }] }), - 3, + 3 ], [ 'hostGroups', (): void => context.setCriteria?.({ name: 'host_groups', - value: [{ id: 0, name: 'Linux-servers' }], + value: [{ id: 0, name: 'Linux-servers' }] }), - 3, + 3 ], [ 'serviceGroups', (): void => context.setCriteria?.({ name: 'service_groups', - value: [{ id: 1, name: 'Web-services' }], + value: [{ id: 1, name: 'Web-services' }] }), - 3, + 3 ], [ 'hostCategories', (): void => context.setCriteria?.({ name: 'host_categories', - value: [{ id: 0, name: 'Linux' }], + value: [{ id: 0, name: 'Linux' }] }), - 3, + 3 ], [ 'serviceCategories', (): void => context.setCriteria?.({ name: 'service_categories', - value: [{ id: 1, name: 'Web-services' }], + value: [{ id: 1, name: 'Web-services' }] }), - 3, - ], + 3 + ] ]; it.each(testCases)( @@ -180,6 +180,6 @@ describe(useLoadResources, () => { expect(context.page).toEqual(1); expect(mockedAxios.get).toHaveBeenCalled(); }); - }, + } ); }); diff --git a/www/front_src/src/Resources/Listing/useLoadResources/index.ts b/www/front_src/src/Resources/Listing/useLoadResources/index.ts index 97da71c8586..4d582531c6a 100644 --- a/www/front_src/src/Resources/Listing/useLoadResources/index.ts +++ b/www/front_src/src/Resources/Listing/useLoadResources/index.ts @@ -8,7 +8,7 @@ import { not, pathEq, pathOr, - prop, + prop } from 'ramda'; import { useAtomValue, useUpdateAtom } from 'jotai/utils'; import { useAtom } from 'jotai'; @@ -18,7 +18,7 @@ import { getData, SelectEntry, useRequest, - getUrlQueryParameters, + getUrlQueryParameters } from '@centreon/ui'; import { refreshIntervalAtom } from '@centreon/ui-context'; @@ -30,25 +30,25 @@ import { selectedResourceDetailsEndpointDerivedAtom, selectedResourceUuidAtom, sendingDetailsAtom, - selectedResourcesDetailsAtom, + selectedResourcesDetailsAtom } from '../../Details/detailsAtoms'; import { enabledAutorefreshAtom, limitAtom, listingAtom, pageAtom, - sendingAtom, + sendingAtom } from '../listingAtoms'; import { listResources } from '../api'; import { labelNoResourceFound, - labelSomethingWentWrong, + labelSomethingWentWrong } from '../../translatedLabels'; import { ResourceDetails } from '../../Details/models'; import { appliedFilterAtom, customFiltersAtom, - getCriteriaValueDerivedAtom, + getCriteriaValueDerivedAtom } from '../../Filter/filterAtoms'; export interface LoadResources { @@ -65,9 +65,9 @@ const useLoadResources = (): LoadResources => { getErrorMessage: ifElse( pathEq(['response', 'status'], 404), always(t(labelNoResourceFound)), - pathOr(t(labelSomethingWentWrong), ['response', 'data', 'message']), + pathOr(t(labelSomethingWentWrong), ['response', 'data', 'message']) ), - request: listResources, + request: listResources }); const { sendRequest: sendLoadDetailsRequest, sending: sendingDetails } = @@ -75,9 +75,9 @@ const useLoadResources = (): LoadResources => { getErrorMessage: ifElse( pathEq(['response', 'status'], 404), always(t(labelNoResourceFound)), - pathOr(t(labelSomethingWentWrong), ['response', 'data', 'message']), + pathOr(t(labelSomethingWentWrong), ['response', 'data', 'message']) ), - request: getData, + request: getData }); const [page, setPage] = useAtom(pageAtom); @@ -87,7 +87,7 @@ const useLoadResources = (): LoadResources => { const limit = useAtomValue(limitAtom); const enabledAutorefresh = useAtomValue(enabledAutorefreshAtom); const selectedResourceDetailsEndpoint = useAtomValue( - selectedResourceDetailsEndpointDerivedAtom, + selectedResourceDetailsEndpointDerivedAtom ); const selectedResourceDetails = useAtomValue(selectedResourcesDetailsAtom); const customFilters = useAtomValue(customFiltersAtom); @@ -115,7 +115,7 @@ const useLoadResources = (): LoadResources => { return { [sortField]: sortOrder, - ...secondSortCriteria, + ...secondSortCriteria }; }; @@ -125,7 +125,7 @@ const useLoadResources = (): LoadResources => { } sendLoadDetailsRequest({ - endpoint: selectedResourceDetailsEndpoint, + endpoint: selectedResourceDetailsEndpoint }) .then(setDetails) .catch(() => { @@ -139,13 +139,13 @@ const useLoadResources = (): LoadResources => { ? { regex: { fields: searchableFields, - value: searchCriteria, - }, + value: searchCriteria + } } : undefined; const getCriteriaIds = ( - name: string, + name: string ): Array | undefined => { const criteriaValue = getCriteriaValue(name) as | Array @@ -193,7 +193,7 @@ const useLoadResources = (): LoadResources => { sort: getSort(), states: getCriteriaIds('states'), statusTypes: getCriteriaIds('status_types'), - statuses: getCriteriaIds('statuses'), + statuses: getCriteriaIds('statuses') }).then(setListing); if (isNil(details)) { @@ -272,7 +272,7 @@ const useLoadResources = (): LoadResources => { }, [ selectedResourceUuid, selectedResourceDetails?.parentResourceId, - selectedResourceDetails?.resourceId, + selectedResourceDetails?.resourceId ]); return { initAutorefreshAndLoad }; diff --git a/www/front_src/src/Resources/Listing/useLoadResources/useLoadDetails.ts b/www/front_src/src/Resources/Listing/useLoadResources/useLoadDetails.ts index 3df644462f2..be3bcc1c403 100644 --- a/www/front_src/src/Resources/Listing/useLoadResources/useLoadDetails.ts +++ b/www/front_src/src/Resources/Listing/useLoadResources/useLoadDetails.ts @@ -8,12 +8,12 @@ import { clearSelectedResourceDerivedAtom, detailsAtom, selectedResourceDetailsEndpointDerivedAtom, - selectedResourcesDetailsAtom, + selectedResourcesDetailsAtom } from '../../Details/detailsAtoms'; import { ResourceDetails } from '../../Details/models'; import { labelNoResourceFound, - labelSomethingWentWrong, + labelSomethingWentWrong } from '../../translatedLabels'; export interface LoadResources { @@ -31,13 +31,13 @@ const useLoadDetails = (): LoadDetails => { getErrorMessage: ifElse( pathEq(['response', 'status'], 404), always(t(labelNoResourceFound)), - pathOr(t(labelSomethingWentWrong), ['response', 'data', 'message']), + pathOr(t(labelSomethingWentWrong), ['response', 'data', 'message']) ), - request: getData, + request: getData }); const selectedResourceDetailsEndpoint = useAtomValue( - selectedResourceDetailsEndpointDerivedAtom, + selectedResourceDetailsEndpointDerivedAtom ); const selectedResourceDetails = useAtomValue(selectedResourcesDetailsAtom); const clearSelectedResource = useUpdateAtom(clearSelectedResourceDerivedAtom); @@ -49,7 +49,7 @@ const useLoadDetails = (): LoadDetails => { } sendLoadDetailsRequest({ - endpoint: selectedResourceDetailsEndpoint, + endpoint: selectedResourceDetailsEndpoint }) .then(setDetails) .catch(() => { diff --git a/www/front_src/src/Resources/ShortTypeChip.tsx b/www/front_src/src/Resources/ShortTypeChip.tsx index fae79f3c9af..6a964bb9518 100644 --- a/www/front_src/src/Resources/ShortTypeChip.tsx +++ b/www/front_src/src/Resources/ShortTypeChip.tsx @@ -4,11 +4,11 @@ import { SeverityCode, StatusChip } from '@centreon/ui'; const useStyles = makeStyles((theme) => ({ extraSmallChipContainer: { - height: 19, + height: 19 }, smallChipLabel: { - padding: theme.spacing(0.5), - }, + padding: theme.spacing(0.5) + } })); interface Props { @@ -22,7 +22,7 @@ const ShortTypeChip = ({ label }: Props): JSX.Element => { => [ { color: theme.palette.action.inDowntimeBackground, condition: ({ in_downtime }): boolean => in_downtime, - name: 'inDowntime', + name: 'inDowntime' }, { color: theme.palette.action.acknowledgedBackground, condition: ({ acknowledged }): boolean => acknowledged, - name: 'acknowledged', - }, + name: 'acknowledged' + } ]; export { rowColorConditions }; diff --git a/www/front_src/src/Resources/decoders.ts b/www/front_src/src/Resources/decoders.ts index 1f45f3bc053..59cf93c0ab7 100644 --- a/www/front_src/src/Resources/decoders.ts +++ b/www/front_src/src/Resources/decoders.ts @@ -12,24 +12,24 @@ import { ResourceType, ResourceUris, Status, - Severity, + Severity } from './models'; const statusDecoder = JsonDecoder.object( { name: JsonDecoder.string, - severity_code: JsonDecoder.number, + severity_code: JsonDecoder.number }, - 'Status', + 'Status' ); const severityIcon = JsonDecoder.object( { id: JsonDecoder.number, name: JsonDecoder.string, - url: JsonDecoder.string, + url: JsonDecoder.string }, - 'SeverityIcon', + 'SeverityIcon' ); const severityDecoder = JsonDecoder.object( @@ -38,9 +38,9 @@ const severityDecoder = JsonDecoder.object( id: JsonDecoder.number, level: JsonDecoder.number, name: JsonDecoder.string, - type: JsonDecoder.string, + type: JsonDecoder.string }, - 'Severity', + 'Severity' ); const commonDecoders = { @@ -52,10 +52,10 @@ const commonDecoders = { { id: JsonDecoder.optional(JsonDecoder.number), name: JsonDecoder.string, - url: JsonDecoder.string, + url: JsonDecoder.string }, - 'ResourceIcon', - ), + 'ResourceIcon' + ) ), id: JsonDecoder.number, in_downtime: JsonDecoder.optional(JsonDecoder.boolean), @@ -73,9 +73,9 @@ const commonDecoders = { metrics: JsonDecoder.optional(JsonDecoder.string), performance_graph: JsonDecoder.optional(JsonDecoder.string), status_graph: JsonDecoder.optional(JsonDecoder.string), - timeline: JsonDecoder.optional(JsonDecoder.string), + timeline: JsonDecoder.optional(JsonDecoder.string) }, - 'ResourceLinksEndpoints', + 'ResourceLinksEndpoints' ), externals: JsonDecoder.object( { @@ -84,25 +84,25 @@ const commonDecoders = { JsonDecoder.object( { label: JsonDecoder.optional(JsonDecoder.string), - url: JsonDecoder.string, + url: JsonDecoder.string }, - 'ResourceLinksExternalNotes', - ), - ), + 'ResourceLinksExternalNotes' + ) + ) }, - 'ResourceLinksExternals', + 'ResourceLinksExternals' ), uris: JsonDecoder.object( { configuration: JsonDecoder.optional(JsonDecoder.string), logs: JsonDecoder.optional(JsonDecoder.string), - reporting: JsonDecoder.optional(JsonDecoder.string), + reporting: JsonDecoder.optional(JsonDecoder.string) }, - 'ResourceLinksUris', - ), + 'ResourceLinksUris' + ) }, - 'ResourceLinks', - ), + 'ResourceLinks' + ) ), name: JsonDecoder.string, notification_enabled: JsonDecoder.optional(JsonDecoder.boolean), @@ -114,24 +114,24 @@ const commonDecoders = { JsonDecoder.isExactly('h'), JsonDecoder.isExactly('m'), JsonDecoder.isExactly('s'), - JsonDecoder.isExactly('a'), + JsonDecoder.isExactly('a') ], - 'ResourceShortType', + 'ResourceShortType' ), status: JsonDecoder.optional(statusDecoder), tries: JsonDecoder.optional(JsonDecoder.string), type: JsonDecoder.enumeration(ResourceType, 'ResourceType'), - uuid: JsonDecoder.string, + uuid: JsonDecoder.string }; const resourceDecoder = JsonDecoder.object( { ...commonDecoders, parent: JsonDecoder.optional( - JsonDecoder.object(commonDecoders, 'ResourceParent'), - ), + JsonDecoder.object(commonDecoders, 'ResourceParent') + ) }, - 'Resource', + 'Resource' ); export { statusDecoder, resourceDecoder }; diff --git a/www/front_src/src/Resources/helpers.ts b/www/front_src/src/Resources/helpers.ts index 25a4d1afbd3..60fd2f36700 100644 --- a/www/front_src/src/Resources/helpers.ts +++ b/www/front_src/src/Resources/helpers.ts @@ -5,7 +5,7 @@ interface ReplaceBasename { export const replaceBasename = ({ newWord, - endpoint, + endpoint }: ReplaceBasename): string => { const basename = (document diff --git a/www/front_src/src/Resources/index.tsx b/www/front_src/src/Resources/index.tsx index fb8dbaf6517..383fb1fb091 100644 --- a/www/front_src/src/Resources/index.tsx +++ b/www/front_src/src/Resources/index.tsx @@ -7,13 +7,13 @@ import { ListingPage, LoadingSkeleton, useMemoComponent, - WithPanel, + WithPanel } from '@centreon/ui'; import Details from './Details'; import { selectedResourcesDetailsAtom, - clearSelectedResourceDerivedAtom, + clearSelectedResourceDerivedAtom } from './Details/detailsAtoms'; import useDetails from './Details/useDetails'; import { editPanelOpenAtom } from './Filter/filterAtoms'; @@ -58,7 +58,7 @@ const ResourcesPage = (): JSX.Element => { /> ), - memoProps: [selectedResource?.resourceId, editPanelOpen], + memoProps: [selectedResource?.resourceId, editPanelOpen] }); }; diff --git a/www/front_src/src/Resources/memoizedComponent.tsx b/www/front_src/src/Resources/memoizedComponent.tsx index a3fa10ce74e..61e44123fb0 100644 --- a/www/front_src/src/Resources/memoizedComponent.tsx +++ b/www/front_src/src/Resources/memoizedComponent.tsx @@ -9,10 +9,10 @@ interface memoizeComponentParameters { const memoizeComponent = ({ memoProps, - Component, + Component }: memoizeComponentParameters): NamedExoticComponent => memo(Component, (prevProps, nextProps) => - equals(pick(memoProps, prevProps), pick(memoProps, nextProps)), + equals(pick(memoProps, prevProps), pick(memoProps, nextProps)) ); export default memoizeComponent; diff --git a/www/front_src/src/Resources/models.ts b/www/front_src/src/Resources/models.ts index 3527194d836..20e46c2a06b 100644 --- a/www/front_src/src/Resources/models.ts +++ b/www/front_src/src/Resources/models.ts @@ -4,14 +4,14 @@ export enum ResourceType { anomalydetection = 'anomaly-detection', host = 'host', metaservice = 'metaservice', - service = 'service', + service = 'service' } export enum ResourceCategory { 'anomaly-detection' = ResourceType.service, 'service' = ResourceType.service, 'host' = ResourceType.host, - 'metaservice' = ResourceType.metaservice, + 'metaservice' = ResourceType.metaservice } export type ResourceShortType = 'h' | 's' | 'm' | 'a'; @@ -118,5 +118,5 @@ export type TranslationType = (label: string) => string; export enum SortOrder { asc = 'asc', - desc = 'desc', + desc = 'desc' } diff --git a/www/front_src/src/Resources/storage.ts b/www/front_src/src/Resources/storage.ts index 8337b57b1f1..ad1d81d0c3b 100644 --- a/www/front_src/src/Resources/storage.ts +++ b/www/front_src/src/Resources/storage.ts @@ -13,7 +13,7 @@ const getStoredOrDefault = ({ cachedItem, defaultValue, onCachedItemUpdate, - key, + key }: StoredItemParameters): TItem => { if (!isNil(cachedItem)) { return cachedItem; diff --git a/www/front_src/src/Resources/testUtils/index.ts b/www/front_src/src/Resources/testUtils/index.ts index ce91ac6fdff..1e5d68eb3f4 100644 --- a/www/front_src/src/Resources/testUtils/index.ts +++ b/www/front_src/src/Resources/testUtils/index.ts @@ -38,7 +38,7 @@ const getListingEndpoint = ({ limit = 30, sort = { status_severity_code: SortOrder.asc, - ...defaultSecondSortCriteria, + ...defaultSecondSortCriteria }, statuses = defaultStatuses, states = defaultStates, @@ -53,7 +53,7 @@ const getListingEndpoint = ({ serviceSeverityLevels = [], monitoringServers = [], search, - statusTypes = defaultStateTypes, + statusTypes = defaultStateTypes }: EndpointParams): string => buildResourcesEndpoint({ hostCategories, @@ -68,8 +68,8 @@ const getListingEndpoint = ({ ? { regex: { fields: searchableFields, - value: search, - }, + value: search + } } : undefined, serviceCategories, @@ -79,7 +79,7 @@ const getListingEndpoint = ({ sort, states, statusTypes, - statuses, + statuses }); const cancelTokenRequestParam = { cancelToken: {} }; @@ -91,7 +91,7 @@ interface CriteriaValueProps { const getCriteriaValue = ({ filter, - name, + name }: CriteriaValueProps): CriteriaValue | undefined => { return filter.criterias.find(propEq('name', name))?.value; }; @@ -105,7 +105,7 @@ interface FilterAndCriteriaToUpdate { const getFilterWithUpdatedCriteria = ({ filter, criteriaName, - criteriaValue, + criteriaValue }: FilterAndCriteriaToUpdate): Filter => { const index = findIndex(propEq('name', criteriaName))(filter.criterias); const lens = lensPath(['criterias', index, 'value']); @@ -123,5 +123,5 @@ export { getCriteriaValue, getFilterWithUpdatedCriteria, defaultSecondSortCriteria, - defaultStateTypes, + defaultStateTypes }; diff --git a/www/front_src/src/Resources/testUtils/useActions.ts b/www/front_src/src/Resources/testUtils/useActions.ts index 533b2fe6cfb..0d7885bb7c3 100644 --- a/www/front_src/src/Resources/testUtils/useActions.ts +++ b/www/front_src/src/Resources/testUtils/useActions.ts @@ -14,12 +14,12 @@ export interface ActionsState { const useActions = (): ActionsState => { const [selectedResources, setSelectedResources] = useAtom( - selectedResourcesAtom, + selectedResourcesAtom ); return { selectedResources, - setSelectedResources, + setSelectedResources }; }; diff --git a/www/front_src/src/Resources/testUtils/useFilter.ts b/www/front_src/src/Resources/testUtils/useFilter.ts index c70b954ea41..1c5f0dd1a42 100644 --- a/www/front_src/src/Resources/testUtils/useFilter.ts +++ b/www/front_src/src/Resources/testUtils/useFilter.ts @@ -8,7 +8,7 @@ import { useAtom } from 'jotai'; import { useRequest, setUrlQueryParameters, - getUrlQueryParameters, + getUrlQueryParameters } from '@centreon/ui'; import { @@ -21,7 +21,7 @@ import { getCriteriaValueDerivedAtom, searchAtom, setCriteriaDerivedAtom, - storedFilterAtom, + storedFilterAtom } from '../Filter/filterAtoms'; import { listCustomFilters } from '../Filter/api'; import { listCustomFiltersDecoder } from '../Filter/api/decoders'; @@ -32,16 +32,16 @@ import { FilterState } from '../Filter/useFilter'; const useFilter = (): FilterState => { const { sendRequest: sendListCustomFiltersRequest, - sending: customFiltersLoading, + sending: customFiltersLoading } = useRequest({ decoder: listCustomFiltersDecoder, - request: listCustomFilters, + request: listCustomFilters }); const [customFilters, setCustomFilters] = useAtom(customFiltersAtom); const [currentFilter, setCurrentFilter] = useAtom(currentFilterAtom); const filterWithParsedSearch = useAtomValue( - filterWithParsedSearchDerivedAtom, + filterWithParsedSearchDerivedAtom ); const getCriteriaValue = useAtomValue(getCriteriaValueDerivedAtom); const defaultFilter = useAtomValue(storedFilterAtom); @@ -78,8 +78,8 @@ const useFilter = (): FilterState => { const queryParameters = [ { name: 'filter', - value: filterWithParsedSearch, - }, + value: filterWithParsedSearch + } ]; setUrlQueryParameters(queryParameters); @@ -93,8 +93,8 @@ const useFilter = (): FilterState => { setUrlQueryParameters([ { name: 'fromTopCounter', - value: false, - }, + value: false + } ]); applyFilter(defaultFilter); @@ -109,7 +109,7 @@ const useFilter = (): FilterState => { loadCustomFilters, setCriteria, setCurrentFilter, - setEditPanelOpen, + setEditPanelOpen }; }; diff --git a/www/front_src/src/Resources/testUtils/useLoadDetails.ts b/www/front_src/src/Resources/testUtils/useLoadDetails.ts index 23c8e5c1fe6..6f7251ca0b8 100644 --- a/www/front_src/src/Resources/testUtils/useLoadDetails.ts +++ b/www/front_src/src/Resources/testUtils/useLoadDetails.ts @@ -9,14 +9,14 @@ import { useRequest, getData } from '@centreon/ui'; import { labelNoResourceFound, - labelSomethingWentWrong, + labelSomethingWentWrong } from '../translatedLabels'; import useTimePeriod from '../Graph/Performance/TimePeriods/useTimePeriod'; import { customTimePeriodAtom, getNewCustomTimePeriod, resourceDetailsUpdatedAtom, - selectedTimePeriodAtom, + selectedTimePeriodAtom } from '../Graph/Performance/TimePeriods/timePeriodAtoms'; import { ResourceDetails } from '../Details/models'; import { @@ -25,7 +25,7 @@ import { selectedResourceDetailsEndpointDerivedAtom, selectedResourceUuidAtom, sendingDetailsAtom, - selectedResourcesDetailsAtom, + selectedResourcesDetailsAtom } from '../Details/detailsAtoms'; import { ChangeCustomTimePeriodProps } from '../Details/tabs/Graph/models'; @@ -41,16 +41,16 @@ const useLoadDetails = (): DetailsState => { getErrorMessage: ifElse( pathEq(['response', 'status'], 404), always(t(labelNoResourceFound)), - pathOr(t(labelSomethingWentWrong), ['response', 'data', 'message']), + pathOr(t(labelSomethingWentWrong), ['response', 'data', 'message']) ), - request: getData, + request: getData }); const [customTimePeriod, setCustomTimePeriod] = useAtom(customTimePeriodAtom); const selectedResource = useAtomValue(selectedResourcesDetailsAtom); const selectedResourceUuid = useAtomValue(selectedResourceUuidAtom); const selectedResourceDetailsEndpoint = useAtomValue( - selectedResourceDetailsEndpointDerivedAtom, + selectedResourceDetailsEndpointDerivedAtom ); const sendingDetails = useAtomValue(sendingDetailsAtom); const setDetails = useUpdateAtom(detailsAtom); @@ -59,7 +59,7 @@ const useLoadDetails = (): DetailsState => { const setResourceDetailsUpdated = useUpdateAtom(resourceDetailsUpdatedAtom); useTimePeriod({ - sending: sendingDetails, + sending: sendingDetails }); const loadDetails = (): void => { @@ -68,7 +68,7 @@ const useLoadDetails = (): DetailsState => { } sendRequest({ - endpoint: selectedResourceDetailsEndpoint, + endpoint: selectedResourceDetailsEndpoint }) .then(setDetails) .catch(() => { @@ -79,7 +79,7 @@ const useLoadDetails = (): DetailsState => { const changeCustomTimePeriod = ({ date, property }): void => { const newCustomTimePeriod = getNewCustomTimePeriod({ ...customTimePeriod, - [property]: date, + [property]: date }); setCustomTimePeriod(newCustomTimePeriod); @@ -93,12 +93,12 @@ const useLoadDetails = (): DetailsState => { }, [ selectedResourceUuid, selectedResource?.parentResourceId, - selectedResource?.resourceId, + selectedResource?.resourceId ]); return { changeCustomTimePeriod, - loadDetails, + loadDetails }; }; diff --git a/www/front_src/src/Resources/useDateTimePickerAdapter.ts b/www/front_src/src/Resources/useDateTimePickerAdapter.ts index c7872ed9264..1ced1bef9ad 100644 --- a/www/front_src/src/Resources/useDateTimePickerAdapter.ts +++ b/www/front_src/src/Resources/useDateTimePickerAdapter.ts @@ -13,14 +13,14 @@ interface UseDateTimePickerAdapterProps { Adapter; formatKeyboardValue: (value?: string) => string | undefined; getDestinationAndConfiguredTimezoneOffset: ( - destinationTimezone?: string, + destinationTimezone?: string ) => number; } enum DSTState { SUMMER, WINTER, - NODST, + NODST } interface ToTimezonedDateProps { @@ -38,7 +38,7 @@ const useDateTimePickerAdapter = (): UseDateTimePickerAdapterProps => { const toTimezonedDate = ({ date, - timeZone = undefined, + timeZone = undefined }: ToTimezonedDateProps): Date => { if (isNil(timeZone)) { return new Date(date.toLocaleString('en-US')); @@ -48,23 +48,23 @@ const useDateTimePickerAdapter = (): UseDateTimePickerAdapterProps => { }; const getDestinationAndConfiguredTimezoneOffset = ( - destinationTimezone?: string, + destinationTimezone?: string ): number => { const now = new Date(); const currentTimezoneDate = toTimezonedDate({ date: now, - timeZone: destinationTimezone, + timeZone: destinationTimezone }); const destinationTimezoneDate = toTimezonedDate({ date: now, - timeZone: timezone, + timeZone: timezone }); return Math.floor( (currentTimezoneDate.getTime() - destinationTimezoneDate.getTime()) / 60 / 60 / - 1000, + 1000 ); }; @@ -72,7 +72,7 @@ const useDateTimePickerAdapter = (): UseDateTimePickerAdapterProps => { (date: dayjs.Dayjs): DSTState => { const currentYear = toTimezonedDate({ date: new Date(), - timeZone: timezone, + timeZone: timezone }).getFullYear(); const january = dayjs(new Date(currentYear, 0, 1)) @@ -86,7 +86,7 @@ const useDateTimePickerAdapter = (): UseDateTimePickerAdapterProps => { return july === date.utcOffset() ? DSTState.SUMMER : DSTState.WINTER; }, - [timezone], + [timezone] ); const formatKeyboardValue = (value?: string): string | undefined => { @@ -113,7 +113,7 @@ const useDateTimePickerAdapter = (): UseDateTimePickerAdapterProps => { return equals( format({ date: value, formatString: 'LT' }), - format({ date: comparing, formatString: 'LT' }), + format({ date: comparing, formatString: 'LT' }) ); }; @@ -127,7 +127,7 @@ const useDateTimePickerAdapter = (): UseDateTimePickerAdapterProps => { const isNotASummerDate = pipe(isSummerDate, not)(dateDSTState); const isInUTC = equals( getDestinationAndConfiguredTimezoneOffset('UTC'), - 0, + 0 ); if ((isInUTC && isNotASummerDate) || equals('UTC', timezone)) { @@ -141,7 +141,7 @@ const useDateTimePickerAdapter = (): UseDateTimePickerAdapterProps => { public isSameHour = ( date: dayjs.Dayjs, - comparing: dayjs.Dayjs, + comparing: dayjs.Dayjs ): boolean => { return date.tz(timezone).isSame(comparing.tz(timezone), 'hour'); }; @@ -175,7 +175,7 @@ const useDateTimePickerAdapter = (): UseDateTimePickerAdapterProps => { public isSameMonth = ( date: dayjs.Dayjs, - comparing: dayjs.Dayjs, + comparing: dayjs.Dayjs ): boolean => { return date.tz(timezone).isSame(comparing.tz(timezone), 'month'); }; @@ -192,13 +192,13 @@ const useDateTimePickerAdapter = (): UseDateTimePickerAdapterProps => { const start = dayjs().locale(locale).tz(timezone).startOf('week'); return [0, 1, 2, 3, 4, 5, 6].map((diff) => - this.formatByString(start.add(diff, 'day'), 'dd'), + this.formatByString(start.add(diff, 'day'), 'dd') ); }; public mergeDateAndTime = ( date: dayjs.Dayjs, - time: dayjs.Dayjs, + time: dayjs.Dayjs ): dayjs.Dayjs => { const dateWithTimezone = date.tz(timezone).startOf('day'); const timeWithTimezone = time.tz(timezone); @@ -222,7 +222,7 @@ const useDateTimePickerAdapter = (): UseDateTimePickerAdapterProps => { return { Adapter, formatKeyboardValue, - getDestinationAndConfiguredTimezoneOffset, + getDestinationAndConfiguredTimezoneOffset }; }; diff --git a/www/front_src/src/__mocks__/@centreon/ui-context.jsx b/www/front_src/src/__mocks__/@centreon/ui-context.jsx index 48b7ec34f66..316f5e3d8b1 100644 --- a/www/front_src/src/__mocks__/@centreon/ui-context.jsx +++ b/www/front_src/src/__mocks__/@centreon/ui-context.jsx @@ -1,6 +1,6 @@ jest.mock('@centreon/ui-context', () => ({ ...jest.requireActual('centreon-frontend/packages/ui-context'), ThemeMode: { - light: 'light', - }, + light: 'light' + } })); diff --git a/www/front_src/src/__mocks__/axios.js b/www/front_src/src/__mocks__/axios.js index c7bd0405c57..61548dbe060 100644 --- a/www/front_src/src/__mocks__/axios.js +++ b/www/front_src/src/__mocks__/axios.js @@ -6,8 +6,8 @@ mockAxios.CancelToken = { // eslint-disable-next-line @typescript-eslint/explicit-function-return-type source: () => ({ cancel: jest.fn(), - token: {}, - }), + token: {} + }) }; export default mockAxios; diff --git a/www/front_src/src/api/decoders.ts b/www/front_src/src/api/decoders.ts index 3020067b8e8..c794dc361c2 100644 --- a/www/front_src/src/api/decoders.ts +++ b/www/front_src/src/api/decoders.ts @@ -8,33 +8,33 @@ export const userDecoder = JsonDecoder.object( { alias: JsonDecoder.string, default_page: JsonDecoder.optional( - JsonDecoder.nullable(JsonDecoder.string), + JsonDecoder.nullable(JsonDecoder.string) ), isExportButtonEnabled: JsonDecoder.boolean, locale: JsonDecoder.string, name: JsonDecoder.string, themeMode: JsonDecoder.optional( - JsonDecoder.enumeration(ThemeMode, 'ThemeMode'), + JsonDecoder.enumeration(ThemeMode, 'ThemeMode') ), timezone: JsonDecoder.string, - use_deprecated_pages: JsonDecoder.boolean, + use_deprecated_pages: JsonDecoder.boolean }, 'User parameters', { isExportButtonEnabled: 'is_export_button_enabled', - themeMode: 'theme', - }, + themeMode: 'theme' + } ); export const platformInstallationStatusDecoder = JsonDecoder.object( { hasUpgradeAvailable: JsonDecoder.boolean, - isInstalled: JsonDecoder.boolean, + isInstalled: JsonDecoder.boolean }, 'Web versions', { hasUpgradeAvailable: 'has_upgrade_available', - isInstalled: 'is_installed', - }, + isInstalled: 'is_installed' + } ); diff --git a/www/front_src/src/components/FederatedComponents/index.tsx b/www/front_src/src/components/FederatedComponents/index.tsx index 7b0cb1762ce..44c7245d220 100644 --- a/www/front_src/src/components/FederatedComponents/index.tsx +++ b/www/front_src/src/components/FederatedComponents/index.tsx @@ -25,7 +25,7 @@ const FederatedModules = ({ remoteEntry, moduleFederationName, federatedComponentsConfiguration, - moduleName, + moduleName }) => { return federatedComponentsConfiguration.federatedComponents.map( (component) => { @@ -40,13 +40,13 @@ const FederatedModules = ({ {...rest} /> ); - }, + } ); - }, + } )} ), - memoProps: [federatedModulesConfigurations], + memoProps: [federatedModulesConfigurations] }); }; @@ -60,7 +60,7 @@ interface LoadableComponentsProps extends LoadableComponentsContainerProps { const getLoadableComponents = ({ path, - federatedModules, + federatedModules }: LoadableComponentsProps): Array | null => { if (isNil(federatedModules)) { return null; @@ -69,7 +69,7 @@ const getLoadableComponents = ({ const components = path ? filter( pathEq(['federatedComponentsConfiguration', 'path'], path), - federatedModules, + federatedModules ) : federatedModules; @@ -84,7 +84,7 @@ const LoadableComponentsContainer = ({ const federatedModulesToDisplay = useMemo( () => getLoadableComponents({ federatedModules, path }), - [federatedModules, path], + [federatedModules, path] ); if (isNil(federatedModulesToDisplay)) { diff --git a/www/front_src/src/components/PageLoader/index.tsx b/www/front_src/src/components/PageLoader/index.tsx index 356da7c44d2..dd1e6697f92 100644 --- a/www/front_src/src/components/PageLoader/index.tsx +++ b/www/front_src/src/components/PageLoader/index.tsx @@ -5,8 +5,8 @@ import { PageSkeleton } from '@centreon/ui'; const useStyles = makeStyles(() => ({ skeletonContainer: { height: '100vh', - width: '100%', - }, + width: '100%' + } })); const PageLoader = (): JSX.Element => { diff --git a/www/front_src/src/components/ReactRouter/index.test.tsx b/www/front_src/src/components/ReactRouter/index.test.tsx index 65e6ee7b345..e996a79f211 100644 --- a/www/front_src/src/components/ReactRouter/index.test.tsx +++ b/www/front_src/src/components/ReactRouter/index.test.tsx @@ -7,7 +7,7 @@ import { labelThisPageCouldNotBeFound } from '../../FallbackPages/NotFoundPage/t import navigationAtom from '../../Navigation/navigationAtoms'; import { retrievedNavigation, - retrievedNavigationWithAnEmptySet, + retrievedNavigationWithAnEmptySet } from '../../Navigation/mocks'; import { retrievedFederatedModule } from '../../federatedModules/mocks'; import { federatedModulesAtom } from '../../federatedModules/atoms'; @@ -22,7 +22,7 @@ jest.mock('../../Resources', () => { return { __esModule: true, - default: Resources, + default: Resources }; }); @@ -32,12 +32,12 @@ const renderReactRouter = (navigation = retrievedNavigation): RenderResult => - , + ); describe('React Router', () => { @@ -62,13 +62,13 @@ describe('React Router', () => { await waitFor(() => { expect( - screen.getByText(labelThisPageCouldNotBeFound), + screen.getByText(labelThisPageCouldNotBeFound) ).toBeInTheDocument(); }); expect(screen.getByText('404')).toBeInTheDocument(); expect( - screen.getByText('This page could not be found'), + screen.getByText('This page could not be found') ).toBeInTheDocument(); }); @@ -79,13 +79,13 @@ describe('React Router', () => { await waitFor(() => { expect( - screen.getByText(labelYouAreNotAllowedToSeeThisPage), + screen.getByText(labelYouAreNotAllowedToSeeThisPage) ).toBeInTheDocument(); }); expect(screen.getByText('Lost in space?')).toBeInTheDocument(); expect( - screen.getByText('You are not allowed to see this page'), + screen.getByText('You are not allowed to see this page') ).toBeInTheDocument(); }); }); diff --git a/www/front_src/src/components/ReactRouter/index.tsx b/www/front_src/src/components/ReactRouter/index.tsx index 4d1b7d8611c..ddff1109e4d 100644 --- a/www/front_src/src/components/ReactRouter/index.tsx +++ b/www/front_src/src/components/ReactRouter/index.tsx @@ -22,12 +22,12 @@ const PageContainer = styled('div')(() => ({ display: 'grid', gridTemplateRows: 'auto 1fr', height: '100%', - overflow: 'auto', + overflow: 'auto' })); const getExternalPageRoutes = ({ allowedPages, - federatedModules, + federatedModules }): Array => { const isAllowedPage = (path): boolean => allowedPages?.find((allowedPage) => path.includes(allowedPage)); @@ -58,7 +58,7 @@ const getExternalPageRoutes = ({ /> ); }); - }, + } ); }; @@ -71,7 +71,7 @@ interface Props { const ReactRouterContent = ({ federatedModules, externalPagesFetched, - allowedPages, + allowedPages }: Props): JSX.Element => { return useMemoComponent({ Component: ( @@ -101,7 +101,7 @@ const ReactRouterContent = ({ ), - memoProps: [externalPagesFetched, federatedModules, allowedPages], + memoProps: [externalPagesFetched, federatedModules, allowedPages] }); }; diff --git a/www/front_src/src/components/Wallpaper/BackgroundImage.tsx b/www/front_src/src/components/Wallpaper/BackgroundImage.tsx index 2de34a5d600..b4cc6aa654b 100644 --- a/www/front_src/src/components/Wallpaper/BackgroundImage.tsx +++ b/www/front_src/src/components/Wallpaper/BackgroundImage.tsx @@ -23,8 +23,8 @@ const useStyles = makeStyles({ left: 0, position: 'fixed', right: 0, - top: 0, - }), + top: 0 + }) }); const BackgroundImage = ({ image }: Props): JSX.Element => { diff --git a/www/front_src/src/components/Wallpaper/index.tsx b/www/front_src/src/components/Wallpaper/index.tsx index f274a3baa43..c4ce02d3cbe 100644 --- a/www/front_src/src/components/Wallpaper/index.tsx +++ b/www/front_src/src/components/Wallpaper/index.tsx @@ -15,8 +15,8 @@ const useStyles = makeStyles({ left: 0, position: 'absolute', right: 0, - top: 0, - }, + top: 0 + } }); const Wallpaper = (): JSX.Element => { @@ -36,5 +36,5 @@ const Wallpaper = (): JSX.Element => { export default memoizeComponent({ Component: Wallpaper, - memoProps: [], + memoProps: [] }); diff --git a/www/front_src/src/components/Wallpaper/loadImageAtom.ts b/www/front_src/src/components/Wallpaper/loadImageAtom.ts index ecdcc42fbac..ef55249a8fd 100644 --- a/www/front_src/src/components/Wallpaper/loadImageAtom.ts +++ b/www/front_src/src/components/Wallpaper/loadImageAtom.ts @@ -17,5 +17,5 @@ export const loadImageDerivedAtom = atom( loadImage(imagePath) .then((image) => set(imageAtom, image)) .catch(() => undefined); - }, + } ); diff --git a/www/front_src/src/components/Wallpaper/useLoadWallpaper.ts b/www/front_src/src/components/Wallpaper/useLoadWallpaper.ts index 1f521342c32..4e9962ddc67 100644 --- a/www/front_src/src/components/Wallpaper/useLoadWallpaper.ts +++ b/www/front_src/src/components/Wallpaper/useLoadWallpaper.ts @@ -21,9 +21,9 @@ const useLoadWallpaper = (): void => { cond([ [lte(theme.breakpoints.values.xl), always(centreonWallpaperXl)], [lte(theme.breakpoints.values.lg), always(centreonWallpaperLg)], - [lte(theme.breakpoints.values.sm), always(centreonWallpaperSm)], + [lte(theme.breakpoints.values.sm), always(centreonWallpaperSm)] ])(window.screen.width), - [], + [] ); useEffect(() => { diff --git a/www/front_src/src/components/WizardFormSetupStatus/index.tsx b/www/front_src/src/components/WizardFormSetupStatus/index.tsx index 1a17f1d96f4..f1097bf2ec2 100755 --- a/www/front_src/src/components/WizardFormSetupStatus/index.tsx +++ b/www/front_src/src/components/WizardFormSetupStatus/index.tsx @@ -11,7 +11,7 @@ import { ContentWithCircularLoading } from '@centreon/ui'; import { useStylesWithProps } from '../../styles/partials/form/PollerWizardStyle'; import { labelCreatingExportTask, - labelGeneratingExportFiles, + labelGeneratingExportFiles } from '../../PollerWizard/translatedLabels'; interface Props { @@ -25,7 +25,7 @@ export default ({ formTitle, statusCreating, statusGenerating, - error, + error }: Props): JSX.Element => { const classes = useStylesWithProps({ statusCreating, statusGenerating }); diff --git a/www/front_src/src/federatedModules/Load/index.tsx b/www/front_src/src/federatedModules/Load/index.tsx index 63fcb964a76..24409b8ee64 100644 --- a/www/front_src/src/federatedModules/Load/index.tsx +++ b/www/front_src/src/federatedModules/Load/index.tsx @@ -24,12 +24,12 @@ const remoteEntriesLoadedAtom = atom([] as Array); const useDynamicLoadRemoteEntry = ({ remoteEntry, - moduleName, + moduleName }: UseDynamicLoadRemoteEntryProps): UseDynamicLoadRemoteEntryState => { const [failed, setFailed] = useState(false); const [remoteEntriesLoaded, setRemoteEntriesLoaded] = useAtom( - remoteEntriesLoadedAtom, + remoteEntriesLoadedAtom ); useEffect((): (() => void) | undefined => { @@ -51,7 +51,7 @@ const useDynamicLoadRemoteEntry = ({ element.onload = (): void => { setRemoteEntriesLoaded((currentRemoteEntries) => [ ...currentRemoteEntries, - moduleName, + moduleName ]); }; @@ -68,7 +68,7 @@ const useDynamicLoadRemoteEntry = ({ return { failed, - ready: remoteEntriesLoaded.includes(moduleName), + ready: remoteEntriesLoaded.includes(moduleName) }; }; @@ -86,7 +86,7 @@ const LoadComponent = ({ }: LoadComponentProps): JSX.Element => { const Component = useMemo( () => lazy(loadComponent({ component, moduleFederationName })), - [moduleFederationName], + [moduleFederationName] ); return ( @@ -100,7 +100,7 @@ const LoadComponent = ({ const MemoizedLoadComponent = memoizeComponent({ Component: LoadComponent, - memoProps: ['name', 'component', 'isFederatedModule'], + memoProps: ['name', 'component', 'isFederatedModule'] }); interface RemoteProps extends LoadComponentProps { @@ -118,7 +118,7 @@ export const Remote = ({ }: RemoteProps): JSX.Element => { const { ready, failed } = useDynamicLoadRemoteEntry({ moduleName, - remoteEntry, + remoteEntry }); if (!ready) { diff --git a/www/front_src/src/federatedModules/index.test.ts b/www/front_src/src/federatedModules/index.test.ts index 7632e67d871..a0b45b58095 100644 --- a/www/front_src/src/federatedModules/index.test.ts +++ b/www/front_src/src/federatedModules/index.test.ts @@ -12,12 +12,12 @@ const mockedAxios = axios as jest.Mocked; const retrievedWebVersions = { modules: { 'centreon-bam-server': { - version: '1.0.0', - }, + version: '1.0.0' + } }, web: { - version: '21.10.1', - }, + version: '21.10.1' + } }; describe('external components', () => { @@ -31,7 +31,7 @@ describe('external components', () => { it('populates the federated components atom with the data retrieved from the API', async () => { const { result } = renderHook(() => ({ ...useFederatedModules(), - ...usePlatformVersions(), + ...usePlatformVersions() })); expect(result.current.federatedModules).toEqual(null); @@ -50,7 +50,7 @@ describe('external components', () => { await waitFor(() => { expect(result.current.federatedModules).toEqual([ - retrievedFederatedModule, + retrievedFederatedModule ]); }); }); diff --git a/www/front_src/src/federatedModules/mocks.ts b/www/front_src/src/federatedModules/mocks.ts index a78220c9f72..9733f6acf9d 100644 --- a/www/front_src/src/federatedModules/mocks.ts +++ b/www/front_src/src/federatedModules/mocks.ts @@ -3,19 +3,19 @@ import { FederatedModule } from './models'; export const retrievedFederatedModule: FederatedModule = { federatedComponentsConfiguration: { federatedComponents: ['./monitoring/hooks/topCounter'], - path: '/header/topCounter', + path: '/header/topCounter' }, federatedPages: [ { component: './configuration/pages/bas', - route: '/configuration/bam/bas', + route: '/configuration/bam/bas' }, { component: './configuration/pages/bvs', - route: '/configuration/bam/bvs', - }, + route: '/configuration/bam/bvs' + } ], moduleFederationName: 'bam', moduleName: 'centreon-bam-server', - remoteEntry: 'remoteEntry.js', + remoteEntry: 'remoteEntry.js' }; diff --git a/www/front_src/src/federatedModules/useFederatedModules.ts b/www/front_src/src/federatedModules/useFederatedModules.ts index 4ef770596c7..82e990277b2 100644 --- a/www/front_src/src/federatedModules/useFederatedModules.ts +++ b/www/front_src/src/federatedModules/useFederatedModules.ts @@ -20,7 +20,7 @@ interface UseFederatedModulesState { const useFederatedModules = (): UseFederatedModulesState => { const { sendRequest } = useRequest({ - request: getData, + request: getData }); const [federatedModules, setFederatedModules] = useAtom(federatedModulesAtom); const { getModules } = usePlatformVersions(); @@ -34,8 +34,8 @@ const useFederatedModules = (): UseFederatedModulesState => { Promise.all( modules?.map((moduleName) => - sendRequest({ endpoint: getFederatedModule(moduleName) }), - ) || [], + sendRequest({ endpoint: getFederatedModule(moduleName) }) + ) || [] ).then(setFederatedModules); }, [modules]); @@ -45,7 +45,7 @@ const useFederatedModules = (): UseFederatedModulesState => { return { federatedModules, - getFederatedModulesConfigurations, + getFederatedModulesConfigurations }; }; diff --git a/www/front_src/src/helpers/dynamicImport.js b/www/front_src/src/helpers/dynamicImport.js index 58afb044ba5..b30839d2378 100644 --- a/www/front_src/src/helpers/dynamicImport.js +++ b/www/front_src/src/helpers/dynamicImport.js @@ -52,7 +52,7 @@ const importModules = ({ basename, files }) => { export const dynamicImport = (basename, parameters) => new Promise(async (resolve, _reject) => { const { - js: { commons, chunks, bundle }, + js: { commons, chunks, bundle } } = parameters; if (!bundle) { console.error(new Error('dynamic import should contains js parameter.')); @@ -64,13 +64,13 @@ export const dynamicImport = (basename, parameters) => // import commons and vendor chunks await importModules({ basename, - files: commons, + files: commons }); // import specific bundle chunks await importModules({ basename, - files: chunks, + files: chunks }); // import bundle itself diff --git a/www/front_src/src/helpers/extras/global.js b/www/front_src/src/helpers/extras/global.js index 6e0f5938170..1b0f8438f5e 100644 --- a/www/front_src/src/helpers/extras/global.js +++ b/www/front_src/src/helpers/extras/global.js @@ -74,7 +74,7 @@ [], function () { return {}; - }, + } ]; const { getRegister } = systemJSPrototype; @@ -102,9 +102,9 @@ return { execute() { _export({ __useDefault: true, default: globalExport }); - }, + } }; - }, + } ]; }; })(typeof self !== 'undefined' ? self : global); diff --git a/www/front_src/src/reactRoutes/index.ts b/www/front_src/src/reactRoutes/index.ts index 72c41f65c9f..48e63add6dd 100644 --- a/www/front_src/src/reactRoutes/index.ts +++ b/www/front_src/src/reactRoutes/index.ts @@ -5,28 +5,28 @@ import routeMap from './routeMap'; const reactRoutes = [ { comp: lazy(() => import('../route-components/pollerWizard')), - path: routeMap.pollerWizard, + path: routeMap.pollerWizard }, { comp: lazy(() => import('../Extensions')), - path: routeMap.extensionsManagerPage, + path: routeMap.extensionsManagerPage }, { comp: lazy(() => import('../FallbackPages/NotAllowedPage')), - path: routeMap.notAllowedPage, + path: routeMap.notAllowedPage }, { comp: lazy(() => import('../Resources')), - path: routeMap.resources, + path: routeMap.resources }, { comp: lazy(() => import('../Authentication')), - path: routeMap.authentication, + path: routeMap.authentication }, { comp: lazy(() => import('../ResetPassword')), - path: routeMap.resetPassword, - }, + path: routeMap.resetPassword + } ]; export default reactRoutes; diff --git a/www/front_src/src/reactRoutes/routeMap.ts b/www/front_src/src/reactRoutes/routeMap.ts index 2c277bd3d61..6a7c6ec71ce 100644 --- a/www/front_src/src/reactRoutes/routeMap.ts +++ b/www/front_src/src/reactRoutes/routeMap.ts @@ -8,7 +8,7 @@ const routeMap = { pollerWizard: '/poller-wizard/1', resetPassword: '/reset-password', resources: '/monitoring/resources', - upgrade: '/install/upgrade.php', + upgrade: '/install/upgrade.php' }; export default routeMap; diff --git a/www/front_src/src/route-components/legacyRoute/index.tsx b/www/front_src/src/route-components/legacyRoute/index.tsx index 44fc2fcfef6..54d8b126bf5 100644 --- a/www/front_src/src/route-components/legacyRoute/index.tsx +++ b/www/front_src/src/route-components/legacyRoute/index.tsx @@ -44,7 +44,7 @@ const LegacyRoute = (): JSX.Element => { navigate(`/${formattedHref}`, { replace: true }); }, - { once: true }, + { once: true } ); }); }; diff --git a/www/front_src/src/route-components/pollerWizard/index.tsx b/www/front_src/src/route-components/pollerWizard/index.tsx index 13169c8aa9c..d579c7fb143 100644 --- a/www/front_src/src/route-components/pollerWizard/index.tsx +++ b/www/front_src/src/route-components/pollerWizard/index.tsx @@ -14,22 +14,22 @@ import { labelAddAdvancedConfiguration, labelConfigureServer, labelFinishTheSetup, - labelSelectServerType, + labelSelectServerType } from './translatedLabels'; const ServerConfigurationWizard = lazy( - () => import('../../PollerWizard/serverConfigurationWizard'), + () => import('../../PollerWizard/serverConfigurationWizard') ); const RemoteServerStep1 = lazy( - () => import('../../PollerWizard/remoteServerStep1'), + () => import('../../PollerWizard/remoteServerStep1') ); const PollerStep1 = lazy(() => import('../../PollerWizard/pollerStep1')); const RemoteServerStep2 = lazy( - () => import('../../PollerWizard/remoteServerStep2'), + () => import('../../PollerWizard/remoteServerStep2') ); const PollerStep2 = lazy(() => import('../../PollerWizard/pollerStep2')); const RemoteServerStep3 = lazy( - () => import('../../PollerWizard/remoteServerStep3'), + () => import('../../PollerWizard/remoteServerStep3') ); const PollerStep3 = lazy(() => import('../../PollerWizard/pollerStep3')); @@ -37,20 +37,20 @@ const formSteps = [ { [ServerType.Base]: ServerConfigurationWizard }, { [ServerType.Remote]: RemoteServerStep1, [ServerType.Poller]: PollerStep1 }, { [ServerType.Remote]: RemoteServerStep2, [ServerType.Poller]: PollerStep2 }, - { [ServerType.Remote]: RemoteServerStep3, [ServerType.Poller]: PollerStep3 }, + { [ServerType.Remote]: RemoteServerStep3, [ServerType.Poller]: PollerStep3 } ]; const steps = [ labelSelectServerType, labelConfigureServer, labelAddAdvancedConfiguration, - labelFinishTheSetup, + labelFinishTheSetup ]; const useStyles = makeStyles((theme) => ({ wrapper: { - margin: theme.spacing(2, 4), - }, + margin: theme.spacing(2, 4) + } })); const PollerWizard = (): JSX.Element | null => { @@ -87,7 +87,7 @@ const PollerWizard = (): JSX.Element | null => { const Form = path<(props: WizardFormProps) => JSX.Element>( [currentStep, equals(currentStep, 0) ? ServerType.Base : serverType], - formSteps, + formSteps ); if (isNil(Form)) { @@ -104,7 +104,7 @@ const PollerWizard = (): JSX.Element | null => { ref={listingRef} sx={{ maxHeight: listingContainerHeight, - overflowY: 'auto', + overflowY: 'auto' }} >

diff --git a/www/front_src/src/styles/partials/form/PollerWizardStyle.ts b/www/front_src/src/styles/partials/form/PollerWizardStyle.ts index badb91b39e7..7c6e8f2201e 100644 --- a/www/front_src/src/styles/partials/form/PollerWizardStyle.ts +++ b/www/front_src/src/styles/partials/form/PollerWizardStyle.ts @@ -13,33 +13,33 @@ const useStyles = makeStyles((theme) => ({ display: 'flex', flexDirection: 'column', rowGap: theme.spacing(2), - width: '100%', + width: '100%' }, formButton: { columnGap: theme.spacing(1), display: 'flex', flexDirection: 'row', justifyContent: 'flex-end', - marginTop: theme.spacing(1.875), + marginTop: theme.spacing(1.875) }, formHeading: { - marginBottom: theme.spacing(0.625), + marginBottom: theme.spacing(0.625) }, formItem: { - paddingBottom: theme.spacing(1.875), + paddingBottom: theme.spacing(1.875) }, formText: { color: '#242f3a', fontFamily: 'Roboto Regular', fontSize: theme.spacing(1.5), - margin: '20px 0', + margin: '20px 0' }, wizardRadio: { columnGap: theme.spacing(2), display: 'flex', justifyContent: 'center', - marginBottom: theme.spacing(3), - }, + marginBottom: theme.spacing(3) + } })); const useStylesWithProps = makeStyles((theme) => ({ @@ -48,25 +48,25 @@ const useStylesWithProps = makeStyles((theme) => ({ display: 'flex', flexDirection: 'row', justifyContent: 'flex-end', - marginTop: theme.spacing(1.875), + marginTop: theme.spacing(1.875) }, formHeading: { - marginBottom: theme.spacing(0.625), + marginBottom: theme.spacing(0.625) }, formText: { color: grey[500], fontFamily: 'Roboto Regular', fontSize: theme.spacing(1.5), - margin: '20px 0', + margin: '20px 0' }, statusCreating: ({ statusCreating }): CreateCSSProperties => ({ - color: statusCreating ? '#acd174' : '#d0021b', + color: statusCreating ? '#acd174' : '#d0021b' }), statusGenerating: ({ - statusGenerating, + statusGenerating }): CreateCSSProperties => ({ - color: statusGenerating ? '#acd174' : '#d0021b', - }), + color: statusGenerating ? '#acd174' : '#d0021b' + }) })); export { useStyles, useStylesWithProps };