@bento-core/table 1.0.1-ccdiintegrated.6 → 1.0.1-ccdiintegrated.8
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/dist/body/components/CPIMappingView.js +1 -1
- package/dist/body/components/CPIModal.js +12 -7
- package/dist/body/components/CPIView.js +1 -1
- package/dist/wrapper/components/AddFiles.js +4 -14
- package/dist/wrapper/components/CPIFilesView/CPIFilesView.js +13 -7
- package/dist/wrapper/components/Snackbar/CartToast.js +96 -0
- package/dist/wrapper/components/Snackbar/Snackbar.js +5 -1
- package/dist/wrapper/components/Snackbar/SnackbarRedux.js +2 -1
- package/package.json +1 -1
- package/src/body/components/CPIMappingView.js +1 -1
- package/src/body/components/CPIModal.js +50 -46
- package/src/body/components/CPIView.js +1 -1
- package/src/wrapper/components/AddFiles.js +5 -14
- package/src/wrapper/components/CPIFilesView/CPIFilesView.js +16 -10
- package/src/wrapper/components/Snackbar/CartToast.js +99 -0
- package/src/wrapper/components/Snackbar/Snackbar.js +5 -1
- package/src/wrapper/components/Snackbar/SnackbarRedux.js +2 -1
|
@@ -163,7 +163,7 @@ const CPIMappingView = _ref => {
|
|
|
163
163
|
style: {
|
|
164
164
|
marginBottom: '6px'
|
|
165
165
|
}
|
|
166
|
-
}, "This participant has more than one identifier in CCDI
|
|
166
|
+
}, "This participant has more than one identifier in CCDI studies:"), internalData.map(e => /*#__PURE__*/_react.default.createElement("div", {
|
|
167
167
|
key: e.associated_id,
|
|
168
168
|
style: italicText
|
|
169
169
|
}, "".concat(e.associated_id, ", ").concat(e.repository_of_synonym_id))), /*#__PURE__*/_react.default.createElement("div", {
|
|
@@ -643,7 +643,7 @@ const CPIModal = _ref => {
|
|
|
643
643
|
style: viewInExploreButton,
|
|
644
644
|
onClick: () => {
|
|
645
645
|
onClose();
|
|
646
|
-
navigation("/
|
|
646
|
+
navigation("/exploreParticipants?p_id=".concat(participantId, "&dbgap_accession=").concat(studyId));
|
|
647
647
|
},
|
|
648
648
|
disableRipple: true
|
|
649
649
|
}, "VIEW IN EXPLORE"), /*#__PURE__*/_react.default.createElement("div", {
|
|
@@ -654,31 +654,36 @@ const CPIModal = _ref => {
|
|
|
654
654
|
className: "".concat(classes.button, " ").concat(dropdownOpen ? classes.buttonOpen : ''),
|
|
655
655
|
onClick: handleDropdownToggle,
|
|
656
656
|
disableRipple: true
|
|
657
|
-
}, /*#__PURE__*/_react.default.createElement("span", null, "ADD TO OR GO TO CART"), dropdownOpen ? /*#__PURE__*/_react.default.createElement(_ExpandLess.default, null) : /*#__PURE__*/_react.default.createElement(_ExpandMore.default, null)), dropdownOpen && /*#__PURE__*/_react.default.createElement(
|
|
657
|
+
}, /*#__PURE__*/_react.default.createElement("span", null, "ADD TO OR GO TO CART"), dropdownOpen ? /*#__PURE__*/_react.default.createElement(_ExpandLess.default, null) : /*#__PURE__*/_react.default.createElement(_ExpandMore.default, null)), dropdownOpen && /*#__PURE__*/_react.default.createElement("div", {
|
|
658
658
|
style: {
|
|
659
659
|
position: 'fixed',
|
|
660
660
|
top: 0,
|
|
661
661
|
left: 0,
|
|
662
662
|
right: 0,
|
|
663
663
|
bottom: 0,
|
|
664
|
-
zIndex:
|
|
664
|
+
zIndex: 1
|
|
665
665
|
},
|
|
666
666
|
onClick: () => setDropdownOpen(false)
|
|
667
667
|
}), /*#__PURE__*/_react.default.createElement("div", {
|
|
668
|
-
className: classes.dropdown
|
|
668
|
+
className: classes.dropdown,
|
|
669
|
+
style: {
|
|
670
|
+
display: dropdownOpen ? 'block' : 'none'
|
|
671
|
+
}
|
|
669
672
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
670
673
|
className: classes.dropdownList
|
|
671
674
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
672
675
|
className: classes.dropdownItem
|
|
673
676
|
}, /*#__PURE__*/_react.default.createElement(_ReduxAddFile.default, _extends({}, wrapperConfig.items[0], {
|
|
674
677
|
buttonStyle: addAllFilesButton,
|
|
675
|
-
rowID: row.id
|
|
678
|
+
rowID: row.id,
|
|
679
|
+
onOptionClick: () => setDropdownOpen(false)
|
|
676
680
|
}))), /*#__PURE__*/_react.default.createElement("div", {
|
|
677
681
|
className: classes.dropdownItem
|
|
678
682
|
}, /*#__PURE__*/_react.default.createElement(_ReduxAddFile.default, _extends({}, wrapperConfig.items[1], {
|
|
679
683
|
buttonStyle: addSelectedFilesButton,
|
|
680
684
|
rowID: row.id,
|
|
681
|
-
disabled: selectedIds.length === 0
|
|
685
|
+
disabled: selectedIds.length === 0,
|
|
686
|
+
onOptionClick: () => setDropdownOpen(false)
|
|
682
687
|
}))), /*#__PURE__*/_react.default.createElement("div", {
|
|
683
688
|
className: classes.dropdownItem
|
|
684
689
|
}, /*#__PURE__*/_react.default.createElement(_core.Button, {
|
|
@@ -689,7 +694,7 @@ const CPIModal = _ref => {
|
|
|
689
694
|
navigation('/fileCentricCart');
|
|
690
695
|
},
|
|
691
696
|
disableRipple: true
|
|
692
|
-
}, "GO TO CART"))))))
|
|
697
|
+
}, "GO TO CART")))))), /*#__PURE__*/_react.default.createElement("div", {
|
|
693
698
|
className: "footer",
|
|
694
699
|
style: footer
|
|
695
700
|
}, /*#__PURE__*/_react.default.createElement("span", null, "For more information about CPI, click", ' ', /*#__PURE__*/_react.default.createElement("a", {
|
|
@@ -141,7 +141,7 @@ const CPIView = _ref => {
|
|
|
141
141
|
style: {
|
|
142
142
|
marginBottom: '6px'
|
|
143
143
|
}
|
|
144
|
-
}, "This participant has more than one identifier in CCDI
|
|
144
|
+
}, "This participant has more than one identifier in CCDI studies:"), internalData.map(e => /*#__PURE__*/_react.default.createElement("div", {
|
|
145
145
|
key: e.associated_id,
|
|
146
146
|
style: italicText
|
|
147
147
|
}, "".concat(e.associated_id, ", ").concat(e.repository_of_synonym_id))), /*#__PURE__*/_react.default.createElement("div", {
|
|
@@ -7,7 +7,7 @@ exports.default = exports.btnTypes = void 0;
|
|
|
7
7
|
var _react = _interopRequireWildcard(require("react"));
|
|
8
8
|
var _client = require("@apollo/client");
|
|
9
9
|
var _CPIFilesView = _interopRequireDefault(require("./CPIFilesView/CPIFilesView"));
|
|
10
|
-
var
|
|
10
|
+
var _CartToast = _interopRequireDefault(require("./Snackbar/CartToast"));
|
|
11
11
|
var _AddToCartDialogAlertView = _interopRequireDefault(require("./AddToCartDialog/AddToCartDialogAlertView"));
|
|
12
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
13
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
@@ -19,8 +19,8 @@ const btnTypes = {
|
|
|
19
19
|
DOWNLOAD_MANIFEST: 'DOWNLOAD_MANIFEST'
|
|
20
20
|
};
|
|
21
21
|
/**
|
|
22
|
-
*
|
|
23
|
-
*
|
|
22
|
+
* Explore CPI add-files button. Uses CartToast (body portal) instead of the
|
|
23
|
+
* Global Search MUI Snackbar so the toast stays visible above the Explore Modal.
|
|
24
24
|
*/
|
|
25
25
|
exports.btnTypes = btnTypes;
|
|
26
26
|
const AddFilesView = props => {
|
|
@@ -31,18 +31,8 @@ const AddFilesView = props => {
|
|
|
31
31
|
cartFiles,
|
|
32
32
|
buttonStyle
|
|
33
33
|
} = props;
|
|
34
|
-
/**
|
|
35
|
-
* snackbar state
|
|
36
|
-
*/
|
|
37
34
|
const [openSnackbar, setOpenSnackbar] = (0, _react.useState)(false);
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* conditionally display max file Alter/Error dialog view
|
|
41
|
-
*/
|
|
42
35
|
const [displayAlter, setAlterDisplay] = (0, _react.useState)(false);
|
|
43
|
-
/**
|
|
44
|
-
* acess bento app client via ApolloProvider
|
|
45
|
-
*/
|
|
46
36
|
const client = (0, _client.useApolloClient)();
|
|
47
37
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_CPIFilesView.default, _extends({}, props, {
|
|
48
38
|
client: client,
|
|
@@ -50,7 +40,7 @@ const AddFilesView = props => {
|
|
|
50
40
|
setOpenSnackbar: setOpenSnackbar,
|
|
51
41
|
cartFiles: cartFiles,
|
|
52
42
|
buttonStyle: buttonStyle
|
|
53
|
-
})), /*#__PURE__*/_react.default.createElement(
|
|
43
|
+
})), /*#__PURE__*/_react.default.createElement(_CartToast.default, {
|
|
54
44
|
open: openSnackbar,
|
|
55
45
|
count: count,
|
|
56
46
|
alreadyInCartCount: alreadyInCartCount,
|
|
@@ -67,7 +67,7 @@ const ToolTipView = props => {
|
|
|
67
67
|
// };
|
|
68
68
|
exports.ToolTipView = ToolTipView;
|
|
69
69
|
const checkDuplicate = (cartFiles, ids) => ids.filter(id => !cartFiles[id]);
|
|
70
|
-
const addFileQuery = (0, _graphqlTag.default)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\nquery search (
|
|
70
|
+
const addFileQuery = (0, _graphqlTag.default)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\nquery search (\n $pid: [String],\n){\n fileIDsFromList (\n pid: $pid,\n )\n}\n "])));
|
|
71
71
|
const CPIFilesComponent = props => {
|
|
72
72
|
const {
|
|
73
73
|
title,
|
|
@@ -82,7 +82,8 @@ const CPIFilesComponent = props => {
|
|
|
82
82
|
cartFiles,
|
|
83
83
|
participantIds,
|
|
84
84
|
buttonStyle,
|
|
85
|
-
rowID
|
|
85
|
+
rowID,
|
|
86
|
+
onOptionClick
|
|
86
87
|
} = props;
|
|
87
88
|
/**
|
|
88
89
|
* conditionally display dialog view
|
|
@@ -106,21 +107,26 @@ const CPIFilesComponent = props => {
|
|
|
106
107
|
* verify and set file ids
|
|
107
108
|
*/
|
|
108
109
|
const addAllFiles = () => {
|
|
110
|
+
if (typeof onOptionClick === 'function') {
|
|
111
|
+
onOptionClick();
|
|
112
|
+
}
|
|
109
113
|
let toAdd = [];
|
|
110
114
|
if (btnType === 'ADD_ALL_FILES') {
|
|
115
|
+
// Always include the modal participant pid plus any internal CPI-mapped ids.
|
|
116
|
+
toAdd = rowID ? [rowID] : [];
|
|
111
117
|
participantIds.forEach(e => {
|
|
112
118
|
if (e.data_type === 'internal' && e.p_id) {
|
|
113
119
|
toAdd = toAdd.concat(e.p_id);
|
|
114
120
|
}
|
|
115
|
-
toAdd = toAdd.concat(rowID);
|
|
116
121
|
});
|
|
117
122
|
} else {
|
|
118
|
-
toAdd =
|
|
123
|
+
toAdd = (rowID ? [rowID] : []).concat(participantIds);
|
|
119
124
|
}
|
|
125
|
+
toAdd = [...new Set(toAdd.filter(id => typeof id === 'string' && id))];
|
|
120
126
|
const fileIds = (0, _WrapperService.getFilesID)({
|
|
121
127
|
client,
|
|
122
128
|
variables: {
|
|
123
|
-
|
|
129
|
+
pid: toAdd
|
|
124
130
|
},
|
|
125
131
|
query: addFileQuery
|
|
126
132
|
});
|
|
@@ -136,10 +142,10 @@ const CPIFilesComponent = props => {
|
|
|
136
142
|
setOpen(true);
|
|
137
143
|
setAddFilesId(ids);
|
|
138
144
|
} else {
|
|
139
|
-
const newIds = checkDuplicate(
|
|
145
|
+
const newIds = checkDuplicate(cartFilesDict, ids);
|
|
140
146
|
if (cartCount + newIds.length <= upperLimit) {
|
|
141
147
|
setOpen(true);
|
|
142
|
-
setAddFilesId(
|
|
148
|
+
setAddFilesId(newIds);
|
|
143
149
|
} else {
|
|
144
150
|
setAlterDisplay(true);
|
|
145
151
|
}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _reactDom = _interopRequireDefault(require("react-dom"));
|
|
9
|
+
var _cart = require("@bento-core/cart");
|
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
12
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
13
|
+
/**
|
|
14
|
+
* Explore CPI cart toast.
|
|
15
|
+
* Body portal keeps it visible above the Explore Modal; styling matches the
|
|
16
|
+
* Global Search CPI MUI snackbar. Dropdown closes on option click so the toast
|
|
17
|
+
* does not need width hacks to avoid overlap.
|
|
18
|
+
*/
|
|
19
|
+
const SuccessIcon = () => /*#__PURE__*/_react.default.createElement("svg", {
|
|
20
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
21
|
+
width: "24",
|
|
22
|
+
height: "24",
|
|
23
|
+
viewBox: "0 0 24 24",
|
|
24
|
+
"aria-hidden": "true",
|
|
25
|
+
focusable: "false",
|
|
26
|
+
style: {
|
|
27
|
+
display: 'block',
|
|
28
|
+
fill: 'currentColor'
|
|
29
|
+
}
|
|
30
|
+
}, /*#__PURE__*/_react.default.createElement("path", {
|
|
31
|
+
d: "M20,12A8,8 0 0,1 12,20A8,8 0 0,1 4,12A8,8 0 0,1 12,4C12.76,4 13.5,4.11 14.2, 4.31L15.77,2.74C14.61,2.26 13.34,2 12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0, 0 22,12M7.91,10.08L6.5,11.5L11,16L21,6L19.59,4.58L11,13.17L7.91,10.08Z"
|
|
32
|
+
}));
|
|
33
|
+
const CartToast = _ref => {
|
|
34
|
+
let {
|
|
35
|
+
open,
|
|
36
|
+
count,
|
|
37
|
+
alreadyInCartCount = 0,
|
|
38
|
+
onClose
|
|
39
|
+
} = _ref;
|
|
40
|
+
(0, _react.useEffect)(() => {
|
|
41
|
+
if (!open) {
|
|
42
|
+
return undefined;
|
|
43
|
+
}
|
|
44
|
+
const timer = setTimeout(() => {
|
|
45
|
+
onClose();
|
|
46
|
+
}, 3000);
|
|
47
|
+
return () => clearTimeout(timer);
|
|
48
|
+
}, [open, onClose]);
|
|
49
|
+
if (!open || typeof document === 'undefined') {
|
|
50
|
+
return null;
|
|
51
|
+
}
|
|
52
|
+
return /*#__PURE__*/_reactDom.default.createPortal( /*#__PURE__*/_react.default.createElement("div", {
|
|
53
|
+
className: "snackBar exploreCpiCartToast",
|
|
54
|
+
role: "status",
|
|
55
|
+
"aria-live": "polite",
|
|
56
|
+
style: {
|
|
57
|
+
position: 'fixed',
|
|
58
|
+
bottom: '20px',
|
|
59
|
+
right: '24px',
|
|
60
|
+
zIndex: 99999,
|
|
61
|
+
pointerEvents: 'none'
|
|
62
|
+
}
|
|
63
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
64
|
+
className: "snackBarMessage",
|
|
65
|
+
style: {
|
|
66
|
+
display: 'flex',
|
|
67
|
+
alignItems: 'center',
|
|
68
|
+
backgroundColor: '#323232',
|
|
69
|
+
color: '#fff',
|
|
70
|
+
padding: '6px 16px',
|
|
71
|
+
borderRadius: '4px',
|
|
72
|
+
boxShadow: '0px 3px 5px -1px rgba(0,0,0,0.2), 0px 6px 10px 0px rgba(0,0,0,0.14), 0px 1px 18px 0px rgba(0,0,0,0.12)',
|
|
73
|
+
minWidth: 288,
|
|
74
|
+
maxWidth: 568,
|
|
75
|
+
boxSizing: 'border-box',
|
|
76
|
+
fontFamily: '"Roboto", "Helvetica", "Arial", sans-serif',
|
|
77
|
+
fontWeight: 400,
|
|
78
|
+
fontSize: '0.875rem',
|
|
79
|
+
lineHeight: 1.43,
|
|
80
|
+
letterSpacing: '0.01071em'
|
|
81
|
+
}
|
|
82
|
+
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
83
|
+
className: "snackBarMessageIcon",
|
|
84
|
+
style: {
|
|
85
|
+
display: 'inline-flex',
|
|
86
|
+
alignItems: 'center',
|
|
87
|
+
marginRight: 8,
|
|
88
|
+
color: '#fff',
|
|
89
|
+
flexShrink: 0
|
|
90
|
+
}
|
|
91
|
+
}, /*#__PURE__*/_react.default.createElement(SuccessIcon, null)), /*#__PURE__*/_react.default.createElement("span", {
|
|
92
|
+
className: "snackBarText"
|
|
93
|
+
}, (0, _cart.formatCartAddMessage)(count, alreadyInCartCount)))), document.body);
|
|
94
|
+
};
|
|
95
|
+
var _default = CartToast;
|
|
96
|
+
exports.default = _default;
|
|
@@ -9,6 +9,10 @@ var _core = require("@material-ui/core");
|
|
|
9
9
|
var _cart = require("@bento-core/cart");
|
|
10
10
|
var _SuccessOutlined = _interopRequireDefault(require("./SuccessOutlined"));
|
|
11
11
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
|
+
/**
|
|
13
|
+
* Legacy MUI snackbar kept for non-CPI table cart actions.
|
|
14
|
+
* Explore CPI uses CartToast instead.
|
|
15
|
+
*/
|
|
12
16
|
const SnackbarView = props => {
|
|
13
17
|
const {
|
|
14
18
|
count,
|
|
@@ -31,7 +35,7 @@ const SnackbarView = props => {
|
|
|
31
35
|
},
|
|
32
36
|
style: {
|
|
33
37
|
bottom: '-45%',
|
|
34
|
-
zIndex:
|
|
38
|
+
zIndex: 15000,
|
|
35
39
|
pointerEvents: 'none'
|
|
36
40
|
},
|
|
37
41
|
message: /*#__PURE__*/_react.default.createElement("div", {
|
|
@@ -10,7 +10,8 @@ var _Snackbar = _interopRequireDefault(require("./Snackbar"));
|
|
|
10
10
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
11
|
const ReduxSnackbar = props => /*#__PURE__*/_react.default.createElement(_Snackbar.default, props);
|
|
12
12
|
const mapStateToProps = state => ({
|
|
13
|
-
count: state.cartReducer.count
|
|
13
|
+
count: state.cartReducer && state.cartReducer.count,
|
|
14
|
+
alreadyInCartCount: state.cartReducer && state.cartReducer.alreadyInCartCount
|
|
14
15
|
});
|
|
15
16
|
var _default = (0, _reactRedux.connect)(mapStateToProps, null)(ReduxSnackbar);
|
|
16
17
|
exports.default = _default;
|
package/package.json
CHANGED
|
@@ -175,7 +175,7 @@ const CPIMappingView = ({
|
|
|
175
175
|
tooltipContent = (
|
|
176
176
|
<div>
|
|
177
177
|
<div style={{ marginBottom: '6px' }}>
|
|
178
|
-
This participant has more than one identifier in CCDI
|
|
178
|
+
This participant has more than one identifier in CCDI studies:
|
|
179
179
|
</div>
|
|
180
180
|
{internalData.map((e) => (
|
|
181
181
|
<div key={e.associated_id} style={italicText}>
|
|
@@ -687,7 +687,7 @@ const CPIModal = ({
|
|
|
687
687
|
style={viewInExploreButton}
|
|
688
688
|
onClick={() => {
|
|
689
689
|
onClose();
|
|
690
|
-
navigation(`/
|
|
690
|
+
navigation(`/exploreParticipants?p_id=${participantId}&dbgap_accession=${studyId}`);
|
|
691
691
|
}}
|
|
692
692
|
disableRipple
|
|
693
693
|
>
|
|
@@ -706,52 +706,56 @@ const CPIModal = ({
|
|
|
706
706
|
</Button>
|
|
707
707
|
|
|
708
708
|
{dropdownOpen && (
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
/>
|
|
721
|
-
<div className={classes.dropdown}>
|
|
722
|
-
<div className={classes.dropdownList}>
|
|
723
|
-
<div className={classes.dropdownItem}>
|
|
724
|
-
<AddFileButtonView
|
|
725
|
-
{...wrapperConfig.items[0]}
|
|
726
|
-
buttonStyle={addAllFilesButton}
|
|
727
|
-
rowID={row.id}
|
|
728
|
-
/>
|
|
729
|
-
</div>
|
|
730
|
-
<div className={classes.dropdownItem}>
|
|
731
|
-
<AddFileButtonView
|
|
732
|
-
{...wrapperConfig.items[1]}
|
|
733
|
-
buttonStyle={addSelectedFilesButton}
|
|
734
|
-
rowID={row.id}
|
|
735
|
-
disabled={selectedIds.length === 0}
|
|
736
|
-
/>
|
|
737
|
-
</div>
|
|
738
|
-
<div className={classes.dropdownItem}>
|
|
739
|
-
<Button
|
|
740
|
-
style={goToCartButton}
|
|
741
|
-
onClick={() => {
|
|
742
|
-
onClose();
|
|
743
|
-
setDropdownOpen(false);
|
|
744
|
-
navigation('/fileCentricCart');
|
|
745
|
-
}}
|
|
746
|
-
disableRipple
|
|
747
|
-
>
|
|
748
|
-
GO TO CART
|
|
749
|
-
</Button>
|
|
750
|
-
</div>
|
|
751
|
-
</div>
|
|
752
|
-
</div>
|
|
753
|
-
</>
|
|
709
|
+
<div
|
|
710
|
+
style={{
|
|
711
|
+
position: 'fixed',
|
|
712
|
+
top: 0,
|
|
713
|
+
left: 0,
|
|
714
|
+
right: 0,
|
|
715
|
+
bottom: 0,
|
|
716
|
+
zIndex: 1,
|
|
717
|
+
}}
|
|
718
|
+
onClick={() => setDropdownOpen(false)}
|
|
719
|
+
/>
|
|
754
720
|
)}
|
|
721
|
+
{/* Keep cart actions mounted while closed so the success toast is not unmounted. */}
|
|
722
|
+
<div
|
|
723
|
+
className={classes.dropdown}
|
|
724
|
+
style={{ display: dropdownOpen ? 'block' : 'none' }}
|
|
725
|
+
>
|
|
726
|
+
<div className={classes.dropdownList}>
|
|
727
|
+
<div className={classes.dropdownItem}>
|
|
728
|
+
<AddFileButtonView
|
|
729
|
+
{...wrapperConfig.items[0]}
|
|
730
|
+
buttonStyle={addAllFilesButton}
|
|
731
|
+
rowID={row.id}
|
|
732
|
+
onOptionClick={() => setDropdownOpen(false)}
|
|
733
|
+
/>
|
|
734
|
+
</div>
|
|
735
|
+
<div className={classes.dropdownItem}>
|
|
736
|
+
<AddFileButtonView
|
|
737
|
+
{...wrapperConfig.items[1]}
|
|
738
|
+
buttonStyle={addSelectedFilesButton}
|
|
739
|
+
rowID={row.id}
|
|
740
|
+
disabled={selectedIds.length === 0}
|
|
741
|
+
onOptionClick={() => setDropdownOpen(false)}
|
|
742
|
+
/>
|
|
743
|
+
</div>
|
|
744
|
+
<div className={classes.dropdownItem}>
|
|
745
|
+
<Button
|
|
746
|
+
style={goToCartButton}
|
|
747
|
+
onClick={() => {
|
|
748
|
+
onClose();
|
|
749
|
+
setDropdownOpen(false);
|
|
750
|
+
navigation('/fileCentricCart');
|
|
751
|
+
}}
|
|
752
|
+
disableRipple
|
|
753
|
+
>
|
|
754
|
+
GO TO CART
|
|
755
|
+
</Button>
|
|
756
|
+
</div>
|
|
757
|
+
</div>
|
|
758
|
+
</div>
|
|
755
759
|
</div>
|
|
756
760
|
</div>
|
|
757
761
|
<div className="footer" style={footer}>
|
|
@@ -152,7 +152,7 @@ const CPIView = ({
|
|
|
152
152
|
)
|
|
153
153
|
: (
|
|
154
154
|
<div>
|
|
155
|
-
<div style={{ marginBottom: '6px' }}>This participant has more than one identifier in CCDI
|
|
155
|
+
<div style={{ marginBottom: '6px' }}>This participant has more than one identifier in CCDI studies:</div>
|
|
156
156
|
{internalData.map((e) => (
|
|
157
157
|
<div key={e.associated_id} style={italicText}>{`${e.associated_id}, ${e.repository_of_synonym_id}`}</div>
|
|
158
158
|
))}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { useState } from 'react';
|
|
2
2
|
import { useApolloClient } from '@apollo/client';
|
|
3
3
|
import CPIFilesView from './CPIFilesView/CPIFilesView';
|
|
4
|
-
import
|
|
4
|
+
import CartToast from './Snackbar/CartToast';
|
|
5
5
|
import AlertView from './AddToCartDialog/AddToCartDialogAlertView';
|
|
6
6
|
|
|
7
7
|
export const btnTypes = {
|
|
@@ -10,8 +10,8 @@ export const btnTypes = {
|
|
|
10
10
|
DOWNLOAD_MANIFEST: 'DOWNLOAD_MANIFEST',
|
|
11
11
|
};
|
|
12
12
|
/**
|
|
13
|
-
*
|
|
14
|
-
*
|
|
13
|
+
* Explore CPI add-files button. Uses CartToast (body portal) instead of the
|
|
14
|
+
* Global Search MUI Snackbar so the toast stays visible above the Explore Modal.
|
|
15
15
|
*/
|
|
16
16
|
const AddFilesView = (props) => {
|
|
17
17
|
const {
|
|
@@ -21,19 +21,10 @@ const AddFilesView = (props) => {
|
|
|
21
21
|
cartFiles,
|
|
22
22
|
buttonStyle,
|
|
23
23
|
} = props;
|
|
24
|
-
/**
|
|
25
|
-
* snackbar state
|
|
26
|
-
*/
|
|
27
24
|
const [openSnackbar, setOpenSnackbar] = useState(false);
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* conditionally display max file Alter/Error dialog view
|
|
31
|
-
*/
|
|
32
25
|
const [displayAlter, setAlterDisplay] = useState(false);
|
|
33
|
-
/**
|
|
34
|
-
* acess bento app client via ApolloProvider
|
|
35
|
-
*/
|
|
36
26
|
const client = useApolloClient();
|
|
27
|
+
|
|
37
28
|
return (
|
|
38
29
|
<>
|
|
39
30
|
<CPIFilesView
|
|
@@ -44,7 +35,7 @@ const AddFilesView = (props) => {
|
|
|
44
35
|
cartFiles={cartFiles}
|
|
45
36
|
buttonStyle={buttonStyle}
|
|
46
37
|
/>
|
|
47
|
-
<
|
|
38
|
+
<CartToast
|
|
48
39
|
open={openSnackbar}
|
|
49
40
|
count={count}
|
|
50
41
|
alreadyInCartCount={alreadyInCartCount}
|
|
@@ -62,12 +62,12 @@ export const ToolTipView = (props) => {
|
|
|
62
62
|
const checkDuplicate = (cartFiles, ids) => (ids.filter((id) => !cartFiles[id]));
|
|
63
63
|
|
|
64
64
|
const addFileQuery = gql`
|
|
65
|
-
query search (
|
|
66
|
-
$
|
|
65
|
+
query search (
|
|
66
|
+
$pid: [String],
|
|
67
67
|
){
|
|
68
|
-
fileIDsFromList (
|
|
69
|
-
|
|
70
|
-
)
|
|
68
|
+
fileIDsFromList (
|
|
69
|
+
pid: $pid,
|
|
70
|
+
)
|
|
71
71
|
}
|
|
72
72
|
`;
|
|
73
73
|
|
|
@@ -86,6 +86,7 @@ const CPIFilesComponent = (props) => {
|
|
|
86
86
|
participantIds,
|
|
87
87
|
buttonStyle,
|
|
88
88
|
rowID,
|
|
89
|
+
onOptionClick,
|
|
89
90
|
} = props;
|
|
90
91
|
/**
|
|
91
92
|
* conditionally display dialog view
|
|
@@ -108,20 +109,25 @@ const CPIFilesComponent = (props) => {
|
|
|
108
109
|
* verify and set file ids
|
|
109
110
|
*/
|
|
110
111
|
const addAllFiles = () => {
|
|
112
|
+
if (typeof onOptionClick === 'function') {
|
|
113
|
+
onOptionClick();
|
|
114
|
+
}
|
|
111
115
|
let toAdd = [];
|
|
112
116
|
if (btnType === 'ADD_ALL_FILES') {
|
|
117
|
+
// Always include the modal participant pid plus any internal CPI-mapped ids.
|
|
118
|
+
toAdd = rowID ? [rowID] : [];
|
|
113
119
|
participantIds.forEach((e) => {
|
|
114
120
|
if (e.data_type === 'internal' && e.p_id) {
|
|
115
121
|
toAdd = toAdd.concat(e.p_id);
|
|
116
122
|
}
|
|
117
|
-
toAdd = toAdd.concat(rowID);
|
|
118
123
|
});
|
|
119
124
|
} else {
|
|
120
|
-
toAdd =
|
|
125
|
+
toAdd = (rowID ? [rowID] : []).concat(participantIds);
|
|
121
126
|
}
|
|
127
|
+
toAdd = [...new Set(toAdd.filter((id) => typeof id === 'string' && id))];
|
|
122
128
|
const fileIds = getFilesID({
|
|
123
129
|
client,
|
|
124
|
-
variables: {
|
|
130
|
+
variables: { pid: toAdd },
|
|
125
131
|
query: addFileQuery,
|
|
126
132
|
});
|
|
127
133
|
const upperLimit = 200000;
|
|
@@ -136,10 +142,10 @@ const CPIFilesComponent = (props) => {
|
|
|
136
142
|
setOpen(true);
|
|
137
143
|
setAddFilesId(ids);
|
|
138
144
|
} else {
|
|
139
|
-
const newIds = checkDuplicate(
|
|
145
|
+
const newIds = checkDuplicate(cartFilesDict, ids);
|
|
140
146
|
if (cartCount + newIds.length <= upperLimit) {
|
|
141
147
|
setOpen(true);
|
|
142
|
-
setAddFilesId(
|
|
148
|
+
setAddFilesId(newIds);
|
|
143
149
|
} else {
|
|
144
150
|
setAlterDisplay(true);
|
|
145
151
|
}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import React, { useEffect } from 'react';
|
|
2
|
+
import ReactDOM from 'react-dom';
|
|
3
|
+
import { formatCartAddMessage } from '@bento-core/cart';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Explore CPI cart toast.
|
|
7
|
+
* Body portal keeps it visible above the Explore Modal; styling matches the
|
|
8
|
+
* Global Search CPI MUI snackbar. Dropdown closes on option click so the toast
|
|
9
|
+
* does not need width hacks to avoid overlap.
|
|
10
|
+
*/
|
|
11
|
+
const SuccessIcon = () => (
|
|
12
|
+
<svg
|
|
13
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
14
|
+
width="24"
|
|
15
|
+
height="24"
|
|
16
|
+
viewBox="0 0 24 24"
|
|
17
|
+
aria-hidden="true"
|
|
18
|
+
focusable="false"
|
|
19
|
+
style={{ display: 'block', fill: 'currentColor' }}
|
|
20
|
+
>
|
|
21
|
+
<path d="M20,12A8,8 0 0,1 12,20A8,8 0 0,1 4,12A8,8 0 0,1 12,4C12.76,4 13.5,4.11 14.2, 4.31L15.77,2.74C14.61,2.26 13.34,2 12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0, 0 22,12M7.91,10.08L6.5,11.5L11,16L21,6L19.59,4.58L11,13.17L7.91,10.08Z" />
|
|
22
|
+
</svg>
|
|
23
|
+
);
|
|
24
|
+
|
|
25
|
+
const CartToast = ({
|
|
26
|
+
open,
|
|
27
|
+
count,
|
|
28
|
+
alreadyInCartCount = 0,
|
|
29
|
+
onClose,
|
|
30
|
+
}) => {
|
|
31
|
+
useEffect(() => {
|
|
32
|
+
if (!open) {
|
|
33
|
+
return undefined;
|
|
34
|
+
}
|
|
35
|
+
const timer = setTimeout(() => {
|
|
36
|
+
onClose();
|
|
37
|
+
}, 3000);
|
|
38
|
+
return () => clearTimeout(timer);
|
|
39
|
+
}, [open, onClose]);
|
|
40
|
+
|
|
41
|
+
if (!open || typeof document === 'undefined') {
|
|
42
|
+
return null;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
return ReactDOM.createPortal(
|
|
46
|
+
<div
|
|
47
|
+
className="snackBar exploreCpiCartToast"
|
|
48
|
+
role="status"
|
|
49
|
+
aria-live="polite"
|
|
50
|
+
style={{
|
|
51
|
+
position: 'fixed',
|
|
52
|
+
bottom: '20px',
|
|
53
|
+
right: '24px',
|
|
54
|
+
zIndex: 99999,
|
|
55
|
+
pointerEvents: 'none',
|
|
56
|
+
}}
|
|
57
|
+
>
|
|
58
|
+
<div
|
|
59
|
+
className="snackBarMessage"
|
|
60
|
+
style={{
|
|
61
|
+
display: 'flex',
|
|
62
|
+
alignItems: 'center',
|
|
63
|
+
backgroundColor: '#323232',
|
|
64
|
+
color: '#fff',
|
|
65
|
+
padding: '6px 16px',
|
|
66
|
+
borderRadius: '4px',
|
|
67
|
+
boxShadow: '0px 3px 5px -1px rgba(0,0,0,0.2), 0px 6px 10px 0px rgba(0,0,0,0.14), 0px 1px 18px 0px rgba(0,0,0,0.12)',
|
|
68
|
+
minWidth: 288,
|
|
69
|
+
maxWidth: 568,
|
|
70
|
+
boxSizing: 'border-box',
|
|
71
|
+
fontFamily: '"Roboto", "Helvetica", "Arial", sans-serif',
|
|
72
|
+
fontWeight: 400,
|
|
73
|
+
fontSize: '0.875rem',
|
|
74
|
+
lineHeight: 1.43,
|
|
75
|
+
letterSpacing: '0.01071em',
|
|
76
|
+
}}
|
|
77
|
+
>
|
|
78
|
+
<span
|
|
79
|
+
className="snackBarMessageIcon"
|
|
80
|
+
style={{
|
|
81
|
+
display: 'inline-flex',
|
|
82
|
+
alignItems: 'center',
|
|
83
|
+
marginRight: 8,
|
|
84
|
+
color: '#fff',
|
|
85
|
+
flexShrink: 0,
|
|
86
|
+
}}
|
|
87
|
+
>
|
|
88
|
+
<SuccessIcon />
|
|
89
|
+
</span>
|
|
90
|
+
<span className="snackBarText">
|
|
91
|
+
{formatCartAddMessage(count, alreadyInCartCount)}
|
|
92
|
+
</span>
|
|
93
|
+
</div>
|
|
94
|
+
</div>,
|
|
95
|
+
document.body,
|
|
96
|
+
);
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
export default CartToast;
|
|
@@ -3,6 +3,10 @@ import { Snackbar } from '@material-ui/core';
|
|
|
3
3
|
import { formatCartAddMessage } from '@bento-core/cart';
|
|
4
4
|
import SuccessOutlinedIcon from './SuccessOutlined';
|
|
5
5
|
|
|
6
|
+
/**
|
|
7
|
+
* Legacy MUI snackbar kept for non-CPI table cart actions.
|
|
8
|
+
* Explore CPI uses CartToast instead.
|
|
9
|
+
*/
|
|
6
10
|
const SnackbarView = (props) => {
|
|
7
11
|
const {
|
|
8
12
|
count,
|
|
@@ -24,7 +28,7 @@ const SnackbarView = (props) => {
|
|
|
24
28
|
open={open}
|
|
25
29
|
autoHideDuration={3000}
|
|
26
30
|
anchorOrigin={{ vertical: 'bottom', horizontal: 'right' }}
|
|
27
|
-
style={{ bottom: '-45%', zIndex:
|
|
31
|
+
style={{ bottom: '-45%', zIndex: 15000, pointerEvents: 'none' }}
|
|
28
32
|
message={(
|
|
29
33
|
<div className="snackBarMessage">
|
|
30
34
|
<span className="snackBarMessageIcon">
|
|
@@ -5,7 +5,8 @@ import SnackbarView from './Snackbar';
|
|
|
5
5
|
const ReduxSnackbar = ((props) => <SnackbarView {...props} />);
|
|
6
6
|
|
|
7
7
|
const mapStateToProps = (state) => ({
|
|
8
|
-
count: state.cartReducer.count,
|
|
8
|
+
count: state.cartReducer && state.cartReducer.count,
|
|
9
|
+
alreadyInCartCount: state.cartReducer && state.cartReducer.alreadyInCartCount,
|
|
9
10
|
});
|
|
10
11
|
|
|
11
12
|
export default connect(mapStateToProps, null)(ReduxSnackbar);
|