@elice/material-runbox 1.260825.0-runboxusability.1 → 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 -17
  8. package/cjs/components/material-runbox/hooks/index.d.ts +0 -2
  9. package/cjs/components/material-runbox/hooks/index.js +0 -6
  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 -19
  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 -19
  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 +77 -15
  37. package/package.json +6 -6
  38. package/cjs/components/material-runbox/hooks/useOnlineState.d.ts +0 -12
  39. package/cjs/components/material-runbox/hooks/useOnlineState.js +0 -50
  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 -88
  44. package/cjs/components/material-runbox/status/MaterialRunboxStatusConnectionItem.d.ts +0 -11
  45. package/cjs/components/material-runbox/status/MaterialRunboxStatusConnectionItem.js +0 -32
  46. package/cjs/components/material-runbox/status/MaterialRunboxStatusPopover.d.ts +0 -17
  47. package/cjs/components/material-runbox/status/MaterialRunboxStatusPopover.js +0 -133
  48. package/cjs/components/material-runbox/status/MaterialRunboxStatusResourceItem.d.ts +0 -11
  49. package/cjs/components/material-runbox/status/MaterialRunboxStatusResourceItem.js +0 -42
  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 -116
  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 -117
  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/useOnlineState.d.ts +0 -12
  61. package/es/components/material-runbox/hooks/useOnlineState.js +0 -44
  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 -80
  66. package/es/components/material-runbox/status/MaterialRunboxStatusConnectionItem.d.ts +0 -11
  67. package/es/components/material-runbox/status/MaterialRunboxStatusConnectionItem.js +0 -28
  68. package/es/components/material-runbox/status/MaterialRunboxStatusPopover.d.ts +0 -17
  69. package/es/components/material-runbox/status/MaterialRunboxStatusPopover.js +0 -129
  70. package/es/components/material-runbox/status/MaterialRunboxStatusResourceItem.d.ts +0 -11
  71. package/es/components/material-runbox/status/MaterialRunboxStatusResourceItem.js +0 -38
  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 -112
  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 -113
  80. package/es/components/material-runbox/timer/MaterialRunboxQuotaTimePart.d.ts +0 -15
  81. package/es/components/material-runbox/timer/MaterialRunboxQuotaTimePart.js +0 -46
@@ -9,12 +9,13 @@ import { useEliceRunboxQuota } from '@elice/runbox-client';
9
9
  import { faXmarkLarge } from '@fortawesome/pro-regular-svg-icons';
10
10
  import { Popover, Stack, Card, Divider, Button, FormControlLabel, Typography, Checkbox, IconButton } from '@mui/material';
11
11
  import { useQuery } from '@tanstack/react-query';
12
- import { QUOTA_ALMOST_END_MINUTES, QUOTA_PER_SESSION_ALMOST_END_MINUTES } from '../hooks/useRunboxSessionEndWarning.js';
13
- import MaterialRunboxQuotaAmount from './MaterialRunboxQuotaAmount.js';
12
+ import { getTimeParts } from '../../../utils/time.js';
14
13
 
15
14
  //
16
15
  //
17
16
  //
17
+ var QUOTA_ALMOST_END_MINUTES = 30;
18
+ var QUOTA_PER_SESSION_ALMOST_END_MINUTES = 10;
18
19
  var QUOTA_POPOVER_NOT_SHOW_ON_START = 'MaterialRunboxTimer.timerDetailPopover.notShowOnStart';
19
20
  //
20
21
  //
@@ -113,6 +114,48 @@ var MaterialRunboxTimerDetailPopover = function MaterialRunboxTimerDetailPopover
113
114
  })]
114
115
  });
115
116
  };
117
+ /**
118
+ *
119
+ */
120
+ var formatTimePart = function formatTimePart(value, unit) {
121
+ return intl.formatNumber(value, {
122
+ style: 'unit',
123
+ unit: unit,
124
+ unitDisplay: 'short'
125
+ });
126
+ };
127
+ /**
128
+ *
129
+ */
130
+ var renderQuotaTimePart = function renderQuotaTimePart(value, unit, color) {
131
+ if (value === 0) {
132
+ return null;
133
+ }
134
+ var parts = intl.formatNumberToParts(value, {
135
+ style: 'unit',
136
+ unit: unit,
137
+ unitDisplay: 'short'
138
+ });
139
+ return jsx(Typography, {
140
+ component: "span",
141
+ variant: "h5",
142
+ fontWeight: "extraBold",
143
+ color: color,
144
+ children: parts.map(function (part, index) {
145
+ if (part.type === 'unit') {
146
+ return jsx(Typography, {
147
+ component: "span",
148
+ variant: "body2",
149
+ fontWeight: "regular",
150
+ children: part.value
151
+ }, index);
152
+ }
153
+ return jsx("span", {
154
+ children: part.value
155
+ }, index);
156
+ })
157
+ });
158
+ };
116
159
  /**
117
160
  *
118
161
  */
@@ -138,6 +181,13 @@ var MaterialRunboxTimerDetailPopover = function MaterialRunboxTimerDetailPopover
138
181
  })]
139
182
  });
140
183
  }
184
+ // Sync UI with the timer.
185
+ var _getTimeParts = getTimeParts(quotaInfo.remainingQuota * 60),
186
+ remainingHours = _getTimeParts.hours,
187
+ remainingMinutes = _getTimeParts.minutes;
188
+ var _getTimeParts2 = getTimeParts(quotaInfo.quota * 60),
189
+ totalHours = _getTimeParts2.hours,
190
+ totalMinutes = _getTimeParts2.minutes;
141
191
  var quotaColor = quotaInfo.remainingQuota > QUOTA_ALMOST_END_MINUTES ? 'success.main' : 'warning.main';
142
192
  var quotaBgColor = quotaInfo.remainingQuota > QUOTA_ALMOST_END_MINUTES ? undefined : 'warning.opacity03';
143
193
  return jsxs(Stack, {
@@ -151,10 +201,15 @@ var MaterialRunboxTimerDetailPopover = function MaterialRunboxTimerDetailPopover
151
201
  children: intl.formatMessage({
152
202
  id: 'runbox.timer.popover.quota.title'
153
203
  })
154
- }), jsx(MaterialRunboxQuotaAmount, {
155
- remainingQuota: quotaInfo.remainingQuota,
156
- quota: quotaInfo.quota,
157
- color: quotaColor
204
+ }), jsxs(Typography, {
205
+ variant: "body2",
206
+ children: [jsxs(Stack, {
207
+ component: "span",
208
+ display: "inline-flex",
209
+ direction: "row",
210
+ gap: "0.25rem",
211
+ children: [renderQuotaTimePart(remainingHours, 'hour', quotaColor), renderQuotaTimePart(remainingMinutes, 'minute', quotaColor)]
212
+ }), [" / ", totalHours > 0 ? formatTimePart(totalHours, 'hour') : null, totalMinutes > 0 ? formatTimePart(totalMinutes, 'minute') : null].filter(Boolean).join(' ')]
158
213
  })]
159
214
  });
160
215
  };
@@ -173,6 +228,12 @@ var MaterialRunboxTimerDetailPopover = function MaterialRunboxTimerDetailPopover
173
228
  })]
174
229
  });
175
230
  }
231
+ var _getTimeParts3 = getTimeParts(quotaPerSessionInfo.remainingQuota * 60),
232
+ remainingHours = _getTimeParts3.hours,
233
+ remainingMinutes = _getTimeParts3.minutes;
234
+ var _getTimeParts4 = getTimeParts(quotaPerSessionInfo.quota * 60),
235
+ totalHours = _getTimeParts4.hours,
236
+ totalMinutes = _getTimeParts4.minutes;
176
237
  var perSessionColor = quotaPerSessionInfo.remainingQuota > QUOTA_PER_SESSION_ALMOST_END_MINUTES ? 'success.main' : 'warning.main';
177
238
  var perSessionBgColor = quotaPerSessionInfo.remainingQuota > QUOTA_PER_SESSION_ALMOST_END_MINUTES ? undefined : 'warning.opacity03';
178
239
  return jsxs(Stack, {
@@ -186,21 +247,22 @@ var MaterialRunboxTimerDetailPopover = function MaterialRunboxTimerDetailPopover
186
247
  children: intl.formatMessage({
187
248
  id: 'runbox.timer.popover.quota_per_session.title'
188
249
  })
189
- }), jsx(MaterialRunboxQuotaAmount, {
190
- remainingQuota: quotaPerSessionInfo.remainingQuota,
191
- quota: quotaPerSessionInfo.quota,
192
- color: perSessionColor
250
+ }), jsxs(Typography, {
251
+ variant: "body2",
252
+ children: [jsxs(Stack, {
253
+ component: "span",
254
+ display: "inline-flex",
255
+ direction: "row",
256
+ gap: "0.25rem",
257
+ children: [renderQuotaTimePart(remainingHours, 'hour', perSessionColor), renderQuotaTimePart(remainingMinutes, 'minute', perSessionColor)]
258
+ }), [" / ", totalHours > 0 ? formatTimePart(totalHours, 'hour') : null, totalMinutes > 0 ? formatTimePart(totalMinutes, 'minute') : null].filter(Boolean).join(' ')]
193
259
  }), jsx(Typography, {
194
260
  variant: "body2",
195
261
  color: "text.tertiary",
196
262
  children: intl.formatMessage({
197
263
  id: 'runbox.timer.popover.quota_per_session.description'
198
264
  }, {
199
- time: intl.formatNumber(quotaPerSessionInfo.quota, {
200
- style: 'unit',
201
- unit: 'minute',
202
- unitDisplay: 'short'
203
- })
265
+ time: formatTimePart(quotaPerSessionInfo.quota, 'minute')
204
266
  })
205
267
  })]
206
268
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elice/material-runbox",
3
- "version": "1.260825.0-runboxusability.1",
3
+ "version": "1.260826.0",
4
4
  "description": "User view and editing components of Elice material runbox",
5
5
  "repository": {
6
6
  "type": "git",
@@ -20,8 +20,8 @@
20
20
  "peerDependencies": {
21
21
  "@elice/api-client": "^1",
22
22
  "@elice/intl": "^0",
23
- "@elice/material-shared-types": "1.260825.0-runboxusability.1",
24
- "@elice/material-shared-utils": "1.260825.0-runboxusability.1",
23
+ "@elice/material-shared-types": "1.260826.0",
24
+ "@elice/material-shared-utils": "1.260826.0",
25
25
  "@elice/mui-elements": "^5",
26
26
  "@elice/mui-system": "^5",
27
27
  "@elice/mui-x-snackbar": "^5",
@@ -51,12 +51,12 @@
51
51
  "devDependencies": {
52
52
  "@elice/api-client": "1.260529.0",
53
53
  "@elice/intl": "0.260526.0",
54
- "@elice/material-shared-types": "1.260825.0-runboxusability.1",
55
- "@elice/material-shared-utils": "1.260825.0-runboxusability.1",
54
+ "@elice/material-shared-types": "1.260826.0",
55
+ "@elice/material-shared-utils": "1.260826.0",
56
56
  "@elice/mui-elements": "5.251204.0",
57
57
  "@elice/mui-system": "5.251204.0",
58
58
  "@elice/mui-x-snackbar": "^5.250108.0-controllabel.0",
59
- "@elice/openapi-client-material-runbox": "1.260727.0",
59
+ "@elice/openapi-client-material-runbox": "1.250821.0",
60
60
  "@elice/rollup-config": "^1.260406.0",
61
61
  "@elice/runbox-client": "^1.250828.0",
62
62
  "@elice/types": "1.260608.0",
@@ -1,12 +0,0 @@
1
- /**
2
- * Whether the browser currently has a network connection.
3
- *
4
- * NOTICE: this deliberately does not use `react-use`'s `useNetworkState`.
5
- * That hook only exists in react-use v17, and consumers of this package do not
6
- * agree on the major — elice-web still resolves v13, which breaks the build at
7
- * link time. Reading `navigator.onLine` keeps this working on both.
8
- *
9
- * `undefined` means "not known yet" (server render, or no `navigator`), which
10
- * callers should treat as online rather than as offline.
11
- */
12
- export declare const useOnlineState: () => boolean | undefined;
@@ -1,50 +0,0 @@
1
- 'use strict';
2
-
3
- var _rollupPluginBabelHelpers = require('../../../_virtual/_rollupPluginBabelHelpers.js');
4
- var React = require('react');
5
-
6
- function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
7
-
8
- var React__default = /*#__PURE__*/_interopDefaultCompat(React);
9
-
10
- //
11
- //
12
- //
13
- /**
14
- * Whether the browser currently has a network connection.
15
- *
16
- * NOTICE: this deliberately does not use `react-use`'s `useNetworkState`.
17
- * That hook only exists in react-use v17, and consumers of this package do not
18
- * agree on the major — elice-web still resolves v13, which breaks the build at
19
- * link time. Reading `navigator.onLine` keeps this working on both.
20
- *
21
- * `undefined` means "not known yet" (server render, or no `navigator`), which
22
- * callers should treat as online rather than as offline.
23
- */
24
- var useOnlineState = function useOnlineState() {
25
- var _React$useState = React__default.default.useState(function () {
26
- return typeof navigator === 'undefined' ? undefined : navigator.onLine;
27
- }),
28
- _React$useState2 = _rollupPluginBabelHelpers.slicedToArray(_React$useState, 2),
29
- online = _React$useState2[0],
30
- setOnline = _React$useState2[1];
31
- React__default.default.useEffect(function () {
32
- var handleOnline = function handleOnline() {
33
- return setOnline(true);
34
- };
35
- var handleOffline = function handleOffline() {
36
- return setOnline(false);
37
- };
38
- window.addEventListener('online', handleOnline);
39
- window.addEventListener('offline', handleOffline);
40
- // Catch a change that happened between the initial state and this effect.
41
- setOnline(navigator.onLine);
42
- return function () {
43
- window.removeEventListener('online', handleOnline);
44
- window.removeEventListener('offline', handleOffline);
45
- };
46
- }, []);
47
- return online;
48
- };
49
-
50
- exports.useOnlineState = useOnlineState;
@@ -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,67 +0,0 @@
1
- 'use strict';
2
-
3
- var _rollupPluginBabelHelpers = require('../../../_virtual/_rollupPluginBabelHelpers.js');
4
- var reactUse = require('react-use');
5
- var runboxClient = require('@elice/runbox-client');
6
-
7
- //
8
- //
9
- //
10
- var QUOTA_ALMOST_END_MINUTES = 30;
11
- var QUOTA_PER_SESSION_ALMOST_END_MINUTES = 10;
12
- var WAS_WARNED_STORAGE_KEY = 'MaterialRunboxSessionEndWarning.wasWarned';
13
- //
14
- //
15
- //
16
- /** Remaining minutes while the almost-end warning is due, `null` when it is not. */
17
- function getAlmostEndRemaining(quotaInfo, thresholdMinutes) {
18
- var seen = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
19
- if (seen || quotaInfo.isUnlimited || quotaInfo.remainingQuota > thresholdMinutes) {
20
- return null;
21
- }
22
- return quotaInfo.remainingQuota;
23
- }
24
- /** The due warning that runs out soonest, `null` when neither is due. */
25
- function getSessionEndWarning(quotaInfo, quotaPerSessionInfo, seen) {
26
- var quota = getAlmostEndRemaining(quotaInfo, QUOTA_ALMOST_END_MINUTES, seen.quota);
27
- var quotaPerSession = getAlmostEndRemaining(quotaPerSessionInfo, QUOTA_PER_SESSION_ALMOST_END_MINUTES, seen.quotaPerSession);
28
- if (quota === null) {
29
- return quotaPerSession === null ? null : 'quotaPerSession';
30
- }
31
- if (quotaPerSession === null) {
32
- return 'quota';
33
- }
34
- return quota < quotaPerSession ? 'quota' : 'quotaPerSession';
35
- }
36
- //
37
- //
38
- //
39
- function useRunboxSessionEndWarning(_ref) {
40
- var runboxId = _ref.runboxId,
41
- _ref$disabled = _ref.disabled,
42
- disabled = _ref$disabled === void 0 ? false : _ref$disabled;
43
- var _a;
44
- var _useEliceRunboxQuota = runboxClient.useEliceRunboxQuota(),
45
- quotaInfo = _useEliceRunboxQuota.quotaInfo,
46
- quotaPerSessionInfo = _useEliceRunboxQuota.quotaPerSessionInfo;
47
- var _useSessionStorage = reactUse.useSessionStorage(WAS_WARNED_STORAGE_KEY, {}),
48
- _useSessionStorage2 = _rollupPluginBabelHelpers.slicedToArray(_useSessionStorage, 2),
49
- wasWarned = _useSessionStorage2[0],
50
- setWasWarned = _useSessionStorage2[1];
51
- var seen = (_a = wasWarned === null || wasWarned === void 0 ? void 0 : wasWarned[runboxId]) !== null && _a !== void 0 ? _a : {};
52
- var warning = disabled ? null : getSessionEndWarning(quotaInfo, quotaPerSessionInfo, seen);
53
- var dismiss = function dismiss() {
54
- if (warning === null) {
55
- return;
56
- }
57
- setWasWarned(Object.assign(Object.assign({}, wasWarned), _rollupPluginBabelHelpers.defineProperty({}, runboxId, Object.assign(Object.assign({}, seen), _rollupPluginBabelHelpers.defineProperty({}, warning, true)))));
58
- };
59
- return {
60
- warning: warning,
61
- dismiss: dismiss
62
- };
63
- }
64
-
65
- exports.QUOTA_ALMOST_END_MINUTES = QUOTA_ALMOST_END_MINUTES;
66
- exports.QUOTA_PER_SESSION_ALMOST_END_MINUTES = QUOTA_PER_SESSION_ALMOST_END_MINUTES;
67
- exports.useRunboxSessionEndWarning = 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,88 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var _rollupPluginBabelHelpers = require('../../../_virtual/_rollupPluginBabelHelpers.js');
6
- var jsxRuntime = require('react/jsx-runtime');
7
- var React = require('react');
8
- var intl = require('@elice/intl');
9
- var muiElements = require('@elice/mui-elements');
10
- var runboxClient = require('@elice/runbox-client');
11
- var proSolidSvgIcons = require('@fortawesome/pro-solid-svg-icons');
12
- var material = require('@mui/material');
13
- var MaterialRunboxStatusPopover = require('./MaterialRunboxStatusPopover.js');
14
-
15
- function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
16
-
17
- var React__default = /*#__PURE__*/_interopDefaultCompat(React);
18
-
19
- //
20
- //
21
- //
22
- /**
23
- * Opens the runbox connection/resource status popover.
24
- *
25
- * Replaces the always-visible resource stats of the removed footer,
26
- * so the numbers are only shown on explicit request. (`[R-5]` `[R-6]`)
27
- */
28
- var MaterialRunboxStatusButton = function MaterialRunboxStatusButton(_ref) {
29
- var bottomAction = _ref.bottomAction;
30
- var intl$1 = intl.useRawEliceIntl();
31
- var _useEliceRunboxRunnin = runboxClient.useEliceRunboxRunning(),
32
- status = _useEliceRunboxRunnin.status;
33
- var _React$useState = React__default.default.useState(null),
34
- _React$useState2 = _rollupPluginBabelHelpers.slicedToArray(_React$useState, 2),
35
- anchorEl = _React$useState2[0],
36
- setAnchorEl = _React$useState2[1];
37
- var isRunboxRunning = status === 'running';
38
- /**
39
- *
40
- */
41
- var handleClose = function handleClose() {
42
- setAnchorEl(null);
43
- };
44
- //
45
- //
46
- //
47
- return jsxRuntime.jsxs(jsxRuntime.Fragment, {
48
- children: [jsxRuntime.jsx(material.Button, {
49
- variant: "text",
50
- size: "small",
51
- startIcon: jsxRuntime.jsx(muiElements.EliceIcon, {
52
- icon: proSolidSvgIcons.faWifi
53
- }),
54
- endIcon: jsxRuntime.jsx(muiElements.EliceIcon, {
55
- icon: proSolidSvgIcons.faAngleDown
56
- }),
57
- sx: _rollupPluginBabelHelpers.defineProperty({}, "& .".concat(material.buttonClasses.startIcon), {
58
- color: isRunboxRunning ? 'success.main' : 'text.disabled'
59
- }),
60
- onClick: function onClick(e) {
61
- return setAnchorEl(function (prev) {
62
- return prev ? null : e.currentTarget;
63
- });
64
- },
65
- children: intl$1.formatMessage({
66
- id: 'runbox.status.button.title'
67
- })
68
- }), jsxRuntime.jsx(MaterialRunboxStatusPopover.default, {
69
- open: Boolean(anchorEl),
70
- anchorEl: anchorEl,
71
- anchorOrigin: {
72
- vertical: 'bottom',
73
- horizontal: 'left'
74
- },
75
- transformOrigin: {
76
- vertical: 'top',
77
- horizontal: 'left'
78
- },
79
- sx: {
80
- marginTop: '0.5rem'
81
- },
82
- bottomAction: bottomAction,
83
- onClose: handleClose
84
- })]
85
- });
86
- };
87
-
88
- exports.default = MaterialRunboxStatusButton;
@@ -1,11 +0,0 @@
1
- import type React from 'react';
2
- export interface MaterialRunboxStatusConnectionItemProps {
3
- /** Leading icon element. */
4
- icon: React.ReactNode;
5
- /** Row label. */
6
- label: React.ReactNode;
7
- /** Whether the subject is connected. Drives the icon color. */
8
- connected: boolean;
9
- }
10
- declare const MaterialRunboxStatusConnectionItem: React.FC<MaterialRunboxStatusConnectionItemProps>;
11
- export default MaterialRunboxStatusConnectionItem;
@@ -1,32 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var jsxRuntime = require('react/jsx-runtime');
6
- var material = require('@mui/material');
7
-
8
- //
9
- //
10
- //
11
- var MaterialRunboxStatusConnectionItem = function MaterialRunboxStatusConnectionItem(_ref) {
12
- var icon = _ref.icon,
13
- label = _ref.label,
14
- connected = _ref.connected;
15
- return jsxRuntime.jsxs(material.Stack, {
16
- direction: "row",
17
- alignItems: "center",
18
- gap: "0.75rem",
19
- padding: "0.625rem 0.75rem",
20
- children: [jsxRuntime.jsx(material.Typography, {
21
- component: "span",
22
- display: "inline-flex",
23
- color: connected ? 'success.main' : 'text.disabled',
24
- children: icon
25
- }), jsxRuntime.jsx(material.Typography, {
26
- variant: "body2",
27
- children: label
28
- })]
29
- });
30
- };
31
-
32
- exports.default = MaterialRunboxStatusConnectionItem;
@@ -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,133 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var tslib = require('tslib');
6
- var jsxRuntime = require('react/jsx-runtime');
7
- var intl = require('@elice/intl');
8
- var muiElements = require('@elice/mui-elements');
9
- var runboxClient = require('@elice/runbox-client');
10
- var proSolidSvgIcons = require('@fortawesome/pro-solid-svg-icons');
11
- var material = require('@mui/material');
12
- var MaterialRunboxStatusConnectionItem = require('./MaterialRunboxStatusConnectionItem.js');
13
- var MaterialRunboxStatusResourceItem = require('./MaterialRunboxStatusResourceItem.js');
14
- var useOnlineState = require('../hooks/useOnlineState.js');
15
-
16
- //
17
- //
18
- //
19
- var POPOVER_WIDTH = '15.25rem'; // 244px
20
- //
21
- //
22
- //
23
- var MaterialRunboxStatusPopover = function MaterialRunboxStatusPopover(_a) {
24
- var open = _a.open,
25
- onClose = _a.onClose,
26
- bottomAction = _a.bottomAction,
27
- props = tslib.__rest(_a, ["open", "onClose", "bottomAction"]);
28
- var intl$1 = intl.useRawEliceIntl();
29
- var _useEliceRunboxRunnin = runboxClient.useEliceRunboxRunning(),
30
- status = _useEliceRunboxRunnin.status;
31
- var online = useOnlineState.useOnlineState();
32
- var contStats = runboxClient.useEliceRunboxContainerStats();
33
- var stats = contStats ? contStats[contStats.length - 1] : null;
34
- var isRunboxRunning = status === 'running';
35
- //
36
- //
37
- //
38
- return jsxRuntime.jsx(material.Popover, Object.assign({
39
- open: open,
40
- onClose: onClose
41
- }, props, {
42
- children: jsxRuntime.jsxs(material.Stack, {
43
- direction: "column",
44
- padding: "0.75rem 0",
45
- width: POPOVER_WIDTH,
46
- bgcolor: "background.paper",
47
- children: [jsxRuntime.jsxs(material.Stack, {
48
- direction: "column",
49
- children: [jsxRuntime.jsx(MaterialRunboxStatusConnectionItem.default, {
50
- icon: jsxRuntime.jsx(muiElements.EliceIcon, {
51
- icon: online === false ? proSolidSvgIcons.faWifiSlash : proSolidSvgIcons.faWifi
52
- }),
53
- label: intl$1.formatMessage({
54
- id: 'runbox.status.network'
55
- }),
56
- // `online` is undefined while unknown — only mark it down when known offline.
57
- connected: online !== false
58
- }), jsxRuntime.jsx(MaterialRunboxStatusConnectionItem.default, {
59
- icon: jsxRuntime.jsx(muiElements.EliceIcon, {
60
- icon: isRunboxRunning ? proSolidSvgIcons.faLinkSimple : proSolidSvgIcons.faLinkSimpleSlash
61
- }),
62
- label: intl$1.formatMessage({
63
- id: isRunboxRunning ? 'runbox.status.runtime.connected' : 'runbox.status.runtime.disconnected'
64
- }),
65
- connected: isRunboxRunning
66
- })]
67
- }), stats ? jsxRuntime.jsxs(jsxRuntime.Fragment, {
68
- children: [jsxRuntime.jsx(material.Divider, {
69
- sx: {
70
- margin: '0.75rem'
71
- }
72
- }), jsxRuntime.jsxs(material.Stack, {
73
- direction: "column",
74
- children: [jsxRuntime.jsx(MaterialRunboxStatusResourceItem.default, {
75
- icon: jsxRuntime.jsx(muiElements.EliceIcon, {
76
- icon: proSolidSvgIcons.faMicrochip
77
- }),
78
- label: "CPU",
79
- value: intl$1.formatNumber(stats.avgCpu, {
80
- style: 'percent',
81
- maximumFractionDigits: 2
82
- })
83
- }), jsxRuntime.jsx(MaterialRunboxStatusResourceItem.default, {
84
- icon: jsxRuntime.jsx(muiElements.EliceIcon, {
85
- icon: proSolidSvgIcons.faMemory
86
- }),
87
- label: "Memory",
88
- value: "".concat(intl$1.formatDataSize(stats.memCurrent, {
89
- unitSystem: 'iec',
90
- maximumFractionDigits: 2
91
- }), " / ").concat(intl$1.formatDataSize(stats.memTotal, {
92
- unitSystem: 'iec',
93
- maximumFractionDigits: 2
94
- }))
95
- }), jsxRuntime.jsx(MaterialRunboxStatusResourceItem.default, {
96
- icon: jsxRuntime.jsx(muiElements.EliceIcon, {
97
- icon: proSolidSvgIcons.faArrowUpRight
98
- }),
99
- label: "UP",
100
- value: "".concat(intl$1.formatDataSize(stats.netOutPsec, {
101
- unitSystem: 'iec'
102
- }), "/s")
103
- }), jsxRuntime.jsx(MaterialRunboxStatusResourceItem.default, {
104
- icon: jsxRuntime.jsx(muiElements.EliceIcon, {
105
- icon: proSolidSvgIcons.faArrowDownLeft
106
- }),
107
- label: "DOWN",
108
- value: "".concat(intl$1.formatDataSize(stats.netInPsec, {
109
- unitSystem: 'iec'
110
- }), "/s")
111
- }), jsxRuntime.jsx(MaterialRunboxStatusResourceItem.default, {
112
- icon: jsxRuntime.jsx(muiElements.EliceIcon, {
113
- icon: proSolidSvgIcons.faDiscDrive
114
- }),
115
- label: "DISK",
116
- value: "".concat(intl$1.formatDataSize(stats.diskCurrent, {
117
- unitSystem: 'iec',
118
- maximumFractionDigits: 2
119
- }), " / ").concat(intl$1.formatDataSize(stats.diskTotal, {
120
- unitSystem: 'iec',
121
- maximumFractionDigits: 2
122
- }))
123
- })]
124
- })]
125
- }) : null, bottomAction ? jsxRuntime.jsx(material.Stack, {
126
- padding: "0.75rem 0.75rem 0",
127
- children: bottomAction
128
- }) : null]
129
- })
130
- }));
131
- };
132
-
133
- exports.default = MaterialRunboxStatusPopover;
@@ -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;