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