1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-07-19 13:29:41 +02:00

feat(helm): helm actions [r8s-259] (#715)

Co-authored-by: James Player <james.player@portainer.io>
Co-authored-by: Cara Ryan <cara.ryan@portainer.io>
Co-authored-by: stevensbkang <skan070@gmail.com>
This commit is contained in:
Ali 2025-05-13 22:15:04 +12:00 committed by GitHub
parent dfa32b6755
commit 4ee349bd6b
117 changed files with 4161 additions and 696 deletions

View file

@ -1,5 +1,6 @@
import { useCurrentStateAndParams } from '@uirouter/react';
import { useMemo } from 'react';
import { compact } from 'lodash';
import { createStore } from '@/react/kubernetes/datatables/default-kube-datatable-store';
import { EnvironmentId } from '@/react/portainer/environments/types';
@ -74,36 +75,32 @@ export function useApplicationEvents(
application
);
// related events are events that have the application id, or the id of a service or pod from the application
const relatedUids = useMemo(() => {
const serviceIds = compact(
servicesQuery.data?.map((service) => service?.metadata?.uid)
);
const podIds = compact(podsQuery.data?.map((pod) => pod?.metadata?.uid));
return [application?.metadata?.uid, ...serviceIds, ...podIds];
}, [application?.metadata?.uid, podsQuery.data, servicesQuery.data]);
const relatedUidsSet = useMemo(() => new Set(relatedUids), [relatedUids]);
const { data: events, ...eventsQuery } = useEvents(environmentId, {
namespace,
queryOptions: {
autoRefreshRate: options?.autoRefreshRate
? options.autoRefreshRate * 1000
: undefined,
select: (data) =>
data.filter((event) => relatedUidsSet.has(event.involvedObject.uid)),
},
});
// related events are events that have the application id, or the id of a service or pod from the application
const relatedEvents = useMemo(() => {
const serviceIds = servicesQuery.data?.map(
(service) => service?.metadata?.uid
);
const podIds = podsQuery.data?.map((pod) => pod?.metadata?.uid);
return (
events?.filter(
(event) =>
event.involvedObject.uid === application?.metadata?.uid ||
serviceIds?.includes(event.involvedObject.uid) ||
podIds?.includes(event.involvedObject.uid)
) || []
);
}, [application?.metadata?.uid, events, podsQuery.data, servicesQuery.data]);
const isInitialLoading =
applicationQuery.isInitialLoading ||
servicesQuery.isInitialLoading ||
podsQuery.isInitialLoading ||
eventsQuery.isInitialLoading;
return { relatedEvents, isInitialLoading };
return { relatedEvents: events || [], isInitialLoading };
}