@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
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var _rollupPluginBabelHelpers = require('../../_virtual/_rollupPluginBabelHelpers.js');
|
|
6
|
+
var React = require('react');
|
|
7
|
+
var reactIntl = require('react-intl');
|
|
8
|
+
var runboxClient = require('@elice/runbox-client');
|
|
9
|
+
var styled = require('@emotion/styled');
|
|
10
|
+
var iconsMaterial = require('@mui/icons-material');
|
|
11
|
+
var material = require('@mui/material');
|
|
12
|
+
var context = require('./context.js');
|
|
13
|
+
require('@elice/openapi-client-material-runbox');
|
|
14
|
+
var useRunboxControl = require('./hooks/useRunboxControl.js');
|
|
15
|
+
var runbox_logo = require('../../assets/runbox_logo.png.js');
|
|
16
|
+
|
|
17
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
18
|
+
|
|
19
|
+
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
20
|
+
var styled__default = /*#__PURE__*/_interopDefaultLegacy(styled);
|
|
21
|
+
|
|
22
|
+
var _templateObject;
|
|
23
|
+
//
|
|
24
|
+
//
|
|
25
|
+
//
|
|
26
|
+
var StyledHeader = styled__default["default"].div(_templateObject || (_templateObject = _rollupPluginBabelHelpers.taggedTemplateLiteral(["\n position: relative;\n flex: 0 0 3rem;\n display: flex;\n justify-content: space-between;\n align-items: center;\n padding: 0 1rem;\n width: 100%;\n border-bottom: 1px solid ", ";\n overflow: hidden;\n"])), function (_ref) {
|
|
27
|
+
var theme = _ref.theme;
|
|
28
|
+
return theme.palette.divider;
|
|
29
|
+
});
|
|
30
|
+
//
|
|
31
|
+
//
|
|
32
|
+
//
|
|
33
|
+
var MaterialRunboxHeader = function MaterialRunboxHeader(_ref2) {
|
|
34
|
+
var runbox = _ref2.runbox,
|
|
35
|
+
runtime = _ref2.runtime,
|
|
36
|
+
runtimeTemplate = _ref2.runtimeTemplate,
|
|
37
|
+
courseId = _ref2.courseId,
|
|
38
|
+
refetch = _ref2.refetch;
|
|
39
|
+
var intl = reactIntl.useIntl();
|
|
40
|
+
var _React$useContext = React__default["default"].useContext(context.MaterialRunboxContext),
|
|
41
|
+
materialRunboxApi = _React$useContext.materialRunboxApi;
|
|
42
|
+
var _useEliceRunboxRunnin = runboxClient.useEliceRunboxRunning(),
|
|
43
|
+
status = _useEliceRunboxRunnin.status;
|
|
44
|
+
var _useRunboxControl = useRunboxControl.useRunboxControl({
|
|
45
|
+
runbox: runbox,
|
|
46
|
+
courseId: courseId,
|
|
47
|
+
refetch: refetch
|
|
48
|
+
}),
|
|
49
|
+
start = _useRunboxControl.start;
|
|
50
|
+
var isRunboxRunning = status === 'running';
|
|
51
|
+
/**
|
|
52
|
+
*
|
|
53
|
+
*/
|
|
54
|
+
var handleAutoShutdownSwitchChange = function handleAutoShutdownSwitchChange(_, shutdown) {
|
|
55
|
+
if (!runtime) {
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
materialRunboxApi.runtime.runtimeRuntimeIdPatch({
|
|
59
|
+
runtimeId: runtime.id,
|
|
60
|
+
runtimePatchRequest: {
|
|
61
|
+
autoShutdown: !shutdown
|
|
62
|
+
},
|
|
63
|
+
eliceCourseId: courseId
|
|
64
|
+
}).then(refetch).catch(function () {
|
|
65
|
+
//
|
|
66
|
+
});
|
|
67
|
+
};
|
|
68
|
+
/**
|
|
69
|
+
*
|
|
70
|
+
*/
|
|
71
|
+
var renderHeaderAutoShutdownSwitch = function renderHeaderAutoShutdownSwitch() {
|
|
72
|
+
var _a;
|
|
73
|
+
return React__default["default"].createElement(material.Tooltip, {
|
|
74
|
+
title: intl.formatMessage({
|
|
75
|
+
id: runtimeTemplate.autoShutdown ? 'material.runbox.header.autoShutdownDisabledTooltip' : 'material.runbox.header.autoShutdownTooltip'
|
|
76
|
+
}, {
|
|
77
|
+
time: intl.formatNumber((_a = runtimeTemplate.quotaPerSession) !== null && _a !== void 0 ? _a : 2880, {
|
|
78
|
+
style: 'unit',
|
|
79
|
+
unit: 'minute',
|
|
80
|
+
unitDisplay: 'short'
|
|
81
|
+
})
|
|
82
|
+
})
|
|
83
|
+
}, React__default["default"].createElement(material.FormControlLabel, {
|
|
84
|
+
control: React__default["default"].createElement(material.Switch, {
|
|
85
|
+
checked: !(runtime === null || runtime === void 0 ? void 0 : runtime.autoShutdown),
|
|
86
|
+
disabled: !runtime || runtimeTemplate.autoShutdown,
|
|
87
|
+
onChange: handleAutoShutdownSwitchChange
|
|
88
|
+
}),
|
|
89
|
+
label: intl.formatMessage({
|
|
90
|
+
id: 'material.runbox.header.autoShutdown'
|
|
91
|
+
}),
|
|
92
|
+
componentsProps: {
|
|
93
|
+
typography: {
|
|
94
|
+
variant: 'body2'
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}));
|
|
98
|
+
};
|
|
99
|
+
/**
|
|
100
|
+
*
|
|
101
|
+
*/
|
|
102
|
+
var renderHeaderRestartButton = function renderHeaderRestartButton() {
|
|
103
|
+
return React__default["default"].createElement(material.Tooltip, {
|
|
104
|
+
title: intl.formatMessage({
|
|
105
|
+
id: 'material.runbox.header.restart'
|
|
106
|
+
})
|
|
107
|
+
}, React__default["default"].createElement(material.IconButton, {
|
|
108
|
+
disabled: !isRunboxRunning,
|
|
109
|
+
sx: {
|
|
110
|
+
width: '38px'
|
|
111
|
+
},
|
|
112
|
+
onClick: function onClick() {
|
|
113
|
+
return start(true);
|
|
114
|
+
}
|
|
115
|
+
}, React__default["default"].createElement(iconsMaterial.RestartAlt, null)));
|
|
116
|
+
};
|
|
117
|
+
//
|
|
118
|
+
//
|
|
119
|
+
//
|
|
120
|
+
return React__default["default"].createElement(StyledHeader, null, React__default["default"].createElement(material.Stack, {
|
|
121
|
+
direction: "row",
|
|
122
|
+
sx: {
|
|
123
|
+
height: '100%',
|
|
124
|
+
padding: '0.75rem 0'
|
|
125
|
+
}
|
|
126
|
+
}, React__default["default"].createElement(material.Box, {
|
|
127
|
+
component: "img",
|
|
128
|
+
src: runbox_logo["default"],
|
|
129
|
+
alt: "elice runbox",
|
|
130
|
+
sx: {
|
|
131
|
+
width: 'auto',
|
|
132
|
+
height: '100%'
|
|
133
|
+
}
|
|
134
|
+
})), React__default["default"].createElement(material.Stack, {
|
|
135
|
+
direction: "row"
|
|
136
|
+
}, renderHeaderAutoShutdownSwitch(), renderHeaderRestartButton()));
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
exports["default"] = MaterialRunboxHeader;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { UseMaterialRunboxApiReturn } from './hooks';
|
|
3
|
+
export declare type MaterialRunboxContextValue = MaterialRunboxContextExternalValue & MaterialRunboxContextInternalValue;
|
|
4
|
+
export interface MaterialRunboxContextExternalValue {
|
|
5
|
+
/** */
|
|
6
|
+
locale: string;
|
|
7
|
+
/** */
|
|
8
|
+
showMessenger: () => void;
|
|
9
|
+
}
|
|
10
|
+
export declare type MaterialRunboxContextInternalValue = UseMaterialRunboxApiReturn;
|
|
11
|
+
export declare const MaterialRunboxContext: import("react").Context<MaterialRunboxContextValue>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { RunboxApi as EliceMaterialRunboxRunboxApi, RuntimeApi as EliceMaterialRunboxRuntimeApi, RuntimeTemplateApi as EliceMaterialRuntimeTemplateApi } from '@elice/openapi-client-material-runbox';
|
|
2
|
+
import type { Configuration as EliceMaterialRunboxApiConfiguration } from '@elice/openapi-client-material-runbox';
|
|
3
|
+
export interface UseMaterialRunboxApiProps {
|
|
4
|
+
eliceMaterialRunboxApiConfiguration: EliceMaterialRunboxApiConfiguration;
|
|
5
|
+
}
|
|
6
|
+
export interface UseMaterialRunboxApiReturnMaterialRunbox {
|
|
7
|
+
runbox: EliceMaterialRunboxRunboxApi;
|
|
8
|
+
runtime: EliceMaterialRunboxRuntimeApi;
|
|
9
|
+
runtimeTemplate: EliceMaterialRuntimeTemplateApi;
|
|
10
|
+
}
|
|
11
|
+
export interface UseMaterialRunboxApiReturn {
|
|
12
|
+
materialRunboxApi: UseMaterialRunboxApiReturnMaterialRunbox;
|
|
13
|
+
}
|
|
14
|
+
export declare const useMaterialRunboxApi: (props: UseMaterialRunboxApiProps) => UseMaterialRunboxApiReturn;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var _rollupPluginBabelHelpers = require('../../../_virtual/_rollupPluginBabelHelpers.js');
|
|
6
|
+
var React = require('react');
|
|
7
|
+
var openapiClientMaterialRunbox = require('@elice/openapi-client-material-runbox');
|
|
8
|
+
|
|
9
|
+
//
|
|
10
|
+
//
|
|
11
|
+
//
|
|
12
|
+
var useMaterialRunboxApi = function useMaterialRunboxApi(props) {
|
|
13
|
+
var _return = React.useRef({});
|
|
14
|
+
//
|
|
15
|
+
//
|
|
16
|
+
//
|
|
17
|
+
var createMaterialRunboxApi = function createMaterialRunboxApi() {
|
|
18
|
+
return Object.freeze({
|
|
19
|
+
runbox: new openapiClientMaterialRunbox.RunboxApi(props.eliceMaterialRunboxApiConfiguration),
|
|
20
|
+
runtime: new openapiClientMaterialRunbox.RuntimeApi(props.eliceMaterialRunboxApiConfiguration),
|
|
21
|
+
runtimeTemplate: new openapiClientMaterialRunbox.RuntimeTemplateApi(props.eliceMaterialRunboxApiConfiguration)
|
|
22
|
+
});
|
|
23
|
+
};
|
|
24
|
+
//
|
|
25
|
+
//
|
|
26
|
+
//
|
|
27
|
+
var _useState = React.useState(createMaterialRunboxApi),
|
|
28
|
+
_useState2 = _rollupPluginBabelHelpers.slicedToArray(_useState, 2),
|
|
29
|
+
materialRunboxApi = _useState2[0],
|
|
30
|
+
setMaterialRunboxApi = _useState2[1];
|
|
31
|
+
//
|
|
32
|
+
//
|
|
33
|
+
//
|
|
34
|
+
React.useEffect(function () {
|
|
35
|
+
return setMaterialRunboxApi(createMaterialRunboxApi);
|
|
36
|
+
},
|
|
37
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
38
|
+
[props.eliceMaterialRunboxApiConfiguration]);
|
|
39
|
+
//
|
|
40
|
+
//
|
|
41
|
+
//
|
|
42
|
+
_return.current.materialRunboxApi = materialRunboxApi;
|
|
43
|
+
return _return.current;
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
exports.useMaterialRunboxApi = useMaterialRunboxApi;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { RuntimeProps } from '../runtime/Runtime';
|
|
2
|
+
declare type UseRunboxControlProps = Pick<RuntimeProps, 'runbox' | 'courseId' | 'refetch'>;
|
|
3
|
+
interface UseRunboxControlReturn {
|
|
4
|
+
start: (force?: boolean) => Promise<void>;
|
|
5
|
+
stop: () => Promise<void>;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Hook for runbox control and status.
|
|
9
|
+
*/
|
|
10
|
+
export declare const useRunboxControl: (props: UseRunboxControlProps) => UseRunboxControlReturn;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var _rollupPluginBabelHelpers = require('../../../_virtual/_rollupPluginBabelHelpers.js');
|
|
6
|
+
var React = require('react');
|
|
7
|
+
var reactIntl = require('react-intl');
|
|
8
|
+
var runboxClient = require('@elice/runbox-client');
|
|
9
|
+
var notistack = require('notistack');
|
|
10
|
+
var context = require('../context.js');
|
|
11
|
+
|
|
12
|
+
//
|
|
13
|
+
//
|
|
14
|
+
//
|
|
15
|
+
/**
|
|
16
|
+
* Hook for runbox control and status.
|
|
17
|
+
*/
|
|
18
|
+
var useRunboxControl = function useRunboxControl(props) {
|
|
19
|
+
var _return = React.useRef({});
|
|
20
|
+
var intl = reactIntl.useIntl();
|
|
21
|
+
var _useSnackbar = notistack.useSnackbar(),
|
|
22
|
+
enqueueSnackbar = _useSnackbar.enqueueSnackbar;
|
|
23
|
+
var _useContext = React.useContext(context.MaterialRunboxContext),
|
|
24
|
+
materialRunboxApi = _useContext.materialRunboxApi;
|
|
25
|
+
var _useEliceRunboxRunnin = runboxClient.useEliceRunboxRunning(),
|
|
26
|
+
runboxStart = _useEliceRunboxRunnin.start,
|
|
27
|
+
runboxStop = _useEliceRunboxRunnin.stop;
|
|
28
|
+
/**
|
|
29
|
+
* Start project.
|
|
30
|
+
*/
|
|
31
|
+
var start = React.useCallback( /*#__PURE__*/_rollupPluginBabelHelpers.asyncToGenerator( /*#__PURE__*/_rollupPluginBabelHelpers.regeneratorRuntime().mark(function _callee() {
|
|
32
|
+
var force,
|
|
33
|
+
_args = arguments;
|
|
34
|
+
return _rollupPluginBabelHelpers.regeneratorRuntime().wrap(function _callee$(_context) {
|
|
35
|
+
while (1) switch (_context.prev = _context.next) {
|
|
36
|
+
case 0:
|
|
37
|
+
force = _args.length > 0 && _args[0] !== undefined ? _args[0] : false;
|
|
38
|
+
return _context.abrupt("return", runboxStart(function (signal) {
|
|
39
|
+
return materialRunboxApi.runbox.runboxRunboxIdStartPost({
|
|
40
|
+
runboxId: props.runbox.id,
|
|
41
|
+
eliceCourseId: props.courseId
|
|
42
|
+
}, {
|
|
43
|
+
signal: signal
|
|
44
|
+
});
|
|
45
|
+
}, force).then(function () {
|
|
46
|
+
return void props.refetch();
|
|
47
|
+
}).catch(function (err) {
|
|
48
|
+
if (err.name !== 'AbortError') {
|
|
49
|
+
enqueueSnackbar(intl.formatMessage({
|
|
50
|
+
id: 'material.runbox.runtime.message.startError'
|
|
51
|
+
}), {
|
|
52
|
+
variant: 'error'
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
}));
|
|
56
|
+
case 2:
|
|
57
|
+
case "end":
|
|
58
|
+
return _context.stop();
|
|
59
|
+
}
|
|
60
|
+
}, _callee);
|
|
61
|
+
})),
|
|
62
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
63
|
+
[props.runbox.id, props.courseId, runboxStart]);
|
|
64
|
+
/**
|
|
65
|
+
* Stop project.
|
|
66
|
+
*/
|
|
67
|
+
var stop = React.useCallback( /*#__PURE__*/_rollupPluginBabelHelpers.asyncToGenerator( /*#__PURE__*/_rollupPluginBabelHelpers.regeneratorRuntime().mark(function _callee2() {
|
|
68
|
+
return _rollupPluginBabelHelpers.regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
69
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
70
|
+
case 0:
|
|
71
|
+
return _context2.abrupt("return", runboxStop(function (signal) {
|
|
72
|
+
return materialRunboxApi.runbox.runboxRunboxIdStopPost({
|
|
73
|
+
runboxId: props.runbox.id,
|
|
74
|
+
eliceCourseId: props.courseId
|
|
75
|
+
}, {
|
|
76
|
+
signal: signal
|
|
77
|
+
});
|
|
78
|
+
}).then(function () {
|
|
79
|
+
//
|
|
80
|
+
}).catch(function (err) {
|
|
81
|
+
if (err.name !== 'AbortError') ;
|
|
82
|
+
}));
|
|
83
|
+
case 1:
|
|
84
|
+
case "end":
|
|
85
|
+
return _context2.stop();
|
|
86
|
+
}
|
|
87
|
+
}, _callee2);
|
|
88
|
+
})),
|
|
89
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
90
|
+
[props.runbox.id, props.courseId, runboxStop]);
|
|
91
|
+
//
|
|
92
|
+
//
|
|
93
|
+
//
|
|
94
|
+
_return.current.start = start;
|
|
95
|
+
_return.current.stop = stop;
|
|
96
|
+
return _return.current;
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
exports.useRunboxControl = useRunboxControl;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { RunboxGetAndListResponse, RuntimeGetAndListResponse, RuntimeTemplateGetAndListResponse } from '@elice/openapi-client-material-runbox';
|
|
3
|
+
import type { QueryObserverResult } from '@tanstack/react-query';
|
|
4
|
+
export interface RuntimeProps {
|
|
5
|
+
/** */
|
|
6
|
+
runbox: RunboxGetAndListResponse;
|
|
7
|
+
/** */
|
|
8
|
+
runtime: RuntimeGetAndListResponse | null;
|
|
9
|
+
/** */
|
|
10
|
+
runtimeTemplate: RuntimeTemplateGetAndListResponse;
|
|
11
|
+
/** */
|
|
12
|
+
courseId: number;
|
|
13
|
+
/** */
|
|
14
|
+
refetch: () => Promise<QueryObserverResult<[
|
|
15
|
+
RunboxGetAndListResponse,
|
|
16
|
+
RuntimeGetAndListResponse,
|
|
17
|
+
RuntimeTemplateGetAndListResponse
|
|
18
|
+
], unknown>>;
|
|
19
|
+
}
|
|
20
|
+
declare const Runtime: React.FC<RuntimeProps>;
|
|
21
|
+
export default Runtime;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var React = require('react');
|
|
6
|
+
var runboxClient = require('@elice/runbox-client');
|
|
7
|
+
require('@elice/openapi-client-material-runbox');
|
|
8
|
+
var useRunboxControl = require('../hooks/useRunboxControl.js');
|
|
9
|
+
var RuntimeOverlayAssigned = require('./RuntimeOverlayAssigned.js');
|
|
10
|
+
var RuntimeOverlayQueued = require('./RuntimeOverlayQueued.js');
|
|
11
|
+
var RuntimeOverlayTerminated = require('./RuntimeOverlayTerminated.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
|
+
//
|
|
18
|
+
//
|
|
19
|
+
//
|
|
20
|
+
var Runtime = function Runtime(props) {
|
|
21
|
+
var _useRunboxControl = useRunboxControl.useRunboxControl(props),
|
|
22
|
+
startRuntime = _useRunboxControl.start;
|
|
23
|
+
//
|
|
24
|
+
//
|
|
25
|
+
//
|
|
26
|
+
React__default["default"].useEffect(function () {
|
|
27
|
+
if (!props.runbox.id) {
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
void startRuntime(
|
|
31
|
+
// check whether runtime is already assigned, or not.
|
|
32
|
+
// if runtime not assigned, should be restarted (ignore previous running state)
|
|
33
|
+
!props.runtime);
|
|
34
|
+
// NOTICE: do not stop runtime when unmounting,
|
|
35
|
+
// since it will automatically stopped by the server.
|
|
36
|
+
// return () => {
|
|
37
|
+
// if (props.runtimeTemplate.autoShutdown) {
|
|
38
|
+
// stopRuntime();
|
|
39
|
+
// }
|
|
40
|
+
// };
|
|
41
|
+
},
|
|
42
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
43
|
+
[props.runbox.id]);
|
|
44
|
+
//
|
|
45
|
+
//
|
|
46
|
+
//
|
|
47
|
+
return React__default["default"].createElement(runboxClient.EliceRunboxView, {
|
|
48
|
+
OverlayAssigned: RuntimeOverlayAssigned["default"],
|
|
49
|
+
OverlayQueued: RuntimeOverlayQueued["default"],
|
|
50
|
+
OverlayTerminated: function OverlayTerminated(props) {
|
|
51
|
+
return React__default["default"].createElement(RuntimeOverlayTerminated["default"], Object.assign({}, props, {
|
|
52
|
+
startRuntime: startRuntime
|
|
53
|
+
}));
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
exports["default"] = Runtime;
|
|
@@ -0,0 +1,48 @@
|
|
|
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 material = require('@mui/material');
|
|
8
|
+
var queue = require('../../../assets/queue.gif.js');
|
|
9
|
+
|
|
10
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
11
|
+
|
|
12
|
+
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
13
|
+
|
|
14
|
+
//
|
|
15
|
+
//
|
|
16
|
+
//
|
|
17
|
+
var RuntimeOverlayAssigned = function RuntimeOverlayAssigned() {
|
|
18
|
+
return React__default["default"].createElement(material.Stack, {
|
|
19
|
+
gap: "1.5rem",
|
|
20
|
+
sx: {
|
|
21
|
+
display: 'flex',
|
|
22
|
+
justifyContent: 'center',
|
|
23
|
+
alignItems: 'center',
|
|
24
|
+
width: '100%',
|
|
25
|
+
height: '100%'
|
|
26
|
+
}
|
|
27
|
+
}, React__default["default"].createElement(material.Box, {
|
|
28
|
+
component: "img",
|
|
29
|
+
src: queue["default"],
|
|
30
|
+
alt: "queue",
|
|
31
|
+
sx: {
|
|
32
|
+
width: '100%',
|
|
33
|
+
height: 'auto',
|
|
34
|
+
maxWidth: '13.375rem'
|
|
35
|
+
}
|
|
36
|
+
}), React__default["default"].createElement(material.Typography, {
|
|
37
|
+
variant: "subtitle2",
|
|
38
|
+
color: "text:secondary",
|
|
39
|
+
sx: {
|
|
40
|
+
whiteSpace: 'pre-wrap',
|
|
41
|
+
textAlign: 'center'
|
|
42
|
+
}
|
|
43
|
+
}, React__default["default"].createElement(reactIntl.FormattedMessage, {
|
|
44
|
+
id: "material.runbox.runtime.overlay.assigned.description"
|
|
45
|
+
})));
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
exports["default"] = RuntimeOverlayAssigned;
|
|
@@ -0,0 +1,63 @@
|
|
|
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 iconsMaterial = require('@mui/icons-material');
|
|
8
|
+
var material = require('@mui/material');
|
|
9
|
+
var context = require('../context.js');
|
|
10
|
+
var queue = require('../../../assets/queue.gif.js');
|
|
11
|
+
|
|
12
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
13
|
+
|
|
14
|
+
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
15
|
+
|
|
16
|
+
//
|
|
17
|
+
//
|
|
18
|
+
//
|
|
19
|
+
var RuntimeOverlayQueued = function RuntimeOverlayQueued(_ref) {
|
|
20
|
+
var numWaiters = _ref.numWaiters;
|
|
21
|
+
var _React$useContext = React__default["default"].useContext(context.MaterialRunboxContext),
|
|
22
|
+
showMessenger = _React$useContext.showMessenger;
|
|
23
|
+
//
|
|
24
|
+
//
|
|
25
|
+
//
|
|
26
|
+
return React__default["default"].createElement(material.Stack, {
|
|
27
|
+
gap: "1.5rem",
|
|
28
|
+
sx: {
|
|
29
|
+
display: 'flex',
|
|
30
|
+
justifyContent: 'center',
|
|
31
|
+
alignItems: 'center',
|
|
32
|
+
width: '100%',
|
|
33
|
+
height: '100%'
|
|
34
|
+
}
|
|
35
|
+
}, React__default["default"].createElement(material.Box, {
|
|
36
|
+
component: "img",
|
|
37
|
+
src: queue["default"],
|
|
38
|
+
alt: "queue",
|
|
39
|
+
sx: {
|
|
40
|
+
width: '100%',
|
|
41
|
+
height: 'auto',
|
|
42
|
+
maxWidth: '13.375rem'
|
|
43
|
+
}
|
|
44
|
+
}), React__default["default"].createElement(material.Typography, {
|
|
45
|
+
variant: "subtitle2",
|
|
46
|
+
color: "text:secondary"
|
|
47
|
+
}, numWaiters > 0 ? React__default["default"].createElement(reactIntl.FormattedMessage, {
|
|
48
|
+
id: "material.runbox.runtime.overlay.queued.description",
|
|
49
|
+
values: {
|
|
50
|
+
waiters: numWaiters
|
|
51
|
+
}
|
|
52
|
+
}) : React__default["default"].createElement(reactIntl.FormattedMessage, {
|
|
53
|
+
id: "material.runbox.runtime.overlay.queued.description_zero"
|
|
54
|
+
})), React__default["default"].createElement(material.Button, {
|
|
55
|
+
variant: "outlined",
|
|
56
|
+
startIcon: React__default["default"].createElement(iconsMaterial.QuestionAnswer, null),
|
|
57
|
+
onClick: showMessenger
|
|
58
|
+
}, React__default["default"].createElement(reactIntl.FormattedMessage, {
|
|
59
|
+
id: "common.support"
|
|
60
|
+
})));
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
exports["default"] = RuntimeOverlayQueued;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { EliceRunboxViewerOverlayTerminatedComponentProps as TerminatedComponentProps } from '@elice/runbox-client';
|
|
3
|
+
interface RuntimeOverlayTerminatedProps extends TerminatedComponentProps {
|
|
4
|
+
startRuntime: () => Promise<void>;
|
|
5
|
+
}
|
|
6
|
+
declare const RuntimeOverlayTerminated: React.FC<RuntimeOverlayTerminatedProps>;
|
|
7
|
+
export default RuntimeOverlayTerminated;
|