Fix bug where node alias is not remaining after changing the template on a wf node

This commit is contained in:
mabashian 2022-07-19 15:18:25 -04:00
parent 6446b627ad
commit 6d0d8e57a4
3 changed files with 33 additions and 15 deletions

View File

@ -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;
}

View File

@ -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 ||

View File

@ -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(