forked from dell/iDRAC-Telemetry-Reference-Tools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
140 lines (126 loc) · 7.34 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous"/>
<script src="http://code.jquery.com/jquery-3.4.1.min.js" integrity="sha384-vk5WoKIaW/vJyUAd9n/wmopsmNhiy+L2Z+SBxGYnUkunIxVxAv/UtMOhba/xskxh" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
</head>
<body>
<nav class="navbar navbar-dark sticky-top bg-dark flex-md-nowrap p-0">
<a class="navbar-brand col-sm-3 col-md-2 mr-0" href="#">Redfish Telemetry Service Configuration </a>
</nav>
<div class="container-fluid">
<div class="row">
<nav class="col-md-2 d-none d-md-block bg-light sidebar">
<div class="sidebar-sticky">
<ul class="nav flex-column">
<li class="nav-item">
<a class="nav-link" href="#Servers">
<i data-feather="server"></i> Source Services
</a>
</li>
</ul>
</div>
</nav>
<main role="main" class="col-md-9 ml-sm-auto col-lg-10 pt-3 px-4"><div class="chartjs-size-monitor" style="position: absolute; left: 0px; top: 0px; right: 0px; bottom: 0px; overflow: hidden; pointer-events: none; visibility: hidden; z-index: -1;"><div class="chartjs-size-monitor-expand" style="position:absolute;left:0;top:0;right:0;bottom:0;overflow:hidden;pointer-events:none;visibility:hidden;z-index:-1;"><div style="position:absolute;width:1000000px;height:1000000px;left:0;top:0"></div></div><div class="chartjs-size-monitor-shrink" style="position:absolute;left:0;top:0;right:0;bottom:0;overflow:hidden;pointer-events:none;visibility:hidden;z-index:-1;"><div style="position:absolute;width:200%;height:200%;left:0; top:0"></div></div></div>
<div class="d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center pb-2 mb-3 border-bottom">
<h1 class="h2">Dashboard</h1>
</div>
<h2><a id="Servers"></a>Redfish Telemetry Source Services</h2>
<div class="table-responsive">
<table class="table table-striped table-sm">
<thead>
<tr>
<th>IP/Hostname</th>
<th>Username</th>
<th>State</th>
<th>Last Event</th>
</tr>
</thead>
<tbody id="services">
</tbody>
</table>
</div>
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#serviceModal">Add New Service</button>
</main>
</div>
</div>
<div class="modal fade" id="serviceModal" tabindex="-1" role="dialog" aria-labelledby="serviceModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">Add New Service</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<form id="newService">
<input class="form-control" id="hostname" name="hostname" type="text" placeholder="Service IP/Hostname"/>
<input class="form-control" id="username" name="username" type="text" placeholder="Username"/>
<input class="form-control" id="password" name="password" type="password" placeholder="Password"/>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary" onclick="addService()">Add Service</button>
</div>
</div>
</div>
</div>
<!-- Bootstrap core JavaScript
================================================== -->
<!-- Icons -->
<script src="https://unpkg.com/feather-icons/dist/feather.min.js"></script>
<script>
feather.replace()
</script>
<script>
$.getJSON("/api/v1/Systems", gotServiceList);
$(function () {
$('[data-toggle="tooltip"]').tooltip()
})
function gotServiceList(data) {
var tbody = $('#services');
for(var i = 0; i < data.length; i++) {
classStr = "text-warning"
switch(data[i].State) {
case 'Running':
classStr = "text-success";
break;
case 'Stopped':
classStr = "text-danger";
break;
}
tbody.append('<tr><td>'+data[i].Hostname+'</td><td>'+data[i].Username+'</td><td class="'+classStr+'">'+data[i].State+'</td><td>'+new Date(data[i].LastEvent)+'</td></tr>')
}
}
function addService() {
var arr = $('#newService').serializeArray();
var obj = {};
for(var i = 0; i < arr.length; i++) {
obj[arr[i].name] = arr[i].value;
}
$.ajax({
url: '/api/v1/Systems',
method: 'POST',
data: JSON.stringify(obj),
contentType: 'application/json',
dataType: 'json',
complete: addDone
})
}
function addDone(jqXHR) {
if(jqXHR.status != 200) {
alert("Failed to add new service!");
console.error(jqXHR)
}
else {
location.reload();
}
}
</script>
</body>
</html>