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
Boxiang Sun
gitlab-ce
Commits
e17f0e9e
Commit
e17f0e9e
authored
Dec 21, 2017
by
Matija Čupić
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add reset cache button to pipelines view
parent
1eb207f3
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
42 additions
and
4 deletions
+42
-4
app/assets/javascripts/pipelines/components/nav_controls.vue
app/assets/javascripts/pipelines/components/nav_controls.vue
+10
-0
app/assets/javascripts/pipelines/components/pipelines.vue
app/assets/javascripts/pipelines/components/pipelines.vue
+2
-0
app/views/projects/pipelines/index.html.haml
app/views/projects/pipelines/index.html.haml
+2
-1
spec/javascripts/fixtures/pipelines.html.haml
spec/javascripts/fixtures/pipelines.html.haml
+3
-1
spec/javascripts/pipelines/nav_controls_spec.js
spec/javascripts/pipelines/nav_controls_spec.js
+25
-2
No files found.
app/assets/javascripts/pipelines/components/nav_controls.vue
View file @
e17f0e9e
...
...
@@ -17,6 +17,11 @@ export default {
required
:
true
,
},
resetCachePath
:
{
type
:
String
,
required
:
true
,
},
ciLintPath
:
{
type
:
String
,
required
:
true
,
...
...
@@ -45,6 +50,11 @@ export default {
Get started with Pipelines
</a>
<a
:href=
"resetCachePath"
class=
"btn btn-default"
>
Clear runner caches
</a>
<a
:href=
"ciLintPath"
class=
"btn btn-default"
>
...
...
app/assets/javascripts/pipelines/components/pipelines.vue
View file @
e17f0e9e
...
...
@@ -50,6 +50,7 @@
canCreatePipeline
:
pipelinesData
.
canCreatePipeline
,
hasCi
:
pipelinesData
.
hasCi
,
ciLintPath
:
pipelinesData
.
ciLintPath
,
resetCachePath
:
pipelinesData
.
resetCachePath
,
state
:
this
.
store
.
state
,
scope
:
getParameterByName
(
'
scope
'
)
||
'
all
'
,
page
:
getParameterByName
(
'
page
'
)
||
'
1
'
,
...
...
@@ -220,6 +221,7 @@
:new-pipeline-path=
"newPipelinePath"
:has-ci-enabled=
"hasCiEnabled"
:help-page-path=
"helpPagePath"
:resetCachePath=
"resetCachePath"
:ci-lint-path=
"ciLintPath"
:can-create-pipeline=
"canCreatePipelineParsed "
/>
...
...
app/views/projects/pipelines/index.html.haml
View file @
e17f0e9e
...
...
@@ -10,7 +10,8 @@
"new-pipeline-path"
=>
new_project_pipeline_path
(
@project
),
"can-create-pipeline"
=>
can?
(
current_user
,
:create_pipeline
,
@project
).
to_s
,
"has-ci"
=>
@repository
.
gitlab_ci_yml
,
"ci-lint-path"
=>
ci_lint_path
}
}
"ci-lint-path"
=>
ci_lint_path
,
"reset-cache-path"
=>
reset_cache_project_path
(
@project
)
}
}
=
page_specific_javascript_bundle_tag
(
'common_vue'
)
=
page_specific_javascript_bundle_tag
(
'pipelines'
)
spec/javascripts/fixtures/pipelines.html.haml
View file @
e17f0e9e
...
...
@@ -7,4 +7,6 @@
"new-pipeline-path"
=>
'foo'
,
"can-create-pipeline"
=>
'true'
,
"has-ci"
=>
'foo'
,
"ci-lint-path"
=>
'foo'
}
}
"ci-lint-path"
=>
'foo'
,
"reset-cache-path"
=>
'foo'
}
}
spec/javascripts/pipelines/nav_controls_spec.js
View file @
e17f0e9e
...
...
@@ -14,6 +14,7 @@ describe('Pipelines Nav Controls', () => {
hasCiEnabled
:
true
,
helpPagePath
:
'
foo
'
,
ciLintPath
:
'
foo
'
,
resetCachePath
:
'
foo
'
,
canCreatePipeline
:
true
,
};
...
...
@@ -31,6 +32,7 @@ describe('Pipelines Nav Controls', () => {
hasCiEnabled
:
true
,
helpPagePath
:
'
foo
'
,
ciLintPath
:
'
foo
'
,
resetCachePath
:
'
foo
'
,
canCreatePipeline
:
false
,
};
...
...
@@ -41,12 +43,31 @@ describe('Pipelines Nav Controls', () => {
expect
(
component
.
$el
.
querySelector
(
'
.btn-create
'
)).
toEqual
(
null
);
});
it
(
'
should render link for resetting runner caches
'
,
()
=>
{
const
mockData
=
{
newPipelinePath
:
'
foo
'
,
hasCiEnabled
:
true
,
helpPagePath
:
'
foo
'
,
ciLintPath
:
'
foo
'
,
resetCachePath
:
'
foo
'
,
canCreatePipeline
:
false
,
};
const
component
=
new
NavControlsComponent
({
propsData
:
mockData
,
}).
$mount
();
expect
(
component
.
$el
.
querySelectorAll
(
'
.btn-default
'
)[
0
].
textContent
).
toContain
(
'
Reset runner caches
'
);
expect
(
component
.
$el
.
querySelectorAll
(
'
.btn-default
'
)[
0
].
getAttribute
(
'
href
'
)).
toEqual
(
mockData
.
resetCachePath
);
});
it
(
'
should render link for CI lint
'
,
()
=>
{
const
mockData
=
{
newPipelinePath
:
'
foo
'
,
hasCiEnabled
:
true
,
helpPagePath
:
'
foo
'
,
ciLintPath
:
'
foo
'
,
resetCachePath
:
'
foo
'
,
canCreatePipeline
:
true
,
};
...
...
@@ -54,8 +75,8 @@ describe('Pipelines Nav Controls', () => {
propsData
:
mockData
,
}).
$mount
();
expect
(
component
.
$el
.
querySelector
(
'
.btn-default
'
)
.
textContent
).
toContain
(
'
CI Lint
'
);
expect
(
component
.
$el
.
querySelector
(
'
.btn-default
'
)
.
getAttribute
(
'
href
'
)).
toEqual
(
mockData
.
ciLintPath
);
expect
(
component
.
$el
.
querySelector
All
(
'
.btn-default
'
)[
1
]
.
textContent
).
toContain
(
'
CI Lint
'
);
expect
(
component
.
$el
.
querySelector
All
(
'
.btn-default
'
)[
1
]
.
getAttribute
(
'
href
'
)).
toEqual
(
mockData
.
ciLintPath
);
});
it
(
'
should render link to help page when CI is not enabled
'
,
()
=>
{
...
...
@@ -64,6 +85,7 @@ describe('Pipelines Nav Controls', () => {
hasCiEnabled
:
false
,
helpPagePath
:
'
foo
'
,
ciLintPath
:
'
foo
'
,
resetCachePath
:
'
foo
'
,
canCreatePipeline
:
true
,
};
...
...
@@ -81,6 +103,7 @@ describe('Pipelines Nav Controls', () => {
hasCiEnabled
:
true
,
helpPagePath
:
'
foo
'
,
ciLintPath
:
'
foo
'
,
resetCachePath
:
'
foo
'
,
canCreatePipeline
:
true
,
};
...
...
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