Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Léo-Paul Géneau
gitlab-ce
Commits
284cf0bf
Commit
284cf0bf
authored
Mar 08, 2017
by
Shinya Maeda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add name. Improve order_and_sort.
parent
17580029
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
7 deletions
+12
-7
app/finders/pipelines_finder.rb
app/finders/pipelines_finder.rb
+12
-7
No files found.
app/finders/pipelines_finder.rb
View file @
284cf0bf
...
@@ -12,6 +12,7 @@ class PipelinesFinder
...
@@ -12,6 +12,7 @@ class PipelinesFinder
items
=
by_scope
(
items
)
items
=
by_scope
(
items
)
items
=
by_status
(
items
)
items
=
by_status
(
items
)
items
=
by_ref
(
items
)
items
=
by_ref
(
items
)
items
=
by_name
(
items
)
items
=
by_username
(
items
)
items
=
by_username
(
items
)
items
=
by_yaml_errors
(
items
)
items
=
by_yaml_errors
(
items
)
order_and_sort
(
items
)
order_and_sort
(
items
)
...
@@ -107,12 +108,16 @@ class PipelinesFinder
...
@@ -107,12 +108,16 @@ class PipelinesFinder
end
end
def
order_and_sort
(
items
)
def
order_and_sort
(
items
)
if
params
[
:order_by
].
present?
&&
params
[
:sort
].
present?
&&
order_by
=
if
params
[
:order_by
].
present?
&&
items
.
column_names
.
include?
(
params
[
:order_by
])
items
.
column_names
.
include?
(
params
[
:order_by
])
&&
params
[
:order_by
]
params
[
:sort
]
=~
/\A(ASC|DESC)\z/i
else
items
.
reorder
(
params
[
:order_by
]
=>
params
[
:sort
])
:id
else
end
items
.
reorder
(
id: :desc
)
sort
=
if
params
[
:sort
].
present?
&&
params
[
:sort
]
=~
/\A(ASC|DESC)\z/i
end
params
[
:sort
]
else
:desc
end
items
.
reorder
(
order_by
=>
sort
)
end
end
end
end
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