@next-core/brick-container 2.82.12 → 2.83.1
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/deploy/update_postscript.sh +59 -0
- package/dist/{dll.531a8685.js → dll.7cb0b17e.js} +2 -2
- package/dist/{dll.531a8685.js.map → dll.7cb0b17e.js.map} +1 -1
- package/dist/index.html +1 -1
- package/dist/main.517a1008faf4025a9925.js +2 -0
- package/dist/{main.92cea187dafb577859ba.js.map → main.517a1008faf4025a9925.js.map} +1 -1
- package/dist/preview.html +1 -1
- package/package.json +7 -7
- package/tools/report_installed_brick_next_package.py +181 -129
- package/dist/main.92cea187dafb577859ba.js +0 -2
|
@@ -11,7 +11,8 @@ import tarfile
|
|
|
11
11
|
from copy import deepcopy
|
|
12
12
|
|
|
13
13
|
logger = logging.getLogger("report_installed_brick_next_package")
|
|
14
|
-
logging.basicConfig(level=logging.DEBUG,
|
|
14
|
+
logging.basicConfig(level=logging.DEBUG,
|
|
15
|
+
filename="./report_installed_brick_next_package.log")
|
|
15
16
|
|
|
16
17
|
|
|
17
18
|
# 1. 获取到当前的需要处理的包处理到包名
|
|
@@ -19,147 +20,198 @@ logging.basicConfig(level=logging.DEBUG, filename="./report_installed_brick_next
|
|
|
19
20
|
# 3. 读取三个文件的内容
|
|
20
21
|
# 4. 调用接口,发送文件内容
|
|
21
22
|
class NameServiceError(Exception):
|
|
22
|
-
|
|
23
|
+
pass
|
|
24
|
+
|
|
23
25
|
|
|
24
26
|
def get_snippets_from_stories(stories_content):
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
27
|
+
ret_snippets = []
|
|
28
|
+
for story in stories_content:
|
|
29
|
+
story_category = story.get("category", "other")
|
|
30
|
+
story_conf = story.get("conf") # 获取示例数据
|
|
31
|
+
if isinstance(story_conf, list) and len(story_conf) > 0:
|
|
32
|
+
for conf in story_conf:
|
|
33
|
+
if conf.get("snippetId"): # 有snippetId的示例,需要上报到snippet
|
|
34
|
+
snippet_tmp = deepcopy(conf)
|
|
35
|
+
snippet_tmp["id"] = snippet_tmp["snippetId"]
|
|
36
|
+
del snippet_tmp["snippetId"]
|
|
37
|
+
snippet_tmp["category"] = story_category
|
|
38
|
+
if "title" in snippet_tmp:
|
|
39
|
+
snippet_tmp["text"] = snippet_tmp["title"]
|
|
40
|
+
del snippet_tmp["title"]
|
|
41
|
+
if "description" in snippet_tmp:
|
|
42
|
+
snippet_tmp["description"] = snippet_tmp["message"]
|
|
43
|
+
del snippet_tmp["message"]
|
|
44
|
+
ret_snippets.append(snippet_tmp)
|
|
45
|
+
return ret_snippets
|
|
44
46
|
|
|
45
47
|
|
|
46
48
|
def collect(install_path):
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
49
|
+
if not os.path.exists(install_path):
|
|
50
|
+
raise Exception("could not find install path {}".format(install_path))
|
|
51
|
+
if not os.path.isdir(install_path):
|
|
52
|
+
raise Exception("install_path must be a dir {}".format(install_path))
|
|
53
|
+
package_name = os.path.basename(install_path)
|
|
54
|
+
logger.info("install_path %s packageName %s", install_path, package_name)
|
|
55
|
+
bricks_path = os.path.join(install_path, "dist", "bricks.json")
|
|
56
|
+
if not os.path.exists(bricks_path):
|
|
57
|
+
raise Exception(
|
|
58
|
+
"could not find bricks.json path {}".format(bricks_path))
|
|
59
|
+
stories_path = os.path.join(install_path, "dist", "stories.json")
|
|
60
|
+
with open(bricks_path) as bricks_file:
|
|
61
|
+
bricks_content = simplejson.load(bricks_file)
|
|
62
|
+
stories_content = []
|
|
63
|
+
if os.path.exists(stories_path):
|
|
64
|
+
with open(stories_path) as stories_file:
|
|
65
|
+
stories_content = simplejson.load(stories_file)
|
|
66
|
+
snippets_from_stories = get_snippets_from_stories(stories_content)
|
|
67
|
+
snippets_path = os.path.join(install_path, "dist", "snippets.json")
|
|
68
|
+
snippets_content = {"snippets": []}
|
|
69
|
+
if os.path.exists(snippets_path):
|
|
70
|
+
with open(snippets_path) as snippets_file:
|
|
71
|
+
snippets_content = simplejson.load(snippets_file)
|
|
72
|
+
snippets_content["snippets"].extend(snippets_from_stories)
|
|
73
|
+
contract_path = os.path.join(install_path, "dist", "contracts.json")
|
|
74
|
+
contract_content = {}
|
|
75
|
+
if os.path.exists(contract_path):
|
|
76
|
+
with open(contract_path) as contract_file:
|
|
77
|
+
contract_content = simplejson.load(contract_file)
|
|
78
|
+
return package_name, bricks_content, stories_content, snippets_content, contract_content
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
def report_bricks_atom(org, nb_targz_path, package_name, package_version, bricks_content, stories_content,
|
|
82
|
+
snippets_content):
|
|
83
|
+
session_id, ip, port = ens_api.get_service_by_name(
|
|
84
|
+
"web.brick_next", "logic.micro_app_service")
|
|
85
|
+
if session_id <= 0:
|
|
86
|
+
raise NameServiceError(
|
|
87
|
+
"get nameservice logic.micro_app_service error, session_id={}".format(session_id))
|
|
88
|
+
address = "{}:{}".format(ip, port)
|
|
89
|
+
headers = {"org": str(org), "user": "defaultUser"}
|
|
90
|
+
# report atom
|
|
91
|
+
atom_url = "http://{}/api/v1/brick/atom/import".format(address)
|
|
92
|
+
data_dict = {"stories": stories_content, "bricks": bricks_content}
|
|
93
|
+
data_str = simplejson.dumps(data_dict)
|
|
94
|
+
data = {"packageName": package_name,
|
|
95
|
+
"packageVersion": package_version, "data": data_str}
|
|
96
|
+
rsp = requests.post(atom_url, data=data, headers=headers, files={
|
|
97
|
+
"file": open(nb_targz_path, "rb")})
|
|
98
|
+
rsp.raise_for_status()
|
|
99
|
+
# report snippet
|
|
100
|
+
snippet_url = "http://{}/api/v1/brick/snippet/import".format(address)
|
|
101
|
+
snippet_param = {"packageName": package_name, "snippets": snippets_content}
|
|
102
|
+
rsp = requests.post(snippet_url, json=snippet_param, headers=headers)
|
|
103
|
+
rsp.raise_for_status()
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
def report_brick_next_package(org, brick_targz_path, package_name, package_version):
|
|
107
|
+
session_id, ip, port = ens_api.get_service_by_name(
|
|
108
|
+
"web.brick_next", "logic.micro_app_service")
|
|
109
|
+
if session_id <= 0:
|
|
110
|
+
raise NameServiceError(
|
|
111
|
+
"get nameservice logic.micro_app_service error, session_id={}".format(session_id))
|
|
112
|
+
address = "{}:{}".format(ip, port)
|
|
113
|
+
headers = {"org": str(org), "user": "defaultUser"}
|
|
114
|
+
# report atom
|
|
115
|
+
atom_url = "http://{}/api/v1/brick_next/report".format(address)
|
|
116
|
+
data = {"packageName": package_name, "packageVersion": package_version}
|
|
117
|
+
rsp = requests.post(atom_url, data=data, headers=headers, files={
|
|
118
|
+
"file": open(brick_targz_path, "rb")})
|
|
119
|
+
rsp.raise_for_status()
|
|
96
120
|
|
|
97
121
|
|
|
98
122
|
def report_provider_into_contract(org, package_name, contract_content):
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
123
|
+
session_id, ip, port = ens_api.get_service_by_name(
|
|
124
|
+
"web.brick_next", "logic.micro_app_service")
|
|
125
|
+
if session_id <= 0:
|
|
126
|
+
raise NameServiceError(
|
|
127
|
+
"get nameservice logic.micro_app_service error, session_id={}".format(session_id))
|
|
128
|
+
address = "{}:{}".format(ip, port)
|
|
129
|
+
headers = {"org": str(org), "user": "defaultUser"}
|
|
130
|
+
# report contract
|
|
131
|
+
url = "http://{}/api/v1/brick/provider/import_into_contract".format(
|
|
132
|
+
address)
|
|
133
|
+
param = {"packageName": package_name, "data": {
|
|
134
|
+
"contractInfo": contract_content}}
|
|
135
|
+
rsp = requests.post(url, json=param, headers=headers)
|
|
136
|
+
rsp.raise_for_status()
|
|
137
|
+
|
|
109
138
|
|
|
110
139
|
def mk_nb_tar_gz(output_filename, source_dir):
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
140
|
+
try:
|
|
141
|
+
tar = tarfile.open(output_filename, "w:gz")
|
|
142
|
+
for root, dirs, files in os.walk(source_dir):
|
|
143
|
+
root_ = os.path.relpath(root, start=source_dir)
|
|
144
|
+
for file in files:
|
|
145
|
+
if not file.endswith(".log"):
|
|
146
|
+
file_path = os.path.join(root, file)
|
|
147
|
+
tar.add(file_path, arcname=os.path.join(root_, file))
|
|
148
|
+
tar.close()
|
|
149
|
+
return True
|
|
150
|
+
except Exception as e:
|
|
151
|
+
logger.error(e)
|
|
152
|
+
return False
|
|
124
153
|
|
|
125
154
|
|
|
126
155
|
def remove_tar_gz_file(nb_targz_path):
|
|
127
|
-
|
|
156
|
+
os.remove(nb_targz_path)
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
def report_brick_next(org, install_path):
|
|
160
|
+
# 读取版本信息
|
|
161
|
+
version_file = os.path.join(install_path, "version.ini")
|
|
162
|
+
with open(version_file, "r") as f:
|
|
163
|
+
lines = f.readlines()
|
|
164
|
+
package_version = str.strip(lines[1])
|
|
165
|
+
targz_name = "brick_next.tar.gz"
|
|
166
|
+
brick_targz_path = os.path.join(install_path, targz_name)
|
|
167
|
+
if not mk_nb_tar_gz(brick_targz_path, install_path):
|
|
168
|
+
logger.error("mkdir brick_next.tar.gz err")
|
|
169
|
+
sys.exit(1)
|
|
170
|
+
package_name = "brick_next"
|
|
171
|
+
report_brick_next_package(org, brick_targz_path, package_name, package_version)
|
|
172
|
+
remove_tar_gz_file(brick_targz_path)
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
def report_nb(org, install_path):
|
|
176
|
+
# 读取版本信息
|
|
177
|
+
version_file = os.path.join(install_path, "version.ini")
|
|
178
|
+
with open(version_file, "r") as f:
|
|
179
|
+
lines = f.readlines()
|
|
180
|
+
package_version = str.strip(lines[1])
|
|
181
|
+
|
|
182
|
+
package_name, bricks_content, stories_content, snippets_content, contract_content = collect(
|
|
183
|
+
install_path)
|
|
184
|
+
if package_name and bricks_content and snippets_content:
|
|
185
|
+
targz_name = package_name + ".tar.gz"
|
|
186
|
+
nb_targz_path = os.path.join(install_path, targz_name)
|
|
187
|
+
if not mk_nb_tar_gz(nb_targz_path, install_path):
|
|
188
|
+
logger.error("mkdir tar.gz of nb err")
|
|
189
|
+
sys.exit(1)
|
|
190
|
+
report_bricks_atom(org, nb_targz_path, package_name, package_version, bricks_content, stories_content,
|
|
191
|
+
snippets_content)
|
|
192
|
+
remove_tar_gz_file(nb_targz_path)
|
|
193
|
+
if contract_content:
|
|
194
|
+
report_provider_into_contract(org, package_name, contract_content)
|
|
128
195
|
|
|
129
196
|
|
|
130
197
|
if __name__ == "__main__":
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
lines = f.readlines()
|
|
152
|
-
package_version = str.strip(lines[1])
|
|
153
|
-
|
|
154
|
-
package_name, bricks_content, stories_content, snippets_content, contract_content = collect(install_path)
|
|
155
|
-
if package_name and bricks_content and snippets_content:
|
|
156
|
-
targz_name = package_name + ".tar.gz"
|
|
157
|
-
nb_targz_path = os.path.join(install_path, targz_name)
|
|
158
|
-
if not mk_nb_tar_gz(nb_targz_path, install_path):
|
|
159
|
-
logger.error("mkdir tar.gz of nb err")
|
|
160
|
-
sys.exit(1)
|
|
161
|
-
report_bricks_atom(org, nb_targz_path, package_name, package_version, bricks_content, stories_content,
|
|
162
|
-
snippets_content)
|
|
163
|
-
remove_tar_gz_file(nb_targz_path)
|
|
164
|
-
if contract_content:
|
|
165
|
-
report_provider_into_contract(org, package_name, contract_content)
|
|
198
|
+
# 兼容老nb包install_postscript.sh调用report_installed_brick_next_package仅传入包路径
|
|
199
|
+
if len(sys.argv) == 2:
|
|
200
|
+
sys.exit(0)
|
|
201
|
+
|
|
202
|
+
if len(sys.argv) != 3:
|
|
203
|
+
print("Usage: ./report_installed_brick_next_package.py $org $install_path")
|
|
204
|
+
sys.exit(1)
|
|
205
|
+
|
|
206
|
+
org = sys.argv[1]
|
|
207
|
+
install_path = sys.argv[2]
|
|
208
|
+
|
|
209
|
+
if install_path.endswith(os.sep):
|
|
210
|
+
install_path = install_path[:-1]
|
|
211
|
+
|
|
212
|
+
if install_path.endswith("brick_next"):
|
|
213
|
+
report_brick_next(org, install_path)
|
|
214
|
+
elif install_path.endswith("-NB"):
|
|
215
|
+
report_nb(org, install_path)
|
|
216
|
+
else:
|
|
217
|
+
sys.exit(0)
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
!function(e){function t(t){for(var n,r,i=t[0],a=t[1],u=0,c=[];u<i.length;u++)r=i[u],Object.prototype.hasOwnProperty.call(o,r)&&o[r]&&c.push(o[r][0]),o[r]=0;for(n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n]);for(s&&s(t);c.length;)c.shift()()}var n={},o={0:0};function r(t){if(n[t])return n[t].exports;var o=n[t]={i:t,l:!1,exports:{}};return e[t].call(o.exports,o,o.exports,r),o.l=!0,o.exports}r.e=function(e){var t=[],n=o[e];if(0!==n)if(n)t.push(n[2]);else{var i=new Promise((function(t,r){n=o[e]=[t,r]}));t.push(n[2]=i);var a,u=document.createElement("script");u.charset="utf-8",u.timeout=120,r.nc&&u.setAttribute("nonce",r.nc),u.src=function(e){return r.p+""+({1:"mockdate"}[e]||e)+"."+{1:"59f45d37e8dce0f31118"}[e]+".js"}(e);var s=new Error;a=function(t){u.onerror=u.onload=null,clearTimeout(c);var n=o[e];if(0!==n){if(n){var r=t&&("load"===t.type?"missing":t.type),i=t&&t.target&&t.target.src;s.message="Loading chunk "+e+" failed.\n("+r+": "+i+")",s.name="ChunkLoadError",s.type=r,s.request=i,n[1](s)}o[e]=void 0}};var c=setTimeout((function(){a({type:"timeout",target:u})}),12e4);u.onerror=u.onload=a,document.head.appendChild(u)}return Promise.all(t)},r.m=e,r.c=n,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r.oe=function(e){throw console.error(e),e};var i=window.webpackJsonp=window.webpackJsonp||[],a=i.push.bind(i);i.push=t,i=i.slice();for(var u=0;u<i.length;u++)t(i[u]);var s=a;r(r.s="GR0M")}({"+Pr9":function(e,t,n){"use strict";n.d(t,"b",(function(){return r})),n.d(t,"a",(function(){return o}));var o,r="brick-container";!function(e){e.BOOTSTRAP_ERROR="BOOTSTRAP_ERROR"}(o||(o={}))},"1OyB":function(e,t,n){e.exports=n("XuQu")("1OyB")},"1VXw":function(e,t,n){},"3tO9":function(e,t,n){e.exports=n("XuQu")("3tO9")},"5WJL":function(e,t,n){},"9RIe":function(e,t,n){e.exports=n("XuQu")("9RIe")},"9kay":function(e,t,n){e.exports=n("XuQu")("9kay")},GQp1:function(e,t,n){},GR0M:function(e,t,n){"use strict";n.r(t);var o=n("yXPU"),r=n.n(o),i=n("3tO9"),a=n.n(i),u=(n("wd/R"),n("XDpg"),n("q1tI")),s=n.n(u),c=n("i8i4"),l=n.n(c),d=n("gdfu"),p=n("tYg3"),f=n("JxWY"),g=n("9RIe"),h=n("vA6H");XMLHttpRequest.prototype.origOpen=XMLHttpRequest.prototype.open,XMLHttpRequest.prototype.open=function(){this.origOpen.apply(this,arguments);var e=Object(p.getAuth)().csrfToken;e&&this.setRequestHeader("X-CSRF-Token",e)},d.message.config({top:40});n("dCvI"),n("a8Gk"),n("OzFo"),n("GQp1"),n("hv1i"),n("5WJL"),n("1VXw");var v=n("GrFY"),m=n("+Pr9");function w(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=Object(f.getUrlWithParams)(e,t),[o,r]=n.split("?");if(r){var i=r.split("&");return"".concat(o,"?").concat(i.sort().join("&"))}return e}function y(e){return"string"==typeof e||Array.isArray(e)?e:(t=e,"[object Object]"!==Object.prototype.toString.call(t)||null===t||Array.isArray(t)?null:Object.keys(e).sort().reduce((t,n)=>(t[n]=e[n],t),{}));var t}Object(g.initializeLibrary)(),window.DLL_PATH={ace:"dll-of-ace.1d453681.js",d3:"dll-of-d3.1991969b.js",echarts:"dll-of-echarts.d885e687.js","editor-bricks-helper":"dll-of-editor-bricks-helper.99308d55.js","react-dnd":"dll-of-react-dnd.0ca00465.js"},window.BRICK_NEXT_VERSIONS={"brick-container":"2.82.12","brick-dll":"2.41.36","brick-kit":"2.164.5","brick-utils":"2.45.20"},window.BRICK_NEXT_FEATURES=["edit-evaluations-and-transformations-in-devtools"];var b,k,S,O=document.body,x=Object(p.createRuntime)(),R={menuBar:O.querySelector("#menu-bar-mount-point"),appBar:O.querySelector("#app-bar-mount-point"),loadingBar:O.querySelector("#loading-bar-mount-point"),main:O.querySelector("#main-mount-point"),bg:O.querySelector("#bg-mount-point"),portal:O.querySelector("#portal-mount-point")},I="".concat(x.getBasePath(),"api/gateway/data_exchange.store.ClickHouseInsertData/api/v1/data_exchange/frontend_stat"),E=h.apiAnalyzer.create({api:I});Object(f.createHttpInstance)({adapter:(b=f.defaultAdapter,k=new Map,S=!0,window.addEventListener("http:cache.start",(function(){S=!0})),window.addEventListener("http:cache.end",(function(){S=!1,k.clear()})),e=>{var{method:t,url:n,options:o={},data:i}=e,{useCache:a=!0,params:u}=o;if(("get"===(t||"GET").toLowerCase()||n.includes("cmdb.instance.PostSearch"))&&S){var s=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2?arguments[2]:void 0,o=w(e,t),r=y(n);return JSON.stringify({url:o,body:r})}(n,u,i);if(a){var c=k.get(s);return c?(console.warn("[http] use cached request by cache adapter --\x3e ".concat(function(e){try{return JSON.parse(e).url}catch(t){return console.error(t),e}}(s))),c):(c=r()((function*(){try{return yield b(e)}catch(e){throw k.delete(s),e}}))(),k.set(s,c),c)}return k.delete(s),b(e)}return b(e)})}),f.http.interceptors.request.use((function(e){var t;return a()(a()({},e),{},{options:a()(a()({},e.options),{},{signal:null!==(t=e.options)&&void 0!==t&&t.noAbortOnRouteChange?null:p.abortController.getSignalToken()})})})),f.http.interceptors.request.use((function(e){var t,{csrfToken:n}=Object(p.getAuth)(),o=new Headers((null===(t=e.options)||void 0===t?void 0:t.headers)||{});o.set("lang",v.a.resolvedLanguage),n&&o.set("X-CSRF-Token",n);var r=Object(p.getMockInfo)(e.url,e.method);return r&&(e.url=r.url,o.set("easyops-mock-id",r.mockId)),a()(a()({},e),{},{options:a()(a()({},e.options),{},{headers:o})})}));var T=()=>Object(p.getRuntimeMisc)().isInIframeOfSameSite&&!Object(p.getRuntimeMisc)().isInIframeOfVisualBuilder;f.http.interceptors.request.use((function(e){var t,n;if(E){var{userInstanceId:o,username:r}=Object(p.getAuth)(),i=Date.now();e.meta={st:i,time:Math.round(i/1e3),uid:o,username:r}}null!==(t=e.options)&&void 0!==t&&null!==(n=t.interceptorParams)&&void 0!==n&&n.ignoreLoadingBar||(T()?window.parent:window).dispatchEvent(new CustomEvent("request.start"));return e})),f.http.interceptors.response.use((function(e){var t;return(T()?window.parent:window).dispatchEvent(new CustomEvent("request.end")),Object(p.getRuntime)().getFeatureFlags()["enable-analyzer"]&&(null==E||E.analyses(e)),"response"===(null===(t=e.config.options)||void 0===t?void 0:t.observe)?e:e.data}),(function(e){return Object(p.getRuntime)().getFeatureFlags()["enable-analyzer"]&&(null==E||E.analyses(e)),(T()?window.parent:window).dispatchEvent(new CustomEvent("request.end")),Promise.reject(e.error)}));var j,C,L="loading",P=!1;function A(){return X.apply(this,arguments)}function X(){return(X=r()((function*(){if(!P&&"ok"===L&&j){P=!0;var e=/^https?:\/\/localhost(?:$|:)/,t=j===location.origin||e.test(j)||e.test(location.origin);if(!t){var{allowedPreviewFromOrigins:n}=x.getMiscSettings();Array.isArray(n)&&(t=n.some(e=>e===j)),t||console.error("Preview is disallowed, from origin: ".concat(j,", while allowing: ").concat(JSON.stringify(n)))}if(t){if(yield p.developHelper.loadDynamicBricksInBrickConf({brick:"next-previewer.preview-helper"}),customElements.get("next-previewer.preview-helper"))document.createElement("next-previewer.preview-helper").start(j,C)}}}))).apply(this,arguments)}if(window.parent){var _=function(){var e=r()((function*(e){var{data:t,origin:n}=e;t&&"preview-container"===t.sender&&"start-preview"===t.type&&(window.removeEventListener("message",_),j=n,C=t.options,f.http.enableCache(!0),f.http.on("match-api-cache",e=>{window.parent.postMessage({type:"match-api-cache",sender:"previewer",forwardedFor:"builder",num:e},n)}),f.http.setClearCacheIgnoreList(C.clearPreviewRequestCacheIgnoreList||[]),A())}));return function(t){return e.apply(this,arguments)}}();window.addEventListener("message",_)}function F(){return(F=r()((function*(){try{if(window.MOCK_DATE){var{set:e}=yield n.e(1).then(n.t.bind(null,"xKHS",7));e(window.MOCK_DATE)}yield x.bootstrap(R),L="ok"}catch(e){L="failed",console.error(e),document.body.classList.add("bootstrap-error","bars-hidden"),l.a.render(s.a.createElement(d.Result,{status:"error",title:v.a.t("".concat(m.b,":").concat(m.a.BOOTSTRAP_ERROR)),subTitle:Object(p.httpErrorToString)(e)}),R.main)}A()}))).apply(this,arguments)}window.Cypress&&(window.__test_only_getHistory=p.getHistory,window.__test_only_getBasePath=Object(p.getRuntime)().getBasePath,window.__test_only_getFeatureFlags=Object(p.getRuntime)().getFeatureFlags),function(){F.apply(this,arguments)}()},GrFY:function(e,t,n){"use strict";var o=n("XzT5"),r=n("9kay"),i=n("wd/R"),a=n.n(i),u=n("1OyB"),s=n("vuIU"),c=[],l=c.forEach,d=c.slice;function p(e){return l.call(d.call(arguments,1),(function(t){if(t)for(var n in t)void 0===e[n]&&(e[n]=t[n])})),e}var f=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/,g=function(e,t,n){var o=n||{};o.path=o.path||"/";var r=encodeURIComponent(t),i="".concat(e,"=").concat(r);if(o.maxAge>0){var a=o.maxAge-0;if(Number.isNaN(a))throw new Error("maxAge should be a Number");i+="; Max-Age=".concat(Math.floor(a))}if(o.domain){if(!f.test(o.domain))throw new TypeError("option domain is invalid");i+="; Domain=".concat(o.domain)}if(o.path){if(!f.test(o.path))throw new TypeError("option path is invalid");i+="; Path=".concat(o.path)}if(o.expires){if("function"!=typeof o.expires.toUTCString)throw new TypeError("option expires is invalid");i+="; Expires=".concat(o.expires.toUTCString())}if(o.httpOnly&&(i+="; HttpOnly"),o.secure&&(i+="; Secure"),o.sameSite)switch("string"==typeof o.sameSite?o.sameSite.toLowerCase():o.sameSite){case!0:i+="; SameSite=Strict";break;case"lax":i+="; SameSite=Lax";break;case"strict":i+="; SameSite=Strict";break;case"none":i+="; SameSite=None";break;default:throw new TypeError("option sameSite is invalid")}return i},h=function(e,t,n,o){var r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{path:"/",sameSite:"strict"};n&&(r.expires=new Date,r.expires.setTime(r.expires.getTime()+60*n*1e3)),o&&(r.domain=o),document.cookie=g(e,encodeURIComponent(t),r)},v=function(e){for(var t="".concat(e,"="),n=document.cookie.split(";"),o=0;o<n.length;o++){for(var r=n[o];" "===r.charAt(0);)r=r.substring(1,r.length);if(0===r.indexOf(t))return r.substring(t.length,r.length)}return null},m={name:"cookie",lookup:function(e){var t;if(e.lookupCookie&&"undefined"!=typeof document){var n=v(e.lookupCookie);n&&(t=n)}return t},cacheUserLanguage:function(e,t){t.lookupCookie&&"undefined"!=typeof document&&h(t.lookupCookie,e,t.cookieMinutes,t.cookieDomain,t.cookieOptions)}},w={name:"querystring",lookup:function(e){var t;if("undefined"!=typeof window){var n=window.location.search;!window.location.search&&window.location.hash&&window.location.hash.indexOf("?")>-1&&(n=window.location.hash.substring(window.location.hash.indexOf("?")));for(var o=n.substring(1).split("&"),r=0;r<o.length;r++){var i=o[r].indexOf("=");if(i>0)o[r].substring(0,i)===e.lookupQuerystring&&(t=o[r].substring(i+1))}}return t}},y=null,b=function(){if(null!==y)return y;try{y="undefined"!==window&&null!==window.localStorage;window.localStorage.setItem("i18next.translate.boo","foo"),window.localStorage.removeItem("i18next.translate.boo")}catch(e){y=!1}return y},k={name:"localStorage",lookup:function(e){var t;if(e.lookupLocalStorage&&b()){var n=window.localStorage.getItem(e.lookupLocalStorage);n&&(t=n)}return t},cacheUserLanguage:function(e,t){t.lookupLocalStorage&&b()&&window.localStorage.setItem(t.lookupLocalStorage,e)}},S=null,O=function(){if(null!==S)return S;try{S="undefined"!==window&&null!==window.sessionStorage;window.sessionStorage.setItem("i18next.translate.boo","foo"),window.sessionStorage.removeItem("i18next.translate.boo")}catch(e){S=!1}return S},x={name:"sessionStorage",lookup:function(e){var t;if(e.lookupSessionStorage&&O()){var n=window.sessionStorage.getItem(e.lookupSessionStorage);n&&(t=n)}return t},cacheUserLanguage:function(e,t){t.lookupSessionStorage&&O()&&window.sessionStorage.setItem(t.lookupSessionStorage,e)}},R={name:"navigator",lookup:function(e){var t=[];if("undefined"!=typeof navigator){if(navigator.languages)for(var n=0;n<navigator.languages.length;n++)t.push(navigator.languages[n]);navigator.userLanguage&&t.push(navigator.userLanguage),navigator.language&&t.push(navigator.language)}return t.length>0?t:void 0}},I={name:"htmlTag",lookup:function(e){var t,n=e.htmlTag||("undefined"!=typeof document?document.documentElement:null);return n&&"function"==typeof n.getAttribute&&(t=n.getAttribute("lang")),t}},E={name:"path",lookup:function(e){var t;if("undefined"!=typeof window){var n=window.location.pathname.match(/\/([a-zA-Z-]*)/g);if(n instanceof Array)if("number"==typeof e.lookupFromPathIndex){if("string"!=typeof n[e.lookupFromPathIndex])return;t=n[e.lookupFromPathIndex].replace("/","")}else t=n[0].replace("/","")}return t}},T={name:"subdomain",lookup:function(e){var t="number"==typeof e.lookupFromSubdomainIndex?e.lookupFromSubdomainIndex+1:1,n="undefined"!=typeof window&&window.location&&window.location.hostname&&window.location.hostname.match(/^(\w{2,5})\.(([a-z0-9-]{1,63}\.[a-z]{2,6})|localhost)/i);if(n)return n[t]}};var j=function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Object(u.default)(this,e),this.type="languageDetector",this.detectors={},this.init(t,n)}return Object(s.default)(e,[{key:"init",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};this.services=e,this.options=p(t,this.options||{},{order:["querystring","cookie","localStorage","sessionStorage","navigator","htmlTag"],lookupQuerystring:"lng",lookupCookie:"i18next",lookupLocalStorage:"i18nextLng",lookupSessionStorage:"i18nextLng",caches:["localStorage"],excludeCacheFor:["cimode"]}),this.options.lookupFromUrlIndex&&(this.options.lookupFromPathIndex=this.options.lookupFromUrlIndex),this.i18nOptions=n,this.addDetector(m),this.addDetector(w),this.addDetector(k),this.addDetector(x),this.addDetector(R),this.addDetector(I),this.addDetector(E),this.addDetector(T)}},{key:"addDetector",value:function(e){this.detectors[e.name]=e}},{key:"detect",value:function(e){var t=this;e||(e=this.options.order);var n=[];return e.forEach((function(e){if(t.detectors[e]){var o=t.detectors[e].lookup(t.options);o&&"string"==typeof o&&(o=[o]),o&&(n=n.concat(o))}})),this.services.languageUtils.getBestMatchFromCodes?n:n.length>0?n[0]:null}},{key:"cacheUserLanguage",value:function(e,t){var n=this;t||(t=this.options.caches),t&&(this.options.excludeCacheFor&&this.options.excludeCacheFor.indexOf(e)>-1||t.forEach((function(t){n.detectors[t]&&n.detectors[t].cacheUserLanguage(e,n.options)})))}}]),e}();j.type="languageDetector";var C=n("tYg3"),L=n("+Pr9"),P={[L.a.BOOTSTRAP_ERROR]:"Bootstrap Error"},A={[L.a.BOOTSTRAP_ERROR]:"启动错误"};o.default.on("languageChanged",(function(e){a.a.locale(e)})),o.default.use(j).use(r.initReactI18next).init({fallbackLng:"zh",debug:!1,supportedLngs:["zh","en"],nonExplicitSupportedLngs:!0,interpolation:{escapeValue:!1},react:{useSuspense:!1},compatibilityJSON:"v3",resources:{en:{[L.b]:P},zh:{[L.b]:A}}}),Object(C.initI18n)();t.a=o.default},JxWY:function(e,t,n){e.exports=n("XuQu")("JxWY")},OzFo:function(e,t,n){},XDpg:function(e,t,n){e.exports=n("XuQu")("XDpg")},XuQu:function(e,t){e.exports=dll},XzT5:function(e,t,n){e.exports=n("XuQu")("XzT5")},a8Gk:function(e,t,n){},dCvI:function(e,t,n){},gdfu:function(e,t,n){e.exports=n("XuQu")("gdfu")},hv1i:function(e,t,n){},i8i4:function(e,t,n){e.exports=n("XuQu")("i8i4")},q1tI:function(e,t,n){e.exports=n("XuQu")("q1tI")},tYg3:function(e,t,n){e.exports=n("XuQu")("tYg3")},vA6H:function(e,t,n){e.exports=n("XuQu")("vA6H")},vuIU:function(e,t,n){e.exports=n("XuQu")("vuIU")},"wd/R":function(e,t,n){e.exports=n("XuQu")("wd/R")},yXPU:function(e,t,n){e.exports=n("XuQu")("yXPU")}});
|
|
2
|
-
//# sourceMappingURL=main.92cea187dafb577859ba.js.map
|