@elice/material-runbox 1.260908.0 → 1.260910.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.
Files changed (185) hide show
  1. package/cjs/_virtual/_rollupPluginBabelHelpers.js +16 -0
  2. package/cjs/assets/runbox-loading.svg.js +7 -0
  3. package/cjs/components/material-runbox/MaterialRunbox.js +16 -11
  4. package/cjs/components/material-runbox/MaterialRunboxContent.d.ts +2 -0
  5. package/cjs/components/material-runbox/MaterialRunboxContent.js +93 -65
  6. package/cjs/components/material-runbox/MaterialRunboxHeader.js +55 -69
  7. package/cjs/components/material-runbox/actions/MaterialRunboxActionDisconnect.d.ts +1 -4
  8. package/cjs/components/material-runbox/actions/MaterialRunboxActionDisconnect.js +29 -2
  9. package/cjs/components/material-runbox/actions/MaterialRunboxActionDisconnectMenuItem.d.ts +3 -0
  10. package/cjs/components/material-runbox/actions/MaterialRunboxActionDisconnectMenuItem.js +90 -0
  11. package/cjs/components/material-runbox/actions/MaterialRunboxActionMenu.d.ts +3 -1
  12. package/cjs/components/material-runbox/actions/MaterialRunboxActionMenu.js +26 -7
  13. package/cjs/components/material-runbox/actions/MaterialRunboxActionRestart.d.ts +1 -2
  14. package/cjs/components/material-runbox/actions/MaterialRunboxActionRestart.js +9 -26
  15. package/cjs/components/material-runbox/contexts/MaterialRunboxControlContext.d.ts +14 -0
  16. package/cjs/components/material-runbox/contexts/MaterialRunboxControlContext.js +56 -0
  17. package/cjs/components/material-runbox/contexts/index.d.ts +2 -0
  18. package/cjs/components/material-runbox/contexts/index.js +4 -0
  19. package/cjs/components/material-runbox/disk/MaterialRunboxDiskUsageAlert.d.ts +13 -0
  20. package/cjs/components/material-runbox/disk/MaterialRunboxDiskUsageAlert.js +71 -0
  21. package/cjs/components/material-runbox/disk/MaterialRunboxDiskUsageDialog.d.ts +10 -0
  22. package/cjs/components/material-runbox/disk/MaterialRunboxDiskUsageDialog.js +98 -0
  23. package/cjs/components/material-runbox/disk/MaterialRunboxEnvResetButton.d.ts +10 -0
  24. package/cjs/components/material-runbox/disk/MaterialRunboxEnvResetButton.js +151 -0
  25. package/cjs/components/material-runbox/disk/MaterialRunboxEnvResetDialog.d.ts +13 -0
  26. package/cjs/components/material-runbox/disk/MaterialRunboxEnvResetDialog.js +98 -0
  27. package/cjs/components/material-runbox/disk/index.d.ts +8 -1
  28. package/cjs/components/material-runbox/disk/index.js +8 -2
  29. package/cjs/components/material-runbox/hooks/index.d.ts +3 -0
  30. package/cjs/components/material-runbox/hooks/index.js +14 -0
  31. package/cjs/components/material-runbox/hooks/useRunboxControl.d.ts +4 -3
  32. package/cjs/components/material-runbox/hooks/useRunboxControl.js +43 -14
  33. package/cjs/components/material-runbox/hooks/useRunboxDiskUsage.d.ts +16 -0
  34. package/cjs/components/material-runbox/hooks/useRunboxDiskUsage.js +50 -0
  35. package/cjs/components/material-runbox/hooks/useRunboxNetworkStatus.d.ts +14 -0
  36. package/cjs/components/material-runbox/hooks/useRunboxNetworkStatus.js +65 -0
  37. package/cjs/components/material-runbox/hooks/useRunboxSessionEndWarning.d.ts +18 -0
  38. package/cjs/components/material-runbox/hooks/useRunboxSessionEndWarning.js +67 -0
  39. package/cjs/components/material-runbox/locales/en.json.js +1 -1
  40. package/cjs/components/material-runbox/locales/ja.json.js +1 -1
  41. package/cjs/components/material-runbox/locales/ko.json.js +1 -1
  42. package/cjs/components/material-runbox/locales/th.json.js +1 -1
  43. package/cjs/components/material-runbox/runtime/Runtime.js +21 -18
  44. package/cjs/components/material-runbox/runtime/RuntimeChangeMaterialDialog.d.ts +0 -1
  45. package/cjs/components/material-runbox/runtime/RuntimeChangeMaterialDialog.js +9 -3
  46. package/cjs/components/material-runbox/runtime/RuntimeOverlayAssigned.d.ts +5 -3
  47. package/cjs/components/material-runbox/runtime/RuntimeOverlayAssigned.js +6 -54
  48. package/cjs/components/material-runbox/runtime/RuntimeOverlayConflicted.d.ts +0 -1
  49. package/cjs/components/material-runbox/runtime/RuntimeOverlayConflicted.js +68 -64
  50. package/cjs/components/material-runbox/runtime/RuntimeOverlayLoading.d.ts +9 -0
  51. package/cjs/components/material-runbox/runtime/RuntimeOverlayLoading.js +283 -0
  52. package/cjs/components/material-runbox/runtime/RuntimeOverlayQueued.d.ts +5 -3
  53. package/cjs/components/material-runbox/runtime/RuntimeOverlayQueued.js +6 -64
  54. package/cjs/components/material-runbox/runtime/RuntimeOverlayTerminated.d.ts +4 -1
  55. package/cjs/components/material-runbox/runtime/RuntimeOverlayTerminated.js +92 -70
  56. package/cjs/components/material-runbox/runtime/runtime-loading-tips.d.ts +7 -0
  57. package/cjs/components/material-runbox/runtime/runtime-loading-tips.js +148 -0
  58. package/cjs/components/material-runbox/status/MaterialRunboxStatusButton.d.ts +15 -0
  59. package/cjs/components/material-runbox/status/MaterialRunboxStatusButton.js +117 -0
  60. package/cjs/components/material-runbox/status/MaterialRunboxStatusConnectionItem.d.ts +12 -0
  61. package/cjs/components/material-runbox/status/MaterialRunboxStatusConnectionItem.js +35 -0
  62. package/cjs/components/material-runbox/status/MaterialRunboxStatusPopover.d.ts +14 -0
  63. package/cjs/components/material-runbox/status/MaterialRunboxStatusPopover.js +161 -0
  64. package/cjs/components/material-runbox/status/MaterialRunboxStatusResourceItem.d.ts +11 -0
  65. package/cjs/components/material-runbox/status/MaterialRunboxStatusResourceItem.js +41 -0
  66. package/cjs/components/material-runbox/status/index.d.ts +4 -0
  67. package/cjs/components/material-runbox/status/index.js +9 -0
  68. package/cjs/components/material-runbox/theme.d.ts +2 -0
  69. package/cjs/components/material-runbox/theme.js +15 -0
  70. package/cjs/components/material-runbox/timer/MaterialRunboxQuotaAlmostEndDialog.d.ts +11 -0
  71. package/cjs/components/material-runbox/timer/MaterialRunboxQuotaAlmostEndDialog.js +125 -0
  72. package/cjs/components/material-runbox/timer/MaterialRunboxQuotaAmount.d.ts +13 -0
  73. package/cjs/components/material-runbox/timer/MaterialRunboxQuotaAmount.js +56 -0
  74. package/cjs/components/material-runbox/timer/MaterialRunboxQuotaPerSessionAlmostEndDialog.d.ts +12 -0
  75. package/cjs/components/material-runbox/timer/MaterialRunboxQuotaPerSessionAlmostEndDialog.js +126 -0
  76. package/cjs/components/material-runbox/timer/MaterialRunboxQuotaTimePart.d.ts +15 -0
  77. package/cjs/components/material-runbox/timer/MaterialRunboxQuotaTimePart.js +50 -0
  78. package/cjs/components/material-runbox/timer/MaterialRunboxTimer.d.ts +6 -1
  79. package/cjs/components/material-runbox/timer/MaterialRunboxTimer.js +26 -18
  80. package/cjs/components/material-runbox/timer/MaterialRunboxTimerDetailPopover.js +21 -81
  81. package/cjs/components/shared/hooks/index.d.ts +1 -0
  82. package/cjs/components/shared/hooks/index.js +7 -0
  83. package/cjs/components/shared/hooks/useBreakpoint.d.ts +4 -0
  84. package/cjs/components/shared/hooks/useBreakpoint.js +12 -0
  85. package/es/_virtual/_rollupPluginBabelHelpers.js +13 -1
  86. package/es/assets/runbox-loading.svg.js +3 -0
  87. package/es/components/material-runbox/MaterialRunbox.js +16 -11
  88. package/es/components/material-runbox/MaterialRunboxContent.d.ts +2 -0
  89. package/es/components/material-runbox/MaterialRunboxContent.js +94 -66
  90. package/es/components/material-runbox/MaterialRunboxHeader.js +56 -70
  91. package/es/components/material-runbox/actions/MaterialRunboxActionDisconnect.d.ts +1 -4
  92. package/es/components/material-runbox/actions/MaterialRunboxActionDisconnect.js +30 -3
  93. package/es/components/material-runbox/actions/MaterialRunboxActionDisconnectMenuItem.d.ts +3 -0
  94. package/es/components/material-runbox/actions/MaterialRunboxActionDisconnectMenuItem.js +82 -0
  95. package/es/components/material-runbox/actions/MaterialRunboxActionMenu.d.ts +3 -1
  96. package/es/components/material-runbox/actions/MaterialRunboxActionMenu.js +28 -9
  97. package/es/components/material-runbox/actions/MaterialRunboxActionRestart.d.ts +1 -2
  98. package/es/components/material-runbox/actions/MaterialRunboxActionRestart.js +9 -26
  99. package/es/components/material-runbox/contexts/MaterialRunboxControlContext.d.ts +14 -0
  100. package/es/components/material-runbox/contexts/MaterialRunboxControlContext.js +46 -0
  101. package/es/components/material-runbox/contexts/index.d.ts +2 -0
  102. package/es/components/material-runbox/contexts/index.js +1 -0
  103. package/es/components/material-runbox/disk/MaterialRunboxDiskUsageAlert.d.ts +13 -0
  104. package/es/components/material-runbox/disk/MaterialRunboxDiskUsageAlert.js +67 -0
  105. package/es/components/material-runbox/disk/MaterialRunboxDiskUsageDialog.d.ts +10 -0
  106. package/es/components/material-runbox/disk/MaterialRunboxDiskUsageDialog.js +94 -0
  107. package/es/components/material-runbox/disk/MaterialRunboxEnvResetButton.d.ts +10 -0
  108. package/es/components/material-runbox/disk/MaterialRunboxEnvResetButton.js +143 -0
  109. package/es/components/material-runbox/disk/MaterialRunboxEnvResetDialog.d.ts +13 -0
  110. package/es/components/material-runbox/disk/MaterialRunboxEnvResetDialog.js +90 -0
  111. package/es/components/material-runbox/disk/index.d.ts +8 -1
  112. package/es/components/material-runbox/disk/index.js +4 -1
  113. package/es/components/material-runbox/hooks/index.d.ts +3 -0
  114. package/es/components/material-runbox/hooks/index.js +3 -0
  115. package/es/components/material-runbox/hooks/useRunboxControl.d.ts +4 -3
  116. package/es/components/material-runbox/hooks/useRunboxControl.js +43 -14
  117. package/es/components/material-runbox/hooks/useRunboxDiskUsage.d.ts +16 -0
  118. package/es/components/material-runbox/hooks/useRunboxDiskUsage.js +42 -0
  119. package/es/components/material-runbox/hooks/useRunboxNetworkStatus.d.ts +14 -0
  120. package/es/components/material-runbox/hooks/useRunboxNetworkStatus.js +59 -0
  121. package/es/components/material-runbox/hooks/useRunboxSessionEndWarning.d.ts +18 -0
  122. package/es/components/material-runbox/hooks/useRunboxSessionEndWarning.js +63 -0
  123. package/es/components/material-runbox/locales/en.json.js +1 -1
  124. package/es/components/material-runbox/locales/ja.json.js +1 -1
  125. package/es/components/material-runbox/locales/ko.json.js +1 -1
  126. package/es/components/material-runbox/locales/th.json.js +1 -1
  127. package/es/components/material-runbox/runtime/Runtime.js +22 -19
  128. package/es/components/material-runbox/runtime/RuntimeChangeMaterialDialog.d.ts +0 -1
  129. package/es/components/material-runbox/runtime/RuntimeChangeMaterialDialog.js +9 -3
  130. package/es/components/material-runbox/runtime/RuntimeOverlayAssigned.d.ts +5 -3
  131. package/es/components/material-runbox/runtime/RuntimeOverlayAssigned.js +7 -55
  132. package/es/components/material-runbox/runtime/RuntimeOverlayConflicted.d.ts +0 -1
  133. package/es/components/material-runbox/runtime/RuntimeOverlayConflicted.js +69 -65
  134. package/es/components/material-runbox/runtime/RuntimeOverlayLoading.d.ts +9 -0
  135. package/es/components/material-runbox/runtime/RuntimeOverlayLoading.js +275 -0
  136. package/es/components/material-runbox/runtime/RuntimeOverlayQueued.d.ts +5 -3
  137. package/es/components/material-runbox/runtime/RuntimeOverlayQueued.js +7 -65
  138. package/es/components/material-runbox/runtime/RuntimeOverlayTerminated.d.ts +4 -1
  139. package/es/components/material-runbox/runtime/RuntimeOverlayTerminated.js +82 -60
  140. package/es/components/material-runbox/runtime/runtime-loading-tips.d.ts +7 -0
  141. package/es/components/material-runbox/runtime/runtime-loading-tips.js +146 -0
  142. package/es/components/material-runbox/status/MaterialRunboxStatusButton.d.ts +15 -0
  143. package/es/components/material-runbox/status/MaterialRunboxStatusButton.js +109 -0
  144. package/es/components/material-runbox/status/MaterialRunboxStatusConnectionItem.d.ts +12 -0
  145. package/es/components/material-runbox/status/MaterialRunboxStatusConnectionItem.js +31 -0
  146. package/es/components/material-runbox/status/MaterialRunboxStatusPopover.d.ts +14 -0
  147. package/es/components/material-runbox/status/MaterialRunboxStatusPopover.js +157 -0
  148. package/es/components/material-runbox/status/MaterialRunboxStatusResourceItem.d.ts +11 -0
  149. package/es/components/material-runbox/status/MaterialRunboxStatusResourceItem.js +37 -0
  150. package/es/components/material-runbox/status/index.d.ts +4 -0
  151. package/es/components/material-runbox/status/index.js +2 -0
  152. package/es/components/material-runbox/theme.d.ts +2 -0
  153. package/es/components/material-runbox/theme.js +12 -0
  154. package/es/components/material-runbox/timer/MaterialRunboxQuotaAlmostEndDialog.d.ts +11 -0
  155. package/es/components/material-runbox/timer/MaterialRunboxQuotaAlmostEndDialog.js +121 -0
  156. package/es/components/material-runbox/timer/MaterialRunboxQuotaAmount.d.ts +13 -0
  157. package/es/components/material-runbox/timer/MaterialRunboxQuotaAmount.js +52 -0
  158. package/es/components/material-runbox/timer/MaterialRunboxQuotaPerSessionAlmostEndDialog.d.ts +12 -0
  159. package/es/components/material-runbox/timer/MaterialRunboxQuotaPerSessionAlmostEndDialog.js +122 -0
  160. package/es/components/material-runbox/timer/MaterialRunboxQuotaTimePart.d.ts +15 -0
  161. package/es/components/material-runbox/timer/MaterialRunboxQuotaTimePart.js +46 -0
  162. package/es/components/material-runbox/timer/MaterialRunboxTimer.d.ts +6 -1
  163. package/es/components/material-runbox/timer/MaterialRunboxTimer.js +25 -17
  164. package/es/components/material-runbox/timer/MaterialRunboxTimerDetailPopover.js +18 -78
  165. package/es/components/shared/hooks/index.d.ts +1 -0
  166. package/es/components/shared/hooks/index.js +1 -0
  167. package/es/components/shared/hooks/useBreakpoint.d.ts +4 -0
  168. package/es/components/shared/hooks/useBreakpoint.js +10 -0
  169. package/package.json +7 -7
  170. package/cjs/assets/queue.gif.js +0 -7
  171. package/cjs/assets/runbox_logo.png.js +0 -7
  172. package/cjs/components/material-runbox/MaterialRunboxFooter.d.ts +0 -4
  173. package/cjs/components/material-runbox/MaterialRunboxFooter.js +0 -64
  174. package/cjs/components/material-runbox/disk/MaterialRunboxDiskAlmostFullSnackbar.d.ts +0 -5
  175. package/cjs/components/material-runbox/disk/MaterialRunboxDiskAlmostFullSnackbar.js +0 -98
  176. package/cjs/components/material-runbox/timer/MaterialRunboxAlmostEndSnackbars.d.ts +0 -6
  177. package/cjs/components/material-runbox/timer/MaterialRunboxAlmostEndSnackbars.js +0 -90
  178. package/es/assets/queue.gif.js +0 -3
  179. package/es/assets/runbox_logo.png.js +0 -3
  180. package/es/components/material-runbox/MaterialRunboxFooter.d.ts +0 -4
  181. package/es/components/material-runbox/MaterialRunboxFooter.js +0 -56
  182. package/es/components/material-runbox/disk/MaterialRunboxDiskAlmostFullSnackbar.d.ts +0 -5
  183. package/es/components/material-runbox/disk/MaterialRunboxDiskAlmostFullSnackbar.js +0 -94
  184. package/es/components/material-runbox/timer/MaterialRunboxAlmostEndSnackbars.d.ts +0 -6
  185. package/es/components/material-runbox/timer/MaterialRunboxAlmostEndSnackbars.js +0 -86
@@ -1,15 +1,18 @@
1
1
  import { asyncToGenerator as _asyncToGenerator, regenerator as _regenerator } from '../../../_virtual/_rollupPluginBabelHelpers.js';
2
- import { jsxs, jsx } from 'react/jsx-runtime';
2
+ import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
3
3
  import React from 'react';
4
4
  import { getOrgCourseGet } from '@elice/api-client';
5
5
  import { useEliceRunboxRunning } from '@elice/runbox-client';
6
6
  import { enums } from '@elice/types';
7
- import { Menu } from '@mui/material';
7
+ import { Menu, Fade, Stack, Divider } from '@mui/material';
8
8
  import { useQuery } from '@tanstack/react-query';
9
+ import MaterialRunboxActionAutoShutdown from './MaterialRunboxActionAutoShutdown.js';
10
+ import MaterialRunboxActionDisconnectMenuItem from './MaterialRunboxActionDisconnectMenuItem.js';
9
11
  import MaterialRunboxActionReset from './MaterialRunboxActionReset.js';
10
12
  import MaterialRunboxActionRestart from './MaterialRunboxActionRestart.js';
11
13
  import MaterialRunboxActionShare from './MaterialRunboxActionShare.js';
12
14
  import MaterialRunboxActionSubmitLog from './MaterialRunboxActionSubmitLog.js';
15
+ import { useBreakpoint } from '../../shared/hooks/useBreakpoint.js';
13
16
 
14
17
  //
15
18
  //
@@ -17,9 +20,12 @@ import MaterialRunboxActionSubmitLog from './MaterialRunboxActionSubmitLog.js';
17
20
  var MaterialRunboxActionMenu = function MaterialRunboxActionMenu(_ref) {
18
21
  var runbox = _ref.runbox,
19
22
  runtime = _ref.runtime,
23
+ runtimeTemplate = _ref.runtimeTemplate,
20
24
  courseId = _ref.courseId,
21
25
  studentUserId = _ref.studentUserId,
22
26
  isTutoring = _ref.isTutoring,
27
+ _ref$enableAutoShutdo = _ref.enableAutoShutdown,
28
+ enableAutoShutdown = _ref$enableAutoShutdo === void 0 ? false : _ref$enableAutoShutdo,
23
29
  menuAnchorEl = _ref.menuAnchorEl,
24
30
  refetch = _ref.refetch,
25
31
  getAchievementColor = _ref.getAchievementColor,
@@ -27,6 +33,7 @@ var MaterialRunboxActionMenu = function MaterialRunboxActionMenu(_ref) {
27
33
  var _a, _b;
28
34
  var _useEliceRunboxRunnin = useEliceRunboxRunning(),
29
35
  status = _useEliceRunboxRunnin.status;
36
+ var isMobileOrSmaller = useBreakpoint('sm', 'down');
30
37
  var isRunboxRunning = status === 'running';
31
38
  //
32
39
  //
@@ -79,16 +86,28 @@ var MaterialRunboxActionMenu = function MaterialRunboxActionMenu(_ref) {
79
86
  vertical: 'top',
80
87
  horizontal: 'right'
81
88
  },
89
+ TransitionComponent: Fade,
82
90
  onClose: handleMenuClose,
83
- children: [jsx(MaterialRunboxActionShare, {
91
+ children: [enableAutoShutdown ? jsxs(Fragment, {
92
+ children: [jsx(Stack, {
93
+ direction: "row",
94
+ alignItems: "center",
95
+ padding: "0.25rem 0.5rem",
96
+ children: jsx(MaterialRunboxActionAutoShutdown, {
97
+ runtime: runtime,
98
+ runtimeTemplate: runtimeTemplate,
99
+ courseId: courseId,
100
+ refetch: refetch
101
+ })
102
+ }), jsx(Divider, {
103
+ sx: {
104
+ margin: '0.5rem 0'
105
+ }
106
+ })]
107
+ }) : null, jsx(MaterialRunboxActionShare, {
84
108
  handleMenuClose: handleMenuClose
85
109
  }), jsx(MaterialRunboxActionRestart, {
86
- runbox: runbox,
87
- runtime: runtime,
88
- courseId: courseId,
89
110
  envMode: envMode,
90
- studentUserId: studentUserId,
91
- refetch: refetch,
92
111
  handleMenuClose: handleMenuClose
93
112
  }), isTutoring && studentUserId ? jsx(MaterialRunboxActionSubmitLog, {
94
113
  runboxId: runbox === null || runbox === void 0 ? void 0 : runbox.id,
@@ -101,7 +120,7 @@ var MaterialRunboxActionMenu = function MaterialRunboxActionMenu(_ref) {
101
120
  courseId: courseId,
102
121
  envMode: envMode,
103
122
  handleMenuClose: handleMenuClose
104
- })]
123
+ }), isMobileOrSmaller && !isTutoring ? jsx(MaterialRunboxActionDisconnectMenuItem, {}) : null]
105
124
  });
106
125
  };
107
126
 
@@ -1,7 +1,6 @@
1
1
  import React from 'react';
2
2
  import { enums } from '@elice/types';
3
- import type { RuntimeProps } from '../runtime/Runtime';
4
- type MaterialRunboxActionRestartProps = Pick<RuntimeProps, 'runbox' | 'runtime' | 'courseId' | 'refetch' | 'studentUserId'> & {
3
+ type MaterialRunboxActionRestartProps = {
5
4
  envMode: enums.LeaderboardEnvModeType;
6
5
  handleMenuClose: () => void;
7
6
  };
@@ -7,37 +7,22 @@ import { enums } from '@elice/types';
7
7
  import { faRotateRight } from '@fortawesome/pro-solid-svg-icons';
8
8
  import { LoadingButton } from '@mui/lab';
9
9
  import { MenuItem, ListItemIcon, ListItemText, Dialog, DialogTitle, DialogContent, DialogContentText, DialogActions, Button } from '@mui/material';
10
- import { useRunboxControl } from '../hooks/useRunboxControl.js';
10
+ import { useMaterialRunboxControlContext } from '../contexts/MaterialRunboxControlContext.js';
11
11
 
12
12
  //
13
13
  //
14
14
  //
15
15
  var MaterialRunboxActionRestart = function MaterialRunboxActionRestart(_ref) {
16
- var runbox = _ref.runbox,
17
- runtime = _ref.runtime,
18
- courseId = _ref.courseId,
19
- refetch = _ref.refetch,
20
- studentUserId = _ref.studentUserId,
21
- envMode = _ref.envMode,
16
+ var envMode = _ref.envMode,
22
17
  handleMenuClose = _ref.handleMenuClose;
23
18
  var intl = useRawEliceIntl();
24
19
  var _React$useState = React.useState(false),
25
20
  _React$useState2 = _slicedToArray(_React$useState, 2),
26
- isLoading = _React$useState2[0],
27
- setIsLoading = _React$useState2[1];
28
- var _React$useState3 = React.useState(false),
29
- _React$useState4 = _slicedToArray(_React$useState3, 2),
30
- isDialogOpened = _React$useState4[0],
31
- setDialogOpened = _React$useState4[1];
32
- // restart
33
- var _useRunboxControl = useRunboxControl({
34
- runbox: runbox,
35
- runtime: runtime,
36
- courseId: courseId,
37
- refetch: refetch,
38
- userId: studentUserId
39
- }),
40
- start = _useRunboxControl.start;
21
+ isDialogOpened = _React$useState2[0],
22
+ setDialogOpened = _React$useState2[1];
23
+ var _useMaterialRunboxCon = useMaterialRunboxControlContext(),
24
+ start = _useMaterialRunboxCon.start,
25
+ isStarting = _useMaterialRunboxCon.isStarting;
41
26
  /**
42
27
  *
43
28
  */
@@ -48,7 +33,6 @@ var MaterialRunboxActionRestart = function MaterialRunboxActionRestart(_ref) {
48
33
  *
49
34
  */
50
35
  var handleRestartAction = function handleRestartAction() {
51
- setIsLoading(true);
52
36
  start({
53
37
  force: true
54
38
  })["catch"](function () {
@@ -56,7 +40,6 @@ var MaterialRunboxActionRestart = function MaterialRunboxActionRestart(_ref) {
56
40
  })["finally"](function () {
57
41
  handleDialogClose();
58
42
  handleMenuClose();
59
- setIsLoading(false);
60
43
  });
61
44
  };
62
45
  /**
@@ -108,7 +91,7 @@ var MaterialRunboxActionRestart = function MaterialRunboxActionRestart(_ref) {
108
91
  }), jsxs(DialogActions, {
109
92
  children: [jsx(Button, {
110
93
  color: "inherit",
111
- disabled: isLoading,
94
+ disabled: isStarting,
112
95
  onClick: handleDialogClose,
113
96
  children: intl.formatMessage({
114
97
  id: 'runbox.common.close'
@@ -116,7 +99,7 @@ var MaterialRunboxActionRestart = function MaterialRunboxActionRestart(_ref) {
116
99
  }), jsx(LoadingButton, {
117
100
  variant: "contained",
118
101
  color: "warning",
119
- loading: isLoading,
102
+ loading: isStarting,
120
103
  onClick: handleRestartAction,
121
104
  children: intl.formatMessage({
122
105
  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,46 @@
1
+ import { __rest } from 'tslib';
2
+ import { jsx } from 'react/jsx-runtime';
3
+ import React from 'react';
4
+ import { useRunboxControl } from '../hooks/useRunboxControl.js';
5
+
6
+ //
7
+ //
8
+ //
9
+ var MaterialRunboxControlContext = React.createContext({});
10
+ var useMaterialRunboxControlContext = function useMaterialRunboxControlContext() {
11
+ return React.useContext(MaterialRunboxControlContext);
12
+ };
13
+ //
14
+ //
15
+ //
16
+ /**
17
+ * Owns the single `useRunboxControl` instance for one runbox, so every consumer
18
+ * shares one abort controller and one pre-check result.
19
+ */
20
+ var MaterialRunboxControlContextProvider = function MaterialRunboxControlContextProvider(_a) {
21
+ var children = _a.children,
22
+ props = __rest(_a, ["children"]);
23
+ var _useRunboxControl = useRunboxControl(props),
24
+ start = _useRunboxControl.start,
25
+ stop = _useRunboxControl.stop,
26
+ isStarting = _useRunboxControl.isStarting,
27
+ isStopping = _useRunboxControl.isStopping,
28
+ preCheckStatus = _useRunboxControl.preCheckStatus;
29
+ // The hook hands back one mutated ref, so a stable value would leave
30
+ // consumers reading stale fields once anything below here is memoized.
31
+ var value = React.useMemo(function () {
32
+ return {
33
+ start: start,
34
+ stop: stop,
35
+ isStarting: isStarting,
36
+ isStopping: isStopping,
37
+ preCheckStatus: preCheckStatus
38
+ };
39
+ }, [start, stop, isStarting, isStopping, preCheckStatus]);
40
+ return jsx(MaterialRunboxControlContext.Provider, {
41
+ children: children,
42
+ value: value
43
+ });
44
+ };
45
+
46
+ export { MaterialRunboxControlContext, MaterialRunboxControlContextProvider as default, 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, RunningRunboxLinkProps, } from './MaterialRunboxContext';
8
+ export type { MaterialRunboxControlContextProps, MaterialRunboxControlContextValue, } from './MaterialRunboxControlContext';
@@ -1,3 +1,4 @@
1
1
  export { MaterialRunboxApiContext, default as MaterialRunboxApiContextProvider, useMaterialRunboxApiContext } from './MaterialRunboxApiContext.js';
2
2
  export { MaterialRunboxCommandContext, default as MaterialRunboxCommandContextProvider, useMaterialRunboxCommandContext } from './MaterialRunboxCommandContext.js';
3
+ export { MaterialRunboxControlContext, default as MaterialRunboxControlContextProvider, useMaterialRunboxControlContext } from './MaterialRunboxControlContext.js';
3
4
  export { MaterialRunboxContext, default as MaterialRunboxContextProvider, useMaterialRunboxContext } from './MaterialRunboxContext.js';
@@ -0,0 +1,13 @@
1
+ import type React from 'react';
2
+ export interface MaterialRunboxDiskUsageAlertProps {
3
+ runtimeTemplateId: string;
4
+ courseId: number;
5
+ /** User ID for tutoring. */
6
+ userId?: number;
7
+ }
8
+ /**
9
+ * Persistent bar under the header once disk usage passes 80%. Unlike the notice
10
+ * dialog it stays put, because it carries the only way out — the reset CTA.
11
+ */
12
+ declare const MaterialRunboxDiskUsageAlert: React.FC<MaterialRunboxDiskUsageAlertProps>;
13
+ export default MaterialRunboxDiskUsageAlert;
@@ -0,0 +1,67 @@
1
+ import { jsx } from 'react/jsx-runtime';
2
+ import { useRawEliceIntl } from '@elice/intl';
3
+ import { EliceIcon } from '@elice/mui-elements';
4
+ import { faArrowsRotate } from '@fortawesome/pro-solid-svg-icons';
5
+ import { Alert, Typography } from '@mui/material';
6
+ import MaterialRunboxEnvResetButton from './MaterialRunboxEnvResetButton.js';
7
+ import { useRunboxDiskUsage } from '../hooks/useRunboxDiskUsage.js';
8
+
9
+ //
10
+ //
11
+ //
12
+ /**
13
+ * Persistent bar under the header once disk usage passes 80%. Unlike the notice
14
+ * dialog it stays put, because it carries the only way out — the reset CTA.
15
+ */
16
+ var MaterialRunboxDiskUsageAlert = function MaterialRunboxDiskUsageAlert(_ref) {
17
+ var runtimeTemplateId = _ref.runtimeTemplateId,
18
+ courseId = _ref.courseId,
19
+ userId = _ref.userId;
20
+ var intl = useRawEliceIntl();
21
+ var _useRunboxDiskUsage = useRunboxDiskUsage(),
22
+ severity = _useRunboxDiskUsage.severity,
23
+ diskCurrent = _useRunboxDiskUsage.diskCurrent,
24
+ diskTotal = _useRunboxDiskUsage.diskTotal;
25
+ if (!severity) {
26
+ return null;
27
+ }
28
+ //
29
+ //
30
+ //
31
+ return jsx(Alert, {
32
+ severity: severity,
33
+ sx: {
34
+ width: '100%',
35
+ borderRadius: '0',
36
+ alignItems: 'center'
37
+ },
38
+ action: jsx(MaterialRunboxEnvResetButton, {
39
+ variant: "text",
40
+ size: "small",
41
+ color: "inherit",
42
+ startIcon: jsx(EliceIcon, {
43
+ icon: faArrowsRotate
44
+ }),
45
+ runtimeTemplateId: runtimeTemplateId,
46
+ courseId: courseId,
47
+ userId: userId
48
+ }),
49
+ children: jsx(Typography, {
50
+ variant: "body2",
51
+ children: intl.formatMessage({
52
+ id: "runbox.disk.usage.alert.".concat(severity)
53
+ }, {
54
+ used: intl.formatDataSize(diskCurrent, {
55
+ unitSystem: 'iec',
56
+ maximumFractionDigits: 2
57
+ }),
58
+ total: intl.formatDataSize(diskTotal, {
59
+ unitSystem: 'iec',
60
+ maximumFractionDigits: 2
61
+ })
62
+ })
63
+ })
64
+ });
65
+ };
66
+
67
+ export { MaterialRunboxDiskUsageAlert as default };
@@ -0,0 +1,10 @@
1
+ import type React from 'react';
2
+ export interface MaterialRunboxDiskUsageDialogProps {
3
+ runboxId: string;
4
+ }
5
+ /**
6
+ * Notice shown once per severity per runbox for the browser session. The reset
7
+ * CTA lives in the alert bar, so this only has to be acknowledged.
8
+ */
9
+ declare const MaterialRunboxDiskUsageDialog: React.FC<MaterialRunboxDiskUsageDialogProps>;
10
+ export default MaterialRunboxDiskUsageDialog;
@@ -0,0 +1,94 @@
1
+ import { slicedToArray as _slicedToArray, defineProperty as _defineProperty, toConsumableArray as _toConsumableArray } from '../../../_virtual/_rollupPluginBabelHelpers.js';
2
+ import { jsxs, jsx } from 'react/jsx-runtime';
3
+ import { useSessionStorage } from 'react-use';
4
+ import { useRawEliceIntl } from '@elice/intl';
5
+ import { EliceIcon } from '@elice/mui-elements';
6
+ import { faCircleExclamation, faTriangleExclamation } from '@fortawesome/pro-solid-svg-icons';
7
+ import { Dialog, DialogTitle, Stack, DialogContent, DialogContentText, DialogActions, Button } from '@mui/material';
8
+ import { useRunboxDiskUsage } from '../hooks/useRunboxDiskUsage.js';
9
+
10
+ //
11
+ //
12
+ //
13
+ var SEEN_STORAGE_KEY = 'MaterialRunboxDiskUsage.seenNotice';
14
+ //
15
+ //
16
+ //
17
+ /**
18
+ * Notice shown once per severity per runbox for the browser session. The reset
19
+ * CTA lives in the alert bar, so this only has to be acknowledged.
20
+ */
21
+ var MaterialRunboxDiskUsageDialog = function MaterialRunboxDiskUsageDialog(_ref) {
22
+ var runboxId = _ref.runboxId;
23
+ var _a;
24
+ var intl = useRawEliceIntl();
25
+ var _useRunboxDiskUsage = useRunboxDiskUsage(),
26
+ severity = _useRunboxDiskUsage.severity,
27
+ diskCurrent = _useRunboxDiskUsage.diskCurrent,
28
+ diskTotal = _useRunboxDiskUsage.diskTotal;
29
+ var _useSessionStorage = useSessionStorage(SEEN_STORAGE_KEY, {}),
30
+ _useSessionStorage2 = _slicedToArray(_useSessionStorage, 2),
31
+ seen = _useSessionStorage2[0],
32
+ setSeen = _useSessionStorage2[1];
33
+ var seenSeverities = (_a = seen === null || seen === void 0 ? void 0 : seen[runboxId]) !== null && _a !== void 0 ? _a : [];
34
+ /**
35
+ *
36
+ */
37
+ var handleClose = function handleClose() {
38
+ if (!severity) {
39
+ return;
40
+ }
41
+ setSeen(Object.assign(Object.assign({}, seen), _defineProperty({}, runboxId, [].concat(_toConsumableArray(seenSeverities), [severity]))));
42
+ };
43
+ //
44
+ //
45
+ //
46
+ if (!severity) {
47
+ return null;
48
+ }
49
+ return jsxs(Dialog, {
50
+ fullWidth: true,
51
+ open: !seenSeverities.includes(severity),
52
+ maxWidth: "xs",
53
+ onClose: handleClose,
54
+ children: [jsx(DialogTitle, {
55
+ children: jsxs(Stack, {
56
+ direction: "row",
57
+ alignItems: "center",
58
+ gap: "0.5rem",
59
+ children: [jsx(EliceIcon, {
60
+ icon: severity === 'error' ? faCircleExclamation : faTriangleExclamation,
61
+ color: severity
62
+ }), intl.formatMessage({
63
+ id: 'runbox.disk.usage.dialog.title'
64
+ })]
65
+ })
66
+ }), jsx(DialogContent, {
67
+ children: jsx(DialogContentText, {
68
+ whiteSpace: "pre-line",
69
+ children: intl.formatMessage({
70
+ id: "runbox.disk.usage.dialog.description.".concat(severity)
71
+ }, {
72
+ used: intl.formatDataSize(diskCurrent, {
73
+ unitSystem: 'iec',
74
+ maximumFractionDigits: 2
75
+ }),
76
+ total: intl.formatDataSize(diskTotal, {
77
+ unitSystem: 'iec',
78
+ maximumFractionDigits: 2
79
+ })
80
+ })
81
+ })
82
+ }), jsx(DialogActions, {
83
+ children: jsx(Button, {
84
+ color: "inherit",
85
+ onClick: handleClose,
86
+ children: intl.formatMessage({
87
+ id: 'runbox.disk.usage.dialog.actions.close'
88
+ })
89
+ })
90
+ })]
91
+ });
92
+ };
93
+
94
+ export { MaterialRunboxDiskUsageDialog as default };
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ import type { LoadingButtonProps } from '@mui/lab';
3
+ export interface MaterialRunboxEnvResetButtonProps extends Omit<LoadingButtonProps, 'onClick' | 'loading'> {
4
+ runtimeTemplateId: string;
5
+ courseId: number;
6
+ userId?: number;
7
+ onSuccess?: () => void;
8
+ }
9
+ declare const MaterialRunboxEnvResetButton: React.FC<MaterialRunboxEnvResetButtonProps>;
10
+ export default MaterialRunboxEnvResetButton;
@@ -0,0 +1,143 @@
1
+ import { slicedToArray as _slicedToArray, asyncToGenerator as _asyncToGenerator, regenerator as _regenerator } from '../../../_virtual/_rollupPluginBabelHelpers.js';
2
+ import { __rest } from 'tslib';
3
+ import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
4
+ import React from 'react';
5
+ import { useRawEliceIntl } from '@elice/intl';
6
+ import { useSnackbar } from '@elice/mui-x-snackbar';
7
+ import { LoadingButton } from '@mui/lab';
8
+ import { ThemeProvider } from '@mui/material';
9
+ import { runboxDarkTheme } from '../theme.js';
10
+ import MaterialRunboxEnvResetDialog from './MaterialRunboxEnvResetDialog.js';
11
+ import { useMaterialRunboxApiContext } from '../contexts/MaterialRunboxApiContext.js';
12
+ import { useMaterialRunboxControlContext } from '../contexts/MaterialRunboxControlContext.js';
13
+
14
+ //
15
+ //
16
+ //
17
+ var MaterialRunboxEnvResetButton = function MaterialRunboxEnvResetButton(_a) {
18
+ var runtimeTemplateId = _a.runtimeTemplateId,
19
+ courseId = _a.courseId,
20
+ userId = _a.userId,
21
+ onSuccess = _a.onSuccess,
22
+ props = __rest(_a, ["runtimeTemplateId", "courseId", "userId", "onSuccess"]);
23
+ var intl = useRawEliceIntl();
24
+ var _useSnackbar = useSnackbar(),
25
+ enqueueSnackbar = _useSnackbar.enqueueSnackbar;
26
+ var materialRunboxApi = useMaterialRunboxApiContext();
27
+ var _useMaterialRunboxCon = useMaterialRunboxControlContext(),
28
+ startRuntime = _useMaterialRunboxCon.start;
29
+ var _React$useState = React.useState(false),
30
+ _React$useState2 = _slicedToArray(_React$useState, 2),
31
+ isDialogOpened = _React$useState2[0],
32
+ setDialogOpened = _React$useState2[1];
33
+ var _React$useState3 = React.useState(false),
34
+ _React$useState4 = _slicedToArray(_React$useState3, 2),
35
+ isResetting = _React$useState4[0],
36
+ setResetting = _React$useState4[1];
37
+ /**
38
+ *
39
+ */
40
+ var handleConfirm = /*#__PURE__*/function () {
41
+ var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
42
+ var _yield$materialRunbox, _yield$materialRunbox2, runtime;
43
+ return _regenerator().w(function (_context) {
44
+ while (1) switch (_context.p = _context.n) {
45
+ case 0:
46
+ setDialogOpened(false);
47
+ setResetting(true);
48
+ _context.p = 1;
49
+ _context.n = 2;
50
+ return materialRunboxApi.runtime.runtimeGet({
51
+ filterRuntimeTemplateId: runtimeTemplateId,
52
+ skip: 0,
53
+ count: 1,
54
+ userId: userId,
55
+ eliceCourseId: courseId
56
+ });
57
+ case 2:
58
+ _yield$materialRunbox = _context.v;
59
+ _yield$materialRunbox2 = _slicedToArray(_yield$materialRunbox, 1);
60
+ runtime = _yield$materialRunbox2[0];
61
+ if (runtime) {
62
+ _context.n = 3;
63
+ break;
64
+ }
65
+ enqueueSnackbar(intl.formatMessage({
66
+ id: 'runbox.disk.env_reset.noti.no_runtime'
67
+ }), {
68
+ variant: 'error'
69
+ });
70
+ return _context.a(2);
71
+ case 3:
72
+ _context.n = 4;
73
+ return materialRunboxApi.runtime.runtimeRuntimeIdDiskResetPost({
74
+ runtimeId: runtime.id,
75
+ eliceCourseId: courseId
76
+ });
77
+ case 4:
78
+ enqueueSnackbar(intl.formatMessage({
79
+ id: 'runbox.disk.env_reset.noti.success'
80
+ }), {
81
+ variant: 'success'
82
+ });
83
+ onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess();
84
+ // The reset replaces the disk, which the server can only do with the
85
+ // runtime detached, so the session is always gone by now. Start it back
86
+ // up so the learner lands on the practice screen instead of a dead one.
87
+ _context.n = 5;
88
+ return startRuntime({
89
+ force: true,
90
+ runPreCheck: false
91
+ });
92
+ case 5:
93
+ _context.n = 7;
94
+ break;
95
+ case 6:
96
+ _context.p = 6;
97
+ _context.v;
98
+ enqueueSnackbar(intl.formatMessage({
99
+ id: 'runbox.disk.env_reset.noti.error'
100
+ }), {
101
+ variant: 'error'
102
+ });
103
+ case 7:
104
+ _context.p = 7;
105
+ setResetting(false);
106
+ return _context.f(7);
107
+ case 8:
108
+ return _context.a(2);
109
+ }
110
+ }, _callee, null, [[1, 6, 7, 8]]);
111
+ }));
112
+ return function handleConfirm() {
113
+ return _ref.apply(this, arguments);
114
+ };
115
+ }();
116
+ //
117
+ //
118
+ //
119
+ return jsxs(Fragment, {
120
+ children: [jsx(LoadingButton, Object.assign({}, props, {
121
+ loading: isResetting,
122
+ onClick: function onClick() {
123
+ return setDialogOpened(true);
124
+ },
125
+ children: intl.formatMessage({
126
+ id: 'runbox.disk.env_reset.title'
127
+ })
128
+ })), jsx(ThemeProvider, {
129
+ theme: runboxDarkTheme,
130
+ children: jsx(MaterialRunboxEnvResetDialog, {
131
+ open: isDialogOpened,
132
+ onClose: function onClose() {
133
+ return setDialogOpened(false);
134
+ },
135
+ onConfirm: function onConfirm() {
136
+ return void handleConfirm();
137
+ }
138
+ })
139
+ })]
140
+ });
141
+ };
142
+
143
+ export { MaterialRunboxEnvResetButton as default };
@@ -0,0 +1,13 @@
1
+ import React from 'react';
2
+ export interface MaterialRunboxEnvResetDialogProps {
3
+ open: boolean;
4
+ onClose: () => void;
5
+ onConfirm: () => void;
6
+ }
7
+ /**
8
+ * Confirms clearing the practice environment. The checkbox is the explicit
9
+ * acknowledgement `[R-3]` asks for: the delete action stays disabled until it
10
+ * is ticked.
11
+ */
12
+ declare const MaterialRunboxEnvResetDialog: React.FC<MaterialRunboxEnvResetDialogProps>;
13
+ export default MaterialRunboxEnvResetDialog;