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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
1eda0077
Commit
1eda0077
authored
May 20, 2020
by
pburdette
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Validate query params
Validate query params and clean up the code. Also updated a few specs.
parent
84b93dc1
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
16 additions
and
39 deletions
+16
-39
app/assets/javascripts/pipelines/components/pipelines.vue
app/assets/javascripts/pipelines/components/pipelines.vue
+7
-12
app/assets/javascripts/pipelines/components/pipelines_filtered_search.vue
...cripts/pipelines/components/pipelines_filtered_search.vue
+5
-24
app/assets/javascripts/pipelines/constants.js
app/assets/javascripts/pipelines/constants.js
+1
-0
spec/frontend/pipelines/components/pipelines_filtered_search_spec.js
...nd/pipelines/components/pipelines_filtered_search_spec.js
+1
-3
spec/frontend/pipelines/tokens/pipeline_branch_name_token_spec.js
...ntend/pipelines/tokens/pipeline_branch_name_token_spec.js
+1
-0
spec/frontend/pipelines/tokens/pipeline_trigger_author_token_spec.js
...nd/pipelines/tokens/pipeline_trigger_author_token_spec.js
+1
-0
No files found.
app/assets/javascripts/pipelines/components/pipelines.vue
View file @
1eda0077
<
script
>
<
script
>
import
{
isEqual
}
from
'
lodash
'
;
import
{
isEqual
,
pickBy
}
from
'
lodash
'
;
import
{
__
,
sprintf
,
s__
}
from
'
../../locale
'
;
import
{
__
,
sprintf
,
s__
}
from
'
../../locale
'
;
import
createFlash
from
'
../../flash
'
;
import
createFlash
from
'
../../flash
'
;
import
PipelinesService
from
'
../services/pipelines_service
'
;
import
PipelinesService
from
'
../services/pipelines_service
'
;
...
@@ -10,7 +10,7 @@ import NavigationControls from './nav_controls.vue';
...
@@ -10,7 +10,7 @@ import NavigationControls from './nav_controls.vue';
import
{
getParameterByName
}
from
'
../../lib/utils/common_utils
'
;
import
{
getParameterByName
}
from
'
../../lib/utils/common_utils
'
;
import
CIPaginationMixin
from
'
../../vue_shared/mixins/ci_pagination_api_mixin
'
;
import
CIPaginationMixin
from
'
../../vue_shared/mixins/ci_pagination_api_mixin
'
;
import
PipelinesFilteredSearch
from
'
./pipelines_filtered_search.vue
'
;
import
PipelinesFilteredSearch
from
'
./pipelines_filtered_search.vue
'
;
import
{
ANY_TRIGGER_AUTHOR
,
RAW_TEXT_WARNING
}
from
'
../constants
'
;
import
{
ANY_TRIGGER_AUTHOR
,
RAW_TEXT_WARNING
,
SUPPORTED_FILTER_PARAMETERS
}
from
'
../constants
'
;
import
glFeatureFlagsMixin
from
'
~/vue_shared/mixins/gl_feature_flags_mixin
'
;
import
glFeatureFlagsMixin
from
'
~/vue_shared/mixins/gl_feature_flags_mixin
'
;
export
default
{
export
default
{
...
@@ -224,20 +224,15 @@ export default {
...
@@ -224,20 +224,15 @@ export default {
canFilterPipelines
()
{
canFilterPipelines
()
{
return
this
.
glFeatures
.
filterPipelinesSearch
;
return
this
.
glFeatures
.
filterPipelinesSearch
;
},
},
validatedParams
()
{
return
pickBy
(
this
.
params
,
(
val
,
key
)
=>
SUPPORTED_FILTER_PARAMETERS
.
includes
(
key
)
&&
val
);
},
},
},
created
()
{
created
()
{
const
{
username
,
ref
}
=
this
.
params
;
this
.
service
=
new
PipelinesService
(
this
.
endpoint
);
this
.
service
=
new
PipelinesService
(
this
.
endpoint
);
this
.
requestData
=
{
page
:
this
.
page
,
scope
:
this
.
scope
};
this
.
requestData
=
{
page
:
this
.
page
,
scope
:
this
.
scope
};
if
(
username
)
{
Object
.
assign
(
this
.
requestData
,
this
.
validatedParams
);
this
.
requestData
.
username
=
username
;
}
if
(
ref
)
{
this
.
requestData
.
ref
=
ref
;
}
},
},
methods
:
{
methods
:
{
successCallback
(
resp
)
{
successCallback
(
resp
)
{
...
@@ -320,7 +315,7 @@ export default {
...
@@ -320,7 +315,7 @@ export default {
v-if=
"canFilterPipelines"
v-if=
"canFilterPipelines"
:pipelines=
"state.pipelines"
:pipelines=
"state.pipelines"
:project-id=
"projectId"
:project-id=
"projectId"
:params=
"
p
arams"
:params=
"
validatedP
arams"
@
filterPipelines=
"filterPipelines"
@
filterPipelines=
"filterPipelines"
/>
/>
...
...
app/assets/javascripts/pipelines/components/pipelines_filtered_search.vue
View file @
1eda0077
...
@@ -3,6 +3,7 @@ import { GlFilteredSearch } from '@gitlab/ui';
...
@@ -3,6 +3,7 @@ import { GlFilteredSearch } from '@gitlab/ui';
import
{
__
,
s__
}
from
'
~/locale
'
;
import
{
__
,
s__
}
from
'
~/locale
'
;
import
PipelineTriggerAuthorToken
from
'
./tokens/pipeline_trigger_author_token.vue
'
;
import
PipelineTriggerAuthorToken
from
'
./tokens/pipeline_trigger_author_token.vue
'
;
import
PipelineBranchNameToken
from
'
./tokens/pipeline_branch_name_token.vue
'
;
import
PipelineBranchNameToken
from
'
./tokens/pipeline_branch_name_token.vue
'
;
import
{
map
}
from
'
lodash
'
;
export
default
{
export
default
{
components
:
{
components
:
{
...
@@ -46,30 +47,10 @@ export default {
...
@@ -46,30 +47,10 @@ export default {
];
];
},
},
paramsValue
()
{
paramsValue
()
{
const
valueArray
=
[];
return
map
(
this
.
params
,
(
val
,
key
)
=>
({
const
{
username
,
ref
}
=
this
.
params
;
type
:
key
,
value
:
{
data
:
val
,
operator
:
'
=
'
},
if
(
username
)
{
}));
valueArray
.
push
({
type
:
'
username
'
,
value
:
{
data
:
username
,
operator
:
'
=
'
,
},
});
}
if
(
ref
)
{
valueArray
.
push
({
type
:
'
ref
'
,
value
:
{
data
:
ref
,
operator
:
'
=
'
,
},
});
}
return
valueArray
;
},
},
},
},
methods
:
{
methods
:
{
...
...
app/assets/javascripts/pipelines/constants.js
View file @
1eda0077
...
@@ -5,6 +5,7 @@ export const PIPELINES_TABLE = 'PIPELINES_TABLE';
...
@@ -5,6 +5,7 @@ export const PIPELINES_TABLE = 'PIPELINES_TABLE';
export
const
LAYOUT_CHANGE_DELAY
=
300
;
export
const
LAYOUT_CHANGE_DELAY
=
300
;
export
const
FILTER_PIPELINES_SEARCH_DELAY
=
200
;
export
const
FILTER_PIPELINES_SEARCH_DELAY
=
200
;
export
const
ANY_TRIGGER_AUTHOR
=
'
Any
'
;
export
const
ANY_TRIGGER_AUTHOR
=
'
Any
'
;
export
const
SUPPORTED_FILTER_PARAMETERS
=
[
'
username
'
,
'
ref
'
];
export
const
TestStatus
=
{
export
const
TestStatus
=
{
FAILED
:
'
failed
'
,
FAILED
:
'
failed
'
,
...
...
spec/frontend/pipelines/components/pipelines_filtered_search_spec.js
View file @
1eda0077
...
@@ -78,10 +78,8 @@ describe('Pipelines filtered search', () => {
...
@@ -78,10 +78,8 @@ describe('Pipelines filtered search', () => {
describe
(
'
Url query params
'
,
()
=>
{
describe
(
'
Url query params
'
,
()
=>
{
const
params
=
{
const
params
=
{
page
:
'
1
'
,
ref
:
'
master
'
,
scope
:
'
all
'
,
username
:
'
deja.green
'
,
username
:
'
deja.green
'
,
ref
:
'
master
'
,
};
};
beforeEach
(()
=>
{
beforeEach
(()
=>
{
...
...
spec/frontend/pipelines/tokens/pipeline_branch_name_token_spec.js
View file @
1eda0077
...
@@ -65,6 +65,7 @@ describe('Pipeline Branch Name Token', () => {
...
@@ -65,6 +65,7 @@ describe('Pipeline Branch Name Token', () => {
expect
(
Api
.
branches
).
toHaveBeenCalled
();
expect
(
Api
.
branches
).
toHaveBeenCalled
();
expect
(
wrapper
.
vm
.
branches
).
toEqual
(
mockBranchesAfterMap
);
expect
(
wrapper
.
vm
.
branches
).
toEqual
(
mockBranchesAfterMap
);
expect
(
findLoadingIcon
().
exists
()).
toBe
(
false
);
});
});
describe
(
'
displays loading icon correctly
'
,
()
=>
{
describe
(
'
displays loading icon correctly
'
,
()
=>
{
...
...
spec/frontend/pipelines/tokens/pipeline_trigger_author_token_spec.js
View file @
1eda0077
...
@@ -64,6 +64,7 @@ describe('Pipeline Trigger Author Token', () => {
...
@@ -64,6 +64,7 @@ describe('Pipeline Trigger Author Token', () => {
expect
(
Api
.
projectUsers
).
toHaveBeenCalled
();
expect
(
Api
.
projectUsers
).
toHaveBeenCalled
();
expect
(
wrapper
.
vm
.
users
).
toEqual
(
users
);
expect
(
wrapper
.
vm
.
users
).
toEqual
(
users
);
expect
(
findLoadingIcon
().
exists
()).
toBe
(
false
);
});
});
describe
(
'
displays loading icon correctly
'
,
()
=>
{
describe
(
'
displays loading icon correctly
'
,
()
=>
{
...
...
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