Skip to content

Instantly share code, notes, and snippets.

@fernandofuly
Last active March 27, 2019 00:49
Show Gist options
  • Save fernandofuly/09e69d84cd5b0acd8ab02734159f22ad to your computer and use it in GitHub Desktop.
Save fernandofuly/09e69d84cd5b0acd8ab02734159f22ad to your computer and use it in GitHub Desktop.
ASDF
<!doctype html>
<html lang="en" ng-app="ecoPerformance">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.7.7/angular.min.js"></script>
<script>
angular.module("ecoPerformance", []);
angular.module("ecoPerformance").controller("readCSVController", function($http){
var vm = this;
var srcGroups = '/assets/csv/grupos.csv';
vm.groups = {};
function csvToJson(csv) {
var lines = csv.split(/\r?\n/);
var result = [];
var headers = lines[0].split(";");
for (var i = 1; i < lines.length; i++) {
var obj = {};
var currentline = lines[i].split(";");
for (var j = 0; j < headers.length; j++) {
obj[headers[j]] = currentline[j];
}
result.push(obj);
}
return result; //JSON
};
$http.get(srcGroups)
.then(
function(response) {
vm.groups = csvToJson(response.data);
},
function(error) {
console.log(error);
}
);
});
</script>
<title>ECO²-Performance</title>
</head>
<body>
<section>
<div class="container">
<div class="jumbotron mt-2">
<!-- As tags H(vai de 1 a 6) são cabeçalhos -->
<h1 class="display-4">Control Loop ECO²-Performance</h1>
<p class="lead">Portable Data Analytic Solution to Monitor Performance in PID Control Loops</p>
<hr class="my-4">
<!-- <p>Chamada Raspberry</p> -->
<a class="btn btn-primary btn-lg" href="/test" role="button">Executar</a>
</div>
</div>
</section>
<section ng-controller="readCSVController as Docs">
<div class="container">
<table class="table">
<thead>
<tr>
<th>User</th>
<th>ID</th>
<th>Gender</th>
<th>Age</th>
<th>EstimatedSalary</th>
<th>Purchased</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="item in Docs.groups">
<td>{{item.User}}</td>
<td>{{item.ID}}</td>
<td>{{item.Gender}}</td>
<td>{{item.Age}}</td>
<td>{{item.EstimatedSalary}}</td>
<td>{{item.Purchased}}</td>
</tr>
</tbody>
</table>
</div>
</section>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment