diff --git a/.prettierrc b/.prettierrc index e09edeb6..47592156 100644 --- a/.prettierrc +++ b/.prettierrc @@ -1,5 +1,5 @@ { - "printWidth": 100, + "printWidth": 120, "trailingComma": "all", "tabWidth": 2, "semi": true, diff --git a/package-lock.json b/package-lock.json index 12a0164c..3573415e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "wlan-cloud-owprov-ui", - "version": "2.6.56", + "version": "2.6.57", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "wlan-cloud-owprov-ui", - "version": "2.6.56", + "version": "2.6.57", "license": "ISC", "dependencies": { "@chakra-ui/icons": "^1.1.1", diff --git a/package.json b/package.json index 945c7dbe..b4ad98c4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "wlan-cloud-owprov-ui", - "version": "2.6.56", + "version": "2.6.57", "description": "", "main": "index.js", "scripts": { diff --git a/src/App.js b/src/App.js index 35a921dc..168739da 100644 --- a/src/App.js +++ b/src/App.js @@ -16,8 +16,7 @@ const queryClient = new QueryClient({ }); const App = () => { - const storageToken = - localStorage.getItem('access_token') ?? sessionStorage.getItem('access_token'); + const storageToken = localStorage.getItem('access_token') ?? sessionStorage.getItem('access_token'); return ( diff --git a/src/components/Buttons/FileInputButton/index.js b/src/components/Buttons/FileInputButton/index.js index 9acea762..05f8399c 100644 --- a/src/components/Buttons/FileInputButton/index.js +++ b/src/components/Buttons/FileInputButton/index.js @@ -18,15 +18,7 @@ const defaultProps = { isStringFile: false, }; -const FileInputButton = ({ - value, - setValue, - setFileName, - refreshId, - accept, - isHidden, - isStringFile, -}) => { +const FileInputButton = ({ value, setValue, setFileName, refreshId, accept, isHidden, isStringFile }) => { const [fileKey, setFileKey] = useState(uuid()); let fileReader; diff --git a/src/components/Buttons/SaveButton/index.js b/src/components/Buttons/SaveButton/index.js index ff30273a..6987d9ed 100644 --- a/src/components/Buttons/SaveButton/index.js +++ b/src/components/Buttons/SaveButton/index.js @@ -22,15 +22,7 @@ const defaultProps = { dirtyCheck: false, }; -const SaveButton = ({ - onClick, - isDisabled, - isLoading, - isCompact, - isDirty, - dirtyCheck, - ...props -}) => { +const SaveButton = ({ onClick, isDisabled, isLoading, isCompact, isDirty, dirtyCheck, ...props }) => { const { t } = useTranslation(); const breakpoint = useBreakpoint(); diff --git a/src/components/Buttons/ToggleEditButton/index.js b/src/components/Buttons/ToggleEditButton/index.js index 0bcf7295..e60c4c4b 100644 --- a/src/components/Buttons/ToggleEditButton/index.js +++ b/src/components/Buttons/ToggleEditButton/index.js @@ -21,15 +21,7 @@ const defaultProps = { isDirty: false, }; -const ToggleEditButton = ({ - toggleEdit, - isEditing, - isDirty, - isDisabled, - isLoading, - isCompact, - ...props -}) => { +const ToggleEditButton = ({ toggleEdit, isEditing, isDirty, isDisabled, isLoading, isCompact, ...props }) => { const { t } = useTranslation(); const breakpoint = useBreakpoint(); const { isOpen: showConfirm, onOpen: openConfirm, onClose: closeConfirm } = useDisclosure(); @@ -61,11 +53,7 @@ const ToggleEditButton = ({ > {isEditing ? t('common.stop_editing') : t('common.edit')} - + ); } diff --git a/src/components/ColumnPicker/index.js b/src/components/ColumnPicker/index.js index 9e7bb57a..2fe0e2ca 100644 --- a/src/components/ColumnPicker/index.js +++ b/src/components/ColumnPicker/index.js @@ -2,16 +2,7 @@ import React, { useEffect } from 'react'; import PropTypes from 'prop-types'; import { v4 as uuid } from 'uuid'; import { useTranslation } from 'react-i18next'; -import { - Button, - Checkbox, - IconButton, - Menu, - MenuButton, - MenuItem, - MenuList, - useBreakpoint, -} from '@chakra-ui/react'; +import { Button, Checkbox, IconButton, Menu, MenuButton, MenuItem, MenuList, useBreakpoint } from '@chakra-ui/react'; import { useAuth } from 'contexts/AuthProvider'; import { FunnelSimple } from 'phosphor-react'; @@ -34,8 +25,7 @@ const ColumnPicker = ({ preference, columns, hiddenColumns, setHiddenColumns }) const handleColumnClick = (id) => { let newHidden = []; - if (hiddenColumns.find((hidden) => hidden === id)) - newHidden = [...hiddenColumns.filter((hidden) => hidden !== id)]; + if (hiddenColumns.find((hidden) => hidden === id)) newHidden = [...hiddenColumns.filter((hidden) => hidden !== id)]; else newHidden = [...hiddenColumns, id]; setPref({ preference, value: newHidden.join(',') }); setHiddenColumns(newHidden); @@ -52,11 +42,7 @@ const ColumnPicker = ({ preference, columns, hiddenColumns, setHiddenColumns }) } /> {columns.map((column) => ( - handleColumnClick(column.id)} - > + handleColumnClick(column.id)}> hidden === column.id)} isDisabled={column.alwaysShow} @@ -77,11 +63,7 @@ const ColumnPicker = ({ preference, columns, hiddenColumns, setHiddenColumns }) {columns.map((column) => ( - handleColumnClick(column.id)} - > + handleColumnClick(column.id)}> hidden === column.id)} isDisabled={column.alwaysShow} diff --git a/src/components/CreateObjectsForms/LocationPickerCreator/Form.js b/src/components/CreateObjectsForms/LocationPickerCreator/Form.js index cb5e6d9f..e7357ae5 100644 --- a/src/components/CreateObjectsForms/LocationPickerCreator/Form.js +++ b/src/components/CreateObjectsForms/LocationPickerCreator/Form.js @@ -33,39 +33,18 @@ const Form = ({ name }) => { { label: 'CORPORATE', value: 'CORPORATE' }, ]} /> - - + + - + - + - + diff --git a/src/components/CreateObjectsForms/LocationPickerCreator/Modal.js b/src/components/CreateObjectsForms/LocationPickerCreator/Modal.js index c727d57e..14b81758 100644 --- a/src/components/CreateObjectsForms/LocationPickerCreator/Modal.js +++ b/src/components/CreateObjectsForms/LocationPickerCreator/Modal.js @@ -1,14 +1,6 @@ import React, { useCallback, useEffect, useState } from 'react'; import PropTypes from 'prop-types'; -import { - CloseButton, - Modal, - ModalBody, - ModalContent, - ModalOverlay, - SimpleGrid, - useDisclosure, -} from '@chakra-ui/react'; +import { CloseButton, Modal, ModalBody, ModalContent, ModalOverlay, SimpleGrid, useDisclosure } from '@chakra-ui/react'; import ModalHeader from 'components/ModalHeader'; import SaveButton from 'components/Buttons/SaveButton'; import ConfirmCloseAlert from 'components/ConfirmCloseAlert'; @@ -154,29 +146,13 @@ const LocationPickerCreatorModal = ({ setLocation, reset }) => { { label: 'CORPORATE', value: 'CORPORATE' }, ]} /> - - + + - + - + diff --git a/src/components/CreateObjectsForms/LocationPickerCreator/index.js b/src/components/CreateObjectsForms/LocationPickerCreator/index.js index 12c14f7e..5dfc3acf 100644 --- a/src/components/CreateObjectsForms/LocationPickerCreator/index.js +++ b/src/components/CreateObjectsForms/LocationPickerCreator/index.js @@ -24,14 +24,7 @@ const defaultProps = { venueId: null, }; -const LocationPickerCreator = ({ - locationName, - createLocationName, - editing, - isModal, - entityId, - venueId, -}) => { +const LocationPickerCreator = ({ locationName, createLocationName, editing, isModal, entityId, venueId }) => { const { t } = useTranslation(); const toast = useToast(); const [{ value: location }, , { setValue: setLocation }] = useField(locationName); diff --git a/src/components/CustomFields/CustomNumberAsStringField/FastNumberInput.js b/src/components/CustomFields/CustomNumberAsStringField/FastNumberInput.js index 9341fa17..8c8534ac 100644 --- a/src/components/CustomFields/CustomNumberAsStringField/FastNumberInput.js +++ b/src/components/CustomFields/CustomNumberAsStringField/FastNumberInput.js @@ -33,17 +33,7 @@ const defaultProps = { isDisabled: false, }; -const FastNumberInput = ({ - label, - value, - unit, - onChange, - onBlur, - error, - touched, - isRequired, - isDisabled, -}) => ( +const FastNumberInput = ({ label, value, unit, onChange, onBlur, error, touched, isRequired, isDisabled }) => ( {label} diff --git a/src/components/CustomFields/DeviceConfigurationsModalField/Modal.js b/src/components/CustomFields/DeviceConfigurationsModalField/Modal.js index 13863f5b..c62ef56a 100644 --- a/src/components/CustomFields/DeviceConfigurationsModalField/Modal.js +++ b/src/components/CustomFields/DeviceConfigurationsModalField/Modal.js @@ -39,15 +39,7 @@ const defaultProps = { isDisabled: false, }; -const DeviceConfigurationsModal = ({ - name, - initialValue, - setValue, - errors, - isDisabled, - isRequired, - label, -}) => { +const DeviceConfigurationsModal = ({ name, initialValue, setValue, errors, isDisabled, isRequired, label }) => { const { t } = useTranslation(); const toast = useToast(); const [localValue, setLocalValue] = useState([]); @@ -86,10 +78,7 @@ const DeviceConfigurationsModal = ({ const { length } = initialValue; if (length === 0) return t('entities.add_configurations'); if (length === 1 && configurations) - return ( - configurations.find((conf) => conf.id === initialValue[0])?.name ?? - `1 ${t('configurations.one')}` - ); + return configurations.find((conf) => conf.id === initialValue[0])?.name ?? `1 ${t('configurations.one')}`; return `${length} ${t('configurations.title')}`; }, [initialValue, configurations]); @@ -221,22 +210,14 @@ const DeviceConfigurationsModal = ({ configurations.find((config) => config.id === id)) - : [] - } + data={configurations ? localValue.map((id) => configurations.find((config) => config.id === id)) : []} isLoading={isFetching} obj={t('configurations.title')} /> !localValue.find((local) => local === config.id), - ) ?? [] - } + data={configurations?.filter((config) => !localValue.find((local) => local === config.id)) ?? []} isLoading={isFetching} obj={t('configurations.title')} /> diff --git a/src/components/CustomFields/DeviceConfigurationsModalField/index.js b/src/components/CustomFields/DeviceConfigurationsModalField/index.js index 71189b06..079acea6 100644 --- a/src/components/CustomFields/DeviceConfigurationsModalField/index.js +++ b/src/components/CustomFields/DeviceConfigurationsModalField/index.js @@ -17,14 +17,7 @@ const defaultProps = { isDisabled: false, }; -const DeviceConfigurationsModalField = ({ - name, - label, - setFieldValue, - errors, - isDisabled, - isRequired, -}) => { +const DeviceConfigurationsModalField = ({ name, label, setFieldValue, errors, isDisabled, isRequired }) => { const setValue = (value) => setFieldValue(name, value); return ( diff --git a/src/components/CustomFields/MultiPhoneNumberField/MultiPhoneNumberFieldInput.js b/src/components/CustomFields/MultiPhoneNumberField/MultiPhoneNumberFieldInput.js index 61f7fe7f..0972024d 100644 --- a/src/components/CustomFields/MultiPhoneNumberField/MultiPhoneNumberFieldInput.js +++ b/src/components/CustomFields/MultiPhoneNumberField/MultiPhoneNumberFieldInput.js @@ -55,10 +55,7 @@ const MultiPhoneNumberFieldInput = ({ definitionKey, }) => { const { t } = useTranslation(); - const NoOptionsMessage = useCallback( - () =>
{t('common.type_for_options')}
, - [], - ); + const NoOptionsMessage = useCallback(() =>
{t('common.type_for_options')}
, []); return (
- +
diff --git a/src/components/Tables/InventoryTable/CreateTagModal/index.js b/src/components/Tables/InventoryTable/CreateTagModal/index.js index 10a6836c..d9e0471a 100644 --- a/src/components/Tables/InventoryTable/CreateTagModal/index.js +++ b/src/components/Tables/InventoryTable/CreateTagModal/index.js @@ -64,8 +64,7 @@ const CreateTagModal = ({ refresh, entityId, subId }) => { setConfiguration(null); onOpen(); }; - const closeModal = () => - form.dirty || configuration?.__form?.isDirty ? openConfirm() : onClose(); + const closeModal = () => (form.dirty || configuration?.__form?.isDirty ? openConfirm() : onClose()); const closeCancelAndForm = () => { closeConfirm(); onClose(); @@ -84,11 +83,7 @@ const CreateTagModal = ({ refresh, entityId, subId }) => { @@ -109,11 +104,7 @@ const CreateTagModal = ({ refresh, entityId, subId }) => { /> - + ); diff --git a/src/components/Tables/InventoryTable/EditTagModal/ComputedConfigurationDisplay.js b/src/components/Tables/InventoryTable/EditTagModal/ComputedConfigurationDisplay.js index 489a1690..f124d6c2 100644 --- a/src/components/Tables/InventoryTable/EditTagModal/ComputedConfigurationDisplay.js +++ b/src/components/Tables/InventoryTable/EditTagModal/ComputedConfigurationDisplay.js @@ -50,16 +50,9 @@ const ComputedConfigurationDisplay = ({ computedConfig }) => { {computedConfig.explanation?.map((exp) => (
diff --git a/src/components/Tables/InventoryTable/EditTagModal/ConfigurationPicker.js b/src/components/Tables/InventoryTable/EditTagModal/ConfigurationPicker.js index ec532ae0..ed8ee97e 100644 --- a/src/components/Tables/InventoryTable/EditTagModal/ConfigurationPicker.js +++ b/src/components/Tables/InventoryTable/EditTagModal/ConfigurationPicker.js @@ -45,9 +45,7 @@ const ConfigurationPicker = ({ tagId, name, isDisabled }) => { classNamePrefix="chakra-react-select" menuPortalTarget={document.body} options={[{ value: '', label: t('common.none') }, ...options]} - value={[{ value: '', label: t('common.none') }, ...options].find( - (opt) => opt.value === value, - )} + value={[{ value: '', label: t('common.none') }, ...options].find((opt) => opt.value === value)} onChange={onChange} onBlur={onBlur} /> diff --git a/src/components/Tables/InventoryTable/EditTagModal/Form.js b/src/components/Tables/InventoryTable/EditTagModal/Form.js index facdf6b3..057be839 100644 --- a/src/components/Tables/InventoryTable/EditTagModal/Form.js +++ b/src/components/Tables/InventoryTable/EditTagModal/Form.js @@ -2,16 +2,7 @@ import React, { useEffect, useState } from 'react'; import PropTypes from 'prop-types'; import { useTranslation } from 'react-i18next'; import { v4 as uuid } from 'uuid'; -import { - useToast, - Tabs, - TabList, - TabPanels, - TabPanel, - Tab, - SimpleGrid, - Textarea, -} from '@chakra-ui/react'; +import { useToast, Tabs, TabList, TabPanels, TabPanel, Tab, SimpleGrid, Textarea } from '@chakra-ui/react'; import { Formik, Field, Form } from 'formik'; import NotesTable from 'components/NotesTable'; import StringField from 'components/FormFields/StringField'; @@ -199,23 +190,9 @@ const EditTagForm = ({
- - - + + + - {({ field }) => ( - - )} + {({ field }) => } - - {({ field }) =>