Dashboard: Display capacity value for Persistent Volume Claims in user friendly format

Created on 7 Sep 2017  路  4Comments  路  Source: kubernetes/dashboard

Environment
Dashboard version: 1.6.3 and latest.
Kubernetes version: 1.7.3
Operating system: Ubuntu 16.04
Node.js version: 6.11.2
Go version: 1.8.3
Steps to reproduce


Go to [Persistent Volume Claims] -> Choose a claim

Observed result


Expected result


Only show values.

Comments


https://github.com/kubernetes/dashboard/blob/584c48deb1f4869610f2fce9501f1f2461f9ef21/src/app/frontend/persistentvolumeclaim/detail/info.html#L30
Replace this line as below:

   <div ng-show="::$ctrl.persistentVolumeClaim.capacity">{{::$ctrl.persistentVolumeClaim.capacity.storage}}</div>

cc @maciaszczykm

help wanted

All 4 comments

It can't be done like that. Capacity object is a map:

// PersistentVolumeClaimStatus is the current status of a persistent volume claim.
type PersistentVolumeClaimStatus struct {
    // Phase represents the current phase of PersistentVolumeClaim.
    // +optional
    Phase PersistentVolumeClaimPhase `json:"phase,omitempty" protobuf:"bytes,1,opt,name=phase,casttype=PersistentVolumeClaimPhase"`
    // AccessModes contains the actual access modes the volume backing the PVC has.
    // More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#access-modes-1
    // +optional
    AccessModes []PersistentVolumeAccessMode `json:"accessModes,omitempty" protobuf:"bytes,2,rep,name=accessModes,casttype=PersistentVolumeAccessMode"`
    // Represents the actual resources of the underlying volume.
    // +optional
    Capacity ResourceList `json:"capacity,omitempty" protobuf:"bytes,3,rep,name=capacity,casttype=ResourceList,castkey=ResourceName"`
}

// ResourceList is a set of (resource name, quantity) pairs.
type ResourceList map[ResourceName]resource.Quantity

In this case resource name is storage so it would work but there might be multiple entries with different names. We could write a component to iterate over map and display it in some other format.

I have changed name of issue to reflect actual requirement.

@floreks Could I use kd-middle-ellipsis to handle? like this:

      <kd-middle-ellipsis ng-repeat="(key, value) in ::$ctrl.persistentVolumeClaim.capacity"
                          display-string="{{::value}}">
      </kd-middle-ellipsis>

I don't think so. Since it is a map of ResourceName -> Quantity then both values should be displayed.

Was this page helpful?
0 / 5 - 0 ratings