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