mirror of
https://github.com/ansible/awx.git
synced 2026-01-11 18:09:57 -03:30
Fix bug where node alias is not remaining after changing the template on a wf node
This commit is contained in:
parent
6446b627ad
commit
6d0d8e57a4
@ -53,14 +53,7 @@ const Wrapper = styled.div`
|
||||
`;
|
||||
|
||||
const replaceIdentifier = (node) => {
|
||||
if (stringIsUUID(node.originalNodeObject.identifier) && node.identifier) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (
|
||||
!stringIsUUID(node.originalNodeObject.identifier) &&
|
||||
node.identifier !== node.originalNodeObject.identifier
|
||||
) {
|
||||
if (stringIsUUID(node.originalNodeObject.identifier) || node.identifier) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@ -170,14 +170,14 @@ function VisualizerNode({
|
||||
|
||||
let nodeName;
|
||||
|
||||
if (
|
||||
node?.identifier ||
|
||||
(node?.originalNodeObject?.identifier &&
|
||||
!stringIsUUID(node.originalNodeObject.identifier))
|
||||
if (node?.identifier && node.identifier !== '') {
|
||||
nodeName = node.identifier;
|
||||
} else if (
|
||||
node?.identifier !== '' &&
|
||||
node?.originalNodeObject?.identifier &&
|
||||
!stringIsUUID(node.originalNodeObject.identifier)
|
||||
) {
|
||||
nodeName = node?.identifier
|
||||
? node?.identifier
|
||||
: node?.originalNodeObject?.identifier;
|
||||
nodeName = node?.originalNodeObject?.identifier;
|
||||
} else {
|
||||
nodeName =
|
||||
node?.fullUnifiedJobTemplate?.name ||
|
||||
|
||||
@ -270,6 +270,31 @@ describe('VisualizerNode', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('Node with empty string alias', () => {
|
||||
test('Displays unified job template name inside node', () => {
|
||||
const wrapper = mountWithContexts(
|
||||
<svg>
|
||||
<WorkflowStateContext.Provider value={mockedContext}>
|
||||
<VisualizerNode
|
||||
node={{
|
||||
id: 2,
|
||||
identifier: '',
|
||||
fullUnifiedJobTemplate: {
|
||||
name: 'foobar',
|
||||
},
|
||||
}}
|
||||
readOnly={false}
|
||||
updateHelpText={() => {}}
|
||||
updateNodeHelp={() => {}}
|
||||
/>
|
||||
</WorkflowStateContext.Provider>
|
||||
</svg>
|
||||
);
|
||||
expect(wrapper).toHaveLength(1);
|
||||
expect(wrapper.find('NodeResourceName').text()).toBe('foobar');
|
||||
});
|
||||
});
|
||||
|
||||
describe('Node should display convergence label', () => {
|
||||
test('Should display ALL convergence label', async () => {
|
||||
const wrapper = mountWithContexts(
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user