mirror of
https://github.com/ansible/awx.git
synced 2026-03-01 08:48:46 -03:30
Merge pull request #12546 from mabashian/6018-node-alias
Fix bug where node alias is not remaining after changing the template on a wf node
This commit is contained in:
@@ -53,14 +53,7 @@ const Wrapper = styled.div`
|
|||||||
`;
|
`;
|
||||||
|
|
||||||
const replaceIdentifier = (node) => {
|
const replaceIdentifier = (node) => {
|
||||||
if (stringIsUUID(node.originalNodeObject.identifier) && node.identifier) {
|
if (stringIsUUID(node.originalNodeObject.identifier) || node.identifier) {
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (
|
|
||||||
!stringIsUUID(node.originalNodeObject.identifier) &&
|
|
||||||
node.identifier !== node.originalNodeObject.identifier
|
|
||||||
) {
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -170,14 +170,14 @@ function VisualizerNode({
|
|||||||
|
|
||||||
let nodeName;
|
let nodeName;
|
||||||
|
|
||||||
if (
|
if (node?.identifier && node.identifier !== '') {
|
||||||
node?.identifier ||
|
nodeName = node.identifier;
|
||||||
(node?.originalNodeObject?.identifier &&
|
} else if (
|
||||||
!stringIsUUID(node.originalNodeObject.identifier))
|
node?.identifier !== '' &&
|
||||||
|
node?.originalNodeObject?.identifier &&
|
||||||
|
!stringIsUUID(node.originalNodeObject.identifier)
|
||||||
) {
|
) {
|
||||||
nodeName = node?.identifier
|
nodeName = node?.originalNodeObject?.identifier;
|
||||||
? node?.identifier
|
|
||||||
: node?.originalNodeObject?.identifier;
|
|
||||||
} else {
|
} else {
|
||||||
nodeName =
|
nodeName =
|
||||||
node?.fullUnifiedJobTemplate?.name ||
|
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', () => {
|
describe('Node should display convergence label', () => {
|
||||||
test('Should display ALL convergence label', async () => {
|
test('Should display ALL convergence label', async () => {
|
||||||
const wrapper = mountWithContexts(
|
const wrapper = mountWithContexts(
|
||||||
|
|||||||
Reference in New Issue
Block a user