fix repo list item extra info

This commit is contained in:
mbecker20
2024-04-07 17:37:19 -07:00
parent d68ea2c28f
commit 1e5ed1d29e
3 changed files with 14 additions and 8 deletions

View File

@@ -28,7 +28,7 @@ use monitor_client::{
ProcedureListItemInfo, ProcedureQuerySpecifics,
},
repo::{
Repo, RepoConfig, RepoInfo, RepoListItem, RepoQuerySpecifics,
Repo, RepoConfig, RepoInfo, RepoListItem, RepoListItemInfo, RepoQuerySpecifics
},
resource::{AddFilters, Resource, ResourceQuery},
server::{
@@ -443,7 +443,7 @@ impl StateResource for Repo {
id: repo.id,
tags: repo.tags,
resource_type: ResourceTargetVariant::Repo,
info: RepoInfo {
info: RepoListItemInfo {
last_pulled_at: repo.info.last_pulled_at,
repo: repo.config.repo,
branch: repo.config.branch,

View File

@@ -3,7 +3,7 @@ use std::collections::HashMap;
use monitor_client::{
api::write::{CreateRepo, UpdateRepo},
entities::{
repo::{PartialRepoConfig, Repo, RepoInfo},
repo::{PartialRepoConfig, Repo, RepoListItemInfo},
resource::{Resource, ResourceListItem},
update::ResourceTarget,
},
@@ -13,7 +13,7 @@ use crate::{maps::name_to_repo, monitor_client, sync::ResourceSync};
impl ResourceSync for Repo {
type PartialConfig = PartialRepoConfig;
type ListItemInfo = RepoInfo;
type ListItemInfo = RepoListItemInfo;
fn display() -> &'static str {
"repo"

View File

@@ -13,17 +13,23 @@ use super::{
};
#[typeshare]
pub type Repo = Resource<RepoConfig, RepoInfo>;
pub type RepoListItem = ResourceListItem<RepoListItemInfo>;
#[typeshare]
pub type RepoListItem = ResourceListItem<RepoInfo>;
#[derive(Serialize, Deserialize, Debug, Clone, Default)]
pub struct RepoListItemInfo {
pub last_pulled_at: I64,
pub repo: String,
pub branch: String,
}
#[typeshare]
pub type Repo = Resource<RepoConfig, RepoInfo>;
#[typeshare]
#[derive(Serialize, Deserialize, Debug, Clone, Default)]
pub struct RepoInfo {
pub last_pulled_at: I64,
pub repo: String,
pub branch: String,
}
#[typeshare(serialized_as = "Partial<RepoConfig>")]