@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.
Files changed (60) hide show
  1. package/cjs/assets/queue.gif.js +1 -1
  2. package/cjs/assets/runbox_logo.png.js +1 -1
  3. package/cjs/assets/terminated.png.js +1 -1
  4. package/cjs/components/material-runbox/MaterialRunbox.js +17 -19
  5. package/cjs/components/material-runbox/MaterialRunboxBody.js +15 -12
  6. package/cjs/components/material-runbox/MaterialRunboxContent.js +94 -101
  7. package/cjs/components/material-runbox/MaterialRunboxFooter.js +17 -22
  8. package/cjs/components/material-runbox/MaterialRunboxHeader.d.ts +3 -0
  9. package/cjs/components/material-runbox/MaterialRunboxHeader.js +77 -81
  10. package/cjs/components/material-runbox/actions/MaterialRunboxActionAutoShutdown.js +26 -22
  11. package/cjs/components/material-runbox/actions/MaterialRunboxActionGrade.js +140 -180
  12. package/cjs/components/material-runbox/actions/MaterialRunboxActionMenu.d.ts +8 -0
  13. package/cjs/components/material-runbox/actions/MaterialRunboxActionMenu.js +65 -0
  14. package/cjs/components/material-runbox/actions/MaterialRunboxActionReset.d.ts +3 -1
  15. package/cjs/components/material-runbox/actions/MaterialRunboxActionReset.js +73 -110
  16. package/cjs/components/material-runbox/actions/MaterialRunboxActionRestart.d.ts +3 -1
  17. package/cjs/components/material-runbox/actions/MaterialRunboxActionRestart.js +54 -70
  18. package/cjs/components/material-runbox/actions/MaterialRunboxActionShare.d.ts +4 -1
  19. package/cjs/components/material-runbox/actions/MaterialRunboxActionShare.js +67 -41
  20. package/cjs/components/material-runbox/contexts/MaterialRunboxApiContext.js +16 -27
  21. package/cjs/components/material-runbox/contexts/MaterialRunboxCommandContext.js +38 -53
  22. package/cjs/components/material-runbox/contexts/MaterialRunboxContext.js +9 -11
  23. package/cjs/components/material-runbox/hooks/useRunboxControl.js +39 -65
  24. package/cjs/components/material-runbox/locales/en.json.js +2 -2
  25. package/cjs/components/material-runbox/locales/index.js +2 -4
  26. package/cjs/components/material-runbox/locales/ko.json.js +2 -2
  27. package/cjs/components/material-runbox/runtime/Runtime.js +18 -26
  28. package/cjs/components/material-runbox/runtime/RuntimeOverlayAssigned.js +10 -17
  29. package/cjs/components/material-runbox/runtime/RuntimeOverlayQueued.js +16 -18
  30. package/cjs/components/material-runbox/runtime/RuntimeOverlayTerminated.js +27 -33
  31. package/cjs/index.js +1 -3
  32. package/es/components/material-runbox/MaterialRunbox.js +11 -9
  33. package/es/components/material-runbox/MaterialRunboxBody.js +13 -5
  34. package/es/components/material-runbox/MaterialRunboxContent.js +80 -82
  35. package/es/components/material-runbox/MaterialRunboxFooter.js +11 -11
  36. package/es/components/material-runbox/MaterialRunboxHeader.d.ts +3 -0
  37. package/es/components/material-runbox/MaterialRunboxHeader.js +72 -71
  38. package/es/components/material-runbox/actions/MaterialRunboxActionAutoShutdown.js +22 -13
  39. package/es/components/material-runbox/actions/MaterialRunboxActionGrade.js +120 -155
  40. package/es/components/material-runbox/actions/MaterialRunboxActionMenu.d.ts +8 -0
  41. package/es/components/material-runbox/actions/MaterialRunboxActionMenu.js +61 -0
  42. package/es/components/material-runbox/actions/MaterialRunboxActionReset.d.ts +3 -1
  43. package/es/components/material-runbox/actions/MaterialRunboxActionReset.js +65 -98
  44. package/es/components/material-runbox/actions/MaterialRunboxActionRestart.d.ts +3 -1
  45. package/es/components/material-runbox/actions/MaterialRunboxActionRestart.js +47 -59
  46. package/es/components/material-runbox/actions/MaterialRunboxActionShare.d.ts +4 -1
  47. package/es/components/material-runbox/actions/MaterialRunboxActionShare.js +68 -38
  48. package/es/components/material-runbox/contexts/MaterialRunboxApiContext.js +13 -20
  49. package/es/components/material-runbox/contexts/MaterialRunboxCommandContext.js +35 -46
  50. package/es/components/material-runbox/contexts/MaterialRunboxContext.js +6 -4
  51. package/es/components/material-runbox/hooks/useRunboxControl.js +39 -63
  52. package/es/components/material-runbox/locales/en.json.js +1 -1
  53. package/es/components/material-runbox/locales/ko.json.js +1 -1
  54. package/es/components/material-runbox/runtime/Runtime.js +14 -18
  55. package/es/components/material-runbox/runtime/RuntimeOverlayAssigned.js +3 -6
  56. package/es/components/material-runbox/runtime/RuntimeOverlayQueued.js +6 -4
  57. package/es/components/material-runbox/runtime/RuntimeOverlayTerminated.js +12 -14
  58. package/package.json +13 -9
  59. package/cjs/_virtual/_rollupPluginBabelHelpers.js +0 -399
  60. 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 _rollupPluginBabelHelpers = require('../../../_virtual/_rollupPluginBabelHelpers.js');
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 _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
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
- var StyledFormControlLabel = styled__default["default"](material.FormControlLabel)(_templateObject || (_templateObject = _rollupPluginBabelHelpers.taggedTemplateLiteral(["\n margin: 0 !important;\n"])));
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
- var MaterialRunboxActionAutoShutdown = function MaterialRunboxActionAutoShutdown(_ref) {
28
- var runtime = _ref.runtime,
29
- runtimeTemplate = _ref.runtimeTemplate,
30
- courseId = _ref.courseId,
31
- refetch = _ref.refetch;
30
+ const MaterialRunboxActionAutoShutdown = ({
31
+ runtime,
32
+ runtimeTemplate,
33
+ courseId,
34
+ refetch
35
+ }) => {
32
36
  var _a;
33
- var intl = reactIntl.useIntl();
34
- var materialRunboxApi = MaterialRunboxApiContext.useMaterialRunboxApiContext();
37
+ const intl = reactIntl.useIntl();
38
+ const materialRunboxApi = MaterialRunboxApiContext.useMaterialRunboxApiContext();
35
39
  /**
36
40
  *
37
41
  */
38
- var handleAction = function handleAction(_, shutdown) {
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(function () {
52
+ }).then(refetch).catch(() => {
49
53
  //
50
54
  });
51
55
  };
52
56
  //
53
57
  //
54
58
  //
55
- return React__default["default"].createElement(material.Tooltip, {
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
- }, React__default["default"].createElement(StyledFormControlLabel, {
66
- control: React__default["default"].createElement(material.Switch, {
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["default"] = MaterialRunboxActionAutoShutdown;
86
+ exports.default = MaterialRunboxActionAutoShutdown;
@@ -2,33 +2,27 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var _rollupPluginBabelHelpers = require('../../../_virtual/_rollupPluginBabelHelpers.js');
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 _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
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
- var TRANSITION_DURATION = 300;
31
- var TRANSITION_STYLE_MAP = {
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
- var StyledMainActionButton = styled__default["default"](lab.LoadingButton)(_templateObject || (_templateObject = _rollupPluginBabelHelpers.taggedTemplateLiteral(["\n min-width: 4rem !important;\n"])));
52
- var StyledSubActionButton = styled__default["default"](material.Button)(_templateObject2 || (_templateObject2 = _rollupPluginBabelHelpers.taggedTemplateLiteral(["\n transition: max-width ", "ms\n cubic-bezier(0.25, 0.46, 0.45, 1);\n"])), TRANSITION_DURATION);
53
- var StyledTerminal = styled__default["default"].textarea(_templateObject3 || (_templateObject3 = _rollupPluginBabelHelpers.taggedTemplateLiteral(["\n padding: 1rem;\n width: 100%;\n color: ", ";\n background-color: ", ";\n border: none;\n border-radius: 0.5rem;\n font-family: 'Elice Digital Coding', monospace;\n font-size: ", ";\n line-height: ", ";\n outline: none;\n resize: none;\n"])), function (_ref) {
54
- var theme = _ref.theme;
55
- return theme.palette.common.white;
56
- }, function (_ref2) {
57
- var theme = _ref2.theme;
58
- return theme.palette.common.black;
59
- }, function (_ref3) {
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
- var MaterialRunboxActionGrade = function MaterialRunboxActionGrade(_ref5) {
70
- var runtime = _ref5.runtime,
71
- courseId = _ref5.courseId;
72
+ const MaterialRunboxActionGrade = ({
73
+ runtime,
74
+ courseId
75
+ }) => {
72
76
  var _a;
73
- var _useSnackbar = notistack.useSnackbar(),
74
- enqueueSnackbar = _useSnackbar.enqueueSnackbar;
75
- var intl = reactIntl.useIntl();
76
- var materialRunboxApi = MaterialRunboxApiContext.useMaterialRunboxApiContext();
77
- var _useMaterialRunboxCom = MaterialRunboxCommandContext.useMaterialRunboxCommandContext(),
78
- isLastCommandRunning = _useMaterialRunboxCom.isLastCommandRunning,
79
- lastCommand = _useMaterialRunboxCom.lastCommand,
80
- setCommandIdToPing = _useMaterialRunboxCom.setCommandIdToPing;
81
- var _useEliceRunboxRunnin = runboxClient.useEliceRunboxRunning(),
82
- status = _useEliceRunboxRunnin.status;
83
- var leaderboardSubmitInfoQuery = reactQuery.useQuery({
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: courseId,
86
- runtime: runtime
92
+ courseId,
93
+ runtime
87
94
  }],
88
- queryFn: function queryFn(_ref6) {
89
- var signal = _ref6.signal;
90
- return materialRunboxApi.runbox.runboxRunboxIdSubmitInfoGet({
91
- eliceCourseId: courseId,
92
- runboxId: runtime === null || runtime === void 0 ? void 0 : runtime.runboxId
93
- }, {
94
- signal: signal
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
- var isSubmitCountRemained = ((_a = leaderboardSubmitInfoQuery.data) === null || _a === void 0 ? void 0 : _a.remainSubmitCount) !== 0;
101
- var _React$useState = React__default["default"].useState(false),
102
- _React$useState2 = _rollupPluginBabelHelpers.slicedToArray(_React$useState, 2),
103
- isActionLoading = _React$useState2[0],
104
- setActionLoading = _React$useState2[1];
105
- var _React$useState3 = React__default["default"].useState(false),
106
- _React$useState4 = _rollupPluginBabelHelpers.slicedToArray(_React$useState3, 2),
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
- var handleGradeResultDialogOpen = function handleGradeResultDialogOpen() {
116
+ const handleGradeResultDialogOpen = () => {
123
117
  setGradeResultDialogOpen(true);
124
118
  };
125
119
  /**
126
120
  *
127
121
  */
128
- var handleGradeResultDialogClose = function handleGradeResultDialogClose() {
122
+ const handleGradeResultDialogClose = () => {
129
123
  setGradeResultDialogOpen(false);
130
124
  };
131
125
  /**
132
126
  *
133
127
  */
134
- var handleSubmitCountInfoDialogClose = function handleSubmitCountInfoDialogClose() {
128
+ const handleSubmitCountInfoDialogClose = () => {
135
129
  setSubmitCountInfoDialogOpen(false);
136
130
  };
137
131
  /**
138
132
  *
139
133
  */
140
- var handleAction = /*#__PURE__*/function () {
141
- var _ref7 = _rollupPluginBabelHelpers.asyncToGenerator( /*#__PURE__*/_rollupPluginBabelHelpers.regeneratorRuntime().mark(function _callee() {
142
- var _yield$leaderboardSub, currentLeaderboardSubmitInfo, isCurrentSubmitCountEmpty, runtimeId, _yield$materialRunbox, commandId;
143
- return _rollupPluginBabelHelpers.regeneratorRuntime().wrap(function _callee$(_context) {
144
- while (1) switch (_context.prev = _context.next) {
145
- case 0:
146
- setActionLoading(true);
147
- _context.prev = 1;
148
- _context.next = 4;
149
- return leaderboardSubmitInfoQuery.refetch();
150
- case 4:
151
- _yield$leaderboardSub = _context.sent;
152
- currentLeaderboardSubmitInfo = _yield$leaderboardSub.data;
153
- isCurrentSubmitCountEmpty = (currentLeaderboardSubmitInfo === null || currentLeaderboardSubmitInfo === void 0 ? void 0 : currentLeaderboardSubmitInfo.remainSubmitCount) === 0;
154
- if (!isCurrentSubmitCountEmpty) {
155
- _context.next = 10;
156
- break;
157
- }
158
- setSubmitCountInfoDialogOpen(true);
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
- }, _callee, null, [[1, 18, 21, 24]]);
193
- }));
194
- return function handleAction() {
195
- return _ref7.apply(this, arguments);
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
- React__default["default"].useEffect(function () {
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
- React__default["default"].useEffect(function () {
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
- React__default["default"].useEffect(function () {
214
- return setGradeResultDialogOpen(isGradeDoneWithOutput);
215
- }, [isGradeDoneWithOutput]);
177
+ React.useEffect(() => setGradeResultDialogOpen(isGradeDoneWithOutput), [isGradeDoneWithOutput]);
216
178
  /**
217
179
  *
218
180
  */
219
- var renderActionButton = function renderActionButton() {
220
- var isGradeType = (lastCommand === null || lastCommand === void 0 ? void 0 : lastCommand.commandType) === openapiClientMaterialRunbox.CommandType.Grade;
221
- var isGrading = isActionLoading || isLastCommandRunning && isGradeType;
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
- var getActionTooltipMessage = function getActionTooltipMessage() {
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 React__default["default"].createElement(material.Tooltip, {
200
+ return React.createElement(material.Tooltip, {
239
201
  title: getActionTooltipMessage(),
240
202
  placement: "bottom-end"
241
- }, React__default["default"].createElement(material.ButtonGroup, {
203
+ }, React.createElement(material.ButtonGroup, {
242
204
  variant: "contained"
243
- }, React__default["default"].createElement(StyledMainActionButton, {
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
- }, React__default["default"].createElement(reactIntl.FormattedMessage, {
211
+ }, React.createElement(reactIntl.FormattedMessage, {
250
212
  id: "runbox.action.grade.title"
251
- })), React__default["default"].createElement(reactTransitionGroup.Transition, {
213
+ })), isGradeDoneWithOutput ? React.createElement(reactTransitionGroup.Transition, {
252
214
  in: isGradeDoneWithOutput,
253
215
  timeout: 0,
254
216
  mountOnEnter: true,
255
217
  unmountOnExit: true
256
- }, function (state) {
257
- return React__default["default"].createElement(StyledSubActionButton, {
258
- size: "small",
259
- disabled: isLastCommandRunning,
260
- onClick: handleGradeResultDialogOpen,
261
- style: TRANSITION_STYLE_MAP[state]
262
- }, React__default["default"].createElement(material.Badge, {
263
- color: "error",
264
- variant: "dot",
265
- invisible: !hasUnreadResult
266
- }, React__default["default"].createElement(iconsMaterial.Terminal, {
267
- fontSize: "small"
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
- var renderActionGradeResultDialog = function renderActionGradeResultDialog() {
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 React__default["default"].createElement(material.Dialog, {
238
+ return React.createElement(material.Dialog, {
279
239
  open: isGradeResultDialogOpen,
280
240
  maxWidth: "md",
281
241
  fullWidth: true,
282
242
  onClose: handleGradeResultDialogClose
283
- }, React__default["default"].createElement(material.DialogTitle, null, React__default["default"].createElement(reactIntl.FormattedMessage, {
243
+ }, React.createElement(material.DialogTitle, null, React.createElement(reactIntl.FormattedMessage, {
284
244
  id: "runbox.action.grade.dialog.title"
285
- })), React__default["default"].createElement(material.DialogContent, null, React__default["default"].createElement(material.Stack, {
245
+ })), React.createElement(material.DialogContent, null, React.createElement(material.Stack, {
286
246
  gap: "0.75rem"
287
- }, lastCommand.terminatedReason === 'done' ? React__default["default"].createElement(material.Alert, {
247
+ }, lastCommand.terminatedReason === 'done' ? React.createElement(material.Alert, {
288
248
  severity: "success"
289
- }, React__default["default"].createElement(reactIntl.FormattedMessage, {
249
+ }, React.createElement(reactIntl.FormattedMessage, {
290
250
  id: "runbox.action.grade.dialog.description.success"
291
- })) : React__default["default"].createElement(material.Alert, {
251
+ })) : React.createElement(material.Alert, {
292
252
  severity: "error"
293
- }, React__default["default"].createElement(reactIntl.FormattedMessage, {
253
+ }, React.createElement(reactIntl.FormattedMessage, {
294
254
  id: "runbox.action.grade.dialog.description.error"
295
- })), React__default["default"].createElement(StyledTerminal, {
255
+ })), React.createElement(StyledTerminal, {
296
256
  value: lastCommand.output,
297
257
  readOnly: true,
298
258
  rows: 20
299
- }))), React__default["default"].createElement(material.DialogActions, null, React__default["default"].createElement(material.Button, {
259
+ }))), React.createElement(material.DialogActions, null, React.createElement(material.Button, {
300
260
  color: "inherit",
301
261
  disabled: isActionLoading,
302
262
  onClick: handleGradeResultDialogClose
303
- }, React__default["default"].createElement(reactIntl.FormattedMessage, {
263
+ }, React.createElement(reactIntl.FormattedMessage, {
304
264
  id: "runbox.common.close"
305
265
  }))));
306
266
  };
307
267
  /**
308
268
  *
309
269
  */
310
- var renderActionSubmitCountInfoDialog = function renderActionSubmitCountInfoDialog() {
311
- return React__default["default"].createElement(material.Dialog, {
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
- }, React__default["default"].createElement(material.DialogTitle, null, React__default["default"].createElement(reactIntl.FormattedMessage, {
276
+ }, React.createElement(material.DialogTitle, null, React.createElement(reactIntl.FormattedMessage, {
317
277
  id: "runbtox.action.submitCountInfo.dialog.title"
318
- })), React__default["default"].createElement(material.DialogContent, null, React__default["default"].createElement(material.Typography, null, React__default["default"].createElement(reactIntl.FormattedMessage, {
278
+ })), React.createElement(material.DialogContent, null, React.createElement(material.Typography, null, React.createElement(reactIntl.FormattedMessage, {
319
279
  id: "runbox.action.submitCountInfo.dialog.description"
320
- }))), React__default["default"].createElement(material.DialogActions, null, React__default["default"].createElement(material.Button, {
280
+ }))), React.createElement(material.DialogActions, null, React.createElement(material.Button, {
321
281
  color: "inherit",
322
282
  onClick: handleSubmitCountInfoDialogClose
323
- }, React__default["default"].createElement(reactIntl.FormattedMessage, {
283
+ }, React.createElement(reactIntl.FormattedMessage, {
324
284
  id: "runbox.common.close"
325
285
  }))));
326
286
  };
327
287
  //
328
288
  //
329
289
  //
330
- return React__default["default"].createElement(React__default["default"].Fragment, null, renderActionButton(), renderActionGradeResultDialog(), renderActionSubmitCountInfoDialog());
290
+ return React.createElement(React.Fragment, null, renderActionButton(), renderActionGradeResultDialog(), renderActionSubmitCountInfoDialog());
331
291
  };
332
292
 
333
- exports["default"] = MaterialRunboxActionGrade;
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;