diff --git a/awx/ui_next/src/screens/Template/WorkflowJobTemplateVisualizer/Modals/NodeModals/NodeViewModal.jsx b/awx/ui_next/src/screens/Template/WorkflowJobTemplateVisualizer/Modals/NodeModals/NodeViewModal.jsx
index 6eb01a9a0e..96ff7809fa 100644
--- a/awx/ui_next/src/screens/Template/WorkflowJobTemplateVisualizer/Modals/NodeModals/NodeViewModal.jsx
+++ b/awx/ui_next/src/screens/Template/WorkflowJobTemplateVisualizer/Modals/NodeModals/NodeViewModal.jsx
@@ -41,7 +41,7 @@ function getNodeType(node) {
}
}
-function NodeViewModal({ i18n }) {
+function NodeViewModal({ i18n, readOnly }) {
const dispatch = useContext(WorkflowDispatchContext);
const { nodeToView } = useContext(WorkflowStateContext);
const { unifiedJobTemplate } = nodeToView;
@@ -136,15 +136,20 @@ function NodeViewModal({ i18n }) {
title={unifiedJobTemplate.name}
aria-label={i18n._(t`Workflow node view modal`)}
onClose={() => dispatch({ type: 'SET_NODE_TO_VIEW', value: null })}
- actions={[
- ,
- ]}
+ actions={
+ readOnly
+ ? []
+ : [
+ ,
+ ]
+ }
>
{Content}
diff --git a/awx/ui_next/src/screens/Template/WorkflowJobTemplateVisualizer/Modals/NodeModals/NodeViewModal.test.jsx b/awx/ui_next/src/screens/Template/WorkflowJobTemplateVisualizer/Modals/NodeModals/NodeViewModal.test.jsx
index 3d968974d5..024517bfe3 100644
--- a/awx/ui_next/src/screens/Template/WorkflowJobTemplateVisualizer/Modals/NodeModals/NodeViewModal.test.jsx
+++ b/awx/ui_next/src/screens/Template/WorkflowJobTemplateVisualizer/Modals/NodeModals/NodeViewModal.test.jsx
@@ -168,6 +168,40 @@ describe('NodeViewModal', () => {
wrapper.unmount();
jest.clearAllMocks();
});
+
+ test('edit button shoud be shown when readOnly prop is false', async () => {
+ let wrapper;
+ await act(async () => {
+ wrapper = mountWithContexts(
+
+
+
+
+
+ );
+ });
+ waitForLoaded(wrapper);
+ expect(wrapper.find('Button#node-view-edit-button').length).toBe(1);
+ wrapper.unmount();
+ jest.clearAllMocks();
+ });
+
+ test('edit button shoud be hidden when readOnly prop is true', async () => {
+ let wrapper;
+ await act(async () => {
+ wrapper = mountWithContexts(
+
+
+
+
+
+ );
+ });
+ waitForLoaded(wrapper);
+ expect(wrapper.find('Button#node-view-edit-button').length).toBe(0);
+ wrapper.unmount();
+ jest.clearAllMocks();
+ });
});
describe('Project node', () => {
diff --git a/awx/ui_next/src/screens/Template/WorkflowJobTemplateVisualizer/Visualizer.jsx b/awx/ui_next/src/screens/Template/WorkflowJobTemplateVisualizer/Visualizer.jsx
index 27c8dc0894..311d95cec9 100644
--- a/awx/ui_next/src/screens/Template/WorkflowJobTemplateVisualizer/Visualizer.jsx
+++ b/awx/ui_next/src/screens/Template/WorkflowJobTemplateVisualizer/Visualizer.jsx
@@ -460,7 +460,7 @@ function Visualizer({ template, i18n }) {
/>
)}
{showDeleteAllNodesModal && }
- {nodeToView && }
+ {nodeToView && }
);