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