dyndns: run as a task
this lets us display logs
This commit is contained in:
@@ -79,6 +79,7 @@ var TASK_TYPES = {
|
||||
TASK_CHANGE_MAIL_LOCATION: 'changeMailLocation',
|
||||
TASK_SYNC_DNS_RECORDS: 'syncDnsRecords',
|
||||
TASK_UPDATE_DISK_USAGE: 'updateDiskUsage',
|
||||
TASK_SYNC_DYNDNS: 'syncDyndns',
|
||||
};
|
||||
|
||||
const APP_TYPES = {
|
||||
@@ -4083,9 +4084,10 @@ angular.module('Application').service('Client', ['$http', '$interval', '$timeout
|
||||
return 'User ' + (data.user ? data.user.username : data.userId) + ' logged out';
|
||||
|
||||
case ACTION_DYNDNS_UPDATE: {
|
||||
details = '';
|
||||
if (data.fromIpv4 !== data.toIpv4) details += 'DNS was updated from IPv4 ' + data.fromIpv4 + ' to ' + data.toIpv4 + '. ';
|
||||
if (data.fromIpv6 !== data.toIpv6) details += 'DNS was updated from IPv6 ' + data.fromIpv6 + ' to ' + data.toIpv6 + '.';
|
||||
details = data.errorMessage ? 'Error updating DNS. ' : 'Updated DNS. ';
|
||||
if (data.fromIpv4 !== data.toIpv4) details += 'From IPv4 ' + data.fromIpv4 + ' to ' + data.toIpv4 + '. ';
|
||||
if (data.fromIpv6 !== data.toIpv6) details += 'From IPv6 ' + data.fromIpv6 + ' to ' + data.toIpv6 + '.';
|
||||
if (data.errorMessage) details += ' ' + data.errorMessage;
|
||||
return details;
|
||||
}
|
||||
|
||||
|
||||
@@ -790,7 +790,8 @@
|
||||
},
|
||||
"dyndns": {
|
||||
"title": "Dynamic DNS",
|
||||
"description": "Enable this option to keep all your DNS records in sync with a changing IP address. This is useful when Cloudron runs in a network with a frequently changing public IP address like a home connection."
|
||||
"description": "Enable this option to keep all your DNS records in sync with a changing IP address. This is useful when Cloudron runs in a network with a frequently changing public IP address like a home connection.",
|
||||
"showLogsAction": "Show Logs"
|
||||
},
|
||||
"configureIp": {
|
||||
"title": "Configure IP Provider",
|
||||
|
||||
@@ -1502,7 +1502,8 @@
|
||||
"paste": "Plakken",
|
||||
"copy": "Kopiëren",
|
||||
"cut": "Knippen",
|
||||
"edit": "Bewerk"
|
||||
"edit": "Bewerk",
|
||||
"open": "Open"
|
||||
},
|
||||
"mtime": "Bewerkt"
|
||||
},
|
||||
@@ -1517,6 +1518,16 @@
|
||||
},
|
||||
"newDirectory": {
|
||||
"errorAlreadyExists": "Bestaat al"
|
||||
},
|
||||
"uploader": {
|
||||
"exitWarning": "Uploaden nog bezig. Weet je zeker dat je deze pagina wilt sluiten?",
|
||||
"uploading": "Uploaden"
|
||||
},
|
||||
"extractionInProgress": "Bezig met uitpakken",
|
||||
"textEditor": {
|
||||
"undo": "Ongedaan maken",
|
||||
"redo": "Opnieuw doen",
|
||||
"save": "Bewaar"
|
||||
}
|
||||
},
|
||||
"email": {
|
||||
|
||||
@@ -1489,7 +1489,8 @@
|
||||
"cut": "Вырезать",
|
||||
"paste": "Вставить",
|
||||
"selectAll": "Выбрать все",
|
||||
"copy": "Скопировать"
|
||||
"copy": "Скопировать",
|
||||
"open": "Открыть"
|
||||
},
|
||||
"symlink": "Символическая ссылка на {{ target }}",
|
||||
"mtime": "Изменён"
|
||||
@@ -1517,6 +1518,16 @@
|
||||
},
|
||||
"status": {
|
||||
"restartingApp": "перезапускаем приложение"
|
||||
},
|
||||
"extractionInProgress": "Идёт извлечение",
|
||||
"uploader": {
|
||||
"exitWarning": "Загрузка ещё не завершена. Вы уверены, что хотите закрыть страницу?",
|
||||
"uploading": "Загружаем"
|
||||
},
|
||||
"textEditor": {
|
||||
"undo": "Отменить операцию",
|
||||
"redo": "Повторить операцию",
|
||||
"save": "Сохранить"
|
||||
}
|
||||
},
|
||||
"email": {
|
||||
|
||||
@@ -277,7 +277,21 @@
|
||||
|
||||
<!-- Dynamic DNS -->
|
||||
<div class="text-left section-header">
|
||||
<h3>{{ 'network.dyndns.title' | tr }}</h3>
|
||||
<h3>
|
||||
{{ 'network.dyndns.title' | tr }}
|
||||
<div class="btn-group btn-group-sm pull-right">
|
||||
<button type="button" class="btn btn-small btn-default dropdown-toggle" ng-show="dyndnsConfigure.tasks.length" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" uib-tooltip="{{ 'network.dyndns.showLogsAction' | tr }}">
|
||||
<i class="fas fa-align-left"></i> <span class="caret"></span>
|
||||
</button>
|
||||
<ul class="dropdown-menu">
|
||||
<li ng-repeat="task in dyndnsConfigure.tasks">
|
||||
<a ng-href="/logs.html?taskId={{task.id}}" target="_blank" class="text-right">
|
||||
{{ task.ts | prettyLongDate }} <i class="fa" style="margin-left: 20px" ng-class="{ 'status-active fa-check-circle': !task.active && task.success, 'fa-circle-notch fa-spin': task.active, 'status-error fa-times-circle': !task.active && !task.success }"></i>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</h3>
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
|
||||
@@ -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();
|
||||
});
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user