@elice/material-runbox 1.230328.0 → 1.230418.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 (84) hide show
  1. package/cjs/_virtual/_rollupPluginBabelHelpers.js +404 -0
  2. package/cjs/assets/queue.gif.js +8 -0
  3. package/cjs/assets/runbox_logo.png.js +8 -0
  4. package/cjs/assets/terminated.png.js +8 -0
  5. package/cjs/components/material-runbox/MaterialRunbox.d.ts +7 -3
  6. package/cjs/components/material-runbox/MaterialRunbox.js +148 -30
  7. package/cjs/components/material-runbox/MaterialRunboxBody.d.ts +4 -0
  8. package/cjs/components/material-runbox/MaterialRunboxBody.js +27 -0
  9. package/cjs/components/material-runbox/MaterialRunboxFooter.d.ts +4 -0
  10. package/cjs/components/material-runbox/MaterialRunboxFooter.js +57 -0
  11. package/cjs/components/material-runbox/MaterialRunboxHeader.d.ts +4 -0
  12. package/cjs/components/material-runbox/MaterialRunboxHeader.js +139 -0
  13. package/cjs/components/material-runbox/context.d.ts +11 -0
  14. package/cjs/components/material-runbox/context.js +12 -0
  15. package/cjs/components/material-runbox/hooks/index.d.ts +2 -0
  16. package/cjs/components/material-runbox/hooks/useMaterialRunboxApi.d.ts +14 -0
  17. package/cjs/components/material-runbox/hooks/useMaterialRunboxApi.js +46 -0
  18. package/cjs/components/material-runbox/hooks/useRunboxControl.d.ts +11 -0
  19. package/cjs/components/material-runbox/hooks/useRunboxControl.js +99 -0
  20. package/cjs/components/material-runbox/runtime/Runtime.d.ts +21 -0
  21. package/cjs/components/material-runbox/runtime/Runtime.js +58 -0
  22. package/cjs/components/material-runbox/runtime/RuntimeOverlayAssigned.d.ts +4 -0
  23. package/cjs/components/material-runbox/runtime/RuntimeOverlayAssigned.js +48 -0
  24. package/cjs/components/material-runbox/runtime/RuntimeOverlayQueued.d.ts +4 -0
  25. package/cjs/components/material-runbox/runtime/RuntimeOverlayQueued.js +63 -0
  26. package/cjs/components/material-runbox/runtime/RuntimeOverlayTerminated.d.ts +7 -0
  27. package/cjs/components/material-runbox/runtime/RuntimeOverlayTerminated.js +144 -0
  28. package/cjs/index.js +1 -1
  29. package/es/_virtual/_rollupPluginBabelHelpers.js +392 -0
  30. package/es/assets/queue.gif.js +4 -0
  31. package/es/assets/runbox_logo.png.js +4 -0
  32. package/es/assets/terminated.png.js +4 -0
  33. package/es/components/material-runbox/MaterialRunbox.d.ts +7 -3
  34. package/es/components/material-runbox/MaterialRunbox.js +146 -32
  35. package/es/components/material-runbox/MaterialRunboxBody.d.ts +4 -0
  36. package/es/components/material-runbox/MaterialRunboxBody.js +18 -0
  37. package/es/components/material-runbox/MaterialRunboxFooter.d.ts +4 -0
  38. package/es/components/material-runbox/MaterialRunboxFooter.js +48 -0
  39. package/es/components/material-runbox/MaterialRunboxHeader.d.ts +4 -0
  40. package/es/components/material-runbox/MaterialRunboxHeader.js +130 -0
  41. package/es/components/material-runbox/context.d.ts +11 -0
  42. package/es/components/material-runbox/context.js +8 -0
  43. package/es/components/material-runbox/hooks/index.d.ts +2 -0
  44. package/es/components/material-runbox/hooks/useMaterialRunboxApi.d.ts +14 -0
  45. package/es/components/material-runbox/hooks/useMaterialRunboxApi.js +42 -0
  46. package/es/components/material-runbox/hooks/useRunboxControl.d.ts +11 -0
  47. package/es/components/material-runbox/hooks/useRunboxControl.js +95 -0
  48. package/es/components/material-runbox/runtime/Runtime.d.ts +21 -0
  49. package/es/components/material-runbox/runtime/Runtime.js +50 -0
  50. package/es/components/material-runbox/runtime/RuntimeOverlayAssigned.d.ts +4 -0
  51. package/es/components/material-runbox/runtime/RuntimeOverlayAssigned.js +40 -0
  52. package/es/components/material-runbox/runtime/RuntimeOverlayQueued.d.ts +4 -0
  53. package/es/components/material-runbox/runtime/RuntimeOverlayQueued.js +55 -0
  54. package/es/components/material-runbox/runtime/RuntimeOverlayTerminated.d.ts +7 -0
  55. package/es/components/material-runbox/runtime/RuntimeOverlayTerminated.js +136 -0
  56. package/package.json +23 -24
  57. package/cjs/components/material-runbox/MaterialRunbox.styled.d.ts +0 -1
  58. package/cjs/components/material-runbox/MaterialRunbox.styled.js +0 -15
  59. package/cjs/components/material-runbox/MaterialRunboxContent.d.ts +0 -18
  60. package/cjs/components/material-runbox/MaterialRunboxContent.js +0 -305
  61. package/cjs/components/material-runbox/MaterialRunboxContent.styled.d.ts +0 -8
  62. package/cjs/components/material-runbox/MaterialRunboxContent.styled.js +0 -50
  63. package/cjs/components/material-runbox/MaterialRunboxRunnerRoomWrapper.d.ts +0 -6
  64. package/cjs/components/material-runbox/MaterialRunboxRunnerRoomWrapper.js +0 -72
  65. package/cjs/components/material-runbox/MaterialRunboxStdioWrapper.d.ts +0 -7
  66. package/cjs/components/material-runbox/MaterialRunboxStdioWrapper.js +0 -80
  67. package/cjs/components/material-runbox/locales.d.ts +0 -15
  68. package/cjs/components/material-runbox/locales.js +0 -35
  69. package/cjs/components/material-runbox/websocket.d.ts +0 -10
  70. package/cjs/components/material-runbox/websocket.js +0 -20
  71. package/es/components/material-runbox/MaterialRunbox.styled.d.ts +0 -1
  72. package/es/components/material-runbox/MaterialRunbox.styled.js +0 -7
  73. package/es/components/material-runbox/MaterialRunboxContent.d.ts +0 -18
  74. package/es/components/material-runbox/MaterialRunboxContent.js +0 -297
  75. package/es/components/material-runbox/MaterialRunboxContent.styled.d.ts +0 -8
  76. package/es/components/material-runbox/MaterialRunboxContent.styled.js +0 -38
  77. package/es/components/material-runbox/MaterialRunboxRunnerRoomWrapper.d.ts +0 -6
  78. package/es/components/material-runbox/MaterialRunboxRunnerRoomWrapper.js +0 -66
  79. package/es/components/material-runbox/MaterialRunboxStdioWrapper.d.ts +0 -7
  80. package/es/components/material-runbox/MaterialRunboxStdioWrapper.js +0 -74
  81. package/es/components/material-runbox/locales.d.ts +0 -15
  82. package/es/components/material-runbox/locales.js +0 -30
  83. package/es/components/material-runbox/websocket.d.ts +0 -10
  84. package/es/components/material-runbox/websocket.js +0 -15
@@ -1,35 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- const en = {
6
- 'runbox.status.idle': 'Prepare notebook',
7
- 'runbox.status.connecting': 'Connecting notebook',
8
- 'runbox.status.loading': 'Loading notebook',
9
- 'runbox.status.done': 'Connected',
10
- 'runbox.status.disconnected': 'Disconnected',
11
- 'runbox.status.terminated': 'Terminated',
12
- 'runbox.reloadButton.tooltip': 'Reconnecting',
13
- 'runbox.overlay.message.terminated': 'The connection has been terminated.\nTo reconnect, click the refresh button at the top.',
14
- 'runbox.overlay.message.error': 'An error occurred connecting to the notebook server.\nClose all open notebook windows, please try again in a few minutes.',
15
- 'runbox.overlay.message.disconnected': 'Reconnection is being attempted.\nIf the connection is delayed, check the network environment.',
16
- 'runbox.overlay.message.connecting': 'Connecting.\nThis may take up to 5 minutes.',
17
- 'runbox.share.success': 'Copied share URL to clipboard.'
18
- };
19
- const ko = {
20
- 'runbox.status.idle': '준비 중...',
21
- 'runbox.status.connecting': '페이지 연결 중...',
22
- 'runbox.status.loading': '페이지 로드 중...',
23
- 'runbox.status.done': '연결됨',
24
- 'runbox.status.disconnected': '연결 끊김',
25
- 'runbox.status.terminated': '종료됨',
26
- 'runbox.reloadButton.tooltip': '재연결 중',
27
- 'runbox.overlay.message.terminated': '연결이 종료되었습니다.\n다시 연결하시려면 상단의 새로고침 버튼을 눌려주세요.',
28
- 'runbox.overlay.message.error': '노트북 서버에 연결 중 오류가 발생했습니다.\n열려 있는 모든 노트북 창을 닫고, 몇 분 뒤에 다시 시도해 주십시오.',
29
- 'runbox.overlay.message.disconnected': '재연결 시도 중 입니다.\n연결이 지연될 시에는 네트워크 환경을 확인해주세요.',
30
- 'runbox.overlay.message.connecting': '연결 중 입니다.\n최대 5분까지 소요될 수 있습니다.',
31
- 'runbox.share.success': '공유 URL이 클립보드에 복사되었습니다.'
32
- };
33
-
34
- exports.en = en;
35
- exports.ko = ko;
@@ -1,10 +0,0 @@
1
- import { EliceWebSocketReact } from '@elice/websocket';
2
- /**
3
- * Websocket instance for material runbox runner room.
4
- * - endpoint: `/runner_room`
5
- */
6
- export declare const WSMaterialRunboxRunnerRoom: EliceWebSocketReact;
7
- /**
8
- * Websocket instance for material runbox stdio.
9
- */
10
- export declare const WSMaterialRunboxStdio: EliceWebSocketReact;
@@ -1,20 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var websocket = require('@elice/websocket');
6
-
7
- /**
8
- * Websocket instance for material runbox runner room.
9
- * - endpoint: `/runner_room`
10
- */
11
-
12
- const WSMaterialRunboxRunnerRoom = new websocket.EliceWebSocketReact();
13
- /**
14
- * Websocket instance for material runbox stdio.
15
- */
16
-
17
- const WSMaterialRunboxStdio = new websocket.EliceWebSocketReact();
18
-
19
- exports.WSMaterialRunboxRunnerRoom = WSMaterialRunboxRunnerRoom;
20
- exports.WSMaterialRunboxStdio = WSMaterialRunboxStdio;
@@ -1 +0,0 @@
1
- export declare const StyledMaterialRunbox: import("styled-components").StyledComponent<"div", any, {}, never>;
@@ -1,7 +0,0 @@
1
- import styled from 'styled-components';
2
-
3
- const StyledMaterialRunbox = styled.div.withConfig({
4
- componentId: "sc-2frgib-0"
5
- })(["display:flex;flex-direction:column;padding-top:0.5rem;width:100%;height:100%;background-color:#fff;"]);
6
-
7
- export { 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,297 +0,0 @@
1
- import React from 'react';
2
- import { useIntl, FormattedMessage } from 'react-intl';
3
- import { usePrevious } from 'react-use';
4
- import { Flex, Hspace, Text, IconButton, Tooltip, Vspace, Notification, LaptopOrLarger, AntProgress, Box, Spinner } from '@elice/blocks';
5
- import { eilShare, eilReset } from '@elice/icons';
6
- import { WSMaterialRunboxStdio } from './websocket.js';
7
- import { RunboxHeader, RunboxStatusLight, RunboxBody, RunboxBodyOverlay, RunboxBodyIframe } from './MaterialRunboxContent.styled.js';
8
-
9
- /* eslint-disable @typescript-eslint/naming-convention */
10
- var MaterialRunboxStatus;
11
-
12
- (function (MaterialRunboxStatus) {
13
- MaterialRunboxStatus[MaterialRunboxStatus["Idle"] = 0] = "Idle";
14
- MaterialRunboxStatus[MaterialRunboxStatus["Connecting"] = 1] = "Connecting";
15
- MaterialRunboxStatus[MaterialRunboxStatus["Loading"] = 2] = "Loading";
16
- MaterialRunboxStatus[MaterialRunboxStatus["Done"] = 3] = "Done";
17
- MaterialRunboxStatus[MaterialRunboxStatus["Disconnected"] = 4] = "Disconnected";
18
- MaterialRunboxStatus[MaterialRunboxStatus["Terminated"] = 5] = "Terminated";
19
- MaterialRunboxStatus[MaterialRunboxStatus["Error"] = 6] = "Error";
20
- })(MaterialRunboxStatus || (MaterialRunboxStatus = {}));
21
-
22
- const MaterialRunboxContent = ({
23
- runboxUrl,
24
- isRunboxTerminated,
25
- isRunboxJoinError,
26
- reconnect
27
- }) => {
28
- const intl = useIntl();
29
- const [runboxStats, setRunboxStats] = React.useState(null);
30
- const [isRunboxUrlLoaded, setRunboxUrlLoaded] = React.useState(false);
31
- const isRunboxUrlLoadedPrev = usePrevious(isRunboxUrlLoaded);
32
- const [runboxStatus, setRunboxStatus] = React.useState(MaterialRunboxStatus.Idle);
33
- const isRunboxPreparing = runboxStatus !== MaterialRunboxStatus.Done && runboxStatus !== MaterialRunboxStatus.Terminated;
34
- WSMaterialRunboxStdio.useMessage(message => {
35
- if (message.type === 'stats') {
36
- setRunboxStats(message.data);
37
- }
38
- }, {
39
- camelize: true
40
- });
41
-
42
- const handleReconnect = () => {
43
- setRunboxStats(null);
44
- setRunboxUrlLoaded(false);
45
- reconnect();
46
- };
47
-
48
- const handleShare = async () => {
49
- if (!runboxUrl) {
50
- return;
51
- }
52
-
53
- try {
54
- await navigator.clipboard.writeText(runboxUrl);
55
- Notification.success(intl.formatMessage({
56
- id: 'runbox.share.success'
57
- }));
58
- } catch (e) {
59
- alert(runboxUrl);
60
- }
61
- }; //
62
- // Change `isRunboxUrlLoaded` flag to false, when runbox url removed.
63
- //
64
-
65
-
66
- React.useEffect(() => {
67
- if (!runboxUrl) {
68
- setRunboxUrlLoaded(false);
69
- }
70
- }, [runboxUrl]); //
71
- // Determine runbox status.
72
- //
73
-
74
- React.useEffect(() => {
75
- setRunboxStatus((() => {
76
- switch (true) {
77
- case isRunboxJoinError:
78
- return MaterialRunboxStatus.Error;
79
-
80
- case !runboxUrl && isRunboxTerminated:
81
- return MaterialRunboxStatus.Terminated;
82
-
83
- case !runboxUrl && !isRunboxTerminated && isRunboxUrlLoadedPrev:
84
- return MaterialRunboxStatus.Disconnected;
85
-
86
- case !runboxUrl && !isRunboxTerminated && !isRunboxUrlLoadedPrev:
87
- return MaterialRunboxStatus.Connecting;
88
-
89
- case Boolean(runboxUrl) && !isRunboxUrlLoaded:
90
- return MaterialRunboxStatus.Loading;
91
-
92
- case Boolean(runboxUrl) && isRunboxUrlLoaded:
93
- return MaterialRunboxStatus.Done;
94
-
95
- default:
96
- return MaterialRunboxStatus.Idle;
97
- }
98
- })());
99
- }, [isRunboxJoinError, isRunboxTerminated, isRunboxUrlLoaded, isRunboxUrlLoadedPrev, runboxUrl]);
100
- /**
101
- * Runbox status message shown at header.
102
- */
103
-
104
- const renderRunboxStatusMessage = () => {
105
- switch (runboxStatus) {
106
- case MaterialRunboxStatus.Idle:
107
- return React.createElement(FormattedMessage, {
108
- id: "runbox.status.idle"
109
- });
110
-
111
- case MaterialRunboxStatus.Connecting:
112
- return React.createElement(FormattedMessage, {
113
- id: "runbox.status.connecting"
114
- });
115
-
116
- case MaterialRunboxStatus.Loading:
117
- return React.createElement(FormattedMessage, {
118
- id: "runbox.status.loading"
119
- });
120
-
121
- case MaterialRunboxStatus.Done:
122
- return React.createElement(FormattedMessage, {
123
- id: "runbox.status.done"
124
- });
125
-
126
- case MaterialRunboxStatus.Disconnected:
127
- return React.createElement(FormattedMessage, {
128
- id: "runbox.status.disconnected"
129
- });
130
-
131
- case MaterialRunboxStatus.Terminated:
132
- return React.createElement(FormattedMessage, {
133
- id: "runbox.status.terminated"
134
- });
135
- }
136
- };
137
- /**
138
- * Header of runbox.
139
- */
140
-
141
-
142
- const renderRunboxHeader = () => {
143
- const runboxStatsInfo = runboxStats ? React.createElement(LaptopOrLarger, null, React.createElement(Flex, null, React.createElement(Flex, {
144
- align: "center"
145
- }, React.createElement(Text, {
146
- size: "tiny",
147
- lineHeight: 1.5,
148
- role: "gray7",
149
- bold: true
150
- }, "CPU:\u00A0"), React.createElement(Flex, {
151
- align: "center",
152
- width: "30px"
153
- }, React.createElement(AntProgress, {
154
- type: "line",
155
- percent: runboxStats.cpu.percent,
156
- status: 'active',
157
- showInfo: false
158
- })), React.createElement(Text, {
159
- size: "tiny",
160
- lineHeight: 1.5,
161
- role: "gray5"
162
- }, "\u00A0", `${runboxStats.cpu.percent.toFixed(0)}%`)), React.createElement(Hspace, {
163
- width: 1
164
- }), React.createElement(Flex, {
165
- align: "center"
166
- }, React.createElement(Text, {
167
- size: "tiny",
168
- lineHeight: 1.5,
169
- role: "gray7",
170
- bold: true
171
- }, "MEM:\u00A0"), React.createElement(Flex, {
172
- align: "center",
173
- width: "30px"
174
- }, React.createElement(AntProgress, {
175
- percent: runboxStats.memory.currentBytes / runboxStats.memory.limitBytes * 100,
176
- status: 'active',
177
- showInfo: false
178
- })), React.createElement(Text, {
179
- size: "tiny",
180
- lineHeight: 1.5,
181
- role: "gray5"
182
- }, "\u00A0", `${(runboxStats.memory.currentBytes / 1024 / 1024).toFixed(0)}M / ${(runboxStats.memory.limitBytes / 1024 / 1024).toFixed(0)}M`)), React.createElement(Hspace, {
183
- width: 1
184
- }), React.createElement(Text, {
185
- size: "tiny",
186
- lineHeight: 1.5,
187
- role: "gray7",
188
- bold: true
189
- }, "DISK:\u00A0"), React.createElement(Text, {
190
- size: "tiny",
191
- lineHeight: 1.5,
192
- role: "gray5"
193
- }, `Read ${(runboxStats.block.rxBytes / 1024 / 1024).toFixed(0)}M Write ${(runboxStats.block.txBytes / 1024 / 1024).toFixed(0)}M`), React.createElement(Hspace, {
194
- width: 1
195
- }), React.createElement(Text, {
196
- size: "tiny",
197
- lineHeight: 1.5,
198
- role: "gray7",
199
- bold: true
200
- }, "NET:\u00A0"), React.createElement(Text, {
201
- size: "tiny",
202
- lineHeight: 1.5,
203
- role: "gray5"
204
- }, `↓${(runboxStats.network.rxBytes / 1024 / 1024).toFixed(0)}M ↑${(runboxStats.network.txBytes / 1024 / 1024).toFixed(0)}M`), React.createElement(Hspace, {
205
- width: 1
206
- }))) : null;
207
- return React.createElement(RunboxHeader, null, runboxStatsInfo, React.createElement(Flex, {
208
- align: "center"
209
- }, React.createElement(RunboxStatusLight, {
210
- status: runboxStatus
211
- }), React.createElement(Hspace, {
212
- width: 0.5
213
- }), React.createElement(Text, {
214
- size: "small"
215
- }, renderRunboxStatusMessage())), React.createElement(Hspace, {
216
- width: 1
217
- }), React.createElement(IconButton, {
218
- icon: eilShare,
219
- role: "greyfb",
220
- size: "small",
221
- border: true,
222
- disabled: isRunboxPreparing,
223
- onClick: handleShare
224
- }), React.createElement(Hspace, {
225
- width: 0.5
226
- }), React.createElement(Tooltip, {
227
- title: isRunboxPreparing ? intl.formatMessage({
228
- id: 'runbox.reloadButton.tooltip'
229
- }) : undefined
230
- }, React.createElement("span", null, React.createElement(IconButton, {
231
- icon: eilReset,
232
- iconSpin: isRunboxPreparing,
233
- role: "greyfb",
234
- size: "small",
235
- border: true,
236
- disabled: isRunboxPreparing,
237
- onClick: handleReconnect
238
- }))));
239
- };
240
- /**
241
- * Body of runbox.
242
- */
243
-
244
-
245
- const renderRunboxBody = () => {
246
- if (runboxStatus === MaterialRunboxStatus.Terminated) {
247
- return React.createElement(RunboxBody, null, React.createElement(RunboxBodyOverlay, null, React.createElement(Box, null, React.createElement(Text, {
248
- size: "small",
249
- preWrap: true,
250
- lineHeight: 1.5,
251
- textAlign: "center"
252
- }, React.createElement(FormattedMessage, {
253
- id: "runbox.overlay.message.terminated"
254
- })))));
255
- }
256
-
257
- if (runboxStatus === MaterialRunboxStatus.Error) {
258
- return React.createElement(RunboxBody, null, React.createElement(RunboxBodyOverlay, null, React.createElement(Box, null, React.createElement(Text, {
259
- size: "small",
260
- preWrap: true,
261
- lineHeight: 1.5,
262
- textAlign: "center"
263
- }, React.createElement(FormattedMessage, {
264
- id: "runbox.overlay.message.error"
265
- })))));
266
- }
267
-
268
- return React.createElement(RunboxBody, null, React.createElement(RunboxBodyOverlay, {
269
- "aria-hidden": !isRunboxPreparing
270
- }, React.createElement(Box, null, React.createElement(Spinner, null), React.createElement(Vspace, {
271
- height: 1
272
- }), React.createElement(Text, {
273
- size: "small",
274
- preWrap: true,
275
- lineHeight: 1.5,
276
- textAlign: "center"
277
- }, runboxStatus === MaterialRunboxStatus.Disconnected ? React.createElement(FormattedMessage, {
278
- id: "runbox.overlay.message.disconnected"
279
- }) : React.createElement(FormattedMessage, {
280
- id: "runbox.overlay.message.connecting"
281
- })))), runboxUrl ? React.createElement(RunboxBodyIframe, {
282
- src: runboxUrl + '/?folder=/mnt/elice/workspace',
283
- title: "material-runbox",
284
- onLoad: () => setRunboxUrlLoaded(true),
285
- allow: "clipboard-read; clipboard-write; camera *; microphone *"
286
- }) : null);
287
- }; //
288
- //
289
- //
290
-
291
-
292
- return React.createElement(React.Fragment, null, renderRunboxHeader(), React.createElement(Vspace, {
293
- height: 0.5
294
- }), renderRunboxBody());
295
- };
296
-
297
- export { MaterialRunboxStatus, MaterialRunboxContent as default };
@@ -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,38 +0,0 @@
1
- import { base } from '@elice/design-tokens';
2
- import styled from 'styled-components';
3
- import { MaterialRunboxStatus } from './MaterialRunboxContent.js';
4
-
5
- const RunboxHeader = styled.div.withConfig({
6
- componentId: "sc-c53ntk-0"
7
- })(["flex:0 0 2.5rem;display:flex;justify-content:flex-end;align-items:center;padding:0 0.5rem;"]);
8
- const RunboxBody = styled.div.withConfig({
9
- componentId: "sc-c53ntk-1"
10
- })(["position:relative;flex:1;"]);
11
- const RunboxBodyOverlay = styled.div.withConfig({
12
- componentId: "sc-c53ntk-2"
13
- })(["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;}"]);
14
- const RunboxBodyIframe = styled.iframe.withConfig({
15
- componentId: "sc-c53ntk-3"
16
- })(["width:100%;height:100%;border:none;"]);
17
- const RunboxStatusLight = styled.span.withConfig({
18
- componentId: "sc-c53ntk-4"
19
- })(["display:block;width:0.5rem;height:0.5rem;border-radius:50%;background-color:", ";"], props => {
20
- switch (props.status) {
21
- case MaterialRunboxStatus.Loading:
22
- case MaterialRunboxStatus.Connecting:
23
- return base.color.yellow3;
24
-
25
- case MaterialRunboxStatus.Disconnected:
26
- return base.color.red7;
27
-
28
- case MaterialRunboxStatus.Done:
29
- return base.color.green7;
30
-
31
- case MaterialRunboxStatus.Idle:
32
- case MaterialRunboxStatus.Terminated:
33
- default:
34
- return base.color.white;
35
- }
36
- });
37
-
38
- export { RunboxBody, RunboxBodyIframe, RunboxBodyOverlay, RunboxHeader, RunboxStatusLight };
@@ -1,6 +0,0 @@
1
- import React from 'react';
2
- export interface MaterialRunboxRunnerRoomWrapperProps {
3
- materialRunboxId: number;
4
- }
5
- declare const MaterialRunboxRunnerRoomWrapper: React.FC<MaterialRunboxRunnerRoomWrapperProps>;
6
- export default MaterialRunboxRunnerRoomWrapper;
@@ -1,66 +0,0 @@
1
- import React from 'react';
2
- import { postOrgRunnerRoomMaterialRunboxJoin, postOrgMaterialRunboxRunboxRunningCancel } from '@elice/api-client';
3
- import { useMaterialConfig } from '@elice/material-shared-utils';
4
- import MaterialRunboxStdioWrapper from './MaterialRunboxStdioWrapper.js';
5
- import { WSMaterialRunboxRunnerRoom } from './websocket.js';
6
-
7
- const MaterialRunboxRunnerRoomWrapper = ({
8
- materialRunboxId
9
- }) => {
10
- const {
11
- apiWsOriginUrl
12
- } = useMaterialConfig();
13
- const abortCtrlRef = React.useRef(new AbortController());
14
- const [runboxRunningId, setRunboxRunningId] = React.useState();
15
- const [isRunboxJoinError, setRunboxJoinError] = React.useState(false);
16
- const [isRunboxRunningCanceling, setRunboxRunningCanceling] = React.useState(false);
17
- /**
18
- * Resolve runner room token.
19
- */
20
-
21
- const resolveRunnerRoomToken = React.useCallback(async () => {
22
- setRunboxJoinError(false);
23
- abortCtrlRef.current.abort();
24
- abortCtrlRef.current = new AbortController();
25
- return postOrgRunnerRoomMaterialRunboxJoin({
26
- materialRunboxId
27
- }, {
28
- signal: abortCtrlRef.current.signal
29
- }).then(res => {
30
- setRunboxJoinError(false);
31
- setRunboxRunningId(res.runboxRunningId);
32
- return res.roomToken;
33
- }).catch(err => {
34
- setRunboxJoinError(true);
35
- throw err;
36
- });
37
- }, [materialRunboxId]);
38
- /**
39
- * Reconnect runbox.
40
- */
41
-
42
- const reconnectRunnerRoomWebSocket = React.useCallback(async () => {
43
- if (!runboxRunningId) {
44
- return;
45
- }
46
-
47
- setRunboxRunningCanceling(true);
48
- return postOrgMaterialRunboxRunboxRunningCancel({
49
- runboxRunningId
50
- }).then(() => setRunboxRunningCanceling(false)).catch(() => setRunboxRunningCanceling(false));
51
- }, [runboxRunningId]); //
52
- //
53
- //
54
-
55
- return React.createElement(WSMaterialRunboxRunnerRoom.Provider, {
56
- enable: !isRunboxRunningCanceling,
57
- endpoint: `${apiWsOriginUrl}/runner_room`,
58
- tokenProvider: resolveRunnerRoomToken,
59
- connectionTimeout: 8000
60
- }, React.createElement(MaterialRunboxStdioWrapper, {
61
- isRunboxJoinError: isRunboxJoinError,
62
- reconnectRunnerRoomWebSocket: reconnectRunnerRoomWebSocket
63
- }));
64
- };
65
-
66
- export { MaterialRunboxRunnerRoomWrapper as default };
@@ -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,74 +0,0 @@
1
- import React from 'react';
2
- import MaterialRunboxContent from './MaterialRunboxContent.js';
3
- import { WSMaterialRunboxRunnerRoom, WSMaterialRunboxStdio } from './websocket.js';
4
-
5
- const RECONNECT_DELAY = 500;
6
-
7
- const MaterialRunboxStdioWrapper = ({
8
- isRunboxJoinError,
9
- reconnectRunnerRoomWebSocket
10
- }) => {
11
- const [roomToken, setRoomToken] = React.useState('');
12
- const [wsUri, setWsUri] = React.useState('');
13
- const [runboxUrl, setRunboxUrl] = React.useState(null);
14
- const [isRunboxTerminated, setRunboxTerminated] = React.useState(false);
15
- const {
16
- close: closeRunnerRoom
17
- } = WSMaterialRunboxRunnerRoom.useControls();
18
- const runnerRoomWsStatus = WSMaterialRunboxRunnerRoom.useReadyState();
19
- /**
20
- * Reconnect runbox.
21
- */
22
-
23
- const reconnect = () => {
24
- setRunboxUrl(null);
25
- setRunboxTerminated(false);
26
- setTimeout(() => void reconnectRunnerRoomWebSocket(), RECONNECT_DELAY);
27
- }; //
28
- //
29
- //
30
-
31
-
32
- WSMaterialRunboxRunnerRoom.useMessage(message => {
33
- switch (message.type) {
34
- case 'ROOM_PREPARED':
35
- setRoomToken(message.data.roomToken);
36
- setWsUri(message.data.forwarder.wsUri);
37
- setRunboxUrl(message.data.forwarder.httpUri);
38
- break;
39
-
40
- case 'EXECUTE_DONE':
41
- closeRunnerRoom();
42
- setRunboxTerminated(true);
43
- break;
44
- }
45
- }, {
46
- camelize: true
47
- }); //
48
- // Remove runbox url, when websocket is not open state.
49
- //
50
-
51
- React.useEffect(() => {
52
- if (runnerRoomWsStatus !== WebSocket.OPEN) {
53
- setRunboxUrl(null);
54
- }
55
- }, [runnerRoomWsStatus]); //
56
- //
57
- //
58
-
59
- const isReady = Boolean(wsUri) && Boolean(roomToken);
60
- return React.createElement(WSMaterialRunboxStdio.Provider, {
61
- enable: isReady,
62
- endpoint: `${wsUri}/client/stdio`,
63
- tokenProvider: async () => roomToken,
64
- maxRetries: 5,
65
- heartAttack: true
66
- }, isReady ? React.createElement(MaterialRunboxContent, {
67
- runboxUrl: runboxUrl,
68
- isRunboxJoinError: isRunboxJoinError,
69
- isRunboxTerminated: isRunboxTerminated,
70
- reconnect: reconnect
71
- }) : null);
72
- };
73
-
74
- export { MaterialRunboxStdioWrapper as default };
@@ -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;
@@ -1,30 +0,0 @@
1
- const en = {
2
- 'runbox.status.idle': 'Prepare notebook',
3
- 'runbox.status.connecting': 'Connecting notebook',
4
- 'runbox.status.loading': 'Loading notebook',
5
- 'runbox.status.done': 'Connected',
6
- 'runbox.status.disconnected': 'Disconnected',
7
- 'runbox.status.terminated': 'Terminated',
8
- 'runbox.reloadButton.tooltip': 'Reconnecting',
9
- 'runbox.overlay.message.terminated': 'The connection has been terminated.\nTo reconnect, click the refresh button at the top.',
10
- 'runbox.overlay.message.error': 'An error occurred connecting to the notebook server.\nClose all open notebook windows, please try again in a few minutes.',
11
- 'runbox.overlay.message.disconnected': 'Reconnection is being attempted.\nIf the connection is delayed, check the network environment.',
12
- 'runbox.overlay.message.connecting': 'Connecting.\nThis may take up to 5 minutes.',
13
- 'runbox.share.success': 'Copied share URL to clipboard.'
14
- };
15
- const ko = {
16
- 'runbox.status.idle': '준비 중...',
17
- 'runbox.status.connecting': '페이지 연결 중...',
18
- 'runbox.status.loading': '페이지 로드 중...',
19
- 'runbox.status.done': '연결됨',
20
- 'runbox.status.disconnected': '연결 끊김',
21
- 'runbox.status.terminated': '종료됨',
22
- 'runbox.reloadButton.tooltip': '재연결 중',
23
- 'runbox.overlay.message.terminated': '연결이 종료되었습니다.\n다시 연결하시려면 상단의 새로고침 버튼을 눌려주세요.',
24
- 'runbox.overlay.message.error': '노트북 서버에 연결 중 오류가 발생했습니다.\n열려 있는 모든 노트북 창을 닫고, 몇 분 뒤에 다시 시도해 주십시오.',
25
- 'runbox.overlay.message.disconnected': '재연결 시도 중 입니다.\n연결이 지연될 시에는 네트워크 환경을 확인해주세요.',
26
- 'runbox.overlay.message.connecting': '연결 중 입니다.\n최대 5분까지 소요될 수 있습니다.',
27
- 'runbox.share.success': '공유 URL이 클립보드에 복사되었습니다.'
28
- };
29
-
30
- export { en, ko };
@@ -1,10 +0,0 @@
1
- import { EliceWebSocketReact } from '@elice/websocket';
2
- /**
3
- * Websocket instance for material runbox runner room.
4
- * - endpoint: `/runner_room`
5
- */
6
- export declare const WSMaterialRunboxRunnerRoom: EliceWebSocketReact;
7
- /**
8
- * Websocket instance for material runbox stdio.
9
- */
10
- export declare const WSMaterialRunboxStdio: EliceWebSocketReact;
@@ -1,15 +0,0 @@
1
- import { EliceWebSocketReact } from '@elice/websocket';
2
-
3
- /**
4
- * Websocket instance for material runbox runner room.
5
- * - endpoint: `/runner_room`
6
- */
7
-
8
- const WSMaterialRunboxRunnerRoom = new EliceWebSocketReact();
9
- /**
10
- * Websocket instance for material runbox stdio.
11
- */
12
-
13
- const WSMaterialRunboxStdio = new EliceWebSocketReact();
14
-
15
- export { WSMaterialRunboxRunnerRoom, WSMaterialRunboxStdio };