3
3
< head >
4
4
< meta charset ="UTF-8 ">
5
5
< title > Python Package Tool For Tencent Serverless Cloud Function</ title >
6
+ < link rel ="stylesheet " type ="text/css " href ="dist/semantic.css ">
7
+
8
+ < script src ="dist/assets/library/jquery.min.js "> </ script >
9
+ < script src ="dist/assets/library/iframe.js "> </ script >
10
+ < link rel ="stylesheet " type ="text/css " href ="dist/components/reset.css ">
11
+ < link rel ="stylesheet " type ="text/css " href ="dist/components/site.css ">
12
+ < link rel ="stylesheet " type ="text/css " href ="dist/components/grid.css ">
13
+ < link rel ="stylesheet " type ="text/css " href ="dist/components/icon.css ">
14
+ < link rel ="stylesheet " type ="text/css " href ="dist/components/input.css ">
15
+ < link rel ="stylesheet " type ="text/css " href ="dist/components/button.css ">
16
+ < link rel ="stylesheet " type ="text/css " href ="dist/components/divider.css ">
17
+ < link rel ="stylesheet " type ="text/css " href ="dist/components/label.css ">
18
+ < link rel ="stylesheet " type ="text/css " href ="dist/components/dropdown.css ">
19
+ < link rel ="stylesheet " type ="text/css " href ="dist/components/transition.css ">
20
+ < link rel ="stylesheet " type ="text/css " href ="dist/components/popup.css ">
21
+ < script src ="dist/assets/library/jquery.min.js "> </ script >
22
+ < script src ="dist/assets/library/iframe-content.js "> </ script >
23
+ < script type ="text/javascript " src ="dist/components/popup.js "> </ script >
24
+ < script type ="text/javascript " src ="dist/components/dropdown.js "> </ script >
25
+ < script type ="text/javascript " src ="dist/components/transition.js "> </ script >
26
+
27
+ < style type ="text/css ">
28
+ body > .ui .container {
29
+ margin-top : 3em ;
30
+ }
31
+
32
+ iframe {
33
+ border : none;
34
+ width : calc (100% + 2em );
35
+ margin : 0em -1em ;
36
+ height : 300px ;
37
+ }
38
+
39
+ iframe html {
40
+ overflow : hidden;
41
+ }
42
+
43
+ iframe body {
44
+ padding : 0em ;
45
+ }
46
+
47
+ .ui .container > h1 {
48
+ font-size : 3em ;
49
+ text-align : center;
50
+ font-weight : normal;
51
+ }
52
+
53
+ # footer {
54
+ height : 100px ;
55
+ width : 100% ;
56
+ position : absolute;
57
+ bottom : 0 ;
58
+ }
59
+ </ style >
60
+ < script >
61
+ $ ( document )
62
+ . ready ( function ( ) {
63
+ $ ( '.ui.dropdown' )
64
+ . dropdown ( {
65
+ on : 'click'
66
+ } )
67
+ ;
68
+ } )
69
+ ;
70
+ </ script >
6
71
< script >
7
72
function loadXMLDoc ( ) {
8
- document . getElementById ( "result" ) . innerText = "系统处理中,请稍后..."
73
+ document . getElementById ( "result" ) . style . display = "inline"
74
+ document . getElementById ( "info" ) . style . display = "none"
9
75
var UTFTranslate = {
10
76
Change : function ( pValue ) {
11
77
return pValue . replace ( / [ ^ \u0000 - \u00FF ] / g, function ( $0 ) {
28
94
xmlhttp . onreadystatechange = function ( ) {
29
95
if ( xmlhttp . readyState == 4 && xmlhttp . status == 200 ) {
30
96
if ( JSON . parse ( xmlhttp . responseText ) [ "error" ] ) {
31
- document . getElementById ( "result" ) . innerText = JSON . parse ( xmlhttp . responseText ) [ "result" ] ;
97
+ document . getElementById ( "result" ) . style . display = "none"
98
+ document . getElementById ( "info" ) . style . display = "inline"
99
+ document . getElementById ( "info" ) . innerText = JSON . parse ( xmlhttp . responseText ) [ "result" ]
32
100
} else {
33
- document . getElementById ( "result" ) . innerText = "点击下载压缩包" ;
34
- document . getElementById ( "result" ) . href = JSON . parse ( xmlhttp . responseText ) [ "result" ] ;
101
+ document . getElementById ( "result" ) . className = "ui button"
102
+ document . getElementById ( "result" ) . innerText = "点击下载压缩包"
103
+ document . getElementById ( "download" ) . href = JSON . parse ( xmlhttp . responseText ) [ "result" ]
104
+ document . getElementById ( "result" ) . style . display = "inline"
105
+ document . getElementById ( "info" ) . style . display = "none"
35
106
}
36
107
}
37
108
}
38
109
39
- var pythonVersion = 3
40
- var url = "http://service-8d3fi753-1256773370.bj.apigw.tencentcs.com/release/scf_python3_package_download"
41
- var obj = document . getElementsByName ( "python" ) ;
110
+ var url
111
+ var obj = document . getElementsByClassName ( "item" ) ;
42
112
for ( var i = 0 ; i < obj . length ; i ++ ) {
43
- if ( obj [ i ] . checked ) {
44
- pythonVersion = obj [ i ] . value ;
113
+ if ( obj [ i ] . className . indexOf ( "selected" ) != - 1 ) {
114
+ if ( obj [ i ] . innerHTML == "Python 3" ) {
115
+ url = "http://service-8d3fi753-1256773370.bj.apigw.tencentcs.com/release/scf_python3_package_download"
116
+ break
117
+ }
118
+ if ( obj [ i ] . innerHTML == "Python 2" ) {
119
+ url = "http://service-8d3fi753-1256773370.bj.apigw.tencentcs.com/release/scf_python2_package_download"
120
+ break
121
+ }
45
122
}
46
123
}
47
- if ( pythonVersion == 2 ) {
48
- url = "http://service-8d3fi753-1256773370.bj.apigw.tencentcs.com/release/scf_python2_package_download"
49
- }
50
- xmlhttp . open ( "POST" , url , true ) ;
51
- xmlhttp . setRequestHeader ( "Content-type" , "application/json" ) ;
52
- var postData = {
53
- name : document . getElementById ( "name" ) . value ,
54
- version : document . getElementById ( "version" ) . value
124
+ if ( ! url ) {
125
+ document . getElementById ( "result" ) . style . display = "none"
126
+ document . getElementById ( "info" ) . style . display = "inline"
127
+ document . getElementById ( "info" ) . innerText = "请在上面的下来框中选择Runtime"
128
+ } else {
129
+ xmlhttp . open ( "POST" , url , true ) ;
130
+ xmlhttp . setRequestHeader ( "Content-type" , "application/json" ) ;
131
+ var postData = {
132
+ name : document . getElementById ( "name" ) . value ,
133
+ version : document . getElementById ( "version" ) . value
134
+ }
135
+ xmlhttp . send ( JSON . stringify ( postData ) ) ;
55
136
}
56
- xmlhttp . send ( JSON . stringify ( postData ) ) ;
57
137
}
58
138
</ script >
59
139
</ head >
60
140
< body >
61
141
62
- < h1 style ="text-align: center "> Python Package Tool For Tencent Serverless Cloud Function</ h1 >
63
- < div style ="text-align: center ">
64
- < input type ="radio " value ="2 " name ="python "> Python2
65
- < input type ="radio " value ="3 " name ="python " checked ="checked "> Python3
66
- < br > < br >
67
- < input type ="text " width ="40% " placeholder ="请输入Package名字 " id ="name ">
68
- < input type ="text " width ="40% " placeholder ="请输入版本信息 " id ="version ">
69
- < button onclick ="loadXMLDoc() "> 确定</ button >
142
+ < div class ="ui container ">
143
+ < h1 > Python Package Tool For Tencent Serverless Cloud Function</ h1 >
144
+ < br >
145
+
146
+ < center >
147
+ < div class ="ui center labeled input ">
148
+ < input placeholder ="请输入包名 " type ="text " id ="name ">
149
+ < input placeholder ="请输版本名 " type ="text " id ="version ">
150
+ < div class ="ui dropdown label ">
151
+ < div class ="text "> 请选择Runtime</ div >
152
+ < i class ="dropdown icon "> </ i >
153
+ < div class ="menu ">
154
+ < div class ="item "> Python 3</ div >
155
+ < div class ="item "> Python 2</ div >
156
+ </ div >
157
+ </ div >
158
+ < button class ="ui primary button " onclick ="loadXMLDoc() "> 获取依赖</ button >
159
+ </ div >
160
+ </ center >
161
+ < br >
162
+
163
+
164
+ < center >
165
+ < a href ="" id ="download ">
166
+ < button class ="ui loading button " style ="display: none " id ="result "> Loading</ button >
167
+ </ a >
168
+ < h3 style ="display: none " id ="info "> </ h3 >
169
+ </ center >
170
+
70
171
< br > < br >
71
- < a href ="# " id ="result "> </ a >
172
+ < div class ="column ">
173
+ < h2 > 使用说明</ h2 >
174
+ < p > 本工具是通过Serverless Framework工具构建在腾讯云SCF上的Python依赖下载工具.</ p >
175
+ < p > < strong > 工具背景: </ strong > SCF的环境在CentOS + Python(3.6/2.7),在Python项目中,我们通过PIP安装依赖可能会涉及到编译相关过程,可能会导致在非CentOS系统上下载的依赖上传到SCF中无法使用。</ p >
176
+ < p > < strong > 解决问题: </ strong > 可以通过用户提交的包名和依赖名为用户在SCF的环境中打包相关依赖,用户可以下载依赖放入到自己项目中,并且使用。</ p >
177
+ < p > < strong > 免责说明: </ strong > 本项目所提供的下载均为安装之后直接压缩并返回给用户的压缩包,不存在中间过程修改,但是本人并不能保证返回给您的依赖可用性以及安全性,本工具仅供测试使用,不代表官方行为,仅作为Serverless爱好者为您提供的工具,如果您在使用过程中出现任何问题,可以随时联系我QQ:80902630;出现任何问题,我会尽力协助解决,但是不会负责,请您慎重使用。</ p >
178
+ </ div >
179
+
72
180
</ div >
73
- < p style ="text-align: center "> 本项目自豪的< br > 通过Serverless Framework< br > 搭建在腾讯云SCF上</ p >
181
+
182
+ < footer id ="footer ">
183
+ < center > < p > 本项目自豪的< br >
184
+ 通过Serverless Framework< br >
185
+ 搭建在腾讯云SCF上</ p > </ center >
186
+ </ footer >
187
+
74
188
</ body >
75
189
</ html >
0 commit comments