Skip to content

new ci monitor #37

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 29 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
305791b
Sort by pipeline status first
Sep 26, 2018
a8e2166
Add blacklist parameter to exclude projects
Sep 27, 2018
bbf8a4f
Mark rotten (no build since 2 days) projects dark yellow and sort the…
Sep 28, 2018
0d66935
show four columns of cards
Oct 2, 2018
2331a18
Merge branch 'master' of https://github.com/globocom/gitlab-ci-monitor
Nov 8, 2018
97e733e
fix sorting
Nov 8, 2018
00ff33c
fix sorting
Nov 8, 2018
9afb443
fix sorting
Nov 8, 2018
c16282e
fix sorting
Nov 8, 2018
d76422b
use latest non-skipped build
Jan 16, 2019
b2ec59c
use latest non-skipped build
Jan 16, 2019
16cb668
use latest non-skipped build
Jan 16, 2019
e889ee6
Update app.js
mdescher Feb 6, 2019
542b6b1
Update style.css
mdescher Feb 6, 2019
9655d81
Update app.js
mdescher Feb 6, 2019
2097b8e
Update app.js
mdescher Feb 6, 2019
57ffcfa
Update app.js
mdescher Feb 6, 2019
fe61946
Make background colors nicer :-)
Feb 6, 2019
acc4993
color to white shade for currently building pipelines
Feb 6, 2019
1909e3a
Solid background color with brightness animation for running pipelines
Feb 7, 2019
cfba0db
Merge remote-tracking branch 'upstream/master'
Apr 29, 2019
cc66cbb
Update webpack.config.js
mdescher Dec 4, 2019
67048b1
Merge remote-tracking branch 'upstream/master'
Feb 25, 2020
9937107
Use upstream package-lock.json
Feb 25, 2020
a0920e7
Fix syntax
Feb 25, 2020
c7b28ce
Fix js file
Feb 25, 2020
0b810fc
Revert code style fixed to reduce diff to upstream
Feb 25, 2020
bc57ef1
Revert running from animation back to static color
May 8, 2020
de95b76
Merge branch 'globocom:master' into master
mdescher Jun 20, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
.DS_Store
node_modules
dist
.env
.env
/npm-debug.log
5 changes: 5 additions & 0 deletions css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,8 @@ body {
.ui.cards>.card.canceled {
background-color: #aaaaaa;
}

.ui.card,
.ui.cards>.card.rotten {
background-color: #666600;
}
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
</div>
<div class="row builds">
<div class="sixteen wide column">
<div class="ui stackable cards">
<div class="ui four cards">
<div v-for="pipeline in sortedPipelines" class="card {{pipeline.status}}">
<div class="content">
<div class="header project-name">
Expand Down
65 changes: 54 additions & 11 deletions js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,15 @@ const app = new Vue({
self.gitlab = getParameterByName('gitlab')
self.token = getParameterByName('token')
self.ref = getParameterByName('ref')
self.blacklist = []
self.repositories = []
self.groups = []

const blacklistParameter = getParameterByName('blacklist')
if (blacklistParameter != null) {
self.blacklist = getParameterByName('blacklist').split(',')
}

self.loadConfigGroups()
self.loadConfigOrder()

Expand Down Expand Up @@ -154,6 +160,31 @@ const app = new Vue({
}
})
},
blacklisted: function(project) {
for (var i = 0; i < this.blacklist.length; i++) {
if (this.blacklist[i] === project) {
return true;
}
}
return false;
},
statusPriority: function(status) {
const st = status.endsWith(' running') ? 'running' : status;
switch (st) {
case 'failed':
return 'a';
case 'running':
return 'b';
case 'pending':
return 'c';
case 'canceled':
return 'd';
case 'rotten':
return 'e';
default:
return 'f';
}
},
validateConfig: function() {
const error = { response: { status: 500 } }
if (this.repositories.length === 0 && this.groups.length === 0) {
Expand Down Expand Up @@ -202,7 +233,7 @@ const app = new Vue({
.then(function (response) {
self.loading = false
response.data.projects.forEach(function(project) {
if (project.jobs_enabled && !project.archived) {
if (project.jobs_enabled && !project.archived && !self.blacklisted(project.name)) {
const branch = project.default_branch
const projectName = project.name
const nameWithNamespace = project.path_with_namespace
Expand Down Expand Up @@ -236,27 +267,38 @@ const app = new Vue({
if (pipelines.data.length === 0) {
return
}
const commitId = pipelines.data[0].sha
const pipelineId = pipelines.data[0].id
axios.get('/projects/' + p.data.id + '/repository/commits/' + commitId)
.then(function(commit) {
self.updateBuildInfo(p, commit, pipelineId)
})
.catch(onError.bind(self))
var running = false;
for (var i = 0; i < pipelines.data.length; i++) {
running |= pipelines.data[i].status === 'running'
if (pipelines.data[i].status !== 'skipped' && pipelines.data[i].status !== 'running') { // find latest non-skipped/non-running build
const commitId = pipelines.data[i].sha
const pipelineId = pipelines.data[i].id
axios.get('/projects/' + p.data.id + '/repository/commits/' + commitId)
.then(function(commit) {
self.updateBuildInfo(p, commit, pipelineId, running)
})
.catch(onError.bind(self))
return;
}
}
})
.catch(onError.bind(self))
},
updateBuildInfo: function(p, commit, pipelineId) {
updateBuildInfo: function(p, commit, pipelineId, running) {
const self = this
const rottenThreshold = 2 * 24 * 60 * 60 * 1000; // no build since 2 days => rotten

axios.get('/projects/' + p.data.id + '/pipelines/' + pipelineId)
.then(function(pipeline) {
const startedAt = pipeline.data.started_at
const startedFromNow = distanceInWordsToNow(startedAt, { addSuffix: true })
const b = self.pipelinesMap[p.project.key]
const status = Date.now() - Date.parse(startedAt) >= rottenThreshold ? 'rotten' : pipeline.data.status + (running ? ' running' : '')
const statusPrio = self.statusPriority(status)
if (b !== undefined) {
b.id = pipeline.data.id
b.status = pipeline.data.status
b.status = status
b.status_prio = statusPrio
b.started_from_now = startedFromNow
b.started_at = startedAt
b.author = commit.data.author_name
Expand All @@ -266,7 +308,8 @@ const app = new Vue({
const project = {
project: p.project.projectName,
id: pipeline.data.id,
status: pipeline.data.status,
status: status,
status_prio: statusPrio,
started_from_now: startedFromNow,
started_at: startedAt,
author: commit.data.author_name,
Expand Down
2 changes: 2 additions & 0 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ module.exports = ({ mode } = { mode: 'development' }) => {
new CopyWebpackPlugin([{ from: 'images', to: 'images' }]),
],
devServer: {
host: '0.0.0.0',
disableHostCheck: true,
contentBase: path.join(__dirname, 'build'),
compress: true
}
Expand Down