Skip to content

Commit 019a03d

Browse files
Added button to rerun pipelines (#201)
Co-authored-by: Timo Schwarzer <me@timoschwarzer.com>
1 parent 333cbeb commit 019a03d

File tree

9 files changed

+60
-36
lines changed

9 files changed

+60
-36
lines changed

CONFIGURATION.md

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -44,17 +44,14 @@ Here you'll find documentation about each configration option:
4444
gitlabApi: https://gitlab.example.com/api/v4
4545

4646
# Required
47-
# Can be generated here: https://gitlab.example.com/profile/personal_access_tokens At least api_read scope is needed
47+
# Can be generated here: https://gitlab.example.com/profile/personal_access_tokens
48+
# At least api_read scope is needed
4849
privateToken: ABCDEF123456
4950

5051
# In hours. Projects with last activity older than this age won't be displayed.
5152
# If set to 0, no filter will be applied
5253
maxAge: 168
5354

54-
#How many projects will be fetched from GitLab. Usually you want all projects under a user/group.
55-
#If set to greater than 100, then all available projects will be retrieved (in batches of 100)
56-
fetchCountProjects: 101,
57-
5855
# How many projects will be fetched from GitLab.
5956
# If set to greater than 100, then all available projects will be retrieved (in batches of 100)
6057
fetchCount: 20
@@ -103,15 +100,18 @@ showStagesNames: false
103100
# Whether to show pipeline durations or not
104101
showDurations: true
105102

106-
# Whether to show the user that invoked the pipeline or not
107-
showUsers: false
108-
109-
# Wether to show the pipelines test coverage if available
103+
# Whether to show the pipelines test coverage if available
110104
showCoverage: false
111105

112-
# Wether to show the pipelines test report if available
106+
# Whether to show the pipelines test report if available
113107
showTestReport: true
114108

109+
# Whether to show the user that invoked the pipeline or not
110+
showUsers: false
111+
112+
# Whether to show a button to rerun pipelines
113+
showRerunButton: false
114+
115115
# The page title, or null to hide
116116
title: null
117117

@@ -139,6 +139,9 @@ membership: false
139139
# Whether to show project badges or not
140140
badges: true
141141

142+
# Whether to show the amount and availability of runners
143+
showRunnerStatus: true
144+
142145
# Filter projects
143146
# The filter is applied to the path with namespace
144147
# (e.g. 'my-group/my-project'
@@ -237,4 +240,3 @@ includeSubgroups: false
237240
# You can override styles in the settings or submit your own theme here: https://git.io/JUOFb
238241
theme: null
239242
```
240-

README.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,6 @@
66

77
### Hosted version
88

9-
**Note: I recently changed the address from timoschwarzer.com/gitlab-monitor to
10-
gitlab-monitor.timoschwarzer.com! Please update your config if you still use the
11-
old address. Sorry for the inconvenience!**
12-
139
If you don't want to setup your own server, you can always
1410
use the latest version of GitLab Monitor I upload here:
1511

charts/gitlab-monitor/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ $ helm install . -n gitlab-monitor --namespace default
2121

2222
## Configure
2323

24-
Edit the `values.yaml` and set the config yaml string according.
24+
Edit the `values.yaml` and set the config yaml string accordingly.
2525

2626
```yaml
2727
config: |
@@ -55,6 +55,7 @@ config: |
5555
"showTags": true,
5656
"showLatestTagOnly": false,
5757
"showDetached": false,
58+
"showLabels": true,
5859
"maxPipelines": 10,
5960
"notifyFailureOn": null
6061
}

charts/gitlab-monitor/values.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,4 +60,3 @@ config: |
6060
}
6161
}
6262
}
63-

index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<html lang="en">
33
<head>
44
<meta charset="utf-8">
5-
<title>gitlab-monitor</title>
5+
<title>GitLab Monitor</title>
66
</head>
77
<body>
88
<div id="app"></div>

src/GitLabApi.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,10 @@ import Config from './Config'
66
const GitLabApi = {}
77

88
GitLabApi.install = (Vue, options) => {
9-
Vue.prototype.$api = async (path, params = {}, behaviour = {}) => {
10-
const response = await axios.get(path, {
9+
Vue.prototype.$api = async (path, params = {}, behaviour = {}, method = 'GET') => {
10+
const response = await axios(path, {
1111
baseURL: Config.root.gitlabApi,
12+
method: method,
1213
params,
1314
headers: { 'Private-Token': Config.root.privateToken }
1415
})

src/components/app.vue

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,9 @@
2121
<div v-else-if="!configured" class="container">
2222
<h1>Configuration</h1>
2323
<p>
24-
Hi! Before you can use GitLab Monitor, it has to be configured.<br>
25-
Configuration is done by supplying YAML formatted configuration.<br>
24+
To use GitLab Monitor, it has to be configured.<br>
25+
Configuration is done by supplying YAML formatted options,<br>
26+
all configuration options are described <a href="https://github.com/timoschwarzer/gitlab-monitor/blob/main/CONFIGURATION.md#configuration-options" target="_blank">here</a>.<br>
2627
Your configuration is being persisted in this browser.
2728
</p>
2829
<monaco-editor v-model="config" language="yaml" class="config" :options="monacoOptions" />
@@ -359,7 +360,7 @@
359360
padding: 8px;
360361
margin-right: 4px;
361362
background: #2e2e2e;
362-
border: 2px solid #606060;
363+
border: 1px solid white;
363364
border-radius: 4px;
364365
color: #fff;
365366
cursor: pointer;
@@ -412,7 +413,7 @@
412413
413414
.config {
414415
margin-bottom: 8px;
415-
min-height: 300px;
416+
min-height: 500px;
416417
}
417418
418419
.configure {
@@ -421,8 +422,7 @@
421422
bottom: 0;
422423
padding: 16px 16px;
423424
background-color: #161616;
424-
border-top-right-radius: 3px;
425-
border-bottom-right-radius: 3px;
425+
border-top-right-radius: 4px;
426426
border-top: 2px solid white;
427427
border-right: 2px solid white;
428428
opacity: 0;

src/components/pipeline-view.vue

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@
3737
<span v-if="showCoverage && pipeline.coverage !== null" class="coverage">{{ pipeline.coverage + '%' }}</span>
3838
<gitlab-icon v-if="showUsers && duration !== null" class="user-icon" name="user" size="10" />
3939
<span v-if="showUsers && pipeline.user !== null" class="user">{{ pipeline.user.name }}</span>
40+
<button v-if="showRerunButton" class="rerun" @click="rerunPipeline">
41+
<octicon name="sync" scale="0.9" />
42+
</button>
4043
</div>
4144
</div>
4245
<test-report v-if="showTestReport && pipeline.test_report !== null" :pipeline="pipeline" />
@@ -91,6 +94,9 @@
9194
showTestReport() {
9295
return Config.root.showTestReport
9396
},
97+
showRerunButton() {
98+
return Config.root.showRerunButton
99+
},
94100
durationString() {
95101
const duration = this.duration
96102
const hrs = ~~(duration / 3600)
@@ -194,6 +200,14 @@
194200
this.durationCounterIntervalId = null
195201
}
196202
},
203+
async rerunPipeline() {
204+
await this.$api(
205+
!this.pipeline.ref.includes('merge-request')
206+
? `/projects/${this.project.id}/pipeline?ref=${this.pipeline.ref}`
207+
: `/projects/${this.project.id}/merge_requests/${this.pipeline.ref.match(/\d+/)}/pipelines`,
208+
{}, {}, 'POST',
209+
);
210+
},
197211
}
198212
}
199213
</script>
@@ -223,21 +237,23 @@
223237
}
224238
225239
.mr-label {
240+
//float: right;
241+
display: inline-flex;
242+
vertical-align: text-bottom;
226243
margin-left: 5px;
227-
vertical-align: middle;
228-
padding: 2px;
229-
font-size: 8px;
244+
padding: 3px;
245+
font-size: 5px;
230246
border-radius: 0.75rem;
231-
color: var(--project-default, #424242);
232-
background: var(--pipeline-id, rgba(255, 255, 255, 0.8));
247+
box-sizing: border-box;
248+
border: 0.5px solid var(--job-border-color, white);
233249
}
234250
235251
.pipeline {
236252
display: flex;
237253
align-items: center;
238254
color: white;
239255
height: 30px;
240-
margin-bottom: 4px;
256+
margin: 4px 0;
241257
242258
&.with-stages-names {
243259
padding-bottom: 20px;
@@ -312,6 +328,14 @@
312328
font-size: smaller;
313329
line-height: var(--job-icon-size, inherit);
314330
}
331+
332+
button.rerun {
333+
margin-left: 5px;
334+
padding: 2px 8px;
335+
background: inherit;
336+
display: inline-flex;
337+
border: 1px solid var(--job-border-color, white);
338+
}
315339
}
316340
}
317341
</style>

src/config.default.json

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,25 +5,26 @@
55
"fetchCount": 20,
66
"pipelinesOnly": false,
77
"autoZoom": false,
8-
"membership": false,
98
"showPipelineIds": true,
9+
"showProjectOnlyOn": [],
1010
"showJobs": "icon",
1111
"showJobsNameOnlyOn": [],
12-
"showProjectOnlyOn": [],
1312
"showRestartedJobs": true,
1413
"showStagesNames": false,
1514
"showDurations": true,
1615
"showCoverage": false,
1716
"showTestReport": false,
1817
"showUsers": false,
19-
"showRunnerStatus": true,
20-
"projectVisibility": "any",
18+
"showRerunButton": false,
2119
"title": null,
2220
"orderBy": "lastActivity",
2321
"orderByDesc": false,
2422
"pollingIntervalMultiplier": 1.0,
2523
"backgroundRefresh": true,
24+
"projectVisibility": "any",
25+
"membership": false,
2626
"badges": false,
27+
"showRunnerStatus": true,
2728
"filter": {
2829
"include": ".*",
2930
"includeTags": ".*",

0 commit comments

Comments
 (0)