Skip to content

Commit

Permalink
Merge pull request #914 from Arnei/filters-not-fetched
Browse files Browse the repository at this point in the history
Fix new filters not being loaded
  • Loading branch information
geichelberger authored Feb 26, 2025
2 parents 8e5d5c4 + b881f7d commit c57e8d2
Show file tree
Hide file tree
Showing 10 changed files with 11 additions and 53 deletions.
7 changes: 1 addition & 6 deletions src/components/configuration/Themes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import Header from "../Header";
import NavBar from "../NavBar";
import MainView from "../MainView";
import Footer from "../Footer";
import { getCurrentFilterResource } from "../../selectors/tableFilterSelectors";
import { useAppDispatch, useAppSelector } from "../../store";
import { fetchThemes } from "../../slices/themeSlice";

Expand All @@ -22,8 +21,6 @@ const Themes = () => {
const { t } = useTranslation();
const dispatch = useAppDispatch();

const currentFilterType = useAppSelector(state => getCurrentFilterResource(state));

const [displayNavigation, setNavigation] = useState(false);

const themes = useAppSelector(state => getTotalThemes(state));
Expand All @@ -37,9 +34,7 @@ const Themes = () => {
};

useEffect(() => {
if ("themes" !== currentFilterType) {
dispatch(fetchFilters("themes"));
}
dispatch(fetchFilters("themes"));

// Reset text filter
dispatch(editTextFilter(""));
Expand Down
6 changes: 1 addition & 5 deletions src/components/events/Events.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ import Footer from "../Footer";
import { getUserInformation } from "../../selectors/userInfoSelectors";
import { hasAccess } from "../../utils/utils";
import { availableHotkeys } from "../../configs/hotkeysConfig";
import { getCurrentFilterResource } from "../../selectors/tableFilterSelectors";
import { fetchAssetUploadOptions } from "../../thunks/assetsThunks";
import { useAppDispatch, useAppSelector } from "../../store";
import {
Expand All @@ -50,7 +49,6 @@ const Events = () => {
const { t } = useTranslation();
const dispatch = useAppDispatch();

const currentFilterType = useAppSelector(state => getCurrentFilterResource(state));
const displayEventDetailsModal = useAppSelector(state => showModal(state));

const [displayActionMenu, setActionMenu] = useState(false);
Expand All @@ -69,9 +67,7 @@ const Events = () => {
let location = useLocation();

useEffect(() => {
if ("events" !== currentFilterType) {
dispatch(fetchFilters("events"))
}
dispatch(fetchFilters("events"))

// Reset text filter
dispatch(editTextFilter(""));
Expand Down
8 changes: 2 additions & 6 deletions src/components/events/Series.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import MainView from "../MainView";
import Footer from "../Footer";
import { getUserInformation } from "../../selectors/userInfoSelectors";
import { hasAccess } from "../../utils/utils";
import { getCurrentFilterResource } from "../../selectors/tableFilterSelectors";
import { useAppDispatch, useAppSelector } from "../../store";
import {
fetchSeries,
Expand All @@ -45,18 +44,15 @@ const Series = () => {
const newSeriesModalRef = useRef<ModalHandle>(null);
const deleteModalRef = useRef<ModalHandle>(null);

const user = useAppSelector(state => getUserInformation(state));
const currentFilterType = useAppSelector(state => getCurrentFilterResource(state));
const user = useAppSelector(state => getUserInformation(state));

let location = useLocation();

const series = useAppSelector(state => getTotalSeries(state));
const showActions = useAppSelector(state => isShowActions(state));

useEffect(() => {
if ("series" !== currentFilterType) {
dispatch(fetchFilters("series"))
}
dispatch(fetchFilters("series"))

// Reset text filer
dispatch(editTextFilter(""));
Expand Down
6 changes: 1 addition & 5 deletions src/components/recordings/Recordings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import Header from "../Header";
import NavBar from "../NavBar";
import MainView from "../MainView";
import Footer from "../Footer";
import { getCurrentFilterResource } from "../../selectors/tableFilterSelectors";
import { useAppDispatch, useAppSelector } from "../../store";
import { fetchRecordings } from "../../slices/recordingSlice";
import { AsyncThunk } from "@reduxjs/toolkit";
Expand All @@ -24,7 +23,6 @@ const Recordings = () => {
const dispatch = useAppDispatch();
const [displayNavigation, setNavigation] = useState(false);

const currentFilterType = useAppSelector(state => getCurrentFilterResource(state));
const recordings = useAppSelector(state => getTotalRecordings(state));

const loadRecordings = async () => {
Expand All @@ -36,9 +34,7 @@ const Recordings = () => {
};

useEffect(() => {
if ("recordings" !== currentFilterType) {
dispatch(fetchFilters("recordings"));
}
dispatch(fetchFilters("recordings"));

// Reset text filter
dispatch(editTextFilter(""));
Expand Down
6 changes: 1 addition & 5 deletions src/components/systems/Jobs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import Header from "../Header";
import NavBar from "../NavBar";
import MainView from "../MainView";
import Footer from "../Footer";
import { getCurrentFilterResource } from "../../selectors/tableFilterSelectors";
import { useAppDispatch, useAppSelector } from "../../store";
import { fetchJobs } from "../../slices/jobSlice";
import { loadJobs, systemsLinks } from "./partials/SystemsNavigation";
Expand All @@ -26,13 +25,10 @@ const Jobs = () => {
const dispatch = useAppDispatch();
const [displayNavigation, setNavigation] = useState(false);

const currentFilterType = useAppSelector(state => getCurrentFilterResource(state));
const jobs = useAppSelector(state => getTotalJobs(state));

useEffect(() => {
if ("jobs" !== currentFilterType) {
dispatch(fetchFilters("jobs"));
}
dispatch(fetchFilters("jobs"));

// Reset text filter
dispatch(editTextFilter(""));
Expand Down
6 changes: 1 addition & 5 deletions src/components/systems/Servers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import Header from "../Header";
import NavBar from "../NavBar";
import MainView from "../MainView";
import Footer from "../Footer";
import { getCurrentFilterResource } from "../../selectors/tableFilterSelectors";
import { useAppDispatch, useAppSelector } from "../../store";
import { fetchServers } from "../../slices/serverSlice";
import { loadServers, systemsLinks } from "./partials/SystemsNavigation";
Expand All @@ -26,13 +25,10 @@ const Servers = () => {
const dispatch = useAppDispatch();
const [displayNavigation, setNavigation] = useState(false);

const currentFilterType = useAppSelector(state => getCurrentFilterResource(state));
const servers = useAppSelector(state => getTotalServers(state));

useEffect(() => {
if ("servers" !== currentFilterType) {
dispatch(fetchFilters("servers"));
}
dispatch(fetchFilters("servers"));

// Reset text filter
dispatch(editTextFilter(""));
Expand Down
6 changes: 1 addition & 5 deletions src/components/systems/Services.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import Header from "../Header";
import NavBar from "../NavBar";
import MainView from "../MainView";
import Footer from "../Footer";
import { getCurrentFilterResource } from "../../selectors/tableFilterSelectors";
import { useAppDispatch, useAppSelector } from "../../store";
import { fetchServices } from "../../slices/serviceSlice";
import { loadServices, systemsLinks } from "./partials/SystemsNavigation";
Expand All @@ -26,13 +25,10 @@ const Services = () => {
const dispatch = useAppDispatch();
const [displayNavigation, setNavigation] = useState(false);

const currentFilterType = useAppSelector(state => getCurrentFilterResource(state));
const services = useAppSelector(state => getTotalServices(state));

useEffect(() => {
if ("services" !== currentFilterType) {
dispatch(fetchFilters("services"));
}
dispatch(fetchFilters("services"));

// Reset text filter
dispatch(editTextFilter(""));
Expand Down
6 changes: 1 addition & 5 deletions src/components/users/Acls.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import Header from "../Header";
import NavBar from "../NavBar";
import MainView from "../MainView";
import Footer from "../Footer";
import { getCurrentFilterResource } from "../../selectors/tableFilterSelectors";
import { useAppDispatch, useAppSelector } from "../../store";
import { fetchAcls } from "../../slices/aclSlice";
import { loadAcls, usersLinks } from "./partials/UsersNavigation";
Expand All @@ -27,12 +26,9 @@ const Acls = () => {

const dispatch = useAppDispatch();
const acls = useAppSelector(state => getTotalAcls(state));
const currentFilterType = useAppSelector(state => getCurrentFilterResource(state));

useEffect(() => {
if ("acls" !== currentFilterType) {
dispatch(fetchFilters("acls"));
}
dispatch(fetchFilters("acls"));

// Reset text filter
dispatch(editTextFilter(""));
Expand Down
6 changes: 1 addition & 5 deletions src/components/users/Groups.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import Header from "../Header";
import NavBar from "../NavBar";
import MainView from "../MainView";
import Footer from "../Footer";
import { getCurrentFilterResource } from "../../selectors/tableFilterSelectors";
import { useAppDispatch, useAppSelector } from "../../store";
import { fetchGroups } from "../../slices/groupSlice";
import { loadGroups, usersLinks } from "./partials/UsersNavigation";
Expand All @@ -27,12 +26,9 @@ const Groups = () => {
const [displayNavigation, setNavigation] = useState(false);

const groups = useAppSelector(state => getTotalGroups(state));
const currentFilterType = useAppSelector(state => getCurrentFilterResource(state));

useEffect(() => {
if ("groups" !== currentFilterType) {
dispatch(fetchFilters("groups"));
}
dispatch(fetchFilters("groups"));

// Reset text filter
dispatch(editTextFilter(""));
Expand Down
7 changes: 1 addition & 6 deletions src/components/users/Users.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ import Header from "../Header";
import NavBar from "../NavBar";
import MainView from "../MainView";
import Footer from "../Footer";

import { getCurrentFilterResource } from "../../selectors/tableFilterSelectors";
import { useAppDispatch, useAppSelector } from "../../store";
import { fetchUsers } from "../../slices/userSlice";
import { loadUsers, usersLinks } from "./partials/UsersNavigation";
Expand All @@ -28,12 +26,9 @@ const Users = () => {
const [displayNavigation, setNavigation] = useState(false);

const users = useAppSelector(state => getTotalUsers(state));
const currentFilterType = useAppSelector(state => getCurrentFilterResource(state));

useEffect(() => {
if ("users" !== currentFilterType) {
dispatch(fetchFilters("users"));
}
dispatch(fetchFilters("users"));

// Reset text filter
dispatch(editTextFilter(""));
Expand Down

0 comments on commit c57e8d2

Please sign in to comment.