Add ui to configure registry

This commit is contained in:
Girish Ramakrishnan
2019-10-22 22:31:38 -07:00
parent 470936476e
commit 7c978f6c1c
3 changed files with 143 additions and 0 deletions

View File

@@ -308,6 +308,16 @@ angular.module('Application').controller('SettingsController', ['$scope', '$loca
});
}
function getRegistryConfig() {
Client.getRegistryConfig(function (error, result) {
if (error) return console.error(error);
$scope.registryConfig.serverAddress = result.serverAddress;
$scope.registryConfig.username = result.username;
$scope.registryConfig.password = result.password;
});
}
function getSubscription() {
$scope.subscriptionBusy = true;
@@ -353,6 +363,50 @@ angular.module('Application').controller('SettingsController', ['$scope', '$loca
fr.readAsDataURL(event.target.files[0]);
};
$scope.registryConfig = {
busy: false,
error: null,
serverAddress: '',
username: '',
password: '',
reset: function () {
$scope.cloudronNameChange.busy = false;
$scope.registryConfig.error = null;
$scope.registryConfigForm.$setUntouched();
$scope.registryConfigForm.$setPristine();
},
show: function () {
$scope.registryConfig.reset();
$('#registryConfigModal').modal('show');
},
submit: function () {
$scope.registryConfig.busy = true;
var data = {
serverAddress: $scope.registryConfig.serverAddress,
username: $scope.registryConfig.username,
password: $scope.registryConfig.password
};
Client.setRegistryConfig(data, function (error) {
$scope.registryConfig.busy = false;
if (error) {
$scope.registryConfig.error = error;
return;
}
$('#registryConfigModal').modal('hide');
getRegistryConfig();
});
}
};
$scope.unstableApps = {
busy: false,
enabled: false,
@@ -425,6 +479,7 @@ angular.module('Application').controller('SettingsController', ['$scope', '$loca
Client.onReady(function () {
getAutoupdatePattern();
getUnstableAppsConfig();
getRegistryConfig();
$scope.update.checkStatus();