fix(helm,tiller): change list offset to next result

Previously, paging used the last release name of the current set to ask
for more results. Now switched to using the first name of the next set.

Not sure I like this method. It makes the user experience more
complicated.
pull/669/head
Matt Butcher 8 years ago
parent 6844d3b493
commit a8642c81fc

@ -63,9 +63,9 @@ message ListReleasesRequest {
// Offset is the last release name that was seen. The next listing
// operation will start with the name after this one.
// Example: If list one returns albert, bernie, carl and we supply
// carl as the offset, the next one should begin with the next release name
// after carl (e.g. dennis).
// Example: If list one returns albert, bernie, carl, and sets 'next: dennis'.
// dennis is the offset. Supplying 'dennis' for the next request should
// cause the next batch to return a set of results starting with 'dennis'.
string offset = 2;
// SortBy is the sort field that the ListReleases server should sort data before returning.
@ -100,17 +100,15 @@ message ListReleasesResponse {
// Count is the expected total number of releases to be returned.
int64 count = 1;
// Offset is the last-seen release name, used to offset the next set.
string offset = 2;
// Next is the name of the next release. If this is other than an empty
// string, it means there are more results.
string next = 2;
// Total is the total number of queryable releases.
int64 total = 3;
// Releases is the list of found release objects.
repeated hapi.release.Release releases = 4;
// More indicates whether there are more objects to retrieve.
bool more = 5;
}
// GetReleaseStatusRequest is a request to get the status of a release.

@ -57,7 +57,7 @@ func init() {
f.BoolVarP(&listByDate, "date", "d", false, "sort by release date")
f.BoolVarP(&listSortDesc, "reverse", "r", false, "reverse the sort order")
f.IntVarP(&listMax, "max", "m", 256, "maximum number of releases to fetch")
f.StringVarP(&listOffset, "offset", "o", "", "the last seen release name, used to offset from start value")
f.StringVarP(&listOffset, "offset", "o", "", "the next release name in the list, used to offset from start value")
RootCommand.AddCommand(listCommand)
}
@ -83,6 +83,10 @@ func listCmd(cmd *cobra.Command, args []string) error {
return prettyError(err)
}
if res.Next != "" {
fmt.Printf("\tnext: %s", res.Next)
}
rels := res.Releases
if listLong {
return formatList(rels)

@ -44,7 +44,6 @@ var (
var ListDefaultLimit int64 = 512
func (s *releaseServer) ListReleases(req *services.ListReleasesRequest, stream services.ReleaseService_ListReleasesServer) error {
more := false
rels, err := s.env.Releases.List()
if err != nil {
return err
@ -81,7 +80,7 @@ func (s *releaseServer) ListReleases(req *services.ListReleasesRequest, stream s
i := -1
for ii, cur := range rels {
if cur.Name == req.Offset {
i = ii + 1
i = ii
}
}
if i == -1 {
@ -100,22 +99,18 @@ func (s *releaseServer) ListReleases(req *services.ListReleasesRequest, stream s
req.Limit = ListDefaultLimit
}
next := ""
if l > req.Limit {
more = true
next = rels[req.Limit].Name
rels = rels[0:req.Limit]
l = int64(len(rels))
}
last := ""
if l > 0 {
last = rels[l-1].Name
}
res := &services.ListReleasesResponse{
Offset: last,
Next: next,
Count: l,
Total: total,
Releases: rels,
More: more,
}
stream.Send(res)
return nil

@ -135,14 +135,13 @@ func (*ListSort) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1}
type ListReleasesResponse struct {
// Count is the expected total number of releases to be returned.
Count int64 `protobuf:"varint,1,opt,name=count" json:"count,omitempty"`
// Offset is the last-seen release name, used to offset the next set.
Offset string `protobuf:"bytes,2,opt,name=offset" json:"offset,omitempty"`
// Next is the name of the next release. If this is other than an empty
// string, it means there are more results.
Next string `protobuf:"bytes,2,opt,name=next" json:"next,omitempty"`
// Total is the total number of queryable releases.
Total int64 `protobuf:"varint,3,opt,name=total" json:"total,omitempty"`
// Releases is the list of found release objects.
Releases []*hapi_release2.Release `protobuf:"bytes,4,rep,name=releases" json:"releases,omitempty"`
// More indicates whether there are more objects to retrieve.
More bool `protobuf:"varint,5,opt,name=more" json:"more,omitempty"`
}
func (m *ListReleasesResponse) Reset() { *m = ListReleasesResponse{} }
@ -583,49 +582,48 @@ var _ReleaseService_serviceDesc = grpc.ServiceDesc{
}
var fileDescriptor0 = []byte{
// 689 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x9c, 0x55, 0xdd, 0x6e, 0xd3, 0x4c,
0x10, 0xad, 0x9b, 0x34, 0x3f, 0xd3, 0xaf, 0x55, 0x3a, 0x5f, 0x9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, 0x9a, 0x14, 0x72, 0xe5, 0xb5, 0x85, 0x1c, 0x1a, 0x8b, 0x3d, 0x8d, 0x7b, 0xf9,
0x31, 0x0a, 0x46, 0xc5, 0x76, 0x96, 0xa5, 0x1b, 0x59, 0xbc, 0x81, 0xad, 0x7b, 0x0d, 0x8c, 0xff,
0x0c, 0x93, 0x9d, 0x0c, 0xbb, 0xbb, 0x34, 0x3f, 0xd5, 0xfd, 0x06, 0x1b, 0x99, 0x96, 0xc6, 0x02,
0xb7, 0xf2, 0xe6, 0xc1, 0x7e, 0xb9, 0x14, 0x37, 0xd5, 0x9a, 0xc2, 0x66, 0xb6, 0x3b, 0xb1, 0x20,
0x40, 0xee, 0x28, 0xd9, 0xaf, 0x96, 0x23, 0xa7, 0x72, 0xb2, 0x8e, 0x8b, 0x2d, 0x59, 0x54, 0xc7,
0x82, 0x4e, 0x2f, 0xaa, 0x63, 0x51, 0xa7, 0x93, 0x95, 0x7d, 0xf8, 0x5c, 0x33, 0xec, 0x8b, 0x8a,
0xfa, 0xf7, 0x7c, 0xfb, 0x27, 0x00, 0x00, 0xff, 0xff, 0x81, 0xdd, 0x53, 0x62, 0xd7, 0x07, 0x00,
0x00,
// 682 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x9c, 0x55, 0xdd, 0x4e, 0x13, 0x41,
0x14, 0x66, 0x69, 0x69, 0xcb, 0x41, 0x48, 0x39, 0x96, 0xb6, 0xee, 0x85, 0x31, 0x93, 0xa8, 0x88,
0xb2, 0xd5, 0x7a, 0x6f, 0x52, 0xa0, 0x21, 0x84, 0x5a, 0x92, 0xa9, 0x68, 0xe2, 0x85, 0x64, 0x81,
0xa9, 0xac, 0x59, 0x76, 0xeb, 0xce, 0x94, 0xc8, 0x03, 0x78, 0xe1, 0x1b, 0xf9, 0x40, 0x3e, 0x88,
0xb3, 0x33, 0x3b, 0x1b, 0xb6, 0xdd, 0xd5, 0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