1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-08-05 05:45:22 +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

@ -141,8 +141,11 @@ export class HostBrowserController {
return this.$async(this.onFileSelectedForUploadAsync, file);
}
async onFileSelectedForUploadAsync(file) {
if (!this.endpointId) {
throw new Error('missing endpoint id');
}
try {
await this.HostBrowserService.upload(this.state.path, file);
await this.HostBrowserService.upload(this.endpointId, this.state.path, file);
this.onFileUploaded();
} catch (err) {
this.Notifications.error('Failure', err, 'Unable to upload file');

View file

@ -4,4 +4,7 @@ import { HostBrowserController } from './hostBrowserController';
angular.module('portainer.agent').component('hostBrowser', {
controller: HostBrowserController,
templateUrl: './hostBrowser.html',
bindings: {
endpointId: '<',
},
});

View file

@ -9,5 +9,6 @@ angular.module('portainer.agent').component('volumeBrowser', {
volumeId: '<',
nodeName: '<',
isUploadEnabled: '<',
endpointId: '<',
},
});

View file

@ -111,7 +111,7 @@ export class VolumeBrowserController {
}
async onFileSelectedForUploadAsync(file) {
try {
await this.VolumeBrowserService.upload(this.state.path, file, this.volumeId);
await this.VolumeBrowserService.upload(this.endpointId, this.state.path, file, this.volumeId);
this.onFileUploaded();
} catch (err) {
this.Notifications.error('Failure', err, 'Unable to upload file');