123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708 |
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <title>Aisky-Sixth</title>
- <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
- <!-- 新 Bootstrap4 核心 CSS 文件 -->
- <link rel="stylesheet" href="https://cdn.bootcss.com/bootstrap/4.1.0/css/bootstrap.min.css">
- <!-- jQuery文件。务必在bootstrap.min.js 之前引入 -->
- <script src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
- <!-- popper.min.js 用于弹窗、提示、下拉菜单 -->
- <script src="https://cdn.bootcss.com/popper.js/1.12.5/umd/popper.min.js"></script>
- <!-- 最新的 Bootstrap4 核心 JavaScript 文件 -->
- <script src="https://cdn.bootcss.com/bootstrap/4.1.0/js/bootstrap.min.js"></script>
- <!--可用來建立使用者小圖示-->
- <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
- <script src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/2.3.0/socket.io.dev.js"></script>
- <!-- <script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/socket.io/1.3.6/socket.io.min.js"></script>-->
- <!-- <script src="https://cdn.socket.io/4.0.1/socket.io.min.js" integrity="sha384-LzhRnpGmQP+lOvWruF/lgkcqD+WDVt9fU3H4BWmwP5u5LTmkUGafMcpZKNObVMLU" crossorigin="anonymous"></script>-->
- <style>
- body {
- margin:0;
- }
- .navbar-dark .navbar-nav .nav-link {
- color: white;
- cursor: pointer;
- text-decoration:none;
- width: 130px;
- height: 46px;
- }
- .nav-top {
- line-height:40px;
- background-color: #C4C4C4;
- }
- .website_title{
- font-family: Roboto;
- font-style: normal;
- font-weight: normal;
- font-size: 30px;
- color: #000000;
- }
- .navbar-nav > li{
- float: none;
- display: inline-block;
- width: 110px;
- margin: 0 auto;
- text-align: center;
- }
- .navbar-nav > li a{
- font-size: 20px;
- }
- .main-page {
- margin-top: 150px;
- }
- .page-title {
- font-family: Roboto;
- font-style: normal;
- font-weight: bold;
- font-size: 36px;
- }
- .flex {
- display: flex;
- flex-direction: row;
- flex-wrap: wrap;
- justify-content: center;
- }
- .set-link {
- display: inline-block;
- width: 350px;
- height: 100px;
- line-height: 100px;
- background: #008CBA;
- border: 1px solid #CFCFCF;
- box-sizing: border-box;
- color: #FFFFFF;
- border-radius: 10px;
- font-size: 36px;
- }
- .fa{
- display: inline-block;
- font: normal normal normal 14px/1 FontAwesome;
- font-size: inherit;
- text-rendering: auto;
- -webkit-font-smoothing: antialiased;
- }
- .fa-user-o:before{
- content: "\f2c0";
- }
- button {
- cursor: pointer;
- }
- @media(max-width:373px){
- .card {
- margin-right: 0px;
- }
- }
- @media(max-width:577px){
- }
- @media(min-width:576px){
- }
- @media(min-width:768px){
- .navbar-nav > li {
- margin-left: 0px;
- }
- .navbar-nav .li-block {
- display:none;
- }
- }
- @media(min-width:991px){
- .navbar-nav > li {
- margin-left: 20px;
- }
- .navbar-nav .li-block {
- display:none;
- }
- }
- @media(min-width:1200px){
- .navbar-nav > li {
- margin-left: 35px;
- }
- .navbar-nav .li-block {
- display: inline-block;
- width: 100px;
- }
- }
- @media(min-width:1400px){
- .navbar-nav .li-block {
- display: inline-block;
- width: 200px;
- }
- }
- @media(min-width:1689px) {
- .navbar-nav > li {
- margin-left: 50px;
- }
- .navbar-nav .li-block {
- display: inline-block;
- width: 500px;
- }
- }
- </style>
- <script>
- <!-- //驗證token,如果不符合或過期就登出回登入頁-->
- <!-- var str = localStorage.getItem('Hello');-->
- <!-- $.ajax({-->
- <!-- type: "GET",-->
- <!-- url: "/auth",-->
- <!-- headers: {'Authorization': 'Bearer ' + str},-->
- <!-- success: function(result){-->
- <!-- console.log(result.identity);-->
- <!-- },-->
- <!-- error: function(result){-->
- <!-- window.location.href='/logout';-->
- <!-- }-->
- <!-- });-->
- $(function(){
- var namespace = '/test_conn';
- var url = 'http://127.0.0.1';
- var port = '5000';
- var socket = io.connect(url + ':' + port + namespace);
- socket.on('connect', function() {
- socket.emit('connect_event', {data: 'connected!'});
- });
- socket.on('user-confirm', function(msg) {
- console.log(msg);
- if(msg == 'pass'){
- var item = document.getElementById('python3.8-status');
- item.style.width = '2%';
- item.innerText = '2%';
- timer_python38 = window.setInterval("AddBarIndex('python3.8-status')", 2000);
- };
- });
- socket.on('stdout', function(msg) {
- if(msg.indexOf('python3.8') != -1){
- ItemInstallSuccess(timer_python38, 'python3.8');
- timer_python3_pip = window.setInterval("AddBarIndex('python3-pip-status')", 2000);
- };
- if(msg.indexOf('python3-pip') != -1){
- ItemInstallSuccess(timer_python3_pip, 'python3-pip');
- timer_git = window.setInterval("AddBarIndex('git-status')", 2000);
- };
- if(msg.indexOf('git') != -1){
- ItemInstallSuccess(timer_git, 'git');
- timer_wget = window.setInterval("AddBarIndex('wget-status')", 2000);
- };
- if(msg.indexOf('wget') != -1){
- ItemInstallSuccess(timer_wget, 'wget');
- timer_grep = window.setInterval("AddBarIndex('grep-status')", 2000);
- };
- if(msg.indexOf('grep') != -1){
- ItemInstallSuccess(timer_grep, 'grep');
- timer_tasksel = window.setInterval("AddBarIndex('tasksel-status')", 2000);
- };
- if(msg.indexOf('tasksel') != -1){
- ItemInstallSuccess(timer_tasksel, 'tasksel');
- timer_lamp_server = window.setInterval("AddBarIndex('lamp-server-status')", 2000);
- };
- if(msg.indexOf('lamp-server') != -1){
- ItemInstallSuccess(timer_lamp_server, 'lamp-server');
- timer_phpMyAdmin510_all_languages = window.setInterval("AddBarIndex('phpMyAdmin-5.1.0-all-languages.tar.gz-status')", 2000);
- };
- <!-- if(msg.indexOf('phpMyAdmin-5.1.0-all-languages.tar.gz') != -1){-->
- <!-- ItemInstallSuccess(timer_phpMyAdmin510_all_languages, 'phpMyAdmin-5.1.0-all-languages.tar.gz');-->
- <!-- timer_openssl = window.setInterval("AddBarIndex('openssl-status')", 2000);-->
- <!-- };-->
- if(msg.indexOf('install phpmyadmin done') != -1){
- ItemInstallSuccess(timer_phpMyAdmin510_all_languages, 'phpMyAdmin-5.1.0-all-languages.tar.gz');
- timer_openssl = window.setInterval("AddBarIndex('openssl-status')", 2000);
- };
- if(msg.indexOf('openssl') != -1){
- ItemInstallSuccess(timer_openssl, 'openssl');
- timer_php_common = window.setInterval("AddBarIndex('php-common-status')", 2000);
- };
- if(msg.indexOf('php-common') != -1){
- ItemInstallSuccess(timer_php_common, 'php-common');
- timer_php_curl = window.setInterval("AddBarIndex('php-curl-status')", 2000);
- };
- if(msg.indexOf('php-curl') != -1){
- ItemInstallSuccess(timer_php_curl, 'php-curl');
- timer_php_json = window.setInterval("AddBarIndex('php-json-status')", 2000);
- };
- if(msg.indexOf('php-json') != -1){
- ItemInstallSuccess(timer_php_json, 'php-json');
- timer_php_mbstring = window.setInterval("AddBarIndex('php-mbstring')", 2000);
- };
- if(msg.indexOf('php-mbstring') != -1){
- ItemInstallSuccess(timer_php_mbstring, 'php-mbstring');
- timer_php_mysql = window.setInterval("AddBarIndex('php-mysql')", 2000);
- };
- if(msg.indexOf('php-mysql') != -1){
- ItemInstallSuccess(timer_php_mysql, 'php-mysql');
- timer_php_xml = window.setInterval("AddBarIndex('php-xml-status')", 2000);
- };
- if(msg.indexOf('php-xml') != -1){
- ItemInstallSuccess(timer_php_xml, 'php-xml');
- timer_php_zip = window.setInterval("AddBarIndex('php-zip-status')", 2000);
- };
- if(msg.indexOf('php-zip') != -1){
- ItemInstallSuccess(timer_php_zip, 'php-zip');
- timer_php72_mbstring = window.setInterval("AddBarIndex('php7.2-mbstring-status')", 2000);
- };
- if(msg.indexOf('php7.2-mbstring') != -1){
- ItemInstallSuccess(timer_php72_mbstring, 'php7.2-mbstring');
- timer_php72_xml = window.setInterval("AddBarIndex('php7.2-xml-status')", 2000);
- };
- if(msg.indexOf('php7.2-xml') != -1){
- ItemInstallSuccess(timer_php72_xml, 'php7.2-xml');
- timer_php72_mysql = window.setInterval("AddBarIndex('php7.2-mysql-status')", 2000);
- };
- if(msg.indexOf('php7.2-mysql') != -1){
- ItemInstallSuccess(timer_php72_mysql, 'php7.2-mysql');
- timer_php72_common = window.setInterval("AddBarIndex('php7.2-common-status')", 2000);
- };
- if(msg.indexOf('php7.2-common') != -1){
- ItemInstallSuccess(timer_php72_common, 'php7.2-common');
- timer_php72_curl = window.setInterval("AddBarIndex('php7.2-curl-status')", 2000);
- };
- if(msg.indexOf('php7.2-curl') != -1){
- ItemInstallSuccess(timer_php72_curl, 'php7.2-curl');
- timer_php72_json = window.setInterval("AddBarIndex('php7.2-json-status')", 2000);
- };
- if(msg.indexOf('php7.2-json') != -1){
- ItemInstallSuccess(timer_php72_json, 'php7.2-json');
- timer_php72_zip = window.setInterval("AddBarIndex('php7.2-zip-status')", 2000);
- };
- if(msg.indexOf('php7.2-zip') != -1){
- ItemInstallSuccess(timer_php72_zip, 'php7.2-zip');
- timer_service_apache2 = window.setInterval("AddBarIndex('service-apache2-start-status')", 2000);
- };
- if(msg.indexOf('service apache2 start') != -1){
- ItemInstallSuccess(timer_service_apache2, 'service-apache2-start');
- timer_setting_mysql = window.setInterval("AddBarIndex('setting-mysql-status')", 2000);
- };
- console.log(msg);
- console.log('test1');
- });
- socket.on('stderr', function(msg) {
- if(msg.indexOf('python3.8') != -1){
- ItemInstallFail(timer_python38, 'python3.8');
- timer_python3_pip = window.setInterval("AddBarIndex('python3-pip-status')", 2000);
- };
- if(msg.indexOf('python3-pip') != -1){
- ItemInstallFail(timer_python3_pip, 'python3-pip');
- timer_git = window.setInterval("AddBarIndex('git-status')", 2000);
- };
- if(msg.indexOf('git') != -1){
- ItemInstallFail(timer_git, 'git');
- timer_wget = window.setInterval("AddBarIndex('wget-status')", 2000);
- };
- if(msg.indexOf('wget') != -1){
- ItemInstallFail(timer_wget, 'wget');
- timer_grep = window.setInterval("AddBarIndex('grep-status')", 2000);
- };
- if(msg.indexOf('grep') != -1){
- ItemInstallFail(timer_grep, 'grep');
- timer_tasksel = window.setInterval("AddBarIndex('tasksel-status')", 2000);
- };
- if(msg.indexOf('tasksel') != -1){
- ItemInstallFail(timer_tasksel, 'tasksel');
- timer_lamp_server = window.setInterval("AddBarIndex('lamp-server-status')", 2000);
- };
- if(msg.indexOf('lamp-server') != -1){
- ItemInstallFail(timer_lamp_server, 'lamp-server');
- timer_phpMyAdmin = window.setInterval("AddBarIndex('phpMyAdmin-5.1.0-all-languages.tar.gz-status')", 2000);
- };
- <!-- if(msg.indexOf('phpMyAdmin-5.1.0-all-languages.tar.gz') != -1){-->
- <!-- ItemInstallFail(timer_phpMyAdmin, 'phpMyAdmin-5.1.0-all-languages.tar.gz');-->
- <!-- timer_openssl = window.setInterval("AddBarIndex('openssl-status')", 2000);-->
- <!-- };-->
- if(msg.indexOf('openssl') != -1){
- ItemInstallFail(timer_openssl, 'openssl');
- timer_php_common = window.setInterval("AddBarIndex('php-common-status')", 2000);
- };
- if(msg.indexOf('php-common') != -1){
- ItemInstallFail(timer_php_common, 'php-common');
- timer_php_curl = window.setInterval("AddBarIndex('php-curl-status')", 2000);
- };
- if(msg.indexOf('php-curl') != -1){
- ItemInstallFail(timer_php_curl, 'php-curl');
- timer_php_json = window.setInterval("AddBarIndex('php-json-status')", 2000);
- };
- if(msg.indexOf('php-json') != -1){
- ItemInstallFail(timer_php_json, 'php-json');
- timer_php_mbstring = window.setInterval("AddBarIndex('php-mbstring')", 2000);
- };
- if(msg.indexOf('php-mbstring') != -1){
- ItemInstallFail(timer_php_mbstring, 'php-mbstring');
- timer_php_mysql = window.setInterval("AddBarIndex('php-mysql')", 2000);
- };
- if(msg.indexOf('php-mysql') != -1){
- ItemInstallFail(timer_php_mysql, 'php-mysql');
- timer_php_xml = window.setInterval("AddBarIndex('php-xml-status')", 2000);
- };
- if(msg.indexOf('php-xml') != -1){
- ItemInstallFail(timer_php_xml, 'php-xml');
- timer_php_zip = window.setInterval("AddBarIndex('php-zip-status')", 2000);
- };
- if(msg.indexOf('php-zip') != -1){
- ItemInstallFail(timer_php_zip, 'php-zip');
- timer_php72_mbstring = window.setInterval("AddBarIndex('php7.2-mbstring-status')", 2000);
- };
- if(msg.indexOf('php7.2-mbstring') != -1){
- ItemInstallFail(timer_php72_mbstring, 'php7.2-mbstring');
- timer_php72_xml = window.setInterval("AddBarIndex('php7.2-xml-status')", 2000);
- };
- if(msg.indexOf('php7.2-xml') != -1){
- ItemInstallFail(timer_php72_xml, 'php7.2-xml');
- timer_php72_mysql = window.setInterval("AddBarIndex('php7.2-mysql-status')", 2000);
- };
- if(msg.indexOf('php7.2-mysql') != -1){
- ItemInstallFail(timer_php72_mysql, 'php7.2-mysql');
- timer_php72_common = window.setInterval("AddBarIndex('php7.2-common-status')", 2000);
- };
- if(msg.indexOf('php7.2-common') != -1){
- ItemInstallFail(timer_php72_common, 'php7.2-common');
- timer_php72_curl = window.setInterval("AddBarIndex('php7.2-curl-status')", 2000);
- };
- if(msg.indexOf('php7.2-curl') != -1){
- ItemInstallFail(timer_php72_curl, 'php7.2-curl');
- timer_php72_json = window.setInterval("AddBarIndex('php7.2-json-status')", 2000);
- };
- if(msg.indexOf('php7.2-json') != -1){
- ItemInstallFail(timer_php72_json, 'php7.2-json');
- timer_php72_zip = window.setInterval("AddBarIndex('php7.2-zip-status')", 2000);
- };
- if(msg.indexOf('php7.2-zip') != -1){
- ItemInstallFail(timer_php72_zip, 'php7.2-zip');
- timer_service_apache2 = window.setInterval("AddBarIndex('service-apache2-start-status')", 2000);
- };
- if(msg.indexOf('service apache2 start') != -1){
- ItemInstallFail(timer_service_apache2, 'service-apache2-start');
- timer_setting_mysql = window.setInterval("AddBarIndex('setting-mysql-status')", 2000);
- };
- console.log(msg);
- console.log('test2');
- });
- });
- </script>
- </head>
- <body>
- <nav class="fixed-top">
- <nav class="navbar navbar-expand-md nav-top justify-content-center">
- <div>
- <span class="website_title">伺服器建置</span>
- </div>
- </nav>
- <nav class="navbar navbar-expand-md bg-dark navbar-dark nav-bottom">
- <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#collapsibleNavbar">
- <span class="navbar-toggler-icon"></span>
- </button>
- <div class="collapse navbar-collapse" id="collapsibleNavbar">
- <ul class="navbar-nav">
- <li class="nav-item">
- <a class="nav-link" href="/">首頁</a>
- </li>
- <li class="nav-item">
- <a class="nav-link" href="/incoming_check">進貨檢測</a>
- </li>
- <li class="nav-item">
- <a class="nav-link" href="/burn_program">感測器燒錄</a>
- </li>
- <li class="nav-item">
- <a class="nav-link" href="/modify_permissions">權限設置</a>
- </li>
- <li class="nav-item">
- <a class="nav-link" href="/add_sensor">新增感測器</a>
- </li>
- <li class="nav-item">
- <a class="nav-link" href="/add_server">伺服器建置</a>
- </li>
- <li class="li-block"></li>
- <li class="nav-item">
- <a class="nav-link" href="#"><i class="fa fa-user-o"></i> {{params.username}}</a>
- </li>
- <li class="nav-item">
- <a class="nav-link" href="/logout">Logout</a>
- </li>
- </ul>
- </div>
- </nav>
- </nav>
- <div class="main-page">
- <div class="container">
- <div class="row">
- <div class="col" style="margin: auto; ">
- <table class="table table-bordered" style="font-size:23px;margin-top:30px;">
- <tbody>
- <tr>
- <td>1.請輸入您的IP位置:</td>
- <td><input type="text" name="user_ip"></td>
- </tr>
- <tr>
- <td>2.請輸入您的username:</td>
- <td><input type="text" name="user_username"></td>
- </tr>
- <tr>
- <td>3.請輸入您的password:</td>
- <td><input type="password" name="user_password"></td>
- </tr>
- </tbody>
- </table>
- <div class="text-center">
- <input type="button" value="建置" name="add_server" style="cursor:pointer;" onclick="AddServer()">
- </div>
- <div class="text-center" id="addServer-status" style="margin-top:30px;color:red;visibility:hidden;">
- <h2>伺服器建置中...</h2>
- </div>
- <div>
- <h1>Item install status</h1>
- <table class="table table-bordered" style="font-size:23px;margin-top:30px;">
- <tbody>
- <tr>
- <th>Item</th>
- <th>Status</th>
- </tr>
- {% for item in params.L %}
- <tr>
- <td>{{loop.index}}.{{item}}</td>
- <td>
- <div class="progress" style="height:35px;">
- <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>
- </div>
- </td>
- </tr>
- {% endfor %}
- <!-- <tr>-->
- <!-- <td>1.pymysql</td>-->
- <!--<!– <td><span name="pymysql-status"></span></td>–>-->
- <!-- <td>-->
- <!-- <div class="progress" style="height:35px;">-->
- <!-- <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>-->
- <!-- </div>-->
- <!-- </td>-->
- <!-- </tr>-->
- <!-- <tr>-->
- <!-- <td>2.eventlet</td>-->
- <!--<!– <td><span name="eventlet-status"></span></td>–>-->
- <!-- <td>-->
- <!-- <div class="progress" style="height:35px;">-->
- <!-- <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>-->
- <!-- </div>-->
- <!-- </td>-->
- <!-- </tr>-->
- <!-- <tr>-->
- <!-- <td>3.flask</td>-->
- <!--<!– <td><span name="eventlet-status"></span></td>–>-->
- <!-- <td>-->
- <!-- <div class="progress" style="height:35px;">-->
- <!-- <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>-->
- <!-- </div>-->
- <!-- </td>-->
- <!-- </tr>-->
- </tbody>
- </table>
- </div>
- </div>
- </div>
- </div>
- </div>
- </body>
- <script>
- var timer_python38 = 0;
- var timer_python3_pip = 0;
- var timer_git = 0;
- var timer_wget = 0;
- var timer_grep = 0;
- var timer_tasksel = 0;
- var timer_lamp_server = 0;
- var timer_phpMyAdmin = 0;
- var timer_openssl = 0;
- var timer_php_common = 0;
- var timer_php_curl = 0;
- var timer_php_json = 0;
- var timer_php_mbstring = 0;
- var timer_php_mysql = 0;
- var timer_php_xml = 0;
- var timer_php_zip = 0;
- var timer_php72_mbstring = 0;
- var timer_php72_xml = 0;
- var timer_php72_mysql = 0;
- var timer_php72_common = 0;
- var timer_php72_curl = 0;
- var timer_php72_json = 0;
- var timer_php72_zip = 0;
- var timer_service_apache2 = 0;
- var timer_setting_mysql = 0;
- var timer_paho_mqtt = 0;
- var timer_mosquitto = 0;
- var timer_mqtt_server = 0;
- var timer_watchdog = 0;
- var timer_golang = 0;
- var timer_Git_server = 0;
- var timer_flask = 0;
- var timer_Flask_SQLAlchemy = 0;
- var timer_pymysql = 0;
- var timer_flask_mqtt = 0;
- var timer_flask_migrate = 0;
- var timer_flask_jwt_extended = 0;
- var timer_numpy = 0;
- var timer_pandas = 0;
- var timer_opencv_python = 0;
- var timer_BeautifulSoup4 = 0;
- var timer_selenium = 0;
- var timer_geocoder = 0;
- var timer_AP = 0;
- var timer_chrony_ntpdate = 0;
- var timer_deb_ros_packages_and_keyserver = 0;
- var timer_update = 0;
- var timer_upgrade = 0;
- var timer_ros_melodic_desktop_full = 0;
- var timer_ros_melodic_rqt = 0;
- var timer_pythonrosdep = 0;
- var timer_python_rosinstall = 0;
- var timer_ROS = 0;
- function AddBarIndex(obj){
- var item = document.getElementById(obj);
- //因假設元素id內有.或是空格的使用jQuery選擇器會找不到,所以改成用js的節點來設置
- //[0].style.width 讓width顯示為%值,使用css.('width')會顯示px
- //var width = obj[0].style.width;
- var width = item.style.width;
- var current_width = width.substring(0, width.length-1);
- item.style.width = Number(current_width) + 2 + '%';
- item.innerText = Number(current_width) + 2 + '%';
- };
- function AddServer(){
- //var item = document.getElementById('python3.8-status');
- //item.style.width = '2%';
- //item.innerText = '2%';
- //timer_python38 = window.setInterval("AddBarIndex('python3.8-status')", 2000);
- $("#addServer-status").css('visibility','visible');
- var ip = $("input[name=user_ip]").val();
- var username = $("input[name=user_username]").val();
- var password = $("input[name=user_password]").val();
- var json = {"ip":ip, "username":username, "password":password};
- $.post('/add_server', json, function(resText){
- $("#addServer-status").css('visibility','hidden');
- if(resText == 'Authentication failed.'){
- resText = '您輸入的密碼有誤,請重新輸入!';
- $("input[name=user_ip]").val('');
- $("input[name=user_username]").val('');
- $("input[name=user_password]").val('');
- };
- alert(resText);
- }, 'text');
- };
- function ItemInstallSuccess(timer_item, item_name){
- eval('clearInterval(' + timer_item + ')');
- var item = document.getElementById(item_name + '-status');
- item.style.width = '100%';
- item.innerText = '100%';
- };
- function ItemInstallFail(timer_item, item_name){
- eval('clearInterval(' + timer_item + ')');
- var item = document.getElementById(item_name + '-status');
- item.style.width = '0%';
- item.innerText = 'Fail';
- item.style.color = 'red';
- };
- </script>
- </html>
|