Skip to content

Commit

Permalink
fix: pages periodic refresh and Smart Proxy service fix (#177)
Browse files Browse the repository at this point in the history
* fix: Refresh pages and smartproxy fix

* fix: refresh for clusterList and RecsList pages and smart proxy fix
  • Loading branch information
Fewwy authored Mar 15, 2022
1 parent 3394e73 commit 50212ae
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 3 deletions.
4 changes: 3 additions & 1 deletion src/Components/ClustersListTable/ClustersListTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ import {
} from '../MessageState/EmptyStates';

const ClustersListTable = ({
query: { isError, isUninitialized, isFetching, isSuccess, data },
query: { isError, isUninitialized, isFetching, isSuccess, data, refetch },
}) => {
const intl = useIntl();
const dispatch = useDispatch();
Expand Down Expand Up @@ -105,6 +105,8 @@ const ClustersListTable = ({
);
};

useEffect(() => setInterval(() => refetch(), 20000), []);

const removeFilterParam = (param) => {
const { [param]: omitted, ...newFilters } = { ...filters, offset: 0 };
updateFilters({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ describe('clusters list table', () => {
isUninitialized: false,
isSuccess: true,
data: props,
refetch: cy.stub(),
}}
/>
</Provider>
Expand Down
2 changes: 2 additions & 0 deletions src/Components/RecsListTable/RecsListTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,8 @@ const RecsListTable = ({ query }) => {
setFilterBuilding(false);
}, []);

useEffect(() => setInterval(() => refetch(), 20000), []);

// constructs array of rows (from the initial data) checking currently applied filters
const buildFilteredRows = (allRows, filters) => {
return allRows
Expand Down
3 changes: 1 addition & 2 deletions src/Services/SmartProxy.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export const SmartProxyApi = createApi({
baseUrl: BASE_URL,
}),
refetchOnReconnect: true,
refetchOnMountOrArgChange: 3,
endpoints: (builder) => ({
getClusterById: builder.query({
query: ({ id, includeDisabled }) =>
Expand All @@ -23,7 +24,6 @@ export const SmartProxyApi = createApi({
}),
getRecs: builder.query({
query: () => `v2/rule`,
keepUnusedDataFor: 5,
}),
getClusters: builder.query({
query: () => `v2/clusters`,
Expand All @@ -32,7 +32,6 @@ export const SmartProxyApi = createApi({
data: response.data.filter((element) => element.cluster_id !== ''),
};
},
keepUnusedDataFor: 5,
}),
}),
});
Expand Down

0 comments on commit 50212ae

Please sign in to comment.