mirror of
https://github.com/ansible/awx.git
synced 2026-01-15 20:00:43 -03:30
Identify node to be deleted on workflow
Identify node to be deleted on workflow. If there is an alias show the alias if no alias is available show the node name. See: https://github.com/ansible/awx/issues/11351
This commit is contained in:
parent
03ed6e9755
commit
47ae6e7a5a
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -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={[
|
||||
|
||||
@ -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',
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user