Skip to content

Commit

Permalink
feat: extend auto refresh timeout to 30s, fix pagination
Browse files Browse the repository at this point in the history
  • Loading branch information
jiegec committed Mar 20, 2024
1 parent 06b724a commit 2fccfc3
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
4 changes: 2 additions & 2 deletions frontend/src/pages/pipelines/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
<v-spacer></v-spacer>
<v-col class="d-flex align-end justify-end">
<v-progress-circular
:model-value="countdown * 10 / 1"
:model-value="countdown * 10 / 3"
size="36"
color="blue"
style="margin-right: 20px;"
Expand Down Expand Up @@ -267,7 +267,7 @@
},
methods: {
startAutoRefresh() {
this.countdown = 10;
this.countdown = 30;
this.intervalHandle = setInterval(() => {
if (this.countdown == 0) {
clearInterval(this.intervalHandle);
Expand Down
17 changes: 14 additions & 3 deletions server/src/routes/pipeline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -175,10 +175,21 @@ pub async fn pipeline_list(

Ok(Json(
conn.transaction::<PipelineListResponse, diesel::result::Error, _>(|conn| {
let total_items = crate::schema::pipelines::dsl::pipelines
.count()
.get_result(conn)?;
// compute total items for pagination
let mut total_items_query = crate::schema::pipelines::dsl::pipelines.into_boxed();

if query.stable_only {
total_items_query = total_items_query
.filter(crate::schema::pipelines::dsl::git_branch.eq("stable"));
}
if query.github_pr_only {
total_items_query = total_items_query
.filter(crate::schema::pipelines::dsl::github_pr.is_not_null());
}

let total_items = total_items_query.count().get_result(conn)?;

// collect pipelines
let mut sql = crate::schema::pipelines::dsl::pipelines
.left_join(crate::schema::users::dsl::users)
.order_by(crate::schema::pipelines::dsl::id.desc())
Expand Down

0 comments on commit 2fccfc3

Please sign in to comment.