diff --git a/src/views/workflow-page/__fixtures__/workflow-actions-config.ts b/src/views/workflow-actions/__fixtures__/workflow-actions-config.ts
similarity index 75%
rename from src/views/workflow-page/__fixtures__/workflow-actions-config.ts
rename to src/views/workflow-actions/__fixtures__/workflow-actions-config.ts
index 82313fb19..b9455760e 100644
--- a/src/views/workflow-page/__fixtures__/workflow-actions-config.ts
+++ b/src/views/workflow-actions/__fixtures__/workflow-actions-config.ts
@@ -1,8 +1,8 @@
import { MdHighlightOff, MdPowerSettingsNew } from 'react-icons/md';
-import { type WorkflowAction } from '../workflow-page-actions-menu/workflow-page-actions-menu.types';
+import { type WorkflowAction } from '../workflow-actions.types';
-export const mockWorkflowPageActionsConfig = [
+export const mockWorkflowActionsConfig = [
{
id: 'cancel',
label: 'Mock cancel',
diff --git a/src/views/workflow-page/workflow-page-actions-button/__tests__/workflow-page-actions-button.test.tsx b/src/views/workflow-actions/__tests__/workflow-actions.test.tsx
similarity index 82%
rename from src/views/workflow-page/workflow-page-actions-button/__tests__/workflow-page-actions-button.test.tsx
rename to src/views/workflow-actions/__tests__/workflow-actions.test.tsx
index 55a401773..fcddae2d4 100644
--- a/src/views/workflow-page/workflow-page-actions-button/__tests__/workflow-page-actions-button.test.tsx
+++ b/src/views/workflow-actions/__tests__/workflow-actions.test.tsx
@@ -4,9 +4,10 @@ import { HttpResponse } from 'msw';
import { act, render, screen, userEvent } from '@/test-utils/rtl';
-import { describeWorkflowResponse } from '../../__fixtures__/describe-workflow-response';
-import { mockWorkflowPageActionsConfig } from '../../__fixtures__/workflow-actions-config';
-import WorkflowPageActionsButton from '../workflow-page-actions-button';
+import { describeWorkflowResponse } from '@/views/workflow-page/__fixtures__/describe-workflow-response';
+
+import { mockWorkflowActionsConfig } from '../__fixtures__/workflow-actions-config';
+import WorkflowActions from '../workflow-actions';
jest.mock('next/navigation', () => ({
...jest.requireActual('next/navigation'),
@@ -18,7 +19,7 @@ jest.mock('next/navigation', () => ({
}),
}));
-jest.mock('../../workflow-page-actions-modal/workflow-page-actions-modal', () =>
+jest.mock('../workflow-actions-modal/workflow-actions-modal', () =>
jest.fn((props) => {
return props.action ? (
Actions Modal
@@ -26,11 +27,11 @@ jest.mock('../../workflow-page-actions-modal/workflow-page-actions-modal', () =>
})
);
-jest.mock('../../workflow-page-actions-menu/workflow-page-actions-menu', () =>
+jest.mock('../workflow-actions-menu/workflow-actions-menu', () =>
jest.fn((props) => {
return (
props.onActionSelect(mockWorkflowPageActionsConfig[0])}
+ onClick={() => props.onActionSelect(mockWorkflowActionsConfig[0])}
data-testid="actions-menu"
>
Actions Menu{props.disabled ? ' (disabled)' : ''}
@@ -39,7 +40,7 @@ jest.mock('../../workflow-page-actions-menu/workflow-page-actions-menu', () =>
})
);
-describe(WorkflowPageActionsButton.name, () => {
+describe(WorkflowActions.name, () => {
beforeEach(() => {
jest.clearAllMocks();
});
@@ -88,7 +89,7 @@ async function setup({ isError }: { isError?: boolean }) {
const renderResult = render(
-
+
,
{
endpointsMocks: [
diff --git a/src/views/workflow-page/config/workflow-page-actions.config.ts b/src/views/workflow-actions/config/workflow-actions.config.ts
similarity index 71%
rename from src/views/workflow-page/config/workflow-page-actions.config.ts
rename to src/views/workflow-actions/config/workflow-actions.config.ts
index 78c271e25..41f954f7b 100644
--- a/src/views/workflow-page/config/workflow-page-actions.config.ts
+++ b/src/views/workflow-actions/config/workflow-actions.config.ts
@@ -1,9 +1,10 @@
import { MdHighlightOff, MdPowerSettingsNew } from 'react-icons/md';
-import getWorkflowIsCompleted from '../helpers/get-workflow-is-completed';
-import { type WorkflowAction } from '../workflow-page-actions-menu/workflow-page-actions-menu.types';
+import getWorkflowIsCompleted from '@/views/workflow-page/helpers/get-workflow-is-completed';
-const workflowPageActionsConfig = [
+import { type WorkflowAction } from '../workflow-actions.types';
+
+const workflowActionsConfig = [
{
id: 'cancel',
label: 'Cancel',
@@ -26,4 +27,4 @@ const workflowPageActionsConfig = [
},
] as const satisfies Array
;
-export default workflowPageActionsConfig;
+export default workflowActionsConfig;
diff --git a/src/views/workflow-page/workflow-page-actions-menu/__tests__/workflow-page-actions-menu.test.tsx b/src/views/workflow-actions/workflow-actions-menu/__tests__/workflow-actions-menu.test.tsx
similarity index 78%
rename from src/views/workflow-page/workflow-page-actions-menu/__tests__/workflow-page-actions-menu.test.tsx
rename to src/views/workflow-actions/workflow-actions-menu/__tests__/workflow-actions-menu.test.tsx
index 9e083f021..6f139f898 100644
--- a/src/views/workflow-page/workflow-page-actions-menu/__tests__/workflow-page-actions-menu.test.tsx
+++ b/src/views/workflow-actions/workflow-actions-menu/__tests__/workflow-actions-menu.test.tsx
@@ -2,16 +2,17 @@ import React from 'react';
import { render, screen, userEvent, within } from '@/test-utils/rtl';
-import { describeWorkflowResponse } from '../../__fixtures__/describe-workflow-response';
-import { mockWorkflowPageActionsConfig } from '../../__fixtures__/workflow-actions-config';
-import WorkflowPageActionsMenu from '../workflow-page-actions-menu';
+import { describeWorkflowResponse } from '@/views/workflow-page/__fixtures__/describe-workflow-response';
+
+import { mockWorkflowActionsConfig } from '../../__fixtures__/workflow-actions-config';
+import WorkflowActionsMenu from '../workflow-actions-menu';
jest.mock(
- '../../config/workflow-page-actions.config',
- () => mockWorkflowPageActionsConfig
+ '../../config/workflow-actions.config',
+ () => mockWorkflowActionsConfig
);
-describe(WorkflowPageActionsMenu.name, () => {
+describe(WorkflowActionsMenu.name, () => {
beforeEach(() => {
jest.clearAllMocks();
});
@@ -55,7 +56,7 @@ function setup() {
const mockOnActionSelect = jest.fn();
const renderResult = render(
-
diff --git a/src/views/workflow-page/workflow-page-actions-menu/workflow-page-actions-menu.styles.ts b/src/views/workflow-actions/workflow-actions-menu/workflow-actions-menu.styles.ts
similarity index 100%
rename from src/views/workflow-page/workflow-page-actions-menu/workflow-page-actions-menu.styles.ts
rename to src/views/workflow-actions/workflow-actions-menu/workflow-actions-menu.styles.ts
diff --git a/src/views/workflow-page/workflow-page-actions-menu/workflow-page-actions-menu.tsx b/src/views/workflow-actions/workflow-actions-menu/workflow-actions-menu.tsx
similarity index 69%
rename from src/views/workflow-page/workflow-page-actions-menu/workflow-page-actions-menu.tsx
rename to src/views/workflow-actions/workflow-actions-menu/workflow-actions-menu.tsx
index 0514888d0..0a0fd5d68 100644
--- a/src/views/workflow-page/workflow-page-actions-menu/workflow-page-actions-menu.tsx
+++ b/src/views/workflow-actions/workflow-actions-menu/workflow-actions-menu.tsx
@@ -1,17 +1,17 @@
import { Button, KIND } from 'baseui/button';
-import workflowPageActionsConfig from '../config/workflow-page-actions.config';
+import workflowActionsConfig from '../config/workflow-actions.config';
-import { overrides, styled } from './workflow-page-actions-menu.styles';
-import { type Props } from './workflow-page-actions-menu.types';
+import { overrides, styled } from './workflow-actions-menu.styles';
+import { type Props } from './workflow-actions-menu.types';
-export default function WorkflowPageActionsMenu({
+export default function WorkflowActionsMenu({
workflow,
onActionSelect,
}: Props) {
return (
- {workflowPageActionsConfig.map((action) => (
+ {workflowActionsConfig.map((action) => (
- setSelectedAction(undefined)}
diff --git a/src/views/workflow-page/workflow-page-actions-menu/workflow-page-actions-menu.types.ts b/src/views/workflow-actions/workflow-actions.types.ts
similarity index 79%
rename from src/views/workflow-page/workflow-page-actions-menu/workflow-page-actions-menu.types.ts
rename to src/views/workflow-actions/workflow-actions.types.ts
index 0f4260d8a..8199df641 100644
--- a/src/views/workflow-page/workflow-page-actions-menu/workflow-page-actions-menu.types.ts
+++ b/src/views/workflow-actions/workflow-actions.types.ts
@@ -13,8 +13,3 @@ export type WorkflowAction = {
getIsEnabled: (workflow: DescribeWorkflowResponse) => boolean;
// Add a field for the endpoint to call
};
-
-export type Props = {
- workflow: DescribeWorkflowResponse;
- onActionSelect: (action: WorkflowAction) => void;
-};
diff --git a/src/views/workflow-page/workflow-page-actions-button/workflow-page-actions-button.types.ts b/src/views/workflow-page/workflow-page-actions-button/workflow-page-actions-button.types.ts
deleted file mode 100644
index e06ea334b..000000000
--- a/src/views/workflow-page/workflow-page-actions-button/workflow-page-actions-button.types.ts
+++ /dev/null
@@ -1,6 +0,0 @@
-export type Props = {
- domain: string;
- cluster: string;
- workflowId: string;
- runId: string;
-};
diff --git a/src/views/workflow-page/workflow-page-tabs/__tests__/workflow-page-tabs.test.tsx b/src/views/workflow-page/workflow-page-tabs/__tests__/workflow-page-tabs.test.tsx
index 23214898b..e2ff4cc85 100644
--- a/src/views/workflow-page/workflow-page-tabs/__tests__/workflow-page-tabs.test.tsx
+++ b/src/views/workflow-page/workflow-page-tabs/__tests__/workflow-page-tabs.test.tsx
@@ -43,9 +43,8 @@ jest.mock(
() => jest.fn(() => CLI Commands
)
);
-jest.mock(
- '../../workflow-page-actions-button/workflow-page-actions-button',
- () => jest.fn(() => Actions
)
+jest.mock('@/views/workflow-actions/workflow-actions', () =>
+ jest.fn(() => Actions
)
);
describe('WorkflowPageTabs', () => {
diff --git a/src/views/workflow-page/workflow-page-tabs/workflow-page-tabs.tsx b/src/views/workflow-page/workflow-page-tabs/workflow-page-tabs.tsx
index 97d9faf3d..a77121f01 100644
--- a/src/views/workflow-page/workflow-page-tabs/workflow-page-tabs.tsx
+++ b/src/views/workflow-page/workflow-page-tabs/workflow-page-tabs.tsx
@@ -6,9 +6,9 @@ import { useRouter, useParams } from 'next/navigation';
import ErrorBoundary from '@/components/error-boundary/error-boundary';
import PageTabs from '@/components/page-tabs/page-tabs';
import decodeUrlParams from '@/utils/decode-url-params';
+import WorkflowActions from '@/views/workflow-actions/workflow-actions';
import workflowPageTabsConfig from '../config/workflow-page-tabs.config';
-import WorkflowPageActionsButton from '../workflow-page-actions-button/workflow-page-actions-button';
import WorkflowPageCliCommandsButton from '../workflow-page-cli-commands-button/workflow-page-cli-commands-button';
import { styled } from './workflow-page-tabs.styles';
@@ -29,7 +29,7 @@ export default function WorkflowPageTabs() {
null}>
-
+
}