mirror of
https://github.com/portainer/portainer.git
synced 2025-08-09 07:45:22 +02:00
refactor(nomad): sync frontend with EE [EE-3353] (#7758)
This commit is contained in:
parent
78dcba614d
commit
881e99df53
68 changed files with 1799 additions and 17 deletions
|
@ -22,6 +22,7 @@ import { useTags } from '@/portainer/tags/queries';
|
|||
import { useAgentVersionsList } from '@/react/portainer/environments/queries/useAgentVersionsList';
|
||||
import { EnvironmentsQueryParams } from '@/react/portainer/environments/environment.service';
|
||||
import { useUser } from '@/react/hooks/useUser';
|
||||
import { isBE } from '@/react/portainer/feature-flags/feature-flags.service';
|
||||
|
||||
import { TableFooter } from '@@/datatables/TableFooter';
|
||||
import { TableActions, TableContainer, TableTitle } from '@@/datatables';
|
||||
|
@ -350,6 +351,7 @@ export function EnvironmentList({ onClickItem, onRefresh }: Props) {
|
|||
EnvironmentType.AgentOnKubernetes,
|
||||
EnvironmentType.EdgeAgentOnKubernetes,
|
||||
],
|
||||
[PlatformType.Nomad]: [EnvironmentType.EdgeAgentOnNomad],
|
||||
};
|
||||
|
||||
const typesByConnection = {
|
||||
|
@ -475,6 +477,7 @@ function getConnectionTypeOptions(platformTypes: Filter<PlatformType>[]) {
|
|||
ConnectionType.EdgeAgent,
|
||||
ConnectionType.EdgeDevice,
|
||||
],
|
||||
[PlatformType.Nomad]: [ConnectionType.EdgeAgent, ConnectionType.EdgeDevice],
|
||||
};
|
||||
|
||||
const connectionTypesDefaultOptions = [
|
||||
|
@ -501,6 +504,13 @@ function getPlatformTypeOptions(connectionTypes: Filter<ConnectionType>[]) {
|
|||
{ value: PlatformType.Kubernetes, label: 'Kubernetes' },
|
||||
];
|
||||
|
||||
if (isBE) {
|
||||
platformDefaultOptions.push({
|
||||
value: PlatformType.Nomad,
|
||||
label: 'Nomad',
|
||||
});
|
||||
}
|
||||
|
||||
if (connectionTypes.length === 0) {
|
||||
return platformDefaultOptions;
|
||||
}
|
||||
|
@ -508,8 +518,16 @@ function getPlatformTypeOptions(connectionTypes: Filter<ConnectionType>[]) {
|
|||
const connectionTypePlatformType = {
|
||||
[ConnectionType.API]: [PlatformType.Docker, PlatformType.Azure],
|
||||
[ConnectionType.Agent]: [PlatformType.Docker, PlatformType.Kubernetes],
|
||||
[ConnectionType.EdgeAgent]: [PlatformType.Kubernetes, PlatformType.Docker],
|
||||
[ConnectionType.EdgeDevice]: [PlatformType.Docker, PlatformType.Kubernetes],
|
||||
[ConnectionType.EdgeAgent]: [
|
||||
PlatformType.Kubernetes,
|
||||
PlatformType.Nomad,
|
||||
PlatformType.Docker,
|
||||
],
|
||||
[ConnectionType.EdgeDevice]: [
|
||||
PlatformType.Nomad,
|
||||
PlatformType.Docker,
|
||||
PlatformType.Kubernetes,
|
||||
],
|
||||
};
|
||||
|
||||
return _.compact(
|
||||
|
|
|
@ -18,6 +18,8 @@ export enum EnvironmentType {
|
|||
AgentOnKubernetes,
|
||||
// EdgeAgentOnKubernetes represents an environment(endpoint) connected to an Edge agent deployed on a Kubernetes environment(endpoint)
|
||||
EdgeAgentOnKubernetes,
|
||||
// EdgeAgentOnNomad represents an environment(endpoint) connected to an Edge agent deployed on a Nomad environment(endpoint)
|
||||
EdgeAgentOnNomad,
|
||||
}
|
||||
|
||||
export const EdgeTypes = [
|
||||
|
@ -147,4 +149,5 @@ export enum PlatformType {
|
|||
Docker,
|
||||
Kubernetes,
|
||||
Azure,
|
||||
Nomad,
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@ import {
|
|||
import Docker from './docker.svg?c';
|
||||
import Azure from './azure.svg?c';
|
||||
import Kubernetes from './kubernetes.svg?c';
|
||||
import Nomad from './nomad.svg?c';
|
||||
|
||||
const icons: {
|
||||
[key in PlatformType]: SvgrComponent;
|
||||
|
@ -14,6 +15,7 @@ const icons: {
|
|||
[PlatformType.Docker]: Docker,
|
||||
[PlatformType.Kubernetes]: Kubernetes,
|
||||
[PlatformType.Azure]: Azure,
|
||||
[PlatformType.Nomad]: Nomad,
|
||||
};
|
||||
|
||||
export function getPlatformIcon(type: EnvironmentType) {
|
||||
|
|
|
@ -12,8 +12,10 @@ export function getPlatformType(envType: EnvironmentType) {
|
|||
return PlatformType.Docker;
|
||||
case EnvironmentType.Azure:
|
||||
return PlatformType.Azure;
|
||||
case EnvironmentType.EdgeAgentOnNomad:
|
||||
return PlatformType.Nomad;
|
||||
default:
|
||||
throw new Error(`${envType} is not a supported environment type`);
|
||||
throw new Error(`Environment Type ${envType} is not supported`);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -25,6 +27,14 @@ export function isKubernetesEnvironment(envType: EnvironmentType) {
|
|||
return getPlatformType(envType) === PlatformType.Kubernetes;
|
||||
}
|
||||
|
||||
export function getPlatformTypeName(envType: EnvironmentType): string {
|
||||
return PlatformType[getPlatformType(envType)];
|
||||
}
|
||||
|
||||
export function isNomadEnvironment(envType: EnvironmentType) {
|
||||
return getPlatformType(envType) === PlatformType.Nomad;
|
||||
}
|
||||
|
||||
export function isAgentEnvironment(envType: EnvironmentType) {
|
||||
return (
|
||||
isEdgeEnvironment(envType) ||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue