mirror of
https://github.com/portainer/portainer.git
synced 2025-07-23 15:29:42 +02:00
* feat(api): gitlab registry type * feat(registries): early support for gitlab registries * feat(app): registry service selector * feat(registry): gitlab support : list repositories and tags - remove features missing * feat(registry): gitlab registry remove features * feat(registry): gitlab switch to registry V2 API for repositories and tags * feat(api): use development extension binary * fix(registry): avoid 401 on gitlab retrieve to disconnect the user * feat(registry): gitlab browse projects without extension * style(app): code cleaning * refactor(app): PR review changes + refactor on types * fix(gitlab): remove gitlab info from registrymanagementconfig and force gitlab type * style(api): go fmt * feat(api): update APIVersion and ExtensionDefinitionsURL * fix(api): fix invalid RM extension URL * feat(registry): PAT scope help * feat(registry): defaults on registry creation * style(registry-creation): update layout and text for Gitlab registry * feat(registry-creation): update gitlab notice
70 lines
2.4 KiB
JavaScript
70 lines
2.4 KiB
JavaScript
import { RegistryManagementConfigurationDefaultModel } from '../../../../portainer/models/registry';
|
|
import { RegistryTypes } from 'Extensions/registry-management/models/registryTypes';
|
|
|
|
angular.module('portainer.extensions.registrymanagement')
|
|
.controller('ConfigureRegistryController', ['$scope', '$state', '$transition$', 'RegistryService', 'RegistryServiceSelector', 'Notifications',
|
|
function ($scope, $state, $transition$, RegistryService, RegistryServiceSelector, Notifications) {
|
|
|
|
$scope.state = {
|
|
testInProgress: false,
|
|
updateInProgress: false,
|
|
validConfiguration : false
|
|
};
|
|
|
|
$scope.testConfiguration = testConfiguration;
|
|
$scope.updateConfiguration = updateConfiguration;
|
|
|
|
function testConfiguration() {
|
|
$scope.state.testInProgress = true;
|
|
|
|
RegistryService.configureRegistry($scope.registry.Id, $scope.model)
|
|
.then(function success() {
|
|
return RegistryServiceSelector.ping($scope.registry, true);
|
|
})
|
|
.then(function success() {
|
|
Notifications.success('Success', 'Valid management configuration');
|
|
$scope.state.validConfiguration = true;
|
|
})
|
|
.catch(function error(err) {
|
|
Notifications.error('Failure', err, 'Invalid management configuration');
|
|
})
|
|
.finally(function final() {
|
|
$scope.state.testInProgress = false;
|
|
});
|
|
}
|
|
|
|
function updateConfiguration() {
|
|
$scope.state.updateInProgress = true;
|
|
|
|
RegistryService.configureRegistry($scope.registry.Id, $scope.model)
|
|
.then(function success() {
|
|
Notifications.success('Success', 'Registry management configuration updated');
|
|
$state.go('portainer.registries.registry.repositories', { id: $scope.registry.Id }, {reload: true});
|
|
})
|
|
.catch(function error(err) {
|
|
Notifications.error('Failure', err, 'Unable to update registry management configuration');
|
|
})
|
|
.finally(function final() {
|
|
$scope.state.updateInProgress = false;
|
|
});
|
|
}
|
|
|
|
function initView() {
|
|
var registryId = $transition$.params().id;
|
|
$scope.RegistryTypes = RegistryTypes;
|
|
|
|
RegistryService.registry(registryId)
|
|
.then(function success(data) {
|
|
var registry = data;
|
|
var model = new RegistryManagementConfigurationDefaultModel(registry);
|
|
|
|
$scope.registry = registry;
|
|
$scope.model = model;
|
|
})
|
|
.catch(function error(err) {
|
|
Notifications.error('Failure', err, 'Unable to retrieve registry details');
|
|
});
|
|
}
|
|
|
|
initView();
|
|
}]);
|