Michael Davis | cb8bb19 | 2017-02-09 15:45:13 -0600 | [diff] [blame] | 1 | <!DOCTYPE html> |
| 2 | <html lang="en"> |
| 3 | <head> |
| 4 | <meta charset="UTF-8"> |
| 5 | <title>openBMC</title> |
| 6 | <link rel="icon" href="favicon.ico?v=2"/> |
| 7 | <link rel="stylesheet" href="css/main.css"> |
| 8 | <script src="js/vendor/vendor.min.js"></script> |
Michael Davis | 57738ea | 2017-03-06 23:21:19 -0600 | [diff] [blame^] | 9 | <script> |
| 10 | |
| 11 | // var user = 'root'; |
| 12 | // var password = '0penBmc'; |
| 13 | // var ip = 'https://9.3.164.147'; |
| 14 | |
| 15 | function getList(){ |
| 16 | |
| 17 | $.ajax({ |
| 18 | type: "GET", |
| 19 | url: ip + "/xyz/openbmc_project/list", |
| 20 | dataType: "json", |
| 21 | async: true, |
| 22 | xhrFields: { |
| 23 | withCredentials: true |
| 24 | }, |
| 25 | headers: { |
| 26 | 'Accept': 'application/json', |
| 27 | 'Content-Type': 'application/json' |
| 28 | }, |
| 29 | success: function(response){ |
| 30 | var json = JSON.stringify(response); |
| 31 | var content = JSON.parse(json); |
| 32 | //console.log(content.data); |
| 33 | |
| 34 | for (var i = 0; i < content.data.length; i++) { |
| 35 | var item = content.data[i]; |
| 36 | console.log(item); |
| 37 | $('.container').append('<p>' + item + '</p>'); |
| 38 | } |
| 39 | }, |
| 40 | error: function(xhr, textStatus, errorThrown){ |
| 41 | console.log("not a successful request!"); |
| 42 | console.log(xhr, textStatus, errorThrown) |
| 43 | } |
| 44 | }); |
| 45 | } |
| 46 | |
| 47 | function getPowerStatus(){ |
| 48 | |
| 49 | $.ajax({ |
| 50 | type: "GET", |
| 51 | url: ip + "/xyz/openbmc_project/state/host0", |
| 52 | dataType: "json", |
| 53 | async: true, |
| 54 | xhrFields: { |
| 55 | withCredentials: true |
| 56 | }, |
| 57 | headers: { |
| 58 | 'Accept': 'application/json', |
| 59 | 'Content-Type': 'application/json' |
| 60 | }, |
| 61 | success: function(response){ |
| 62 | var json = JSON.stringify(response); |
| 63 | var content = JSON.parse(json); |
| 64 | //console.log(content.data); |
| 65 | var currentHostState = content.data.CurrentHostState; |
| 66 | if(currentHostState == "xyz.openbmc_project.State.Host.HostState.Off"){ |
| 67 | $('#power-indicator-bar').removeClass('power__state-off power__state-on').addClass('power__state-off'); |
| 68 | }else{ |
| 69 | $('#power-indicator-bar').removeClass('power__state-off power__state-on').addClass('power__state-on'); |
| 70 | } |
| 71 | }, |
| 72 | error: function(xhr, textStatus, errorThrown){ |
| 73 | console.log("not a successful request!"); |
| 74 | console.log(xhr, textStatus, errorThrown) |
| 75 | } |
| 76 | }); |
| 77 | } |
| 78 | |
| 79 | function login() { |
| 80 | console.log('login!'); |
| 81 | |
| 82 | var user = 'root'; |
| 83 | var password = '0penBmc'; |
| 84 | var ip = 'https://9.3.164.147'; |
| 85 | |
| 86 | $.ajax({ |
| 87 | "type": "POST", |
| 88 | "url": ip + "/login", |
| 89 | "dataType": "json", |
| 90 | "async": true, |
| 91 | "headers": { |
| 92 | 'Accept': 'application/json', |
| 93 | 'Content-Type': 'application/json' |
| 94 | }, |
| 95 | "xhrFields": { |
| 96 | withCredentials: true |
| 97 | }, |
| 98 | "data": JSON.stringify({"data": [user, password]}), |
| 99 | "success": function (response) { |
| 100 | console.log(response); |
| 101 | //getList(); |
| 102 | //getPowerStatus(); |
| 103 | alert(JSON.stringify(response)); |
| 104 | window.location.replace("system-overview.html"); |
| 105 | |
| 106 | }, |
| 107 | "error": function (xhr, textStatus, errorThrown) { |
| 108 | console.log("not a successful request!"); |
| 109 | console.log(xhr, textStatus, errorThrown) |
| 110 | } |
| 111 | }); |
| 112 | } |
| 113 | </script> |
Michael Davis | cb8bb19 | 2017-02-09 15:45:13 -0600 | [diff] [blame] | 114 | </head> |
Michael Davis | e15a956 | 2017-03-03 14:30:24 -0600 | [diff] [blame] | 115 | <body id="login"> |
Michael Davis | cb8bb19 | 2017-02-09 15:45:13 -0600 | [diff] [blame] | 116 | <div class="login__wrapper"> |
| 117 | <div class="row"> |
| 118 | <div class="columns large-6"> |
Michael Davis | d7bf098 | 2017-02-21 10:07:20 -0600 | [diff] [blame] | 119 | <img src="img/logo.svg" class="login__logo" alt="IBM logo" role="img"/> |
Michael Davis | cb8bb19 | 2017-02-09 15:45:13 -0600 | [diff] [blame] | 120 | </div> |
| 121 | <div class="columns large-6"> |
| 122 | </div> |
| 123 | </div> |
| 124 | <div class="row"> |
| 125 | <div class="columns large-6 login__desc"> |
Michael Davis | e15a956 | 2017-03-03 14:30:24 -0600 | [diff] [blame] | 126 | <h1>OpenBMC Advanced System Management</h1> |
| 127 | <ul class="login__server-info"> |
| 128 | <li><p class="login__info-label">Build version</p><p>1.00.102</p></li> |
| 129 | <li><p class="login__info-label">Server ID</p><p>29000000166668</p></li> |
| 130 | <li><p class="login__info-label">Server model</p><p>Power SL-22LC</p></li> |
| 131 | <!-- ping server to see if powered on. Change status-light and txt accordingly. Status message is planned to be hardcoded message were display via local JS. --> |
Michael Davis | 57738ea | 2017-03-06 23:21:19 -0600 | [diff] [blame^] | 132 | <li><p class="login__info-label">Server power</p><p class="status-light__good">On</p></li> |
| 133 | <li><p class="login__info-label">Status message</p><!--<p>BMC was reset by user</p>--></li> |
Michael Davis | e15a956 | 2017-03-03 14:30:24 -0600 | [diff] [blame] | 134 | </ul> |
Michael Davis | cb8bb19 | 2017-02-09 15:45:13 -0600 | [diff] [blame] | 135 | </div> |
| 136 | <div class="columns large-6"> |
Michael Davis | 57738ea | 2017-03-06 23:21:19 -0600 | [diff] [blame^] | 137 | <form id="login__form" role="form" action="" > |
Michael Davis | cb8bb19 | 2017-02-09 15:45:13 -0600 | [diff] [blame] | 138 | <label for="username">Username</label> |
| 139 | <input type="text" id="username" name="username" required> |
| 140 | |
| 141 | <label for="password">Password</label> |
Michael Davis | 57738ea | 2017-03-06 23:21:19 -0600 | [diff] [blame^] | 142 | <input type="password" id="password" name="password" class="" required> |
Michael Davis | cb8bb19 | 2017-02-09 15:45:13 -0600 | [diff] [blame] | 143 | |
Michael Davis | 57738ea | 2017-03-06 23:21:19 -0600 | [diff] [blame^] | 144 | <input id="login__submit" class="btn-primary" type="submit" value="Log in" role="button" onclick="login();"> |
Michael Davis | cb8bb19 | 2017-02-09 15:45:13 -0600 | [diff] [blame] | 145 | |
Michael Davis | e15a956 | 2017-03-03 14:30:24 -0600 | [diff] [blame] | 146 | <p class="login__error-msg" role="alert">Incorrect username or password</p> |
Michael Davis | d7bf098 | 2017-02-21 10:07:20 -0600 | [diff] [blame] | 147 | </form> |
Michael Davis | cb8bb19 | 2017-02-09 15:45:13 -0600 | [diff] [blame] | 148 | </div> |
| 149 | </div> |
| 150 | </div> |
| 151 | <script src="js/app.min.js"></script> |
| 152 | </body> |
| 153 | </html> |