mirror of
https://github.com/portainer/portainer.git
synced 2025-08-05 13:55:21 +02:00
refactor(agent): refactor rest factories to es6 (#4090)
* refactor(agent): replace v1 browse with es6 module * refactor(agent): refactor agentv1 to es6 * refactor(agent): replace agent factory with es6 * refactor(agent): refactor browse response to es6 * refactor(agent): refactor browse to es6 * refactor(agent): import angular * refactor(agent): refactor host to es6 * refactor(agent): refactor ping to es6
This commit is contained in:
parent
435f15ec6a
commit
7eb8d5449a
7 changed files with 143 additions and 159 deletions
|
@ -1,17 +1,15 @@
|
|||
angular.module('portainer.agent').factory('AgentVersion1', [
|
||||
'$resource',
|
||||
'API_ENDPOINT_ENDPOINTS',
|
||||
'EndpointProvider',
|
||||
function AgentFactory($resource, API_ENDPOINT_ENDPOINTS, EndpointProvider) {
|
||||
'use strict';
|
||||
return $resource(
|
||||
API_ENDPOINT_ENDPOINTS + '/:endpointId/docker/agents',
|
||||
{
|
||||
endpointId: EndpointProvider.endpointID,
|
||||
},
|
||||
{
|
||||
query: { method: 'GET', isArray: true },
|
||||
}
|
||||
);
|
||||
},
|
||||
]);
|
||||
import angular from 'angular';
|
||||
|
||||
angular.module('portainer.agent').factory('AgentVersion1', AgentFactory);
|
||||
|
||||
function AgentFactory($resource, API_ENDPOINT_ENDPOINTS, EndpointProvider) {
|
||||
return $resource(
|
||||
`${API_ENDPOINT_ENDPOINTS}/:endpointId/docker/agents`,
|
||||
{
|
||||
endpointId: EndpointProvider.endpointID,
|
||||
},
|
||||
{
|
||||
query: { method: 'GET', isArray: true },
|
||||
}
|
||||
);
|
||||
}
|
||||
|
|
|
@ -1,37 +1,35 @@
|
|||
import angular from 'angular';
|
||||
|
||||
import { browseGetResponse } from '../response/browse';
|
||||
|
||||
angular.module('portainer.agent').factory('BrowseVersion1', [
|
||||
'$resource',
|
||||
'API_ENDPOINT_ENDPOINTS',
|
||||
'EndpointProvider',
|
||||
function BrowseFactory($resource, API_ENDPOINT_ENDPOINTS, EndpointProvider) {
|
||||
'use strict';
|
||||
return $resource(
|
||||
API_ENDPOINT_ENDPOINTS + '/:endpointId/docker/browse/:volumeID/:action',
|
||||
{
|
||||
endpointId: EndpointProvider.endpointID,
|
||||
angular.module('portainer.agent').factory('BrowseVersion1', BrowseFactory);
|
||||
|
||||
function BrowseFactory($resource, API_ENDPOINT_ENDPOINTS, EndpointProvider) {
|
||||
return $resource(
|
||||
`${API_ENDPOINT_ENDPOINTS}/:endpointId/docker/browse/:volumeID/:action`,
|
||||
{
|
||||
endpointId: EndpointProvider.endpointID,
|
||||
},
|
||||
{
|
||||
ls: {
|
||||
method: 'GET',
|
||||
isArray: true,
|
||||
params: { action: 'ls' },
|
||||
},
|
||||
{
|
||||
ls: {
|
||||
method: 'GET',
|
||||
isArray: true,
|
||||
params: { action: 'ls' },
|
||||
},
|
||||
get: {
|
||||
method: 'GET',
|
||||
params: { action: 'get' },
|
||||
transformResponse: browseGetResponse,
|
||||
responseType: 'arraybuffer',
|
||||
},
|
||||
delete: {
|
||||
method: 'DELETE',
|
||||
params: { action: 'delete' },
|
||||
},
|
||||
rename: {
|
||||
method: 'PUT',
|
||||
params: { action: 'rename' },
|
||||
},
|
||||
}
|
||||
);
|
||||
},
|
||||
]);
|
||||
get: {
|
||||
method: 'GET',
|
||||
params: { action: 'get' },
|
||||
transformResponse: browseGetResponse,
|
||||
responseType: 'arraybuffer',
|
||||
},
|
||||
delete: {
|
||||
method: 'DELETE',
|
||||
params: { action: 'delete' },
|
||||
},
|
||||
rename: {
|
||||
method: 'PUT',
|
||||
params: { action: 'rename' },
|
||||
},
|
||||
}
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue