1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-08-03 04:45:21 +02:00

refactor(app): migrate configmap and secret form sections [EE-6233] (#10528)

* refactor(app): migrate configmap and secret form sections [EE-6233]
This commit is contained in:
Ali 2024-01-03 09:07:11 +13:00 committed by GitHub
parent 391b85da41
commit 7a2412b1be
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
18 changed files with 631 additions and 447 deletions

View file

@ -1,4 +1,4 @@
import { ConfigMapList } from 'kubernetes-types/core/v1';
import { ConfigMap, ConfigMapList } from 'kubernetes-types/core/v1';
import { useMutation, useQuery } from 'react-query';
import { queryClient, withError } from '@/react-tools/react-query';
@ -133,7 +133,11 @@ async function getConfigMaps(environmentId: EnvironmentId, namespace: string) {
const { data } = await axios.get<ConfigMapList>(
buildUrl(environmentId, namespace)
);
return data.items;
const configMapsWithKind: ConfigMap[] = data.items.map((configmap) => ({
...configmap,
kind: 'ConfigMap',
}));
return configMapsWithKind;
} catch (e) {
throw parseKubernetesAxiosError(e, 'Unable to retrieve ConfigMaps');
}

View file

@ -1,4 +1,4 @@
import { SecretList } from 'kubernetes-types/core/v1';
import { Secret, SecretList } from 'kubernetes-types/core/v1';
import { useMutation, useQuery } from 'react-query';
import { queryClient, withError } from '@/react-tools/react-query';
@ -129,7 +129,11 @@ async function getSecrets(environmentId: EnvironmentId, namespace: string) {
const { data } = await axios.get<SecretList>(
buildUrl(environmentId, namespace)
);
return data.items;
const secretsWithKind: Secret[] = data.items.map((secret) => ({
...secret,
kind: 'Secret',
}));
return secretsWithKind;
} catch (e) {
throw parseKubernetesAxiosError(e, 'Unable to retrieve secrets');
}