change limit
This commit is contained in:
@@ -22,12 +22,9 @@ function CorrelationsPageLegacy() {
|
||||
}
|
||||
|
||||
function CorrelationsPageAppPlatform() {
|
||||
// todo remove fake limit
|
||||
|
||||
const [page, setPage] = useState(1);
|
||||
let totalItems = useRef(0);
|
||||
|
||||
const limit = 10;
|
||||
const limit = 100;
|
||||
const { currentData, isLoading, error, remainingItems } = useCorrelationsK8s(limit, page);
|
||||
const [deleteCorrelation] = useDeleteCorrelationMutation();
|
||||
if (page === 1) {
|
||||
|
||||
@@ -3,7 +3,6 @@ import { lastValueFrom } from 'rxjs';
|
||||
|
||||
import { getDataSourceSrv, FetchResponse, CorrelationData, CorrelationsData } from '@grafana/runtime';
|
||||
import { useGrafana } from 'app/core/context/GrafanaContext';
|
||||
//import { dispatch } from 'app/store/store';
|
||||
|
||||
import {
|
||||
Correlation,
|
||||
@@ -95,7 +94,7 @@ export const useCorrelations = () => {
|
||||
return lastValueFrom(
|
||||
backend.fetch<CorrelationsResponse>({
|
||||
url: '/api/datasources/correlations',
|
||||
params: { page: params.page, limit: 10 }, // todo this is to force pagination for testing, remove
|
||||
params: { page: params.page },
|
||||
method: 'GET',
|
||||
showErrorAlert: false,
|
||||
})
|
||||
@@ -119,7 +118,6 @@ export const useCorrelations = () => {
|
||||
throw new Error('invalid sourceUID');
|
||||
}
|
||||
});
|
||||
// }
|
||||
},
|
||||
[backend]
|
||||
);
|
||||
|
||||
@@ -48,7 +48,7 @@ export const toEnrichedCorrelationDataK8s = (item: CorrelationK8s): CorrelationD
|
||||
};
|
||||
|
||||
// we're faking traditional pagination here, realistically folks shouldnt have enough correlations to see a performance impact but if they do we can change the ui
|
||||
export const useCorrelationsK8s = (limit: number, page: number) => {
|
||||
export const useCorrelationsK8s = (limit = 100, page: number) => {
|
||||
let pagedLimit = limit;
|
||||
if (page > 1) {
|
||||
pagedLimit = limit * page;
|
||||
|
||||
Reference in New Issue
Block a user