Skip to content

Commit 1731ed1

Browse files
committed
Bug Fixes
1 parent e620d21 commit 1731ed1

File tree

9 files changed

+106
-87
lines changed

9 files changed

+106
-87
lines changed

Diff for: client-reactjs/src/components/application/Assets/TitleRenderer.js

+30-27
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React, { useState } from 'react';
22
import { DeleteOutlined, EyeOutlined, FilePdfOutlined, FolderOutlined, PlusOutlined } from '@ant-design/icons';
33
import { useDispatch } from 'react-redux';
4-
import { Dropdown, Menu } from 'antd';
4+
import { Dropdown } from 'antd';
55

66
import { selectGroup } from '../../../redux/actions/Groups';
77
import Text from '../../common/Text';
@@ -19,56 +19,59 @@ const TitleRenderer = ({ nodeData, handleMenuClick }) => {
1919

2020
const GroupMenu = () => {
2121
const items = [
22+
{
23+
key: 'Group',
24+
label: <Text text="New Group" />,
25+
icon: <PlusOutlined />,
26+
},
27+
];
28+
29+
const extraItems = [
2230
{
2331
key: 'Edit-Group',
24-
name: <Text text="View" />,
32+
label: <Text text="View" />,
2533
icon: <EyeOutlined />,
2634
},
2735
{
2836
key: 'Delete-Group',
29-
name: <Text text="Delete" />,
37+
label: <Text text="Delete" />,
3038
icon: <DeleteOutlined />,
3139
},
3240
{
3341
key: 'Move-Group',
34-
name: <Text text="Move" />,
42+
label: <Text text="Move" />,
3543
icon: <FolderOutlined />,
3644
},
3745
{
3846
key: 'Print-Assets',
39-
name: <Text text="Print Assets" />,
47+
label: <Text text="Print Assets" />,
4048
icon: <FilePdfOutlined />,
4149
},
4250
];
4351

44-
const onClick = (props) => {
45-
props.domEvent.stopPropagation();
46-
setVisible(false);
47-
handleMenuClick(props, nodeData);
48-
};
49-
5052
const isRootNode = nodeData.key === '0-0';
51-
return (
52-
<Menu mode="inline" theme="dark" onClick={onClick}>
53-
<Menu.Item key="Group" icon={<PlusOutlined />}>
54-
{<Text text="New Group" />}
55-
</Menu.Item>
56-
{!isRootNode &&
57-
items.map((item) => {
58-
return (
59-
<Menu.Item key={item.key} icon={item.icon}>
60-
{item.name}
61-
</Menu.Item>
62-
);
63-
})}
64-
</Menu>
65-
);
53+
54+
if (!isRootNode) {
55+
extraItems.map((item) => {
56+
items.push(item);
57+
});
58+
}
59+
return items;
6660
};
6761

62+
const onClick = (props) => {
63+
props.domEvent.stopPropagation();
64+
setVisible(false);
65+
handleMenuClick(props, nodeData);
66+
};
6867
return (
6968
<li className="group-title">
7069
<span className="group-options">{nodeData.title}</span>
71-
<Dropdown open={visible} trigger={['click']} menu={<GroupMenu />} onOpenChange={onVisibleChange}>
70+
<Dropdown
71+
open={visible}
72+
trigger={['click']}
73+
menu={{ items: GroupMenu(), onClick }}
74+
onOpenChange={onVisibleChange}>
7275
<i className="fa fa-bars" onClick={(e) => e.stopPropagation()} />
7376
</Dropdown>
7477
</li>

Diff for: client-reactjs/src/components/application/Assets/index.js

+1
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ const Assets = () => {
7878
useEffect(() => {
7979
//application changed
8080
if (application?.applicationId) {
81+
console.log(groupsReducer.tree);
8182
if (groupsReducer.tree.length === 0 || groupsReducer.error) {
8283
fetchGroups(); // run this function on initial load to populate tree and datalist;
8384
}

Diff for: client-reactjs/src/components/application/Graph/GraphX6.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,7 @@ import { getWorkingCopyGraph, saveWorkingCopyGraph } from '../../common/CommonUt
2222
const NOTIFICATION_CONF = {
2323
placement: 'top',
2424
style: {
25-
width: 'auto',
26-
maxWidth: '750px',
25+
width: '400px',
2726
},
2827
};
2928

Diff for: client-reactjs/src/components/application/Graph/Shape.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ const ports = {
112112
class Node extends React.Component {
113113
shouldComponentUpdate() {
114114
const { node } = this.props;
115-
console.log(this.props);
115+
116116
if (node) {
117117
// Graph does not detect changes in nodes data when toggle collapse, need to mention it here manually
118118
if (node.hasChanged('data') || node.data?.isCollapsed) {

Diff for: client-reactjs/src/components/application/Graph/Toolbar/VersionsButton.js

+4-17
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,7 @@ const { confirm } = Modal;
4040
const NOTIFICATION_CONF = {
4141
placement: 'top',
4242
style: {
43-
width: 'auto',
44-
maxWidth: '750px',
43+
width: '500px',
4544
},
4645
};
4746

@@ -153,13 +152,7 @@ const VersionsButton = ({ graphRef }) => {
153152
if (!response.ok) handleError(response);
154153

155154
const result = await response.json();
156-
graphRef.current
157-
.unfreeze()
158-
.enableSelection()
159-
.enableRubberband()
160-
.enableSnapline()
161-
.enableSharpSnapline()
162-
.hideTools();
155+
// graphRef.current.enableSelection().enableRubberband().enableSnapline().enableSharpSnapline().hideTools();
163156
graphRef.current.fromJSON(result.graph);
164157

165158
if (isPermanent) {
@@ -199,13 +192,7 @@ const VersionsButton = ({ graphRef }) => {
199192
setClickedVersion({ id: '', name: '', description: '' });
200193
} else {
201194
// When change is not permanent we need to cancel most of the interactions to avoid editing graph.
202-
graphRef.current
203-
.freeze()
204-
.disableSelection()
205-
.disableRubberband()
206-
.disableSnapline()
207-
.disableSharpSnapline()
208-
.hideTools();
195+
// graphRef.current.disableSelection().disableRubberband().disableSnapline().disableSharpSnapline().hideTools();
209196

210197
// Only versions in DB can be executed, updated value will reflect in modal execute button;
211198
graphRef.current.dataflowVersionId = version.id;
@@ -404,7 +391,7 @@ const VersionsButton = ({ graphRef }) => {
404391

405392
if (wcGraph) {
406393
// making sure that graph is not frozen and updates reflects on ui
407-
graphRef.current.unfreeze();
394+
// graphRef.current.unfreeze();
408395
graphRef.current.fromJSON(wcGraph);
409396
}
410397

Diff for: client-reactjs/src/components/application/templates/FileTemplate.jsx

+57-35
Original file line numberDiff line numberDiff line change
@@ -174,46 +174,67 @@ function FileTemplate({ match, selectedAsset = {}, displayingInModal, onClose })
174174
setMonitoringDetails((prev) => ({ ...prev, landingZonePath }));
175175
};
176176

177+
const validateForms = async () => {
178+
let validationError = null;
179+
let formData = {};
180+
181+
try {
182+
formData = await form.validateFields();
183+
} catch (err) {
184+
validationError = err;
185+
}
186+
187+
return { validationError, formData };
188+
};
189+
177190
//Save file template
178191
const saveFileTemplate = async () => {
179-
await form.validateFields();
180-
const {
181-
title,
182-
cluster,
183-
fileNamePattern,
184-
searchString,
185-
description,
186-
setFileMonitoring,
187-
landingZone,
188-
machine,
189-
dirToMonitor,
190-
shouldMonitorSubDirs,
191-
} = form.getFieldsValue();
192-
const url = `/api/fileTemplate/read/saveFileTemplate`;
193-
const body = JSON.stringify({
194-
title,
195-
assetId,
196-
groupId,
197-
cluster,
198-
description,
199-
searchString,
200-
fileNamePattern,
201-
fileLayoutData: layoutData,
202-
application_id: applicationId,
203-
sampleLayoutFile: sampleFileForLayout,
204-
metaData: {
205-
isAssociated: true,
206-
fileMonitoringTemplate: setFileMonitoring,
192+
try {
193+
const data = await validateForms();
194+
195+
if (data.validationError?.errorFields) {
196+
throw new Error('Validation failed, please check form fields again.');
197+
}
198+
199+
const {
200+
title,
201+
cluster,
202+
fileNamePattern,
203+
searchString,
204+
description,
205+
setFileMonitoring,
207206
landingZone,
208207
machine,
209-
lzPath: landingZoneMonitoringDetails.landingZonePath,
210-
directory: dirToMonitor,
211-
monitorSubDirs: shouldMonitorSubDirs,
212-
licenses: selectedLicenses,
213-
},
214-
});
215-
try {
208+
dirToMonitor,
209+
shouldMonitorSubDirs,
210+
} = form.getFieldsValue();
211+
212+
const url = `/api/fileTemplate/read/saveFileTemplate`;
213+
const body = JSON.stringify({
214+
title,
215+
assetId,
216+
groupId,
217+
cluster,
218+
description,
219+
searchString,
220+
fileNamePattern,
221+
fileLayoutData: layoutData,
222+
application_id: applicationId,
223+
sampleLayoutFile: sampleFileForLayout,
224+
metaData: {
225+
isAssociated: true,
226+
fileMonitoringTemplate: setFileMonitoring,
227+
landingZone,
228+
machine,
229+
lzPath: landingZoneMonitoringDetails.landingZonePath,
230+
directory: dirToMonitor,
231+
monitorSubDirs: shouldMonitorSubDirs,
232+
licenses: selectedLicenses,
233+
},
234+
});
235+
216236
const response = await fetch(url, { headers: authHeader(), method: 'POST', body });
237+
217238
if (!response.ok) throw Error('Unable to save template');
218239
message.success('Template Saved');
219240

@@ -231,6 +252,7 @@ function FileTemplate({ match, selectedAsset = {}, displayingInModal, onClose })
231252
history.push(`/${application.applicationId}/assets`);
232253
}
233254
} catch (err) {
255+
console.log(err);
234256
message.error(err.message);
235257
}
236258
};

Diff for: client-reactjs/src/components/common/MonacoEditor.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import React from 'react';
22
import { default as Monaco } from '@monaco-editor/react';
3+
34
// import { loader } from '@monaco-editor/react';
45

56
// https://github.com/suren-atoyan/monaco-react/issues/217#issuecomment-980800802
@@ -9,6 +10,7 @@ const MonacoEditor = ({ onChange, value = '', targetDomId = '', lang = 'markdown
910
const config = {
1011
markdown: {
1112
height: '300px',
13+
1214
onChange: (text) => onChange({ target: { name: 'description', value: text } }),
1315
options: {
1416
lineNumbers: 'off',
@@ -19,8 +21,8 @@ const MonacoEditor = ({ onChange, value = '', targetDomId = '', lang = 'markdown
1921
cursorBlinking: 'smooth',
2022
minimap: { enabled: false },
2123
scrollbar: {
22-
horizontalScrollbarSize: 3,
23-
verticalScrollbarSize: 3,
24+
horizontalScrollbarSize: 0,
25+
verticalScrollbarSize: 0,
2426
},
2527
},
2628
},
@@ -32,15 +34,13 @@ const MonacoEditor = ({ onChange, value = '', targetDomId = '', lang = 'markdown
3234
},
3335
};
3436

35-
console.log(config);
36-
3737
return (
3838
<Monaco
3939
value={value}
4040
language={lang}
4141
{...config[lang]} // get rest of config depending on editor type
4242
{...rest} // all other props
43-
className="ant-input" // give ant input field styles
43+
className="ant-input monacoEditor" // give ant input field styles
4444
path={lang + targetDomId} // will make this model unique
4545
/>
4646
);

Diff for: client-reactjs/src/index.css

+4
Original file line numberDiff line numberDiff line change
@@ -1122,3 +1122,7 @@ div.tooltip {
11221122
font-family: inherit !important;
11231123
color: rgba(0, 0, 0, 1) !important;
11241124
}
1125+
1126+
.monacoEditor {
1127+
border: 1px solid #d9d9d9;
1128+
}

Diff for: client-reactjs/src/redux/actions/Groups.js

+3
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,10 @@ export const getGroupsTree = (applicationId) => {
2626

2727
const tree = await response.json();
2828

29+
console.log(tree);
30+
2931
const dataList = generateList(tree);
32+
console.log(dataList);
3033

3134
dispatch(fetchGroupsTreeSuccess({ tree, dataList }));
3235
} catch (error) {

0 commit comments

Comments
 (0)