@imposium-hub/components 1.42.3 → 1.42.4
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/components/story-previewer/StoryPreviewer.tsx +49 -11
- package/constants/copy.ts +2 -1
- package/dist/components.js +40 -40
- package/dist/components.js.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/styles.css.map +1 -1
- package/dist/styles.less +4 -0
- package/dist/styles.less.map +1 -1
- package/less/components/story-previewer.less +4 -0
- package/package.json +1 -1
- package/services/API.ts +2 -0
|
@@ -46,13 +46,14 @@ interface IStoryPreviewerState {
|
|
|
46
46
|
rendering : boolean;
|
|
47
47
|
activeOutput : string;
|
|
48
48
|
timeElapsed : number;
|
|
49
|
+
isTimeOut : boolean;
|
|
49
50
|
}
|
|
50
51
|
|
|
51
52
|
class StoryPreviewer extends React.PureComponent<IStoryPreviewerProps, IStoryPreviewerState> {
|
|
52
53
|
|
|
53
54
|
private timer : Timer;
|
|
54
55
|
private evtHandlers : any;
|
|
55
|
-
|
|
56
|
+
private TIMEOUT : string = '02:00';
|
|
56
57
|
constructor(props) {
|
|
57
58
|
|
|
58
59
|
super(props);
|
|
@@ -68,7 +69,8 @@ class StoryPreviewer extends React.PureComponent<IStoryPreviewerProps, IStoryPre
|
|
|
68
69
|
experience: null,
|
|
69
70
|
timeElapsed: 0,
|
|
70
71
|
activeOutput: '',
|
|
71
|
-
rendering: false
|
|
72
|
+
rendering: false,
|
|
73
|
+
isTimeOut: false,
|
|
72
74
|
};
|
|
73
75
|
|
|
74
76
|
this.timer = new Timer({
|
|
@@ -207,6 +209,25 @@ class StoryPreviewer extends React.PureComponent<IStoryPreviewerProps, IStoryPre
|
|
|
207
209
|
inventory
|
|
208
210
|
});
|
|
209
211
|
}
|
|
212
|
+
|
|
213
|
+
if (prevState.timeElapsed !== this.state.timeElapsed) {
|
|
214
|
+
if (formattedTime(this.state.timeElapsed) === this.TIMEOUT && !this.state.experience) {
|
|
215
|
+
|
|
216
|
+
const {onError, api} = this.props;
|
|
217
|
+
const {experienceId} = this.state;
|
|
218
|
+
|
|
219
|
+
api.cancelExperiencePolling()
|
|
220
|
+
.then(() => {
|
|
221
|
+
|
|
222
|
+
onError(copy.runExpError.replace('[expId]', experienceId));
|
|
223
|
+
|
|
224
|
+
this.resetState(true, () => {
|
|
225
|
+
this.setState({isTimeOut: true});
|
|
226
|
+
});
|
|
227
|
+
|
|
228
|
+
});
|
|
229
|
+
}
|
|
230
|
+
}
|
|
210
231
|
}
|
|
211
232
|
|
|
212
233
|
private variableInputChanged(key, value) {
|
|
@@ -395,7 +416,7 @@ class StoryPreviewer extends React.PureComponent<IStoryPreviewerProps, IStoryPre
|
|
|
395
416
|
this.setState({
|
|
396
417
|
rendering: false,
|
|
397
418
|
activeOutput: this.getFirstOutput(resVideo),
|
|
398
|
-
experience: resVideo
|
|
419
|
+
experience: resVideo,
|
|
399
420
|
});
|
|
400
421
|
};
|
|
401
422
|
|
|
@@ -408,7 +429,11 @@ class StoryPreviewer extends React.PureComponent<IStoryPreviewerProps, IStoryPre
|
|
|
408
429
|
}).catch((e) => {
|
|
409
430
|
this.resetState();
|
|
410
431
|
if (onError) {
|
|
411
|
-
|
|
432
|
+
if (e.error) {
|
|
433
|
+
onError(e.error);
|
|
434
|
+
} else {
|
|
435
|
+
onError(copy.runExpError.replace('[expId]', experienceId));
|
|
436
|
+
}
|
|
412
437
|
}
|
|
413
438
|
});
|
|
414
439
|
|
|
@@ -436,7 +461,6 @@ class StoryPreviewer extends React.PureComponent<IStoryPreviewerProps, IStoryPre
|
|
|
436
461
|
};
|
|
437
462
|
|
|
438
463
|
api.getExperience(experienceId, true).then((resVideo) => {
|
|
439
|
-
|
|
440
464
|
if (this.evtHandlers.gotExperience) {
|
|
441
465
|
this.evtHandlers.gotExperience(resVideo);
|
|
442
466
|
}
|
|
@@ -444,7 +468,11 @@ class StoryPreviewer extends React.PureComponent<IStoryPreviewerProps, IStoryPre
|
|
|
444
468
|
}).catch((e) => {
|
|
445
469
|
this.resetState();
|
|
446
470
|
if (onError) {
|
|
447
|
-
|
|
471
|
+
if (e.error) {
|
|
472
|
+
onError(e.error);
|
|
473
|
+
} else {
|
|
474
|
+
onError(copy.runExpError.replace('[expId]', experienceId));
|
|
475
|
+
}
|
|
448
476
|
}
|
|
449
477
|
});
|
|
450
478
|
}
|
|
@@ -456,9 +484,10 @@ class StoryPreviewer extends React.PureComponent<IStoryPreviewerProps, IStoryPre
|
|
|
456
484
|
|
|
457
485
|
const {storyId, onNotification, onError, api, onExperienceCreated, compositionId, useWorkingCopy} = this.props;
|
|
458
486
|
|
|
459
|
-
this.resetState(() => {
|
|
487
|
+
this.resetState(false, () => {
|
|
460
488
|
this.setState({
|
|
461
|
-
rendering: true
|
|
489
|
+
rendering: true,
|
|
490
|
+
isTimeOut: false,
|
|
462
491
|
}, () => {
|
|
463
492
|
|
|
464
493
|
this.timer.start();
|
|
@@ -492,15 +521,16 @@ class StoryPreviewer extends React.PureComponent<IStoryPreviewerProps, IStoryPre
|
|
|
492
521
|
});
|
|
493
522
|
}
|
|
494
523
|
|
|
495
|
-
private resetState(callback?) {
|
|
524
|
+
private resetState(isTimeOut? : boolean, callback?) {
|
|
496
525
|
this.timer.stop();
|
|
497
526
|
this.setState({
|
|
498
527
|
rendering: false,
|
|
499
528
|
experienceId: null,
|
|
500
529
|
experience: null,
|
|
501
530
|
jobId: null,
|
|
502
|
-
timeElapsed: 0,
|
|
531
|
+
timeElapsed: !isTimeOut ? 0 : this.state.timeElapsed,
|
|
503
532
|
activeOutput: null,
|
|
533
|
+
isTimeOut
|
|
504
534
|
}, () => {
|
|
505
535
|
if (callback) {
|
|
506
536
|
callback();
|
|
@@ -510,7 +540,8 @@ class StoryPreviewer extends React.PureComponent<IStoryPreviewerProps, IStoryPre
|
|
|
510
540
|
|
|
511
541
|
private renderViewerContent() {
|
|
512
542
|
|
|
513
|
-
const {rendering, experience, timeElapsed, activeOutput } = this.state;
|
|
543
|
+
const {rendering, experience, timeElapsed, activeOutput, isTimeOut } = this.state;
|
|
544
|
+
|
|
514
545
|
const { api, onError } = this.props;
|
|
515
546
|
|
|
516
547
|
if (rendering) {
|
|
@@ -519,6 +550,13 @@ class StoryPreviewer extends React.PureComponent<IStoryPreviewerProps, IStoryPre
|
|
|
519
550
|
<h1> {copy.expRunning }</h1>
|
|
520
551
|
<p>{copy.time} {formattedTime(timeElapsed)}</p>
|
|
521
552
|
</div>;
|
|
553
|
+
} else if (isTimeOut || isTimeOut === undefined) {
|
|
554
|
+
return (
|
|
555
|
+
<div className = 'running-prompt error-wrapper'>
|
|
556
|
+
<h1> {copy.runExpErrorDes}</h1>
|
|
557
|
+
<p>{copy.time} {formattedTime(timeElapsed)}</p>
|
|
558
|
+
</div>
|
|
559
|
+
);
|
|
522
560
|
} else if (experience && activeOutput) {
|
|
523
561
|
|
|
524
562
|
let player;
|
package/constants/copy.ts
CHANGED
|
@@ -55,7 +55,8 @@ export const previewer = {
|
|
|
55
55
|
btnLog: 'Job Log',
|
|
56
56
|
btnRender: 'Render',
|
|
57
57
|
btnReRender: 'Re-Render',
|
|
58
|
-
expIdField: 'Exp. ID'
|
|
58
|
+
expIdField: 'Exp. ID',
|
|
59
|
+
runExpErrorDes: 'Sorry, there was a problem creating your video. Please try again.'
|
|
59
60
|
};
|
|
60
61
|
|
|
61
62
|
export const compositions = {
|