@abtnode/ux 1.16.18-beta-7aa6be5a → 1.16.18-beta-bb4ebacc

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.
Files changed (47) hide show
  1. package/es/blocklet/actions.js +17 -6
  2. package/es/blocklet/add-cert.js +1 -0
  3. package/es/blocklet/component/add-component-core.js +1317 -0
  4. package/es/blocklet/component/add.js +14 -1246
  5. package/es/blocklet/component/select-store.js +21 -7
  6. package/es/blocklet/component/store-blocklet-list.js +20 -6
  7. package/es/blocklet/configuration.js +28 -118
  8. package/es/blocklet/logo-uploader.js +131 -0
  9. package/es/blocklet/oauth/federated-site-list.js +1 -1
  10. package/es/blocklet/publish/create-project.js +6 -2
  11. package/es/blocklet/publish/create-release.js +5 -4
  12. package/es/blocklet/publish/index.js +26 -2
  13. package/es/blocklet/publish/project-list.js +6 -2
  14. package/es/hooks/use-navigation.js +1 -1
  15. package/es/hooks/use-passport-id.js +9 -6
  16. package/es/locales/en.js +26 -5
  17. package/es/locales/zh.js +22 -1
  18. package/es/logs/log-terminal.js +2 -1
  19. package/es/schema-form/index.js +11 -3
  20. package/es/team/members/connections.js +27 -0
  21. package/es/team/members/member.js +2 -26
  22. package/es/team/members/passport-item.js +104 -0
  23. package/es/team/members/passports.js +23 -78
  24. package/lib/blocklet/actions.js +17 -6
  25. package/lib/blocklet/add-cert.js +1 -0
  26. package/lib/blocklet/component/add-component-core.js +1131 -0
  27. package/lib/blocklet/component/add.js +18 -1058
  28. package/lib/blocklet/component/select-store.js +25 -7
  29. package/lib/blocklet/component/store-blocklet-list.js +22 -8
  30. package/lib/blocklet/configuration.js +30 -90
  31. package/lib/blocklet/logo-uploader.js +112 -0
  32. package/lib/blocklet/oauth/federated-site-list.js +1 -1
  33. package/lib/blocklet/publish/create-project.js +5 -1
  34. package/lib/blocklet/publish/create-release.js +5 -4
  35. package/lib/blocklet/publish/index.js +27 -1
  36. package/lib/blocklet/publish/project-list.js +5 -1
  37. package/lib/hooks/use-navigation.js +1 -1
  38. package/lib/hooks/use-passport-id.js +9 -7
  39. package/lib/locales/en.js +26 -5
  40. package/lib/locales/zh.js +22 -1
  41. package/lib/logs/log-terminal.js +2 -1
  42. package/lib/schema-form/index.js +9 -3
  43. package/lib/team/members/connections.js +35 -0
  44. package/lib/team/members/member.js +8 -33
  45. package/lib/team/members/passport-item.js +95 -0
  46. package/lib/team/members/passports.js +26 -54
  47. package/package.json +20 -20
package/es/locales/en.js CHANGED
@@ -81,6 +81,7 @@ module.exports = {
81
81
  instances: 'Number of instances'
82
82
  },
83
83
  common: {
84
+ invalid: 'Invalid',
84
85
  about: 'About',
85
86
  access: 'Access',
86
87
  accessKey: 'Access Keys',
@@ -100,6 +101,7 @@ module.exports = {
100
101
  back: 'Back',
101
102
  basic: 'Basic',
102
103
  basicInfo: 'Basic Information',
104
+ profile: 'Profile',
103
105
  bind: 'Bind',
104
106
  blocklet: 'Blocklet',
105
107
  blocklets: 'Blocklets',
@@ -153,6 +155,7 @@ module.exports = {
153
155
  downloading: 'Downloading',
154
156
  edit: 'Edit',
155
157
  email: 'Email',
158
+ phone: 'Phone',
156
159
  empty: 'Empty',
157
160
  emptyData: 'No results found',
158
161
  enable: 'Enable',
@@ -394,9 +397,9 @@ module.exports = {
394
397
  securityError: 'SecurityError: Can not open the admin url from accessing a cross-origin frame'
395
398
  },
396
399
  config: {
397
- name: 'Blocklet Name',
398
- description: 'Blocklet Description',
399
- sk: 'Secret key for the blocklet wallet',
400
+ name: 'App Name',
401
+ description: 'App Description',
402
+ sk: 'Secret key for the app wallet',
400
403
  logoSquare: 'App Logo',
401
404
  logoRect: 'Rect logo',
402
405
  logoRectDesc: 'Usually displayed at the top of the page, default to app logo',
@@ -417,7 +420,7 @@ module.exports = {
417
420
  languages: 'Supported Languages',
418
421
  selectLanguagesTip: 'Adjust the order by removing and re-adding',
419
422
  passportColor: 'Passport Color',
420
- appUrl: 'Blocklet URL',
423
+ appUrl: 'App URL',
421
424
  access: {
422
425
  title: 'Who Can Access',
423
426
  description: 'Who can access the blocklet',
@@ -568,6 +571,7 @@ module.exports = {
568
571
  fromUrl: 'Add Component From Url'
569
572
  },
570
573
  addNext: 'Add {name}',
574
+ upgradeNext: 'Upgrade {name}',
571
575
  setting: 'Settings'
572
576
  },
573
577
  router: {
@@ -1106,7 +1110,24 @@ module.exports = {
1106
1110
  passportEmpty: 'Passport should not be empty'
1107
1111
  },
1108
1112
  connectedAccounts: 'Connected Accounts',
1109
- federated: 'Federated'
1113
+ connections: 'Connections',
1114
+ federated: 'Federated',
1115
+ switch: {
1116
+ did: 'Switch DID',
1117
+ profile: 'Switch Profile',
1118
+ passport: 'Switch Passport'
1119
+ },
1120
+ settings: {
1121
+ notification: 'Notifications',
1122
+ email: 'Send email to me when some events happen',
1123
+ wallet: 'Send notification to my wallet when some events happen',
1124
+ phone: 'Send text message to me when some events happen',
1125
+ webhook: 'Webhooks',
1126
+ add: 'Add new webhook',
1127
+ url: 'Custom URL',
1128
+ slack: 'Slack Webhook',
1129
+ tested: 'Test message sent'
1130
+ }
1110
1131
  },
1111
1132
  transferNode: {
1112
1133
  name: 'Transfer Ownership',
package/es/locales/zh.js CHANGED
@@ -84,6 +84,7 @@ module.exports = {
84
84
  instances: '实例数'
85
85
  },
86
86
  common: {
87
+ invalid: '无效',
87
88
  about: '关于',
88
89
  access: '访问',
89
90
  accessKey: '访问秘钥',
@@ -103,6 +104,7 @@ module.exports = {
103
104
  back: '返回',
104
105
  basic: '基础',
105
106
  basicInfo: '基础信息',
107
+ profile: '信息',
106
108
  bind: '绑定',
107
109
  blocklet: '基石程序',
108
110
  blocklets: '基石程序',
@@ -157,6 +159,7 @@ module.exports = {
157
159
  downloading: '下载中',
158
160
  edit: '编辑',
159
161
  email: '邮箱',
162
+ phone: '电话',
160
163
  empty: '暂无',
161
164
  emptyData: '未找到结果',
162
165
  enable: '启用',
@@ -575,6 +578,7 @@ module.exports = {
575
578
  fromUrl: '通过 URL 选择组件'
576
579
  },
577
580
  addNext: '添加 {name}',
581
+ upgradeNext: '升级 {name}',
578
582
  setting: '参数设置'
579
583
  },
580
584
  router: {
@@ -1109,7 +1113,24 @@ module.exports = {
1109
1113
  passportEmpty: '通行证不能为空'
1110
1114
  },
1111
1115
  connectedAccounts: '已连接账号',
1112
- federated: '统一登录'
1116
+ connections: '账号绑定',
1117
+ federated: '统一登录',
1118
+ switch: {
1119
+ did: '添加账户',
1120
+ profile: '更新身份',
1121
+ passport: '切换通行证'
1122
+ },
1123
+ settings: {
1124
+ notification: '通知设置',
1125
+ email: '当有动态时给我发送邮件',
1126
+ wallet: '当有动态时给我发送钱包通知',
1127
+ phone: '当有动态时给我发送短信',
1128
+ webhook: '外部钩子',
1129
+ add: '添加新钩子',
1130
+ url: '自定义 URL',
1131
+ slack: 'Slack 通知',
1132
+ tested: '测试消息已经发送'
1133
+ }
1113
1134
  },
1114
1135
  transferNode: {
1115
1136
  name: '转移所有者',
@@ -34,7 +34,8 @@ export function LogTerminalGroup({
34
34
  error: 'Error',
35
35
  access: 'Access',
36
36
  stdout: 'stdout',
37
- stderr: 'stderr'
37
+ stderr: 'stderr',
38
+ pm2: 'PM2'
38
39
  };
39
40
  const isMobile = useMediaQuery(theme => theme.breakpoints.down('md'));
40
41
  const [currentType, setCurrentType] = useState(types[defaultTypeIndex || 0]);
@@ -12,6 +12,7 @@ import TextInput from './text-input';
12
12
  import PassportInput from './passport-input';
13
13
  import Required from '../form/required';
14
14
  import FormWrapper from '../form/form-wrapper';
15
+ import Uploader from '../blocklet/logo-uploader';
15
16
  import { jsx as _jsx } from "react/jsx-runtime";
16
17
  import { jsxs as _jsxs } from "react/jsx-runtime";
17
18
  import { Fragment as _Fragment } from "react/jsx-runtime";
@@ -35,7 +36,10 @@ function getComponent(item, {
35
36
  const componentMap = {
36
37
  input: TextInput,
37
38
  color: ColorInput,
38
- passport: PassportInput
39
+ passport: PassportInput,
40
+ uploader: props => /*#__PURE__*/_jsx(Uploader, {
41
+ ...props.componentProps
42
+ })
39
43
  };
40
44
  return componentMap[componentType?.toLowerCase()];
41
45
  }
@@ -119,6 +123,7 @@ export default function SchemaForm({
119
123
  key,
120
124
  description,
121
125
  required,
126
+ solo = false,
122
127
  hidden = false,
123
128
  componentProps = {}
124
129
  } = x;
@@ -146,7 +151,7 @@ export default function SchemaForm({
146
151
  };
147
152
  return /*#__PURE__*/_jsxs(Box, {
148
153
  className: "form-item",
149
- children: [/*#__PURE__*/_jsxs(Box, {
154
+ children: [!solo && /*#__PURE__*/_jsxs(Box, {
150
155
  className: "form-item-label",
151
156
  style: {
152
157
  color: required && !currentValue ? '#ff0000' : '#333'
@@ -156,10 +161,13 @@ export default function SchemaForm({
156
161
  className: "form-item-body",
157
162
  children: [/*#__PURE__*/_jsx(Box, {
158
163
  className: "form-item-input",
164
+ sx: {
165
+ textAlign: solo ? 'center' : 'left'
166
+ },
159
167
  children: /*#__PURE__*/_jsx(CurrentComponent, {
160
168
  ...renderComponentProps
161
169
  })
162
- }), /*#__PURE__*/_jsx(Box, {
170
+ }), !solo && /*#__PURE__*/_jsx(Box, {
163
171
  className: "form-item-action",
164
172
  children: editing ? /*#__PURE__*/_jsxs(_Fragment, {
165
173
  children: [/*#__PURE__*/_jsx(IconButton, {
@@ -0,0 +1,27 @@
1
+ import React from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import InfoRow from '@arcblock/ux/lib/InfoRow';
4
+ import DidAddress from '../../did-address';
5
+ import { jsx as _jsx } from "react/jsx-runtime";
6
+ export default function UserConnections({
7
+ user
8
+ }) {
9
+ const connectedAccounts = user.connectedAccounts || [];
10
+ return connectedAccounts.map(account => {
11
+ return /*#__PURE__*/_jsx(InfoRow, {
12
+ style: {
13
+ alignItems: 'flex-start'
14
+ },
15
+ valueComponent: "div",
16
+ nameWidth: 120,
17
+ name: account.provider,
18
+ children: /*#__PURE__*/_jsx(DidAddress, {
19
+ did: account.did
20
+ })
21
+ }, account.did);
22
+ });
23
+ }
24
+ UserConnections.propTypes = {
25
+ user: PropTypes.object.isRequired
26
+ };
27
+ UserConnections.defaultProps = {};
@@ -26,6 +26,7 @@ import PassportIssuances from './passport-issuances';
26
26
  import Passports from './passports';
27
27
  import ToggleUserApproval from './toggle-user-approval';
28
28
  import { parseAvatar } from './util';
29
+ import UserConnections from './connections';
29
30
  import { jsx as _jsx } from "react/jsx-runtime";
30
31
  import { jsxs as _jsxs } from "react/jsx-runtime";
31
32
  function LinkUser({
@@ -47,31 +48,6 @@ function LinkUser({
47
48
  LinkUser.propTypes = {
48
49
  name: PropTypes.string.isRequired
49
50
  };
50
- function TabOAuth({
51
- user
52
- }) {
53
- const connectedAccounts = user.connectedAccounts || [];
54
- return connectedAccounts.map(account => {
55
- return /*#__PURE__*/_jsx(InfoRow, {
56
- style: {
57
- alignItems: 'flex-start'
58
- },
59
- valueComponent: "div",
60
- nameWidth: 120,
61
- name: account.provider,
62
- children: /*#__PURE__*/_jsx(DidAddress, {
63
- did: account.did
64
- })
65
- }, account.did);
66
- });
67
- }
68
- TabOAuth.propTypes = {
69
- user: PropTypes.object.isRequired,
70
- onChangeUser: PropTypes.func
71
- };
72
- TabOAuth.defaultProps = {
73
- onChangeUser: () => {}
74
- };
75
51
  const defaultTab = 'info';
76
52
  export default function Member({
77
53
  userDid,
@@ -232,7 +208,7 @@ export default function Member({
232
208
  oauth: {
233
209
  label: t('team.member.connectedAccounts'),
234
210
  value: 'oauth',
235
- component: () => /*#__PURE__*/_jsx(TabOAuth, {
211
+ component: () => /*#__PURE__*/_jsx(UserConnections, {
236
212
  user: pageState.user,
237
213
  onChangeUser: handleChangeUser
238
214
  })
@@ -0,0 +1,104 @@
1
+ /* eslint-disable prettier/prettier */
2
+ import React from 'react';
3
+ import PropTypes from 'prop-types';
4
+ import styled from '@emotion/styled';
5
+ import upperFirst from 'lodash/upperFirst';
6
+ import Box from '@mui/material/Box';
7
+ import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
8
+ import RevokeIcon from '@arcblock/icons/lib/RevokeIcon';
9
+ import { jsx as _jsx } from "react/jsx-runtime";
10
+ import { jsxs as _jsxs } from "react/jsx-runtime";
11
+ export default function PassportItem({
12
+ passport,
13
+ user,
14
+ color,
15
+ width,
16
+ icon,
17
+ children,
18
+ createPassportSvg,
19
+ ...rest
20
+ }) {
21
+ const {
22
+ t
23
+ } = useLocaleContext();
24
+ return /*#__PURE__*/_jsxs(Root, {
25
+ display: "flex",
26
+ alignItems: "center",
27
+ ...rest,
28
+ children: [/*#__PURE__*/_jsx("div", {
29
+ // eslint-disable-next-line react/no-danger
30
+ dangerouslySetInnerHTML: {
31
+ __html: createPassportSvg({
32
+ title: passport.title || passport.name,
33
+ issuer: passport.issuer && passport.issuer.name,
34
+ issuerDid: passport.issuer && passport.issuer.id,
35
+ ownerName: user.fullName,
36
+ ownerDid: user.did,
37
+ ownerAvatarUrl: user.avatar,
38
+ revoked: passport.revoked,
39
+ preferredColor: color,
40
+ width
41
+ })
42
+ }
43
+ }), /*#__PURE__*/_jsxs("div", {
44
+ className: "body",
45
+ children: [/*#__PURE__*/_jsxs(Box, {
46
+ className: "title",
47
+ display: "flex",
48
+ alignItems: "center",
49
+ children: [upperFirst(passport.title), /*#__PURE__*/_jsxs("div", {
50
+ className: "status-icons",
51
+ children: [icon, passport.revoked && /*#__PURE__*/_jsx(RevokeIcon, {})]
52
+ })]
53
+ }), passport.expirationDate && /*#__PURE__*/_jsx(Box, {
54
+ className: "title",
55
+ display: "flex",
56
+ alignItems: "center",
57
+ children: t('team.passport.validUntil', {
58
+ date: passport.expirationDate
59
+ })
60
+ }), children]
61
+ })]
62
+ });
63
+ }
64
+ PassportItem.propTypes = {
65
+ passport: PropTypes.any.isRequired,
66
+ user: PropTypes.any.isRequired,
67
+ color: PropTypes.string.isRequired,
68
+ createPassportSvg: PropTypes.func.isRequired,
69
+ icon: PropTypes.any,
70
+ children: PropTypes.any,
71
+ width: PropTypes.number
72
+ };
73
+ PassportItem.defaultProps = {
74
+ icon: null,
75
+ children: null,
76
+ width: 150
77
+ };
78
+ const Root = styled(Box)`
79
+ .body {
80
+ padding: 0;
81
+ margin-left: 24px;
82
+ margin-top: 0;
83
+ }
84
+ .title {
85
+ font-weight: 400;
86
+ font-size: 16px;
87
+ line-height: 19px;
88
+ color: #222222;
89
+ }
90
+ .tip {
91
+ display: flex;
92
+ align-items: center;
93
+ font-size: 14px;
94
+ margin-top: 6px;
95
+ color: #bbb;
96
+ }
97
+ .status-icons {
98
+ svg {
99
+ fill: #bfbfbf;
100
+ height: 1.2em;
101
+ margin-left: 0.4em;
102
+ }
103
+ }
104
+ `;
@@ -1,9 +1,8 @@
1
1
  /* eslint-disable prettier/prettier */
2
- import { useState } from 'react';
2
+ import React, { useState } from 'react';
3
3
  import PropTypes from 'prop-types';
4
4
  import styled from '@emotion/styled';
5
5
  import get from 'lodash/get';
6
- import upperFirst from 'lodash/upperFirst';
7
6
  import Toast from '@arcblock/ux/lib/Toast';
8
7
  import AddIcon from '@mui/icons-material/Add';
9
8
  import Box from '@mui/material/Box';
@@ -26,6 +25,7 @@ import Permission from '../../permission';
26
25
  import SearchInput from '../search-input';
27
26
  import ListHeader from '../styles/list-header';
28
27
  import IssuePassport from './issue-passport';
28
+ import PassportItem from './passport-item';
29
29
  import { jsx as _jsx } from "react/jsx-runtime";
30
30
  import { jsxs as _jsxs } from "react/jsx-runtime";
31
31
  function ConfirmDescription({
@@ -210,60 +210,30 @@ export default function Passports({
210
210
  justifyContent: "space-between",
211
211
  alignItems: "center",
212
212
  mt: 3,
213
- children: [/*#__PURE__*/_jsxs(Box, {
214
- display: "flex",
215
- alignItems: "center",
216
- children: [/*#__PURE__*/_jsx("div", {
217
- // eslint-disable-next-line react/no-danger
218
- dangerouslySetInnerHTML: {
219
- __html: createPassportSvg({
220
- title: x.title || x.name,
221
- issuer: x.issuer && x.issuer.name,
222
- issuerDid: x.issuer && x.issuer.id,
223
- ownerName: user.fullName,
224
- ownerDid: user.did,
225
- ownerAvatarUrl: user.avatar,
226
- revoked: x.revoked,
227
- preferredColor: passportColor,
228
- width: '150px'
213
+ children: [/*#__PURE__*/_jsx(PassportItem, {
214
+ passport: x,
215
+ user: user,
216
+ color: passportColor,
217
+ createPassportSvg: createPassportSvg,
218
+ icon: !!appIdList.length && !appIdList.includes(x.issuer.id) ? /*#__PURE__*/_jsx(ExternalIssuerIcon, {}) : null,
219
+ children: !!appIdList.length && !appIdList.includes(x.issuer.id) && /*#__PURE__*/_jsxs("div", {
220
+ className: "tip",
221
+ children: [x.issuer.id !== teamIssuerDid && !trustedPassports.some(y => y.issuerDid === x.issuer.id) && /*#__PURE__*/_jsx(Tooltip, {
222
+ title: t('team.passport.notTrustedIssuerTip'),
223
+ children: /*#__PURE__*/_jsx(Box, {
224
+ component: ErrorOutlineIcon,
225
+ style: {
226
+ fontSize: '1.3em'
227
+ },
228
+ color: "error.main",
229
+ mr: 0.5
229
230
  })
230
- }
231
- }), /*#__PURE__*/_jsxs("div", {
232
- className: "body",
233
- children: [/*#__PURE__*/_jsxs(Box, {
234
- className: "title",
235
- display: "flex",
236
- alignItems: "center",
237
- children: [upperFirst(x.title), /*#__PURE__*/_jsxs("div", {
238
- className: "status-icons",
239
- children: [!!appIdList.length && !appIdList.includes(x.issuer.id) && /*#__PURE__*/_jsx(ExternalIssuerIcon, {}), x.revoked && /*#__PURE__*/_jsx(RevokeIcon, {})]
240
- })]
241
- }), x.expirationDate && /*#__PURE__*/_jsx(Box, {
242
- className: "title",
243
- display: "flex",
244
- alignItems: "center",
245
- children: t('team.passport.validUntil', {
246
- date: x.expirationDate
231
+ }), /*#__PURE__*/_jsx("span", {
232
+ children: t('team.passport.issueBy', {
233
+ name: x.issuer.name
247
234
  })
248
- }), !!appIdList.length && !appIdList.includes(x.issuer.id) && /*#__PURE__*/_jsxs("div", {
249
- className: "tip",
250
- children: [x.issuer.id !== teamIssuerDid && !trustedPassports.some(y => y.issuerDid === x.issuer.id) && /*#__PURE__*/_jsx(Tooltip, {
251
- title: t('team.passport.notTrustedIssuerTip'),
252
- children: /*#__PURE__*/_jsx(Box, {
253
- component: ErrorOutlineIcon,
254
- style: {
255
- fontSize: '1.3em'
256
- },
257
- color: "error.main",
258
- mr: 0.5
259
- })
260
- }), /*#__PURE__*/_jsx("span", {
261
- children: t('team.passport.issueBy', {
262
- name: x.issuer.name
263
- })
264
- })]
265
235
  })]
266
- })]
236
+ })
267
237
  }), /*#__PURE__*/_jsx(Box, {
268
238
  children: revokeInfo(can, x).revokable ? /*#__PURE__*/_jsxs(Button, {
269
239
  variant: "outlined",
@@ -326,31 +296,6 @@ Passports.defaultProps = {
326
296
  };
327
297
  const Div = styled.div`
328
298
  .passport-item {
329
- .body {
330
- padding: 0;
331
- margin-left: 24px;
332
- margin-top: 0;
333
- }
334
- .title {
335
- font-weight: 400;
336
- font-size: 16px;
337
- line-height: 19px;
338
- color: #222222;
339
- }
340
- .tip {
341
- display: flex;
342
- align-items: center;
343
- font-size: 14px;
344
- margin-top: 6px;
345
- color: #bbb;
346
- }
347
- .status-icons {
348
- svg {
349
- fill: #bfbfbf;
350
- height: 1.2em;
351
- margin-left: 0.4em;
352
- }
353
- }
354
299
  .MuiButton-outlinedSecondary {
355
300
  color: #f16e6e;
356
301
  fill: #f16e6e;
@@ -94,7 +94,6 @@ function BlockletActions(_ref) {
94
94
  });
95
95
  setLoading(true);
96
96
  setCurrentAction(action);
97
- setConfirmSetting(null);
98
97
  let isRemoved = false;
99
98
  try {
100
99
  if (action === 'remove') {
@@ -151,6 +150,7 @@ function BlockletActions(_ref) {
151
150
  if (action === 'reload') {
152
151
  _Toast.default.success(t('blocklet.reloadSuccess'));
153
152
  }
153
+ setConfirmSetting(null);
154
154
  onComplete({
155
155
  action,
156
156
  blocklet
@@ -162,6 +162,7 @@ function BlockletActions(_ref) {
162
162
  blocklet,
163
163
  error: new Error(errMsg)
164
164
  });
165
+ throw new Error(errMsg);
165
166
  } finally {
166
167
  if (!isRemoved) {
167
168
  setLoading(false);
@@ -276,7 +277,6 @@ function BlockletActions(_ref) {
276
277
  e.preventDefault();
277
278
  // eslint-disable-next-line no-empty
278
279
  } catch (_unused3) {}
279
- setAnchorEl(null);
280
280
  if (typeof action.handler === 'function') {
281
281
  try {
282
282
  setLoading(true);
@@ -287,7 +287,10 @@ function BlockletActions(_ref) {
287
287
  console.error("Blocklet ".concat(action.name, " failed: "), err);
288
288
  } finally {
289
289
  setLoading(false);
290
+ setAnchorEl(null);
290
291
  }
292
+ } else {
293
+ setAnchorEl(null);
291
294
  }
292
295
  };
293
296
  const removeAction = !inService && (0, _util.isDeletableBlocklet)(blocklet) ? {
@@ -413,13 +416,18 @@ function BlockletActions(_ref) {
413
416
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_MenuItem.default, {
414
417
  dense: true,
415
418
  onClick: e => onAction(action, e),
416
- disabled: action.disabled,
419
+ disabled: loading || action.disabled,
417
420
  "data-cy": "".concat(action.action, "-blocklet"),
418
421
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_ListItemIcon.default, {
419
422
  style: {
420
423
  minWidth: 24
421
424
  },
422
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(action.icon, {
425
+ children: currentAction === action.action && loading ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_CircularProgress.default, {
426
+ size: 16,
427
+ sx: {
428
+ marginRight: 1
429
+ }
430
+ }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(action.icon, {
423
431
  fontSize: "small"
424
432
  })
425
433
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ListItemText.default, {
@@ -447,8 +455,11 @@ function BlockletActions(_ref) {
447
455
  "data-cy": "".concat(action.action, "-blocklet"),
448
456
  onClick: () => onAction(action),
449
457
  disabled: Boolean(action.disabled) || loading,
450
- children: [currentAction === action.action && loading && inProgress ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_CircularProgress.default, {
451
- size: 16
458
+ children: [currentAction === action.action && loading ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_CircularProgress.default, {
459
+ size: 16,
460
+ sx: {
461
+ marginRight: 1
462
+ }
452
463
  }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(action.icon, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
453
464
  className: "blocklet-action-text",
454
465
  children: action.name
@@ -19,6 +19,7 @@ var _blocklet = require("../contexts/blocklet");
19
19
  var _util = require("../util");
20
20
  var _jsxRuntime = require("react/jsx-runtime");
21
21
  const _excluded = ["domain", "domainStatus"];
22
+ /* eslint-disable react/no-unused-prop-types */
22
23
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
23
24
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
24
25
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }