@elice/material-runbox 1.260825.0-runboxusability.2 → 1.260826.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 (81) hide show
  1. package/cjs/assets/runbox_logo.png.js +7 -0
  2. package/cjs/components/material-runbox/MaterialRunboxContent.js +2 -1
  3. package/cjs/components/material-runbox/MaterialRunboxFooter.d.ts +4 -0
  4. package/cjs/components/material-runbox/MaterialRunboxFooter.js +64 -0
  5. package/cjs/components/material-runbox/MaterialRunboxHeader.js +29 -12
  6. package/cjs/components/material-runbox/actions/MaterialRunboxActionMenu.d.ts +1 -3
  7. package/cjs/components/material-runbox/actions/MaterialRunboxActionMenu.js +1 -22
  8. package/cjs/components/material-runbox/hooks/index.d.ts +0 -2
  9. package/cjs/components/material-runbox/hooks/index.js +0 -10
  10. package/cjs/components/material-runbox/locales/en.json.js +1 -1
  11. package/cjs/components/material-runbox/locales/ja.json.js +1 -1
  12. package/cjs/components/material-runbox/locales/ko.json.js +1 -1
  13. package/cjs/components/material-runbox/locales/th.json.js +1 -1
  14. package/cjs/components/material-runbox/timer/MaterialRunboxAlmostEndSnackbars.d.ts +6 -0
  15. package/cjs/components/material-runbox/timer/MaterialRunboxAlmostEndSnackbars.js +90 -0
  16. package/cjs/components/material-runbox/timer/MaterialRunboxTimer.d.ts +0 -6
  17. package/cjs/components/material-runbox/timer/MaterialRunboxTimer.js +16 -20
  18. package/cjs/components/material-runbox/timer/MaterialRunboxTimerDetailPopover.js +81 -21
  19. package/es/assets/runbox_logo.png.js +3 -0
  20. package/es/components/material-runbox/MaterialRunboxContent.js +2 -1
  21. package/es/components/material-runbox/MaterialRunboxFooter.d.ts +4 -0
  22. package/es/components/material-runbox/MaterialRunboxFooter.js +56 -0
  23. package/es/components/material-runbox/MaterialRunboxHeader.js +30 -13
  24. package/es/components/material-runbox/actions/MaterialRunboxActionMenu.d.ts +1 -3
  25. package/es/components/material-runbox/actions/MaterialRunboxActionMenu.js +3 -24
  26. package/es/components/material-runbox/hooks/index.d.ts +0 -2
  27. package/es/components/material-runbox/hooks/index.js +0 -2
  28. package/es/components/material-runbox/locales/en.json.js +1 -1
  29. package/es/components/material-runbox/locales/ja.json.js +1 -1
  30. package/es/components/material-runbox/locales/ko.json.js +1 -1
  31. package/es/components/material-runbox/locales/th.json.js +1 -1
  32. package/es/components/material-runbox/timer/MaterialRunboxAlmostEndSnackbars.d.ts +6 -0
  33. package/es/components/material-runbox/timer/MaterialRunboxAlmostEndSnackbars.js +86 -0
  34. package/es/components/material-runbox/timer/MaterialRunboxTimer.d.ts +0 -6
  35. package/es/components/material-runbox/timer/MaterialRunboxTimer.js +15 -19
  36. package/es/components/material-runbox/timer/MaterialRunboxTimerDetailPopover.js +78 -18
  37. package/package.json +6 -6
  38. package/cjs/components/material-runbox/hooks/useRunboxNetworkStatus.d.ts +0 -14
  39. package/cjs/components/material-runbox/hooks/useRunboxNetworkStatus.js +0 -65
  40. package/cjs/components/material-runbox/hooks/useRunboxSessionEndWarning.d.ts +0 -18
  41. package/cjs/components/material-runbox/hooks/useRunboxSessionEndWarning.js +0 -67
  42. package/cjs/components/material-runbox/status/MaterialRunboxStatusButton.d.ts +0 -18
  43. package/cjs/components/material-runbox/status/MaterialRunboxStatusButton.js +0 -89
  44. package/cjs/components/material-runbox/status/MaterialRunboxStatusConnectionItem.d.ts +0 -12
  45. package/cjs/components/material-runbox/status/MaterialRunboxStatusConnectionItem.js +0 -35
  46. package/cjs/components/material-runbox/status/MaterialRunboxStatusPopover.d.ts +0 -17
  47. package/cjs/components/material-runbox/status/MaterialRunboxStatusPopover.js +0 -142
  48. package/cjs/components/material-runbox/status/MaterialRunboxStatusResourceItem.d.ts +0 -11
  49. package/cjs/components/material-runbox/status/MaterialRunboxStatusResourceItem.js +0 -41
  50. package/cjs/components/material-runbox/status/index.d.ts +0 -4
  51. package/cjs/components/material-runbox/status/index.js +0 -9
  52. package/cjs/components/material-runbox/timer/MaterialRunboxQuotaAlmostEndDialog.d.ts +0 -11
  53. package/cjs/components/material-runbox/timer/MaterialRunboxQuotaAlmostEndDialog.js +0 -117
  54. package/cjs/components/material-runbox/timer/MaterialRunboxQuotaAmount.d.ts +0 -13
  55. package/cjs/components/material-runbox/timer/MaterialRunboxQuotaAmount.js +0 -56
  56. package/cjs/components/material-runbox/timer/MaterialRunboxQuotaPerSessionAlmostEndDialog.d.ts +0 -12
  57. package/cjs/components/material-runbox/timer/MaterialRunboxQuotaPerSessionAlmostEndDialog.js +0 -118
  58. package/cjs/components/material-runbox/timer/MaterialRunboxQuotaTimePart.d.ts +0 -15
  59. package/cjs/components/material-runbox/timer/MaterialRunboxQuotaTimePart.js +0 -50
  60. package/es/components/material-runbox/hooks/useRunboxNetworkStatus.d.ts +0 -14
  61. package/es/components/material-runbox/hooks/useRunboxNetworkStatus.js +0 -59
  62. package/es/components/material-runbox/hooks/useRunboxSessionEndWarning.d.ts +0 -18
  63. package/es/components/material-runbox/hooks/useRunboxSessionEndWarning.js +0 -63
  64. package/es/components/material-runbox/status/MaterialRunboxStatusButton.d.ts +0 -18
  65. package/es/components/material-runbox/status/MaterialRunboxStatusButton.js +0 -81
  66. package/es/components/material-runbox/status/MaterialRunboxStatusConnectionItem.d.ts +0 -12
  67. package/es/components/material-runbox/status/MaterialRunboxStatusConnectionItem.js +0 -31
  68. package/es/components/material-runbox/status/MaterialRunboxStatusPopover.d.ts +0 -17
  69. package/es/components/material-runbox/status/MaterialRunboxStatusPopover.js +0 -138
  70. package/es/components/material-runbox/status/MaterialRunboxStatusResourceItem.d.ts +0 -11
  71. package/es/components/material-runbox/status/MaterialRunboxStatusResourceItem.js +0 -37
  72. package/es/components/material-runbox/status/index.d.ts +0 -4
  73. package/es/components/material-runbox/status/index.js +0 -2
  74. package/es/components/material-runbox/timer/MaterialRunboxQuotaAlmostEndDialog.d.ts +0 -11
  75. package/es/components/material-runbox/timer/MaterialRunboxQuotaAlmostEndDialog.js +0 -113
  76. package/es/components/material-runbox/timer/MaterialRunboxQuotaAmount.d.ts +0 -13
  77. package/es/components/material-runbox/timer/MaterialRunboxQuotaAmount.js +0 -52
  78. package/es/components/material-runbox/timer/MaterialRunboxQuotaPerSessionAlmostEndDialog.d.ts +0 -12
  79. package/es/components/material-runbox/timer/MaterialRunboxQuotaPerSessionAlmostEndDialog.js +0 -114
  80. package/es/components/material-runbox/timer/MaterialRunboxQuotaTimePart.d.ts +0 -15
  81. package/es/components/material-runbox/timer/MaterialRunboxQuotaTimePart.js +0 -46
@@ -1,59 +0,0 @@
1
- import React from 'react';
2
- import { useEliceRunboxContainerStats } from '@elice/runbox-client';
3
-
4
- //
5
- //
6
- //
7
- var RunboxNetworkStatus;
8
- (function (RunboxNetworkStatus) {
9
- RunboxNetworkStatus["Good"] = "good";
10
- RunboxNetworkStatus["NotGood"] = "not_good";
11
- RunboxNetworkStatus["Bad"] = "bad";
12
- })(RunboxNetworkStatus || (RunboxNetworkStatus = {}));
13
- //
14
- //
15
- //
16
- var RTT_THRESHOLD_GOOD = 600; // Fast 3G
17
- var RTT_THRESHOLD_BAD = 1200; // Slow 3G
18
- /** A failed heartbeat carries no `__rtt`, which counts as the worst latency. */
19
- var MISSING_RTT = 1e10;
20
- //
21
- //
22
- //
23
- /**
24
- * Runbox network quality, derived from the heartbeat round trip.
25
- *
26
- * `null` until the first sample arrives.
27
- */
28
- var useRunboxNetworkStatus = function useRunboxNetworkStatus() {
29
- var stats = useEliceRunboxContainerStats();
30
- /** Averaged over the newer half, so a recovered connection is not held back. */
31
- var avgRtt = React.useMemo(function () {
32
- if (!stats.length) {
33
- return null;
34
- }
35
- var recent = stats.slice(stats.length / 2, stats.length);
36
- return recent.reduce(function (acc, stat) {
37
- var _a;
38
- return acc + ((_a = stat === null || stat === void 0 ? void 0 : stat.__rtt) !== null && _a !== void 0 ? _a : MISSING_RTT);
39
- }, 0) / recent.length;
40
- }, [stats]);
41
- var status = React.useMemo(function () {
42
- if (avgRtt === null) {
43
- return null;
44
- }
45
- if (avgRtt < RTT_THRESHOLD_GOOD) {
46
- return RunboxNetworkStatus.Good;
47
- }
48
- if (avgRtt < RTT_THRESHOLD_BAD) {
49
- return RunboxNetworkStatus.NotGood;
50
- }
51
- return RunboxNetworkStatus.Bad;
52
- }, [avgRtt]);
53
- return {
54
- avgRtt: avgRtt,
55
- status: status
56
- };
57
- };
58
-
59
- export { RunboxNetworkStatus, useRunboxNetworkStatus };
@@ -1,18 +0,0 @@
1
- export type RunboxSessionEndWarning = 'quota' | 'quotaPerSession';
2
- interface UseRunboxSessionEndWarningParams {
3
- runboxId: string;
4
- /**
5
- * Suppress every warning.
6
- * @default false
7
- */
8
- disabled?: boolean;
9
- }
10
- interface UseRunboxSessionEndWarningReturn {
11
- warning: RunboxSessionEndWarning | null;
12
- /** Marks the current warning as seen, which is what closes it. */
13
- dismiss: () => void;
14
- }
15
- export declare const QUOTA_ALMOST_END_MINUTES = 30;
16
- export declare const QUOTA_PER_SESSION_ALMOST_END_MINUTES = 10;
17
- export declare function useRunboxSessionEndWarning({ runboxId, disabled, }: UseRunboxSessionEndWarningParams): UseRunboxSessionEndWarningReturn;
18
- export {};
@@ -1,63 +0,0 @@
1
- import { slicedToArray as _slicedToArray, defineProperty as _defineProperty } from '../../../_virtual/_rollupPluginBabelHelpers.js';
2
- import { useSessionStorage } from 'react-use';
3
- import { useEliceRunboxQuota } from '@elice/runbox-client';
4
-
5
- //
6
- //
7
- //
8
- var QUOTA_ALMOST_END_MINUTES = 30;
9
- var QUOTA_PER_SESSION_ALMOST_END_MINUTES = 10;
10
- var WAS_WARNED_STORAGE_KEY = 'MaterialRunboxSessionEndWarning.wasWarned';
11
- //
12
- //
13
- //
14
- /** Remaining minutes while the almost-end warning is due, `null` when it is not. */
15
- function getAlmostEndRemaining(quotaInfo, thresholdMinutes) {
16
- var seen = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
17
- if (seen || quotaInfo.isUnlimited || quotaInfo.remainingQuota > thresholdMinutes) {
18
- return null;
19
- }
20
- return quotaInfo.remainingQuota;
21
- }
22
- /** The due warning that runs out soonest, `null` when neither is due. */
23
- function getSessionEndWarning(quotaInfo, quotaPerSessionInfo, seen) {
24
- var quota = getAlmostEndRemaining(quotaInfo, QUOTA_ALMOST_END_MINUTES, seen.quota);
25
- var quotaPerSession = getAlmostEndRemaining(quotaPerSessionInfo, QUOTA_PER_SESSION_ALMOST_END_MINUTES, seen.quotaPerSession);
26
- if (quota === null) {
27
- return quotaPerSession === null ? null : 'quotaPerSession';
28
- }
29
- if (quotaPerSession === null) {
30
- return 'quota';
31
- }
32
- return quota < quotaPerSession ? 'quota' : 'quotaPerSession';
33
- }
34
- //
35
- //
36
- //
37
- function useRunboxSessionEndWarning(_ref) {
38
- var runboxId = _ref.runboxId,
39
- _ref$disabled = _ref.disabled,
40
- disabled = _ref$disabled === void 0 ? false : _ref$disabled;
41
- var _a;
42
- var _useEliceRunboxQuota = useEliceRunboxQuota(),
43
- quotaInfo = _useEliceRunboxQuota.quotaInfo,
44
- quotaPerSessionInfo = _useEliceRunboxQuota.quotaPerSessionInfo;
45
- var _useSessionStorage = useSessionStorage(WAS_WARNED_STORAGE_KEY, {}),
46
- _useSessionStorage2 = _slicedToArray(_useSessionStorage, 2),
47
- wasWarned = _useSessionStorage2[0],
48
- setWasWarned = _useSessionStorage2[1];
49
- var seen = (_a = wasWarned === null || wasWarned === void 0 ? void 0 : wasWarned[runboxId]) !== null && _a !== void 0 ? _a : {};
50
- var warning = disabled ? null : getSessionEndWarning(quotaInfo, quotaPerSessionInfo, seen);
51
- var dismiss = function dismiss() {
52
- if (warning === null) {
53
- return;
54
- }
55
- setWasWarned(Object.assign(Object.assign({}, wasWarned), _defineProperty({}, runboxId, Object.assign(Object.assign({}, seen), _defineProperty({}, warning, true)))));
56
- };
57
- return {
58
- warning: warning,
59
- dismiss: dismiss
60
- };
61
- }
62
-
63
- export { QUOTA_ALMOST_END_MINUTES, QUOTA_PER_SESSION_ALMOST_END_MINUTES, useRunboxSessionEndWarning };
@@ -1,18 +0,0 @@
1
- import React from 'react';
2
- export interface MaterialRunboxStatusButtonProps {
3
- /**
4
- * Bottom action slot of the popover.
5
- *
6
- * NOTICE: the "실습 환경 초기화" button is out of scope for PLAT-4181.
7
- * PLAT-4184 injects it here.
8
- */
9
- bottomAction?: React.ReactNode;
10
- }
11
- /**
12
- * Opens the runbox connection/resource status popover.
13
- *
14
- * Replaces the always-visible resource stats of the removed footer,
15
- * so the numbers are only shown on explicit request. (`[R-5]` `[R-6]`)
16
- */
17
- declare const MaterialRunboxStatusButton: React.FC<MaterialRunboxStatusButtonProps>;
18
- export default MaterialRunboxStatusButton;
@@ -1,81 +0,0 @@
1
- import { slicedToArray as _slicedToArray, defineProperty as _defineProperty } from '../../../_virtual/_rollupPluginBabelHelpers.js';
2
- import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
3
- import React from 'react';
4
- import { useRawEliceIntl } from '@elice/intl';
5
- import { EliceIcon } from '@elice/mui-elements';
6
- import { useEliceRunboxRunning } from '@elice/runbox-client';
7
- import { faAngleDown, faWifi } from '@fortawesome/pro-solid-svg-icons';
8
- import { Button, buttonClasses } from '@mui/material';
9
- import MaterialRunboxStatusPopover from './MaterialRunboxStatusPopover.js';
10
-
11
- //
12
- //
13
- //
14
- /**
15
- * Opens the runbox connection/resource status popover.
16
- *
17
- * Replaces the always-visible resource stats of the removed footer,
18
- * so the numbers are only shown on explicit request. (`[R-5]` `[R-6]`)
19
- */
20
- var MaterialRunboxStatusButton = function MaterialRunboxStatusButton(_ref) {
21
- var bottomAction = _ref.bottomAction;
22
- var intl = useRawEliceIntl();
23
- var _useEliceRunboxRunnin = useEliceRunboxRunning(),
24
- status = _useEliceRunboxRunnin.status;
25
- var _React$useState = React.useState(null),
26
- _React$useState2 = _slicedToArray(_React$useState, 2),
27
- anchorEl = _React$useState2[0],
28
- setAnchorEl = _React$useState2[1];
29
- var isRunboxRunning = status === 'running';
30
- /**
31
- *
32
- */
33
- var handleClose = function handleClose() {
34
- setAnchorEl(null);
35
- };
36
- //
37
- //
38
- //
39
- return jsxs(Fragment, {
40
- children: [jsx(Button, {
41
- variant: "text",
42
- size: "small",
43
- color: "inherit",
44
- startIcon: jsx(EliceIcon, {
45
- icon: faWifi
46
- }),
47
- endIcon: jsx(EliceIcon, {
48
- icon: faAngleDown
49
- }),
50
- sx: _defineProperty({}, "& .".concat(buttonClasses.startIcon), {
51
- color: isRunboxRunning ? 'success.main' : 'text.disabled'
52
- }),
53
- onClick: function onClick(e) {
54
- return setAnchorEl(function (prev) {
55
- return prev ? null : e.currentTarget;
56
- });
57
- },
58
- children: intl.formatMessage({
59
- id: 'runbox.status.button.title'
60
- })
61
- }), jsx(MaterialRunboxStatusPopover, {
62
- open: Boolean(anchorEl),
63
- anchorEl: anchorEl,
64
- anchorOrigin: {
65
- vertical: 'bottom',
66
- horizontal: 'left'
67
- },
68
- transformOrigin: {
69
- vertical: 'top',
70
- horizontal: 'left'
71
- },
72
- sx: {
73
- marginTop: '0.5rem'
74
- },
75
- bottomAction: bottomAction,
76
- onClose: handleClose
77
- })]
78
- });
79
- };
80
-
81
- export { MaterialRunboxStatusButton as default };
@@ -1,12 +0,0 @@
1
- import type { TypographyProps } from '@mui/material';
2
- import type React from 'react';
3
- export interface MaterialRunboxStatusConnectionItemProps {
4
- /** Leading icon element, or a progress indicator while connecting. */
5
- icon: React.ReactNode;
6
- /** Row label. */
7
- label: React.ReactNode;
8
- /** Palette color for the icon, e.g. `success.main`. */
9
- color?: TypographyProps['color'];
10
- }
11
- declare const MaterialRunboxStatusConnectionItem: React.FC<MaterialRunboxStatusConnectionItemProps>;
12
- export default MaterialRunboxStatusConnectionItem;
@@ -1,31 +0,0 @@
1
- import { jsxs, jsx } from 'react/jsx-runtime';
2
- import { Stack, Typography } from '@mui/material';
3
-
4
- //
5
- //
6
- //
7
- var MaterialRunboxStatusConnectionItem = function MaterialRunboxStatusConnectionItem(_ref) {
8
- var icon = _ref.icon,
9
- label = _ref.label,
10
- _ref$color = _ref.color,
11
- color = _ref$color === void 0 ? 'text.disabled' : _ref$color;
12
- return jsxs(Stack, {
13
- direction: "row",
14
- alignItems: "center",
15
- gap: "0.75rem",
16
- minHeight: "2.5rem",
17
- padding: "0 0.75rem",
18
- children: [jsx(Typography, {
19
- component: "span",
20
- display: "inline-flex",
21
- color: color,
22
- children: icon
23
- }), jsx(Typography, {
24
- variant: "body2",
25
- color: "text.tertiary",
26
- children: label
27
- })]
28
- });
29
- };
30
-
31
- export { MaterialRunboxStatusConnectionItem as default };
@@ -1,17 +0,0 @@
1
- import type { PopoverProps } from '@mui/material';
2
- import type React from 'react';
3
- export interface MaterialRunboxStatusPopoverProps extends Omit<PopoverProps, 'open' | 'onClose' | 'children'> {
4
- /** Whether the popover is open. */
5
- open: boolean;
6
- /** Called when the popover requests to be closed. */
7
- onClose: () => void;
8
- /**
9
- * Bottom action slot.
10
- *
11
- * NOTICE: the "실습 환경 초기화" button is out of scope for PLAT-4181.
12
- * PLAT-4184 injects it here.
13
- */
14
- bottomAction?: React.ReactNode;
15
- }
16
- declare const MaterialRunboxStatusPopover: React.FC<MaterialRunboxStatusPopoverProps>;
17
- export default MaterialRunboxStatusPopover;
@@ -1,138 +0,0 @@
1
- import { defineProperty as _defineProperty } from '../../../_virtual/_rollupPluginBabelHelpers.js';
2
- import { __rest } from 'tslib';
3
- import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
4
- import { useRawEliceIntl } from '@elice/intl';
5
- import { EliceIcon } from '@elice/mui-elements';
6
- import { useEliceRunboxRunning, useEliceRunboxContainerStats } from '@elice/runbox-client';
7
- import { faWifi, faWifiFair, faLinkSimple, faLinkSimpleSlash, faMicrochip, faMemory, faArrowUpRight, faArrowDownLeft, faDiscDrive, faWifiSlash } from '@fortawesome/pro-solid-svg-icons';
8
- import { Popover, Fade, Stack, CircularProgress, Divider } from '@mui/material';
9
- import MaterialRunboxStatusConnectionItem from './MaterialRunboxStatusConnectionItem.js';
10
- import MaterialRunboxStatusResourceItem from './MaterialRunboxStatusResourceItem.js';
11
- import { RunboxNetworkStatus, useRunboxNetworkStatus } from '../hooks/useRunboxNetworkStatus.js';
12
-
13
- //
14
- //
15
- //
16
- var POPOVER_WIDTH = '15.25rem'; // 244px
17
- var NETWORK_ICON = Object.freeze(_defineProperty(_defineProperty(_defineProperty({}, RunboxNetworkStatus.Good, faWifi), RunboxNetworkStatus.NotGood, faWifiFair), RunboxNetworkStatus.Bad, faWifiSlash));
18
- var NETWORK_COLOR = Object.freeze(_defineProperty(_defineProperty(_defineProperty({}, RunboxNetworkStatus.Good, 'success.main'), RunboxNetworkStatus.NotGood, 'warning.main'), RunboxNetworkStatus.Bad, 'error.main'));
19
- //
20
- //
21
- //
22
- var MaterialRunboxStatusPopover = function MaterialRunboxStatusPopover(_a) {
23
- var open = _a.open,
24
- onClose = _a.onClose,
25
- bottomAction = _a.bottomAction,
26
- props = __rest(_a, ["open", "onClose", "bottomAction"]);
27
- var intl = useRawEliceIntl();
28
- var _useEliceRunboxRunnin = useEliceRunboxRunning(),
29
- status = _useEliceRunboxRunnin.status;
30
- var _useRunboxNetworkStat = useRunboxNetworkStatus(),
31
- networkStatus = _useRunboxNetworkStat.status;
32
- var contStats = useEliceRunboxContainerStats();
33
- var stats = contStats ? contStats[contStats.length - 1] : null;
34
- var isRunboxConnecting = status === 'queued' || status === 'assigned';
35
- var isRunboxRunning = status === 'running';
36
- //
37
- //
38
- //
39
- return jsx(Popover, Object.assign({
40
- open: open,
41
- TransitionComponent: Fade,
42
- onClose: onClose
43
- }, props, {
44
- children: jsxs(Stack, {
45
- direction: "column",
46
- gap: "0.75rem",
47
- padding: "0.75rem",
48
- width: POPOVER_WIDTH,
49
- bgcolor: "background.paper",
50
- children: [jsxs(Stack, {
51
- direction: "column",
52
- children: [networkStatus ? jsx(MaterialRunboxStatusConnectionItem, {
53
- icon: jsx(EliceIcon, {
54
- icon: NETWORK_ICON[networkStatus],
55
- fontSize: "small"
56
- }),
57
- label: intl.formatMessage({
58
- id: 'runbox.status.network'
59
- }),
60
- color: NETWORK_COLOR[networkStatus]
61
- }) : null, jsx(MaterialRunboxStatusConnectionItem, {
62
- icon: isRunboxConnecting ? jsx(CircularProgress, {
63
- color: "inherit",
64
- size: "1rem"
65
- }) : jsx(EliceIcon, {
66
- icon: isRunboxRunning ? faLinkSimple : faLinkSimpleSlash,
67
- fontSize: "small"
68
- }),
69
- label: intl.formatMessage({
70
- id: isRunboxConnecting ? 'runbox.status.runtime.connecting' : isRunboxRunning ? 'runbox.status.runtime.connected' : 'runbox.status.runtime.disconnected'
71
- }),
72
- color: isRunboxRunning ? 'success.main' : 'text.disabled'
73
- })]
74
- }), stats ? jsxs(Fragment, {
75
- children: [jsx(Divider, {}), jsxs(Stack, {
76
- direction: "column",
77
- children: [jsx(MaterialRunboxStatusResourceItem, {
78
- icon: jsx(EliceIcon, {
79
- icon: faMicrochip,
80
- fontSize: "small"
81
- }),
82
- label: "CPU",
83
- value: intl.formatNumber(stats.avgCpu, {
84
- style: 'percent',
85
- maximumFractionDigits: 2
86
- })
87
- }), jsx(MaterialRunboxStatusResourceItem, {
88
- icon: jsx(EliceIcon, {
89
- icon: faMemory,
90
- fontSize: "small"
91
- }),
92
- label: "Memory",
93
- value: "".concat(intl.formatDataSize(stats.memCurrent, {
94
- unitSystem: 'iec',
95
- maximumFractionDigits: 2
96
- }), " / ").concat(intl.formatDataSize(stats.memTotal, {
97
- unitSystem: 'iec',
98
- maximumFractionDigits: 2
99
- }))
100
- }), jsx(MaterialRunboxStatusResourceItem, {
101
- icon: jsx(EliceIcon, {
102
- icon: faArrowUpRight,
103
- fontSize: "small"
104
- }),
105
- label: "UP",
106
- value: "".concat(intl.formatDataSize(stats.netOutPsec, {
107
- unitSystem: 'iec'
108
- }), "/s")
109
- }), jsx(MaterialRunboxStatusResourceItem, {
110
- icon: jsx(EliceIcon, {
111
- icon: faArrowDownLeft,
112
- fontSize: "small"
113
- }),
114
- label: "DOWN",
115
- value: "".concat(intl.formatDataSize(stats.netInPsec, {
116
- unitSystem: 'iec'
117
- }), "/s")
118
- }), jsx(MaterialRunboxStatusResourceItem, {
119
- icon: jsx(EliceIcon, {
120
- icon: faDiscDrive,
121
- fontSize: "small"
122
- }),
123
- label: "DISK",
124
- value: "".concat(intl.formatDataSize(stats.diskCurrent, {
125
- unitSystem: 'iec',
126
- maximumFractionDigits: 2
127
- }), " / ").concat(intl.formatDataSize(stats.diskTotal, {
128
- unitSystem: 'iec',
129
- maximumFractionDigits: 2
130
- }))
131
- })]
132
- })]
133
- }) : null, bottomAction]
134
- })
135
- }));
136
- };
137
-
138
- export { MaterialRunboxStatusPopover as default };
@@ -1,11 +0,0 @@
1
- import type React from 'react';
2
- export interface MaterialRunboxStatusResourceItemProps {
3
- /** Leading icon element. */
4
- icon: React.ReactNode;
5
- /** Resource label, e.g. `CPU`. */
6
- label: React.ReactNode;
7
- /** Formatted value, e.g. `438.33 MiB / 4 GiB`. */
8
- value: React.ReactNode;
9
- }
10
- declare const MaterialRunboxStatusResourceItem: React.FC<MaterialRunboxStatusResourceItemProps>;
11
- export default MaterialRunboxStatusResourceItem;
@@ -1,37 +0,0 @@
1
- import { jsxs, jsx } from 'react/jsx-runtime';
2
- import { Stack, Typography } from '@mui/material';
3
-
4
- //
5
- //
6
- //
7
- var MaterialRunboxStatusResourceItem = function MaterialRunboxStatusResourceItem(_ref) {
8
- var icon = _ref.icon,
9
- label = _ref.label,
10
- value = _ref.value;
11
- return jsxs(Stack, {
12
- direction: "row",
13
- alignItems: "center",
14
- gap: "0.75rem",
15
- padding: "0.375rem 0.75rem",
16
- children: [jsx(Typography, {
17
- component: "span",
18
- display: "inline-flex",
19
- color: "text.tertiary",
20
- children: icon
21
- }), jsxs(Stack, {
22
- direction: "column",
23
- children: [jsx(Typography, {
24
- variant: "body2",
25
- color: "text.tertiary",
26
- children: label
27
- }), jsx(Typography, {
28
- variant: "caption",
29
- color: "text.tertiary",
30
- fontFamily: "'JetBrains Mono', monospace",
31
- children: value
32
- })]
33
- })]
34
- });
35
- };
36
-
37
- export { MaterialRunboxStatusResourceItem as default };
@@ -1,4 +0,0 @@
1
- export { default as MaterialRunboxStatusButton } from './MaterialRunboxStatusButton';
2
- export { default as MaterialRunboxStatusPopover } from './MaterialRunboxStatusPopover';
3
- export type { MaterialRunboxStatusButtonProps } from './MaterialRunboxStatusButton';
4
- export type { MaterialRunboxStatusPopoverProps } from './MaterialRunboxStatusPopover';
@@ -1,2 +0,0 @@
1
- export { default as MaterialRunboxStatusButton } from './MaterialRunboxStatusButton.js';
2
- export { default as MaterialRunboxStatusPopover } from './MaterialRunboxStatusPopover.js';
@@ -1,11 +0,0 @@
1
- interface MaterialRunboxQuotaAlmostEndDialogProps {
2
- open: boolean;
3
- onClose: () => void;
4
- }
5
- /**
6
- * Warns the learner that the *total* available time is about to run out.
7
- *
8
- * Once it does, the practice ends for good — there is no reconnecting.
9
- */
10
- declare const MaterialRunboxQuotaAlmostEndDialog: React.FC<MaterialRunboxQuotaAlmostEndDialogProps>;
11
- export default MaterialRunboxQuotaAlmostEndDialog;
@@ -1,113 +0,0 @@
1
- import { jsxs, jsx } from 'react/jsx-runtime';
2
- import { useRawEliceIntl } from '@elice/intl';
3
- import { useEliceRunboxQuota } from '@elice/runbox-client';
4
- import { Dialog, DialogTitle, DialogContent, Stack, Card, Typography, Divider, DialogActions, Button } from '@mui/material';
5
- import { QUOTA_ALMOST_END_MINUTES, QUOTA_PER_SESSION_ALMOST_END_MINUTES } from '../hooks/useRunboxSessionEndWarning.js';
6
- import MaterialRunboxQuotaAmount from './MaterialRunboxQuotaAmount.js';
7
-
8
- //
9
- //
10
- //
11
- /**
12
- * Warns the learner that the *total* available time is about to run out.
13
- *
14
- * Once it does, the practice ends for good — there is no reconnecting.
15
- */
16
- var MaterialRunboxQuotaAlmostEndDialog = function MaterialRunboxQuotaAlmostEndDialog(_ref) {
17
- var open = _ref.open,
18
- onClose = _ref.onClose;
19
- var intl = useRawEliceIntl();
20
- var _useEliceRunboxQuota = useEliceRunboxQuota(),
21
- quotaInfo = _useEliceRunboxQuota.quotaInfo,
22
- quotaPerSessionInfo = _useEliceRunboxQuota.quotaPerSessionInfo;
23
- if (quotaInfo.isUnlimited) {
24
- return null;
25
- }
26
- var isQuotaAlmostEnd = quotaInfo.remainingQuota <= QUOTA_ALMOST_END_MINUTES;
27
- var isQuotaPerSessionAlmostEnd = !quotaPerSessionInfo.isUnlimited && quotaPerSessionInfo.remainingQuota <= QUOTA_PER_SESSION_ALMOST_END_MINUTES;
28
- return jsxs(Dialog, {
29
- fullWidth: true,
30
- maxWidth: "xs",
31
- open: open,
32
- onClose: onClose,
33
- children: [jsx(DialogTitle, {
34
- children: intl.formatMessage({
35
- id: 'runbox.timer.almost_end.dialog.quota.title'
36
- }, {
37
- time: intl.formatNumber(QUOTA_ALMOST_END_MINUTES, {
38
- style: 'unit',
39
- unit: 'minute',
40
- unitDisplay: 'short'
41
- })
42
- })
43
- }), jsx(DialogContent, {
44
- children: jsxs(Stack, {
45
- direction: "column",
46
- gap: "1.5rem",
47
- children: [jsxs(Card, {
48
- elevation: 0,
49
- sx: {
50
- bgcolor: 'background.neutral'
51
- },
52
- children: [jsxs(Stack, {
53
- direction: "column",
54
- gap: "0.5rem",
55
- padding: "1rem",
56
- bgcolor: isQuotaAlmostEnd ? 'warning.opacity03' : undefined,
57
- children: [jsx(Typography, {
58
- variant: "body2",
59
- fontWeight: "bold",
60
- children: intl.formatMessage({
61
- id: 'runbox.timer.popover.quota.title'
62
- })
63
- }), jsx(MaterialRunboxQuotaAmount, {
64
- remainingQuota: quotaInfo.remainingQuota,
65
- quota: quotaInfo.quota,
66
- color: isQuotaAlmostEnd ? 'warning.main' : 'success.main'
67
- })]
68
- }), jsx(Divider, {}), jsxs(Stack, {
69
- direction: "column",
70
- gap: "0.5rem",
71
- padding: "1rem",
72
- bgcolor: isQuotaPerSessionAlmostEnd ? 'warning.opacity03' : undefined,
73
- children: [jsx(Typography, {
74
- variant: "body2",
75
- fontWeight: "bold",
76
- children: intl.formatMessage({
77
- id: 'runbox.timer.popover.quota_per_session.title'
78
- })
79
- }), quotaPerSessionInfo.isUnlimited ? jsx(Typography, {
80
- component: "span",
81
- variant: "h5",
82
- fontWeight: "extraBold",
83
- children: intl.formatMessage({
84
- id: 'runbox.timer.unlimited'
85
- })
86
- }) : jsx(MaterialRunboxQuotaAmount, {
87
- remainingQuota: quotaPerSessionInfo.remainingQuota,
88
- quota: quotaPerSessionInfo.quota,
89
- color: isQuotaPerSessionAlmostEnd ? 'warning.main' : 'success.main'
90
- })]
91
- })]
92
- }), jsx(Typography, {
93
- variant: "body2",
94
- whiteSpace: "pre-line",
95
- children: intl.formatMessage({
96
- id: 'runbox.timer.almost_end.dialog.quota.description'
97
- })
98
- })]
99
- })
100
- }), jsx(DialogActions, {
101
- children: jsx(Button, {
102
- variant: "contained",
103
- color: "inherit",
104
- onClick: onClose,
105
- children: intl.formatMessage({
106
- id: 'runbox.timer.almost_end.dialog.confirm'
107
- })
108
- })
109
- })]
110
- });
111
- };
112
-
113
- export { MaterialRunboxQuotaAlmostEndDialog as default };
@@ -1,13 +0,0 @@
1
- export interface MaterialRunboxQuotaAmountProps {
2
- /** Remaining time, in minutes. */
3
- remainingQuota: number;
4
- /** Total granted time, in minutes. */
5
- quota: number;
6
- /** Color of the remaining time. */
7
- color?: string;
8
- }
9
- /**
10
- * Renders `<remaining> / <total>`, e.g. `4시간 11분 / 5시간`.
11
- */
12
- declare const MaterialRunboxQuotaAmount: React.FC<MaterialRunboxQuotaAmountProps>;
13
- export default MaterialRunboxQuotaAmount;