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