@instructure/quiz-core 20.8.0 → 20.8.1-rc.1
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 +36 -8
- package/es/banks/components/Banks/presenter.js +10 -1
- package/es/banks/components/BanksList/presenter.js +5 -0
- package/es/banks/components/SharingModal/ShareList/index.js +20 -9
- package/es/banks/components/SharingModal/asyncSearch.js +65 -6
- package/es/banks/components/SharingModal/presenter.js +6 -2
- package/es/building/components/resources/BanksTray/presenter.js +7 -0
- package/es/moderating/components/resources/ModerateTable/presenter.js +46 -11
- package/es/moderating/components/resources/ModerateTableRow/presenter.js +8 -2
- package/lib/banks/api/banks.js +35 -7
- package/lib/banks/components/Banks/presenter.js +10 -1
- package/lib/banks/components/BanksList/presenter.js +5 -0
- package/lib/banks/components/SharingModal/ShareList/index.js +19 -8
- package/lib/banks/components/SharingModal/asyncSearch.js +64 -5
- package/lib/banks/components/SharingModal/presenter.js +6 -2
- package/lib/building/components/resources/BanksTray/presenter.js +7 -0
- package/lib/moderating/components/resources/ModerateTable/presenter.js +50 -12
- package/lib/moderating/components/resources/ModerateTableRow/presenter.js +8 -2
- package/package.json +10 -10
package/lib/banks/api/banks.js
CHANGED
|
@@ -274,10 +274,10 @@ var shareBank = function shareBank(_shareBank) {
|
|
|
274
274
|
};
|
|
275
275
|
dispatch((0, _callHandlers.handleShareBankResponse)(sharedBank));
|
|
276
276
|
});
|
|
277
|
-
} else
|
|
277
|
+
} else {
|
|
278
278
|
var sharedBank = {
|
|
279
279
|
id: sharedBankInfo.id,
|
|
280
|
-
entityType:
|
|
280
|
+
entityType: _shareBank.entityType,
|
|
281
281
|
entityId: _shareBank.entityId,
|
|
282
282
|
title: _shareBank.title,
|
|
283
283
|
permission: sharedBankInfo.permission,
|
|
@@ -326,10 +326,8 @@ var getSharedBank = function getSharedBank(bankId, entityType, entityId) {
|
|
|
326
326
|
|
|
327
327
|
exports.getSharedBank = getSharedBank;
|
|
328
328
|
|
|
329
|
-
var getSharedBanks = function getSharedBanks(bank, getUserInfo, getCourseInfo) {
|
|
329
|
+
var getSharedBanks = function getSharedBanks(bank, getUserInfo, getCourseInfo, getAccountInfo) {
|
|
330
330
|
var url = "".concat(banksApiEndpoint, "/").concat(bank.id, "/shared_banks");
|
|
331
|
-
var userSharedBanks = [];
|
|
332
|
-
var courseSharedBanks = [];
|
|
333
331
|
return function (dispatch, getState) {
|
|
334
332
|
var fetcher = new _Fetcher.default({
|
|
335
333
|
onError: (0, _helpers.handleError)(dispatch, (0, _formatMessage.default)('Failed to fetch shared banks.'))
|
|
@@ -344,8 +342,10 @@ var getSharedBanks = function getSharedBanks(bank, getUserInfo, getCourseInfo) {
|
|
|
344
342
|
permission: _quizCommon.CAN_EDIT,
|
|
345
343
|
bank_id: bank.id
|
|
346
344
|
});
|
|
347
|
-
}
|
|
345
|
+
} // USERS
|
|
346
|
+
|
|
348
347
|
|
|
348
|
+
var userSharedBanks = [];
|
|
349
349
|
var userUuids = sharedBanksInfo.filter(function (sb) {
|
|
350
350
|
return sb.entity_type === _quizCommon.SHARED_WITH_USER;
|
|
351
351
|
}).map(function (sb) {
|
|
@@ -370,7 +370,9 @@ var getSharedBanks = function getSharedBanks(bank, getUserInfo, getCourseInfo) {
|
|
|
370
370
|
}
|
|
371
371
|
});
|
|
372
372
|
dispatch((0, _callHandlers.handleShareBanksResponse)(userSharedBanks));
|
|
373
|
-
});
|
|
373
|
+
}); // COURSES
|
|
374
|
+
|
|
375
|
+
var courseSharedBanks = [];
|
|
374
376
|
var courseUuids = sharedBanksInfo.filter(function (sb) {
|
|
375
377
|
return sb.entity_type === _quizCommon.SHARED_WITH_COURSE;
|
|
376
378
|
}).map(function (sb) {
|
|
@@ -394,6 +396,32 @@ var getSharedBanks = function getSharedBanks(bank, getUserInfo, getCourseInfo) {
|
|
|
394
396
|
}
|
|
395
397
|
});
|
|
396
398
|
dispatch((0, _callHandlers.handleShareBanksResponse)(courseSharedBanks));
|
|
399
|
+
}); // ACCOUNTS
|
|
400
|
+
|
|
401
|
+
var accountSharedBanks = [];
|
|
402
|
+
var accountUuids = sharedBanksInfo.filter(function (sb) {
|
|
403
|
+
return sb.entity_type === _quizCommon.SHARED_WITH_ACCOUNT;
|
|
404
|
+
}).map(function (sb) {
|
|
405
|
+
return sb.entity_id;
|
|
406
|
+
});
|
|
407
|
+
getAccountInfo(accountUuids).then(function (accountsInfo) {
|
|
408
|
+
accountsInfo.forEach(function (accountInfo) {
|
|
409
|
+
var sharedBankInfo = sharedBanksInfo.find(function (sb) {
|
|
410
|
+
return sb.entity_type === _quizCommon.SHARED_WITH_ACCOUNT && sb.entity_id === accountInfo.uuid;
|
|
411
|
+
});
|
|
412
|
+
|
|
413
|
+
if (sharedBankInfo) {
|
|
414
|
+
accountSharedBanks.push({
|
|
415
|
+
id: sharedBankInfo.id,
|
|
416
|
+
entityType: sharedBankInfo.entity_type,
|
|
417
|
+
entityId: sharedBankInfo.entity_id,
|
|
418
|
+
title: accountInfo.name,
|
|
419
|
+
permission: sharedBankInfo.permission,
|
|
420
|
+
bankId: sharedBankInfo.bank_id
|
|
421
|
+
});
|
|
422
|
+
}
|
|
423
|
+
});
|
|
424
|
+
dispatch((0, _callHandlers.handleShareBanksResponse)(accountSharedBanks));
|
|
397
425
|
});
|
|
398
426
|
});
|
|
399
427
|
};
|
|
@@ -208,8 +208,10 @@ var Banks = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _d
|
|
|
208
208
|
focusCreateBankButton: _this.focusCreateBankButton,
|
|
209
209
|
getCourseInfo: _this.props.getCourseInfo,
|
|
210
210
|
getUserInfo: _this.props.getUserInfo,
|
|
211
|
+
getSubaccountInfo: _this.props.getSubaccountInfo,
|
|
211
212
|
getShareableCourses: _this.props.getShareableCourses,
|
|
212
213
|
getShareableUsers: _this.props.getShareableUsers,
|
|
214
|
+
getShareableSubaccounts: _this.props.getShareableSubaccounts,
|
|
213
215
|
isCompact: _this.props.isCompact,
|
|
214
216
|
itemBankSearchTableEnabled: _this.props.itemBankSearchTableEnabled,
|
|
215
217
|
minChars: _this.props.minChars,
|
|
@@ -436,6 +438,7 @@ var Banks = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _d
|
|
|
436
438
|
createBank: _propTypes.default.func.isRequired,
|
|
437
439
|
currentUser: _propTypes.default.shape({
|
|
438
440
|
bank_admin: _propTypes.default.bool,
|
|
441
|
+
can_share_banks_with_subaccounts: _propTypes.default.bool,
|
|
439
442
|
email: _propTypes.default.string,
|
|
440
443
|
enrollment_names: _propTypes.default.arrayOf(_propTypes.default.string),
|
|
441
444
|
full_name: _propTypes.default.string,
|
|
@@ -453,7 +456,11 @@ var Banks = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _d
|
|
|
453
456
|
getShareableCourses: _propTypes.default.func,
|
|
454
457
|
// from consumer
|
|
455
458
|
getShareableUsers: _propTypes.default.func,
|
|
456
|
-
// from consumer
|
|
459
|
+
// from consumer
|
|
460
|
+
getShareableSubaccounts: _propTypes.default.func,
|
|
461
|
+
// from consumer
|
|
462
|
+
getSubaccountInfo: _propTypes.default.func,
|
|
463
|
+
// from consumer
|
|
457
464
|
getCourseAssignments: _propTypes.default.func,
|
|
458
465
|
// from consumer
|
|
459
466
|
isCompact: _propTypes.default.bool,
|
|
@@ -490,6 +497,8 @@ var Banks = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _d
|
|
|
490
497
|
getShareableCourses: null,
|
|
491
498
|
getShareableUsers: null,
|
|
492
499
|
getCourseAssignments: null,
|
|
500
|
+
getShareableSubaccounts: null,
|
|
501
|
+
getSubaccountInfo: null,
|
|
493
502
|
minChars: void 0,
|
|
494
503
|
isCompact: false,
|
|
495
504
|
navigateToBuild: null,
|
|
@@ -434,6 +434,7 @@ var BanksList = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default)
|
|
|
434
434
|
focusCreateBankButton: this.props.focusCreateBankButton,
|
|
435
435
|
getCourseInfo: this.props.getCourseInfo,
|
|
436
436
|
getUserInfo: this.props.getUserInfo,
|
|
437
|
+
getSubaccountInfo: this.props.getSubaccountInfo,
|
|
437
438
|
isOpen: this.state.sharingModalOpen,
|
|
438
439
|
minChars: this.props.minChars,
|
|
439
440
|
modalTrigger: this.sharingButtons[this.state.sharingModalBank.id],
|
|
@@ -441,6 +442,7 @@ var BanksList = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default)
|
|
|
441
442
|
onShare: this.props.onShare,
|
|
442
443
|
getShareableCourses: this.props.getShareableCourses,
|
|
443
444
|
getShareableUsers: this.props.getShareableUsers,
|
|
445
|
+
getShareableSubaccounts: this.props.getShareableSubaccounts,
|
|
444
446
|
updateSharedCount: this.updateSharedCount
|
|
445
447
|
});
|
|
446
448
|
}
|
|
@@ -544,6 +546,7 @@ var BanksList = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default)
|
|
|
544
546
|
createBankCloneJob: _propTypes.default.func.isRequired,
|
|
545
547
|
currentUser: _propTypes.default.shape({
|
|
546
548
|
bank_admin: _propTypes.default.bool,
|
|
549
|
+
can_share_banks_with_subaccounts: _propTypes.default.bool,
|
|
547
550
|
email: _propTypes.default.string,
|
|
548
551
|
enrollment_names: _propTypes.default.arrayOf(_propTypes.default.string),
|
|
549
552
|
full_name: _propTypes.default.string,
|
|
@@ -557,6 +560,7 @@ var BanksList = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default)
|
|
|
557
560
|
getUserInfo: _propTypes.default.func,
|
|
558
561
|
getShareableCourses: _propTypes.default.func,
|
|
559
562
|
getShareableUsers: _propTypes.default.func,
|
|
563
|
+
getShareableSubaccounts: _propTypes.default.func,
|
|
560
564
|
minChars: _propTypes.default.number,
|
|
561
565
|
navigateToBank: _propTypes.default.func.isRequired,
|
|
562
566
|
onShare: _propTypes.default.func,
|
|
@@ -572,6 +576,7 @@ var BanksList = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default)
|
|
|
572
576
|
getUserInfo: null,
|
|
573
577
|
getShareableCourses: null,
|
|
574
578
|
getShareableUsers: null,
|
|
579
|
+
getShareableSubaccounts: null,
|
|
575
580
|
minChars: void 0,
|
|
576
581
|
locale: null,
|
|
577
582
|
timezone: null,
|
|
@@ -178,11 +178,10 @@ var ShareList = (_dec = (0, _emotion.withStyle)(_styles.default, null), _dec(_cl
|
|
|
178
178
|
}, {
|
|
179
179
|
key: "render",
|
|
180
180
|
value: function render() {
|
|
181
|
-
var _this$props$currentUs;
|
|
182
|
-
|
|
183
181
|
var _this$props = this.props,
|
|
184
182
|
shares = _this$props.shares,
|
|
185
|
-
subAccountBankSharingEnabled = _this$props.subAccountBankSharingEnabled
|
|
183
|
+
subAccountBankSharingEnabled = _this$props.subAccountBankSharingEnabled,
|
|
184
|
+
currentUser = _this$props.currentUser;
|
|
186
185
|
var newEntityIds = this.props.newEntities.map(function (e) {
|
|
187
186
|
return e.get('id');
|
|
188
187
|
});
|
|
@@ -195,6 +194,9 @@ var ShareList = (_dec = (0, _emotion.withStyle)(_styles.default, null), _dec(_cl
|
|
|
195
194
|
var existingCourses = existingShares.filter(function (s) {
|
|
196
195
|
return s.get('entityType') === _quizCommon.SHARED_WITH_COURSE;
|
|
197
196
|
});
|
|
197
|
+
var existingAccounts = existingShares.filter(function (s) {
|
|
198
|
+
return s.get('entityType') === _quizCommon.SHARED_WITH_ACCOUNT;
|
|
199
|
+
});
|
|
198
200
|
return (0, _emotion.jsx)("div", {
|
|
199
201
|
className: "fs-mask"
|
|
200
202
|
}, !subAccountBankSharingEnabled && (0, _emotion.jsx)(_uiText.Text, {
|
|
@@ -229,16 +231,24 @@ var ShareList = (_dec = (0, _emotion.withStyle)(_styles.default, null), _dec(_cl
|
|
|
229
231
|
lineHeight: "double"
|
|
230
232
|
}, (0, _formatMessage.default)('Currently shared with')), (0, _emotion.jsx)(_uiGrid.Grid, {
|
|
231
233
|
vAlign: "middle"
|
|
232
|
-
}, existingCourses.map(this.renderEntity))), subAccountBankSharingEnabled && (0, _emotion.jsx)(_uiTabs.Tabs.Panel, {
|
|
233
|
-
renderTitle: (0, _formatMessage.default)('Accounts'
|
|
234
|
+
}, existingCourses.map(this.renderEntity))), subAccountBankSharingEnabled && ((currentUser === null || currentUser === void 0 ? void 0 : currentUser.bank_admin) || (currentUser === null || currentUser === void 0 ? void 0 : currentUser.can_share_banks_with_subaccounts)) && (0, _emotion.jsx)(_uiTabs.Tabs.Panel, {
|
|
235
|
+
renderTitle: (0, _formatMessage.default)('Accounts ({ accountsCount })', {
|
|
236
|
+
accountsCount: existingAccounts.size
|
|
237
|
+
}),
|
|
234
238
|
isSelected: this.state.selectedTabIndex === 2,
|
|
235
239
|
padding: "large small small small"
|
|
236
|
-
}, (
|
|
240
|
+
}, (currentUser === null || currentUser === void 0 ? void 0 : currentUser.bank_admin) && (0, _emotion.jsx)(_RootAccountSharing.default, {
|
|
237
241
|
accountName: this.props.accountName,
|
|
238
242
|
onShareChange: this.props.onToggleAccountShare,
|
|
239
243
|
onShareTypeChange: this.props.onAccountPermissionChange,
|
|
240
244
|
accountPermission: this.props.accountPermission
|
|
241
|
-
}))))
|
|
245
|
+
}), (currentUser === null || currentUser === void 0 ? void 0 : currentUser.can_share_banks_with_subaccounts) && this.props.renderSearchSection(_quizCommon.SHARED_WITH_ACCOUNT), (0, _emotion.jsx)(_uiText.Text, {
|
|
246
|
+
as: "div",
|
|
247
|
+
weight: "bold",
|
|
248
|
+
lineHeight: "double"
|
|
249
|
+
}, (0, _formatMessage.default)('Currently shared with')), (0, _emotion.jsx)(_uiGrid.Grid, {
|
|
250
|
+
vAlign: "middle"
|
|
251
|
+
}, existingAccounts.map(this.renderEntity))))));
|
|
242
252
|
}
|
|
243
253
|
}]);
|
|
244
254
|
ShareList.displayName = "ShareList";
|
|
@@ -246,7 +256,8 @@ var ShareList = (_dec = (0, _emotion.withStyle)(_styles.default, null), _dec(_cl
|
|
|
246
256
|
}(_react.Component), _class2.propTypes = {
|
|
247
257
|
canEdit: _propTypes.default.bool.isRequired,
|
|
248
258
|
currentUser: _propTypes.default.shape({
|
|
249
|
-
bank_admin: _propTypes.default.bool
|
|
259
|
+
bank_admin: _propTypes.default.bool,
|
|
260
|
+
can_share_banks_with_subaccounts: _propTypes.default.bool
|
|
250
261
|
}),
|
|
251
262
|
improvedBankSharingEnabled: _propTypes.default.bool.isRequired,
|
|
252
263
|
newEntities: _reactImmutableProptypes.default.list,
|
|
@@ -59,6 +59,7 @@ var AsyncSearch = /*#__PURE__*/function (_Component) {
|
|
|
59
59
|
isShowingOptions: false,
|
|
60
60
|
isLoading: false,
|
|
61
61
|
highlightedOptionId: null,
|
|
62
|
+
shareableSubaccounts: [],
|
|
62
63
|
shareableCourses: [],
|
|
63
64
|
shareableUsers: []
|
|
64
65
|
};
|
|
@@ -70,7 +71,7 @@ var AsyncSearch = /*#__PURE__*/function (_Component) {
|
|
|
70
71
|
};
|
|
71
72
|
|
|
72
73
|
_this.handleHideOptions = function () {
|
|
73
|
-
var allOptions = [].concat((0, _toConsumableArray2.default)(_this.filterOptions(_this.state.shareableCourses)), (0, _toConsumableArray2.default)(_this.filterOptions(_this.state.shareableUsers))); // an option matching user input exists
|
|
74
|
+
var allOptions = [].concat((0, _toConsumableArray2.default)(_this.filterOptions(_this.state.shareableSubaccounts)), (0, _toConsumableArray2.default)(_this.filterOptions(_this.state.shareableCourses)), (0, _toConsumableArray2.default)(_this.filterOptions(_this.state.shareableUsers))); // an option matching user input exists
|
|
74
75
|
|
|
75
76
|
if (allOptions.length === 1) {
|
|
76
77
|
var onlyOption = allOptions[0]; // automatically select the matching option
|
|
@@ -191,7 +192,8 @@ var AsyncSearch = /*#__PURE__*/function (_Component) {
|
|
|
191
192
|
|
|
192
193
|
_this.search = (0, _debounce.default)(_this.props.debounceDelay, function (value) {
|
|
193
194
|
var shouldSearchPeople = !_this.props.searchType || _this.props.searchType === _quizCommon.SHARED_WITH_USER;
|
|
194
|
-
var shouldSearchCourses = !_this.props.searchType || _this.props.searchType === _quizCommon.SHARED_WITH_COURSE;
|
|
195
|
+
var shouldSearchCourses = !_this.props.searchType || _this.props.searchType === _quizCommon.SHARED_WITH_COURSE;
|
|
196
|
+
var shouldSearchSubaccounts = _this.props.searchType === _quizCommon.SHARED_WITH_ACCOUNT; // TODO add the promise cancellation for avoiding having disordered requests
|
|
195
197
|
|
|
196
198
|
if (shouldSearchPeople) {
|
|
197
199
|
_this.props.getShareableUsers(value).then(function (shareableUsers) {
|
|
@@ -216,6 +218,18 @@ var AsyncSearch = /*#__PURE__*/function (_Component) {
|
|
|
216
218
|
});
|
|
217
219
|
});
|
|
218
220
|
}
|
|
221
|
+
|
|
222
|
+
if (shouldSearchSubaccounts) {
|
|
223
|
+
_this.props.getShareableSubaccounts(value).then(function (shareableSubaccounts) {
|
|
224
|
+
var filteredAccounts = _this.filterOptions(shareableSubaccounts);
|
|
225
|
+
|
|
226
|
+
_this.setState({
|
|
227
|
+
shareableSubaccounts: shareableSubaccounts,
|
|
228
|
+
highlightedOptionId: filteredAccounts.length ? filteredAccounts[0].uuid : _this.state.highlightedOptionId,
|
|
229
|
+
isLoading: false
|
|
230
|
+
});
|
|
231
|
+
});
|
|
232
|
+
}
|
|
219
233
|
});
|
|
220
234
|
return _this;
|
|
221
235
|
}
|
|
@@ -243,6 +257,16 @@ var AsyncSearch = /*#__PURE__*/function (_Component) {
|
|
|
243
257
|
});
|
|
244
258
|
}
|
|
245
259
|
|
|
260
|
+
var account = (0, _find.default)({
|
|
261
|
+
uuid: id
|
|
262
|
+
}, this.state.shareableSubaccounts);
|
|
263
|
+
|
|
264
|
+
if (account) {
|
|
265
|
+
return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, account), {}, {
|
|
266
|
+
entityType: _quizCommon.SHARED_WITH_ACCOUNT
|
|
267
|
+
});
|
|
268
|
+
}
|
|
269
|
+
|
|
246
270
|
return (0, _find.default)({
|
|
247
271
|
uuid: id
|
|
248
272
|
}, this.props.selectedOption);
|
|
@@ -257,7 +281,7 @@ var AsyncSearch = /*#__PURE__*/function (_Component) {
|
|
|
257
281
|
key: option.uuid,
|
|
258
282
|
id: option.uuid,
|
|
259
283
|
index: index,
|
|
260
|
-
text: option.fullName || option.title,
|
|
284
|
+
text: option.fullName || option.title || option.name,
|
|
261
285
|
onClick: _this2.dismissTag
|
|
262
286
|
});
|
|
263
287
|
});
|
|
@@ -309,6 +333,24 @@ var AsyncSearch = /*#__PURE__*/function (_Component) {
|
|
|
309
333
|
}, course.title);
|
|
310
334
|
}));
|
|
311
335
|
}
|
|
336
|
+
}, {
|
|
337
|
+
key: "renderSubaccountsOptions",
|
|
338
|
+
value: function renderSubaccountsOptions(subaccounts) {
|
|
339
|
+
var _this6 = this;
|
|
340
|
+
|
|
341
|
+
return /*#__PURE__*/_react.default.createElement(_uiSelect.Select.Group, {
|
|
342
|
+
key: _quizCommon.SHARED_WITH_ACCOUNT,
|
|
343
|
+
renderLabel: (0, _formatMessage.default)('Accounts')
|
|
344
|
+
}, subaccounts.map(function (subaccount) {
|
|
345
|
+
return /*#__PURE__*/_react.default.createElement(_uiSelect.Select.Option, {
|
|
346
|
+
// eslint-disable-next-line react/jsx-no-literals
|
|
347
|
+
"data-automation": "sdk-item-bank-option-subaccount-".concat(subaccount.uuid),
|
|
348
|
+
id: subaccount.uuid,
|
|
349
|
+
key: subaccount.uuid,
|
|
350
|
+
isHighlighted: subaccount.uuid === _this6.state.highlightedOptionId
|
|
351
|
+
}, subaccount.name);
|
|
352
|
+
}));
|
|
353
|
+
}
|
|
312
354
|
}, {
|
|
313
355
|
key: "emptyOption",
|
|
314
356
|
value: function emptyOption() {
|
|
@@ -338,6 +380,12 @@ var AsyncSearch = /*#__PURE__*/function (_Component) {
|
|
|
338
380
|
groups.push(this.renderCoursesOptions(courses));
|
|
339
381
|
}
|
|
340
382
|
|
|
383
|
+
var subaccounts = this.filterOptions(this.state.shareableSubaccounts);
|
|
384
|
+
|
|
385
|
+
if (subaccounts.length) {
|
|
386
|
+
groups.push(this.renderSubaccountsOptions(subaccounts));
|
|
387
|
+
}
|
|
388
|
+
|
|
341
389
|
return groups.length ? groups : /*#__PURE__*/_react.default.createElement(_uiSelect.Select.Option, {
|
|
342
390
|
id: _quizCommon.SELECT_EMPTY_OPTION,
|
|
343
391
|
key: _quizCommon.SELECT_EMPTY_OPTION
|
|
@@ -346,17 +394,27 @@ var AsyncSearch = /*#__PURE__*/function (_Component) {
|
|
|
346
394
|
size: "x-small"
|
|
347
395
|
}) : this.emptyOption());
|
|
348
396
|
}
|
|
397
|
+
}, {
|
|
398
|
+
key: "placeholder",
|
|
399
|
+
value: function placeholder() {
|
|
400
|
+
if (this.props.searchType === _quizCommon.SHARED_WITH_ACCOUNT) {
|
|
401
|
+
return (0, _formatMessage.default)('Enter subaccount name');
|
|
402
|
+
} else if (this.props.searchType === _quizCommon.SHARED_WITH_COURSE) {
|
|
403
|
+
return (0, _formatMessage.default)('Enter course name or course id');
|
|
404
|
+
} else {
|
|
405
|
+
return (0, _formatMessage.default)('Enter name or login id');
|
|
406
|
+
}
|
|
407
|
+
}
|
|
349
408
|
}, {
|
|
350
409
|
key: "render",
|
|
351
410
|
value: function render() {
|
|
352
411
|
var _this$state = this.state,
|
|
353
412
|
inputValue = _this$state.inputValue,
|
|
354
413
|
isShowingOptions = _this$state.isShowingOptions;
|
|
355
|
-
var placeholder = this.props.searchType === _quizCommon.SHARED_WITH_COURSE ? (0, _formatMessage.default)('Enter course name or course id') : (0, _formatMessage.default)('Enter name or login id');
|
|
356
414
|
return /*#__PURE__*/_react.default.createElement(_uiSelect.Select, {
|
|
357
415
|
"data-automation": "sdk-item-bank-share-input",
|
|
358
416
|
renderLabel: (0, _formatMessage.default)('Share With'),
|
|
359
|
-
placeholder: placeholder,
|
|
417
|
+
placeholder: this.placeholder(),
|
|
360
418
|
inputValue: inputValue,
|
|
361
419
|
isShowingOptions: isShowingOptions,
|
|
362
420
|
inputRef: this.setInputRef,
|
|
@@ -383,6 +441,7 @@ AsyncSearch.propTypes = {
|
|
|
383
441
|
onSelectionChange: _propTypes.default.func.isRequired,
|
|
384
442
|
getShareableCourses: _propTypes.default.func.isRequired,
|
|
385
443
|
getShareableUsers: _propTypes.default.func.isRequired,
|
|
444
|
+
getShareableSubaccounts: _propTypes.default.func.isRequired,
|
|
386
445
|
searchType: _propTypes.default.string,
|
|
387
446
|
selectedOption: _propTypes.default.arrayOf(_propTypes.default.shape({
|
|
388
447
|
avatar: _propTypes.default.string,
|
|
@@ -119,7 +119,7 @@ var SharingModalPresenter = (_dec = (0, _emotion.withStyle)(_styles.default, _th
|
|
|
119
119
|
var size = _this.props.sharedBanks.size;
|
|
120
120
|
|
|
121
121
|
if (size >= 0 && size !== _this.props.bank.sharedCount || size === 0) {
|
|
122
|
-
_this.props.getSharedBanks(_this.props.bank, _this.props.getUserInfo, _this.props.getCourseInfo);
|
|
122
|
+
_this.props.getSharedBanks(_this.props.bank, _this.props.getUserInfo, _this.props.getCourseInfo, _this.props.getSubaccountInfo);
|
|
123
123
|
} else {
|
|
124
124
|
// eslint-disable-next-line react/no-did-mount-set-state
|
|
125
125
|
_this.setState({
|
|
@@ -291,7 +291,7 @@ var SharingModalPresenter = (_dec = (0, _emotion.withStyle)(_styles.default, _th
|
|
|
291
291
|
id: entity.uuid,
|
|
292
292
|
entityType: entity.entityType,
|
|
293
293
|
entityId: entity.uuid,
|
|
294
|
-
title: entity.fullName || entity.title,
|
|
294
|
+
title: entity.fullName || entity.title || entity.name,
|
|
295
295
|
avatar: entity.avatar,
|
|
296
296
|
email: entity.email,
|
|
297
297
|
permission: _this.state.searchPermission
|
|
@@ -415,6 +415,7 @@ var SharingModalPresenter = (_dec = (0, _emotion.withStyle)(_styles.default, _th
|
|
|
415
415
|
}, (0, _emotion.jsx)(_uiGrid.Grid.Row, null, (0, _emotion.jsx)(_uiGrid.Grid.Col, null, (0, _emotion.jsx)(_asyncSearch.default, {
|
|
416
416
|
getShareableCourses: _this.props.getShareableCourses,
|
|
417
417
|
getShareableUsers: _this.props.getShareableUsers,
|
|
418
|
+
getShareableSubaccounts: _this.props.getShareableSubaccounts,
|
|
418
419
|
improvedBankSharingEnabled: _this.props.improvedBankSharingEnabled,
|
|
419
420
|
minChars: _this.props.minChars,
|
|
420
421
|
onSelectionChange: _this.handleSearchSelectionChange,
|
|
@@ -602,6 +603,7 @@ var SharingModalPresenter = (_dec = (0, _emotion.withStyle)(_styles.default, _th
|
|
|
602
603
|
bank: _reactImmutableProptypes.default.record.isRequired,
|
|
603
604
|
currentUser: _propTypes.default.shape({
|
|
604
605
|
bank_admin: _propTypes.default.bool,
|
|
606
|
+
can_share_banks_with_subaccounts: _propTypes.default.bool,
|
|
605
607
|
email: _propTypes.default.string,
|
|
606
608
|
enrollment_names: _propTypes.default.arrayOf(_propTypes.default.string),
|
|
607
609
|
full_name: _propTypes.default.string,
|
|
@@ -615,6 +617,8 @@ var SharingModalPresenter = (_dec = (0, _emotion.withStyle)(_styles.default, _th
|
|
|
615
617
|
getShareableUsers: _propTypes.default.func.isRequired,
|
|
616
618
|
getSharedBanks: _propTypes.default.func.isRequired,
|
|
617
619
|
getUserInfo: _propTypes.default.func.isRequired,
|
|
620
|
+
getShareableSubaccounts: _propTypes.default.func.isRequired,
|
|
621
|
+
getSubaccountInfo: _propTypes.default.func.isRequired,
|
|
618
622
|
improvedBankSharingEnabled: _propTypes.default.bool,
|
|
619
623
|
isOpen: _propTypes.default.bool,
|
|
620
624
|
minChars: _propTypes.default.number,
|
|
@@ -136,8 +136,10 @@ var BanksTray = /*#__PURE__*/function (_Component) {
|
|
|
136
136
|
getCourseInfo: this.props.getCourseInfo,
|
|
137
137
|
getCourseAssignments: this.props.getCourseAssignments,
|
|
138
138
|
getUserInfo: this.props.getUserInfo,
|
|
139
|
+
getSubaccountInfo: this.props.getSubaccountInfo,
|
|
139
140
|
getShareableCourses: this.props.getShareableCourses,
|
|
140
141
|
getShareableUsers: this.props.getShareableUsers,
|
|
142
|
+
getShareableSubaccounts: this.props.getShareableSubaccounts,
|
|
141
143
|
minChars: this.props.minChars,
|
|
142
144
|
onShare: this.props.onShare,
|
|
143
145
|
scope: this.props.itemBanksScope
|
|
@@ -200,6 +202,7 @@ BanksTray.propTypes = {
|
|
|
200
202
|
clear: _propTypes.default.func.isRequired,
|
|
201
203
|
currentUser: _propTypes.default.shape({
|
|
202
204
|
bank_admin: _propTypes.default.bool,
|
|
205
|
+
can_share_banks_with_subaccounts: _propTypes.default.bool,
|
|
203
206
|
email: _propTypes.default.string,
|
|
204
207
|
enrollment_names: _propTypes.default.arrayOf(_propTypes.default.string),
|
|
205
208
|
full_name: _propTypes.default.string,
|
|
@@ -211,6 +214,8 @@ BanksTray.propTypes = {
|
|
|
211
214
|
getUserInfo: _propTypes.default.func,
|
|
212
215
|
getShareableCourses: _propTypes.default.func,
|
|
213
216
|
getShareableUsers: _propTypes.default.func,
|
|
217
|
+
getShareableSubaccounts: _propTypes.default.func,
|
|
218
|
+
getSubaccountInfo: _propTypes.default.func,
|
|
214
219
|
minChars: _propTypes.default.number,
|
|
215
220
|
newActiveBank: _propTypes.default.func.isRequired,
|
|
216
221
|
newActiveBankEntry: _propTypes.default.func.isRequired,
|
|
@@ -233,6 +238,8 @@ BanksTray.defaultProps = {
|
|
|
233
238
|
currentUser: null,
|
|
234
239
|
getShareableCourses: null,
|
|
235
240
|
getShareableUsers: null,
|
|
241
|
+
getShareableSubaccounts: null,
|
|
242
|
+
getSubaccountInfo: null,
|
|
236
243
|
minChars: void 0,
|
|
237
244
|
getCourseInfo: null,
|
|
238
245
|
getCourseAssignments: null,
|
|
@@ -9,6 +9,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
9
9
|
});
|
|
10
10
|
exports.default = exports.ModerateTable = void 0;
|
|
11
11
|
|
|
12
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
13
|
+
|
|
12
14
|
var _createForOfIteratorHelper2 = _interopRequireDefault(require("@babel/runtime/helpers/createForOfIteratorHelper"));
|
|
13
15
|
|
|
14
16
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
@@ -27,6 +29,8 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
27
29
|
|
|
28
30
|
var _reactImmutableProptypes = _interopRequireDefault(require("react-immutable-proptypes"));
|
|
29
31
|
|
|
32
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
33
|
+
|
|
30
34
|
var _uiText = require("@instructure/ui-text");
|
|
31
35
|
|
|
32
36
|
var _uiLink = require("@instructure/ui-link");
|
|
@@ -37,6 +41,10 @@ var _uiA11yContent = require("@instructure/ui-a11y-content");
|
|
|
37
41
|
|
|
38
42
|
var _uiTable = require("@instructure/ui-table");
|
|
39
43
|
|
|
44
|
+
var _uiButtons = require("@instructure/ui-buttons");
|
|
45
|
+
|
|
46
|
+
var _uiIcons = require("@instructure/ui-icons");
|
|
47
|
+
|
|
40
48
|
var _uiThemeable = require("@instructure/ui-themeable");
|
|
41
49
|
|
|
42
50
|
var _formatMessage = _interopRequireDefault(require("@instructure/quiz-i18n/es/format-message"));
|
|
@@ -57,26 +65,28 @@ var _index5 = _interopRequireDefault(require("../../sidebar/ResetQuiz/index.js")
|
|
|
57
65
|
|
|
58
66
|
var _quizCommon = require("@instructure/quiz-common");
|
|
59
67
|
|
|
60
|
-
var _uiIcons = require("@instructure/ui-icons");
|
|
61
|
-
|
|
62
68
|
var _lodash = require("lodash");
|
|
63
69
|
|
|
64
70
|
var _dec, _class, _class2, _temp;
|
|
65
71
|
|
|
66
72
|
var styles = {
|
|
67
|
-
componentId: '
|
|
73
|
+
componentId: 'eDRzW',
|
|
68
74
|
template: function template(theme) {
|
|
69
|
-
return "\n\n.
|
|
75
|
+
return "\n\n.eDRzW_bwKH{display:block;margin:".concat(theme.emptyTextMargin || 'inherit', " 0 0 0}\n\n.eDRzW_xNcP{background-color:").concat(theme.pageBackgroundColor || 'inherit', ";flex:1;overflow:auto}\n\n.eDRzW_eeML{display:inline-block;transition:transform 0.3s}\n\n.eDRzW_XujX{transform:scaleX(-1)}");
|
|
70
76
|
},
|
|
71
|
-
'emptyText': '
|
|
72
|
-
'page': '
|
|
77
|
+
'emptyText': 'eDRzW_bwKH',
|
|
78
|
+
'page': 'eDRzW_xNcP',
|
|
79
|
+
'scoreToggleWrapper': 'eDRzW_eeML',
|
|
80
|
+
'mirror': 'eDRzW_XujX'
|
|
73
81
|
};
|
|
74
82
|
|
|
75
83
|
var _ref2 = /*#__PURE__*/_react.default.createElement(_uiFlex.Flex.Item, null, /*#__PURE__*/_react.default.createElement(_uiIcons.IconInfoLine, null));
|
|
76
84
|
|
|
77
|
-
var _ref4 = /*#__PURE__*/_react.default.createElement(
|
|
85
|
+
var _ref4 = /*#__PURE__*/_react.default.createElement(_uiIcons.IconConfigureLine, null);
|
|
86
|
+
|
|
87
|
+
var _ref5 = /*#__PURE__*/_react.default.createElement(_Spinner.default, null);
|
|
78
88
|
|
|
79
|
-
var
|
|
89
|
+
var _ref6 = /*#__PURE__*/_react.default.createElement(_index5.default, null);
|
|
80
90
|
|
|
81
91
|
var ModerateTable = (_dec = (0, _uiThemeable.themeable)(_theme.default, styles), _dec(_class = (_temp = _class2 = /*#__PURE__*/function (_Component) {
|
|
82
92
|
(0, _inherits2.default)(ModerateTable, _Component);
|
|
@@ -94,6 +104,7 @@ var ModerateTable = (_dec = (0, _uiThemeable.themeable)(_theme.default, styles),
|
|
|
94
104
|
|
|
95
105
|
_this = _super.call.apply(_super, [this].concat(args));
|
|
96
106
|
_this.state = {
|
|
107
|
+
displayScoreAsPercentage: true,
|
|
97
108
|
// To support voiceover when the table changes
|
|
98
109
|
moderatePanelIterations: 0,
|
|
99
110
|
selectedStudent: null,
|
|
@@ -184,6 +195,18 @@ var ModerateTable = (_dec = (0, _uiThemeable.themeable)(_theme.default, styles),
|
|
|
184
195
|
_this.pollAutogradingStatus(submittedQuizSessions);
|
|
185
196
|
};
|
|
186
197
|
|
|
198
|
+
_this.handleScoreToggle = function () {
|
|
199
|
+
_this.setState(function (prevState) {
|
|
200
|
+
return {
|
|
201
|
+
displayScoreAsPercentage: !prevState.displayScoreAsPercentage
|
|
202
|
+
};
|
|
203
|
+
});
|
|
204
|
+
};
|
|
205
|
+
|
|
206
|
+
_this.scoreToggleScreenreaderMessage = function () {
|
|
207
|
+
return _this.state.displayScoreAsPercentage ? (0, _formatMessage.default)('Toggle scores to raw points') : (0, _formatMessage.default)('Toggle scores to percentages');
|
|
208
|
+
};
|
|
209
|
+
|
|
187
210
|
_this.openModalOnClick = function () {
|
|
188
211
|
_this.props.openModal(_quizCommon.OUTSTANDING_QUIZZES_MODAL);
|
|
189
212
|
};
|
|
@@ -263,7 +286,8 @@ var ModerateTable = (_dec = (0, _uiThemeable.themeable)(_theme.default, styles),
|
|
|
263
286
|
onModerateLogClick: onModerateLogClick,
|
|
264
287
|
rowData: rowData,
|
|
265
288
|
shouldRenderModerateButton: shouldRenderModerateButton,
|
|
266
|
-
focusTarget: _this2.state.selectedStudent
|
|
289
|
+
focusTarget: _this2.state.selectedStudent,
|
|
290
|
+
displayScoreAsPercentage: _this2.state.displayScoreAsPercentage
|
|
267
291
|
});
|
|
268
292
|
});
|
|
269
293
|
}
|
|
@@ -323,6 +347,20 @@ var ModerateTable = (_dec = (0, _uiThemeable.themeable)(_theme.default, styles),
|
|
|
323
347
|
afterSubmit: this.props.afterManualSubmit
|
|
324
348
|
})));
|
|
325
349
|
}
|
|
350
|
+
}, {
|
|
351
|
+
key: "renderScoreToggle",
|
|
352
|
+
value: function renderScoreToggle() {
|
|
353
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
354
|
+
className: (0, _classnames.default)(styles.scoreToggleWrapper, (0, _defineProperty2.default)({}, styles.mirror, !this.state.displayScoreAsPercentage))
|
|
355
|
+
}, /*#__PURE__*/_react.default.createElement(_uiButtons.IconButton, {
|
|
356
|
+
size: "small",
|
|
357
|
+
margin: "0 x-small",
|
|
358
|
+
withBackground: false,
|
|
359
|
+
withBorder: false,
|
|
360
|
+
screenReaderLabel: this.scoreToggleScreenreaderMessage(),
|
|
361
|
+
onClick: this.handleScoreToggle
|
|
362
|
+
}, _ref4));
|
|
363
|
+
}
|
|
326
364
|
}, {
|
|
327
365
|
key: "renderTable",
|
|
328
366
|
value: function renderTable() {
|
|
@@ -337,7 +375,7 @@ var ModerateTable = (_dec = (0, _uiThemeable.themeable)(_theme.default, styles),
|
|
|
337
375
|
id: "moderation-table-attempts"
|
|
338
376
|
}, (0, _formatMessage.default)('Attempts')), !this.props.anonymousGrading && /*#__PURE__*/_react.default.createElement(_uiTable.Table.ColHeader, {
|
|
339
377
|
id: "moderation-table-score"
|
|
340
|
-
}, (0, _formatMessage.default)('Score')), !this.props.anonymousGrading && /*#__PURE__*/_react.default.createElement(_uiTable.Table.ColHeader, {
|
|
378
|
+
}, (0, _formatMessage.default)('Score'), this.renderScoreToggle()), !this.props.anonymousGrading && /*#__PURE__*/_react.default.createElement(_uiTable.Table.ColHeader, {
|
|
341
379
|
id: "moderation-table-time"
|
|
342
380
|
}, (0, _formatMessage.default)('Time')), !this.props.anonymousGrading && /*#__PURE__*/_react.default.createElement(_uiTable.Table.ColHeader, {
|
|
343
381
|
id: "moderation-table-log"
|
|
@@ -357,7 +395,7 @@ var ModerateTable = (_dec = (0, _uiThemeable.themeable)(_theme.default, styles),
|
|
|
357
395
|
isFetching = _this$props5.isFetching,
|
|
358
396
|
tableData = _this$props5.tableData,
|
|
359
397
|
emptyMessage = _this$props5.emptyMessage;
|
|
360
|
-
if (isFetching || this.state.isWaiting) return
|
|
398
|
+
if (isFetching || this.state.isWaiting) return _ref5;
|
|
361
399
|
if (tableData.length) return this.renderTable();
|
|
362
400
|
return /*#__PURE__*/_react.default.createElement("span", {
|
|
363
401
|
className: styles.emptyText
|
|
@@ -372,7 +410,7 @@ var ModerateTable = (_dec = (0, _uiThemeable.themeable)(_theme.default, styles),
|
|
|
372
410
|
className: styles.page
|
|
373
411
|
}, /*#__PURE__*/_react.default.createElement(_index4.default, {
|
|
374
412
|
onClose: this.onCloseTray
|
|
375
|
-
}, !this.props.anonymousGrading &&
|
|
413
|
+
}, !this.props.anonymousGrading && _ref6, this.props.children), this.renderContent());
|
|
376
414
|
}
|
|
377
415
|
}]);
|
|
378
416
|
ModerateTable.displayName = "ModerateTable";
|
|
@@ -175,8 +175,12 @@ var ModerateTableRow = (_dec = (0, _uiThemeable.themeable)(_theme.default, style
|
|
|
175
175
|
var message = (0, _formatMessage.default)('No Score');
|
|
176
176
|
|
|
177
177
|
if (result.get('score') != null) {
|
|
178
|
-
|
|
179
|
-
|
|
178
|
+
if (_this3.props.displayScoreAsPercentage) {
|
|
179
|
+
var percentage = result.get('score') / result.get('pointsPossible');
|
|
180
|
+
message = _this3.formatPercentMax2FractionDigits(percentage);
|
|
181
|
+
} else {
|
|
182
|
+
message = "".concat(_formatMessage.default.number(result.get('score')), "/").concat(_formatMessage.default.number(result.get('pointsPossible')));
|
|
183
|
+
}
|
|
180
184
|
}
|
|
181
185
|
|
|
182
186
|
if (result.get('pointsPossible') === 0) {
|
|
@@ -391,6 +395,7 @@ var ModerateTableRow = (_dec = (0, _uiThemeable.themeable)(_theme.default, style
|
|
|
391
395
|
return ModerateTableRow;
|
|
392
396
|
}((0, _quizCommon.withI18nSupport)(_react.Component)), _class2.propTypes = {
|
|
393
397
|
anonymousGrading: _propTypes.default.bool.isRequired,
|
|
398
|
+
displayScoreAsPercentage: _propTypes.default.bool,
|
|
394
399
|
onModerateButtonClick: _propTypes.default.func.isRequired,
|
|
395
400
|
onModerateLogClick: _propTypes.default.func.isRequired,
|
|
396
401
|
onAccommodationsClick: _propTypes.default.func,
|
|
@@ -411,6 +416,7 @@ var ModerateTableRow = (_dec = (0, _uiThemeable.themeable)(_theme.default, style
|
|
|
411
416
|
shouldRenderModerateButton: _propTypes.default.bool,
|
|
412
417
|
focusTarget: _propTypes.default.string
|
|
413
418
|
}, _class2.defaultProps = {
|
|
419
|
+
displayScoreAsPercentage: true,
|
|
414
420
|
shouldRenderModerateButton: true,
|
|
415
421
|
focusTarget: null,
|
|
416
422
|
onAccommodationsClick: null
|