@rh-support/troubleshoot 2.2.190 → 2.2.191

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.
@@ -17,9 +17,24 @@
17
17
  }
18
18
 
19
19
  .right-node {
20
+ white-space: nowrap;
20
21
  overflow: hidden;
21
22
  text-overflow: ellipsis;
23
+ width: 100%;
24
+ }
25
+ .content-date-right-history {
22
26
  white-space: nowrap;
27
+ overflow: hidden;
28
+ text-overflow: ellipsis;
29
+ }
30
+
31
+ .timelineMenu button.pf-v5-c-button.pf-m-primary {
32
+ margin-bottom: 31px;
33
+ }
34
+
35
+ /* fixes a bug with datepicker month input being bigger than the day */
36
+ .timelineMenu div.pf-v5-c-calendar-month__header-year span.pf-v5-c-form-control input {
37
+ margin-bottom: -3px;
23
38
  }
24
39
 
25
40
  .timeline::after {
@@ -1 +1 @@
1
- {"version":3,"file":"Timeline.d.ts","sourceRoot":"","sources":["../../../../../../src/components/CaseEditView/Tabs/CaseHistory/Timeline.tsx"],"names":[],"mappings":"AAAA,OAAO,gBAAgB,CAAC;AA0BxB,OAAO,KAAsC,MAAM,OAAO,CAAC;AA8P3D,QAAA,MAAM,QAAQ;;uBAgUb,CAAC;AAEF,eAAe,QAAQ,CAAC"}
1
+ {"version":3,"file":"Timeline.d.ts","sourceRoot":"","sources":["../../../../../../src/components/CaseEditView/Tabs/CaseHistory/Timeline.tsx"],"names":[],"mappings":"AAAA,OAAO,gBAAgB,CAAC;AA0BxB,OAAO,KAAsC,MAAM,OAAO,CAAC;AA4Q3D,QAAA,MAAM,QAAQ;;uBAkUb,CAAC;AAEF,eAAe,QAAQ,CAAC"}
@@ -42,11 +42,14 @@ const TimelineNode = React.forwardRef(({ leftEvent, rightEvent, user, useAvatar
42
42
  React.createElement("div", { ref: ref, "aria-label": `${useAvatar ? 'User profile picture' : 'Timeline marker'}`, tabIndex: -1 }, useAvatar ? (React.createElement(Avatar, { src: 'https://www.patternfly.org/images/668560cd.svg', className: `timeline-avatar timeline-avatar-${user}`, alt: `${user}'s avatar` })) : (React.createElement("div", { className: `timeline-marker timeline-${user}` }))),
43
43
  rightEvent && React.createElement(TimelineEvent, Object.assign({}, rightEvent, { side: "right" }))));
44
44
  });
45
- //Handling changes in case fields to be displayed to the user
45
+ /**
46
+ *
47
+ * @param {Object} item - The item object to process.
48
+ * @returns {string} The formatted text string.
49
+ */
46
50
  const applyReplacements = (item) => {
47
- if (!item || typeof item !== 'object') {
51
+ if (!item || typeof item !== 'object')
48
52
  return '';
49
- }
50
53
  const fieldNameMapping = {
51
54
  ContactId: 'Contact',
52
55
  RH_Product__c: 'Product',
@@ -73,75 +76,79 @@ const applyReplacements = (item) => {
73
76
  jp: 'Japanese',
74
77
  zh: 'Chinese',
75
78
  };
76
- let fieldName = fieldNameMapping[item.fieldName] || item.fieldLabel || item.fieldName || '';
77
- const getNameValue = (prefix) => {
78
- const keyMap = {
79
- Product: 'product',
80
- Version: 'version',
81
- Account: 'account',
82
- Contact: 'contact',
83
- Entitlement: 'entitlement',
84
- 'Business Hours': 'businessHours',
85
- Owner: 'queueNameOwner',
86
- 'Customer Escalation': 'customerEscalation',
87
- 'Case Group': 'caseGroup',
88
- 'SLA Start Date': 'slaStartDate',
89
- 'Case Language': 'caseLanguage',
90
- Alternate_Id__c: 'Personal reference number',
91
- };
92
- const baseKey = keyMap[fieldName] || fieldName.replace(/\s/g, '');
93
- const key = `${baseKey}${prefix}Name`;
94
- return item[key] || item[`${prefix}Value`] || '';
79
+ const keyMap = {
80
+ Product: 'product',
81
+ Version: 'version',
82
+ Account: 'account',
83
+ Contact: 'contact',
84
+ Entitlement: 'entitlement',
85
+ 'Business Hours': 'businessHours',
86
+ Owner: 'queueNameOwner',
87
+ 'Customer Escalation': 'customerEscalation',
88
+ 'Case Group': 'caseGroup',
89
+ 'SLA Start Date': 'slaStartDate',
90
+ 'Case Language': 'caseLanguage',
91
+ 'Personal reference number': 'alternateId',
95
92
  };
96
- let newValue = getNameValue('New');
97
- let oldValue = getNameValue('Old');
93
+ const getMappedFieldName = (fieldName) => fieldNameMapping[fieldName] || item.fieldLabel || fieldName || '';
94
+ const getNameValue = (prefix) => item[`${keyMap[getMappedFieldName(item.fieldName)]}${prefix}Name`] ||
95
+ item[`${prefix}Value`] ||
96
+ item[`${prefix.toLowerCase()}Value`] ||
97
+ '';
98
+ const formatLanguageChange = (fieldName, oldLanguage, newLanguage) => `changed ${fieldName} from ${oldLanguage} to ${newLanguage}`;
99
+ const formatSimpleChange = (fieldName, value) => `set ${fieldName} to ${value}`;
100
+ const formatBooleanChange = (fieldName, value) => `set ${fieldName} to ${value}`;
101
+ const fieldName = getMappedFieldName(item.fieldName);
102
+ const newValue = getNameValue('new');
103
+ const oldValue = getNameValue('old');
98
104
  let newText = '';
99
- if (item.fieldName === 'Case_Language__c') {
100
- // Map language codes to language names
101
- const newLanguage = languageCodeMapping[item.newValue] || item.newValue;
102
- const oldLanguage = languageCodeMapping[item.oldValue] || item.oldValue;
103
- if (item.oldValue && item.newValue) {
104
- newText = `changed ${fieldName} from ${oldLanguage} to ${newLanguage}`;
105
- }
106
- else if (item.newValue) {
107
- newText = `set ${fieldName} to ${newLanguage}`;
105
+ switch (item.fieldName) {
106
+ case 'Case_Language__c': {
107
+ const newLanguage = languageCodeMapping[item.newValue] || item.newValue;
108
+ const oldLanguage = languageCodeMapping[item.oldValue] || item.oldValue;
109
+ newText =
110
+ item.oldValue && item.newValue
111
+ ? formatLanguageChange(fieldName, oldLanguage, newLanguage)
112
+ : formatSimpleChange(fieldName, newLanguage || 'empty');
113
+ break;
108
114
  }
115
+ case 'OwnerId':
116
+ if (item.createdByUserName)
117
+ newText = formatSimpleChange(fieldName, item.createdByUserName);
118
+ break;
119
+ case 'Status':
120
+ newText =
121
+ item.oldValue && item.newValue
122
+ ? `changed ${fieldName} from ${item.oldValue} to ${item.newValue}`
123
+ : formatSimpleChange(fieldName, item.newValue || 'empty');
124
+ break;
125
+ case 'Customer_Escalation__c':
126
+ if (item.createdByUserName)
127
+ newText = 'started Escalation for this ticket';
128
+ break;
129
+ case 'SlaStartDate':
130
+ if (item.newValue)
131
+ newText = formatSimpleChange(fieldName, item.newValue);
132
+ break;
133
+ default:
134
+ if (oldValue && newValue) {
135
+ newText = `changed ${fieldName} from ${oldValue} to ${newValue}`;
136
+ }
137
+ else if (newValue) {
138
+ newText = formatSimpleChange(fieldName, newValue);
139
+ }
140
+ else if (oldValue && (newValue === undefined || newValue === '')) {
141
+ newText = `removed ${fieldName}, was ${oldValue}`;
142
+ }
143
+ else if (item.newValue !== undefined) {
144
+ newText = formatSimpleChange(fieldName, item.newValue);
145
+ }
146
+ break;
109
147
  }
110
- else if (item.fieldName === 'OwnerId' && item.createdByUserName) {
111
- newText = `set ${fieldName} to ${item.createdByUserName}`;
112
- }
113
- else if (item.fieldName === 'Status') {
114
- if (item.oldValue && item.newValue) {
115
- newText = `changed ${fieldName} from ${item.oldValue} to ${item.newValue}`;
116
- }
117
- else if (item.newValue) {
118
- newText = `set ${fieldName} to ${item.newValue}`;
119
- }
120
- }
121
- else if (item.fieldName === 'Customer_Escalation__c' && item.createdByUserName) {
122
- newText = `started Escalation for this ticket`;
123
- }
124
- else if (oldValue && newValue) {
125
- newText = `changed ${fieldName} from ${oldValue} to ${newValue}`;
126
- }
127
- else if (newValue) {
128
- newText = `set ${fieldName} to ${newValue}`;
129
- }
130
- else if (item.newValue !== undefined) {
131
- newText = `set ${fieldName} to ${item.newValue}`;
132
- }
133
- // Handle boolean values
134
- if (typeof item.newValue === 'boolean') {
135
- newText = `set ${fieldName} to ${item.newValue}`;
136
- }
137
- // Handle date values
138
- if (item.fieldName === 'SlaStartDate' && item.newValue) {
139
- newText = `set ${fieldName} to ${item.newValue}`;
140
- }
141
- // Replace 'Problem Statement' with 'Title'
142
- if (typeof newText === 'string') {
148
+ if (typeof item.newValue === 'boolean')
149
+ newText = formatBooleanChange(fieldName, item.newValue);
150
+ if (typeof newText === 'string')
143
151
  newText = newText.replace(/Problem Statement/g, 'Title');
144
- }
145
152
  return newText;
146
153
  };
147
154
  // function to change the apiResponse
@@ -285,15 +292,17 @@ const Timeline = ({ caseNumber }) => {
285
292
  return '';
286
293
  };
287
294
  const updateLineStyle = () => {
288
- var _a;
289
295
  const timelineElement = document.querySelector('.timeline');
290
296
  if (timelineElement) {
291
297
  if (lastNodeRef.current) {
292
- const timelineBottom = lastNodeRef.current.getBoundingClientRect().bottom + window.scrollY;
293
- const timelineTop = timelineElement.getBoundingClientRect().top + window.scrollY;
294
- const avatarHeight = ((_a = lastNodeRef.current.querySelector('.timeline-avatar')) === null || _a === void 0 ? void 0 : _a.clientHeight) || 0;
295
- const calculatedBottomValue = `${timelineTop + timelineElement.offsetHeight - timelineBottom + avatarHeight}px`;
296
- timelineElement.style.setProperty('--timeline-bottom', calculatedBottomValue);
298
+ const timelineRect = timelineElement.getBoundingClientRect();
299
+ const lastNodeRect = lastNodeRef.current.getBoundingClientRect();
300
+ const timelineBottomPosition = timelineRect.bottom + window.scrollY;
301
+ const lastNodeBottomPosition = lastNodeRect.bottom + window.scrollY;
302
+ // Calculate the difference between the bottom of the timeline and the bottom of the last node
303
+ const bottomOffset = timelineBottomPosition - lastNodeBottomPosition;
304
+ // Set the --timeline-bottom CSS variable to adjust the line height
305
+ timelineElement.style.setProperty('--timeline-bottom', `${bottomOffset}px`);
297
306
  }
298
307
  else {
299
308
  timelineElement.style.setProperty('--timeline-bottom', '0px');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rh-support/troubleshoot",
3
- "version": "2.2.190",
3
+ "version": "2.2.191",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "registry": "https://registry.npmjs.org"
@@ -134,5 +134,5 @@
134
134
  "defaults and supports es6-module",
135
135
  "maintained node versions"
136
136
  ],
137
- "gitHead": "d867a78014ee4a08aa8d7bf9e0dc9bd08ce6ac5a"
137
+ "gitHead": "9d68649cf6e2fbd399b34388704429012356113e"
138
138
  }