11<template >
22 <div >
3+ <md-card md-theme =" white" class =" full-height clean-card" >
4+ <md-card-area >
5+ <md-list class =" m-t-md m-b-md" >
6+ <md-list-item >
7+ <md-input-container class =" m-r-sm" >
8+ <label >From Build Number</label >
9+ <md-input v-model =" form.from" ></md-input >
10+ </md-input-container >
11+ <md-input-container class =" m-r-sm" >
12+ <label >To Build Number</label >
13+ <md-input v-model =" form.to" ></md-input >
14+ </md-input-container >
15+ <md-input-container class =" m-r-sm" >
16+ <label >Sha</label >
17+ <md-input v-model =" form.sha" ></md-input >
18+ </md-input-container >
19+ <md-input-container class =" m-l-sm" >
20+ <label >Branch</label >
21+ <md-input v-model =" form.branch" ></md-input >
22+ </md-input-container >
23+ <md-input-container >
24+ <label >Cronjob</label >
25+ <md-select name =" cronjob" id =" cronjob" v-model =" form.cronjob" >
26+ <md-option value =" " class =" bg-white" >Any</md-option >
27+ <md-option value =" true" class =" bg-white" >Yes</md-option >
28+ <md-option value =" false" class =" bg-white" >No</md-option >
29+ </md-select >
30+ </md-input-container >
31+ <md-input-container >
32+ <label >State</label >
33+ <md-select name =" state" id =" state" v-model =" form.state" >
34+ <md-option value =" " class =" bg-white" >Any</md-option >
35+ <md-option value =" running" class =" bg-white" >Running</md-option >
36+ <md-option value =" failed" class =" bg-white" >Failed</md-option >
37+ <md-option value =" unstable" class =" bg-white" >Unstable</md-option >
38+ <md-option value =" killed" class =" bg-white" >Killed</md-option >
39+ <md-option value =" error" class =" bg-white" >Error</md-option >
40+ <md-option value =" finished" class =" bg-white" >Finished</md-option >
41+ </md-select >
42+ </md-input-container >
43+ <md-button class =" md-icon-button md-list-action" @click =" doSearch()" >
44+ <md-icon md-theme =" running" class =" md-primary" >search</md-icon >
45+ <md-tooltip >Search</md-tooltip >
46+ </md-button >
47+ </md-list-item >
48+ </md-list >
49+ </md-card-area >
50+ </md-card >
51+
352 <md-table-card class =" clean-card add-overflow" >
453 <md-table class =" min-medium" >
554 <md-table-header >
62111</template >
63112
64113<script >
114+
65115export default {
66116 props: [' project' ],
67117 data : () => {
68118 return {
69119 page: 1 ,
70120 size: 10 ,
71- total: 0
121+ total: 0 ,
122+
123+ form: {
124+ from: null ,
125+ to: null ,
126+ sha: null ,
127+ branch: null ,
128+ cronjob: ' ' ,
129+ startDate: null ,
130+ state: ' '
131+ },
132+
133+ search: {
134+ from: null ,
135+ to: null ,
136+ sha: null ,
137+ branch: null ,
138+ cronjob: null ,
139+ startDate: null ,
140+ search: false ,
141+ state: null
142+ }
72143 }
73144 },
74145 computed: {
@@ -85,18 +156,52 @@ export default {
85156
86157 let builds = []
87158 let foundFrom = maxBuildNumber
88- for (let b of this .project .builds ) {
89- if (from <= b .number && b .number < to) {
159+
160+ if (this .search .search ) {
161+ this .project .loadBuilds (this .search .from || 0 , this .search .to || maxBuildNumber, this .search .sha , this .search .branch , this .search .cronjob )
162+
163+ for (let b of this .project .builds ) {
164+ if (this .search .branch && b .commit && b .commit .branch !== this .search .branch ) {
165+ continue
166+ }
167+
168+ if (this .search .sha && b .commit && b .commit .id !== this .search .sha ) {
169+ continue
170+ }
171+
172+ if (this .search .cronjob && String (b .isCronjob ) !== this .search .cronjob ) {
173+ continue
174+ }
175+
176+ if (this .search .state && b .state !== this .search .state ) {
177+ continue
178+ }
179+
180+ console .log (this .search .from )
181+ if (this .search .from && b .number < this .search .from ) {
182+ continue
183+ }
184+
185+ if (this .search .to && b .number > this .search .to ) {
186+ continue
187+ }
188+
90189 builds .push (b)
190+ }
191+ } else {
192+ for (let b of this .project .builds ) {
193+ if (from <= b .number && b .number < to) {
194+ builds .push (b)
91195
92- if (b .number < foundFrom) {
93- foundFrom = b .number
196+ if (b .number < foundFrom) {
197+ foundFrom = b .number
198+ }
94199 }
95200 }
96- }
97201
98- if (foundFrom !== from) {
99- this .project .loadBuilds (from, to)
202+ if (foundFrom !== from) {
203+ this .project .loadBuilds (from, to, this .search .sha , this .search .branch , this .search .cronjob )
204+ }
100205 }
101206
102207 return builds
@@ -111,6 +216,18 @@ export default {
111216 }
112217
113218 this .size = opt .size
219+ },
220+
221+ doSearch () {
222+ this .search = {
223+ from: this .form .from ,
224+ to: this .form .to ,
225+ sha: this .form .sha ,
226+ branch: this .form .branch ,
227+ cronjob: this .form .cronjob ,
228+ state: this .form .state ,
229+ search: true
230+ }
114231 }
115232 }
116233}
0 commit comments