1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-08-09 15:55:23 +02:00

enable nodeport and load balancer type in ingresses

This commit is contained in:
Prabhat Khera 2023-05-31 12:27:00 +12:00
parent 96de026eba
commit eb815df8f4
2 changed files with 20 additions and 14 deletions

View file

@ -4,6 +4,7 @@ import { SelectHTMLAttributes } from 'react';
export interface Option<T extends string | number> { export interface Option<T extends string | number> {
value: T; value: T;
label: string; label: string;
disabled?: boolean;
} }
interface Props<T extends string | number> { interface Props<T extends string | number> {
@ -22,7 +23,7 @@ export function Select<T extends number | string>({
className={clsx('form-control', className)} className={clsx('form-control', className)}
> >
{options.map((item) => ( {options.map((item) => (
<option value={item.value} key={item.value}> <option value={item.value} key={item.value} disabled={item.disabled}>
{item.label} {item.label}
</option> </option>
))} ))}

View file

@ -1,7 +1,7 @@
import { useState, useEffect, useMemo, ReactNode, useCallback } from 'react'; import { useState, useEffect, useMemo, ReactNode, useCallback } from 'react';
import { useCurrentStateAndParams, useRouter } from '@uirouter/react'; import { useCurrentStateAndParams, useRouter } from '@uirouter/react';
import { v4 as uuidv4 } from 'uuid'; import { v4 as uuidv4 } from 'uuid';
import { debounce } from 'lodash'; import { debounce, groupBy, forOwn } from 'lodash';
import { useEnvironmentId } from '@/react/hooks/useEnvironmentId'; import { useEnvironmentId } from '@/react/hooks/useEnvironmentId';
import { useConfigurations } from '@/react/kubernetes/configs/queries'; import { useConfigurations } from '@/react/kubernetes/configs/queries';
@ -133,18 +133,23 @@ export function CreateIngressView() {
} }
}); });
const clusterIpServices = useMemo( const clusterIpServices = servicesResults.data;
() => servicesResults.data?.filter((s) => s.Type === 'ClusterIP'), const servicesOptions: Option<string>[] = useMemo(() => {
[servicesResults.data] const options: Option<string>[] = [];
); forOwn(
const servicesOptions = useMemo( groupBy(clusterIpServices, (s) => s.Type),
() => (services, type) => {
clusterIpServices?.map((service) => ({ options.push({ label: `--- ${type} ---`, value: type, disabled: true });
label: service.Name, services.forEach((service) => {
value: service.Name, options.push({
})), label: service.Name,
[clusterIpServices] value: service.Name,
); });
});
}
);
return options;
}, [clusterIpServices]);
const serviceOptions = [ const serviceOptions = [
{ label: 'Select a service', value: '' }, { label: 'Select a service', value: '' },