show enqueued build in banner instead of active ones
This commit is contained in:
parent
ed57e14bef
commit
4ffb4b2855
@ -40,14 +40,13 @@ async fn get_stats(db: &DatabaseConnection) -> anyhow::Result<ListStats> {
|
|||||||
|
|
||||||
// todo implement this values somehow
|
// todo implement this values somehow
|
||||||
let avg_queue_wait_time: u32 = 42;
|
let avg_queue_wait_time: u32 = 42;
|
||||||
let avg_build_time: u32 = 42;
|
|
||||||
|
|
||||||
// Calculate repo storage size
|
// Calculate repo storage size
|
||||||
let repo_storage_size: u64 = dir_size("repo/").unwrap_or(0);
|
let repo_storage_size: u64 = dir_size("repo/").unwrap_or(0);
|
||||||
|
|
||||||
// Count active builds
|
// Count active builds
|
||||||
let active_builds: u32 = Builds::find()
|
let enqueued_builds: u32 = Builds::find()
|
||||||
.filter(builds::Column::Status.eq(0))
|
.filter(builds::Column::Status.eq(3))
|
||||||
.count(db)
|
.count(db)
|
||||||
.await?
|
.await?
|
||||||
.try_into()?;
|
.try_into()?;
|
||||||
@ -57,7 +56,8 @@ async fn get_stats(db: &DatabaseConnection) -> anyhow::Result<ListStats> {
|
|||||||
avg_build_time: f64,
|
avg_build_time: f64,
|
||||||
}
|
}
|
||||||
|
|
||||||
let unique: BuildTimeStruct = BuildTimeStruct::find_by_statement(Statement::from_sql_and_values(
|
let unique: BuildTimeStruct =
|
||||||
|
BuildTimeStruct::find_by_statement(Statement::from_sql_and_values(
|
||||||
DbBackend::Sqlite,
|
DbBackend::Sqlite,
|
||||||
r#"SELECT AVG((builds.end_time - builds.start_time)) AS avg_build_time
|
r#"SELECT AVG((builds.end_time - builds.start_time)) AS avg_build_time
|
||||||
FROM builds
|
FROM builds
|
||||||
@ -79,7 +79,7 @@ async fn get_stats(db: &DatabaseConnection) -> anyhow::Result<ListStats> {
|
|||||||
avg_queue_wait_time,
|
avg_queue_wait_time,
|
||||||
avg_build_time,
|
avg_build_time,
|
||||||
repo_storage_size,
|
repo_storage_size,
|
||||||
active_builds,
|
enqueued_builds,
|
||||||
total_packages,
|
total_packages,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -42,6 +42,6 @@ pub struct ListStats {
|
|||||||
pub avg_queue_wait_time: u32,
|
pub avg_queue_wait_time: u32,
|
||||||
pub avg_build_time: u32,
|
pub avg_build_time: u32,
|
||||||
pub repo_storage_size: u64,
|
pub repo_storage_size: u64,
|
||||||
pub active_builds: u32,
|
pub enqueued_builds: u32,
|
||||||
pub total_packages: u32,
|
pub total_packages: u32,
|
||||||
}
|
}
|
||||||
|
@ -100,7 +100,7 @@ class _BuildsChartState extends State<BuildsChart> {
|
|||||||
);
|
);
|
||||||
case 2:
|
case 2:
|
||||||
return PieChartSectionData(
|
return PieChartSectionData(
|
||||||
color: const Color(0xff9d8d00),
|
color: const Color(0xFF0044AA),
|
||||||
value: (widget.nrActiveBuilds).toDouble(),
|
value: (widget.nrActiveBuilds).toDouble(),
|
||||||
title:
|
title:
|
||||||
"${((widget.nrActiveBuilds) * 100 / widget.nrbuilds).toStringAsFixed(2)}%",
|
"${((widget.nrActiveBuilds) * 100 / widget.nrbuilds).toStringAsFixed(2)}%",
|
||||||
|
@ -46,8 +46,8 @@ class QuickInfoBanner extends StatelessWidget {
|
|||||||
QuickInfoData(
|
QuickInfoData(
|
||||||
color: const Color(0xFFFFA113),
|
color: const Color(0xFFFFA113),
|
||||||
icon: Icons.hourglass_top,
|
icon: Icons.hourglass_top,
|
||||||
title: "Active Builds",
|
title: "Enqueued Builds",
|
||||||
subtitle: stats.active_builds.toString()),
|
subtitle: stats.enqueued_builds.toString()),
|
||||||
QuickInfoData(
|
QuickInfoData(
|
||||||
color: const Color(0xFFA4CDFF),
|
color: const Color(0xFFA4CDFF),
|
||||||
icon: Icons.build,
|
icon: Icons.build,
|
||||||
|
@ -9,12 +9,12 @@ class SidePanel extends StatelessWidget {
|
|||||||
Key? key,
|
Key? key,
|
||||||
required this.nrbuilds,
|
required this.nrbuilds,
|
||||||
required this.nrfailedbuilds,
|
required this.nrfailedbuilds,
|
||||||
required this.nrActiveBuilds,
|
required this.nrEnqueuedBuilds,
|
||||||
}) : super(key: key);
|
}) : super(key: key);
|
||||||
|
|
||||||
final int nrbuilds;
|
final int nrbuilds;
|
||||||
final int nrfailedbuilds;
|
final int nrfailedbuilds;
|
||||||
final int nrActiveBuilds;
|
final int nrEnqueuedBuilds;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
@ -38,7 +38,7 @@ class SidePanel extends StatelessWidget {
|
|||||||
BuildsChart(
|
BuildsChart(
|
||||||
nrbuilds: nrbuilds,
|
nrbuilds: nrbuilds,
|
||||||
nrfailedbuilds: nrfailedbuilds,
|
nrfailedbuilds: nrfailedbuilds,
|
||||||
nrActiveBuilds: nrActiveBuilds),
|
nrActiveBuilds: nrEnqueuedBuilds),
|
||||||
SideCard(
|
SideCard(
|
||||||
color: const Color(0xff0a7005),
|
color: const Color(0xff0a7005),
|
||||||
title: "Successful Builds",
|
title: "Successful Builds",
|
||||||
@ -54,11 +54,11 @@ class SidePanel extends StatelessWidget {
|
|||||||
subtitle: nrfailedbuilds.toString(),
|
subtitle: nrfailedbuilds.toString(),
|
||||||
),
|
),
|
||||||
SideCard(
|
SideCard(
|
||||||
color: const Color(0xff9d8d00),
|
color: const Color(0xFF0044AA),
|
||||||
title: "Active Builds",
|
title: "Enqueued Builds",
|
||||||
textRight:
|
textRight:
|
||||||
"${(nrActiveBuilds * 100 / nrbuilds).toStringAsFixed(2)}%",
|
"${(nrEnqueuedBuilds * 100 / nrbuilds).toStringAsFixed(2)}%",
|
||||||
subtitle: nrActiveBuilds.toString(),
|
subtitle: nrEnqueuedBuilds.toString(),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
@ -3,7 +3,7 @@ class Stats {
|
|||||||
failed_builds,
|
failed_builds,
|
||||||
avg_queue_wait_time,
|
avg_queue_wait_time,
|
||||||
repo_storage_size,
|
repo_storage_size,
|
||||||
active_builds,
|
enqueued_builds,
|
||||||
total_packages;
|
total_packages;
|
||||||
final Duration avg_build_time;
|
final Duration avg_build_time;
|
||||||
|
|
||||||
@ -14,7 +14,7 @@ class Stats {
|
|||||||
avg_queue_wait_time: json["avg_queue_wait_time"] as int,
|
avg_queue_wait_time: json["avg_queue_wait_time"] as int,
|
||||||
avg_build_time: Duration(seconds: json["avg_build_time"]),
|
avg_build_time: Duration(seconds: json["avg_build_time"]),
|
||||||
repo_storage_size: json["repo_storage_size"] as int,
|
repo_storage_size: json["repo_storage_size"] as int,
|
||||||
active_builds: json["active_builds"] as int,
|
enqueued_builds: json["enqueued_builds"] as int,
|
||||||
total_packages: json["total_packages"] as int,
|
total_packages: json["total_packages"] as int,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -25,6 +25,6 @@ class Stats {
|
|||||||
required this.avg_queue_wait_time,
|
required this.avg_queue_wait_time,
|
||||||
required this.avg_build_time,
|
required this.avg_build_time,
|
||||||
required this.repo_storage_size,
|
required this.repo_storage_size,
|
||||||
required this.active_builds,
|
required this.enqueued_builds,
|
||||||
required this.total_packages});
|
required this.total_packages});
|
||||||
}
|
}
|
||||||
|
@ -60,7 +60,7 @@ class _DashboardScreenState extends State<DashboardScreen> {
|
|||||||
SidePanel(
|
SidePanel(
|
||||||
nrbuilds: stats.total_builds,
|
nrbuilds: stats.total_builds,
|
||||||
nrfailedbuilds: stats.failed_builds,
|
nrfailedbuilds: stats.failed_builds,
|
||||||
nrActiveBuilds: stats.active_builds),
|
nrEnqueuedBuilds: stats.enqueued_builds),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -73,7 +73,7 @@ class _DashboardScreenState extends State<DashboardScreen> {
|
|||||||
child: SidePanel(
|
child: SidePanel(
|
||||||
nrbuilds: stats.total_builds,
|
nrbuilds: stats.total_builds,
|
||||||
nrfailedbuilds: stats.failed_builds,
|
nrfailedbuilds: stats.failed_builds,
|
||||||
nrActiveBuilds: stats.active_builds),
|
nrEnqueuedBuilds: stats.enqueued_builds),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user