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:
parent
dfa32b6755
commit
4ee349bd6b
117 changed files with 4161 additions and 696 deletions
|
@ -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 };
|
||||
}
|
||||
|
|
|
@ -96,6 +96,7 @@ export function ApplicationsDatatable({
|
|||
item={row.original}
|
||||
hideStacks={hideStacks}
|
||||
areSecretsRestricted={!!restrictSecretsQuery.data}
|
||||
selectDisabled={!hasWriteAuth}
|
||||
/>
|
||||
)}
|
||||
renderTableActions={(selectedItems) =>
|
||||
|
|
|
@ -11,19 +11,22 @@ export function SubRow({
|
|||
item,
|
||||
hideStacks,
|
||||
areSecretsRestricted,
|
||||
selectDisabled,
|
||||
}: {
|
||||
item: ApplicationRowData;
|
||||
hideStacks: boolean;
|
||||
areSecretsRestricted: boolean;
|
||||
selectDisabled: boolean;
|
||||
}) {
|
||||
const {
|
||||
user: { Username: username },
|
||||
} = useCurrentUser();
|
||||
const colSpan = hideStacks ? 7 : 8;
|
||||
const alignColSpan = selectDisabled ? 1 : 2;
|
||||
|
||||
return (
|
||||
<tr className={clsx({ 'secondary-body': !item.KubernetesApplications })}>
|
||||
<td colSpan={2} />
|
||||
<td colSpan={alignColSpan} />
|
||||
<td colSpan={colSpan} className="datatable-padding-vertical">
|
||||
{item.KubernetesApplications ? (
|
||||
<InnerTable
|
||||
|
|
|
@ -35,7 +35,7 @@ export function EditYamlFormSection({
|
|||
titleContent={<TitleContent isComposeFormat={isComposeFormat} />}
|
||||
onChange={(values) => onChange(values)}
|
||||
id={formId}
|
||||
placeholder="Define or paste the content of your manifest file here"
|
||||
textTip="Define or paste the content of your manifest file here"
|
||||
type="yaml"
|
||||
/>
|
||||
</div>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue