72 lines
2.1 KiB
JavaScript
72 lines
2.1 KiB
JavaScript
var tuto_progress = [
|
|
{
|
|
1: { title: "Is alive?", label: "T1"},
|
|
2: { title: "DMZ reached", label: "T2"},
|
|
3: { title: "HTTPS on + time", label: "T3"},
|
|
4: { title: "DNS ok", label: "T4"},
|
|
5: { title: "On Internet", label: "T5"},
|
|
6: { title: "Bonus ICMP", label: "B1"},
|
|
7: { title: "Bonus disk", label: "B2"},
|
|
8: { title: "Uploaded SSH key", label: "SSH"},
|
|
},
|
|
{
|
|
100: { title: "HTTP", label: "HTTP"},
|
|
101: { title: "HTTPS", label: "HTTPS"},
|
|
102: { title: "DNS", label: "DNS"},
|
|
},
|
|
];
|
|
|
|
|
|
angular.module("AdLinApp", ["ngResource", "ngSanitize"])
|
|
.factory("Student", function($resource) {
|
|
return $resource("/api/students/:studentId", { studentId: '@id' }, {
|
|
'update': {method: 'PUT'},
|
|
})
|
|
})
|
|
.factory("Progression", function($resource) {
|
|
return $resource("/api/progress")
|
|
})
|
|
.factory("Challenge", function($resource) {
|
|
return $resource("/challenge/:challengeId", { challengeId: '@id' })
|
|
});
|
|
|
|
angular.module("AdLinApp")
|
|
.controller("StudentsController", function($scope, $interval, Student) {
|
|
$scope.students = Student.query();
|
|
var refreshStd = function() {
|
|
$scope.students = Student.query();
|
|
}
|
|
$interval(refreshStd, 1600000);
|
|
})
|
|
.controller("PingController", function($scope, $interval, $http) {
|
|
$scope.PING = false;
|
|
var refreshPing = function() {
|
|
$http.get("/api/students/" + $scope.student.id + "/ping").then(function(response) {
|
|
$scope.PING = response.data
|
|
});
|
|
}
|
|
refreshPing();
|
|
$interval(refreshPing, 15000);
|
|
})
|
|
.controller("SSHController", function($scope, $interval, $http) {
|
|
$scope.SSH = false;
|
|
var refreshSSH = function() {
|
|
$http.get("/api/students/" + $scope.student.id + "/hassshkeys").then(function(response) {
|
|
$scope.SSH = response.data
|
|
});
|
|
}
|
|
refreshSSH();
|
|
$interval(refreshSSH, 15500);
|
|
})
|
|
.controller("ProgressionController", function($scope, $interval, $http) {
|
|
$scope.tuto_progress = tuto_progress;
|
|
$scope.mychallenges = {};
|
|
var refreshChal = function() {
|
|
$http.get("/api/students/" + $scope.student.id + "/progress").then(function(response) {
|
|
$scope.mychallenges = response.data
|
|
});
|
|
}
|
|
refreshChal();
|
|
$interval(refreshChal, 15750);
|
|
})
|