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
d3732b55
Commit
d3732b55
authored
Mar 14, 2017
by
Filipa Lacerda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Moves tabs into Vue Component
parent
d51a5f0b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
146 additions
and
75 deletions
+146
-75
app/assets/javascripts/vue_pipelines_index/index.js
app/assets/javascripts/vue_pipelines_index/index.js
+2
-8
app/assets/javascripts/vue_pipelines_index/pipelines.js
app/assets/javascripts/vue_pipelines_index/pipelines.js
+127
-17
app/views/projects/pipelines/index.html.haml
app/views/projects/pipelines/index.html.haml
+17
-50
No files found.
app/assets/javascripts/vue_pipelines_index/index.js
View file @
d3732b55
...
@@ -7,13 +7,10 @@ require('../vue_shared/vue_resource_interceptor');
...
@@ -7,13 +7,10 @@ require('../vue_shared/vue_resource_interceptor');
require
(
'
./pipelines
'
);
require
(
'
./pipelines
'
);
$
(()
=>
new
Vue
({
$
(()
=>
new
Vue
({
el
:
document
.
querySelector
(
'
.vue-pipelines-index
'
),
el
:
document
.
querySelector
(
'
#pipelines-list-vue
'
),
data
()
{
data
()
{
const
project
=
document
.
querySelector
(
'
.pipelines
'
);
return
{
return
{
scope
:
project
.
dataset
.
url
,
store
:
new
gl
.
PipelineStore
(),
store
:
new
gl
.
PipelineStore
(),
};
};
},
},
...
@@ -21,9 +18,6 @@ $(() => new Vue({
...
@@ -21,9 +18,6 @@ $(() => new Vue({
'
vue-pipelines
'
:
gl
.
VuePipelines
,
'
vue-pipelines
'
:
gl
.
VuePipelines
,
},
},
template
:
`
template
:
`
<vue-pipelines
<vue-pipelines :store="store"/>
:scope="scope"
:store="store">
</vue-pipelines>
`
,
`
,
}));
}));
app/assets/javascripts/vue_pipelines_index/pipelines.js
View file @
d3732b55
...
@@ -18,10 +18,11 @@ const CommitPipelinesStoreWithTimeAgo = require('../commit/pipelines/pipelines_s
...
@@ -18,10 +18,11 @@ const CommitPipelinesStoreWithTimeAgo = require('../commit/pipelines/pipelines_s
},
},
data
()
{
data
()
{
const
pipelinesData
=
document
.
querySelector
(
'
#pipelines-list-vue
'
).
dataset
;
return
{
return
{
...
pipelinesData
,
pipelines
:
[],
pipelines
:
[],
timeLoopInterval
:
''
,
intervalId
:
''
,
apiScope
:
'
all
'
,
apiScope
:
'
all
'
,
pageInfo
:
{},
pageInfo
:
{},
pagenum
:
1
,
pagenum
:
1
,
...
@@ -39,7 +40,7 @@ const CommitPipelinesStoreWithTimeAgo = require('../commit/pipelines/pipelines_s
...
@@ -39,7 +40,7 @@ const CommitPipelinesStoreWithTimeAgo = require('../commit/pipelines/pipelines_s
if
(
pagenum
)
this
.
pagenum
=
pagenum
;
if
(
pagenum
)
this
.
pagenum
=
pagenum
;
if
(
scope
)
this
.
apiScope
=
scope
;
if
(
scope
)
this
.
apiScope
=
scope
;
this
.
store
.
fetchDataLoop
.
call
(
this
,
Vue
,
this
.
pagenum
,
this
.
scope
,
this
.
apiScope
);
this
.
store
.
fetchDataLoop
.
call
(
this
,
Vue
,
this
.
pagenum
,
this
.
endpoint
,
this
.
apiScope
);
},
},
beforeUpdate
()
{
beforeUpdate
()
{
...
@@ -49,12 +50,56 @@ const CommitPipelinesStoreWithTimeAgo = require('../commit/pipelines/pipelines_s
...
@@ -49,12 +50,56 @@ const CommitPipelinesStoreWithTimeAgo = require('../commit/pipelines/pipelines_s
},
},
computed
:
{
computed
:
{
canCreatePipelineParsed
()
{
return
gl
.
utils
.
convertPermissionToBoolean
(
this
.
canCreatePipeline
);
},
scope
()
{
return
gl
.
utils
.
getParameterByName
(
'
scope
'
);
},
shouldRenderErrorState
()
{
shouldRenderErrorState
()
{
return
this
.
hasError
&&
!
this
.
pageRequest
;
return
this
.
hasError
&&
!
this
.
pageRequest
;
},
},
/**
* The empty state should only be rendered when the request is made to fetch all pipelines
* and none is returned.
*
* @return {Boolean}
*/
shouldRenderEmptyState
()
{
shouldRenderEmptyState
()
{
return
!
this
.
hasError
&&
!
this
.
pageRequest
&&
!
this
.
pipelines
.
length
;
return
!
this
.
hasError
&&
!
this
.
pageRequest
&&
(
!
this
.
pipelines
.
length
&&
(
this
.
scope
===
'
all
'
||
this
.
scope
===
null
)
);
},
shouldRenderTable
()
{
return
!
this
.
hasError
&&
!
this
.
pageRequest
&&
this
.
pipelines
.
length
;
},
/**
* Header tabs should only be rendered when we receive an error or a successfull response with
* pipelines.
*
* @return {Boolean}
*/
shouldRenderTabs
()
{
return
!
this
.
pageRequest
&&
!
this
.
hasError
&&
this
.
pipelines
.
length
;
},
/**
* Pagination should only be rendered when there is more than one page.
*
* @return {Boolean}
*/
shouldRenderPagination
()
{
return
!
this
.
pageRequest
&&
this
.
pipelines
.
length
&&
this
.
pageInfo
.
total
>
this
.
pageInfo
.
perPage
;
},
},
},
},
...
@@ -72,14 +117,80 @@ const CommitPipelinesStoreWithTimeAgo = require('../commit/pipelines/pipelines_s
...
@@ -72,14 +117,80 @@ const CommitPipelinesStoreWithTimeAgo = require('../commit/pipelines/pipelines_s
},
},
},
},
template
:
`
template
:
`
<div>
<div :class="cssClass">
<div class="pipelines realtime-loading" v-if='pageRequest'>
<div class="top-area" v-if="!shouldRenderEmptyState">
<i class="fa fa-spinner fa-spin"></i>
<ul
class="nav-links">
<li :class="{ 'active': scope === null || scope === 'all'}">
<a :href="allPath">
All
</a>
<span class="badge js-totalbuilds-count">
</span>
</li>
<li
class="js-pipelines-tab-pending"
:class="{ 'active': scope === 'pending'}">
<a :href="pendingPath">
Pending
</a>
<span class="badge"></span>
</li>
<li
class="js-pipelines-tab-running"
:class="{ 'active': scope === 'running'}">
<a :href="runningPath">Running</a>
<span class="badge"></span>
</li>
<li
class="js-pipelines-tab-finished"
:class="{ 'active': scope === 'finished'}">
<a :href="finishedPath">Finished</a>
<span class="badge"></span>
</li>
<li
class="js-pipelines-tab-branches"
:class="{ 'active': scope === 'branches'}">
<a :href="branchesPath">Branches</a>
</li>
<li
class="js-pipelines-tab-tags"
:class="{ 'active': scope === 'tags'}">
<a :href="tagsPath">Tags</a>
</li>
</ul>
<div class="nav-controls">
<a
v-if="canCreatePipelineParsed"
:href="newPipelinePath"
class="btn btn-create">
Run Pipeline
</a>
<a
v-if="!hasCi"
:href="helpPagePath"
class="btn btn-info">
Get started with Pipelines
</a>
<a
:href="ciLintPath"
class="btn btn-default">
CI Lint
</a>
</div>
</div>
<div class="pipelines realtime-loading"
v-if="pageRequest">
<i class="fa fa-spinner fa-spin" aria-hidden="true"></i>
</div>
</div>
<div v-if="shouldRenderEmptyState"
<div v-if="shouldRenderEmptyState"
class="row empty-state">
class="row empty-state">
<div class="col-xs-12 pull-right">
<div class="col-xs-12 pull-right">
<div class="svg-content">
<div class="svg-content">
${
pipelinesEmptyStateSVG
}
${
pipelinesEmptyStateSVG
}
...
@@ -92,8 +203,7 @@ const CommitPipelinesStoreWithTimeAgo = require('../commit/pipelines/pipelines_s
...
@@ -92,8 +203,7 @@ const CommitPipelinesStoreWithTimeAgo = require('../commit/pipelines/pipelines_s
<p>
<p>
Continous Integration can help catch bugs by running your tests automatically,
Continous Integration can help catch bugs by running your tests automatically,
while Continuous Deployment can help you deliver code to your product environment.
while Continuous Deployment can help you deliver code to your product environment.
<a :href="helpPagePath" class="btn btn-info">
<a href="" class="btn btn-info">
Get started with Pipelines
Get started with Pipelines
</a>
</a>
</p>
</p>
...
@@ -103,7 +213,6 @@ const CommitPipelinesStoreWithTimeAgo = require('../commit/pipelines/pipelines_s
...
@@ -103,7 +213,6 @@ const CommitPipelinesStoreWithTimeAgo = require('../commit/pipelines/pipelines_s
<div v-if="shouldRenderErrorState"
<div v-if="shouldRenderErrorState"
class="row empty-state">
class="row empty-state">
<div class="col-xs-12 pull-right">
<div class="col-xs-12 pull-right">
<div class="svg-content">
<div class="svg-content">
${
pipelinesErrorStateSVG
}
${
pipelinesErrorStateSVG
}
...
@@ -117,16 +226,17 @@ const CommitPipelinesStoreWithTimeAgo = require('../commit/pipelines/pipelines_s
...
@@ -117,16 +226,17 @@ const CommitPipelinesStoreWithTimeAgo = require('../commit/pipelines/pipelines_s
</div>
</div>
</div>
</div>
<div class="table-holder" v-if='!pageRequest && pipelines.length'>
<div class="table-holder"
v-if="shouldRenderTable">
<pipelines-table-component :pipelines='pipelines'/>
<pipelines-table-component :pipelines='pipelines'/>
</div>
</div>
<gl-pagination
<gl-pagination
v-if=
'!pageRequest && pipelines.length && pageInfo.total > pageInfo.perPage'
v-if=
"shouldRenderPagination"
:pagenum=
'pagenum'
:pagenum=
"pagenum"
:change=
'change'
:change=
"change"
:count=
'count.all'
:count=
"count.all"
:pageInfo=
'pageInfo'
/>
:pageInfo=
"pageInfo"
/>
</div>
</div>
`
,
`
,
});
});
...
...
app/views/projects/pipelines/index.html.haml
View file @
d3732b55
...
@@ -2,53 +2,20 @@
...
@@ -2,53 +2,20 @@
-
page_title
"Pipelines"
-
page_title
"Pipelines"
=
render
"projects/pipelines/head"
=
render
"projects/pipelines/head"
%div
{
class:
container_class
}
-
content_for
:page_specific_javascripts
do
.top-area
=
page_specific_javascript_bundle_tag
(
"common_vue"
)
%ul
.nav-links
=
page_specific_javascript_bundle_tag
(
"vue_pipelines"
)
%li
.js-pipelines-tab-all
{
class:
active_when
(
@scope
.
nil?
)
}
>
=
link_to
project_pipelines_path
(
@project
)
do
#pipelines-list-vue
{
data:
{
endpoint:
namespace_project_pipelines_path
(
@project
.
namespace
,
@project
,
format: :json
),
All
"css-class"
=>
container_class
,
%span
.badge.js-totalbuilds-count
"help-page-path"
=>
help_page_path
(
'ci/quick_start/README'
),
=
number_with_delimiter
(
@pipelines_count
)
"new-pipeline-path"
=>
new_namespace_project_pipeline_path
(
@project
.
namespace
,
@project
),
"can-create-pipeline"
=>
can?
(
current_user
,
:create_pipeline
,
@project
).
to_s
,
%li
.js-pipelines-tab-pending
{
class:
active_when
(
@scope
==
'pending'
)
}
>
"all-path"
=>
project_pipelines_path
(
@project
),
=
link_to
project_pipelines_path
(
@project
,
scope: :pending
)
do
"pending-path"
=>
project_pipelines_path
(
@project
,
scope: :pending
),
Pending
"running-path"
=>
project_pipelines_path
(
@project
,
scope: :running
),
%span
.badge
"finished-path"
=>
project_pipelines_path
(
@project
,
scope: :finished
),
=
number_with_delimiter
(
@pending_count
)
"branches-path"
=>
project_pipelines_path
(
@project
,
scope: :branches
),
"tags-path"
=>
project_pipelines_path
(
@project
,
scope: :tags
),
%li
.js-pipelines-tab-running
{
class:
active_when
(
@scope
==
'running'
)
}
>
"has-ci"
=>
@repository
.
gitlab_ci_yml
,
=
link_to
project_pipelines_path
(
@project
,
scope: :running
)
do
"ci-lint-path"
=>
ci_lint_path
}
}
Running
%span
.badge.js-running-count
=
number_with_delimiter
(
@running_count
)
%li
.js-pipelines-tab-finished
{
class:
active_when
(
@scope
==
'finished'
)
}
>
=
link_to
project_pipelines_path
(
@project
,
scope: :finished
)
do
Finished
%span
.badge
=
number_with_delimiter
(
@finished_count
)
%li
.js-pipelines-tab-branches
{
class:
active_when
(
@scope
==
'branches'
)
}
>
=
link_to
project_pipelines_path
(
@project
,
scope: :branches
)
do
Branches
%li
.js-pipelines-tab-tags
{
class:
active_when
(
@scope
==
'tags'
)
}
>
=
link_to
project_pipelines_path
(
@project
,
scope: :tags
)
do
Tags
.nav-controls
-
if
can?
current_user
,
:create_pipeline
,
@project
=
link_to
new_namespace_project_pipeline_path
(
@project
.
namespace
,
@project
),
class:
'btn btn-create'
do
Run pipeline
-
unless
@repository
.
gitlab_ci_yml
=
link_to
'Get started with Pipelines'
,
help_page_path
(
'ci/quick_start/README'
),
class:
'btn btn-info'
=
link_to
ci_lint_path
,
class:
'btn btn-default'
do
%span
CI Lint
.content-list.pipelines
{
data:
{
url:
namespace_project_pipelines_path
(
@project
.
namespace
,
@project
,
format: :json
)
}
}
.vue-pipelines-index
=
page_specific_javascript_bundle_tag
(
'common_vue'
)
=
page_specific_javascript_bundle_tag
(
'vue_pipelines'
)
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