@abtnode/ux 1.16.14-beta-0c29907f → 1.16.14-beta-1936d3d0
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/lib/blocklet/log.js +49 -5
- package/lib/blocklet/notification/email.js +26 -0
- package/lib/card-selector.js +5 -7
- package/lib/locales/en.js +1 -0
- package/lib/locales/zh.js +1 -0
- package/lib/logs/log-terminal.js +15 -6
- package/package.json +16 -16
package/lib/blocklet/log.js
CHANGED
|
@@ -6,7 +6,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.default = BlockletLog;
|
|
7
7
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
8
8
|
var _Box = _interopRequireDefault(require("@mui/material/Box"));
|
|
9
|
-
var
|
|
9
|
+
var _FormControl = _interopRequireDefault(require("@mui/material/FormControl"));
|
|
10
|
+
var _Select = _interopRequireDefault(require("@mui/material/Select"));
|
|
11
|
+
var _MenuItem = _interopRequireDefault(require("@mui/material/MenuItem"));
|
|
12
|
+
var _useLocalStorage = _interopRequireDefault(require("react-use/lib/useLocalStorage"));
|
|
10
13
|
var _logTerminal = require("../logs/log-terminal");
|
|
11
14
|
var _download = _interopRequireDefault(require("../logs/download"));
|
|
12
15
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
@@ -39,6 +42,43 @@ function BlockletLog(_ref) {
|
|
|
39
42
|
} = _ref,
|
|
40
43
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
41
44
|
const initialData = ['Tip: this tab will only show runtime logs. Please go to "Blocklet Server" to view other lifecycle logs of the blocklet (install/start/stop...)', '\r\n\r\n'];
|
|
45
|
+
const logs = ((blocklet === null || blocklet === void 0 ? void 0 : blocklet.children) || []).map(x => ({
|
|
46
|
+
did: x.meta.did,
|
|
47
|
+
name: x.meta.title,
|
|
48
|
+
types: ['error', 'info', 'access', 'stdout', 'stderr']
|
|
49
|
+
}));
|
|
50
|
+
|
|
51
|
+
// format: `{componentId},{defaultTypeIndex}`
|
|
52
|
+
const [config, setConfig] = (0, _useLocalStorage.default)("blocklet-log-".concat(blocklet.meta.did), '');
|
|
53
|
+
|
|
54
|
+
// eslint-disable-next-line prefer-const
|
|
55
|
+
let [componentId, defaultTypeIndex] = config.split(',');
|
|
56
|
+
if (!logs.find(x => x.did === componentId)) {
|
|
57
|
+
var _logs$;
|
|
58
|
+
componentId = (_logs$ = logs[0]) === null || _logs$ === void 0 ? void 0 : _logs$.did;
|
|
59
|
+
}
|
|
60
|
+
const onSelectChange = e => {
|
|
61
|
+
setConfig([e.target.value, defaultTypeIndex].join(','));
|
|
62
|
+
};
|
|
63
|
+
const componentSelect = /*#__PURE__*/(0, _jsxRuntime.jsx)(_FormControl.default, {
|
|
64
|
+
sx: {
|
|
65
|
+
minWidth: 240
|
|
66
|
+
},
|
|
67
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Select.default, {
|
|
68
|
+
value: componentId,
|
|
69
|
+
onChange: onSelectChange,
|
|
70
|
+
size: "small",
|
|
71
|
+
children: logs.map(x => /*#__PURE__*/(0, _jsxRuntime.jsx)(_MenuItem.default, {
|
|
72
|
+
value: x.did,
|
|
73
|
+
children: x.name
|
|
74
|
+
}, x.did))
|
|
75
|
+
})
|
|
76
|
+
});
|
|
77
|
+
const log = logs.find(item => item.did === componentId) || logs[0] || blocklet.meta;
|
|
78
|
+
const onTypeChange = type => {
|
|
79
|
+
const index = log.types.indexOf(type);
|
|
80
|
+
setConfig([componentId, index || 0].join(','));
|
|
81
|
+
};
|
|
42
82
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Box.default, _objectSpread(_objectSpread({
|
|
43
83
|
height: {
|
|
44
84
|
xs: 'calc(100vh - 444px)',
|
|
@@ -47,14 +87,18 @@ function BlockletLog(_ref) {
|
|
|
47
87
|
}
|
|
48
88
|
}, rest), {}, {
|
|
49
89
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_logTerminal.LogTerminalGroup, {
|
|
50
|
-
|
|
51
|
-
logId: "blocklet-".concat(blocklet.meta.did),
|
|
90
|
+
logId: log === blocklet.meta ? "blocklet-".concat(blocklet.meta.did) : "blocklet-".concat(blocklet.meta.did, "/").concat(log.did),
|
|
52
91
|
initialData: initialData,
|
|
92
|
+
prepend: componentSelect,
|
|
53
93
|
postpend: /*#__PURE__*/(0, _jsxRuntime.jsx)(_download.default, {
|
|
54
94
|
id: blocklet.meta.did,
|
|
55
95
|
name: blocklet.meta.name
|
|
56
|
-
})
|
|
57
|
-
|
|
96
|
+
}),
|
|
97
|
+
name: log.name,
|
|
98
|
+
types: log.types,
|
|
99
|
+
defaultTypeIndex: defaultTypeIndex,
|
|
100
|
+
onTypeChange: onTypeChange
|
|
101
|
+
}, log.did)
|
|
58
102
|
}));
|
|
59
103
|
}
|
|
60
104
|
BlockletLog.propTypes = {
|
|
@@ -24,6 +24,7 @@ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typ
|
|
|
24
24
|
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
25
25
|
const defaultFormValues = {
|
|
26
26
|
enabled: false,
|
|
27
|
+
secure: false,
|
|
27
28
|
from: '',
|
|
28
29
|
host: '',
|
|
29
30
|
port: '',
|
|
@@ -247,6 +248,31 @@ function NotificationEmail() {
|
|
|
247
248
|
}))
|
|
248
249
|
});
|
|
249
250
|
}
|
|
251
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactHookForm.Controller, {
|
|
252
|
+
name: "secure",
|
|
253
|
+
control: control,
|
|
254
|
+
rules: {
|
|
255
|
+
validate: noop
|
|
256
|
+
},
|
|
257
|
+
render: _ref7 => {
|
|
258
|
+
let {
|
|
259
|
+
field
|
|
260
|
+
} = _ref7;
|
|
261
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.FormControl, {
|
|
262
|
+
fullWidth: true,
|
|
263
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.FormControlLabel, {
|
|
264
|
+
control: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Switch, _objectSpread(_objectSpread({
|
|
265
|
+
checked: field.value
|
|
266
|
+
}, field), {}, {
|
|
267
|
+
disabled: !enabled
|
|
268
|
+
})),
|
|
269
|
+
label: t('notification.email.secure'),
|
|
270
|
+
style: {
|
|
271
|
+
marginBottom: 16
|
|
272
|
+
}
|
|
273
|
+
})
|
|
274
|
+
});
|
|
275
|
+
}
|
|
250
276
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Button, {
|
|
251
277
|
type: "submit",
|
|
252
278
|
variant: "contained",
|
package/lib/card-selector.js
CHANGED
|
@@ -61,7 +61,7 @@ function CardSelector(_ref) {
|
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
63
|
};
|
|
64
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
64
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(Container, {
|
|
65
65
|
ref: outterCon,
|
|
66
66
|
onTouchStart: touchstart,
|
|
67
67
|
onTouchEnd: touchend,
|
|
@@ -71,7 +71,7 @@ function CardSelector(_ref) {
|
|
|
71
71
|
transform: "translate(".concat(-translateX, "px, 0)")
|
|
72
72
|
},
|
|
73
73
|
children: list.map((e, i) => {
|
|
74
|
-
return /*#__PURE__*/(0, _jsxRuntime.
|
|
74
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
75
75
|
className: "card-item ".concat(i === selectedId ? 'selected' : ''),
|
|
76
76
|
style: {
|
|
77
77
|
width,
|
|
@@ -82,18 +82,16 @@ function CardSelector(_ref) {
|
|
|
82
82
|
,
|
|
83
83
|
|
|
84
84
|
onClick: () => selectedItem(i),
|
|
85
|
-
children:
|
|
85
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("object", {
|
|
86
86
|
data: e.src,
|
|
87
87
|
alt: e.name
|
|
88
|
-
})
|
|
89
|
-
className: "card-item-cover"
|
|
90
|
-
})]
|
|
88
|
+
})
|
|
91
89
|
}, i);
|
|
92
90
|
})
|
|
93
91
|
})
|
|
94
92
|
});
|
|
95
93
|
}
|
|
96
|
-
const
|
|
94
|
+
const Container = _styled.default.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n overflow: hidden;\n mask-image: linear-gradient(to left, transparent, black 3%, black 97%, transparent);\n overflow: hidden;\n .card-container {\n display: flex;\n white-space: nowrap;\n width: max-content;\n transition: all ease 0.3s;\n }\n .card-item {\n display: inline-flex;\n justify-content: center;\n align-items: center;\n flex-shrink: 0;\n cursor: pointer;\n\n object {\n pointer-events: none;\n max-width: 100%;\n max-height: 100%;\n width: auto;\n height: auto;\n outline: #526ded solid 0;\n transition: all ease 0.2s;\n box-shadow: rgba(0, 0, 0, 0.2) 0 0 10px;\n }\n &.selected {\n cursor: default;\n object {\n outline: #526ded solid 5px;\n }\n }\n }\n"])));
|
|
97
95
|
CardSelector.propTypes = {
|
|
98
96
|
list: _propTypes.default.array,
|
|
99
97
|
width: _propTypes.default.number,
|
package/lib/locales/en.js
CHANGED
|
@@ -773,6 +773,7 @@ module.exports = {
|
|
|
773
773
|
host: 'SMTP server host',
|
|
774
774
|
port: 'SMTP server port',
|
|
775
775
|
user: 'SMTP server username',
|
|
776
|
+
secure: 'Enable secure connection',
|
|
776
777
|
password: 'SMTP server user password',
|
|
777
778
|
fromRequired: 'Email sender is required',
|
|
778
779
|
fromInvalid: 'Email sender is invalid',
|
package/lib/locales/zh.js
CHANGED
package/lib/logs/log-terminal.js
CHANGED
|
@@ -16,7 +16,7 @@ var _clock = _interopRequireDefault(require("./clock"));
|
|
|
16
16
|
var _node = require("../contexts/node");
|
|
17
17
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
18
18
|
var _templateObject, _templateObject2;
|
|
19
|
-
const _excluded = ["name", "logId", "types", "initialData", "prepend", "postpend"],
|
|
19
|
+
const _excluded = ["name", "logId", "types", "defaultTypeIndex", "initialData", "prepend", "postpend", "onTypeChange"],
|
|
20
20
|
_excluded2 = ["logFile"];
|
|
21
21
|
/**
|
|
22
22
|
* 按 level/destination 分类的一组 terminal
|
|
@@ -35,9 +35,11 @@ function LogTerminalGroup(_ref) {
|
|
|
35
35
|
name,
|
|
36
36
|
logId,
|
|
37
37
|
types,
|
|
38
|
+
defaultTypeIndex,
|
|
38
39
|
initialData,
|
|
39
40
|
prepend,
|
|
40
|
-
postpend
|
|
41
|
+
postpend,
|
|
42
|
+
onTypeChange
|
|
41
43
|
} = _ref,
|
|
42
44
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
43
45
|
const {
|
|
@@ -53,7 +55,7 @@ function LogTerminalGroup(_ref) {
|
|
|
53
55
|
stderr: 'stderr'
|
|
54
56
|
};
|
|
55
57
|
const isMobile = (0, _useMediaQuery.default)(theme => theme.breakpoints.down('md'));
|
|
56
|
-
const [currentType, setCurrentType] = (0, _react.useState)(types[0]);
|
|
58
|
+
const [currentType, setCurrentType] = (0, _react.useState)(types[defaultTypeIndex || 0]);
|
|
57
59
|
const [logFiles, setLogFiles] = (0, _react.useState)();
|
|
58
60
|
const terminalRefs = (0, _react.useRef)({});
|
|
59
61
|
|
|
@@ -94,7 +96,10 @@ function LogTerminalGroup(_ref) {
|
|
|
94
96
|
variant: 'contained'
|
|
95
97
|
} : {};
|
|
96
98
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Button.default, _objectSpread(_objectSpread({}, props), {}, {
|
|
97
|
-
onClick: () =>
|
|
99
|
+
onClick: () => {
|
|
100
|
+
setCurrentType(type);
|
|
101
|
+
onTypeChange(type);
|
|
102
|
+
},
|
|
98
103
|
children: logTypeLabels[type]
|
|
99
104
|
}), type);
|
|
100
105
|
})
|
|
@@ -126,16 +131,20 @@ LogTerminalGroup.propTypes = {
|
|
|
126
131
|
logId: _propTypes.default.string.isRequired,
|
|
127
132
|
// 日志类型, info/error 或 stdin/stdout/access
|
|
128
133
|
types: _propTypes.default.arrayOf(_propTypes.default.string),
|
|
134
|
+
defaultTypeIndex: _propTypes.default.number,
|
|
129
135
|
// 写入 terminal 的初始数据
|
|
130
136
|
initialData: _propTypes.default.arrayOf(_propTypes.default.string),
|
|
131
137
|
prepend: _propTypes.default.node,
|
|
132
|
-
postpend: _propTypes.default.node
|
|
138
|
+
postpend: _propTypes.default.node,
|
|
139
|
+
onTypeChange: _propTypes.default.func
|
|
133
140
|
};
|
|
134
141
|
LogTerminalGroup.defaultProps = {
|
|
135
142
|
types: ['error', 'info', 'access', 'stdout', 'stderr'],
|
|
143
|
+
defaultTypeIndex: 0,
|
|
136
144
|
initialData: [],
|
|
137
145
|
prepend: null,
|
|
138
|
-
postpend: null
|
|
146
|
+
postpend: null,
|
|
147
|
+
onTypeChange: () => {}
|
|
139
148
|
};
|
|
140
149
|
const LogTerminalGroupRoot = _styled.default.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: column;\n height: 100%;\n .log-terminal-group-head {\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding-bottom: 16px;\n }\n\n .log-terminal-group-head-start {\n flex: 0 0 auto;\n display: flex;\n align-items: center;\n gap: 16px;\n ", " {\n flex-direction: column;\n align-items: start;\n }\n }\n\n .log-terminal-group-head-end {\n flex: 0 0 auto;\n display: flex;\n align-items: center;\n gap: 16px;\n ", " {\n flex-direction: column;\n align-items: start;\n }\n }\n .log-terminal-group-terminals {\n flex: 1;\n position: relative;\n overflow: hidden;\n > * {\n position: absolute;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n }\n }\n"])), props => props.theme.breakpoints.down('md'), props => props.theme.breakpoints.down('md'));
|
|
141
150
|
const LogTerminal = /*#__PURE__*/(0, _react.forwardRef)((_ref3, ref) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abtnode/ux",
|
|
3
|
-
"version": "1.16.14-beta-
|
|
3
|
+
"version": "1.16.14-beta-1936d3d0",
|
|
4
4
|
"description": "UX components shared across abtnode packages",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -23,23 +23,23 @@
|
|
|
23
23
|
"author": "linchen <linchen1987@foxmail.com> (http://github.com/linchen1987)",
|
|
24
24
|
"license": "Apache-2.0",
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@abtnode/auth": "1.16.14-beta-
|
|
27
|
-
"@abtnode/constant": "1.16.14-beta-
|
|
28
|
-
"@abtnode/util": "1.16.14-beta-
|
|
26
|
+
"@abtnode/auth": "1.16.14-beta-1936d3d0",
|
|
27
|
+
"@abtnode/constant": "1.16.14-beta-1936d3d0",
|
|
28
|
+
"@abtnode/util": "1.16.14-beta-1936d3d0",
|
|
29
29
|
"@ahooksjs/use-url-state": "^3.5.1",
|
|
30
30
|
"@arcblock/did": "^1.18.87",
|
|
31
|
-
"@arcblock/did-connect": "^2.5.
|
|
31
|
+
"@arcblock/did-connect": "^2.5.62",
|
|
32
32
|
"@arcblock/did-motif": "^1.1.13",
|
|
33
|
-
"@arcblock/icons": "^2.5.
|
|
34
|
-
"@arcblock/nft-display": "2.5.
|
|
35
|
-
"@arcblock/react-hooks": "^2.5.
|
|
36
|
-
"@arcblock/terminal": "^2.5.
|
|
37
|
-
"@arcblock/ux": "^2.5.
|
|
38
|
-
"@blocklet/constant": "1.16.14-beta-
|
|
39
|
-
"@blocklet/launcher-layout": "2.1.
|
|
40
|
-
"@blocklet/list": "^0.12.
|
|
41
|
-
"@blocklet/meta": "1.16.14-beta-
|
|
42
|
-
"@blocklet/ui-react": "^2.5.
|
|
33
|
+
"@arcblock/icons": "^2.5.62",
|
|
34
|
+
"@arcblock/nft-display": "2.5.62",
|
|
35
|
+
"@arcblock/react-hooks": "^2.5.62",
|
|
36
|
+
"@arcblock/terminal": "^2.5.62",
|
|
37
|
+
"@arcblock/ux": "^2.5.62",
|
|
38
|
+
"@blocklet/constant": "1.16.14-beta-1936d3d0",
|
|
39
|
+
"@blocklet/launcher-layout": "2.1.51",
|
|
40
|
+
"@blocklet/list": "^0.12.10",
|
|
41
|
+
"@blocklet/meta": "1.16.14-beta-1936d3d0",
|
|
42
|
+
"@blocklet/ui-react": "^2.5.62",
|
|
43
43
|
"@emotion/react": "^11.10.4",
|
|
44
44
|
"@emotion/styled": "^11.10.4",
|
|
45
45
|
"@iconify/react": "^4.0.0",
|
|
@@ -97,5 +97,5 @@
|
|
|
97
97
|
"@babel/preset-react": "^7.18.6",
|
|
98
98
|
"babel-plugin-inline-react-svg": "^1.1.2"
|
|
99
99
|
},
|
|
100
|
-
"gitHead": "
|
|
100
|
+
"gitHead": "32bcf5b55889ebd7302887eedd306d331e9cd3b8"
|
|
101
101
|
}
|