@abtnode/ux 1.16.25-next-b726d470 → 1.16.25
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/es/blocklet/actions.js +11 -1
- package/es/blocklet/component/add-component-core.js +5 -0
- package/es/blocklet/component/component-cell.js +2 -1
- package/es/blocklet/icons.js +3 -1
- package/es/blocklet/overview.js +13 -7
- package/es/blocklet/publish/create-release.js +150 -43
- package/es/blocklet/publish/index.js +0 -4
- package/es/blocklet/publish/project-list.js +133 -29
- package/es/blocklet/publish/release-list.js +18 -4
- package/es/blocklet/publish/resource.js +35 -32
- package/es/blocklet/router/rule-list.js +2 -1
- package/es/locales/ar.js +13 -8
- package/es/locales/de.js +13 -8
- package/es/locales/en.js +12 -7
- package/es/locales/es.js +13 -8
- package/es/locales/fr.js +13 -8
- package/es/locales/hi.js +13 -8
- package/es/locales/i18n.db +0 -0
- package/es/locales/id.js +13 -8
- package/es/locales/ja.js +13 -8
- package/es/locales/ko.js +13 -8
- package/es/locales/pt.js +13 -8
- package/es/locales/ru.js +13 -8
- package/es/locales/th.js +13 -8
- package/es/locales/vi.js +13 -8
- package/es/locales/zh-tw.js +13 -8
- package/es/locales/zh.js +17 -12
- package/es/subscription/blocklet.js +3 -0
- package/es/subscription/server.js +11 -5
- package/es/team/members/connections.js +2 -1
- package/es/team/members/member.js +2 -1
- package/es/util/index.js +0 -4
- package/lib/blocklet/actions.js +14 -2
- package/lib/blocklet/component/add-component-core.js +1 -1
- package/lib/blocklet/component/component-cell.js +2 -1
- package/lib/blocklet/icons.js +3 -1
- package/lib/blocklet/overview.js +13 -7
- package/lib/blocklet/publish/create-release.js +154 -43
- package/lib/blocklet/publish/index.js +0 -4
- package/lib/blocklet/publish/project-list.js +133 -29
- package/lib/blocklet/publish/release-list.js +18 -4
- package/lib/blocklet/publish/resource.js +34 -31
- package/lib/blocklet/router/rule-list.js +2 -1
- package/lib/locales/ar.js +13 -8
- package/lib/locales/de.js +13 -8
- package/lib/locales/en.js +12 -7
- package/lib/locales/es.js +13 -8
- package/lib/locales/fr.js +13 -8
- package/lib/locales/hi.js +13 -8
- package/lib/locales/i18n.db +0 -0
- package/lib/locales/id.js +13 -8
- package/lib/locales/ja.js +13 -8
- package/lib/locales/ko.js +13 -8
- package/lib/locales/pt.js +13 -8
- package/lib/locales/ru.js +13 -8
- package/lib/locales/th.js +13 -8
- package/lib/locales/vi.js +13 -8
- package/lib/locales/zh-tw.js +13 -8
- package/lib/locales/zh.js +17 -12
- package/lib/subscription/blocklet.js +3 -0
- package/lib/subscription/server.js +10 -4
- package/lib/team/members/connections.js +2 -1
- package/lib/team/members/member.js +2 -1
- package/lib/util/index.js +0 -5
- package/package.json +16 -16
- package/es/blocklet/publish/create-project.js +0 -205
- package/lib/blocklet/publish/create-project.js +0 -215
package/lib/locales/zh-tw.js
CHANGED
|
@@ -661,12 +661,12 @@ var _default = exports.default = {
|
|
|
661
661
|
resourceTitle: '資源',
|
|
662
662
|
blockletEmptyTip: '這裡沒有任何區塊元件',
|
|
663
663
|
createBlockletTip: '您可以透過現有的資源、元件和設定,在此應用程式中建立新的 blocklet',
|
|
664
|
-
createBlocklet: '
|
|
664
|
+
createBlocklet: '新的區塊',
|
|
665
665
|
deleteBlockletTip: '刪除後無法恢復區塊,請確認',
|
|
666
666
|
componentNotRunning: '{name}元件未運行,請先啟動。',
|
|
667
667
|
releaseEmptyTip: '這裡沒有任何發布',
|
|
668
668
|
createReleaseTip: '您可以創建一個區塊釋出,附帶釋出說明和資源,供其他人使用',
|
|
669
|
-
createRelease: '
|
|
669
|
+
createRelease: '新版本發布',
|
|
670
670
|
deleteReleaseTip: '刪除後無法還原發布',
|
|
671
671
|
createBlockletDid: '從DID錢包創建',
|
|
672
672
|
createReleaseSuccess: '發佈成功',
|
|
@@ -686,13 +686,18 @@ var _default = exports.default = {
|
|
|
686
686
|
noDescription: '需要提供 Blocklet 描述',
|
|
687
687
|
noNote: '需要提供發佈說明'
|
|
688
688
|
},
|
|
689
|
-
packTip: '
|
|
689
|
+
packTip: '目前,blocklet可以直接安裝為應用程序。組件和應用程序配置將自動包含在blocklet中',
|
|
690
690
|
resourceChangedWarning: '您已修改資源,請儘速保存',
|
|
691
|
-
installResourceTip: '
|
|
691
|
+
installResourceTip: '安裝網址:',
|
|
692
692
|
installResourceTip2: '如果您想查看更多提示,請訪問 {name}',
|
|
693
693
|
installResourceHelp: '幫助文件',
|
|
694
694
|
componentIncluded: '已包含',
|
|
695
|
-
componentForceRequired: '強制要求'
|
|
695
|
+
componentForceRequired: '強制要求',
|
|
696
|
+
productListTitle: '發布 Blocklets',
|
|
697
|
+
download: '下載 {name}',
|
|
698
|
+
delete: '刪除 {name}',
|
|
699
|
+
copyInstallUrl: '複製安裝連結',
|
|
700
|
+
install: '安裝{name}'
|
|
696
701
|
},
|
|
697
702
|
titleValidationError: '標題長度必須至少為3到40個字符',
|
|
698
703
|
descriptionValidationError: '描述長度必須介於3到160個字符之間'
|
|
@@ -796,7 +801,7 @@ var _default = exports.default = {
|
|
|
796
801
|
switchLabel: '歡迎頁面'
|
|
797
802
|
},
|
|
798
803
|
upgrade: {
|
|
799
|
-
title: '升級 Blocklet 伺服器
|
|
804
|
+
title: '升級 Blocklet 伺服器',
|
|
800
805
|
description: '在升級期間,您的 Blocklet 伺服器將進入維護模式,更新完成後將持續幾分鐘。',
|
|
801
806
|
dialog: '點擊"確認"安裝更新。Blocklet服務器將進入維護模式,直到更新完成並自動返回生產模式。',
|
|
802
807
|
confirm: '升級',
|
|
@@ -809,7 +814,7 @@ var _default = exports.default = {
|
|
|
809
814
|
verifying: '正在驗證Blocklet服務器v{version}',
|
|
810
815
|
rollback: '回滾Blocklet伺服器',
|
|
811
816
|
complete: '升級完成!',
|
|
812
|
-
progress: '
|
|
817
|
+
progress: '升級 {name}',
|
|
813
818
|
check: '檢查更新',
|
|
814
819
|
latest: '您正在執行最新版本。'
|
|
815
820
|
},
|
|
@@ -824,7 +829,7 @@ var _default = exports.default = {
|
|
|
824
829
|
cleanup: '確保一切正常',
|
|
825
830
|
rollback: '清理髒污狀態',
|
|
826
831
|
complete: '維護完成!',
|
|
827
|
-
progress: '重新啟動
|
|
832
|
+
progress: '重新啟動 {name}'
|
|
828
833
|
},
|
|
829
834
|
register: {
|
|
830
835
|
titleAdded: '已新增至 Blocklet Launcher',
|
package/lib/locales/zh.js
CHANGED
|
@@ -661,26 +661,26 @@ var _default = exports.default = {
|
|
|
661
661
|
productTitle: 'Blocklet 详情',
|
|
662
662
|
versionTitle: '版本信息',
|
|
663
663
|
imgTitle: '图片资源',
|
|
664
|
-
resourceTitle: '
|
|
665
|
-
blockletEmptyTip: '这里没有任何
|
|
664
|
+
resourceTitle: '资源型 Blocklet',
|
|
665
|
+
blockletEmptyTip: '这里没有任何 Blocklet',
|
|
666
666
|
createBlockletTip: '你可以使用此应用的资源,组件,配置制作新的 Blocklet',
|
|
667
|
-
createBlocklet: '
|
|
667
|
+
createBlocklet: '新的块',
|
|
668
668
|
deleteBlockletTip: '此 Blocklet 删除后不可恢复,是否继续?',
|
|
669
669
|
componentNotRunning: '组件 {name} 未运行',
|
|
670
670
|
releaseEmptyTip: '这里没有任何发布',
|
|
671
|
-
createReleaseTip: '您可以创建 Blocklet
|
|
672
|
-
createRelease: '
|
|
671
|
+
createReleaseTip: '您可以创建 Blocklet 新版本,在发布中包含说明和资源,以供其他人使用',
|
|
672
|
+
createRelease: '创建新的版本',
|
|
673
673
|
deleteReleaseTip: '此发布删除后不可恢复,是否继续?',
|
|
674
674
|
createBlockletDid: '通过 DID 钱包创建',
|
|
675
675
|
createReleaseSuccess: '发布成功',
|
|
676
676
|
saveDraftSuccess: '保存成功',
|
|
677
|
-
packTip: 'Blocklet
|
|
677
|
+
packTip: '您的 Blocklet 现在可以直接安装为应用程序。应用程序配置将自动包含在内',
|
|
678
678
|
resourceChangedWarning: '您修改了资源,请及时保存',
|
|
679
|
-
installResourceTip: '
|
|
679
|
+
installResourceTip: '安装网址:',
|
|
680
680
|
installResourceTip2: '如果你需要更多提示,请查看',
|
|
681
681
|
installResourceHelp: '帮助文档',
|
|
682
682
|
componentIncluded: '包含',
|
|
683
|
-
componentForceRequired: '
|
|
683
|
+
componentForceRequired: '强依赖',
|
|
684
684
|
connect: {
|
|
685
685
|
title: '创建 Blocklet DID',
|
|
686
686
|
scan: '扫描下面的二维码来生成 Blocklet DID',
|
|
@@ -695,7 +695,12 @@ var _default = exports.default = {
|
|
|
695
695
|
noVersion: '请填写 Blocklet 版本号',
|
|
696
696
|
noDescription: '请填写 Blocklet 描述',
|
|
697
697
|
noNote: '请填写 发布说明'
|
|
698
|
-
}
|
|
698
|
+
},
|
|
699
|
+
productListTitle: '发布 Blocklets',
|
|
700
|
+
download: '下载 {name}',
|
|
701
|
+
delete: '删除 {name}',
|
|
702
|
+
copyInstallUrl: '复制安装链接',
|
|
703
|
+
install: '安装 {name}'
|
|
699
704
|
},
|
|
700
705
|
titleValidationError: '标题长度必须至少为3到40个字符',
|
|
701
706
|
descriptionValidationError: '描述长度必须在3到160个字符之间'
|
|
@@ -792,7 +797,7 @@ var _default = exports.default = {
|
|
|
792
797
|
nftDomainUrl: 'NFT Domain 地址',
|
|
793
798
|
nftDomainUrlPlaceholder: '你可以选择其它的 NFT Domain 服务器, 也可以使用官方提供的版本',
|
|
794
799
|
upgrade: {
|
|
795
|
-
title: '
|
|
800
|
+
title: '升级 Blocklet 服务器',
|
|
796
801
|
description: '在升级期间,节点将会进入维护模式几分钟。',
|
|
797
802
|
dialog: '点击 “确认” 安装更新。节点将进入维护模式,直到更新完成并自动返回生产模式。',
|
|
798
803
|
confirm: '升级',
|
|
@@ -805,7 +810,7 @@ var _default = exports.default = {
|
|
|
805
810
|
verifying: '验证节点新版本 v{version}',
|
|
806
811
|
rollback: '回滚此次升级',
|
|
807
812
|
complete: '升级完成!',
|
|
808
|
-
progress: '
|
|
813
|
+
progress: '升级 {name}',
|
|
809
814
|
check: '检查更新',
|
|
810
815
|
latest: '太棒了,你的节点已经是最新版!'
|
|
811
816
|
},
|
|
@@ -820,7 +825,7 @@ var _default = exports.default = {
|
|
|
820
825
|
cleanup: '验证重启成功',
|
|
821
826
|
rollback: '撤销重启操作',
|
|
822
827
|
complete: '维护完成',
|
|
823
|
-
progress: '
|
|
828
|
+
progress: '重新开始 {name}'
|
|
824
829
|
},
|
|
825
830
|
welcome: {
|
|
826
831
|
switchLabel: 'Welcome 页面'
|
|
@@ -58,9 +58,12 @@ function SubscriptionServer(_ref) {
|
|
|
58
58
|
rest = _objectWithoutProperties(props, _excluded2);
|
|
59
59
|
const typoKey = isMobile ? 'mobile' : 'desktop';
|
|
60
60
|
const asyncState = (0, _useAsyncRetry.default)(async () => {
|
|
61
|
-
const [
|
|
61
|
+
const [data, subscriptionURL] = await Promise.all([
|
|
62
|
+
// 新 Launch 的 Server 会有 launcherSessionId 信息,旧的 Server 只有 nftId
|
|
63
|
+
// 这里做兼容处理,优先使用 launcherSessionId, 如果没有则使用 nftId
|
|
64
|
+
node.api.getLauncherSession({
|
|
62
65
|
input: {
|
|
63
|
-
launcherSessionId,
|
|
66
|
+
launcherSessionId: launcherSessionId || nftId,
|
|
64
67
|
launcherUrl
|
|
65
68
|
}
|
|
66
69
|
}), (0, _util.getSubscriptionUrlV2)({
|
|
@@ -69,8 +72,11 @@ function SubscriptionServer(_ref) {
|
|
|
69
72
|
launcherSessionId,
|
|
70
73
|
locale
|
|
71
74
|
})]);
|
|
75
|
+
if (data !== null && data !== void 0 && data.error) {
|
|
76
|
+
throw new Error(data.error);
|
|
77
|
+
}
|
|
72
78
|
return {
|
|
73
|
-
|
|
79
|
+
launcherSession: data.launcherSession,
|
|
74
80
|
subscriptionURL
|
|
75
81
|
};
|
|
76
82
|
}, [locale]);
|
|
@@ -102,7 +108,7 @@ function SubscriptionServer(_ref) {
|
|
|
102
108
|
onClick: () => asyncState.retry()
|
|
103
109
|
}));
|
|
104
110
|
}
|
|
105
|
-
const expirationDate = (
|
|
111
|
+
const expirationDate = (_asyncState$value = asyncState.value) === null || _asyncState$value === void 0 || (_asyncState$value = _asyncState$value.launcherSession) === null || _asyncState$value === void 0 ? void 0 : _asyncState$value.expirationDate;
|
|
106
112
|
const isExpired = (0, _dayjs.default)(expirationDate).isBefore((0, _dayjs.default)());
|
|
107
113
|
const validityMs = (0, _dayjs.default)(expirationDate).diff((0, _dayjs.default)(), 'ms');
|
|
108
114
|
let status = 'success';
|
package/lib/util/index.js
CHANGED
|
@@ -23,7 +23,6 @@ exports.formatUrl = void 0;
|
|
|
23
23
|
exports.getAccessUrl = getAccessUrl;
|
|
24
24
|
exports.getAccessibleUrl = void 0;
|
|
25
25
|
exports.getAsset = getAsset;
|
|
26
|
-
exports.getAssetExpiration = getAssetExpiration;
|
|
27
26
|
exports.getBlockletLogoUrl = void 0;
|
|
28
27
|
exports.getBlockletMetaUrl = getBlockletMetaUrl;
|
|
29
28
|
exports.getBlockletUrl = getBlockletUrl;
|
|
@@ -46,7 +45,6 @@ var _filesize = _interopRequireDefault(require("filesize"));
|
|
|
46
45
|
var _humanizeUrl = _interopRequireDefault(require("humanize-url"));
|
|
47
46
|
var _isUrl = _interopRequireDefault(require("is-url"));
|
|
48
47
|
var _get = _interopRequireDefault(require("lodash/get"));
|
|
49
|
-
var _last = _interopRequireDefault(require("lodash/last"));
|
|
50
48
|
var _trimEnd = _interopRequireDefault(require("lodash/trimEnd"));
|
|
51
49
|
var _querystring = _interopRequireDefault(require("querystring"));
|
|
52
50
|
var _urlJoin = _interopRequireDefault(require("url-join"));
|
|
@@ -617,9 +615,6 @@ async function getAsset(chainHost, address) {
|
|
|
617
615
|
}
|
|
618
616
|
return state;
|
|
619
617
|
}
|
|
620
|
-
function getAssetExpiration(asset) {
|
|
621
|
-
return (0, _last.default)((0, _get.default)(asset, 'data.value.expirationDate', []));
|
|
622
|
-
}
|
|
623
618
|
|
|
624
619
|
/**
|
|
625
620
|
* 检查url是否 未添加到 store list 中
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abtnode/ux",
|
|
3
|
-
"version": "1.16.25
|
|
3
|
+
"version": "1.16.25",
|
|
4
4
|
"description": "UX components shared across abtnode packages",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -28,23 +28,23 @@
|
|
|
28
28
|
"author": "linchen <linchen1987@foxmail.com> (http://github.com/linchen1987)",
|
|
29
29
|
"license": "Apache-2.0",
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@abtnode/auth": "1.16.25
|
|
32
|
-
"@abtnode/constant": "1.16.25
|
|
33
|
-
"@abtnode/util": "1.16.25
|
|
31
|
+
"@abtnode/auth": "1.16.25",
|
|
32
|
+
"@abtnode/constant": "1.16.25",
|
|
33
|
+
"@abtnode/util": "1.16.25",
|
|
34
34
|
"@ahooksjs/use-url-state": "^3.5.1",
|
|
35
35
|
"@arcblock/did": "^1.18.113",
|
|
36
|
-
"@arcblock/did-connect": "^2.9.
|
|
36
|
+
"@arcblock/did-connect": "^2.9.63",
|
|
37
37
|
"@arcblock/did-motif": "^1.1.13",
|
|
38
|
-
"@arcblock/icons": "^2.9.
|
|
39
|
-
"@arcblock/nft-display": "2.9.
|
|
40
|
-
"@arcblock/react-hooks": "^2.9.
|
|
41
|
-
"@arcblock/terminal": "^2.9.
|
|
42
|
-
"@arcblock/ux": "^2.9.
|
|
43
|
-
"@blocklet/constant": "1.16.25
|
|
44
|
-
"@blocklet/launcher-layout": "2.2.
|
|
45
|
-
"@blocklet/list": "^0.12.
|
|
46
|
-
"@blocklet/meta": "1.16.25
|
|
47
|
-
"@blocklet/ui-react": "^2.9.
|
|
38
|
+
"@arcblock/icons": "^2.9.63",
|
|
39
|
+
"@arcblock/nft-display": "2.9.63",
|
|
40
|
+
"@arcblock/react-hooks": "^2.9.63",
|
|
41
|
+
"@arcblock/terminal": "^2.9.63",
|
|
42
|
+
"@arcblock/ux": "^2.9.63",
|
|
43
|
+
"@blocklet/constant": "1.16.25",
|
|
44
|
+
"@blocklet/launcher-layout": "2.2.66",
|
|
45
|
+
"@blocklet/list": "^0.12.79",
|
|
46
|
+
"@blocklet/meta": "1.16.25",
|
|
47
|
+
"@blocklet/ui-react": "^2.9.63",
|
|
48
48
|
"@blocklet/uploader": "^0.0.75",
|
|
49
49
|
"@emotion/react": "^11.10.4",
|
|
50
50
|
"@emotion/styled": "^11.10.4",
|
|
@@ -107,7 +107,7 @@
|
|
|
107
107
|
"jest": "^29.7.0",
|
|
108
108
|
"jest-environment-jsdom": "^29.7.0"
|
|
109
109
|
},
|
|
110
|
-
"gitHead": "
|
|
110
|
+
"gitHead": "8752b9a0caa8745e16e1de8db4ef696b713ffb4d",
|
|
111
111
|
"exports": {
|
|
112
112
|
".": {
|
|
113
113
|
"import": "./es/index.js",
|
|
@@ -1,205 +0,0 @@
|
|
|
1
|
-
import { useState } from 'react';
|
|
2
|
-
import { Link, useNavigate, useParams } from 'react-router-dom';
|
|
3
|
-
import useLocalStorage from 'react-use/lib/useLocalStorage';
|
|
4
|
-
import MenuItem from '@mui/material/MenuItem';
|
|
5
|
-
import TextField from '@mui/material/TextField';
|
|
6
|
-
import Typography from '@mui/material/Typography';
|
|
7
|
-
import Breadcrumbs from '@mui/material/Breadcrumbs';
|
|
8
|
-
import InputAdornment from '@mui/material/InputAdornment';
|
|
9
|
-
import styled from '@emotion/styled';
|
|
10
|
-
import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
11
|
-
import Box from '@mui/material/Box';
|
|
12
|
-
import Button from '@arcblock/ux/lib/Button';
|
|
13
|
-
import DidConnect from '@arcblock/did-connect/lib/Connect';
|
|
14
|
-
import Toast from '@arcblock/ux/lib/Toast';
|
|
15
|
-
import { useNodeContext } from '../../contexts/node';
|
|
16
|
-
import { useBlockletContext } from '../../contexts/blocklet';
|
|
17
|
-
import { useSessionContext } from '../../contexts/session';
|
|
18
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
19
|
-
const Types = [{
|
|
20
|
-
label: {
|
|
21
|
-
en: 'Resource',
|
|
22
|
-
zh: '资源'
|
|
23
|
-
},
|
|
24
|
-
value: 'resource'
|
|
25
|
-
}, {
|
|
26
|
-
label: {
|
|
27
|
-
en: 'Application',
|
|
28
|
-
zh: '应用'
|
|
29
|
-
},
|
|
30
|
-
value: 'pack'
|
|
31
|
-
}];
|
|
32
|
-
export default function CreateProject({
|
|
33
|
-
...rest
|
|
34
|
-
}) {
|
|
35
|
-
const navigate = useNavigate();
|
|
36
|
-
const {
|
|
37
|
-
t,
|
|
38
|
-
locale
|
|
39
|
-
} = useLocaleContext();
|
|
40
|
-
const {
|
|
41
|
-
blocklet
|
|
42
|
-
} = useBlockletContext();
|
|
43
|
-
const [blockletTitle, setBlockletTitle] = useState('');
|
|
44
|
-
const [loading, setLoading] = useState(false);
|
|
45
|
-
const [type, setType] = useState('resource'); // resource, pack
|
|
46
|
-
const {
|
|
47
|
-
api: sessionApi
|
|
48
|
-
} = useSessionContext();
|
|
49
|
-
const {
|
|
50
|
-
api
|
|
51
|
-
} = useNodeContext();
|
|
52
|
-
const [blockletDid, setBlockletDid] = useState();
|
|
53
|
-
const [openConnect, setOpenConnect] = useState(false);
|
|
54
|
-
const [manualCreateBlockletDid] = useLocalStorage('manual-create-blocklet-did', false);
|
|
55
|
-
const {
|
|
56
|
-
componentDid = ''
|
|
57
|
-
} = useParams();
|
|
58
|
-
const handleCreateBlockletDidError = err => {
|
|
59
|
-
Toast.error(err.message);
|
|
60
|
-
setOpenConnect(false);
|
|
61
|
-
};
|
|
62
|
-
const handleCreateBlockletDidSuccess = result => {
|
|
63
|
-
const did = result?.blockletWallet?.address;
|
|
64
|
-
if (!did) {
|
|
65
|
-
Toast.error('Empty Blocklet DID');
|
|
66
|
-
} else {
|
|
67
|
-
setBlockletDid(did);
|
|
68
|
-
}
|
|
69
|
-
setOpenConnect(false);
|
|
70
|
-
};
|
|
71
|
-
const onCreate = () => {
|
|
72
|
-
if (!blockletDid) {
|
|
73
|
-
Toast.error(t('blocklet.publish.errorTip.noDid'));
|
|
74
|
-
return;
|
|
75
|
-
}
|
|
76
|
-
if (!blockletTitle) {
|
|
77
|
-
Toast.error(t('blocklet.publish.errorTip.noTitle'));
|
|
78
|
-
return;
|
|
79
|
-
}
|
|
80
|
-
setLoading(true);
|
|
81
|
-
api.createProject({
|
|
82
|
-
input: {
|
|
83
|
-
did: blocklet.meta.did,
|
|
84
|
-
blockletTitle: blockletTitle || '',
|
|
85
|
-
blockletDid,
|
|
86
|
-
type,
|
|
87
|
-
componentDid
|
|
88
|
-
}
|
|
89
|
-
}).then(() => {
|
|
90
|
-
setLoading(false);
|
|
91
|
-
navigate('../', {
|
|
92
|
-
replace: true
|
|
93
|
-
});
|
|
94
|
-
}).catch(err => {
|
|
95
|
-
setLoading(false);
|
|
96
|
-
Toast.error(err.message);
|
|
97
|
-
});
|
|
98
|
-
};
|
|
99
|
-
return /*#__PURE__*/_jsxs(Main, {
|
|
100
|
-
...rest,
|
|
101
|
-
children: [/*#__PURE__*/_jsxs(Breadcrumbs, {
|
|
102
|
-
className: "breadcrumbs",
|
|
103
|
-
"aria-label": "breadcrumb",
|
|
104
|
-
children: [/*#__PURE__*/_jsx(Link, {
|
|
105
|
-
to: "..",
|
|
106
|
-
children: t('common.publish')
|
|
107
|
-
}), /*#__PURE__*/_jsxs(Typography, {
|
|
108
|
-
color: "text.primary",
|
|
109
|
-
children: [t('common.create'), " Blocklet"]
|
|
110
|
-
})]
|
|
111
|
-
}), /*#__PURE__*/_jsxs(Box, {
|
|
112
|
-
style: {
|
|
113
|
-
maxWidth: 500
|
|
114
|
-
},
|
|
115
|
-
children: [/*#__PURE__*/_jsx(TextField, {
|
|
116
|
-
required: true,
|
|
117
|
-
sx: {
|
|
118
|
-
mb: 4
|
|
119
|
-
},
|
|
120
|
-
label: "Blocklet DID",
|
|
121
|
-
fullWidth: true,
|
|
122
|
-
readonly: true,
|
|
123
|
-
autoComplete: "off",
|
|
124
|
-
variant: "outlined",
|
|
125
|
-
onChange: e => manualCreateBlockletDid && setBlockletDid(e.target.value),
|
|
126
|
-
onClick: () => !manualCreateBlockletDid && !blockletDid && setOpenConnect(true),
|
|
127
|
-
InputProps: {
|
|
128
|
-
'data-cy': 'export-blocklet-did',
|
|
129
|
-
endAdornment: !manualCreateBlockletDid && /*#__PURE__*/_jsx(InputAdornment, {
|
|
130
|
-
position: "end",
|
|
131
|
-
children: /*#__PURE__*/_jsx(Button, {
|
|
132
|
-
onClick: () => setOpenConnect(true),
|
|
133
|
-
children: t(blockletDid ? 'common.update' : 'common.create')
|
|
134
|
-
})
|
|
135
|
-
})
|
|
136
|
-
},
|
|
137
|
-
helperText: "",
|
|
138
|
-
value: blockletDid || ''
|
|
139
|
-
}), openConnect && /*#__PURE__*/_jsx(DidConnect, {
|
|
140
|
-
open: true,
|
|
141
|
-
popup: true,
|
|
142
|
-
onClose: () => setOpenConnect(false),
|
|
143
|
-
action: "gen-blocklet-key-pair",
|
|
144
|
-
locale: locale,
|
|
145
|
-
checkFn: sessionApi.get,
|
|
146
|
-
saveConnect: false,
|
|
147
|
-
forceConnected: false,
|
|
148
|
-
checkTimeout: 5 * 60 * 1000,
|
|
149
|
-
onSuccess: handleCreateBlockletDidSuccess,
|
|
150
|
-
onError: handleCreateBlockletDidError,
|
|
151
|
-
extraParams: {
|
|
152
|
-
did: blocklet.meta.did
|
|
153
|
-
},
|
|
154
|
-
messages: {
|
|
155
|
-
title: t('blocklet.publish.connect.title'),
|
|
156
|
-
scan: t('blocklet.publish.connect.scan'),
|
|
157
|
-
confirm: t('blocklet.publish.connect.confirm'),
|
|
158
|
-
success: t('blocklet.publish.connect.success')
|
|
159
|
-
}
|
|
160
|
-
}), /*#__PURE__*/_jsx(TextField, {
|
|
161
|
-
required: true,
|
|
162
|
-
label: `Blocklet ${t('common.title')}`,
|
|
163
|
-
autoComplete: "off",
|
|
164
|
-
variant: "outlined",
|
|
165
|
-
InputProps: {
|
|
166
|
-
'data-cy': 'export-blocklet-title'
|
|
167
|
-
},
|
|
168
|
-
fullWidth: true,
|
|
169
|
-
helperText: "",
|
|
170
|
-
value: blockletTitle || '',
|
|
171
|
-
onChange: e => {
|
|
172
|
-
setBlockletTitle(e.target.value);
|
|
173
|
-
}
|
|
174
|
-
}), /*#__PURE__*/_jsx(TextField, {
|
|
175
|
-
sx: {
|
|
176
|
-
my: 4
|
|
177
|
-
},
|
|
178
|
-
id: "blocklet-type",
|
|
179
|
-
select: true,
|
|
180
|
-
label: `Blocklet ${t('common.type')}`,
|
|
181
|
-
helperText: "",
|
|
182
|
-
fullWidth: true,
|
|
183
|
-
value: type,
|
|
184
|
-
onChange: e => setType(e.target.value),
|
|
185
|
-
children: Types.map(x => /*#__PURE__*/_jsx(MenuItem, {
|
|
186
|
-
value: x.value,
|
|
187
|
-
disabled: x.disabled,
|
|
188
|
-
children: x.label[locale] || x.label.en
|
|
189
|
-
}, x.value))
|
|
190
|
-
})]
|
|
191
|
-
}), /*#__PURE__*/_jsx(Button, {
|
|
192
|
-
variant: "contained",
|
|
193
|
-
disabled: loading,
|
|
194
|
-
onClick: onCreate,
|
|
195
|
-
children: t('common.create')
|
|
196
|
-
})]
|
|
197
|
-
});
|
|
198
|
-
}
|
|
199
|
-
CreateProject.propTypes = {};
|
|
200
|
-
CreateProject.defaultProps = {};
|
|
201
|
-
const Main = styled.div`
|
|
202
|
-
.breadcrumbs {
|
|
203
|
-
margin-bottom: 24px;
|
|
204
|
-
}
|
|
205
|
-
`;
|