| <!DOCTYPE html> |
| <html lang="en"> |
| <head> |
| <meta charset="UTF-8"> |
| <title>openBMC</title> |
| <link rel="icon" href="favicon.ico?v=2"/> |
| <link rel="stylesheet" href="css/main.css"> |
| <script src="js/vendor/vendor.min.js"></script> |
| <script> |
| var user = 'root'; |
| var password = '0penBmc'; |
| var ip = 'https://9.3.164.147'; |
| |
| function getList(){ |
| |
| $.ajax({ |
| type: "GET", |
| url: ip + "/xyz/openbmc_project/list", |
| dataType: "json", |
| async: true, |
| xhrFields: { |
| withCredentials: true |
| }, |
| headers: { |
| 'Accept': 'application/json', |
| 'Content-Type': 'application/json' |
| }, |
| success: function(response){ |
| var json = JSON.stringify(response); |
| var content = JSON.parse(json); |
| //console.log(content.data); |
| |
| for (var i = 0; i < content.data.length; i++) { |
| var item = content.data[i]; |
| console.log(item); |
| $('.container').append('<p>' + item + '</p>'); |
| } |
| }, |
| error: function(xhr, textStatus, errorThrown){ |
| console.log("not a successful request!"); |
| console.log(xhr, textStatus, errorThrown) |
| } |
| }); |
| } |
| |
| function getPowerStatus(){ |
| |
| $.ajax({ |
| type: "GET", |
| url: ip + "/xyz/openbmc_project/state/host0", |
| dataType: "json", |
| async: true, |
| xhrFields: { |
| withCredentials: true |
| }, |
| headers: { |
| 'Accept': 'application/json', |
| 'Content-Type': 'application/json' |
| }, |
| success: function(response){ |
| var json = JSON.stringify(response); |
| var content = JSON.parse(json); |
| //console.log(content.data); |
| var currentHostState = content.data.CurrentHostState; |
| if(currentHostState == "xyz.openbmc_project.State.Host.HostState.Off"){ |
| $('#power-indicator-bar').removeClass('power__state-off power__state-on').addClass('power__state-off'); |
| }else{ |
| $('#power-indicator-bar').removeClass('power__state-off power__state-on').addClass('power__state-on'); |
| } |
| }, |
| error: function(xhr, textStatus, errorThrown){ |
| console.log("not a successful request!"); |
| console.log(xhr, textStatus, errorThrown) |
| } |
| }); |
| } |
| var login = { |
| "type": "POST", |
| "url": ip + "/login", |
| "dataType": "json", |
| "async": true, |
| "headers": { |
| 'Accept': 'application/json', |
| 'Content-Type': 'application/json' |
| }, |
| "xhrFields": { |
| withCredentials: true |
| }, |
| "data": JSON.stringify({"data": [user, password]}), |
| "success": function(response){ |
| console.log(response); |
| //getList(); |
| getPowerStatus(); |
| }, |
| "error": function(xhr, textStatus, errorThrown){ |
| console.log("not a successful request!"); |
| console.log(xhr, textStatus, errorThrown) |
| } |
| }; |
| </script> |
| </head> |
| <body> |
| |
| <!-- Header & Navigation includes --> |
| <div id="header__wrapper"></div> |
| <div id="navigation"></div> |
| <main class="content__container" role="main"> |
| <div class="row"> |
| <div class="column"> |
| |
| <!-- Main content --> |
| <script>$.ajax(login)</script> |
| <div id="data"></div> |
| |
| <p>Donec sollicitudin molestie malesuada. Pellentesque in ipsum id orci porta dapibus. Curabitur non nulla sit amet nisl tempus convallis quis ac lectus. Vivamus suscipit tortor eget felis porttitor volutpat. Cras ultricies ligula sed magna dictum porta. Sed porttitor lectus nibh. Praesent sapien massa, convallis a pellentesque nec, egestas non nisi. Vivamus suscipit tortor eget felis porttitor volutpat. Vivamus suscipit tortor eget felis porttitor volutpat. Nulla porttitor accumsan tincidunt.</p> |
| </div> |
| </div> |
| </main> |
| |
| </body> |
| <script src="js/app.min.js"></script> |
| </html> |