Revert "feat(frontend): import CE code to EE" (#1557)
This commit is contained in:
@@ -4,18 +4,15 @@ import { http, HttpResponse } from 'msw';
|
||||
import { vi } from 'vitest';
|
||||
import { ComponentProps } from 'react';
|
||||
|
||||
import { server } from '@CE/setup-tests/server';
|
||||
import { withTestQueryProvider } from '@CE/react/test-utils/withTestQuery';
|
||||
import { withUserProvider } from '@CE/react/test-utils/withUserProvider';
|
||||
import { createMockUsers, createMockStack } from '@CE/react-tools/test-mocks';
|
||||
import { EnvironmentType } from '@CE/react/portainer/environments/types';
|
||||
import { Role } from '@CE/portainer/users/types';
|
||||
import { withTestRouter } from '@CE/react/test-utils/withRouter';
|
||||
import { confirmStackUpdate } from '@CE/react/common/stacks/common/confirm-stack-update';
|
||||
import {
|
||||
notifyError,
|
||||
notifySuccess,
|
||||
} from '@CE/portainer/services/notifications';
|
||||
import { server } from '@/setup-tests/server';
|
||||
import { withTestQueryProvider } from '@/react/test-utils/withTestQuery';
|
||||
import { withUserProvider } from '@/react/test-utils/withUserProvider';
|
||||
import { createMockUsers, createMockStack } from '@/react-tools/test-mocks';
|
||||
import { EnvironmentType } from '@/react/portainer/environments/types';
|
||||
import { Role } from '@/portainer/users/types';
|
||||
import { withTestRouter } from '@/react/test-utils/withRouter';
|
||||
import { confirmStackUpdate } from '@/react/common/stacks/common/confirm-stack-update';
|
||||
import { notifyError, notifySuccess } from '@/portainer/services/notifications';
|
||||
|
||||
import { StackEditorTab } from './StackEditorTab';
|
||||
|
||||
@@ -39,7 +36,7 @@ const defaultProps = {
|
||||
};
|
||||
|
||||
// Mock the hooks and child component
|
||||
vi.mock('@@CE/WebEditorForm', () => ({
|
||||
vi.mock('@@/WebEditorForm', () => ({
|
||||
usePreventExit: vi.fn(),
|
||||
}));
|
||||
|
||||
@@ -54,13 +51,13 @@ vi.mock('@uirouter/react', async (importOriginal: () => Promise<object>) => ({
|
||||
})),
|
||||
}));
|
||||
|
||||
vi.mock('@CE/react/common/stacks/common/confirm-stack-update', () => ({
|
||||
vi.mock('@/react/common/stacks/common/confirm-stack-update', () => ({
|
||||
confirmStackUpdate: vi.fn(() =>
|
||||
Promise.resolve({ repullImageAndRedeploy: false })
|
||||
),
|
||||
}));
|
||||
|
||||
vi.mock('@CE/portainer/services/notifications', () => ({
|
||||
vi.mock('@/portainer/services/notifications', () => ({
|
||||
notifyError: vi.fn(),
|
||||
notifySuccess: vi.fn(),
|
||||
}));
|
||||
|
||||
@@ -2,15 +2,12 @@ import { Formik } from 'formik';
|
||||
import { useRouter } from '@uirouter/react';
|
||||
import _ from 'lodash';
|
||||
|
||||
import { Stack, StackType } from '@CE/react/common/stacks/types';
|
||||
import { useDockerComposeSchema } from '@CE/react/hooks/useDockerComposeSchema/useDockerComposeSchema';
|
||||
import { useApiVersion } from '@CE/react/docker/proxy/queries/useVersion';
|
||||
import { useCurrentEnvironment } from '@CE/react/hooks/useCurrentEnvironment';
|
||||
import { confirmStackUpdate } from '@CE/react/common/stacks/common/confirm-stack-update';
|
||||
import {
|
||||
notifyError,
|
||||
notifySuccess,
|
||||
} from '@CE/portainer/services/notifications';
|
||||
import { Stack, StackType } from '@/react/common/stacks/types';
|
||||
import { useDockerComposeSchema } from '@/react/hooks/useDockerComposeSchema/useDockerComposeSchema';
|
||||
import { useApiVersion } from '@/react/docker/proxy/queries/useVersion';
|
||||
import { useCurrentEnvironment } from '@/react/hooks/useCurrentEnvironment';
|
||||
import { confirmStackUpdate } from '@/react/common/stacks/common/confirm-stack-update';
|
||||
import { notifyError, notifySuccess } from '@/portainer/services/notifications';
|
||||
|
||||
import { useUpdateStackMutation } from '../../useUpdateStack';
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { EnvVarValues } from '@@CE/form-components/EnvironmentVariablesFieldset';
|
||||
import { EnvVarValues } from '@@/form-components/EnvironmentVariablesFieldset';
|
||||
|
||||
export interface StackEditorFormValues {
|
||||
stackFileContent: string;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { object, string, boolean, SchemaOf, array, number } from 'yup';
|
||||
|
||||
import { envVarValidation } from '@@CE/form-components/EnvironmentVariablesFieldset';
|
||||
import { envVarValidation } from '@@/form-components/EnvironmentVariablesFieldset';
|
||||
|
||||
import { StackEditorFormValues } from './StackEditorTab.types';
|
||||
import { validateYAML } from './stackYamlValidation';
|
||||
|
||||
@@ -5,22 +5,22 @@ import { vi } from 'vitest';
|
||||
import { ComponentProps } from 'react';
|
||||
import { JSONSchema7 } from 'json-schema';
|
||||
|
||||
import { StackType } from '@CE/react/common/stacks/types';
|
||||
import { EnvironmentType } from '@CE/react/portainer/environments/types';
|
||||
import { withTestQueryProvider } from '@CE/react/test-utils/withTestQuery';
|
||||
import { withUserProvider } from '@CE/react/test-utils/withUserProvider';
|
||||
import { createMockUsers } from '@CE/react-tools/test-mocks';
|
||||
import { Role } from '@CE/portainer/users/types';
|
||||
import { withTestRouter } from '@CE/react/test-utils/withRouter';
|
||||
import { StackType } from '@/react/common/stacks/types';
|
||||
import { EnvironmentType } from '@/react/portainer/environments/types';
|
||||
import { withTestQueryProvider } from '@/react/test-utils/withTestQuery';
|
||||
import { withUserProvider } from '@/react/test-utils/withUserProvider';
|
||||
import { createMockUsers } from '@/react-tools/test-mocks';
|
||||
import { Role } from '@/portainer/users/types';
|
||||
import { withTestRouter } from '@/react/test-utils/withRouter';
|
||||
|
||||
import { usePreventExit } from '@@CE/WebEditorForm';
|
||||
import { usePreventExit } from '@@/WebEditorForm';
|
||||
|
||||
import { StackEditorTabInner } from './StackEditorTabInner';
|
||||
import { StackEditorFormValues } from './StackEditorTab.types';
|
||||
import { useVersionedStackFile } from './useVersionedStackFile';
|
||||
|
||||
// Mock the hooks
|
||||
vi.mock('@@CE/WebEditorForm', () => ({
|
||||
vi.mock('@@/WebEditorForm', () => ({
|
||||
usePreventExit: vi.fn(),
|
||||
}));
|
||||
|
||||
|
||||
@@ -2,17 +2,17 @@ import { Form, useFormikContext } from 'formik';
|
||||
import { JSONSchema7 } from 'json-schema';
|
||||
import { useCallback } from 'react';
|
||||
|
||||
import { Stack, StackType } from '@CE/react/common/stacks/types';
|
||||
import { EnvironmentType } from '@CE/react/portainer/environments/types';
|
||||
import { Authorized, useAuthorizations } from '@CE/react/hooks/useUser';
|
||||
import { Stack, StackType } from '@/react/common/stacks/types';
|
||||
import { EnvironmentType } from '@/react/portainer/environments/types';
|
||||
import { Authorized, useAuthorizations } from '@/react/hooks/useUser';
|
||||
|
||||
import { CodeEditor } from '@@CE/CodeEditor';
|
||||
import { SwitchField } from '@@CE/form-components/SwitchField';
|
||||
import { StackEnvironmentVariablesPanel } from '@@CE/form-components/EnvironmentVariablesFieldset';
|
||||
import { FormActions } from '@@CE/form-components/FormActions';
|
||||
import { FormSection } from '@@CE/form-components/FormSection';
|
||||
import { usePreventExit } from '@@CE/WebEditorForm';
|
||||
import { FormError } from '@@CE/form-components/FormError';
|
||||
import { CodeEditor } from '@@/CodeEditor';
|
||||
import { SwitchField } from '@@/form-components/SwitchField';
|
||||
import { StackEnvironmentVariablesPanel } from '@@/form-components/EnvironmentVariablesFieldset';
|
||||
import { FormActions } from '@@/form-components/FormActions';
|
||||
import { FormSection } from '@@/form-components/FormSection';
|
||||
import { usePreventExit } from '@@/WebEditorForm';
|
||||
import { FormError } from '@@/form-components/FormError';
|
||||
|
||||
import { StackEditorFormValues } from './StackEditorTab.types';
|
||||
import { WebhookFieldset } from './WebhookFieldset';
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
import uuidv4 from 'uuid/v4';
|
||||
import { useState } from 'react';
|
||||
|
||||
import { baseStackWebhookUrl } from '@CE/portainer/helpers/webhookHelper';
|
||||
import { Authorized, useAuthorizations } from '@CE/react/hooks/useUser';
|
||||
import { FeatureId } from '@CE/react/portainer/feature-flags/enums';
|
||||
import { WebhookSettings } from '@CE/react/portainer/gitops/AutoUpdateFieldset/WebhookSettings';
|
||||
import { baseStackWebhookUrl } from '@/portainer/helpers/webhookHelper';
|
||||
import { Authorized, useAuthorizations } from '@/react/hooks/useUser';
|
||||
import { FeatureId } from '@/react/portainer/feature-flags/enums';
|
||||
import { WebhookSettings } from '@/react/portainer/gitops/AutoUpdateFieldset/WebhookSettings';
|
||||
|
||||
import { FormSection } from '@@CE/form-components/FormSection';
|
||||
import { SwitchField } from '@@CE/form-components/SwitchField';
|
||||
import { FormSection } from '@@/form-components/FormSection';
|
||||
import { SwitchField } from '@@/form-components/SwitchField';
|
||||
|
||||
export function WebhookFieldset({
|
||||
value,
|
||||
|
||||
@@ -3,8 +3,8 @@ import { renderHook } from '@testing-library/react-hooks';
|
||||
import { http, HttpResponse } from 'msw';
|
||||
import { vi } from 'vitest';
|
||||
|
||||
import { server } from '@CE/setup-tests/server';
|
||||
import { withTestQueryProvider } from '@CE/react/test-utils/withTestQuery';
|
||||
import { server } from '@/setup-tests/server';
|
||||
import { withTestQueryProvider } from '@/react/test-utils/withTestQuery';
|
||||
|
||||
import { useVersionedStackFile } from './useVersionedStackFile';
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { useEffect } from 'react';
|
||||
|
||||
import { useStackFile } from '@CE/react/common/stacks/queries/useStackFile';
|
||||
import { Stack } from '@CE/react/common/stacks/types';
|
||||
import { useStackFile } from '@/react/common/stacks/queries/useStackFile';
|
||||
import { Stack } from '@/react/common/stacks/types';
|
||||
|
||||
export function useVersionedStackFile({
|
||||
stackId,
|
||||
|
||||
Reference in New Issue
Block a user