1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-08-02 20:35:25 +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

@ -52,7 +52,7 @@ export class HostBrowserController {
}
async getFilesForPathAsync(path) {
try {
const files = await this.HostBrowserService.ls(path);
const files = await this.HostBrowserService.ls(this.endpointId, path);
this.state.path = path;
this.files = files;
} catch (err) {
@ -67,9 +67,9 @@ export class HostBrowserController {
const filePath = this.buildPath(this.state.path, name);
const newFilePath = this.buildPath(this.state.path, newName);
try {
await this.HostBrowserService.rename(filePath, newFilePath);
await this.HostBrowserService.rename(this.endpointId, filePath, newFilePath);
this.Notifications.success('File successfully renamed', this.getRelativePath(newFilePath));
const files = await this.HostBrowserService.ls(this.state.path);
const files = await this.HostBrowserService.ls(this.endpointId, this.state.path);
this.files = files;
} catch (err) {
this.Notifications.error('Failure', err, 'Unable to rename file');
@ -82,7 +82,7 @@ export class HostBrowserController {
async downloadFileAsync(fileName) {
const filePath = this.buildPath(this.state.path, fileName);
try {
const { file } = await this.HostBrowserService.get(filePath);
const { file } = await this.HostBrowserService.get(this.endpointId, filePath);
const downloadData = new Blob([file], {
type: 'text/plain;charset=utf-8',
});
@ -108,9 +108,9 @@ export class HostBrowserController {
}
async deleteFileAsync(path) {
try {
await this.HostBrowserService.delete(path);
await this.HostBrowserService.delete(this.endpointId, path);
this.Notifications.success('File successfully deleted', this.getRelativePath(path));
const files = await this.HostBrowserService.ls(this.state.path);
const files = await this.HostBrowserService.ls(this.endpointId, this.state.path);
this.files = files;
} catch (err) {
this.Notifications.error('Failure', err, 'Unable to delete file');

View file

@ -7,5 +7,6 @@ angular.module('portainer.agent').component('nodeSelector', {
controller: NodeSelectorController,
bindings: {
model: '=',
endpointId: '<',
},
});

View file

@ -6,7 +6,7 @@ export class NodeSelectorController {
async $onInit() {
try {
const agents = await this.AgentService.agents();
const agents = await this.AgentService.agents(this.endpointId);
this.agents = agents;
if (!this.model) {
this.model = agents[0].NodeName;

View file

@ -36,9 +36,9 @@ export class VolumeBrowserController {
const newFilePath = this.state.path === '/' ? newName : `${this.state.path}/${newName}`;
try {
await this.VolumeBrowserService.rename(this.volumeId, filePath, newFilePath);
await this.VolumeBrowserService.rename(this.endpointId, this.volumeId, filePath, newFilePath);
this.Notifications.success('File successfully renamed', newFilePath);
this.files = await this.VolumeBrowserService.ls(this.volumeId, this.state.path);
this.files = await this.VolumeBrowserService.ls(this.endpointId, this.volumeId, this.state.path);
} catch (err) {
this.Notifications.error('Failure', err, 'Unable to rename file');
}
@ -62,7 +62,7 @@ export class VolumeBrowserController {
const filePath = this.state.path === '/' ? file : `${this.state.path}/${file}`;
try {
const data = await this.VolumeBrowserService.get(this.volumeId, filePath);
const data = await this.VolumeBrowserService.get(this.endpointId, this.volumeId, filePath);
const downloadData = new Blob([data.file]);
this.FileSaver.saveAs(downloadData, file);
} catch (err) {
@ -85,9 +85,9 @@ export class VolumeBrowserController {
}
async deleteFileAsync(file) {
try {
await this.VolumeBrowserService.delete(this.volumeId, file);
await this.VolumeBrowserService.delete(this.endpointId, this.volumeId, file);
this.Notifications.success('File successfully deleted', file);
this.files = await this.VolumeBrowserService.ls(this.volumeId, this.state.path);
this.files = await this.VolumeBrowserService.ls(this.endpointId, this.volumeId, this.state.path);
} catch (err) {
this.Notifications.error('Failure', err, 'Unable to delete file');
}
@ -98,7 +98,7 @@ export class VolumeBrowserController {
}
async getFilesForPathAsync(path) {
try {
const files = await this.VolumeBrowserService.ls(this.volumeId, path);
const files = await this.VolumeBrowserService.ls(this.endpointId, this.volumeId, path);
this.state.path = path;
this.files = files;
} catch (err) {
@ -145,7 +145,7 @@ export class VolumeBrowserController {
async $onInit() {
this.HttpRequestHelper.setPortainerAgentTargetHeader(this.nodeName);
try {
this.files = await this.VolumeBrowserService.ls(this.volumeId, this.state.path);
this.files = await this.VolumeBrowserService.ls(this.endpointId, this.volumeId, this.state.path);
} catch (err) {
this.Notifications.error('Failure', err, 'Unable to browse volume');
}