Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitb9095f3

Browse files
committed
Small improvements for the overview view
1 parent0083801 commitb9095f3

File tree

5 files changed

+144
-15
lines changed

5 files changed

+144
-15
lines changed

‎frontend/client/views/overview/index.vue‎

Lines changed: 56 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,26 @@
55
<divclass="notification content-article">
66
<divclass="status-display-success"></div>
77
<divclass="outer-box">
8-
<divclass="outer-box-icon-image">
9-
<img:src="getImagePath(pipeline.type)"class="outer-box-image">
10-
</div>
11-
<div>
12-
<router-link:to="{ path: '/pipeline/detail', query: { pipelineid: pipeline.id }}"class="subtitle">{{ pipeline.name }}</router-link>
13-
</div>
14-
<div>
15-
<hrstyle="color:lightgrey;">
16-
<aclass="button is-primary"@click="startPipeline(pipeline.id)">
17-
<spanclass="icon">
18-
<iclass="fa fa-play-circle"></i>
19-
</span>
20-
<span>Start Pipeline</span>
21-
</a>
8+
<router-link:to="{ path: '/pipeline/detail', query: { pipelineid: pipeline.p.id }}"class="hoveraction">
9+
<divclass="outer-box-icon-image">
10+
<img:src="getImagePath(pipeline.p.type)"class="outer-box-image">
11+
</div>
12+
<div>
13+
<spanclass="subtitle">{{ pipeline.p.name }}</span>
14+
</div>
15+
</router-link>
16+
<hrclass="pipeline-hr">
17+
<divclass="pipeline-info">
18+
<span>Duration: {{ pipeline.r.startdate }}</span><br />
19+
<span>Started: {{ pipeline.r.finishdate }}</span><br />
20+
<divclass="pipelinegrid-footer">
21+
<aclass="button is-primary"@click="startPipeline(pipeline.p.id)"style="width:250px;">
22+
<spanclass="icon">
23+
<iclass="fa fa-play-circle"></i>
24+
</span>
25+
<span>Start Pipeline</span>
26+
</a>
27+
</div>
2228
</div>
2329
</div>
2430
</div>
@@ -55,7 +61,7 @@ export default {
5561
methods: {
5662
fetchData () {
5763
this.$http
58-
.get('/api/v1/pipeline', { showProgressBar:false })
64+
.get('/api/v1/pipeline/latest', { showProgressBar:false })
5965
.then(response=> {
6066
if (response.data) {
6167
this.pipelines=response.data
@@ -151,4 +157,39 @@ export default {
151157
transform:translate(-50%,-50%);
152158
}
153159
160+
.hoveraction:hover.outer-box-icon-image {
161+
border-color:#4da2fc!important;
162+
}
163+
164+
.hoveraction:hover.subtitle {
165+
color:#4da2fc!important;
166+
text-decoration:underline;
167+
text-decoration-color:#4da2fc!important;
168+
}
169+
170+
.pipeline-hr {
171+
position:absolute;
172+
width:325px;
173+
margin-left:-13px;
174+
margin-top:18px;
175+
background-image:linear-gradient(
176+
toright,
177+
black33%,
178+
rgba(255,255,255,0)0%
179+
);
180+
background-position:bottom;
181+
background-size:3px1px;
182+
background-repeat:repeat-x;
183+
}
184+
185+
.pipeline-info {
186+
padding-top:33px;
187+
}
188+
189+
.pipelinegrid-footer {
190+
margin:auto;
191+
width:82%;
192+
padding-top:20px;
193+
}
194+
154195
</style>

‎handlers/handler.go‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,12 @@ func InitHandlers(e *echo.Echo, store *store.Store, scheduler *scheduler.Schedul
7777
e.GET(p+"pipeline",PipelineGetAll)
7878
e.GET(p+"pipeline/:pipelineid",PipelineGet)
7979
e.POST(p+"pipeline/:pipelineid/start",PipelineStart)
80+
e.GET(p+"pipeline/latest",PipelineGetAllWithLatestRun)
8081

8182
// PipelineRun
8283
e.GET(p+"pipelinerun/:pipelineid/:runid",PipelineRunGet)
8384
e.GET(p+"pipelinerun/:pipelineid",PipelineGetAllRuns)
85+
e.GET(p+"pipelinerun/:pipelineid/latest",PipelineGetLatestRun)
8486
e.GET(p+"pipelinerun/:pipelineid/:runid/log",GetJobLogs)
8587

8688
// Middleware

‎handlers/pipeline.go‎

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,3 +156,39 @@ func PipelineStart(c echo.Context) error {
156156
// Pipeline not found
157157
returnc.String(http.StatusNotFound,errPipelineNotFound.Error())
158158
}
159+
160+
typegetAllWithLatestRunstruct {
161+
Pipeline gaia.Pipeline`json:"p"`
162+
PipelineRun gaia.PipelineRun`json:"r"`
163+
}
164+
165+
// PipelineGetAllWithLatestRun returns the latest of all registered pipelines
166+
// included with the latest run.
167+
funcPipelineGetAllWithLatestRun(c echo.Context)error {
168+
// Get all active pipelines
169+
varpipelines []gaia.Pipeline
170+
forpipeline:=rangepipeline.GlobalActivePipelines.Iter() {
171+
pipelines=append(pipelines,pipeline)
172+
}
173+
174+
// Iterate all pipelines
175+
varpipelinesWithLatestRun []getAllWithLatestRun
176+
for_,pipeline:=rangepipelines {
177+
// Get the latest run by the given pipeline id
178+
run,err:=storeService.PipelineGetLatestRun(pipeline.ID)
179+
iferr!=nil {
180+
returnc.String(http.StatusInternalServerError,err.Error())
181+
}
182+
183+
// Create new return obj
184+
g:=getAllWithLatestRun{
185+
Pipeline:pipeline,
186+
PipelineRun:*run,
187+
}
188+
189+
// Append
190+
pipelinesWithLatestRun=append(pipelinesWithLatestRun,g)
191+
}
192+
193+
returnc.JSON(http.StatusOK,pipelinesWithLatestRun)
194+
}

‎handlers/pipeline_run.go‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,23 @@ func PipelineGetAllRuns(c echo.Context) error {
6969
returnc.JSON(http.StatusOK,runs)
7070
}
7171

72+
// PipelineGetLatestRun returns the latest run of a pipeline, given by id.
73+
funcPipelineGetLatestRun(c echo.Context)error {
74+
// Convert string to int because id is int
75+
pipelineID,err:=strconv.Atoi(c.Param("pipelineid"))
76+
iferr!=nil {
77+
returnc.String(http.StatusBadRequest,errInvalidPipelineID.Error())
78+
}
79+
80+
// Get the latest run by the given pipeline id
81+
run,err:=storeService.PipelineGetLatestRun(pipelineID)
82+
iferr!=nil {
83+
returnc.String(http.StatusInternalServerError,err.Error())
84+
}
85+
86+
returnc.JSON(http.StatusOK,run)
87+
}
88+
7289
// GetJobLogs returns logs and new start position for the given job.
7390
// If no jobID is given, a collection of all jobs logs will be returned.
7491
//

‎store/pipeline.go‎

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,3 +277,36 @@ func (s *Store) PipelineGetAllRuns(pipelineID int) ([]gaia.PipelineRun, error) {
277277
})
278278
})
279279
}
280+
281+
// PipelineGetLatestRun returns the latest run by the given pipeline id.
282+
func (s*Store)PipelineGetLatestRun(pipelineIDint) (*gaia.PipelineRun,error) {
283+
varrun*gaia.PipelineRun
284+
285+
returnrun,s.db.View(func(tx*bolt.Tx)error {
286+
// Get Bucket
287+
b:=tx.Bucket(pipelineRunBucket)
288+
289+
// Iterate all pipeline runs.
290+
returnb.ForEach(func(k,v []byte)error {
291+
// create single run object
292+
r:=&gaia.PipelineRun{}
293+
294+
// Unmarshal
295+
err:=json.Unmarshal(v,r)
296+
iferr!=nil {
297+
returnerr
298+
}
299+
300+
// Is this a run from our pipeline?
301+
ifr.PipelineID==pipelineID {
302+
// Check if this is the latest run
303+
ifrun==nil||run.StartDate.Before(r.StartDate) {
304+
// set it
305+
run=r
306+
}
307+
}
308+
309+
returnnil
310+
})
311+
})
312+
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp