@instructure/quiz-core 17.54.2-rc.7 → 17.55.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +17 -0
- package/es/banks/api/banks.js +6 -3
- package/es/banks/components/BanksList/presenter.js +17 -0
- package/es/banks/components/SharingModal/ShareList/index.js +23 -12
- package/es/banks/components/SharingModal/asyncSearch.js +17 -10
- package/es/banks/components/SharingModal/index.js +4 -1
- package/es/banks/components/SharingModal/presenter.js +211 -106
- package/lib/banks/api/banks.js +6 -3
- package/lib/banks/components/BanksList/presenter.js +17 -0
- package/lib/banks/components/SharingModal/ShareList/index.js +23 -12
- package/lib/banks/components/SharingModal/asyncSearch.js +17 -10
- package/lib/banks/components/SharingModal/index.js +5 -1
- package/lib/banks/components/SharingModal/presenter.js +214 -106
- package/package.json +10 -10
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,23 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [17.55.0](https://gerrit.instructure.com/quizzes-ui/compare/v17.54.1...v17.55.0) (2023-05-31)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **Banks:** hide tray close button on manage banks page ([a5030d7](https://gerrit.instructure.com/quizzes-ui/commits/a5030d786b6a0663caf283879009227ac8cf6012))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### Features
|
|
15
|
+
|
|
16
|
+
* **Reports:** Adjust report mock for demo app ([b07c30a](https://gerrit.instructure.com/quizzes-ui/commits/b07c30aced5b736b1d626cba3a2968784be12017))
|
|
17
|
+
* **SharingModal:** redesign to prep for sub-account sharing ([46e46bb](https://gerrit.instructure.com/quizzes-ui/commits/46e46bb0b613359393148b22d82fffa59643b660))
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
6
23
|
## [17.54.1](https://gerrit.instructure.com/quizzes-ui/compare/v17.54.0...v17.54.1) (2023-05-16)
|
|
7
24
|
|
|
8
25
|
|
package/es/banks/api/banks.js
CHANGED
|
@@ -66,8 +66,12 @@ export var getBank = function getBank(bankId) {
|
|
|
66
66
|
});
|
|
67
67
|
return fetcher.get("".concat(banksApiEndpoint, "/").concat(bankId)).then(function (response) {
|
|
68
68
|
return dispatch(handleBanksResponse([response]));
|
|
69
|
-
}).catch(function () {
|
|
69
|
+
}).catch(function (err) {
|
|
70
|
+
if (err.response.status === 404) {
|
|
71
|
+
dispatch(clear(BANKS_BANK_PAGINATION));
|
|
72
|
+
} // Do nothing because this case is handled elsewhere.
|
|
70
73
|
// This catch is to suppress an console error for "unhandled in promise".
|
|
74
|
+
|
|
71
75
|
});
|
|
72
76
|
};
|
|
73
77
|
};
|
|
@@ -199,7 +203,7 @@ export var shareBank = function shareBank(_shareBank, getUserInfo) {
|
|
|
199
203
|
var sharedBank = {
|
|
200
204
|
id: sharedBankInfo.id,
|
|
201
205
|
entityType: SHARED_WITH_COURSE,
|
|
202
|
-
entityId: _shareBank.
|
|
206
|
+
entityId: _shareBank.entityId,
|
|
203
207
|
title: _shareBank.title,
|
|
204
208
|
permission: sharedBankInfo.permission,
|
|
205
209
|
bankId: _shareBank.bankId
|
|
@@ -296,7 +300,6 @@ export var updateSharedBankPermission = function updateSharedBankPermission(bank
|
|
|
296
300
|
body: shareBankData
|
|
297
301
|
}).then(function (sharedBank) {
|
|
298
302
|
if (permission === REMOVED_ACCESS) {
|
|
299
|
-
dispatch(clear(BANKS_BANK_PAGINATION));
|
|
300
303
|
dispatch(removeSharedBank(sharedBankId));
|
|
301
304
|
} else {
|
|
302
305
|
dispatch(updateSharedBankPermissionAction(sharedBankId, permission));
|
|
@@ -263,6 +263,23 @@ export var BanksList = (_dec = themeable(theme, styles), _dec(_class = (_temp =
|
|
|
263
263
|
}
|
|
264
264
|
|
|
265
265
|
_createClass(BanksList, [{
|
|
266
|
+
key: "componentDidUpdate",
|
|
267
|
+
value: function componentDidUpdate() {
|
|
268
|
+
var _this2 = this;
|
|
269
|
+
|
|
270
|
+
if (this.state.sharingModalBank) {
|
|
271
|
+
var bankFromList = this.props.banks.find(function (bank) {
|
|
272
|
+
return bank.get('id') === _this2.state.sharingModalBank.get('id');
|
|
273
|
+
});
|
|
274
|
+
|
|
275
|
+
if (!this.state.sharingModalBank.equals(bankFromList)) {
|
|
276
|
+
this.setState({
|
|
277
|
+
sharingModalBank: bankFromList
|
|
278
|
+
});
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
}, {
|
|
266
283
|
key: "renderDetails",
|
|
267
284
|
value: function renderDetails(bank) {
|
|
268
285
|
var separator = ' | ';
|
|
@@ -65,7 +65,7 @@ export var ShareList = (_dec = themeable(theme, styles), _dec(_class = (_temp =
|
|
|
65
65
|
var entity = _ref2.entity,
|
|
66
66
|
isEntityRemoved = _ref2.isEntityRemoved;
|
|
67
67
|
|
|
68
|
-
_this.props.onEntityRemove(entity
|
|
68
|
+
_this.props.onEntityRemove(entity, isEntityRemoved);
|
|
69
69
|
};
|
|
70
70
|
|
|
71
71
|
_this.handlePermissionChange = function (entity) {
|
|
@@ -153,7 +153,9 @@ export var ShareList = (_dec = themeable(theme, styles), _dec(_class = (_temp =
|
|
|
153
153
|
}, {
|
|
154
154
|
key: "render",
|
|
155
155
|
value: function render() {
|
|
156
|
-
var
|
|
156
|
+
var _this$props = this.props,
|
|
157
|
+
shares = _this$props.shares,
|
|
158
|
+
subAccountBankSharingEnabled = _this$props.subAccountBankSharingEnabled;
|
|
157
159
|
var newEntityIds = this.props.newEntities.map(function (e) {
|
|
158
160
|
return e.get('id');
|
|
159
161
|
});
|
|
@@ -168,30 +170,37 @@ export var ShareList = (_dec = themeable(theme, styles), _dec(_class = (_temp =
|
|
|
168
170
|
});
|
|
169
171
|
return /*#__PURE__*/React.createElement("div", {
|
|
170
172
|
className: "fs-mask"
|
|
171
|
-
}, /*#__PURE__*/React.createElement(Text, {
|
|
173
|
+
}, !subAccountBankSharingEnabled && /*#__PURE__*/React.createElement(Text, {
|
|
172
174
|
as: "div",
|
|
173
175
|
weight: "bold"
|
|
174
176
|
}, t('Currently shared with')), /*#__PURE__*/React.createElement(View, {
|
|
175
177
|
as: "div",
|
|
176
|
-
padding: "small 0 0 0",
|
|
177
178
|
"data-automation": "sdk-shared-bank-user-list"
|
|
178
|
-
}, this.renderNewEntities(), /*#__PURE__*/React.createElement(Tabs, {
|
|
179
|
+
}, !subAccountBankSharingEnabled && this.renderNewEntities(), /*#__PURE__*/React.createElement(Tabs, {
|
|
179
180
|
onRequestTabChange: this.handleTabChange
|
|
180
181
|
}, /*#__PURE__*/React.createElement(Tabs.Panel, {
|
|
181
182
|
renderTitle: t('People ({ peopleCount })', {
|
|
182
183
|
peopleCount: existingPeople.size
|
|
183
184
|
}),
|
|
184
185
|
isSelected: this.state.selectedTabIndex === 0,
|
|
185
|
-
padding: "
|
|
186
|
-
}, /*#__PURE__*/React.createElement(
|
|
186
|
+
padding: "large 0 0 0"
|
|
187
|
+
}, subAccountBankSharingEnabled && this.props.renderSearchSection(SHARED_WITH_USER), subAccountBankSharingEnabled && /*#__PURE__*/React.createElement(Text, {
|
|
188
|
+
as: "div",
|
|
189
|
+
weight: "bold",
|
|
190
|
+
lineHeight: "double"
|
|
191
|
+
}, t('Currently shared with')), /*#__PURE__*/React.createElement(Grid, {
|
|
187
192
|
vAlign: "middle"
|
|
188
|
-
}, existingPeople.map(this.renderEntity))), !existingCourses.isEmpty() && /*#__PURE__*/React.createElement(Tabs.Panel, {
|
|
193
|
+
}, existingPeople.map(this.renderEntity))), (!existingCourses.isEmpty() || subAccountBankSharingEnabled) && /*#__PURE__*/React.createElement(Tabs.Panel, {
|
|
189
194
|
renderTitle: t('Courses ({ coursesCount })', {
|
|
190
195
|
coursesCount: existingCourses.size
|
|
191
196
|
}),
|
|
192
197
|
isSelected: this.state.selectedTabIndex === 1,
|
|
193
|
-
padding: "
|
|
194
|
-
}, /*#__PURE__*/React.createElement(
|
|
198
|
+
padding: "large 0 0 0"
|
|
199
|
+
}, subAccountBankSharingEnabled && this.props.renderSearchSection(SHARED_WITH_COURSE), subAccountBankSharingEnabled && /*#__PURE__*/React.createElement(Text, {
|
|
200
|
+
as: "div",
|
|
201
|
+
weight: "bold",
|
|
202
|
+
lineHeight: "double"
|
|
203
|
+
}, t('Currently shared with')), /*#__PURE__*/React.createElement(Grid, {
|
|
195
204
|
vAlign: "middle"
|
|
196
205
|
}, existingCourses.map(this.renderEntity))))));
|
|
197
206
|
}
|
|
@@ -203,6 +212,9 @@ export var ShareList = (_dec = themeable(theme, styles), _dec(_class = (_temp =
|
|
|
203
212
|
canEdit: PropTypes.bool.isRequired,
|
|
204
213
|
improvedBankSharingEnabled: PropTypes.bool.isRequired,
|
|
205
214
|
newEntities: ImmutablePropTypes.list,
|
|
215
|
+
onEntityRemove: PropTypes.func.isRequired,
|
|
216
|
+
onPermissionChange: PropTypes.func.isRequired,
|
|
217
|
+
renderSearchSection: PropTypes.func.isRequired,
|
|
206
218
|
sharedBanks: ImmutablePropTypes.list,
|
|
207
219
|
shares: ImmutablePropTypes.listOf(ImmutablePropTypes.contains({
|
|
208
220
|
avatar: PropTypes.string,
|
|
@@ -212,8 +224,7 @@ export var ShareList = (_dec = themeable(theme, styles), _dec(_class = (_temp =
|
|
|
212
224
|
permission: PropTypes.string.isRequired,
|
|
213
225
|
id: PropTypes.string.isRequired
|
|
214
226
|
})).isRequired,
|
|
215
|
-
|
|
216
|
-
onEntityRemove: PropTypes.func.isRequired
|
|
227
|
+
subAccountBankSharingEnabled: PropTypes.bool.isRequired
|
|
217
228
|
}, _class2.defaultProps = {
|
|
218
229
|
newEntities: List(),
|
|
219
230
|
sharedBanks: List()
|
|
@@ -171,18 +171,22 @@ export var AsyncSearch = /*#__PURE__*/function (_Component) {
|
|
|
171
171
|
};
|
|
172
172
|
|
|
173
173
|
_this.search = debounce(_this.props.debounceDelay, function (value) {
|
|
174
|
-
|
|
175
|
-
_this.props.
|
|
176
|
-
var filteredUsers = _this.filterOptions(shareableUsers);
|
|
174
|
+
var shouldSearchPeople = !_this.props.searchType || _this.props.searchType === SHARED_WITH_USER;
|
|
175
|
+
var shouldSearchCourses = !_this.props.searchType || _this.props.searchType === SHARED_WITH_COURSE; // TODO add the promise cancellation for avoiding having disordered requests
|
|
177
176
|
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
177
|
+
if (shouldSearchPeople) {
|
|
178
|
+
_this.props.getShareableUsers(value).then(function (shareableUsers) {
|
|
179
|
+
var filteredUsers = _this.filterOptions(shareableUsers);
|
|
180
|
+
|
|
181
|
+
_this.setState({
|
|
182
|
+
shareableUsers: shareableUsers,
|
|
183
|
+
highlightedOptionId: filteredUsers.length ? filteredUsers[0].uuid : _this.state.highlightedOptionId,
|
|
184
|
+
isLoading: false
|
|
185
|
+
});
|
|
182
186
|
});
|
|
183
|
-
}
|
|
187
|
+
}
|
|
184
188
|
|
|
185
|
-
if (_this.props.improvedBankSharingEnabled) {
|
|
189
|
+
if (_this.props.improvedBankSharingEnabled && shouldSearchCourses) {
|
|
186
190
|
_this.props.getShareableCourses(value).then(function (shareableCourses) {
|
|
187
191
|
var filteredCourses = _this.filterOptions(shareableCourses);
|
|
188
192
|
|
|
@@ -326,10 +330,11 @@ export var AsyncSearch = /*#__PURE__*/function (_Component) {
|
|
|
326
330
|
var _this$state = this.state,
|
|
327
331
|
inputValue = _this$state.inputValue,
|
|
328
332
|
isShowingOptions = _this$state.isShowingOptions;
|
|
333
|
+
var placeholder = this.props.searchType === SHARED_WITH_COURSE ? t('Enter course name or course id') : t('Enter name or login id');
|
|
329
334
|
return /*#__PURE__*/React.createElement(Select, {
|
|
330
335
|
"data-automation": "sdk-item-bank-share-input",
|
|
331
336
|
renderLabel: t('Share With'),
|
|
332
|
-
placeholder:
|
|
337
|
+
placeholder: placeholder,
|
|
333
338
|
inputValue: inputValue,
|
|
334
339
|
isShowingOptions: isShowingOptions,
|
|
335
340
|
inputRef: this.setInputRef,
|
|
@@ -355,6 +360,7 @@ AsyncSearch.propTypes = {
|
|
|
355
360
|
onSelectionChange: PropTypes.func.isRequired,
|
|
356
361
|
getShareableCourses: PropTypes.func.isRequired,
|
|
357
362
|
getShareableUsers: PropTypes.func.isRequired,
|
|
363
|
+
searchType: PropTypes.string,
|
|
358
364
|
selectedOption: PropTypes.arrayOf(PropTypes.shape({
|
|
359
365
|
avatar: PropTypes.string,
|
|
360
366
|
fullName: PropTypes.string,
|
|
@@ -366,6 +372,7 @@ AsyncSearch.propTypes = {
|
|
|
366
372
|
AsyncSearch.defaultProps = {
|
|
367
373
|
debounceDelay: 500,
|
|
368
374
|
minChars: 1,
|
|
375
|
+
searchType: null,
|
|
369
376
|
selectionFilter: function selectionFilter(value) {
|
|
370
377
|
return value;
|
|
371
378
|
}
|
|
@@ -3,6 +3,7 @@ import { Map } from 'immutable';
|
|
|
3
3
|
import { connect } from "../../../common/react-redux.js";
|
|
4
4
|
import { shareBank, getSharedBanks, updateSharedBankPermission, getBank, updateBank } from "../../api/banks.js";
|
|
5
5
|
import { removeSharedBank } from "../../../common/actions/sharedBanks.js";
|
|
6
|
+
import { withConfirm } from "../../../common/actions/modal.js";
|
|
6
7
|
import { featureOn } from "../../../common/util/featureCheck.js";
|
|
7
8
|
import SharingModal from "./presenter.js";
|
|
8
9
|
|
|
@@ -12,6 +13,7 @@ function mapStateToProps(state, ownProps) {
|
|
|
12
13
|
}).toList();
|
|
13
14
|
return {
|
|
14
15
|
improvedBankSharingEnabled: featureOn('improved_bank_sharing'),
|
|
16
|
+
subAccountBankSharingEnabled: featureOn('sub_account_bank_sharing'),
|
|
15
17
|
sharedBanks: sharedBanks
|
|
16
18
|
};
|
|
17
19
|
}
|
|
@@ -22,6 +24,7 @@ var mapDispatchToProps = {
|
|
|
22
24
|
updateSharedBankPermission: updateSharedBankPermission,
|
|
23
25
|
getBank: getBank,
|
|
24
26
|
removeSharedBank: removeSharedBank,
|
|
25
|
-
updateBank: updateBank
|
|
27
|
+
updateBank: updateBank,
|
|
28
|
+
withConfirm: withConfirm
|
|
26
29
|
};
|
|
27
30
|
export default compose(connect(mapStateToProps, mapDispatchToProps))(SharingModal);
|