@instructure/quiz-core 20.18.0 → 20.18.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/bankEntries.js +48 -1
- package/es/banks/components/AddToBankModal/index.js +2 -1
- package/es/banks/components/AddToBankModal/presenter.js +13 -2
- package/es/banks/components/CopyMoveBankEntryModal/index.js +3 -1
- package/es/banks/components/CopyMoveBankEntryModal/presenter.js +26 -7
- package/es/building/components/resources/quizEntry/QuizEntryEdit/presenter.js +1 -0
- package/es/common/components/resources/stimulus/StimulusEdit/presenter.js +1 -0
- package/lib/banks/api/bankEntries.js +60 -1
- package/lib/banks/components/AddToBankModal/index.js +1 -0
- package/lib/banks/components/AddToBankModal/presenter.js +14 -2
- package/lib/banks/components/CopyMoveBankEntryModal/index.js +2 -0
- package/lib/banks/components/CopyMoveBankEntryModal/presenter.js +27 -7
- package/lib/building/components/resources/quizEntry/QuizEntryEdit/presenter.js +1 -0
- package/lib/common/components/resources/stimulus/StimulusEdit/presenter.js +1 -0
- package/package.json +10 -10
|
@@ -9,7 +9,7 @@ import { archiveBankEntry } from "../../common/actions/bankEntries.js";
|
|
|
9
9
|
import { getBank } from "./banks.js";
|
|
10
10
|
import { handleError } from "../../common/api/helpers.js";
|
|
11
11
|
import get from 'lodash/get';
|
|
12
|
-
import { BANKS_BANK_ENTRY_PAGINATION, GET_BANK_ENTRIES_CALL, GET_BANK_ENTRY_CALL, UPDATE_BANK_ENTRY_CALL, CREATE_BANK_ENTRY_CALL, REMOVE_BANK_ENTRY_CALL } from '@instructure/quiz-common';
|
|
12
|
+
import { BANKS_BANK_ENTRY_PAGINATION, GET_BANK_ENTRIES_CALL, GET_BANK_ENTRY_CALL, UPDATE_BANK_ENTRY_CALL, CREATE_BANK_ENTRY_CALL, COPY_BANK_ENTRY_CALL, REMOVE_BANK_ENTRY_CALL } from '@instructure/quiz-common';
|
|
13
13
|
import t from '@instructure/quiz-i18n/es/format-message';
|
|
14
14
|
export var getBankEntries = function getBankEntries(bankId, useBankSearch) {
|
|
15
15
|
var params = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
|
|
@@ -98,6 +98,53 @@ export var createEntryAndBankEntry = function createEntryAndBankEntry(bankId, en
|
|
|
98
98
|
});
|
|
99
99
|
};
|
|
100
100
|
};
|
|
101
|
+
export var moveBankEntryFromQuizEntry = function moveBankEntryFromQuizEntry(sourceQuizId, sourceEntryId, sourceEntryType, destinationBankId) {
|
|
102
|
+
var body = {
|
|
103
|
+
source_entry_id: sourceEntryId,
|
|
104
|
+
source_entry_type: sourceEntryType
|
|
105
|
+
};
|
|
106
|
+
var query_params = {
|
|
107
|
+
source_quiz_id: sourceQuizId
|
|
108
|
+
};
|
|
109
|
+
return copyOrMoveBankEntry(body, destinationBankId, 'move_from_quiz_entry', query_params);
|
|
110
|
+
};
|
|
111
|
+
export var copyBankEntry = function copyBankEntry(sourceBankId, bankEntryId, destinationBankId) {
|
|
112
|
+
var body = {
|
|
113
|
+
source_bank_id: sourceBankId,
|
|
114
|
+
source_bank_entry_id: bankEntryId
|
|
115
|
+
};
|
|
116
|
+
var followUpActions = [clear("".concat(BANKS_BANK_ENTRY_PAGINATION, ":").concat(destinationBankId))];
|
|
117
|
+
return copyOrMoveBankEntry(body, destinationBankId, 'copy', null, followUpActions);
|
|
118
|
+
};
|
|
119
|
+
export var moveBankEntry = function moveBankEntry(sourceBankId, bankEntryId, destinationBankId) {
|
|
120
|
+
var body = {
|
|
121
|
+
source_bank_id: sourceBankId,
|
|
122
|
+
source_bank_entry_id: bankEntryId
|
|
123
|
+
};
|
|
124
|
+
var followUpActions = [clear("".concat(BANKS_BANK_ENTRY_PAGINATION, ":").concat(destinationBankId)), clear("".concat(BANKS_BANK_ENTRY_PAGINATION, ":").concat(sourceBankId)), getBank(sourceBankId)];
|
|
125
|
+
return copyOrMoveBankEntry(body, destinationBankId, 'move', null, followUpActions);
|
|
126
|
+
};
|
|
127
|
+
export var copyOrMoveBankEntry = function copyOrMoveBankEntry(body, destinationBankId, operation, query_params) {
|
|
128
|
+
var followUpActions = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : [];
|
|
129
|
+
var url = "/api/banks/".concat(destinationBankId, "/bank_entries/").concat(operation);
|
|
130
|
+
return function (dispatch, getState) {
|
|
131
|
+
var fetcher = new Fetcher({
|
|
132
|
+
callType: COPY_BANK_ENTRY_CALL,
|
|
133
|
+
onError: handleError(dispatch, t('Failed to copy bank entry.'))
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
if (query_params) {
|
|
137
|
+
url = fetcher.appendQueryParams(url, query_params);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
return fetcher.post(url, {
|
|
141
|
+
body: JSON.stringify(body)
|
|
142
|
+
}).then(function (response) {
|
|
143
|
+
dispatch([handleBankEntryResponse(response), associateEntries(destinationBankId, [response.id]), getBank(destinationBankId)].concat(_toConsumableArray(followUpActions)));
|
|
144
|
+
return response;
|
|
145
|
+
});
|
|
146
|
+
};
|
|
147
|
+
};
|
|
101
148
|
export var createBankEntry = function createBankEntry(bankId, entryType, entryId) {
|
|
102
149
|
var url = "/api/banks/".concat(bankId, "/bank_entries");
|
|
103
150
|
return function (dispatch, getState) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { connect } from "../../../common/react-redux.js";
|
|
2
2
|
import { createBank } from "../../api/banks.js";
|
|
3
|
-
import { createBankEntry } from "../../api/bankEntries.js";
|
|
3
|
+
import { createBankEntry, moveBankEntryFromQuizEntry } from "../../api/bankEntries.js";
|
|
4
4
|
import { checkItemShareability } from "../../../building/api/items.js";
|
|
5
5
|
import { checkStimulusShareability } from "../../../building/api/stimuli.js";
|
|
6
6
|
import AddToBankModal from "./presenter.js";
|
|
@@ -27,6 +27,7 @@ var mapDispatchToProps = {
|
|
|
27
27
|
closeModal: modalActions.closeModal,
|
|
28
28
|
createBank: createBank,
|
|
29
29
|
createBankEntry: createBankEntry,
|
|
30
|
+
moveBankEntryFromQuizEntry: moveBankEntryFromQuizEntry,
|
|
30
31
|
disassociateBankEntry: disassociateEntry,
|
|
31
32
|
uiSet: uiActions.set
|
|
32
33
|
};
|
|
@@ -21,6 +21,7 @@ import { View } from '@instructure/ui-view';
|
|
|
21
21
|
import { Flex } from '@instructure/ui-flex';
|
|
22
22
|
import t from '@instructure/quiz-i18n/es/format-message';
|
|
23
23
|
import { Modal, ModalHeader, ModalBody, ModalFooter, ADD_TO_BANK_MODAL_BANK_SELECTION, XSMALL_SIDE_MARGIN } from '@instructure/quiz-common';
|
|
24
|
+
import { featureOn } from "../../../common/util/featureCheck.js";
|
|
24
25
|
|
|
25
26
|
var _ref2 = /*#__PURE__*/React.createElement(IconCheckLine, {
|
|
26
27
|
color: "success"
|
|
@@ -60,9 +61,17 @@ export var AddToBankModal = /*#__PURE__*/function (_Component) {
|
|
|
60
61
|
newBankTitle: ''
|
|
61
62
|
};
|
|
62
63
|
|
|
64
|
+
_this.copyBankEntry = function (entryId, bankId) {
|
|
65
|
+
if (featureOn('instfs_bank_entry_movement_endpoints')) {
|
|
66
|
+
return _this.props.moveBankEntryFromQuizEntry(_this.props.quizId, entryId, _this.props.entryType, bankId);
|
|
67
|
+
} else {
|
|
68
|
+
return _this.props.createBankEntry(bankId, _this.props.entryType, entryId);
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
|
|
63
72
|
_this.addToBank = function (bankId) {
|
|
64
73
|
_this.props.getEntry().then(function (entry) {
|
|
65
|
-
return _this.
|
|
74
|
+
return _this.copyBankEntry(entry.id, bankId);
|
|
66
75
|
}).then(_this.props.onAdd).catch(function (e) {
|
|
67
76
|
if (e.validationErrorsFromApi) {
|
|
68
77
|
// Close the modal so the user can view the input validation errors and correct them
|
|
@@ -301,6 +310,7 @@ AddToBankModal.propTypes = {
|
|
|
301
310
|
checkContentShareability: PropTypes.func.isRequired,
|
|
302
311
|
closeModal: PropTypes.func.isRequired,
|
|
303
312
|
createBank: PropTypes.func.isRequired,
|
|
313
|
+
moveBankEntryFromQuizEntry: PropTypes.func.isRequired,
|
|
304
314
|
createBankEntry: PropTypes.func.isRequired,
|
|
305
315
|
// Create the bank entry's entry, or clone it if it already exists. Should
|
|
306
316
|
// always be provided when a source is provided.
|
|
@@ -318,7 +328,8 @@ AddToBankModal.propTypes = {
|
|
|
318
328
|
onContinue: PropTypes.func,
|
|
319
329
|
selectedBank: ImmutablePropTypes.record,
|
|
320
330
|
uiSet: PropTypes.func.isRequired,
|
|
321
|
-
workingEntry: ImmutablePropTypes.record.isRequired
|
|
331
|
+
workingEntry: ImmutablePropTypes.record.isRequired,
|
|
332
|
+
quizId: PropTypes.string.isRequired
|
|
322
333
|
};
|
|
323
334
|
AddToBankModal.defaultProps = {
|
|
324
335
|
canvasOrigin: '',
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { connect } from "../../../common/react-redux.js";
|
|
2
2
|
import { createBank } from "../../api/banks.js";
|
|
3
|
-
import { createBankEntry, updateBankEntry } from "../../api/bankEntries.js";
|
|
3
|
+
import { createBankEntry, updateBankEntry, moveBankEntry, copyBankEntry } from "../../api/bankEntries.js";
|
|
4
4
|
import CopyMoveBankModal from "./presenter.js";
|
|
5
5
|
import * as modalActions from "../../../common/actions/modal.js";
|
|
6
6
|
import { disassociateEntry } from "../../../common/actions/banks.js";
|
|
@@ -22,8 +22,10 @@ export function mapStateToProps(state, props) {
|
|
|
22
22
|
var mapDispatchToProps = {
|
|
23
23
|
closeModal: modalActions.closeModal,
|
|
24
24
|
createBank: createBank,
|
|
25
|
+
copyBankEntry: copyBankEntry,
|
|
25
26
|
createBankEntry: createBankEntry,
|
|
26
27
|
updateBankEntry: updateBankEntry,
|
|
28
|
+
moveBankEntry: moveBankEntry,
|
|
27
29
|
disassociateBankEntry: disassociateEntry,
|
|
28
30
|
uiSet: uiActions.set
|
|
29
31
|
};
|
|
@@ -15,6 +15,7 @@ import t from '@instructure/quiz-i18n/es/format-message';
|
|
|
15
15
|
import Bank from "../../../common/records/Bank.js";
|
|
16
16
|
import BankSelection from "../../../common/components/resources/BankSelection/index.js";
|
|
17
17
|
import { Modal, ModalHeader, ModalBody, ModalFooter, COPY_MOVE_BANK_ENTRY_MODAL_BANK_SELECTION, COPY_MOVE_BANK_ENTRY_MODAL_KEEP_COPY, XSMALL_SIDE_MARGIN } from '@instructure/quiz-common';
|
|
18
|
+
import { featureOn } from "../../../common/util/featureCheck.js";
|
|
18
19
|
|
|
19
20
|
var _ref = /*#__PURE__*/React.createElement("br", null);
|
|
20
21
|
|
|
@@ -65,20 +66,36 @@ export var CopyMoveBankEntryModal = /*#__PURE__*/function (_Component) {
|
|
|
65
66
|
}
|
|
66
67
|
};
|
|
67
68
|
|
|
69
|
+
_this.initiateMove = function (newBankId) {
|
|
70
|
+
if (featureOn('instfs_bank_entry_movement_endpoints')) {
|
|
71
|
+
return _this.props.moveBankEntry(_this.props.sourceBankId, _this.props.sourceBankEntryId, newBankId);
|
|
72
|
+
} else {
|
|
73
|
+
return _this.props.updateBankEntry(_this.props.sourceBankId, _this.props.sourceBankEntryId, {
|
|
74
|
+
bankId: newBankId
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
|
|
68
79
|
_this.moveBankEntry = function (newBankId) {
|
|
69
|
-
return _this.
|
|
70
|
-
bankId: newBankId
|
|
71
|
-
}).then(function (bankEntry) {
|
|
80
|
+
return _this.initiateMove(newBankId).then(function (bankEntry) {
|
|
72
81
|
_this.props.disassociateBankEntry(_this.props.sourceBankId, _this.props.sourceBankEntryId);
|
|
73
82
|
|
|
74
83
|
return bankEntry;
|
|
75
84
|
}).then(_this.props.onAdd);
|
|
76
85
|
};
|
|
77
86
|
|
|
87
|
+
_this.initiateCopy = function (newBankId) {
|
|
88
|
+
if (featureOn('instfs_bank_entry_movement_endpoints')) {
|
|
89
|
+
return _this.props.copyBankEntry(_this.props.sourceBankId, _this.props.sourceBankEntryId, newBankId);
|
|
90
|
+
} else {
|
|
91
|
+
return _this.props.createEntry().then(function (entry) {
|
|
92
|
+
return _this.props.createBankEntry(newBankId, _this.props.entryType, entry.id);
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
|
|
78
97
|
_this.copyBankEntry = function (newBankId) {
|
|
79
|
-
return _this.
|
|
80
|
-
return _this.props.createBankEntry(newBankId, _this.props.entryType, entry.id);
|
|
81
|
-
}).then(_this.props.onAdd);
|
|
98
|
+
return _this.initiateCopy(newBankId).then(_this.props.onAdd);
|
|
82
99
|
};
|
|
83
100
|
|
|
84
101
|
_this.closeAction = function () {
|
|
@@ -202,6 +219,7 @@ export var CopyMoveBankEntryModal = /*#__PURE__*/function (_Component) {
|
|
|
202
219
|
CopyMoveBankEntryModal.propTypes = {
|
|
203
220
|
closeModal: PropTypes.func.isRequired,
|
|
204
221
|
createBank: PropTypes.func.isRequired,
|
|
222
|
+
copyBankEntry: PropTypes.func.isRequired,
|
|
205
223
|
createBankEntry: PropTypes.func.isRequired,
|
|
206
224
|
// Create the bank entry's entry, or clone it if it already exists. Should
|
|
207
225
|
// always be provided when a source is provided.
|
|
@@ -221,7 +239,8 @@ CopyMoveBankEntryModal.propTypes = {
|
|
|
221
239
|
sourceBankEntryId: PropTypes.string.isRequired,
|
|
222
240
|
sourceBankId: PropTypes.string.isRequired,
|
|
223
241
|
uiSet: PropTypes.func.isRequired,
|
|
224
|
-
updateBankEntry: PropTypes.func.isRequired
|
|
242
|
+
updateBankEntry: PropTypes.func.isRequired,
|
|
243
|
+
moveBankEntry: PropTypes.func.isRequired
|
|
225
244
|
};
|
|
226
245
|
CopyMoveBankEntryModal.contextTypes = {
|
|
227
246
|
locale: PropTypes.string
|
|
@@ -394,6 +394,7 @@ var QuizEntryEdit = (_dec = withStyle(generateStyle, generateComponentTheme), _d
|
|
|
394
394
|
workingEntry: this.props.workingEntry,
|
|
395
395
|
entryId: this.props.guid,
|
|
396
396
|
entryType: this.props.quizEntry.entryType,
|
|
397
|
+
quizId: this.props.quizId,
|
|
397
398
|
handleValidationErrorsFromApi: this.props.handleValidationErrorsFromApi
|
|
398
399
|
});
|
|
399
400
|
}
|
|
@@ -382,6 +382,7 @@ export var StimulusEdit = (_dec = withStyle(generateStyle, generateComponentThem
|
|
|
382
382
|
onContinue: this.handleAddToBankContinue,
|
|
383
383
|
getEntry: this.getEntryForBank,
|
|
384
384
|
workingEntry: this.props.workingStimulus,
|
|
385
|
+
quizId: this.props.quizId,
|
|
385
386
|
entryId: this.props.guid,
|
|
386
387
|
entryType: this.props.quizEntry.entryType
|
|
387
388
|
});
|
|
@@ -5,7 +5,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.removeBankEntry = exports.updateBankEntry = exports.createBankEntry = exports.createEntryAndBankEntry = exports.cloneBankEntry = exports.getBankEntry = exports.getBankEntries = void 0;
|
|
8
|
+
exports.removeBankEntry = exports.updateBankEntry = exports.createBankEntry = exports.copyOrMoveBankEntry = exports.moveBankEntry = exports.copyBankEntry = exports.moveBankEntryFromQuizEntry = exports.createEntryAndBankEntry = exports.cloneBankEntry = exports.getBankEntry = exports.getBankEntries = void 0;
|
|
9
9
|
|
|
10
10
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
11
11
|
|
|
@@ -132,6 +132,65 @@ var createEntryAndBankEntry = function createEntryAndBankEntry(bankId, entry, ba
|
|
|
132
132
|
|
|
133
133
|
exports.createEntryAndBankEntry = createEntryAndBankEntry;
|
|
134
134
|
|
|
135
|
+
var moveBankEntryFromQuizEntry = function moveBankEntryFromQuizEntry(sourceQuizId, sourceEntryId, sourceEntryType, destinationBankId) {
|
|
136
|
+
var body = {
|
|
137
|
+
source_entry_id: sourceEntryId,
|
|
138
|
+
source_entry_type: sourceEntryType
|
|
139
|
+
};
|
|
140
|
+
var query_params = {
|
|
141
|
+
source_quiz_id: sourceQuizId
|
|
142
|
+
};
|
|
143
|
+
return copyOrMoveBankEntry(body, destinationBankId, 'move_from_quiz_entry', query_params);
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
exports.moveBankEntryFromQuizEntry = moveBankEntryFromQuizEntry;
|
|
147
|
+
|
|
148
|
+
var copyBankEntry = function copyBankEntry(sourceBankId, bankEntryId, destinationBankId) {
|
|
149
|
+
var body = {
|
|
150
|
+
source_bank_id: sourceBankId,
|
|
151
|
+
source_bank_entry_id: bankEntryId
|
|
152
|
+
};
|
|
153
|
+
var followUpActions = [(0, _ui.clear)("".concat(_quizCommon.BANKS_BANK_ENTRY_PAGINATION, ":").concat(destinationBankId))];
|
|
154
|
+
return copyOrMoveBankEntry(body, destinationBankId, 'copy', null, followUpActions);
|
|
155
|
+
};
|
|
156
|
+
|
|
157
|
+
exports.copyBankEntry = copyBankEntry;
|
|
158
|
+
|
|
159
|
+
var moveBankEntry = function moveBankEntry(sourceBankId, bankEntryId, destinationBankId) {
|
|
160
|
+
var body = {
|
|
161
|
+
source_bank_id: sourceBankId,
|
|
162
|
+
source_bank_entry_id: bankEntryId
|
|
163
|
+
};
|
|
164
|
+
var followUpActions = [(0, _ui.clear)("".concat(_quizCommon.BANKS_BANK_ENTRY_PAGINATION, ":").concat(destinationBankId)), (0, _ui.clear)("".concat(_quizCommon.BANKS_BANK_ENTRY_PAGINATION, ":").concat(sourceBankId)), (0, _banks2.getBank)(sourceBankId)];
|
|
165
|
+
return copyOrMoveBankEntry(body, destinationBankId, 'move', null, followUpActions);
|
|
166
|
+
};
|
|
167
|
+
|
|
168
|
+
exports.moveBankEntry = moveBankEntry;
|
|
169
|
+
|
|
170
|
+
var copyOrMoveBankEntry = function copyOrMoveBankEntry(body, destinationBankId, operation, query_params) {
|
|
171
|
+
var followUpActions = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : [];
|
|
172
|
+
var url = "/api/banks/".concat(destinationBankId, "/bank_entries/").concat(operation);
|
|
173
|
+
return function (dispatch, getState) {
|
|
174
|
+
var fetcher = new _Fetcher.default({
|
|
175
|
+
callType: _quizCommon.COPY_BANK_ENTRY_CALL,
|
|
176
|
+
onError: (0, _helpers.handleError)(dispatch, (0, _formatMessage.default)('Failed to copy bank entry.'))
|
|
177
|
+
});
|
|
178
|
+
|
|
179
|
+
if (query_params) {
|
|
180
|
+
url = fetcher.appendQueryParams(url, query_params);
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
return fetcher.post(url, {
|
|
184
|
+
body: JSON.stringify(body)
|
|
185
|
+
}).then(function (response) {
|
|
186
|
+
dispatch([(0, _callHandlers.handleBankEntryResponse)(response), (0, _banks.associateEntries)(destinationBankId, [response.id]), (0, _banks2.getBank)(destinationBankId)].concat((0, _toConsumableArray2.default)(followUpActions)));
|
|
187
|
+
return response;
|
|
188
|
+
});
|
|
189
|
+
};
|
|
190
|
+
};
|
|
191
|
+
|
|
192
|
+
exports.copyOrMoveBankEntry = copyOrMoveBankEntry;
|
|
193
|
+
|
|
135
194
|
var createBankEntry = function createBankEntry(bankId, entryType, entryId) {
|
|
136
195
|
var url = "/api/banks/".concat(bankId, "/bank_entries");
|
|
137
196
|
return function (dispatch, getState) {
|
|
@@ -53,6 +53,7 @@ var mapDispatchToProps = {
|
|
|
53
53
|
closeModal: modalActions.closeModal,
|
|
54
54
|
createBank: _banks.createBank,
|
|
55
55
|
createBankEntry: _bankEntries.createBankEntry,
|
|
56
|
+
moveBankEntryFromQuizEntry: _bankEntries.moveBankEntryFromQuizEntry,
|
|
56
57
|
disassociateBankEntry: _banks2.disassociateEntry,
|
|
57
58
|
uiSet: uiActions.set
|
|
58
59
|
};
|
|
@@ -55,6 +55,8 @@ var _formatMessage = _interopRequireDefault(require("@instructure/quiz-i18n/es/f
|
|
|
55
55
|
|
|
56
56
|
var _quizCommon = require("@instructure/quiz-common");
|
|
57
57
|
|
|
58
|
+
var _featureCheck = require("../../../common/util/featureCheck.js");
|
|
59
|
+
|
|
58
60
|
var _ref2 = /*#__PURE__*/_react.default.createElement(_uiIcons.IconCheckLine, {
|
|
59
61
|
color: "success"
|
|
60
62
|
});
|
|
@@ -93,9 +95,17 @@ var AddToBankModal = /*#__PURE__*/function (_Component) {
|
|
|
93
95
|
newBankTitle: ''
|
|
94
96
|
};
|
|
95
97
|
|
|
98
|
+
_this.copyBankEntry = function (entryId, bankId) {
|
|
99
|
+
if ((0, _featureCheck.featureOn)('instfs_bank_entry_movement_endpoints')) {
|
|
100
|
+
return _this.props.moveBankEntryFromQuizEntry(_this.props.quizId, entryId, _this.props.entryType, bankId);
|
|
101
|
+
} else {
|
|
102
|
+
return _this.props.createBankEntry(bankId, _this.props.entryType, entryId);
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
|
|
96
106
|
_this.addToBank = function (bankId) {
|
|
97
107
|
_this.props.getEntry().then(function (entry) {
|
|
98
|
-
return _this.
|
|
108
|
+
return _this.copyBankEntry(entry.id, bankId);
|
|
99
109
|
}).then(_this.props.onAdd).catch(function (e) {
|
|
100
110
|
if (e.validationErrorsFromApi) {
|
|
101
111
|
// Close the modal so the user can view the input validation errors and correct them
|
|
@@ -335,6 +345,7 @@ AddToBankModal.propTypes = {
|
|
|
335
345
|
checkContentShareability: _propTypes.default.func.isRequired,
|
|
336
346
|
closeModal: _propTypes.default.func.isRequired,
|
|
337
347
|
createBank: _propTypes.default.func.isRequired,
|
|
348
|
+
moveBankEntryFromQuizEntry: _propTypes.default.func.isRequired,
|
|
338
349
|
createBankEntry: _propTypes.default.func.isRequired,
|
|
339
350
|
// Create the bank entry's entry, or clone it if it already exists. Should
|
|
340
351
|
// always be provided when a source is provided.
|
|
@@ -352,7 +363,8 @@ AddToBankModal.propTypes = {
|
|
|
352
363
|
onContinue: _propTypes.default.func,
|
|
353
364
|
selectedBank: _reactImmutableProptypes.default.record,
|
|
354
365
|
uiSet: _propTypes.default.func.isRequired,
|
|
355
|
-
workingEntry: _reactImmutableProptypes.default.record.isRequired
|
|
366
|
+
workingEntry: _reactImmutableProptypes.default.record.isRequired,
|
|
367
|
+
quizId: _propTypes.default.string.isRequired
|
|
356
368
|
};
|
|
357
369
|
AddToBankModal.defaultProps = {
|
|
358
370
|
canvasOrigin: '',
|
|
@@ -45,8 +45,10 @@ function mapStateToProps(state, props) {
|
|
|
45
45
|
var mapDispatchToProps = {
|
|
46
46
|
closeModal: modalActions.closeModal,
|
|
47
47
|
createBank: _banks.createBank,
|
|
48
|
+
copyBankEntry: _bankEntries.copyBankEntry,
|
|
48
49
|
createBankEntry: _bankEntries.createBankEntry,
|
|
49
50
|
updateBankEntry: _bankEntries.updateBankEntry,
|
|
51
|
+
moveBankEntry: _bankEntries.moveBankEntry,
|
|
50
52
|
disassociateBankEntry: _banks2.disassociateEntry,
|
|
51
53
|
uiSet: uiActions.set
|
|
52
54
|
};
|
|
@@ -43,6 +43,8 @@ var _index = _interopRequireDefault(require("../../../common/components/resource
|
|
|
43
43
|
|
|
44
44
|
var _quizCommon = require("@instructure/quiz-common");
|
|
45
45
|
|
|
46
|
+
var _featureCheck = require("../../../common/util/featureCheck.js");
|
|
47
|
+
|
|
46
48
|
var _ref = /*#__PURE__*/_react.default.createElement("br", null);
|
|
47
49
|
|
|
48
50
|
var _ref2 = /*#__PURE__*/_react.default.createElement("br", null);
|
|
@@ -92,20 +94,36 @@ var CopyMoveBankEntryModal = /*#__PURE__*/function (_Component) {
|
|
|
92
94
|
}
|
|
93
95
|
};
|
|
94
96
|
|
|
97
|
+
_this.initiateMove = function (newBankId) {
|
|
98
|
+
if ((0, _featureCheck.featureOn)('instfs_bank_entry_movement_endpoints')) {
|
|
99
|
+
return _this.props.moveBankEntry(_this.props.sourceBankId, _this.props.sourceBankEntryId, newBankId);
|
|
100
|
+
} else {
|
|
101
|
+
return _this.props.updateBankEntry(_this.props.sourceBankId, _this.props.sourceBankEntryId, {
|
|
102
|
+
bankId: newBankId
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
|
|
95
107
|
_this.moveBankEntry = function (newBankId) {
|
|
96
|
-
return _this.
|
|
97
|
-
bankId: newBankId
|
|
98
|
-
}).then(function (bankEntry) {
|
|
108
|
+
return _this.initiateMove(newBankId).then(function (bankEntry) {
|
|
99
109
|
_this.props.disassociateBankEntry(_this.props.sourceBankId, _this.props.sourceBankEntryId);
|
|
100
110
|
|
|
101
111
|
return bankEntry;
|
|
102
112
|
}).then(_this.props.onAdd);
|
|
103
113
|
};
|
|
104
114
|
|
|
115
|
+
_this.initiateCopy = function (newBankId) {
|
|
116
|
+
if ((0, _featureCheck.featureOn)('instfs_bank_entry_movement_endpoints')) {
|
|
117
|
+
return _this.props.copyBankEntry(_this.props.sourceBankId, _this.props.sourceBankEntryId, newBankId);
|
|
118
|
+
} else {
|
|
119
|
+
return _this.props.createEntry().then(function (entry) {
|
|
120
|
+
return _this.props.createBankEntry(newBankId, _this.props.entryType, entry.id);
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
|
|
105
125
|
_this.copyBankEntry = function (newBankId) {
|
|
106
|
-
return _this.
|
|
107
|
-
return _this.props.createBankEntry(newBankId, _this.props.entryType, entry.id);
|
|
108
|
-
}).then(_this.props.onAdd);
|
|
126
|
+
return _this.initiateCopy(newBankId).then(_this.props.onAdd);
|
|
109
127
|
};
|
|
110
128
|
|
|
111
129
|
_this.closeAction = function () {
|
|
@@ -230,6 +248,7 @@ exports.CopyMoveBankEntryModal = CopyMoveBankEntryModal;
|
|
|
230
248
|
CopyMoveBankEntryModal.propTypes = {
|
|
231
249
|
closeModal: _propTypes.default.func.isRequired,
|
|
232
250
|
createBank: _propTypes.default.func.isRequired,
|
|
251
|
+
copyBankEntry: _propTypes.default.func.isRequired,
|
|
233
252
|
createBankEntry: _propTypes.default.func.isRequired,
|
|
234
253
|
// Create the bank entry's entry, or clone it if it already exists. Should
|
|
235
254
|
// always be provided when a source is provided.
|
|
@@ -249,7 +268,8 @@ CopyMoveBankEntryModal.propTypes = {
|
|
|
249
268
|
sourceBankEntryId: _propTypes.default.string.isRequired,
|
|
250
269
|
sourceBankId: _propTypes.default.string.isRequired,
|
|
251
270
|
uiSet: _propTypes.default.func.isRequired,
|
|
252
|
-
updateBankEntry: _propTypes.default.func.isRequired
|
|
271
|
+
updateBankEntry: _propTypes.default.func.isRequired,
|
|
272
|
+
moveBankEntry: _propTypes.default.func.isRequired
|
|
253
273
|
};
|
|
254
274
|
CopyMoveBankEntryModal.contextTypes = {
|
|
255
275
|
locale: _propTypes.default.string
|
|
@@ -426,6 +426,7 @@ var QuizEntryEdit = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.defa
|
|
|
426
426
|
workingEntry: this.props.workingEntry,
|
|
427
427
|
entryId: this.props.guid,
|
|
428
428
|
entryType: this.props.quizEntry.entryType,
|
|
429
|
+
quizId: this.props.quizId,
|
|
429
430
|
handleValidationErrorsFromApi: this.props.handleValidationErrorsFromApi
|
|
430
431
|
});
|
|
431
432
|
}
|
|
@@ -419,6 +419,7 @@ var StimulusEdit = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.defau
|
|
|
419
419
|
onContinue: this.handleAddToBankContinue,
|
|
420
420
|
getEntry: this.getEntryForBank,
|
|
421
421
|
workingEntry: this.props.workingStimulus,
|
|
422
|
+
quizId: this.props.quizId,
|
|
422
423
|
entryId: this.props.guid,
|
|
423
424
|
entryType: this.props.quizEntry.entryType
|
|
424
425
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instructure/quiz-core",
|
|
3
|
-
"version": "20.18.
|
|
3
|
+
"version": "20.18.1-rc.1+70dd69c4d",
|
|
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.2.2",
|
|
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.18.1-rc.1+70dd69c4d",
|
|
48
|
+
"@instructure/quiz-i18n": "20.18.1-rc.1+70dd69c4d",
|
|
49
|
+
"@instructure/quiz-interactions": "20.18.1-rc.1+70dd69c4d",
|
|
50
|
+
"@instructure/quiz-number-input": "20.18.1-rc.1+70dd69c4d",
|
|
51
|
+
"@instructure/quiz-rce": "20.18.1-rc.1+70dd69c4d",
|
|
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",
|
|
@@ -111,7 +111,7 @@
|
|
|
111
111
|
"file-saver": "~2.0.5",
|
|
112
112
|
"humps": "^2.0.0",
|
|
113
113
|
"immutable": "^3.8.1",
|
|
114
|
-
"instructure-validations": "
|
|
114
|
+
"instructure-validations": "20.18.1-rc.1+70dd69c4d",
|
|
115
115
|
"ipaddr.js": "^1.5.4",
|
|
116
116
|
"isomorphic-fetch": "^2.2.0",
|
|
117
117
|
"isuuid": "^0.1.0",
|
|
@@ -142,7 +142,7 @@
|
|
|
142
142
|
"uuid": "^3.2.1"
|
|
143
143
|
},
|
|
144
144
|
"devDependencies": {
|
|
145
|
-
"@instructure/quiz-scripts": "
|
|
145
|
+
"@instructure/quiz-scripts": "20.18.0",
|
|
146
146
|
"@instructure/ui-axe-check": "^8.51.0",
|
|
147
147
|
"@instructure/ui-babel-preset": "^7.22.1",
|
|
148
148
|
"@instructure/ui-scripts": "^7.22.1",
|
|
@@ -161,7 +161,7 @@
|
|
|
161
161
|
"jquery": "^2.2.3",
|
|
162
162
|
"karma-junit-reporter": "^2.0.1",
|
|
163
163
|
"most-subject": "^5.3.0",
|
|
164
|
-
"quiz-presets": "
|
|
164
|
+
"quiz-presets": "20.18.1-rc.1+70dd69c4d",
|
|
165
165
|
"react": "^16.8.6",
|
|
166
166
|
"react-addons-test-utils": "^15.6.2",
|
|
167
167
|
"react-dom": "^16.8.6",
|
|
@@ -177,5 +177,5 @@
|
|
|
177
177
|
"publishConfig": {
|
|
178
178
|
"access": "public"
|
|
179
179
|
},
|
|
180
|
-
"gitHead": "
|
|
180
|
+
"gitHead": "70dd69c4d96b54c29d5adb229c7d6b7dad4f602c"
|
|
181
181
|
}
|