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
8653c2df
Commit
8653c2df
authored
Mar 30, 2017
by
Shinya Maeda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add constant as ALLOWED_INDEXED_COLUMNS
parent
0a36bfa9
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
2 deletions
+4
-2
app/finders/pipelines_finder.rb
app/finders/pipelines_finder.rb
+3
-1
lib/api/pipelines.rb
lib/api/pipelines.rb
+1
-1
No files found.
app/finders/pipelines_finder.rb
View file @
8653c2df
class
PipelinesFinder
class
PipelinesFinder
attr_reader
:project
,
:pipelines
,
:params
attr_reader
:project
,
:pipelines
,
:params
ALLOWED_INDEXED_COLUMNS
=
%w[id status ref user_id]
.
freeze
def
initialize
(
project
,
params
=
{})
def
initialize
(
project
,
params
=
{})
@project
=
project
@project
=
project
@pipelines
=
project
.
pipelines
@pipelines
=
project
.
pipelines
...
@@ -95,7 +97,7 @@ class PipelinesFinder
...
@@ -95,7 +97,7 @@ class PipelinesFinder
end
end
def
sort_items
(
items
)
def
sort_items
(
items
)
order_by
=
if
%w[id status ref user_id]
.
include?
(
params
[
:order_by
])
# Allow only indexed columns
order_by
=
if
ALLOWED_INDEXED_COLUMNS
.
include?
(
params
[
:order_by
])
params
[
:order_by
]
params
[
:order_by
]
else
else
:id
:id
...
...
lib/api/pipelines.rb
View file @
8653c2df
...
@@ -22,7 +22,7 @@ module API
...
@@ -22,7 +22,7 @@ module API
optional
:yaml_errors
,
type:
Boolean
,
desc:
'If true, returns only yaml error pipelines'
optional
:yaml_errors
,
type:
Boolean
,
desc:
'If true, returns only yaml error pipelines'
optional
:name
,
type:
String
,
desc:
'The name of user who triggered pipelines'
optional
:name
,
type:
String
,
desc:
'The name of user who triggered pipelines'
optional
:username
,
type:
String
,
desc:
'The username of user who triggered pipelines'
optional
:username
,
type:
String
,
desc:
'The username of user who triggered pipelines'
optional
:order_by
,
type:
String
,
values:
%w[id status ref user_id]
,
default:
'id'
,
optional
:order_by
,
type:
String
,
values:
PipelinesFinder
::
ALLOWED_INDEXED_COLUMNS
,
default:
'id'
,
desc:
'The order_by which is combined with a sort'
desc:
'The order_by which is combined with a sort'
optional
:sort
,
type:
String
,
values:
%w[asc desc]
,
default:
'desc'
,
optional
:sort
,
type:
String
,
values:
%w[asc desc]
,
default:
'desc'
,
desc:
'The sort method which is combined with an order_by'
desc:
'The sort method which is combined with an order_by'
...
...
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