@pega/react-sdk-overrides 0.23.20 → 0.23.21
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/lib/designSystemExtension/Banner/Banner.css +35 -0
- package/lib/designSystemExtension/Banner/Banner.tsx +33 -0
- package/lib/designSystemExtension/Banner/index.tsx +1 -0
- package/lib/designSystemExtension/CaseSummaryFields/CaseSummaryFields.tsx +1 -2
- package/lib/field/DateTime/DateTime.tsx +6 -7
- package/lib/helpers/template-utils.ts +7 -7
- package/lib/infra/Assignment/Assignment.tsx +126 -109
- package/lib/infra/Containers/FlowContainer/FlowContainer.tsx +5 -5
- package/lib/template/AppShell/AppShell.tsx +159 -27
- package/lib/template/BannerPage/BannerPage.tsx +61 -0
- package/lib/template/BannerPage/index.tsx +1 -0
- package/lib/template/Confirmation/Confirmation.tsx +29 -11
- package/lib/template/WssNavBar/WssNavBar.css +5 -0
- package/lib/template/WssNavBar/WssNavBar.tsx +141 -0
- package/lib/template/WssNavBar/index.tsx +1 -0
- package/lib/widget/Attachment/Attachment.tsx +9 -10
- package/lib/widget/ToDo/ToDo.tsx +73 -63
- package/package.json +1 -1
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
.background-image-style {
|
|
2
|
+
margin-left: -16px;
|
|
3
|
+
margin-right: -16px;
|
|
4
|
+
height: calc(19rem);
|
|
5
|
+
background-size: cover;
|
|
6
|
+
background-position: center center;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.background-style {
|
|
10
|
+
background-color: transparent;
|
|
11
|
+
color: rgb(0, 0, 0);
|
|
12
|
+
width: 100%;
|
|
13
|
+
height: 100%;
|
|
14
|
+
text-align: center;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.content {
|
|
18
|
+
display: flex;
|
|
19
|
+
flex-direction: column;
|
|
20
|
+
justify-content: center;
|
|
21
|
+
align-items: center;
|
|
22
|
+
gap: calc(0.5rem);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.title {
|
|
26
|
+
margin: 0rem;
|
|
27
|
+
font-size: 1.728rem;
|
|
28
|
+
font-weight: 600;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.message {
|
|
32
|
+
margin: 0;
|
|
33
|
+
font-size: 1rem;
|
|
34
|
+
font-weight: 400;
|
|
35
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import Grid from '@material-ui/core/Grid';
|
|
3
|
+
import './Banner.css';
|
|
4
|
+
|
|
5
|
+
export default function Banner(props) {
|
|
6
|
+
const { a, b, banner } = props;
|
|
7
|
+
const { title, message, backgroundImage } = banner;
|
|
8
|
+
return (
|
|
9
|
+
<div>
|
|
10
|
+
<div
|
|
11
|
+
className='background-image-style'
|
|
12
|
+
style={{ backgroundImage: `url(${backgroundImage})` }}
|
|
13
|
+
>
|
|
14
|
+
<div className='background-style content'>
|
|
15
|
+
<div>
|
|
16
|
+
<h1 className='title'>{title}</h1>
|
|
17
|
+
<p className='message'>{message}</p>
|
|
18
|
+
</div>
|
|
19
|
+
</div>
|
|
20
|
+
</div>
|
|
21
|
+
<div style={{ padding: '1rem' }}>
|
|
22
|
+
<Grid container item xs={12} spacing={1}>
|
|
23
|
+
<Grid item xs={8} style={{ padding: '1em' }}>
|
|
24
|
+
{a}
|
|
25
|
+
</Grid>
|
|
26
|
+
<Grid item xs={4} style={{ padding: '1em' }}>
|
|
27
|
+
{b}
|
|
28
|
+
</Grid>
|
|
29
|
+
</Grid>
|
|
30
|
+
</div>
|
|
31
|
+
</div>
|
|
32
|
+
);
|
|
33
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './Banner';
|
|
@@ -125,8 +125,7 @@ export default function CaseSummaryFields(props) {
|
|
|
125
125
|
case 'date':
|
|
126
126
|
case 'datetime': {
|
|
127
127
|
const theDateFormatInfo = getDateFormatInfo();
|
|
128
|
-
//
|
|
129
|
-
console.log(`theDateFormatInfo: ${theDateFormatInfo}`);
|
|
128
|
+
// console.log(`theDateFormatInfo: ${theDateFormatInfo}`);
|
|
130
129
|
const theFormat = (fieldTypeLower === 'datetime') ? `${theDateFormatInfo.dateFormatStringLong} hh:mm a` : theDateFormatInfo.dateFormatStringLong
|
|
131
130
|
|
|
132
131
|
return (
|
|
@@ -38,19 +38,18 @@ export default function DateTime(props) {
|
|
|
38
38
|
|
|
39
39
|
|
|
40
40
|
if (displayMode === 'LABELS_LEFT') {
|
|
41
|
-
const
|
|
42
|
-
return <FieldValueList name={hideLabel ? '' : label} value={
|
|
41
|
+
const formattedDateTime = format(props.value, 'datetime', { format: `${dateFormatInfo.dateFormatString} hh:mm a` });
|
|
42
|
+
return <FieldValueList name={hideLabel ? '' : label} value={formattedDateTime} />;
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
if (displayMode === 'STACKED_LARGE_VAL') {
|
|
46
|
-
const
|
|
47
|
-
return <FieldValueList name={hideLabel ? '' : label} value={
|
|
46
|
+
const formattedDateTime = format(props.value, 'datetime', { format: `${dateFormatInfo.dateFormatString} hh:mm a` });
|
|
47
|
+
return <FieldValueList name={hideLabel ? '' : label} value={formattedDateTime} variant='stacked' />;
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
if (readOnly) {
|
|
51
|
-
const
|
|
52
|
-
props
|
|
53
|
-
return <TextInput {...props} />;
|
|
51
|
+
const formattedDateTime = format(props.value, 'datetime');
|
|
52
|
+
return <TextInput {...props} value={formattedDateTime} />;
|
|
54
53
|
}
|
|
55
54
|
|
|
56
55
|
const handleChange = date => {
|
|
@@ -6,16 +6,15 @@ export function getAllFields(pConnect: any) {
|
|
|
6
6
|
const metadata = pConnect.getRawMetadata();
|
|
7
7
|
let allFields = [];
|
|
8
8
|
if (metadata.children && metadata.children.map) {
|
|
9
|
-
allFields = metadata.children.map(
|
|
9
|
+
allFields = metadata.children.map(fields => {
|
|
10
10
|
const children = fields.children instanceof Array ? fields.children : [];
|
|
11
|
-
return children.map(
|
|
11
|
+
return children.map(field => field.config);
|
|
12
12
|
});
|
|
13
13
|
}
|
|
14
14
|
return allFields;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
export function filterForFieldValueList(fields : any) {
|
|
17
|
+
export function filterForFieldValueList(fields: any) {
|
|
19
18
|
return fields
|
|
20
19
|
.filter(({ visibility }) => visibility !== false)
|
|
21
20
|
.map(({ value, label }) => ({
|
|
@@ -25,12 +24,11 @@ export function filterForFieldValueList(fields : any) {
|
|
|
25
24
|
}));
|
|
26
25
|
}
|
|
27
26
|
|
|
28
|
-
|
|
29
27
|
/**
|
|
30
28
|
* Determine if the current view is the view of the case step/assignment.
|
|
31
29
|
* @param {Function} pConnect PConnect object for the component
|
|
32
30
|
*/
|
|
33
|
-
|
|
31
|
+
export function getIsAssignmentView(pConnect) {
|
|
34
32
|
// Get caseInfo content from the store which contains the view info about the current assignment/step
|
|
35
33
|
// TODO To be replaced with pConnect.getCaseInfo().getCurrentAssignmentView when it's available
|
|
36
34
|
const assignmentViewClass = pConnect.getValue(PCore.getConstants().CASE_INFO.CASE_INFO_CLASSID);
|
|
@@ -50,7 +48,9 @@ export function filterForFieldValueList(fields : any) {
|
|
|
50
48
|
* @param {string} [instructions="casestep"] 'casestep', 'none', or the html content of a Rule-UI-Paragraph rule (processed via core's paragraph annotation handler)
|
|
51
49
|
*/
|
|
52
50
|
export function getInstructions(pConnect, instructions = 'casestep') {
|
|
53
|
-
const caseStepInstructions =
|
|
51
|
+
const caseStepInstructions =
|
|
52
|
+
PCore.getConstants().CASE_INFO.INSTRUCTIONS &&
|
|
53
|
+
pConnect.getValue(PCore.getConstants().CASE_INFO.INSTRUCTIONS);
|
|
54
54
|
|
|
55
55
|
// Determine if this view is the current assignment/step view
|
|
56
56
|
const isCurrentAssignmentView = getIsAssignmentView(pConnect);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import React, { useState, useEffect } from
|
|
2
|
-
import PropTypes from
|
|
1
|
+
import React, { useState, useEffect } from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
3
|
|
|
4
4
|
import AssignmentCard from '@pega/react-sdk-components/lib/components/infra/AssignmentCard';
|
|
5
5
|
import MultiStep from '@pega/react-sdk-components/lib/components/infra/MultiStep';
|
|
@@ -14,7 +14,7 @@ export default function Assignment(props) {
|
|
|
14
14
|
const thePConn = getPConnect();
|
|
15
15
|
|
|
16
16
|
const [bHasNavigation, setHasNavigation] = useState(false);
|
|
17
|
-
const [actionButtons, setActionButtons] = useState(
|
|
17
|
+
const [actionButtons, setActionButtons] = useState({});
|
|
18
18
|
const [bIsVertical, setIsVertical] = useState(false);
|
|
19
19
|
const [arCurrentStepIndicies, setArCurrentStepIndicies] = useState<Array<any>>([]);
|
|
20
20
|
const [arNavigationSteps, setArNavigationSteps] = useState<Array<any>>([]);
|
|
@@ -30,40 +30,38 @@ export default function Assignment(props) {
|
|
|
30
30
|
// const showPage = actionsAPI.showPage.bind(actionsAPI);
|
|
31
31
|
|
|
32
32
|
const [showSnackbar, setShowSnackbar] = useState(false);
|
|
33
|
-
const [snackbarMessage, setSnackbarMessage] = useState(
|
|
34
|
-
|
|
35
|
-
function findCurrentIndicies(arStepperSteps: Array<any>, arIndicies: Array<number>, depth: number) : Array<number> {
|
|
33
|
+
const [snackbarMessage, setSnackbarMessage] = useState('');
|
|
36
34
|
|
|
35
|
+
function findCurrentIndicies(
|
|
36
|
+
arStepperSteps: Array<any>,
|
|
37
|
+
arIndicies: Array<number>,
|
|
38
|
+
depth: number
|
|
39
|
+
): Array<number> {
|
|
37
40
|
let count = 0;
|
|
38
|
-
arStepperSteps.forEach(
|
|
39
|
-
if (step.visited_status ===
|
|
41
|
+
arStepperSteps.forEach(step => {
|
|
42
|
+
if (step.visited_status === 'current') {
|
|
40
43
|
arIndicies[depth] = count;
|
|
41
44
|
|
|
42
45
|
// add in
|
|
43
|
-
step[
|
|
44
|
-
}
|
|
45
|
-
else if (step.visited_status === "success") {
|
|
46
|
+
step['step_status'] = '';
|
|
47
|
+
} else if (step.visited_status === 'success') {
|
|
46
48
|
count += 1;
|
|
47
|
-
step.step_status =
|
|
48
|
-
}
|
|
49
|
-
else {
|
|
49
|
+
step.step_status = 'completed';
|
|
50
|
+
} else {
|
|
50
51
|
count += 1;
|
|
51
|
-
step.step_status =
|
|
52
|
+
step.step_status = '';
|
|
52
53
|
}
|
|
53
54
|
|
|
54
55
|
if (step.steps) {
|
|
55
|
-
arIndicies = findCurrentIndicies(step.steps, arIndicies, depth + 1)
|
|
56
|
+
arIndicies = findCurrentIndicies(step.steps, arIndicies, depth + 1);
|
|
56
57
|
}
|
|
57
58
|
});
|
|
58
59
|
|
|
59
60
|
return arIndicies;
|
|
60
61
|
}
|
|
61
62
|
|
|
62
|
-
|
|
63
|
-
useEffect( ()=> {
|
|
64
|
-
|
|
63
|
+
useEffect(() => {
|
|
65
64
|
if (children && children.length > 0) {
|
|
66
|
-
|
|
67
65
|
// debugger;
|
|
68
66
|
|
|
69
67
|
const oWorkItem = children[0].props.getPConnect();
|
|
@@ -77,32 +75,32 @@ export default function Assignment(props) {
|
|
|
77
75
|
setActionButtons(oCaseInfo.actionButtons);
|
|
78
76
|
}
|
|
79
77
|
|
|
80
|
-
if (
|
|
78
|
+
if (oCaseInfo?.navigation /* was oCaseInfo.navigation != null */) {
|
|
81
79
|
setHasNavigation(true);
|
|
82
80
|
|
|
83
|
-
if (
|
|
81
|
+
if (
|
|
82
|
+
oCaseInfo.navigation.template &&
|
|
83
|
+
oCaseInfo.navigation.template.toLowerCase() === 'standard'
|
|
84
|
+
) {
|
|
84
85
|
setHasNavigation(false);
|
|
85
|
-
}
|
|
86
|
-
|
|
86
|
+
} else if (
|
|
87
|
+
oCaseInfo.navigation.template &&
|
|
88
|
+
oCaseInfo.navigation.template.toLowerCase() === 'vertical'
|
|
89
|
+
) {
|
|
87
90
|
setIsVertical(true);
|
|
88
|
-
}
|
|
89
|
-
else {
|
|
91
|
+
} else {
|
|
90
92
|
setIsVertical(false);
|
|
91
93
|
}
|
|
92
94
|
|
|
93
95
|
setArNavigationSteps(JSON.parse(JSON.stringify(oCaseInfo.navigation.steps)));
|
|
94
|
-
setArCurrentStepIndicies(
|
|
95
|
-
|
|
96
|
+
setArCurrentStepIndicies(
|
|
97
|
+
findCurrentIndicies(arNavigationSteps, arCurrentStepIndicies, 0)
|
|
98
|
+
);
|
|
96
99
|
}
|
|
97
100
|
}
|
|
98
|
-
|
|
99
101
|
}
|
|
100
|
-
|
|
101
|
-
|
|
102
102
|
}, [children]);
|
|
103
103
|
|
|
104
|
-
|
|
105
|
-
|
|
106
104
|
function showToast(message: string) {
|
|
107
105
|
const theMessage = `Assignment: ${message}`;
|
|
108
106
|
// eslint-disable-next-line no-console
|
|
@@ -111,61 +109,65 @@ export default function Assignment(props) {
|
|
|
111
109
|
setShowSnackbar(true);
|
|
112
110
|
}
|
|
113
111
|
|
|
114
|
-
|
|
115
112
|
function handleSnackbarClose(event: React.SyntheticEvent | React.MouseEvent, reason?: string) {
|
|
116
113
|
if (reason === 'clickaway') {
|
|
117
114
|
return;
|
|
118
115
|
}
|
|
119
116
|
setShowSnackbar(false);
|
|
120
|
-
}
|
|
117
|
+
}
|
|
121
118
|
|
|
122
119
|
function onSaveActionSuccess(data) {
|
|
123
120
|
actionsAPI.cancelAssignment(itemKey).then(() => {
|
|
124
|
-
PCore.getPubSubUtils().publish(
|
|
121
|
+
PCore.getPubSubUtils().publish(
|
|
122
|
+
PCore.getConstants().PUB_SUB_EVENTS.CASE_EVENTS.CREATE_STAGE_SAVED,
|
|
123
|
+
data
|
|
124
|
+
);
|
|
125
125
|
});
|
|
126
126
|
}
|
|
127
127
|
|
|
128
128
|
function buttonPress(sAction: string, sButtonType: string) {
|
|
129
|
-
|
|
130
|
-
if (sButtonType === "secondary") {
|
|
131
|
-
|
|
129
|
+
if (sButtonType === 'secondary') {
|
|
132
130
|
switch (sAction) {
|
|
133
|
-
case
|
|
134
|
-
const navigatePromise = navigateToStep(
|
|
131
|
+
case 'navigateToStep': {
|
|
132
|
+
const navigatePromise = navigateToStep('previous', itemKey);
|
|
135
133
|
|
|
136
134
|
navigatePromise
|
|
137
|
-
.then(() => {
|
|
138
|
-
})
|
|
135
|
+
.then(() => {})
|
|
139
136
|
.catch(() => {
|
|
140
|
-
showToast(
|
|
137
|
+
showToast(`Navigation failed!`);
|
|
141
138
|
});
|
|
142
139
|
|
|
143
140
|
break;
|
|
144
141
|
}
|
|
145
142
|
|
|
146
|
-
case
|
|
143
|
+
case 'saveAssignment': {
|
|
147
144
|
const caseID = thePConn.getCaseInfo().getKey();
|
|
148
145
|
const assignmentID = thePConn.getCaseInfo().getAssignmentID();
|
|
149
146
|
const savePromise = saveAssignment(itemKey);
|
|
150
147
|
|
|
151
148
|
savePromise
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
149
|
+
.then(() => {
|
|
150
|
+
const caseType = thePConn
|
|
151
|
+
.getCaseInfo()
|
|
152
|
+
.c11nEnv.getValue(PCore.getConstants().CASE_INFO.CASE_TYPE_ID);
|
|
153
|
+
onSaveActionSuccess({ caseType, caseID, assignmentID });
|
|
154
|
+
})
|
|
155
|
+
.catch(() => {
|
|
156
|
+
showToast('Save failed');
|
|
157
|
+
});
|
|
159
158
|
|
|
160
159
|
break;
|
|
161
160
|
}
|
|
162
161
|
|
|
163
|
-
case
|
|
162
|
+
case 'cancelAssignment': {
|
|
164
163
|
// check if create stage (modal)
|
|
165
164
|
const { PUB_SUB_EVENTS } = PCore.getConstants();
|
|
166
165
|
const { publish } = PCore.getPubSubUtils();
|
|
167
166
|
const isAssignmentInCreateStage = thePConn.getCaseInfo().isAssignmentInCreateStage();
|
|
168
|
-
const isLocalAction =
|
|
167
|
+
const isLocalAction =
|
|
168
|
+
thePConn.getCaseInfo().isLocalAction() ||
|
|
169
|
+
(PCore.getConstants().CASE_INFO.IS_LOCAL_ACTION &&
|
|
170
|
+
getPConnect().getValue(PCore.getConstants().CASE_INFO.IS_LOCAL_ACTION));
|
|
169
171
|
if (isAssignmentInCreateStage && isInModal && !isLocalAction) {
|
|
170
172
|
const cancelPromise = cancelCreateStageAssignment(itemKey);
|
|
171
173
|
|
|
@@ -193,73 +195,89 @@ export default function Assignment(props) {
|
|
|
193
195
|
default:
|
|
194
196
|
break;
|
|
195
197
|
}
|
|
196
|
-
}
|
|
197
|
-
else if (sButtonType === "primary") {
|
|
198
|
+
} else if (sButtonType === 'primary') {
|
|
198
199
|
// eslint-disable-next-line sonarjs/no-small-switch
|
|
199
200
|
switch (sAction) {
|
|
200
|
-
case
|
|
201
|
-
|
|
202
|
-
const finishPromise = finishAssignment(itemKey);
|
|
201
|
+
case 'finishAssignment': {
|
|
202
|
+
const finishPromise = finishAssignment(itemKey);
|
|
203
203
|
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
});
|
|
204
|
+
finishPromise
|
|
205
|
+
.then(() => {})
|
|
206
|
+
.catch(() => {
|
|
207
|
+
showToast(`Submit failed!`);
|
|
208
|
+
});
|
|
210
209
|
|
|
211
|
-
|
|
212
|
-
|
|
210
|
+
break;
|
|
211
|
+
}
|
|
213
212
|
|
|
214
213
|
default:
|
|
215
214
|
break;
|
|
216
215
|
}
|
|
217
216
|
}
|
|
218
|
-
|
|
219
217
|
}
|
|
220
218
|
|
|
221
|
-
|
|
222
219
|
return (
|
|
223
|
-
<div id=
|
|
224
|
-
{
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
220
|
+
<div id='Assignment'>
|
|
221
|
+
{bHasNavigation ? (
|
|
222
|
+
<React.Fragment>
|
|
223
|
+
<MultiStep
|
|
224
|
+
getPConnect={getPConnect}
|
|
225
|
+
itemKey={itemKey}
|
|
226
|
+
actionButtons={actionButtons}
|
|
227
|
+
onButtonPress={buttonPress}
|
|
228
|
+
bIsVertical={bIsVertical}
|
|
229
|
+
arCurrentStepIndicies={arCurrentStepIndicies}
|
|
230
|
+
arNavigationSteps={arNavigationSteps}
|
|
231
|
+
>
|
|
232
|
+
{children}
|
|
233
|
+
</MultiStep>
|
|
234
|
+
<Snackbar
|
|
235
|
+
open={showSnackbar}
|
|
236
|
+
autoHideDuration={3000}
|
|
237
|
+
onClose={handleSnackbarClose}
|
|
238
|
+
message={snackbarMessage}
|
|
239
|
+
action={
|
|
240
|
+
<IconButton
|
|
241
|
+
size='small'
|
|
242
|
+
aria-label='close'
|
|
243
|
+
color='inherit'
|
|
244
|
+
onClick={handleSnackbarClose}
|
|
245
|
+
>
|
|
246
|
+
<CloseIcon fontSize='small' />
|
|
247
|
+
</IconButton>
|
|
248
|
+
}
|
|
249
|
+
/>
|
|
250
|
+
</React.Fragment>
|
|
251
|
+
) : (
|
|
252
|
+
<React.Fragment>
|
|
253
|
+
<AssignmentCard
|
|
254
|
+
getPConnect={getPConnect}
|
|
255
|
+
itemKey={itemKey}
|
|
256
|
+
actionButtons={actionButtons}
|
|
257
|
+
onButtonPress={buttonPress}
|
|
258
|
+
>
|
|
259
|
+
{children}
|
|
260
|
+
</AssignmentCard>
|
|
261
|
+
<Snackbar
|
|
262
|
+
open={showSnackbar}
|
|
263
|
+
autoHideDuration={3000}
|
|
264
|
+
onClose={handleSnackbarClose}
|
|
265
|
+
message={snackbarMessage}
|
|
266
|
+
action={
|
|
267
|
+
<IconButton
|
|
268
|
+
size='small'
|
|
269
|
+
aria-label='close'
|
|
270
|
+
color='inherit'
|
|
271
|
+
onClick={handleSnackbarClose}
|
|
272
|
+
>
|
|
273
|
+
<CloseIcon fontSize='small' />
|
|
274
|
+
</IconButton>
|
|
275
|
+
}
|
|
276
|
+
/>
|
|
277
|
+
</React.Fragment>
|
|
278
|
+
)}
|
|
261
279
|
</div>
|
|
262
|
-
)
|
|
280
|
+
);
|
|
263
281
|
}
|
|
264
282
|
|
|
265
283
|
// From WC SDK
|
|
@@ -286,7 +304,6 @@ export default function Assignment(props) {
|
|
|
286
304
|
// </div>`}
|
|
287
305
|
// `;
|
|
288
306
|
|
|
289
|
-
|
|
290
307
|
Assignment.propTypes = {
|
|
291
308
|
children: PropTypes.node.isRequired,
|
|
292
309
|
getPConnect: PropTypes.func.isRequired,
|
|
@@ -171,7 +171,7 @@ export default function FlowContainer(props) {
|
|
|
171
171
|
|
|
172
172
|
if (bLoadChildren && oWorkData) {
|
|
173
173
|
// debugger;
|
|
174
|
-
setContainerName(oWorkData.caseInfo.assignments[0].name);
|
|
174
|
+
setContainerName(oWorkData.caseInfo.assignments?.[0].name);
|
|
175
175
|
}
|
|
176
176
|
|
|
177
177
|
// debugger;
|
|
@@ -253,7 +253,7 @@ export default function FlowContainer(props) {
|
|
|
253
253
|
|
|
254
254
|
const caseActions = ourPConn.getValue(CASE_CONSTS.CASE_INFO_ACTIONS);
|
|
255
255
|
const activeActionID = ourPConn.getValue(CASE_CONSTS.ACTIVE_ACTION_ID);
|
|
256
|
-
const activeAction = caseActions
|
|
256
|
+
const activeAction = caseActions?.find(action => action.ID === activeActionID);
|
|
257
257
|
if (activeAction) {
|
|
258
258
|
activeActionLabel = activeAction.name;
|
|
259
259
|
}
|
|
@@ -396,7 +396,7 @@ export default function FlowContainer(props) {
|
|
|
396
396
|
// check if have oWorkData, there are times due to timing of state change, when this
|
|
397
397
|
// may not be available
|
|
398
398
|
if (oWorkData) {
|
|
399
|
-
setContainerName(getActiveViewLabel() || oWorkData.caseInfo.assignments[0].name);
|
|
399
|
+
setContainerName(getActiveViewLabel() || oWorkData.caseInfo.assignments?.[0].name);
|
|
400
400
|
}
|
|
401
401
|
}
|
|
402
402
|
}
|
|
@@ -405,7 +405,7 @@ export default function FlowContainer(props) {
|
|
|
405
405
|
|
|
406
406
|
const caseId = thePConn.getCaseSummary().content.pyID;
|
|
407
407
|
const urgency = getPConnect().getCaseSummary().assignments
|
|
408
|
-
? getPConnect().getCaseSummary().assignments[0].urgency
|
|
408
|
+
? getPConnect().getCaseSummary().assignments?.[0].urgency
|
|
409
409
|
: '';
|
|
410
410
|
const operatorInitials = Utils.getInitials(PCore.getEnvironmentInfo().getOperatorName());
|
|
411
411
|
let instructionText = thePConn.getCaseSummary()?.assignments?.[0]?.instructions;
|
|
@@ -465,7 +465,7 @@ export default function FlowContainer(props) {
|
|
|
465
465
|
<Alert severity='success'>{caseMessages}</Alert>
|
|
466
466
|
</div>
|
|
467
467
|
)}
|
|
468
|
-
{bShowConfirm && <
|
|
468
|
+
{bShowConfirm && <div>{arNewChildrenAsReact}</div>}
|
|
469
469
|
</div>
|
|
470
470
|
);
|
|
471
471
|
}
|
|
@@ -1,24 +1,33 @@
|
|
|
1
|
-
import React, { useEffect, useState } from
|
|
2
|
-
import PropTypes from
|
|
1
|
+
import React, { useEffect, useState } from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
3
|
import { makeStyles } from '@material-ui/core/styles';
|
|
4
|
-
|
|
4
|
+
import { Utils } from '@pega/react-sdk-components/lib/components/helpers/utils';
|
|
5
|
+
import Avatar from '@material-ui/core/Avatar';
|
|
5
6
|
import { NavContext } from '@pega/react-sdk-components/lib/components/helpers/reactContextHelpers';
|
|
6
7
|
import './AppShell.css';
|
|
7
8
|
|
|
8
|
-
// AppShell can emit NavBar
|
|
9
|
+
// AppShell can emit NavBar or WssNavBar
|
|
9
10
|
import NavBar from '@pega/react-sdk-components/lib/components/infra/NavBar';
|
|
11
|
+
import WssNavBar from '@pega/react-sdk-components/lib/components/template/WssNavBar';
|
|
10
12
|
|
|
11
|
-
const useStyles = makeStyles(
|
|
13
|
+
const useStyles = makeStyles(theme => ({
|
|
12
14
|
root: {
|
|
13
|
-
display: 'flex'
|
|
15
|
+
display: 'flex'
|
|
14
16
|
},
|
|
15
17
|
content: {
|
|
16
18
|
flexGrow: 1,
|
|
17
19
|
height: '100vh',
|
|
18
20
|
overflow: 'auto',
|
|
19
21
|
marginLeft: theme.spacing(2),
|
|
20
|
-
marginRight: theme.spacing(2)
|
|
22
|
+
marginRight: theme.spacing(2)
|
|
21
23
|
},
|
|
24
|
+
wsscontent: {
|
|
25
|
+
flexGrow: 1,
|
|
26
|
+
height: '100vh',
|
|
27
|
+
overflow: 'auto',
|
|
28
|
+
marginLeft: theme.spacing(1),
|
|
29
|
+
marginRight: theme.spacing(1)
|
|
30
|
+
}
|
|
22
31
|
}));
|
|
23
32
|
|
|
24
33
|
declare const PCore;
|
|
@@ -31,53 +40,176 @@ export default function AppShell(props) {
|
|
|
31
40
|
showAppName,
|
|
32
41
|
children,
|
|
33
42
|
getPConnect,
|
|
43
|
+
portalTemplate,
|
|
44
|
+
portalName,
|
|
45
|
+
portalLogo,
|
|
46
|
+
navDisplayOptions
|
|
34
47
|
} = props;
|
|
35
48
|
const [open, setOpen] = useState(true);
|
|
36
|
-
|
|
49
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars, no-unused-vars
|
|
50
|
+
const [activeTab, setActiveTab] = useState(!pages ? null : pages[0]?.pyRuleName);
|
|
37
51
|
const pConn = getPConnect();
|
|
38
52
|
const envInfo = PCore.getEnvironmentInfo();
|
|
39
|
-
|
|
40
|
-
const
|
|
41
|
-
|
|
53
|
+
const imageKey = envInfo.getOperatorImageInsKey();
|
|
54
|
+
const userName = envInfo.getOperatorName();
|
|
55
|
+
const currentUserInitials = Utils.getInitials(userName);
|
|
56
|
+
const appNameToDisplay = showAppName ? envInfo.getApplicationLabel() : '';
|
|
57
|
+
const portalClass = pConn.getValue('.classID');
|
|
58
|
+
const envPortalName = envInfo.getPortalName();
|
|
59
|
+
const localeUtils = PCore.getLocaleUtils();
|
|
42
60
|
const classes = useStyles();
|
|
43
|
-
|
|
61
|
+
const actionsAPI = pConn.getActionsApi();
|
|
62
|
+
const localeReference = pConn.getValue('.pyLocaleReference');
|
|
63
|
+
const [imageBlobUrl, setImageBlobUrl] = useState(null);
|
|
44
64
|
// useState for appName and mapChildren - note these are ONLY updated once (on component mount!)
|
|
45
65
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars, no-unused-vars
|
|
46
|
-
const [appName, setAppName] = useState(
|
|
66
|
+
const [appName, setAppName] = useState('');
|
|
47
67
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars, no-unused-vars
|
|
48
68
|
const [mapChildren, setMapChildren] = useState([]);
|
|
49
69
|
|
|
50
70
|
// Initial setting of appName and mapChildren
|
|
51
|
-
useEffect(
|
|
71
|
+
useEffect(() => {
|
|
52
72
|
setAppName(PCore.getEnvironmentInfo().getApplicationName());
|
|
53
73
|
|
|
54
74
|
const tempMap = pConn.getChildren().map((child, index) => {
|
|
55
75
|
const theChildComp = child.getPConnect().getComponentName();
|
|
56
76
|
const theKey = `.${index}`;
|
|
57
|
-
return
|
|
77
|
+
return (
|
|
78
|
+
<div id={theChildComp} key={theKey} style={{ border: 'solid 1px silver', margin: '1px' }}>
|
|
79
|
+
{theChildComp} will be here
|
|
80
|
+
</div>
|
|
81
|
+
);
|
|
58
82
|
});
|
|
59
83
|
|
|
60
|
-
setMapChildren(tempMap)
|
|
84
|
+
setMapChildren(tempMap);
|
|
85
|
+
}, []);
|
|
61
86
|
|
|
87
|
+
const [iconURL, setIconURL] = useState('');
|
|
88
|
+
const [fullIconURL, setFullIconURL] = useState('');
|
|
89
|
+
useEffect(() => {
|
|
90
|
+
// using the default icon then fetch it from the static folder (not auth involved)
|
|
91
|
+
if (
|
|
92
|
+
!portalLogo ||
|
|
93
|
+
portalLogo.toLowerCase().includes('pzpega-logo-mark') ||
|
|
94
|
+
portalLogo.toLowerCase().includes('py-logo') ||
|
|
95
|
+
portalLogo.toLowerCase().includes('py-full-logo')
|
|
96
|
+
) {
|
|
97
|
+
const portalLogoImage = Utils.getIconPath(PCore.getAssetLoader().getStaticServerUrl()).concat(
|
|
98
|
+
'pzpega-logo-mark.svg'
|
|
99
|
+
);
|
|
100
|
+
setIconURL(portalLogoImage);
|
|
101
|
+
setFullIconURL(`${PCore.getAssetLoader().getStaticServerUrl()}static/py-full-logo.svg`);
|
|
102
|
+
}
|
|
103
|
+
// not using default icon to fetch it using the way which uses authentication
|
|
104
|
+
else {
|
|
105
|
+
PCore.getAssetLoader()
|
|
106
|
+
.getSvcImage(portalLogo)
|
|
107
|
+
.then(blob => window.URL.createObjectURL(blob))
|
|
108
|
+
.then(data => {
|
|
109
|
+
setIconURL(data);
|
|
110
|
+
setFullIconURL(data);
|
|
111
|
+
})
|
|
112
|
+
.catch(() => {
|
|
113
|
+
// eslint-disable-next-line no-console
|
|
114
|
+
console.error(
|
|
115
|
+
`Unable to load the image for the portal logo/icon with the insName:${portalLogo}`
|
|
116
|
+
);
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
}, [portalLogo]);
|
|
120
|
+
|
|
121
|
+
useEffect(() => {
|
|
122
|
+
if (imageKey && portalTemplate === 'wss') {
|
|
123
|
+
PCore.getAssetLoader()
|
|
124
|
+
.getSvcImage(imageKey)
|
|
125
|
+
.then(blob => window.URL.createObjectURL(blob))
|
|
126
|
+
.then(imagePath => setImageBlobUrl(imagePath));
|
|
127
|
+
}
|
|
62
128
|
}, []);
|
|
63
129
|
|
|
130
|
+
const getOperator = () => {
|
|
131
|
+
return {
|
|
132
|
+
avatar: portalTemplate !== 'wss' ? <Avatar /> : { name: userName, imageSrc: imageBlobUrl },
|
|
133
|
+
name: userName,
|
|
134
|
+
currentUserInitials
|
|
135
|
+
};
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
function showPage(viewName, className) {
|
|
139
|
+
actionsAPI.showPage(viewName, className);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
function openURL(URL) {
|
|
143
|
+
window.open(URL, '_blank');
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
const links = !pages
|
|
147
|
+
? []
|
|
148
|
+
: pages.map(page => {
|
|
149
|
+
const name = localeUtils.getLocaleValue(page.pyLabel, '', localeReference);
|
|
150
|
+
return {
|
|
151
|
+
text: name,
|
|
152
|
+
name,
|
|
153
|
+
icon: page.pxPageViewIcon.replace('pi pi-', ''),
|
|
154
|
+
active: page.pyRuleName === activeTab,
|
|
155
|
+
onClick: () =>
|
|
156
|
+
!page.pyURLContent || page.pyURLContent === ''
|
|
157
|
+
? showPage(page.pyRuleName, page.pyClassName)
|
|
158
|
+
: openURL(page.pyURLContent)
|
|
159
|
+
};
|
|
160
|
+
});
|
|
161
|
+
|
|
64
162
|
if (pConn.hasChildren()) {
|
|
65
163
|
// const theChildren = pConn.getChildren();
|
|
66
164
|
// const mapChildCompNames = theChildren.map((child) => { return child.getPConnect().getComponentName()});
|
|
67
|
-
|
|
68
165
|
// debugging/investigation help
|
|
69
166
|
// console.log(`AppShell has children: ${theChildren.length}`);
|
|
70
167
|
// console.log(`--> ${mapChildCompNames.map((name) => {return name;})}`);
|
|
71
168
|
}
|
|
72
169
|
|
|
73
|
-
|
|
170
|
+
if (portalTemplate === 'wss') {
|
|
171
|
+
return (
|
|
172
|
+
<div id='AppShell'>
|
|
173
|
+
<WssNavBar
|
|
174
|
+
portalName={portalName}
|
|
175
|
+
imageSrc={iconURL}
|
|
176
|
+
fullImageSrc={fullIconURL}
|
|
177
|
+
appName={localeUtils.getLocaleValue(
|
|
178
|
+
appNameToDisplay,
|
|
179
|
+
'',
|
|
180
|
+
`${portalClass}!PORTAL!${envPortalName}`.toUpperCase()
|
|
181
|
+
)}
|
|
182
|
+
appInfo={{
|
|
183
|
+
imageSrc: iconURL,
|
|
184
|
+
appName: localeUtils.getLocaleValue(
|
|
185
|
+
appNameToDisplay,
|
|
186
|
+
'',
|
|
187
|
+
`${portalClass}!PORTAL!${envPortalName}`.toUpperCase()
|
|
188
|
+
),
|
|
189
|
+
onClick: links[0] && links[0].onClick ? links[0].onClick : undefined
|
|
190
|
+
}}
|
|
191
|
+
navLinks={links.filter((link, index) => {
|
|
192
|
+
return index !== 0;
|
|
193
|
+
})}
|
|
194
|
+
operator={getOperator()}
|
|
195
|
+
navDisplayOptions={navDisplayOptions}
|
|
196
|
+
/>
|
|
197
|
+
<div className={classes.wsscontent}>{children}</div>
|
|
198
|
+
</div>
|
|
74
199
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
200
|
+
);
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
return (
|
|
204
|
+
<NavContext.Provider value={{ open, setOpen }}>
|
|
205
|
+
<div id='AppShell' className={classes.root}>
|
|
206
|
+
<NavBar
|
|
207
|
+
pConn={getPConnect()}
|
|
208
|
+
appName={appNameToDisplay}
|
|
209
|
+
pages={pages}
|
|
210
|
+
caseTypes={caseTypes}
|
|
211
|
+
></NavBar>
|
|
212
|
+
<div className={classes.content}>{children}</div>
|
|
81
213
|
</div>
|
|
82
214
|
</NavContext.Provider>
|
|
83
215
|
);
|
|
@@ -86,12 +218,12 @@ export default function AppShell(props) {
|
|
|
86
218
|
AppShell.defaultProps = {
|
|
87
219
|
pages: [],
|
|
88
220
|
caseTypes: [],
|
|
89
|
-
children: []
|
|
221
|
+
children: []
|
|
90
222
|
};
|
|
91
223
|
AppShell.propTypes = {
|
|
92
|
-
showAppName: PropTypes.bool/* .isRequired */,
|
|
224
|
+
showAppName: PropTypes.bool /* .isRequired */,
|
|
93
225
|
pages: PropTypes.arrayOf(PropTypes.object),
|
|
94
226
|
caseTypes: PropTypes.arrayOf(PropTypes.object),
|
|
95
227
|
children: PropTypes.arrayOf(PropTypes.node),
|
|
96
|
-
getPConnect: PropTypes.func.isRequired
|
|
228
|
+
getPConnect: PropTypes.func.isRequired
|
|
97
229
|
};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { useMemo, Children } from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import Banner from '@pega/react-sdk-components/lib/components/designSystemExtension/Banner';
|
|
4
|
+
import React from 'react';
|
|
5
|
+
|
|
6
|
+
/*
|
|
7
|
+
* BannerPage template.
|
|
8
|
+
*/
|
|
9
|
+
export default function BannerPage(props) {
|
|
10
|
+
const {
|
|
11
|
+
children,
|
|
12
|
+
layout,
|
|
13
|
+
heading,
|
|
14
|
+
message,
|
|
15
|
+
imageTheme,
|
|
16
|
+
backgroundImage,
|
|
17
|
+
backgroundColor,
|
|
18
|
+
tintImage
|
|
19
|
+
} = props;
|
|
20
|
+
|
|
21
|
+
const childArray = useMemo(() => {
|
|
22
|
+
return Children.toArray(children);
|
|
23
|
+
}, [children]);
|
|
24
|
+
|
|
25
|
+
return (
|
|
26
|
+
<Banner
|
|
27
|
+
variant={layout}
|
|
28
|
+
a={childArray[0]}
|
|
29
|
+
b={childArray[1]}
|
|
30
|
+
banner={{
|
|
31
|
+
variant: imageTheme,
|
|
32
|
+
backgroundColor,
|
|
33
|
+
title: heading,
|
|
34
|
+
message,
|
|
35
|
+
backgroundImage,
|
|
36
|
+
tintImage
|
|
37
|
+
}}
|
|
38
|
+
/>
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
BannerPage.propTypes = {
|
|
43
|
+
children: PropTypes.arrayOf(PropTypes.node).isRequired,
|
|
44
|
+
layout: PropTypes.string,
|
|
45
|
+
heading: PropTypes.string,
|
|
46
|
+
message: PropTypes.string,
|
|
47
|
+
imageTheme: PropTypes.string,
|
|
48
|
+
backgroundImage: PropTypes.string,
|
|
49
|
+
backgroundColor: PropTypes.string,
|
|
50
|
+
tintImage: PropTypes.bool
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
BannerPage.defaultProps = {
|
|
54
|
+
layout: 'two-column',
|
|
55
|
+
heading: '',
|
|
56
|
+
message: '',
|
|
57
|
+
imageTheme: 'light',
|
|
58
|
+
backgroundImage: '',
|
|
59
|
+
backgroundColor: '',
|
|
60
|
+
tintImage: false
|
|
61
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './BannerPage';
|
|
@@ -7,11 +7,25 @@ import React from 'react';
|
|
|
7
7
|
import { getToDoAssignments } from '@pega/react-sdk-components/lib/components/infra/Containers/FlowContainer/helpers';
|
|
8
8
|
import ToDo from '@pega/react-sdk-components/lib/components/widget/ToDo';
|
|
9
9
|
import Details from '@pega/react-sdk-components/lib/components/template/Details/Details';
|
|
10
|
-
import { Button } from '@material-ui/core';
|
|
10
|
+
import { Button, Card, makeStyles } from '@material-ui/core';
|
|
11
11
|
|
|
12
12
|
declare const PCore;
|
|
13
13
|
|
|
14
|
+
const useStyles = makeStyles(theme => ({
|
|
15
|
+
root: {
|
|
16
|
+
paddingRight: theme.spacing(1),
|
|
17
|
+
paddingLeft: theme.spacing(1),
|
|
18
|
+
paddingTop: theme.spacing(1),
|
|
19
|
+
paddingBottom: theme.spacing(1),
|
|
20
|
+
marginRight: theme.spacing(1),
|
|
21
|
+
marginLeft: theme.spacing(1),
|
|
22
|
+
marginTop: theme.spacing(1),
|
|
23
|
+
marginBottom: theme.spacing(1)
|
|
24
|
+
}
|
|
25
|
+
}));
|
|
26
|
+
|
|
14
27
|
export default function Confirmation(props) {
|
|
28
|
+
const classes = useStyles();
|
|
15
29
|
const CONSTS = PCore.getConstants();
|
|
16
30
|
const [showConfirmView, setShowConfirmView] = useState(true);
|
|
17
31
|
const { showTasks, getPConnect, datasource } = props;
|
|
@@ -38,8 +52,8 @@ export default function Confirmation(props) {
|
|
|
38
52
|
const detailProps = { ...props, showLabel: false };
|
|
39
53
|
const showDetails = detailProps?.children?.[0]?.props?.getPConnect()?.getChildren()?.length > 0;
|
|
40
54
|
return showConfirmView ? (
|
|
41
|
-
<
|
|
42
|
-
<h2>{props.showLabel ? props.label : ''}</h2>
|
|
55
|
+
<Card className={classes.root}>
|
|
56
|
+
<h2 id='confirm-label'>{props.showLabel ? props.label : ''}</h2>
|
|
43
57
|
{showDetails ? <Details {...detailProps} /> : undefined}
|
|
44
58
|
{showTasks ? (
|
|
45
59
|
toDoList && toDoList.length > 0 ? (
|
|
@@ -49,6 +63,7 @@ export default function Confirmation(props) {
|
|
|
49
63
|
getPConnect={getPConnect}
|
|
50
64
|
type={CONSTS.TODO}
|
|
51
65
|
headerText='Open Tasks'
|
|
66
|
+
isConfirm
|
|
52
67
|
/>
|
|
53
68
|
) : undefined
|
|
54
69
|
) : undefined}
|
|
@@ -57,15 +72,18 @@ export default function Confirmation(props) {
|
|
|
57
72
|
Done
|
|
58
73
|
</Button>
|
|
59
74
|
</div>
|
|
60
|
-
</
|
|
75
|
+
</Card>
|
|
61
76
|
) : toDoList && toDoList.length > 0 ? (
|
|
62
|
-
<
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
77
|
+
<Card className={classes.root}>
|
|
78
|
+
<ToDo
|
|
79
|
+
{...props}
|
|
80
|
+
datasource={{ source: toDoList }}
|
|
81
|
+
getPConnect={getPConnect}
|
|
82
|
+
type={CONSTS.TODO}
|
|
83
|
+
headerText='Tasks'
|
|
84
|
+
isConfirm
|
|
85
|
+
/>
|
|
86
|
+
</Card>
|
|
69
87
|
) : null;
|
|
70
88
|
}
|
|
71
89
|
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import { makeStyles } from '@material-ui/core/styles';
|
|
3
|
+
import AppBar from '@material-ui/core/AppBar';
|
|
4
|
+
import Box from '@material-ui/core/Box';
|
|
5
|
+
import Toolbar from '@material-ui/core/Toolbar';
|
|
6
|
+
import Container from '@material-ui/core/Container';
|
|
7
|
+
import { IconButton, Menu, MenuItem, Typography } from '@material-ui/core';
|
|
8
|
+
import { Button } from '@material-ui/core';
|
|
9
|
+
import Avatar from '@material-ui/core/Avatar';
|
|
10
|
+
import MenuIcon from '@material-ui/icons/Menu';
|
|
11
|
+
import { logout } from '@pega/react-sdk-components/lib/components/helpers/authManager';
|
|
12
|
+
import './WssNavBar.css';
|
|
13
|
+
|
|
14
|
+
const useStyles = makeStyles(theme => ({
|
|
15
|
+
root: {
|
|
16
|
+
display: 'flex'
|
|
17
|
+
},
|
|
18
|
+
content: {
|
|
19
|
+
flexGrow: 1,
|
|
20
|
+
height: '100vh',
|
|
21
|
+
marginLeft: theme.spacing(2),
|
|
22
|
+
marginRight: theme.spacing(2)
|
|
23
|
+
},
|
|
24
|
+
appListLogo: {
|
|
25
|
+
width: '3.6rem'
|
|
26
|
+
},
|
|
27
|
+
appName: {
|
|
28
|
+
color: 'white',
|
|
29
|
+
marginLeft: theme.spacing(2),
|
|
30
|
+
marginRight: theme.spacing(4),
|
|
31
|
+
fontSize: '1.5rem'
|
|
32
|
+
}
|
|
33
|
+
}));
|
|
34
|
+
|
|
35
|
+
export default function WssNavBar(props) {
|
|
36
|
+
const { appInfo, navLinks, operator, navDisplayOptions } = props;
|
|
37
|
+
const { alignment } = navDisplayOptions;
|
|
38
|
+
const classes = useStyles();
|
|
39
|
+
|
|
40
|
+
const [anchorElNav, setAnchorElNav] = useState<null | HTMLElement>(null);
|
|
41
|
+
const [anchorElUser, setAnchorElUser] = useState<null | HTMLElement>(null);
|
|
42
|
+
|
|
43
|
+
const handleOpenNavMenu = (event: React.MouseEvent<HTMLElement>) => {
|
|
44
|
+
setAnchorElNav(event.currentTarget);
|
|
45
|
+
};
|
|
46
|
+
const handleOpenUserMenu = (event: React.MouseEvent<HTMLElement>) => {
|
|
47
|
+
setAnchorElUser(event.currentTarget);
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
const handleCloseNavMenu = () => {
|
|
51
|
+
setAnchorElNav(null);
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
const handleCloseUserMenu = () => {
|
|
55
|
+
setAnchorElUser(null);
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
return (
|
|
59
|
+
<div id='NavBar'>
|
|
60
|
+
<AppBar position='static' color='primary'>
|
|
61
|
+
<Container maxWidth='xl'>
|
|
62
|
+
<Toolbar disableGutters>
|
|
63
|
+
<Button style={{ textTransform: 'capitalize' }} onClick={appInfo.onClick}>
|
|
64
|
+
<img src={appInfo.imageSrc} className={classes.appListLogo} />
|
|
65
|
+
<span className={classes.appName}>{appInfo.appName}</span>
|
|
66
|
+
</Button>
|
|
67
|
+
<Box sx={{ flexGrow: 1, display: { xs: 'flex', md: 'none' } }}>
|
|
68
|
+
<IconButton
|
|
69
|
+
size='small'
|
|
70
|
+
aria-label='account of current user'
|
|
71
|
+
aria-controls='menu-appbar'
|
|
72
|
+
aria-haspopup='true'
|
|
73
|
+
onClick={handleOpenNavMenu}
|
|
74
|
+
color='inherit'
|
|
75
|
+
>
|
|
76
|
+
<MenuIcon />
|
|
77
|
+
</IconButton>
|
|
78
|
+
<Menu
|
|
79
|
+
id='menu-appbar'
|
|
80
|
+
anchorEl={anchorElNav}
|
|
81
|
+
anchorOrigin={{
|
|
82
|
+
vertical: 'bottom',
|
|
83
|
+
horizontal: 'left'
|
|
84
|
+
}}
|
|
85
|
+
keepMounted
|
|
86
|
+
transformOrigin={{
|
|
87
|
+
vertical: 'top',
|
|
88
|
+
horizontal: 'left'
|
|
89
|
+
}}
|
|
90
|
+
open={Boolean(anchorElNav)}
|
|
91
|
+
onClose={handleCloseNavMenu}
|
|
92
|
+
>
|
|
93
|
+
{navLinks.map(link => (
|
|
94
|
+
<MenuItem key={link.text} onClick={link.onClick}>
|
|
95
|
+
<Typography>{link.text}</Typography>
|
|
96
|
+
</MenuItem>
|
|
97
|
+
))}
|
|
98
|
+
</Menu>
|
|
99
|
+
</Box>
|
|
100
|
+
|
|
101
|
+
<Box
|
|
102
|
+
sx={{ flexGrow: 1, display: { xs: 'none', md: 'flex' } }}
|
|
103
|
+
style={{ justifyContent: alignment }}
|
|
104
|
+
>
|
|
105
|
+
{navLinks.map(link => (
|
|
106
|
+
<Button className='link-style' key={link.text} onClick={link.onClick}>
|
|
107
|
+
{link.text}
|
|
108
|
+
</Button>
|
|
109
|
+
))}
|
|
110
|
+
</Box>
|
|
111
|
+
|
|
112
|
+
<Box sx={{ flexGrow: 0 }}>
|
|
113
|
+
<IconButton onClick={handleOpenUserMenu}>
|
|
114
|
+
<Avatar>{operator.currentUserInitials}</Avatar>
|
|
115
|
+
</IconButton>
|
|
116
|
+
<Menu
|
|
117
|
+
id='menu-appbar'
|
|
118
|
+
anchorEl={anchorElUser}
|
|
119
|
+
anchorOrigin={{
|
|
120
|
+
vertical: 'top',
|
|
121
|
+
horizontal: 'right'
|
|
122
|
+
}}
|
|
123
|
+
keepMounted
|
|
124
|
+
transformOrigin={{
|
|
125
|
+
vertical: 'top',
|
|
126
|
+
horizontal: 'right'
|
|
127
|
+
}}
|
|
128
|
+
open={Boolean(anchorElUser)}
|
|
129
|
+
onClose={handleCloseUserMenu}
|
|
130
|
+
>
|
|
131
|
+
<MenuItem onClick={logout}>
|
|
132
|
+
<Typography>Logout</Typography>
|
|
133
|
+
</MenuItem>
|
|
134
|
+
</Menu>
|
|
135
|
+
</Box>
|
|
136
|
+
</Toolbar>
|
|
137
|
+
</Container>
|
|
138
|
+
</AppBar>
|
|
139
|
+
</div>
|
|
140
|
+
);
|
|
141
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './WssNavBar';
|
|
@@ -421,17 +421,16 @@ export default function Attachment(props) {
|
|
|
421
421
|
}
|
|
422
422
|
);
|
|
423
423
|
}
|
|
424
|
-
|
|
425
|
-
PCore.getPubSubUtils().subscribe(
|
|
426
|
-
PCore.getConstants().PUB_SUB_EVENTS.CASE_EVENTS.ASSIGNMENT_SUBMISSION,
|
|
427
|
-
resetAttachmentStoredState,
|
|
428
|
-
caseID
|
|
429
|
-
);
|
|
430
|
-
return () => {
|
|
431
|
-
PCore.getPubSubUtils().unsubscribe(PCore.getConstants().PUB_SUB_EVENTS.CASE_EVENTS.ASSIGNMENT_SUBMISSION, caseID);
|
|
432
|
-
};
|
|
433
424
|
}
|
|
434
|
-
|
|
425
|
+
}
|
|
426
|
+
PCore.getPubSubUtils().subscribe(
|
|
427
|
+
PCore.getConstants().PUB_SUB_EVENTS.CASE_EVENTS.ASSIGNMENT_SUBMISSION,
|
|
428
|
+
resetAttachmentStoredState,
|
|
429
|
+
caseID
|
|
430
|
+
);
|
|
431
|
+
return () => {
|
|
432
|
+
PCore.getPubSubUtils().unsubscribe(PCore.getConstants().PUB_SUB_EVENTS.CASE_EVENTS.ASSIGNMENT_SUBMISSION, caseID);
|
|
433
|
+
};
|
|
435
434
|
}, []);
|
|
436
435
|
|
|
437
436
|
let content = (
|
package/lib/widget/ToDo/ToDo.tsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* eslint-disable no-shadow */
|
|
2
2
|
/* eslint-disable @typescript-eslint/no-shadow */
|
|
3
|
-
import React, { useState } from 'react';
|
|
3
|
+
import React, { Fragment, useState } from 'react';
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
5
5
|
import { Utils } from '@pega/react-sdk-components/lib/components/helpers/utils';
|
|
6
6
|
import {
|
|
@@ -30,7 +30,7 @@ import './ToDo.css';
|
|
|
30
30
|
|
|
31
31
|
declare const PCore: any;
|
|
32
32
|
|
|
33
|
-
const isChildCase =
|
|
33
|
+
const isChildCase = assignment => {
|
|
34
34
|
return assignment.isChild;
|
|
35
35
|
};
|
|
36
36
|
|
|
@@ -60,11 +60,17 @@ const useStyles = makeStyles(theme => ({
|
|
|
60
60
|
avatar: {
|
|
61
61
|
backgroundColor: theme.palette.primary.light,
|
|
62
62
|
color: theme.palette.getContrastText(theme.palette.primary.light)
|
|
63
|
+
},
|
|
64
|
+
todoWrapper: {
|
|
65
|
+
borderLeft: '6px solid',
|
|
66
|
+
borderLeftColor: theme.palette.primary.light,
|
|
67
|
+
padding: theme.spacing(1),
|
|
68
|
+
margin: theme.spacing(1)
|
|
63
69
|
}
|
|
64
70
|
}));
|
|
65
71
|
|
|
66
72
|
export default function ToDo(props) {
|
|
67
|
-
const { datasource, getPConnect, headerText, showTodoList, myWorkList, type } = props;
|
|
73
|
+
const { datasource, getPConnect, headerText, showTodoList, myWorkList, type, isConfirm } = props;
|
|
68
74
|
|
|
69
75
|
const CONSTS = PCore.getConstants();
|
|
70
76
|
|
|
@@ -203,6 +209,47 @@ export default function ToDo(props) {
|
|
|
203
209
|
);
|
|
204
210
|
};
|
|
205
211
|
|
|
212
|
+
const toDoContent = (
|
|
213
|
+
<>
|
|
214
|
+
{showTodoList && (
|
|
215
|
+
<CardHeader
|
|
216
|
+
title={
|
|
217
|
+
<Badge badgeContent={assignmentCount} color='primary'>
|
|
218
|
+
<Typography variant='h6'>{headerText} </Typography>
|
|
219
|
+
</Badge>
|
|
220
|
+
}
|
|
221
|
+
></CardHeader>
|
|
222
|
+
)}
|
|
223
|
+
<List>
|
|
224
|
+
{assignments.map(assignment => (
|
|
225
|
+
<>
|
|
226
|
+
<div className='psdk-todo-avatar-header'>
|
|
227
|
+
<Avatar className={classes.avatar} style={{ marginRight: '16px' }}>
|
|
228
|
+
{currentUserInitials}
|
|
229
|
+
</Avatar>
|
|
230
|
+
<div style={{ display: 'block' }}>
|
|
231
|
+
<Typography variant='h6'>{assignment?.name}</Typography>
|
|
232
|
+
{`Task in ${renderTaskId(
|
|
233
|
+
type,
|
|
234
|
+
getPConnect,
|
|
235
|
+
showTodoList,
|
|
236
|
+
assignment
|
|
237
|
+
)} \u2022 Urgency ${getPriority(assignment)}`}
|
|
238
|
+
</div>
|
|
239
|
+
{!isConfirm && (
|
|
240
|
+
<div style={{ marginLeft: 'auto' }}>
|
|
241
|
+
<IconButton onClick={() => clickGo(assignment)}>
|
|
242
|
+
<ArrowForwardIosOutlinedIcon />
|
|
243
|
+
</IconButton>
|
|
244
|
+
</div>
|
|
245
|
+
)}
|
|
246
|
+
</div>
|
|
247
|
+
</>
|
|
248
|
+
))}
|
|
249
|
+
</List>
|
|
250
|
+
</>
|
|
251
|
+
);
|
|
252
|
+
|
|
206
253
|
return (
|
|
207
254
|
<React.Fragment>
|
|
208
255
|
{type === CONSTS.WORKLIST && (
|
|
@@ -230,72 +277,33 @@ export default function ToDo(props) {
|
|
|
230
277
|
primary={getAssignmentName(assignment)}
|
|
231
278
|
secondary={getListItemComponent(assignment)}
|
|
232
279
|
/>
|
|
233
|
-
|
|
234
|
-
<
|
|
235
|
-
<
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
</ListItemSecondaryAction>
|
|
239
|
-
)}
|
|
280
|
+
<ListItemSecondaryAction>
|
|
281
|
+
<IconButton onClick={() => clickGo(assignment)}>
|
|
282
|
+
<ArrowForwardIosOutlinedIcon />
|
|
283
|
+
</IconButton>
|
|
284
|
+
</ListItemSecondaryAction>
|
|
240
285
|
</ListItem>
|
|
241
286
|
))}
|
|
242
287
|
</List>
|
|
243
288
|
</CardContent>
|
|
244
|
-
{assignmentCount > 3 && (
|
|
245
|
-
<Box display='flex' justifyContent='center'>
|
|
246
|
-
{bShowMore ? (
|
|
247
|
-
<Button color='primary' onClick={_showMore}>
|
|
248
|
-
Show more
|
|
249
|
-
</Button>
|
|
250
|
-
) : (
|
|
251
|
-
<Button onClick={_showLess}>Show less</Button>
|
|
252
|
-
)}
|
|
253
|
-
</Box>
|
|
254
|
-
)}
|
|
255
289
|
</Card>
|
|
256
290
|
)}
|
|
257
291
|
|
|
258
|
-
{type === CONSTS.TODO && (
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
<Avatar className={classes.avatar} style={{ marginRight: '16px' }}>
|
|
272
|
-
{currentUserInitials}
|
|
273
|
-
</Avatar>
|
|
274
|
-
<div style={{ display: 'block' }}>
|
|
275
|
-
<Typography variant='h6'>{assignment?.name}</Typography>
|
|
276
|
-
{`Task in ${renderTaskId(
|
|
277
|
-
type,
|
|
278
|
-
getPConnect,
|
|
279
|
-
showTodoList,
|
|
280
|
-
assignment
|
|
281
|
-
)} \u2022 Urgency ${getPriority(assignment)}`}
|
|
282
|
-
</div>
|
|
283
|
-
</div>
|
|
284
|
-
</>
|
|
285
|
-
))}
|
|
286
|
-
</List>
|
|
287
|
-
{assignmentCount > 3 && (
|
|
288
|
-
<Box display='flex' justifyContent='center'>
|
|
289
|
-
{bShowMore ? (
|
|
290
|
-
<Button color='primary' onClick={_showMore}>
|
|
291
|
-
Show more
|
|
292
|
-
</Button>
|
|
293
|
-
) : (
|
|
294
|
-
<Button onClick={_showLess}>Show less</Button>
|
|
295
|
-
)}
|
|
296
|
-
</Box>
|
|
292
|
+
{type === CONSTS.TODO && !isConfirm && (
|
|
293
|
+
<Card className={classes.todoWrapper}>{toDoContent}</Card>
|
|
294
|
+
)}
|
|
295
|
+
{type === CONSTS.TODO && isConfirm && <Fragment>{toDoContent}</Fragment>}
|
|
296
|
+
|
|
297
|
+
{assignmentCount > 3 && (
|
|
298
|
+
<Box display='flex' justifyContent='center'>
|
|
299
|
+
{bShowMore ? (
|
|
300
|
+
<Button color='primary' onClick={_showMore}>
|
|
301
|
+
Show more
|
|
302
|
+
</Button>
|
|
303
|
+
) : (
|
|
304
|
+
<Button onClick={_showLess}>Show less</Button>
|
|
297
305
|
)}
|
|
298
|
-
|
|
306
|
+
</Box>
|
|
299
307
|
)}
|
|
300
308
|
|
|
301
309
|
<Snackbar
|
|
@@ -328,8 +336,9 @@ ToDo.propTypes = {
|
|
|
328
336
|
type: PropTypes.string,
|
|
329
337
|
// pageMessages: PropTypes.arrayOf(PropTypes.any),
|
|
330
338
|
// eslint-disable-next-line react/no-unused-prop-types
|
|
331
|
-
context: PropTypes.string
|
|
339
|
+
context: PropTypes.string,
|
|
332
340
|
// hideActionButtons: PropTypes.bool
|
|
341
|
+
isConfirm: PropTypes.bool
|
|
333
342
|
};
|
|
334
343
|
|
|
335
344
|
ToDo.defaultProps = {
|
|
@@ -343,6 +352,7 @@ ToDo.defaultProps = {
|
|
|
343
352
|
// target: "",
|
|
344
353
|
type: 'worklist',
|
|
345
354
|
// pageMessages: null,
|
|
346
|
-
context: ''
|
|
355
|
+
context: '',
|
|
347
356
|
// hideActionButtons: false
|
|
357
|
+
isConfirm: false
|
|
348
358
|
};
|
package/package.json
CHANGED