fix(host-info) host info improvement EE-7075 (#11884)

pull/11911/merge
cmeng 2024-06-27 03:18:22 +12:00 committed by GitHub
parent ba4526985a
commit e828615467
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 40 additions and 2 deletions

View File

@ -3,6 +3,7 @@
<host-details-panel
host="$ctrl.hostDetails"
is-browse-enabled="$ctrl.isAgent && $ctrl.agentApiVersion > 1 && $ctrl.hostFeaturesEnabled"
environment-id="$ctrl.environmentId"
browse-url="{{ $ctrl.browseUrl }}"
></host-details-panel>

View File

@ -10,6 +10,7 @@ angular.module('portainer.docker').component('hostOverview', {
refreshUrl: '@',
browseUrl: '@',
hostFeaturesEnabled: '<',
environmentId: '<',
},
transclude: true,
});

View File

@ -15,9 +15,12 @@
<td>{{ device.Name }}</td>
<td>{{ device.Vendor }}</td>
</tr>
<tr ng-if="!$ctrl.devices">
<tr ng-if="$ctrl.devices === undefined">
<td colspan="2" class="text-muted text-center">Loading...</td>
</tr>
<tr ng-if="$ctrl.devices === null">
<td colspan="2" class="text-muted text-center"> Failed to load devices. </td>
</tr>
<tr ng-if="$ctrl.devices.length === 0">
<td colspan="2" class="text-muted text-center"> No device available. </td>
</tr>

View File

@ -0,0 +1,27 @@
const ROOT_PATH = '/host';
export class HostDetailsPanelController {
/* @ngInject */
constructor($async, HostBrowserService) {
Object.assign(this, { $async, HostBrowserService });
this.getFilesForPath = this.getFilesForPath.bind(this);
this.getFilesForPathAsync = this.getFilesForPathAsync.bind(this);
}
getFilesForPath(path) {
return this.$async(this.getFilesForPathAsync, path);
}
async getFilesForPathAsync(path) {
const isBrowseEnabledOrig = this.isBrowseEnabled;
this.isBrowseEnabled = false;
await this.HostBrowserService.ls(this.environmentId, path);
this.isBrowseEnabled = isBrowseEnabledOrig;
}
$onInit() {
this.getFilesForPath(ROOT_PATH);
}
}

View File

@ -1,8 +1,12 @@
import { HostDetailsPanelController } from './host-details-panel-controller';
angular.module('portainer.docker').component('hostDetailsPanel', {
templateUrl: './host-details-panel.html',
controller: HostDetailsPanelController,
bindings: {
host: '<',
isBrowseEnabled: '<',
browseUrl: '@',
environmentId: '<',
},
});

View File

@ -17,7 +17,7 @@ angular.module('portainer.docker').controller('HostViewController', [
this.engineDetails = {};
this.hostDetails = {};
this.devices = null;
this.devices = undefined;
this.disks = null;
function initView() {

View File

@ -8,4 +8,5 @@
refresh-url="docker.host"
browse-url="docker.host.browser"
host-features-enabled="$ctrl.state.enableHostManagementFeatures"
environment-id="$ctrl.endpoint.Id"
></host-overview>

View File

@ -101,6 +101,7 @@ function linuxStandaloneCommand(agentVersion: string, agentSecret: string) {
--restart=always \\
-v /var/run/docker.sock:/var/run/docker.sock \\
-v /var/lib/docker/volumes:/var/lib/docker/volumes \\
-v /:/host \\
portainer/agent:${agentVersion}
`;
}