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

feat(ingress): ingresses datatable with add/edit ingresses EE-2615 (#7672)

This commit is contained in:
Prabhat Khera 2022-09-21 16:49:42 +12:00 committed by GitHub
parent 393d1fc91d
commit ef1d648c07
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
68 changed files with 4938 additions and 61 deletions

View file

@ -0,0 +1,29 @@
import { useQuery } from 'react-query';
import { EnvironmentId } from '@/portainer/environments/types';
import { error as notifyError } from '@/portainer/services/notifications';
import { getConfigMaps } from './service';
export function useConfigurations(
environmentId: EnvironmentId,
namespace?: string
) {
return useQuery(
[
'environments',
environmentId,
'kubernetes',
'namespaces',
namespace,
'configurations',
],
() => (namespace ? getConfigMaps(environmentId, namespace) : []),
{
onError: (err) => {
notifyError('Failure', err as Error, 'Unable to get configurations');
},
enabled: !!namespace,
}
);
}

View file

@ -0,0 +1,18 @@
import axios, { parseAxiosError } from '@/portainer/services/axios';
import { EnvironmentId } from '@/portainer/environments/types';
import { Configuration } from './types';
export async function getConfigMaps(
environmentId: EnvironmentId,
namespace: string
) {
try {
const { data: configmaps } = await axios.get<Configuration[]>(
`kubernetes/${environmentId}/namespaces/${namespace}/configmaps`
);
return configmaps;
} catch (e) {
throw parseAxiosError(e as Error, 'Unable to retrieve configmaps');
}
}

View file

@ -0,0 +1,17 @@
export interface Configuration {
Id: string;
Name: string;
Type: number;
Namespace: string;
CreationDate: Date;
ConfigurationOwner: string;
Used: boolean;
// Applications: any[];
Data: Document;
Yaml: string;
SecretType?: string;
IsRegistrySecret?: boolean;
}