diff --git a/.github/workflows/linter.yml b/.github/workflows/linter.yml index 3aa67796eea..18f8f554490 100644 --- a/.github/workflows/linter.yml +++ b/.github/workflows/linter.yml @@ -16,16 +16,16 @@ jobs: statuses: write steps: - - name: Checkout code - uses: actions/checkout@v2 + - name: Checkout code + uses: actions/checkout@v2 - - name: Set up Node.js - uses: actions/setup-node@v2 - with: - node-version: '18' + - name: Set up Node.js + uses: actions/setup-node@v2 + with: + node-version: "18" - - name: Install dependencies - run: npm ci + - name: Install dependencies + run: npm ci - - name: Run lint - run: npm run lint + - name: Run lint + run: npm run lint --quiet diff --git a/src/CAREUI/interactive/FiltersSlideover.tsx b/src/CAREUI/interactive/FiltersSlideover.tsx index f396f03da79..9b2e5a29c29 100644 --- a/src/CAREUI/interactive/FiltersSlideover.tsx +++ b/src/CAREUI/interactive/FiltersSlideover.tsx @@ -3,11 +3,12 @@ import useFilters from "../../Common/hooks/useFilters"; import ButtonV2 from "../../Components/Common/components/ButtonV2"; import CareIcon from "../icons/CareIcon"; import SlideOver from "./SlideOver"; +import { ReactNode } from "react"; type AdvancedFilter = ReturnType["advancedFilter"]; interface Props { - children: any; + children: ReactNode | ReactNode[]; advancedFilter: AdvancedFilter; onClear?: () => void; onApply?: () => void; diff --git a/src/Components/Assets/AssetImportModal.tsx b/src/Components/Assets/AssetImportModal.tsx index f8ab7cbc65f..02fe1d90265 100644 --- a/src/Components/Assets/AssetImportModal.tsx +++ b/src/Components/Assets/AssetImportModal.tsx @@ -33,24 +33,19 @@ const AssetImportModal = ({ open, onClose, facility }: Props) => { const [errors, setErrors] = useState({ location: "", }); - const [locations, setLocations] = useState([]); const { sample_format_asset_import } = useConfig(); - const [locationsLoading, setLocationsLoading] = useState(false); const closeModal = () => { setPreview(undefined); setSelectedFile(undefined); onClose && onClose(); }; - useQuery(routes.listFacilityAssetLocation, { + const { data, loading } = useQuery(routes.listFacilityAssetLocation, { pathParams: { facility_external_id: `${facility.id}` }, - onResponse: ({ res, data }) => { - if (res?.status === 200 && data) { - setLocations(data.results); - } - }, }); + const locations = data?.results || []; + useEffect(() => { const readFile = async () => { try { @@ -209,7 +204,7 @@ const AssetImportModal = ({ open, onClose, facility }: Props) => { fixedWidth={false} > {facility.name} - {!locationsLoading && locations.length === 0 ? ( + {!loading && locations.length === 0 ? ( <>

diff --git a/src/Components/Assets/AssetType/ONVIFCamera.tsx b/src/Components/Assets/AssetType/ONVIFCamera.tsx index eb6ebb9abfd..4a3a003d0a1 100644 --- a/src/Components/Assets/AssetType/ONVIFCamera.tsx +++ b/src/Components/Assets/AssetType/ONVIFCamera.tsx @@ -18,7 +18,6 @@ import useQuery from "../../../Utils/request/useQuery"; import CareIcon from "../../../CAREUI/icons/CareIcon"; - interface Props { assetId: string; facilityId: string; @@ -135,7 +134,7 @@ const ONVIFCamera = ({ assetId, facilityId, asset, onUpdated }: Props) => { } setLoadingAddPreset(false); }; - + if (isLoading || loading || !facility) return ; const fallbackMiddleware =