add_server.html 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>Aisky-Sixth</title>
  6. <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
  7. <!-- 新 Bootstrap4 核心 CSS 文件 -->
  8. <link rel="stylesheet" href="https://cdn.bootcss.com/bootstrap/4.1.0/css/bootstrap.min.css">
  9. <!-- jQuery文件。务必在bootstrap.min.js 之前引入 -->
  10. <script src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
  11. <!-- popper.min.js 用于弹窗、提示、下拉菜单 -->
  12. <script src="https://cdn.bootcss.com/popper.js/1.12.5/umd/popper.min.js"></script>
  13. <!-- 最新的 Bootstrap4 核心 JavaScript 文件 -->
  14. <script src="https://cdn.bootcss.com/bootstrap/4.1.0/js/bootstrap.min.js"></script>
  15. <!--可用來建立使用者小圖示-->
  16. <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
  17. <script src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/2.3.0/socket.io.dev.js"></script>
  18. <!-- <script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/socket.io/1.3.6/socket.io.min.js"></script>-->
  19. <!-- <script src="https://cdn.socket.io/4.0.1/socket.io.min.js" integrity="sha384-LzhRnpGmQP+lOvWruF/lgkcqD+WDVt9fU3H4BWmwP5u5LTmkUGafMcpZKNObVMLU" crossorigin="anonymous"></script>-->
  20. <style>
  21. body {
  22. margin:0;
  23. }
  24. .navbar-dark .navbar-nav .nav-link {
  25. color: white;
  26. cursor: pointer;
  27. text-decoration:none;
  28. width: 130px;
  29. height: 46px;
  30. }
  31. .nav-top {
  32. line-height:40px;
  33. background-color: #C4C4C4;
  34. }
  35. .website_title{
  36. font-family: Roboto;
  37. font-style: normal;
  38. font-weight: normal;
  39. font-size: 30px;
  40. color: #000000;
  41. }
  42. .navbar-nav > li{
  43. float: none;
  44. display: inline-block;
  45. width: 110px;
  46. margin: 0 auto;
  47. text-align: center;
  48. }
  49. .navbar-nav > li a{
  50. font-size: 20px;
  51. }
  52. .main-page {
  53. margin-top: 150px;
  54. }
  55. .page-title {
  56. font-family: Roboto;
  57. font-style: normal;
  58. font-weight: bold;
  59. font-size: 36px;
  60. }
  61. .flex {
  62. display: flex;
  63. flex-direction: row;
  64. flex-wrap: wrap;
  65. justify-content: center;
  66. }
  67. .set-link {
  68. display: inline-block;
  69. width: 350px;
  70. height: 100px;
  71. line-height: 100px;
  72. background: #008CBA;
  73. border: 1px solid #CFCFCF;
  74. box-sizing: border-box;
  75. color: #FFFFFF;
  76. border-radius: 10px;
  77. font-size: 36px;
  78. }
  79. .fa{
  80. display: inline-block;
  81. font: normal normal normal 14px/1 FontAwesome;
  82. font-size: inherit;
  83. text-rendering: auto;
  84. -webkit-font-smoothing: antialiased;
  85. }
  86. .fa-user-o:before{
  87. content: "\f2c0";
  88. }
  89. button {
  90. cursor: pointer;
  91. }
  92. @media(max-width:373px){
  93. .card {
  94. margin-right: 0px;
  95. }
  96. }
  97. @media(max-width:577px){
  98. }
  99. @media(min-width:576px){
  100. }
  101. @media(min-width:768px){
  102. .navbar-nav > li {
  103. margin-left: 0px;
  104. }
  105. .navbar-nav .li-block {
  106. display:none;
  107. }
  108. }
  109. @media(min-width:991px){
  110. .navbar-nav > li {
  111. margin-left: 20px;
  112. }
  113. .navbar-nav .li-block {
  114. display:none;
  115. }
  116. }
  117. @media(min-width:1200px){
  118. .navbar-nav > li {
  119. margin-left: 35px;
  120. }
  121. .navbar-nav .li-block {
  122. display: inline-block;
  123. width: 100px;
  124. }
  125. }
  126. @media(min-width:1400px){
  127. .navbar-nav .li-block {
  128. display: inline-block;
  129. width: 200px;
  130. }
  131. }
  132. @media(min-width:1689px) {
  133. .navbar-nav > li {
  134. margin-left: 50px;
  135. }
  136. .navbar-nav .li-block {
  137. display: inline-block;
  138. width: 500px;
  139. }
  140. }
  141. </style>
  142. <script>
  143. <!-- //驗證token,如果不符合或過期就登出回登入頁-->
  144. <!-- var str = localStorage.getItem('Hello');-->
  145. <!-- $.ajax({-->
  146. <!-- type: "GET",-->
  147. <!-- url: "/auth",-->
  148. <!-- headers: {'Authorization': 'Bearer ' + str},-->
  149. <!-- success: function(result){-->
  150. <!-- console.log(result.identity);-->
  151. <!-- },-->
  152. <!-- error: function(result){-->
  153. <!-- window.location.href='/logout';-->
  154. <!-- }-->
  155. <!-- });-->
  156. $(function(){
  157. var namespace = '/test_conn';
  158. var url = 'http://127.0.0.1';
  159. var port = '5000';
  160. var socket = io.connect(url + ':' + port + namespace);
  161. socket.on('connect', function() {
  162. socket.emit('connect_event', {data: 'connected!'});
  163. });
  164. socket.on('user-confirm', function(msg) {
  165. console.log(msg);
  166. if(msg == 'pass'){
  167. var item = document.getElementById('python3.8-status');
  168. item.style.width = '2%';
  169. item.innerText = '2%';
  170. timer_python38 = window.setInterval("AddBarIndex('python3.8-status')", 2000);
  171. };
  172. });
  173. socket.on('stdout', function(msg) {
  174. if(msg.indexOf('python3.8') != -1){
  175. ItemInstallSuccess(timer_python38, 'python3.8');
  176. timer_python3_pip = window.setInterval("AddBarIndex('python3-pip-status')", 2000);
  177. };
  178. if(msg.indexOf('python3-pip') != -1){
  179. ItemInstallSuccess(timer_python3_pip, 'python3-pip');
  180. timer_git = window.setInterval("AddBarIndex('git-status')", 2000);
  181. };
  182. if(msg.indexOf('git') != -1){
  183. ItemInstallSuccess(timer_git, 'git');
  184. timer_wget = window.setInterval("AddBarIndex('wget-status')", 2000);
  185. };
  186. if(msg.indexOf('wget') != -1){
  187. ItemInstallSuccess(timer_wget, 'wget');
  188. timer_grep = window.setInterval("AddBarIndex('grep-status')", 2000);
  189. };
  190. if(msg.indexOf('grep') != -1){
  191. ItemInstallSuccess(timer_grep, 'grep');
  192. timer_tasksel = window.setInterval("AddBarIndex('tasksel-status')", 2000);
  193. };
  194. if(msg.indexOf('tasksel') != -1){
  195. ItemInstallSuccess(timer_tasksel, 'tasksel');
  196. timer_lamp_server = window.setInterval("AddBarIndex('lamp-server-status')", 2000);
  197. };
  198. if(msg.indexOf('lamp-server') != -1){
  199. ItemInstallSuccess(timer_lamp_server, 'lamp-server');
  200. timer_phpMyAdmin510_all_languages = window.setInterval("AddBarIndex('phpMyAdmin-5.1.0-all-languages.tar.gz-status')", 2000);
  201. };
  202. <!-- if(msg.indexOf('phpMyAdmin-5.1.0-all-languages.tar.gz') != -1){-->
  203. <!-- ItemInstallSuccess(timer_phpMyAdmin510_all_languages, 'phpMyAdmin-5.1.0-all-languages.tar.gz');-->
  204. <!-- timer_openssl = window.setInterval("AddBarIndex('openssl-status')", 2000);-->
  205. <!-- };-->
  206. if(msg.indexOf('install phpmyadmin done') != -1){
  207. ItemInstallSuccess(timer_phpMyAdmin510_all_languages, 'phpMyAdmin-5.1.0-all-languages.tar.gz');
  208. timer_openssl = window.setInterval("AddBarIndex('openssl-status')", 2000);
  209. };
  210. if(msg.indexOf('openssl') != -1){
  211. ItemInstallSuccess(timer_openssl, 'openssl');
  212. timer_php_common = window.setInterval("AddBarIndex('php-common-status')", 2000);
  213. };
  214. if(msg.indexOf('php-common') != -1){
  215. ItemInstallSuccess(timer_php_common, 'php-common');
  216. timer_php_curl = window.setInterval("AddBarIndex('php-curl-status')", 2000);
  217. };
  218. if(msg.indexOf('php-curl') != -1){
  219. ItemInstallSuccess(timer_php_curl, 'php-curl');
  220. timer_php_json = window.setInterval("AddBarIndex('php-json-status')", 2000);
  221. };
  222. if(msg.indexOf('php-json') != -1){
  223. ItemInstallSuccess(timer_php_json, 'php-json');
  224. timer_php_mbstring = window.setInterval("AddBarIndex('php-mbstring')", 2000);
  225. };
  226. if(msg.indexOf('php-mbstring') != -1){
  227. ItemInstallSuccess(timer_php_mbstring, 'php-mbstring');
  228. timer_php_mysql = window.setInterval("AddBarIndex('php-mysql')", 2000);
  229. };
  230. if(msg.indexOf('php-mysql') != -1){
  231. ItemInstallSuccess(timer_php_mysql, 'php-mysql');
  232. timer_php_xml = window.setInterval("AddBarIndex('php-xml-status')", 2000);
  233. };
  234. if(msg.indexOf('php-xml') != -1){
  235. ItemInstallSuccess(timer_php_xml, 'php-xml');
  236. timer_php_zip = window.setInterval("AddBarIndex('php-zip-status')", 2000);
  237. };
  238. if(msg.indexOf('php-zip') != -1){
  239. ItemInstallSuccess(timer_php_zip, 'php-zip');
  240. timer_php72_mbstring = window.setInterval("AddBarIndex('php7.2-mbstring-status')", 2000);
  241. };
  242. if(msg.indexOf('php7.2-mbstring') != -1){
  243. ItemInstallSuccess(timer_php72_mbstring, 'php7.2-mbstring');
  244. timer_php72_xml = window.setInterval("AddBarIndex('php7.2-xml-status')", 2000);
  245. };
  246. if(msg.indexOf('php7.2-xml') != -1){
  247. ItemInstallSuccess(timer_php72_xml, 'php7.2-xml');
  248. timer_php72_mysql = window.setInterval("AddBarIndex('php7.2-mysql-status')", 2000);
  249. };
  250. if(msg.indexOf('php7.2-mysql') != -1){
  251. ItemInstallSuccess(timer_php72_mysql, 'php7.2-mysql');
  252. timer_php72_common = window.setInterval("AddBarIndex('php7.2-common-status')", 2000);
  253. };
  254. if(msg.indexOf('php7.2-common') != -1){
  255. ItemInstallSuccess(timer_php72_common, 'php7.2-common');
  256. timer_php72_curl = window.setInterval("AddBarIndex('php7.2-curl-status')", 2000);
  257. };
  258. if(msg.indexOf('php7.2-curl') != -1){
  259. ItemInstallSuccess(timer_php72_curl, 'php7.2-curl');
  260. timer_php72_json = window.setInterval("AddBarIndex('php7.2-json-status')", 2000);
  261. };
  262. if(msg.indexOf('php7.2-json') != -1){
  263. ItemInstallSuccess(timer_php72_json, 'php7.2-json');
  264. timer_php72_zip = window.setInterval("AddBarIndex('php7.2-zip-status')", 2000);
  265. };
  266. if(msg.indexOf('php7.2-zip') != -1){
  267. ItemInstallSuccess(timer_php72_zip, 'php7.2-zip');
  268. timer_service_apache2 = window.setInterval("AddBarIndex('service-apache2-start-status')", 2000);
  269. };
  270. if(msg.indexOf('service apache2 start') != -1){
  271. ItemInstallSuccess(timer_service_apache2, 'service-apache2-start');
  272. timer_setting_mysql = window.setInterval("AddBarIndex('setting-mysql-status')", 2000);
  273. };
  274. console.log(msg);
  275. console.log('test1');
  276. });
  277. socket.on('stderr', function(msg) {
  278. if(msg.indexOf('python3.8') != -1){
  279. ItemInstallFail(timer_python38, 'python3.8');
  280. timer_python3_pip = window.setInterval("AddBarIndex('python3-pip-status')", 2000);
  281. };
  282. if(msg.indexOf('python3-pip') != -1){
  283. ItemInstallFail(timer_python3_pip, 'python3-pip');
  284. timer_git = window.setInterval("AddBarIndex('git-status')", 2000);
  285. };
  286. if(msg.indexOf('git') != -1){
  287. ItemInstallFail(timer_git, 'git');
  288. timer_wget = window.setInterval("AddBarIndex('wget-status')", 2000);
  289. };
  290. if(msg.indexOf('wget') != -1){
  291. ItemInstallFail(timer_wget, 'wget');
  292. timer_grep = window.setInterval("AddBarIndex('grep-status')", 2000);
  293. };
  294. if(msg.indexOf('grep') != -1){
  295. ItemInstallFail(timer_grep, 'grep');
  296. timer_tasksel = window.setInterval("AddBarIndex('tasksel-status')", 2000);
  297. };
  298. if(msg.indexOf('tasksel') != -1){
  299. ItemInstallFail(timer_tasksel, 'tasksel');
  300. timer_lamp_server = window.setInterval("AddBarIndex('lamp-server-status')", 2000);
  301. };
  302. if(msg.indexOf('lamp-server') != -1){
  303. ItemInstallFail(timer_lamp_server, 'lamp-server');
  304. timer_phpMyAdmin = window.setInterval("AddBarIndex('phpMyAdmin-5.1.0-all-languages.tar.gz-status')", 2000);
  305. };
  306. <!-- if(msg.indexOf('phpMyAdmin-5.1.0-all-languages.tar.gz') != -1){-->
  307. <!-- ItemInstallFail(timer_phpMyAdmin, 'phpMyAdmin-5.1.0-all-languages.tar.gz');-->
  308. <!-- timer_openssl = window.setInterval("AddBarIndex('openssl-status')", 2000);-->
  309. <!-- };-->
  310. if(msg.indexOf('openssl') != -1){
  311. ItemInstallFail(timer_openssl, 'openssl');
  312. timer_php_common = window.setInterval("AddBarIndex('php-common-status')", 2000);
  313. };
  314. if(msg.indexOf('php-common') != -1){
  315. ItemInstallFail(timer_php_common, 'php-common');
  316. timer_php_curl = window.setInterval("AddBarIndex('php-curl-status')", 2000);
  317. };
  318. if(msg.indexOf('php-curl') != -1){
  319. ItemInstallFail(timer_php_curl, 'php-curl');
  320. timer_php_json = window.setInterval("AddBarIndex('php-json-status')", 2000);
  321. };
  322. if(msg.indexOf('php-json') != -1){
  323. ItemInstallFail(timer_php_json, 'php-json');
  324. timer_php_mbstring = window.setInterval("AddBarIndex('php-mbstring')", 2000);
  325. };
  326. if(msg.indexOf('php-mbstring') != -1){
  327. ItemInstallFail(timer_php_mbstring, 'php-mbstring');
  328. timer_php_mysql = window.setInterval("AddBarIndex('php-mysql')", 2000);
  329. };
  330. if(msg.indexOf('php-mysql') != -1){
  331. ItemInstallFail(timer_php_mysql, 'php-mysql');
  332. timer_php_xml = window.setInterval("AddBarIndex('php-xml-status')", 2000);
  333. };
  334. if(msg.indexOf('php-xml') != -1){
  335. ItemInstallFail(timer_php_xml, 'php-xml');
  336. timer_php_zip = window.setInterval("AddBarIndex('php-zip-status')", 2000);
  337. };
  338. if(msg.indexOf('php-zip') != -1){
  339. ItemInstallFail(timer_php_zip, 'php-zip');
  340. timer_php72_mbstring = window.setInterval("AddBarIndex('php7.2-mbstring-status')", 2000);
  341. };
  342. if(msg.indexOf('php7.2-mbstring') != -1){
  343. ItemInstallFail(timer_php72_mbstring, 'php7.2-mbstring');
  344. timer_php72_xml = window.setInterval("AddBarIndex('php7.2-xml-status')", 2000);
  345. };
  346. if(msg.indexOf('php7.2-xml') != -1){
  347. ItemInstallFail(timer_php72_xml, 'php7.2-xml');
  348. timer_php72_mysql = window.setInterval("AddBarIndex('php7.2-mysql-status')", 2000);
  349. };
  350. if(msg.indexOf('php7.2-mysql') != -1){
  351. ItemInstallFail(timer_php72_mysql, 'php7.2-mysql');
  352. timer_php72_common = window.setInterval("AddBarIndex('php7.2-common-status')", 2000);
  353. };
  354. if(msg.indexOf('php7.2-common') != -1){
  355. ItemInstallFail(timer_php72_common, 'php7.2-common');
  356. timer_php72_curl = window.setInterval("AddBarIndex('php7.2-curl-status')", 2000);
  357. };
  358. if(msg.indexOf('php7.2-curl') != -1){
  359. ItemInstallFail(timer_php72_curl, 'php7.2-curl');
  360. timer_php72_json = window.setInterval("AddBarIndex('php7.2-json-status')", 2000);
  361. };
  362. if(msg.indexOf('php7.2-json') != -1){
  363. ItemInstallFail(timer_php72_json, 'php7.2-json');
  364. timer_php72_zip = window.setInterval("AddBarIndex('php7.2-zip-status')", 2000);
  365. };
  366. if(msg.indexOf('php7.2-zip') != -1){
  367. ItemInstallFail(timer_php72_zip, 'php7.2-zip');
  368. timer_service_apache2 = window.setInterval("AddBarIndex('service-apache2-start-status')", 2000);
  369. };
  370. if(msg.indexOf('service apache2 start') != -1){
  371. ItemInstallFail(timer_service_apache2, 'service-apache2-start');
  372. timer_setting_mysql = window.setInterval("AddBarIndex('setting-mysql-status')", 2000);
  373. };
  374. console.log(msg);
  375. console.log('test2');
  376. });
  377. });
  378. </script>
  379. </head>
  380. <body>
  381. <nav class="fixed-top">
  382. <nav class="navbar navbar-expand-md nav-top justify-content-center">
  383. <div>
  384. <span class="website_title">伺服器建置</span>
  385. </div>
  386. </nav>
  387. <nav class="navbar navbar-expand-md bg-dark navbar-dark nav-bottom">
  388. <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#collapsibleNavbar">
  389. <span class="navbar-toggler-icon"></span>
  390. </button>
  391. <div class="collapse navbar-collapse" id="collapsibleNavbar">
  392. <ul class="navbar-nav">
  393. <li class="nav-item">
  394. <a class="nav-link" href="/">首頁</a>
  395. </li>
  396. <li class="nav-item">
  397. <a class="nav-link" href="/incoming_check">進貨檢測</a>
  398. </li>
  399. <li class="nav-item">
  400. <a class="nav-link" href="/burn_program">感測器燒錄</a>
  401. </li>
  402. <li class="nav-item">
  403. <a class="nav-link" href="/modify_permissions">權限設置</a>
  404. </li>
  405. <li class="nav-item">
  406. <a class="nav-link" href="/add_sensor">新增感測器</a>
  407. </li>
  408. <li class="nav-item">
  409. <a class="nav-link" href="/add_server">伺服器建置</a>
  410. </li>
  411. <li class="li-block"></li>
  412. <li class="nav-item">
  413. <a class="nav-link" href="#"><i class="fa fa-user-o"></i> {{params.username}}</a>
  414. </li>
  415. <li class="nav-item">
  416. <a class="nav-link" href="/logout">Logout</a>
  417. </li>
  418. </ul>
  419. </div>
  420. </nav>
  421. </nav>
  422. <div class="main-page">
  423. <div class="container">
  424. <div class="row">
  425. <div class="col" style="margin: auto; ">
  426. <table class="table table-bordered" style="font-size:23px;margin-top:30px;">
  427. <tbody>
  428. <tr>
  429. <td>1.請輸入您的IP位置:</td>
  430. <td><input type="text" name="user_ip"></td>
  431. </tr>
  432. <tr>
  433. <td>2.請輸入您的username:</td>
  434. <td><input type="text" name="user_username"></td>
  435. </tr>
  436. <tr>
  437. <td>3.請輸入您的password:</td>
  438. <td><input type="password" name="user_password"></td>
  439. </tr>
  440. </tbody>
  441. </table>
  442. <div class="text-center">
  443. <input type="button" value="建置" name="add_server" style="cursor:pointer;" onclick="AddServer()">
  444. </div>
  445. <div class="text-center" id="addServer-status" style="margin-top:30px;color:red;visibility:hidden;">
  446. <h2>伺服器建置中...</h2>
  447. </div>
  448. <div>
  449. <h1>Item install status</h1>
  450. <table class="table table-bordered" style="font-size:23px;margin-top:30px;">
  451. <tbody>
  452. <tr>
  453. <th>Item</th>
  454. <th>Status</th>
  455. </tr>
  456. {% for item in params.L %}
  457. <tr>
  458. <td>{{loop.index}}.{{item}}</td>
  459. <td>
  460. <div class="progress" style="height:35px;">
  461. <div id="{{item}}-status" name="{{item}}-status" class="progress-bar progress-bar-striped" style="width:0%;height:35px;font-size:20px;color:black;text-align:center;">0%</div>
  462. </div>
  463. </td>
  464. </tr>
  465. {% endfor %}
  466. <!-- <tr>-->
  467. <!-- <td>1.pymysql</td>-->
  468. <!--&lt;!&ndash; <td><span name="pymysql-status"></span></td>&ndash;&gt;-->
  469. <!-- <td>-->
  470. <!-- <div class="progress" style="height:35px;">-->
  471. <!-- <div id="pymysql-status" class="progress-bar progress-bar-striped" style="width:0%;height:35px;font-size:20px;color:black;text-align:center;">0%</div>-->
  472. <!-- </div>-->
  473. <!-- </td>-->
  474. <!-- </tr>-->
  475. <!-- <tr>-->
  476. <!-- <td>2.eventlet</td>-->
  477. <!--&lt;!&ndash; <td><span name="eventlet-status"></span></td>&ndash;&gt;-->
  478. <!-- <td>-->
  479. <!-- <div class="progress" style="height:35px;">-->
  480. <!-- <div id="eventlet-status" class="progress-bar progress-bar-striped" style="width:0%;height:35px;font-size:20px;color:black;text-align:center;">0%</div>-->
  481. <!-- </div>-->
  482. <!-- </td>-->
  483. <!-- </tr>-->
  484. <!-- <tr>-->
  485. <!-- <td>3.flask</td>-->
  486. <!--&lt;!&ndash; <td><span name="eventlet-status"></span></td>&ndash;&gt;-->
  487. <!-- <td>-->
  488. <!-- <div class="progress" style="height:35px;">-->
  489. <!-- <div id="flask-status" class="progress-bar progress-bar-striped" style="width:0%;height:35px;font-size:20px;color:black;text-align:center;">0%</div>-->
  490. <!-- </div>-->
  491. <!-- </td>-->
  492. <!-- </tr>-->
  493. </tbody>
  494. </table>
  495. </div>
  496. </div>
  497. </div>
  498. </div>
  499. </div>
  500. </body>
  501. <script>
  502. var timer_python38 = 0;
  503. var timer_python3_pip = 0;
  504. var timer_git = 0;
  505. var timer_wget = 0;
  506. var timer_grep = 0;
  507. var timer_tasksel = 0;
  508. var timer_lamp_server = 0;
  509. var timer_phpMyAdmin = 0;
  510. var timer_openssl = 0;
  511. var timer_php_common = 0;
  512. var timer_php_curl = 0;
  513. var timer_php_json = 0;
  514. var timer_php_mbstring = 0;
  515. var timer_php_mysql = 0;
  516. var timer_php_xml = 0;
  517. var timer_php_zip = 0;
  518. var timer_php72_mbstring = 0;
  519. var timer_php72_xml = 0;
  520. var timer_php72_mysql = 0;
  521. var timer_php72_common = 0;
  522. var timer_php72_curl = 0;
  523. var timer_php72_json = 0;
  524. var timer_php72_zip = 0;
  525. var timer_service_apache2 = 0;
  526. var timer_setting_mysql = 0;
  527. var timer_paho_mqtt = 0;
  528. var timer_mosquitto = 0;
  529. var timer_mqtt_server = 0;
  530. var timer_watchdog = 0;
  531. var timer_golang = 0;
  532. var timer_Git_server = 0;
  533. var timer_flask = 0;
  534. var timer_Flask_SQLAlchemy = 0;
  535. var timer_pymysql = 0;
  536. var timer_flask_mqtt = 0;
  537. var timer_flask_migrate = 0;
  538. var timer_flask_jwt_extended = 0;
  539. var timer_numpy = 0;
  540. var timer_pandas = 0;
  541. var timer_opencv_python = 0;
  542. var timer_BeautifulSoup4 = 0;
  543. var timer_selenium = 0;
  544. var timer_geocoder = 0;
  545. var timer_AP = 0;
  546. var timer_chrony_ntpdate = 0;
  547. var timer_deb_ros_packages_and_keyserver = 0;
  548. var timer_update = 0;
  549. var timer_upgrade = 0;
  550. var timer_ros_melodic_desktop_full = 0;
  551. var timer_ros_melodic_rqt = 0;
  552. var timer_pythonrosdep = 0;
  553. var timer_python_rosinstall = 0;
  554. var timer_ROS = 0;
  555. function AddBarIndex(obj){
  556. var item = document.getElementById(obj);
  557. //因假設元素id內有.或是空格的使用jQuery選擇器會找不到,所以改成用js的節點來設置
  558. //[0].style.width 讓width顯示為%值,使用css.('width')會顯示px
  559. //var width = obj[0].style.width;
  560. var width = item.style.width;
  561. var current_width = width.substring(0, width.length-1);
  562. item.style.width = Number(current_width) + 2 + '%';
  563. item.innerText = Number(current_width) + 2 + '%';
  564. };
  565. function AddServer(){
  566. //var item = document.getElementById('python3.8-status');
  567. //item.style.width = '2%';
  568. //item.innerText = '2%';
  569. //timer_python38 = window.setInterval("AddBarIndex('python3.8-status')", 2000);
  570. $("#addServer-status").css('visibility','visible');
  571. var ip = $("input[name=user_ip]").val();
  572. var username = $("input[name=user_username]").val();
  573. var password = $("input[name=user_password]").val();
  574. var json = {"ip":ip, "username":username, "password":password};
  575. $.post('/add_server', json, function(resText){
  576. $("#addServer-status").css('visibility','hidden');
  577. if(resText == 'Authentication failed.'){
  578. resText = '您輸入的密碼有誤,請重新輸入!';
  579. $("input[name=user_ip]").val('');
  580. $("input[name=user_username]").val('');
  581. $("input[name=user_password]").val('');
  582. };
  583. alert(resText);
  584. }, 'text');
  585. };
  586. function ItemInstallSuccess(timer_item, item_name){
  587. eval('clearInterval(' + timer_item + ')');
  588. var item = document.getElementById(item_name + '-status');
  589. item.style.width = '100%';
  590. item.innerText = '100%';
  591. };
  592. function ItemInstallFail(timer_item, item_name){
  593. eval('clearInterval(' + timer_item + ')');
  594. var item = document.getElementById(item_name + '-status');
  595. item.style.width = '0%';
  596. item.innerText = 'Fail';
  597. item.style.color = 'red';
  598. };
  599. </script>
  600. </html>