add_server.html 37 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837
  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. // // 原本就註解
  144. // //驗證token,如果不符合或過期就登出回登入頁
  145. // var str = localStorage.getItem('Hello');
  146. // $.ajax({
  147. // type: "GET",
  148. // url: "/auth",
  149. // headers: {'Authorization': 'Bearer ' + str},
  150. // success: function(result){
  151. // console.log(result.identity);
  152. // },
  153. // error: function(result){
  154. // window.location.href='/logout';
  155. // }
  156. // });
  157. $(function(){
  158. console.log("OK")
  159. var namespace = '/test_conn';
  160. var url = 'http://127.0.0.1';
  161. var port = '5000';
  162. // var socket = io.connect(url + ':' + port + namespace);
  163. // var item = document.getElementById('python3.8-status');
  164. // item.style.width = '0%';
  165. // item.innerText = '0%';
  166. // timer_python38 = window.setInterval("AddBarIndex('python3.8-status')", 2000);
  167. // window.setInterval("abs_update()", 1000);
  168. // socket.on('connect', function() {
  169. // socket.emit('connect_event', {data: 'connected!'});
  170. // print("SOCKET CONNECT")
  171. // });
  172. // socket.on('user-confirm', function(msg) {
  173. // console.log(msg);
  174. // if(msg == 'pass'){
  175. // var item = document.getElementById('python3.8-status');
  176. // item.style.width = '2%';
  177. // item.innerText = '2%';
  178. // timer_python38 = window.setInterval("AddBarIndex('python3.8-status')", 2000);
  179. // };
  180. // });
  181. // socket.on('stdout', function(msg) {
  182. // if(msg.indexOf('python3.8') != -1){
  183. // ItemInstallSuccess(timer_python38, 'python3.8');
  184. // timer_python3_pip = window.setInterval("AddBarIndex('python3-pip-status')", 2000);
  185. // };
  186. // if(msg.indexOf('python3-pip') != -1){
  187. // ItemInstallSuccess(timer_python3_pip, 'python3-pip');
  188. // timer_git = window.setInterval("AddBarIndex('git-status')", 2000);
  189. // };
  190. // if(msg.indexOf('git') != -1){
  191. // ItemInstallSuccess(timer_git, 'git');
  192. // timer_wget = window.setInterval("AddBarIndex('wget-status')", 2000);
  193. // };
  194. // if(msg.indexOf('wget') != -1){
  195. // ItemInstallSuccess(timer_wget, 'wget');
  196. // timer_grep = window.setInterval("AddBarIndex('grep-status')", 2000);
  197. // };
  198. // if(msg.indexOf('grep') != -1){
  199. // ItemInstallSuccess(timer_grep, 'grep');
  200. // timer_tasksel = window.setInterval("AddBarIndex('tasksel-status')", 2000);
  201. // };
  202. // if(msg.indexOf('tasksel') != -1){
  203. // ItemInstallSuccess(timer_tasksel, 'tasksel');
  204. // timer_lamp_server = window.setInterval("AddBarIndex('lamp-server-status')", 2000);
  205. // };
  206. // if(msg.indexOf('lamp-server') != -1){
  207. // ItemInstallSuccess(timer_lamp_server, 'lamp-server');
  208. // timer_phpMyAdmin510_all_languages = window.setInterval("AddBarIndex('phpMyAdmin-5.1.0-all-languages.tar.gz-status')", 2000);
  209. // };
  210. // // // 原本就註解
  211. // // if(msg.indexOf('phpMyAdmin-5.1.0-all-languages.tar.gz') != -1){
  212. // // ItemInstallSuccess(timer_phpMyAdmin510_all_languages, 'phpMyAdmin-5.1.0-all-languages.tar.gz');
  213. // // timer_openssl = window.setInterval("AddBarIndex('openssl-status')", 2000);
  214. // // };
  215. // if(msg.indexOf('install phpmyadmin done') != -1){
  216. // ItemInstallSuccess(timer_phpMyAdmin510_all_languages, 'phpMyAdmin-5.1.0-all-languages.tar.gz');
  217. // timer_openssl = window.setInterval("AddBarIndex('openssl-status')", 2000);
  218. // };
  219. // if(msg.indexOf('openssl') != -1){
  220. // ItemInstallSuccess(timer_openssl, 'openssl');
  221. // timer_php_common = window.setInterval("AddBarIndex('php-common-status')", 2000);
  222. // };
  223. // if(msg.indexOf('php-common') != -1){
  224. // ItemInstallSuccess(timer_php_common, 'php-common');
  225. // timer_php_curl = window.setInterval("AddBarIndex('php-curl-status')", 2000);
  226. // };
  227. // if(msg.indexOf('php-curl') != -1){
  228. // ItemInstallSuccess(timer_php_curl, 'php-curl');
  229. // timer_php_json = window.setInterval("AddBarIndex('php-json-status')", 2000);
  230. // };
  231. // if(msg.indexOf('php-json') != -1){
  232. // ItemInstallSuccess(timer_php_json, 'php-json');
  233. // timer_php_mbstring = window.setInterval("AddBarIndex('php-mbstring')", 2000);
  234. // };
  235. // if(msg.indexOf('php-mbstring') != -1){
  236. // ItemInstallSuccess(timer_php_mbstring, 'php-mbstring');
  237. // timer_php_mysql = window.setInterval("AddBarIndex('php-mysql')", 2000);
  238. // };
  239. // if(msg.indexOf('php-mysql') != -1){
  240. // ItemInstallSuccess(timer_php_mysql, 'php-mysql');
  241. // timer_php_xml = window.setInterval("AddBarIndex('php-xml-status')", 2000);
  242. // };
  243. // if(msg.indexOf('php-xml') != -1){
  244. // ItemInstallSuccess(timer_php_xml, 'php-xml');
  245. // timer_php_zip = window.setInterval("AddBarIndex('php-zip-status')", 2000);
  246. // };
  247. // if(msg.indexOf('php-zip') != -1){
  248. // ItemInstallSuccess(timer_php_zip, 'php-zip');
  249. // timer_php72_mbstring = window.setInterval("AddBarIndex('php7.2-mbstring-status')", 2000);
  250. // };
  251. // if(msg.indexOf('php7.2-mbstring') != -1){
  252. // ItemInstallSuccess(timer_php72_mbstring, 'php7.2-mbstring');
  253. // timer_php72_xml = window.setInterval("AddBarIndex('php7.2-xml-status')", 2000);
  254. // };
  255. // if(msg.indexOf('php7.2-xml') != -1){
  256. // ItemInstallSuccess(timer_php72_xml, 'php7.2-xml');
  257. // timer_php72_mysql = window.setInterval("AddBarIndex('php7.2-mysql-status')", 2000);
  258. // };
  259. // if(msg.indexOf('php7.2-mysql') != -1){
  260. // ItemInstallSuccess(timer_php72_mysql, 'php7.2-mysql');
  261. // timer_php72_common = window.setInterval("AddBarIndex('php7.2-common-status')", 2000);
  262. // };
  263. // if(msg.indexOf('php7.2-common') != -1){
  264. // ItemInstallSuccess(timer_php72_common, 'php7.2-common');
  265. // timer_php72_curl = window.setInterval("AddBarIndex('php7.2-curl-status')", 2000);
  266. // };
  267. // if(msg.indexOf('php7.2-curl') != -1){
  268. // ItemInstallSuccess(timer_php72_curl, 'php7.2-curl');
  269. // timer_php72_json = window.setInterval("AddBarIndex('php7.2-json-status')", 2000);
  270. // };
  271. // if(msg.indexOf('php7.2-json') != -1){
  272. // ItemInstallSuccess(timer_php72_json, 'php7.2-json');
  273. // timer_php72_zip = window.setInterval("AddBarIndex('php7.2-zip-status')", 2000);
  274. // };
  275. // if(msg.indexOf('php7.2-zip') != -1){
  276. // ItemInstallSuccess(timer_php72_zip, 'php7.2-zip');
  277. // timer_service_apache2 = window.setInterval("AddBarIndex('service-apache2-start-status')", 2000);
  278. // };
  279. // if(msg.indexOf('service apache2 start') != -1){
  280. // ItemInstallSuccess(timer_service_apache2, 'service-apache2-start');
  281. // timer_setting_mysql = window.setInterval("AddBarIndex('setting-mysql-status')", 2000);
  282. // };
  283. // console.log(msg);
  284. // console.log('test1');
  285. // });
  286. // socket.on('stderr', function(msg) {
  287. // if(msg.indexOf('python3.8') != -1){
  288. // ItemInstallFail(timer_python38, 'python3.8');
  289. // timer_python3_pip = window.setInterval("AddBarIndex('python3-pip-status')", 2000);
  290. // };
  291. // if(msg.indexOf('python3-pip') != -1){
  292. // ItemInstallFail(timer_python3_pip, 'python3-pip');
  293. // timer_git = window.setInterval("AddBarIndex('git-status')", 2000);
  294. // };
  295. // if(msg.indexOf('git') != -1){
  296. // ItemInstallFail(timer_git, 'git');
  297. // timer_wget = window.setInterval("AddBarIndex('wget-status')", 2000);
  298. // };
  299. // if(msg.indexOf('wget') != -1){
  300. // ItemInstallFail(timer_wget, 'wget');
  301. // timer_grep = window.setInterval("AddBarIndex('grep-status')", 2000);
  302. // };
  303. // if(msg.indexOf('grep') != -1){
  304. // ItemInstallFail(timer_grep, 'grep');
  305. // timer_tasksel = window.setInterval("AddBarIndex('tasksel-status')", 2000);
  306. // };
  307. // if(msg.indexOf('tasksel') != -1){
  308. // ItemInstallFail(timer_tasksel, 'tasksel');
  309. // timer_lamp_server = window.setInterval("AddBarIndex('lamp-server-status')", 2000);
  310. // };
  311. // if(msg.indexOf('lamp-server') != -1){
  312. // ItemInstallFail(timer_lamp_server, 'lamp-server');
  313. // timer_phpMyAdmin = window.setInterval("AddBarIndex('phpMyAdmin-5.1.0-all-languages.tar.gz-status')", 2000);
  314. // };
  315. // // // 原本就註解
  316. // // if(msg.indexOf('phpMyAdmin-5.1.0-all-languages.tar.gz') != -1){
  317. // // ItemInstallFail(timer_phpMyAdmin, 'phpMyAdmin-5.1.0-all-languages.tar.gz');
  318. // // timer_openssl = window.setInterval("AddBarIndex('openssl-status')", 2000);
  319. // // };
  320. // if(msg.indexOf('openssl') != -1){
  321. // ItemInstallFail(timer_openssl, 'openssl');
  322. // timer_php_common = window.setInterval("AddBarIndex('php-common-status')", 2000);
  323. // };
  324. // if(msg.indexOf('php-common') != -1){
  325. // ItemInstallFail(timer_php_common, 'php-common');
  326. // timer_php_curl = window.setInterval("AddBarIndex('php-curl-status')", 2000);
  327. // };
  328. // if(msg.indexOf('php-curl') != -1){
  329. // ItemInstallFail(timer_php_curl, 'php-curl');
  330. // timer_php_json = window.setInterval("AddBarIndex('php-json-status')", 2000);
  331. // };
  332. // if(msg.indexOf('php-json') != -1){
  333. // ItemInstallFail(timer_php_json, 'php-json');
  334. // timer_php_mbstring = window.setInterval("AddBarIndex('php-mbstring')", 2000);
  335. // };
  336. // if(msg.indexOf('php-mbstring') != -1){
  337. // ItemInstallFail(timer_php_mbstring, 'php-mbstring');
  338. // timer_php_mysql = window.setInterval("AddBarIndex('php-mysql')", 2000);
  339. // };
  340. // if(msg.indexOf('php-mysql') != -1){
  341. // ItemInstallFail(timer_php_mysql, 'php-mysql');
  342. // timer_php_xml = window.setInterval("AddBarIndex('php-xml-status')", 2000);
  343. // };
  344. // if(msg.indexOf('php-xml') != -1){
  345. // ItemInstallFail(timer_php_xml, 'php-xml');
  346. // timer_php_zip = window.setInterval("AddBarIndex('php-zip-status')", 2000);
  347. // };
  348. // if(msg.indexOf('php-zip') != -1){
  349. // ItemInstallFail(timer_php_zip, 'php-zip');
  350. // timer_php72_mbstring = window.setInterval("AddBarIndex('php7.2-mbstring-status')", 2000);
  351. // };
  352. // if(msg.indexOf('php7.2-mbstring') != -1){
  353. // ItemInstallFail(timer_php72_mbstring, 'php7.2-mbstring');
  354. // timer_php72_xml = window.setInterval("AddBarIndex('php7.2-xml-status')", 2000);
  355. // };
  356. // if(msg.indexOf('php7.2-xml') != -1){
  357. // ItemInstallFail(timer_php72_xml, 'php7.2-xml');
  358. // timer_php72_mysql = window.setInterval("AddBarIndex('php7.2-mysql-status')", 2000);
  359. // };
  360. // if(msg.indexOf('php7.2-mysql') != -1){
  361. // ItemInstallFail(timer_php72_mysql, 'php7.2-mysql');
  362. // timer_php72_common = window.setInterval("AddBarIndex('php7.2-common-status')", 2000);
  363. // };
  364. // if(msg.indexOf('php7.2-common') != -1){
  365. // ItemInstallFail(timer_php72_common, 'php7.2-common');
  366. // timer_php72_curl = window.setInterval("AddBarIndex('php7.2-curl-status')", 2000);
  367. // };
  368. // if(msg.indexOf('php7.2-curl') != -1){
  369. // ItemInstallFail(timer_php72_curl, 'php7.2-curl');
  370. // timer_php72_json = window.setInterval("AddBarIndex('php7.2-json-status')", 2000);
  371. // };
  372. // if(msg.indexOf('php7.2-json') != -1){
  373. // ItemInstallFail(timer_php72_json, 'php7.2-json');
  374. // timer_php72_zip = window.setInterval("AddBarIndex('php7.2-zip-status')", 2000);
  375. // };
  376. // if(msg.indexOf('php7.2-zip') != -1){
  377. // ItemInstallFail(timer_php72_zip, 'php7.2-zip');
  378. // timer_service_apache2 = window.setInterval("AddBarIndex('service-apache2-start-status')", 2000);
  379. // };
  380. // if(msg.indexOf('service apache2 start') != -1){
  381. // ItemInstallFail(timer_service_apache2, 'service-apache2-start');
  382. // timer_setting_mysql = window.setInterval("AddBarIndex('setting-mysql-status')", 2000);
  383. // };
  384. // console.log(msg);
  385. // console.log('test2');
  386. // });
  387. });
  388. </script>
  389. </head>
  390. <body>
  391. <nav class="fixed-top">
  392. <nav class="navbar navbar-expand-md nav-top justify-content-center">
  393. <div>
  394. <span class="website_title">伺服器建置</span>
  395. </div>
  396. </nav>
  397. <nav class="navbar navbar-expand-md bg-dark navbar-dark nav-bottom">
  398. <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#collapsibleNavbar">
  399. <span class="navbar-toggler-icon"></span>
  400. </button>
  401. <div class="collapse navbar-collapse" id="collapsibleNavbar">
  402. <ul class="navbar-nav">
  403. <li class="nav-item">
  404. <a class="nav-link" href="/">首頁</a>
  405. </li>
  406. <li class="nav-item">
  407. <a class="nav-link" href="/incoming_check">進貨檢測</a>
  408. </li>
  409. <li class="nav-item">
  410. <a class="nav-link" href="/burn_program">感測器燒錄</a>
  411. </li>
  412. <li class="nav-item">
  413. <a class="nav-link" href="/modify_permissions">權限設置</a>
  414. </li>
  415. <li class="nav-item">
  416. <a class="nav-link" href="/add_sensor">新增感測器</a>
  417. </li>
  418. <li class="nav-item">
  419. <a class="nav-link" href="/add_server">伺服器建置</a>
  420. </li>
  421. <li class="li-block"></li>
  422. <li class="nav-item">
  423. <a class="nav-link" href="#"><i class="fa fa-user-o"></i> {{params.username}}</a>
  424. </li>
  425. <li class="nav-item">
  426. <a class="nav-link" href="/logout">Logout</a>
  427. </li>
  428. </ul>
  429. </div>
  430. </nav>
  431. </nav>
  432. <div class="main-page">
  433. <div class="container">
  434. <div class="row">
  435. <div class="col" style="margin: auto; ">
  436. <table class="table table-bordered" style="font-size:23px;margin-top:30px;">
  437. <tbody>
  438. <tr>
  439. <td>1.請輸入您的IP位置:</td>
  440. <td><input type="text" name="user_ip" value="60.250.156.232"></td>
  441. </tr>
  442. <tr>
  443. <td>2.請輸入您的登入帳號:</td>
  444. <td><input type="text" name="user_loginname" value="root"></td>
  445. </tr>
  446. <tr>
  447. <td>3.請輸入您的username:</td>
  448. <td><input type="text" name="user_username" value="gs1802"></td>
  449. </tr>
  450. <tr>
  451. <td>4.請輸入您的password:</td>
  452. <td><input type="password" name="user_password" value="g53743001"></td>
  453. </tr>
  454. </tbody>
  455. </table>
  456. <div class="text-center">
  457. <input type="button" value="建置" name="add_server" style="cursor:pointer;" onclick="AddServer()">
  458. </div>
  459. <div class="text-center" id="addServer-status" style="margin-top:30px;color:red;visibility:hidden;">
  460. <h2>伺服器建置中...</h2>
  461. </div>
  462. <div>
  463. <h1>Item install status</h1>
  464. <table class="table table-bordered" style="font-size:23px;margin-top:30px;">
  465. <tbody>
  466. <tr>
  467. <th>Item</th>
  468. <th>Status</th>
  469. </tr>
  470. {% for item in params.L %}
  471. <tr>
  472. <td>{{loop.index}}.{{item}}</td>
  473. <td>
  474. <div class="progress" style="height:35px;">
  475. <div id="{{item}}-status" name="{{item}}-status" class="progress-bar progress-bar-striped"
  476. style="width:0%; height:35px; font-size:20px; color:black; text-align:center;">0%
  477. </div>
  478. </div>
  479. </td>
  480. </tr>
  481. {% endfor %}
  482. <!-- <tr>-->
  483. <!-- <td>1.pymysql</td>-->
  484. <!--&lt;!&ndash; <td><span name="pymysql-status"></span></td>&ndash;&gt;-->
  485. <!-- <td>-->
  486. <!-- <div class="progress" style="height:35px;">-->
  487. <!-- <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>-->
  488. <!-- </div>-->
  489. <!-- </td>-->
  490. <!-- </tr>-->
  491. <!-- <tr>-->
  492. <!-- <td>2.eventlet</td>-->
  493. <!--&lt;!&ndash; <td><span name="eventlet-status"></span></td>&ndash;&gt;-->
  494. <!-- <td>-->
  495. <!-- <div class="progress" style="height:35px;">-->
  496. <!-- <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>-->
  497. <!-- </div>-->
  498. <!-- </td>-->
  499. <!-- </tr>-->
  500. <!-- <tr>-->
  501. <!-- <td>3.flask</td>-->
  502. <!--&lt;!&ndash; <td><span name="eventlet-status"></span></td>&ndash;&gt;-->
  503. <!-- <td>-->
  504. <!-- <div class="progress" style="height:35px;">-->
  505. <!-- <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>-->
  506. <!-- </div>-->
  507. <!-- </td>-->
  508. <!-- </tr>-->
  509. </tbody>
  510. </table>
  511. </div>
  512. </div>
  513. </div>
  514. </div>
  515. </div>
  516. </body>
  517. <script>
  518. // var timer_python38 = 0;
  519. // var timer_python3_pip = 0;
  520. // var timer_git = 0;
  521. // var timer_wget = 0;
  522. // var timer_grep = 0;
  523. // var timer_tasksel = 0;
  524. // var timer_lamp_server = 0;
  525. // var timer_phpMyAdmin = 0;
  526. // var timer_openssl = 0;
  527. // var timer_php_common = 0;
  528. // var timer_php_curl = 0;
  529. // var timer_php_json = 0;
  530. // var timer_php_mbstring = 0;
  531. // var timer_php_mysql = 0;
  532. // var timer_php_xml = 0;
  533. // var timer_php_zip = 0;
  534. // var timer_php72_mbstring = 0;
  535. // var timer_php72_xml = 0;
  536. // var timer_php72_mysql = 0;
  537. // var timer_php72_common = 0;
  538. // var timer_php72_curl = 0;
  539. // var timer_php72_json = 0;
  540. // var timer_php72_zip = 0;
  541. // var timer_service_apache2 = 0;
  542. // var timer_setting_mysql = 0;
  543. // var timer_paho_mqtt = 0;
  544. // var timer_mosquitto = 0;
  545. // var timer_mqtt_server = 0;
  546. // var timer_watchdog = 0;
  547. // var timer_golang = 0;
  548. // var timer_Git_server = 0;
  549. // var timer_flask = 0;
  550. // var timer_Flask_SQLAlchemy = 0;
  551. // var timer_pymysql = 0;
  552. // var timer_flask_mqtt = 0;
  553. // var timer_flask_migrate = 0;
  554. // var timer_flask_jwt_extended = 0;
  555. // var timer_numpy = 0;
  556. // var timer_pandas = 0;
  557. // var timer_opencv_python = 0;
  558. // var timer_BeautifulSoup4 = 0;
  559. // var timer_selenium = 0;
  560. // var timer_geocoder = 0;
  561. // var timer_AP = 0;
  562. // var timer_chrony_ntpdate = 0;
  563. // var timer_deb_ros_packages_and_keyserver = 0;
  564. // var timer_update = 0;
  565. // var timer_upgrade = 0;
  566. // var timer_ros_melodic_desktop_full = 0;
  567. // var timer_ros_melodic_rqt = 0;
  568. // var timer_pythonrosdep = 0;
  569. // var timer_python_rosinstall = 0;
  570. // var timer_ROS = 0;
  571. function AddBarIndex(obj){
  572. var item = document.getElementById(obj);
  573. //因假設元素id內有.或是空格的使用jQuery選擇器會找不到,所以改成用js的節點來設置
  574. //[0].style.width 讓width顯示為%值,使用css.('width')會顯示px
  575. //var width = obj[0].style.width;
  576. var width = item.style.width;
  577. // console.log("width: " + width);
  578. var current_width = width.substring(0, width.length-1);
  579. console.log("current_width: " + current_width);
  580. item.style.width = Number(current_width) + 2 + '%';
  581. // console.log("item.style.width: " + item.style.width);
  582. item.innerText = Number(current_width) + 2 + '%';
  583. // console.log("item.innerText: " + item.innerText);
  584. if (current_width == 94) {
  585. console.log(obj + ' INSTALLATION AddBar Pause');
  586. eval('clearInterval(timer)');
  587. }
  588. };
  589. function AddServer(){
  590. //var item = document.getElementById('python3.8-status');
  591. //item.style.width = '2%';
  592. //item.innerText = '2%';
  593. //timer_python38 = window.setInterval("AddBarIndex('python3.8-status')", 2000);
  594. $("#addServer-status").css('visibility','visible');
  595. var ip = $("input[name=user_ip]").val();
  596. var loginname = $("input[name=user_loginname]").val();
  597. var username = $("input[name=user_username]").val();
  598. var password = $("input[name=user_password]").val();
  599. var json = {"ip":ip, "loginname":loginname, "username":username, "password":password};
  600. var abs_update_interval = window.setInterval("abs_update()", 1000);
  601. $.post('/add_server', json, function(resText){
  602. $("#addServer-status").css('visibility','hidden');
  603. if(resText == 'Authentication failed.'){
  604. resText = '您輸入的密碼有誤,請重新輸入!';
  605. $("input[name=user_ip]").val('');
  606. $("input[name=user_username]").val('');
  607. $("input[name=user_password]").val('');
  608. };
  609. clearInterval(abs_update_interval);
  610. alert(resText);
  611. }, 'text');
  612. };
  613. Automatic_Build_System_installation = {
  614. 'python3.8-installation': 'Wait',
  615. 'python3-pip-installation': 'Wait',
  616. 'cryptography-installation': 'Wait',
  617. 'upgrade-installation': 'Wait',
  618. 'grep-installation': 'Wait',
  619. 'git-installation': 'Wait',
  620. 'gitpython-installation': 'Wait',
  621. 'python3-tk-installation': 'Wait',
  622. 'wget-installation': 'Wait',
  623. 'python3-dev-installation': 'Wait',
  624. 'tasksel-installation': 'Wait',
  625. 'lamp-server-installation': 'Wait',
  626. 'phpMyAdmin-5.1.0-all-languages.tar.gz-installation': 'Wait',
  627. 'openssl-installation': 'Wait',
  628. 'php-common-installation': 'Wait',
  629. 'php-curl-installation': 'Wait',
  630. 'php-json-installation': 'Wait',
  631. 'php-mbstring-installation': 'Wait',
  632. 'php-mysql-installation': 'Wait',
  633. 'php-xml-installation': 'Wait',
  634. 'php-zip-installation': 'Wait',
  635. 'php7.2-mbstring-installation': 'Wait',
  636. 'php7.2-xml-installation': 'Wait',
  637. 'php7.2-mysql-installation': 'Wait',
  638. 'php7.2-common-installation': 'Wait',
  639. 'php7.2-curl-installation': 'Wait',
  640. 'php7.2-json-installation': 'Wait',
  641. 'php7.2-zip-installation': 'Wait',
  642. 'apache2-installation': 'Wait',
  643. 'mysql -u root -e-installation': 'Wait',
  644. 'paho-mqtt-installation': 'Wait',
  645. 'mosquitto-installation': 'Wait',
  646. 'mqtt_server_setting-installation': 'Wait',
  647. 'rclocal/rc.local-installation': 'Wait',
  648. 'golang-installation': 'Wait',
  649. 'gogsfile.git-installation': 'Wait',
  650. 'requirements-installation': 'Wait',
  651. 'chrony-installation': 'Wait',
  652. '--keyserver-installation': 'Wait',
  653. 'update-installation': 'Wait',
  654. 'ros-melodic-desktop-full-installation': 'Wait',
  655. 'ros-melodic-rqt*-installation': 'Wait',
  656. 'python-rosdep-installation': 'Wait',
  657. 'python-rosinstall-installation': 'Wait',
  658. 'python-rosinstall-generator-installation': 'Wait',
  659. 'python-wstool-installation': 'Wait',
  660. 'catkin_make-installation': 'Wait'
  661. }
  662. var abs_update_process = 0;
  663. function abs_update() {
  664. if (abs_update_process === 1) {
  665. return;
  666. }
  667. abs_update_process = 1;
  668. $.ajax({
  669. async:false,
  670. type:"GET",
  671. url:"/ABS_update",
  672. dataType:"JSON",
  673. success:function(response){
  674. for (const key of Object.entries(response)) {
  675. if (response[key[0]] == 'Install') {
  676. if (Automatic_Build_System_installation[key[0] + '-installation'] == 'Wait') {
  677. Automatic_Build_System_installation[key[0] + '-installation'] = 'Install';
  678. timer = window.setInterval("AddBarIndex('" + key[0] + "-status')", 2000);
  679. }
  680. } else if (response[key[0]] == '0') {
  681. // pass
  682. } else if (response[key[0]] == 'Error') {
  683. if (Automatic_Build_System_installation[key[0] + '-installation'] == 'Install') {
  684. Automatic_Build_System_installation[key[0] + '-installation'] = 'Error';
  685. ItemInstallFail(timer, key[0]);
  686. }
  687. // } else if (response[key[0]] == 'Success') {
  688. // if (Automatic_Build_System_installation[key[0] + '-installation'] == 'Install') {
  689. // Automatic_Build_System_installation[key[0] + '-installation'] = 'Success';
  690. // ItemInstallSuccess(timer, key[0]);
  691. // }
  692. } else if (Number(response[key[0]]) !== NaN) {
  693. if (Automatic_Build_System_installation[key[0] + '-installation'] == 'Install') {
  694. Automatic_Build_System_installation[key[0] + '-installation'] = 'Success';
  695. ItemInstallSuccess(timer, key[0], response[key[0]]);
  696. }
  697. } else {
  698. console.log("response[key[0]]: " + response[key[0]]);
  699. }
  700. }
  701. abs_update_process = 0;
  702. },
  703. error:function(thrownError){
  704. console.log("thrownError: " + thrownError);
  705. abs_update_process = 0;
  706. }
  707. });
  708. };
  709. function ItemInstallSuccess(timer_item, item_name, execution_time){
  710. eval('clearInterval(' + timer_item + ')');
  711. var item = document.getElementById(item_name + '-status');
  712. item.style.width = '100%';
  713. item.innerText = execution_time + 's';
  714. };
  715. function ItemInstallFail(timer_item, item_name){
  716. eval('clearInterval(' + timer_item + ')');
  717. var item = document.getElementById(item_name + '-status');
  718. item.style.width = '0%';
  719. item.innerText = 'Fail';
  720. item.style.color = 'red';
  721. item.style.fontWeight = 'bold';
  722. };
  723. </script>
  724. </html>