1
0
Fork 0
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:
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

@ -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);
});
}