Skip to content

Commit da0eaba

Browse files
committed
add a search reset button and limit search result to 200 builds
1 parent ea2cb93 commit da0eaba

3 files changed

Lines changed: 31 additions & 8 deletions

File tree

src/api/handlers/build.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,12 @@ def get(self, project_id):
3838
else:
3939
cronjob = None
4040

41+
if build_from:
42+
build_from = int(build_from)
43+
44+
if build_to:
45+
build_to = int(build_to)
46+
4147
if not build_to:
4248
r = g.db.execute_one_dict('''
4349
SELECT max(build_number) as max
@@ -53,8 +59,8 @@ def get(self, project_id):
5359
if not build_from:
5460
build_from = max(build_to - 10, 0)
5561

56-
if build_to - build_from > 500:
57-
build_from = build_to - 500
62+
if build_to - build_from > 200:
63+
build_from = build_to - 200
5864

5965
p = g.db.execute_many_dict('''
6066
SELECT b.id, b.build_number, b.restart_counter, b.is_cronjob

src/api/handlers/projects/jobs.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,12 @@ def get(self, project_id):
4646
else:
4747
cronjob = None
4848

49+
if build_from:
50+
build_from = int(build_from)
51+
52+
if build_to:
53+
build_to = int(build_to)
54+
4955
if not build_to:
5056
r = g.db.execute_one_dict('''
5157
SELECT max(build_number) as max
@@ -61,8 +67,8 @@ def get(self, project_id):
6167
if not build_from:
6268
build_from = max(build_to - 10, 0)
6369

64-
if build_to - build_from > 500:
65-
build_from = build_to - 500
70+
if build_to - build_from > 200:
71+
build_from = build_to - 200
6672

6773
jobs = g.db.execute_many_dict('''
6874
SELECT

src/dashboard-client/src/components/build/BuildTable.vue

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
<md-select name="state" id="state" v-model="form.state">
3434
<md-option value="" class="bg-white">Any</md-option>
3535
<md-option value="running" class="bg-white">Running</md-option>
36-
<md-option value="failed" class="bg-white">Failed</md-option>
36+
<md-option value="failure" class="bg-white">Failure</md-option>
3737
<md-option value="unstable" class="bg-white">Unstable</md-option>
3838
<md-option value="killed" class="bg-white">Killed</md-option>
3939
<md-option value="error" class="bg-white">Error</md-option>
@@ -44,6 +44,10 @@
4444
<md-icon md-theme="running" class="md-primary">search</md-icon>
4545
<md-tooltip>Search</md-tooltip>
4646
</md-button>
47+
<md-button class="md-icon-button md-list-action" @click="resetSearch()">
48+
<md-icon md-theme="running" class="md-primary">clear</md-icon>
49+
<md-tooltip>Clear</md-tooltip>
50+
</md-button>
4751
</md-list-item>
4852
</md-list>
4953
</md-card-area>
@@ -97,7 +101,7 @@
97101
</md-table-row>
98102
</md-table-body>
99103
</md-table>
100-
<md-table-pagination
104+
<md-table-pagination v-if="!this.search.search">
101105
:md-size="size"
102106
:md-total="total"
103107
:md-page="page"
@@ -152,7 +156,11 @@ export default {
152156
153157
const p = this.page - 1
154158
const to = maxBuildNumber - (p * this.size) + 1
155-
const from = to - this.size
159+
let from = to - this.size
160+
161+
if (from < 0) {
162+
from = 0
163+
}
156164
157165
let builds = []
158166
let foundFrom = maxBuildNumber
@@ -177,7 +185,6 @@ export default {
177185
continue
178186
}
179187
180-
console.log(this.search.from)
181188
if (this.search.from && b.number < this.search.from) {
182189
continue
183190
}
@@ -218,6 +225,10 @@ export default {
218225
this.size = opt.size
219226
},
220227
228+
resetSearch () {
229+
this.search.search = false
230+
},
231+
221232
doSearch () {
222233
this.search = {
223234
from: this.form.from,

0 commit comments

Comments
 (0)