@elice/material-runbox 1.260825.0-runboxusability.7 → 1.260825.0-runboxusability.8
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/cjs/components/material-runbox/MaterialRunboxContent.js +21 -18
- package/cjs/components/material-runbox/MaterialRunboxHeader.js +1 -16
- package/cjs/components/material-runbox/actions/MaterialRunboxActionDisconnect.d.ts +1 -4
- package/cjs/components/material-runbox/actions/MaterialRunboxActionDisconnect.js +4 -2
- package/cjs/components/material-runbox/actions/MaterialRunboxActionDisconnectMenuItem.d.ts +1 -4
- package/cjs/components/material-runbox/actions/MaterialRunboxActionDisconnectMenuItem.js +13 -19
- package/cjs/components/material-runbox/actions/MaterialRunboxActionMenu.d.ts +0 -1
- package/cjs/components/material-runbox/actions/MaterialRunboxActionMenu.js +1 -9
- package/cjs/components/material-runbox/actions/MaterialRunboxActionRestart.d.ts +1 -2
- package/cjs/components/material-runbox/actions/MaterialRunboxActionRestart.js +9 -26
- package/cjs/components/material-runbox/contexts/MaterialRunboxControlContext.d.ts +14 -0
- package/cjs/components/material-runbox/contexts/MaterialRunboxControlContext.js +56 -0
- package/cjs/components/material-runbox/contexts/index.d.ts +2 -0
- package/cjs/components/material-runbox/contexts/index.js +4 -0
- package/cjs/components/material-runbox/disk/MaterialRunboxEnvResetButton.d.ts +0 -1
- package/cjs/components/material-runbox/disk/MaterialRunboxEnvResetButton.js +92 -16
- package/cjs/components/material-runbox/hooks/index.d.ts +0 -1
- package/cjs/components/material-runbox/hooks/index.js +0 -2
- package/cjs/components/material-runbox/hooks/useRunboxControl.d.ts +4 -3
- package/cjs/components/material-runbox/hooks/useRunboxControl.js +43 -14
- package/cjs/components/material-runbox/locales/en.json.js +1 -1
- package/cjs/components/material-runbox/locales/ja.json.js +1 -1
- package/cjs/components/material-runbox/locales/ko.json.js +1 -1
- package/cjs/components/material-runbox/locales/th.json.js +1 -1
- package/cjs/components/material-runbox/runtime/Runtime.js +7 -15
- package/cjs/components/material-runbox/runtime/RuntimeChangeMaterialDialog.d.ts +0 -1
- package/cjs/components/material-runbox/runtime/RuntimeChangeMaterialDialog.js +9 -3
- package/cjs/components/material-runbox/runtime/RuntimeOverlayConflicted.d.ts +0 -1
- package/cjs/components/material-runbox/runtime/RuntimeOverlayConflicted.js +1 -3
- package/cjs/components/material-runbox/runtime/RuntimeOverlayTerminated.d.ts +0 -1
- package/cjs/components/material-runbox/runtime/RuntimeOverlayTerminated.js +7 -6
- package/cjs/components/material-runbox/timer/MaterialRunboxTimer.d.ts +0 -1
- package/cjs/components/material-runbox/timer/MaterialRunboxTimer.js +3 -1
- package/es/components/material-runbox/MaterialRunboxContent.js +21 -18
- package/es/components/material-runbox/MaterialRunboxHeader.js +1 -16
- package/es/components/material-runbox/actions/MaterialRunboxActionDisconnect.d.ts +1 -4
- package/es/components/material-runbox/actions/MaterialRunboxActionDisconnect.js +4 -2
- package/es/components/material-runbox/actions/MaterialRunboxActionDisconnectMenuItem.d.ts +1 -4
- package/es/components/material-runbox/actions/MaterialRunboxActionDisconnectMenuItem.js +13 -19
- package/es/components/material-runbox/actions/MaterialRunboxActionMenu.d.ts +0 -1
- package/es/components/material-runbox/actions/MaterialRunboxActionMenu.js +1 -9
- package/es/components/material-runbox/actions/MaterialRunboxActionRestart.d.ts +1 -2
- package/es/components/material-runbox/actions/MaterialRunboxActionRestart.js +9 -26
- package/es/components/material-runbox/contexts/MaterialRunboxControlContext.d.ts +14 -0
- package/es/components/material-runbox/contexts/MaterialRunboxControlContext.js +46 -0
- package/es/components/material-runbox/contexts/index.d.ts +2 -0
- package/es/components/material-runbox/contexts/index.js +1 -0
- package/es/components/material-runbox/disk/MaterialRunboxEnvResetButton.d.ts +0 -1
- package/es/components/material-runbox/disk/MaterialRunboxEnvResetButton.js +93 -17
- package/es/components/material-runbox/hooks/index.d.ts +0 -1
- package/es/components/material-runbox/hooks/index.js +0 -1
- package/es/components/material-runbox/hooks/useRunboxControl.d.ts +4 -3
- package/es/components/material-runbox/hooks/useRunboxControl.js +43 -14
- package/es/components/material-runbox/locales/en.json.js +1 -1
- package/es/components/material-runbox/locales/ja.json.js +1 -1
- package/es/components/material-runbox/locales/ko.json.js +1 -1
- package/es/components/material-runbox/locales/th.json.js +1 -1
- package/es/components/material-runbox/runtime/Runtime.js +8 -16
- package/es/components/material-runbox/runtime/RuntimeChangeMaterialDialog.d.ts +0 -1
- package/es/components/material-runbox/runtime/RuntimeChangeMaterialDialog.js +9 -3
- package/es/components/material-runbox/runtime/RuntimeOverlayConflicted.d.ts +0 -1
- package/es/components/material-runbox/runtime/RuntimeOverlayConflicted.js +1 -3
- package/es/components/material-runbox/runtime/RuntimeOverlayTerminated.d.ts +0 -1
- package/es/components/material-runbox/runtime/RuntimeOverlayTerminated.js +7 -6
- package/es/components/material-runbox/timer/MaterialRunboxTimer.d.ts +0 -1
- package/es/components/material-runbox/timer/MaterialRunboxTimer.js +3 -1
- package/package.json +6 -6
- package/cjs/components/material-runbox/hooks/useRunboxEnvReset.d.ts +0 -16
- package/cjs/components/material-runbox/hooks/useRunboxEnvReset.js +0 -95
- package/es/components/material-runbox/hooks/useRunboxEnvReset.d.ts +0 -16
- package/es/components/material-runbox/hooks/useRunboxEnvReset.js +0 -89
|
@@ -19,6 +19,7 @@ var MaterialRunboxHeader = require('./MaterialRunboxHeader.js');
|
|
|
19
19
|
var MaterialRunboxContext = require('./contexts/MaterialRunboxContext.js');
|
|
20
20
|
var MaterialRunboxApiContext = require('./contexts/MaterialRunboxApiContext.js');
|
|
21
21
|
var MaterialRunboxCommandContext = require('./contexts/MaterialRunboxCommandContext.js');
|
|
22
|
+
var MaterialRunboxControlContext = require('./contexts/MaterialRunboxControlContext.js');
|
|
22
23
|
var MaterialRunboxDiskUsageAlert = require('./disk/MaterialRunboxDiskUsageAlert.js');
|
|
23
24
|
var MaterialRunboxDiskUsageDialog = require('./disk/MaterialRunboxDiskUsageDialog.js');
|
|
24
25
|
var useMaterialRunboxRunboxIdStarterGet = require('./hooks/useMaterialRunboxRunboxIdStarterGet.js');
|
|
@@ -277,28 +278,30 @@ var MaterialRunboxContent = function MaterialRunboxContent(_ref) {
|
|
|
277
278
|
},
|
|
278
279
|
onRunboxRefetchRequest: refetch,
|
|
279
280
|
children: jsxRuntime.jsx(StyledRunboxContainer, {
|
|
280
|
-
children: jsxRuntime.
|
|
281
|
+
children: jsxRuntime.jsx(muiXSnackbar.SnackbarProvider, {
|
|
281
282
|
domRoot: snackbarRoot !== null && snackbarRoot !== void 0 ? snackbarRoot : document.body,
|
|
282
283
|
classes: {
|
|
283
284
|
containerRoot: SNACKBAR_CONTAINER_CLASS
|
|
284
285
|
},
|
|
285
|
-
children:
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
286
|
+
children: jsxRuntime.jsxs(MaterialRunboxControlContext.default, Object.assign({}, props, {
|
|
287
|
+
children: [jsxRuntime.jsx(MaterialRunboxHeader.default, Object.assign({}, props, {
|
|
288
|
+
hideTimerPopover: hideTimerPopover
|
|
289
|
+
})), jsxRuntime.jsx(MaterialRunboxAlert.default, {
|
|
290
|
+
runbox: runbox,
|
|
291
|
+
courseId: courseId,
|
|
292
|
+
studentUserId: studentUserId,
|
|
293
|
+
userId: userId,
|
|
294
|
+
isTutoring: isTutoring
|
|
295
|
+
}), jsxRuntime.jsx(MaterialRunboxDiskUsageAlert.default, {
|
|
296
|
+
runtimeTemplateId: runtimeTemplate.id,
|
|
297
|
+
courseId: courseId,
|
|
298
|
+
userId: studentUserId
|
|
299
|
+
}), jsxRuntime.jsx(MaterialRunboxDiskUsageDialog.default, {
|
|
300
|
+
runboxId: runbox.id
|
|
301
|
+
}), jsxRuntime.jsx(MaterialRunboxBody.default, Object.assign({
|
|
302
|
+
setSnackbarRoot: setSnackbarRoot
|
|
303
|
+
}, props))]
|
|
304
|
+
}))
|
|
302
305
|
})
|
|
303
306
|
})
|
|
304
307
|
})
|
|
@@ -23,7 +23,6 @@ var MaterialRunboxApiContext = require('./contexts/MaterialRunboxApiContext.js')
|
|
|
23
23
|
var MaterialRunboxTimer = require('./timer/MaterialRunboxTimer.js');
|
|
24
24
|
var MaterialRunboxStatusButton = require('./status/MaterialRunboxStatusButton.js');
|
|
25
25
|
var useBreakpoint = require('../shared/hooks/useBreakpoint.js');
|
|
26
|
-
var useRunboxControl = require('./hooks/useRunboxControl.js');
|
|
27
26
|
|
|
28
27
|
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
29
28
|
|
|
@@ -71,16 +70,6 @@ var MaterialRunboxHeader = function MaterialRunboxHeader(_ref4) {
|
|
|
71
70
|
var _useEliceRunboxRunnin = runboxClient.useEliceRunboxRunning(),
|
|
72
71
|
status = _useEliceRunboxRunnin.status;
|
|
73
72
|
var isRunboxRunning = status === 'running';
|
|
74
|
-
var _useRunboxControl = useRunboxControl.useRunboxControl({
|
|
75
|
-
runbox: runbox,
|
|
76
|
-
runtime: runtime,
|
|
77
|
-
courseId: courseId,
|
|
78
|
-
refetch: refetch,
|
|
79
|
-
userId: userId,
|
|
80
|
-
studentUserId: studentUserId,
|
|
81
|
-
isTutoring: isTutoring
|
|
82
|
-
}),
|
|
83
|
-
stopRuntime = _useRunboxControl.stop;
|
|
84
73
|
//
|
|
85
74
|
var _useQuery = reactQuery.useQuery({
|
|
86
75
|
queryKey: ['getGlobalOrganizationGet', orgNameShort],
|
|
@@ -211,7 +200,6 @@ var MaterialRunboxHeader = function MaterialRunboxHeader(_ref4) {
|
|
|
211
200
|
studentUserId: studentUserId,
|
|
212
201
|
isTutoring: isTutoring,
|
|
213
202
|
enableAutoShutdown: enableAutoShutdown,
|
|
214
|
-
stopRuntime: stopRuntime,
|
|
215
203
|
menuAnchorEl: menuAnchorEl,
|
|
216
204
|
refetch: refetch,
|
|
217
205
|
handleMenuClose: handleMenuClose,
|
|
@@ -226,9 +214,7 @@ var MaterialRunboxHeader = function MaterialRunboxHeader(_ref4) {
|
|
|
226
214
|
if (isTutoring) {
|
|
227
215
|
return null;
|
|
228
216
|
}
|
|
229
|
-
return jsxRuntime.jsx(MaterialRunboxActionDisconnect.default, {
|
|
230
|
-
stopRuntime: stopRuntime
|
|
231
|
-
});
|
|
217
|
+
return jsxRuntime.jsx(MaterialRunboxActionDisconnect.default, {});
|
|
232
218
|
};
|
|
233
219
|
//
|
|
234
220
|
//
|
|
@@ -239,7 +225,6 @@ var MaterialRunboxHeader = function MaterialRunboxHeader(_ref4) {
|
|
|
239
225
|
runboxId: runbox.id,
|
|
240
226
|
userId: userId,
|
|
241
227
|
headerElement: headerRef.current,
|
|
242
|
-
stopRuntime: stopRuntime,
|
|
243
228
|
hideTimerPopover: hideTimerPopover,
|
|
244
229
|
isTutoring: isTutoring
|
|
245
230
|
}) : null, jsxRuntime.jsx(MaterialRunboxStatusButton.default, {
|
|
@@ -1,6 +1,3 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
|
|
3
|
-
stopRuntime: () => Promise<void>;
|
|
4
|
-
}
|
|
5
|
-
declare const MaterialRunboxActionDisconnect: React.FC<MaterialRunboxActionDisconnectProps>;
|
|
2
|
+
declare const MaterialRunboxActionDisconnect: React.FC;
|
|
6
3
|
export default MaterialRunboxActionDisconnect;
|
|
@@ -12,6 +12,7 @@ var proSolidSvgIcons = require('@fortawesome/pro-solid-svg-icons');
|
|
|
12
12
|
var material = require('@mui/material');
|
|
13
13
|
var MaterialRunboxActionDisconnectDialog = require('./MaterialRunboxActionDisconnectDialog.js');
|
|
14
14
|
var useBreakpoint = require('../../shared/hooks/useBreakpoint.js');
|
|
15
|
+
var MaterialRunboxControlContext = require('../contexts/MaterialRunboxControlContext.js');
|
|
15
16
|
|
|
16
17
|
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
17
18
|
|
|
@@ -20,14 +21,15 @@ var React__default = /*#__PURE__*/_interopDefaultCompat(React);
|
|
|
20
21
|
//
|
|
21
22
|
//
|
|
22
23
|
//
|
|
23
|
-
var MaterialRunboxActionDisconnect = function MaterialRunboxActionDisconnect(
|
|
24
|
-
var stopRuntime = _ref.stopRuntime;
|
|
24
|
+
var MaterialRunboxActionDisconnect = function MaterialRunboxActionDisconnect() {
|
|
25
25
|
var intl$1 = intl.useRawEliceIntl();
|
|
26
26
|
var isSmallTabletOrSmaller = useBreakpoint.useBreakpoint('md', 'down');
|
|
27
27
|
var isMobileOrSmaller = useBreakpoint.useBreakpoint('sm', 'down');
|
|
28
28
|
var _useEliceRunboxRunnin = runboxClient.useEliceRunboxRunning(),
|
|
29
29
|
status = _useEliceRunboxRunnin.status;
|
|
30
30
|
var isRunboxTerminated = status === 'terminated';
|
|
31
|
+
var _useMaterialRunboxCon = MaterialRunboxControlContext.useMaterialRunboxControlContext(),
|
|
32
|
+
stopRuntime = _useMaterialRunboxCon.stop;
|
|
31
33
|
var _React$useState = React__default.default.useState(false),
|
|
32
34
|
_React$useState2 = _rollupPluginBabelHelpers.slicedToArray(_React$useState, 2),
|
|
33
35
|
isDisconnectDialogOpen = _React$useState2[0],
|
|
@@ -1,6 +1,3 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
|
|
3
|
-
stopRuntime: () => Promise<void>;
|
|
4
|
-
}
|
|
5
|
-
declare const MaterialRunboxActionDisconnectMenuItem: React.FC<MaterialRunboxActionDisconnectMenuItemProps>;
|
|
2
|
+
declare const MaterialRunboxActionDisconnectMenuItem: React.FC;
|
|
6
3
|
export default MaterialRunboxActionDisconnectMenuItem;
|
|
@@ -12,6 +12,7 @@ var proSolidSvgIcons = require('@fortawesome/pro-solid-svg-icons');
|
|
|
12
12
|
var lab = require('@mui/lab');
|
|
13
13
|
var material = require('@mui/material');
|
|
14
14
|
var MaterialRunboxActionDisconnectDialog = require('./MaterialRunboxActionDisconnectDialog.js');
|
|
15
|
+
var MaterialRunboxControlContext = require('../contexts/MaterialRunboxControlContext.js');
|
|
15
16
|
|
|
16
17
|
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
17
18
|
|
|
@@ -20,44 +21,36 @@ var React__default = /*#__PURE__*/_interopDefaultCompat(React);
|
|
|
20
21
|
//
|
|
21
22
|
//
|
|
22
23
|
//
|
|
23
|
-
var MaterialRunboxActionDisconnectMenuItem = function MaterialRunboxActionDisconnectMenuItem(
|
|
24
|
-
var stopRuntime = _ref.stopRuntime;
|
|
24
|
+
var MaterialRunboxActionDisconnectMenuItem = function MaterialRunboxActionDisconnectMenuItem() {
|
|
25
25
|
var intl$1 = intl.useRawEliceIntl();
|
|
26
26
|
var _useEliceRunboxRunnin = runboxClient.useEliceRunboxRunning(),
|
|
27
27
|
status = _useEliceRunboxRunnin.status;
|
|
28
28
|
var isRunboxTerminated = status === 'terminated';
|
|
29
|
+
var _useMaterialRunboxCon = MaterialRunboxControlContext.useMaterialRunboxControlContext(),
|
|
30
|
+
stopRuntime = _useMaterialRunboxCon.stop,
|
|
31
|
+
isStopping = _useMaterialRunboxCon.isStopping;
|
|
29
32
|
var _React$useState = React__default.default.useState(false),
|
|
30
33
|
_React$useState2 = _rollupPluginBabelHelpers.slicedToArray(_React$useState, 2),
|
|
31
34
|
isDisconnectDialogOpen = _React$useState2[0],
|
|
32
35
|
setDisconnectDialogOpen = _React$useState2[1];
|
|
33
|
-
var _React$useState3 = React__default.default.useState(false),
|
|
34
|
-
_React$useState4 = _rollupPluginBabelHelpers.slicedToArray(_React$useState3, 2),
|
|
35
|
-
isStopRuntimeLoading = _React$useState4[0],
|
|
36
|
-
setStopRuntimeLoading = _React$useState4[1];
|
|
37
36
|
/**
|
|
38
37
|
*
|
|
39
38
|
*/
|
|
40
39
|
var handleConfirmDisconnect = /*#__PURE__*/function () {
|
|
41
|
-
var
|
|
40
|
+
var _ref = _rollupPluginBabelHelpers.asyncToGenerator(/*#__PURE__*/_rollupPluginBabelHelpers.regenerator().m(function _callee() {
|
|
42
41
|
return _rollupPluginBabelHelpers.regenerator().w(function (_context) {
|
|
43
|
-
while (1) switch (_context.
|
|
42
|
+
while (1) switch (_context.n) {
|
|
44
43
|
case 0:
|
|
45
44
|
setDisconnectDialogOpen(false);
|
|
46
|
-
|
|
47
|
-
_context.p = 1;
|
|
48
|
-
_context.n = 2;
|
|
45
|
+
_context.n = 1;
|
|
49
46
|
return stopRuntime();
|
|
50
|
-
case
|
|
51
|
-
_context.p = 2;
|
|
52
|
-
setStopRuntimeLoading(false);
|
|
53
|
-
return _context.f(2);
|
|
54
|
-
case 3:
|
|
47
|
+
case 1:
|
|
55
48
|
return _context.a(2);
|
|
56
49
|
}
|
|
57
|
-
}, _callee
|
|
50
|
+
}, _callee);
|
|
58
51
|
}));
|
|
59
52
|
return function handleConfirmDisconnect() {
|
|
60
|
-
return
|
|
53
|
+
return _ref.apply(this, arguments);
|
|
61
54
|
};
|
|
62
55
|
}();
|
|
63
56
|
//
|
|
@@ -65,9 +58,10 @@ var MaterialRunboxActionDisconnectMenuItem = function MaterialRunboxActionDiscon
|
|
|
65
58
|
//
|
|
66
59
|
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
67
60
|
children: [jsxRuntime.jsxs(material.MenuItem, {
|
|
61
|
+
fullWidth: true,
|
|
68
62
|
component: lab.LoadingButton,
|
|
69
63
|
color: "inherit",
|
|
70
|
-
loading:
|
|
64
|
+
loading: isStopping,
|
|
71
65
|
disabled: isRunboxTerminated,
|
|
72
66
|
onClick: function onClick() {
|
|
73
67
|
return setDisconnectDialogOpen(true);
|
|
@@ -4,7 +4,6 @@ type MaterialRunboxActionMenuProps = Pick<RuntimeProps, 'runbox' | 'runtime' | '
|
|
|
4
4
|
menuAnchorEl: null | HTMLButtonElement;
|
|
5
5
|
/** Whether the auto-shutdown toggle is available. Decided by the header. */
|
|
6
6
|
enableAutoShutdown?: boolean;
|
|
7
|
-
stopRuntime: () => Promise<void>;
|
|
8
7
|
handleMenuClose: () => void;
|
|
9
8
|
};
|
|
10
9
|
declare const MaterialRunboxActionMenu: React.FC<MaterialRunboxActionMenuProps>;
|
|
@@ -34,7 +34,6 @@ var MaterialRunboxActionMenu = function MaterialRunboxActionMenu(_ref) {
|
|
|
34
34
|
isTutoring = _ref.isTutoring,
|
|
35
35
|
_ref$enableAutoShutdo = _ref.enableAutoShutdown,
|
|
36
36
|
enableAutoShutdown = _ref$enableAutoShutdo === void 0 ? false : _ref$enableAutoShutdo,
|
|
37
|
-
stopRuntime = _ref.stopRuntime,
|
|
38
37
|
menuAnchorEl = _ref.menuAnchorEl,
|
|
39
38
|
refetch = _ref.refetch,
|
|
40
39
|
getAchievementColor = _ref.getAchievementColor,
|
|
@@ -116,12 +115,7 @@ var MaterialRunboxActionMenu = function MaterialRunboxActionMenu(_ref) {
|
|
|
116
115
|
}) : null, jsxRuntime.jsx(MaterialRunboxActionShare.default, {
|
|
117
116
|
handleMenuClose: handleMenuClose
|
|
118
117
|
}), jsxRuntime.jsx(MaterialRunboxActionRestart.default, {
|
|
119
|
-
runbox: runbox,
|
|
120
|
-
runtime: runtime,
|
|
121
|
-
courseId: courseId,
|
|
122
118
|
envMode: envMode,
|
|
123
|
-
studentUserId: studentUserId,
|
|
124
|
-
refetch: refetch,
|
|
125
119
|
handleMenuClose: handleMenuClose
|
|
126
120
|
}), isTutoring && studentUserId ? jsxRuntime.jsx(MaterialRunboxActionSubmitLog.default, {
|
|
127
121
|
runboxId: runbox === null || runbox === void 0 ? void 0 : runbox.id,
|
|
@@ -134,9 +128,7 @@ var MaterialRunboxActionMenu = function MaterialRunboxActionMenu(_ref) {
|
|
|
134
128
|
courseId: courseId,
|
|
135
129
|
envMode: envMode,
|
|
136
130
|
handleMenuClose: handleMenuClose
|
|
137
|
-
}), isMobileOrSmaller && !isTutoring ? jsxRuntime.jsx(MaterialRunboxActionDisconnectMenuItem.default, {
|
|
138
|
-
stopRuntime: stopRuntime
|
|
139
|
-
}) : null]
|
|
131
|
+
}), isMobileOrSmaller && !isTutoring ? jsxRuntime.jsx(MaterialRunboxActionDisconnectMenuItem.default, {}) : null]
|
|
140
132
|
});
|
|
141
133
|
};
|
|
142
134
|
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { enums } from '@elice/types';
|
|
3
|
-
|
|
4
|
-
type MaterialRunboxActionRestartProps = Pick<RuntimeProps, 'runbox' | 'runtime' | 'courseId' | 'refetch' | 'studentUserId'> & {
|
|
3
|
+
type MaterialRunboxActionRestartProps = {
|
|
5
4
|
envMode: enums.LeaderboardEnvModeType;
|
|
6
5
|
handleMenuClose: () => void;
|
|
7
6
|
};
|
|
@@ -11,7 +11,7 @@ var types = require('@elice/types');
|
|
|
11
11
|
var proSolidSvgIcons = require('@fortawesome/pro-solid-svg-icons');
|
|
12
12
|
var lab = require('@mui/lab');
|
|
13
13
|
var material = require('@mui/material');
|
|
14
|
-
var
|
|
14
|
+
var MaterialRunboxControlContext = require('../contexts/MaterialRunboxControlContext.js');
|
|
15
15
|
|
|
16
16
|
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
17
17
|
|
|
@@ -21,31 +21,16 @@ var React__default = /*#__PURE__*/_interopDefaultCompat(React);
|
|
|
21
21
|
//
|
|
22
22
|
//
|
|
23
23
|
var MaterialRunboxActionRestart = function MaterialRunboxActionRestart(_ref) {
|
|
24
|
-
var
|
|
25
|
-
runtime = _ref.runtime,
|
|
26
|
-
courseId = _ref.courseId,
|
|
27
|
-
refetch = _ref.refetch,
|
|
28
|
-
studentUserId = _ref.studentUserId,
|
|
29
|
-
envMode = _ref.envMode,
|
|
24
|
+
var envMode = _ref.envMode,
|
|
30
25
|
handleMenuClose = _ref.handleMenuClose;
|
|
31
26
|
var intl$1 = intl.useRawEliceIntl();
|
|
32
27
|
var _React$useState = React__default.default.useState(false),
|
|
33
28
|
_React$useState2 = _rollupPluginBabelHelpers.slicedToArray(_React$useState, 2),
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
var
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
setDialogOpened = _React$useState4[1];
|
|
40
|
-
// restart
|
|
41
|
-
var _useRunboxControl = useRunboxControl.useRunboxControl({
|
|
42
|
-
runbox: runbox,
|
|
43
|
-
runtime: runtime,
|
|
44
|
-
courseId: courseId,
|
|
45
|
-
refetch: refetch,
|
|
46
|
-
userId: studentUserId
|
|
47
|
-
}),
|
|
48
|
-
start = _useRunboxControl.start;
|
|
29
|
+
isDialogOpened = _React$useState2[0],
|
|
30
|
+
setDialogOpened = _React$useState2[1];
|
|
31
|
+
var _useMaterialRunboxCon = MaterialRunboxControlContext.useMaterialRunboxControlContext(),
|
|
32
|
+
start = _useMaterialRunboxCon.start,
|
|
33
|
+
isStarting = _useMaterialRunboxCon.isStarting;
|
|
49
34
|
/**
|
|
50
35
|
*
|
|
51
36
|
*/
|
|
@@ -56,7 +41,6 @@ var MaterialRunboxActionRestart = function MaterialRunboxActionRestart(_ref) {
|
|
|
56
41
|
*
|
|
57
42
|
*/
|
|
58
43
|
var handleRestartAction = function handleRestartAction() {
|
|
59
|
-
setIsLoading(true);
|
|
60
44
|
start({
|
|
61
45
|
force: true
|
|
62
46
|
})["catch"](function () {
|
|
@@ -64,7 +48,6 @@ var MaterialRunboxActionRestart = function MaterialRunboxActionRestart(_ref) {
|
|
|
64
48
|
})["finally"](function () {
|
|
65
49
|
handleDialogClose();
|
|
66
50
|
handleMenuClose();
|
|
67
|
-
setIsLoading(false);
|
|
68
51
|
});
|
|
69
52
|
};
|
|
70
53
|
/**
|
|
@@ -116,7 +99,7 @@ var MaterialRunboxActionRestart = function MaterialRunboxActionRestart(_ref) {
|
|
|
116
99
|
}), jsxRuntime.jsxs(material.DialogActions, {
|
|
117
100
|
children: [jsxRuntime.jsx(material.Button, {
|
|
118
101
|
color: "inherit",
|
|
119
|
-
disabled:
|
|
102
|
+
disabled: isStarting,
|
|
120
103
|
onClick: handleDialogClose,
|
|
121
104
|
children: intl$1.formatMessage({
|
|
122
105
|
id: 'runbox.common.close'
|
|
@@ -124,7 +107,7 @@ var MaterialRunboxActionRestart = function MaterialRunboxActionRestart(_ref) {
|
|
|
124
107
|
}), jsxRuntime.jsx(lab.LoadingButton, {
|
|
125
108
|
variant: "contained",
|
|
126
109
|
color: "warning",
|
|
127
|
-
loading:
|
|
110
|
+
loading: isStarting,
|
|
128
111
|
onClick: handleRestartAction,
|
|
129
112
|
children: intl$1.formatMessage({
|
|
130
113
|
id: 'runbox.action.restart.dialog.actions.confirm'
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { UseRunboxControlProps, UseRunboxControlReturn } from '../hooks/useRunboxControl';
|
|
3
|
+
export type MaterialRunboxControlContextValue = UseRunboxControlReturn;
|
|
4
|
+
export interface MaterialRunboxControlContextProps extends UseRunboxControlProps {
|
|
5
|
+
children?: React.ReactNode;
|
|
6
|
+
}
|
|
7
|
+
export declare const MaterialRunboxControlContext: React.Context<UseRunboxControlReturn>;
|
|
8
|
+
export declare const useMaterialRunboxControlContext: () => UseRunboxControlReturn;
|
|
9
|
+
/**
|
|
10
|
+
* Owns the single `useRunboxControl` instance for one runbox, so every consumer
|
|
11
|
+
* shares one abort controller and one pre-check result.
|
|
12
|
+
*/
|
|
13
|
+
declare const MaterialRunboxControlContextProvider: React.FC<MaterialRunboxControlContextProps>;
|
|
14
|
+
export default MaterialRunboxControlContextProvider;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var tslib = require('tslib');
|
|
6
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
7
|
+
var React = require('react');
|
|
8
|
+
var useRunboxControl = require('../hooks/useRunboxControl.js');
|
|
9
|
+
|
|
10
|
+
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
11
|
+
|
|
12
|
+
var React__default = /*#__PURE__*/_interopDefaultCompat(React);
|
|
13
|
+
|
|
14
|
+
//
|
|
15
|
+
//
|
|
16
|
+
//
|
|
17
|
+
var MaterialRunboxControlContext = React__default.default.createContext({});
|
|
18
|
+
var useMaterialRunboxControlContext = function useMaterialRunboxControlContext() {
|
|
19
|
+
return React__default.default.useContext(MaterialRunboxControlContext);
|
|
20
|
+
};
|
|
21
|
+
//
|
|
22
|
+
//
|
|
23
|
+
//
|
|
24
|
+
/**
|
|
25
|
+
* Owns the single `useRunboxControl` instance for one runbox, so every consumer
|
|
26
|
+
* shares one abort controller and one pre-check result.
|
|
27
|
+
*/
|
|
28
|
+
var MaterialRunboxControlContextProvider = function MaterialRunboxControlContextProvider(_a) {
|
|
29
|
+
var children = _a.children,
|
|
30
|
+
props = tslib.__rest(_a, ["children"]);
|
|
31
|
+
var _useRunboxControl = useRunboxControl.useRunboxControl(props),
|
|
32
|
+
start = _useRunboxControl.start,
|
|
33
|
+
stop = _useRunboxControl.stop,
|
|
34
|
+
isStarting = _useRunboxControl.isStarting,
|
|
35
|
+
isStopping = _useRunboxControl.isStopping,
|
|
36
|
+
preCheckStatus = _useRunboxControl.preCheckStatus;
|
|
37
|
+
// The hook hands back one mutated ref, so a stable value would leave
|
|
38
|
+
// consumers reading stale fields once anything below here is memoized.
|
|
39
|
+
var value = React__default.default.useMemo(function () {
|
|
40
|
+
return {
|
|
41
|
+
start: start,
|
|
42
|
+
stop: stop,
|
|
43
|
+
isStarting: isStarting,
|
|
44
|
+
isStopping: isStopping,
|
|
45
|
+
preCheckStatus: preCheckStatus
|
|
46
|
+
};
|
|
47
|
+
}, [start, stop, isStarting, isStopping, preCheckStatus]);
|
|
48
|
+
return jsxRuntime.jsx(MaterialRunboxControlContext.Provider, {
|
|
49
|
+
children: children,
|
|
50
|
+
value: value
|
|
51
|
+
});
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
exports.MaterialRunboxControlContext = MaterialRunboxControlContext;
|
|
55
|
+
exports.default = MaterialRunboxControlContextProvider;
|
|
56
|
+
exports.useMaterialRunboxControlContext = useMaterialRunboxControlContext;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
export { default as MaterialRunboxApiContextProvider, MaterialRunboxApiContext, useMaterialRunboxApiContext, } from './MaterialRunboxApiContext';
|
|
2
2
|
export { default as MaterialRunboxCommandContextProvider, MaterialRunboxCommandContext, useMaterialRunboxCommandContext, } from './MaterialRunboxCommandContext';
|
|
3
|
+
export { default as MaterialRunboxControlContextProvider, MaterialRunboxControlContext, useMaterialRunboxControlContext, } from './MaterialRunboxControlContext';
|
|
3
4
|
export { default as MaterialRunboxContextProvider, MaterialRunboxContext, useMaterialRunboxContext, } from './MaterialRunboxContext';
|
|
4
5
|
export type { MaterialRunboxApiContextProps, MaterialRunboxApiContextValue, } from './MaterialRunboxApiContext';
|
|
5
6
|
export type { MaterialRunboxCommandContextProps, MaterialRunboxCommandContextValue, } from './MaterialRunboxCommandContext';
|
|
6
7
|
export type { MaterialRunboxContextProps, MaterialRunboxContextValue, } from './MaterialRunboxContext';
|
|
8
|
+
export type { MaterialRunboxControlContextProps, MaterialRunboxControlContextValue, } from './MaterialRunboxControlContext';
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var MaterialRunboxApiContext = require('./MaterialRunboxApiContext.js');
|
|
4
4
|
var MaterialRunboxCommandContext = require('./MaterialRunboxCommandContext.js');
|
|
5
|
+
var MaterialRunboxControlContext = require('./MaterialRunboxControlContext.js');
|
|
5
6
|
var MaterialRunboxContext = require('./MaterialRunboxContext.js');
|
|
6
7
|
|
|
7
8
|
|
|
@@ -12,6 +13,9 @@ exports.useMaterialRunboxApiContext = MaterialRunboxApiContext.useMaterialRunbox
|
|
|
12
13
|
exports.MaterialRunboxCommandContext = MaterialRunboxCommandContext.MaterialRunboxCommandContext;
|
|
13
14
|
exports.MaterialRunboxCommandContextProvider = MaterialRunboxCommandContext.default;
|
|
14
15
|
exports.useMaterialRunboxCommandContext = MaterialRunboxCommandContext.useMaterialRunboxCommandContext;
|
|
16
|
+
exports.MaterialRunboxControlContext = MaterialRunboxControlContext.MaterialRunboxControlContext;
|
|
17
|
+
exports.MaterialRunboxControlContextProvider = MaterialRunboxControlContext.default;
|
|
18
|
+
exports.useMaterialRunboxControlContext = MaterialRunboxControlContext.useMaterialRunboxControlContext;
|
|
15
19
|
exports.MaterialRunboxContext = MaterialRunboxContext.MaterialRunboxContext;
|
|
16
20
|
exports.MaterialRunboxContextProvider = MaterialRunboxContext.default;
|
|
17
21
|
exports.useMaterialRunboxContext = MaterialRunboxContext.useMaterialRunboxContext;
|
|
@@ -4,7 +4,6 @@ export interface MaterialRunboxEnvResetButtonProps extends Omit<ButtonProps, 'on
|
|
|
4
4
|
runtimeTemplateId: string;
|
|
5
5
|
courseId: number;
|
|
6
6
|
userId?: number;
|
|
7
|
-
onSuccess?: () => void;
|
|
8
7
|
}
|
|
9
8
|
declare const MaterialRunboxEnvResetButton: React.FC<MaterialRunboxEnvResetButtonProps>;
|
|
10
9
|
export default MaterialRunboxEnvResetButton;
|
|
@@ -7,9 +7,11 @@ var tslib = require('tslib');
|
|
|
7
7
|
var jsxRuntime = require('react/jsx-runtime');
|
|
8
8
|
var React = require('react');
|
|
9
9
|
var intl = require('@elice/intl');
|
|
10
|
+
var muiXSnackbar = require('@elice/mui-x-snackbar');
|
|
10
11
|
var material = require('@mui/material');
|
|
11
12
|
var MaterialRunboxEnvResetDialog = require('./MaterialRunboxEnvResetDialog.js');
|
|
12
|
-
var
|
|
13
|
+
var MaterialRunboxApiContext = require('../contexts/MaterialRunboxApiContext.js');
|
|
14
|
+
var MaterialRunboxControlContext = require('../contexts/MaterialRunboxControlContext.js');
|
|
13
15
|
|
|
14
16
|
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
15
17
|
|
|
@@ -22,21 +24,99 @@ var MaterialRunboxEnvResetButton = function MaterialRunboxEnvResetButton(_a) {
|
|
|
22
24
|
var runtimeTemplateId = _a.runtimeTemplateId,
|
|
23
25
|
courseId = _a.courseId,
|
|
24
26
|
userId = _a.userId,
|
|
25
|
-
|
|
26
|
-
props = tslib.__rest(_a, ["runtimeTemplateId", "courseId", "userId", "onSuccess"]);
|
|
27
|
+
props = tslib.__rest(_a, ["runtimeTemplateId", "courseId", "userId"]);
|
|
27
28
|
var intl$1 = intl.useRawEliceIntl();
|
|
29
|
+
var _useSnackbar = muiXSnackbar.useSnackbar(),
|
|
30
|
+
enqueueSnackbar = _useSnackbar.enqueueSnackbar;
|
|
31
|
+
var materialRunboxApi = MaterialRunboxApiContext.useMaterialRunboxApiContext();
|
|
32
|
+
var _useMaterialRunboxCon = MaterialRunboxControlContext.useMaterialRunboxControlContext(),
|
|
33
|
+
startRuntime = _useMaterialRunboxCon.start;
|
|
28
34
|
var _React$useState = React__default.default.useState(false),
|
|
29
35
|
_React$useState2 = _rollupPluginBabelHelpers.slicedToArray(_React$useState, 2),
|
|
30
36
|
isDialogOpened = _React$useState2[0],
|
|
31
37
|
setDialogOpened = _React$useState2[1];
|
|
32
|
-
var
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
38
|
+
var _React$useState3 = React__default.default.useState(false),
|
|
39
|
+
_React$useState4 = _rollupPluginBabelHelpers.slicedToArray(_React$useState3, 2),
|
|
40
|
+
isResetting = _React$useState4[0],
|
|
41
|
+
setResetting = _React$useState4[1];
|
|
42
|
+
/**
|
|
43
|
+
*
|
|
44
|
+
*/
|
|
45
|
+
var handleConfirm = /*#__PURE__*/function () {
|
|
46
|
+
var _ref = _rollupPluginBabelHelpers.asyncToGenerator(/*#__PURE__*/_rollupPluginBabelHelpers.regenerator().m(function _callee() {
|
|
47
|
+
var _yield$materialRunbox, _yield$materialRunbox2, runtime;
|
|
48
|
+
return _rollupPluginBabelHelpers.regenerator().w(function (_context) {
|
|
49
|
+
while (1) switch (_context.p = _context.n) {
|
|
50
|
+
case 0:
|
|
51
|
+
setResetting(true);
|
|
52
|
+
_context.p = 1;
|
|
53
|
+
_context.n = 2;
|
|
54
|
+
return materialRunboxApi.runtime.runtimeGet({
|
|
55
|
+
filterRuntimeTemplateId: runtimeTemplateId,
|
|
56
|
+
skip: 0,
|
|
57
|
+
count: 1,
|
|
58
|
+
userId: userId,
|
|
59
|
+
eliceCourseId: courseId
|
|
60
|
+
});
|
|
61
|
+
case 2:
|
|
62
|
+
_yield$materialRunbox = _context.v;
|
|
63
|
+
_yield$materialRunbox2 = _rollupPluginBabelHelpers.slicedToArray(_yield$materialRunbox, 1);
|
|
64
|
+
runtime = _yield$materialRunbox2[0];
|
|
65
|
+
if (runtime) {
|
|
66
|
+
_context.n = 3;
|
|
67
|
+
break;
|
|
68
|
+
}
|
|
69
|
+
enqueueSnackbar(intl$1.formatMessage({
|
|
70
|
+
id: 'runbox.disk.env_reset.noti.no_runtime'
|
|
71
|
+
}), {
|
|
72
|
+
variant: 'error'
|
|
73
|
+
});
|
|
74
|
+
return _context.a(2);
|
|
75
|
+
case 3:
|
|
76
|
+
_context.n = 4;
|
|
77
|
+
return materialRunboxApi.runtime.runtimeRuntimeIdDiskResetPost({
|
|
78
|
+
runtimeId: runtime.id,
|
|
79
|
+
eliceCourseId: courseId
|
|
80
|
+
});
|
|
81
|
+
case 4:
|
|
82
|
+
setDialogOpened(false);
|
|
83
|
+
enqueueSnackbar(intl$1.formatMessage({
|
|
84
|
+
id: 'runbox.disk.env_reset.noti.success'
|
|
85
|
+
}), {
|
|
86
|
+
variant: 'success'
|
|
87
|
+
});
|
|
88
|
+
// The reset replaces the disk, which the server can only do with the
|
|
89
|
+
// runtime detached, so the session is always gone by now. Start it back
|
|
90
|
+
// up so the learner lands on the practice screen instead of a dead one.
|
|
91
|
+
_context.n = 5;
|
|
92
|
+
return startRuntime({
|
|
93
|
+
force: true,
|
|
94
|
+
runPreCheck: false
|
|
95
|
+
});
|
|
96
|
+
case 5:
|
|
97
|
+
_context.n = 7;
|
|
98
|
+
break;
|
|
99
|
+
case 6:
|
|
100
|
+
_context.p = 6;
|
|
101
|
+
_context.v;
|
|
102
|
+
enqueueSnackbar(intl$1.formatMessage({
|
|
103
|
+
id: 'runbox.disk.env_reset.noti.error'
|
|
104
|
+
}), {
|
|
105
|
+
variant: 'error'
|
|
106
|
+
});
|
|
107
|
+
case 7:
|
|
108
|
+
_context.p = 7;
|
|
109
|
+
setResetting(false);
|
|
110
|
+
return _context.f(7);
|
|
111
|
+
case 8:
|
|
112
|
+
return _context.a(2);
|
|
113
|
+
}
|
|
114
|
+
}, _callee, null, [[1, 6, 7, 8]]);
|
|
115
|
+
}));
|
|
116
|
+
return function handleConfirm() {
|
|
117
|
+
return _ref.apply(this, arguments);
|
|
118
|
+
};
|
|
119
|
+
}();
|
|
40
120
|
//
|
|
41
121
|
//
|
|
42
122
|
//
|
|
@@ -55,11 +135,7 @@ var MaterialRunboxEnvResetButton = function MaterialRunboxEnvResetButton(_a) {
|
|
|
55
135
|
return setDialogOpened(false);
|
|
56
136
|
},
|
|
57
137
|
onConfirm: function onConfirm() {
|
|
58
|
-
return void
|
|
59
|
-
runtimeTemplateId: runtimeTemplateId,
|
|
60
|
-
courseId: courseId,
|
|
61
|
-
userId: userId
|
|
62
|
-
});
|
|
138
|
+
return void handleConfirm();
|
|
63
139
|
}
|
|
64
140
|
})]
|
|
65
141
|
});
|
|
@@ -7,7 +7,6 @@ var useInfiniteRunboxRunboxIdGrade = require('./useInfiniteRunboxRunboxIdGrade.j
|
|
|
7
7
|
var useMaterialRunboxRunboxIdStarterGet = require('./useMaterialRunboxRunboxIdStarterGet.js');
|
|
8
8
|
var useRunboxNetworkStatus = require('./useRunboxNetworkStatus.js');
|
|
9
9
|
var useRunboxDiskUsage = require('./useRunboxDiskUsage.js');
|
|
10
|
-
var useRunboxEnvReset = require('./useRunboxEnvReset.js');
|
|
11
10
|
|
|
12
11
|
|
|
13
12
|
|
|
@@ -30,4 +29,3 @@ exports.useRunboxNetworkStatus = useRunboxNetworkStatus.useRunboxNetworkStatus;
|
|
|
30
29
|
exports.DISK_USAGE_ERROR_RATIO = useRunboxDiskUsage.DISK_USAGE_ERROR_RATIO;
|
|
31
30
|
exports.DISK_USAGE_WARNING_RATIO = useRunboxDiskUsage.DISK_USAGE_WARNING_RATIO;
|
|
32
31
|
exports.useRunboxDiskUsage = useRunboxDiskUsage.useRunboxDiskUsage;
|
|
33
|
-
exports.useRunboxEnvReset = useRunboxEnvReset.useRunboxEnvReset;
|
|
@@ -10,17 +10,18 @@ export type RunboxPreCheckResult = {
|
|
|
10
10
|
type: RunboxPreCheckResultType.RuntimeRunningOnOtherRunbox;
|
|
11
11
|
runningRunbox: RunningRunbox;
|
|
12
12
|
};
|
|
13
|
-
type UseRunboxControlProps = Pick<RuntimeProps, 'runbox' | 'runtime' | 'courseId' | 'refetch' | 'userId' | 'studentUserId' | 'isTutoring'>;
|
|
14
|
-
interface UseRunboxControlReturn {
|
|
13
|
+
export type UseRunboxControlProps = Pick<RuntimeProps, 'runbox' | 'runtime' | 'courseId' | 'refetch' | 'userId' | 'studentUserId' | 'isTutoring'>;
|
|
14
|
+
export interface UseRunboxControlReturn {
|
|
15
15
|
start: (args?: {
|
|
16
16
|
force?: boolean;
|
|
17
17
|
runPreCheck?: boolean;
|
|
18
18
|
}) => Promise<void>;
|
|
19
19
|
stop: () => Promise<void>;
|
|
20
|
+
isStarting: boolean;
|
|
21
|
+
isStopping: boolean;
|
|
20
22
|
preCheckStatus: RunboxPreCheckResult | null;
|
|
21
23
|
}
|
|
22
24
|
/**
|
|
23
25
|
* Hook for runbox control and status.
|
|
24
26
|
*/
|
|
25
27
|
export declare const useRunboxControl: (props: UseRunboxControlProps) => UseRunboxControlReturn;
|
|
26
|
-
export {};
|