Skip to content
Permalink
Browse files

Fix size field formatting on resize and clone pages

  • Loading branch information
subuk committed Nov 25, 2019
1 parent ef8e3ca commit b2647f6fc0b455cbed711eea444fdf556b5ef435
Showing with 8 additions and 4 deletions.
  1. +4 −0 compute/volume.go
  2. +3 −3 templates/volume/clone.html
  3. +1 −1 templates/volume/resize.html
@@ -22,6 +22,10 @@ type Volume struct {
Metadata VolumeMetadata
}

func (v *Volume) SizeMb() uint64 {
return v.Size / 1024 / 1024
}

func (volume *Volume) Base() string {
return filepath.Base(volume.Path)
}
@@ -19,7 +19,7 @@ <h4>Clone Volume {{ .Volume.Path }}</h4>
<label>New Volume Pool</label>
<select required="required" class="form-control" name="Pool">
{{ range .Pools }}
<option value="{{ .Name }}">{{ .Name }} ({{ .FreeGB }}G free {{ .UsagePercent }}% used)</option>
<option value="{{ .Name }}">{{ .Name }} ({{ .Free | HumanizeBytes }} free {{ .UsagePercent }}% used)</option>
{{ end }}
</select>
</div>
@@ -44,8 +44,8 @@ <h4>Clone Volume {{ .Volume.Path }}</h4>
<div class="form-group row">
<div class="col-md-12">
<label>New Volume Size (megabytes)</label>
<input value="{{ .Volume.Size }}" required="required" name="Size" class="form-control" id="Size">
<small id="nameHelp" class="form-text text-muted">Volume can be resized after creation</small>
<input value="{{ .Volume.SizeMb }}" required="required" name="Size" class="form-control" id="Size">
<small id="nameHelp" class="form-text text-muted">LVM volumes cannot be resized after creation</small>
</div>
</div>

@@ -17,7 +17,7 @@ <h4>Resize Volume {{ .Volume.Path }}</h4>
<div class="form-group row">
<div class="col-md-12">
<label>New Volume Size (megabytes)</label>
<input value="{{ .Volume.Size }}" required="required" class="form-control" name="Size" id="Name">
<input value="{{ .Volume.SizeMb }}" required="required" class="form-control" name="Size" id="Name">
<small id="nameHelp" class="form-text text-muted">Volume size can only be increased, current size is {{ .Volume.Size }}M</small>
</div>
</div>

0 comments on commit b2647f6

Please sign in to comment.
You can’t perform that action at this time.