@blocklet/launcher-workflow 1.7.56 → 1.7.59

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.
@@ -31,6 +31,8 @@ var _pageHeader = _interopRequireDefault(require("@blocklet/launcher-layout/lib/
31
31
 
32
32
  var _launchResultMessage = _interopRequireDefault(require("@blocklet/launcher-layout/lib/launch-result-message"));
33
33
 
34
+ var _progressMessage = _interopRequireDefault(require("@blocklet/launcher-ux/lib/progress-message"));
35
+
34
36
  var _util = require("../util");
35
37
 
36
38
  var _query = _interopRequireDefault(require("../hooks/query"));
@@ -83,6 +85,8 @@ function OperationPage(_ref) {
83
85
  const {
84
86
  api
85
87
  } = (0, _request.default)();
88
+ const [progressStepIndex, setProgressStepIndex] = (0, _react.useState)(0);
89
+ const [isDone, setIsDone] = (0, _react.useState)(false);
86
90
  let createServerTime = sessionStorage.getItem("launcher-create-server-".concat(nftId, "-time"));
87
91
 
88
92
  if (!createServerTime) {
@@ -100,15 +104,18 @@ function OperationPage(_ref) {
100
104
 
101
105
  if (instance.status >= _constant.INSTANCE_STATUS.running) {
102
106
  const url = (0, _util.getLaunchBlockletUrl)(instance.serverUrl, blockletMetaUrl, locale);
103
- setLaunchState(pre => _objectSpread(_objectSpread({}, pre), {}, {
104
- status: STATUS.success,
105
- appUrl: url
106
- }));
107
- (0, _util.loadURL)(url).finally(() => {
108
- setTimeout(() => {
109
- window.location.href = url;
110
- }, 1000);
111
- });
107
+ setIsDone(true);
108
+ setTimeout(() => {
109
+ setLaunchState(pre => _objectSpread(_objectSpread({}, pre), {}, {
110
+ status: STATUS.success,
111
+ appUrl: url
112
+ }));
113
+ (0, _util.loadURL)(url).finally(() => {
114
+ setTimeout(() => {
115
+ window.location.href = url;
116
+ }, 1000);
117
+ });
118
+ }, 1000);
112
119
  }
113
120
  } catch (error) {
114
121
  sessionStorage.removeItem("launcher-create-server-".concat(nftId, "-time"));
@@ -145,41 +152,31 @@ function OperationPage(_ref) {
145
152
  }, [nftId]); // eslint-disable-line
146
153
 
147
154
  const successful = launchState.status === STATUS.success;
148
- const message = [/*#__PURE__*/(0, _jsxRuntime.jsxs)(MessageDiv, {
149
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
150
- className: "msg-before",
151
- children: "1/5"
152
- }), t('launch.waiting.starting')]
153
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(MessageDiv, {
154
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
155
- className: "msg-before",
156
- children: "2/5"
157
- }), t('launch.waiting.securing')]
158
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(MessageDiv, {
159
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
160
- className: "msg-before",
161
- children: "3/5"
162
- }), t('launch.waiting.prepare')]
163
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(MessageDiv, {
164
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
165
- className: "msg-before",
166
- children: "4/5"
167
- }), t('launch.waiting.waiting')]
168
- })];
169
- const messageDuration = 40000; // 防止用户刷新后message进度重新开始,修正 message 展示的信息
170
-
171
- const nowTime = Date.now();
172
- const creatingTime = nowTime - createServerTime;
173
- let step = Math.floor(creatingTime / messageDuration);
174
-
175
- if (step > 0) {
176
- if (step >= message.length) {
177
- step = message.length - 1;
155
+ const progressSteps = [t('launch.waiting.starting'), t('launch.waiting.securing'), t('launch.waiting.prepare'), t('launch.waiting.waiting'), t('launch.waiting.done')];
156
+ const messageDuration = 40000;
157
+
158
+ const fixStepIndex = () => {
159
+ // 防止用户刷新后message进度重新开始,修正 message 展示的信息
160
+ const nowTime = Date.now();
161
+ const creatingTime = nowTime - createServerTime;
162
+ let step = Math.floor(creatingTime / messageDuration);
163
+
164
+ if (step > 0) {
165
+ if (step >= progressSteps.length - 1) {
166
+ step = progressSteps.length - 2;
167
+ }
178
168
  }
179
169
 
180
- message.splice(0, step);
181
- }
170
+ setProgressStepIndex(step);
171
+ };
182
172
 
173
+ (0, _react.useEffect)(() => {
174
+ fixStepIndex();
175
+ const timer = setInterval(() => {
176
+ fixStepIndex();
177
+ }, 1000);
178
+ return () => clearInterval(timer); // eslint-disable-next-line react-hooks/exhaustive-deps
179
+ }, []);
183
180
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(Content, {
184
181
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_pageHeader.default, {
185
182
  title: t("".concat(type, ".title")),
@@ -189,7 +186,16 @@ function OperationPage(_ref) {
189
186
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Spinner.default, {})
190
187
  }), launchState.status === STATUS.launching && /*#__PURE__*/(0, _jsxRuntime.jsx)(WaiterContainer, {
191
188
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_AnimationWaiter.default, {
192
- message: message,
189
+ message: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
190
+ style: {
191
+ textAlign: 'center'
192
+ },
193
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_progressMessage.default, {
194
+ steps: progressSteps,
195
+ stepIndex: isDone ? 4 : progressStepIndex,
196
+ autoGrowth: isDone ? 500 : 20000
197
+ })
198
+ }),
193
199
  increaseSpeed: 0.3,
194
200
  messageLoop: false,
195
201
  maybeDuration: 180000,
@@ -237,24 +243,19 @@ function OperationPage(_ref) {
237
243
  });
238
244
  }
239
245
 
240
- const MessageDiv = _styledComponents.default.div.withConfig({
241
- displayName: "instance-operation__MessageDiv",
242
- componentId: "sc-1fcaixs-0"
243
- })([".msg-before{display:inline-block;color:#aaa;font-size:14px;margin-right:6px;}"]);
244
-
245
246
  const LinkEle = _styledComponents.default.a.withConfig({
246
247
  displayName: "instance-operation__LinkEle",
247
- componentId: "sc-1fcaixs-1"
248
+ componentId: "sc-1fcaixs-0"
248
249
  })(["display:flex;justify-content:center;align-items:center;height:36px;color:", ";"], props => props.theme.palette.primary.main);
249
250
 
250
251
  const WaiterContainer = _styledComponents.default.div.withConfig({
251
252
  displayName: "instance-operation__WaiterContainer",
252
- componentId: "sc-1fcaixs-2"
253
+ componentId: "sc-1fcaixs-1"
253
254
  })(["color:#1dc1c7;"]);
254
255
 
255
256
  const Content = _styledComponents.default.div.withConfig({
256
257
  displayName: "instance-operation__Content",
257
- componentId: "sc-1fcaixs-3"
258
+ componentId: "sc-1fcaixs-2"
258
259
  })(["margin:auto;height:100%;.link{color:", ";}.link:hover{text-decoration:underline !important;}.status{color:", ";display:flex;flex-direction:column;align-items:center;.status-spinner{color:inherit !important;}.status-text{display:inline-block;padding:0 20px;max-width:420px;margin-top:24px;text-align:center;}}.button{min-width:150px;margin-bottom:100px;}.center{display:flex;align-items:center;justify-content:center;width:100%;height:100%;}.launch-page-header{transition:all ease 0.3s;&.header-hide{opacity:0;}}"], props => props.theme.palette.primary.main, props => props.theme.palette.primary.main);
259
260
 
260
261
  OperationPage.propTypes = {
package/lib/locales/en.js CHANGED
@@ -60,7 +60,8 @@ module.exports = {
60
60
  starting: 'Starting Server Instance',
61
61
  securing: 'Securing Server Network',
62
62
  prepare: 'Prepare Server Storage',
63
- waiting: 'Waiting Server Ready'
63
+ waiting: 'Waiting Server Ready',
64
+ done: 'Server is Ready'
64
65
  },
65
66
  dialog: {
66
67
  title: 'Launch Blocklet Server',
package/lib/locales/zh.js CHANGED
@@ -60,7 +60,8 @@ module.exports = {
60
60
  starting: '启动节点实例',
61
61
  securing: '确保节点的网络安全',
62
62
  prepare: '准备好节点存储',
63
- waiting: '等待节点就绪'
63
+ waiting: '等待节点就绪',
64
+ done: '节点已准备就绪'
64
65
  },
65
66
  dialog: {
66
67
  title: '创建节点',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blocklet/launcher-workflow",
3
- "version": "1.7.56",
3
+ "version": "1.7.59",
4
4
  "description": "Purchase components for Launcher UI",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -37,12 +37,13 @@
37
37
  "react": ">=18.1.0"
38
38
  },
39
39
  "dependencies": {
40
- "@arcblock/did-connect": "^2.1.57",
41
- "@arcblock/icons": "^2.1.57",
42
- "@arcblock/license": "^2.1.57",
43
- "@arcblock/ux": "^2.1.57",
44
- "@blocklet/launcher-layout": "1.7.56",
45
- "@blocklet/launcher-util": "1.7.56",
40
+ "@arcblock/did-connect": "^2.1.58",
41
+ "@arcblock/icons": "^2.1.58",
42
+ "@arcblock/license": "^2.1.58",
43
+ "@arcblock/ux": "^2.1.58",
44
+ "@blocklet/launcher-layout": "1.7.59",
45
+ "@blocklet/launcher-util": "1.7.59",
46
+ "@blocklet/launcher-ux": "1.7.59",
46
47
  "@emotion/react": "^11.9.0",
47
48
  "@emotion/styled": "^11.8.1",
48
49
  "@mui/icons-material": "^5.6.2",
@@ -73,5 +74,5 @@
73
74
  "babel-plugin-inline-react-svg": "^2.0.1",
74
75
  "babel-plugin-styled-components": "^1.10.7"
75
76
  },
76
- "gitHead": "b8c044b0bf1ab3ad425a501b4e437fd7eda19d8c"
77
+ "gitHead": "14edbf56df618b4786ccb98533e8663c461c60ea"
77
78
  }