mirror of
https://github.com/portainer/portainer.git
synced 2025-07-23 23:39:41 +02:00
feat: add warning events count next to the status badge (#828)
This commit is contained in:
parent
f4df51884c
commit
1332f718ae
18 changed files with 120 additions and 37 deletions
|
@ -13,14 +13,21 @@ export function useNamespacesQuery<T = PortainerNamespace[]>(
|
|||
options?: {
|
||||
autoRefreshRate?: number;
|
||||
withResourceQuota?: boolean;
|
||||
withUnhealthyEvents?: boolean;
|
||||
select?: (namespaces: PortainerNamespace[]) => T;
|
||||
}
|
||||
) {
|
||||
return useQuery(
|
||||
queryKeys.list(environmentId, {
|
||||
withResourceQuota: !!options?.withResourceQuota,
|
||||
withUnhealthyEvents: !!options?.withUnhealthyEvents,
|
||||
}),
|
||||
async () => getNamespaces(environmentId, options?.withResourceQuota),
|
||||
async () =>
|
||||
getNamespaces(
|
||||
environmentId,
|
||||
options?.withResourceQuota,
|
||||
options?.withUnhealthyEvents
|
||||
),
|
||||
{
|
||||
...withGlobalError('Unable to get namespaces.'),
|
||||
refetchInterval() {
|
||||
|
@ -34,9 +41,13 @@ export function useNamespacesQuery<T = PortainerNamespace[]>(
|
|||
// getNamespaces is used to retrieve namespaces using the Portainer backend with caching
|
||||
export async function getNamespaces(
|
||||
environmentId: EnvironmentId,
|
||||
withResourceQuota?: boolean
|
||||
withResourceQuota?: boolean,
|
||||
withUnhealthyEvents?: boolean
|
||||
) {
|
||||
const params = withResourceQuota ? { withResourceQuota } : {};
|
||||
const params = {
|
||||
withResourceQuota,
|
||||
withUnhealthyEvents,
|
||||
};
|
||||
try {
|
||||
const { data: namespaces } = await axios.get<PortainerNamespace[]>(
|
||||
`kubernetes/${environmentId}/namespaces`,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue