@pega/react-sdk-overrides 0.23.29 → 0.23.31

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.
@@ -4,6 +4,9 @@ import Menu from '@material-ui/core/Menu';
4
4
  import MenuItem from '@material-ui/core/MenuItem';
5
5
 
6
6
  import { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
7
+ import Snackbar from '@material-ui/core/Snackbar';
8
+ import IconButton from '@material-ui/core/IconButton';
9
+ import CloseIcon from '@material-ui/icons/Close';
7
10
 
8
11
  interface CaseViewActionsMenuProps extends PConnProps {
9
12
  // If any, enter additional props that only exist on this component
@@ -23,6 +26,9 @@ export default function CaseViewActionsMenu(props: CaseViewActionsMenuProps) {
23
26
 
24
27
  const [anchorEl, setAnchorEl] = useState<null | HTMLElement>(null);
25
28
 
29
+ const [showSnackbar, setShowSnackbar] = useState(false);
30
+ const [snackbarMessage, setSnackbarMessage]: any = useState('');
31
+
26
32
  const handleClick = (event: React.MouseEvent<HTMLButtonElement>) => {
27
33
  setAnchorEl(event.currentTarget);
28
34
  };
@@ -33,6 +39,18 @@ export default function CaseViewActionsMenu(props: CaseViewActionsMenuProps) {
33
39
 
34
40
  const arMenuItems: any[] = [];
35
41
 
42
+ function showToast(message: string) {
43
+ setSnackbarMessage(message);
44
+ setShowSnackbar(true);
45
+ }
46
+
47
+ function handleSnackbarClose(event: React.SyntheticEvent | React.MouseEvent, reason?: string) {
48
+ if (reason === 'clickaway') {
49
+ return;
50
+ }
51
+ setShowSnackbar(false);
52
+ }
53
+
36
54
  function _actionMenuActionsClick(data) {
37
55
  const actionsAPI = thePConn.getActionsApi();
38
56
  const openLocalAction = actionsAPI.openLocalAction.bind(actionsAPI);
@@ -51,7 +69,11 @@ export default function CaseViewActionsMenu(props: CaseViewActionsMenuProps) {
51
69
  const openProcessAction = actionsAPI.openProcessAction.bind(actionsAPI);
52
70
  openProcessAction(process.ID, {
53
71
  ...process
54
- });
72
+ })
73
+ .then(() => {})
74
+ .catch(() => {
75
+ showToast(`${process.name} Submit failed!`);
76
+ });
55
77
  handleClose();
56
78
  }
57
79
 
@@ -79,6 +101,17 @@ export default function CaseViewActionsMenu(props: CaseViewActionsMenuProps) {
79
101
  <Menu id='simple-menu' anchorEl={anchorEl} keepMounted open={Boolean(anchorEl)} onClose={handleClose}>
80
102
  {arMenuItems}
81
103
  </Menu>
104
+ <Snackbar
105
+ open={showSnackbar}
106
+ autoHideDuration={3000}
107
+ onClose={handleSnackbarClose}
108
+ message={snackbarMessage}
109
+ action={
110
+ <IconButton size='small' aria-label='close' color='inherit' onClick={handleSnackbarClose}>
111
+ <CloseIcon fontSize='small' />
112
+ </IconButton>
113
+ }
114
+ />
82
115
  </>
83
116
  );
84
117
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pega/react-sdk-overrides",
3
- "version": "0.23.29",
3
+ "version": "0.23.31",
4
4
  "description": "React SDK - Code for overriding components",
5
5
  "_filesComment": "During packing, npm ignores everything NOT in the files list",
6
6
  "files": [