@pega/custom-dx-components 0.24.14 → 0.24.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.
Files changed (24) hide show
  1. package/package.json +1 -1
  2. package/src/tasks/create/templates/Constellation/Field/Icon-Button-URL/demo.stories.tsx.mustache +5 -0
  3. package/src/tasks/create/templates/Constellation/Field/Icon-Button-URL/index.tsx.mustache +26 -15
  4. package/src/tasks/create/templates/Constellation/Template/DETAILS/demo.stories.tsx.mustache +1 -0
  5. package/src/tasks/create/templates/Constellation/Template/DETAILS/mock.ts.mustache +14 -10
  6. package/src/tasks/create/templates/Constellation/Widget/PAGE/demo.stories.tsx.mustache +29 -22
  7. package/src/tasks/create/templates/Constellation/Widget/PAGE/index.tsx.mustache +34 -20
  8. package/src/tasks/create/templates/Launchpad/Field/Icon-Button-URL/demo.stories.tsx.mustache +5 -0
  9. package/src/tasks/create/templates/Launchpad/Field/Icon-Button-URL/index.tsx.mustache +30 -17
  10. package/src/tasks/create/templates/Launchpad/Widget/PAGE/demo.stories.tsx.mustache +30 -22
  11. package/src/tasks/create/templates/Launchpad/Widget/PAGE/index.tsx.mustache +34 -20
  12. package/src/tasks/init/template/package.json.mustache +1 -1
  13. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyDetails/demo.stories.tsx +1 -0
  14. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyDetails/mock.ts +14 -10
  15. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyIconButtonURL/demo.stories.tsx +5 -0
  16. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyIconButtonURL/index.tsx +26 -15
  17. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyPageWidget/demo.stories.tsx +29 -22
  18. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyPageWidget/index.tsx +34 -20
  19. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyDetails/demo.stories.tsx +1 -0
  20. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyDetails/mock.ts +14 -10
  21. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyIconButtonURL/demo.stories.tsx +5 -0
  22. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyIconButtonURL/index.tsx +30 -17
  23. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyPageWidget/demo.stories.tsx +30 -22
  24. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyPageWidget/index.tsx +34 -20
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pega/custom-dx-components",
3
- "version": "0.24.14",
3
+ "version": "0.24.15",
4
4
  "description": "Utility for building custom UI components",
5
5
  "bin": "./bin/index.js",
6
6
  "scripts": {
@@ -38,6 +38,11 @@ const statelistData = {
38
38
 
39
39
  window.PCore.getDataPageUtils = () => {
40
40
  return {
41
+ getData: () => {
42
+ return new Promise(resolve => {
43
+ resolve(statelistData);
44
+ });
45
+ },
41
46
  getDataAsync: () => {
42
47
  return new Promise(resolve => {
43
48
  resolve(statelistData);
@@ -65,8 +65,11 @@ function {{COMPONENT_CLASS_NAME}}(props: {{COMPONENT_CLASS_NAME}}Props) {
65
65
  const { value, displayMode, countryCode = 'USA', getPConnect, testId } = props;
66
66
  const [statelist, setStatelist] = useState([]);
67
67
  const [showTable, setShowTable] = useState(false);
68
+ const [isLoading, setIsLoading] = useState(true);
68
69
  const [validUrl, setValidUrl] = useState('about:blank');
69
70
  const PConnect = getPConnect();
71
+ const dataViewName = 'D_pyStateList';
72
+ const context = PConnect.getContextName();
70
73
 
71
74
  // IMPORTANT: need to register icons used in camel case
72
75
  registerIcon(listNumber, arrowRight, globe);
@@ -111,8 +114,6 @@ function {{COMPONENT_CLASS_NAME}}(props: {{COMPONENT_CLASS_NAME}}Props) {
111
114
  // get data from a data page and a PConnect function
112
115
  // to get getContextName
113
116
  useEffect(() => {
114
- const dataViewName = 'D_pyStateList';
115
- const context = PConnect.getContextName();
116
117
  const params = { pyCountry: countryCode };
117
118
 
118
119
  // only retrieve table data if table is shown
@@ -121,25 +122,33 @@ function {{COMPONENT_CLASS_NAME}}(props: {{COMPONENT_CLASS_NAME}}Props) {
121
122
  .getDataAsync(dataViewName, context, params, null, null)
122
123
  // @ts-ignore
123
124
  .then((response: any) => {
125
+ setIsLoading(false);
124
126
  // table requires an index or will get setExtraStackFrame error
125
- setStatelist(
126
- response.data.map((entry: any, index: number) => {
127
- // mapping the data into the column names
128
- // MUST have an id/index or will get a setExtraStackFrame error
129
- // put a key in the table
130
- return {
131
- stateName: entry.pyLabel,
132
- stateCode: entry.pyStateCode,
133
- id: index
134
- };
135
- })
136
- );
127
+ if (response.data !== null) {
128
+ setStatelist(
129
+ response.data.map((entry: any, index: number) => {
130
+ // mapping the data into the column names
131
+ // MUST have an id/index or will get a setExtraStackFrame error
132
+ // put a key in the table
133
+ return {
134
+ stateName: entry.pyLabel,
135
+ stateCode: entry.pyStateCode,
136
+ id: index
137
+ };
138
+ })
139
+ );
140
+ } else {
141
+ setStatelist([]);
142
+ setIsLoading(false);
143
+ }
137
144
  })
138
145
  .catch((error: any) => {
146
+ setStatelist([]);
147
+ setIsLoading(false);
139
148
  console.log(error);
140
149
  });
141
150
  }
142
- }, [PConnect, countryCode, showTable]);
151
+ }, [context, countryCode, showTable]);
143
152
 
144
153
  // when DISPLAY_ONLY, in this example we will just show the URL.
145
154
  if (displayMode === 'DISPLAY_ONLY') {
@@ -196,6 +205,8 @@ function {{COMPONENT_CLASS_NAME}}(props: {{COMPONENT_CLASS_NAME}}Props) {
196
205
  title={PConnect.getLocalizedValue('State list', '', '')}
197
206
  columns={columns}
198
207
  data={statelist}
208
+ loading={isLoading}
209
+ loadingMessage={PConnect.getLocalizedValue('Loading state list', '', '')}
199
210
  />
200
211
  )}
201
212
  <%={{ }}=%> {{! revert delimiters for mustache }}
@@ -24,6 +24,7 @@ const Region = props => {
24
24
  return <></>;
25
25
  };
26
26
 
27
+
27
28
  const renderField = resolvedProps => {
28
29
  const {
29
30
  displayAsStatus = false,
@@ -1,5 +1,4 @@
1
1
 
2
-
3
2
  // @ts-nocheck
4
3
  export const pyReviewRaw = {
5
4
  name: 'pyReview',
@@ -18,6 +17,7 @@ export const pyReviewRaw = {
18
17
  value: '@P .pyStatusWork',
19
18
  label: '@L Work Status',
20
19
  hideLabel: true,
20
+ displayMode: 'STACKED_LARGE_VAL',
21
21
  displayAsStatus: true,
22
22
  key: 'pyStatusWork'
23
23
  }
@@ -28,6 +28,7 @@ export const pyReviewRaw = {
28
28
  value: '@P .pyID',
29
29
  label: '@L Case ID',
30
30
  hideLabel: true,
31
+ displayMode: 'STACKED_LARGE_VAL',
31
32
  key: 'pyID'
32
33
  }
33
34
  },
@@ -37,6 +38,7 @@ export const pyReviewRaw = {
37
38
  value: '@P .pxCreateDateTime',
38
39
  label: '@L Create date/time',
39
40
  hideLabel: true,
41
+ displayMode: 'STACKED_LARGE_VAL',
40
42
  key: 'pxCreateDateTime'
41
43
  }
42
44
  },
@@ -47,6 +49,7 @@ export const pyReviewRaw = {
47
49
  hideLabel: true,
48
50
  value: '@USER .pxCreateOperator',
49
51
  placeholder: 'Select...',
52
+ displayMode: 'STACKED_LARGE_VAL',
50
53
  key: 'pxCreateOperator'
51
54
  }
52
55
  }
@@ -66,6 +69,7 @@ export const pyReviewRaw = {
66
69
  {
67
70
  name: 'A',
68
71
  type: 'Region',
72
+ key: 'A',
69
73
  getPConnect: () => {
70
74
  return {
71
75
  getRawMetadata: () => {
@@ -78,17 +82,17 @@ export const pyReviewRaw = {
78
82
  type: 'DateTime',
79
83
  config: {
80
84
  value: '@P .pySLADeadline',
81
- label: '@L SLA Deadline'
82
- },
83
- key: '1'
85
+ label: '@L SLA Deadline',
86
+ key: 'pySLADeadline'
87
+ }
84
88
  },
85
89
  {
86
90
  type: 'DateTime',
87
91
  config: {
88
92
  value: '@P .pySLAGoal',
89
- label: '@L SLA Goal'
90
- },
91
- key: '2'
93
+ label: '@L SLA Goal',
94
+ key: 'pySLAGoal'
95
+ }
92
96
  },
93
97
  {
94
98
  type: 'RadioButtons',
@@ -96,9 +100,9 @@ export const pyReviewRaw = {
96
100
  value: '@P .pySLAStartTime',
97
101
  label: '@L SLA Start Time',
98
102
  listType: 'associated',
99
- datasource: '@ASSOCIATED .pySLAStartTime'
100
- },
101
- key: '3'
103
+ datasource: '@ASSOCIATED .pySLAStartTime',
104
+ key: 'pySLAStartTime'
105
+ }
102
106
  }
103
107
  ]
104
108
  }
@@ -22,30 +22,37 @@ if (!window.PCore) {
22
22
  }
23
23
 
24
24
  const worklistData = {
25
- data: [
26
- {
27
- pxProcessName: 'Loan',
28
- pxRefObjectInsName: ' A-8002',
29
- pyAssignmentStatus: 'New',
30
- pxTaskLabel: 'Details'
31
- },
32
- {
33
- pxProcessName: 'Loan',
34
- pxRefObjectInsName: ' A-7001',
35
- pyAssignmentStatus: 'Open',
36
- pxTaskLabel: 'Info'
37
- },
38
- {
39
- pxProcessName: 'Loan',
40
- pxRefObjectInsName: ' A-9000',
41
- pyAssignmentStatus: 'Open',
42
- pxTaskLabel: 'Amount'
43
- }
44
- ]
25
+ data: {
26
+ data: [
27
+ {
28
+ pxProcessName: 'Loan',
29
+ pxRefObjectInsName: ' A-8002',
30
+ pyAssignmentStatus: 'New',
31
+ pxTaskLabel: 'Details'
32
+ },
33
+ {
34
+ pxProcessName: 'Loan',
35
+ pxRefObjectInsName: ' A-7001',
36
+ pyAssignmentStatus: 'Open',
37
+ pxTaskLabel: 'Info'
38
+ },
39
+ {
40
+ pxProcessName: 'Loan',
41
+ pxRefObjectInsName: ' A-9000',
42
+ pyAssignmentStatus: 'Open',
43
+ pxTaskLabel: 'Amount'
44
+ }
45
+ ]
46
+ }
45
47
  };
46
48
 
47
- window.PCore.getDataPageUtils = () => {
49
+ window.PCore.getDataApiUtils = () => {
48
50
  return {
51
+ getData: () => {
52
+ return new Promise(resolve => {
53
+ resolve(worklistData);
54
+ });
55
+ },
49
56
  getDataAsync: () => {
50
57
  return new Promise(resolve => {
51
58
  resolve(worklistData);
@@ -59,7 +66,7 @@ window.PCore.getDataPageUtils = () => {
59
66
  export const Base{{COMPONENT_CLASS_NAME}}: Story = args => {
60
67
 
61
68
  const props = {
62
- image: configProps.image,
69
+ ...configProps,
63
70
  getPConnect: () => {
64
71
  return {
65
72
  getValue: value => {
@@ -21,7 +21,11 @@ function {{COMPONENT_CLASS_NAME}}(props: {{COMPONENT_CLASS_NAME}}Props) {
21
21
 
22
22
  const { header, description, datasource = [], whatsnewlink, image, getPConnect } = props;
23
23
  const [worklist, setWorklist] = useState([]);
24
+ const [isLoading, setIsLoading] = useState(true);
24
25
  const PConnect = getPConnect();
26
+ const dataViewName = 'D_pyMyWorkList';
27
+ const context = PConnect.getContextName();
28
+
25
29
  let details = [];
26
30
  // @ts-ignore
27
31
  if (datasource && datasource.source) {
@@ -44,33 +48,41 @@ function {{COMPONENT_CLASS_NAME}}(props: {{COMPONENT_CLASS_NAME}}Props) {
44
48
  // get data from a data page and a PConnect function
45
49
  // to get getContextName
46
50
  useEffect(() => {
47
- const dataViewName = 'D_pyMyWorkList';
48
- const context = PConnect.getContextName();
49
51
 
50
- PCore.getDataPageUtils()
51
- .getDataAsync(dataViewName, context, {}, null, null)
52
+ PCore.getDataApiUtils()
53
+ .getData(dataViewName, {}, context)
52
54
  // @ts-ignore
53
55
  .then((response: any) => {
54
- // table requires an index or will get setExtraStackFrame error
55
- setWorklist(
56
- response.data.map((entry: any, index: number) => {
57
- // mapping the data into the column names
58
- // MUST have an id/index or will get a setExtraStackFrame error
59
- // put a key in the table
60
- return {
61
- caseType: entry.pxProcessName,
62
- insKey: entry.pxRefObjectInsName,
63
- status: entry.pyAssignmentStatus,
64
- stage: entry.pxTaskLabel,
65
- id: index
66
- };
67
- })
68
- );
56
+ setIsLoading(false);
57
+ if (response.data.data !== null) {
58
+ // table requires an index or will get setExtraStackFrame error
59
+ setWorklist(
60
+ response.data.data.map((entry: any, index: number) => {
61
+ // mapping the data into the column names
62
+ // MUST have an id/index or will get a setExtraStackFrame error
63
+ // put a key in the table
64
+ return {
65
+ caseType: entry.pxProcessName,
66
+ insKey: entry.pxRefObjectInsName,
67
+ status: entry.pyAssignmentStatus,
68
+ stage: entry.pxTaskLabel,
69
+ id: index
70
+ };
71
+ })
72
+ );
73
+ }
74
+ else {
75
+ setWorklist([]);
76
+ setIsLoading(false);
77
+ }
78
+
69
79
  })
70
80
  .catch((error: any) => {
81
+ setWorklist([]);
82
+ setIsLoading(false);
71
83
  console.log(error);
72
84
  });
73
- }, [PConnect]);
85
+ }, [context]);
74
86
 
75
87
  return (
76
88
  <Styled{{COMPONENT_CLASS_NAME}}Wrapper>
@@ -86,6 +98,8 @@ function {{COMPONENT_CLASS_NAME}}(props: {{COMPONENT_CLASS_NAME}}Props) {
86
98
  title={PConnect.getLocalizedValue('Work list', '', '')}
87
99
  columns={columns}
88
100
  data={worklist}
101
+ loading={isLoading}
102
+ loadingMessage={PConnect.getLocalizedValue('Loading Work list', '', '')}
89
103
  />
90
104
  </Styled{{COMPONENT_CLASS_NAME}}Wrapper>
91
105
  );
@@ -38,6 +38,11 @@ const countrylistData = {
38
38
 
39
39
  window.PCore.getDataPageUtils = () => {
40
40
  return {
41
+ getData: () => {
42
+ return new Promise(resolve => {
43
+ resolve(countrylistData);
44
+ });
45
+ },
41
46
  getDataAsync: () => {
42
47
  return new Promise(resolve => {
43
48
  resolve(countrylistData);
@@ -60,10 +60,13 @@ export const textFormatter = (value: string) => {
60
60
  // any default values in config.pros should be set in defaultProps at bottom of this file
61
61
  function {{COMPONENT_CLASS_NAME}}(props: {{COMPONENT_CLASS_NAME}}Props) {
62
62
  const { value, displayMode, getPConnect, testId } = props;
63
- const [statelist, setStatelist] = useState([]);
63
+ const [countrylist, setCountrylist] = useState([]);
64
64
  const [showTable, setShowTable] = useState(false);
65
+ const [isLoading, setIsLoading] = useState(true);
65
66
  const [validUrl, setValidUrl] = useState('about:blank');
66
67
  const PConnect = getPConnect();
68
+ const dataViewName = 'CountryList';
69
+ const context = PConnect.getContextName();
67
70
 
68
71
  // IMPORTANT: need to register icons used in camel case
69
72
  registerIcon(listNumber, arrowRight, globe);
@@ -108,8 +111,6 @@ function {{COMPONENT_CLASS_NAME}}(props: {{COMPONENT_CLASS_NAME}}Props) {
108
111
  // get data from a data page and a PConnect function
109
112
  // to get getContextName
110
113
  useEffect(() => {
111
- const dataViewName = 'CountryList';
112
- const context = PConnect.getContextName();
113
114
  const params = { };
114
115
 
115
116
  // only retrieve table data if table is shown
@@ -118,25 +119,35 @@ function {{COMPONENT_CLASS_NAME}}(props: {{COMPONENT_CLASS_NAME}}Props) {
118
119
  .getDataAsync(dataViewName, context, params, null, null)
119
120
  // @ts-ignore
120
121
  .then((response: any) => {
122
+ setIsLoading(false);
121
123
  // table requires an index or will get setExtraStackFrame error
122
- setStatelist(
123
- response.data.map((entry: any, index: number) => {
124
- // mapping the data into the column names
125
- // MUST have an id/index or will get a setExtraStackFrame error
126
- // put a key in the table
127
- return {
128
- countryName: entry.Name,
129
- shortName: entry.ShortName,
130
- id: index
131
- };
132
- })
133
- );
124
+ if (response.data !== null) {
125
+ setCountrylist(
126
+ response.data.map((entry: any, index: number) => {
127
+ // mapping the data into the column names
128
+ // MUST have an id/index or will get a setExtraStackFrame error
129
+ // put a key in the table
130
+ return {
131
+ countryName: entry.Name,
132
+ shortName: entry.ShortName,
133
+ id: index
134
+ };
135
+ })
136
+ );
137
+ }
138
+ else {
139
+ setCountrylist([]);
140
+ setIsLoading(false);
141
+ }
142
+
134
143
  })
135
144
  .catch((error: any) => {
145
+ setCountrylist([]);
146
+ setIsLoading(false);
136
147
  console.log(error);
137
148
  });
138
149
  }
139
- }, [PConnect, showTable]);
150
+ }, [context, showTable]);
140
151
 
141
152
  // when DISPLAY_ONLY, in this example we will just show the URL.
142
153
  if (displayMode === 'DISPLAY_ONLY') {
@@ -191,7 +202,9 @@ function {{COMPONENT_CLASS_NAME}}(props: {{COMPONENT_CLASS_NAME}}Props) {
191
202
  <Table
192
203
  title={PConnect.getLocalizedValue('State list', '', '')}
193
204
  columns={columns}
194
- data={statelist}
205
+ data={countrylist}
206
+ loading={isLoading}
207
+ loadingMessage={PConnect.getLocalizedValue('Loading country list', '', '')}
195
208
  />
196
209
  )}
197
210
  <%={{ }}=%> {{! revert delimiters for mustache }}
@@ -22,30 +22,38 @@ if (!window.PCore) {
22
22
  }
23
23
 
24
24
  const worklistData = {
25
- data: [
26
- {
27
- CaseName: 'Loan',
28
- BusinessID: ' A-8002',
29
- ProcessName: 'New',
30
- TaskName: 'Details'
31
- },
32
- {
33
- CaseName: 'Loan',
34
- BusinessID: ' A-7001',
35
- ProcessName: 'Open',
36
- TaskName: 'Info'
37
- },
38
- {
39
- CaseName: 'Loan',
40
- BusinessID: ' A-9000',
41
- ProcessName: 'Open',
42
- TaskName: 'Amount'
43
- }
44
- ]
25
+ data: {
26
+ data: [
27
+ {
28
+ CaseName: 'Loan',
29
+ BusinessID: ' A-8002',
30
+ ProcessName: 'New',
31
+ TaskName: 'Details'
32
+ },
33
+ {
34
+ CaseName: 'Loan',
35
+ BusinessID: ' A-7001',
36
+ ProcessName: 'Open',
37
+ TaskName: 'Info'
38
+ },
39
+ {
40
+ CaseName: 'Loan',
41
+ BusinessID: ' A-9000',
42
+ ProcessName: 'Open',
43
+ TaskName: 'Amount'
44
+ }
45
+ ]
46
+ }
47
+
45
48
  };
46
49
 
47
- window.PCore.getDataPageUtils = () => {
50
+ window.PCore.getDataApiUtils = () => {
48
51
  return {
52
+ getData: () => {
53
+ return new Promise(resolve => {
54
+ resolve(worklistData);
55
+ });
56
+ },
49
57
  getDataAsync: () => {
50
58
  return new Promise(resolve => {
51
59
  resolve(worklistData);
@@ -59,7 +67,7 @@ window.PCore.getDataPageUtils = () => {
59
67
  export const Base{{COMPONENT_CLASS_NAME}}: Story = args => {
60
68
 
61
69
  const props = {
62
- image: configProps.image,
70
+ ...configProps,
63
71
  getPConnect: () => {
64
72
  return {
65
73
  getValue: value => {
@@ -21,7 +21,11 @@ function {{COMPONENT_CLASS_NAME}}(props: {{COMPONENT_CLASS_NAME}}Props) {
21
21
 
22
22
  const { header, description, datasource = [], whatsnewlink, image, getPConnect } = props;
23
23
  const [worklist, setWorklist] = useState([]);
24
+ const [isLoading, setIsLoading] = useState(true);
24
25
  const PConnect = getPConnect();
26
+ const dataViewName = 'MyWorkList';
27
+ const context = PConnect.getContextName();
28
+
25
29
  let details = [];
26
30
  // @ts-ignore
27
31
  if (datasource && datasource.source) {
@@ -44,33 +48,41 @@ function {{COMPONENT_CLASS_NAME}}(props: {{COMPONENT_CLASS_NAME}}Props) {
44
48
  // get data from a data page and a PConnect function
45
49
  // to get getContextName
46
50
  useEffect(() => {
47
- const dataViewName = 'MyWorkList';
48
- const context = PConnect.getContextName();
49
51
 
50
- PCore.getDataPageUtils()
51
- .getDataAsync(dataViewName, context, {}, null, null)
52
+ PCore.getDataApiUtils()
53
+ .getData(dataViewName, {}, context)
52
54
  // @ts-ignore
53
55
  .then((response: any) => {
54
- // table requires an index or will get setExtraStackFrame error
55
- setWorklist(
56
- response.data.map((entry: any, index: number) => {
57
- // mapping the data into the column names
58
- // MUST have an id/index or will get a setExtraStackFrame error
59
- // put a key in the table
60
- return {
61
- caseType: entry.CaseName,
62
- insKey: entry.BusinessID,
63
- status: entry.ProcessName,
64
- stage: entry.TaskName,
65
- id: index
66
- };
67
- })
68
- );
56
+ setIsLoading(false);
57
+ if (response.data.data !== null) {
58
+ // table requires an index or will get setExtraStackFrame error
59
+ setWorklist(
60
+ response.data.data.map((entry: any, index: number) => {
61
+ // mapping the data into the column names
62
+ // MUST have an id/index or will get a setExtraStackFrame error
63
+ // put a key in the table
64
+ return {
65
+ caseType: entry.CaseName,
66
+ insKey: entry.BusinessID,
67
+ status: entry.ProcessName,
68
+ stage: entry.TaskName,
69
+ id: index
70
+ };
71
+ })
72
+ );
73
+ }
74
+ else {
75
+ setWorklist([]);
76
+ setIsLoading(false);
77
+ }
78
+
69
79
  })
70
80
  .catch((error: any) => {
81
+ setWorklist([]);
82
+ setIsLoading(false);
71
83
  console.log(error);
72
84
  });
73
- }, [PConnect]);
85
+ }, [context]);
74
86
 
75
87
  return (
76
88
  <Styled{{COMPONENT_CLASS_NAME}}Wrapper>
@@ -86,6 +98,8 @@ function {{COMPONENT_CLASS_NAME}}(props: {{COMPONENT_CLASS_NAME}}Props) {
86
98
  title={PConnect.getLocalizedValue('Work list', '', '')}
87
99
  columns={columns}
88
100
  data={worklist}
101
+ loading={isLoading}
102
+ loadingMessage={PConnect.getLocalizedValue('Loading Work list', '', '')}
89
103
  />
90
104
  </Styled{{COMPONENT_CLASS_NAME}}Wrapper>
91
105
  );
@@ -69,7 +69,7 @@
69
69
  },
70
70
  "devDependencies": {
71
71
  "@pega/configs": "^0.6.0",
72
- "@pega/custom-dx-components": "0.24.14",
72
+ "@pega/custom-dx-components": "0.24.15",
73
73
  "@pega/pcore-pconnect-typedefs": "~3.0.0",
74
74
  "@storybook/addon-actions": "^7.6.7",
75
75
  "@storybook/addon-essentials": "^7.6.7",
@@ -24,6 +24,7 @@ const Region = props => {
24
24
  return <></>;
25
25
  };
26
26
 
27
+
27
28
  const renderField = resolvedProps => {
28
29
  const {
29
30
  displayAsStatus = false,
@@ -1,5 +1,4 @@
1
1
 
2
-
3
2
  // @ts-nocheck
4
3
  export const pyReviewRaw = {
5
4
  name: 'pyReview',
@@ -18,6 +17,7 @@ export const pyReviewRaw = {
18
17
  value: '@P .pyStatusWork',
19
18
  label: '@L Work Status',
20
19
  hideLabel: true,
20
+ displayMode: 'STACKED_LARGE_VAL',
21
21
  displayAsStatus: true,
22
22
  key: 'pyStatusWork'
23
23
  }
@@ -28,6 +28,7 @@ export const pyReviewRaw = {
28
28
  value: '@P .pyID',
29
29
  label: '@L Case ID',
30
30
  hideLabel: true,
31
+ displayMode: 'STACKED_LARGE_VAL',
31
32
  key: 'pyID'
32
33
  }
33
34
  },
@@ -37,6 +38,7 @@ export const pyReviewRaw = {
37
38
  value: '@P .pxCreateDateTime',
38
39
  label: '@L Create date/time',
39
40
  hideLabel: true,
41
+ displayMode: 'STACKED_LARGE_VAL',
40
42
  key: 'pxCreateDateTime'
41
43
  }
42
44
  },
@@ -47,6 +49,7 @@ export const pyReviewRaw = {
47
49
  hideLabel: true,
48
50
  value: '@USER .pxCreateOperator',
49
51
  placeholder: 'Select...',
52
+ displayMode: 'STACKED_LARGE_VAL',
50
53
  key: 'pxCreateOperator'
51
54
  }
52
55
  }
@@ -66,6 +69,7 @@ export const pyReviewRaw = {
66
69
  {
67
70
  name: 'A',
68
71
  type: 'Region',
72
+ key: 'A',
69
73
  getPConnect: () => {
70
74
  return {
71
75
  getRawMetadata: () => {
@@ -78,17 +82,17 @@ export const pyReviewRaw = {
78
82
  type: 'DateTime',
79
83
  config: {
80
84
  value: '@P .pySLADeadline',
81
- label: '@L SLA Deadline'
82
- },
83
- key: '1'
85
+ label: '@L SLA Deadline',
86
+ key: 'pySLADeadline'
87
+ }
84
88
  },
85
89
  {
86
90
  type: 'DateTime',
87
91
  config: {
88
92
  value: '@P .pySLAGoal',
89
- label: '@L SLA Goal'
90
- },
91
- key: '2'
93
+ label: '@L SLA Goal',
94
+ key: 'pySLAGoal'
95
+ }
92
96
  },
93
97
  {
94
98
  type: 'RadioButtons',
@@ -96,9 +100,9 @@ export const pyReviewRaw = {
96
100
  value: '@P .pySLAStartTime',
97
101
  label: '@L SLA Start Time',
98
102
  listType: 'associated',
99
- datasource: '@ASSOCIATED .pySLAStartTime'
100
- },
101
- key: '3'
103
+ datasource: '@ASSOCIATED .pySLAStartTime',
104
+ key: 'pySLAStartTime'
105
+ }
102
106
  }
103
107
  ]
104
108
  }
@@ -38,6 +38,11 @@ const statelistData = {
38
38
 
39
39
  window.PCore.getDataPageUtils = () => {
40
40
  return {
41
+ getData: () => {
42
+ return new Promise(resolve => {
43
+ resolve(statelistData);
44
+ });
45
+ },
41
46
  getDataAsync: () => {
42
47
  return new Promise(resolve => {
43
48
  resolve(statelistData);
@@ -65,8 +65,11 @@ function PegaDxilMyIconButtonUrl(props: PegaDxilMyIconButtonUrlProps) {
65
65
  const { value, displayMode, countryCode = 'USA', getPConnect, testId } = props;
66
66
  const [statelist, setStatelist] = useState([]);
67
67
  const [showTable, setShowTable] = useState(false);
68
+ const [isLoading, setIsLoading] = useState(true);
68
69
  const [validUrl, setValidUrl] = useState('about:blank');
69
70
  const PConnect = getPConnect();
71
+ const dataViewName = 'D_pyStateList';
72
+ const context = PConnect.getContextName();
70
73
 
71
74
  // IMPORTANT: need to register icons used in camel case
72
75
  registerIcon(listNumber, arrowRight, globe);
@@ -111,8 +114,6 @@ function PegaDxilMyIconButtonUrl(props: PegaDxilMyIconButtonUrlProps) {
111
114
  // get data from a data page and a PConnect function
112
115
  // to get getContextName
113
116
  useEffect(() => {
114
- const dataViewName = 'D_pyStateList';
115
- const context = PConnect.getContextName();
116
117
  const params = { pyCountry: countryCode };
117
118
 
118
119
  // only retrieve table data if table is shown
@@ -121,25 +122,33 @@ function PegaDxilMyIconButtonUrl(props: PegaDxilMyIconButtonUrlProps) {
121
122
  .getDataAsync(dataViewName, context, params, null, null)
122
123
  // @ts-ignore
123
124
  .then((response: any) => {
125
+ setIsLoading(false);
124
126
  // table requires an index or will get setExtraStackFrame error
125
- setStatelist(
126
- response.data.map((entry: any, index: number) => {
127
- // mapping the data into the column names
128
- // MUST have an id/index or will get a setExtraStackFrame error
129
- // put a key in the table
130
- return {
131
- stateName: entry.pyLabel,
132
- stateCode: entry.pyStateCode,
133
- id: index
134
- };
135
- })
136
- );
127
+ if (response.data !== null) {
128
+ setStatelist(
129
+ response.data.map((entry: any, index: number) => {
130
+ // mapping the data into the column names
131
+ // MUST have an id/index or will get a setExtraStackFrame error
132
+ // put a key in the table
133
+ return {
134
+ stateName: entry.pyLabel,
135
+ stateCode: entry.pyStateCode,
136
+ id: index
137
+ };
138
+ })
139
+ );
140
+ } else {
141
+ setStatelist([]);
142
+ setIsLoading(false);
143
+ }
137
144
  })
138
145
  .catch((error: any) => {
146
+ setStatelist([]);
147
+ setIsLoading(false);
139
148
  console.log(error);
140
149
  });
141
150
  }
142
- }, [PConnect, countryCode, showTable]);
151
+ }, [context, countryCode, showTable]);
143
152
 
144
153
  // when DISPLAY_ONLY, in this example we will just show the URL.
145
154
  if (displayMode === 'DISPLAY_ONLY') {
@@ -194,6 +203,8 @@ function PegaDxilMyIconButtonUrl(props: PegaDxilMyIconButtonUrlProps) {
194
203
  title={PConnect.getLocalizedValue('State list', '', '')}
195
204
  columns={columns}
196
205
  data={statelist}
206
+ loading={isLoading}
207
+ loadingMessage={PConnect.getLocalizedValue('Loading state list', '', '')}
197
208
  />
198
209
  )}
199
210
  </StyledPegaDxilMyIconButtonUrlWrapper>
@@ -22,30 +22,37 @@ if (!window.PCore) {
22
22
  }
23
23
 
24
24
  const worklistData = {
25
- data: [
26
- {
27
- pxProcessName: 'Loan',
28
- pxRefObjectInsName: ' A-8002',
29
- pyAssignmentStatus: 'New',
30
- pxTaskLabel: 'Details'
31
- },
32
- {
33
- pxProcessName: 'Loan',
34
- pxRefObjectInsName: ' A-7001',
35
- pyAssignmentStatus: 'Open',
36
- pxTaskLabel: 'Info'
37
- },
38
- {
39
- pxProcessName: 'Loan',
40
- pxRefObjectInsName: ' A-9000',
41
- pyAssignmentStatus: 'Open',
42
- pxTaskLabel: 'Amount'
43
- }
44
- ]
25
+ data: {
26
+ data: [
27
+ {
28
+ pxProcessName: 'Loan',
29
+ pxRefObjectInsName: ' A-8002',
30
+ pyAssignmentStatus: 'New',
31
+ pxTaskLabel: 'Details'
32
+ },
33
+ {
34
+ pxProcessName: 'Loan',
35
+ pxRefObjectInsName: ' A-7001',
36
+ pyAssignmentStatus: 'Open',
37
+ pxTaskLabel: 'Info'
38
+ },
39
+ {
40
+ pxProcessName: 'Loan',
41
+ pxRefObjectInsName: ' A-9000',
42
+ pyAssignmentStatus: 'Open',
43
+ pxTaskLabel: 'Amount'
44
+ }
45
+ ]
46
+ }
45
47
  };
46
48
 
47
- window.PCore.getDataPageUtils = () => {
49
+ window.PCore.getDataApiUtils = () => {
48
50
  return {
51
+ getData: () => {
52
+ return new Promise(resolve => {
53
+ resolve(worklistData);
54
+ });
55
+ },
49
56
  getDataAsync: () => {
50
57
  return new Promise(resolve => {
51
58
  resolve(worklistData);
@@ -59,7 +66,7 @@ window.PCore.getDataPageUtils = () => {
59
66
  export const BasePegaDxilMyPageWidget: Story = args => {
60
67
 
61
68
  const props = {
62
- image: configProps.image,
69
+ ...configProps,
63
70
  getPConnect: () => {
64
71
  return {
65
72
  getValue: value => {
@@ -21,7 +21,11 @@ function PegaDxilMyPageWidget(props: PegaDxilMyPageWidgetProps) {
21
21
 
22
22
  const { header, description, datasource = [], whatsnewlink, image, getPConnect } = props;
23
23
  const [worklist, setWorklist] = useState([]);
24
+ const [isLoading, setIsLoading] = useState(true);
24
25
  const PConnect = getPConnect();
26
+ const dataViewName = 'D_pyMyWorkList';
27
+ const context = PConnect.getContextName();
28
+
25
29
  let details = [];
26
30
  // @ts-ignore
27
31
  if (datasource && datasource.source) {
@@ -44,33 +48,41 @@ function PegaDxilMyPageWidget(props: PegaDxilMyPageWidgetProps) {
44
48
  // get data from a data page and a PConnect function
45
49
  // to get getContextName
46
50
  useEffect(() => {
47
- const dataViewName = 'D_pyMyWorkList';
48
- const context = PConnect.getContextName();
49
51
 
50
- PCore.getDataPageUtils()
51
- .getDataAsync(dataViewName, context, {}, null, null)
52
+ PCore.getDataApiUtils()
53
+ .getData(dataViewName, {}, context)
52
54
  // @ts-ignore
53
55
  .then((response: any) => {
54
- // table requires an index or will get setExtraStackFrame error
55
- setWorklist(
56
- response.data.map((entry: any, index: number) => {
57
- // mapping the data into the column names
58
- // MUST have an id/index or will get a setExtraStackFrame error
59
- // put a key in the table
60
- return {
61
- caseType: entry.pxProcessName,
62
- insKey: entry.pxRefObjectInsName,
63
- status: entry.pyAssignmentStatus,
64
- stage: entry.pxTaskLabel,
65
- id: index
66
- };
67
- })
68
- );
56
+ setIsLoading(false);
57
+ if (response.data.data !== null) {
58
+ // table requires an index or will get setExtraStackFrame error
59
+ setWorklist(
60
+ response.data.data.map((entry: any, index: number) => {
61
+ // mapping the data into the column names
62
+ // MUST have an id/index or will get a setExtraStackFrame error
63
+ // put a key in the table
64
+ return {
65
+ caseType: entry.pxProcessName,
66
+ insKey: entry.pxRefObjectInsName,
67
+ status: entry.pyAssignmentStatus,
68
+ stage: entry.pxTaskLabel,
69
+ id: index
70
+ };
71
+ })
72
+ );
73
+ }
74
+ else {
75
+ setWorklist([]);
76
+ setIsLoading(false);
77
+ }
78
+
69
79
  })
70
80
  .catch((error: any) => {
81
+ setWorklist([]);
82
+ setIsLoading(false);
71
83
  console.log(error);
72
84
  });
73
- }, [PConnect]);
85
+ }, [context]);
74
86
 
75
87
  return (
76
88
  <StyledPegaDxilMyPageWidgetWrapper>
@@ -86,6 +98,8 @@ function PegaDxilMyPageWidget(props: PegaDxilMyPageWidgetProps) {
86
98
  title={PConnect.getLocalizedValue('Work list', '', '')}
87
99
  columns={columns}
88
100
  data={worklist}
101
+ loading={isLoading}
102
+ loadingMessage={PConnect.getLocalizedValue('Loading Work list', '', '')}
89
103
  />
90
104
  </StyledPegaDxilMyPageWidgetWrapper>
91
105
  );
@@ -24,6 +24,7 @@ const Region = props => {
24
24
  return <></>;
25
25
  };
26
26
 
27
+
27
28
  const renderField = resolvedProps => {
28
29
  const {
29
30
  displayAsStatus = false,
@@ -1,5 +1,4 @@
1
1
 
2
-
3
2
  // @ts-nocheck
4
3
  export const pyReviewRaw = {
5
4
  name: 'pyReview',
@@ -18,6 +17,7 @@ export const pyReviewRaw = {
18
17
  value: '@P .pyStatusWork',
19
18
  label: '@L Work Status',
20
19
  hideLabel: true,
20
+ displayMode: 'STACKED_LARGE_VAL',
21
21
  displayAsStatus: true,
22
22
  key: 'pyStatusWork'
23
23
  }
@@ -28,6 +28,7 @@ export const pyReviewRaw = {
28
28
  value: '@P .pyID',
29
29
  label: '@L Case ID',
30
30
  hideLabel: true,
31
+ displayMode: 'STACKED_LARGE_VAL',
31
32
  key: 'pyID'
32
33
  }
33
34
  },
@@ -37,6 +38,7 @@ export const pyReviewRaw = {
37
38
  value: '@P .pxCreateDateTime',
38
39
  label: '@L Create date/time',
39
40
  hideLabel: true,
41
+ displayMode: 'STACKED_LARGE_VAL',
40
42
  key: 'pxCreateDateTime'
41
43
  }
42
44
  },
@@ -47,6 +49,7 @@ export const pyReviewRaw = {
47
49
  hideLabel: true,
48
50
  value: '@USER .pxCreateOperator',
49
51
  placeholder: 'Select...',
52
+ displayMode: 'STACKED_LARGE_VAL',
50
53
  key: 'pxCreateOperator'
51
54
  }
52
55
  }
@@ -66,6 +69,7 @@ export const pyReviewRaw = {
66
69
  {
67
70
  name: 'A',
68
71
  type: 'Region',
72
+ key: 'A',
69
73
  getPConnect: () => {
70
74
  return {
71
75
  getRawMetadata: () => {
@@ -78,17 +82,17 @@ export const pyReviewRaw = {
78
82
  type: 'DateTime',
79
83
  config: {
80
84
  value: '@P .pySLADeadline',
81
- label: '@L SLA Deadline'
82
- },
83
- key: '1'
85
+ label: '@L SLA Deadline',
86
+ key: 'pySLADeadline'
87
+ }
84
88
  },
85
89
  {
86
90
  type: 'DateTime',
87
91
  config: {
88
92
  value: '@P .pySLAGoal',
89
- label: '@L SLA Goal'
90
- },
91
- key: '2'
93
+ label: '@L SLA Goal',
94
+ key: 'pySLAGoal'
95
+ }
92
96
  },
93
97
  {
94
98
  type: 'RadioButtons',
@@ -96,9 +100,9 @@ export const pyReviewRaw = {
96
100
  value: '@P .pySLAStartTime',
97
101
  label: '@L SLA Start Time',
98
102
  listType: 'associated',
99
- datasource: '@ASSOCIATED .pySLAStartTime'
100
- },
101
- key: '3'
103
+ datasource: '@ASSOCIATED .pySLAStartTime',
104
+ key: 'pySLAStartTime'
105
+ }
102
106
  }
103
107
  ]
104
108
  }
@@ -38,6 +38,11 @@ const countrylistData = {
38
38
 
39
39
  window.PCore.getDataPageUtils = () => {
40
40
  return {
41
+ getData: () => {
42
+ return new Promise(resolve => {
43
+ resolve(countrylistData);
44
+ });
45
+ },
41
46
  getDataAsync: () => {
42
47
  return new Promise(resolve => {
43
48
  resolve(countrylistData);
@@ -60,10 +60,13 @@ export const textFormatter = (value: string) => {
60
60
  // any default values in config.pros should be set in defaultProps at bottom of this file
61
61
  function PegaDxilMyIconButtonUrl(props: PegaDxilMyIconButtonUrlProps) {
62
62
  const { value, displayMode, getPConnect, testId } = props;
63
- const [statelist, setStatelist] = useState([]);
63
+ const [countrylist, setCountrylist] = useState([]);
64
64
  const [showTable, setShowTable] = useState(false);
65
+ const [isLoading, setIsLoading] = useState(true);
65
66
  const [validUrl, setValidUrl] = useState('about:blank');
66
67
  const PConnect = getPConnect();
68
+ const dataViewName = 'CountryList';
69
+ const context = PConnect.getContextName();
67
70
 
68
71
  // IMPORTANT: need to register icons used in camel case
69
72
  registerIcon(listNumber, arrowRight, globe);
@@ -108,8 +111,6 @@ function PegaDxilMyIconButtonUrl(props: PegaDxilMyIconButtonUrlProps) {
108
111
  // get data from a data page and a PConnect function
109
112
  // to get getContextName
110
113
  useEffect(() => {
111
- const dataViewName = 'CountryList';
112
- const context = PConnect.getContextName();
113
114
  const params = { };
114
115
 
115
116
  // only retrieve table data if table is shown
@@ -118,25 +119,35 @@ function PegaDxilMyIconButtonUrl(props: PegaDxilMyIconButtonUrlProps) {
118
119
  .getDataAsync(dataViewName, context, params, null, null)
119
120
  // @ts-ignore
120
121
  .then((response: any) => {
122
+ setIsLoading(false);
121
123
  // table requires an index or will get setExtraStackFrame error
122
- setStatelist(
123
- response.data.map((entry: any, index: number) => {
124
- // mapping the data into the column names
125
- // MUST have an id/index or will get a setExtraStackFrame error
126
- // put a key in the table
127
- return {
128
- countryName: entry.Name,
129
- shortName: entry.ShortName,
130
- id: index
131
- };
132
- })
133
- );
124
+ if (response.data !== null) {
125
+ setCountrylist(
126
+ response.data.map((entry: any, index: number) => {
127
+ // mapping the data into the column names
128
+ // MUST have an id/index or will get a setExtraStackFrame error
129
+ // put a key in the table
130
+ return {
131
+ countryName: entry.Name,
132
+ shortName: entry.ShortName,
133
+ id: index
134
+ };
135
+ })
136
+ );
137
+ }
138
+ else {
139
+ setCountrylist([]);
140
+ setIsLoading(false);
141
+ }
142
+
134
143
  })
135
144
  .catch((error: any) => {
145
+ setCountrylist([]);
146
+ setIsLoading(false);
136
147
  console.log(error);
137
148
  });
138
149
  }
139
- }, [PConnect, showTable]);
150
+ }, [context, showTable]);
140
151
 
141
152
  // when DISPLAY_ONLY, in this example we will just show the URL.
142
153
  if (displayMode === 'DISPLAY_ONLY') {
@@ -189,7 +200,9 @@ function PegaDxilMyIconButtonUrl(props: PegaDxilMyIconButtonUrlProps) {
189
200
  <Table
190
201
  title={PConnect.getLocalizedValue('State list', '', '')}
191
202
  columns={columns}
192
- data={statelist}
203
+ data={countrylist}
204
+ loading={isLoading}
205
+ loadingMessage={PConnect.getLocalizedValue('Loading country list', '', '')}
193
206
  />
194
207
  )}
195
208
  </StyledPegaDxilMyIconButtonUrlWrapper>
@@ -22,30 +22,38 @@ if (!window.PCore) {
22
22
  }
23
23
 
24
24
  const worklistData = {
25
- data: [
26
- {
27
- CaseName: 'Loan',
28
- BusinessID: ' A-8002',
29
- ProcessName: 'New',
30
- TaskName: 'Details'
31
- },
32
- {
33
- CaseName: 'Loan',
34
- BusinessID: ' A-7001',
35
- ProcessName: 'Open',
36
- TaskName: 'Info'
37
- },
38
- {
39
- CaseName: 'Loan',
40
- BusinessID: ' A-9000',
41
- ProcessName: 'Open',
42
- TaskName: 'Amount'
43
- }
44
- ]
25
+ data: {
26
+ data: [
27
+ {
28
+ CaseName: 'Loan',
29
+ BusinessID: ' A-8002',
30
+ ProcessName: 'New',
31
+ TaskName: 'Details'
32
+ },
33
+ {
34
+ CaseName: 'Loan',
35
+ BusinessID: ' A-7001',
36
+ ProcessName: 'Open',
37
+ TaskName: 'Info'
38
+ },
39
+ {
40
+ CaseName: 'Loan',
41
+ BusinessID: ' A-9000',
42
+ ProcessName: 'Open',
43
+ TaskName: 'Amount'
44
+ }
45
+ ]
46
+ }
47
+
45
48
  };
46
49
 
47
- window.PCore.getDataPageUtils = () => {
50
+ window.PCore.getDataApiUtils = () => {
48
51
  return {
52
+ getData: () => {
53
+ return new Promise(resolve => {
54
+ resolve(worklistData);
55
+ });
56
+ },
49
57
  getDataAsync: () => {
50
58
  return new Promise(resolve => {
51
59
  resolve(worklistData);
@@ -59,7 +67,7 @@ window.PCore.getDataPageUtils = () => {
59
67
  export const BasePegaDxilMyPageWidget: Story = args => {
60
68
 
61
69
  const props = {
62
- image: configProps.image,
70
+ ...configProps,
63
71
  getPConnect: () => {
64
72
  return {
65
73
  getValue: value => {
@@ -21,7 +21,11 @@ function PegaDxilMyPageWidget(props: PegaDxilMyPageWidgetProps) {
21
21
 
22
22
  const { header, description, datasource = [], whatsnewlink, image, getPConnect } = props;
23
23
  const [worklist, setWorklist] = useState([]);
24
+ const [isLoading, setIsLoading] = useState(true);
24
25
  const PConnect = getPConnect();
26
+ const dataViewName = 'MyWorkList';
27
+ const context = PConnect.getContextName();
28
+
25
29
  let details = [];
26
30
  // @ts-ignore
27
31
  if (datasource && datasource.source) {
@@ -44,33 +48,41 @@ function PegaDxilMyPageWidget(props: PegaDxilMyPageWidgetProps) {
44
48
  // get data from a data page and a PConnect function
45
49
  // to get getContextName
46
50
  useEffect(() => {
47
- const dataViewName = 'MyWorkList';
48
- const context = PConnect.getContextName();
49
51
 
50
- PCore.getDataPageUtils()
51
- .getDataAsync(dataViewName, context, {}, null, null)
52
+ PCore.getDataApiUtils()
53
+ .getData(dataViewName, {}, context)
52
54
  // @ts-ignore
53
55
  .then((response: any) => {
54
- // table requires an index or will get setExtraStackFrame error
55
- setWorklist(
56
- response.data.map((entry: any, index: number) => {
57
- // mapping the data into the column names
58
- // MUST have an id/index or will get a setExtraStackFrame error
59
- // put a key in the table
60
- return {
61
- caseType: entry.CaseName,
62
- insKey: entry.BusinessID,
63
- status: entry.ProcessName,
64
- stage: entry.TaskName,
65
- id: index
66
- };
67
- })
68
- );
56
+ setIsLoading(false);
57
+ if (response.data.data !== null) {
58
+ // table requires an index or will get setExtraStackFrame error
59
+ setWorklist(
60
+ response.data.data.map((entry: any, index: number) => {
61
+ // mapping the data into the column names
62
+ // MUST have an id/index or will get a setExtraStackFrame error
63
+ // put a key in the table
64
+ return {
65
+ caseType: entry.CaseName,
66
+ insKey: entry.BusinessID,
67
+ status: entry.ProcessName,
68
+ stage: entry.TaskName,
69
+ id: index
70
+ };
71
+ })
72
+ );
73
+ }
74
+ else {
75
+ setWorklist([]);
76
+ setIsLoading(false);
77
+ }
78
+
69
79
  })
70
80
  .catch((error: any) => {
81
+ setWorklist([]);
82
+ setIsLoading(false);
71
83
  console.log(error);
72
84
  });
73
- }, [PConnect]);
85
+ }, [context]);
74
86
 
75
87
  return (
76
88
  <StyledPegaDxilMyPageWidgetWrapper>
@@ -86,6 +98,8 @@ function PegaDxilMyPageWidget(props: PegaDxilMyPageWidgetProps) {
86
98
  title={PConnect.getLocalizedValue('Work list', '', '')}
87
99
  columns={columns}
88
100
  data={worklist}
101
+ loading={isLoading}
102
+ loadingMessage={PConnect.getLocalizedValue('Loading Work list', '', '')}
89
103
  />
90
104
  </StyledPegaDxilMyPageWidgetWrapper>
91
105
  );