ebta-workflow-prod 4.0.13 → 4.0.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "ebta-workflow-prod",
3
3
  "private": false,
4
- "version": "4.0.13",
4
+ "version": "4.0.15",
5
5
  "description": "",
6
6
  "license": "UNLICENSED",
7
7
  "author": "",
@@ -471,8 +471,8 @@ export default class PDFMapGeneratorActivity implements IActivityHandler {
471
471
  newPage.drawImage(image10, {
472
472
  x: 40,
473
473
  y: 145,
474
- width: lableSize,
475
- height: lableSize * (image10.height / image10.width),
474
+ width: 60,
475
+ height: 60 * (image10.height / image10.width),
476
476
  });
477
477
  console.log('image10 drawn successfully')
478
478
  }
@@ -616,10 +616,17 @@ export default class PDFMapGeneratorActivity implements IActivityHandler {
616
616
  console.log('bold font embed successful')
617
617
  if (inputs.template == 'VMP') {
618
618
  newPage.drawText('Maximum Speed 10KM/h within Work Area', {
619
- x: (28 + 151),
619
+ x: (28 + 111),
620
620
  y: 145,
621
- size: 30,
622
- color: rgb(1, 0, 0), // red color, IGNORE VSCODE COLOR
621
+ size: 25,
622
+ color: rgb(0, 0, 0), // WHITE color, IGNORE VSCODE COLOR
623
+ font: boldFont,
624
+ });
625
+ newPage.drawText('Maximum Speed 10KM/h within Work Area', {
626
+ x: (28 + 109),
627
+ y: 147,
628
+ size: 25,
629
+ color: rgb(1, 1, 1), // WHITE color, IGNORE VSCODE COLOR
623
630
  font: boldFont,
624
631
  });
625
632
  console.log('speed limit text inserted')
@@ -639,7 +646,7 @@ export default class PDFMapGeneratorActivity implements IActivityHandler {
639
646
  width: buttonW,
640
647
  height: buttonH,
641
648
  });
642
-
649
+
643
650
  newPage.drawText('Go to EBTA GIS', {
644
651
  x: buttonX + 5,
645
652
  y: buttonY + 22,
@@ -166,18 +166,34 @@ function AttributeFilter(props: AttributeFilterProps): React.ReactElement {
166
166
  // Iterate through each attribute in the 'attributes' object of the feature
167
167
  // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
168
168
  for (const [key, value] of Object.entries(feature.attributes)) {
169
- // Check if the attribute is in the short list
170
169
  if (shortListOfAttributes.includes(key)) {
171
- // If it's not already in the attributeSummary, initialize it
170
+ if (value === null || value === undefined) continue;
171
+
172
172
  if (!attributeSummary[key]) {
173
173
  attributeSummary[key] = {};
174
174
  }
175
- let valueKey
176
- if (props.fields.find(obj => obj.name == key)?.type == "date" && Number(value) > 0) {
177
- valueKey = dayjs.unix(Number(value) / 1000).format("DD/MM/YYYY")
175
+
176
+ let valueKey: string;
177
+ const fieldType = props.fields.find(obj => obj.name == key)?.type;
178
+
179
+ if (fieldType === "date") {
180
+ const epoch = Number(value);
181
+ if (!epoch || epoch <= 0) continue;
182
+ valueKey = dayjs.unix(epoch / 1000).format("DD/MM/YYYY");
183
+
184
+ } else if (fieldType && ['integer', 'number', 'float', 'short', 'long', 'big integer'].includes(fieldType)) {
185
+ // Numeric: value passed null check above, but still guard NaN
186
+ const num = Number(value);
187
+ if (isNaN(num)) continue;
188
+ valueKey = String(value);
189
+
190
+ } else {
191
+ // String: reject known meaningless values
192
+ valueKey = String(value).trim();
193
+ const meaningless = ['', 'null', 'undefined', '{}', 'N/A', 'n/a', '<Null>', '<null>'];
194
+ if (meaningless.includes(valueKey)) continue;
178
195
  }
179
- // Count the occurrence of each value for the attribute
180
- else { valueKey = String(value); }
196
+
181
197
  if (!attributeSummary[key][valueKey]) {
182
198
  attributeSummary[key][valueKey] = 0;
183
199
  }
@@ -213,10 +229,10 @@ function AttributeFilter(props: AttributeFilterProps): React.ReactElement {
213
229
  // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
214
230
  let result = props.fields.filter(obj => !attributeList || attributeList.length === 0 || attributeList.includes(obj.name)) // Filter only if nameList is valid
215
231
  .filter(obj => {
216
- if (RawOriginalData.length==0){return true}
232
+ if (RawOriginalData.length == 0) { return true }
217
233
  let matchingRawDataValues = RawOriginalData.find(item => item.name === obj.name)?.uniqValue;
218
234
  let meanless = ['{}', ' ', 'null']
219
- return (matchingRawDataValues && matchingRawDataValues.length > 0 && !meanless.includes(matchingRawDataValues[0].value))
235
+ return matchingRawDataValues !== undefined && matchingRawDataValues.length > 0 && !matchingRawDataValues.every((val) => meanless.includes(val.value))
220
236
  })
221
237
  .map(obj => {
222
238
  let newObj: Attribute = { name: obj.name };
@@ -1211,7 +1227,7 @@ function AttributeFilter(props: AttributeFilterProps): React.ReactElement {
1211
1227
  limitInUse = (attribute.type == 'date' && (dayjs.unix(minDate.current).format('DD/MM/YYYY') != startDate.format('DD/MM/YYYY') || (dayjs.unix(maxDate.current).format('DD/MM/YYYY') != endDate.format('DD/MM/YYYY')))) || searchValue.length > 0 || (minValue !== -Infinity || maxValue !== Infinity)
1212
1228
  }
1213
1229
  if (attribute.uniqValue && attribute.uniqValue.length > 0) {
1214
- displayedValues = (attribute.uniqValue.length < defaultNumber + 2) || showAll ? attribute.uniqValue : attribute.uniqValue.slice(0, defaultNumber);
1230
+ displayedValues = (attribute.uniqValue.length < defaultNumber + 2) || showAll ? attribute.uniqValue : attribute.uniqValue.slice(0, defaultNumber);
1215
1231
  }
1216
1232
 
1217
1233
  if (limitInUse && filteredValues.length > 0) {
@@ -1529,14 +1545,14 @@ function AttributeFilter(props: AttributeFilterProps): React.ReactElement {
1529
1545
  const matchedItems = attri.uniqValue?.filter(item =>
1530
1546
  keywords.every(keyword => item.value.toLowerCase().includes(keyword))
1531
1547
  );
1532
- return sortItemsBySelection(matchedItems,attri.selection) || [];
1548
+ return sortItemsBySelection(matchedItems, attri.selection) || [];
1533
1549
  }
1534
1550
 
1535
1551
  function filterRange(attri: Attribute, min: number, max: number) {
1536
1552
  const matchedItems = attri.uniqValue?.filter(item =>
1537
1553
  Number(item.value) <= max && Number(item.value) >= min
1538
1554
  );
1539
- return sortItemsBySelection(matchedItems,attri.selection) || []
1555
+ return sortItemsBySelection(matchedItems, attri.selection) || []
1540
1556
  }
1541
1557
 
1542
1558
  const groupByMelbourneDate = (data: fieldValue[]) => {
@@ -1563,7 +1579,7 @@ function AttributeFilter(props: AttributeFilterProps): React.ReactElement {
1563
1579
  itemDate.isSame(start, 'day') || itemDate.isSame(end, 'day'); // Inclusive comparison
1564
1580
  });
1565
1581
 
1566
- return sortItemsBySelection(matchedItems,attri.selection);
1582
+ return sortItemsBySelection(matchedItems, attri.selection);
1567
1583
  }
1568
1584
 
1569
1585
 
@@ -1574,7 +1590,7 @@ function AttributeFilter(props: AttributeFilterProps): React.ReactElement {
1574
1590
  const matchedItems = attri.uniqValue?.filter(item =>
1575
1591
  keywords.every(keyword => item.value.toLowerCase().includes(keyword))
1576
1592
  );
1577
- return sortItemsBySelection(matchedItems,attri.selection) || [];
1593
+ return sortItemsBySelection(matchedItems, attri.selection) || [];
1578
1594
  }
1579
1595
  if (props.openedAttribute !== undefined && (openAttriTime.current) !== (props.openedAttribute.timestamp)) {
1580
1596
  let newAttriData: fieldValue[] | undefined
@@ -1683,7 +1699,7 @@ function AttributeFilter(props: AttributeFilterProps): React.ReactElement {
1683
1699
  if (startDate == undefined) { setProperty("startDate" as any, defaultStart) }
1684
1700
  if (endDate == undefined) { setProperty("endDate" as any, defaultEnd) }
1685
1701
  if (filteredValues == undefined) { setProperty("filteredValues" as any, []) }
1686
- if (sqlRule== undefined) {props.setProperty("sqlRule" as any, "AND") }
1702
+ if (sqlRule == undefined) { props.setProperty("sqlRule" as any, "AND") }
1687
1703
  }, [defaultEnd, defaultStart, endDate, filteredValues, layerName, maxValue, minValue, props, rule, searchQuery, searchValue, setProperty, sqlRule, startDate, summary]);
1688
1704
 
1689
1705
  React.useEffect(() => {
@@ -1754,18 +1770,18 @@ function AttributeFilter(props: AttributeFilterProps): React.ReactElement {
1754
1770
  )}
1755
1771
  </Search> : <></>}
1756
1772
  {sqlRule && (
1757
- <RadioGroup
1758
- //Radio Group
1759
- row
1760
- aria-labelledby="demo-row-radio-buttons-group-label"
1761
- name="row-radio-buttons-group"
1762
- value={sqlRule}
1763
- onChange={handleSqlRule}
1764
- >
1765
- <FormControlLabel sx={{ fontSize: 15 }} value="AND" control={<Radio sx={{ color: 'var(--accentIconBorder) !important' }}
1766
- />} label={<span style={{ fontSize: '1.2rem' }}>Meet ALL Conditions</span>} />
1767
- <FormControlLabel sx={{ fontSize: 15 }} value="OR" control={<Radio sx={{ color: 'var(--accentIconBorder) !important' }} />} label={<span style={{ fontSize: '1.2rem' }}>Meet ANY Conditon</span>} />
1768
- </RadioGroup>
1773
+ <RadioGroup
1774
+ //Radio Group
1775
+ row
1776
+ aria-labelledby="demo-row-radio-buttons-group-label"
1777
+ name="row-radio-buttons-group"
1778
+ value={sqlRule}
1779
+ onChange={handleSqlRule}
1780
+ >
1781
+ <FormControlLabel sx={{ fontSize: 15 }} value="AND" control={<Radio sx={{ color: 'var(--accentIconBorder) !important' }}
1782
+ />} label={<span style={{ fontSize: '1.2rem' }}>Meet ALL Conditions</span>} />
1783
+ <FormControlLabel sx={{ fontSize: 15 }} value="OR" control={<Radio sx={{ color: 'var(--accentIconBorder) !important' }} />} label={<span style={{ fontSize: '1.2rem' }}>Meet ANY Conditon</span>} />
1784
+ </RadioGroup>
1769
1785
  )}
1770
1786
  {
1771
1787
  props.footerButton ?