@elice/material-runbox 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/assets/queue.gif.js +1 -1
- package/cjs/assets/runbox_logo.png.js +1 -1
- package/cjs/assets/terminated.png.js +1 -1
- package/cjs/components/material-runbox/MaterialRunbox.js +17 -19
- package/cjs/components/material-runbox/MaterialRunboxBody.js +15 -12
- package/cjs/components/material-runbox/MaterialRunboxContent.js +94 -101
- package/cjs/components/material-runbox/MaterialRunboxFooter.js +17 -22
- package/cjs/components/material-runbox/MaterialRunboxHeader.d.ts +3 -0
- package/cjs/components/material-runbox/MaterialRunboxHeader.js +77 -81
- package/cjs/components/material-runbox/actions/MaterialRunboxActionAutoShutdown.js +26 -22
- package/cjs/components/material-runbox/actions/MaterialRunboxActionGrade.js +140 -180
- package/cjs/components/material-runbox/actions/MaterialRunboxActionMenu.d.ts +8 -0
- package/cjs/components/material-runbox/actions/MaterialRunboxActionMenu.js +65 -0
- package/cjs/components/material-runbox/actions/MaterialRunboxActionReset.d.ts +3 -1
- package/cjs/components/material-runbox/actions/MaterialRunboxActionReset.js +73 -110
- package/cjs/components/material-runbox/actions/MaterialRunboxActionRestart.d.ts +3 -1
- package/cjs/components/material-runbox/actions/MaterialRunboxActionRestart.js +54 -70
- package/cjs/components/material-runbox/actions/MaterialRunboxActionShare.d.ts +4 -1
- package/cjs/components/material-runbox/actions/MaterialRunboxActionShare.js +67 -41
- package/cjs/components/material-runbox/contexts/MaterialRunboxApiContext.js +16 -27
- package/cjs/components/material-runbox/contexts/MaterialRunboxCommandContext.js +38 -53
- package/cjs/components/material-runbox/contexts/MaterialRunboxContext.js +9 -11
- package/cjs/components/material-runbox/hooks/useRunboxControl.js +39 -65
- package/cjs/components/material-runbox/locales/en.json.js +2 -2
- package/cjs/components/material-runbox/locales/index.js +2 -4
- package/cjs/components/material-runbox/locales/ko.json.js +2 -2
- package/cjs/components/material-runbox/runtime/Runtime.js +18 -26
- package/cjs/components/material-runbox/runtime/RuntimeOverlayAssigned.js +10 -17
- package/cjs/components/material-runbox/runtime/RuntimeOverlayQueued.js +16 -18
- package/cjs/components/material-runbox/runtime/RuntimeOverlayTerminated.js +27 -33
- package/cjs/index.js +1 -3
- package/es/components/material-runbox/MaterialRunbox.js +11 -9
- package/es/components/material-runbox/MaterialRunboxBody.js +13 -5
- package/es/components/material-runbox/MaterialRunboxContent.js +80 -82
- package/es/components/material-runbox/MaterialRunboxFooter.js +11 -11
- package/es/components/material-runbox/MaterialRunboxHeader.d.ts +3 -0
- package/es/components/material-runbox/MaterialRunboxHeader.js +72 -71
- package/es/components/material-runbox/actions/MaterialRunboxActionAutoShutdown.js +22 -13
- package/es/components/material-runbox/actions/MaterialRunboxActionGrade.js +120 -155
- package/es/components/material-runbox/actions/MaterialRunboxActionMenu.d.ts +8 -0
- package/es/components/material-runbox/actions/MaterialRunboxActionMenu.js +61 -0
- package/es/components/material-runbox/actions/MaterialRunboxActionReset.d.ts +3 -1
- package/es/components/material-runbox/actions/MaterialRunboxActionReset.js +65 -98
- package/es/components/material-runbox/actions/MaterialRunboxActionRestart.d.ts +3 -1
- package/es/components/material-runbox/actions/MaterialRunboxActionRestart.js +47 -59
- package/es/components/material-runbox/actions/MaterialRunboxActionShare.d.ts +4 -1
- package/es/components/material-runbox/actions/MaterialRunboxActionShare.js +68 -38
- package/es/components/material-runbox/contexts/MaterialRunboxApiContext.js +13 -20
- package/es/components/material-runbox/contexts/MaterialRunboxCommandContext.js +35 -46
- package/es/components/material-runbox/contexts/MaterialRunboxContext.js +6 -4
- package/es/components/material-runbox/hooks/useRunboxControl.js +39 -63
- package/es/components/material-runbox/locales/en.json.js +1 -1
- package/es/components/material-runbox/locales/ko.json.js +1 -1
- package/es/components/material-runbox/runtime/Runtime.js +14 -18
- package/es/components/material-runbox/runtime/RuntimeOverlayAssigned.js +3 -6
- package/es/components/material-runbox/runtime/RuntimeOverlayQueued.js +6 -4
- package/es/components/material-runbox/runtime/RuntimeOverlayTerminated.js +12 -14
- package/package.json +13 -9
- package/cjs/_virtual/_rollupPluginBabelHelpers.js +0 -399
- package/es/_virtual/_rollupPluginBabelHelpers.js +0 -387
|
@@ -2,40 +2,44 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var _styled = require('@emotion/styled/base');
|
|
6
6
|
var React = require('react');
|
|
7
7
|
var reactIntl = require('react-intl');
|
|
8
|
-
var styled = require('@emotion/styled');
|
|
9
8
|
var material = require('@mui/material');
|
|
10
9
|
var MaterialRunboxApiContext = require('../contexts/MaterialRunboxApiContext.js');
|
|
11
10
|
require('../contexts/MaterialRunboxCommandContext.js');
|
|
12
11
|
require('../contexts/MaterialRunboxContext.js');
|
|
13
12
|
|
|
14
|
-
function
|
|
15
|
-
|
|
16
|
-
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
17
|
-
var styled__default = /*#__PURE__*/_interopDefaultLegacy(styled);
|
|
18
|
-
|
|
19
|
-
var _templateObject;
|
|
13
|
+
function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
|
|
20
14
|
//
|
|
21
15
|
//
|
|
22
16
|
//
|
|
23
|
-
|
|
17
|
+
const StyledFormControlLabel = /*#__PURE__*/_styled(material.FormControlLabel, {
|
|
18
|
+
target: "e1ket70c0"
|
|
19
|
+
})("production" === "production" ? {
|
|
20
|
+
name: "1ep9nyp",
|
|
21
|
+
styles: "margin:0!important"
|
|
22
|
+
} : {
|
|
23
|
+
name: "1ep9nyp",
|
|
24
|
+
styles: "margin:0!important",
|
|
25
|
+
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
26
|
+
});
|
|
24
27
|
//
|
|
25
28
|
//
|
|
26
29
|
//
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
const MaterialRunboxActionAutoShutdown = ({
|
|
31
|
+
runtime,
|
|
32
|
+
runtimeTemplate,
|
|
33
|
+
courseId,
|
|
34
|
+
refetch
|
|
35
|
+
}) => {
|
|
32
36
|
var _a;
|
|
33
|
-
|
|
34
|
-
|
|
37
|
+
const intl = reactIntl.useIntl();
|
|
38
|
+
const materialRunboxApi = MaterialRunboxApiContext.useMaterialRunboxApiContext();
|
|
35
39
|
/**
|
|
36
40
|
*
|
|
37
41
|
*/
|
|
38
|
-
|
|
42
|
+
const handleAction = (_, shutdown) => {
|
|
39
43
|
if (!runtime) {
|
|
40
44
|
return;
|
|
41
45
|
}
|
|
@@ -45,14 +49,14 @@ var MaterialRunboxActionAutoShutdown = function MaterialRunboxActionAutoShutdown
|
|
|
45
49
|
autoShutdown: !shutdown
|
|
46
50
|
},
|
|
47
51
|
eliceCourseId: courseId
|
|
48
|
-
}).then(refetch).catch(
|
|
52
|
+
}).then(refetch).catch(() => {
|
|
49
53
|
//
|
|
50
54
|
});
|
|
51
55
|
};
|
|
52
56
|
//
|
|
53
57
|
//
|
|
54
58
|
//
|
|
55
|
-
return
|
|
59
|
+
return React.createElement(material.Tooltip, {
|
|
56
60
|
title: intl.formatMessage({
|
|
57
61
|
id: runtimeTemplate.autoShutdown ? 'runbox.action.autoShutdown.tooltip.disabled' : 'runbox.action.autoShutdown.tooltip.enabled'
|
|
58
62
|
}, {
|
|
@@ -62,8 +66,8 @@ var MaterialRunboxActionAutoShutdown = function MaterialRunboxActionAutoShutdown
|
|
|
62
66
|
unitDisplay: 'short'
|
|
63
67
|
})
|
|
64
68
|
})
|
|
65
|
-
},
|
|
66
|
-
control:
|
|
69
|
+
}, React.createElement(StyledFormControlLabel, {
|
|
70
|
+
control: React.createElement(material.Switch, {
|
|
67
71
|
checked: !(runtime === null || runtime === void 0 ? void 0 : runtime.autoShutdown),
|
|
68
72
|
disabled: !runtime || runtimeTemplate.autoShutdown,
|
|
69
73
|
onChange: handleAction
|
|
@@ -79,4 +83,4 @@ var MaterialRunboxActionAutoShutdown = function MaterialRunboxActionAutoShutdown
|
|
|
79
83
|
}));
|
|
80
84
|
};
|
|
81
85
|
|
|
82
|
-
exports
|
|
86
|
+
exports.default = MaterialRunboxActionAutoShutdown;
|
|
@@ -2,33 +2,27 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var _styled = require('@emotion/styled/base');
|
|
6
6
|
var React = require('react');
|
|
7
7
|
var reactIntl = require('react-intl');
|
|
8
8
|
var reactTransitionGroup = require('react-transition-group');
|
|
9
|
+
var muiXSnackbar = require('@elice/mui-x-snackbar');
|
|
9
10
|
var openapiClientMaterialRunbox = require('@elice/openapi-client-material-runbox');
|
|
10
11
|
var runboxClient = require('@elice/runbox-client');
|
|
11
|
-
var styled = require('@emotion/styled');
|
|
12
12
|
var iconsMaterial = require('@mui/icons-material');
|
|
13
13
|
var lab = require('@mui/lab');
|
|
14
14
|
var material = require('@mui/material');
|
|
15
15
|
var reactQuery = require('@tanstack/react-query');
|
|
16
|
-
var notistack = require('notistack');
|
|
17
16
|
var MaterialRunboxApiContext = require('../contexts/MaterialRunboxApiContext.js');
|
|
18
17
|
var MaterialRunboxCommandContext = require('../contexts/MaterialRunboxCommandContext.js');
|
|
19
18
|
require('../contexts/MaterialRunboxContext.js');
|
|
20
19
|
|
|
21
|
-
function
|
|
22
|
-
|
|
23
|
-
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
24
|
-
var styled__default = /*#__PURE__*/_interopDefaultLegacy(styled);
|
|
25
|
-
|
|
26
|
-
var _templateObject, _templateObject2, _templateObject3;
|
|
20
|
+
function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
|
|
27
21
|
//
|
|
28
22
|
//
|
|
29
23
|
//
|
|
30
|
-
|
|
31
|
-
|
|
24
|
+
const TRANSITION_DURATION = 300;
|
|
25
|
+
const TRANSITION_STYLE_MAP = {
|
|
32
26
|
entering: {
|
|
33
27
|
maxWidth: 0
|
|
34
28
|
},
|
|
@@ -48,181 +42,149 @@ var TRANSITION_STYLE_MAP = {
|
|
|
48
42
|
//
|
|
49
43
|
//
|
|
50
44
|
//
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
var theme = _ref3.theme;
|
|
61
|
-
return theme.typography.body2.fontSize;
|
|
62
|
-
}, function (_ref4) {
|
|
63
|
-
var theme = _ref4.theme;
|
|
64
|
-
return theme.typography.body2.lineHeight;
|
|
45
|
+
const StyledMainActionButton = /*#__PURE__*/_styled(lab.LoadingButton, {
|
|
46
|
+
target: "eae460y2"
|
|
47
|
+
})("production" === "production" ? {
|
|
48
|
+
name: "tssn5p",
|
|
49
|
+
styles: "min-width:4rem!important"
|
|
50
|
+
} : {
|
|
51
|
+
name: "tssn5p",
|
|
52
|
+
styles: "min-width:4rem!important",
|
|
53
|
+
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
65
54
|
});
|
|
55
|
+
const StyledSubActionButton = /*#__PURE__*/_styled(material.Button, {
|
|
56
|
+
target: "eae460y1"
|
|
57
|
+
})("transition:max-width ", TRANSITION_DURATION, "ms cubic-bezier(0.25, 0.46, 0.45, 1);");
|
|
58
|
+
const StyledTerminal = /*#__PURE__*/_styled("textarea", {
|
|
59
|
+
target: "eae460y0"
|
|
60
|
+
})("padding:1rem;width:100%;color:", ({
|
|
61
|
+
theme
|
|
62
|
+
}) => theme.palette.common.white, ";background-color:", ({
|
|
63
|
+
theme
|
|
64
|
+
}) => theme.palette.common.black, ";border:none;border-radius:0.5rem;font-family:'Elice Digital Coding',monospace;font-size:", ({
|
|
65
|
+
theme
|
|
66
|
+
}) => theme.typography.body2.fontSize, ";line-height:", ({
|
|
67
|
+
theme
|
|
68
|
+
}) => theme.typography.body2.lineHeight, ";outline:none;resize:none;");
|
|
66
69
|
//
|
|
67
70
|
//
|
|
68
71
|
//
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
+
const MaterialRunboxActionGrade = ({
|
|
73
|
+
runtime,
|
|
74
|
+
courseId
|
|
75
|
+
}) => {
|
|
72
76
|
var _a;
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
77
|
+
const intl = reactIntl.useIntl();
|
|
78
|
+
const {
|
|
79
|
+
enqueueSnackbar
|
|
80
|
+
} = muiXSnackbar.useSnackbar();
|
|
81
|
+
const materialRunboxApi = MaterialRunboxApiContext.useMaterialRunboxApiContext();
|
|
82
|
+
const {
|
|
83
|
+
isLastCommandRunning,
|
|
84
|
+
lastCommand,
|
|
85
|
+
setCommandIdToPing
|
|
86
|
+
} = MaterialRunboxCommandContext.useMaterialRunboxCommandContext();
|
|
87
|
+
const {
|
|
88
|
+
status
|
|
89
|
+
} = runboxClient.useEliceRunboxRunning();
|
|
90
|
+
const leaderboardSubmitInfoQuery = reactQuery.useQuery({
|
|
84
91
|
queryKey: ['eliceMaterialRunboxRunboxApi.runboxRunboxIdSubmitInfoGet', {
|
|
85
|
-
courseId
|
|
86
|
-
runtime
|
|
92
|
+
courseId,
|
|
93
|
+
runtime
|
|
87
94
|
}],
|
|
88
|
-
queryFn:
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
},
|
|
95
|
+
queryFn: ({
|
|
96
|
+
signal
|
|
97
|
+
}) => materialRunboxApi.runbox.runboxRunboxIdSubmitInfoGet({
|
|
98
|
+
eliceCourseId: courseId,
|
|
99
|
+
runboxId: runtime === null || runtime === void 0 ? void 0 : runtime.runboxId
|
|
100
|
+
}, {
|
|
101
|
+
signal
|
|
102
|
+
}),
|
|
97
103
|
enabled: Boolean(runtime === null || runtime === void 0 ? void 0 : runtime.runboxId),
|
|
98
104
|
retry: false
|
|
99
105
|
});
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
isGradeResultDialogOpen = _React$useState4[0],
|
|
108
|
-
setGradeResultDialogOpen = _React$useState4[1];
|
|
109
|
-
var _React$useState5 = React__default["default"].useState(false),
|
|
110
|
-
_React$useState6 = _rollupPluginBabelHelpers.slicedToArray(_React$useState5, 2),
|
|
111
|
-
isSubmitCountInfoDialogOpen = _React$useState6[0],
|
|
112
|
-
setSubmitCountInfoDialogOpen = _React$useState6[1];
|
|
113
|
-
var _React$useState7 = React__default["default"].useState(false),
|
|
114
|
-
_React$useState8 = _rollupPluginBabelHelpers.slicedToArray(_React$useState7, 2),
|
|
115
|
-
hasUnreadResult = _React$useState8[0],
|
|
116
|
-
setHasUnreadResult = _React$useState8[1];
|
|
117
|
-
var isRunboxRunning = status === 'running';
|
|
118
|
-
var isGradeDoneWithOutput = !isLastCommandRunning && (lastCommand === null || lastCommand === void 0 ? void 0 : lastCommand.commandType) === openapiClientMaterialRunbox.CommandType.Grade && Boolean(lastCommand === null || lastCommand === void 0 ? void 0 : lastCommand.output);
|
|
106
|
+
const isSubmitCountRemained = ((_a = leaderboardSubmitInfoQuery.data) === null || _a === void 0 ? void 0 : _a.remainSubmitCount) !== 0;
|
|
107
|
+
const [isActionLoading, setActionLoading] = React.useState(false);
|
|
108
|
+
const [isGradeResultDialogOpen, setGradeResultDialogOpen] = React.useState(false);
|
|
109
|
+
const [isSubmitCountInfoDialogOpen, setSubmitCountInfoDialogOpen] = React.useState(false);
|
|
110
|
+
const [hasUnreadResult, setHasUnreadResult] = React.useState(false);
|
|
111
|
+
const isRunboxRunning = status === 'running';
|
|
112
|
+
const isGradeDoneWithOutput = !isLastCommandRunning && (lastCommand === null || lastCommand === void 0 ? void 0 : lastCommand.commandType) === openapiClientMaterialRunbox.CommandType.Grade && Boolean(lastCommand === null || lastCommand === void 0 ? void 0 : lastCommand.output);
|
|
119
113
|
/**
|
|
120
114
|
*
|
|
121
115
|
*/
|
|
122
|
-
|
|
116
|
+
const handleGradeResultDialogOpen = () => {
|
|
123
117
|
setGradeResultDialogOpen(true);
|
|
124
118
|
};
|
|
125
119
|
/**
|
|
126
120
|
*
|
|
127
121
|
*/
|
|
128
|
-
|
|
122
|
+
const handleGradeResultDialogClose = () => {
|
|
129
123
|
setGradeResultDialogOpen(false);
|
|
130
124
|
};
|
|
131
125
|
/**
|
|
132
126
|
*
|
|
133
127
|
*/
|
|
134
|
-
|
|
128
|
+
const handleSubmitCountInfoDialogClose = () => {
|
|
135
129
|
setSubmitCountInfoDialogOpen(false);
|
|
136
130
|
};
|
|
137
131
|
/**
|
|
138
132
|
*
|
|
139
133
|
*/
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
return _context.abrupt("return");
|
|
160
|
-
case 10:
|
|
161
|
-
runtimeId = runtime === null || runtime === void 0 ? void 0 : runtime.id;
|
|
162
|
-
_context.next = 13;
|
|
163
|
-
return materialRunboxApi.runtime.runtimeRuntimeIdCommandPost({
|
|
164
|
-
runtimeId: runtimeId,
|
|
165
|
-
eliceCourseId: courseId,
|
|
166
|
-
runboxCommandPostRequest: {
|
|
167
|
-
commandType: openapiClientMaterialRunbox.CommandType.Grade
|
|
168
|
-
}
|
|
169
|
-
});
|
|
170
|
-
case 13:
|
|
171
|
-
_yield$materialRunbox = _context.sent;
|
|
172
|
-
commandId = _yield$materialRunbox.id;
|
|
173
|
-
setCommandIdToPing(commandId);
|
|
174
|
-
_context.next = 21;
|
|
175
|
-
break;
|
|
176
|
-
case 18:
|
|
177
|
-
_context.prev = 18;
|
|
178
|
-
_context.t0 = _context["catch"](1);
|
|
179
|
-
enqueueSnackbar(intl.formatMessage({
|
|
180
|
-
id: 'runbox.action.grade.noti.error'
|
|
181
|
-
}), {
|
|
182
|
-
variant: 'error'
|
|
183
|
-
});
|
|
184
|
-
case 21:
|
|
185
|
-
_context.prev = 21;
|
|
186
|
-
setActionLoading(false);
|
|
187
|
-
return _context.finish(21);
|
|
188
|
-
case 24:
|
|
189
|
-
case "end":
|
|
190
|
-
return _context.stop();
|
|
134
|
+
const handleAction = async () => {
|
|
135
|
+
setActionLoading(true);
|
|
136
|
+
try {
|
|
137
|
+
const {
|
|
138
|
+
data: currentLeaderboardSubmitInfo
|
|
139
|
+
} = await leaderboardSubmitInfoQuery.refetch();
|
|
140
|
+
const isCurrentSubmitCountEmpty = (currentLeaderboardSubmitInfo === null || currentLeaderboardSubmitInfo === void 0 ? void 0 : currentLeaderboardSubmitInfo.remainSubmitCount) === 0;
|
|
141
|
+
if (isCurrentSubmitCountEmpty) {
|
|
142
|
+
setSubmitCountInfoDialogOpen(true);
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
const runtimeId = runtime === null || runtime === void 0 ? void 0 : runtime.id;
|
|
146
|
+
const {
|
|
147
|
+
id: commandId
|
|
148
|
+
} = await materialRunboxApi.runtime.runtimeRuntimeIdCommandPost({
|
|
149
|
+
runtimeId,
|
|
150
|
+
eliceCourseId: courseId,
|
|
151
|
+
runboxCommandPostRequest: {
|
|
152
|
+
commandType: openapiClientMaterialRunbox.CommandType.Grade
|
|
191
153
|
}
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
154
|
+
});
|
|
155
|
+
setCommandIdToPing(commandId);
|
|
156
|
+
} catch (err) {
|
|
157
|
+
enqueueSnackbar(intl.formatMessage({
|
|
158
|
+
id: 'runbox.action.grade.noti.error'
|
|
159
|
+
}), {
|
|
160
|
+
variant: 'error'
|
|
161
|
+
});
|
|
162
|
+
} finally {
|
|
163
|
+
setActionLoading(false);
|
|
164
|
+
}
|
|
165
|
+
};
|
|
198
166
|
//
|
|
199
167
|
// set `hasUnreadResult` when last command output exists
|
|
200
168
|
//
|
|
201
|
-
|
|
202
|
-
return setHasUnreadResult(isGradeDoneWithOutput);
|
|
203
|
-
}, [isGradeDoneWithOutput]);
|
|
169
|
+
React.useEffect(() => setHasUnreadResult(isGradeDoneWithOutput), [isGradeDoneWithOutput]);
|
|
204
170
|
//
|
|
205
171
|
// reset `hasUnreadResult` when dialog state toggled
|
|
206
172
|
//
|
|
207
|
-
|
|
208
|
-
return setHasUnreadResult(false);
|
|
209
|
-
}, [isGradeResultDialogOpen]);
|
|
173
|
+
React.useEffect(() => setHasUnreadResult(false), [isGradeResultDialogOpen]);
|
|
210
174
|
//
|
|
211
175
|
// toggle dialog state when last command output exists
|
|
212
176
|
//
|
|
213
|
-
|
|
214
|
-
return setGradeResultDialogOpen(isGradeDoneWithOutput);
|
|
215
|
-
}, [isGradeDoneWithOutput]);
|
|
177
|
+
React.useEffect(() => setGradeResultDialogOpen(isGradeDoneWithOutput), [isGradeDoneWithOutput]);
|
|
216
178
|
/**
|
|
217
179
|
*
|
|
218
180
|
*/
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
181
|
+
const renderActionButton = () => {
|
|
182
|
+
const isGradeType = (lastCommand === null || lastCommand === void 0 ? void 0 : lastCommand.commandType) === openapiClientMaterialRunbox.CommandType.Grade;
|
|
183
|
+
const isGrading = isActionLoading || isLastCommandRunning && isGradeType;
|
|
222
184
|
/**
|
|
223
185
|
*
|
|
224
186
|
*/
|
|
225
|
-
|
|
187
|
+
const getActionTooltipMessage = () => {
|
|
226
188
|
if (!isSubmitCountRemained) {
|
|
227
189
|
return intl.formatMessage({
|
|
228
190
|
id: 'runbox.action.submitCountInfo.tooltip.disabled'
|
|
@@ -235,99 +197,97 @@ var MaterialRunboxActionGrade = function MaterialRunboxActionGrade(_ref5) {
|
|
|
235
197
|
}
|
|
236
198
|
return '';
|
|
237
199
|
};
|
|
238
|
-
return
|
|
200
|
+
return React.createElement(material.Tooltip, {
|
|
239
201
|
title: getActionTooltipMessage(),
|
|
240
202
|
placement: "bottom-end"
|
|
241
|
-
},
|
|
203
|
+
}, React.createElement(material.ButtonGroup, {
|
|
242
204
|
variant: "contained"
|
|
243
|
-
},
|
|
205
|
+
}, React.createElement(StyledMainActionButton, {
|
|
244
206
|
variant: "contained",
|
|
245
207
|
loading: isGrading,
|
|
246
208
|
disabled: !isRunboxRunning || isLastCommandRunning || !isSubmitCountRemained,
|
|
247
209
|
size: "small",
|
|
248
210
|
onClick: handleAction
|
|
249
|
-
},
|
|
211
|
+
}, React.createElement(reactIntl.FormattedMessage, {
|
|
250
212
|
id: "runbox.action.grade.title"
|
|
251
|
-
})),
|
|
213
|
+
})), isGradeDoneWithOutput ? React.createElement(reactTransitionGroup.Transition, {
|
|
252
214
|
in: isGradeDoneWithOutput,
|
|
253
215
|
timeout: 0,
|
|
254
216
|
mountOnEnter: true,
|
|
255
217
|
unmountOnExit: true
|
|
256
|
-
},
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
})));
|
|
269
|
-
})));
|
|
218
|
+
}, state => React.createElement(StyledSubActionButton, {
|
|
219
|
+
size: "small",
|
|
220
|
+
disabled: isLastCommandRunning,
|
|
221
|
+
onClick: handleGradeResultDialogOpen,
|
|
222
|
+
style: TRANSITION_STYLE_MAP[state]
|
|
223
|
+
}, React.createElement(material.Badge, {
|
|
224
|
+
color: "error",
|
|
225
|
+
variant: "dot",
|
|
226
|
+
invisible: !hasUnreadResult
|
|
227
|
+
}, React.createElement(iconsMaterial.Terminal, {
|
|
228
|
+
fontSize: "small"
|
|
229
|
+
})))) : null));
|
|
270
230
|
};
|
|
271
231
|
/**
|
|
272
232
|
*
|
|
273
233
|
*/
|
|
274
|
-
|
|
234
|
+
const renderActionGradeResultDialog = () => {
|
|
275
235
|
if ((lastCommand === null || lastCommand === void 0 ? void 0 : lastCommand.commandType) !== openapiClientMaterialRunbox.CommandType.Grade) {
|
|
276
236
|
return null;
|
|
277
237
|
}
|
|
278
|
-
return
|
|
238
|
+
return React.createElement(material.Dialog, {
|
|
279
239
|
open: isGradeResultDialogOpen,
|
|
280
240
|
maxWidth: "md",
|
|
281
241
|
fullWidth: true,
|
|
282
242
|
onClose: handleGradeResultDialogClose
|
|
283
|
-
},
|
|
243
|
+
}, React.createElement(material.DialogTitle, null, React.createElement(reactIntl.FormattedMessage, {
|
|
284
244
|
id: "runbox.action.grade.dialog.title"
|
|
285
|
-
})),
|
|
245
|
+
})), React.createElement(material.DialogContent, null, React.createElement(material.Stack, {
|
|
286
246
|
gap: "0.75rem"
|
|
287
|
-
}, lastCommand.terminatedReason === 'done' ?
|
|
247
|
+
}, lastCommand.terminatedReason === 'done' ? React.createElement(material.Alert, {
|
|
288
248
|
severity: "success"
|
|
289
|
-
},
|
|
249
|
+
}, React.createElement(reactIntl.FormattedMessage, {
|
|
290
250
|
id: "runbox.action.grade.dialog.description.success"
|
|
291
|
-
})) :
|
|
251
|
+
})) : React.createElement(material.Alert, {
|
|
292
252
|
severity: "error"
|
|
293
|
-
},
|
|
253
|
+
}, React.createElement(reactIntl.FormattedMessage, {
|
|
294
254
|
id: "runbox.action.grade.dialog.description.error"
|
|
295
|
-
})),
|
|
255
|
+
})), React.createElement(StyledTerminal, {
|
|
296
256
|
value: lastCommand.output,
|
|
297
257
|
readOnly: true,
|
|
298
258
|
rows: 20
|
|
299
|
-
}))),
|
|
259
|
+
}))), React.createElement(material.DialogActions, null, React.createElement(material.Button, {
|
|
300
260
|
color: "inherit",
|
|
301
261
|
disabled: isActionLoading,
|
|
302
262
|
onClick: handleGradeResultDialogClose
|
|
303
|
-
},
|
|
263
|
+
}, React.createElement(reactIntl.FormattedMessage, {
|
|
304
264
|
id: "runbox.common.close"
|
|
305
265
|
}))));
|
|
306
266
|
};
|
|
307
267
|
/**
|
|
308
268
|
*
|
|
309
269
|
*/
|
|
310
|
-
|
|
311
|
-
return
|
|
270
|
+
const renderActionSubmitCountInfoDialog = () => {
|
|
271
|
+
return React.createElement(material.Dialog, {
|
|
312
272
|
fullWidth: true,
|
|
313
273
|
maxWidth: "xs",
|
|
314
274
|
open: isSubmitCountInfoDialogOpen,
|
|
315
275
|
onClick: handleSubmitCountInfoDialogClose
|
|
316
|
-
},
|
|
276
|
+
}, React.createElement(material.DialogTitle, null, React.createElement(reactIntl.FormattedMessage, {
|
|
317
277
|
id: "runbtox.action.submitCountInfo.dialog.title"
|
|
318
|
-
})),
|
|
278
|
+
})), React.createElement(material.DialogContent, null, React.createElement(material.Typography, null, React.createElement(reactIntl.FormattedMessage, {
|
|
319
279
|
id: "runbox.action.submitCountInfo.dialog.description"
|
|
320
|
-
}))),
|
|
280
|
+
}))), React.createElement(material.DialogActions, null, React.createElement(material.Button, {
|
|
321
281
|
color: "inherit",
|
|
322
282
|
onClick: handleSubmitCountInfoDialogClose
|
|
323
|
-
},
|
|
283
|
+
}, React.createElement(reactIntl.FormattedMessage, {
|
|
324
284
|
id: "runbox.common.close"
|
|
325
285
|
}))));
|
|
326
286
|
};
|
|
327
287
|
//
|
|
328
288
|
//
|
|
329
289
|
//
|
|
330
|
-
return
|
|
290
|
+
return React.createElement(React.Fragment, null, renderActionButton(), renderActionGradeResultDialog(), renderActionSubmitCountInfoDialog());
|
|
331
291
|
};
|
|
332
292
|
|
|
333
|
-
exports
|
|
293
|
+
exports.default = MaterialRunboxActionGrade;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { RuntimeProps } from '../runtime/Runtime';
|
|
3
|
+
type MaterialRunboxActionMenuProps = Pick<RuntimeProps, 'runbox' | 'runtime' | 'courseId' | 'refetch'> & {
|
|
4
|
+
menuAnchorEl: null | HTMLButtonElement;
|
|
5
|
+
handleMenuClose: () => void;
|
|
6
|
+
};
|
|
7
|
+
declare const MaterialRunboxActionMenu: React.FC<MaterialRunboxActionMenuProps>;
|
|
8
|
+
export default MaterialRunboxActionMenu;
|
|
@@ -0,0 +1,65 @@
|
|
|
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
|
+
var material = require('@mui/material');
|
|
8
|
+
var MaterialRunboxActionReset = require('./MaterialRunboxActionReset.js');
|
|
9
|
+
var MaterialRunboxActionRestart = require('./MaterialRunboxActionRestart.js');
|
|
10
|
+
var MaterialRunboxActionShare = require('./MaterialRunboxActionShare.js');
|
|
11
|
+
|
|
12
|
+
//
|
|
13
|
+
//
|
|
14
|
+
//
|
|
15
|
+
const MaterialRunboxActionMenu = ({
|
|
16
|
+
runbox,
|
|
17
|
+
runtime,
|
|
18
|
+
courseId,
|
|
19
|
+
menuAnchorEl,
|
|
20
|
+
refetch,
|
|
21
|
+
handleMenuClose
|
|
22
|
+
}) => {
|
|
23
|
+
const {
|
|
24
|
+
status
|
|
25
|
+
} = runboxClient.useEliceRunboxRunning();
|
|
26
|
+
const isRunboxRunning = status === 'running';
|
|
27
|
+
//
|
|
28
|
+
//
|
|
29
|
+
//
|
|
30
|
+
React.useEffect(() => {
|
|
31
|
+
if (!isRunboxRunning) {
|
|
32
|
+
handleMenuClose();
|
|
33
|
+
}
|
|
34
|
+
}, [handleMenuClose, isRunboxRunning]);
|
|
35
|
+
//
|
|
36
|
+
//
|
|
37
|
+
//
|
|
38
|
+
return React.createElement(material.Menu, {
|
|
39
|
+
open: Boolean(menuAnchorEl),
|
|
40
|
+
anchorEl: menuAnchorEl,
|
|
41
|
+
anchorOrigin: {
|
|
42
|
+
vertical: 'bottom',
|
|
43
|
+
horizontal: 'right'
|
|
44
|
+
},
|
|
45
|
+
transformOrigin: {
|
|
46
|
+
vertical: 'top',
|
|
47
|
+
horizontal: 'right'
|
|
48
|
+
},
|
|
49
|
+
onClose: handleMenuClose
|
|
50
|
+
}, React.createElement(MaterialRunboxActionShare.default, {
|
|
51
|
+
handleMenuClose: handleMenuClose
|
|
52
|
+
}), React.createElement(MaterialRunboxActionRestart.default, {
|
|
53
|
+
runbox: runbox,
|
|
54
|
+
runtime: runtime,
|
|
55
|
+
courseId: courseId,
|
|
56
|
+
refetch: refetch,
|
|
57
|
+
handleMenuClose: handleMenuClose
|
|
58
|
+
}), React.createElement(MaterialRunboxActionReset.default, {
|
|
59
|
+
runtime: runtime,
|
|
60
|
+
courseId: courseId,
|
|
61
|
+
handleMenuClose: handleMenuClose
|
|
62
|
+
}));
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
exports.default = MaterialRunboxActionMenu;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { RuntimeProps } from '../runtime/Runtime';
|
|
3
|
-
type MaterialRunboxActionResetProps = Pick<RuntimeProps, 'runtime' | 'courseId'
|
|
3
|
+
type MaterialRunboxActionResetProps = Pick<RuntimeProps, 'runtime' | 'courseId'> & {
|
|
4
|
+
handleMenuClose: () => void;
|
|
5
|
+
};
|
|
4
6
|
declare const MaterialRunboxActionReset: React.FC<MaterialRunboxActionResetProps>;
|
|
5
7
|
export default MaterialRunboxActionReset;
|