@elice/material-runbox 1.231227.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
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { useEliceRunboxRunning } from '@elice/runbox-client';
|
|
3
|
+
import { Menu } from '@mui/material';
|
|
4
|
+
import MaterialRunboxActionReset from './MaterialRunboxActionReset.js';
|
|
5
|
+
import MaterialRunboxActionRestart from './MaterialRunboxActionRestart.js';
|
|
6
|
+
import MaterialRunboxActionShare from './MaterialRunboxActionShare.js';
|
|
7
|
+
|
|
8
|
+
//
|
|
9
|
+
//
|
|
10
|
+
//
|
|
11
|
+
const MaterialRunboxActionMenu = ({
|
|
12
|
+
runbox,
|
|
13
|
+
runtime,
|
|
14
|
+
courseId,
|
|
15
|
+
menuAnchorEl,
|
|
16
|
+
refetch,
|
|
17
|
+
handleMenuClose
|
|
18
|
+
}) => {
|
|
19
|
+
const {
|
|
20
|
+
status
|
|
21
|
+
} = useEliceRunboxRunning();
|
|
22
|
+
const isRunboxRunning = status === 'running';
|
|
23
|
+
//
|
|
24
|
+
//
|
|
25
|
+
//
|
|
26
|
+
React.useEffect(() => {
|
|
27
|
+
if (!isRunboxRunning) {
|
|
28
|
+
handleMenuClose();
|
|
29
|
+
}
|
|
30
|
+
}, [handleMenuClose, isRunboxRunning]);
|
|
31
|
+
//
|
|
32
|
+
//
|
|
33
|
+
//
|
|
34
|
+
return React.createElement(Menu, {
|
|
35
|
+
open: Boolean(menuAnchorEl),
|
|
36
|
+
anchorEl: menuAnchorEl,
|
|
37
|
+
anchorOrigin: {
|
|
38
|
+
vertical: 'bottom',
|
|
39
|
+
horizontal: 'right'
|
|
40
|
+
},
|
|
41
|
+
transformOrigin: {
|
|
42
|
+
vertical: 'top',
|
|
43
|
+
horizontal: 'right'
|
|
44
|
+
},
|
|
45
|
+
onClose: handleMenuClose
|
|
46
|
+
}, React.createElement(MaterialRunboxActionShare, {
|
|
47
|
+
handleMenuClose: handleMenuClose
|
|
48
|
+
}), React.createElement(MaterialRunboxActionRestart, {
|
|
49
|
+
runbox: runbox,
|
|
50
|
+
runtime: runtime,
|
|
51
|
+
courseId: courseId,
|
|
52
|
+
refetch: refetch,
|
|
53
|
+
handleMenuClose: handleMenuClose
|
|
54
|
+
}), React.createElement(MaterialRunboxActionReset, {
|
|
55
|
+
runtime: runtime,
|
|
56
|
+
courseId: courseId,
|
|
57
|
+
handleMenuClose: handleMenuClose
|
|
58
|
+
}));
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
export { MaterialRunboxActionMenu as default };
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { RuntimeProps } from '../runtime/Runtime';
|
|
3
|
-
type MaterialRunboxActionResetProps = Pick<RuntimeProps, 'runtime' | 'courseId'
|
|
3
|
+
type MaterialRunboxActionResetProps = Pick<RuntimeProps, 'runtime' | 'courseId'> & {
|
|
4
|
+
handleMenuClose: () => void;
|
|
5
|
+
};
|
|
4
6
|
declare const MaterialRunboxActionReset: React.FC<MaterialRunboxActionResetProps>;
|
|
5
7
|
export default MaterialRunboxActionReset;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { slicedToArray as _slicedToArray, asyncToGenerator as _asyncToGenerator, regeneratorRuntime as _regeneratorRuntime } from '../../../_virtual/_rollupPluginBabelHelpers.js';
|
|
2
1
|
import React from 'react';
|
|
3
2
|
import { useIntl, FormattedMessage } from 'react-intl';
|
|
3
|
+
import { EliceIcon } from '@elice/mui-elements';
|
|
4
|
+
import { useSnackbar } from '@elice/mui-x-snackbar';
|
|
4
5
|
import { CommandType } from '@elice/openapi-client-material-runbox';
|
|
5
|
-
import {
|
|
6
|
+
import { faRefresh } from '@fortawesome/pro-solid-svg-icons';
|
|
6
7
|
import { LoadingButton } from '@mui/lab';
|
|
7
|
-
import { Dialog, DialogTitle, DialogContent, DialogContentText, DialogActions, Button } from '@mui/material';
|
|
8
|
-
import { useSnackbar } from 'notistack';
|
|
8
|
+
import { MenuItem, ListItemIcon, ListItemText, Dialog, DialogTitle, DialogContent, DialogContentText, DialogActions, Button } from '@mui/material';
|
|
9
9
|
import { useMaterialRunboxApiContext } from '../contexts/MaterialRunboxApiContext.js';
|
|
10
10
|
import { useMaterialRunboxCommandContext } from '../contexts/MaterialRunboxCommandContext.js';
|
|
11
11
|
import '../contexts/MaterialRunboxContext.js';
|
|
@@ -13,114 +13,81 @@ import '../contexts/MaterialRunboxContext.js';
|
|
|
13
13
|
//
|
|
14
14
|
//
|
|
15
15
|
//
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
isConfirmDialogOpen = _React$useState2[0],
|
|
33
|
-
setConfirmDialogOpen = _React$useState2[1];
|
|
34
|
-
var _React$useState3 = React.useState(false),
|
|
35
|
-
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
36
|
-
isActionLoading = _React$useState4[0],
|
|
37
|
-
setActionLoading = _React$useState4[1];
|
|
16
|
+
const MaterialRunboxActionReset = ({
|
|
17
|
+
runtime,
|
|
18
|
+
courseId,
|
|
19
|
+
handleMenuClose
|
|
20
|
+
}) => {
|
|
21
|
+
const intl = useIntl();
|
|
22
|
+
const {
|
|
23
|
+
enqueueSnackbar
|
|
24
|
+
} = useSnackbar();
|
|
25
|
+
const materialRunboxApi = useMaterialRunboxApiContext();
|
|
26
|
+
const [isLoading, setLoading] = React.useState(false);
|
|
27
|
+
const [isDialogOpened, setDialogOpened] = React.useState(false);
|
|
28
|
+
const {
|
|
29
|
+
isLastCommandRunning,
|
|
30
|
+
setCommandIdToPing
|
|
31
|
+
} = useMaterialRunboxCommandContext();
|
|
38
32
|
/**
|
|
39
33
|
*
|
|
40
34
|
*/
|
|
41
|
-
|
|
42
|
-
|
|
35
|
+
const handleDialogClose = () => {
|
|
36
|
+
setDialogOpened(false);
|
|
43
37
|
};
|
|
44
38
|
/**
|
|
45
39
|
*
|
|
46
40
|
*/
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
case 0:
|
|
59
|
-
setActionLoading(true);
|
|
60
|
-
_context.prev = 1;
|
|
61
|
-
runtimeId = runtime === null || runtime === void 0 ? void 0 : runtime.id;
|
|
62
|
-
_context.next = 5;
|
|
63
|
-
return materialRunboxApi.runtime.runtimeRuntimeIdCommandPost({
|
|
64
|
-
runtimeId: runtimeId,
|
|
65
|
-
eliceCourseId: courseId,
|
|
66
|
-
runboxCommandPostRequest: {
|
|
67
|
-
commandType: CommandType.ProjectFileReset
|
|
68
|
-
}
|
|
69
|
-
});
|
|
70
|
-
case 5:
|
|
71
|
-
_yield$materialRunbox = _context.sent;
|
|
72
|
-
commentId = _yield$materialRunbox.id;
|
|
73
|
-
setCommandIdToPing(commentId);
|
|
74
|
-
handleConfirmDialogClose();
|
|
75
|
-
_context.next = 14;
|
|
76
|
-
break;
|
|
77
|
-
case 11:
|
|
78
|
-
_context.prev = 11;
|
|
79
|
-
_context.t0 = _context["catch"](1);
|
|
80
|
-
enqueueSnackbar(intl.formatMessage({
|
|
81
|
-
id: 'runbox.action.reset.noti.error'
|
|
82
|
-
}), {
|
|
83
|
-
variant: 'error'
|
|
84
|
-
});
|
|
85
|
-
case 14:
|
|
86
|
-
_context.prev = 14;
|
|
87
|
-
setActionLoading(false);
|
|
88
|
-
return _context.finish(14);
|
|
89
|
-
case 17:
|
|
90
|
-
case "end":
|
|
91
|
-
return _context.stop();
|
|
41
|
+
const handleReset = async () => {
|
|
42
|
+
setLoading(true);
|
|
43
|
+
try {
|
|
44
|
+
const runtimeId = runtime === null || runtime === void 0 ? void 0 : runtime.id;
|
|
45
|
+
const {
|
|
46
|
+
id: commentId
|
|
47
|
+
} = await materialRunboxApi.runtime.runtimeRuntimeIdCommandPost({
|
|
48
|
+
runtimeId,
|
|
49
|
+
eliceCourseId: courseId,
|
|
50
|
+
runboxCommandPostRequest: {
|
|
51
|
+
commandType: CommandType.ProjectFileReset
|
|
92
52
|
}
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
53
|
+
});
|
|
54
|
+
setCommandIdToPing(commentId);
|
|
55
|
+
handleDialogClose();
|
|
56
|
+
} catch (err) {
|
|
57
|
+
enqueueSnackbar(intl.formatMessage({
|
|
58
|
+
id: 'runbox.action.reset.noti.error'
|
|
59
|
+
}), {
|
|
60
|
+
variant: 'error'
|
|
61
|
+
});
|
|
62
|
+
} finally {
|
|
63
|
+
setLoading(false);
|
|
64
|
+
}
|
|
65
|
+
};
|
|
99
66
|
/**
|
|
100
67
|
*
|
|
101
68
|
*/
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
size: "small",
|
|
110
|
-
onClick: handleConfirmDialogOpen
|
|
111
|
-
}, React.createElement(FormattedMessage, {
|
|
69
|
+
const renderResetMenuItem = () => {
|
|
70
|
+
return React.createElement(MenuItem, {
|
|
71
|
+
onClick: () => setDialogOpened(true),
|
|
72
|
+
disabled: isLastCommandRunning
|
|
73
|
+
}, React.createElement(ListItemIcon, null, React.createElement(EliceIcon, {
|
|
74
|
+
icon: faRefresh
|
|
75
|
+
})), React.createElement(ListItemText, null, React.createElement(FormattedMessage, {
|
|
112
76
|
id: "runbox.action.reset.title"
|
|
113
|
-
}));
|
|
77
|
+
})));
|
|
114
78
|
};
|
|
115
79
|
/**
|
|
116
80
|
*
|
|
117
81
|
*/
|
|
118
|
-
|
|
82
|
+
const renderConfirmDialog = () => {
|
|
83
|
+
if (!isDialogOpened) {
|
|
84
|
+
return null;
|
|
85
|
+
}
|
|
119
86
|
return React.createElement(Dialog, {
|
|
120
|
-
open:
|
|
87
|
+
open: true,
|
|
121
88
|
maxWidth: "xs",
|
|
122
89
|
fullWidth: true,
|
|
123
|
-
onClose:
|
|
90
|
+
onClose: handleDialogClose
|
|
124
91
|
}, React.createElement(DialogTitle, null, React.createElement(FormattedMessage, {
|
|
125
92
|
id: "runbox.action.reset.title"
|
|
126
93
|
})), React.createElement(DialogContent, null, React.createElement(DialogContentText, {
|
|
@@ -131,15 +98,15 @@ var MaterialRunboxActionReset = function MaterialRunboxActionReset(_ref) {
|
|
|
131
98
|
id: "runbox.action.reset.dialog.description"
|
|
132
99
|
}))), React.createElement(DialogActions, null, React.createElement(Button, {
|
|
133
100
|
color: "inherit",
|
|
134
|
-
disabled:
|
|
135
|
-
onClick:
|
|
101
|
+
disabled: isLoading,
|
|
102
|
+
onClick: handleDialogClose
|
|
136
103
|
}, React.createElement(FormattedMessage, {
|
|
137
104
|
id: "runbox.common.close"
|
|
138
105
|
})), React.createElement(LoadingButton, {
|
|
139
106
|
variant: "contained",
|
|
140
107
|
color: "warning",
|
|
141
|
-
loading:
|
|
142
|
-
onClick:
|
|
108
|
+
loading: isLoading || isLastCommandRunning,
|
|
109
|
+
onClick: handleReset
|
|
143
110
|
}, React.createElement(FormattedMessage, {
|
|
144
111
|
id: "runbox.action.reset.dialog.actions.confirm"
|
|
145
112
|
}))));
|
|
@@ -147,7 +114,7 @@ var MaterialRunboxActionReset = function MaterialRunboxActionReset(_ref) {
|
|
|
147
114
|
//
|
|
148
115
|
//
|
|
149
116
|
//
|
|
150
|
-
return React.createElement(React.Fragment, null,
|
|
117
|
+
return React.createElement(React.Fragment, null, renderResetMenuItem(), renderConfirmDialog());
|
|
151
118
|
};
|
|
152
119
|
|
|
153
120
|
export { MaterialRunboxActionReset as default };
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { RuntimeProps } from '../runtime/Runtime';
|
|
3
|
-
type MaterialRunboxActionRestartProps = Pick<RuntimeProps, 'runbox' | 'courseId' | 'refetch'
|
|
3
|
+
type MaterialRunboxActionRestartProps = Pick<RuntimeProps, 'runbox' | 'runtime' | 'courseId' | 'refetch'> & {
|
|
4
|
+
handleMenuClose: () => void;
|
|
5
|
+
};
|
|
4
6
|
declare const MaterialRunboxActionRestart: React.FC<MaterialRunboxActionRestartProps>;
|
|
5
7
|
export default MaterialRunboxActionRestart;
|
|
@@ -1,83 +1,71 @@
|
|
|
1
|
-
import { slicedToArray as _slicedToArray } from '../../../_virtual/_rollupPluginBabelHelpers.js';
|
|
2
1
|
import React from 'react';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
2
|
+
import { FormattedMessage } from 'react-intl';
|
|
3
|
+
import { EliceIcon } from '@elice/mui-elements';
|
|
4
|
+
import { faRotateRight } from '@fortawesome/pro-solid-svg-icons';
|
|
6
5
|
import { LoadingButton } from '@mui/lab';
|
|
7
|
-
import {
|
|
6
|
+
import { MenuItem, ListItemIcon, ListItemText, Dialog, DialogTitle, DialogContent, DialogContentText, DialogActions, Button } from '@mui/material';
|
|
8
7
|
import { useRunboxControl } from '../hooks/useRunboxControl.js';
|
|
9
8
|
|
|
10
9
|
//
|
|
11
10
|
//
|
|
12
11
|
//
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
isConfirmDialogOpen = _React$useState2[0],
|
|
30
|
-
setConfirmDialogOpen = _React$useState2[1];
|
|
31
|
-
var _React$useState3 = React.useState(false),
|
|
32
|
-
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
33
|
-
isActionLoading = _React$useState4[0],
|
|
34
|
-
setActionLoading = _React$useState4[1];
|
|
12
|
+
const MaterialRunboxActionRestart = ({
|
|
13
|
+
runbox,
|
|
14
|
+
courseId,
|
|
15
|
+
refetch,
|
|
16
|
+
handleMenuClose
|
|
17
|
+
}) => {
|
|
18
|
+
const [isLoading, setIsLoading] = React.useState(false);
|
|
19
|
+
const [isDialogOpened, setDialogOpened] = React.useState(false);
|
|
20
|
+
// restart
|
|
21
|
+
const {
|
|
22
|
+
start
|
|
23
|
+
} = useRunboxControl({
|
|
24
|
+
runbox,
|
|
25
|
+
courseId,
|
|
26
|
+
refetch
|
|
27
|
+
});
|
|
35
28
|
/**
|
|
36
29
|
*
|
|
37
30
|
*/
|
|
38
|
-
|
|
39
|
-
|
|
31
|
+
const handleDialogClose = () => {
|
|
32
|
+
setDialogOpened(false);
|
|
40
33
|
};
|
|
41
34
|
/**
|
|
42
35
|
*
|
|
43
36
|
*/
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
var handleAction = function handleAction() {
|
|
51
|
-
setActionLoading(true);
|
|
52
|
-
start(true).catch(function () {
|
|
53
|
-
return void 0;
|
|
54
|
-
}).finally(function () {
|
|
55
|
-
setActionLoading(false);
|
|
56
|
-
handleConfirmDialogClose();
|
|
37
|
+
const handleRestartAction = () => {
|
|
38
|
+
setIsLoading(true);
|
|
39
|
+
start(true).catch(() => void 0).finally(() => {
|
|
40
|
+
handleDialogClose();
|
|
41
|
+
handleMenuClose();
|
|
42
|
+
setIsLoading(false);
|
|
57
43
|
});
|
|
58
44
|
};
|
|
59
45
|
/**
|
|
60
46
|
*
|
|
61
47
|
*/
|
|
62
|
-
|
|
63
|
-
return React.createElement(
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
}, React.createElement(
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
}, React.createElement(RestartAlt, null)));
|
|
48
|
+
const renderRestartMenuItem = () => {
|
|
49
|
+
return React.createElement(MenuItem, {
|
|
50
|
+
onClick: () => setDialogOpened(true)
|
|
51
|
+
}, React.createElement(ListItemIcon, null, React.createElement(EliceIcon, {
|
|
52
|
+
icon: faRotateRight
|
|
53
|
+
})), React.createElement(ListItemText, null, React.createElement(FormattedMessage, {
|
|
54
|
+
id: "runbox.action.restart.title"
|
|
55
|
+
})));
|
|
71
56
|
};
|
|
72
57
|
/**
|
|
73
58
|
*
|
|
74
59
|
*/
|
|
75
|
-
|
|
60
|
+
const renderConfirmDialog = () => {
|
|
61
|
+
if (!isDialogOpened) {
|
|
62
|
+
return null;
|
|
63
|
+
}
|
|
76
64
|
return React.createElement(Dialog, {
|
|
77
|
-
open: isConfirmDialogOpen,
|
|
78
65
|
maxWidth: "xs",
|
|
66
|
+
open: true,
|
|
79
67
|
fullWidth: true,
|
|
80
|
-
onClose:
|
|
68
|
+
onClose: handleDialogClose
|
|
81
69
|
}, React.createElement(DialogTitle, null, React.createElement(FormattedMessage, {
|
|
82
70
|
id: "runbox.action.restart.title"
|
|
83
71
|
})), React.createElement(DialogContent, null, React.createElement(DialogContentText, {
|
|
@@ -88,15 +76,15 @@ var MaterialRunboxActionRestart = function MaterialRunboxActionRestart(_ref) {
|
|
|
88
76
|
id: "runbox.action.restart.dialog.description"
|
|
89
77
|
}))), React.createElement(DialogActions, null, React.createElement(Button, {
|
|
90
78
|
color: "inherit",
|
|
91
|
-
disabled:
|
|
92
|
-
onClick:
|
|
79
|
+
disabled: isLoading,
|
|
80
|
+
onClick: handleDialogClose
|
|
93
81
|
}, React.createElement(FormattedMessage, {
|
|
94
82
|
id: "runbox.common.close"
|
|
95
83
|
})), React.createElement(LoadingButton, {
|
|
96
84
|
variant: "contained",
|
|
97
85
|
color: "warning",
|
|
98
|
-
loading:
|
|
99
|
-
onClick:
|
|
86
|
+
loading: isLoading,
|
|
87
|
+
onClick: handleRestartAction
|
|
100
88
|
}, React.createElement(FormattedMessage, {
|
|
101
89
|
id: "runbox.action.restart.dialog.actions.confirm"
|
|
102
90
|
}))));
|
|
@@ -104,7 +92,7 @@ var MaterialRunboxActionRestart = function MaterialRunboxActionRestart(_ref) {
|
|
|
104
92
|
//
|
|
105
93
|
//
|
|
106
94
|
//
|
|
107
|
-
return React.createElement(React.Fragment, null,
|
|
95
|
+
return React.createElement(React.Fragment, null, renderRestartMenuItem(), renderConfirmDialog());
|
|
108
96
|
};
|
|
109
97
|
|
|
110
98
|
export { MaterialRunboxActionRestart as default };
|
|
@@ -1,3 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
|
|
2
|
+
interface MaterialRunboxActionShareProps {
|
|
3
|
+
handleMenuClose: () => void;
|
|
4
|
+
}
|
|
5
|
+
declare const MaterialRunboxActionShare: React.FC<MaterialRunboxActionShareProps>;
|
|
3
6
|
export default MaterialRunboxActionShare;
|
|
@@ -1,61 +1,91 @@
|
|
|
1
|
-
import { slicedToArray as _slicedToArray } from '../../../_virtual/_rollupPluginBabelHelpers.js';
|
|
2
1
|
import React from 'react';
|
|
3
|
-
import { useIntl } from 'react-intl';
|
|
2
|
+
import { useIntl, FormattedMessage } from 'react-intl';
|
|
4
3
|
import { useCopyToClipboard } from 'react-use';
|
|
4
|
+
import { EliceIcon } from '@elice/mui-elements';
|
|
5
|
+
import { useSnackbar } from '@elice/mui-x-snackbar';
|
|
5
6
|
import { useEliceRunboxRunning } from '@elice/runbox-client';
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
7
|
+
import { faLinkSimple } from '@fortawesome/pro-solid-svg-icons';
|
|
8
|
+
import { MenuItem, ListItemIcon, ListItemText } from '@mui/material';
|
|
9
|
+
import '../contexts/MaterialRunboxApiContext.js';
|
|
10
|
+
import '../contexts/MaterialRunboxCommandContext.js';
|
|
11
|
+
import { useMaterialRunboxContext } from '../contexts/MaterialRunboxContext.js';
|
|
8
12
|
|
|
9
13
|
//
|
|
10
14
|
//
|
|
11
15
|
//
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
16
|
+
const MaterialRunboxActionShare = ({
|
|
17
|
+
handleMenuClose
|
|
18
|
+
}) => {
|
|
19
|
+
const intl = useIntl();
|
|
20
|
+
const {
|
|
21
|
+
enqueueSnackbar
|
|
22
|
+
} = useSnackbar();
|
|
23
|
+
const {
|
|
24
|
+
enableUrlShare
|
|
25
|
+
} = useMaterialRunboxContext();
|
|
26
|
+
const {
|
|
27
|
+
url
|
|
28
|
+
} = useEliceRunboxRunning();
|
|
29
|
+
const [{
|
|
30
|
+
value: clipboardValue,
|
|
31
|
+
error
|
|
32
|
+
}, copy] = useCopyToClipboard();
|
|
33
|
+
const [isClipboardCopied, setClipboardCopied] = React.useState(false);
|
|
26
34
|
/**
|
|
27
35
|
*
|
|
28
36
|
*/
|
|
29
|
-
|
|
37
|
+
const renderShareMenuItem = () => {
|
|
38
|
+
if (!enableUrlShare) {
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
41
|
+
return React.createElement(MenuItem, {
|
|
42
|
+
disabled: !url,
|
|
43
|
+
onClick: handleShareAction
|
|
44
|
+
}, React.createElement(ListItemIcon, null, React.createElement(EliceIcon, {
|
|
45
|
+
icon: faLinkSimple
|
|
46
|
+
})), React.createElement(ListItemText, null, React.createElement(FormattedMessage, {
|
|
47
|
+
id: "runbox.action.share.title"
|
|
48
|
+
})));
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
*
|
|
52
|
+
*/
|
|
53
|
+
const handleShareAction = () => {
|
|
30
54
|
if (url) {
|
|
31
55
|
copy(url);
|
|
56
|
+
if (!error) {
|
|
57
|
+
handleMenuClose();
|
|
58
|
+
setClipboardCopied(true);
|
|
59
|
+
}
|
|
32
60
|
}
|
|
33
61
|
};
|
|
34
62
|
//
|
|
35
63
|
//
|
|
36
64
|
//
|
|
37
|
-
React.useEffect(
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
65
|
+
React.useEffect(() => {
|
|
66
|
+
if (!isClipboardCopied) {
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
if (clipboardValue && !error) {
|
|
70
|
+
enqueueSnackbar(intl.formatMessage({
|
|
71
|
+
id: 'runbox.action.share.snackbar.copied.success'
|
|
72
|
+
}), {
|
|
73
|
+
variant: 'success'
|
|
74
|
+
});
|
|
75
|
+
} else {
|
|
76
|
+
enqueueSnackbar(intl.formatMessage({
|
|
77
|
+
id: 'runbox.action.share.snackbar.copied.fail'
|
|
78
|
+
}), {
|
|
79
|
+
variant: 'error'
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
setClipboardCopied(false);
|
|
83
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
84
|
+
}, [isClipboardCopied]);
|
|
46
85
|
//
|
|
47
86
|
//
|
|
48
87
|
//
|
|
49
|
-
return
|
|
50
|
-
title: isClipboardCopied ? intl.formatMessage({
|
|
51
|
-
id: 'runbox.action.share.tooltip.copied'
|
|
52
|
-
}) : intl.formatMessage({
|
|
53
|
-
id: 'runbox.action.share.title'
|
|
54
|
-
})
|
|
55
|
-
}, React.createElement(IconButton, {
|
|
56
|
-
disabled: !isRunboxRunning || !url,
|
|
57
|
-
onClick: handleAction
|
|
58
|
-
}, isClipboardCopied ? React.createElement(Check, null) : React.createElement(Link, null)));
|
|
88
|
+
return renderShareMenuItem();
|
|
59
89
|
};
|
|
60
90
|
|
|
61
91
|
export { MaterialRunboxActionShare as default };
|
|
@@ -1,40 +1,33 @@
|
|
|
1
|
-
import { slicedToArray as _slicedToArray } from '../../../_virtual/_rollupPluginBabelHelpers.js';
|
|
2
1
|
import React from 'react';
|
|
3
2
|
import { RunboxApi, RuntimeApi, RuntimeTemplateApi } from '@elice/openapi-client-material-runbox';
|
|
4
3
|
|
|
5
4
|
//
|
|
6
5
|
//
|
|
7
6
|
//
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
const MaterialRunboxApiContext = React.createContext({});
|
|
8
|
+
const useMaterialRunboxApiContext = () => {
|
|
10
9
|
return React.useContext(MaterialRunboxApiContext);
|
|
11
10
|
};
|
|
12
11
|
//
|
|
13
12
|
//
|
|
14
13
|
//
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
14
|
+
const MaterialRunboxApiContextProvider = ({
|
|
15
|
+
children,
|
|
16
|
+
eliceMaterialRunboxApiConfiguration
|
|
17
|
+
}) => {
|
|
18
|
+
const createMaterialRunboxApi = () => Object.freeze({
|
|
19
|
+
runbox: new RunboxApi(eliceMaterialRunboxApiConfiguration),
|
|
20
|
+
runtime: new RuntimeApi(eliceMaterialRunboxApiConfiguration),
|
|
21
|
+
runtimeTemplate: new RuntimeTemplateApi(eliceMaterialRunboxApiConfiguration)
|
|
22
|
+
});
|
|
25
23
|
//
|
|
26
24
|
//
|
|
27
25
|
//
|
|
28
|
-
|
|
29
|
-
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
30
|
-
materialRunboxApi = _React$useState2[0],
|
|
31
|
-
setMaterialRunboxApi = _React$useState2[1];
|
|
26
|
+
const [materialRunboxApi, setMaterialRunboxApi] = React.useState(createMaterialRunboxApi);
|
|
32
27
|
//
|
|
33
28
|
//
|
|
34
29
|
//
|
|
35
|
-
React.useEffect(
|
|
36
|
-
return setMaterialRunboxApi(createMaterialRunboxApi);
|
|
37
|
-
},
|
|
30
|
+
React.useEffect(() => setMaterialRunboxApi(createMaterialRunboxApi),
|
|
38
31
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
39
32
|
[eliceMaterialRunboxApiConfiguration]);
|
|
40
33
|
//
|