@elice/material-runbox 1.230328.0 → 1.230418.1
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 +404 -0
- package/cjs/assets/queue.gif.js +8 -0
- package/cjs/assets/runbox_logo.png.js +8 -0
- package/cjs/assets/terminated.png.js +8 -0
- package/cjs/components/material-runbox/MaterialRunbox.d.ts +7 -3
- package/cjs/components/material-runbox/MaterialRunbox.js +148 -30
- package/cjs/components/material-runbox/MaterialRunboxBody.d.ts +4 -0
- package/cjs/components/material-runbox/MaterialRunboxBody.js +27 -0
- package/cjs/components/material-runbox/MaterialRunboxFooter.d.ts +4 -0
- package/cjs/components/material-runbox/MaterialRunboxFooter.js +57 -0
- package/cjs/components/material-runbox/MaterialRunboxHeader.d.ts +4 -0
- package/cjs/components/material-runbox/MaterialRunboxHeader.js +139 -0
- package/cjs/components/material-runbox/context.d.ts +11 -0
- package/cjs/components/material-runbox/context.js +12 -0
- package/cjs/components/material-runbox/hooks/index.d.ts +2 -0
- package/cjs/components/material-runbox/hooks/useMaterialRunboxApi.d.ts +14 -0
- package/cjs/components/material-runbox/hooks/useMaterialRunboxApi.js +46 -0
- package/cjs/components/material-runbox/hooks/useRunboxControl.d.ts +11 -0
- package/cjs/components/material-runbox/hooks/useRunboxControl.js +99 -0
- package/cjs/components/material-runbox/runtime/Runtime.d.ts +21 -0
- package/cjs/components/material-runbox/runtime/Runtime.js +58 -0
- package/cjs/components/material-runbox/runtime/RuntimeOverlayAssigned.d.ts +4 -0
- package/cjs/components/material-runbox/runtime/RuntimeOverlayAssigned.js +48 -0
- package/cjs/components/material-runbox/runtime/RuntimeOverlayQueued.d.ts +4 -0
- package/cjs/components/material-runbox/runtime/RuntimeOverlayQueued.js +63 -0
- package/cjs/components/material-runbox/runtime/RuntimeOverlayTerminated.d.ts +7 -0
- package/cjs/components/material-runbox/runtime/RuntimeOverlayTerminated.js +144 -0
- package/cjs/index.js +1 -1
- package/es/_virtual/_rollupPluginBabelHelpers.js +392 -0
- package/es/assets/queue.gif.js +4 -0
- package/es/assets/runbox_logo.png.js +4 -0
- package/es/assets/terminated.png.js +4 -0
- package/es/components/material-runbox/MaterialRunbox.d.ts +7 -3
- package/es/components/material-runbox/MaterialRunbox.js +146 -32
- package/es/components/material-runbox/MaterialRunboxBody.d.ts +4 -0
- package/es/components/material-runbox/MaterialRunboxBody.js +18 -0
- package/es/components/material-runbox/MaterialRunboxFooter.d.ts +4 -0
- package/es/components/material-runbox/MaterialRunboxFooter.js +48 -0
- package/es/components/material-runbox/MaterialRunboxHeader.d.ts +4 -0
- package/es/components/material-runbox/MaterialRunboxHeader.js +130 -0
- package/es/components/material-runbox/context.d.ts +11 -0
- package/es/components/material-runbox/context.js +8 -0
- package/es/components/material-runbox/hooks/index.d.ts +2 -0
- package/es/components/material-runbox/hooks/useMaterialRunboxApi.d.ts +14 -0
- package/es/components/material-runbox/hooks/useMaterialRunboxApi.js +42 -0
- package/es/components/material-runbox/hooks/useRunboxControl.d.ts +11 -0
- package/es/components/material-runbox/hooks/useRunboxControl.js +95 -0
- package/es/components/material-runbox/runtime/Runtime.d.ts +21 -0
- package/es/components/material-runbox/runtime/Runtime.js +50 -0
- package/es/components/material-runbox/runtime/RuntimeOverlayAssigned.d.ts +4 -0
- package/es/components/material-runbox/runtime/RuntimeOverlayAssigned.js +40 -0
- package/es/components/material-runbox/runtime/RuntimeOverlayQueued.d.ts +4 -0
- package/es/components/material-runbox/runtime/RuntimeOverlayQueued.js +55 -0
- package/es/components/material-runbox/runtime/RuntimeOverlayTerminated.d.ts +7 -0
- package/es/components/material-runbox/runtime/RuntimeOverlayTerminated.js +136 -0
- package/package.json +24 -24
- package/cjs/components/material-runbox/MaterialRunbox.styled.d.ts +0 -1
- package/cjs/components/material-runbox/MaterialRunbox.styled.js +0 -15
- package/cjs/components/material-runbox/MaterialRunboxContent.d.ts +0 -18
- package/cjs/components/material-runbox/MaterialRunboxContent.js +0 -305
- package/cjs/components/material-runbox/MaterialRunboxContent.styled.d.ts +0 -8
- package/cjs/components/material-runbox/MaterialRunboxContent.styled.js +0 -50
- package/cjs/components/material-runbox/MaterialRunboxRunnerRoomWrapper.d.ts +0 -6
- package/cjs/components/material-runbox/MaterialRunboxRunnerRoomWrapper.js +0 -72
- package/cjs/components/material-runbox/MaterialRunboxStdioWrapper.d.ts +0 -7
- package/cjs/components/material-runbox/MaterialRunboxStdioWrapper.js +0 -80
- package/cjs/components/material-runbox/locales.d.ts +0 -15
- package/cjs/components/material-runbox/locales.js +0 -35
- package/cjs/components/material-runbox/websocket.d.ts +0 -10
- package/cjs/components/material-runbox/websocket.js +0 -20
- package/es/components/material-runbox/MaterialRunbox.styled.d.ts +0 -1
- package/es/components/material-runbox/MaterialRunbox.styled.js +0 -7
- package/es/components/material-runbox/MaterialRunboxContent.d.ts +0 -18
- package/es/components/material-runbox/MaterialRunboxContent.js +0 -297
- package/es/components/material-runbox/MaterialRunboxContent.styled.d.ts +0 -8
- package/es/components/material-runbox/MaterialRunboxContent.styled.js +0 -38
- package/es/components/material-runbox/MaterialRunboxRunnerRoomWrapper.d.ts +0 -6
- package/es/components/material-runbox/MaterialRunboxRunnerRoomWrapper.js +0 -66
- package/es/components/material-runbox/MaterialRunboxStdioWrapper.d.ts +0 -7
- package/es/components/material-runbox/MaterialRunboxStdioWrapper.js +0 -74
- package/es/components/material-runbox/locales.d.ts +0 -15
- package/es/components/material-runbox/locales.js +0 -30
- package/es/components/material-runbox/websocket.d.ts +0 -10
- package/es/components/material-runbox/websocket.js +0 -15
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elice/material-runbox",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.230418.1",
|
|
4
4
|
"description": "User view and editing components of Elice material runbox",
|
|
5
5
|
"repository": "https://git.elicer.io/elice/frontend/library/elice-material",
|
|
6
6
|
"license": "UNLICENSED",
|
|
@@ -29,42 +29,42 @@
|
|
|
29
29
|
"clean": "del-cli \"es/*\" \"cjs/*\" \"dist/*\""
|
|
30
30
|
},
|
|
31
31
|
"peerDependencies": {
|
|
32
|
-
"@elice/api-client": "1.230306.1",
|
|
33
|
-
"@elice/blocks": "^1.220803.0",
|
|
34
|
-
"@elice/design-tokens": "^1.220803.0",
|
|
35
|
-
"@elice/icons": "^1.220803.0",
|
|
36
|
-
"@elice/markdown": "^1.220803.0",
|
|
37
32
|
"@elice/material-shared-types": "*",
|
|
38
33
|
"@elice/material-shared-utils": "*",
|
|
39
|
-
"@elice/
|
|
40
|
-
"@elice/
|
|
34
|
+
"@elice/openapi-client-material-runbox": "^1.230417.0",
|
|
35
|
+
"@elice/runbox-client": "^1.230412.0",
|
|
36
|
+
"@emotion/react": "^11.10.5",
|
|
37
|
+
"@emotion/styled": "^11.10.5",
|
|
38
|
+
"@mui/icons-material": "^5.10.16",
|
|
39
|
+
"@mui/lab": "^5.0.0-alpha.112",
|
|
40
|
+
"@mui/material": "^5.10.16",
|
|
41
|
+
"@tanstack/react-query": "^4.0.0",
|
|
42
|
+
"notistack": "^3.0.0",
|
|
41
43
|
"react": "^16.8.0 || ^17.0.0 || ^18.0.0",
|
|
42
44
|
"react-intl": "^5.0.0",
|
|
43
|
-
"react-use": "^17.0.0"
|
|
44
|
-
"styled-components": "^5.2.0"
|
|
45
|
+
"react-use": "^17.0.0"
|
|
45
46
|
},
|
|
46
47
|
"dependencies": {
|
|
47
48
|
"classnames": "^2.2.0",
|
|
48
49
|
"tslib": "^2.3.1"
|
|
49
50
|
},
|
|
50
51
|
"devDependencies": {
|
|
51
|
-
"@elice/
|
|
52
|
-
"@elice/
|
|
53
|
-
"@elice/
|
|
54
|
-
"@elice/
|
|
55
|
-
"@
|
|
56
|
-
"@
|
|
57
|
-
"@
|
|
58
|
-
"@
|
|
59
|
-
"@
|
|
60
|
-
"@
|
|
52
|
+
"@elice/material-shared-types": "1.230418.1",
|
|
53
|
+
"@elice/material-shared-utils": "1.230418.1",
|
|
54
|
+
"@elice/openapi-client-material-runbox": "^1.230417.0",
|
|
55
|
+
"@elice/runbox-client": "^1.230412.0",
|
|
56
|
+
"@emotion/react": "^11.10.5",
|
|
57
|
+
"@emotion/styled": "^11.10.5",
|
|
58
|
+
"@mui/icons-material": "^5.10.16",
|
|
59
|
+
"@mui/lab": "^5.0.0-alpha.112",
|
|
60
|
+
"@mui/material": "^5.10.16",
|
|
61
|
+
"@tanstack/react-query": "^4.29.3",
|
|
61
62
|
"@types/classnames": "^2.3.1",
|
|
62
63
|
"@types/react": "~17.0.9",
|
|
63
|
-
"
|
|
64
|
+
"notistack": "^3.0.0",
|
|
64
65
|
"react": "^17.0.2",
|
|
65
66
|
"react-intl": "^5.20.10",
|
|
66
|
-
"react-use": "^17.2.4"
|
|
67
|
-
"styled-components": "^5.3.0"
|
|
67
|
+
"react-use": "^17.2.4"
|
|
68
68
|
},
|
|
69
|
-
"gitHead": "
|
|
69
|
+
"gitHead": "9c1ccec857ef44c667da271e9782ca20ff713390"
|
|
70
70
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const StyledMaterialRunbox: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var styled = require('styled-components');
|
|
6
|
-
|
|
7
|
-
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
8
|
-
|
|
9
|
-
var styled__default = /*#__PURE__*/_interopDefaultLegacy(styled);
|
|
10
|
-
|
|
11
|
-
const StyledMaterialRunbox = styled__default["default"].div.withConfig({
|
|
12
|
-
componentId: "sc-2frgib-0"
|
|
13
|
-
})(["display:flex;flex-direction:column;padding-top:0.5rem;width:100%;height:100%;background-color:#fff;"]);
|
|
14
|
-
|
|
15
|
-
exports.StyledMaterialRunbox = StyledMaterialRunbox;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
export declare enum MaterialRunboxStatus {
|
|
3
|
-
Idle = 0,
|
|
4
|
-
Connecting = 1,
|
|
5
|
-
Loading = 2,
|
|
6
|
-
Done = 3,
|
|
7
|
-
Disconnected = 4,
|
|
8
|
-
Terminated = 5,
|
|
9
|
-
Error = 6
|
|
10
|
-
}
|
|
11
|
-
interface MaterialRunboxContentProps {
|
|
12
|
-
runboxUrl: string | null;
|
|
13
|
-
isRunboxTerminated: boolean;
|
|
14
|
-
isRunboxJoinError: boolean;
|
|
15
|
-
reconnect: () => void;
|
|
16
|
-
}
|
|
17
|
-
declare const MaterialRunboxContent: React.FC<MaterialRunboxContentProps>;
|
|
18
|
-
export default MaterialRunboxContent;
|
|
@@ -1,305 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var React = require('react');
|
|
6
|
-
var reactIntl = require('react-intl');
|
|
7
|
-
var reactUse = require('react-use');
|
|
8
|
-
var blocks = require('@elice/blocks');
|
|
9
|
-
var icons = require('@elice/icons');
|
|
10
|
-
var websocket = require('./websocket.js');
|
|
11
|
-
var MaterialRunboxContent_styled = require('./MaterialRunboxContent.styled.js');
|
|
12
|
-
|
|
13
|
-
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
14
|
-
|
|
15
|
-
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
16
|
-
|
|
17
|
-
/* eslint-disable @typescript-eslint/naming-convention */
|
|
18
|
-
exports.MaterialRunboxStatus = void 0;
|
|
19
|
-
|
|
20
|
-
(function (MaterialRunboxStatus) {
|
|
21
|
-
MaterialRunboxStatus[MaterialRunboxStatus["Idle"] = 0] = "Idle";
|
|
22
|
-
MaterialRunboxStatus[MaterialRunboxStatus["Connecting"] = 1] = "Connecting";
|
|
23
|
-
MaterialRunboxStatus[MaterialRunboxStatus["Loading"] = 2] = "Loading";
|
|
24
|
-
MaterialRunboxStatus[MaterialRunboxStatus["Done"] = 3] = "Done";
|
|
25
|
-
MaterialRunboxStatus[MaterialRunboxStatus["Disconnected"] = 4] = "Disconnected";
|
|
26
|
-
MaterialRunboxStatus[MaterialRunboxStatus["Terminated"] = 5] = "Terminated";
|
|
27
|
-
MaterialRunboxStatus[MaterialRunboxStatus["Error"] = 6] = "Error";
|
|
28
|
-
})(exports.MaterialRunboxStatus || (exports.MaterialRunboxStatus = {}));
|
|
29
|
-
|
|
30
|
-
const MaterialRunboxContent = ({
|
|
31
|
-
runboxUrl,
|
|
32
|
-
isRunboxTerminated,
|
|
33
|
-
isRunboxJoinError,
|
|
34
|
-
reconnect
|
|
35
|
-
}) => {
|
|
36
|
-
const intl = reactIntl.useIntl();
|
|
37
|
-
const [runboxStats, setRunboxStats] = React__default["default"].useState(null);
|
|
38
|
-
const [isRunboxUrlLoaded, setRunboxUrlLoaded] = React__default["default"].useState(false);
|
|
39
|
-
const isRunboxUrlLoadedPrev = reactUse.usePrevious(isRunboxUrlLoaded);
|
|
40
|
-
const [runboxStatus, setRunboxStatus] = React__default["default"].useState(exports.MaterialRunboxStatus.Idle);
|
|
41
|
-
const isRunboxPreparing = runboxStatus !== exports.MaterialRunboxStatus.Done && runboxStatus !== exports.MaterialRunboxStatus.Terminated;
|
|
42
|
-
websocket.WSMaterialRunboxStdio.useMessage(message => {
|
|
43
|
-
if (message.type === 'stats') {
|
|
44
|
-
setRunboxStats(message.data);
|
|
45
|
-
}
|
|
46
|
-
}, {
|
|
47
|
-
camelize: true
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
const handleReconnect = () => {
|
|
51
|
-
setRunboxStats(null);
|
|
52
|
-
setRunboxUrlLoaded(false);
|
|
53
|
-
reconnect();
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
const handleShare = async () => {
|
|
57
|
-
if (!runboxUrl) {
|
|
58
|
-
return;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
try {
|
|
62
|
-
await navigator.clipboard.writeText(runboxUrl);
|
|
63
|
-
blocks.Notification.success(intl.formatMessage({
|
|
64
|
-
id: 'runbox.share.success'
|
|
65
|
-
}));
|
|
66
|
-
} catch (e) {
|
|
67
|
-
alert(runboxUrl);
|
|
68
|
-
}
|
|
69
|
-
}; //
|
|
70
|
-
// Change `isRunboxUrlLoaded` flag to false, when runbox url removed.
|
|
71
|
-
//
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
React__default["default"].useEffect(() => {
|
|
75
|
-
if (!runboxUrl) {
|
|
76
|
-
setRunboxUrlLoaded(false);
|
|
77
|
-
}
|
|
78
|
-
}, [runboxUrl]); //
|
|
79
|
-
// Determine runbox status.
|
|
80
|
-
//
|
|
81
|
-
|
|
82
|
-
React__default["default"].useEffect(() => {
|
|
83
|
-
setRunboxStatus((() => {
|
|
84
|
-
switch (true) {
|
|
85
|
-
case isRunboxJoinError:
|
|
86
|
-
return exports.MaterialRunboxStatus.Error;
|
|
87
|
-
|
|
88
|
-
case !runboxUrl && isRunboxTerminated:
|
|
89
|
-
return exports.MaterialRunboxStatus.Terminated;
|
|
90
|
-
|
|
91
|
-
case !runboxUrl && !isRunboxTerminated && isRunboxUrlLoadedPrev:
|
|
92
|
-
return exports.MaterialRunboxStatus.Disconnected;
|
|
93
|
-
|
|
94
|
-
case !runboxUrl && !isRunboxTerminated && !isRunboxUrlLoadedPrev:
|
|
95
|
-
return exports.MaterialRunboxStatus.Connecting;
|
|
96
|
-
|
|
97
|
-
case Boolean(runboxUrl) && !isRunboxUrlLoaded:
|
|
98
|
-
return exports.MaterialRunboxStatus.Loading;
|
|
99
|
-
|
|
100
|
-
case Boolean(runboxUrl) && isRunboxUrlLoaded:
|
|
101
|
-
return exports.MaterialRunboxStatus.Done;
|
|
102
|
-
|
|
103
|
-
default:
|
|
104
|
-
return exports.MaterialRunboxStatus.Idle;
|
|
105
|
-
}
|
|
106
|
-
})());
|
|
107
|
-
}, [isRunboxJoinError, isRunboxTerminated, isRunboxUrlLoaded, isRunboxUrlLoadedPrev, runboxUrl]);
|
|
108
|
-
/**
|
|
109
|
-
* Runbox status message shown at header.
|
|
110
|
-
*/
|
|
111
|
-
|
|
112
|
-
const renderRunboxStatusMessage = () => {
|
|
113
|
-
switch (runboxStatus) {
|
|
114
|
-
case exports.MaterialRunboxStatus.Idle:
|
|
115
|
-
return React__default["default"].createElement(reactIntl.FormattedMessage, {
|
|
116
|
-
id: "runbox.status.idle"
|
|
117
|
-
});
|
|
118
|
-
|
|
119
|
-
case exports.MaterialRunboxStatus.Connecting:
|
|
120
|
-
return React__default["default"].createElement(reactIntl.FormattedMessage, {
|
|
121
|
-
id: "runbox.status.connecting"
|
|
122
|
-
});
|
|
123
|
-
|
|
124
|
-
case exports.MaterialRunboxStatus.Loading:
|
|
125
|
-
return React__default["default"].createElement(reactIntl.FormattedMessage, {
|
|
126
|
-
id: "runbox.status.loading"
|
|
127
|
-
});
|
|
128
|
-
|
|
129
|
-
case exports.MaterialRunboxStatus.Done:
|
|
130
|
-
return React__default["default"].createElement(reactIntl.FormattedMessage, {
|
|
131
|
-
id: "runbox.status.done"
|
|
132
|
-
});
|
|
133
|
-
|
|
134
|
-
case exports.MaterialRunboxStatus.Disconnected:
|
|
135
|
-
return React__default["default"].createElement(reactIntl.FormattedMessage, {
|
|
136
|
-
id: "runbox.status.disconnected"
|
|
137
|
-
});
|
|
138
|
-
|
|
139
|
-
case exports.MaterialRunboxStatus.Terminated:
|
|
140
|
-
return React__default["default"].createElement(reactIntl.FormattedMessage, {
|
|
141
|
-
id: "runbox.status.terminated"
|
|
142
|
-
});
|
|
143
|
-
}
|
|
144
|
-
};
|
|
145
|
-
/**
|
|
146
|
-
* Header of runbox.
|
|
147
|
-
*/
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
const renderRunboxHeader = () => {
|
|
151
|
-
const runboxStatsInfo = runboxStats ? React__default["default"].createElement(blocks.LaptopOrLarger, null, React__default["default"].createElement(blocks.Flex, null, React__default["default"].createElement(blocks.Flex, {
|
|
152
|
-
align: "center"
|
|
153
|
-
}, React__default["default"].createElement(blocks.Text, {
|
|
154
|
-
size: "tiny",
|
|
155
|
-
lineHeight: 1.5,
|
|
156
|
-
role: "gray7",
|
|
157
|
-
bold: true
|
|
158
|
-
}, "CPU:\u00A0"), React__default["default"].createElement(blocks.Flex, {
|
|
159
|
-
align: "center",
|
|
160
|
-
width: "30px"
|
|
161
|
-
}, React__default["default"].createElement(blocks.AntProgress, {
|
|
162
|
-
type: "line",
|
|
163
|
-
percent: runboxStats.cpu.percent,
|
|
164
|
-
status: 'active',
|
|
165
|
-
showInfo: false
|
|
166
|
-
})), React__default["default"].createElement(blocks.Text, {
|
|
167
|
-
size: "tiny",
|
|
168
|
-
lineHeight: 1.5,
|
|
169
|
-
role: "gray5"
|
|
170
|
-
}, "\u00A0", `${runboxStats.cpu.percent.toFixed(0)}%`)), React__default["default"].createElement(blocks.Hspace, {
|
|
171
|
-
width: 1
|
|
172
|
-
}), React__default["default"].createElement(blocks.Flex, {
|
|
173
|
-
align: "center"
|
|
174
|
-
}, React__default["default"].createElement(blocks.Text, {
|
|
175
|
-
size: "tiny",
|
|
176
|
-
lineHeight: 1.5,
|
|
177
|
-
role: "gray7",
|
|
178
|
-
bold: true
|
|
179
|
-
}, "MEM:\u00A0"), React__default["default"].createElement(blocks.Flex, {
|
|
180
|
-
align: "center",
|
|
181
|
-
width: "30px"
|
|
182
|
-
}, React__default["default"].createElement(blocks.AntProgress, {
|
|
183
|
-
percent: runboxStats.memory.currentBytes / runboxStats.memory.limitBytes * 100,
|
|
184
|
-
status: 'active',
|
|
185
|
-
showInfo: false
|
|
186
|
-
})), React__default["default"].createElement(blocks.Text, {
|
|
187
|
-
size: "tiny",
|
|
188
|
-
lineHeight: 1.5,
|
|
189
|
-
role: "gray5"
|
|
190
|
-
}, "\u00A0", `${(runboxStats.memory.currentBytes / 1024 / 1024).toFixed(0)}M / ${(runboxStats.memory.limitBytes / 1024 / 1024).toFixed(0)}M`)), React__default["default"].createElement(blocks.Hspace, {
|
|
191
|
-
width: 1
|
|
192
|
-
}), React__default["default"].createElement(blocks.Text, {
|
|
193
|
-
size: "tiny",
|
|
194
|
-
lineHeight: 1.5,
|
|
195
|
-
role: "gray7",
|
|
196
|
-
bold: true
|
|
197
|
-
}, "DISK:\u00A0"), React__default["default"].createElement(blocks.Text, {
|
|
198
|
-
size: "tiny",
|
|
199
|
-
lineHeight: 1.5,
|
|
200
|
-
role: "gray5"
|
|
201
|
-
}, `Read ${(runboxStats.block.rxBytes / 1024 / 1024).toFixed(0)}M Write ${(runboxStats.block.txBytes / 1024 / 1024).toFixed(0)}M`), React__default["default"].createElement(blocks.Hspace, {
|
|
202
|
-
width: 1
|
|
203
|
-
}), React__default["default"].createElement(blocks.Text, {
|
|
204
|
-
size: "tiny",
|
|
205
|
-
lineHeight: 1.5,
|
|
206
|
-
role: "gray7",
|
|
207
|
-
bold: true
|
|
208
|
-
}, "NET:\u00A0"), React__default["default"].createElement(blocks.Text, {
|
|
209
|
-
size: "tiny",
|
|
210
|
-
lineHeight: 1.5,
|
|
211
|
-
role: "gray5"
|
|
212
|
-
}, `↓${(runboxStats.network.rxBytes / 1024 / 1024).toFixed(0)}M ↑${(runboxStats.network.txBytes / 1024 / 1024).toFixed(0)}M`), React__default["default"].createElement(blocks.Hspace, {
|
|
213
|
-
width: 1
|
|
214
|
-
}))) : null;
|
|
215
|
-
return React__default["default"].createElement(MaterialRunboxContent_styled.RunboxHeader, null, runboxStatsInfo, React__default["default"].createElement(blocks.Flex, {
|
|
216
|
-
align: "center"
|
|
217
|
-
}, React__default["default"].createElement(MaterialRunboxContent_styled.RunboxStatusLight, {
|
|
218
|
-
status: runboxStatus
|
|
219
|
-
}), React__default["default"].createElement(blocks.Hspace, {
|
|
220
|
-
width: 0.5
|
|
221
|
-
}), React__default["default"].createElement(blocks.Text, {
|
|
222
|
-
size: "small"
|
|
223
|
-
}, renderRunboxStatusMessage())), React__default["default"].createElement(blocks.Hspace, {
|
|
224
|
-
width: 1
|
|
225
|
-
}), React__default["default"].createElement(blocks.IconButton, {
|
|
226
|
-
icon: icons.eilShare,
|
|
227
|
-
role: "greyfb",
|
|
228
|
-
size: "small",
|
|
229
|
-
border: true,
|
|
230
|
-
disabled: isRunboxPreparing,
|
|
231
|
-
onClick: handleShare
|
|
232
|
-
}), React__default["default"].createElement(blocks.Hspace, {
|
|
233
|
-
width: 0.5
|
|
234
|
-
}), React__default["default"].createElement(blocks.Tooltip, {
|
|
235
|
-
title: isRunboxPreparing ? intl.formatMessage({
|
|
236
|
-
id: 'runbox.reloadButton.tooltip'
|
|
237
|
-
}) : undefined
|
|
238
|
-
}, React__default["default"].createElement("span", null, React__default["default"].createElement(blocks.IconButton, {
|
|
239
|
-
icon: icons.eilReset,
|
|
240
|
-
iconSpin: isRunboxPreparing,
|
|
241
|
-
role: "greyfb",
|
|
242
|
-
size: "small",
|
|
243
|
-
border: true,
|
|
244
|
-
disabled: isRunboxPreparing,
|
|
245
|
-
onClick: handleReconnect
|
|
246
|
-
}))));
|
|
247
|
-
};
|
|
248
|
-
/**
|
|
249
|
-
* Body of runbox.
|
|
250
|
-
*/
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
const renderRunboxBody = () => {
|
|
254
|
-
if (runboxStatus === exports.MaterialRunboxStatus.Terminated) {
|
|
255
|
-
return React__default["default"].createElement(MaterialRunboxContent_styled.RunboxBody, null, React__default["default"].createElement(MaterialRunboxContent_styled.RunboxBodyOverlay, null, React__default["default"].createElement(blocks.Box, null, React__default["default"].createElement(blocks.Text, {
|
|
256
|
-
size: "small",
|
|
257
|
-
preWrap: true,
|
|
258
|
-
lineHeight: 1.5,
|
|
259
|
-
textAlign: "center"
|
|
260
|
-
}, React__default["default"].createElement(reactIntl.FormattedMessage, {
|
|
261
|
-
id: "runbox.overlay.message.terminated"
|
|
262
|
-
})))));
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
if (runboxStatus === exports.MaterialRunboxStatus.Error) {
|
|
266
|
-
return React__default["default"].createElement(MaterialRunboxContent_styled.RunboxBody, null, React__default["default"].createElement(MaterialRunboxContent_styled.RunboxBodyOverlay, null, React__default["default"].createElement(blocks.Box, null, React__default["default"].createElement(blocks.Text, {
|
|
267
|
-
size: "small",
|
|
268
|
-
preWrap: true,
|
|
269
|
-
lineHeight: 1.5,
|
|
270
|
-
textAlign: "center"
|
|
271
|
-
}, React__default["default"].createElement(reactIntl.FormattedMessage, {
|
|
272
|
-
id: "runbox.overlay.message.error"
|
|
273
|
-
})))));
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
return React__default["default"].createElement(MaterialRunboxContent_styled.RunboxBody, null, React__default["default"].createElement(MaterialRunboxContent_styled.RunboxBodyOverlay, {
|
|
277
|
-
"aria-hidden": !isRunboxPreparing
|
|
278
|
-
}, React__default["default"].createElement(blocks.Box, null, React__default["default"].createElement(blocks.Spinner, null), React__default["default"].createElement(blocks.Vspace, {
|
|
279
|
-
height: 1
|
|
280
|
-
}), React__default["default"].createElement(blocks.Text, {
|
|
281
|
-
size: "small",
|
|
282
|
-
preWrap: true,
|
|
283
|
-
lineHeight: 1.5,
|
|
284
|
-
textAlign: "center"
|
|
285
|
-
}, runboxStatus === exports.MaterialRunboxStatus.Disconnected ? React__default["default"].createElement(reactIntl.FormattedMessage, {
|
|
286
|
-
id: "runbox.overlay.message.disconnected"
|
|
287
|
-
}) : React__default["default"].createElement(reactIntl.FormattedMessage, {
|
|
288
|
-
id: "runbox.overlay.message.connecting"
|
|
289
|
-
})))), runboxUrl ? React__default["default"].createElement(MaterialRunboxContent_styled.RunboxBodyIframe, {
|
|
290
|
-
src: runboxUrl + '/?folder=/mnt/elice/workspace',
|
|
291
|
-
title: "material-runbox",
|
|
292
|
-
onLoad: () => setRunboxUrlLoaded(true),
|
|
293
|
-
allow: "clipboard-read; clipboard-write; camera *; microphone *"
|
|
294
|
-
}) : null);
|
|
295
|
-
}; //
|
|
296
|
-
//
|
|
297
|
-
//
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
return React__default["default"].createElement(React__default["default"].Fragment, null, renderRunboxHeader(), React__default["default"].createElement(blocks.Vspace, {
|
|
301
|
-
height: 0.5
|
|
302
|
-
}), renderRunboxBody());
|
|
303
|
-
};
|
|
304
|
-
|
|
305
|
-
exports["default"] = MaterialRunboxContent;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { MaterialRunboxStatus } from './MaterialRunboxContent';
|
|
2
|
-
export declare const RunboxHeader: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
3
|
-
export declare const RunboxBody: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
4
|
-
export declare const RunboxBodyOverlay: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
5
|
-
export declare const RunboxBodyIframe: import("styled-components").StyledComponent<"iframe", any, {}, never>;
|
|
6
|
-
export declare const RunboxStatusLight: import("styled-components").StyledComponent<"span", any, {
|
|
7
|
-
status: MaterialRunboxStatus;
|
|
8
|
-
}, never>;
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var designTokens = require('@elice/design-tokens');
|
|
6
|
-
var styled = require('styled-components');
|
|
7
|
-
var MaterialRunboxContent = require('./MaterialRunboxContent.js');
|
|
8
|
-
|
|
9
|
-
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
10
|
-
|
|
11
|
-
var styled__default = /*#__PURE__*/_interopDefaultLegacy(styled);
|
|
12
|
-
|
|
13
|
-
const RunboxHeader = styled__default["default"].div.withConfig({
|
|
14
|
-
componentId: "sc-c53ntk-0"
|
|
15
|
-
})(["flex:0 0 2.5rem;display:flex;justify-content:flex-end;align-items:center;padding:0 0.5rem;"]);
|
|
16
|
-
const RunboxBody = styled__default["default"].div.withConfig({
|
|
17
|
-
componentId: "sc-c53ntk-1"
|
|
18
|
-
})(["position:relative;flex:1;"]);
|
|
19
|
-
const RunboxBodyOverlay = styled__default["default"].div.withConfig({
|
|
20
|
-
componentId: "sc-c53ntk-2"
|
|
21
|
-
})(["position:absolute;top:0;left:0;display:flex;justify-content:center;align-items:center;flex:1;width:100%;height:100%;background:rgba(255,255,255,0.8);&[aria-hidden='true']{display:none;}"]);
|
|
22
|
-
const RunboxBodyIframe = styled__default["default"].iframe.withConfig({
|
|
23
|
-
componentId: "sc-c53ntk-3"
|
|
24
|
-
})(["width:100%;height:100%;border:none;"]);
|
|
25
|
-
const RunboxStatusLight = styled__default["default"].span.withConfig({
|
|
26
|
-
componentId: "sc-c53ntk-4"
|
|
27
|
-
})(["display:block;width:0.5rem;height:0.5rem;border-radius:50%;background-color:", ";"], props => {
|
|
28
|
-
switch (props.status) {
|
|
29
|
-
case MaterialRunboxContent.MaterialRunboxStatus.Loading:
|
|
30
|
-
case MaterialRunboxContent.MaterialRunboxStatus.Connecting:
|
|
31
|
-
return designTokens.base.color.yellow3;
|
|
32
|
-
|
|
33
|
-
case MaterialRunboxContent.MaterialRunboxStatus.Disconnected:
|
|
34
|
-
return designTokens.base.color.red7;
|
|
35
|
-
|
|
36
|
-
case MaterialRunboxContent.MaterialRunboxStatus.Done:
|
|
37
|
-
return designTokens.base.color.green7;
|
|
38
|
-
|
|
39
|
-
case MaterialRunboxContent.MaterialRunboxStatus.Idle:
|
|
40
|
-
case MaterialRunboxContent.MaterialRunboxStatus.Terminated:
|
|
41
|
-
default:
|
|
42
|
-
return designTokens.base.color.white;
|
|
43
|
-
}
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
exports.RunboxBody = RunboxBody;
|
|
47
|
-
exports.RunboxBodyIframe = RunboxBodyIframe;
|
|
48
|
-
exports.RunboxBodyOverlay = RunboxBodyOverlay;
|
|
49
|
-
exports.RunboxHeader = RunboxHeader;
|
|
50
|
-
exports.RunboxStatusLight = RunboxStatusLight;
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var React = require('react');
|
|
4
|
-
var apiClient = require('@elice/api-client');
|
|
5
|
-
var materialSharedUtils = require('@elice/material-shared-utils');
|
|
6
|
-
var MaterialRunboxStdioWrapper = require('./MaterialRunboxStdioWrapper.js');
|
|
7
|
-
var websocket = require('./websocket.js');
|
|
8
|
-
|
|
9
|
-
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
10
|
-
|
|
11
|
-
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
12
|
-
|
|
13
|
-
const MaterialRunboxRunnerRoomWrapper = ({
|
|
14
|
-
materialRunboxId
|
|
15
|
-
}) => {
|
|
16
|
-
const {
|
|
17
|
-
apiWsOriginUrl
|
|
18
|
-
} = materialSharedUtils.useMaterialConfig();
|
|
19
|
-
const abortCtrlRef = React__default["default"].useRef(new AbortController());
|
|
20
|
-
const [runboxRunningId, setRunboxRunningId] = React__default["default"].useState();
|
|
21
|
-
const [isRunboxJoinError, setRunboxJoinError] = React__default["default"].useState(false);
|
|
22
|
-
const [isRunboxRunningCanceling, setRunboxRunningCanceling] = React__default["default"].useState(false);
|
|
23
|
-
/**
|
|
24
|
-
* Resolve runner room token.
|
|
25
|
-
*/
|
|
26
|
-
|
|
27
|
-
const resolveRunnerRoomToken = React__default["default"].useCallback(async () => {
|
|
28
|
-
setRunboxJoinError(false);
|
|
29
|
-
abortCtrlRef.current.abort();
|
|
30
|
-
abortCtrlRef.current = new AbortController();
|
|
31
|
-
return apiClient.postOrgRunnerRoomMaterialRunboxJoin({
|
|
32
|
-
materialRunboxId
|
|
33
|
-
}, {
|
|
34
|
-
signal: abortCtrlRef.current.signal
|
|
35
|
-
}).then(res => {
|
|
36
|
-
setRunboxJoinError(false);
|
|
37
|
-
setRunboxRunningId(res.runboxRunningId);
|
|
38
|
-
return res.roomToken;
|
|
39
|
-
}).catch(err => {
|
|
40
|
-
setRunboxJoinError(true);
|
|
41
|
-
throw err;
|
|
42
|
-
});
|
|
43
|
-
}, [materialRunboxId]);
|
|
44
|
-
/**
|
|
45
|
-
* Reconnect runbox.
|
|
46
|
-
*/
|
|
47
|
-
|
|
48
|
-
const reconnectRunnerRoomWebSocket = React__default["default"].useCallback(async () => {
|
|
49
|
-
if (!runboxRunningId) {
|
|
50
|
-
return;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
setRunboxRunningCanceling(true);
|
|
54
|
-
return apiClient.postOrgMaterialRunboxRunboxRunningCancel({
|
|
55
|
-
runboxRunningId
|
|
56
|
-
}).then(() => setRunboxRunningCanceling(false)).catch(() => setRunboxRunningCanceling(false));
|
|
57
|
-
}, [runboxRunningId]); //
|
|
58
|
-
//
|
|
59
|
-
//
|
|
60
|
-
|
|
61
|
-
return React__default["default"].createElement(websocket.WSMaterialRunboxRunnerRoom.Provider, {
|
|
62
|
-
enable: !isRunboxRunningCanceling,
|
|
63
|
-
endpoint: `${apiWsOriginUrl}/runner_room`,
|
|
64
|
-
tokenProvider: resolveRunnerRoomToken,
|
|
65
|
-
connectionTimeout: 8000
|
|
66
|
-
}, React__default["default"].createElement(MaterialRunboxStdioWrapper, {
|
|
67
|
-
isRunboxJoinError: isRunboxJoinError,
|
|
68
|
-
reconnectRunnerRoomWebSocket: reconnectRunnerRoomWebSocket
|
|
69
|
-
}));
|
|
70
|
-
};
|
|
71
|
-
|
|
72
|
-
module.exports = MaterialRunboxRunnerRoomWrapper;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
interface MaterialRunboxStdioWrapperProps {
|
|
3
|
-
isRunboxJoinError: boolean;
|
|
4
|
-
reconnectRunnerRoomWebSocket: () => Promise<void>;
|
|
5
|
-
}
|
|
6
|
-
declare const MaterialRunboxStdioWrapper: React.FC<MaterialRunboxStdioWrapperProps>;
|
|
7
|
-
export default MaterialRunboxStdioWrapper;
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var React = require('react');
|
|
4
|
-
var MaterialRunboxContent = require('./MaterialRunboxContent.js');
|
|
5
|
-
var websocket = require('./websocket.js');
|
|
6
|
-
|
|
7
|
-
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
8
|
-
|
|
9
|
-
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
10
|
-
|
|
11
|
-
const RECONNECT_DELAY = 500;
|
|
12
|
-
|
|
13
|
-
const MaterialRunboxStdioWrapper = ({
|
|
14
|
-
isRunboxJoinError,
|
|
15
|
-
reconnectRunnerRoomWebSocket
|
|
16
|
-
}) => {
|
|
17
|
-
const [roomToken, setRoomToken] = React__default["default"].useState('');
|
|
18
|
-
const [wsUri, setWsUri] = React__default["default"].useState('');
|
|
19
|
-
const [runboxUrl, setRunboxUrl] = React__default["default"].useState(null);
|
|
20
|
-
const [isRunboxTerminated, setRunboxTerminated] = React__default["default"].useState(false);
|
|
21
|
-
const {
|
|
22
|
-
close: closeRunnerRoom
|
|
23
|
-
} = websocket.WSMaterialRunboxRunnerRoom.useControls();
|
|
24
|
-
const runnerRoomWsStatus = websocket.WSMaterialRunboxRunnerRoom.useReadyState();
|
|
25
|
-
/**
|
|
26
|
-
* Reconnect runbox.
|
|
27
|
-
*/
|
|
28
|
-
|
|
29
|
-
const reconnect = () => {
|
|
30
|
-
setRunboxUrl(null);
|
|
31
|
-
setRunboxTerminated(false);
|
|
32
|
-
setTimeout(() => void reconnectRunnerRoomWebSocket(), RECONNECT_DELAY);
|
|
33
|
-
}; //
|
|
34
|
-
//
|
|
35
|
-
//
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
websocket.WSMaterialRunboxRunnerRoom.useMessage(message => {
|
|
39
|
-
switch (message.type) {
|
|
40
|
-
case 'ROOM_PREPARED':
|
|
41
|
-
setRoomToken(message.data.roomToken);
|
|
42
|
-
setWsUri(message.data.forwarder.wsUri);
|
|
43
|
-
setRunboxUrl(message.data.forwarder.httpUri);
|
|
44
|
-
break;
|
|
45
|
-
|
|
46
|
-
case 'EXECUTE_DONE':
|
|
47
|
-
closeRunnerRoom();
|
|
48
|
-
setRunboxTerminated(true);
|
|
49
|
-
break;
|
|
50
|
-
}
|
|
51
|
-
}, {
|
|
52
|
-
camelize: true
|
|
53
|
-
}); //
|
|
54
|
-
// Remove runbox url, when websocket is not open state.
|
|
55
|
-
//
|
|
56
|
-
|
|
57
|
-
React__default["default"].useEffect(() => {
|
|
58
|
-
if (runnerRoomWsStatus !== WebSocket.OPEN) {
|
|
59
|
-
setRunboxUrl(null);
|
|
60
|
-
}
|
|
61
|
-
}, [runnerRoomWsStatus]); //
|
|
62
|
-
//
|
|
63
|
-
//
|
|
64
|
-
|
|
65
|
-
const isReady = Boolean(wsUri) && Boolean(roomToken);
|
|
66
|
-
return React__default["default"].createElement(websocket.WSMaterialRunboxStdio.Provider, {
|
|
67
|
-
enable: isReady,
|
|
68
|
-
endpoint: `${wsUri}/client/stdio`,
|
|
69
|
-
tokenProvider: async () => roomToken,
|
|
70
|
-
maxRetries: 5,
|
|
71
|
-
heartAttack: true
|
|
72
|
-
}, isReady ? React__default["default"].createElement(MaterialRunboxContent["default"], {
|
|
73
|
-
runboxUrl: runboxUrl,
|
|
74
|
-
isRunboxJoinError: isRunboxJoinError,
|
|
75
|
-
isRunboxTerminated: isRunboxTerminated,
|
|
76
|
-
reconnect: reconnect
|
|
77
|
-
}) : null);
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
module.exports = MaterialRunboxStdioWrapper;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
export declare const en: {
|
|
2
|
-
'runbox.status.idle': string;
|
|
3
|
-
'runbox.status.connecting': string;
|
|
4
|
-
'runbox.status.loading': string;
|
|
5
|
-
'runbox.status.done': string;
|
|
6
|
-
'runbox.status.disconnected': string;
|
|
7
|
-
'runbox.status.terminated': string;
|
|
8
|
-
'runbox.reloadButton.tooltip': string;
|
|
9
|
-
'runbox.overlay.message.terminated': string;
|
|
10
|
-
'runbox.overlay.message.error': string;
|
|
11
|
-
'runbox.overlay.message.disconnected': string;
|
|
12
|
-
'runbox.overlay.message.connecting': string;
|
|
13
|
-
'runbox.share.success': string;
|
|
14
|
-
};
|
|
15
|
-
export declare const ko: typeof en;
|