@abtnode/ux 1.16.29 → 1.16.30-beta-00e8bdd1

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.
@@ -49,6 +49,16 @@ const isCustom = (env, blocklet, ancestors = []) => {
49
49
  }
50
50
  return env.custom;
51
51
  };
52
+ const isValidKey = key => {
53
+ if ([BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_CLUSTER_SIZE].includes(key)) {
54
+ return true;
55
+ }
56
+ if (key.startsWith('BLOCKLET_') || key.startsWith('COMPONENT_')) {
57
+ return false;
58
+ }
59
+ return true;
60
+ };
61
+ const isCustomKey = key => [BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_CLUSTER_SIZE].includes(key) === false;
52
62
  export default function ComponentEnvironment({
53
63
  blocklet,
54
64
  ancestors
@@ -74,11 +84,11 @@ export default function ComponentEnvironment({
74
84
  Toast.error(t('blocklet.config.environment.keyValueRequired'));
75
85
  return;
76
86
  }
77
- if (data.key.startsWith('BLOCKLET_') || data.key.startsWith('COMPONENT_')) {
87
+ if (isValidKey(data.key) === false) {
78
88
  Toast.error(t('blocklet.config.environment.invalidKey'));
79
89
  return;
80
90
  }
81
- data.custom = true;
91
+ data.custom = isCustomKey(data.key);
82
92
  try {
83
93
  const result = await node.api.configBlocklet({
84
94
  input: {
@@ -97,7 +107,7 @@ export default function ComponentEnvironment({
97
107
  Toast.error(t('blocklet.config.environment.keyValueRequired'));
98
108
  return;
99
109
  }
100
- if (newData.key.startsWith('BLOCKLET_') && !BLOCKLET_CONFIGURABLE_KEY[newData.key]) {
110
+ if (isValidKey(newData.key) === false) {
101
111
  Toast.error(t('blocklet.config.environment.invalidKey'));
102
112
  return;
103
113
  }
@@ -119,7 +129,7 @@ export default function ComponentEnvironment({
119
129
  }
120
130
  configs.push({
121
131
  key: oldData.key,
122
- custom: true
132
+ custom: isCustomKey(newData.key)
123
133
  });
124
134
  }
125
135
  try {
@@ -149,7 +159,7 @@ export default function ComponentEnvironment({
149
159
  did: dids,
150
160
  configs: [{
151
161
  key: data.key,
152
- custom: true
162
+ custom: isCustomKey(data.key)
153
163
  }]
154
164
  }
155
165
  });
@@ -160,7 +170,7 @@ export default function ComponentEnvironment({
160
170
  };
161
171
 
162
172
  // configs
163
- const componentConfigs = (blocklet.configs || []).filter(x => !BLOCKLET_CONFIGURABLE_KEY[x.key]);
173
+ const componentConfigs = (blocklet.configs || []).filter(x => !BLOCKLET_CONFIGURABLE_KEY[x.key] || [BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_CLUSTER_SIZE].includes(x.key));
164
174
  const sharedConfigObj = getSharedConfigObj(ancestors[0], blocklet);
165
175
  const missingRequiredConfigs = getComponentMissingConfigs(blocklet, ancestors[0]);
166
176
  const configs = componentConfigs.map(x => ({
@@ -1,7 +1,6 @@
1
1
  import React, { useState, useContext } from 'react';
2
2
  import styled from '@emotion/styled';
3
3
  import PropTypes from 'prop-types';
4
- import get from 'lodash/get';
5
4
  import isEqual from 'lodash/isEqual';
6
5
  import Box from '@mui/material/Box';
7
6
  import Switch from '@mui/material/Switch';
@@ -9,14 +8,13 @@ import Divider from '@mui/material/Divider';
9
8
  import { LocaleContext } from '@arcblock/ux/lib/Locale/context';
10
9
  import Button from '@arcblock/ux/lib/Button';
11
10
  import LoopIcon from '@mui/icons-material/Loop';
12
- import { EVENTS } from '@abtnode/constant';
13
11
  import { BLOCKLET_CONFIGURABLE_KEY, BLOCKLET_TENANT_MODES, SUPPORTED_LANGUAGES } from '@blocklet/constant';
14
12
  import { getWhoCanAccess } from '@blocklet/meta/lib/util';
15
13
  import Toast from '@arcblock/ux/lib/Toast';
16
14
  import FormTextInput from '../form/form-text-input';
17
15
  import FormAutocompleteInput from '../form/form-autocomplete-input';
18
16
  import { useNodeContext } from '../contexts/node';
19
- import { isInstalling, isValidClusterSize, BlockletAdminRoles } from '../util';
17
+ import { isInstalling, BlockletAdminRoles } from '../util';
20
18
  import { enableDebug } from '../util/mode';
21
19
  import Permission, { withPermission } from '../permission';
22
20
  import ClearCache from '../clear-cache';
@@ -41,15 +39,11 @@ function BlockletEnvironment({
41
39
  api,
42
40
  inService,
43
41
  prefix,
44
- getSessionInHeader,
45
- ws: {
46
- useSubscription
47
- }
42
+ getSessionInHeader
48
43
  } = useNodeContext();
49
44
  const {
50
45
  t
51
46
  } = useContext(LocaleContext);
52
- const [cpuCores, setCpuCores] = useState('');
53
47
  const [loading, setLoading] = useState('');
54
48
  const [showTransferOwner, setShowTransferOwner] = useState(false);
55
49
  const whoCanAccess = getWhoCanAccess(blocklet);
@@ -68,12 +62,6 @@ function BlockletEnvironment({
68
62
  const {
69
63
  site
70
64
  } = blocklet;
71
- const clusterMode = get(blocklet.meta, 'capabilities.clusterMode', false);
72
- useSubscription(EVENTS.NODE_RUNTIME_INFO, res => {
73
- if (clusterMode) {
74
- setCpuCores(get(res, 'cpu.physicalCores', ''));
75
- }
76
- });
77
65
  if (isInstalling(blocklet.status)) {
78
66
  return null;
79
67
  }
@@ -108,16 +96,6 @@ function BlockletEnvironment({
108
96
  description: t('blocklet.config.copyrightYear'),
109
97
  value: copyrightYear ? copyrightYear.value : ''
110
98
  }];
111
- if (clusterMode) {
112
- const exist = blocklet.configs.find(x => x.key === BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_CLUSTER_SIZE);
113
- const value = exist ? exist.value : cpuCores;
114
- configurableEnvs.push({
115
- key: BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_CLUSTER_SIZE,
116
- description: t('blocklet.config.clusterSize'),
117
- value,
118
- cpuCores
119
- });
120
- }
121
99
  const onPublicToStoreChange = async e => {
122
100
  if (loading) {
123
101
  return;
@@ -143,16 +121,6 @@ function BlockletEnvironment({
143
121
  }
144
122
  };
145
123
  const onSubmitConfig = async (key, value) => {
146
- if (key === BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_CLUSTER_SIZE) {
147
- const errMessage = isValidClusterSize({
148
- value,
149
- cpuCores
150
- });
151
- if (errMessage) {
152
- Toast.error(errMessage);
153
- return;
154
- }
155
- }
156
124
  const params = [{
157
125
  key,
158
126
  value
@@ -1,74 +1,85 @@
1
1
  /* eslint-disable react/jsx-one-expression-per-line */
2
- import { useContext } from 'react';
2
+ import { useContext, useEffect } from 'react';
3
3
  import styled from '@emotion/styled';
4
- import PropTypes from 'prop-types';
4
+ import CircularProgress from '@mui/material/CircularProgress';
5
5
  import Typography from '@mui/material/Typography';
6
6
  import Link from '@mui/material/Link';
7
7
  import InfoRow from '@arcblock/ux/lib/InfoRow';
8
8
  import { LocaleContext } from '@arcblock/ux/lib/Locale/context';
9
+ import { useBlockletContext } from '../contexts/blocklet';
9
10
  import { filesize } from '../util';
10
11
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
11
12
  export default function BlockletDiskInfo({
12
- blocklet,
13
13
  ...rest
14
14
  }) {
15
15
  const {
16
16
  t
17
17
  } = useContext(LocaleContext);
18
- if (!blocklet.diskInfo) {
19
- return /*#__PURE__*/_jsx(Typography, {
20
- children: t('blocklet.diskInfo.empty')
18
+ const {
19
+ blocklet,
20
+ loadingDiskInfo,
21
+ actions
22
+ } = useBlockletContext();
23
+ useEffect(() => {
24
+ actions.refreshBlocklet({
25
+ showError: false,
26
+ attachDiskInfo: true
27
+ });
28
+ }, []); // eslint-disable-line
29
+
30
+ if (blocklet.diskInfo) {
31
+ const renderDiskInfo = (dir, size, handler) => /*#__PURE__*/_jsxs(Typography, {
32
+ children: [handler ?
33
+ /*#__PURE__*/
34
+ /* eslint-disable-next-line no-script-url, jsx-a11y/anchor-is-valid */
35
+ _jsx(Link, {
36
+ style: {
37
+ cursor: 'pointer'
38
+ },
39
+ onClick: handler,
40
+ underline: "hover",
41
+ children: dir
42
+ }) : dir, ' ', /*#__PURE__*/_jsx("strong", {
43
+ children: size ? filesize(size) : 'empty'
44
+ })]
45
+ });
46
+ const env = blocklet.environments.reduce((acc, x) => {
47
+ acc[x.key] = x.value;
48
+ return acc;
49
+ }, {});
50
+ const rows = [{
51
+ key: 'appDir',
52
+ name: t('blocklet.diskInfo.appDir'),
53
+ value: renderDiskInfo(env.BLOCKLET_APP_DIR, blocklet.diskInfo.app)
54
+ }, {
55
+ key: 'dataDir',
56
+ name: t('blocklet.diskInfo.dataDir'),
57
+ value: renderDiskInfo(env.BLOCKLET_DATA_DIR, blocklet.diskInfo.data)
58
+ }, {
59
+ key: 'logDir',
60
+ name: t('blocklet.diskInfo.logDir'),
61
+ value: renderDiskInfo(env.BLOCKLET_LOG_DIR, blocklet.diskInfo.log)
62
+ }, {
63
+ key: 'cacheDir',
64
+ name: t('blocklet.diskInfo.cacheDir'),
65
+ value: renderDiskInfo(env.BLOCKLET_CACHE_DIR, blocklet.diskInfo.cache)
66
+ }];
67
+ return /*#__PURE__*/_jsx(Div, {
68
+ component: "div",
69
+ ...rest,
70
+ children: rows.map(row => /*#__PURE__*/_jsx(InfoRow, {
71
+ valueComponent: "div",
72
+ nameWidth: 120,
73
+ name: row.name,
74
+ children: row.value
75
+ }, row.key))
21
76
  });
22
77
  }
23
- const renderDiskInfo = (dir, size, handler) => /*#__PURE__*/_jsxs(Typography, {
24
- children: [handler ?
25
- /*#__PURE__*/
26
- /* eslint-disable-next-line no-script-url, jsx-a11y/anchor-is-valid */
27
- _jsx(Link, {
28
- style: {
29
- cursor: 'pointer'
30
- },
31
- onClick: handler,
32
- underline: "hover",
33
- children: dir
34
- }) : dir, ' ', /*#__PURE__*/_jsx("strong", {
35
- children: size ? filesize(size) : 'empty'
36
- })]
37
- });
38
- const env = blocklet.environments.reduce((acc, x) => {
39
- acc[x.key] = x.value;
40
- return acc;
41
- }, {});
42
- const rows = [{
43
- key: 'appDir',
44
- name: t('blocklet.diskInfo.appDir'),
45
- value: renderDiskInfo(env.BLOCKLET_APP_DIR, blocklet.diskInfo.app)
46
- }, {
47
- key: 'dataDir',
48
- name: t('blocklet.diskInfo.dataDir'),
49
- value: renderDiskInfo(env.BLOCKLET_DATA_DIR, blocklet.diskInfo.data)
50
- }, {
51
- key: 'logDir',
52
- name: t('blocklet.diskInfo.logDir'),
53
- value: renderDiskInfo(env.BLOCKLET_LOG_DIR, blocklet.diskInfo.log)
54
- }, {
55
- key: 'cacheDir',
56
- name: t('blocklet.diskInfo.cacheDir'),
57
- value: renderDiskInfo(env.BLOCKLET_CACHE_DIR, blocklet.diskInfo.cache)
58
- }];
59
- return /*#__PURE__*/_jsx(Div, {
60
- component: "div",
61
- ...rest,
62
- children: rows.map(row => /*#__PURE__*/_jsx(InfoRow, {
63
- valueComponent: "div",
64
- nameWidth: 120,
65
- name: row.name,
66
- children: row.value
67
- }, row.key))
78
+ if (loadingDiskInfo) {
79
+ return /*#__PURE__*/_jsx(CircularProgress, {});
80
+ }
81
+ return /*#__PURE__*/_jsx(Typography, {
82
+ children: t('blocklet.diskInfo.empty')
68
83
  });
69
84
  }
70
- BlockletDiskInfo.propTypes = {
71
- blocklet: PropTypes.object.isRequired
72
- };
73
- BlockletDiskInfo.defaultProps = {};
74
85
  const Div = styled(Typography)``;
@@ -104,9 +104,7 @@ function Connected() {
104
104
  fontWeight: "bold",
105
105
  mb: 2,
106
106
  children: t('common.dataStorage')
107
- }), /*#__PURE__*/_jsx(DiskInfo, {
108
- blocklet: blocklet
109
- })]
107
+ }), /*#__PURE__*/_jsx(DiskInfo, {})]
110
108
  });
111
109
  }
112
110
  export default Connected;
@@ -198,7 +198,6 @@ EmptySpacesNFT.defaultProps = {
198
198
  xmlns: "http://www.w3.org/2000/svg",
199
199
  xmlnsXlink: "http://www.w3.org/1999/xlink"
200
200
  };
201
- import { useBlockletContext } from '../../contexts/blocklet';
202
201
  import ConnectTo from './connect-to';
203
202
  import DiskInfo from '../disk-info';
204
203
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
@@ -206,9 +205,6 @@ function Disconnect() {
206
205
  const {
207
206
  t
208
207
  } = useLocaleContext();
209
- const {
210
- blocklet
211
- } = useBlockletContext();
212
208
  return /*#__PURE__*/_jsxs(Box, {
213
209
  children: [/*#__PURE__*/_jsxs(Box, {
214
210
  minHeight: "40vh",
@@ -232,9 +228,7 @@ function Disconnect() {
232
228
  fontWeight: "bold",
233
229
  mb: 2,
234
230
  children: t('common.dataStorage')
235
- }), /*#__PURE__*/_jsx(DiskInfo, {
236
- blocklet: blocklet
237
- })]
231
+ }), /*#__PURE__*/_jsx(DiskInfo, {})]
238
232
  });
239
233
  }
240
234
  Disconnect.propTypes = {};
@@ -56,6 +56,7 @@ export function useBlocklet({
56
56
  const [error, setError] = useState(null);
57
57
  const [loading, setLoading] = useState(false);
58
58
  const [loadingRuntimeInfo, setLoadingRuntimeInfo] = useState(false);
59
+ const [loadingDiskInfo, setLoadingDiskInfo] = useState(true);
59
60
  const [blocklet, setBlocklet] = useState();
60
61
  const [runtimeHistory, setRuntimeHistory] = useState({
61
62
  cpu: [],
@@ -69,8 +70,12 @@ export function useBlocklet({
69
70
  domainsAccessibility,
70
71
  recommendedDomain
71
72
  } = useDomainsAccessibility(domains);
72
- const refreshRuntimeInfo = async () => {
73
- setLoadingRuntimeInfo(true);
73
+ const refreshRuntimeInfo = async (attachDiskInfo = false) => {
74
+ if (attachDiskInfo) {
75
+ setLoadingDiskInfo(true);
76
+ } else {
77
+ setLoadingRuntimeInfo(true);
78
+ }
74
79
  try {
75
80
  const {
76
81
  blocklet: data
@@ -78,6 +83,7 @@ export function useBlocklet({
78
83
  input: {
79
84
  did,
80
85
  attachRuntimeInfo: true,
86
+ attachDiskInfo,
81
87
  getOptionalComponents
82
88
  }
83
89
  });
@@ -89,7 +95,11 @@ export function useBlocklet({
89
95
  } catch (err) {
90
96
  Toast.error(err.message);
91
97
  } finally {
92
- setLoadingRuntimeInfo(false);
98
+ if (attachDiskInfo) {
99
+ setLoadingDiskInfo(false);
100
+ } else {
101
+ setLoadingRuntimeInfo(false);
102
+ }
93
103
  }
94
104
  };
95
105
  const getRuntimeHistory = async () => {
@@ -118,7 +128,8 @@ export function useBlocklet({
118
128
  };
119
129
  const refreshBlocklet = async ({
120
130
  showError = true,
121
- attachRuntimeInfo = true
131
+ attachRuntimeInfo = true,
132
+ attachDiskInfo = false
122
133
  } = {}) => {
123
134
  if (loading) {
124
135
  return;
@@ -145,7 +156,7 @@ export function useBlocklet({
145
156
  });
146
157
  setLoading(false);
147
158
  if (attachRuntimeInfo) {
148
- refreshRuntimeInfo();
159
+ refreshRuntimeInfo(attachDiskInfo);
149
160
  getRuntimeHistory();
150
161
  }
151
162
  } else {
@@ -303,6 +314,7 @@ export function useBlocklet({
303
314
  return {
304
315
  loading,
305
316
  loadingRuntimeInfo,
317
+ loadingDiskInfo,
306
318
  error,
307
319
  blocklet: data,
308
320
  runtimeHistory,
package/lib/locales/ar.js CHANGED
@@ -1274,7 +1274,8 @@ export default {
1274
1274
  },
1275
1275
  activeUserSessions: 'جلسات المستخدم النشطة',
1276
1276
  forceLogout: 'تسجيل الخروج القسري',
1277
- forceLogoutDescription: 'هل تؤكد تسجيل خروج هذا المستخدم؟'
1277
+ forceLogoutDescription: 'هل تؤكد تسجيل خروج هذا المستخدم؟',
1278
+ openProfile: 'عرض الصفحة الشخصية'
1278
1279
  },
1279
1280
  transferNode: {
1280
1281
  name: 'تحويل الملكية',
package/lib/locales/de.js CHANGED
@@ -1274,7 +1274,8 @@ export default {
1274
1274
  },
1275
1275
  activeUserSessions: 'Aktive Benutzersitzungen',
1276
1276
  forceLogout: 'Erzwungenes Abmelden',
1277
- forceLogoutDescription: 'Bestätigen Sie die erzwungene Abmeldung dieses Benutzers?'
1277
+ forceLogoutDescription: 'Bestätigen Sie die erzwungene Abmeldung dieses Benutzers?',
1278
+ openProfile: 'Profil anzeigen'
1278
1279
  },
1279
1280
  transferNode: {
1280
1281
  name: 'Änderung des Eigentums',
package/lib/locales/en.js CHANGED
@@ -1228,6 +1228,7 @@ export default {
1228
1228
  passports: 'Passports',
1229
1229
  lastLogin: 'Last Login',
1230
1230
  lastLoginIp: 'Last Login IP',
1231
+ openProfile: 'View Profile',
1231
1232
  source: 'Register Source',
1232
1233
  source_derived: 'Derived from oauth',
1233
1234
  source_wallet: 'DID Wallet',
package/lib/locales/es.js CHANGED
@@ -1274,7 +1274,8 @@ export default {
1274
1274
  },
1275
1275
  activeUserSessions: 'Sesiones de usuario activas',
1276
1276
  forceLogout: 'Cerrar sesión forzada',
1277
- forceLogoutDescription: '¿Confirmar para forzar el cierre de sesión de este usuario?'
1277
+ forceLogoutDescription: '¿Confirmar para forzar el cierre de sesión de este usuario?',
1278
+ openProfile: 'Ver Perfil'
1278
1279
  },
1279
1280
  transferNode: {
1280
1281
  name: 'Transferir propiedad',
package/lib/locales/fr.js CHANGED
@@ -1274,7 +1274,8 @@ export default {
1274
1274
  },
1275
1275
  activeUserSessions: "Sessions d'utilisateurs actives",
1276
1276
  forceLogout: 'Déconnexion forcée',
1277
- forceLogoutDescription: 'Confirmez-vous la déconnexion forcée de cet utilisateur?'
1277
+ forceLogoutDescription: 'Confirmez-vous la déconnexion forcée de cet utilisateur?',
1278
+ openProfile: 'Voir le profil'
1278
1279
  },
1279
1280
  transferNode: {
1280
1281
  name: 'Transfert de propriété',
package/lib/locales/hi.js CHANGED
@@ -1274,7 +1274,8 @@ export default {
1274
1274
  },
1275
1275
  activeUserSessions: 'सक्रिय उपयोगकर्ता सत्र',
1276
1276
  forceLogout: 'बाहर करें बल',
1277
- forceLogoutDescription: 'क्या आप इस उपयोगकर्ता को बाहर करने के लिए पुष्टि करें?'
1277
+ forceLogoutDescription: 'क्या आप इस उपयोगकर्ता को बाहर करने के लिए पुष्टि करें?',
1278
+ openProfile: 'प्रोफ़ाइल देखें'
1278
1279
  },
1279
1280
  transferNode: {
1280
1281
  name: 'स्वामित्व स्थानांतरण',
Binary file
package/lib/locales/id.js CHANGED
@@ -1274,7 +1274,8 @@ export default {
1274
1274
  },
1275
1275
  activeUserSessions: 'Sesi Pengguna Aktif',
1276
1276
  forceLogout: 'Keluar paksa',
1277
- forceLogoutDescription: 'Konfirmasi untuk logout paksa pengguna ini?'
1277
+ forceLogoutDescription: 'Konfirmasi untuk logout paksa pengguna ini?',
1278
+ openProfile: 'Lihat Profil'
1278
1279
  },
1279
1280
  transferNode: {
1280
1281
  name: 'Pindahkan Kepemilikan',
package/lib/locales/ja.js CHANGED
@@ -1274,7 +1274,8 @@ export default {
1274
1274
  },
1275
1275
  activeUserSessions: 'アクティブユーザーセッション',
1276
1276
  forceLogout: '強制ログアウト',
1277
- forceLogoutDescription: 'このユーザーを強制的にログアウトしますか?'
1277
+ forceLogoutDescription: 'このユーザーを強制的にログアウトしますか?',
1278
+ openProfile: 'プロフィールを表示'
1278
1279
  },
1279
1280
  transferNode: {
1280
1281
  name: '権限の移譲',
package/lib/locales/ko.js CHANGED
@@ -1274,7 +1274,8 @@ export default {
1274
1274
  },
1275
1275
  activeUserSessions: '활성 사용자 세션',
1276
1276
  forceLogout: '강제 로그아웃',
1277
- forceLogoutDescription: '이 사용자를 강제로 로그아웃하시겠습니까?'
1277
+ forceLogoutDescription: '이 사용자를 강제로 로그아웃하시겠습니까?',
1278
+ openProfile: '프로필 보기'
1278
1279
  },
1279
1280
  transferNode: {
1280
1281
  name: '소유권 이전',
package/lib/locales/pt.js CHANGED
@@ -1274,7 +1274,8 @@ export default {
1274
1274
  },
1275
1275
  activeUserSessions: 'Sessões de Usuários Ativos',
1276
1276
  forceLogout: 'Logout forçado',
1277
- forceLogoutDescription: 'Confirmar o logout forçado deste usuário?'
1277
+ forceLogoutDescription: 'Confirmar o logout forçado deste usuário?',
1278
+ openProfile: 'Ver perfil'
1278
1279
  },
1279
1280
  transferNode: {
1280
1281
  name: 'Transferir Propriedade',
package/lib/locales/ru.js CHANGED
@@ -1274,7 +1274,8 @@ export default {
1274
1274
  },
1275
1275
  activeUserSessions: 'Активные пользовательские сессии',
1276
1276
  forceLogout: 'Принудительный выход',
1277
- forceLogoutDescription: 'Подтвердить выход из системы этого пользователя?'
1277
+ forceLogoutDescription: 'Подтвердить выход из системы этого пользователя?',
1278
+ openProfile: 'Просмотр профиля'
1278
1279
  },
1279
1280
  transferNode: {
1280
1281
  name: 'Передача собственности',
package/lib/locales/th.js CHANGED
@@ -1274,7 +1274,8 @@ export default {
1274
1274
  },
1275
1275
  activeUserSessions: 'เซสชันผู้ใช้ที่ใช้งานอยู่',
1276
1276
  forceLogout: 'ออกจากระบบบังคับ',
1277
- forceLogoutDescription: 'ยืนยันให้ออกจากระบบผู้ใช้นี้หรือไม่?'
1277
+ forceLogoutDescription: 'ยืนยันให้ออกจากระบบผู้ใช้นี้หรือไม่?',
1278
+ openProfile: 'ดูโปรไฟล์'
1278
1279
  },
1279
1280
  transferNode: {
1280
1281
  name: 'โอนสิทธิ์การเป็นเจ้าของ',
package/lib/locales/vi.js CHANGED
@@ -1274,7 +1274,8 @@ export default {
1274
1274
  },
1275
1275
  activeUserSessions: 'Phiên người dùng hoạt động',
1276
1276
  forceLogout: 'Đăng xuất bắt buộc',
1277
- forceLogoutDescription: 'Xác nhận đăng xuất buộc người dùng này?'
1277
+ forceLogoutDescription: 'Xác nhận đăng xuất buộc người dùng này?',
1278
+ openProfile: 'Xem hồ sơ'
1278
1279
  },
1279
1280
  transferNode: {
1280
1281
  name: 'Chuyển quyền sở hữu',
@@ -1274,7 +1274,8 @@ export default {
1274
1274
  },
1275
1275
  activeUserSessions: '活躍用戶會話',
1276
1276
  forceLogout: '強制登出',
1277
- forceLogoutDescription: '確認是否強制登出此使用者?'
1277
+ forceLogoutDescription: '確認是否強制登出此使用者?',
1278
+ openProfile: '檢視個人檔案'
1278
1279
  },
1279
1280
  transferNode: {
1280
1281
  name: '轉讓所有權',
package/lib/locales/zh.js CHANGED
@@ -1274,7 +1274,8 @@ export default {
1274
1274
  },
1275
1275
  activeUserSessions: '活跃用户会话',
1276
1276
  forceLogout: '强制注销',
1277
- forceLogoutDescription: '确认是否强制退出此用户?'
1277
+ forceLogoutDescription: '确认是否强制退出此用户?',
1278
+ openProfile: '查看个人资料'
1278
1279
  },
1279
1280
  transferNode: {
1280
1281
  name: '转移所有者',
@@ -1,5 +1,5 @@
1
1
  import PropTypes from 'prop-types';
2
- import { Alert, Box, CircularProgress, DialogContentText, MenuItem, Select, TextField, InputLabel, FormControl } from '@mui/material';
2
+ import { Alert, Box, CircularProgress, DialogContentText, MenuItem, Select, TextField, InputLabel, FormControl, Typography } from '@mui/material';
3
3
  import { useReactive } from 'ahooks';
4
4
  import Dialog from '@arcblock/ux/lib/Dialog';
5
5
  import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
@@ -139,8 +139,21 @@ export default function InviteMember({
139
139
  children: roles.filter(d => d.name !== 'owner').map(r => /*#__PURE__*/_jsx(MenuItem, {
140
140
  value: r.name,
141
141
  "data-cy": `invite-member-select-option-${r.name}`,
142
- children: /*#__PURE__*/_jsx("span", {
143
- children: r.title || r.name
142
+ children: /*#__PURE__*/_jsxs(Box, {
143
+ sx: {
144
+ display: 'flex',
145
+ flexDirection: 'column'
146
+ },
147
+ children: [/*#__PURE__*/_jsx(Typography, {
148
+ variant: "subtitle1",
149
+ children: r.title || r.name
150
+ }), /*#__PURE__*/_jsx(Typography, {
151
+ variant: "caption",
152
+ sx: {
153
+ opacity: 0.7
154
+ },
155
+ children: r.description
156
+ })]
144
157
  })
145
158
  }, r.name))
146
159
  })]
@@ -11,6 +11,7 @@ import FormControl from '@mui/material/FormControl';
11
11
  import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
12
12
  import Button from '@arcblock/ux/lib/Button';
13
13
  import Alert from '@mui/material/Alert';
14
+ import { Box } from '@mui/material';
14
15
  import { useNodeContext } from '../../contexts/node';
15
16
  import { formatError } from '../../util';
16
17
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
@@ -57,6 +58,7 @@ export default function IssuePassport({
57
58
  setLoading(false);
58
59
  }
59
60
  };
61
+ console.error('--debug--', roles);
60
62
  return /*#__PURE__*/_jsxs(Dialog, {
61
63
  title: t('team.passport.issue'),
62
64
  fullWidth: true,
@@ -118,8 +120,21 @@ export default function IssuePassport({
118
120
  children: roles.filter(d => showOwnerPassport || d.name !== 'owner').map(r => /*#__PURE__*/_jsx(MenuItem, {
119
121
  value: r.name,
120
122
  "data-cy": `issue-passport-select-option-${r.name}`,
121
- children: /*#__PURE__*/_jsx("span", {
122
- children: r.title || r.name
123
+ children: /*#__PURE__*/_jsxs(Box, {
124
+ sx: {
125
+ display: 'flex',
126
+ flexDirection: 'column'
127
+ },
128
+ children: [/*#__PURE__*/_jsx(Typography, {
129
+ variant: "subtitle1",
130
+ children: r.title || r.name
131
+ }), /*#__PURE__*/_jsx(Typography, {
132
+ variant: "caption",
133
+ sx: {
134
+ opacity: 0.7
135
+ },
136
+ children: r.description
137
+ })]
123
138
  })
124
139
  }, r.name))
125
140
  })]
@@ -1,5 +1,5 @@
1
1
  /* eslint-disable react/no-unstable-nested-components */
2
- import { useEffect } from 'react';
2
+ import { useEffect, useState } from 'react';
3
3
  import PropTypes from 'prop-types';
4
4
  import styled from '@emotion/styled';
5
5
  import Toast from '@arcblock/ux/lib/Toast';
@@ -14,8 +14,10 @@ import ForbidLoginIcon from '@arcblock/icons/lib/ForbidLoginIcon';
14
14
  import AllowLoginIcon from '@arcblock/icons/lib/AllowLoginIcon';
15
15
  import { getTextColor } from '@abtnode/auth/lib/util/create-passport-svg';
16
16
  import { useReactive } from 'ahooks';
17
+ import { Icon } from '@iconify/react';
17
18
  import { USER_TYPE } from '@abtnode/constant';
18
19
  import { LOGIN_PROVIDER, PROVIDER_NAME, TeamEvents } from '@blocklet/constant';
20
+ import { Button } from '@mui/material';
19
21
  import Tag from '../../tag';
20
22
  import DidAddress from '../../did-address';
21
23
  import Permission from '../../permission';
@@ -26,6 +28,7 @@ import PassportIssuances from './passport-issuances';
26
28
  import Passports from './passports';
27
29
  import ToggleUserApproval from './toggle-user-approval';
28
30
  import { parseAvatar } from './util';
31
+ import blockletSdk from '../../util/sdk';
29
32
  import UserConnections from './connections';
30
33
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
31
34
  function LinkUser({
@@ -75,6 +78,7 @@ export default function Member({
75
78
  issuances: null,
76
79
  tab: initTab || defaultTab
77
80
  });
81
+ const [profileUrl, setProfileUrl] = useState('');
78
82
  const getData = async (_teamDid, _userDid) => {
79
83
  try {
80
84
  const res = await api.doBatchQuery({
@@ -126,6 +130,12 @@ export default function Member({
126
130
  }
127
131
  }, [pageState.issuances]); // eslint-disable-line
128
132
 
133
+ useEffect(() => {
134
+ blockletSdk.user.getProfileUrl({
135
+ did: pageState.user?.did,
136
+ locale
137
+ }).then(setProfileUrl);
138
+ }, [pageState.user?.did, locale]);
129
139
  const handleChangeUser = async changedUser => {
130
140
  await getData(teamDid, changedUser.did);
131
141
  pageState.tab = defaultTab;
@@ -298,29 +308,55 @@ export default function Member({
298
308
  children: /*#__PURE__*/_jsx(Spinner, {})
299
309
  }), pageState.user && /*#__PURE__*/_jsxs("div", {
300
310
  children: [/*#__PURE__*/_jsxs(Box, {
301
- display: "flex",
302
- alignItems: "center",
303
- className: "info",
304
- children: [/*#__PURE__*/_jsx(Avatar, {
305
- src: pageState.user.avatar,
306
- style: {
307
- width: 48,
308
- height: 48,
309
- backgroundColor: 'transparent',
310
- marginRight: 16
311
- }
312
- }), /*#__PURE__*/_jsxs(Box, {
313
- children: [/*#__PURE__*/_jsx(Box, {
314
- className: "name",
315
- children: pageState.user.fullName
316
- }), /*#__PURE__*/_jsx(Box, {
317
- className: "did",
318
- mt: 1,
319
- children: /*#__PURE__*/_jsx(DidAddress, {
320
- did: pageState.user.did,
321
- showQrcode: true
322
- })
311
+ sx: {
312
+ display: 'flex',
313
+ flexDirection: 'row',
314
+ alignItems: 'center',
315
+ justifyContent: 'space-between'
316
+ },
317
+ children: [/*#__PURE__*/_jsxs(Box, {
318
+ display: "flex",
319
+ alignItems: "center",
320
+ className: "info",
321
+ children: [/*#__PURE__*/_jsx(Avatar, {
322
+ src: pageState.user.avatar,
323
+ style: {
324
+ width: 48,
325
+ height: 48,
326
+ backgroundColor: 'transparent',
327
+ marginRight: 16
328
+ }
329
+ }), /*#__PURE__*/_jsxs(Box, {
330
+ children: [/*#__PURE__*/_jsx(Box, {
331
+ className: "name",
332
+ children: pageState.user.fullName
333
+ }), /*#__PURE__*/_jsx(Box, {
334
+ className: "did",
335
+ mt: 1,
336
+ children: /*#__PURE__*/_jsx(DidAddress, {
337
+ compact: true,
338
+ responsive: false,
339
+ did: pageState.user.did,
340
+ showQrcode: true
341
+ })
342
+ })]
323
343
  })]
344
+ }), !!inService && /*#__PURE__*/_jsx("a", {
345
+ href: profileUrl,
346
+ target: "_blank",
347
+ rel: "noreferrer",
348
+ children: /*#__PURE__*/_jsxs(Button, {
349
+ variant: "contained",
350
+ color: "primary",
351
+ "data-cy": "issue-passport",
352
+ children: [/*#__PURE__*/_jsx(Icon, {
353
+ icon: "majesticons:open-line",
354
+ style: {
355
+ fontSize: 16,
356
+ marginRight: 4
357
+ }
358
+ }), t('team.member.openProfile')]
359
+ })
324
360
  })]
325
361
  }), /*#__PURE__*/_jsx(Box, {
326
362
  mx: 3,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abtnode/ux",
3
- "version": "1.16.29",
3
+ "version": "1.16.30-beta-00e8bdd1",
4
4
  "description": "UX components shared across abtnode packages",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -25,24 +25,24 @@
25
25
  "author": "linchen <linchen1987@foxmail.com> (http://github.com/linchen1987)",
26
26
  "license": "Apache-2.0",
27
27
  "dependencies": {
28
- "@abtnode/auth": "1.16.29",
29
- "@abtnode/constant": "1.16.29",
30
- "@abtnode/util": "1.16.29",
28
+ "@abtnode/auth": "1.16.30-beta-00e8bdd1",
29
+ "@abtnode/constant": "1.16.30-beta-00e8bdd1",
30
+ "@abtnode/util": "1.16.30-beta-00e8bdd1",
31
31
  "@ahooksjs/use-url-state": "^3.5.1",
32
32
  "@arcblock/did": "^1.18.128",
33
- "@arcblock/did-connect": "^2.10.12",
33
+ "@arcblock/did-connect": "^2.10.13",
34
34
  "@arcblock/did-motif": "^1.1.13",
35
- "@arcblock/icons": "^2.10.12",
36
- "@arcblock/nft-display": "2.10.12",
37
- "@arcblock/react-hooks": "^2.10.12",
38
- "@arcblock/terminal": "^2.10.12",
39
- "@arcblock/ux": "^2.10.12",
40
- "@blocklet/constant": "1.16.29",
41
- "@blocklet/js-sdk": "1.16.29",
42
- "@blocklet/launcher-layout": "2.3.38",
43
- "@blocklet/list": "^0.13.13",
44
- "@blocklet/meta": "1.16.29",
45
- "@blocklet/ui-react": "^2.10.12",
35
+ "@arcblock/icons": "^2.10.13",
36
+ "@arcblock/nft-display": "2.10.13",
37
+ "@arcblock/react-hooks": "^2.10.13",
38
+ "@arcblock/terminal": "^2.10.13",
39
+ "@arcblock/ux": "^2.10.13",
40
+ "@blocklet/constant": "1.16.30-beta-00e8bdd1",
41
+ "@blocklet/js-sdk": "1.16.30-beta-00e8bdd1",
42
+ "@blocklet/launcher-layout": "2.3.39",
43
+ "@blocklet/list": "^0.13.14",
44
+ "@blocklet/meta": "1.16.30-beta-00e8bdd1",
45
+ "@blocklet/ui-react": "^2.10.13",
46
46
  "@blocklet/uploader": "0.1.20",
47
47
  "@emotion/react": "^11.10.4",
48
48
  "@emotion/styled": "^11.10.4",
@@ -108,5 +108,5 @@
108
108
  "jest": "^29.7.0",
109
109
  "jest-environment-jsdom": "^29.7.0"
110
110
  },
111
- "gitHead": "6c49cffcab4fd0dffc6bed261a5eddf733280ae7"
111
+ "gitHead": "e165c7e64a2900b4c390b7435c0bb71abbf9b625"
112
112
  }