1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-08-06 22:35:23 +02:00

refactor(environments): remove endpoints cache [DTD-100] (#6408)

This commit is contained in:
Chaim Lev-Ari 2022-11-02 13:29:26 +02:00 committed by GitHub
parent 9ef2e27aae
commit 37d4a80769
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
51 changed files with 155 additions and 353 deletions

View file

@ -15,16 +15,16 @@ function AgentServiceFactory(Agent, AgentVersion1, HttpRequestHelper, Host, Stat
return state.endpoint.agentApiVersion;
}
function hostInfo(nodeName) {
function hostInfo(endpointId, nodeName) {
HttpRequestHelper.setPortainerAgentTargetHeader(nodeName);
return Host.info().$promise;
return Host.info({ endpointId }).$promise;
}
async function agents() {
async function agents(endpointId) {
const agentVersion = getAgentApiVersion();
const service = agentVersion > 1 ? Agent : AgentVersion1;
try {
const agents = await service.query({ version: agentVersion }).$promise;
const agents = await service.query({ version: agentVersion, endpointId }).$promise;
return agents.map(function (item) {
return new AgentViewModel(item);
});

View file

@ -6,24 +6,24 @@ angular.module('portainer.agent').factory('HostBrowserService', HostBrowserServi
function HostBrowserServiceFactory(Browse, Upload, API_ENDPOINT_ENDPOINTS, StateManager) {
return { ls, get, delete: deletePath, rename, upload };
function ls(path) {
return Browse.ls({ path: path }).$promise;
function ls(endpointId, path) {
return Browse.ls({ endpointId, path: path }).$promise;
}
function get(path) {
return Browse.get({ path: path }).$promise;
function get(endpointId, path) {
return Browse.get({ endpointId, path: path }).$promise;
}
function deletePath(path) {
return Browse.delete({ path: path }).$promise;
function deletePath(endpointId, path) {
return Browse.delete({ endpointId, path: path }).$promise;
}
function rename(path, newPath) {
function rename(endpointId, path, newPath) {
const payload = {
CurrentFilePath: path,
NewFilePath: newPath,
};
return Browse.rename({}, payload).$promise;
return Browse.rename({ endpointId }, payload).$promise;
}
function upload(endpointId, Path, file, onProgress) {

View file

@ -5,7 +5,7 @@ angular.module('portainer.agent').service('AgentPingService', AgentPingService);
function AgentPingService(AgentPing) {
return { ping };
function ping() {
return AgentPing.ping().$promise;
function ping(endpointId) {
return AgentPing.ping({ endpointId }).$promise;
}
}

View file

@ -22,24 +22,24 @@ function VolumeBrowserServiceFactory(StateManager, Browse, BrowseVersion1, API_E
return agentVersion > 1 ? Browse : BrowseVersion1;
}
function ls(volumeId, path) {
return getBrowseService().ls({ volumeID: volumeId, path, version: getAgentApiVersion() }).$promise;
function ls(endpointId, volumeId, path) {
return getBrowseService().ls({ endpointId, volumeID: volumeId, path, version: getAgentApiVersion() }).$promise;
}
function get(volumeId, path) {
return getBrowseService().get({ volumeID: volumeId, path, version: getAgentApiVersion() }).$promise;
function get(endpointId, volumeId, path) {
return getBrowseService().get({ endpointId, volumeID: volumeId, path, version: getAgentApiVersion() }).$promise;
}
function deletePath(volumeId, path) {
return getBrowseService().delete({ volumeID: volumeId, path, version: getAgentApiVersion() }).$promise;
function deletePath(endpointId, volumeId, path) {
return getBrowseService().delete({ endpointId, volumeID: volumeId, path, version: getAgentApiVersion() }).$promise;
}
function rename(volumeId, path, newPath) {
function rename(endpointId, volumeId, path, newPath) {
const payload = {
CurrentFilePath: path,
NewFilePath: newPath,
};
return getBrowseService().rename({ volumeID: volumeId, version: getAgentApiVersion() }, payload).$promise;
return getBrowseService().rename({ endpointId, volumeID: volumeId, version: getAgentApiVersion() }, payload).$promise;
}
function upload(endpointId, path, file, volumeId, onProgress) {