@elice/material-exercise 1.260429.0-improvetimerpopoverui.0 → 1.260430.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/components/material-exercise/context/index.js +0 -7
- package/cjs/components/material-exercise/context/recoil.d.ts +0 -44
- package/cjs/components/material-exercise/context/recoil.js +0 -108
- package/cjs/components/material-exercise/context/recoilTypes.d.ts +0 -7
- package/cjs/components/material-exercise/exercise-menu/ExerciseMenu.d.ts +1 -1
- package/cjs/components/material-exercise/exercise-menu/ExerciseMenu.js +1 -18
- package/cjs/components/material-exercise/exercise-menu/ExerciseMenuStdioFileBrowser.styled.js +2 -4
- package/cjs/components/material-exercise/exercise-menu/locales/en.json.js +1 -1
- package/cjs/components/material-exercise/exercise-menu/locales/ko.json.js +1 -1
- package/cjs/components/material-exercise/exercise-runner/ExerciseRunner.js +27 -57
- package/cjs/components/material-exercise/exercise-runner/ExerciseRunnerController.js +34 -7
- package/cjs/components/material-exercise/exercise-runner/ExerciseRunnerControllerButtonGroup.d.ts +1 -1
- package/cjs/components/material-exercise/exercise-runner/ExerciseRunnerControllerButtonGroup.js +13 -219
- package/cjs/components/material-exercise/exercise-runner/ExerciseRunnerControllerCodeHelpRequestButton.d.ts +2 -2
- package/cjs/components/material-exercise/exercise-runner/action/ControllerActionCancel.d.ts +3 -0
- package/cjs/components/material-exercise/exercise-runner/action/ControllerActionCancel.js +44 -0
- package/cjs/components/material-exercise/exercise-runner/action/ControllerActionGrade.d.ts +3 -0
- package/cjs/components/material-exercise/exercise-runner/action/ControllerActionGrade.js +58 -0
- package/cjs/components/material-exercise/exercise-runner/action/ControllerActionRun.d.ts +3 -0
- package/cjs/components/material-exercise/exercise-runner/action/ControllerActionRun.js +44 -0
- package/cjs/components/material-exercise/exercise-runner/action/ControllerActionSyncRequest.d.ts +3 -0
- package/cjs/components/material-exercise/exercise-runner/action/ControllerActionSyncRequest.js +44 -0
- package/cjs/components/material-exercise/exercise-runner/action/index.d.ts +5 -0
- package/cjs/components/material-exercise/exercise-runner/action/index.js +15 -0
- package/cjs/components/material-exercise/exercise-runner/action/useControllerActionCancel.d.ts +14 -0
- package/cjs/components/material-exercise/exercise-runner/action/useControllerActionCancel.js +52 -0
- package/cjs/components/material-exercise/exercise-runner/action/useControllerActionGrade.d.ts +16 -0
- package/cjs/components/material-exercise/exercise-runner/action/useControllerActionGrade.js +74 -0
- package/cjs/components/material-exercise/exercise-runner/action/useControllerActionRun.d.ts +14 -0
- package/cjs/components/material-exercise/exercise-runner/action/useControllerActionRun.js +65 -0
- package/cjs/components/material-exercise/exercise-runner/action/useControllerActionSyncRequest.d.ts +15 -0
- package/cjs/components/material-exercise/exercise-runner/action/useControllerActionSyncRequest.js +68 -0
- package/cjs/components/material-exercise/exercise-runner/arduino/ArduinoConnectionGuideDialog.d.ts +3 -0
- package/cjs/components/material-exercise/exercise-runner/arduino/ArduinoConnectionGuideDialog.js +163 -0
- package/cjs/components/material-exercise/exercise-runner/arduino/ArduinoConnectionGuideDialogNativeMock.d.ts +3 -0
- package/cjs/components/material-exercise/exercise-runner/arduino/ArduinoConnectionGuideDialogNativeMock.js +188 -0
- package/cjs/components/material-exercise/exercise-runner/arduino/ArduinoConnectionGuideDialogSteps.d.ts +3 -0
- package/cjs/components/material-exercise/exercise-runner/arduino/ArduinoConnectionGuideDialogSteps.js +128 -0
- package/cjs/components/material-exercise/exercise-runner/arduino/ArduinoControllerActionCompile.d.ts +3 -0
- package/cjs/components/material-exercise/exercise-runner/arduino/ArduinoControllerActionCompile.js +78 -0
- package/cjs/components/material-exercise/exercise-runner/arduino/ArduinoControllerActionUpload.d.ts +3 -0
- package/cjs/components/material-exercise/exercise-runner/arduino/ArduinoControllerActionUpload.js +98 -0
- package/cjs/components/material-exercise/exercise-runner/arduino/ArduinoControllerButtonGroup.d.ts +3 -0
- package/cjs/components/material-exercise/exercise-runner/arduino/ArduinoControllerButtonGroup.js +24 -0
- package/cjs/components/material-exercise/exercise-runner/arduino/ArduinoControllerStatusMessage.d.ts +3 -0
- package/cjs/components/material-exercise/exercise-runner/arduino/ArduinoControllerStatusMessage.js +201 -0
- package/cjs/components/material-exercise/exercise-runner/arduino/ArduinoErrorDialog.d.ts +3 -0
- package/cjs/components/material-exercise/exercise-runner/arduino/ArduinoErrorDialog.js +125 -0
- package/cjs/components/material-exercise/exercise-runner/arduino/ArduinoHelpDialog.d.ts +3 -0
- package/cjs/components/material-exercise/exercise-runner/arduino/ArduinoHelpDialog.js +179 -0
- package/cjs/components/material-exercise/exercise-runner/arduino/ArduinoHelpDialogButton.d.ts +3 -0
- package/cjs/components/material-exercise/exercise-runner/arduino/ArduinoHelpDialogButton.js +29 -0
- package/cjs/components/material-exercise/exercise-runner/arduino/ArduinoHelpDialogChecklist.d.ts +3 -0
- package/cjs/components/material-exercise/exercise-runner/arduino/ArduinoHelpDialogChecklist.js +94 -0
- package/cjs/components/material-exercise/exercise-runner/arduino/ArduinoProvider.d.ts +16 -0
- package/cjs/components/material-exercise/exercise-runner/arduino/ArduinoProvider.js +105 -0
- package/cjs/components/material-exercise/exercise-runner/arduino/ArduinoProviderApiBinder.d.ts +12 -0
- package/cjs/components/material-exercise/exercise-runner/arduino/ArduinoProviderApiBinder.js +94 -0
- package/cjs/components/material-exercise/exercise-runner/arduino/ArduinoProviderFlashWriter.d.ts +7 -0
- package/cjs/components/material-exercise/exercise-runner/arduino/ArduinoProviderFlashWriter.js +95 -0
- package/cjs/components/material-exercise/exercise-runner/arduino/ArduinoProviderSessionWriter.d.ts +7 -0
- package/cjs/components/material-exercise/exercise-runner/arduino/ArduinoProviderSessionWriter.js +70 -0
- package/cjs/components/material-exercise/exercise-runner/arduino/_context.d.ts +35 -0
- package/cjs/components/material-exercise/exercise-runner/arduino/_context.js +18 -0
- package/cjs/components/material-exercise/exercise-runner/arduino/index.d.ts +6 -0
- package/cjs/components/material-exercise/exercise-runner/arduino/index.js +13 -0
- package/cjs/components/material-exercise/exercise-runner/arduino/useArduinoRunIntent.d.ts +9 -0
- package/cjs/components/material-exercise/exercise-runner/arduino/useArduinoRunIntent.js +38 -0
- package/cjs/components/material-exercise/exercise-runner/arduino/useArduinoTerminalWriter.d.ts +10 -0
- package/cjs/components/material-exercise/exercise-runner/arduino/useArduinoTerminalWriter.js +33 -0
- package/cjs/components/material-exercise/exercise-runner/locales/en.json.js +1 -1
- package/cjs/components/material-exercise/exercise-runner/locales/ja.json.js +1 -1
- package/cjs/components/material-exercise/exercise-runner/locales/ko.json.js +1 -1
- package/cjs/components/material-exercise/exercise-runner/locales/th.json.js +1 -1
- package/cjs/components/shared/monaco-editor/utils/prettier/config.d.ts +1 -1
- package/cjs/components/shared/monaco-editor/utils/prettier/config.js +1 -1
- package/cjs/hooks/index.d.ts +0 -1
- package/cjs/hooks/index.js +0 -2
- package/es/components/material-exercise/context/index.js +1 -1
- package/es/components/material-exercise/context/recoil.d.ts +0 -44
- package/es/components/material-exercise/context/recoil.js +1 -102
- package/es/components/material-exercise/context/recoilTypes.d.ts +0 -7
- package/es/components/material-exercise/exercise-menu/ExerciseMenu.d.ts +1 -1
- package/es/components/material-exercise/exercise-menu/ExerciseMenu.js +2 -18
- package/es/components/material-exercise/exercise-menu/ExerciseMenuStdioFileBrowser.styled.js +3 -3
- package/es/components/material-exercise/exercise-menu/locales/en.json.js +1 -1
- package/es/components/material-exercise/exercise-menu/locales/ko.json.js +1 -1
- package/es/components/material-exercise/exercise-runner/ExerciseRunner.js +28 -58
- package/es/components/material-exercise/exercise-runner/ExerciseRunnerController.js +34 -7
- package/es/components/material-exercise/exercise-runner/ExerciseRunnerControllerButtonGroup.d.ts +1 -1
- package/es/components/material-exercise/exercise-runner/ExerciseRunnerControllerButtonGroup.js +13 -214
- package/es/components/material-exercise/exercise-runner/ExerciseRunnerControllerCodeHelpRequestButton.d.ts +2 -2
- package/es/components/material-exercise/exercise-runner/action/ControllerActionCancel.d.ts +3 -0
- package/es/components/material-exercise/exercise-runner/action/ControllerActionCancel.js +40 -0
- package/es/components/material-exercise/exercise-runner/action/ControllerActionGrade.d.ts +3 -0
- package/es/components/material-exercise/exercise-runner/action/ControllerActionGrade.js +54 -0
- package/es/components/material-exercise/exercise-runner/action/ControllerActionRun.d.ts +3 -0
- package/es/components/material-exercise/exercise-runner/action/ControllerActionRun.js +40 -0
- package/es/components/material-exercise/exercise-runner/action/ControllerActionSyncRequest.d.ts +3 -0
- package/es/components/material-exercise/exercise-runner/action/ControllerActionSyncRequest.js +40 -0
- package/es/components/material-exercise/exercise-runner/action/index.d.ts +5 -0
- package/es/components/material-exercise/exercise-runner/action/index.js +5 -0
- package/es/components/material-exercise/exercise-runner/action/useControllerActionCancel.d.ts +14 -0
- package/es/components/material-exercise/exercise-runner/action/useControllerActionCancel.js +46 -0
- package/es/components/material-exercise/exercise-runner/action/useControllerActionGrade.d.ts +16 -0
- package/es/components/material-exercise/exercise-runner/action/useControllerActionGrade.js +68 -0
- package/es/components/material-exercise/exercise-runner/action/useControllerActionRun.d.ts +14 -0
- package/es/components/material-exercise/exercise-runner/action/useControllerActionRun.js +59 -0
- package/es/components/material-exercise/exercise-runner/action/useControllerActionSyncRequest.d.ts +15 -0
- package/es/components/material-exercise/exercise-runner/action/useControllerActionSyncRequest.js +62 -0
- package/es/components/material-exercise/exercise-runner/arduino/ArduinoConnectionGuideDialog.d.ts +3 -0
- package/es/components/material-exercise/exercise-runner/arduino/ArduinoConnectionGuideDialog.js +148 -0
- package/es/components/material-exercise/exercise-runner/arduino/ArduinoConnectionGuideDialogNativeMock.d.ts +3 -0
- package/es/components/material-exercise/exercise-runner/arduino/ArduinoConnectionGuideDialogNativeMock.js +177 -0
- package/es/components/material-exercise/exercise-runner/arduino/ArduinoConnectionGuideDialogSteps.d.ts +3 -0
- package/es/components/material-exercise/exercise-runner/arduino/ArduinoConnectionGuideDialogSteps.js +118 -0
- package/es/components/material-exercise/exercise-runner/arduino/ArduinoControllerActionCompile.d.ts +3 -0
- package/es/components/material-exercise/exercise-runner/arduino/ArduinoControllerActionCompile.js +70 -0
- package/es/components/material-exercise/exercise-runner/arduino/ArduinoControllerActionUpload.d.ts +3 -0
- package/es/components/material-exercise/exercise-runner/arduino/ArduinoControllerActionUpload.js +90 -0
- package/es/components/material-exercise/exercise-runner/arduino/ArduinoControllerButtonGroup.d.ts +3 -0
- package/es/components/material-exercise/exercise-runner/arduino/ArduinoControllerButtonGroup.js +20 -0
- package/es/components/material-exercise/exercise-runner/arduino/ArduinoControllerStatusMessage.d.ts +3 -0
- package/es/components/material-exercise/exercise-runner/arduino/ArduinoControllerStatusMessage.js +197 -0
- package/es/components/material-exercise/exercise-runner/arduino/ArduinoErrorDialog.d.ts +3 -0
- package/es/components/material-exercise/exercise-runner/arduino/ArduinoErrorDialog.js +112 -0
- package/es/components/material-exercise/exercise-runner/arduino/ArduinoHelpDialog.d.ts +3 -0
- package/es/components/material-exercise/exercise-runner/arduino/ArduinoHelpDialog.js +161 -0
- package/es/components/material-exercise/exercise-runner/arduino/ArduinoHelpDialogButton.d.ts +3 -0
- package/es/components/material-exercise/exercise-runner/arduino/ArduinoHelpDialogButton.js +25 -0
- package/es/components/material-exercise/exercise-runner/arduino/ArduinoHelpDialogChecklist.d.ts +3 -0
- package/es/components/material-exercise/exercise-runner/arduino/ArduinoHelpDialogChecklist.js +84 -0
- package/es/components/material-exercise/exercise-runner/arduino/ArduinoProvider.d.ts +16 -0
- package/es/components/material-exercise/exercise-runner/arduino/ArduinoProvider.js +97 -0
- package/es/components/material-exercise/exercise-runner/arduino/ArduinoProviderApiBinder.d.ts +12 -0
- package/es/components/material-exercise/exercise-runner/arduino/ArduinoProviderApiBinder.js +86 -0
- package/es/components/material-exercise/exercise-runner/arduino/ArduinoProviderFlashWriter.d.ts +7 -0
- package/es/components/material-exercise/exercise-runner/arduino/ArduinoProviderFlashWriter.js +87 -0
- package/es/components/material-exercise/exercise-runner/arduino/ArduinoProviderSessionWriter.d.ts +7 -0
- package/es/components/material-exercise/exercise-runner/arduino/ArduinoProviderSessionWriter.js +62 -0
- package/es/components/material-exercise/exercise-runner/arduino/_context.d.ts +35 -0
- package/es/components/material-exercise/exercise-runner/arduino/_context.js +15 -0
- package/es/components/material-exercise/exercise-runner/arduino/index.d.ts +6 -0
- package/es/components/material-exercise/exercise-runner/arduino/index.js +4 -0
- package/es/components/material-exercise/exercise-runner/arduino/useArduinoRunIntent.d.ts +9 -0
- package/es/components/material-exercise/exercise-runner/arduino/useArduinoRunIntent.js +32 -0
- package/es/components/material-exercise/exercise-runner/arduino/useArduinoTerminalWriter.d.ts +10 -0
- package/es/components/material-exercise/exercise-runner/arduino/useArduinoTerminalWriter.js +27 -0
- package/es/components/material-exercise/exercise-runner/locales/en.json.js +1 -1
- package/es/components/material-exercise/exercise-runner/locales/ja.json.js +1 -1
- package/es/components/material-exercise/exercise-runner/locales/ko.json.js +1 -1
- package/es/components/material-exercise/exercise-runner/locales/th.json.js +1 -1
- package/es/components/shared/monaco-editor/utils/prettier/config.d.ts +1 -1
- package/es/components/shared/monaco-editor/utils/prettier/config.js +1 -1
- package/es/hooks/index.d.ts +0 -1
- package/es/hooks/index.js +0 -1
- package/package.json +15 -11
- package/cjs/components/material-exercise/exercise-menu/ExerciseMenuArduinoAgentModalButton.d.ts +0 -3
- package/cjs/components/material-exercise/exercise-menu/ExerciseMenuArduinoAgentModalButton.js +0 -33
- package/cjs/components/material-exercise/exercise-menu/ExerciseMenuArduinoSettings.d.ts +0 -3
- package/cjs/components/material-exercise/exercise-menu/ExerciseMenuArduinoSettings.js +0 -178
- package/cjs/components/material-exercise/exercise-runner/ExerciseRunnerControllerArduinoAgentModal.d.ts +0 -3
- package/cjs/components/material-exercise/exercise-runner/ExerciseRunnerControllerArduinoAgentModal.js +0 -169
- package/cjs/components/material-exercise/exercise-runner/ExerciseRunnerControllerArduinoStatusMessage.d.ts +0 -3
- package/cjs/components/material-exercise/exercise-runner/ExerciseRunnerControllerArduinoStatusMessage.js +0 -120
- package/cjs/constants/arduino.d.ts +0 -35
- package/cjs/constants/arduino.js +0 -73
- package/cjs/hooks/useArduino.d.ts +0 -14
- package/cjs/hooks/useArduino.js +0 -589
- package/cjs/typings/arduino.d.ts +0 -77
- package/cjs/utils/arduino.d.ts +0 -43
- package/cjs/utils/arduino.js +0 -82
- package/es/components/material-exercise/exercise-menu/ExerciseMenuArduinoAgentModalButton.d.ts +0 -3
- package/es/components/material-exercise/exercise-menu/ExerciseMenuArduinoAgentModalButton.js +0 -29
- package/es/components/material-exercise/exercise-menu/ExerciseMenuArduinoSettings.d.ts +0 -3
- package/es/components/material-exercise/exercise-menu/ExerciseMenuArduinoSettings.js +0 -170
- package/es/components/material-exercise/exercise-runner/ExerciseRunnerControllerArduinoAgentModal.d.ts +0 -3
- package/es/components/material-exercise/exercise-runner/ExerciseRunnerControllerArduinoAgentModal.js +0 -161
- package/es/components/material-exercise/exercise-runner/ExerciseRunnerControllerArduinoStatusMessage.d.ts +0 -3
- package/es/components/material-exercise/exercise-runner/ExerciseRunnerControllerArduinoStatusMessage.js +0 -112
- package/es/constants/arduino.d.ts +0 -35
- package/es/constants/arduino.js +0 -62
- package/es/hooks/useArduino.d.ts +0 -14
- package/es/hooks/useArduino.js +0 -583
- package/es/typings/arduino.d.ts +0 -77
- package/es/utils/arduino.d.ts +0 -43
- package/es/utils/arduino.js +0 -75
package/es/components/material-exercise/exercise-runner/ExerciseRunnerControllerButtonGroup.js
CHANGED
|
@@ -1,220 +1,19 @@
|
|
|
1
|
-
import { toConsumableArray as _toConsumableArray } from '../../../_virtual/_rollupPluginBabelHelpers.js';
|
|
2
|
-
import _styled from '@emotion/styled/base';
|
|
3
1
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import { EliceWebSocket } from '@elice/websocket';
|
|
10
|
-
import { useRecoilValue } from 'recoil';
|
|
11
|
-
import { ExerciseRunnerContext } from './ExerciseRunnerContext.js';
|
|
12
|
-
import { exerciseActiveFilenameState, exerciseWebSocketTotalStatusQuery, exerciseState, exerciseRunnerRunTypeState, exerciseLectureState, exerciseRunnerSubmittingState, exerciseRunnerRunningState, exerciseArduinoUploadProgressState, exerciseArduinoOpenedPortNameState } from '../context/recoil.js';
|
|
13
|
-
import { useExericseShortcut } from '../../../hooks/useExericseShortcut.js';
|
|
14
|
-
import { ExerciseContext } from '../context/context.js';
|
|
15
|
-
import { useExerciseFileEditable } from '../../../hooks/useExerciseFile.js';
|
|
16
|
-
import { exerciseFileEditorSaveAction$ } from '../context/subjects.js';
|
|
2
|
+
import { Stack } from '@mui/material';
|
|
3
|
+
import ControllerActionRun from './action/ControllerActionRun.js';
|
|
4
|
+
import ControllerActionGrade from './action/ControllerActionGrade.js';
|
|
5
|
+
import ControllerActionCancel from './action/ControllerActionCancel.js';
|
|
6
|
+
import ControllerActionSyncRequest from './action/ControllerActionSyncRequest.js';
|
|
17
7
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
})("position:relative;transition:none;&.eb-button--role-danger{border-color:", colors.red[700], ";background-color:", colors.red[700], ";}");
|
|
22
|
-
var StyledControllerButtonWrap = /*#__PURE__*/_styled("div", {
|
|
23
|
-
target: "e45p2z1"
|
|
24
|
-
})("production" === "production" ? {
|
|
25
|
-
name: "zjik7",
|
|
26
|
-
styles: "display:flex"
|
|
27
|
-
} : {
|
|
28
|
-
name: "zjik7",
|
|
29
|
-
styles: "display:flex",
|
|
30
|
-
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
31
|
-
});
|
|
32
|
-
var StyledControllerButtonGroup = /*#__PURE__*/_styled("div", {
|
|
33
|
-
target: "e45p2z0"
|
|
34
|
-
})("display:flex;flex-direction:row;align-items:center;>", StyledControllerButtonWrap, ",>", StyledControllerButton, "{margin-right:0.5rem;&:last-child{margin-right:0;}}");
|
|
8
|
+
//
|
|
9
|
+
//
|
|
10
|
+
//
|
|
35
11
|
var ExerciseRunnerControllerButtonGroup = function ExerciseRunnerControllerButtonGroup() {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
onSubmit = _React$useContext2.onSubmit,
|
|
42
|
-
onSyncRequest = _React$useContext2.onSyncRequest,
|
|
43
|
-
onCancel = _React$useContext2.onCancel;
|
|
44
|
-
var activeFilename = useRecoilValue(exerciseActiveFilenameState);
|
|
45
|
-
var isFileEditable = useExerciseFileEditable(activeFilename);
|
|
46
|
-
var runnerWebsocketStatus = useRecoilValue(exerciseWebSocketTotalStatusQuery([].concat(_toConsumableArray(isFileEditable ? ['usercodeEdit'] : []), ['runnerRoom', 'stdio'])));
|
|
47
|
-
var exercise = useRecoilValue(exerciseState(materialExerciseId));
|
|
48
|
-
var exerciseRunType = useRecoilValue(exerciseRunnerRunTypeState);
|
|
49
|
-
var exerciseWithNoGrade = Boolean(exercise === null || exercise === void 0 ? void 0 : exercise.isNoSubmitGrade);
|
|
50
|
-
var lecture = useRecoilValue(exerciseLectureState(exercise === null || exercise === void 0 ? void 0 : exercise._lectureId));
|
|
51
|
-
var isTestLecture = (lecture === null || lecture === void 0 ? void 0 : lecture.lectureType) === enums.LectureType.Test;
|
|
52
|
-
var isTestLectureCompleted = (lecture === null || lecture === void 0 ? void 0 : lecture.testAdmissionStatus) === enums.TestAdmissionStatus.Completed;
|
|
53
|
-
// runner states
|
|
54
|
-
var isSubmitting = useRecoilValue(exerciseRunnerSubmittingState);
|
|
55
|
-
var isRunning = useRecoilValue(exerciseRunnerRunningState);
|
|
56
|
-
var isConnecting = runnerWebsocketStatus === EliceWebSocket.CONNECTING;
|
|
57
|
-
var isNotReady = runnerWebsocketStatus !== EliceWebSocket.OPEN;
|
|
58
|
-
// arduino
|
|
59
|
-
var isArduinoExercise = (exercise === null || exercise === void 0 ? void 0 : exercise.envType) === enums.ExerciseEnvType.Arduino;
|
|
60
|
-
var arduinoUploadProgress = useRecoilValue(exerciseArduinoUploadProgressState);
|
|
61
|
-
var arduinoOpenedPortName = useRecoilValue(exerciseArduinoOpenedPortNameState);
|
|
62
|
-
//
|
|
63
|
-
// ========= ui states =========
|
|
64
|
-
//
|
|
65
|
-
// submit run
|
|
66
|
-
var isSubmitRunHidden = isRunning;
|
|
67
|
-
var isSubmitRunArduinoDisabled = isArduinoExercise ? arduinoUploadProgress !== 'ready' && arduinoUploadProgress !== 'error' || !arduinoOpenedPortName : false;
|
|
68
|
-
var isSubmitRunDisabled = isSubmitRunHidden || isSubmitRunArduinoDisabled || isNotReady || isConnecting || isSubmitting;
|
|
69
|
-
// submit grade
|
|
70
|
-
var isSubmitGradeHidden = isRunning;
|
|
71
|
-
var isSubmitGradeDisabled = isSubmitGradeHidden || exerciseWithNoGrade || isTestLecture && isTestLectureCompleted || isNotReady || isConnecting || isSubmitting;
|
|
72
|
-
// cancel
|
|
73
|
-
var isCancelHidden = !isRunning;
|
|
74
|
-
var isCancelDisabled = isCancelHidden || isNotReady || isConnecting;
|
|
75
|
-
// sync request
|
|
76
|
-
var isSyncRequestHidden = !isRunning || !((_a = exercise === null || exercise === void 0 ? void 0 : exercise.readyExerciseImage) === null || _a === void 0 ? void 0 : _a.httpPort);
|
|
77
|
-
var isSyncRequestDisabled = isSyncRequestHidden || isNotReady || isConnecting;
|
|
78
|
-
//
|
|
79
|
-
//
|
|
80
|
-
//
|
|
81
|
-
/**
|
|
82
|
-
* Submit to run
|
|
83
|
-
*/
|
|
84
|
-
var handleSubmitRun = function handleSubmitRun() {
|
|
85
|
-
if (!isSubmitRunDisabled) {
|
|
86
|
-
void onSubmit(enums.ExerciseRunType.Run);
|
|
87
|
-
}
|
|
88
|
-
};
|
|
89
|
-
/**
|
|
90
|
-
* Submit to grade
|
|
91
|
-
*/
|
|
92
|
-
var handleSubmitGrade = function handleSubmitGrade() {
|
|
93
|
-
if (!isSubmitGradeDisabled) {
|
|
94
|
-
void onSubmit(enums.ExerciseRunType.Grade);
|
|
95
|
-
}
|
|
96
|
-
};
|
|
97
|
-
/**
|
|
98
|
-
* Cancel
|
|
99
|
-
*/
|
|
100
|
-
var handleCancel = function handleCancel() {
|
|
101
|
-
if (!isCancelDisabled) {
|
|
102
|
-
onCancel();
|
|
103
|
-
}
|
|
104
|
-
};
|
|
105
|
-
/**
|
|
106
|
-
* Sync request
|
|
107
|
-
*/
|
|
108
|
-
var handleSyncRequest = function handleSyncRequest() {
|
|
109
|
-
if (!isSyncRequestDisabled) {
|
|
110
|
-
onSyncRequest();
|
|
111
|
-
}
|
|
112
|
-
};
|
|
113
|
-
//
|
|
114
|
-
// keyboard shortcuts to control runner
|
|
115
|
-
//
|
|
116
|
-
useExericseShortcut('RUNNER_SUBMIT_RUN', handleSubmitRun);
|
|
117
|
-
useExericseShortcut('RUNNER_SUBMIT_GRADE', handleSubmitGrade);
|
|
118
|
-
useExericseShortcut('RUNNER_CANCEL', handleCancel);
|
|
119
|
-
useExericseShortcut('RUNNER_SYNC_REQUEST', handleSyncRequest);
|
|
120
|
-
//
|
|
121
|
-
// handle save action emitted by file editor
|
|
122
|
-
//
|
|
123
|
-
React.useEffect(function () {
|
|
124
|
-
var saveActionSub = exerciseFileEditorSaveAction$.subscribe(handleSyncRequest);
|
|
125
|
-
return function () {
|
|
126
|
-
saveActionSub.unsubscribe();
|
|
127
|
-
};
|
|
128
|
-
},
|
|
129
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
130
|
-
[isSyncRequestDisabled]);
|
|
131
|
-
/**
|
|
132
|
-
* Submit to run button
|
|
133
|
-
*/
|
|
134
|
-
var renderSubmitRunButton = function renderSubmitRunButton() {
|
|
135
|
-
if (isSubmitRunHidden) {
|
|
136
|
-
return null;
|
|
137
|
-
}
|
|
138
|
-
return jsx(StyledControllerButton, {
|
|
139
|
-
size: "tiny",
|
|
140
|
-
loading: isConnecting || isSubmitting && exerciseRunType === enums.ExerciseRunType.Run,
|
|
141
|
-
disabled: isSubmitRunDisabled,
|
|
142
|
-
onClick: handleSubmitRun,
|
|
143
|
-
children: isArduinoExercise ? intl.formatMessage({
|
|
144
|
-
id: 'exerciseRunner.controller.buttonGroup.button.compile'
|
|
145
|
-
}) : intl.formatMessage({
|
|
146
|
-
id: 'exerciseRunner.controller.buttonGroup.button.run'
|
|
147
|
-
})
|
|
148
|
-
});
|
|
149
|
-
};
|
|
150
|
-
/**
|
|
151
|
-
* Submit to grade button
|
|
152
|
-
*/
|
|
153
|
-
var renderSubmitGradeButton = function renderSubmitGradeButton() {
|
|
154
|
-
if (isSubmitGradeHidden) {
|
|
155
|
-
return null;
|
|
156
|
-
}
|
|
157
|
-
return jsx(Tooltip, {
|
|
158
|
-
dark: true,
|
|
159
|
-
title: exerciseWithNoGrade ? intl.formatMessage({
|
|
160
|
-
id: 'exerciseRunner.controller.buttonGroup.button.submit.tooltip.noSubmit'
|
|
161
|
-
}) : undefined,
|
|
162
|
-
placement: "top",
|
|
163
|
-
children: jsx(StyledControllerButtonWrap, {
|
|
164
|
-
children: jsx(StyledControllerButton, {
|
|
165
|
-
size: "tiny",
|
|
166
|
-
role: "secondary",
|
|
167
|
-
loading: isConnecting || isSubmitting && exerciseRunType === enums.ExerciseRunType.Grade,
|
|
168
|
-
disabled: isSubmitGradeDisabled,
|
|
169
|
-
onClick: handleSubmitGrade,
|
|
170
|
-
children: intl.formatMessage({
|
|
171
|
-
id: 'exerciseRunner.controller.buttonGroup.button.submit'
|
|
172
|
-
})
|
|
173
|
-
})
|
|
174
|
-
})
|
|
175
|
-
});
|
|
176
|
-
};
|
|
177
|
-
/**
|
|
178
|
-
* Cancel button
|
|
179
|
-
*/
|
|
180
|
-
var renderCancelButton = function renderCancelButton() {
|
|
181
|
-
if (isCancelHidden) {
|
|
182
|
-
return null;
|
|
183
|
-
}
|
|
184
|
-
return jsx(StyledControllerButton, {
|
|
185
|
-
size: "tiny",
|
|
186
|
-
role: "danger",
|
|
187
|
-
loading: isConnecting,
|
|
188
|
-
disabled: isCancelDisabled,
|
|
189
|
-
onClick: handleCancel,
|
|
190
|
-
children: intl.formatMessage({
|
|
191
|
-
id: 'exerciseRunner.controller.buttonGroup.button.stop'
|
|
192
|
-
})
|
|
193
|
-
});
|
|
194
|
-
};
|
|
195
|
-
/**
|
|
196
|
-
* Sync request button
|
|
197
|
-
*/
|
|
198
|
-
var renderSyncRequestButton = function renderSyncRequestButton() {
|
|
199
|
-
if (isSyncRequestHidden) {
|
|
200
|
-
return null;
|
|
201
|
-
}
|
|
202
|
-
return jsx(StyledControllerButton, {
|
|
203
|
-
size: "tiny",
|
|
204
|
-
role: "secondary",
|
|
205
|
-
loading: isConnecting,
|
|
206
|
-
disabled: isSyncRequestDisabled,
|
|
207
|
-
onClick: handleSyncRequest,
|
|
208
|
-
children: intl.formatMessage({
|
|
209
|
-
id: 'exerciseRunner.controller.buttonGroup.button.syncRequest'
|
|
210
|
-
})
|
|
211
|
-
});
|
|
212
|
-
};
|
|
213
|
-
//
|
|
214
|
-
//
|
|
215
|
-
//
|
|
216
|
-
return jsxs(StyledControllerButtonGroup, {
|
|
217
|
-
children: [renderSubmitRunButton(), renderSubmitGradeButton(), renderCancelButton(), renderSyncRequestButton()]
|
|
12
|
+
return jsxs(Stack, {
|
|
13
|
+
direction: "row",
|
|
14
|
+
alignItems: "center",
|
|
15
|
+
gap: "0.5rem",
|
|
16
|
+
children: [jsx(ControllerActionRun, {}), jsx(ControllerActionGrade, {}), jsx(ControllerActionCancel, {}), jsx(ControllerActionSyncRequest, {})]
|
|
218
17
|
});
|
|
219
18
|
};
|
|
220
19
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type React from 'react';
|
|
2
|
-
interface
|
|
2
|
+
interface CodeHelpRequestButtonProps {
|
|
3
3
|
onClick: () => void;
|
|
4
4
|
}
|
|
5
|
-
declare const ExerciseRunnerControllerCodeHelpRequestButton: React.FC<
|
|
5
|
+
declare const ExerciseRunnerControllerCodeHelpRequestButton: React.FC<CodeHelpRequestButtonProps>;
|
|
6
6
|
export default ExerciseRunnerControllerCodeHelpRequestButton;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { useRawEliceIntl } from '@elice/intl';
|
|
3
|
+
import { LoadingButton } from '@mui/lab';
|
|
4
|
+
import { useControllerActionCancel } from './useControllerActionCancel.js';
|
|
5
|
+
import { useExericseShortcut } from '../../../../hooks/useExericseShortcut.js';
|
|
6
|
+
|
|
7
|
+
//
|
|
8
|
+
//
|
|
9
|
+
//
|
|
10
|
+
var ControllerActionCancel = function ControllerActionCancel() {
|
|
11
|
+
var intl = useRawEliceIntl();
|
|
12
|
+
var _useControllerActionC = useControllerActionCancel(),
|
|
13
|
+
isHidden = _useControllerActionC.isHidden,
|
|
14
|
+
isDisabled = _useControllerActionC.isDisabled,
|
|
15
|
+
isLoading = _useControllerActionC.isLoading,
|
|
16
|
+
cancel = _useControllerActionC.cancel;
|
|
17
|
+
//
|
|
18
|
+
// register the shortcut
|
|
19
|
+
//
|
|
20
|
+
useExericseShortcut('RUNNER_CANCEL', cancel);
|
|
21
|
+
//
|
|
22
|
+
//
|
|
23
|
+
//
|
|
24
|
+
if (isHidden) {
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
return jsx(LoadingButton, {
|
|
28
|
+
size: "small",
|
|
29
|
+
variant: "contained",
|
|
30
|
+
color: "error",
|
|
31
|
+
loading: isLoading,
|
|
32
|
+
disabled: isDisabled,
|
|
33
|
+
onClick: cancel,
|
|
34
|
+
children: intl.formatMessage({
|
|
35
|
+
id: 'exerciseRunner.controller.buttonGroup.button.stop'
|
|
36
|
+
})
|
|
37
|
+
});
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export { ControllerActionCancel as default };
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { useRawEliceIntl } from '@elice/intl';
|
|
3
|
+
import { LoadingButton } from '@mui/lab';
|
|
4
|
+
import { Tooltip, Box } from '@mui/material';
|
|
5
|
+
import { useControllerActionGrade } from './useControllerActionGrade.js';
|
|
6
|
+
import { useExericseShortcut } from '../../../../hooks/useExericseShortcut.js';
|
|
7
|
+
|
|
8
|
+
//
|
|
9
|
+
//
|
|
10
|
+
//
|
|
11
|
+
var ControllerActionGrade = function ControllerActionGrade() {
|
|
12
|
+
var intl = useRawEliceIntl();
|
|
13
|
+
var _useControllerActionG = useControllerActionGrade(),
|
|
14
|
+
isHidden = _useControllerActionG.isHidden,
|
|
15
|
+
isDisabled = _useControllerActionG.isDisabled,
|
|
16
|
+
isLoading = _useControllerActionG.isLoading,
|
|
17
|
+
isNoGrade = _useControllerActionG.isNoGrade,
|
|
18
|
+
grade = _useControllerActionG.grade;
|
|
19
|
+
//
|
|
20
|
+
// register the shortcut
|
|
21
|
+
//
|
|
22
|
+
useExericseShortcut('RUNNER_SUBMIT_GRADE', grade);
|
|
23
|
+
//
|
|
24
|
+
//
|
|
25
|
+
//
|
|
26
|
+
if (isHidden) {
|
|
27
|
+
return null;
|
|
28
|
+
}
|
|
29
|
+
return jsx(Tooltip, {
|
|
30
|
+
title: isNoGrade ? intl.formatMessage({
|
|
31
|
+
id: 'exerciseRunner.controller.buttonGroup.button.submit.tooltip.noSubmit'
|
|
32
|
+
}) : '',
|
|
33
|
+
placement: "top",
|
|
34
|
+
children: jsx(Box, {
|
|
35
|
+
component: "span",
|
|
36
|
+
sx: {
|
|
37
|
+
display: 'inline-flex'
|
|
38
|
+
},
|
|
39
|
+
children: jsx(LoadingButton, {
|
|
40
|
+
size: "small",
|
|
41
|
+
variant: "contained",
|
|
42
|
+
color: "info",
|
|
43
|
+
loading: isLoading,
|
|
44
|
+
disabled: isDisabled,
|
|
45
|
+
onClick: grade,
|
|
46
|
+
children: intl.formatMessage({
|
|
47
|
+
id: 'exerciseRunner.controller.buttonGroup.button.submit'
|
|
48
|
+
})
|
|
49
|
+
})
|
|
50
|
+
})
|
|
51
|
+
});
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
export { ControllerActionGrade as default };
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { useRawEliceIntl } from '@elice/intl';
|
|
3
|
+
import { LoadingButton } from '@mui/lab';
|
|
4
|
+
import { useControllerActionRun } from './useControllerActionRun.js';
|
|
5
|
+
import { useExericseShortcut } from '../../../../hooks/useExericseShortcut.js';
|
|
6
|
+
|
|
7
|
+
//
|
|
8
|
+
//
|
|
9
|
+
//
|
|
10
|
+
var ControllerActionRun = function ControllerActionRun() {
|
|
11
|
+
var intl = useRawEliceIntl();
|
|
12
|
+
var _useControllerActionR = useControllerActionRun(),
|
|
13
|
+
isHidden = _useControllerActionR.isHidden,
|
|
14
|
+
isDisabled = _useControllerActionR.isDisabled,
|
|
15
|
+
isLoading = _useControllerActionR.isLoading,
|
|
16
|
+
run = _useControllerActionR.run;
|
|
17
|
+
//
|
|
18
|
+
// register the shortcut
|
|
19
|
+
//
|
|
20
|
+
useExericseShortcut('RUNNER_SUBMIT_RUN', run);
|
|
21
|
+
//
|
|
22
|
+
//
|
|
23
|
+
//
|
|
24
|
+
if (isHidden) {
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
return jsx(LoadingButton, {
|
|
28
|
+
size: "small",
|
|
29
|
+
variant: "contained",
|
|
30
|
+
color: "primary",
|
|
31
|
+
loading: isLoading,
|
|
32
|
+
disabled: isDisabled,
|
|
33
|
+
onClick: run,
|
|
34
|
+
children: intl.formatMessage({
|
|
35
|
+
id: 'exerciseRunner.controller.buttonGroup.button.run'
|
|
36
|
+
})
|
|
37
|
+
});
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export { ControllerActionRun as default };
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { useRawEliceIntl } from '@elice/intl';
|
|
3
|
+
import { LoadingButton } from '@mui/lab';
|
|
4
|
+
import { useControllerActionSyncRequest } from './useControllerActionSyncRequest.js';
|
|
5
|
+
import { useExericseShortcut } from '../../../../hooks/useExericseShortcut.js';
|
|
6
|
+
|
|
7
|
+
//
|
|
8
|
+
//
|
|
9
|
+
//
|
|
10
|
+
var ControllerActionSyncRequest = function ControllerActionSyncRequest() {
|
|
11
|
+
var intl = useRawEliceIntl();
|
|
12
|
+
var _useControllerActionS = useControllerActionSyncRequest(),
|
|
13
|
+
isHidden = _useControllerActionS.isHidden,
|
|
14
|
+
isDisabled = _useControllerActionS.isDisabled,
|
|
15
|
+
isLoading = _useControllerActionS.isLoading,
|
|
16
|
+
syncRequest = _useControllerActionS.syncRequest;
|
|
17
|
+
//
|
|
18
|
+
// register the shortcut
|
|
19
|
+
//
|
|
20
|
+
useExericseShortcut('RUNNER_SYNC_REQUEST', syncRequest);
|
|
21
|
+
//
|
|
22
|
+
//
|
|
23
|
+
//
|
|
24
|
+
if (isHidden) {
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
return jsx(LoadingButton, {
|
|
28
|
+
size: "small",
|
|
29
|
+
variant: "contained",
|
|
30
|
+
color: "secondary",
|
|
31
|
+
loading: isLoading,
|
|
32
|
+
disabled: isDisabled,
|
|
33
|
+
onClick: syncRequest,
|
|
34
|
+
children: intl.formatMessage({
|
|
35
|
+
id: 'exerciseRunner.controller.buttonGroup.button.syncRequest'
|
|
36
|
+
})
|
|
37
|
+
});
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export { ControllerActionSyncRequest as default };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { default as ControllerActionCancel } from './ControllerActionCancel';
|
|
2
|
+
export { default as ControllerActionGrade } from './ControllerActionGrade';
|
|
3
|
+
export { default as ControllerActionRun } from './ControllerActionRun';
|
|
4
|
+
export { default as ControllerActionSyncRequest } from './ControllerActionSyncRequest';
|
|
5
|
+
export { useControllerActionRun } from './useControllerActionRun';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { default as ControllerActionCancel } from './ControllerActionCancel.js';
|
|
2
|
+
export { default as ControllerActionGrade } from './ControllerActionGrade.js';
|
|
3
|
+
export { default as ControllerActionRun } from './ControllerActionRun.js';
|
|
4
|
+
export { default as ControllerActionSyncRequest } from './ControllerActionSyncRequest.js';
|
|
5
|
+
export { useControllerActionRun } from './useControllerActionRun.js';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export interface UseControllerActionCancelReturn {
|
|
2
|
+
/** Whether the cancel button should be hidden. */
|
|
3
|
+
isHidden: boolean;
|
|
4
|
+
/** Whether the cancel button should be disabled. */
|
|
5
|
+
isDisabled: boolean;
|
|
6
|
+
/** Whether the cancel button should show a loading indicator. */
|
|
7
|
+
isLoading: boolean;
|
|
8
|
+
/** Cancel the running exercise. */
|
|
9
|
+
cancel: () => void;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Provides state and handler for the exercise runner's "cancel" action.
|
|
13
|
+
*/
|
|
14
|
+
export declare const useControllerActionCancel: () => UseControllerActionCancelReturn;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { toConsumableArray as _toConsumableArray } from '../../../../_virtual/_rollupPluginBabelHelpers.js';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { EliceWebSocket } from '@elice/websocket';
|
|
4
|
+
import { useRecoilValue } from 'recoil';
|
|
5
|
+
import { ExerciseRunnerContext } from '../ExerciseRunnerContext.js';
|
|
6
|
+
import { exerciseActiveFilenameState, exerciseWebSocketTotalStatusQuery, exerciseRunnerRunningState } from '../../context/recoil.js';
|
|
7
|
+
import { useExerciseFileEditable } from '../../../../hooks/useExerciseFile.js';
|
|
8
|
+
|
|
9
|
+
//
|
|
10
|
+
//
|
|
11
|
+
//
|
|
12
|
+
/**
|
|
13
|
+
* Provides state and handler for the exercise runner's "cancel" action.
|
|
14
|
+
*/
|
|
15
|
+
var useControllerActionCancel = function useControllerActionCancel() {
|
|
16
|
+
var _return = React.useRef({});
|
|
17
|
+
var _React$useContext = React.useContext(ExerciseRunnerContext),
|
|
18
|
+
onCancel = _React$useContext.onCancel;
|
|
19
|
+
var activeFilename = useRecoilValue(exerciseActiveFilenameState);
|
|
20
|
+
var isFileEditable = useExerciseFileEditable(activeFilename);
|
|
21
|
+
var runnerWebsocketStatus = useRecoilValue(exerciseWebSocketTotalStatusQuery([].concat(_toConsumableArray(isFileEditable ? ['usercodeEdit'] : []), ['runnerRoom', 'stdio'])));
|
|
22
|
+
var isRunning = useRecoilValue(exerciseRunnerRunningState);
|
|
23
|
+
var isConnecting = runnerWebsocketStatus === EliceWebSocket.CONNECTING;
|
|
24
|
+
var isNotReady = runnerWebsocketStatus !== EliceWebSocket.OPEN;
|
|
25
|
+
var isHidden = !isRunning;
|
|
26
|
+
var isDisabled = isHidden || isNotReady || isConnecting;
|
|
27
|
+
var isLoading = isConnecting;
|
|
28
|
+
/**
|
|
29
|
+
*
|
|
30
|
+
*/
|
|
31
|
+
var cancel = React.useCallback(function () {
|
|
32
|
+
if (!isDisabled) {
|
|
33
|
+
onCancel();
|
|
34
|
+
}
|
|
35
|
+
}, [isDisabled, onCancel]);
|
|
36
|
+
//
|
|
37
|
+
//
|
|
38
|
+
//
|
|
39
|
+
_return.current.isHidden = isHidden;
|
|
40
|
+
_return.current.isDisabled = isDisabled;
|
|
41
|
+
_return.current.isLoading = isLoading;
|
|
42
|
+
_return.current.cancel = cancel;
|
|
43
|
+
return _return.current;
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
export { useControllerActionCancel };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export interface UseControllerActionGradeReturn {
|
|
2
|
+
/** Whether the grade button should be hidden. */
|
|
3
|
+
isHidden: boolean;
|
|
4
|
+
/** Whether the grade button should be disabled. */
|
|
5
|
+
isDisabled: boolean;
|
|
6
|
+
/** Whether the grade button should show a loading indicator. */
|
|
7
|
+
isLoading: boolean;
|
|
8
|
+
/** Whether grading is disallowed for this exercise (used to show tooltip). */
|
|
9
|
+
isNoGrade: boolean;
|
|
10
|
+
/** Submit the exercise to grade. Resolves when the submission completes. */
|
|
11
|
+
grade: () => Promise<void>;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Provides state and handler for the exercise runner's "grade" action.
|
|
15
|
+
*/
|
|
16
|
+
export declare const useControllerActionGrade: () => UseControllerActionGradeReturn;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { toConsumableArray as _toConsumableArray, asyncToGenerator as _asyncToGenerator, regenerator as _regenerator } from '../../../../_virtual/_rollupPluginBabelHelpers.js';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { enums } from '@elice/types';
|
|
4
|
+
import { EliceWebSocket } from '@elice/websocket';
|
|
5
|
+
import { useRecoilValue } from 'recoil';
|
|
6
|
+
import { ExerciseRunnerContext } from '../ExerciseRunnerContext.js';
|
|
7
|
+
import { exerciseActiveFilenameState, exerciseWebSocketTotalStatusQuery, exerciseState, exerciseRunnerRunTypeState, exerciseLectureState, exerciseRunnerSubmittingState, exerciseRunnerRunningState } from '../../context/recoil.js';
|
|
8
|
+
import { ExerciseContext } from '../../context/context.js';
|
|
9
|
+
import { useExerciseFileEditable } from '../../../../hooks/useExerciseFile.js';
|
|
10
|
+
|
|
11
|
+
//
|
|
12
|
+
//
|
|
13
|
+
//
|
|
14
|
+
/**
|
|
15
|
+
* Provides state and handler for the exercise runner's "grade" action.
|
|
16
|
+
*/
|
|
17
|
+
var useControllerActionGrade = function useControllerActionGrade() {
|
|
18
|
+
var _return = React.useRef({});
|
|
19
|
+
var _React$useContext = React.useContext(ExerciseContext),
|
|
20
|
+
materialExerciseId = _React$useContext.materialExerciseId;
|
|
21
|
+
var _React$useContext2 = React.useContext(ExerciseRunnerContext),
|
|
22
|
+
onSubmit = _React$useContext2.onSubmit;
|
|
23
|
+
var activeFilename = useRecoilValue(exerciseActiveFilenameState);
|
|
24
|
+
var isFileEditable = useExerciseFileEditable(activeFilename);
|
|
25
|
+
var runnerWebsocketStatus = useRecoilValue(exerciseWebSocketTotalStatusQuery([].concat(_toConsumableArray(isFileEditable ? ['usercodeEdit'] : []), ['runnerRoom', 'stdio'])));
|
|
26
|
+
var exercise = useRecoilValue(exerciseState(materialExerciseId));
|
|
27
|
+
var exerciseRunType = useRecoilValue(exerciseRunnerRunTypeState);
|
|
28
|
+
var isNoGrade = Boolean(exercise === null || exercise === void 0 ? void 0 : exercise.isNoSubmitGrade);
|
|
29
|
+
var lecture = useRecoilValue(exerciseLectureState(exercise === null || exercise === void 0 ? void 0 : exercise._lectureId));
|
|
30
|
+
var isTestLecture = (lecture === null || lecture === void 0 ? void 0 : lecture.lectureType) === enums.LectureType.Test;
|
|
31
|
+
var isTestLectureCompleted = (lecture === null || lecture === void 0 ? void 0 : lecture.testAdmissionStatus) === enums.TestAdmissionStatus.Completed;
|
|
32
|
+
var isSubmitting = useRecoilValue(exerciseRunnerSubmittingState);
|
|
33
|
+
var isRunning = useRecoilValue(exerciseRunnerRunningState);
|
|
34
|
+
var isConnecting = runnerWebsocketStatus === EliceWebSocket.CONNECTING;
|
|
35
|
+
var isNotReady = runnerWebsocketStatus !== EliceWebSocket.OPEN;
|
|
36
|
+
var isHidden = isRunning;
|
|
37
|
+
var isDisabled = isHidden || isNoGrade || isTestLecture && isTestLectureCompleted || isNotReady || isConnecting || isSubmitting;
|
|
38
|
+
var isLoading = isConnecting || isSubmitting && exerciseRunType === enums.ExerciseRunType.Grade;
|
|
39
|
+
/**
|
|
40
|
+
*
|
|
41
|
+
*/
|
|
42
|
+
var grade = React.useCallback(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
|
|
43
|
+
return _regenerator().w(function (_context) {
|
|
44
|
+
while (1) switch (_context.n) {
|
|
45
|
+
case 0:
|
|
46
|
+
if (isDisabled) {
|
|
47
|
+
_context.n = 1;
|
|
48
|
+
break;
|
|
49
|
+
}
|
|
50
|
+
_context.n = 1;
|
|
51
|
+
return onSubmit(enums.ExerciseRunType.Grade);
|
|
52
|
+
case 1:
|
|
53
|
+
return _context.a(2);
|
|
54
|
+
}
|
|
55
|
+
}, _callee);
|
|
56
|
+
})), [isDisabled, onSubmit]);
|
|
57
|
+
//
|
|
58
|
+
//
|
|
59
|
+
//
|
|
60
|
+
_return.current.isHidden = isHidden;
|
|
61
|
+
_return.current.isDisabled = isDisabled;
|
|
62
|
+
_return.current.isLoading = isLoading;
|
|
63
|
+
_return.current.isNoGrade = isNoGrade;
|
|
64
|
+
_return.current.grade = grade;
|
|
65
|
+
return _return.current;
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
export { useControllerActionGrade };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export interface UseControllerActionRunReturn {
|
|
2
|
+
/** Whether the run button should be hidden. */
|
|
3
|
+
isHidden: boolean;
|
|
4
|
+
/** Whether the run button should be disabled. */
|
|
5
|
+
isDisabled: boolean;
|
|
6
|
+
/** Whether the run button should show a loading indicator. */
|
|
7
|
+
isLoading: boolean;
|
|
8
|
+
/** Submit the exercise to run. Resolves when the submission completes. */
|
|
9
|
+
run: () => Promise<void>;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Provides state and handler for the exercise runner's "run" action.
|
|
13
|
+
*/
|
|
14
|
+
export declare const useControllerActionRun: () => UseControllerActionRunReturn;
|