1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-08-02 20:35:25 +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

@ -11,7 +11,6 @@ import {
} from '@/react/portainer/environments/types';
import { getPlatformType } from '@/react/portainer/environments/utils';
import { useEnvironment } from '@/react/portainer/environments/queries/useEnvironment';
import { isBE } from '@/react/portainer/feature-flags/feature-flags.service';
import { environmentStore } from '@/react/hooks/current-environment-store';
import { Icon } from '@@/Icon';
@ -24,7 +23,6 @@ import { DockerSidebar } from './DockerSidebar';
import { KubernetesSidebar } from './KubernetesSidebar';
import { SidebarSection, SidebarSectionTitle } from './SidebarSection';
import { useSidebarState } from './useSidebarState';
import { NomadSidebar } from './NomadSidebar';
export function EnvironmentSidebar() {
const { query: currentEnvironmentQuery, clearEnvironment } =
@ -87,7 +85,6 @@ function Content({ environment, onClear }: ContentProps) {
[PlatformType.Azure]: AzureSidebar,
[PlatformType.Docker]: DockerSidebar,
[PlatformType.Kubernetes]: KubernetesSidebar,
[PlatformType.Nomad]: isBE ? NomadSidebar : null,
};
return sidebar[platform];

View file

@ -1,38 +0,0 @@
import { UserContext } from '@/react/hooks/useUser';
import { UserViewModel } from '@/portainer/models/user';
import { render, within } from '@/react-tools/test-utils';
import { TestSidebarProvider } from '../useSidebarState';
import { NomadSidebar } from './NomadSidebar';
test('dashboard items should render correctly', () => {
const { getByLabelText } = renderComponent();
const dashboardItem = getByLabelText(/Dashboard/i);
expect(dashboardItem).toBeVisible();
expect(dashboardItem).toHaveTextContent('Dashboard');
const dashboardItemElements = within(dashboardItem);
expect(
dashboardItemElements.getByRole('img', { hidden: true })
).toBeVisible();
const jobsItem = getByLabelText('Nomad Jobs');
expect(jobsItem).toBeVisible();
expect(jobsItem).toHaveTextContent('Jobs');
const jobsItemElements = within(jobsItem);
expect(jobsItemElements.getByRole('img', { hidden: true })).toBeVisible();
});
function renderComponent() {
const user = new UserViewModel({ Username: 'user' });
return render(
<UserContext.Provider value={{ user }}>
<TestSidebarProvider>
<NomadSidebar environmentId={1} />
</TestSidebarProvider>
</UserContext.Provider>
);
}

View file

@ -1,30 +0,0 @@
import { Clock } from 'lucide-react';
import { EnvironmentId } from '@/react/portainer/environments/types';
import { DashboardLink } from '../items/DashboardLink';
import { SidebarItem } from '../SidebarItem';
interface Props {
environmentId: EnvironmentId;
}
export function NomadSidebar({ environmentId }: Props) {
return (
<>
<DashboardLink
environmentId={environmentId}
platformPath="nomad"
data-cy="nomadSidebar-dashboard"
/>
<SidebarItem
to="nomad.jobs"
params={{ endpointId: environmentId }}
icon={Clock}
label="Nomad Jobs"
data-cy="nomadSidebar-jobs"
/>
</>
);
}

View file

@ -1 +0,0 @@
export { NomadSidebar } from './NomadSidebar';