1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-08-02 20:35:25 +02:00

fix(kubernetes): deprecate old configurations api EE-5571 (#10837)

* fix(kubernetes): deprecate old configurations api EE-5571

* fix doc variable type
This commit is contained in:
Dakota Walsh 2023-12-15 09:04:08 +13:00 committed by GitHub
parent 0b9407f0a6
commit 0ddf84638f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 26 additions and 59 deletions

View file

@ -1,49 +0,0 @@
import { useQuery } from 'react-query';
import { EnvironmentId } from '@/react/portainer/environments/types';
import { error as notifyError } from '@/portainer/services/notifications';
import { withError } from '@/react-tools/react-query';
import { getConfigurations, getConfigMapsForCluster } from './service';
// returns a usequery hook for the formatted list of configmaps and secrets
export function useConfigurations(
environmentId: EnvironmentId,
namespace?: string
) {
return useQuery(
[
'environments',
environmentId,
'kubernetes',
'namespaces',
namespace,
'configurations',
],
() => (namespace ? getConfigurations(environmentId, namespace) : []),
{
onError: (err) => {
notifyError(
'Failure',
err as Error,
`Unable to get configurations for namespace ${namespace}`
);
},
enabled: !!namespace,
}
);
}
export function useConfigurationsForCluster(
environemtId: EnvironmentId,
namespaces?: string[]
) {
return useQuery(
['environments', environemtId, 'kubernetes', 'configurations'],
() => namespaces && getConfigMapsForCluster(environemtId, namespaces),
{
...withError('Unable to retrieve configurations for cluster'),
enabled: !!namespaces,
}
);
}