1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-07-24 15:59:41 +02:00

refactor(endpoints): remove endpointProvider from views [EE-1136] (#5359)

[EE-1136]
This commit is contained in:
Chaim Lev-Ari 2021-12-14 09:34:54 +02:00 committed by GitHub
parent 7088da5157
commit eb9f6c77f4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
56 changed files with 408 additions and 429 deletions

View file

@ -264,7 +264,7 @@
ng-if="item.Ports.length > 0"
ng-repeat="p in item.Ports | unique: 'public'"
class="image-tag"
ng-href="http://{{ $ctrl.state.publicURL || p.host }}:{{ p.public }}"
ng-href="http://{{ $ctrl.endpointPublicUrl || p.host }}:{{ p.public }}"
target="_blank"
>
<i class="fa fa-external-link-alt" aria-hidden="true"></i> {{ p.public }}:{{ p.private }}

View file

@ -13,5 +13,6 @@ angular.module('portainer.docker').component('containersDatatable', {
offlineMode: '<',
refreshCallback: '<',
notAutoFocus: '<',
endpointPublicUrl: '<',
},
});

View file

@ -4,8 +4,7 @@ angular.module('portainer.docker').controller('ContainersDatatableController', [
'$scope',
'$controller',
'DatatableService',
'EndpointProvider',
function ($scope, $controller, DatatableService, EndpointProvider) {
function ($scope, $controller, DatatableService) {
angular.extend(this, $controller('GenericDatatableController', { $scope: $scope }));
var ctrl = this;
@ -14,7 +13,6 @@ angular.module('portainer.docker').controller('ContainersDatatableController', [
noStoppedItemsSelected: true,
noRunningItemsSelected: true,
noPausedItemsSelected: true,
publicURL: EndpointProvider.endpointPublicURL(),
});
this.settings = Object.assign(this.settings, {

View file

@ -6,5 +6,6 @@ angular.module('portainer.docker').component('servicesDatatableActions', {
selectedItemCount: '=',
showUpdateAction: '<',
showAddAction: '<',
endpointId: '<',
},
});

View file

@ -7,8 +7,9 @@ angular.module('portainer.docker').controller('ServicesDatatableActionsControlle
'ModalService',
'ImageHelper',
'WebhookService',
'EndpointProvider',
function ($q, $state, ServiceService, ServiceHelper, Notifications, ModalService, ImageHelper, WebhookService, EndpointProvider) {
function ($q, $state, ServiceService, ServiceHelper, Notifications, ModalService, ImageHelper, WebhookService) {
const ctrl = this;
this.scaleAction = function scaleService(service) {
var config = ServiceHelper.serviceToConfig(service.Model);
config.Mode.Replicated.Replicas = service.Replicas;
@ -84,7 +85,7 @@ angular.module('portainer.docker').controller('ServicesDatatableActionsControlle
angular.forEach(services, function (service) {
ServiceService.remove(service)
.then(function success() {
return WebhookService.webhooks(service.Id, EndpointProvider.endpointID());
return WebhookService.webhooks(service.Id, ctrl.endpointId);
})
.then(function success(data) {
return $q.when(data.length !== 0 && WebhookService.deleteWebhook(data[0].Id));

View file

@ -47,6 +47,7 @@
selected-item-count="$ctrl.state.selectedItemCount"
show-add-action="$ctrl.showAddAction"
show-update-action="$ctrl.showUpdateAction"
endpoint-id="$ctrl.endpointId"
></services-datatable-actions>
<div class="searchBar">
<i class="fa fa-search searchIcon" aria-hidden="true"></i>
@ -171,7 +172,7 @@
ng-if="item.Ports && item.Ports.length > 0 && p.PublishedPort"
ng-repeat="p in item.Ports"
class="image-tag"
ng-href="http://{{ $ctrl.state.publicURL }}:{{ p.PublishedPort }}"
ng-href="http://{{ $ctrl.endpointPublicUrl }}:{{ p.PublishedPort }}"
target="_blank"
ng-click="$event.stopPropagation();"
>

View file

@ -16,5 +16,7 @@ angular.module('portainer.docker').component('servicesDatatable', {
showTaskLogsButton: '<',
refreshCallback: '<',
notAutoFocus: '<',
endpointPublicUrl: '<',
endpointId: '<',
},
});

View file

@ -4,8 +4,7 @@ angular.module('portainer.docker').controller('ServicesDatatableController', [
'$scope',
'$controller',
'DatatableService',
'EndpointProvider',
function ($scope, $controller, DatatableService, EndpointProvider) {
function ($scope, $controller, DatatableService) {
angular.extend(this, $controller('GenericDatatableController', { $scope: $scope }));
var ctrl = this;
@ -13,7 +12,6 @@ angular.module('portainer.docker').controller('ServicesDatatableController', [
this.state = Object.assign(this.state, {
expandAll: false,
expandedItems: [],
publicURL: EndpointProvider.endpointPublicURL(),
});
this.expandAll = function () {