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

feat(nomad): remove nomad from UI EE-6060 (#10509)

This commit is contained in:
matias-portainer 2023-10-31 15:27:20 -03:00 committed by GitHub
parent 1140804fe9
commit 8bb5129be0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
110 changed files with 39 additions and 1813 deletions

View file

@ -6,7 +6,6 @@ import { getPlatformType } from '@/react/portainer/environments/utils';
import { EnvironmentStatsDocker } from './EnvironmentStatsDocker';
import { EnvironmentStatsKubernetes } from './EnvironmentStatsKubernetes';
import { EnvironmentStatsNomad } from './EnvironmentStatsNomad';
interface Props {
environment: Environment;
@ -34,10 +33,6 @@ function getComponent(platform: PlatformType, environment: Environment) {
);
case PlatformType.Docker:
return <EnvironmentStatsDocker snapshot={environment.Snapshots?.[0]} />;
case PlatformType.Nomad:
return (
<EnvironmentStatsNomad snapshot={environment.Nomad.Snapshots?.[0]} />
);
default:
return null;
}

View file

@ -1,44 +0,0 @@
import { Box, Dice4, HardDrive, List, Power } from 'lucide-react';
import { NomadSnapshot } from '@/react/portainer/environments/types';
import { addPlural } from '@/portainer/helpers/strings';
import { StatsItem } from '@@/StatsItem';
interface Props {
snapshot?: NomadSnapshot;
}
export function EnvironmentStatsNomad({ snapshot }: Props) {
if (!snapshot) {
return <>No snapshot available</>;
}
return (
<>
<StatsItem value={addPlural(snapshot.JobCount, 'job')} icon={List} />
<StatsItem value={addPlural(snapshot.GroupCount, 'group')} icon={Dice4} />
<StatsItem value={addPlural(snapshot.TaskCount, 'task')} icon={Box}>
{snapshot.TaskCount > 0 && (
<>
<StatsItem
value={snapshot.RunningTaskCount}
icon={Power}
iconClass="icon-success"
/>
<StatsItem
value={snapshot.TaskCount - snapshot.RunningTaskCount}
icon={Power}
iconClass="icon-danger"
/>
</>
)}
</StatsItem>
<StatsItem
value={addPlural(snapshot.NodeCount, 'node')}
icon={HardDrive}
/>
</>
);
}

View file

@ -268,7 +268,6 @@ export function EnvironmentList({ onClickBrowse, onRefresh }: Props) {
EnvironmentType.AgentOnKubernetes,
EnvironmentType.EdgeAgentOnKubernetes,
],
[PlatformType.Nomad]: [EnvironmentType.EdgeAgentOnNomad],
};
const typesByConnection = {

View file

@ -4,7 +4,6 @@ import { useTags } from '@/portainer/tags/queries';
import { useAgentVersionsList } from '../../environments/queries/useAgentVersionsList';
import { EnvironmentStatus, PlatformType } from '../../environments/types';
import { isBE } from '../../feature-flags/feature-flags.service';
import { useGroups } from '../../environments/environment-groups/queries';
import {
SortOptions,
@ -188,10 +187,6 @@ function getConnectionTypeOptions(platformTypes: PlatformType[]) {
ConnectionType.EdgeAgentStandard,
ConnectionType.EdgeAgentAsync,
],
[PlatformType.Nomad]: [
ConnectionType.EdgeAgentStandard,
ConnectionType.EdgeAgentAsync,
],
};
const connectionTypesDefaultOptions = [
@ -219,13 +214,6 @@ function getPlatformTypeOptions(connectionTypes: ConnectionType[]) {
{ value: PlatformType.Kubernetes, label: 'Kubernetes' },
];
if (isBE) {
platformDefaultOptions.push({
value: PlatformType.Nomad,
label: 'Nomad',
});
}
if (connectionTypes.length === 0) {
return platformDefaultOptions;
}
@ -235,11 +223,9 @@ function getPlatformTypeOptions(connectionTypes: ConnectionType[]) {
[ConnectionType.Agent]: [PlatformType.Docker, PlatformType.Kubernetes],
[ConnectionType.EdgeAgentStandard]: [
PlatformType.Kubernetes,
PlatformType.Nomad,
PlatformType.Docker,
],
[ConnectionType.EdgeAgentAsync]: [
PlatformType.Nomad,
PlatformType.Docker,
PlatformType.Kubernetes,
],

View file

@ -23,7 +23,6 @@ const commands = {
commandsTabs.k8sLinux,
commandsTabs.swarmLinux,
commandsTabs.standaloneLinux,
commandsTabs.nomadLinux,
],
win: [commandsTabs.swarmWindows, commandsTabs.standaloneWindow],
};
@ -156,7 +155,6 @@ function EdgeKeyInfo({
<EdgeScriptForm
edgeInfo={{ key: edgeKey }}
commands={commands}
isNomadTokenVisible
asyncMode={asyncMode}
showMetaFields
>

View file

@ -2,7 +2,7 @@ import { useQuery } from 'react-query';
import { withError } from '@/react-tools/react-query';
import { EnvironmentStatus } from '../types';
import { EnvironmentStatus, EnvironmentType } from '../types';
import {
EnvironmentsQueryParams,
getEnvironments,
@ -71,6 +71,24 @@ export function useEnvironmentList(
],
async () => {
const start = (page - 1) * pageLimit + 1;
// Workaround for EE-6060: filter out Nomad results when no filter is applied.
// Remove when cleaning up API.
if (!query.types || query.types.length === 0) {
const environmentTypesArray: EnvironmentType[] = [
EnvironmentType.Docker,
EnvironmentType.AgentOnDocker,
EnvironmentType.Azure,
EnvironmentType.EdgeAgentOnDocker,
EnvironmentType.KubernetesLocal,
EnvironmentType.AgentOnKubernetes,
EnvironmentType.EdgeAgentOnKubernetes,
];
// eslint-disable-next-line no-param-reassign
query.types = environmentTypesArray;
}
return getEnvironments({
start,
limit: pageLimit,

View file

@ -1,6 +1,5 @@
import { TagId } from '@/portainer/tags/types';
import { EnvironmentGroupId } from '@/react/portainer/environments/environment-groups/types';
import { Job } from '@/react/nomad/types';
import { DockerSnapshot } from '@/react/docker/snapshots/types';
export type EnvironmentId = number;
@ -20,14 +19,11 @@ 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 = [
EnvironmentType.EdgeAgentOnDocker,
EnvironmentType.EdgeAgentOnKubernetes,
EnvironmentType.EdgeAgentOnNomad,
] as const;
export enum EnvironmentStatus {
@ -75,20 +71,6 @@ export interface KubernetesSettings {
Configuration: KubernetesConfiguration;
}
export interface NomadSnapshot {
JobCount: number;
GroupCount: number;
TaskCount: number;
RunningTaskCount: number;
NodeCount: number;
Time: number;
Jobs: Job[];
}
export interface NomadSettings {
Snapshots: NomadSnapshot[];
}
export type EnvironmentEdge = {
AsyncMode: boolean;
PingInterval: number;
@ -156,7 +138,6 @@ export type Environment = {
URL: string;
Snapshots: DockerSnapshot[];
Kubernetes: KubernetesSettings;
Nomad: NomadSettings;
PublicURL?: string;
UserTrusted: boolean;
AMTDeviceGUID?: string;
@ -190,5 +171,4 @@ export enum PlatformType {
Docker,
Kubernetes,
Azure,
Nomad,
}

View file

@ -58,7 +58,7 @@ function CreateView() {
<BetaAlert
className="mb-2 ml-[15px]"
message="Beta feature - currently limited to standalone Linux and Nomad edge devices."
message="Beta feature - currently limited to standalone Linux edge devices."
/>
<div className="row">

View file

@ -82,7 +82,7 @@ function ItemView() {
<BetaAlert
className="mb-2 ml-[15px]"
message="Beta feature - currently limited to standalone Linux and Nomad edge devices."
message="Beta feature - currently limited to standalone Linux edge devices."
/>
<div className="row">

View file

@ -62,7 +62,7 @@ export function ListView() {
<BetaAlert
className="mb-2 ml-[15px]"
message="Beta feature - currently limited to standalone Linux and Nomad edge devices."
message="Beta feature - currently limited to standalone Linux edge devices."
/>
<Datatable

View file

@ -7,7 +7,6 @@ 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;
@ -15,7 +14,6 @@ const icons: {
[PlatformType.Docker]: Docker,
[PlatformType.Kubernetes]: Kubernetes,
[PlatformType.Azure]: Azure,
[PlatformType.Nomad]: Nomad,
};
export function getPlatformIcon(type: EnvironmentType) {

View file

@ -12,8 +12,6 @@ export function getPlatformType(envType: EnvironmentType) {
return PlatformType.Docker;
case EnvironmentType.Azure:
return PlatformType.Azure;
case EnvironmentType.EdgeAgentOnNomad:
return PlatformType.Nomad;
default:
throw new Error(`Environment Type ${envType} is not supported`);
}
@ -31,10 +29,6 @@ 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) ||
@ -105,8 +99,6 @@ export function getDashboardRoute(environment: Environment) {
return 'docker.dashboard';
case PlatformType.Kubernetes:
return 'kubernetes.dashboard';
case PlatformType.Nomad:
return 'nomad.dashboard';
default:
throw new Error(`Unsupported platform ${platform}`);
}

View file

@ -2,7 +2,6 @@ import { FeatureId } from '@/react/portainer/feature-flags/enums';
import Docker from '@/assets/ico/vendor/docker.svg?c';
import Kubernetes from '@/assets/ico/vendor/kubernetes.svg?c';
import Azure from '@/assets/ico/vendor/azure.svg?c';
import Nomad from '@/assets/ico/vendor/nomad.svg?c';
import KaaS from '@/assets/ico/vendor/kaas-icon.svg?c';
import InstallK8s from '@/assets/ico/vendor/install-kubernetes.svg?c';
@ -13,7 +12,6 @@ export type EnvironmentOptionValue =
| 'dockerSwarm'
| 'kubernetes'
| 'aci'
| 'nomad'
| 'kaas'
| 'k8sInstall';
@ -56,16 +54,6 @@ export const existingEnvironmentTypes: EnvironmentOption[] = [
iconType: 'logo',
icon: Azure,
},
{
id: 'nomad',
value: 'nomad',
label: 'Nomad',
description: 'Connect to HashiCorp Nomad environment via API',
icon: Nomad,
iconType: 'logo',
feature: FeatureId.NOMAD,
disabledWhenLimited: true,
},
];
export const newEnvironmentTypes: EnvironmentOption[] = [
@ -102,7 +90,6 @@ export const formTitles: Record<EnvironmentOptionValue, string> = {
dockerSwarm: 'Connect to your Docker Swarm environment',
kubernetes: 'Connect to your Kubernetes environment',
aci: 'Connect to your ACI environment',
nomad: 'Connect to your Nomad environment',
kaas: 'Provision a KaaS environment',
k8sInstall: 'Create a Kubernetes cluster',
};

View file

@ -210,7 +210,6 @@ function useAnalyticsState() {
kaasAgent: 0,
aciApi: 0,
localEndpoint: 0,
nomadEdgeAgentStandard: 0,
dockerEdgeAgentAsync: 0,
dockerEdgeAgentStandard: 0,
});

View file

@ -14,16 +14,10 @@ import { EdgeAgentForm } from './EdgeAgentForm';
interface Props {
onCreate: (environment: Environment) => void;
commands: CommandTab[] | Partial<Record<OS, CommandTab[]>>;
isNomadTokenVisible?: boolean;
asyncMode?: boolean;
}
export function EdgeAgentTab({
onCreate,
commands,
isNomadTokenVisible,
asyncMode = false,
}: Props) {
export function EdgeAgentTab({ onCreate, commands, asyncMode = false }: Props) {
const [edgeInfo, setEdgeInfo] = useState<EdgeInfo>();
const [formKey, clearForm] = useReducer((state) => state + 1, 0);
@ -49,7 +43,6 @@ export function EdgeAgentTab({
<EdgeScriptForm
edgeInfo={edgeInfo}
commands={commands}
isNomadTokenVisible={isNomadTokenVisible}
asyncMode={asyncMode}
/>

View file

@ -9,7 +9,6 @@ export interface AnalyticsState {
kaasAgent: number;
aciApi: number;
localEndpoint: number;
nomadEdgeAgentStandard: number;
}
export type AnalyticsStateKey = keyof AnalyticsState;

View file

@ -15,7 +15,6 @@ export enum FeatureId {
K8S_CREATE_FROM_KUBECONFIG = 'k8s-create-from-kubeconfig',
K8S_EDIT_YAML = 'k8s-edit-yaml',
KAAS_PROVISIONING = 'kaas-provisioning',
NOMAD = 'nomad',
RBAC_ROLES = 'rbac-roles',
REGISTRY_MANAGEMENT = 'registry-management',
K8S_SETUP_DEFAULT = 'k8s-setup-default',

View file

@ -20,7 +20,6 @@ export async function init(edition: Edition) {
[FeatureId.K8S_CREATE_FROM_KUBECONFIG]: Edition.BE,
[FeatureId.KAAS_PROVISIONING]: Edition.BE,
[FeatureId.K8SINSTALL]: Edition.BE,
[FeatureId.NOMAD]: Edition.BE,
[FeatureId.ACTIVITY_AUDIT]: Edition.BE,
[FeatureId.EXTERNAL_AUTH_LDAP]: Edition.BE,
[FeatureId.HIDE_INTERNAL_AUTH]: Edition.BE,

View file

@ -48,7 +48,7 @@ interface Args {
isAdditionalFilesFieldVisible: boolean;
isAuthExplanationVisible: boolean;
isDockerStandalone: boolean;
deployMethod: 'compose' | 'nomad' | 'manifest';
deployMethod: 'compose' | 'manifest';
isForcePullVisible: boolean;
}

View file

@ -23,7 +23,7 @@ interface Props {
value: GitFormModel;
onChange: (value: Partial<GitFormModel>) => void;
environmentType?: 'DOCKER' | 'KUBERNETES' | undefined;
deployMethod?: 'compose' | 'nomad' | 'manifest';
deployMethod?: 'compose' | 'manifest';
isDockerStandalone?: boolean;
isAdditionalFilesFieldVisible?: boolean;
isForcePullVisible?: boolean;

View file

@ -12,8 +12,7 @@ export type ContainerPlatform =
| 'Docker Standalone'
| 'Docker Swarm'
| 'Kubernetes'
| 'Podman'
| 'Nomad';
| 'Podman';
export interface SystemInfoResponse {
platform: ContainerPlatform;