Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
K
koko
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ops
koko
Commits
43afe52a
Commit
43afe52a
authored
May 15, 2019
by
Eric
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Update] pagination improve
parent
d30a8024
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
23 deletions
+17
-23
Gopkg.lock
Gopkg.lock
+2
-11
pagination.go
pkg/handler/pagination.go
+15
-12
No files found.
Gopkg.lock
View file @
43afe52a
...
...
@@ -104,14 +104,6 @@
revision = "3ee7d812e62a0804a7d0a324e0249ca2db3476d3"
version = "v0.0.4"
[[projects]]
digest = "1:4a49346ca45376a2bba679ca0e83bec949d780d4e927931317904bad482943ec"
name = "github.com/mattn/go-sqlite3"
packages = ["."]
pruneopts = "UT"
revision = "c7c4067b79cc51e6dfdcef5c702e74b1e0fa7c75"
version = "v1.10.0"
[[projects]]
digest = "1:abcdbf03ca6ca13d3697e2186edc1f33863bbdac2b3a44dfa39015e8903f7409"
name = "github.com/olekukonko/tablewriter"
...
...
@@ -180,7 +172,7 @@
[[projects]]
branch = "master"
digest = "1:
ed3d25dee9c9d77611e5ce1bd3a5a078930e8efb31afac120ccb1fbba7ec08d1
"
digest = "1:
1a1855ef6bc1338dd3870260716214046cefd69855c5a5a772d44d2791478abc
"
name = "golang.org/x/sys"
packages = [
"cpu",
...
...
@@ -188,7 +180,7 @@
"windows",
]
pruneopts = "UT"
revision = "
a5b02f93d862f065920dd6a40dddc66b60d0dec4
"
revision = "
3a4b5fb9f71f5874b2374ae059bc0e0bcb52e145
"
[[projects]]
digest = "1:c805e517269b0ba4c21ded5836019ed7d16953d4026cb7d00041d039c7906be9"
...
...
@@ -215,7 +207,6 @@
"github.com/jarcoal/httpmock",
"github.com/kr/pty",
"github.com/leonelquinteros/gotext",
"github.com/mattn/go-sqlite3",
"github.com/olekukonko/tablewriter",
"github.com/pkg/errors",
"github.com/pkg/sftp",
...
...
pkg/handler/pagination.go
View file @
43afe52a
...
...
@@ -166,12 +166,12 @@ func (p *AssetPagination) getColumnMaxSize() {
}
func
(
p
*
AssetPagination
)
PaginationState
()
[]
model
.
Asset
{
if
!
p
.
page
.
HasNextPage
()
{
p
.
displayAssets
()
return
[]
model
.
Asset
{}
}
for
{
if
p
.
page
.
CurrentPage
()
==
1
&&
p
.
page
.
GetPageSize
()
>
len
(
p
.
currentData
)
{
p
.
displayAssets
()
return
[]
model
.
Asset
{}
}
p
.
displayAssets
()
p
.
displayTipsInfo
()
line
,
err
:=
p
.
term
.
ReadLine
()
...
...
@@ -202,18 +202,21 @@ func (p *AssetPagination) PaginationState() []model.Asset {
}
case
"b"
:
return
[]
model
.
Asset
{}
default
:
if
indexID
,
err
:=
strconv
.
Atoi
(
line
);
err
==
nil
{
if
indexID
>
0
&&
indexID
<=
len
(
p
.
currentData
)
{
return
[]
model
.
Asset
{
p
.
currentData
[
indexID
-
1
]}
}
}
}
}
if
indexID
,
err
:=
strconv
.
Atoi
(
line
);
err
==
nil
{
if
indexID
>
0
&&
indexID
<=
p
.
page
.
TotalCount
()
{
return
[]
model
.
Asset
{
p
.
currentData
[
indexID
-
1
]}
default
:
if
indexID
,
err
:=
strconv
.
Atoi
(
line
);
err
==
nil
{
if
indexID
>
0
&&
indexID
<=
len
(
p
.
currentData
)
{
return
[]
model
.
Asset
{
p
.
currentData
[
indexID
-
1
]}
}
}
}
if
p
.
page
.
CurrentPage
()
==
1
&&
p
.
page
.
GetPageSize
()
>
len
(
p
.
currentData
)
{
p
.
displayAssets
()
return
[]
model
.
Asset
{}
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment