mirror of
https://github.com/portainer/portainer.git
synced 2025-08-07 23:05:26 +02:00
refactor(endpoints): remove endpointProvider from views [EE-1136] (#5359)
[EE-1136]
This commit is contained in:
parent
7088da5157
commit
eb9f6c77f4
56 changed files with 408 additions and 429 deletions
|
@ -3,10 +3,10 @@ import { baseHref } from '@/portainer/helpers/pathHelper';
|
|||
|
||||
angular.module('portainer.docker').controller('ContainerConsoleController', [
|
||||
'$scope',
|
||||
'$state',
|
||||
'$transition$',
|
||||
'ContainerService',
|
||||
'ImageService',
|
||||
'EndpointProvider',
|
||||
'Notifications',
|
||||
'ContainerHelper',
|
||||
'ExecService',
|
||||
|
@ -15,10 +15,10 @@ angular.module('portainer.docker').controller('ContainerConsoleController', [
|
|||
'CONSOLE_COMMANDS_LABEL_PREFIX',
|
||||
function (
|
||||
$scope,
|
||||
$state,
|
||||
$transition$,
|
||||
ContainerService,
|
||||
ImageService,
|
||||
EndpointProvider,
|
||||
Notifications,
|
||||
ContainerHelper,
|
||||
ExecService,
|
||||
|
@ -65,7 +65,7 @@ angular.module('portainer.docker').controller('ContainerConsoleController', [
|
|||
|
||||
const params = {
|
||||
token: LocalStorage.getJWT(),
|
||||
endpointId: EndpointProvider.endpointID(),
|
||||
endpointId: $state.params.endpointId,
|
||||
id: attachId,
|
||||
};
|
||||
|
||||
|
@ -106,7 +106,7 @@ angular.module('portainer.docker').controller('ContainerConsoleController', [
|
|||
.then(function success(data) {
|
||||
const params = {
|
||||
token: LocalStorage.getJWT(),
|
||||
endpointId: EndpointProvider.endpointID(),
|
||||
endpointId: $state.params.endpointId,
|
||||
id: data.Id,
|
||||
};
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
show-add-action="true"
|
||||
offline-mode="offlineMode"
|
||||
refresh-callback="getContainers"
|
||||
endpoint-public-url="endpoint.PublicURL"
|
||||
></containers-datatable>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -1,29 +1,26 @@
|
|||
angular.module('portainer.docker').controller('ContainersController', [
|
||||
'$scope',
|
||||
'ContainerService',
|
||||
'Notifications',
|
||||
'EndpointProvider',
|
||||
function ($scope, ContainerService, Notifications, EndpointProvider) {
|
||||
$scope.offlineMode = false;
|
||||
angular.module('portainer.docker').controller('ContainersController', ContainersController);
|
||||
|
||||
$scope.getContainers = getContainers;
|
||||
/* @ngInject */
|
||||
function ContainersController($scope, ContainerService, Notifications, endpoint) {
|
||||
$scope.offlineMode = endpoint.Status !== 1;
|
||||
$scope.endpoint = endpoint;
|
||||
|
||||
function getContainers() {
|
||||
ContainerService.containers(1)
|
||||
.then(function success(data) {
|
||||
$scope.containers = data;
|
||||
$scope.offlineMode = EndpointProvider.offlineMode();
|
||||
})
|
||||
.catch(function error(err) {
|
||||
Notifications.error('Failure', err, 'Unable to retrieve containers');
|
||||
$scope.containers = [];
|
||||
});
|
||||
}
|
||||
$scope.getContainers = getContainers;
|
||||
|
||||
function initView() {
|
||||
getContainers();
|
||||
}
|
||||
function getContainers() {
|
||||
ContainerService.containers(1)
|
||||
.then(function success(data) {
|
||||
$scope.containers = data;
|
||||
})
|
||||
.catch(function error(err) {
|
||||
Notifications.error('Failure', err, 'Unable to retrieve containers');
|
||||
$scope.containers = [];
|
||||
});
|
||||
}
|
||||
|
||||
initView();
|
||||
},
|
||||
]);
|
||||
function initView() {
|
||||
getContainers();
|
||||
}
|
||||
|
||||
initView();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue