mirror of
https://github.com/cuigh/swirl
synced 2025-05-08 21:59:35 +00:00
Fix volume filtering
This commit is contained in:
parent
adb2874e60
commit
8fecfb5ba2
@ -5,7 +5,7 @@ ADD . .
|
||||
RUN CGO_ENABLED=0 go build -ldflags "-s -w"
|
||||
|
||||
FROM alpine:3.7
|
||||
MAINTAINER cuigh <noname@live.com>
|
||||
LABEL maintainer="cuigh <noname@live.com>"
|
||||
WORKDIR /app
|
||||
COPY --from=build /go/src/github.com/cuigh/swirl/swirl .
|
||||
COPY --from=build /go/src/github.com/cuigh/swirl/config ./config/
|
||||
|
@ -13,7 +13,7 @@ import (
|
||||
)
|
||||
|
||||
// VolumeList return volumes on the host.
|
||||
func VolumeList(pageIndex, pageSize int) (volumes []*types.Volume, totalCount int, err error) {
|
||||
func VolumeList(name string, pageIndex, pageSize int) (volumes []*types.Volume, totalCount int, err error) {
|
||||
var (
|
||||
ctx context.Context
|
||||
cli *client.Client
|
||||
@ -26,9 +26,11 @@ func VolumeList(pageIndex, pageSize int) (volumes []*types.Volume, totalCount in
|
||||
}
|
||||
|
||||
f := filters.NewArgs()
|
||||
f.Add("dangling", "true")
|
||||
//f.Add("dangling", "true")
|
||||
//f.Add("driver", "xx")
|
||||
//f.Add("name", "xx")
|
||||
if name != "" {
|
||||
f.Add("name", name)
|
||||
}
|
||||
resp, err = cli.VolumeList(ctx, f)
|
||||
if err != nil {
|
||||
return
|
||||
|
@ -36,15 +36,15 @@ func Volume() (c *VolumeController) {
|
||||
}
|
||||
|
||||
func volumeList(ctx web.Context) error {
|
||||
//name := ctx.Q("name")
|
||||
name := ctx.Q("name")
|
||||
page := cast.ToInt(ctx.Q("page"), 1)
|
||||
volumes, totalCount, err := docker.VolumeList(page, model.PageSize)
|
||||
volumes, totalCount, err := docker.VolumeList(name, page, model.PageSize)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
m := newPagerModel(ctx, totalCount, model.PageSize, page).
|
||||
//Set("Name", name).
|
||||
Set("Name", name).
|
||||
Set("Volumes", volumes)
|
||||
return ctx.Render("volume/list", m)
|
||||
}
|
||||
|
@ -23,7 +23,7 @@
|
||||
<form>
|
||||
<div class="field has-addons">
|
||||
<p class="control">
|
||||
<input name="name" value="" class="input" placeholder="Search by name">
|
||||
<input name="name" value="{{ .Name }}" class="input" placeholder="Search by name">
|
||||
</p>
|
||||
<p class="control">
|
||||
<button class="button is-primary">{{ i18n("button.search") }}</button>
|
||||
|
Loading…
Reference in New Issue
Block a user