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