add building state to repo

This commit is contained in:
mbecker20
2024-08-11 17:46:26 -07:00
parent 896784e2e3
commit 14474adb90
6 changed files with 28 additions and 3 deletions

View File

@@ -107,11 +107,16 @@ impl Resolve<GetReposSummary, User> for State {
(_, action_states) if action_states.pulling => {
res.pulling += 1;
}
(_, action_states) if action_states.building => {
res.building += 1;
}
(RepoState::Ok, _) => res.ok += 1,
(RepoState::Failed, _) => res.failed += 1,
(RepoState::Unknown, _) => res.unknown += 1,
// will never come off the cache in the building state, since that comes from action states
(RepoState::Cloning, _) | (RepoState::Pulling, _) => {
(RepoState::Cloning, _)
| (RepoState::Pulling, _)
| (RepoState::Building, _) => {
unreachable!()
}
}

View File

@@ -239,6 +239,8 @@ async fn get_repo_state(id: &String) -> RepoState {
Some(RepoState::Cloning)
} else if s.pulling {
Some(RepoState::Pulling)
} else if s.building {
Some(RepoState::Building)
} else {
None
}

View File

@@ -105,6 +105,8 @@ pub struct GetReposSummaryResponse {
pub cloning: u32,
/// The number of repos currently pulling.
pub pulling: u32,
/// The number of repos currently building.
pub building: u32,
/// The number of repos with failed state.
pub failed: u32,
/// The number of repos with unknown state.

View File

@@ -59,8 +59,10 @@ pub enum RepoState {
Failed,
/// Currently cloning
Cloning,
/// Currently pullling
/// Currently pulling
Pulling,
/// Currently building
Building,
}
#[typeshare]

View File

@@ -1060,8 +1060,10 @@ export enum RepoState {
Failed = "Failed",
/** Currently cloning */
Cloning = "Cloning",
/** Currently pullling */
/** Currently pulling */
Pulling = "Pulling",
/** Currently building */
Building = "Building",
}
export interface RepoListItemInfo {
@@ -1617,10 +1619,14 @@ export enum StackState {
Paused = "paused",
/** All contianers are stopped */
Stopped = "stopped",
/** All containers are created */
Created = "created",
/** All containers are restarting */
Restarting = "restarting",
/** All containers are dead */
Dead = "dead",
/** All containers are removing */
Removing = "removing",
/** The containers are in a mix of states */
Unhealthy = "unhealthy",
/** The stack is not deployed */
@@ -3231,6 +3237,8 @@ export interface GetReposSummaryResponse {
cloning: number;
/** The number of repos currently pulling. */
pulling: number;
/** The number of repos currently building. */
building: number;
/** The number of repos with failed state. */
failed: number;
/** The number of repos with unknown state. */
@@ -3586,6 +3594,10 @@ export interface GetStacksSummaryResponse {
restarting: number;
/** The number of stacks with Dead state. */
dead: number;
/** The number of stacks with Created state. */
created: number;
/** The number of stacks with Removing state. */
removing: number;
/** The number of stacks with Unhealthy state. */
unhealthy: number;
/** The number of stacks with Down state. */

View File

@@ -156,6 +156,8 @@ export const repo_state_intention = (state?: Types.RepoState) => {
return "Warning";
case Types.RepoState.Pulling:
return "Warning";
case Types.RepoState.Building:
return "Warning";
case Types.RepoState.Failed:
return "Critical";
default: