@instructure/quiz-core 17.58.2-rc.1 → 17.58.2-rc.10
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 +35 -1
- package/es/banks/components/Bank/index.js +16 -7
- package/es/banks/components/Bank/presenter.js +198 -18
- package/es/building/components/layout/header/BuildingButtons/index.js +2 -0
- package/es/building/components/layout/header/BuildingButtons/presenter.js +8 -0
- package/es/building/components/resources/BanksTray/presenter.js +2 -1
- package/es/common/actions/sharedBanks.js +2 -2
- package/es/index.js +1 -0
- package/es/moderating/components/events/Event.js +1 -1
- package/es/moderating/components/resources/AccommodationsModal/index.js +1 -1
- package/es/moderating/components/resources/ModerateTable/presenter.js +2 -2
- package/es/moderating/components/resources/ModerateTableRow/index.js +1 -1
- package/es/reporting/components/charts/QuintileDistribution/presenter.js +15 -2
- package/es/reporting/components/resources/NewQuizAndItemAnalysis/AnalysisMetric/index.js +2 -0
- package/es/reporting/components/resources/NewQuizAndItemAnalysis/AnalysisMetric/presenter.js +64 -0
- package/es/reporting/components/resources/NewQuizAndItemAnalysis/AnalysisMetric/theme.js +3 -0
- package/es/reporting/components/resources/NewQuizAndItemAnalysis/AnalysisPopoverMetric/index.js +2 -0
- package/es/reporting/components/resources/NewQuizAndItemAnalysis/AnalysisPopoverMetric/presenter.js +75 -0
- package/es/reporting/components/resources/NewQuizAndItemAnalysis/AnalysisPopoverMetric/theme.js +6 -0
- package/es/reporting/components/resources/NewQuizAndItemAnalysis/NewItemAnalysis/index.js +2 -0
- package/es/reporting/components/resources/NewQuizAndItemAnalysis/NewItemAnalysis/popoverContent.js +18 -0
- package/es/reporting/components/resources/NewQuizAndItemAnalysis/NewItemAnalysis/presenter.js +262 -0
- package/es/reporting/components/resources/NewQuizAndItemAnalysis/NewItemAnalysis/theme.js +12 -0
- package/es/reporting/components/resources/NewQuizAndItemAnalysis/NewQuizAnalysis/presenter.js +59 -58
- package/es/reporting/components/resources/NewQuizAndItemAnalysis/ReportCard/index.js +68 -0
- package/es/reporting/components/resources/NewQuizAndItemAnalysis/charts/ScoreDistribution/index.js +2 -0
- package/es/reporting/components/resources/NewQuizAndItemAnalysis/charts/ScoreDistribution/presenter.js +84 -0
- package/es/reporting/components/resources/NewQuizAndItemAnalysis/charts/ScoreDistribution/theme.js +12 -0
- package/es/reporting/components/resources/NewQuizAndItemAnalysis/presenter.js +13 -18
- package/es/reporting/components/resources/NewQuizAndItemAnalysis/utils.js +1 -1
- package/es/reporting/components/resources/ReportCard/index.js +1 -1
- package/lib/banks/api/banks.js +40 -2
- package/lib/banks/components/Bank/index.js +15 -2
- package/lib/banks/components/Bank/presenter.js +203 -17
- package/lib/building/components/layout/header/BuildingButtons/index.js +3 -0
- package/lib/building/components/layout/header/BuildingButtons/presenter.js +8 -0
- package/lib/building/components/resources/BanksTray/presenter.js +2 -1
- package/lib/common/actions/sharedBanks.js +2 -2
- package/lib/index.js +107 -98
- package/lib/moderating/components/events/Event.js +1 -1
- package/lib/moderating/components/resources/AccommodationsModal/index.js +1 -1
- package/lib/moderating/components/resources/ModerateTable/presenter.js +2 -2
- package/lib/moderating/components/resources/ModerateTableRow/index.js +1 -1
- package/lib/reporting/components/charts/QuintileDistribution/presenter.js +15 -2
- package/lib/reporting/components/resources/NewQuizAndItemAnalysis/AnalysisMetric/index.js +11 -0
- package/lib/reporting/components/resources/NewQuizAndItemAnalysis/AnalysisMetric/presenter.js +83 -0
- package/lib/reporting/components/resources/NewQuizAndItemAnalysis/AnalysisMetric/theme.js +10 -0
- package/lib/reporting/components/resources/NewQuizAndItemAnalysis/AnalysisPopoverMetric/index.js +11 -0
- package/lib/reporting/components/resources/NewQuizAndItemAnalysis/AnalysisPopoverMetric/presenter.js +95 -0
- package/lib/reporting/components/resources/NewQuizAndItemAnalysis/AnalysisPopoverMetric/theme.js +13 -0
- package/lib/reporting/components/resources/NewQuizAndItemAnalysis/NewItemAnalysis/index.js +11 -0
- package/lib/reporting/components/resources/NewQuizAndItemAnalysis/NewItemAnalysis/popoverContent.js +27 -0
- package/lib/reporting/components/resources/NewQuizAndItemAnalysis/NewItemAnalysis/presenter.js +291 -0
- package/lib/reporting/components/resources/NewQuizAndItemAnalysis/NewItemAnalysis/theme.js +19 -0
- package/lib/reporting/components/resources/NewQuizAndItemAnalysis/NewQuizAnalysis/presenter.js +64 -63
- package/lib/reporting/components/resources/NewQuizAndItemAnalysis/ReportCard/index.js +91 -0
- package/lib/reporting/components/resources/NewQuizAndItemAnalysis/charts/ScoreDistribution/index.js +11 -0
- package/lib/reporting/components/resources/NewQuizAndItemAnalysis/charts/ScoreDistribution/presenter.js +106 -0
- package/lib/reporting/components/resources/NewQuizAndItemAnalysis/charts/ScoreDistribution/theme.js +19 -0
- package/lib/reporting/components/resources/NewQuizAndItemAnalysis/presenter.js +15 -20
- package/lib/reporting/components/resources/NewQuizAndItemAnalysis/utils.js +1 -1
- package/lib/reporting/components/resources/ReportCard/index.js +1 -1
- package/package.json +9 -9
package/es/banks/api/banks.js
CHANGED
|
@@ -11,6 +11,7 @@ import { clear, newActiveBankEntry, newActiveBank } from "../../common/actions/u
|
|
|
11
11
|
import t from '@instructure/quiz-i18n/es/format-message';
|
|
12
12
|
import { handleError } from "../../common/api/helpers.js";
|
|
13
13
|
import { BANKS_BANK_PAGINATION, BANKS_BANK_ENTRY_PAGINATION, DELETE_BANK_CALL, UPDATE_BANK_CALL, CAN_EDIT, READ_ONLY, REMOVED_ACCESS, SHARED_WITH_USER, SHARED_WITH_COURSE } from '@instructure/quiz-common';
|
|
14
|
+
import { noop } from 'lodash';
|
|
14
15
|
var banksApiEndpoint = '/api/banks';
|
|
15
16
|
var DEFAULT_PAGE_SIZE = 100;
|
|
16
17
|
|
|
@@ -169,7 +170,8 @@ export var deleteBank = function deleteBank(bankId) {
|
|
|
169
170
|
});
|
|
170
171
|
};
|
|
171
172
|
};
|
|
172
|
-
export var shareBank = function shareBank(_shareBank
|
|
173
|
+
export var shareBank = function shareBank(_shareBank) {
|
|
174
|
+
var getUserInfo = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : noop;
|
|
173
175
|
var url = "".concat(banksApiEndpoint, "/").concat(_shareBank.bankId, "/shared_banks");
|
|
174
176
|
return function (dispatch, getState) {
|
|
175
177
|
var shareBankData = JSON.stringify({
|
|
@@ -213,6 +215,38 @@ export var shareBank = function shareBank(_shareBank, getUserInfo) {
|
|
|
213
215
|
});
|
|
214
216
|
};
|
|
215
217
|
};
|
|
218
|
+
export var getSharedBank = function getSharedBank(bankId, entityType, entityId) {
|
|
219
|
+
var url = "".concat(banksApiEndpoint, "/").concat(bankId, "/shared_banks");
|
|
220
|
+
var params = {
|
|
221
|
+
entity_type: entityType,
|
|
222
|
+
entity_id: entityId
|
|
223
|
+
};
|
|
224
|
+
return function (dispatch, getState) {
|
|
225
|
+
var fetcher = new Fetcher({
|
|
226
|
+
onError: handleError(dispatch, t('Failed to fetch shared bank.'))
|
|
227
|
+
});
|
|
228
|
+
return fetcher.get(url, params).then(function (sharedBankInfo) {
|
|
229
|
+
// if the API returns no data, we manually add placeholder to the response
|
|
230
|
+
if (sharedBankInfo.length === 0) {
|
|
231
|
+
var placeholder = {
|
|
232
|
+
id: "notshared_".concat(bankId, "_").concat(entityId),
|
|
233
|
+
entityType: entityType,
|
|
234
|
+
entityId: entityId,
|
|
235
|
+
permission: REMOVED_ACCESS,
|
|
236
|
+
bankId: bankId
|
|
237
|
+
};
|
|
238
|
+
sharedBankInfo.push(placeholder);
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
dispatch(handleShareBanksResponse(sharedBankInfo));
|
|
242
|
+
}).catch(function (err) {
|
|
243
|
+
if (err.response.status === 401) {
|
|
244
|
+
dispatch(clear(BANKS_BANK_PAGINATION));
|
|
245
|
+
throw err;
|
|
246
|
+
}
|
|
247
|
+
});
|
|
248
|
+
};
|
|
249
|
+
};
|
|
216
250
|
export var getSharedBanks = function getSharedBanks(bank, getUserInfo, getCourseInfo) {
|
|
217
251
|
var url = "".concat(banksApiEndpoint, "/").concat(bank.id, "/shared_banks");
|
|
218
252
|
var userSharedBanks = [];
|
|
@@ -3,18 +3,21 @@ import { Bank as BankPresenter } from "./presenter.js";
|
|
|
3
3
|
import { connect } from "../../../common/react-redux.js";
|
|
4
4
|
import BankRecord from "../../../common/records/Bank.js";
|
|
5
5
|
import { getActiveQuiz } from "../../../common/selectors/quizzes.js";
|
|
6
|
-
import { getBank } from "../../../banks/api/banks.js";
|
|
6
|
+
import { getBank, getSharedBank, shareBank, updateSharedBankPermission } from "../../../banks/api/banks.js";
|
|
7
7
|
import { getBankEntries } from "../../../banks/api/bankEntries.js";
|
|
8
8
|
import { createQuizEntry } from "../../../building/api/quizEntries.js";
|
|
9
|
-
import { openModal } from "../../../common/actions/modal.js";
|
|
9
|
+
import { openModal, withConfirm } from "../../../common/actions/modal.js";
|
|
10
10
|
import { BUILD_TRAY_POSITION, BUILD_TRAY_STIMULUS_ID } from '@instructure/quiz-common';
|
|
11
11
|
import { screenreaderNotification } from "../../../common/actions/alerts.js";
|
|
12
12
|
import { reset as resetSearch } from "../../../common/actions/bankSearch.js";
|
|
13
|
+
import { removeSharedBank } from "../../../common/actions/sharedBanks.js";
|
|
13
14
|
import { featureOn } from "../../../common/util/featureCheck.js";
|
|
14
|
-
|
|
15
|
-
function mapStateToProps(state, props) {
|
|
15
|
+
export function mapStateToProps(state, props) {
|
|
16
16
|
var bank = new BankRecord(state.getIn(['banks', props.bankId]));
|
|
17
17
|
var search = state.get('bankSearch', immutable.Map());
|
|
18
|
+
var courseSharedBank = state.get('sharedBanks', immutable.Map()).find(function (sharedBank) {
|
|
19
|
+
return sharedBank.get('bankId') === props.bankId && sharedBank.get('entityType') === props.scope.type && sharedBank.get('entityId') === props.scope.uuid;
|
|
20
|
+
});
|
|
18
21
|
var activeQuiz = getActiveQuiz(state);
|
|
19
22
|
var lockBlueprintContentEnabled = featureOn('lock_blueprint_content');
|
|
20
23
|
var isQuizContentLocked = activeQuiz && activeQuiz.originalQuizLockedByBlueprint && lockBlueprintContentEnabled;
|
|
@@ -22,20 +25,26 @@ function mapStateToProps(state, props) {
|
|
|
22
25
|
bank: bank,
|
|
23
26
|
isQuizContentLocked: isQuizContentLocked,
|
|
24
27
|
search: search,
|
|
28
|
+
courseSharedBank: courseSharedBank,
|
|
25
29
|
useBankSearch: featureOn('item_bank_search'),
|
|
26
30
|
position: state.getIn(['ui', BUILD_TRAY_POSITION]),
|
|
27
31
|
stimulusId: state.getIn(['ui', BUILD_TRAY_STIMULUS_ID]),
|
|
28
|
-
activeQuizId: state.getIn(['quizzes', 'activeQuizId'])
|
|
32
|
+
activeQuizId: state.getIn(['quizzes', 'activeQuizId']),
|
|
33
|
+
showShareBankFromTray: featureOn('share_bank_from_tray')
|
|
29
34
|
};
|
|
30
35
|
}
|
|
31
|
-
|
|
32
36
|
var mapDispatchToProps = {
|
|
33
37
|
addEntryToQuiz: createQuizEntry,
|
|
34
38
|
getBank: getBank,
|
|
35
39
|
getBankEntries: getBankEntries,
|
|
40
|
+
getSharedBank: getSharedBank,
|
|
36
41
|
openModal: openModal,
|
|
42
|
+
removeSharedBank: removeSharedBank,
|
|
37
43
|
resetSearch: resetSearch,
|
|
38
|
-
screenreaderNotification: screenreaderNotification
|
|
44
|
+
screenreaderNotification: screenreaderNotification,
|
|
45
|
+
shareBank: shareBank,
|
|
46
|
+
updateSharedBankPermission: updateSharedBankPermission,
|
|
47
|
+
withConfirm: withConfirm
|
|
39
48
|
};
|
|
40
49
|
export var Bank = connect(mapStateToProps, mapDispatchToProps)(BankPresenter);
|
|
41
50
|
export default Bank;
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
3
|
+
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
1
4
|
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
2
5
|
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
3
6
|
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
@@ -10,12 +13,15 @@ import * as immutable from 'immutable';
|
|
|
10
13
|
import debounce from 'lodash/debounce';
|
|
11
14
|
import PropTypes from 'prop-types';
|
|
12
15
|
import ImmutablePropTypes from 'react-immutable-proptypes';
|
|
16
|
+
import partial from 'lodash/partial';
|
|
13
17
|
import { IconPlusLine } from '@instructure/ui-icons';
|
|
14
18
|
import { BreadcrumbLink } from '@instructure/ui-breadcrumb';
|
|
15
19
|
import { Button } from '@instructure/ui-buttons';
|
|
16
20
|
import { Heading } from '@instructure/ui-heading';
|
|
17
21
|
import { AccessibleContent } from '@instructure/ui-a11y-content';
|
|
18
22
|
import { themeable } from '@instructure/ui-themeable';
|
|
23
|
+
import { Checkbox } from '@instructure/ui-checkbox';
|
|
24
|
+
import { View } from '@instructure/ui-view';
|
|
19
25
|
import BankRecord from "../../../common/records/Bank.js";
|
|
20
26
|
import Page from "../../../common/components/layout/Page/index.js";
|
|
21
27
|
import PaginatedCollection from "../../../common/components/shared/PaginatedCollection/index.js";
|
|
@@ -27,7 +33,7 @@ import BankEntriesList from "../../../banks/components/BankEntriesList/index.js"
|
|
|
27
33
|
import BankSearch from "../../../banks/components/BankSearch/index.js";
|
|
28
34
|
import HeaderMenu from "../../../banks/components/HeaderMenu/index.js";
|
|
29
35
|
import NavWrapper from "../NavWrapper/index.js";
|
|
30
|
-
import { ADD_BANK_ENTRY_MODAL, BANKS_BANK_ENTRY_PAGINATION } from '@instructure/quiz-common';
|
|
36
|
+
import { ADD_BANK_ENTRY_MODAL, BANKS_BANK_ENTRY_PAGINATION, CAN_EDIT, REMOVED_ACCESS, READ_ONLY } from '@instructure/quiz-common';
|
|
31
37
|
var styles = {
|
|
32
38
|
componentId: 'fWUWr',
|
|
33
39
|
template: function template(theme) {
|
|
@@ -56,6 +62,10 @@ export var Bank = (_dec = themeable(theme, styles), _dec(_class = (_temp = _clas
|
|
|
56
62
|
}
|
|
57
63
|
|
|
58
64
|
_this = _super.call.apply(_super, [this].concat(_args));
|
|
65
|
+
_this.state = {
|
|
66
|
+
sharedWithCourse: false,
|
|
67
|
+
shareWithCourseCheckboxDisabled: true
|
|
68
|
+
};
|
|
59
69
|
|
|
60
70
|
_this.openAddBankEntryModal = function () {
|
|
61
71
|
_this.props.openModal(ADD_BANK_ENTRY_MODAL, {
|
|
@@ -75,6 +85,74 @@ export var Bank = (_dec = themeable(theme, styles), _dec(_class = (_temp = _clas
|
|
|
75
85
|
_this.createBankEntryButton = c;
|
|
76
86
|
};
|
|
77
87
|
|
|
88
|
+
_this.toggleCheckbox = function () {
|
|
89
|
+
// disable until request resolves
|
|
90
|
+
_this.setState({
|
|
91
|
+
shareWithCourseCheckboxDisabled: true
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
_this.changeSharedPermissions();
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
_this.unshareBankWithCourse = /*#__PURE__*/function () {
|
|
98
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(sharedBank) {
|
|
99
|
+
var _this$props, updateSharedBankPermission, bankId, getSharedBank, scope;
|
|
100
|
+
|
|
101
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
102
|
+
while (1) {
|
|
103
|
+
switch (_context.prev = _context.next) {
|
|
104
|
+
case 0:
|
|
105
|
+
_this$props = _this.props, updateSharedBankPermission = _this$props.updateSharedBankPermission, bankId = _this$props.bankId, getSharedBank = _this$props.getSharedBank, scope = _this$props.scope;
|
|
106
|
+
_context.next = 3;
|
|
107
|
+
return updateSharedBankPermission(bankId, sharedBank.get('id'), REMOVED_ACCESS);
|
|
108
|
+
|
|
109
|
+
case 3:
|
|
110
|
+
getSharedBank(bankId, scope.type, scope.uuid).catch(function (err) {
|
|
111
|
+
// make sure the user still has access to the bank
|
|
112
|
+
if (err.response.status === 401) {
|
|
113
|
+
_this.props.navigateToBanks();
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
case 4:
|
|
118
|
+
case "end":
|
|
119
|
+
return _context.stop();
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}, _callee);
|
|
123
|
+
}));
|
|
124
|
+
|
|
125
|
+
return function (_x) {
|
|
126
|
+
return _ref.apply(this, arguments);
|
|
127
|
+
};
|
|
128
|
+
}();
|
|
129
|
+
|
|
130
|
+
_this.translatedPermissionLevel = function (permission) {
|
|
131
|
+
var _CAN_EDIT$READ_ONLY$p;
|
|
132
|
+
|
|
133
|
+
return (_CAN_EDIT$READ_ONLY$p = {}, _defineProperty(_CAN_EDIT$READ_ONLY$p, CAN_EDIT, t('edit')), _defineProperty(_CAN_EDIT$READ_ONLY$p, READ_ONLY, t('view')), _CAN_EDIT$READ_ONLY$p)[permission];
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
_this.confirmUnshareBankWithCourse = function () {
|
|
137
|
+
var confirmText = t('You are about to remove { accessLevel } access for { entityTitle } to this bank.', {
|
|
138
|
+
accessLevel: _this.translatedPermissionLevel(_this.props.courseSharedBank.get('permission')),
|
|
139
|
+
entityTitle: _this.props.scope.title
|
|
140
|
+
});
|
|
141
|
+
|
|
142
|
+
_this.props.withConfirm(partial(_this.unshareBankWithCourse, _this.props.courseSharedBank), {
|
|
143
|
+
title: t('Unshare Bank with Course'),
|
|
144
|
+
text: confirmText,
|
|
145
|
+
continueText: t('Confirm'),
|
|
146
|
+
onCancel: _this.onCancelUnshareBankWithCourse
|
|
147
|
+
});
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
_this.onCancelUnshareBankWithCourse = function () {
|
|
151
|
+
_this.setState({
|
|
152
|
+
shareWithCourseCheckboxDisabled: false
|
|
153
|
+
});
|
|
154
|
+
};
|
|
155
|
+
|
|
78
156
|
_this.addBankToQuiz = function () {
|
|
79
157
|
var newEntry = QuizEntry.create({
|
|
80
158
|
entryId: _this.props.bankId,
|
|
@@ -100,8 +178,8 @@ export var Bank = (_dec = themeable(theme, styles), _dec(_class = (_temp = _clas
|
|
|
100
178
|
}, _this.renderNewBankEntryButton());
|
|
101
179
|
};
|
|
102
180
|
|
|
103
|
-
_this.announceResults = function (
|
|
104
|
-
var totalPages =
|
|
181
|
+
_this.announceResults = function (_ref2) {
|
|
182
|
+
var totalPages = _ref2.totalPages;
|
|
105
183
|
var message = t("{\n count, plural,\n =0 {No search results found}\n one {Displaying one page of results}\n other {Displaying # pages of results}\n }", {
|
|
106
184
|
count: totalPages
|
|
107
185
|
}); // Audibly announce when search results are ready.
|
|
@@ -115,10 +193,10 @@ export var Bank = (_dec = themeable(theme, styles), _dec(_class = (_temp = _clas
|
|
|
115
193
|
_this.debouncedAnnounceResults = debounce(_this.announceResults, 1000);
|
|
116
194
|
|
|
117
195
|
_this.getPage = function (page, search) {
|
|
118
|
-
var _this$
|
|
119
|
-
getBankEntries = _this$
|
|
120
|
-
bankId = _this$
|
|
121
|
-
useBankSearch = _this$
|
|
196
|
+
var _this$props2 = _this.props,
|
|
197
|
+
getBankEntries = _this$props2.getBankEntries,
|
|
198
|
+
bankId = _this$props2.bankId,
|
|
199
|
+
useBankSearch = _this$props2.useBankSearch;
|
|
122
200
|
var text = search.get('text');
|
|
123
201
|
var interactionTypes = search.get('interactionTypes', immutable.Set()).toJS();
|
|
124
202
|
var tagIds = search.get('tags', []).map(function (tag) {
|
|
@@ -173,19 +251,68 @@ export var Bank = (_dec = themeable(theme, styles), _dec(_class = (_temp = _clas
|
|
|
173
251
|
|
|
174
252
|
if (this.props.onError) {
|
|
175
253
|
this.props.getBank(this.props.bankId).catch(this.props.onError);
|
|
254
|
+
|
|
255
|
+
if (this.shouldRenderShareWithCourseCheckbox()) {
|
|
256
|
+
this.props.getSharedBank(this.props.bankId, this.props.scope.type, this.props.scope.uuid).catch(this.props.onError);
|
|
257
|
+
}
|
|
176
258
|
} else {
|
|
177
259
|
this.props.getBank(this.props.bankId);
|
|
260
|
+
|
|
261
|
+
if (this.shouldRenderShareWithCourseCheckbox()) {
|
|
262
|
+
this.props.getSharedBank(this.props.bankId, this.props.scope.type, this.props.scope.uuid);
|
|
263
|
+
}
|
|
264
|
+
} // when courseSharedBank is already loaded
|
|
265
|
+
|
|
266
|
+
|
|
267
|
+
if (this.props.courseSharedBank) {
|
|
268
|
+
this.setShareWithCourseCheckbox();
|
|
178
269
|
}
|
|
179
270
|
}
|
|
271
|
+
}, {
|
|
272
|
+
key: "componentDidUpdate",
|
|
273
|
+
value: function componentDidUpdate(prevProps) {
|
|
274
|
+
var _prevProps$courseShar, _this$props$courseSha;
|
|
275
|
+
|
|
276
|
+
var permissionChanged = ((_prevProps$courseShar = prevProps.courseSharedBank) === null || _prevProps$courseShar === void 0 ? void 0 : _prevProps$courseShar.get('permission')) !== ((_this$props$courseSha = this.props.courseSharedBank) === null || _this$props$courseSha === void 0 ? void 0 : _this$props$courseSha.get('permission'));
|
|
277
|
+
|
|
278
|
+
if (this.props.courseSharedBank && permissionChanged) {
|
|
279
|
+
this.setShareWithCourseCheckbox();
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
}, {
|
|
283
|
+
key: "setShareWithCourseCheckbox",
|
|
284
|
+
value: function setShareWithCourseCheckbox() {
|
|
285
|
+
if (this.props.courseSharedBank.get('permission') === REMOVED_ACCESS) {
|
|
286
|
+
this.setState({
|
|
287
|
+
sharedWithCourse: false,
|
|
288
|
+
shareWithCourseCheckboxDisabled: false
|
|
289
|
+
});
|
|
290
|
+
} else {
|
|
291
|
+
this.setState({
|
|
292
|
+
sharedWithCourse: true,
|
|
293
|
+
shareWithCourseCheckboxDisabled: false
|
|
294
|
+
});
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
}, {
|
|
298
|
+
key: "componentWillUnmount",
|
|
299
|
+
value: function componentWillUnmount() {
|
|
300
|
+
this.props.removeSharedBank(this.placeholderCourseSharedBankKey());
|
|
301
|
+
}
|
|
302
|
+
}, {
|
|
303
|
+
key: "placeholderCourseSharedBankKey",
|
|
304
|
+
value: function placeholderCourseSharedBankKey() {
|
|
305
|
+
return "notshared_".concat(this.props.bankId, "_").concat(this.props.scope.uuid);
|
|
306
|
+
}
|
|
180
307
|
}, {
|
|
181
308
|
key: "renderNav",
|
|
182
309
|
value: function renderNav() {
|
|
183
|
-
var _this$
|
|
184
|
-
scope = _this$
|
|
185
|
-
closeTray = _this$
|
|
186
|
-
navigateToBanks = _this$
|
|
187
|
-
navigateToBuild = _this$
|
|
188
|
-
returnToUrl = _this$
|
|
310
|
+
var _this$props3 = this.props,
|
|
311
|
+
scope = _this$props3.scope,
|
|
312
|
+
closeTray = _this$props3.closeTray,
|
|
313
|
+
navigateToBanks = _this$props3.navigateToBanks,
|
|
314
|
+
navigateToBuild = _this$props3.navigateToBuild,
|
|
315
|
+
returnToUrl = _this$props3.returnToUrl;
|
|
189
316
|
var isScopeEmpty = !Object.keys(scope).length;
|
|
190
317
|
return /*#__PURE__*/React.createElement(NavWrapper, {
|
|
191
318
|
closeTray: closeTray,
|
|
@@ -217,6 +344,50 @@ export var Bank = (_dec = themeable(theme, styles), _dec(_class = (_temp = _clas
|
|
|
217
344
|
});
|
|
218
345
|
}
|
|
219
346
|
}
|
|
347
|
+
}, {
|
|
348
|
+
key: "changeSharedPermissions",
|
|
349
|
+
value: function changeSharedPermissions() {
|
|
350
|
+
if (this.props.bank.canEdit()) {
|
|
351
|
+
if (!this.state.sharedWithCourse) {
|
|
352
|
+
var shareBank = {
|
|
353
|
+
entityId: this.props.scope.uuid,
|
|
354
|
+
entityType: this.props.scope.type,
|
|
355
|
+
title: this.props.scope.title,
|
|
356
|
+
permission: READ_ONLY,
|
|
357
|
+
bankId: this.props.bankId
|
|
358
|
+
};
|
|
359
|
+
this.props.removeSharedBank(this.placeholderCourseSharedBankKey());
|
|
360
|
+
this.props.shareBank(shareBank);
|
|
361
|
+
} else {
|
|
362
|
+
this.confirmUnshareBankWithCourse();
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
}, {
|
|
367
|
+
key: "shouldRenderShareWithCourseCheckbox",
|
|
368
|
+
value: function shouldRenderShareWithCourseCheckbox() {
|
|
369
|
+
return this.props.showShareBankFromTray && this.props.scope.type === 'course' && this.props.scope.title && this.props.scope.uuid;
|
|
370
|
+
}
|
|
371
|
+
}, {
|
|
372
|
+
key: "renderCheckbox",
|
|
373
|
+
value: function renderCheckbox() {
|
|
374
|
+
if (!this.shouldRenderShareWithCourseCheckbox()) {
|
|
375
|
+
return null;
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
var label = t('Share with { courseName }', {
|
|
379
|
+
courseName: this.props.scope.title
|
|
380
|
+
});
|
|
381
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
382
|
+
margin: "small 0",
|
|
383
|
+
as: "div"
|
|
384
|
+
}, /*#__PURE__*/React.createElement(Checkbox, {
|
|
385
|
+
checked: this.state.sharedWithCourse,
|
|
386
|
+
label: label,
|
|
387
|
+
onChange: this.toggleCheckbox,
|
|
388
|
+
disabled: this.props.bank.canEdit() ? this.state.shareWithCourseCheckboxDisabled : true
|
|
389
|
+
}));
|
|
390
|
+
}
|
|
220
391
|
}, {
|
|
221
392
|
key: "renderModals",
|
|
222
393
|
value: function renderModals() {
|
|
@@ -292,7 +463,7 @@ export var Bank = (_dec = themeable(theme, styles), _dec(_class = (_temp = _clas
|
|
|
292
463
|
value: function render() {
|
|
293
464
|
return /*#__PURE__*/React.createElement(Page, null, this.renderModals(), this.renderNav(), /*#__PURE__*/React.createElement("div", {
|
|
294
465
|
className: styles.content
|
|
295
|
-
}, this.renderName(), /*#__PURE__*/React.createElement("div", {
|
|
466
|
+
}, this.renderName(), this.renderCheckbox(), /*#__PURE__*/React.createElement("div", {
|
|
296
467
|
className: styles.topMenu
|
|
297
468
|
}, this.renderTopLeftMenu(), this.renderTopRightMenu()), this.renderSearch(), /*#__PURE__*/React.createElement(PaginatedCollection, {
|
|
298
469
|
empty: this.emptyLoadText(),
|
|
@@ -315,6 +486,7 @@ export var Bank = (_dec = themeable(theme, styles), _dec(_class = (_temp = _clas
|
|
|
315
486
|
closeTray: PropTypes.func,
|
|
316
487
|
getBank: PropTypes.func.isRequired,
|
|
317
488
|
getBankEntries: PropTypes.func.isRequired,
|
|
489
|
+
getSharedBank: PropTypes.func.isRequired,
|
|
318
490
|
isCompact: PropTypes.bool,
|
|
319
491
|
isQuizContentLocked: PropTypes.bool.isRequired,
|
|
320
492
|
navigateToBanks: PropTypes.func.isRequired,
|
|
@@ -323,20 +495,26 @@ export var Bank = (_dec = themeable(theme, styles), _dec(_class = (_temp = _clas
|
|
|
323
495
|
// can be from consumer
|
|
324
496
|
navigateToBuild: PropTypes.func,
|
|
325
497
|
// from consumer
|
|
326
|
-
scope: PropTypes.
|
|
498
|
+
scope: PropTypes.shape({
|
|
327
499
|
type: PropTypes.string,
|
|
328
500
|
uuid: PropTypes.string,
|
|
329
501
|
title: PropTypes.string
|
|
330
|
-
})
|
|
502
|
+
}),
|
|
503
|
+
courseSharedBank: ImmutablePropTypes.map,
|
|
331
504
|
returnToUrl: PropTypes.string,
|
|
332
505
|
// from consumer
|
|
333
506
|
onError: PropTypes.func,
|
|
334
507
|
openModal: PropTypes.func.isRequired,
|
|
335
508
|
position: PropTypes.number,
|
|
509
|
+
removeSharedBank: PropTypes.func.isRequired,
|
|
336
510
|
resetSearch: PropTypes.func.isRequired,
|
|
337
511
|
screenreaderNotification: PropTypes.func.isRequired,
|
|
338
512
|
search: ImmutablePropTypes.map.isRequired,
|
|
339
|
-
|
|
513
|
+
shareBank: PropTypes.func.isRequired,
|
|
514
|
+
stimulusId: PropTypes.string,
|
|
515
|
+
showShareBankFromTray: PropTypes.bool,
|
|
516
|
+
updateSharedBankPermission: PropTypes.func.isRequired,
|
|
517
|
+
withConfirm: PropTypes.func.isRequired
|
|
340
518
|
}, _class2.defaultProps = {
|
|
341
519
|
activeQuizId: null,
|
|
342
520
|
addEntryToQuiz: null,
|
|
@@ -350,6 +528,8 @@ export var Bank = (_dec = themeable(theme, styles), _dec(_class = (_temp = _clas
|
|
|
350
528
|
stimulusId: null,
|
|
351
529
|
scope: {},
|
|
352
530
|
returnToUrl: null,
|
|
353
|
-
isQuizContentLocked: false
|
|
531
|
+
isQuizContentLocked: false,
|
|
532
|
+
showShareBankFromTray: false,
|
|
533
|
+
courseSharedBank: null
|
|
354
534
|
}, _temp)) || _class);
|
|
355
535
|
export default Bank;
|
|
@@ -9,6 +9,7 @@ import { BuildingButtons as BuildingButtonsPresenter } from "./presenter.js";
|
|
|
9
9
|
import { getActiveQuiz } from "../../../../../common/selectors/quizzes.js";
|
|
10
10
|
import { featureOn } from "../../../../../common/util/featureCheck.js";
|
|
11
11
|
import { startQuizExportJob } from "../../../../../common/actions/quizExport.js";
|
|
12
|
+
import { addInfo } from "../../../../../common/actions/alerts.js";
|
|
12
13
|
export function mapStateToProps(state) {
|
|
13
14
|
var quiz = getActiveQuiz(state);
|
|
14
15
|
return {
|
|
@@ -25,6 +26,7 @@ export function mapStateToProps(state) {
|
|
|
25
26
|
|
|
26
27
|
var mapDispatchToProps = function mapDispatchToProps(dispatch) {
|
|
27
28
|
return {
|
|
29
|
+
addInfo: bindActionCreators(addInfo, dispatch),
|
|
28
30
|
openBanksTray: bindActionCreators(setUI.bind(void 0, BUILD_TRAY_OPEN, true), dispatch),
|
|
29
31
|
setBanksTrayButtonRef: bindActionCreators(partial(setUI, BUILD_TRAY_BUTTON_REF), dispatch),
|
|
30
32
|
startExport: bindActionCreators(startQuizExportJob, dispatch),
|
|
@@ -41,6 +41,10 @@ export var BuildingButtons = (_dec = themeable(theme, styles), _dec(_class = (_t
|
|
|
41
41
|
|
|
42
42
|
_this = _super.call.apply(_super, [this].concat(args));
|
|
43
43
|
|
|
44
|
+
_this.quizExportAlert = function () {
|
|
45
|
+
_this.props.addInfo(t("The export process has been started. This can take a while for larger quizzes.\n You can leave the page and you'll get notified when the export is completed."));
|
|
46
|
+
};
|
|
47
|
+
|
|
44
48
|
_this.openBanksTray = function () {
|
|
45
49
|
_this.props.setBanksTrayButtonRef(_this.banksTrayButton);
|
|
46
50
|
|
|
@@ -62,6 +66,8 @@ export var BuildingButtons = (_dec = themeable(theme, styles), _dec(_class = (_t
|
|
|
62
66
|
quizzes: [activeQuizId]
|
|
63
67
|
};
|
|
64
68
|
|
|
69
|
+
_this.quizExportAlert();
|
|
70
|
+
|
|
65
71
|
_this.props.contentExport({
|
|
66
72
|
contextUuid: contextUuid,
|
|
67
73
|
exportSettings: exportSettings
|
|
@@ -196,6 +202,7 @@ export var BuildingButtons = (_dec = themeable(theme, styles), _dec(_class = (_t
|
|
|
196
202
|
return BuildingButtons;
|
|
197
203
|
}(Component), _class2.propTypes = {
|
|
198
204
|
app: PropTypes.string,
|
|
205
|
+
addInfo: PropTypes.func,
|
|
199
206
|
activeQuizId: PropTypes.string,
|
|
200
207
|
canExport: PropTypes.bool.isRequired,
|
|
201
208
|
canImport: PropTypes.bool.isRequired,
|
|
@@ -216,6 +223,7 @@ export var BuildingButtons = (_dec = themeable(theme, styles), _dec(_class = (_t
|
|
|
216
223
|
contextUuid: PropTypes.string
|
|
217
224
|
}, _class2.defaultProps = {
|
|
218
225
|
activeQuizId: null,
|
|
226
|
+
addInfo: function addInfo() {},
|
|
219
227
|
app: null,
|
|
220
228
|
contentExportEnabled: false,
|
|
221
229
|
contentExport: null,
|
|
@@ -95,7 +95,8 @@ export var BanksTray = /*#__PURE__*/function (_Component) {
|
|
|
95
95
|
closeTray: this.closeTray,
|
|
96
96
|
bankId: activeBankId,
|
|
97
97
|
navigateToBanks: this.clearActiveBank,
|
|
98
|
-
navigateToBankEntry: this.props.newActiveBankEntry
|
|
98
|
+
navigateToBankEntry: this.props.newActiveBankEntry,
|
|
99
|
+
scope: this.props.itemBanksScope
|
|
99
100
|
});
|
|
100
101
|
}
|
|
101
102
|
} else {
|
|
@@ -14,9 +14,9 @@ export var updateSharedBankPermission = function updateSharedBankPermission(shar
|
|
|
14
14
|
}
|
|
15
15
|
};
|
|
16
16
|
};
|
|
17
|
-
export var removeSharedBank = function removeSharedBank(
|
|
17
|
+
export var removeSharedBank = function removeSharedBank(sharedBankId) {
|
|
18
18
|
return {
|
|
19
19
|
type: REMOVE_SHARED_BANK,
|
|
20
|
-
payload:
|
|
20
|
+
payload: sharedBankId
|
|
21
21
|
};
|
|
22
22
|
};
|
package/es/index.js
CHANGED
|
@@ -10,6 +10,7 @@ export { ReportList } from "./reporting/components/resources/ReportList/index.js
|
|
|
10
10
|
export { ReportCard } from "./reporting/components/resources/ReportCard/index.js";
|
|
11
11
|
export { QuizAndItemAnalysis } from "./reporting/components/resources/QuizAndItemAnalysis/index.js";
|
|
12
12
|
export { NewQuizAndItemAnalysis } from "./reporting/components/resources/NewQuizAndItemAnalysis/index.js";
|
|
13
|
+
export { NewQuizAndItemAnalysisReportCard } from "./reporting/components/resources/NewQuizAndItemAnalysis/ReportCard/index.js";
|
|
13
14
|
export { Legend } from "./reporting/components/charts/Legend/index.js";
|
|
14
15
|
export { ActionButtons } from "./building/components/resources/ActionButtons/index.js";
|
|
15
16
|
export { BuildingButtons } from "./building/components/layout/header/BuildingButtons/index.js";
|
|
@@ -24,7 +24,7 @@ export var Event = /*#__PURE__*/function (_Component) {
|
|
|
24
24
|
|
|
25
25
|
_createClass(Event, [{
|
|
26
26
|
key: "renderResponseEvent",
|
|
27
|
-
//This ugly hack is necessary because the InstUI v7 Table.Body only renders components with name 'Row'.
|
|
27
|
+
// This ugly hack is necessary because the InstUI v7 Table.Body only renders components with name 'Row'.
|
|
28
28
|
value: function renderResponseEvent(event) {
|
|
29
29
|
var item = event.getItem();
|
|
30
30
|
|
|
@@ -135,7 +135,7 @@ AccommodationModal.propTypes = {
|
|
|
135
135
|
onSubmit: PropTypes.func,
|
|
136
136
|
onDismiss: PropTypes.func,
|
|
137
137
|
mountNode: PropTypes.string,
|
|
138
|
-
//this is just to fix chromatic
|
|
138
|
+
// this is just to fix chromatic
|
|
139
139
|
children: PropTypes.oneOfType([PropTypes.node, PropTypes.arrayOf(PropTypes.node)])
|
|
140
140
|
};
|
|
141
141
|
AccommodationModal.defaultProps = {
|
|
@@ -58,10 +58,10 @@ export var ModerateTable = (_dec = themeable(theme, styles), _dec(_class = (_tem
|
|
|
58
58
|
|
|
59
59
|
_this = _super.call.apply(_super, [this].concat(args));
|
|
60
60
|
_this.state = {
|
|
61
|
-
//To support voiceover when the table changes
|
|
61
|
+
// To support voiceover when the table changes
|
|
62
62
|
moderatePanelIterations: 0,
|
|
63
63
|
selectedStudent: null,
|
|
64
|
-
//To display the spinner while manually submitted quiz sessions are being graded
|
|
64
|
+
// To display the spinner while manually submitted quiz sessions are being graded
|
|
65
65
|
isWaiting: false
|
|
66
66
|
};
|
|
67
67
|
|
|
@@ -10,7 +10,7 @@ export function mapStateToProps(state, ownProps) {
|
|
|
10
10
|
quizSessions: quizSessions
|
|
11
11
|
};
|
|
12
12
|
}
|
|
13
|
-
var connectedModerateTableRow = connect(mapStateToProps)(ModerateTableRow); //This ugly hack is necessary because the InstUI v7 Table.Body only renders components with name 'Row'.
|
|
13
|
+
var connectedModerateTableRow = connect(mapStateToProps)(ModerateTableRow); // This ugly hack is necessary because the InstUI v7 Table.Body only renders components with name 'Row'.
|
|
14
14
|
|
|
15
15
|
connectedModerateTableRow.displayName = 'Row';
|
|
16
16
|
export default connectedModerateTableRow;
|
|
@@ -43,6 +43,11 @@ export var QuintileDistribution = (_dec = themeable(theme, styles), _dec(_class
|
|
|
43
43
|
|
|
44
44
|
_this.calculateLabelForIndex = function (d) {
|
|
45
45
|
var numBars = _this.props.visualDistribution.length;
|
|
46
|
+
|
|
47
|
+
if (_this.props.calculateLabelForColumn) {
|
|
48
|
+
return _this.props.calculateLabelForColumn(d, numBars);
|
|
49
|
+
}
|
|
50
|
+
|
|
46
51
|
var lower = Math.floor(d * 100 / numBars);
|
|
47
52
|
var upper = Math.floor((d + 1) * 100 / numBars - (d < numBars - 1 ? 1 : 0));
|
|
48
53
|
return t('{lower, number}-{upper, number}%', {
|
|
@@ -137,7 +142,14 @@ export var QuintileDistribution = (_dec = themeable(theme, styles), _dec(_class
|
|
|
137
142
|
/* *
|
|
138
143
|
* * A list of score values for each bucket. Size of this array determines the number of buckets
|
|
139
144
|
* */
|
|
140
|
-
visualDistribution: PropTypes.arrayOf(PropTypes.node).isRequired
|
|
145
|
+
visualDistribution: PropTypes.arrayOf(PropTypes.node).isRequired,
|
|
146
|
+
|
|
147
|
+
/* *
|
|
148
|
+
* * Callback with column index and columns quantity as arguments.
|
|
149
|
+
* * Should return string which will be label for chart column.
|
|
150
|
+
* * If undefined uses default column label calculation
|
|
151
|
+
* */
|
|
152
|
+
calculateLabelForColumn: PropTypes.func
|
|
141
153
|
}, _class2.defaultProps = {
|
|
142
154
|
animateDelay: 200,
|
|
143
155
|
animateDuration: 900,
|
|
@@ -148,6 +160,7 @@ export var QuintileDistribution = (_dec = themeable(theme, styles), _dec(_class
|
|
|
148
160
|
// Height in pixels
|
|
149
161
|
chartWidth: void 0,
|
|
150
162
|
summaryDistribution: void 0,
|
|
151
|
-
visualDistribution: []
|
|
163
|
+
visualDistribution: [],
|
|
164
|
+
calculateLabelForColumn: null
|
|
152
165
|
}, _temp)) || _class);
|
|
153
166
|
export default QuintileDistribution;
|