From 92b15523f07d85cd577ef7c09e19c496c07f3755 Mon Sep 17 00:00:00 2001 From: Angele Date: Fri, 28 Sep 2018 00:49:30 +0200 Subject: [PATCH 1/3] feat(containers): add container name in error notification * containersDatable: add containers name if error on executeActionOnContainerList * Update containersDatatableActionsController.js * Update containersDatatableActionsController.js --- .../actions/containersDatatableActionsController.js | 1 + 1 file changed, 1 insertion(+) diff --git a/app/docker/components/datatables/containers-datatable/actions/containersDatatableActionsController.js b/app/docker/components/datatables/containers-datatable/actions/containersDatatableActionsController.js index 88980f8f3..efacb89e7 100644 --- a/app/docker/components/datatables/containers-datatable/actions/containersDatatableActionsController.js +++ b/app/docker/components/datatables/containers-datatable/actions/containersDatatableActionsController.js @@ -72,6 +72,7 @@ function ($state, ContainerService, ModalService, Notifications, HttpRequestHelp Notifications.success(successMessage, container.Names[0]); }) .catch(function error(err) { + errorMessage = errorMessage + ':' + container.Names[0]; Notifications.error('Failure', err, errorMessage); }) .finally(function final() { From 226c45f0355f9897e5e4762db2851b1081a8c8ee Mon Sep 17 00:00:00 2001 From: Chaim Lev-Ari Date: Fri, 28 Sep 2018 06:06:47 +0300 Subject: [PATCH 2/3] fix(template-creation): fix an issue related to the network setting (#2312) * bug(template): pass network name on creation * bug(templates): choose network object on update * fix(templates): set network only when available --- app/portainer/models/template.js | 2 +- app/portainer/views/templates/edit/templateController.js | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/app/portainer/models/template.js b/app/portainer/models/template.js index 0218ce8a2..6b9509958 100644 --- a/app/portainer/models/template.js +++ b/app/portainer/models/template.js @@ -25,7 +25,7 @@ function TemplateCreateRequest(model) { this.Image = model.Image; this.Registry = model.Registry.URL; this.Command = model.Command; - this.Network = model.Network; + this.Network = model.Network && model.Network.Name; this.Privileged = model.Privileged; this.Interactive = model.Interactive; this.RestartPolicy = model.RestartPolicy; diff --git a/app/portainer/views/templates/edit/templateController.js b/app/portainer/views/templates/edit/templateController.js index ccf82d228..352764e43 100644 --- a/app/portainer/views/templates/edit/templateController.js +++ b/app/portainer/views/templates/edit/templateController.js @@ -38,6 +38,12 @@ function ($q, $scope, $state, $transition$, TemplateService, TemplateHelper, Net ) }) .then(function success(data) { + var template = data.template; + if (template.Network) { + template.Network = _.find(data.networks, function(o) { return o.Name === template.Network; }); + } else { + template.Network = _.find(data.networks, function(o) { return o.Name === 'bridge'; }); + } $scope.categories = TemplateHelper.getUniqueCategories(data.templates); $scope.template = data.template; $scope.networks = data.networks; From 5be2684442db3716a41067f2eb60a017ec8c5df5 Mon Sep 17 00:00:00 2001 From: Chaim Lev-Ari Date: Sun, 30 Sep 2018 01:20:10 +0300 Subject: [PATCH 3/3] feat(home): add the ability to edit an endpoint (#2305) * feat(home): add edit button * feat(home): style edit button * feat(home): make endpoint editable on admin only --- .../endpoint-item/endpoint-item-controller.js | 12 ++++++++++++ .../endpoint-list/endpoint-item/endpointItem.html | 12 ++++++++++-- .../endpoint-list/endpoint-item/endpointItem.js | 7 +++++-- .../components/endpoint-list/endpoint-list.js | 4 +++- .../components/endpoint-list/endpointList.html | 2 ++ app/portainer/views/home/home.html | 2 ++ app/portainer/views/home/homeController.js | 6 ++++++ 7 files changed, 40 insertions(+), 5 deletions(-) create mode 100644 app/portainer/components/endpoint-list/endpoint-item/endpoint-item-controller.js diff --git a/app/portainer/components/endpoint-list/endpoint-item/endpoint-item-controller.js b/app/portainer/components/endpoint-list/endpoint-item/endpoint-item-controller.js new file mode 100644 index 000000000..62433ee25 --- /dev/null +++ b/app/portainer/components/endpoint-list/endpoint-item/endpoint-item-controller.js @@ -0,0 +1,12 @@ +angular.module('portainer.app').controller('EndpointItemController', [ + function EndpointItemController() { + var ctrl = this; + + ctrl.editEndpoint = editEndpoint; + + function editEndpoint(event) { + event.stopPropagation(); + ctrl.onEdit(ctrl.model.Id); + } + } +]); diff --git a/app/portainer/components/endpoint-list/endpoint-item/endpointItem.html b/app/portainer/components/endpoint-list/endpoint-item/endpointItem.html index 322ab9a90..6e643da5b 100644 --- a/app/portainer/components/endpoint-list/endpoint-item/endpointItem.html +++ b/app/portainer/components/endpoint-list/endpoint-item/endpointItem.html @@ -21,8 +21,16 @@ - - Group: {{ $ctrl.model.GroupName }} + + + + Group: {{ $ctrl.model.GroupName }} + + diff --git a/app/portainer/components/endpoint-list/endpoint-item/endpointItem.js b/app/portainer/components/endpoint-list/endpoint-item/endpointItem.js index d04fb25cf..450fa089d 100644 --- a/app/portainer/components/endpoint-list/endpoint-item/endpointItem.js +++ b/app/portainer/components/endpoint-list/endpoint-item/endpointItem.js @@ -2,6 +2,9 @@ angular.module('portainer.app').component('endpointItem', { templateUrl: 'app/portainer/components/endpoint-list/endpoint-item/endpointItem.html', bindings: { model: '<', - onSelect: '<' - } + onSelect: '<', + onEdit: '<', + isAdmin:'<' + }, + controller: 'EndpointItemController' }); diff --git a/app/portainer/components/endpoint-list/endpoint-list.js b/app/portainer/components/endpoint-list/endpoint-list.js index d11d7611d..d6a4bd33e 100644 --- a/app/portainer/components/endpoint-list/endpoint-list.js +++ b/app/portainer/components/endpoint-list/endpoint-list.js @@ -11,6 +11,8 @@ angular.module('portainer.app').component('endpointList', { endpoints: '<', dashboardAction: '<', snapshotAction: '<', - showSnapshotAction: '<' + showSnapshotAction: '<', + editAction: '<', + isAdmin:'<' } }); diff --git a/app/portainer/components/endpoint-list/endpointList.html b/app/portainer/components/endpoint-list/endpointList.html index 9110703f9..9b4850dd0 100644 --- a/app/portainer/components/endpoint-list/endpointList.html +++ b/app/portainer/components/endpoint-list/endpointList.html @@ -24,6 +24,8 @@ ng-repeat="endpoint in $ctrl.endpoints | filter:$ctrl.state.textFilter" model="endpoint" on-select="$ctrl.dashboardAction" + on-edit="$ctrl.editAction" + is-admin="$ctrl.isAdmin" >
Loading... diff --git a/app/portainer/views/home/home.html b/app/portainer/views/home/home.html index e9de46386..1ffaa88bd 100644 --- a/app/portainer/views/home/home.html +++ b/app/portainer/views/home/home.html @@ -44,6 +44,8 @@ dashboard-action="goToDashboard" show-snapshot-action="!applicationState.application.authentication || isAdmin" snapshot-action="triggerSnapshot" + edit-action="goToEdit" + is-admin="isAdmin" >
diff --git a/app/portainer/views/home/homeController.js b/app/portainer/views/home/homeController.js index 684c1ff7e..f666e49d7 100644 --- a/app/portainer/views/home/homeController.js +++ b/app/portainer/views/home/homeController.js @@ -62,6 +62,12 @@ function ($q, $scope, $state, Authentication, EndpointService, EndpointHelper, G }); } + $scope.goToEdit = goToEdit; + + function goToEdit(id) { + $state.go('portainer.endpoints.endpoint', { id: id }); + } + function initView() { $scope.isAdmin = Authentication.getUserDetails().role === 1;