Skip to content

Commit

Permalink
Merge pull request #2 from zvercodebender/SSH_on_Windows
Browse files Browse the repository at this point in the history
Update web site
  • Loading branch information
Rick Broker committed Jun 1, 2015
2 parents a4920c8 + cad9664 commit e68f3e7
Show file tree
Hide file tree
Showing 4 changed files with 135 additions and 0 deletions.
Empty file added xld-tasklist/README.md
Empty file.
50 changes: 50 additions & 0 deletions xld-tasklist/src/html/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.css">
<script src="http://code.jquery.com/jquery-1.11.2.min.js"></script>
<script src="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js"></script>
<script src="js/authentication.js"></script>
<script src="js/xld-tasks.js"></script>
</head>
<body>

<!-- =============================================== -->
<div data-role="page" id="login">
<div data-role="header">
<h1>Welcome To XL Deploy Task Monitor</h1>
</div>
<div data-role="main" class="ui-content">
<p>login form</p>
<form method="post" id="loginForm">
<label for="myUsername">Username:</label>
<input name="myUsername" id="myUsername" value="" type="text">
<label for="myPassword">Password:</label>
<input name="myPassword" id="myPassword" value="" type="password">
</form>
<button class="ui-btn ui-corner-all" onClick="authenticate();">Login</button>
<a href="#home" class="ui-btn ui-corner-all">Task List</a>
</div>
</div>
<!-- =============================================== -->
<div data-role="page" id="home">
<div data-role="header">
<h1>Welcome To XL Deploy Task Monitor</h1>
</div>

<div data-role="main" class="ui-content">
<div id="taskList" data-role="collapsibleset" "data-content-theme="a" data-iconpos='right'>
</div>
<button onClick='getAllTasks();' class="ui-btn">Load Details</button>
</div>

</div>
<!-- =============================================== -->
<script>
$(document).ready(function(){
});
</script>
</body>
</html>

3 changes: 3 additions & 0 deletions xld-tasklist/src/html/js/authentication.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
var username="admin";
var password="katy4792";

82 changes: 82 additions & 0 deletions xld-tasklist/src/html/js/xld-tasks.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
//$.getScript("js/authentication.js");

var myUsername="";
var myPassword="";

function getFormData(dom_query) {
var out = {};
var s_data = $(dom_query).serializeArray();
//transform into simple data/value object
for(var i = 0; i<s_data.length; i++) {
var record = s_data[i];
out[record.name] = record.value;
}
return out;
}

function authenticate() {
obj = getFormData('#loginForm');
myUsername = obj.myUsername;
myPassword = obj.myPassword;
console.log( "Username: " + myUsername );
console.log( "Password: " + myPassword );
isOK = validateUser( myUsername, myPassword );
if( isOK == 1 ) {
$.mobile.changePage($("#home"),"slide");
getAllTasks();
}
console.log( "isOK: " + isOK );
}

function validateUser( u, p ) {
URL="/deployit/security/user/" + u;
results = 0;
$.ajax({
type: "GET",
url: URL,
username: u,
password: p,
dataType: "xml",
async: false,
success: function ( data, status, jqXHR ) {
results = 1;
}
});
return results;
}

function getAllTasks() {
if( validateUser(myUsername, myPassword) == 1 ) {
URL="/deployit/tasts/v2/current/all";
$.ajax({
type: "GET",
url: "/deployit/tasks/v2/current/all",
username: username,
password: password,
dataType: "json",
async: false,
success: function ( data, status, jqXHR ) {
html="";
for( i = 0; i < data.length; i++ ) {
if( data[i].state != "XX EXECUTED" && data[i].state != "XX FAILED" ) {
html=html + "<div data-role=\"collapsible\" data-theme=\"a\">";
html=html + "<h4>" + data[i].state + " - ";
html=html + data[i].description + "</h4>";
var steps = data[i].block.steps;
for( j=0; j < steps.length; j++ ) {
html=html + "<div data-role=\"collapsible\" data-theme=\"b\"><h2>" + steps[j].state;
html=html + " - " + steps[j].description + "</h2>";
html=html + "<code>" + steps[j].log + "</code>";
html=html + "</div>";
}
html=html + "</div>";
}
}
$("#taskList").html( html ).collapsibleset("refresh");
}
});
} else {
$.mobile.changePage($("#login"),"slide");
}
}

0 comments on commit e68f3e7

Please sign in to comment.