mirror of
https://github.com/portainer/portainer.git
synced 2025-08-02 04:15:28 +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
|
@ -2,7 +2,8 @@ import angular from 'angular';
|
|||
|
||||
angular.module('portainer.agent').factory('HostBrowserService', HostBrowserServiceFactory);
|
||||
|
||||
function HostBrowserServiceFactory(Browse, Upload, API_ENDPOINT_ENDPOINTS, EndpointProvider, StateManager) {
|
||||
/* @ngInject */
|
||||
function HostBrowserServiceFactory(Browse, Upload, API_ENDPOINT_ENDPOINTS, StateManager) {
|
||||
return { ls, get, delete: deletePath, rename, upload };
|
||||
|
||||
function ls(path) {
|
||||
|
@ -25,14 +26,14 @@ function HostBrowserServiceFactory(Browse, Upload, API_ENDPOINT_ENDPOINTS, Endpo
|
|||
return Browse.rename({}, payload).$promise;
|
||||
}
|
||||
|
||||
function upload(path, file, onProgress) {
|
||||
function upload(endpointId, Path, file, onProgress) {
|
||||
const agentVersion = StateManager.getAgentApiVersion();
|
||||
const url = `${API_ENDPOINT_ENDPOINTS}/${EndpointProvider.endpointID()}/docker${agentVersion > 1 ? '/v' + agentVersion : ''}/browse/put`;
|
||||
const url = `${API_ENDPOINT_ENDPOINTS}/${endpointId}/docker${agentVersion > 1 ? '/v' + agentVersion : ''}/browse/put`;
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
Upload.upload({
|
||||
url: url,
|
||||
data: { file: file, Path: path },
|
||||
data: { file, Path },
|
||||
}).then(resolve, reject, onProgress);
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue