@elice/material-runbox 1.260825.0-runboxusability.2 → 1.260825.0-runboxusability.3
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/_virtual/_rollupPluginBabelHelpers.js +114 -0
- package/cjs/components/material-runbox/MaterialRunboxContent.js +7 -0
- package/cjs/components/material-runbox/MaterialRunboxHeader.js +21 -18
- package/cjs/components/material-runbox/disk/MaterialRunboxDiskUsageAlert.d.ts +11 -0
- package/cjs/components/material-runbox/disk/MaterialRunboxDiskUsageAlert.js +69 -0
- package/cjs/components/material-runbox/disk/MaterialRunboxDiskUsageDialog.d.ts +10 -0
- package/cjs/components/material-runbox/disk/MaterialRunboxDiskUsageDialog.js +98 -0
- package/cjs/components/material-runbox/disk/MaterialRunboxEnvResetButton.d.ts +16 -0
- package/cjs/components/material-runbox/disk/MaterialRunboxEnvResetButton.js +72 -0
- package/cjs/components/material-runbox/disk/MaterialRunboxEnvResetDialog.d.ts +14 -0
- package/cjs/components/material-runbox/disk/MaterialRunboxEnvResetDialog.js +103 -0
- package/cjs/components/material-runbox/disk/index.d.ts +8 -1
- package/cjs/components/material-runbox/disk/index.js +8 -2
- package/cjs/components/material-runbox/hooks/index.d.ts +2 -0
- package/cjs/components/material-runbox/hooks/index.js +6 -0
- package/cjs/components/material-runbox/hooks/useRunboxDiskUsage.d.ts +16 -0
- package/cjs/components/material-runbox/hooks/useRunboxDiskUsage.js +50 -0
- package/cjs/components/material-runbox/hooks/useRunboxEnvReset.d.ts +23 -0
- package/cjs/components/material-runbox/hooks/useRunboxEnvReset.js +132 -0
- 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 +4 -2
- package/cjs/components/material-runbox/runtime/RuntimeOverlayTerminated.d.ts +2 -0
- package/cjs/components/material-runbox/runtime/RuntimeOverlayTerminated.js +14 -4
- package/cjs/components/material-runbox/status/MaterialRunboxStatusButton.d.ts +2 -7
- package/cjs/components/material-runbox/status/MaterialRunboxStatusButton.js +41 -15
- package/cjs/components/material-runbox/status/MaterialRunboxStatusPopover.d.ts +2 -7
- package/cjs/components/material-runbox/status/MaterialRunboxStatusPopover.js +14 -3
- package/cjs/utils/index.d.ts +1 -0
- package/cjs/utils/index.js +3 -0
- package/cjs/utils/polling.d.ts +56 -0
- package/cjs/utils/polling.js +108 -0
- package/es/_virtual/_rollupPluginBabelHelpers.js +99 -1
- package/es/components/material-runbox/MaterialRunboxContent.js +7 -0
- package/es/components/material-runbox/MaterialRunboxHeader.js +21 -18
- package/es/components/material-runbox/disk/MaterialRunboxDiskUsageAlert.d.ts +11 -0
- package/es/components/material-runbox/disk/MaterialRunboxDiskUsageAlert.js +65 -0
- package/es/components/material-runbox/disk/MaterialRunboxDiskUsageDialog.d.ts +10 -0
- package/es/components/material-runbox/disk/MaterialRunboxDiskUsageDialog.js +94 -0
- package/es/components/material-runbox/disk/MaterialRunboxEnvResetButton.d.ts +16 -0
- package/es/components/material-runbox/disk/MaterialRunboxEnvResetButton.js +64 -0
- package/es/components/material-runbox/disk/MaterialRunboxEnvResetDialog.d.ts +14 -0
- package/es/components/material-runbox/disk/MaterialRunboxEnvResetDialog.js +95 -0
- package/es/components/material-runbox/disk/index.d.ts +8 -1
- package/es/components/material-runbox/disk/index.js +4 -1
- package/es/components/material-runbox/hooks/index.d.ts +2 -0
- package/es/components/material-runbox/hooks/index.js +2 -0
- package/es/components/material-runbox/hooks/useRunboxDiskUsage.d.ts +16 -0
- package/es/components/material-runbox/hooks/useRunboxDiskUsage.js +42 -0
- package/es/components/material-runbox/hooks/useRunboxEnvReset.d.ts +23 -0
- package/es/components/material-runbox/hooks/useRunboxEnvReset.js +126 -0
- 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 +4 -2
- package/es/components/material-runbox/runtime/RuntimeOverlayTerminated.d.ts +2 -0
- package/es/components/material-runbox/runtime/RuntimeOverlayTerminated.js +16 -6
- package/es/components/material-runbox/status/MaterialRunboxStatusButton.d.ts +2 -7
- package/es/components/material-runbox/status/MaterialRunboxStatusButton.js +44 -18
- package/es/components/material-runbox/status/MaterialRunboxStatusPopover.d.ts +2 -7
- package/es/components/material-runbox/status/MaterialRunboxStatusPopover.js +15 -4
- package/es/utils/index.d.ts +1 -0
- package/es/utils/index.js +1 -0
- package/es/utils/polling.d.ts +56 -0
- package/es/utils/polling.js +105 -0
- package/package.json +6 -6
- package/cjs/components/material-runbox/disk/MaterialRunboxDiskAlmostFullSnackbar.d.ts +0 -5
- package/cjs/components/material-runbox/disk/MaterialRunboxDiskAlmostFullSnackbar.js +0 -98
- package/es/components/material-runbox/disk/MaterialRunboxDiskAlmostFullSnackbar.d.ts +0 -5
- package/es/components/material-runbox/disk/MaterialRunboxDiskAlmostFullSnackbar.js +0 -94
|
@@ -1,12 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
export interface MaterialRunboxStatusButtonProps {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
*
|
|
6
|
-
* NOTICE: the "실습 환경 초기화" button is out of scope for PLAT-4181.
|
|
7
|
-
* PLAT-4184 injects it here.
|
|
8
|
-
*/
|
|
9
|
-
bottomAction?: React.ReactNode;
|
|
3
|
+
runboxId: string;
|
|
4
|
+
courseId: number;
|
|
10
5
|
}
|
|
11
6
|
/**
|
|
12
7
|
* Opens the runbox connection/resource status popover.
|
|
@@ -11,6 +11,7 @@ var runboxClient = require('@elice/runbox-client');
|
|
|
11
11
|
var proSolidSvgIcons = require('@fortawesome/pro-solid-svg-icons');
|
|
12
12
|
var material = require('@mui/material');
|
|
13
13
|
var MaterialRunboxStatusPopover = require('./MaterialRunboxStatusPopover.js');
|
|
14
|
+
var useRunboxDiskUsage = require('../hooks/useRunboxDiskUsage.js');
|
|
14
15
|
|
|
15
16
|
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
16
17
|
|
|
@@ -26,15 +27,49 @@ var React__default = /*#__PURE__*/_interopDefaultCompat(React);
|
|
|
26
27
|
* so the numbers are only shown on explicit request. (`[R-5]` `[R-6]`)
|
|
27
28
|
*/
|
|
28
29
|
var MaterialRunboxStatusButton = function MaterialRunboxStatusButton(_ref) {
|
|
29
|
-
var
|
|
30
|
+
var runboxId = _ref.runboxId,
|
|
31
|
+
courseId = _ref.courseId;
|
|
30
32
|
var intl$1 = intl.useRawEliceIntl();
|
|
31
33
|
var _useEliceRunboxRunnin = runboxClient.useEliceRunboxRunning(),
|
|
32
34
|
status = _useEliceRunboxRunnin.status;
|
|
35
|
+
var _useRunboxDiskUsage = useRunboxDiskUsage.useRunboxDiskUsage(),
|
|
36
|
+
severity = _useRunboxDiskUsage.severity,
|
|
37
|
+
diskCurrent = _useRunboxDiskUsage.diskCurrent,
|
|
38
|
+
diskTotal = _useRunboxDiskUsage.diskTotal;
|
|
33
39
|
var _React$useState = React__default.default.useState(null),
|
|
34
40
|
_React$useState2 = _rollupPluginBabelHelpers.slicedToArray(_React$useState, 2),
|
|
35
41
|
anchorEl = _React$useState2[0],
|
|
36
42
|
setAnchorEl = _React$useState2[1];
|
|
37
43
|
var isRunboxRunning = status === 'running';
|
|
44
|
+
/**
|
|
45
|
+
* Over threshold the button turns into a disk gauge, so the learner sees the
|
|
46
|
+
* number that matters without opening the popover.
|
|
47
|
+
*/
|
|
48
|
+
var buttonProps = severity ? {
|
|
49
|
+
color: severity,
|
|
50
|
+
startIcon: jsxRuntime.jsx(muiElements.EliceIcon, {
|
|
51
|
+
icon: proSolidSvgIcons.faDiscDrive
|
|
52
|
+
}),
|
|
53
|
+
children: "DISK ".concat(intl$1.formatDataSize(diskCurrent, {
|
|
54
|
+
unitSystem: 'iec',
|
|
55
|
+
maximumFractionDigits: 2
|
|
56
|
+
}), " / ").concat(intl$1.formatDataSize(diskTotal, {
|
|
57
|
+
unitSystem: 'iec',
|
|
58
|
+
maximumFractionDigits: 2
|
|
59
|
+
}))
|
|
60
|
+
} : {
|
|
61
|
+
color: 'inherit',
|
|
62
|
+
startIcon: jsxRuntime.jsx(muiElements.EliceIcon, {
|
|
63
|
+
icon: proSolidSvgIcons.faWifi
|
|
64
|
+
}),
|
|
65
|
+
// The label follows the header, but the icon keeps reporting the runtime.
|
|
66
|
+
sx: _rollupPluginBabelHelpers.defineProperty({}, "& .".concat(material.buttonClasses.startIcon), {
|
|
67
|
+
color: isRunboxRunning ? 'success.main' : 'text.disabled'
|
|
68
|
+
}),
|
|
69
|
+
children: intl$1.formatMessage({
|
|
70
|
+
id: 'runbox.status.button.title'
|
|
71
|
+
})
|
|
72
|
+
};
|
|
38
73
|
/**
|
|
39
74
|
*
|
|
40
75
|
*/
|
|
@@ -45,28 +80,18 @@ var MaterialRunboxStatusButton = function MaterialRunboxStatusButton(_ref) {
|
|
|
45
80
|
//
|
|
46
81
|
//
|
|
47
82
|
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
48
|
-
children: [jsxRuntime.jsx(material.Button, {
|
|
83
|
+
children: [jsxRuntime.jsx(material.Button, Object.assign({
|
|
49
84
|
variant: "text",
|
|
50
85
|
size: "small",
|
|
51
|
-
color: "inherit",
|
|
52
|
-
startIcon: jsxRuntime.jsx(muiElements.EliceIcon, {
|
|
53
|
-
icon: proSolidSvgIcons.faWifi
|
|
54
|
-
}),
|
|
55
86
|
endIcon: jsxRuntime.jsx(muiElements.EliceIcon, {
|
|
56
87
|
icon: proSolidSvgIcons.faAngleDown
|
|
57
88
|
}),
|
|
58
|
-
sx: _rollupPluginBabelHelpers.defineProperty({}, "& .".concat(material.buttonClasses.startIcon), {
|
|
59
|
-
color: isRunboxRunning ? 'success.main' : 'text.disabled'
|
|
60
|
-
}),
|
|
61
89
|
onClick: function onClick(e) {
|
|
62
90
|
return setAnchorEl(function (prev) {
|
|
63
91
|
return prev ? null : e.currentTarget;
|
|
64
92
|
});
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
id: 'runbox.status.button.title'
|
|
68
|
-
})
|
|
69
|
-
}), jsxRuntime.jsx(MaterialRunboxStatusPopover.default, {
|
|
93
|
+
}
|
|
94
|
+
}, buttonProps)), jsxRuntime.jsx(MaterialRunboxStatusPopover.default, {
|
|
70
95
|
open: Boolean(anchorEl),
|
|
71
96
|
anchorEl: anchorEl,
|
|
72
97
|
anchorOrigin: {
|
|
@@ -80,7 +105,8 @@ var MaterialRunboxStatusButton = function MaterialRunboxStatusButton(_ref) {
|
|
|
80
105
|
sx: {
|
|
81
106
|
marginTop: '0.5rem'
|
|
82
107
|
},
|
|
83
|
-
|
|
108
|
+
runboxId: runboxId,
|
|
109
|
+
courseId: courseId,
|
|
84
110
|
onClose: handleClose
|
|
85
111
|
})]
|
|
86
112
|
});
|
|
@@ -5,13 +5,8 @@ export interface MaterialRunboxStatusPopoverProps extends Omit<PopoverProps, 'op
|
|
|
5
5
|
open: boolean;
|
|
6
6
|
/** Called when the popover requests to be closed. */
|
|
7
7
|
onClose: () => void;
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
*
|
|
11
|
-
* NOTICE: the "실습 환경 초기화" button is out of scope for PLAT-4181.
|
|
12
|
-
* PLAT-4184 injects it here.
|
|
13
|
-
*/
|
|
14
|
-
bottomAction?: React.ReactNode;
|
|
8
|
+
runboxId: string;
|
|
9
|
+
courseId: number;
|
|
15
10
|
}
|
|
16
11
|
declare const MaterialRunboxStatusPopover: React.FC<MaterialRunboxStatusPopoverProps>;
|
|
17
12
|
export default MaterialRunboxStatusPopover;
|
|
@@ -13,6 +13,7 @@ var material = require('@mui/material');
|
|
|
13
13
|
var MaterialRunboxStatusConnectionItem = require('./MaterialRunboxStatusConnectionItem.js');
|
|
14
14
|
var MaterialRunboxStatusResourceItem = require('./MaterialRunboxStatusResourceItem.js');
|
|
15
15
|
var useRunboxNetworkStatus = require('../hooks/useRunboxNetworkStatus.js');
|
|
16
|
+
var MaterialRunboxEnvResetButton = require('../disk/MaterialRunboxEnvResetButton.js');
|
|
16
17
|
|
|
17
18
|
//
|
|
18
19
|
//
|
|
@@ -26,8 +27,9 @@ var NETWORK_COLOR = Object.freeze(_rollupPluginBabelHelpers.defineProperty(_roll
|
|
|
26
27
|
var MaterialRunboxStatusPopover = function MaterialRunboxStatusPopover(_a) {
|
|
27
28
|
var open = _a.open,
|
|
28
29
|
onClose = _a.onClose,
|
|
29
|
-
|
|
30
|
-
|
|
30
|
+
runboxId = _a.runboxId,
|
|
31
|
+
courseId = _a.courseId,
|
|
32
|
+
props = tslib.__rest(_a, ["open", "onClose", "runboxId", "courseId"]);
|
|
31
33
|
var intl$1 = intl.useRawEliceIntl();
|
|
32
34
|
var _useEliceRunboxRunnin = runboxClient.useEliceRunboxRunning(),
|
|
33
35
|
status = _useEliceRunboxRunnin.status;
|
|
@@ -134,7 +136,16 @@ var MaterialRunboxStatusPopover = function MaterialRunboxStatusPopover(_a) {
|
|
|
134
136
|
}))
|
|
135
137
|
})]
|
|
136
138
|
})]
|
|
137
|
-
}) : null,
|
|
139
|
+
}) : null, jsxRuntime.jsx(MaterialRunboxEnvResetButton.default, {
|
|
140
|
+
fullWidth: true,
|
|
141
|
+
variant: "contained",
|
|
142
|
+
color: "error",
|
|
143
|
+
startIcon: jsxRuntime.jsx(muiElements.EliceIcon, {
|
|
144
|
+
icon: proSolidSvgIcons.faArrowsRotate
|
|
145
|
+
}),
|
|
146
|
+
runboxId: runboxId,
|
|
147
|
+
courseId: courseId
|
|
148
|
+
})]
|
|
138
149
|
})
|
|
139
150
|
}));
|
|
140
151
|
};
|
package/cjs/utils/index.d.ts
CHANGED
package/cjs/utils/index.js
CHANGED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
interface PollingFnParams {
|
|
2
|
+
signal: AbortSignal;
|
|
3
|
+
}
|
|
4
|
+
interface PollingTimers {
|
|
5
|
+
setTimeout: typeof globalThis.setTimeout;
|
|
6
|
+
clearTimeout: typeof globalThis.clearTimeout;
|
|
7
|
+
}
|
|
8
|
+
interface PollingOptions<R> {
|
|
9
|
+
/**
|
|
10
|
+
* Function to polling request.
|
|
11
|
+
*/
|
|
12
|
+
pollingFn: (params: PollingFnParams) => Promise<R>;
|
|
13
|
+
/**
|
|
14
|
+
* Function to check if the polling request is successful.
|
|
15
|
+
*/
|
|
16
|
+
until: (res: R) => boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Interval of polling.
|
|
19
|
+
*/
|
|
20
|
+
interval?: number;
|
|
21
|
+
/**
|
|
22
|
+
* Maximum number of attempts.
|
|
23
|
+
*/
|
|
24
|
+
maxAttempts?: number;
|
|
25
|
+
/**
|
|
26
|
+
* Abort signal.
|
|
27
|
+
*/
|
|
28
|
+
signal?: AbortSignal;
|
|
29
|
+
/**
|
|
30
|
+
* Function on each poll.
|
|
31
|
+
*/
|
|
32
|
+
onPoll?: (res: R) => void;
|
|
33
|
+
/**
|
|
34
|
+
* Custom timer implementation for the sleep between attempts.
|
|
35
|
+
*
|
|
36
|
+
* ```ts
|
|
37
|
+
* polling({
|
|
38
|
+
* pollingFn,
|
|
39
|
+
* until,
|
|
40
|
+
* timers: {
|
|
41
|
+
* setTimeout: window.setTimeout,
|
|
42
|
+
* clearTimeout: window.clearTimeout,
|
|
43
|
+
* },
|
|
44
|
+
* });
|
|
45
|
+
* ```
|
|
46
|
+
*/
|
|
47
|
+
timers?: PollingTimers;
|
|
48
|
+
}
|
|
49
|
+
export declare class PollingAbortError extends Error {
|
|
50
|
+
constructor(message?: string);
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
*
|
|
54
|
+
*/
|
|
55
|
+
export declare function polling<R>(options: PollingOptions<R>): Promise<R>;
|
|
56
|
+
export {};
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var _rollupPluginBabelHelpers = require('../_virtual/_rollupPluginBabelHelpers.js');
|
|
4
|
+
var workerTimers = require('worker-timers');
|
|
5
|
+
|
|
6
|
+
//
|
|
7
|
+
//
|
|
8
|
+
//
|
|
9
|
+
var DEFAULT_MAX_ATTEMPTS = 10;
|
|
10
|
+
var DEFAULT_INTERVAL = 1000;
|
|
11
|
+
//
|
|
12
|
+
//
|
|
13
|
+
//
|
|
14
|
+
var PollingAbortError = /*#__PURE__*/function (_Error) {
|
|
15
|
+
function PollingAbortError(message) {
|
|
16
|
+
var _this;
|
|
17
|
+
_rollupPluginBabelHelpers.classCallCheck(this, PollingAbortError);
|
|
18
|
+
_this = _rollupPluginBabelHelpers.callSuper(this, PollingAbortError, [message || 'Polling aborted']);
|
|
19
|
+
_this.name = 'AbortError';
|
|
20
|
+
return _this;
|
|
21
|
+
}
|
|
22
|
+
_rollupPluginBabelHelpers.inherits(PollingAbortError, _Error);
|
|
23
|
+
return _rollupPluginBabelHelpers.createClass(PollingAbortError);
|
|
24
|
+
}(/*#__PURE__*/_rollupPluginBabelHelpers.wrapNativeSuper(Error));
|
|
25
|
+
/**
|
|
26
|
+
*
|
|
27
|
+
*/
|
|
28
|
+
function polling(_x) {
|
|
29
|
+
return _polling.apply(this, arguments);
|
|
30
|
+
}
|
|
31
|
+
function _polling() {
|
|
32
|
+
_polling = _rollupPluginBabelHelpers.asyncToGenerator(/*#__PURE__*/_rollupPluginBabelHelpers.regenerator().m(function _callee2(options) {
|
|
33
|
+
var _a, _b, _c, _d, _e, _f, _g, period, maxAttempts, signal, setTimeoutFn, clearTimeoutFn, __sleep, attempt, result;
|
|
34
|
+
return _rollupPluginBabelHelpers.regenerator().w(function (_context2) {
|
|
35
|
+
while (1) switch (_context2.n) {
|
|
36
|
+
case 0:
|
|
37
|
+
period = (_a = options === null || options === void 0 ? void 0 : options.interval) !== null && _a !== void 0 ? _a : DEFAULT_INTERVAL;
|
|
38
|
+
maxAttempts = (_b = options === null || options === void 0 ? void 0 : options.maxAttempts) !== null && _b !== void 0 ? _b : DEFAULT_MAX_ATTEMPTS;
|
|
39
|
+
signal = (_c = options === null || options === void 0 ? void 0 : options.signal) !== null && _c !== void 0 ? _c : new AbortController().signal;
|
|
40
|
+
setTimeoutFn = (_e = (_d = options === null || options === void 0 ? void 0 : options.timers) === null || _d === void 0 ? void 0 : _d.setTimeout) !== null && _e !== void 0 ? _e : workerTimers.setTimeout;
|
|
41
|
+
clearTimeoutFn = (_g = (_f = options === null || options === void 0 ? void 0 : options.timers) === null || _f === void 0 ? void 0 : _f.clearTimeout) !== null && _g !== void 0 ? _g : workerTimers.clearTimeout;
|
|
42
|
+
__sleep = /*#__PURE__*/function () {
|
|
43
|
+
var _ref = _rollupPluginBabelHelpers.asyncToGenerator(/*#__PURE__*/_rollupPluginBabelHelpers.regenerator().m(function _callee() {
|
|
44
|
+
return _rollupPluginBabelHelpers.regenerator().w(function (_context) {
|
|
45
|
+
while (1) switch (_context.n) {
|
|
46
|
+
case 0:
|
|
47
|
+
return _context.a(2, new Promise(function (resolve, reject) {
|
|
48
|
+
if (signal.aborted) {
|
|
49
|
+
return reject(new PollingAbortError());
|
|
50
|
+
}
|
|
51
|
+
var id = setTimeoutFn(resolve, period);
|
|
52
|
+
signal.addEventListener('abort', function () {
|
|
53
|
+
clearTimeoutFn(id);
|
|
54
|
+
reject(new PollingAbortError());
|
|
55
|
+
}, {
|
|
56
|
+
once: true
|
|
57
|
+
});
|
|
58
|
+
}));
|
|
59
|
+
}
|
|
60
|
+
}, _callee);
|
|
61
|
+
}));
|
|
62
|
+
return function __sleep() {
|
|
63
|
+
return _ref.apply(this, arguments);
|
|
64
|
+
};
|
|
65
|
+
}();
|
|
66
|
+
attempt = 1;
|
|
67
|
+
case 1:
|
|
68
|
+
if (!(attempt <= maxAttempts)) {
|
|
69
|
+
_context2.n = 5;
|
|
70
|
+
break;
|
|
71
|
+
}
|
|
72
|
+
_context2.n = 2;
|
|
73
|
+
return options.pollingFn({
|
|
74
|
+
signal: signal
|
|
75
|
+
});
|
|
76
|
+
case 2:
|
|
77
|
+
result = _context2.v;
|
|
78
|
+
if (typeof options.onPoll === 'function') {
|
|
79
|
+
options.onPoll(result);
|
|
80
|
+
}
|
|
81
|
+
if (!options.until(result)) {
|
|
82
|
+
_context2.n = 3;
|
|
83
|
+
break;
|
|
84
|
+
}
|
|
85
|
+
return _context2.a(2, result);
|
|
86
|
+
case 3:
|
|
87
|
+
if (!(attempt < maxAttempts)) {
|
|
88
|
+
_context2.n = 4;
|
|
89
|
+
break;
|
|
90
|
+
}
|
|
91
|
+
_context2.n = 4;
|
|
92
|
+
return __sleep();
|
|
93
|
+
case 4:
|
|
94
|
+
attempt++;
|
|
95
|
+
_context2.n = 1;
|
|
96
|
+
break;
|
|
97
|
+
case 5:
|
|
98
|
+
throw new Error("Polling failed after ".concat(maxAttempts, " attempts"));
|
|
99
|
+
case 6:
|
|
100
|
+
return _context2.a(2);
|
|
101
|
+
}
|
|
102
|
+
}, _callee2);
|
|
103
|
+
}));
|
|
104
|
+
return _polling.apply(this, arguments);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
exports.PollingAbortError = PollingAbortError;
|
|
108
|
+
exports.polling = polling;
|
|
@@ -6,6 +6,13 @@ function _arrayLikeToArray(r, a) {
|
|
|
6
6
|
function _arrayWithHoles(r) {
|
|
7
7
|
if (Array.isArray(r)) return r;
|
|
8
8
|
}
|
|
9
|
+
function _arrayWithoutHoles(r) {
|
|
10
|
+
if (Array.isArray(r)) return _arrayLikeToArray(r);
|
|
11
|
+
}
|
|
12
|
+
function _assertThisInitialized(e) {
|
|
13
|
+
if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
14
|
+
return e;
|
|
15
|
+
}
|
|
9
16
|
function asyncGeneratorStep(n, t, e, r, o, a, c) {
|
|
10
17
|
try {
|
|
11
18
|
var i = n[a](c),
|
|
@@ -31,6 +38,24 @@ function _asyncToGenerator(n) {
|
|
|
31
38
|
});
|
|
32
39
|
};
|
|
33
40
|
}
|
|
41
|
+
function _callSuper(t, o, e) {
|
|
42
|
+
return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e));
|
|
43
|
+
}
|
|
44
|
+
function _classCallCheck(a, n) {
|
|
45
|
+
if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function");
|
|
46
|
+
}
|
|
47
|
+
function _construct(t, e, r) {
|
|
48
|
+
if (_isNativeReflectConstruct()) return Reflect.construct.apply(null, arguments);
|
|
49
|
+
var o = [null];
|
|
50
|
+
o.push.apply(o, e);
|
|
51
|
+
var p = new (t.bind.apply(t, o))();
|
|
52
|
+
return r && _setPrototypeOf(p, r.prototype), p;
|
|
53
|
+
}
|
|
54
|
+
function _createClass(e, r, t) {
|
|
55
|
+
return Object.defineProperty(e, "prototype", {
|
|
56
|
+
writable: false
|
|
57
|
+
}), e;
|
|
58
|
+
}
|
|
34
59
|
function _defineProperty(e, r, t) {
|
|
35
60
|
return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
36
61
|
value: t,
|
|
@@ -39,6 +64,41 @@ function _defineProperty(e, r, t) {
|
|
|
39
64
|
writable: true
|
|
40
65
|
}) : e[r] = t, e;
|
|
41
66
|
}
|
|
67
|
+
function _getPrototypeOf(t) {
|
|
68
|
+
return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) {
|
|
69
|
+
return t.__proto__ || Object.getPrototypeOf(t);
|
|
70
|
+
}, _getPrototypeOf(t);
|
|
71
|
+
}
|
|
72
|
+
function _inherits(t, e) {
|
|
73
|
+
if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function");
|
|
74
|
+
t.prototype = Object.create(e && e.prototype, {
|
|
75
|
+
constructor: {
|
|
76
|
+
value: t,
|
|
77
|
+
writable: true,
|
|
78
|
+
configurable: true
|
|
79
|
+
}
|
|
80
|
+
}), Object.defineProperty(t, "prototype", {
|
|
81
|
+
writable: false
|
|
82
|
+
}), e && _setPrototypeOf(t, e);
|
|
83
|
+
}
|
|
84
|
+
function _isNativeFunction(t) {
|
|
85
|
+
try {
|
|
86
|
+
return -1 !== Function.toString.call(t).indexOf("[native code]");
|
|
87
|
+
} catch (n) {
|
|
88
|
+
return "function" == typeof t;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
function _isNativeReflectConstruct() {
|
|
92
|
+
try {
|
|
93
|
+
var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
|
|
94
|
+
} catch (t) {}
|
|
95
|
+
return (_isNativeReflectConstruct = function () {
|
|
96
|
+
return !!t;
|
|
97
|
+
})();
|
|
98
|
+
}
|
|
99
|
+
function _iterableToArray(r) {
|
|
100
|
+
if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r);
|
|
101
|
+
}
|
|
42
102
|
function _iterableToArrayLimit(r, l) {
|
|
43
103
|
var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
44
104
|
if (null != t) {
|
|
@@ -69,6 +129,14 @@ function _iterableToArrayLimit(r, l) {
|
|
|
69
129
|
function _nonIterableRest() {
|
|
70
130
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
71
131
|
}
|
|
132
|
+
function _nonIterableSpread() {
|
|
133
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
134
|
+
}
|
|
135
|
+
function _possibleConstructorReturn(t, e) {
|
|
136
|
+
if (e && ("object" == typeof e || "function" == typeof e)) return e;
|
|
137
|
+
if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined");
|
|
138
|
+
return _assertThisInitialized(t);
|
|
139
|
+
}
|
|
72
140
|
function _regenerator() {
|
|
73
141
|
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */
|
|
74
142
|
var e,
|
|
@@ -177,6 +245,11 @@ function _regeneratorDefine(e, r, n, t) {
|
|
|
177
245
|
}) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2));
|
|
178
246
|
}, _regeneratorDefine(e, r, n, t);
|
|
179
247
|
}
|
|
248
|
+
function _setPrototypeOf(t, e) {
|
|
249
|
+
return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) {
|
|
250
|
+
return t.__proto__ = e, t;
|
|
251
|
+
}, _setPrototypeOf(t, e);
|
|
252
|
+
}
|
|
180
253
|
function _slicedToArray(r, e) {
|
|
181
254
|
return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
|
|
182
255
|
}
|
|
@@ -187,6 +260,9 @@ function _taggedTemplateLiteral(e, t) {
|
|
|
187
260
|
}
|
|
188
261
|
}));
|
|
189
262
|
}
|
|
263
|
+
function _toConsumableArray(r) {
|
|
264
|
+
return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread();
|
|
265
|
+
}
|
|
190
266
|
function _toPrimitive(t, r) {
|
|
191
267
|
if ("object" != typeof t || !t) return t;
|
|
192
268
|
var e = t[Symbol.toPrimitive];
|
|
@@ -208,5 +284,27 @@ function _unsupportedIterableToArray(r, a) {
|
|
|
208
284
|
return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;
|
|
209
285
|
}
|
|
210
286
|
}
|
|
287
|
+
function _wrapNativeSuper(t) {
|
|
288
|
+
var r = "function" == typeof Map ? new Map() : void 0;
|
|
289
|
+
return _wrapNativeSuper = function (t) {
|
|
290
|
+
if (null === t || !_isNativeFunction(t)) return t;
|
|
291
|
+
if ("function" != typeof t) throw new TypeError("Super expression must either be null or a function");
|
|
292
|
+
if (void 0 !== r) {
|
|
293
|
+
if (r.has(t)) return r.get(t);
|
|
294
|
+
r.set(t, Wrapper);
|
|
295
|
+
}
|
|
296
|
+
function Wrapper() {
|
|
297
|
+
return _construct(t, arguments, _getPrototypeOf(this).constructor);
|
|
298
|
+
}
|
|
299
|
+
return Wrapper.prototype = Object.create(t.prototype, {
|
|
300
|
+
constructor: {
|
|
301
|
+
value: Wrapper,
|
|
302
|
+
enumerable: false,
|
|
303
|
+
writable: true,
|
|
304
|
+
configurable: true
|
|
305
|
+
}
|
|
306
|
+
}), _setPrototypeOf(Wrapper, t);
|
|
307
|
+
}, _wrapNativeSuper(t);
|
|
308
|
+
}
|
|
211
309
|
|
|
212
|
-
export { _arrayLikeToArray as arrayLikeToArray, _arrayWithHoles as arrayWithHoles, _asyncToGenerator as asyncToGenerator, _defineProperty as defineProperty, _iterableToArrayLimit as iterableToArrayLimit, _nonIterableRest as nonIterableRest, _regenerator as regenerator, _regeneratorDefine as regeneratorDefine, _slicedToArray as slicedToArray, _taggedTemplateLiteral as taggedTemplateLiteral, _toPrimitive as toPrimitive, _toPropertyKey as toPropertyKey, _unsupportedIterableToArray as unsupportedIterableToArray };
|
|
310
|
+
export { _arrayLikeToArray as arrayLikeToArray, _arrayWithHoles as arrayWithHoles, _arrayWithoutHoles as arrayWithoutHoles, _assertThisInitialized as assertThisInitialized, _asyncToGenerator as asyncToGenerator, _callSuper as callSuper, _classCallCheck as classCallCheck, _construct as construct, _createClass as createClass, _defineProperty as defineProperty, _getPrototypeOf as getPrototypeOf, _inherits as inherits, _isNativeFunction as isNativeFunction, _isNativeReflectConstruct as isNativeReflectConstruct, _iterableToArray as iterableToArray, _iterableToArrayLimit as iterableToArrayLimit, _nonIterableRest as nonIterableRest, _nonIterableSpread as nonIterableSpread, _possibleConstructorReturn as possibleConstructorReturn, _regenerator as regenerator, _regeneratorDefine as regeneratorDefine, _setPrototypeOf as setPrototypeOf, _slicedToArray as slicedToArray, _taggedTemplateLiteral as taggedTemplateLiteral, _toConsumableArray as toConsumableArray, _toPrimitive as toPrimitive, _toPropertyKey as toPropertyKey, _unsupportedIterableToArray as unsupportedIterableToArray, _wrapNativeSuper as wrapNativeSuper };
|
|
@@ -15,6 +15,8 @@ import MaterialRunboxHeader from './MaterialRunboxHeader.js';
|
|
|
15
15
|
import { useMaterialRunboxContext } from './contexts/MaterialRunboxContext.js';
|
|
16
16
|
import { useMaterialRunboxApiContext } from './contexts/MaterialRunboxApiContext.js';
|
|
17
17
|
import MaterialRunboxCommandContextProvider from './contexts/MaterialRunboxCommandContext.js';
|
|
18
|
+
import MaterialRunboxDiskUsageAlert from './disk/MaterialRunboxDiskUsageAlert.js';
|
|
19
|
+
import MaterialRunboxDiskUsageDialog from './disk/MaterialRunboxDiskUsageDialog.js';
|
|
18
20
|
import { useMaterialRunboxRunboxIdStarterGet } from './hooks/useMaterialRunboxRunboxIdStarterGet.js';
|
|
19
21
|
|
|
20
22
|
var _templateObject;
|
|
@@ -280,6 +282,11 @@ var MaterialRunboxContent = function MaterialRunboxContent(_ref) {
|
|
|
280
282
|
studentUserId: studentUserId,
|
|
281
283
|
userId: userId,
|
|
282
284
|
isTutoring: isTutoring
|
|
285
|
+
}), jsx(MaterialRunboxDiskUsageAlert, {
|
|
286
|
+
runboxId: runbox.id,
|
|
287
|
+
courseId: courseId
|
|
288
|
+
}), jsx(MaterialRunboxDiskUsageDialog, {
|
|
289
|
+
runboxId: runbox.id
|
|
283
290
|
}), jsx(MaterialRunboxBody, Object.assign({
|
|
284
291
|
setSnackbarRoot: setSnackbarRoot
|
|
285
292
|
}, props))]
|
|
@@ -18,7 +18,6 @@ import { useMaterialRunboxContext } from './contexts/MaterialRunboxContext.js';
|
|
|
18
18
|
import { useMaterialRunboxApiContext } from './contexts/MaterialRunboxApiContext.js';
|
|
19
19
|
import MaterialRunboxTimer from './timer/MaterialRunboxTimer.js';
|
|
20
20
|
import MaterialRunboxStatusButton from './status/MaterialRunboxStatusButton.js';
|
|
21
|
-
import MaterialRunboxDiskAlmostFullSnackbar from './disk/MaterialRunboxDiskAlmostFullSnackbar.js';
|
|
22
21
|
import { useRunboxControl } from './hooks/useRunboxControl.js';
|
|
23
22
|
|
|
24
23
|
var StyledHeader = /*#__PURE__*/_styled("div", {
|
|
@@ -26,25 +25,28 @@ var StyledHeader = /*#__PURE__*/_styled("div", {
|
|
|
26
25
|
})("position:relative;flex:0 0 3rem;display:flex;justify-content:flex-start;align-items:center;gap:1rem;padding:0 1rem;width:100%;border-bottom:1px solid ", function (_ref) {
|
|
27
26
|
var theme = _ref.theme;
|
|
28
27
|
return theme.palette.divider;
|
|
29
|
-
}, ";overflow:hidden;
|
|
28
|
+
}, ";overflow:hidden;color:", function (_ref2) {
|
|
30
29
|
var theme = _ref2.theme;
|
|
30
|
+
return theme.palette.text.primary;
|
|
31
|
+
}, ";background-color:", function (_ref3) {
|
|
32
|
+
var theme = _ref3.theme;
|
|
31
33
|
return theme.palette.background.paper;
|
|
32
34
|
}, ";");
|
|
33
35
|
//
|
|
34
36
|
//
|
|
35
37
|
//
|
|
36
|
-
var MaterialRunboxHeader = function MaterialRunboxHeader(
|
|
37
|
-
var runbox =
|
|
38
|
-
runtime =
|
|
39
|
-
runtimeTemplate =
|
|
40
|
-
courseId =
|
|
41
|
-
userId =
|
|
42
|
-
studentUserId =
|
|
43
|
-
isTutoring =
|
|
44
|
-
refetch =
|
|
45
|
-
getAchievementColor =
|
|
46
|
-
|
|
47
|
-
hideTimerPopover =
|
|
38
|
+
var MaterialRunboxHeader = function MaterialRunboxHeader(_ref4) {
|
|
39
|
+
var runbox = _ref4.runbox,
|
|
40
|
+
runtime = _ref4.runtime,
|
|
41
|
+
runtimeTemplate = _ref4.runtimeTemplate,
|
|
42
|
+
courseId = _ref4.courseId,
|
|
43
|
+
userId = _ref4.userId,
|
|
44
|
+
studentUserId = _ref4.studentUserId,
|
|
45
|
+
isTutoring = _ref4.isTutoring,
|
|
46
|
+
refetch = _ref4.refetch,
|
|
47
|
+
getAchievementColor = _ref4.getAchievementColor,
|
|
48
|
+
_ref4$hideTimerPopove = _ref4.hideTimerPopover,
|
|
49
|
+
hideTimerPopover = _ref4$hideTimerPopove === void 0 ? false : _ref4$hideTimerPopove;
|
|
48
50
|
var intl = useRawEliceIntl();
|
|
49
51
|
var _useMaterialRunboxCon = useMaterialRunboxContext(),
|
|
50
52
|
enableAutoShutdownToggle = _useMaterialRunboxCon.enableAutoShutdownToggle;
|
|
@@ -95,8 +97,8 @@ var MaterialRunboxHeader = function MaterialRunboxHeader(_ref3) {
|
|
|
95
97
|
courseId: courseId,
|
|
96
98
|
runtime: runtime
|
|
97
99
|
}],
|
|
98
|
-
queryFn: function queryFn(
|
|
99
|
-
var signal =
|
|
100
|
+
queryFn: function queryFn(_ref5) {
|
|
101
|
+
var signal = _ref5.signal;
|
|
100
102
|
return materialRunboxApi.runbox.runboxRunboxIdSubmitInfoGet({
|
|
101
103
|
eliceCourseId: courseId,
|
|
102
104
|
runboxId: runtime === null || runtime === void 0 ? void 0 : runtime.runboxId
|
|
@@ -217,8 +219,9 @@ var MaterialRunboxHeader = function MaterialRunboxHeader(_ref3) {
|
|
|
217
219
|
stopRuntime: stopRuntime,
|
|
218
220
|
hideTimerPopover: hideTimerPopover,
|
|
219
221
|
isTutoring: isTutoring
|
|
220
|
-
}) : null, jsx(MaterialRunboxStatusButton, {
|
|
221
|
-
runboxId: runbox.id
|
|
222
|
+
}) : null, jsx(MaterialRunboxStatusButton, {
|
|
223
|
+
runboxId: runbox.id,
|
|
224
|
+
courseId: courseId
|
|
222
225
|
}), jsxs(Stack, {
|
|
223
226
|
direction: "row",
|
|
224
227
|
alignItems: "center",
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
export interface MaterialRunboxDiskUsageAlertProps {
|
|
3
|
+
runboxId: string;
|
|
4
|
+
courseId: number;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Persistent bar under the header once disk usage passes 80%. Unlike the notice
|
|
8
|
+
* dialog it stays put, because it carries the only way out — the reset CTA.
|
|
9
|
+
*/
|
|
10
|
+
declare const MaterialRunboxDiskUsageAlert: React.FC<MaterialRunboxDiskUsageAlertProps>;
|
|
11
|
+
export default MaterialRunboxDiskUsageAlert;
|
|
@@ -0,0 +1,65 @@
|
|
|
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 runboxId = _ref.runboxId,
|
|
18
|
+
courseId = _ref.courseId;
|
|
19
|
+
var intl = useRawEliceIntl();
|
|
20
|
+
var _useRunboxDiskUsage = useRunboxDiskUsage(),
|
|
21
|
+
severity = _useRunboxDiskUsage.severity,
|
|
22
|
+
diskCurrent = _useRunboxDiskUsage.diskCurrent,
|
|
23
|
+
diskTotal = _useRunboxDiskUsage.diskTotal;
|
|
24
|
+
if (!severity) {
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
//
|
|
28
|
+
//
|
|
29
|
+
//
|
|
30
|
+
return jsx(Alert, {
|
|
31
|
+
severity: severity,
|
|
32
|
+
sx: {
|
|
33
|
+
width: '100%',
|
|
34
|
+
borderRadius: '0',
|
|
35
|
+
alignItems: 'center'
|
|
36
|
+
},
|
|
37
|
+
action: jsx(MaterialRunboxEnvResetButton, {
|
|
38
|
+
variant: "text",
|
|
39
|
+
size: "small",
|
|
40
|
+
color: "inherit",
|
|
41
|
+
startIcon: jsx(EliceIcon, {
|
|
42
|
+
icon: faArrowsRotate
|
|
43
|
+
}),
|
|
44
|
+
runboxId: runboxId,
|
|
45
|
+
courseId: courseId
|
|
46
|
+
}),
|
|
47
|
+
children: jsx(Typography, {
|
|
48
|
+
variant: "body2",
|
|
49
|
+
children: intl.formatMessage({
|
|
50
|
+
id: "runbox.disk.usage.alert.".concat(severity)
|
|
51
|
+
}, {
|
|
52
|
+
used: intl.formatDataSize(diskCurrent, {
|
|
53
|
+
unitSystem: 'iec',
|
|
54
|
+
maximumFractionDigits: 2
|
|
55
|
+
}),
|
|
56
|
+
total: intl.formatDataSize(diskTotal, {
|
|
57
|
+
unitSystem: 'iec',
|
|
58
|
+
maximumFractionDigits: 2
|
|
59
|
+
})
|
|
60
|
+
})
|
|
61
|
+
})
|
|
62
|
+
});
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
export { MaterialRunboxDiskUsageAlert as default };
|