@elice/material-runbox-legacy 1.231212.0 → 1.231228.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/components/material-runbox-legacy/MaterialRunboxLegacy.js +11 -15
- package/cjs/components/material-runbox-legacy/MaterialRunboxLegacy.styled.js +1 -7
- package/cjs/components/material-runbox-legacy/MaterialRunboxLegacyContent.js +81 -116
- package/cjs/components/material-runbox-legacy/MaterialRunboxLegacyContent.styled.js +6 -12
- package/cjs/components/material-runbox-legacy/MaterialRunboxLegacyRunnerRoomWrapper.js +40 -75
- package/cjs/components/material-runbox-legacy/MaterialRunboxLegacyStdioWrapper.js +23 -56
- package/cjs/components/material-runbox-legacy/locales.js +2 -4
- package/cjs/components/material-runbox-legacy/websocket.js +2 -4
- package/cjs/index.js +1 -3
- package/es/components/material-runbox-legacy/MaterialRunboxLegacy.js +5 -5
- package/es/components/material-runbox-legacy/MaterialRunboxLegacy.styled.js +1 -1
- package/es/components/material-runbox-legacy/MaterialRunboxLegacyContent.js +45 -76
- package/es/components/material-runbox-legacy/MaterialRunboxLegacyContent.styled.js +6 -6
- package/es/components/material-runbox-legacy/MaterialRunboxLegacyRunnerRoomWrapper.js +37 -68
- package/es/components/material-runbox-legacy/MaterialRunboxLegacyStdioWrapper.js +20 -49
- package/es/components/material-runbox-legacy/locales.js +2 -2
- package/es/components/material-runbox-legacy/websocket.js +2 -2
- package/package.json +7 -7
- package/cjs/_virtual/_rollupPluginBabelHelpers.js +0 -388
- package/es/_virtual/_rollupPluginBabelHelpers.js +0 -377
|
@@ -11,34 +11,30 @@ var locales = require('./locales.js');
|
|
|
11
11
|
var MaterialRunboxLegacyRunnerRoomWrapper = require('./MaterialRunboxLegacyRunnerRoomWrapper.js');
|
|
12
12
|
var MaterialRunboxLegacy_styled = require('./MaterialRunboxLegacy.styled.js');
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
var materialRunboxId = _ref.materialRunboxId,
|
|
20
|
-
_ref$locale = _ref.locale,
|
|
21
|
-
locale = _ref$locale === void 0 ? 'en' : _ref$locale;
|
|
22
|
-
var isReady = materialSharedUtils.useMaterialConfigApiClientUpdate(apiClient.config.init);
|
|
14
|
+
const MaterialRunboxLegacy = ({
|
|
15
|
+
materialRunboxId,
|
|
16
|
+
locale = 'en'
|
|
17
|
+
}) => {
|
|
18
|
+
const isReady = materialSharedUtils.useMaterialConfigApiClientUpdate(apiClient.config.init);
|
|
23
19
|
if (!isReady) {
|
|
24
|
-
return
|
|
20
|
+
return React.createElement(blocks.Flex, {
|
|
25
21
|
justify: "center",
|
|
26
22
|
align: "center",
|
|
27
23
|
width: "100%",
|
|
28
24
|
height: "100%"
|
|
29
|
-
},
|
|
25
|
+
}, React.createElement(blocks.Spinner, {
|
|
30
26
|
size: "small"
|
|
31
27
|
}));
|
|
32
28
|
}
|
|
33
|
-
return
|
|
29
|
+
return React.createElement(MaterialRunboxLegacy_styled.StyledMaterialRunboxLegacy, {
|
|
34
30
|
key: materialRunboxId
|
|
35
|
-
},
|
|
31
|
+
}, React.createElement(reactIntl.IntlProvider, {
|
|
36
32
|
locale: locale,
|
|
37
33
|
defaultLocale: "en",
|
|
38
34
|
messages: locale in locales ? locales[locale] : locales.en
|
|
39
|
-
},
|
|
35
|
+
}, React.createElement(MaterialRunboxLegacyRunnerRoomWrapper.default, {
|
|
40
36
|
materialRunboxId: materialRunboxId
|
|
41
37
|
})));
|
|
42
38
|
};
|
|
43
39
|
|
|
44
|
-
exports
|
|
40
|
+
exports.default = MaterialRunboxLegacy;
|
|
@@ -1,14 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
3
|
var styled = require('styled-components');
|
|
6
4
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
var styled__default = /*#__PURE__*/_interopDefaultLegacy(styled);
|
|
10
|
-
|
|
11
|
-
var StyledMaterialRunboxLegacy = styled__default["default"].div.withConfig({
|
|
5
|
+
const StyledMaterialRunboxLegacy = styled.div.withConfig({
|
|
12
6
|
componentId: "sc-w139i8-0"
|
|
13
7
|
})(["display:flex;flex-direction:column;padding-top:0.5rem;width:100%;height:100%;background-color:#fff;"]);
|
|
14
8
|
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var _rollupPluginBabelHelpers = require('../../_virtual/_rollupPluginBabelHelpers.js');
|
|
6
5
|
var React = require('react');
|
|
7
6
|
var reactIntl = require('react-intl');
|
|
8
7
|
var reactUse = require('react-use');
|
|
@@ -11,10 +10,7 @@ var icons = require('@elice/icons');
|
|
|
11
10
|
var websocket = require('./websocket.js');
|
|
12
11
|
var MaterialRunboxLegacyContent_styled = require('./MaterialRunboxLegacyContent.styled.js');
|
|
13
12
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
17
|
-
|
|
13
|
+
/* eslint-disable @typescript-eslint/naming-convention */
|
|
18
14
|
exports.MaterialRunboxLegacyStatus = void 0;
|
|
19
15
|
(function (MaterialRunboxLegacyStatus) {
|
|
20
16
|
MaterialRunboxLegacyStatus[MaterialRunboxLegacyStatus["Idle"] = 0] = "Idle";
|
|
@@ -25,76 +21,47 @@ exports.MaterialRunboxLegacyStatus = void 0;
|
|
|
25
21
|
MaterialRunboxLegacyStatus[MaterialRunboxLegacyStatus["Terminated"] = 5] = "Terminated";
|
|
26
22
|
MaterialRunboxLegacyStatus[MaterialRunboxLegacyStatus["Error"] = 6] = "Error";
|
|
27
23
|
})(exports.MaterialRunboxLegacyStatus || (exports.MaterialRunboxLegacyStatus = {}));
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
setRunboxUrlLoaded = _React$useState4[1];
|
|
42
|
-
var isRunboxUrlLoadedPrev = reactUse.usePrevious(isRunboxUrlLoaded);
|
|
43
|
-
var _React$useState5 = React__default["default"].useState(exports.MaterialRunboxLegacyStatus.Idle),
|
|
44
|
-
_React$useState6 = _rollupPluginBabelHelpers.slicedToArray(_React$useState5, 2),
|
|
45
|
-
runboxStatus = _React$useState6[0],
|
|
46
|
-
setRunboxStatus = _React$useState6[1];
|
|
47
|
-
var isRunboxPreparing = runboxStatus !== exports.MaterialRunboxLegacyStatus.Done && runboxStatus !== exports.MaterialRunboxLegacyStatus.Terminated;
|
|
48
|
-
websocket.WSMaterialRunboxLegacyStdio.useMessage(function (message) {
|
|
24
|
+
const MaterialRunboxLegacyContent = ({
|
|
25
|
+
runboxUrl,
|
|
26
|
+
isRunboxTerminated,
|
|
27
|
+
isRunboxJoinError,
|
|
28
|
+
reconnect
|
|
29
|
+
}) => {
|
|
30
|
+
const intl = reactIntl.useIntl();
|
|
31
|
+
const [runboxStats, setRunboxStats] = React.useState(null);
|
|
32
|
+
const [isRunboxUrlLoaded, setRunboxUrlLoaded] = React.useState(false);
|
|
33
|
+
const isRunboxUrlLoadedPrev = reactUse.usePrevious(isRunboxUrlLoaded);
|
|
34
|
+
const [runboxStatus, setRunboxStatus] = React.useState(exports.MaterialRunboxLegacyStatus.Idle);
|
|
35
|
+
const isRunboxPreparing = runboxStatus !== exports.MaterialRunboxLegacyStatus.Done && runboxStatus !== exports.MaterialRunboxLegacyStatus.Terminated;
|
|
36
|
+
websocket.WSMaterialRunboxLegacyStdio.useMessage(message => {
|
|
49
37
|
if (message.type === 'stats') {
|
|
50
38
|
setRunboxStats(message.data);
|
|
51
39
|
}
|
|
52
40
|
}, {
|
|
53
41
|
camelize: true
|
|
54
42
|
});
|
|
55
|
-
|
|
43
|
+
const handleReconnect = () => {
|
|
56
44
|
setRunboxStats(null);
|
|
57
45
|
setRunboxUrlLoaded(false);
|
|
58
46
|
reconnect();
|
|
59
47
|
};
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
return
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
return navigator.clipboard.writeText(runboxUrl);
|
|
74
|
-
case 5:
|
|
75
|
-
blocks.Notification.success(intl.formatMessage({
|
|
76
|
-
id: 'runboxLegacy.share.success'
|
|
77
|
-
}));
|
|
78
|
-
_context.next = 11;
|
|
79
|
-
break;
|
|
80
|
-
case 8:
|
|
81
|
-
_context.prev = 8;
|
|
82
|
-
_context.t0 = _context["catch"](2);
|
|
83
|
-
alert(runboxUrl);
|
|
84
|
-
case 11:
|
|
85
|
-
case "end":
|
|
86
|
-
return _context.stop();
|
|
87
|
-
}
|
|
88
|
-
}, _callee, null, [[2, 8]]);
|
|
89
|
-
}));
|
|
90
|
-
return function handleShare() {
|
|
91
|
-
return _ref2.apply(this, arguments);
|
|
92
|
-
};
|
|
93
|
-
}();
|
|
48
|
+
const handleShare = async () => {
|
|
49
|
+
if (!runboxUrl) {
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
try {
|
|
53
|
+
await navigator.clipboard.writeText(runboxUrl);
|
|
54
|
+
blocks.Notification.success(intl.formatMessage({
|
|
55
|
+
id: 'runboxLegacy.share.success'
|
|
56
|
+
}));
|
|
57
|
+
} catch (e) {
|
|
58
|
+
alert(runboxUrl);
|
|
59
|
+
}
|
|
60
|
+
};
|
|
94
61
|
//
|
|
95
62
|
// Change `isRunboxUrlLoaded` flag to false, when runbox url removed.
|
|
96
63
|
//
|
|
97
|
-
|
|
64
|
+
React.useEffect(() => {
|
|
98
65
|
if (!runboxUrl) {
|
|
99
66
|
setRunboxUrlLoaded(false);
|
|
100
67
|
}
|
|
@@ -102,8 +69,8 @@ var MaterialRunboxLegacyContent = function MaterialRunboxLegacyContent(_ref) {
|
|
|
102
69
|
//
|
|
103
70
|
// Determine runbox status.
|
|
104
71
|
//
|
|
105
|
-
|
|
106
|
-
setRunboxStatus(
|
|
72
|
+
React.useEffect(() => {
|
|
73
|
+
setRunboxStatus((() => {
|
|
107
74
|
switch (true) {
|
|
108
75
|
case isRunboxJoinError:
|
|
109
76
|
return exports.MaterialRunboxLegacyStatus.Error;
|
|
@@ -120,35 +87,35 @@ var MaterialRunboxLegacyContent = function MaterialRunboxLegacyContent(_ref) {
|
|
|
120
87
|
default:
|
|
121
88
|
return exports.MaterialRunboxLegacyStatus.Idle;
|
|
122
89
|
}
|
|
123
|
-
}());
|
|
90
|
+
})());
|
|
124
91
|
}, [isRunboxJoinError, isRunboxTerminated, isRunboxUrlLoaded, isRunboxUrlLoadedPrev, runboxUrl]);
|
|
125
92
|
/**
|
|
126
93
|
* Runbox status message shown at header.
|
|
127
94
|
*/
|
|
128
|
-
|
|
95
|
+
const renderRunboxStatusMessage = () => {
|
|
129
96
|
switch (runboxStatus) {
|
|
130
97
|
case exports.MaterialRunboxLegacyStatus.Idle:
|
|
131
|
-
return
|
|
98
|
+
return React.createElement(reactIntl.FormattedMessage, {
|
|
132
99
|
id: "runboxLegacy.status.idle"
|
|
133
100
|
});
|
|
134
101
|
case exports.MaterialRunboxLegacyStatus.Connecting:
|
|
135
|
-
return
|
|
102
|
+
return React.createElement(reactIntl.FormattedMessage, {
|
|
136
103
|
id: "runboxLegacy.status.connecting"
|
|
137
104
|
});
|
|
138
105
|
case exports.MaterialRunboxLegacyStatus.Loading:
|
|
139
|
-
return
|
|
106
|
+
return React.createElement(reactIntl.FormattedMessage, {
|
|
140
107
|
id: "runboxLegacy.status.loading"
|
|
141
108
|
});
|
|
142
109
|
case exports.MaterialRunboxLegacyStatus.Done:
|
|
143
|
-
return
|
|
110
|
+
return React.createElement(reactIntl.FormattedMessage, {
|
|
144
111
|
id: "runboxLegacy.status.done"
|
|
145
112
|
});
|
|
146
113
|
case exports.MaterialRunboxLegacyStatus.Disconnected:
|
|
147
|
-
return
|
|
114
|
+
return React.createElement(reactIntl.FormattedMessage, {
|
|
148
115
|
id: "runboxLegacy.status.disconnected"
|
|
149
116
|
});
|
|
150
117
|
case exports.MaterialRunboxLegacyStatus.Terminated:
|
|
151
|
-
return
|
|
118
|
+
return React.createElement(reactIntl.FormattedMessage, {
|
|
152
119
|
id: "runboxLegacy.status.terminated"
|
|
153
120
|
});
|
|
154
121
|
}
|
|
@@ -156,95 +123,95 @@ var MaterialRunboxLegacyContent = function MaterialRunboxLegacyContent(_ref) {
|
|
|
156
123
|
/**
|
|
157
124
|
* Header of runbox.
|
|
158
125
|
*/
|
|
159
|
-
|
|
160
|
-
|
|
126
|
+
const renderRunboxHeader = () => {
|
|
127
|
+
const runboxStatsInfo = runboxStats ? React.createElement(blocks.LaptopOrLarger, null, React.createElement(blocks.Flex, null, React.createElement(blocks.Flex, {
|
|
161
128
|
align: "center"
|
|
162
|
-
},
|
|
129
|
+
}, React.createElement(blocks.Text, {
|
|
163
130
|
size: "tiny",
|
|
164
131
|
lineHeight: 1.5,
|
|
165
132
|
role: "gray7",
|
|
166
133
|
bold: true
|
|
167
|
-
}, "CPU:\
|
|
134
|
+
}, "CPU:\u00A0"), React.createElement(blocks.Flex, {
|
|
168
135
|
align: "center",
|
|
169
136
|
width: "30px"
|
|
170
|
-
},
|
|
137
|
+
}, React.createElement(blocks.AntProgress, {
|
|
171
138
|
type: "line",
|
|
172
139
|
percent: runboxStats.cpu.percent,
|
|
173
140
|
status: 'active',
|
|
174
141
|
showInfo: false
|
|
175
|
-
})),
|
|
142
|
+
})), React.createElement(blocks.Text, {
|
|
176
143
|
size: "tiny",
|
|
177
144
|
lineHeight: 1.5,
|
|
178
145
|
role: "gray5"
|
|
179
|
-
}, "\
|
|
146
|
+
}, "\u00A0", `${runboxStats.cpu.percent.toFixed(0)}%`)), React.createElement(blocks.Hspace, {
|
|
180
147
|
width: 1
|
|
181
|
-
}),
|
|
148
|
+
}), React.createElement(blocks.Flex, {
|
|
182
149
|
align: "center"
|
|
183
|
-
},
|
|
150
|
+
}, React.createElement(blocks.Text, {
|
|
184
151
|
size: "tiny",
|
|
185
152
|
lineHeight: 1.5,
|
|
186
153
|
role: "gray7",
|
|
187
154
|
bold: true
|
|
188
|
-
}, "MEM:\
|
|
155
|
+
}, "MEM:\u00A0"), React.createElement(blocks.Flex, {
|
|
189
156
|
align: "center",
|
|
190
157
|
width: "30px"
|
|
191
|
-
},
|
|
158
|
+
}, React.createElement(blocks.AntProgress, {
|
|
192
159
|
percent: runboxStats.memory.currentBytes / runboxStats.memory.limitBytes * 100,
|
|
193
160
|
status: 'active',
|
|
194
161
|
showInfo: false
|
|
195
|
-
})),
|
|
162
|
+
})), React.createElement(blocks.Text, {
|
|
196
163
|
size: "tiny",
|
|
197
164
|
lineHeight: 1.5,
|
|
198
165
|
role: "gray5"
|
|
199
|
-
}, "\
|
|
166
|
+
}, "\u00A0", `${(runboxStats.memory.currentBytes / 1024 / 1024).toFixed(0)}M / ${(runboxStats.memory.limitBytes / 1024 / 1024).toFixed(0)}M`)), React.createElement(blocks.Hspace, {
|
|
200
167
|
width: 1
|
|
201
|
-
}),
|
|
168
|
+
}), React.createElement(blocks.Text, {
|
|
202
169
|
size: "tiny",
|
|
203
170
|
lineHeight: 1.5,
|
|
204
171
|
role: "gray7",
|
|
205
172
|
bold: true
|
|
206
|
-
}, "DISK:\
|
|
173
|
+
}, "DISK:\u00A0"), React.createElement(blocks.Text, {
|
|
207
174
|
size: "tiny",
|
|
208
175
|
lineHeight: 1.5,
|
|
209
176
|
role: "gray5"
|
|
210
|
-
},
|
|
177
|
+
}, `Read ${(runboxStats.block.rxBytes / 1024 / 1024).toFixed(0)}M Write ${(runboxStats.block.txBytes / 1024 / 1024).toFixed(0)}M`), React.createElement(blocks.Hspace, {
|
|
211
178
|
width: 1
|
|
212
|
-
}),
|
|
179
|
+
}), React.createElement(blocks.Text, {
|
|
213
180
|
size: "tiny",
|
|
214
181
|
lineHeight: 1.5,
|
|
215
182
|
role: "gray7",
|
|
216
183
|
bold: true
|
|
217
|
-
}, "NET:\
|
|
184
|
+
}, "NET:\u00A0"), React.createElement(blocks.Text, {
|
|
218
185
|
size: "tiny",
|
|
219
186
|
lineHeight: 1.5,
|
|
220
187
|
role: "gray5"
|
|
221
|
-
},
|
|
188
|
+
}, `↓${(runboxStats.network.rxBytes / 1024 / 1024).toFixed(0)}M ↑${(runboxStats.network.txBytes / 1024 / 1024).toFixed(0)}M`), React.createElement(blocks.Hspace, {
|
|
222
189
|
width: 1
|
|
223
190
|
}))) : null;
|
|
224
|
-
return
|
|
191
|
+
return React.createElement(MaterialRunboxLegacyContent_styled.RunboxHeader, null, runboxStatsInfo, React.createElement(blocks.Flex, {
|
|
225
192
|
align: "center"
|
|
226
|
-
},
|
|
193
|
+
}, React.createElement(MaterialRunboxLegacyContent_styled.RunboxStatusLight, {
|
|
227
194
|
status: runboxStatus
|
|
228
|
-
}),
|
|
195
|
+
}), React.createElement(blocks.Hspace, {
|
|
229
196
|
width: 0.5
|
|
230
|
-
}),
|
|
197
|
+
}), React.createElement(blocks.Text, {
|
|
231
198
|
size: "small"
|
|
232
|
-
}, renderRunboxStatusMessage())),
|
|
199
|
+
}, renderRunboxStatusMessage())), React.createElement(blocks.Hspace, {
|
|
233
200
|
width: 1
|
|
234
|
-
}),
|
|
201
|
+
}), React.createElement(blocks.IconButton, {
|
|
235
202
|
icon: icons.eilShare,
|
|
236
203
|
role: "greyfb",
|
|
237
204
|
size: "small",
|
|
238
205
|
border: true,
|
|
239
206
|
disabled: isRunboxPreparing,
|
|
240
207
|
onClick: handleShare
|
|
241
|
-
}),
|
|
208
|
+
}), React.createElement(blocks.Hspace, {
|
|
242
209
|
width: 0.5
|
|
243
|
-
}),
|
|
210
|
+
}), React.createElement(blocks.Tooltip, {
|
|
244
211
|
title: isRunboxPreparing ? intl.formatMessage({
|
|
245
212
|
id: 'runboxLegacy.reloadButton.tooltip'
|
|
246
213
|
}) : undefined
|
|
247
|
-
},
|
|
214
|
+
}, React.createElement("span", null, React.createElement(blocks.IconButton, {
|
|
248
215
|
icon: icons.eilReset,
|
|
249
216
|
iconSpin: isRunboxPreparing,
|
|
250
217
|
role: "greyfb",
|
|
@@ -257,55 +224,53 @@ var MaterialRunboxLegacyContent = function MaterialRunboxLegacyContent(_ref) {
|
|
|
257
224
|
/**
|
|
258
225
|
* Body of runbox.
|
|
259
226
|
*/
|
|
260
|
-
|
|
227
|
+
const renderRunboxBody = () => {
|
|
261
228
|
if (runboxStatus === exports.MaterialRunboxLegacyStatus.Terminated) {
|
|
262
|
-
return
|
|
229
|
+
return React.createElement(MaterialRunboxLegacyContent_styled.RunboxBody, null, React.createElement(MaterialRunboxLegacyContent_styled.RunboxBodyOverlay, null, React.createElement(blocks.Box, null, React.createElement(blocks.Text, {
|
|
263
230
|
size: "small",
|
|
264
231
|
preWrap: true,
|
|
265
232
|
lineHeight: 1.5,
|
|
266
233
|
textAlign: "center"
|
|
267
|
-
},
|
|
234
|
+
}, React.createElement(reactIntl.FormattedMessage, {
|
|
268
235
|
id: "runboxLegacy.overlay.message.terminated"
|
|
269
236
|
})))));
|
|
270
237
|
}
|
|
271
238
|
if (runboxStatus === exports.MaterialRunboxLegacyStatus.Error) {
|
|
272
|
-
return
|
|
239
|
+
return React.createElement(MaterialRunboxLegacyContent_styled.RunboxBody, null, React.createElement(MaterialRunboxLegacyContent_styled.RunboxBodyOverlay, null, React.createElement(blocks.Box, null, React.createElement(blocks.Text, {
|
|
273
240
|
size: "small",
|
|
274
241
|
preWrap: true,
|
|
275
242
|
lineHeight: 1.5,
|
|
276
243
|
textAlign: "center"
|
|
277
|
-
},
|
|
244
|
+
}, React.createElement(reactIntl.FormattedMessage, {
|
|
278
245
|
id: "runboxLegacy.overlay.message.error"
|
|
279
246
|
})))));
|
|
280
247
|
}
|
|
281
|
-
return
|
|
248
|
+
return React.createElement(MaterialRunboxLegacyContent_styled.RunboxBody, null, React.createElement(MaterialRunboxLegacyContent_styled.RunboxBodyOverlay, {
|
|
282
249
|
"aria-hidden": !isRunboxPreparing
|
|
283
|
-
},
|
|
250
|
+
}, React.createElement(blocks.Box, null, React.createElement(blocks.Spinner, null), React.createElement(blocks.Vspace, {
|
|
284
251
|
height: 1
|
|
285
|
-
}),
|
|
252
|
+
}), React.createElement(blocks.Text, {
|
|
286
253
|
size: "small",
|
|
287
254
|
preWrap: true,
|
|
288
255
|
lineHeight: 1.5,
|
|
289
256
|
textAlign: "center"
|
|
290
|
-
}, runboxStatus === exports.MaterialRunboxLegacyStatus.Disconnected ?
|
|
257
|
+
}, runboxStatus === exports.MaterialRunboxLegacyStatus.Disconnected ? React.createElement(reactIntl.FormattedMessage, {
|
|
291
258
|
id: "runboxLegacy.overlay.message.disconnected"
|
|
292
|
-
}) :
|
|
259
|
+
}) : React.createElement(reactIntl.FormattedMessage, {
|
|
293
260
|
id: "runboxLegacy.overlay.message.connecting"
|
|
294
|
-
})))), runboxUrl ?
|
|
261
|
+
})))), runboxUrl ? React.createElement(MaterialRunboxLegacyContent_styled.RunboxBodyIframe, {
|
|
295
262
|
src: runboxUrl + '/?folder=/mnt/elice/workspace',
|
|
296
263
|
title: "material-runbox-legacy",
|
|
297
|
-
onLoad:
|
|
298
|
-
return setRunboxUrlLoaded(true);
|
|
299
|
-
},
|
|
264
|
+
onLoad: () => setRunboxUrlLoaded(true),
|
|
300
265
|
allow: "clipboard-read; clipboard-write; camera *; microphone *"
|
|
301
266
|
}) : null);
|
|
302
267
|
};
|
|
303
268
|
//
|
|
304
269
|
//
|
|
305
270
|
//
|
|
306
|
-
return
|
|
271
|
+
return React.createElement(React.Fragment, null, renderRunboxHeader(), React.createElement(blocks.Vspace, {
|
|
307
272
|
height: 0.5
|
|
308
273
|
}), renderRunboxBody());
|
|
309
274
|
};
|
|
310
275
|
|
|
311
|
-
exports
|
|
276
|
+
exports.default = MaterialRunboxLegacyContent;
|
|
@@ -1,30 +1,24 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
3
|
var designTokens = require('@elice/design-tokens');
|
|
6
4
|
var styled = require('styled-components');
|
|
7
5
|
var MaterialRunboxLegacyContent = require('./MaterialRunboxLegacyContent.js');
|
|
8
6
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
var styled__default = /*#__PURE__*/_interopDefaultLegacy(styled);
|
|
12
|
-
|
|
13
|
-
var RunboxHeader = styled__default["default"].div.withConfig({
|
|
7
|
+
const RunboxHeader = styled.div.withConfig({
|
|
14
8
|
componentId: "sc-18a3wux-0"
|
|
15
9
|
})(["flex:0 0 2.5rem;display:flex;justify-content:flex-end;align-items:center;padding:0 0.5rem;"]);
|
|
16
|
-
|
|
10
|
+
const RunboxBody = styled.div.withConfig({
|
|
17
11
|
componentId: "sc-18a3wux-1"
|
|
18
12
|
})(["position:relative;flex:1;"]);
|
|
19
|
-
|
|
13
|
+
const RunboxBodyOverlay = styled.div.withConfig({
|
|
20
14
|
componentId: "sc-18a3wux-2"
|
|
21
15
|
})(["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
|
-
|
|
16
|
+
const RunboxBodyIframe = styled.iframe.withConfig({
|
|
23
17
|
componentId: "sc-18a3wux-3"
|
|
24
18
|
})(["width:100%;height:100%;border:none;"]);
|
|
25
|
-
|
|
19
|
+
const RunboxStatusLight = styled.span.withConfig({
|
|
26
20
|
componentId: "sc-18a3wux-4"
|
|
27
|
-
})(["display:block;width:0.5rem;height:0.5rem;border-radius:50%;background-color:", ";"],
|
|
21
|
+
})(["display:block;width:0.5rem;height:0.5rem;border-radius:50%;background-color:", ";"], props => {
|
|
28
22
|
switch (props.status) {
|
|
29
23
|
case MaterialRunboxLegacyContent.MaterialRunboxLegacyStatus.Loading:
|
|
30
24
|
case MaterialRunboxLegacyContent.MaterialRunboxLegacyStatus.Connecting:
|
|
@@ -2,101 +2,66 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var _rollupPluginBabelHelpers = require('../../_virtual/_rollupPluginBabelHelpers.js');
|
|
6
5
|
var React = require('react');
|
|
7
6
|
var apiClient = require('@elice/api-client');
|
|
8
7
|
var materialSharedUtils = require('@elice/material-shared-utils');
|
|
9
8
|
var MaterialRunboxLegacyStdioWrapper = require('./MaterialRunboxLegacyStdioWrapper.js');
|
|
10
9
|
var websocket = require('./websocket.js');
|
|
11
10
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
_React$useState2 = _rollupPluginBabelHelpers.slicedToArray(_React$useState, 2),
|
|
23
|
-
runboxRunningId = _React$useState2[0],
|
|
24
|
-
setRunboxRunningId = _React$useState2[1];
|
|
25
|
-
var _React$useState3 = React__default["default"].useState(false),
|
|
26
|
-
_React$useState4 = _rollupPluginBabelHelpers.slicedToArray(_React$useState3, 2),
|
|
27
|
-
isRunboxJoinError = _React$useState4[0],
|
|
28
|
-
setRunboxJoinError = _React$useState4[1];
|
|
29
|
-
var _React$useState5 = React__default["default"].useState(false),
|
|
30
|
-
_React$useState6 = _rollupPluginBabelHelpers.slicedToArray(_React$useState5, 2),
|
|
31
|
-
isRunboxRunningCanceling = _React$useState6[0],
|
|
32
|
-
setRunboxRunningCanceling = _React$useState6[1];
|
|
11
|
+
const MaterialRunboxLegacyRunnerRoomWrapper = ({
|
|
12
|
+
materialRunboxId
|
|
13
|
+
}) => {
|
|
14
|
+
const {
|
|
15
|
+
apiWsOriginUrl
|
|
16
|
+
} = materialSharedUtils.useMaterialConfig();
|
|
17
|
+
const abortCtrlRef = React.useRef(new AbortController());
|
|
18
|
+
const [runboxRunningId, setRunboxRunningId] = React.useState();
|
|
19
|
+
const [isRunboxJoinError, setRunboxJoinError] = React.useState(false);
|
|
20
|
+
const [isRunboxRunningCanceling, setRunboxRunningCanceling] = React.useState(false);
|
|
33
21
|
/**
|
|
34
22
|
* Resolve runner room token.
|
|
35
23
|
*/
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
throw err;
|
|
54
|
-
}));
|
|
55
|
-
case 4:
|
|
56
|
-
case "end":
|
|
57
|
-
return _context.stop();
|
|
58
|
-
}
|
|
59
|
-
}, _callee);
|
|
60
|
-
})), [materialRunboxId]);
|
|
24
|
+
const resolveRunnerRoomToken = React.useCallback(async () => {
|
|
25
|
+
setRunboxJoinError(false);
|
|
26
|
+
abortCtrlRef.current.abort();
|
|
27
|
+
abortCtrlRef.current = new AbortController();
|
|
28
|
+
return apiClient.postOrgRunnerRoomMaterialRunboxJoin({
|
|
29
|
+
materialRunboxId
|
|
30
|
+
}, {
|
|
31
|
+
signal: abortCtrlRef.current.signal
|
|
32
|
+
}).then(res => {
|
|
33
|
+
setRunboxJoinError(false);
|
|
34
|
+
setRunboxRunningId(res.runboxRunningId);
|
|
35
|
+
return res.roomToken;
|
|
36
|
+
}).catch(err => {
|
|
37
|
+
setRunboxJoinError(true);
|
|
38
|
+
throw err;
|
|
39
|
+
});
|
|
40
|
+
}, [materialRunboxId]);
|
|
61
41
|
/**
|
|
62
42
|
* Reconnect runbox.
|
|
63
43
|
*/
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
case 2:
|
|
74
|
-
setRunboxRunningCanceling(true);
|
|
75
|
-
return _context2.abrupt("return", apiClient.postOrgMaterialRunboxRunboxRunningCancel({
|
|
76
|
-
runboxRunningId: runboxRunningId
|
|
77
|
-
}).then(function () {
|
|
78
|
-
return setRunboxRunningCanceling(false);
|
|
79
|
-
}).catch(function () {
|
|
80
|
-
return setRunboxRunningCanceling(false);
|
|
81
|
-
}));
|
|
82
|
-
case 4:
|
|
83
|
-
case "end":
|
|
84
|
-
return _context2.stop();
|
|
85
|
-
}
|
|
86
|
-
}, _callee2);
|
|
87
|
-
})), [runboxRunningId]);
|
|
44
|
+
const reconnectRunnerRoomWebSocket = React.useCallback(async () => {
|
|
45
|
+
if (!runboxRunningId) {
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
setRunboxRunningCanceling(true);
|
|
49
|
+
return apiClient.postOrgMaterialRunboxRunboxRunningCancel({
|
|
50
|
+
runboxRunningId
|
|
51
|
+
}).then(() => setRunboxRunningCanceling(false)).catch(() => setRunboxRunningCanceling(false));
|
|
52
|
+
}, [runboxRunningId]);
|
|
88
53
|
//
|
|
89
54
|
//
|
|
90
55
|
//
|
|
91
|
-
return
|
|
56
|
+
return React.createElement(websocket.WSMaterialRunboxLegacyRunnerRoom.Provider, {
|
|
92
57
|
enable: !isRunboxRunningCanceling,
|
|
93
|
-
endpoint:
|
|
58
|
+
endpoint: `${apiWsOriginUrl}/runner_room`,
|
|
94
59
|
tokenProvider: resolveRunnerRoomToken,
|
|
95
60
|
connectionTimeout: 8000
|
|
96
|
-
},
|
|
61
|
+
}, React.createElement(MaterialRunboxLegacyStdioWrapper.default, {
|
|
97
62
|
isRunboxJoinError: isRunboxJoinError,
|
|
98
63
|
reconnectRunnerRoomWebSocket: reconnectRunnerRoomWebSocket
|
|
99
64
|
}));
|
|
100
65
|
};
|
|
101
66
|
|
|
102
|
-
exports
|
|
67
|
+
exports.default = MaterialRunboxLegacyRunnerRoomWrapper;
|