@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.
- package/cjs/assets/runbox_logo.png.js +7 -0
- package/cjs/components/material-runbox/MaterialRunboxContent.js +2 -1
- package/cjs/components/material-runbox/MaterialRunboxFooter.d.ts +4 -0
- package/cjs/components/material-runbox/MaterialRunboxFooter.js +64 -0
- package/cjs/components/material-runbox/MaterialRunboxHeader.js +29 -12
- package/cjs/components/material-runbox/actions/MaterialRunboxActionMenu.d.ts +1 -3
- package/cjs/components/material-runbox/actions/MaterialRunboxActionMenu.js +1 -22
- package/cjs/components/material-runbox/hooks/index.d.ts +0 -2
- package/cjs/components/material-runbox/hooks/index.js +0 -10
- 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/timer/MaterialRunboxAlmostEndSnackbars.d.ts +6 -0
- package/cjs/components/material-runbox/timer/MaterialRunboxAlmostEndSnackbars.js +90 -0
- package/cjs/components/material-runbox/timer/MaterialRunboxTimer.d.ts +0 -6
- package/cjs/components/material-runbox/timer/MaterialRunboxTimer.js +16 -20
- package/cjs/components/material-runbox/timer/MaterialRunboxTimerDetailPopover.js +81 -21
- package/es/assets/runbox_logo.png.js +3 -0
- package/es/components/material-runbox/MaterialRunboxContent.js +2 -1
- package/es/components/material-runbox/MaterialRunboxFooter.d.ts +4 -0
- package/es/components/material-runbox/MaterialRunboxFooter.js +56 -0
- package/es/components/material-runbox/MaterialRunboxHeader.js +30 -13
- package/es/components/material-runbox/actions/MaterialRunboxActionMenu.d.ts +1 -3
- package/es/components/material-runbox/actions/MaterialRunboxActionMenu.js +3 -24
- package/es/components/material-runbox/hooks/index.d.ts +0 -2
- package/es/components/material-runbox/hooks/index.js +0 -2
- 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/timer/MaterialRunboxAlmostEndSnackbars.d.ts +6 -0
- package/es/components/material-runbox/timer/MaterialRunboxAlmostEndSnackbars.js +86 -0
- package/es/components/material-runbox/timer/MaterialRunboxTimer.d.ts +0 -6
- package/es/components/material-runbox/timer/MaterialRunboxTimer.js +15 -19
- package/es/components/material-runbox/timer/MaterialRunboxTimerDetailPopover.js +78 -18
- package/package.json +6 -6
- package/cjs/components/material-runbox/hooks/useRunboxNetworkStatus.d.ts +0 -14
- package/cjs/components/material-runbox/hooks/useRunboxNetworkStatus.js +0 -65
- package/cjs/components/material-runbox/hooks/useRunboxSessionEndWarning.d.ts +0 -18
- package/cjs/components/material-runbox/hooks/useRunboxSessionEndWarning.js +0 -67
- package/cjs/components/material-runbox/status/MaterialRunboxStatusButton.d.ts +0 -18
- package/cjs/components/material-runbox/status/MaterialRunboxStatusButton.js +0 -89
- package/cjs/components/material-runbox/status/MaterialRunboxStatusConnectionItem.d.ts +0 -12
- package/cjs/components/material-runbox/status/MaterialRunboxStatusConnectionItem.js +0 -35
- package/cjs/components/material-runbox/status/MaterialRunboxStatusPopover.d.ts +0 -17
- package/cjs/components/material-runbox/status/MaterialRunboxStatusPopover.js +0 -142
- package/cjs/components/material-runbox/status/MaterialRunboxStatusResourceItem.d.ts +0 -11
- package/cjs/components/material-runbox/status/MaterialRunboxStatusResourceItem.js +0 -41
- package/cjs/components/material-runbox/status/index.d.ts +0 -4
- package/cjs/components/material-runbox/status/index.js +0 -9
- package/cjs/components/material-runbox/timer/MaterialRunboxQuotaAlmostEndDialog.d.ts +0 -11
- package/cjs/components/material-runbox/timer/MaterialRunboxQuotaAlmostEndDialog.js +0 -117
- package/cjs/components/material-runbox/timer/MaterialRunboxQuotaAmount.d.ts +0 -13
- package/cjs/components/material-runbox/timer/MaterialRunboxQuotaAmount.js +0 -56
- package/cjs/components/material-runbox/timer/MaterialRunboxQuotaPerSessionAlmostEndDialog.d.ts +0 -12
- package/cjs/components/material-runbox/timer/MaterialRunboxQuotaPerSessionAlmostEndDialog.js +0 -118
- package/cjs/components/material-runbox/timer/MaterialRunboxQuotaTimePart.d.ts +0 -15
- package/cjs/components/material-runbox/timer/MaterialRunboxQuotaTimePart.js +0 -50
- package/es/components/material-runbox/hooks/useRunboxNetworkStatus.d.ts +0 -14
- package/es/components/material-runbox/hooks/useRunboxNetworkStatus.js +0 -59
- package/es/components/material-runbox/hooks/useRunboxSessionEndWarning.d.ts +0 -18
- package/es/components/material-runbox/hooks/useRunboxSessionEndWarning.js +0 -63
- package/es/components/material-runbox/status/MaterialRunboxStatusButton.d.ts +0 -18
- package/es/components/material-runbox/status/MaterialRunboxStatusButton.js +0 -81
- package/es/components/material-runbox/status/MaterialRunboxStatusConnectionItem.d.ts +0 -12
- package/es/components/material-runbox/status/MaterialRunboxStatusConnectionItem.js +0 -31
- package/es/components/material-runbox/status/MaterialRunboxStatusPopover.d.ts +0 -17
- package/es/components/material-runbox/status/MaterialRunboxStatusPopover.js +0 -138
- package/es/components/material-runbox/status/MaterialRunboxStatusResourceItem.d.ts +0 -11
- package/es/components/material-runbox/status/MaterialRunboxStatusResourceItem.js +0 -37
- package/es/components/material-runbox/status/index.d.ts +0 -4
- package/es/components/material-runbox/status/index.js +0 -2
- package/es/components/material-runbox/timer/MaterialRunboxQuotaAlmostEndDialog.d.ts +0 -11
- package/es/components/material-runbox/timer/MaterialRunboxQuotaAlmostEndDialog.js +0 -113
- package/es/components/material-runbox/timer/MaterialRunboxQuotaAmount.d.ts +0 -13
- package/es/components/material-runbox/timer/MaterialRunboxQuotaAmount.js +0 -52
- package/es/components/material-runbox/timer/MaterialRunboxQuotaPerSessionAlmostEndDialog.d.ts +0 -12
- package/es/components/material-runbox/timer/MaterialRunboxQuotaPerSessionAlmostEndDialog.js +0 -114
- package/es/components/material-runbox/timer/MaterialRunboxQuotaTimePart.d.ts +0 -15
- package/es/components/material-runbox/timer/MaterialRunboxQuotaTimePart.js +0 -46
|
@@ -7,14 +7,15 @@ import { useRawEliceIntl } from '@elice/intl';
|
|
|
7
7
|
import { EliceIcon } from '@elice/mui-elements';
|
|
8
8
|
import { useEliceRunboxQuota } from '@elice/runbox-client';
|
|
9
9
|
import { faXmarkLarge } from '@fortawesome/pro-regular-svg-icons';
|
|
10
|
-
import { Popover,
|
|
10
|
+
import { Popover, Stack, Card, Divider, Button, FormControlLabel, Typography, Checkbox, IconButton } from '@mui/material';
|
|
11
11
|
import { useQuery } from '@tanstack/react-query';
|
|
12
|
-
import {
|
|
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
|
-
}),
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
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,28 +247,28 @@ var MaterialRunboxTimerDetailPopover = function MaterialRunboxTimerDetailPopover
|
|
|
186
247
|
children: intl.formatMessage({
|
|
187
248
|
id: 'runbox.timer.popover.quota_per_session.title'
|
|
188
249
|
})
|
|
189
|
-
}),
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
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:
|
|
200
|
-
style: 'unit',
|
|
201
|
-
unit: 'minute',
|
|
202
|
-
unitDisplay: 'short'
|
|
203
|
-
})
|
|
265
|
+
time: formatTimePart(quotaPerSessionInfo.quota, 'minute')
|
|
204
266
|
})
|
|
205
267
|
})]
|
|
206
268
|
});
|
|
207
269
|
};
|
|
208
270
|
return jsx(Popover, Object.assign({
|
|
209
271
|
open: open,
|
|
210
|
-
TransitionComponent: Fade,
|
|
211
272
|
onClose: onClose
|
|
212
273
|
}, props, {
|
|
213
274
|
children: jsxs(Stack, {
|
|
@@ -218,7 +279,6 @@ var MaterialRunboxTimerDetailPopover = function MaterialRunboxTimerDetailPopover
|
|
|
218
279
|
width: "22rem",
|
|
219
280
|
bgcolor: "background.paper",
|
|
220
281
|
children: [renderHeader(), renderCloseButton(), jsxs(Card, {
|
|
221
|
-
elevation: 0,
|
|
222
282
|
sx: {
|
|
223
283
|
bgcolor: 'background.neutral'
|
|
224
284
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elice/material-runbox",
|
|
3
|
-
"version": "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.
|
|
24
|
-
"@elice/material-shared-utils": "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.
|
|
55
|
-
"@elice/material-shared-utils": "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.
|
|
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,14 +0,0 @@
|
|
|
1
|
-
export declare enum RunboxNetworkStatus {
|
|
2
|
-
Good = "good",
|
|
3
|
-
NotGood = "not_good",
|
|
4
|
-
Bad = "bad"
|
|
5
|
-
}
|
|
6
|
-
/**
|
|
7
|
-
* Runbox network quality, derived from the heartbeat round trip.
|
|
8
|
-
*
|
|
9
|
-
* `null` until the first sample arrives.
|
|
10
|
-
*/
|
|
11
|
-
export declare const useRunboxNetworkStatus: () => {
|
|
12
|
-
avgRtt: number | null;
|
|
13
|
-
status: RunboxNetworkStatus | null;
|
|
14
|
-
};
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var React = require('react');
|
|
4
|
-
var runboxClient = require('@elice/runbox-client');
|
|
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
|
-
exports.RunboxNetworkStatus = void 0;
|
|
14
|
-
(function (RunboxNetworkStatus) {
|
|
15
|
-
RunboxNetworkStatus["Good"] = "good";
|
|
16
|
-
RunboxNetworkStatus["NotGood"] = "not_good";
|
|
17
|
-
RunboxNetworkStatus["Bad"] = "bad";
|
|
18
|
-
})(exports.RunboxNetworkStatus || (exports.RunboxNetworkStatus = {}));
|
|
19
|
-
//
|
|
20
|
-
//
|
|
21
|
-
//
|
|
22
|
-
var RTT_THRESHOLD_GOOD = 600; // Fast 3G
|
|
23
|
-
var RTT_THRESHOLD_BAD = 1200; // Slow 3G
|
|
24
|
-
/** A failed heartbeat carries no `__rtt`, which counts as the worst latency. */
|
|
25
|
-
var MISSING_RTT = 1e10;
|
|
26
|
-
//
|
|
27
|
-
//
|
|
28
|
-
//
|
|
29
|
-
/**
|
|
30
|
-
* Runbox network quality, derived from the heartbeat round trip.
|
|
31
|
-
*
|
|
32
|
-
* `null` until the first sample arrives.
|
|
33
|
-
*/
|
|
34
|
-
var useRunboxNetworkStatus = function useRunboxNetworkStatus() {
|
|
35
|
-
var stats = runboxClient.useEliceRunboxContainerStats();
|
|
36
|
-
/** Averaged over the newer half, so a recovered connection is not held back. */
|
|
37
|
-
var avgRtt = React__default.default.useMemo(function () {
|
|
38
|
-
if (!stats.length) {
|
|
39
|
-
return null;
|
|
40
|
-
}
|
|
41
|
-
var recent = stats.slice(stats.length / 2, stats.length);
|
|
42
|
-
return recent.reduce(function (acc, stat) {
|
|
43
|
-
var _a;
|
|
44
|
-
return acc + ((_a = stat === null || stat === void 0 ? void 0 : stat.__rtt) !== null && _a !== void 0 ? _a : MISSING_RTT);
|
|
45
|
-
}, 0) / recent.length;
|
|
46
|
-
}, [stats]);
|
|
47
|
-
var status = React__default.default.useMemo(function () {
|
|
48
|
-
if (avgRtt === null) {
|
|
49
|
-
return null;
|
|
50
|
-
}
|
|
51
|
-
if (avgRtt < RTT_THRESHOLD_GOOD) {
|
|
52
|
-
return exports.RunboxNetworkStatus.Good;
|
|
53
|
-
}
|
|
54
|
-
if (avgRtt < RTT_THRESHOLD_BAD) {
|
|
55
|
-
return exports.RunboxNetworkStatus.NotGood;
|
|
56
|
-
}
|
|
57
|
-
return exports.RunboxNetworkStatus.Bad;
|
|
58
|
-
}, [avgRtt]);
|
|
59
|
-
return {
|
|
60
|
-
avgRtt: avgRtt,
|
|
61
|
-
status: status
|
|
62
|
-
};
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
exports.useRunboxNetworkStatus = 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,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,89 +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
|
-
color: "inherit",
|
|
52
|
-
startIcon: jsxRuntime.jsx(muiElements.EliceIcon, {
|
|
53
|
-
icon: proSolidSvgIcons.faWifi
|
|
54
|
-
}),
|
|
55
|
-
endIcon: jsxRuntime.jsx(muiElements.EliceIcon, {
|
|
56
|
-
icon: proSolidSvgIcons.faAngleDown
|
|
57
|
-
}),
|
|
58
|
-
sx: _rollupPluginBabelHelpers.defineProperty({}, "& .".concat(material.buttonClasses.startIcon), {
|
|
59
|
-
color: isRunboxRunning ? 'success.main' : 'text.disabled'
|
|
60
|
-
}),
|
|
61
|
-
onClick: function onClick(e) {
|
|
62
|
-
return setAnchorEl(function (prev) {
|
|
63
|
-
return prev ? null : e.currentTarget;
|
|
64
|
-
});
|
|
65
|
-
},
|
|
66
|
-
children: intl$1.formatMessage({
|
|
67
|
-
id: 'runbox.status.button.title'
|
|
68
|
-
})
|
|
69
|
-
}), jsxRuntime.jsx(MaterialRunboxStatusPopover.default, {
|
|
70
|
-
open: Boolean(anchorEl),
|
|
71
|
-
anchorEl: anchorEl,
|
|
72
|
-
anchorOrigin: {
|
|
73
|
-
vertical: 'bottom',
|
|
74
|
-
horizontal: 'left'
|
|
75
|
-
},
|
|
76
|
-
transformOrigin: {
|
|
77
|
-
vertical: 'top',
|
|
78
|
-
horizontal: 'left'
|
|
79
|
-
},
|
|
80
|
-
sx: {
|
|
81
|
-
marginTop: '0.5rem'
|
|
82
|
-
},
|
|
83
|
-
bottomAction: bottomAction,
|
|
84
|
-
onClose: handleClose
|
|
85
|
-
})]
|
|
86
|
-
});
|
|
87
|
-
};
|
|
88
|
-
|
|
89
|
-
exports.default = MaterialRunboxStatusButton;
|
|
@@ -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,35 +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
|
-
_ref$color = _ref.color,
|
|
15
|
-
color = _ref$color === void 0 ? 'text.disabled' : _ref$color;
|
|
16
|
-
return jsxRuntime.jsxs(material.Stack, {
|
|
17
|
-
direction: "row",
|
|
18
|
-
alignItems: "center",
|
|
19
|
-
gap: "0.75rem",
|
|
20
|
-
minHeight: "2.5rem",
|
|
21
|
-
padding: "0 0.75rem",
|
|
22
|
-
children: [jsxRuntime.jsx(material.Typography, {
|
|
23
|
-
component: "span",
|
|
24
|
-
display: "inline-flex",
|
|
25
|
-
color: color,
|
|
26
|
-
children: icon
|
|
27
|
-
}), jsxRuntime.jsx(material.Typography, {
|
|
28
|
-
variant: "body2",
|
|
29
|
-
color: "text.tertiary",
|
|
30
|
-
children: label
|
|
31
|
-
})]
|
|
32
|
-
});
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
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;
|