@elice/material-runbox 1.240718.3 → 1.240719.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/_virtual/_rollupPluginBabelHelpers.js +386 -0
- package/cjs/assets/queue.gif.js +1 -2
- package/cjs/assets/runbox_logo.png.js +1 -2
- package/cjs/assets/terminated.png.js +1 -2
- package/cjs/components/material-runbox/MaterialRunbox.js +24 -20
- package/cjs/components/material-runbox/MaterialRunboxBody.js +10 -4
- package/cjs/components/material-runbox/MaterialRunboxContent.js +132 -103
- package/cjs/components/material-runbox/MaterialRunboxFooter.js +27 -18
- package/cjs/components/material-runbox/MaterialRunboxHeader.js +103 -87
- package/cjs/components/material-runbox/actions/MaterialRunboxActionAutoShutdown.js +31 -27
- package/cjs/components/material-runbox/actions/MaterialRunboxActionGrade.js +242 -159
- package/cjs/components/material-runbox/actions/MaterialRunboxActionMenu.js +32 -28
- package/cjs/components/material-runbox/actions/MaterialRunboxActionReset.js +125 -76
- package/cjs/components/material-runbox/actions/MaterialRunboxActionRestart.js +84 -53
- package/cjs/components/material-runbox/actions/MaterialRunboxActionShare.js +40 -28
- package/cjs/components/material-runbox/contexts/MaterialRunboxApiContext.js +27 -15
- package/cjs/components/material-runbox/contexts/MaterialRunboxCommandContext.js +52 -36
- package/cjs/components/material-runbox/contexts/MaterialRunboxContext.js +11 -8
- package/cjs/components/material-runbox/contexts/index.js +17 -0
- package/cjs/components/material-runbox/hooks/index.js +7 -0
- package/cjs/components/material-runbox/hooks/useRunboxControl.js +62 -38
- package/cjs/components/material-runbox/index.js +7 -0
- package/cjs/components/material-runbox/locales/index.js +13 -0
- package/cjs/components/material-runbox/runtime/Runtime.js +25 -17
- package/cjs/components/material-runbox/runtime/RuntimeOverlayAssigned.js +33 -29
- package/cjs/components/material-runbox/runtime/RuntimeOverlayQueued.js +40 -39
- package/cjs/components/material-runbox/runtime/RuntimeOverlayTerminated.js +72 -57
- package/es/_virtual/_rollupPluginBabelHelpers.js +377 -0
- package/es/assets/queue.gif.js +1 -2
- package/es/assets/runbox_logo.png.js +1 -2
- package/es/assets/terminated.png.js +1 -2
- package/es/components/material-runbox/MaterialRunbox.js +24 -20
- package/es/components/material-runbox/MaterialRunboxBody.js +6 -4
- package/es/components/material-runbox/MaterialRunboxContent.js +128 -103
- package/es/components/material-runbox/MaterialRunboxFooter.js +23 -18
- package/es/components/material-runbox/MaterialRunboxHeader.js +99 -88
- package/es/components/material-runbox/actions/MaterialRunboxActionAutoShutdown.js +27 -27
- package/es/components/material-runbox/actions/MaterialRunboxActionGrade.js +237 -159
- package/es/components/material-runbox/actions/MaterialRunboxActionMenu.js +28 -28
- package/es/components/material-runbox/actions/MaterialRunboxActionReset.js +121 -76
- package/es/components/material-runbox/actions/MaterialRunboxActionRestart.js +80 -53
- package/es/components/material-runbox/actions/MaterialRunboxActionShare.js +36 -28
- package/es/components/material-runbox/contexts/MaterialRunboxApiContext.js +22 -14
- package/es/components/material-runbox/contexts/MaterialRunboxCommandContext.js +47 -35
- package/es/components/material-runbox/contexts/MaterialRunboxContext.js +6 -7
- package/es/components/material-runbox/contexts/index.js +3 -0
- package/es/components/material-runbox/hooks/index.js +1 -0
- package/es/components/material-runbox/hooks/useRunboxControl.js +62 -38
- package/es/components/material-runbox/index.js +1 -0
- package/es/components/material-runbox/locales/index.js +4 -0
- package/es/components/material-runbox/runtime/Runtime.js +21 -17
- package/es/components/material-runbox/runtime/RuntimeOverlayAssigned.js +34 -30
- package/es/components/material-runbox/runtime/RuntimeOverlayQueued.js +41 -40
- package/es/components/material-runbox/runtime/RuntimeOverlayTerminated.js +69 -58
- package/package.json +8 -11
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { slicedToArray as _slicedToArray } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
1
2
|
import _styled from '@emotion/styled/base';
|
|
2
|
-
import
|
|
3
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
3
4
|
import { Spinner } from '@elice/blocks';
|
|
4
5
|
import { useRawEliceIntl } from '@elice/intl';
|
|
5
6
|
import { EliceRunboxProvider } from '@elice/runbox-client';
|
|
@@ -17,11 +18,11 @@ function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringif
|
|
|
17
18
|
//
|
|
18
19
|
//
|
|
19
20
|
//
|
|
20
|
-
|
|
21
|
+
var DEFAULT_DATA = [null, null, null];
|
|
21
22
|
//
|
|
22
23
|
//
|
|
23
24
|
//
|
|
24
|
-
|
|
25
|
+
var StyledRunboxContainer = /*#__PURE__*/_styled("div", {
|
|
25
26
|
target: "eeh98mq0"
|
|
26
27
|
})("production" === "production" ? {
|
|
27
28
|
name: "t5t5sq",
|
|
@@ -34,122 +35,146 @@ const StyledRunboxContainer = /*#__PURE__*/_styled("div", {
|
|
|
34
35
|
//
|
|
35
36
|
//
|
|
36
37
|
//
|
|
37
|
-
|
|
38
|
-
runboxId,
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
} = useMaterialRunboxContext();
|
|
45
|
-
const materialRunboxApi = useMaterialRunboxApiContext();
|
|
38
|
+
var MaterialRunboxContent = function MaterialRunboxContent(_ref) {
|
|
39
|
+
var runboxId = _ref.runboxId,
|
|
40
|
+
courseId = _ref.courseId;
|
|
41
|
+
var intl = useRawEliceIntl();
|
|
42
|
+
var _useMaterialRunboxCon = useMaterialRunboxContext(),
|
|
43
|
+
showMessenger = _useMaterialRunboxCon.showMessenger;
|
|
44
|
+
var materialRunboxApi = useMaterialRunboxApiContext();
|
|
46
45
|
//
|
|
47
46
|
//
|
|
48
47
|
//
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
48
|
+
var _useQuery = useQuery({
|
|
49
|
+
enabled: Boolean(runboxId),
|
|
50
|
+
queryKey: ['eliceMaterialRunboxRunboxApi.runboxRunboxIdGet', 'eliceMaterialRunboxRuntimeTemplateApi.runtimeTemplateRuntimeTemplateIdGet', runboxId, courseId],
|
|
51
|
+
queryFn: function queryFn(_ref2) {
|
|
52
|
+
var signal = _ref2.signal;
|
|
53
|
+
return materialRunboxApi.runbox.runboxRunboxIdGet({
|
|
54
|
+
runboxId: runboxId,
|
|
55
|
+
eliceCourseId: courseId
|
|
56
|
+
}, {
|
|
57
|
+
signal: signal
|
|
58
|
+
}).then(function (runbox) {
|
|
59
|
+
return Promise.all([
|
|
60
|
+
// runbox
|
|
61
|
+
runbox,
|
|
62
|
+
// runtime
|
|
63
|
+
materialRunboxApi.runtime.runtimeGet({
|
|
64
|
+
filterImageId: runbox.imageId,
|
|
65
|
+
filterRuntimeTemplateId: runbox.runtimeTemplateId,
|
|
66
|
+
skip: 0,
|
|
67
|
+
count: 1,
|
|
68
|
+
eliceCourseId: courseId
|
|
69
|
+
}, {
|
|
70
|
+
signal: signal
|
|
71
|
+
}).then(function (runtimes) {
|
|
72
|
+
var _a;
|
|
73
|
+
return (_a = runtimes[0]) !== null && _a !== void 0 ? _a : null;
|
|
74
|
+
}),
|
|
75
|
+
// runtimeTemplate
|
|
76
|
+
materialRunboxApi.runtimeTemplate.runtimeTemplateRuntimeTemplateIdGet({
|
|
77
|
+
runtimeTemplateId: runbox.runtimeTemplateId,
|
|
78
|
+
eliceCourseId: courseId
|
|
79
|
+
}, {
|
|
80
|
+
signal: signal
|
|
81
|
+
})]);
|
|
82
|
+
});
|
|
83
|
+
},
|
|
84
|
+
cacheTime: 0,
|
|
85
|
+
keepPreviousData: true,
|
|
86
|
+
refetchOnWindowFocus: false
|
|
79
87
|
}),
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
refetchOnWindowFocus: false
|
|
90
|
-
});
|
|
88
|
+
_useQuery$data = _useQuery.data,
|
|
89
|
+
_useQuery$data2 = _useQuery$data === void 0 ? DEFAULT_DATA : _useQuery$data,
|
|
90
|
+
_useQuery$data3 = _slicedToArray(_useQuery$data2, 3),
|
|
91
|
+
runbox = _useQuery$data3[0],
|
|
92
|
+
runtime = _useQuery$data3[1],
|
|
93
|
+
runtimeTemplate = _useQuery$data3[2],
|
|
94
|
+
isInitialLoading = _useQuery.isInitialLoading,
|
|
95
|
+
isError = _useQuery.isError,
|
|
96
|
+
refetch = _useQuery.refetch;
|
|
91
97
|
//
|
|
92
98
|
//
|
|
93
99
|
//
|
|
94
100
|
if (isInitialLoading) {
|
|
95
|
-
return
|
|
101
|
+
return jsx(StyledRunboxContainer, {
|
|
102
|
+
children: jsx(Spinner, {})
|
|
103
|
+
});
|
|
96
104
|
}
|
|
97
105
|
if (isError) {
|
|
98
|
-
return
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
106
|
+
return jsx(StyledRunboxContainer, {
|
|
107
|
+
children: jsxs(Stack, {
|
|
108
|
+
gap: "1.5rem",
|
|
109
|
+
children: [jsx(Typography, {
|
|
110
|
+
variant: "h6",
|
|
111
|
+
children: intl.formatMessage({
|
|
112
|
+
id: 'runbox.runtime.message.startError'
|
|
113
|
+
})
|
|
114
|
+
}), jsxs(Stack, {
|
|
115
|
+
gap: "0.5rem",
|
|
116
|
+
children: [jsx(Button, {
|
|
117
|
+
startIcon: jsx(Refresh, {}),
|
|
118
|
+
onClick: function onClick() {
|
|
119
|
+
return refetch();
|
|
120
|
+
},
|
|
121
|
+
children: intl.formatMessage({
|
|
122
|
+
id: 'runbox.common.retry'
|
|
123
|
+
})
|
|
124
|
+
}), typeof showMessenger === 'function' ? jsx(Button, {
|
|
125
|
+
variant: "outlined",
|
|
126
|
+
onClick: function onClick() {
|
|
127
|
+
return showMessenger();
|
|
128
|
+
},
|
|
129
|
+
children: intl.formatMessage({
|
|
130
|
+
id: 'runbox.common.support'
|
|
131
|
+
})
|
|
132
|
+
}) : null]
|
|
133
|
+
})]
|
|
134
|
+
})
|
|
135
|
+
});
|
|
117
136
|
}
|
|
118
137
|
if (!runbox || !runtimeTemplate) {
|
|
119
138
|
return null;
|
|
120
139
|
}
|
|
121
|
-
|
|
122
|
-
runbox,
|
|
123
|
-
runtime,
|
|
124
|
-
runtimeTemplate,
|
|
125
|
-
courseId,
|
|
126
|
-
refetch
|
|
140
|
+
var props = {
|
|
141
|
+
runbox: runbox,
|
|
142
|
+
runtime: runtime,
|
|
143
|
+
runtimeTemplate: runtimeTemplate,
|
|
144
|
+
courseId: courseId,
|
|
145
|
+
refetch: refetch
|
|
127
146
|
};
|
|
128
|
-
return
|
|
147
|
+
return jsx(MaterialRunboxCommandContextProvider, {
|
|
129
148
|
runtime: runtime,
|
|
130
|
-
courseId: courseId
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
149
|
+
courseId: courseId,
|
|
150
|
+
children: jsx(EliceRunboxProvider, {
|
|
151
|
+
runboxId: runbox.id,
|
|
152
|
+
runboxApiHeartbeat: function runboxApiHeartbeat(_ref3) {
|
|
153
|
+
var id = _ref3.id,
|
|
154
|
+
signal = _ref3.signal;
|
|
155
|
+
return materialRunboxApi.runbox.runboxRunboxIdHeartbeatPost({
|
|
156
|
+
runboxId: id,
|
|
157
|
+
eliceCourseId: courseId
|
|
158
|
+
}, {
|
|
159
|
+
signal: signal
|
|
160
|
+
});
|
|
161
|
+
},
|
|
162
|
+
runboxApiQuota: function runboxApiQuota(_ref4) {
|
|
163
|
+
var id = _ref4.id,
|
|
164
|
+
signal = _ref4.signal;
|
|
165
|
+
return materialRunboxApi.runbox.runboxRunboxIdQuotaGet({
|
|
166
|
+
runboxId: id,
|
|
167
|
+
eliceCourseId: courseId
|
|
168
|
+
}, {
|
|
169
|
+
signal: signal
|
|
170
|
+
});
|
|
171
|
+
},
|
|
172
|
+
onRunboxRefetchRequest: refetch,
|
|
173
|
+
children: jsxs(StyledRunboxContainer, {
|
|
174
|
+
children: [jsx(MaterialRunboxHeader, Object.assign({}, props)), jsx(MaterialRunboxBody, Object.assign({}, props)), jsx(MaterialRunboxFooter, Object.assign({}, props))]
|
|
175
|
+
})
|
|
176
|
+
})
|
|
177
|
+
});
|
|
153
178
|
};
|
|
154
179
|
|
|
155
180
|
export { MaterialRunboxContent as default };
|
|
@@ -1,48 +1,53 @@
|
|
|
1
1
|
import _styled from '@emotion/styled/base';
|
|
2
|
-
import
|
|
2
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
3
|
import { EliceRunboxResourceStat, EliceRunboxRemainingTimer, EliceRunboxNetworkStat, EliceRunboxRunningStatus } from '@elice/runbox-client';
|
|
4
4
|
import { Box, Stack, Divider } from '@mui/material';
|
|
5
5
|
|
|
6
6
|
//
|
|
7
7
|
//
|
|
8
8
|
//
|
|
9
|
-
|
|
9
|
+
var StyledFooter = /*#__PURE__*/_styled("div", {
|
|
10
10
|
target: "e9lbhtr0"
|
|
11
|
-
})("position:relative;flex:0 0 2rem;display:flex;justify-content:space-between;align-items:center;padding:0 1rem;width:100%;border-top:1px solid ", ({
|
|
12
|
-
theme
|
|
13
|
-
|
|
11
|
+
})("position:relative;flex:0 0 2rem;display:flex;justify-content:space-between;align-items:center;padding:0 1rem;width:100%;border-top:1px solid ", function (_ref) {
|
|
12
|
+
var theme = _ref.theme;
|
|
13
|
+
return theme.palette.divider;
|
|
14
|
+
}, ";");
|
|
14
15
|
//
|
|
15
16
|
//
|
|
16
17
|
//
|
|
17
|
-
|
|
18
|
-
runtimeTemplate
|
|
19
|
-
}) => {
|
|
18
|
+
var MaterialRunboxFooter = function MaterialRunboxFooter(_ref2) {
|
|
19
|
+
var runtimeTemplate = _ref2.runtimeTemplate;
|
|
20
20
|
/**
|
|
21
21
|
* Resource stats
|
|
22
22
|
*/
|
|
23
|
-
|
|
23
|
+
var renderFooterResourceStats = function renderFooterResourceStats() {
|
|
24
24
|
var _a, _b;
|
|
25
|
-
return
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
return jsx(Box, {
|
|
26
|
+
children: jsx(EliceRunboxResourceStat, {
|
|
27
|
+
gpu: ((_b = (_a = runtimeTemplate.gpus) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0) > 0
|
|
28
|
+
})
|
|
29
|
+
});
|
|
28
30
|
};
|
|
29
31
|
/**
|
|
30
32
|
* Status
|
|
31
33
|
*/
|
|
32
|
-
|
|
33
|
-
return
|
|
34
|
+
var renderFooterStatus = function renderFooterStatus() {
|
|
35
|
+
return jsxs(Stack, {
|
|
34
36
|
direction: "row",
|
|
35
37
|
gap: "0.5rem",
|
|
36
|
-
divider:
|
|
38
|
+
divider: jsx(Divider, {
|
|
37
39
|
orientation: "vertical",
|
|
38
40
|
flexItem: true
|
|
39
|
-
})
|
|
40
|
-
|
|
41
|
+
}),
|
|
42
|
+
children: [jsx(EliceRunboxRemainingTimer, {}), jsx(EliceRunboxNetworkStat, {}), jsx(EliceRunboxRunningStatus, {})]
|
|
43
|
+
});
|
|
41
44
|
};
|
|
42
45
|
//
|
|
43
46
|
//
|
|
44
47
|
//
|
|
45
|
-
return
|
|
48
|
+
return jsxs(StyledFooter, {
|
|
49
|
+
children: [renderFooterResourceStats(), renderFooterStatus()]
|
|
50
|
+
});
|
|
46
51
|
};
|
|
47
52
|
|
|
48
53
|
export { MaterialRunboxFooter as default };
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import { slicedToArray as _slicedToArray } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
1
2
|
import _styled from '@emotion/styled/base';
|
|
3
|
+
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
2
4
|
import React from 'react';
|
|
3
5
|
import { useRawEliceIntl } from '@elice/intl';
|
|
4
6
|
import { Tag, EliceIcon } from '@elice/mui-elements';
|
|
@@ -13,77 +15,80 @@ import MaterialRunboxActionMenu from './actions/MaterialRunboxActionMenu.js';
|
|
|
13
15
|
import { useMaterialRunboxApiContext } from './contexts/MaterialRunboxApiContext.js';
|
|
14
16
|
import './contexts/MaterialRunboxCommandContext.js';
|
|
15
17
|
import { useMaterialRunboxContext } from './contexts/MaterialRunboxContext.js';
|
|
16
|
-
import
|
|
18
|
+
import img from '../../assets/runbox_logo.png.js';
|
|
17
19
|
|
|
18
|
-
|
|
20
|
+
var StyledHeader = /*#__PURE__*/_styled("div", {
|
|
19
21
|
target: "e110d0bp0"
|
|
20
|
-
})("position:relative;flex:0 0 3rem;display:flex;justify-content:space-between;align-items:center;padding:0 1rem;width:100%;border-bottom:1px solid ", ({
|
|
21
|
-
theme
|
|
22
|
-
|
|
22
|
+
})("position:relative;flex:0 0 3rem;display:flex;justify-content:space-between;align-items:center;padding:0 1rem;width:100%;border-bottom:1px solid ", function (_ref) {
|
|
23
|
+
var theme = _ref.theme;
|
|
24
|
+
return theme.palette.divider;
|
|
25
|
+
}, ";overflow:hidden;");
|
|
23
26
|
//
|
|
24
27
|
//
|
|
25
28
|
//
|
|
26
|
-
|
|
27
|
-
runbox,
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
29
|
+
var MaterialRunboxHeader = function MaterialRunboxHeader(_ref2) {
|
|
30
|
+
var runbox = _ref2.runbox,
|
|
31
|
+
runtime = _ref2.runtime,
|
|
32
|
+
runtimeTemplate = _ref2.runtimeTemplate,
|
|
33
|
+
courseId = _ref2.courseId,
|
|
34
|
+
refetch = _ref2.refetch;
|
|
35
|
+
var intl = useRawEliceIntl();
|
|
36
|
+
var _useMaterialRunboxCon = useMaterialRunboxContext(),
|
|
37
|
+
enableAutoShutdownToggle = _useMaterialRunboxCon.enableAutoShutdownToggle;
|
|
38
|
+
var _React$useState = React.useState(null),
|
|
39
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
40
|
+
menuAnchorEl = _React$useState2[0],
|
|
41
|
+
setMenuAnchorEl = _React$useState2[1];
|
|
42
|
+
var _useEliceRunboxRunnin = useEliceRunboxRunning(),
|
|
43
|
+
status = _useEliceRunboxRunnin.status;
|
|
44
|
+
var isRunboxRunning = status === 'running';
|
|
42
45
|
/**
|
|
43
46
|
*
|
|
44
47
|
*/
|
|
45
|
-
|
|
48
|
+
var handleMenuClose = function handleMenuClose() {
|
|
46
49
|
setMenuAnchorEl(null);
|
|
47
50
|
};
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
51
|
+
var materialRunboxApi = useMaterialRunboxApiContext();
|
|
52
|
+
var _useQuery = useQuery({
|
|
53
|
+
queryKey: ['eliceMaterialRunboxRunboxApi.runboxRunboxIdSubmitInfoGet', {
|
|
54
|
+
courseId: courseId,
|
|
55
|
+
runtime: runtime
|
|
56
|
+
}],
|
|
57
|
+
queryFn: function queryFn(_ref3) {
|
|
58
|
+
var signal = _ref3.signal;
|
|
59
|
+
return materialRunboxApi.runbox.runboxRunboxIdSubmitInfoGet({
|
|
60
|
+
eliceCourseId: courseId,
|
|
61
|
+
runboxId: runtime === null || runtime === void 0 ? void 0 : runtime.runboxId
|
|
62
|
+
}, {
|
|
63
|
+
signal: signal
|
|
64
|
+
});
|
|
65
|
+
},
|
|
66
|
+
refetchInterval: function refetchInterval(data) {
|
|
67
|
+
return !(data === null || data === void 0 ? void 0 : data.remainSubmitCount) ? false : 5 * 1000;
|
|
68
|
+
},
|
|
69
|
+
enabled: Boolean(runtime === null || runtime === void 0 ? void 0 : runtime.runboxId),
|
|
70
|
+
retry: false
|
|
64
71
|
}),
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
retry: false
|
|
68
|
-
});
|
|
72
|
+
leaderboardSubmitInfo = _useQuery.data,
|
|
73
|
+
isLeaderboardSubmitInfoLoading = _useQuery.isLoading;
|
|
69
74
|
/**
|
|
70
75
|
*
|
|
71
76
|
*/
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
+
var renderHeaderSubmitInfo = function renderHeaderSubmitInfo() {
|
|
78
|
+
var remainSubmitCount = leaderboardSubmitInfo === null || leaderboardSubmitInfo === void 0 ? void 0 : leaderboardSubmitInfo.remainSubmitCount;
|
|
79
|
+
var totalSubmitCount = leaderboardSubmitInfo === null || leaderboardSubmitInfo === void 0 ? void 0 : leaderboardSubmitInfo.submitCountLimit;
|
|
80
|
+
var isDailyLimitEnabled = leaderboardSubmitInfo === null || leaderboardSubmitInfo === void 0 ? void 0 : leaderboardSubmitInfo.dailyLimitEnabled;
|
|
81
|
+
var isIndividualTypeLeaderboard = (leaderboardSubmitInfo === null || leaderboardSubmitInfo === void 0 ? void 0 : leaderboardSubmitInfo.entryType) === enums.LeaderboardEntryType.Individual;
|
|
77
82
|
if (isLeaderboardSubmitInfoLoading || remainSubmitCount === null) {
|
|
78
83
|
return null;
|
|
79
84
|
}
|
|
80
|
-
return
|
|
85
|
+
return jsx(Tag, {
|
|
81
86
|
label: intl.formatMessage({
|
|
82
87
|
id: 'runbox.header.submitInfo'
|
|
83
88
|
}, {
|
|
84
89
|
remainCount: remainSubmitCount,
|
|
85
90
|
totalCount: totalSubmitCount,
|
|
86
|
-
isDailyLimitEnabled,
|
|
91
|
+
isDailyLimitEnabled: isDailyLimitEnabled,
|
|
87
92
|
isIndividual: isIndividualTypeLeaderboard
|
|
88
93
|
}),
|
|
89
94
|
variant: "muted",
|
|
@@ -93,11 +98,11 @@ const MaterialRunboxHeader = ({
|
|
|
93
98
|
/**
|
|
94
99
|
*
|
|
95
100
|
*/
|
|
96
|
-
|
|
101
|
+
var renderHeaderActionAutoShutdown = function renderHeaderActionAutoShutdown() {
|
|
97
102
|
if (!enableAutoShutdownToggle) {
|
|
98
103
|
return null;
|
|
99
104
|
}
|
|
100
|
-
return
|
|
105
|
+
return jsx(MaterialRunboxActionAutoShutdown, {
|
|
101
106
|
runtime: runtime,
|
|
102
107
|
runtimeTemplate: runtimeTemplate,
|
|
103
108
|
courseId: courseId,
|
|
@@ -107,11 +112,11 @@ const MaterialRunboxHeader = ({
|
|
|
107
112
|
/**
|
|
108
113
|
*
|
|
109
114
|
*/
|
|
110
|
-
|
|
115
|
+
var renderHeaderActionGrade = function renderHeaderActionGrade() {
|
|
111
116
|
if (!runbox.submission.enabled) {
|
|
112
117
|
return null;
|
|
113
118
|
}
|
|
114
|
-
return
|
|
119
|
+
return jsx(MaterialRunboxActionGrade, {
|
|
115
120
|
runtime: runtime,
|
|
116
121
|
courseId: courseId
|
|
117
122
|
});
|
|
@@ -119,45 +124,51 @@ const MaterialRunboxHeader = ({
|
|
|
119
124
|
/**
|
|
120
125
|
*
|
|
121
126
|
*/
|
|
122
|
-
|
|
123
|
-
return
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
127
|
+
var renderOptionMenu = function renderOptionMenu() {
|
|
128
|
+
return jsxs(Fragment, {
|
|
129
|
+
children: [jsx(IconButton, {
|
|
130
|
+
disabled: !isRunboxRunning,
|
|
131
|
+
onClick: function onClick(e) {
|
|
132
|
+
if (Boolean(menuAnchorEl)) {
|
|
133
|
+
setMenuAnchorEl(null);
|
|
134
|
+
} else {
|
|
135
|
+
setMenuAnchorEl(e.currentTarget);
|
|
136
|
+
}
|
|
137
|
+
},
|
|
138
|
+
children: jsx(EliceIcon, {
|
|
139
|
+
icon: faEllipsisVertical
|
|
140
|
+
})
|
|
141
|
+
}), jsx(MaterialRunboxActionMenu, {
|
|
142
|
+
runbox: runbox,
|
|
143
|
+
runtime: runtime,
|
|
144
|
+
courseId: courseId,
|
|
145
|
+
menuAnchorEl: menuAnchorEl,
|
|
146
|
+
refetch: refetch,
|
|
147
|
+
handleMenuClose: handleMenuClose
|
|
148
|
+
})]
|
|
149
|
+
});
|
|
142
150
|
};
|
|
143
151
|
//
|
|
144
152
|
//
|
|
145
153
|
//
|
|
146
|
-
return
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
154
|
+
return jsxs(StyledHeader, {
|
|
155
|
+
children: [jsx(Box, {
|
|
156
|
+
component: "img",
|
|
157
|
+
src: img,
|
|
158
|
+
alt: "elice runbox",
|
|
159
|
+
sx: {
|
|
160
|
+
width: 'auto',
|
|
161
|
+
height: '100%',
|
|
162
|
+
imageRendering: 'auto',
|
|
163
|
+
padding: '0.465rem 0'
|
|
164
|
+
}
|
|
165
|
+
}), jsxs(Stack, {
|
|
166
|
+
direction: "row",
|
|
167
|
+
alignItems: "center",
|
|
168
|
+
gap: "0.5rem",
|
|
169
|
+
children: [renderHeaderSubmitInfo(), renderHeaderActionAutoShutdown(), renderOptionMenu(), renderHeaderActionGrade()]
|
|
170
|
+
})]
|
|
171
|
+
});
|
|
161
172
|
};
|
|
162
173
|
|
|
163
174
|
export { MaterialRunboxHeader as default };
|