feat(area/kubernetes): show shared access policy in volume details (#4707)

pull/4724/head
DarkAEther 4 years ago committed by GitHub
parent 121d33538d
commit 15aed9fc6f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -37,6 +37,17 @@
<td>Storage</td>
<td>{{ ctrl.volume.PersistentVolumeClaim.StorageClass.Name }}</td>
</tr>
<tr>
<td>Shared Access Policy</td>
<td
>{{ ctrl.state.volumeSharedAccessPolicy }}
<portainer-tooltip
position="bottom"
ng-if="ctrl.state.volumeSharedAccessPolicyTooltip"
message="{{ ctrl.state.volumeSharedAccessPolicyTooltip }}"
></portainer-tooltip
></td>
</tr>
<tr>
<td>Provisioner</td>
<td>{{ ctrl.volume.PersistentVolumeClaim.StorageClass.Provisioner ? ctrl.volume.PersistentVolumeClaim.StorageClass.Provisioner : '-' }}</td>

@ -2,6 +2,7 @@ import angular from 'angular';
import _ from 'lodash-es';
import KubernetesVolumeHelper from 'Kubernetes/helpers/volumeHelper';
import KubernetesEventHelper from 'Kubernetes/helpers/eventHelper';
import { KubernetesStorageClassAccessPolicies } from 'Kubernetes/models/storage-class/models';
import filesizeParser from 'filesize-parser';
class KubernetesVolumeController {
@ -179,6 +180,8 @@ class KubernetesVolumeController {
volumeSize: 0,
volumeSizeUnit: 'GB',
volumeSizeError: false,
volumeSharedAccessPolicy: '',
volumeSharedAccessPolicyTooltip: '',
};
this.state.activeTab = this.LocalStorage.getActiveTab('volume');
@ -186,6 +189,16 @@ class KubernetesVolumeController {
try {
await this.getVolume();
await this.getEvents();
if (this.volume.PersistentVolumeClaim.StorageClass !== undefined) {
this.state.volumeSharedAccessPolicy = this.volume.PersistentVolumeClaim.StorageClass.AccessModes[this.volume.PersistentVolumeClaim.StorageClass.AccessModes.length - 1];
let policies = KubernetesStorageClassAccessPolicies();
policies.forEach((policy) => {
if (policy.Name == this.state.volumeSharedAccessPolicy) {
this.state.volumeSharedAccessPolicyTooltip = policy.Description;
}
});
}
} catch (err) {
this.Notifications.error('Failure', err, 'Unable to load view data');
} finally {

Loading…
Cancel
Save