@elice/material-runbox 1.231212.0 → 1.231228.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/assets/queue.gif.js +1 -1
- package/cjs/assets/runbox_logo.png.js +1 -1
- package/cjs/assets/terminated.png.js +1 -1
- package/cjs/components/material-runbox/MaterialRunbox.js +17 -19
- package/cjs/components/material-runbox/MaterialRunboxBody.js +15 -12
- package/cjs/components/material-runbox/MaterialRunboxContent.js +94 -101
- package/cjs/components/material-runbox/MaterialRunboxFooter.js +17 -22
- package/cjs/components/material-runbox/MaterialRunboxHeader.d.ts +3 -0
- package/cjs/components/material-runbox/MaterialRunboxHeader.js +77 -81
- package/cjs/components/material-runbox/actions/MaterialRunboxActionAutoShutdown.js +26 -22
- package/cjs/components/material-runbox/actions/MaterialRunboxActionGrade.js +140 -180
- package/cjs/components/material-runbox/actions/MaterialRunboxActionMenu.d.ts +8 -0
- package/cjs/components/material-runbox/actions/MaterialRunboxActionMenu.js +65 -0
- package/cjs/components/material-runbox/actions/MaterialRunboxActionReset.d.ts +3 -1
- package/cjs/components/material-runbox/actions/MaterialRunboxActionReset.js +73 -110
- package/cjs/components/material-runbox/actions/MaterialRunboxActionRestart.d.ts +3 -1
- package/cjs/components/material-runbox/actions/MaterialRunboxActionRestart.js +54 -70
- package/cjs/components/material-runbox/actions/MaterialRunboxActionShare.d.ts +4 -1
- package/cjs/components/material-runbox/actions/MaterialRunboxActionShare.js +67 -41
- package/cjs/components/material-runbox/contexts/MaterialRunboxApiContext.js +16 -27
- package/cjs/components/material-runbox/contexts/MaterialRunboxCommandContext.js +38 -53
- package/cjs/components/material-runbox/contexts/MaterialRunboxContext.js +9 -11
- package/cjs/components/material-runbox/hooks/useRunboxControl.js +39 -65
- package/cjs/components/material-runbox/locales/en.json.js +2 -2
- package/cjs/components/material-runbox/locales/index.js +2 -4
- package/cjs/components/material-runbox/locales/ko.json.js +2 -2
- package/cjs/components/material-runbox/runtime/Runtime.js +18 -26
- package/cjs/components/material-runbox/runtime/RuntimeOverlayAssigned.js +10 -17
- package/cjs/components/material-runbox/runtime/RuntimeOverlayQueued.js +16 -18
- package/cjs/components/material-runbox/runtime/RuntimeOverlayTerminated.js +27 -33
- package/cjs/index.js +1 -3
- package/es/components/material-runbox/MaterialRunbox.js +11 -9
- package/es/components/material-runbox/MaterialRunboxBody.js +13 -5
- package/es/components/material-runbox/MaterialRunboxContent.js +80 -82
- package/es/components/material-runbox/MaterialRunboxFooter.js +11 -11
- package/es/components/material-runbox/MaterialRunboxHeader.d.ts +3 -0
- package/es/components/material-runbox/MaterialRunboxHeader.js +72 -71
- package/es/components/material-runbox/actions/MaterialRunboxActionAutoShutdown.js +22 -13
- package/es/components/material-runbox/actions/MaterialRunboxActionGrade.js +120 -155
- package/es/components/material-runbox/actions/MaterialRunboxActionMenu.d.ts +8 -0
- package/es/components/material-runbox/actions/MaterialRunboxActionMenu.js +61 -0
- package/es/components/material-runbox/actions/MaterialRunboxActionReset.d.ts +3 -1
- package/es/components/material-runbox/actions/MaterialRunboxActionReset.js +65 -98
- package/es/components/material-runbox/actions/MaterialRunboxActionRestart.d.ts +3 -1
- package/es/components/material-runbox/actions/MaterialRunboxActionRestart.js +47 -59
- package/es/components/material-runbox/actions/MaterialRunboxActionShare.d.ts +4 -1
- package/es/components/material-runbox/actions/MaterialRunboxActionShare.js +68 -38
- package/es/components/material-runbox/contexts/MaterialRunboxApiContext.js +13 -20
- package/es/components/material-runbox/contexts/MaterialRunboxCommandContext.js +35 -46
- package/es/components/material-runbox/contexts/MaterialRunboxContext.js +6 -4
- package/es/components/material-runbox/hooks/useRunboxControl.js +39 -63
- package/es/components/material-runbox/locales/en.json.js +1 -1
- package/es/components/material-runbox/locales/ko.json.js +1 -1
- package/es/components/material-runbox/runtime/Runtime.js +14 -18
- package/es/components/material-runbox/runtime/RuntimeOverlayAssigned.js +3 -6
- package/es/components/material-runbox/runtime/RuntimeOverlayQueued.js +6 -4
- package/es/components/material-runbox/runtime/RuntimeOverlayTerminated.js +12 -14
- package/package.json +13 -9
- package/cjs/_virtual/_rollupPluginBabelHelpers.js +0 -399
- package/es/_virtual/_rollupPluginBabelHelpers.js +0 -387
|
@@ -2,12 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var _styled = require('@emotion/styled/base');
|
|
6
6
|
var React = require('react');
|
|
7
7
|
var reactIntl = require('react-intl');
|
|
8
8
|
var blocks = require('@elice/blocks');
|
|
9
9
|
var runboxClient = require('@elice/runbox-client');
|
|
10
|
-
var styled = require('@emotion/styled');
|
|
11
10
|
var iconsMaterial = require('@mui/icons-material');
|
|
12
11
|
var material = require('@mui/material');
|
|
13
12
|
var reactQuery = require('@tanstack/react-query');
|
|
@@ -18,141 +17,135 @@ var MaterialRunboxBody = require('./MaterialRunboxBody.js');
|
|
|
18
17
|
var MaterialRunboxFooter = require('./MaterialRunboxFooter.js');
|
|
19
18
|
var MaterialRunboxHeader = require('./MaterialRunboxHeader.js');
|
|
20
19
|
|
|
21
|
-
function
|
|
22
|
-
|
|
23
|
-
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
24
|
-
var styled__default = /*#__PURE__*/_interopDefaultLegacy(styled);
|
|
25
|
-
|
|
26
|
-
var _templateObject;
|
|
20
|
+
function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
|
|
27
21
|
//
|
|
28
22
|
//
|
|
29
23
|
//
|
|
30
|
-
|
|
24
|
+
const DEFAULT_DATA = [null, null, null];
|
|
31
25
|
//
|
|
32
26
|
//
|
|
33
27
|
//
|
|
34
|
-
|
|
28
|
+
const StyledRunboxContainer = /*#__PURE__*/_styled("div", {
|
|
29
|
+
target: "eeh98mq0"
|
|
30
|
+
})("production" === "production" ? {
|
|
31
|
+
name: "t5t5sq",
|
|
32
|
+
styles: "display:flex;flex-direction:column;justify-content:center;align-items:center;width:100%;height:100%"
|
|
33
|
+
} : {
|
|
34
|
+
name: "t5t5sq",
|
|
35
|
+
styles: "display:flex;flex-direction:column;justify-content:center;align-items:center;width:100%;height:100%",
|
|
36
|
+
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
37
|
+
});
|
|
35
38
|
//
|
|
36
39
|
//
|
|
37
40
|
//
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
41
|
+
const MaterialRunboxContent = ({
|
|
42
|
+
runboxId,
|
|
43
|
+
courseId
|
|
44
|
+
}) => {
|
|
45
|
+
const {
|
|
46
|
+
locale,
|
|
47
|
+
showMessenger
|
|
48
|
+
} = MaterialRunboxContext.useMaterialRunboxContext();
|
|
49
|
+
const materialRunboxApi = MaterialRunboxApiContext.useMaterialRunboxApiContext();
|
|
45
50
|
//
|
|
46
51
|
//
|
|
47
52
|
//
|
|
48
|
-
|
|
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
|
-
eliceCourseId: courseId
|
|
79
|
-
}, {
|
|
80
|
-
signal: signal
|
|
81
|
-
})]);
|
|
82
|
-
});
|
|
83
|
-
},
|
|
84
|
-
cacheTime: 0,
|
|
85
|
-
keepPreviousData: true,
|
|
86
|
-
refetchOnWindowFocus: false
|
|
53
|
+
const {
|
|
54
|
+
data: [runbox, runtime, runtimeTemplate] = DEFAULT_DATA,
|
|
55
|
+
isInitialLoading,
|
|
56
|
+
isError,
|
|
57
|
+
refetch
|
|
58
|
+
} = reactQuery.useQuery({
|
|
59
|
+
enabled: Boolean(runboxId),
|
|
60
|
+
queryKey: ['eliceMaterialRunboxRunboxApi.runboxRunboxIdGet', 'eliceMaterialRunboxRuntimeTemplateApi.runtimeTemplateRuntimeTemplateIdGet', runboxId, courseId],
|
|
61
|
+
queryFn: ({
|
|
62
|
+
signal
|
|
63
|
+
}) => materialRunboxApi.runbox.runboxRunboxIdGet({
|
|
64
|
+
runboxId: runboxId,
|
|
65
|
+
eliceCourseId: courseId
|
|
66
|
+
}, {
|
|
67
|
+
signal
|
|
68
|
+
}).then(runbox => Promise.all([
|
|
69
|
+
// runbox
|
|
70
|
+
runbox,
|
|
71
|
+
// runtime
|
|
72
|
+
materialRunboxApi.runtime.runtimeGet({
|
|
73
|
+
filterImageId: runbox.imageId,
|
|
74
|
+
filterRuntimeTemplateId: runbox.runtimeTemplateId,
|
|
75
|
+
skip: 0,
|
|
76
|
+
count: 1,
|
|
77
|
+
eliceCourseId: courseId
|
|
78
|
+
}, {
|
|
79
|
+
signal
|
|
80
|
+
}).then(runtimes => {
|
|
81
|
+
var _a;
|
|
82
|
+
return (_a = runtimes[0]) !== null && _a !== void 0 ? _a : null;
|
|
87
83
|
}),
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
84
|
+
// runtimeTemplate
|
|
85
|
+
materialRunboxApi.runtimeTemplate.runtimeTemplateRuntimeTemplateIdGet({
|
|
86
|
+
runtimeTemplateId: runbox.runtimeTemplateId,
|
|
87
|
+
eliceCourseId: courseId
|
|
88
|
+
}, {
|
|
89
|
+
signal
|
|
90
|
+
})])),
|
|
91
|
+
cacheTime: 0,
|
|
92
|
+
keepPreviousData: true,
|
|
93
|
+
refetchOnWindowFocus: false
|
|
94
|
+
});
|
|
97
95
|
//
|
|
98
96
|
//
|
|
99
97
|
//
|
|
100
98
|
if (isInitialLoading) {
|
|
101
|
-
return
|
|
99
|
+
return React.createElement(StyledRunboxContainer, null, React.createElement(blocks.Spinner, null));
|
|
102
100
|
}
|
|
103
101
|
if (isError) {
|
|
104
|
-
return
|
|
102
|
+
return React.createElement(StyledRunboxContainer, null, React.createElement(material.Stack, {
|
|
105
103
|
gap: "1.5rem"
|
|
106
|
-
},
|
|
104
|
+
}, React.createElement(material.Typography, {
|
|
107
105
|
variant: "h6"
|
|
108
|
-
},
|
|
106
|
+
}, React.createElement(reactIntl.FormattedMessage, {
|
|
109
107
|
id: "runbox.runtime.message.startError"
|
|
110
|
-
})),
|
|
108
|
+
})), React.createElement(material.Stack, {
|
|
111
109
|
gap: "0.5rem"
|
|
112
|
-
},
|
|
113
|
-
startIcon:
|
|
114
|
-
onClick:
|
|
115
|
-
|
|
116
|
-
}
|
|
117
|
-
}, React__default["default"].createElement(reactIntl.FormattedMessage, {
|
|
110
|
+
}, React.createElement(material.Button, {
|
|
111
|
+
startIcon: React.createElement(iconsMaterial.Refresh, null),
|
|
112
|
+
onClick: () => refetch()
|
|
113
|
+
}, React.createElement(reactIntl.FormattedMessage, {
|
|
118
114
|
id: "runbox.common.retry"
|
|
119
|
-
})), typeof showMessenger === 'function' ?
|
|
115
|
+
})), typeof showMessenger === 'function' ? React.createElement(material.Button, {
|
|
120
116
|
variant: "outlined",
|
|
121
|
-
onClick:
|
|
122
|
-
|
|
123
|
-
}
|
|
124
|
-
}, React__default["default"].createElement(reactIntl.FormattedMessage, {
|
|
117
|
+
onClick: () => showMessenger()
|
|
118
|
+
}, React.createElement(reactIntl.FormattedMessage, {
|
|
125
119
|
id: "runbox.common.support"
|
|
126
120
|
})) : null)));
|
|
127
121
|
}
|
|
128
122
|
if (!runbox || !runtimeTemplate) {
|
|
129
123
|
return null;
|
|
130
124
|
}
|
|
131
|
-
|
|
132
|
-
runbox
|
|
133
|
-
runtime
|
|
134
|
-
runtimeTemplate
|
|
135
|
-
courseId
|
|
136
|
-
refetch
|
|
125
|
+
const props = {
|
|
126
|
+
runbox,
|
|
127
|
+
runtime,
|
|
128
|
+
runtimeTemplate,
|
|
129
|
+
courseId,
|
|
130
|
+
refetch
|
|
137
131
|
};
|
|
138
|
-
return
|
|
132
|
+
return React.createElement(MaterialRunboxCommandContext.default, {
|
|
139
133
|
runtime: runtime,
|
|
140
134
|
courseId: courseId
|
|
141
|
-
},
|
|
135
|
+
}, React.createElement(runboxClient.EliceRunboxProvider, {
|
|
142
136
|
runboxId: runbox.id,
|
|
143
|
-
runboxApiHeartbeat:
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
},
|
|
137
|
+
runboxApiHeartbeat: ({
|
|
138
|
+
id,
|
|
139
|
+
signal
|
|
140
|
+
}) => materialRunboxApi.runbox.runboxRunboxIdHeartbeatPost({
|
|
141
|
+
runboxId: id,
|
|
142
|
+
eliceCourseId: courseId
|
|
143
|
+
}, {
|
|
144
|
+
signal
|
|
145
|
+
}),
|
|
153
146
|
locale: locale,
|
|
154
147
|
onRunboxRefetchRequest: refetch
|
|
155
|
-
},
|
|
148
|
+
}, React.createElement(StyledRunboxContainer, null, React.createElement(MaterialRunboxHeader.default, Object.assign({}, props)), React.createElement(MaterialRunboxBody.default, Object.assign({}, props)), React.createElement(MaterialRunboxFooter.default, Object.assign({}, props)))));
|
|
156
149
|
};
|
|
157
150
|
|
|
158
|
-
exports
|
|
151
|
+
exports.default = MaterialRunboxContent;
|
|
@@ -2,56 +2,51 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var _styled = require('@emotion/styled/base');
|
|
6
6
|
var React = require('react');
|
|
7
7
|
var runboxClient = require('@elice/runbox-client');
|
|
8
|
-
var styled = require('@emotion/styled');
|
|
9
8
|
var material = require('@mui/material');
|
|
10
9
|
|
|
11
|
-
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
12
|
-
|
|
13
|
-
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
14
|
-
var styled__default = /*#__PURE__*/_interopDefaultLegacy(styled);
|
|
15
|
-
|
|
16
|
-
var _templateObject;
|
|
17
10
|
//
|
|
18
11
|
//
|
|
19
12
|
//
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
13
|
+
const StyledFooter = /*#__PURE__*/_styled("div", {
|
|
14
|
+
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
|
+
}) => theme.palette.divider, ";");
|
|
24
18
|
//
|
|
25
19
|
//
|
|
26
20
|
//
|
|
27
|
-
|
|
28
|
-
|
|
21
|
+
const MaterialRunboxFooter = ({
|
|
22
|
+
runtimeTemplate
|
|
23
|
+
}) => {
|
|
29
24
|
/**
|
|
30
25
|
* Resource stats
|
|
31
26
|
*/
|
|
32
|
-
|
|
27
|
+
const renderFooterResourceStats = () => {
|
|
33
28
|
var _a, _b;
|
|
34
|
-
return
|
|
29
|
+
return React.createElement(material.Box, null, React.createElement(runboxClient.EliceRunboxResourceStat, {
|
|
35
30
|
gpu: ((_b = (_a = runtimeTemplate.gpus) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0) > 0
|
|
36
31
|
}));
|
|
37
32
|
};
|
|
38
33
|
/**
|
|
39
34
|
* Status
|
|
40
35
|
*/
|
|
41
|
-
|
|
42
|
-
return
|
|
36
|
+
const renderFooterStatus = () => {
|
|
37
|
+
return React.createElement(material.Stack, {
|
|
43
38
|
direction: "row",
|
|
44
39
|
gap: "0.5rem",
|
|
45
|
-
divider:
|
|
40
|
+
divider: React.createElement(material.Divider, {
|
|
46
41
|
orientation: "vertical",
|
|
47
42
|
flexItem: true
|
|
48
43
|
})
|
|
49
|
-
},
|
|
44
|
+
}, React.createElement(runboxClient.EliceRunboxRemainingTimer, null), React.createElement(runboxClient.EliceRunboxNetworkStat, null), React.createElement(runboxClient.EliceRunboxRunningStatus, null));
|
|
50
45
|
};
|
|
51
46
|
//
|
|
52
47
|
//
|
|
53
48
|
//
|
|
54
|
-
return
|
|
49
|
+
return React.createElement(StyledFooter, null, renderFooterResourceStats(), renderFooterStatus());
|
|
55
50
|
};
|
|
56
51
|
|
|
57
|
-
exports
|
|
52
|
+
exports.default = MaterialRunboxFooter;
|
|
@@ -2,81 +2,81 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var _styled = require('@emotion/styled/base');
|
|
6
6
|
var React = require('react');
|
|
7
7
|
var reactIntl = require('react-intl');
|
|
8
8
|
var muiElements = require('@elice/mui-elements');
|
|
9
|
-
var
|
|
9
|
+
var runboxClient = require('@elice/runbox-client');
|
|
10
|
+
var proSolidSvgIcons = require('@fortawesome/pro-solid-svg-icons');
|
|
10
11
|
var material = require('@mui/material');
|
|
11
12
|
var reactQuery = require('@tanstack/react-query');
|
|
12
13
|
var MaterialRunboxActionAutoShutdown = require('./actions/MaterialRunboxActionAutoShutdown.js');
|
|
13
14
|
var MaterialRunboxActionGrade = require('./actions/MaterialRunboxActionGrade.js');
|
|
14
|
-
var
|
|
15
|
-
var MaterialRunboxActionRestart = require('./actions/MaterialRunboxActionRestart.js');
|
|
16
|
-
var MaterialRunboxActionShare = require('./actions/MaterialRunboxActionShare.js');
|
|
15
|
+
var MaterialRunboxActionMenu = require('./actions/MaterialRunboxActionMenu.js');
|
|
17
16
|
var MaterialRunboxApiContext = require('./contexts/MaterialRunboxApiContext.js');
|
|
18
17
|
require('./contexts/MaterialRunboxCommandContext.js');
|
|
19
18
|
var MaterialRunboxContext = require('./contexts/MaterialRunboxContext.js');
|
|
20
19
|
var runbox_logo = require('../../assets/runbox_logo.png.js');
|
|
21
20
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
var _templateObject;
|
|
28
|
-
//
|
|
29
|
-
//
|
|
21
|
+
const StyledHeader = /*#__PURE__*/_styled("div", {
|
|
22
|
+
target: "e110d0bp0"
|
|
23
|
+
})("position:relative;flex:0 0 3rem;display:flex;justify-content:space-between;align-items:center;padding:0 1rem;width:100%;border-bottom:1px solid ", ({
|
|
24
|
+
theme
|
|
25
|
+
}) => theme.palette.divider, ";overflow:hidden;");
|
|
30
26
|
//
|
|
31
|
-
var StyledHeader = styled__default["default"].div(_templateObject || (_templateObject = _rollupPluginBabelHelpers.taggedTemplateLiteral(["\n position: relative;\n flex: 0 0 3rem;\n display: flex;\n justify-content: space-between;\n align-items: center;\n padding: 0 1rem;\n width: 100%;\n border-bottom: 1px solid ", ";\n overflow: hidden;\n"])), function (_ref) {
|
|
32
|
-
var theme = _ref.theme;
|
|
33
|
-
return theme.palette.divider;
|
|
34
|
-
});
|
|
35
27
|
//
|
|
36
28
|
//
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
enableAutoShutdownToggle
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
29
|
+
const MaterialRunboxHeader = ({
|
|
30
|
+
runbox,
|
|
31
|
+
runtime,
|
|
32
|
+
runtimeTemplate,
|
|
33
|
+
courseId,
|
|
34
|
+
refetch
|
|
35
|
+
}) => {
|
|
36
|
+
const {
|
|
37
|
+
enableAutoShutdownToggle
|
|
38
|
+
} = MaterialRunboxContext.useMaterialRunboxContext();
|
|
39
|
+
const [menuAnchorEl, setMenuAnchorEl] = React.useState(null);
|
|
40
|
+
const {
|
|
41
|
+
status
|
|
42
|
+
} = runboxClient.useEliceRunboxRunning();
|
|
43
|
+
const isRunboxRunning = status === 'running';
|
|
44
|
+
/**
|
|
45
|
+
*
|
|
46
|
+
*/
|
|
47
|
+
const handleMenuClose = () => {
|
|
48
|
+
setMenuAnchorEl(null);
|
|
49
|
+
};
|
|
50
|
+
const materialRunboxApi = MaterialRunboxApiContext.useMaterialRunboxApiContext();
|
|
51
|
+
const leaderboardSubmitInfoQuery = reactQuery.useQuery({
|
|
49
52
|
queryKey: ['eliceMaterialRunboxRunboxApi.runboxRunboxIdSubmitInfoGet', {
|
|
50
|
-
courseId
|
|
51
|
-
runtime
|
|
53
|
+
courseId,
|
|
54
|
+
runtime
|
|
52
55
|
}],
|
|
53
|
-
queryFn:
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
refetchInterval: function refetchInterval(data) {
|
|
63
|
-
return !(data === null || data === void 0 ? void 0 : data.remainSubmitCount) ? false : 5 * 1000;
|
|
64
|
-
},
|
|
56
|
+
queryFn: ({
|
|
57
|
+
signal
|
|
58
|
+
}) => materialRunboxApi.runbox.runboxRunboxIdSubmitInfoGet({
|
|
59
|
+
eliceCourseId: courseId,
|
|
60
|
+
runboxId: runtime === null || runtime === void 0 ? void 0 : runtime.runboxId
|
|
61
|
+
}, {
|
|
62
|
+
signal
|
|
63
|
+
}),
|
|
64
|
+
refetchInterval: data => !(data === null || data === void 0 ? void 0 : data.remainSubmitCount) ? false : 5 * 1000,
|
|
65
65
|
enabled: Boolean(runtime === null || runtime === void 0 ? void 0 : runtime.runboxId),
|
|
66
66
|
retry: false
|
|
67
67
|
});
|
|
68
68
|
/**
|
|
69
69
|
*
|
|
70
70
|
*/
|
|
71
|
-
|
|
71
|
+
const renderHeaderSubmitInfo = () => {
|
|
72
72
|
var _a, _b;
|
|
73
|
-
|
|
74
|
-
|
|
73
|
+
const remainSubmitCount = (_a = leaderboardSubmitInfoQuery.data) === null || _a === void 0 ? void 0 : _a.remainSubmitCount;
|
|
74
|
+
const totalSubmitCount = (_b = leaderboardSubmitInfoQuery.data) === null || _b === void 0 ? void 0 : _b.submitCountLimit;
|
|
75
75
|
if (leaderboardSubmitInfoQuery.isInitialLoading || remainSubmitCount === null) {
|
|
76
76
|
return null;
|
|
77
77
|
}
|
|
78
|
-
return
|
|
79
|
-
label:
|
|
78
|
+
return React.createElement(muiElements.Tag, {
|
|
79
|
+
label: React.createElement(reactIntl.FormattedMessage, {
|
|
80
80
|
id: "runbox.header.submitInfo",
|
|
81
81
|
values: {
|
|
82
82
|
remainCount: remainSubmitCount,
|
|
@@ -90,11 +90,11 @@ var MaterialRunboxHeader = function MaterialRunboxHeader(_ref2) {
|
|
|
90
90
|
/**
|
|
91
91
|
*
|
|
92
92
|
*/
|
|
93
|
-
|
|
93
|
+
const renderHeaderActionAutoShutdown = () => {
|
|
94
94
|
if (!enableAutoShutdownToggle) {
|
|
95
95
|
return null;
|
|
96
96
|
}
|
|
97
|
-
return
|
|
97
|
+
return React.createElement(MaterialRunboxActionAutoShutdown.default, {
|
|
98
98
|
runtime: runtime,
|
|
99
99
|
runtimeTemplate: runtimeTemplate,
|
|
100
100
|
courseId: courseId,
|
|
@@ -104,27 +104,11 @@ var MaterialRunboxHeader = function MaterialRunboxHeader(_ref2) {
|
|
|
104
104
|
/**
|
|
105
105
|
*
|
|
106
106
|
*/
|
|
107
|
-
|
|
108
|
-
if (!
|
|
107
|
+
const renderHeaderActionGrade = () => {
|
|
108
|
+
if (!runbox.submission.enabled) {
|
|
109
109
|
return null;
|
|
110
110
|
}
|
|
111
|
-
return
|
|
112
|
-
};
|
|
113
|
-
/**
|
|
114
|
-
*
|
|
115
|
-
*/
|
|
116
|
-
var renderHeaderActionRestart = function renderHeaderActionRestart() {
|
|
117
|
-
return React__default["default"].createElement(MaterialRunboxActionRestart["default"], {
|
|
118
|
-
runbox: runbox,
|
|
119
|
-
courseId: courseId,
|
|
120
|
-
refetch: refetch
|
|
121
|
-
});
|
|
122
|
-
};
|
|
123
|
-
/**
|
|
124
|
-
*
|
|
125
|
-
*/
|
|
126
|
-
var renderHeaderActionReset = function renderHeaderActionReset() {
|
|
127
|
-
return React__default["default"].createElement(MaterialRunboxActionReset["default"], {
|
|
111
|
+
return React.createElement(MaterialRunboxActionGrade.default, {
|
|
128
112
|
runtime: runtime,
|
|
129
113
|
courseId: courseId
|
|
130
114
|
});
|
|
@@ -132,21 +116,33 @@ var MaterialRunboxHeader = function MaterialRunboxHeader(_ref2) {
|
|
|
132
116
|
/**
|
|
133
117
|
*
|
|
134
118
|
*/
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
119
|
+
const renderOptionMenu = () => {
|
|
120
|
+
return React.createElement(React.Fragment, null, React.createElement(material.IconButton, {
|
|
121
|
+
disabled: !isRunboxRunning,
|
|
122
|
+
onClick: e => {
|
|
123
|
+
if (Boolean(menuAnchorEl)) {
|
|
124
|
+
setMenuAnchorEl(null);
|
|
125
|
+
} else {
|
|
126
|
+
setMenuAnchorEl(e.currentTarget);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}, React.createElement(muiElements.EliceIcon, {
|
|
130
|
+
icon: proSolidSvgIcons.faEllipsisVertical
|
|
131
|
+
})), React.createElement(MaterialRunboxActionMenu.default, {
|
|
132
|
+
runbox: runbox,
|
|
140
133
|
runtime: runtime,
|
|
141
|
-
courseId: courseId
|
|
142
|
-
|
|
134
|
+
courseId: courseId,
|
|
135
|
+
menuAnchorEl: menuAnchorEl,
|
|
136
|
+
refetch: refetch,
|
|
137
|
+
handleMenuClose: handleMenuClose
|
|
138
|
+
}));
|
|
143
139
|
};
|
|
144
140
|
//
|
|
145
141
|
//
|
|
146
142
|
//
|
|
147
|
-
return
|
|
143
|
+
return React.createElement(StyledHeader, null, React.createElement(material.Box, {
|
|
148
144
|
component: "img",
|
|
149
|
-
src: runbox_logo
|
|
145
|
+
src: runbox_logo.default,
|
|
150
146
|
alt: "elice runbox",
|
|
151
147
|
sx: {
|
|
152
148
|
width: 'auto',
|
|
@@ -154,11 +150,11 @@ var MaterialRunboxHeader = function MaterialRunboxHeader(_ref2) {
|
|
|
154
150
|
imageRendering: 'auto',
|
|
155
151
|
padding: '0.465rem 0'
|
|
156
152
|
}
|
|
157
|
-
}),
|
|
153
|
+
}), React.createElement(material.Stack, {
|
|
158
154
|
direction: "row",
|
|
159
155
|
alignItems: "center",
|
|
160
156
|
gap: "0.5rem"
|
|
161
|
-
}, renderHeaderSubmitInfo(), renderHeaderActionAutoShutdown(),
|
|
157
|
+
}, renderHeaderSubmitInfo(), renderHeaderActionAutoShutdown(), renderOptionMenu(), renderHeaderActionGrade()));
|
|
162
158
|
};
|
|
163
159
|
|
|
164
|
-
exports
|
|
160
|
+
exports.default = MaterialRunboxHeader;
|