dyndns: run as a task

this lets us display logs
This commit is contained in:
Girish Ramakrishnan
2023-07-08 19:48:12 +05:30
parent 56b7cc4041
commit 23f0eba1bd
11 changed files with 108 additions and 31 deletions

View File

@@ -1,9 +1,9 @@
'use strict';
/* global angular */
/* global $ */
/* global $, TASK_TYPES */
angular.module('Application').controller('NetworkController', ['$scope', '$location', 'Client', function ($scope, $location, Client) {
angular.module('Application').controller('NetworkController', ['$scope', '$location', '$timeout', 'Client', function ($scope, $location, $timeout, Client) {
Client.onReady(function () { if (!Client.getUserInfo().isAtLeastAdmin) $location.path('/'); });
$scope.user = Client.getUserInfo();
@@ -37,12 +37,25 @@ angular.module('Application').controller('NetworkController', ['$scope', '$locat
busy: false,
error: '',
isEnabled: false,
tasks: [],
refreshTasks: function () {
Client.getTasksByType(TASK_TYPES.TASK_SYNC_DYNDNS, function (error, tasks) {
if (error) return console.error(error);
$scope.dyndnsConfigure.tasks = tasks.slice(0, 10);
if ($scope.dyndnsConfigure.tasks.length && $scope.dyndnsConfigure.tasks[0].active) {
$timeout($scope.renewCerts.refreshTasks, 5000);
}
});
},
refresh: function () {
Client.getDynamicDnsConfig(function (error, enabled) {
if (error) return console.error(error);
$scope.dyndnsConfigure.isEnabled = enabled;
$scope.dyndnsConfigure.refreshTasks();
});
},