add provider to registry config

this way there is a clear way to disable/remove config
This commit is contained in:
Girish Ramakrishnan
2021-02-09 14:29:40 -08:00
parent 419e1d65e4
commit eb7530b5fd
2 changed files with 37 additions and 14 deletions

View File

@@ -34,6 +34,18 @@ angular.module('Application').controller('SettingsController', ['$scope', '$loca
{ name: '8 PM', value: 20 }, { name: '9 PM', value: 21 }, { name: '10 PM', value: 22 }, { name: '11 PM', value: 23 }
];
$scope.registryConfigProviders = [
{ name: 'AWS', value: 'aws' },
{ name: 'Digital Ocean', value: 'digitalocean' },
{ name: 'DockerHub', value: 'dockerhub' },
{ name: 'Google Cloud', value: 'google-cloud' },
{ name: 'Linode', value: 'linode' },
{ name: 'Other', value: 'other' },
{ name: 'Quay', value: 'quay' },
{ name: 'Treescale', value: 'treescale' },
{ name: 'Disabled', value: 'noop' }
];
$scope.openSubscriptionSetup = function () {
Client.openSubscriptionSetup($scope.subscription || {});
};
@@ -321,10 +333,7 @@ angular.module('Application').controller('SettingsController', ['$scope', '$loca
Client.getRegistryConfig(function (error, result) {
if (error) return console.error(error);
$scope.registryConfig.currentConfig.serverAddress = result.serverAddress;
$scope.registryConfig.currentConfig.username = result.username || '';
$scope.registryConfig.currentConfig.email = result.email || '';
$scope.registryConfig.currentConfig.password = result.password;
$scope.registryConfig.currentConfig = result;
});
}
@@ -345,6 +354,7 @@ angular.module('Application').controller('SettingsController', ['$scope', '$loca
busy: false,
error: null,
serverAddress: '',
provider: 'noop',
username: '',
password: '',
email: '',
@@ -354,10 +364,11 @@ angular.module('Application').controller('SettingsController', ['$scope', '$loca
$scope.registryConfig.busy = false;
$scope.registryConfig.error = null;
$scope.registryConfig.serverAddress = $scope.registryConfig.currentConfig.serverAddress;
$scope.registryConfig.username = $scope.registryConfig.currentConfig.username;
$scope.registryConfig.email = $scope.registryConfig.currentConfig.email;
$scope.registryConfig.password = $scope.registryConfig.currentConfig.password;
$scope.registryConfig.provider = $scope.registryConfig.currentConfig.provider;
$scope.registryConfig.serverAddress = $scope.registryConfig.currentConfig.serverAddress || '';
$scope.registryConfig.username = $scope.registryConfig.currentConfig.username || '';
$scope.registryConfig.email = $scope.registryConfig.currentConfig.email || '';
$scope.registryConfig.password = $scope.registryConfig.currentConfig.password || '';
$scope.registryConfigForm.$setUntouched();
$scope.registryConfigForm.$setPristine();
@@ -372,12 +383,16 @@ angular.module('Application').controller('SettingsController', ['$scope', '$loca
$scope.registryConfig.busy = true;
var data = {
serverAddress: $scope.registryConfig.serverAddress,
username: $scope.registryConfig.username || '',
password: $scope.registryConfig.password,
email: $scope.registryConfig.email || '',
provider: $scope.registryConfig.provider
};
if ($scope.registryConfig.provider !== 'noop') {
data.serverAddress = $scope.registryConfig.serverAddress;
data.username = $scope.registryConfig.username || '';
data.password = $scope.registryConfig.password;
data.email = $scope.registryConfig.email || '';
}
Client.setRegistryConfig(data, function (error) {
$scope.registryConfig.busy = false;