1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-08-04 21:35:23 +02:00

feat(registry): Add ProGet registry type EE-703 (#5196)

* intermediate commit

* feat(registry): backport ProGet registry to CE (#954)

* backport EE changes

* label updates and remove auth-toggle

Co-authored-by: Dennis Buduev <dennis.buduev@portainer.io>
This commit is contained in:
dbuduev 2021-07-01 14:57:15 +12:00 committed by GitHub
parent 8b80eb1731
commit 90a472c08b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 405 additions and 36 deletions

View file

@ -0,0 +1,101 @@
<form class="form-horizontal" name="registryFormProGet" ng-submit="$ctrl.formAction()">
<div class="col-sm-12 form-section-title">
ProGet registry details
</div>
<!-- name-input -->
<div class="form-group">
<label for="registry_name" class="col-sm-3 col-lg-2 control-label text-left">Name</label>
<div class="col-sm-9 col-lg-10">
<input type="text" class="form-control" id="registry_name" name="registry_name" ng-model="$ctrl.model.Name" placeholder="proget-registry" required auto-focus />
</div>
</div>
<div class="form-group" ng-show="registryFormProGet.registry_name.$invalid">
<div class="col-sm-12 small text-warning">
<div ng-messages="registryFormProGet.registry_name.$error">
<p ng-message="required"><i class="fa fa-exclamation-triangle" aria-hidden="true"></i>This field is required.</p>
</div>
</div>
</div>
<!-- !name-input -->
<!-- url-input -->
<div class="form-group">
<label for="registry_url" class="col-sm-3 col-lg-2 control-label text-left">
Registry URL
<portainer-tooltip position="bottom" message="The URL of the ProGet registry including the Feed name"></portainer-tooltip>
</label>
<div class="col-sm-9 col-lg-10">
<input type="text" class="form-control" id="registry_url" name="registry_url" ng-model="$ctrl.model.URL" placeholder="proget.example.com/example-registry" required />
</div>
</div>
<div class="form-group" ng-show="registryFormProGet.registry_url.$invalid">
<div class="col-sm-12 small text-warning">
<div ng-messages="registryFormProGet.registry_url.$error">
<p ng-message="required"><i class="fa fa-exclamation-triangle" aria-hidden="true"></i> This field is required.</p>
</div>
</div>
</div>
<!-- url-input -->
<!-- base-url-input -->
<div class="form-group">
<label for="registry_base_url" class="col-sm-3 col-lg-2 control-label text-left">
Base URL
<portainer-tooltip position="bottom" message="The base URL of the ProGet registry"></portainer-tooltip>
</label>
<div class="col-sm-9 col-lg-10">
<input type="text" class="form-control" id="registry_base_url" name="registry_base_url" ng-model="$ctrl.model.BaseURL" placeholder="proget.example.com" required />
</div>
</div>
<div class="form-group" ng-show="registryFormProGet.registry_base_url.$invalid">
<div class="col-sm-12 small text-warning">
<div ng-messages="registryFormProGet.registry_base_url.$error">
<p ng-message="required"><i class="fa fa-exclamation-triangle" aria-hidden="true"></i> This field is required.</p>
</div>
</div>
</div>
<!-- !base-url-input -->
<div>
<!-- credentials-user -->
<div class="form-group">
<label for="registry_username" class="col-sm-3 col-lg-2 control-label text-left">Username</label>
<div class="col-sm-9 col-lg-10">
<input type="text" class="form-control" id="registry_username" name="registry_username" ng-model="$ctrl.model.Username" required />
</div>
</div>
<div class="form-group" ng-show="registryFormProGet.registry_username.$invalid">
<div class="col-sm-12 small text-warning">
<div ng-messages="registryFormProGet.registry_username.$error">
<p ng-message="required"><i class="fa fa-exclamation-triangle" aria-hidden="true"></i> This field is required.</p>
</div>
</div>
</div>
<!-- !credentials-user -->
<!-- credentials-password -->
<div class="form-group">
<label for="registry_password" class="col-sm-3 col-lg-2 control-label text-left">Password</label>
<div class="col-sm-9 col-lg-10">
<input type="password" class="form-control" id="registry_password" name="registry_password" ng-model="$ctrl.model.Password" required />
</div>
</div>
<div class="form-group" ng-show="registryFormProGet.registry_password.$invalid">
<div class="col-sm-12 small text-warning">
<div ng-messages="registryFormProGet.registry_password.$error">
<p ng-message="required"><i class="fa fa-exclamation-triangle" aria-hidden="true"></i> This field is required.</p>
</div>
</div>
</div>
<!-- !credentials-password -->
</div>
<!-- actions -->
<div class="col-sm-12 form-section-title">
Actions
</div>
<div class="form-group">
<div class="col-sm-12">
<button type="submit" class="btn btn-primary btn-sm" ng-disabled="$ctrl.actionInProgress || !registryFormProGet.$valid" button-spinner="$ctrl.actionInProgress">
<span ng-hide="$ctrl.actionInProgress">{{ $ctrl.formActionLabel }}</span>
<span ng-show="$ctrl.actionInProgress">In progress...</span>
</button>
</div>
</div>
<!-- !actions -->
</form>

View file

@ -0,0 +1,9 @@
angular.module('portainer.app').component('registryFormProget', {
templateUrl: './registry-form-proget.html',
bindings: {
model: '=',
formAction: '<',
formActionLabel: '@',
actionInProgress: '<',
},
});

View file

@ -1,11 +1,12 @@
import _ from 'lodash-es';
import { RegistryTypes } from '@/portainer/models/registryTypes';
import { RegistryTypes } from './registryTypes';
export function RegistryViewModel(data) {
this.Id = data.Id;
this.Type = data.Type;
this.Name = data.Name;
this.URL = data.URL;
this.BaseURL = data.BaseURL;
this.Authentication = data.Authentication;
this.Username = data.Username;
this.Password = data.Password;
@ -33,7 +34,7 @@ export function RegistryManagementConfigurationDefaultModel(registry) {
this.TLS = true;
}
if (registry.Type === RegistryTypes.CUSTOM && registry.Authentication) {
if ((registry.Type === RegistryTypes.CUSTOM || registry.Type === RegistryTypes.PROGET) && registry.Authentication) {
this.Authentication = true;
this.Username = registry.Username;
}
@ -71,4 +72,8 @@ export function RegistryCreateRequest(model) {
organisationName: model.Quay.organisationName,
};
}
if (model.Type === RegistryTypes.PROGET) {
this.BaseURL = _.replace(model.BaseURL, /^https?\:\/\//i, '');
this.BaseURL = _.replace(this.BaseURL, /\/$/, '');
}
}

View file

@ -3,4 +3,5 @@ export const RegistryTypes = Object.freeze({
AZURE: 2,
CUSTOM: 3,
GITLAB: 4,
PROGET: 5,
});

View file

@ -1,5 +1,5 @@
import { RegistryTypes } from '@/portainer/models/registryTypes';
import { RegistryDefaultModel } from '../../../models/registry';
import { RegistryDefaultModel } from '@/portainer/models/registry';
angular.module('portainer.app').controller('CreateRegistryController', [
'$scope',
@ -11,6 +11,7 @@ angular.module('portainer.app').controller('CreateRegistryController', [
$scope.selectQuayRegistry = selectQuayRegistry;
$scope.selectAzureRegistry = selectAzureRegistry;
$scope.selectCustomRegistry = selectCustomRegistry;
$scope.selectProGetRegistry = selectProGetRegistry;
$scope.selectGitlabRegistry = selectGitlabRegistry;
$scope.create = createRegistry;
$scope.useDefaultGitlabConfiguration = useDefaultGitlabConfiguration;
@ -65,6 +66,13 @@ angular.module('portainer.app').controller('CreateRegistryController', [
$scope.model.Authentication = false;
}
function selectProGetRegistry() {
$scope.model.Name = '';
$scope.model.URL = '';
$scope.model.BaseURL = '';
$scope.model.Authentication = true;
}
function retrieveGitlabRegistries() {
$scope.state.actionInProgress = true;
RegistryGitlabService.projects($scope.model.Gitlab.InstanceURL, $scope.model.Token)

View file

@ -26,6 +26,16 @@
<p>Quay container registry</p>
</label>
</div>
<div>
<input type="radio" id="registry_proget" ng-model="model.Type" ng-value="RegistryTypes.PROGET" />
<label for="registry_proget" ng-click="selectProGetRegistry()">
<div class="boxselector_header">
<i class="fa fa-database" aria-hidden="true" style="margin-right: 2px;"></i>
ProGet
</div>
<p>ProGet container registry</p>
</label>
</div>
<div>
<input type="radio" id="registry_azure" ng-model="model.Type" ng-value="RegistryTypes.AZURE" />
<label for="registry_azure" ng-click="selectAzureRegistry()">
@ -83,6 +93,14 @@
action-in-progress="state.actionInProgress"
></registry-form-custom>
<registry-form-proget
ng-if="model.Type === RegistryTypes.PROGET"
model="model"
form-action="create"
form-action-label="Add registry"
action-in-progress="state.actionInProgress"
></registry-form-proget>
<registry-form-gitlab
ng-if="model.Type === RegistryTypes.GITLAB"
model="model"

View file

@ -33,7 +33,7 @@
</div>
<!-- !registry-url-input -->
<!-- authentication-checkbox -->
<div class="form-group">
<div class="form-group" ng-if="registry.Type !== RegistryTypes.PROGET">
<div class="col-sm-12">
<label for="registry_auth" class="control-label text-left">
Authentication