@instructure/quiz-core 20.6.0 → 20.6.1-rc.0
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/es/banks/api/banks.js +8 -1
- package/es/banks/components/SharingModal/RootAccountSharing.js +94 -0
- package/es/banks/components/SharingModal/ShareList/index.js +24 -2
- package/es/banks/components/SharingModal/presenter.js +13 -0
- package/lib/banks/api/banks.js +8 -1
- package/lib/banks/components/SharingModal/RootAccountSharing.js +121 -0
- package/lib/banks/components/SharingModal/ShareList/index.js +25 -2
- package/lib/banks/components/SharingModal/presenter.js +13 -0
- package/package.json +10 -10
package/es/banks/api/banks.js
CHANGED
|
@@ -140,6 +140,7 @@ export function getExistingBankAndEntries(bankId) {
|
|
|
140
140
|
};
|
|
141
141
|
}
|
|
142
142
|
export var updateBank = function updateBank(bank) {
|
|
143
|
+
var clearPagination = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : true;
|
|
143
144
|
var url = "".concat(banksApiEndpoint, "/").concat(bank.id);
|
|
144
145
|
return function (dispatch, getState) {
|
|
145
146
|
var updatedBankData = JSON.stringify({
|
|
@@ -155,7 +156,13 @@ export var updateBank = function updateBank(bank) {
|
|
|
155
156
|
return fetcher.patch(url, {
|
|
156
157
|
body: updatedBankData
|
|
157
158
|
}).then(function (bankData) {
|
|
158
|
-
|
|
159
|
+
var toDispatch = [handleBankResponse(bankData)];
|
|
160
|
+
|
|
161
|
+
if (clearPagination) {
|
|
162
|
+
toDispatch.push(clear(BANKS_BANK_PAGINATION));
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
dispatch(toDispatch);
|
|
159
166
|
return bankData;
|
|
160
167
|
});
|
|
161
168
|
};
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
2
|
+
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
3
|
+
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
4
|
+
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
5
|
+
|
|
6
|
+
var _dec, _class, _class2, _temp;
|
|
7
|
+
|
|
8
|
+
import React, { Component } from 'react';
|
|
9
|
+
import PropTypes from 'prop-types';
|
|
10
|
+
import { CAN_EDIT, READ_ONLY } from '@instructure/quiz-common';
|
|
11
|
+
import { IconAdminLine } from '@instructure/ui-icons';
|
|
12
|
+
import { Checkbox } from '@instructure/ui-checkbox';
|
|
13
|
+
import { View } from '@instructure/ui-view';
|
|
14
|
+
import { Grid } from '@instructure/ui-grid';
|
|
15
|
+
import { ScreenReaderContent } from '@instructure/ui-a11y-content';
|
|
16
|
+
import { SimpleSelect } from '@instructure/ui-simple-select';
|
|
17
|
+
import { withStyle } from '@instructure/emotion';
|
|
18
|
+
import generateStyle from "./styles.js";
|
|
19
|
+
import generateComponentTheme from "./theme.js";
|
|
20
|
+
import t from '@instructure/quiz-i18n/es/format-message';
|
|
21
|
+
|
|
22
|
+
var _ref = /*#__PURE__*/React.createElement(Grid.Col, {
|
|
23
|
+
width: "auto"
|
|
24
|
+
}, /*#__PURE__*/React.createElement(IconAdminLine, {
|
|
25
|
+
size: "medium"
|
|
26
|
+
}));
|
|
27
|
+
|
|
28
|
+
export var RootAccountSharing = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_class = (_temp = _class2 = /*#__PURE__*/function (_Component) {
|
|
29
|
+
_inherits(RootAccountSharing, _Component);
|
|
30
|
+
|
|
31
|
+
var _super = _createSuper(RootAccountSharing);
|
|
32
|
+
|
|
33
|
+
function RootAccountSharing() {
|
|
34
|
+
var _this;
|
|
35
|
+
|
|
36
|
+
_classCallCheck(this, RootAccountSharing);
|
|
37
|
+
|
|
38
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
39
|
+
args[_key] = arguments[_key];
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
_this = _super.call.apply(_super, [this].concat(args));
|
|
43
|
+
|
|
44
|
+
_this.isSharedWithAccount = function () {
|
|
45
|
+
return [READ_ONLY, CAN_EDIT].includes(_this.props.accountPermission);
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
return _this;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
_createClass(RootAccountSharing, [{
|
|
52
|
+
key: "render",
|
|
53
|
+
value: function render() {
|
|
54
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
55
|
+
as: "div",
|
|
56
|
+
margin: "0 0 medium 0"
|
|
57
|
+
}, /*#__PURE__*/React.createElement(Grid, {
|
|
58
|
+
colSpacing: "small"
|
|
59
|
+
}, /*#__PURE__*/React.createElement(Grid.Row, null, _ref, /*#__PURE__*/React.createElement(Grid.Col, null, /*#__PURE__*/React.createElement(View, {
|
|
60
|
+
as: "div",
|
|
61
|
+
padding: "0 0 x-small 0"
|
|
62
|
+
}, this.props.accountName || t('Account')), /*#__PURE__*/React.createElement(Checkbox, {
|
|
63
|
+
label: t('Share with Institution'),
|
|
64
|
+
variant: "toggle",
|
|
65
|
+
value: "accountPermission",
|
|
66
|
+
checked: this.isSharedWithAccount(),
|
|
67
|
+
onChange: this.props.onShareChange
|
|
68
|
+
})), this.isSharedWithAccount() && /*#__PURE__*/React.createElement(Grid.Col, {
|
|
69
|
+
width: "auto"
|
|
70
|
+
}, /*#__PURE__*/React.createElement(SimpleSelect, {
|
|
71
|
+
onChange: this.props.onShareTypeChange,
|
|
72
|
+
value: this.props.accountPermission,
|
|
73
|
+
renderLabel: /*#__PURE__*/React.createElement(ScreenReaderContent, null, t('Access for account'))
|
|
74
|
+
}, /*#__PURE__*/React.createElement(SimpleSelect.Option, {
|
|
75
|
+
id: "sharing-modal-account-perm-select-option-can-view",
|
|
76
|
+
value: READ_ONLY
|
|
77
|
+
}, t('Can view')), /*#__PURE__*/React.createElement(SimpleSelect.Option, {
|
|
78
|
+
id: "sharing-modal-account-perm-select-option-can-edit",
|
|
79
|
+
value: CAN_EDIT
|
|
80
|
+
}, t('Can edit')))))));
|
|
81
|
+
}
|
|
82
|
+
}]);
|
|
83
|
+
|
|
84
|
+
RootAccountSharing.displayName = "RootAccountSharing";
|
|
85
|
+
return RootAccountSharing;
|
|
86
|
+
}(Component), _class2.propTypes = {
|
|
87
|
+
accountName: PropTypes.string.isRequired,
|
|
88
|
+
onShareChange: PropTypes.func.isRequired,
|
|
89
|
+
onShareTypeChange: PropTypes.func.isRequired,
|
|
90
|
+
accountPermission: PropTypes.string
|
|
91
|
+
}, _class2.defaultProps = {
|
|
92
|
+
accountPermission: null
|
|
93
|
+
}, _temp)) || _class);
|
|
94
|
+
export default RootAccountSharing;
|
|
@@ -19,6 +19,7 @@ import { Avatar } from '@instructure/ui-avatar';
|
|
|
19
19
|
import { Tabs } from '@instructure/ui-tabs';
|
|
20
20
|
import { withStyle, jsx } from '@instructure/emotion';
|
|
21
21
|
import { ContextualIconButton } from "../ContextualIconButton/index.js";
|
|
22
|
+
import RootAccountSharing from "../RootAccountSharing.js";
|
|
22
23
|
import { SimpleSelect } from '@instructure/ui-simple-select';
|
|
23
24
|
import generateStyle from "./styles.js";
|
|
24
25
|
import { CAN_EDIT, READ_ONLY, REMOVED_ACCESS, SHARED_WITH_USER, SHARED_WITH_COURSE } from '@instructure/quiz-common';
|
|
@@ -147,6 +148,8 @@ export var ShareList = (_dec = withStyle(generateStyle, null), _dec(_class = (_t
|
|
|
147
148
|
}, {
|
|
148
149
|
key: "render",
|
|
149
150
|
value: function render() {
|
|
151
|
+
var _this$props$currentUs;
|
|
152
|
+
|
|
150
153
|
var _this$props = this.props,
|
|
151
154
|
shares = _this$props.shares,
|
|
152
155
|
subAccountBankSharingEnabled = _this$props.subAccountBankSharingEnabled;
|
|
@@ -196,7 +199,16 @@ export var ShareList = (_dec = withStyle(generateStyle, null), _dec(_class = (_t
|
|
|
196
199
|
lineHeight: "double"
|
|
197
200
|
}, t('Currently shared with')), jsx(Grid, {
|
|
198
201
|
vAlign: "middle"
|
|
199
|
-
}, existingCourses.map(this.renderEntity)))
|
|
202
|
+
}, existingCourses.map(this.renderEntity))), subAccountBankSharingEnabled && jsx(Tabs.Panel, {
|
|
203
|
+
renderTitle: t('Accounts'),
|
|
204
|
+
isSelected: this.state.selectedTabIndex === 2,
|
|
205
|
+
padding: "large small small small"
|
|
206
|
+
}, ((_this$props$currentUs = this.props.currentUser) === null || _this$props$currentUs === void 0 ? void 0 : _this$props$currentUs.bank_admin) && jsx(RootAccountSharing, {
|
|
207
|
+
accountName: this.props.accountName,
|
|
208
|
+
onShareChange: this.props.onToggleAccountShare,
|
|
209
|
+
onShareTypeChange: this.props.onAccountPermissionChange,
|
|
210
|
+
accountPermission: this.props.accountPermission
|
|
211
|
+
})))));
|
|
200
212
|
}
|
|
201
213
|
}]);
|
|
202
214
|
|
|
@@ -204,6 +216,9 @@ export var ShareList = (_dec = withStyle(generateStyle, null), _dec(_class = (_t
|
|
|
204
216
|
return ShareList;
|
|
205
217
|
}(Component), _class2.propTypes = {
|
|
206
218
|
canEdit: PropTypes.bool.isRequired,
|
|
219
|
+
currentUser: PropTypes.shape({
|
|
220
|
+
bank_admin: PropTypes.bool
|
|
221
|
+
}),
|
|
207
222
|
improvedBankSharingEnabled: PropTypes.bool.isRequired,
|
|
208
223
|
newEntities: ImmutablePropTypes.list,
|
|
209
224
|
onEntityRemove: PropTypes.func.isRequired,
|
|
@@ -220,8 +235,15 @@ export var ShareList = (_dec = withStyle(generateStyle, null), _dec(_class = (_t
|
|
|
220
235
|
})).isRequired,
|
|
221
236
|
subAccountBankSharingEnabled: PropTypes.bool.isRequired,
|
|
222
237
|
// eslint-disable-next-line react/require-default-props,react/forbid-prop-types
|
|
223
|
-
styles: PropTypes.object
|
|
238
|
+
styles: PropTypes.object,
|
|
239
|
+
accountName: PropTypes.string,
|
|
240
|
+
onAccountPermissionChange: PropTypes.func.isRequired,
|
|
241
|
+
onToggleAccountShare: PropTypes.func.isRequired,
|
|
242
|
+
accountPermission: PropTypes.string
|
|
224
243
|
}, _class2.defaultProps = {
|
|
244
|
+
accountName: t('Account'),
|
|
245
|
+
accountPermission: null,
|
|
246
|
+
currentUser: null,
|
|
225
247
|
newEntities: List(),
|
|
226
248
|
sharedBanks: List()
|
|
227
249
|
}, _temp)) || _class);
|
|
@@ -426,6 +426,14 @@ export var SharingModalPresenter = (_dec = withStyle(generateStyle, generateComp
|
|
|
426
426
|
accountPermission: nextProps.bank.accountPermission,
|
|
427
427
|
shares: nextProps.sharedBanks
|
|
428
428
|
});
|
|
429
|
+
}
|
|
430
|
+
}, {
|
|
431
|
+
key: "componentDidUpdate",
|
|
432
|
+
value: function componentDidUpdate(prevProps, prevState) {
|
|
433
|
+
if (this.props.subAccountBankSharingEnabled && this.state.accountPermission !== prevState.accountPermission && this.state.accountPermission !== this.props.bank.accountPermission) {
|
|
434
|
+
var updatedBank = this.props.bank.set('accountPermission', this.state.accountPermission);
|
|
435
|
+
this.props.updateBank(updatedBank, false);
|
|
436
|
+
}
|
|
429
437
|
} // =============
|
|
430
438
|
// HELPERS
|
|
431
439
|
// =============
|
|
@@ -485,12 +493,17 @@ export var SharingModalPresenter = (_dec = withStyle(generateStyle, generateComp
|
|
|
485
493
|
key: "renderEntitiesSection",
|
|
486
494
|
value: function renderEntitiesSection() {
|
|
487
495
|
return jsx(ShareList, {
|
|
496
|
+
accountName: this.props.currentUser.account_name,
|
|
497
|
+
accountPermission: this.state.accountPermission,
|
|
488
498
|
canEdit: this.props.bank.canEdit(),
|
|
499
|
+
currentUser: this.props.currentUser,
|
|
489
500
|
entitiesWithChangedPermission: this.state.entitiesWithChangedPermission,
|
|
490
501
|
improvedBankSharingEnabled: this.props.improvedBankSharingEnabled,
|
|
491
502
|
newEntities: this.state.newEntities,
|
|
503
|
+
onAccountPermissionChange: this.handleAccountPermissionChange,
|
|
492
504
|
onEntityRemove: this.handleEntityRemove,
|
|
493
505
|
onPermissionChange: this.handleEntityPermissionChange,
|
|
506
|
+
onToggleAccountShare: this.toggleAccountShare,
|
|
494
507
|
ref: this.handleShareListRef,
|
|
495
508
|
renderSearchSection: this.renderSearchSection // searchPermission and searchSelection are not used directly by ShareList,
|
|
496
509
|
// but are needed as props so that AsyncSearch/Select rerenders when those values change
|
package/lib/banks/api/banks.js
CHANGED
|
@@ -182,6 +182,7 @@ function getExistingBankAndEntries(bankId) {
|
|
|
182
182
|
}
|
|
183
183
|
|
|
184
184
|
var updateBank = function updateBank(bank) {
|
|
185
|
+
var clearPagination = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : true;
|
|
185
186
|
var url = "".concat(banksApiEndpoint, "/").concat(bank.id);
|
|
186
187
|
return function (dispatch, getState) {
|
|
187
188
|
var updatedBankData = JSON.stringify({
|
|
@@ -197,7 +198,13 @@ var updateBank = function updateBank(bank) {
|
|
|
197
198
|
return fetcher.patch(url, {
|
|
198
199
|
body: updatedBankData
|
|
199
200
|
}).then(function (bankData) {
|
|
200
|
-
|
|
201
|
+
var toDispatch = [(0, _callHandlers.handleBankResponse)(bankData)];
|
|
202
|
+
|
|
203
|
+
if (clearPagination) {
|
|
204
|
+
toDispatch.push((0, _ui.clear)(_quizCommon.BANKS_BANK_PAGINATION));
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
dispatch(toDispatch);
|
|
201
208
|
return bankData;
|
|
202
209
|
});
|
|
203
210
|
};
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");
|
|
6
|
+
|
|
7
|
+
Object.defineProperty(exports, "__esModule", {
|
|
8
|
+
value: true
|
|
9
|
+
});
|
|
10
|
+
exports.default = exports.RootAccountSharing = void 0;
|
|
11
|
+
|
|
12
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
13
|
+
|
|
14
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
15
|
+
|
|
16
|
+
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
17
|
+
|
|
18
|
+
var _createSuper2 = _interopRequireDefault(require("@babel/runtime/helpers/createSuper"));
|
|
19
|
+
|
|
20
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
21
|
+
|
|
22
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
23
|
+
|
|
24
|
+
var _quizCommon = require("@instructure/quiz-common");
|
|
25
|
+
|
|
26
|
+
var _uiIcons = require("@instructure/ui-icons");
|
|
27
|
+
|
|
28
|
+
var _uiCheckbox = require("@instructure/ui-checkbox");
|
|
29
|
+
|
|
30
|
+
var _uiView = require("@instructure/ui-view");
|
|
31
|
+
|
|
32
|
+
var _uiGrid = require("@instructure/ui-grid");
|
|
33
|
+
|
|
34
|
+
var _uiA11yContent = require("@instructure/ui-a11y-content");
|
|
35
|
+
|
|
36
|
+
var _uiSimpleSelect = require("@instructure/ui-simple-select");
|
|
37
|
+
|
|
38
|
+
var _emotion = require("@instructure/emotion");
|
|
39
|
+
|
|
40
|
+
var _styles = _interopRequireDefault(require("./styles.js"));
|
|
41
|
+
|
|
42
|
+
var _theme = _interopRequireDefault(require("./theme.js"));
|
|
43
|
+
|
|
44
|
+
var _formatMessage = _interopRequireDefault(require("@instructure/quiz-i18n/es/format-message"));
|
|
45
|
+
|
|
46
|
+
var _dec, _class, _class2, _temp;
|
|
47
|
+
|
|
48
|
+
var _ref = /*#__PURE__*/_react.default.createElement(_uiGrid.Grid.Col, {
|
|
49
|
+
width: "auto"
|
|
50
|
+
}, /*#__PURE__*/_react.default.createElement(_uiIcons.IconAdminLine, {
|
|
51
|
+
size: "medium"
|
|
52
|
+
}));
|
|
53
|
+
|
|
54
|
+
var RootAccountSharing = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec(_class = (_temp = _class2 = /*#__PURE__*/function (_Component) {
|
|
55
|
+
(0, _inherits2.default)(RootAccountSharing, _Component);
|
|
56
|
+
|
|
57
|
+
var _super = (0, _createSuper2.default)(RootAccountSharing);
|
|
58
|
+
|
|
59
|
+
function RootAccountSharing() {
|
|
60
|
+
var _this;
|
|
61
|
+
|
|
62
|
+
(0, _classCallCheck2.default)(this, RootAccountSharing);
|
|
63
|
+
|
|
64
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
65
|
+
args[_key] = arguments[_key];
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
_this = _super.call.apply(_super, [this].concat(args));
|
|
69
|
+
|
|
70
|
+
_this.isSharedWithAccount = function () {
|
|
71
|
+
return [_quizCommon.READ_ONLY, _quizCommon.CAN_EDIT].includes(_this.props.accountPermission);
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
return _this;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
(0, _createClass2.default)(RootAccountSharing, [{
|
|
78
|
+
key: "render",
|
|
79
|
+
value: function render() {
|
|
80
|
+
return /*#__PURE__*/_react.default.createElement(_uiView.View, {
|
|
81
|
+
as: "div",
|
|
82
|
+
margin: "0 0 medium 0"
|
|
83
|
+
}, /*#__PURE__*/_react.default.createElement(_uiGrid.Grid, {
|
|
84
|
+
colSpacing: "small"
|
|
85
|
+
}, /*#__PURE__*/_react.default.createElement(_uiGrid.Grid.Row, null, _ref, /*#__PURE__*/_react.default.createElement(_uiGrid.Grid.Col, null, /*#__PURE__*/_react.default.createElement(_uiView.View, {
|
|
86
|
+
as: "div",
|
|
87
|
+
padding: "0 0 x-small 0"
|
|
88
|
+
}, this.props.accountName || (0, _formatMessage.default)('Account')), /*#__PURE__*/_react.default.createElement(_uiCheckbox.Checkbox, {
|
|
89
|
+
label: (0, _formatMessage.default)('Share with Institution'),
|
|
90
|
+
variant: "toggle",
|
|
91
|
+
value: "accountPermission",
|
|
92
|
+
checked: this.isSharedWithAccount(),
|
|
93
|
+
onChange: this.props.onShareChange
|
|
94
|
+
})), this.isSharedWithAccount() && /*#__PURE__*/_react.default.createElement(_uiGrid.Grid.Col, {
|
|
95
|
+
width: "auto"
|
|
96
|
+
}, /*#__PURE__*/_react.default.createElement(_uiSimpleSelect.SimpleSelect, {
|
|
97
|
+
onChange: this.props.onShareTypeChange,
|
|
98
|
+
value: this.props.accountPermission,
|
|
99
|
+
renderLabel: /*#__PURE__*/_react.default.createElement(_uiA11yContent.ScreenReaderContent, null, (0, _formatMessage.default)('Access for account'))
|
|
100
|
+
}, /*#__PURE__*/_react.default.createElement(_uiSimpleSelect.SimpleSelect.Option, {
|
|
101
|
+
id: "sharing-modal-account-perm-select-option-can-view",
|
|
102
|
+
value: _quizCommon.READ_ONLY
|
|
103
|
+
}, (0, _formatMessage.default)('Can view')), /*#__PURE__*/_react.default.createElement(_uiSimpleSelect.SimpleSelect.Option, {
|
|
104
|
+
id: "sharing-modal-account-perm-select-option-can-edit",
|
|
105
|
+
value: _quizCommon.CAN_EDIT
|
|
106
|
+
}, (0, _formatMessage.default)('Can edit')))))));
|
|
107
|
+
}
|
|
108
|
+
}]);
|
|
109
|
+
RootAccountSharing.displayName = "RootAccountSharing";
|
|
110
|
+
return RootAccountSharing;
|
|
111
|
+
}(_react.Component), _class2.propTypes = {
|
|
112
|
+
accountName: _propTypes.default.string.isRequired,
|
|
113
|
+
onShareChange: _propTypes.default.func.isRequired,
|
|
114
|
+
onShareTypeChange: _propTypes.default.func.isRequired,
|
|
115
|
+
accountPermission: _propTypes.default.string
|
|
116
|
+
}, _class2.defaultProps = {
|
|
117
|
+
accountPermission: null
|
|
118
|
+
}, _temp)) || _class);
|
|
119
|
+
exports.RootAccountSharing = RootAccountSharing;
|
|
120
|
+
var _default = RootAccountSharing;
|
|
121
|
+
exports.default = _default;
|
|
@@ -41,6 +41,8 @@ var _emotion = require("@instructure/emotion");
|
|
|
41
41
|
|
|
42
42
|
var _index = require("../ContextualIconButton/index.js");
|
|
43
43
|
|
|
44
|
+
var _RootAccountSharing = _interopRequireDefault(require("../RootAccountSharing.js"));
|
|
45
|
+
|
|
44
46
|
var _uiSimpleSelect = require("@instructure/ui-simple-select");
|
|
45
47
|
|
|
46
48
|
var _styles = _interopRequireDefault(require("./styles.js"));
|
|
@@ -176,6 +178,8 @@ var ShareList = (_dec = (0, _emotion.withStyle)(_styles.default, null), _dec(_cl
|
|
|
176
178
|
}, {
|
|
177
179
|
key: "render",
|
|
178
180
|
value: function render() {
|
|
181
|
+
var _this$props$currentUs;
|
|
182
|
+
|
|
179
183
|
var _this$props = this.props,
|
|
180
184
|
shares = _this$props.shares,
|
|
181
185
|
subAccountBankSharingEnabled = _this$props.subAccountBankSharingEnabled;
|
|
@@ -225,13 +229,25 @@ var ShareList = (_dec = (0, _emotion.withStyle)(_styles.default, null), _dec(_cl
|
|
|
225
229
|
lineHeight: "double"
|
|
226
230
|
}, (0, _formatMessage.default)('Currently shared with')), (0, _emotion.jsx)(_uiGrid.Grid, {
|
|
227
231
|
vAlign: "middle"
|
|
228
|
-
}, existingCourses.map(this.renderEntity))))
|
|
232
|
+
}, existingCourses.map(this.renderEntity))), subAccountBankSharingEnabled && (0, _emotion.jsx)(_uiTabs.Tabs.Panel, {
|
|
233
|
+
renderTitle: (0, _formatMessage.default)('Accounts'),
|
|
234
|
+
isSelected: this.state.selectedTabIndex === 2,
|
|
235
|
+
padding: "large small small small"
|
|
236
|
+
}, ((_this$props$currentUs = this.props.currentUser) === null || _this$props$currentUs === void 0 ? void 0 : _this$props$currentUs.bank_admin) && (0, _emotion.jsx)(_RootAccountSharing.default, {
|
|
237
|
+
accountName: this.props.accountName,
|
|
238
|
+
onShareChange: this.props.onToggleAccountShare,
|
|
239
|
+
onShareTypeChange: this.props.onAccountPermissionChange,
|
|
240
|
+
accountPermission: this.props.accountPermission
|
|
241
|
+
})))));
|
|
229
242
|
}
|
|
230
243
|
}]);
|
|
231
244
|
ShareList.displayName = "ShareList";
|
|
232
245
|
return ShareList;
|
|
233
246
|
}(_react.Component), _class2.propTypes = {
|
|
234
247
|
canEdit: _propTypes.default.bool.isRequired,
|
|
248
|
+
currentUser: _propTypes.default.shape({
|
|
249
|
+
bank_admin: _propTypes.default.bool
|
|
250
|
+
}),
|
|
235
251
|
improvedBankSharingEnabled: _propTypes.default.bool.isRequired,
|
|
236
252
|
newEntities: _reactImmutableProptypes.default.list,
|
|
237
253
|
onEntityRemove: _propTypes.default.func.isRequired,
|
|
@@ -248,8 +264,15 @@ var ShareList = (_dec = (0, _emotion.withStyle)(_styles.default, null), _dec(_cl
|
|
|
248
264
|
})).isRequired,
|
|
249
265
|
subAccountBankSharingEnabled: _propTypes.default.bool.isRequired,
|
|
250
266
|
// eslint-disable-next-line react/require-default-props,react/forbid-prop-types
|
|
251
|
-
styles: _propTypes.default.object
|
|
267
|
+
styles: _propTypes.default.object,
|
|
268
|
+
accountName: _propTypes.default.string,
|
|
269
|
+
onAccountPermissionChange: _propTypes.default.func.isRequired,
|
|
270
|
+
onToggleAccountShare: _propTypes.default.func.isRequired,
|
|
271
|
+
accountPermission: _propTypes.default.string
|
|
252
272
|
}, _class2.defaultProps = {
|
|
273
|
+
accountName: (0, _formatMessage.default)('Account'),
|
|
274
|
+
accountPermission: null,
|
|
275
|
+
currentUser: null,
|
|
253
276
|
newEntities: (0, _immutable.List)(),
|
|
254
277
|
sharedBanks: (0, _immutable.List)()
|
|
255
278
|
}, _temp)) || _class);
|
|
@@ -464,6 +464,14 @@ var SharingModalPresenter = (_dec = (0, _emotion.withStyle)(_styles.default, _th
|
|
|
464
464
|
accountPermission: nextProps.bank.accountPermission,
|
|
465
465
|
shares: nextProps.sharedBanks
|
|
466
466
|
});
|
|
467
|
+
}
|
|
468
|
+
}, {
|
|
469
|
+
key: "componentDidUpdate",
|
|
470
|
+
value: function componentDidUpdate(prevProps, prevState) {
|
|
471
|
+
if (this.props.subAccountBankSharingEnabled && this.state.accountPermission !== prevState.accountPermission && this.state.accountPermission !== this.props.bank.accountPermission) {
|
|
472
|
+
var updatedBank = this.props.bank.set('accountPermission', this.state.accountPermission);
|
|
473
|
+
this.props.updateBank(updatedBank, false);
|
|
474
|
+
}
|
|
467
475
|
} // =============
|
|
468
476
|
// HELPERS
|
|
469
477
|
// =============
|
|
@@ -523,12 +531,17 @@ var SharingModalPresenter = (_dec = (0, _emotion.withStyle)(_styles.default, _th
|
|
|
523
531
|
key: "renderEntitiesSection",
|
|
524
532
|
value: function renderEntitiesSection() {
|
|
525
533
|
return (0, _emotion.jsx)(_index.default, {
|
|
534
|
+
accountName: this.props.currentUser.account_name,
|
|
535
|
+
accountPermission: this.state.accountPermission,
|
|
526
536
|
canEdit: this.props.bank.canEdit(),
|
|
537
|
+
currentUser: this.props.currentUser,
|
|
527
538
|
entitiesWithChangedPermission: this.state.entitiesWithChangedPermission,
|
|
528
539
|
improvedBankSharingEnabled: this.props.improvedBankSharingEnabled,
|
|
529
540
|
newEntities: this.state.newEntities,
|
|
541
|
+
onAccountPermissionChange: this.handleAccountPermissionChange,
|
|
530
542
|
onEntityRemove: this.handleEntityRemove,
|
|
531
543
|
onPermissionChange: this.handleEntityPermissionChange,
|
|
544
|
+
onToggleAccountShare: this.toggleAccountShare,
|
|
532
545
|
ref: this.handleShareListRef,
|
|
533
546
|
renderSearchSection: this.renderSearchSection // searchPermission and searchSelection are not used directly by ShareList,
|
|
534
547
|
// but are needed as props so that AsyncSearch/Select rerenders when those values change
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instructure/quiz-core",
|
|
3
|
-
"version": "20.6.0",
|
|
3
|
+
"version": "20.6.1-rc.0+a0fffa16e",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "The Quiz React SDK by Instructure Inc.",
|
|
6
6
|
"author": "Instructure, Inc. Engineering and Product Design",
|
|
@@ -44,11 +44,11 @@
|
|
|
44
44
|
"@instructure/emotion": "^8.51.0",
|
|
45
45
|
"@instructure/grading-utils": "^1.0.0",
|
|
46
46
|
"@instructure/outcomes-ui": "^3.1.0",
|
|
47
|
-
"@instructure/quiz-common": "
|
|
48
|
-
"@instructure/quiz-i18n": "
|
|
49
|
-
"@instructure/quiz-interactions": "
|
|
50
|
-
"@instructure/quiz-number-input": "
|
|
51
|
-
"@instructure/quiz-rce": "
|
|
47
|
+
"@instructure/quiz-common": "20.6.1-rc.0+a0fffa16e",
|
|
48
|
+
"@instructure/quiz-i18n": "20.6.1-rc.0+a0fffa16e",
|
|
49
|
+
"@instructure/quiz-interactions": "20.6.1-rc.0+a0fffa16e",
|
|
50
|
+
"@instructure/quiz-number-input": "20.6.1-rc.0+a0fffa16e",
|
|
51
|
+
"@instructure/quiz-rce": "20.6.1-rc.0+a0fffa16e",
|
|
52
52
|
"@instructure/ui-a11y-content": "^8.51.0",
|
|
53
53
|
"@instructure/ui-alerts": "^8.51.0",
|
|
54
54
|
"@instructure/ui-avatar": "^8.51.0",
|
|
@@ -112,7 +112,7 @@
|
|
|
112
112
|
"file-saver": "~2.0.5",
|
|
113
113
|
"humps": "^2.0.0",
|
|
114
114
|
"immutable": "^3.8.1",
|
|
115
|
-
"instructure-validations": "
|
|
115
|
+
"instructure-validations": "20.6.1-rc.0+a0fffa16e",
|
|
116
116
|
"ipaddr.js": "^1.5.4",
|
|
117
117
|
"isomorphic-fetch": "^2.2.0",
|
|
118
118
|
"isuuid": "^0.1.0",
|
|
@@ -143,7 +143,7 @@
|
|
|
143
143
|
"uuid": "^3.2.1"
|
|
144
144
|
},
|
|
145
145
|
"devDependencies": {
|
|
146
|
-
"@instructure/quiz-scripts": "
|
|
146
|
+
"@instructure/quiz-scripts": "20.6.0",
|
|
147
147
|
"@instructure/ui-axe-check": "^8.51.0",
|
|
148
148
|
"@instructure/ui-babel-preset": "^7.22.1",
|
|
149
149
|
"@instructure/ui-karma-config": "^7.22.1",
|
|
@@ -163,7 +163,7 @@
|
|
|
163
163
|
"intl": "^1.2.4",
|
|
164
164
|
"jquery": "^2.2.3",
|
|
165
165
|
"most-subject": "^5.3.0",
|
|
166
|
-
"quiz-presets": "
|
|
166
|
+
"quiz-presets": "20.6.1-rc.0+a0fffa16e",
|
|
167
167
|
"react": "^16.8.6",
|
|
168
168
|
"react-addons-test-utils": "^15.6.2",
|
|
169
169
|
"react-dom": "^16.8.6",
|
|
@@ -179,5 +179,5 @@
|
|
|
179
179
|
"publishConfig": {
|
|
180
180
|
"access": "public"
|
|
181
181
|
},
|
|
182
|
-
"gitHead": "
|
|
182
|
+
"gitHead": "a0fffa16e44c90bfd9f88c622a136f32095f3edf"
|
|
183
183
|
}
|