mirror of
https://github.com/ansible/awx.git
synced 2026-10-31 06:26:15 -02:30
Merge pull request #11353 from nixocio/ui_node_delete
Identify node to be deleted on workflow
This commit is contained in:
+355
-304
File diff suppressed because it is too large
Load Diff
+351
-304
File diff suppressed because it is too large
Load Diff
+351
-304
File diff suppressed because it is too large
Load Diff
+351
-304
File diff suppressed because it is too large
Load Diff
+351
-304
File diff suppressed because it is too large
Load Diff
+352
-305
File diff suppressed because it is too large
Load Diff
+348
-301
File diff suppressed because it is too large
Load Diff
+11
-1
@@ -8,14 +8,24 @@ import {
|
||||
WorkflowStateContext,
|
||||
} from 'contexts/Workflow';
|
||||
import AlertModal from 'components/AlertModal';
|
||||
import { stringIsUUID } from 'util/strings';
|
||||
|
||||
function NodeDeleteModal() {
|
||||
const dispatch = useContext(WorkflowDispatchContext);
|
||||
const { nodeToDelete } = useContext(WorkflowStateContext);
|
||||
const identifier = nodeToDelete?.originalNodeObject?.identifier;
|
||||
const nodeIdentifier =
|
||||
identifier && !stringIsUUID(identifier)
|
||||
? identifier
|
||||
: nodeToDelete?.identifier;
|
||||
const unifiedJobTemplate =
|
||||
nodeToDelete?.fullUnifiedJobTemplate ||
|
||||
nodeToDelete?.originalNodeObject?.summary_fields?.unified_job_template;
|
||||
const nodeName = nodeIdentifier || unifiedJobTemplate?.name;
|
||||
return (
|
||||
<AlertModal
|
||||
variant="danger"
|
||||
title={t`Remove Node`}
|
||||
title={t`Remove Node ${nodeName}`}
|
||||
isOpen={nodeToDelete}
|
||||
onClose={() => dispatch({ type: 'SET_NODE_TO_DELETE', value: null })}
|
||||
actions={[
|
||||
|
||||
+8
@@ -23,6 +23,13 @@ describe('NodeDeleteModal', () => {
|
||||
name: 'Test JT',
|
||||
type: 'job_template',
|
||||
},
|
||||
fullUnifiedJobTemplate: {
|
||||
name: 'Bar',
|
||||
},
|
||||
originalNodeObject: {
|
||||
identifier: '654160ef-4013-4b90-8e4b-87dee0cb6783',
|
||||
summary_fields: { unified_job_template: { name: 'Bar' } },
|
||||
},
|
||||
},
|
||||
}}
|
||||
>
|
||||
@@ -37,6 +44,7 @@ describe('NodeDeleteModal', () => {
|
||||
});
|
||||
|
||||
test('Confirm button dispatches as expected', () => {
|
||||
expect(wrapper.find('Title').text('Remove Node Bar'));
|
||||
wrapper.find('button#confirm-node-removal').simulate('click');
|
||||
expect(dispatch).toHaveBeenCalledWith({
|
||||
type: 'DELETE_NODE',
|
||||
|
||||
Reference in New Issue
Block a user