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