diff --git a/packages/core/admin/admin/src/content-manager/components/DynamicTable/CellContent/Relation/index.js b/packages/core/admin/admin/src/content-manager/components/DynamicTable/CellContent/Relation/index.js index cc20ea288d..d8193efafe 100644 --- a/packages/core/admin/admin/src/content-manager/components/DynamicTable/CellContent/Relation/index.js +++ b/packages/core/admin/admin/src/content-manager/components/DynamicTable/CellContent/Relation/index.js @@ -69,7 +69,7 @@ const Relation = ({ fieldSchema, metadatas, queryInfos, name, rowId, value }) => icon={} /> {visible && ( - + { const [{ rawQuery, query }, setQuery] = useQueryParams(); const dataRequestURL = getRequestUrl('files'); - const { data, error, isLoading } = useQuery( - 'assets', - async () => { - const { data } = await axiosInstance.get(`${dataRequestURL}${rawQuery}`); + const getAssets = async () => { + const { data } = await axiosInstance.get(`${dataRequestURL}${rawQuery}`); - return data; - }, - { enabled: !skipWhen } - ); + return data; + }; + + const { data, error, isLoading } = useQuery(`assets`, getAssets, { + enabled: !skipWhen, + staleTime: 0, + cacheTime: 0, + }); useEffect(() => { if (!query) { diff --git a/packages/core/upload/admin/src/pages/App/components/Filters.js b/packages/core/upload/admin/src/pages/App/components/Filters.js new file mode 100644 index 0000000000..96675a2d42 --- /dev/null +++ b/packages/core/upload/admin/src/pages/App/components/Filters.js @@ -0,0 +1,61 @@ +import React, { useState, useRef } from 'react'; +import { Button } from '@strapi/parts/Button'; +import { FilterPopoverURLQuery } from '@strapi/helper-plugin'; +import FilterIcon from '@strapi/icons/FilterIcon'; +import { useIntl } from 'react-intl'; + +const displayedFilters = [ + { + name: 'created_at', + fieldSchema: { + type: 'date', + }, + metadatas: { label: 'created_at' }, + }, + { + name: 'updated_at', + fieldSchema: { + type: 'date', + }, + metadatas: { label: 'updated_at' }, + }, + { + name: 'type', + fieldSchema: { + type: 'enumeration', + options: ['image', 'video', 'file'], + }, + metadatas: { label: 'type' }, + }, +]; + +export const Filters = () => { + const buttonRef = useRef(null); + const [isVisible, setVisible] = useState(false); + const { formatMessage } = useIntl(); + + const toggleFilter = () => setVisible(prev => !prev); + + return ( + <> + + + {isVisible && ( + + )} + + ); +}; diff --git a/packages/core/upload/admin/src/pages/App/index.js b/packages/core/upload/admin/src/pages/App/index.js index c7de6a6229..766581bb15 100644 --- a/packages/core/upload/admin/src/pages/App/index.js +++ b/packages/core/upload/admin/src/pages/App/index.js @@ -22,6 +22,7 @@ import { ListView } from './components/ListView'; import { useAssets } from '../../hooks/useAssets'; import { getTrad } from '../../utils'; import pluginPermissions from '../../permissions'; +import { Filters } from './components/Filters'; const BoxWithHeight = styled(Box)` height: ${32 / 16}rem; @@ -94,7 +95,7 @@ const App = () => { })} /> - + } endActions={ diff --git a/packages/plugins/i18n/admin/src/components/LocaleListCell/LocaleListCell.js b/packages/plugins/i18n/admin/src/components/LocaleListCell/LocaleListCell.js index f891361995..d58ddc7534 100644 --- a/packages/plugins/i18n/admin/src/components/LocaleListCell/LocaleListCell.js +++ b/packages/plugins/i18n/admin/src/components/LocaleListCell/LocaleListCell.js @@ -88,7 +88,7 @@ const LocaleListCell = ({ localizations, locale: currentLocaleCode, id }) => { icon={} /> {visible && ( - +
    {localesArray.map(name => ( diff --git a/yarn.lock b/yarn.lock index b1227e71c4..a9769e0a69 100644 --- a/yarn.lock +++ b/yarn.lock @@ -20159,10 +20159,10 @@ react-portal@^4.2.0: dependencies: prop-types "^15.5.8" -react-query@3.19.0: - version "3.19.0" - resolved "https://registry.yarnpkg.com/react-query/-/react-query-3.19.0.tgz#e1fe8f62b9956fb2986317686c27f79ad7ee4e7e" - integrity sha512-AaerSVsmBG2iIciwX2x8cWZS4Htw/4u2GFTYK8oiicpX3PY5mvat/8/Y3wZhM47KlllAzvC+P9MW81oHuEt2wg== +react-query@3.24.3: + version "3.24.3" + resolved "https://registry.yarnpkg.com/react-query/-/react-query-3.24.3.tgz#58c538fb55386fa947bda88acbe616e02cb5b2bb" + integrity sha512-JipKpn7XoDVvRWwXWXKSJU5SbNJKqspx9IRBntaQt1EQOBXe9314Z/8cV9YXXbZIhzrHAetT3X7tRClZaYk98g== dependencies: "@babel/runtime" "^7.5.5" broadcast-channel "^3.4.1"