fix(host): show clear host info message [EE-7075] (#12010)

pull/12036/head
Oscar Zhou 2024-07-12 08:45:44 +12:00 committed by GitHub
parent e8af981746
commit 20de243299
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 11 additions and 37 deletions

View File

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

View File

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

View File

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

View File

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

View File

@ -6,10 +6,14 @@
<rd-widget-body> <rd-widget-body>
<form class="form-horizontal" name="$ctrl.form"> <form class="form-horizontal" name="$ctrl.form">
<div class="col-sm-12 form-section-title"> Host and filesystem </div> <div class="col-sm-12 form-section-title"> Host and filesystem </div>
<div ng-if="!$ctrl.isAgent" class="form-group"> <div class="form-group">
<span class="col-sm-12 text-muted small vertical-center"> <span class="col-sm-12 text-muted small vertical-center">
<pr-icon icon="'info'" mode="'primary'" class-name="'space-right'"></pr-icon> <pr-icon icon="'info'" mode="'primary'" class-name="'space-right'"></pr-icon>
These features are only available for an Agent enabled environments. <span class="text-muted"
>The environment must be <a href="https://docs.portainer.io/start/agent">running the Portainer Agent</a> to use this functionality, and the root of the host must be
bind-mounted to <b>/host</b> in the agent deployment. Check
<a href="https://docs.portainer.io/user/docker/host/setup#enable-host-management-features">our documentation</a> for more information.</span
>
</span> </span>
</div> </div>
<div class="form-group"> <div class="form-group">

View File

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

View File

@ -120,6 +120,7 @@ docker service create \\
--constraint 'node.platform.os == linux' \\ --constraint 'node.platform.os == linux' \\
--mount type=bind,src=//var/run/docker.sock,dst=/var/run/docker.sock \\ --mount type=bind,src=//var/run/docker.sock,dst=/var/run/docker.sock \\
--mount type=bind,src=//var/lib/docker/volumes,dst=/var/lib/docker/volumes \\ --mount type=bind,src=//var/lib/docker/volumes,dst=/var/lib/docker/volumes \\
--mount type=bind,src=//,dst=/host \\
portainer/agent:${agentVersion} portainer/agent:${agentVersion}
`; `;
} }