@instructure/quiz-core 18.8.0 → 18.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.
@@ -71,7 +71,7 @@ export var NewQuizAndItemAnalysisPresenter = /*#__PURE__*/function (_Component)
71
71
  }));
72
72
  };
73
73
 
74
- _this.renderErrorBody = function () {
74
+ _this.renderBodyOnFailedFetch = function () {
75
75
  return /*#__PURE__*/React.createElement(Flex, {
76
76
  alignItems: "end",
77
77
  width: "82.5rem",
@@ -117,13 +117,14 @@ export var NewQuizAndItemAnalysisPresenter = /*#__PURE__*/function (_Component)
117
117
  generationInProgress = _this$props.generationInProgress,
118
118
  quizAnalysis = _this$props.quizAnalysis;
119
119
  var shouldShowError = analysisError && !generationInProgress;
120
+ var timeStamp = quizAnalysis === null || quizAnalysis === void 0 ? void 0 : quizAnalysis.created_timestamp;
120
121
  return /*#__PURE__*/React.createElement(Flex, {
121
122
  alignItems: "end",
122
123
  width: "auto",
123
124
  margin: "small auto",
124
125
  direction: "column"
125
- }, /*#__PURE__*/React.createElement(Flex.Item, null, /*#__PURE__*/React.createElement(AnalysisUpdateDate, {
126
- date: quizAnalysis === null || quizAnalysis === void 0 ? void 0 : quizAnalysis.created_timestamp
126
+ }, /*#__PURE__*/React.createElement(Flex.Item, null, timeStamp && /*#__PURE__*/React.createElement(AnalysisUpdateDate, {
127
+ date: timeStamp
127
128
  })), /*#__PURE__*/React.createElement(Flex.Item, null, shouldShowError && /*#__PURE__*/React.createElement(Text, {
128
129
  size: "x-small",
129
130
  weight: "400",
@@ -160,6 +161,15 @@ export var NewQuizAndItemAnalysisPresenter = /*#__PURE__*/function (_Component)
160
161
  });
161
162
  };
162
163
 
164
+ _this.isEmptyReport = function () {
165
+ var _this$props3 = _this.props,
166
+ fetchInProgress = _this$props3.fetchInProgress,
167
+ quizAnalysis = _this$props3.quizAnalysis,
168
+ itemAnalyses = _this$props3.itemAnalyses,
169
+ analysisError = _this$props3.analysisError;
170
+ return !fetchInProgress && !quizAnalysis && !itemAnalyses && !analysisError;
171
+ };
172
+
163
173
  _this.renderTop = function () {
164
174
  return /*#__PURE__*/React.createElement(Flex, {
165
175
  justifyItems: "space-between",
@@ -171,6 +181,10 @@ export var NewQuizAndItemAnalysisPresenter = /*#__PURE__*/function (_Component)
171
181
  }, /*#__PURE__*/React.createElement(Flex.Item, null, _this.renderHeader()), /*#__PURE__*/React.createElement(Flex.Item, null, _this.renderRightSide()));
172
182
  };
173
183
 
184
+ _this.renderTopOnSuccessfulFetch = function () {
185
+ return _this.isEmptyReport() ? _this.renderGenerationButton() : _this.renderTop();
186
+ };
187
+
174
188
  _this.renderTopOnFailedFetch = function () {
175
189
  var exportEnabled = _this.props.exportEnabled;
176
190
  return /*#__PURE__*/React.createElement(Flex, {
@@ -221,9 +235,9 @@ export var NewQuizAndItemAnalysisPresenter = /*#__PURE__*/function (_Component)
221
235
  };
222
236
 
223
237
  _this.renderBody = function () {
224
- var _this$props3 = _this.props,
225
- fetchInProgress = _this$props3.fetchInProgress,
226
- quizAnalysis = _this$props3.quizAnalysis; // TODO need to refactor the NewQuizAnalysis to move out spinner logic
238
+ var _this$props4 = _this.props,
239
+ fetchInProgress = _this$props4.fetchInProgress,
240
+ quizAnalysis = _this$props4.quizAnalysis; // TODO need to refactor the NewQuizAnalysis to move out spinner logic
227
241
 
228
242
  return /*#__PURE__*/React.createElement(React.Fragment, null, (fetchInProgress || quizAnalysis) && /*#__PURE__*/React.createElement(NewQuizAnalysis, {
229
243
  quizAnalysis: quizAnalysis,
@@ -231,6 +245,10 @@ export var NewQuizAndItemAnalysisPresenter = /*#__PURE__*/function (_Component)
231
245
  }), fetchInProgress ? _this.renderSpinner() : _this.renderItemAnalyses());
232
246
  };
233
247
 
248
+ _this.renderBodyOnSuccessfulFetch = function () {
249
+ return !_this.isEmptyReport() && _this.renderBody();
250
+ };
251
+
234
252
  _this.handleGeneration = function (_event) {
235
253
  var filter = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 'last_attempt';
236
254
 
@@ -250,12 +268,12 @@ export var NewQuizAndItemAnalysisPresenter = /*#__PURE__*/function (_Component)
250
268
  _createClass(NewQuizAndItemAnalysisPresenter, [{
251
269
  key: "render",
252
270
  value: function render() {
253
- var _this$props4 = this.props,
254
- analysisFetchError = _this$props4.analysisFetchError,
255
- fetchInProgress = _this$props4.fetchInProgress;
271
+ var _this$props5 = this.props,
272
+ analysisFetchError = _this$props5.analysisFetchError,
273
+ fetchInProgress = _this$props5.fetchInProgress;
256
274
  return /*#__PURE__*/React.createElement("div", {
257
275
  className: "fs-mask"
258
- }, !fetchInProgress && (analysisFetchError ? this.renderTopOnFailedFetch() : this.renderTop()), analysisFetchError ? this.renderErrorBody() : this.renderBody());
276
+ }, !fetchInProgress && (analysisFetchError ? this.renderTopOnFailedFetch() : this.renderTopOnSuccessfulFetch()), analysisFetchError ? this.renderBodyOnFailedFetch() : this.renderBodyOnSuccessfulFetch());
259
277
  }
260
278
  }]);
261
279
 
@@ -6,7 +6,7 @@ import { getItemAnalyses as fetchItemAnalyses } from "../../../api/getItemAnalys
6
6
  import { getAnalysesStatus as fetchAnalysesStatus } from "../../../api/getAnalysesStatus.js";
7
7
  import { getAnalysesExport } from "../../../api/getAnalysesExport.js";
8
8
  import { connect } from "../../../../common/react-redux.js";
9
- import { compose } from 'redux';
9
+ import { bindActionCreators, compose } from 'redux';
10
10
  import { getActiveQuizId } from "../../../../common/selectors/quizzes.js";
11
11
  import { addError } from "../../../../common/actions/alerts.js";
12
12
  import { featureOn } from "../../../../common/util/featureCheck.js";
@@ -28,14 +28,18 @@ export function mapStateToProps(state, ownProps) {
28
28
  exportEnabled: featureOn('item_analysis_csv')
29
29
  };
30
30
  }
31
- var mapDispatchToProps = {
32
- setQuizAnalysis: setQuizAnalysis,
33
- setItemAnalyses: setItemAnalyses,
34
- setFetchInProgress: setFetchInProgress,
35
- setGenerationInProgress: setGenerationInProgress,
36
- setAnalysisError: setAnalysisError,
37
- addError: addError,
38
- setStatusPollingInProgress: setStatusPollingInProgress
31
+
32
+ var mapDispatchToProps = function mapDispatchToProps(dispatch, ownProps) {
33
+ return {
34
+ setQuizAnalysis: bindActionCreators(setQuizAnalysis, dispatch),
35
+ setItemAnalyses: bindActionCreators(setItemAnalyses, dispatch),
36
+ setFetchInProgress: bindActionCreators(setFetchInProgress, dispatch),
37
+ setGenerationInProgress: bindActionCreators(setGenerationInProgress, dispatch),
38
+ setAnalysisError: bindActionCreators(setAnalysisError, dispatch),
39
+ addError: ownProps.addError || bindActionCreators(addError, dispatch),
40
+ setStatusPollingInProgress: bindActionCreators(setStatusPollingInProgress, dispatch)
41
+ };
39
42
  };
43
+
40
44
  export var withAnalysisState = compose(connect(mapStateToProps, mapDispatchToProps), withAnalysisStatePresenter);
41
45
  export default withAnalysisState;
@@ -104,7 +104,7 @@ var NewQuizAndItemAnalysisPresenter = /*#__PURE__*/function (_Component) {
104
104
  }));
105
105
  };
106
106
 
107
- _this.renderErrorBody = function () {
107
+ _this.renderBodyOnFailedFetch = function () {
108
108
  return /*#__PURE__*/_react.default.createElement(_uiFlex.Flex, {
109
109
  alignItems: "end",
110
110
  width: "82.5rem",
@@ -150,13 +150,14 @@ var NewQuizAndItemAnalysisPresenter = /*#__PURE__*/function (_Component) {
150
150
  generationInProgress = _this$props.generationInProgress,
151
151
  quizAnalysis = _this$props.quizAnalysis;
152
152
  var shouldShowError = analysisError && !generationInProgress;
153
+ var timeStamp = quizAnalysis === null || quizAnalysis === void 0 ? void 0 : quizAnalysis.created_timestamp;
153
154
  return /*#__PURE__*/_react.default.createElement(_uiFlex.Flex, {
154
155
  alignItems: "end",
155
156
  width: "auto",
156
157
  margin: "small auto",
157
158
  direction: "column"
158
- }, /*#__PURE__*/_react.default.createElement(_uiFlex.Flex.Item, null, /*#__PURE__*/_react.default.createElement(_index3.AnalysisUpdateDate, {
159
- date: quizAnalysis === null || quizAnalysis === void 0 ? void 0 : quizAnalysis.created_timestamp
159
+ }, /*#__PURE__*/_react.default.createElement(_uiFlex.Flex.Item, null, timeStamp && /*#__PURE__*/_react.default.createElement(_index3.AnalysisUpdateDate, {
160
+ date: timeStamp
160
161
  })), /*#__PURE__*/_react.default.createElement(_uiFlex.Flex.Item, null, shouldShowError && /*#__PURE__*/_react.default.createElement(_uiText.Text, {
161
162
  size: "x-small",
162
163
  weight: "400",
@@ -193,6 +194,15 @@ var NewQuizAndItemAnalysisPresenter = /*#__PURE__*/function (_Component) {
193
194
  });
194
195
  };
195
196
 
197
+ _this.isEmptyReport = function () {
198
+ var _this$props3 = _this.props,
199
+ fetchInProgress = _this$props3.fetchInProgress,
200
+ quizAnalysis = _this$props3.quizAnalysis,
201
+ itemAnalyses = _this$props3.itemAnalyses,
202
+ analysisError = _this$props3.analysisError;
203
+ return !fetchInProgress && !quizAnalysis && !itemAnalyses && !analysisError;
204
+ };
205
+
196
206
  _this.renderTop = function () {
197
207
  return /*#__PURE__*/_react.default.createElement(_uiFlex.Flex, {
198
208
  justifyItems: "space-between",
@@ -204,6 +214,10 @@ var NewQuizAndItemAnalysisPresenter = /*#__PURE__*/function (_Component) {
204
214
  }, /*#__PURE__*/_react.default.createElement(_uiFlex.Flex.Item, null, _this.renderHeader()), /*#__PURE__*/_react.default.createElement(_uiFlex.Flex.Item, null, _this.renderRightSide()));
205
215
  };
206
216
 
217
+ _this.renderTopOnSuccessfulFetch = function () {
218
+ return _this.isEmptyReport() ? _this.renderGenerationButton() : _this.renderTop();
219
+ };
220
+
207
221
  _this.renderTopOnFailedFetch = function () {
208
222
  var exportEnabled = _this.props.exportEnabled;
209
223
  return /*#__PURE__*/_react.default.createElement(_uiFlex.Flex, {
@@ -254,9 +268,9 @@ var NewQuizAndItemAnalysisPresenter = /*#__PURE__*/function (_Component) {
254
268
  };
255
269
 
256
270
  _this.renderBody = function () {
257
- var _this$props3 = _this.props,
258
- fetchInProgress = _this$props3.fetchInProgress,
259
- quizAnalysis = _this$props3.quizAnalysis; // TODO need to refactor the NewQuizAnalysis to move out spinner logic
271
+ var _this$props4 = _this.props,
272
+ fetchInProgress = _this$props4.fetchInProgress,
273
+ quizAnalysis = _this$props4.quizAnalysis; // TODO need to refactor the NewQuizAnalysis to move out spinner logic
260
274
 
261
275
  return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, (fetchInProgress || quizAnalysis) && /*#__PURE__*/_react.default.createElement(_index2.default, {
262
276
  quizAnalysis: quizAnalysis,
@@ -264,6 +278,10 @@ var NewQuizAndItemAnalysisPresenter = /*#__PURE__*/function (_Component) {
264
278
  }), fetchInProgress ? _this.renderSpinner() : _this.renderItemAnalyses());
265
279
  };
266
280
 
281
+ _this.renderBodyOnSuccessfulFetch = function () {
282
+ return !_this.isEmptyReport() && _this.renderBody();
283
+ };
284
+
267
285
  _this.handleGeneration = function (_event) {
268
286
  var filter = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 'last_attempt';
269
287
 
@@ -283,12 +301,12 @@ var NewQuizAndItemAnalysisPresenter = /*#__PURE__*/function (_Component) {
283
301
  (0, _createClass2.default)(NewQuizAndItemAnalysisPresenter, [{
284
302
  key: "render",
285
303
  value: function render() {
286
- var _this$props4 = this.props,
287
- analysisFetchError = _this$props4.analysisFetchError,
288
- fetchInProgress = _this$props4.fetchInProgress;
304
+ var _this$props5 = this.props,
305
+ analysisFetchError = _this$props5.analysisFetchError,
306
+ fetchInProgress = _this$props5.fetchInProgress;
289
307
  return /*#__PURE__*/_react.default.createElement("div", {
290
308
  className: "fs-mask"
291
- }, !fetchInProgress && (analysisFetchError ? this.renderTopOnFailedFetch() : this.renderTop()), analysisFetchError ? this.renderErrorBody() : this.renderBody());
309
+ }, !fetchInProgress && (analysisFetchError ? this.renderTopOnFailedFetch() : this.renderTopOnSuccessfulFetch()), analysisFetchError ? this.renderBodyOnFailedFetch() : this.renderBodyOnSuccessfulFetch());
292
310
  }
293
311
  }]);
294
312
  NewQuizAndItemAnalysisPresenter.displayName = "NewQuizAndItemAnalysisPresenter";
@@ -50,15 +50,18 @@ function mapStateToProps(state, ownProps) {
50
50
  };
51
51
  }
52
52
 
53
- var mapDispatchToProps = {
54
- setQuizAnalysis: _analyses2.setQuizAnalysis,
55
- setItemAnalyses: _analyses2.setItemAnalyses,
56
- setFetchInProgress: _analyses2.setFetchInProgress,
57
- setGenerationInProgress: _analyses2.setGenerationInProgress,
58
- setAnalysisError: _analyses2.setAnalysisError,
59
- addError: _alerts.addError,
60
- setStatusPollingInProgress: _analyses2.setStatusPollingInProgress
53
+ var mapDispatchToProps = function mapDispatchToProps(dispatch, ownProps) {
54
+ return {
55
+ setQuizAnalysis: (0, _redux.bindActionCreators)(_analyses2.setQuizAnalysis, dispatch),
56
+ setItemAnalyses: (0, _redux.bindActionCreators)(_analyses2.setItemAnalyses, dispatch),
57
+ setFetchInProgress: (0, _redux.bindActionCreators)(_analyses2.setFetchInProgress, dispatch),
58
+ setGenerationInProgress: (0, _redux.bindActionCreators)(_analyses2.setGenerationInProgress, dispatch),
59
+ setAnalysisError: (0, _redux.bindActionCreators)(_analyses2.setAnalysisError, dispatch),
60
+ addError: ownProps.addError || (0, _redux.bindActionCreators)(_alerts.addError, dispatch),
61
+ setStatusPollingInProgress: (0, _redux.bindActionCreators)(_analyses2.setStatusPollingInProgress, dispatch)
62
+ };
61
63
  };
64
+
62
65
  var withAnalysisState = (0, _redux.compose)((0, _reactRedux.connect)(mapStateToProps, mapDispatchToProps), _withAnalysisStatePresenter.withAnalysisStatePresenter);
63
66
  exports.withAnalysisState = withAnalysisState;
64
67
  var _default = withAnalysisState;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@instructure/quiz-core",
3
- "version": "18.8.0",
3
+ "version": "18.8.1-rc.1+1ac335e57",
4
4
  "license": "MIT",
5
5
  "description": "The Quiz React SDK by Instructure Inc.",
6
6
  "author": "Instructure, Inc. Engineering and Product Design",
@@ -43,11 +43,11 @@
43
43
  "dependencies": {
44
44
  "@instructure/grading-utils": "^1.0.0",
45
45
  "@instructure/outcomes-ui": "^2.1.9",
46
- "@instructure/quiz-common": "^18.8.0",
47
- "@instructure/quiz-i18n": "^18.8.0",
48
- "@instructure/quiz-interactions": "^18.8.0",
49
- "@instructure/quiz-number-input": "^18.8.0",
50
- "@instructure/quiz-rce": "^18.8.0",
46
+ "@instructure/quiz-common": "18.8.1-rc.1+1ac335e57",
47
+ "@instructure/quiz-i18n": "18.8.1-rc.1+1ac335e57",
48
+ "@instructure/quiz-interactions": "18.8.1-rc.1+1ac335e57",
49
+ "@instructure/quiz-number-input": "18.8.1-rc.1+1ac335e57",
50
+ "@instructure/quiz-rce": "18.8.1-rc.1+1ac335e57",
51
51
  "@instructure/ui-a11y-content": "^7.22.1",
52
52
  "@instructure/ui-alerts": "^7.22.1",
53
53
  "@instructure/ui-avatar": "^7.22.1",
@@ -109,7 +109,7 @@
109
109
  "file-saver": "~2.0.5",
110
110
  "humps": "^2.0.0",
111
111
  "immutable": "^3.8.1",
112
- "instructure-validations": "^18.8.0",
112
+ "instructure-validations": "18.8.1-rc.1+1ac335e57",
113
113
  "ipaddr.js": "^1.5.4",
114
114
  "isomorphic-fetch": "^2.2.0",
115
115
  "isuuid": "^0.1.0",
@@ -141,7 +141,7 @@
141
141
  "uuid": "^3.2.1"
142
142
  },
143
143
  "devDependencies": {
144
- "@instructure/quiz-scripts": "^18.8.0",
144
+ "@instructure/quiz-scripts": "18.8.0",
145
145
  "@instructure/ui-axe-check": "^7.22.1",
146
146
  "@instructure/ui-babel-preset": "^7.22.1",
147
147
  "@instructure/ui-karma-config": "^7.22.1",
@@ -160,7 +160,7 @@
160
160
  "intl": "^1.2.4",
161
161
  "jquery": "^2.2.3",
162
162
  "most-subject": "^5.3.0",
163
- "quiz-presets": "^18.8.0",
163
+ "quiz-presets": "18.8.1-rc.1+1ac335e57",
164
164
  "react": "^16.8.6",
165
165
  "react-addons-test-utils": "^15.6.2",
166
166
  "react-dom": "^16.8.6",
@@ -176,5 +176,5 @@
176
176
  "publishConfig": {
177
177
  "access": "public"
178
178
  },
179
- "gitHead": "999dc8e317a859e6adba56cc0c53569b1414a6d5"
179
+ "gitHead": "1ac335e57a2599fb939c6cf88d00177c88893e1b"
180
180
  }