kopia lustrzana https://github.com/cyoung/stratux
trigger reboot as a webservice and redirect webui to wait on the status page for the reboot to complete
rodzic
43c5ff3b8c
commit
70269dd442
|
@ -255,7 +255,11 @@ func doReboot() {
|
|||
}
|
||||
|
||||
func handleRebootRequest(w http.ResponseWriter, r *http.Request) {
|
||||
doReboot()
|
||||
setNoCache(w)
|
||||
setJSONHeaders(w)
|
||||
w.Header().Set("Access-Control-Allow-Method", "GET, POST, OPTIONS")
|
||||
w.Header().Set("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept")
|
||||
go delayReboot()
|
||||
}
|
||||
|
||||
// AJAX call - /getClients. Responds with all connected clients.
|
||||
|
|
|
@ -9,6 +9,8 @@ var URL_STATUS_WS = "ws://" + URL_HOST_BASE + "/status"
|
|||
var URL_TRAFFIC_WS = "ws://" + URL_HOST_BASE + "/traffic";
|
||||
var URL_WEATHER_WS = "ws://" + URL_HOST_BASE + "/weather";
|
||||
var URL_UPDATE_UPLOAD = "http://" + URL_HOST_BASE + "/updateUpload";
|
||||
var URL_REBOOT = "http://" + URL_HOST_BASE + "/reboot";
|
||||
var URL_SHUTDOWN = "http://" + URL_HOST_BASE + "/shutdown";
|
||||
|
||||
// define the module with dependency on mobile-angular-ui
|
||||
//var app = angular.module('stratux', ['ngRoute', 'mobile-angular-ui', 'mobile-angular-ui.gestures', 'appControllers']);
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
angular.module('appControllers').controller('SettingsCtrl', SettingsCtrl); // get the main module contollers set
|
||||
SettingsCtrl.$inject = ['$rootScope', '$scope', '$state', '$http']; // Inject my dependencies
|
||||
SettingsCtrl.$inject = ['$rootScope', '$scope', '$state', '$location', '$window', '$http']; // Inject my dependencies
|
||||
|
||||
// create our controller function with all necessary logic
|
||||
function SettingsCtrl($rootScope, $scope, $state, $http) {
|
||||
function SettingsCtrl($rootScope, $scope, $state, $location, $window, $http) {
|
||||
|
||||
$scope.$parent.helppage = 'plates/settings-help.html';
|
||||
|
||||
|
@ -111,11 +111,27 @@ function SettingsCtrl($rootScope, $scope, $state, $http) {
|
|||
};
|
||||
|
||||
$scope.postShutdown = function () {
|
||||
$http.post('/shutdown');
|
||||
$window.location.href = "/";
|
||||
$location.path('/home');
|
||||
$http.post(URL_SHUTDOWN).
|
||||
then(function (response) {
|
||||
// do nothing
|
||||
// $scope.$apply();
|
||||
}, function (response) {
|
||||
// do nothing
|
||||
});
|
||||
};
|
||||
|
||||
$scope.postReboot = function () {
|
||||
$http.post('/reboot');
|
||||
$window.location.href = "/";
|
||||
$location.path('/home');
|
||||
$http.post(URL_REBOOT).
|
||||
then(function (response) {
|
||||
// do nothing
|
||||
// $scope.$apply();
|
||||
}, function (response) {
|
||||
// do nothing
|
||||
});
|
||||
};
|
||||
|
||||
$scope.setUploadFile = function (files) {
|
||||
|
|
Ładowanie…
Reference in New Issue