Add paginated panel loading
This commit is contained in:
@@ -23,6 +23,12 @@ pub struct RepositoryRow {
|
||||
pub favorite: bool,
|
||||
}
|
||||
|
||||
#[derive(Clone, uniffi::Record)]
|
||||
pub struct RepositoryListPage {
|
||||
pub rows: Vec<RepositoryRow>,
|
||||
pub has_more: bool,
|
||||
}
|
||||
|
||||
#[derive(Clone, uniffi::Record)]
|
||||
pub struct LabelRow {
|
||||
pub name: String,
|
||||
@@ -40,6 +46,12 @@ pub struct IssueRow {
|
||||
pub labels: Vec<LabelRow>,
|
||||
}
|
||||
|
||||
#[derive(Clone, uniffi::Record)]
|
||||
pub struct IssueListPage {
|
||||
pub rows: Vec<IssueRow>,
|
||||
pub has_more: bool,
|
||||
}
|
||||
|
||||
#[derive(Clone, uniffi::Record)]
|
||||
pub struct PullRow {
|
||||
pub number: i64,
|
||||
@@ -65,6 +77,7 @@ pub struct IssuePage {
|
||||
pub milestone: String,
|
||||
pub body: String,
|
||||
pub comments: Vec<CommentRow>,
|
||||
pub has_more: bool,
|
||||
}
|
||||
|
||||
#[derive(Clone, uniffi::Record)]
|
||||
@@ -115,6 +128,13 @@ pub struct MilestonePage {
|
||||
pub milestone: MilestoneRow,
|
||||
pub issues: Vec<IssueRow>,
|
||||
pub pulls: Vec<PullRow>,
|
||||
pub has_more: bool,
|
||||
}
|
||||
|
||||
#[derive(Clone, uniffi::Record)]
|
||||
pub struct MilestoneListPage {
|
||||
pub rows: Vec<MilestoneRow>,
|
||||
pub has_more: bool,
|
||||
}
|
||||
|
||||
#[derive(Clone, uniffi::Record)]
|
||||
@@ -131,6 +151,13 @@ pub struct PullPage {
|
||||
pub files_ref: String,
|
||||
pub files: Vec<FileRow>,
|
||||
pub comments: Vec<CommentRow>,
|
||||
pub has_more: bool,
|
||||
}
|
||||
|
||||
#[derive(Clone, uniffi::Record)]
|
||||
pub struct PullListPage {
|
||||
pub rows: Vec<PullRow>,
|
||||
pub has_more: bool,
|
||||
}
|
||||
|
||||
#[derive(Clone, uniffi::Record)]
|
||||
@@ -149,6 +176,7 @@ pub struct CommitPage {
|
||||
pub branches: Vec<String>,
|
||||
pub commits: Vec<CommitRow>,
|
||||
pub lane_count: u32,
|
||||
pub has_more: bool,
|
||||
}
|
||||
|
||||
#[derive(Clone, uniffi::Record)]
|
||||
@@ -157,6 +185,12 @@ pub struct FileRow {
|
||||
pub status: String,
|
||||
}
|
||||
|
||||
#[derive(Clone, uniffi::Record)]
|
||||
pub struct FileListPage {
|
||||
pub rows: Vec<FileRow>,
|
||||
pub has_more: bool,
|
||||
}
|
||||
|
||||
#[derive(Clone, uniffi::Record)]
|
||||
pub struct RepositoryContentRow {
|
||||
pub name: String,
|
||||
@@ -216,6 +250,7 @@ pub struct HomePage {
|
||||
pub pull_activities: Vec<ActivityRow>,
|
||||
pub heat_cells: Vec<HeatCell>,
|
||||
pub contribution_count: i64,
|
||||
pub has_more: bool,
|
||||
}
|
||||
|
||||
pub fn repository_rows(
|
||||
@@ -323,6 +358,7 @@ pub fn milestone_page(details: MilestoneDetails) -> MilestonePage {
|
||||
milestone: milestone_row(&details.milestone),
|
||||
issues: issue_rows(&details.issues),
|
||||
pulls: pull_rows(&details.pulls),
|
||||
has_more: details.has_more,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -389,6 +425,7 @@ pub fn commit_page(
|
||||
branches: Vec<String>,
|
||||
commits: &[HistoryCommit],
|
||||
show_graph: bool,
|
||||
has_more: bool,
|
||||
) -> CommitPage {
|
||||
let lane_count = if show_graph {
|
||||
commits
|
||||
@@ -454,6 +491,7 @@ pub fn commit_page(
|
||||
branches,
|
||||
commits,
|
||||
lane_count: lane_count as u32,
|
||||
has_more,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -477,6 +515,7 @@ pub fn issue_page(details: IssueDetails) -> IssuePage {
|
||||
.filter(|body| !body.is_empty())
|
||||
.unwrap_or_else(|| "No description provided.".into()),
|
||||
comments: details.comments.iter().map(comment_row).collect(),
|
||||
has_more: details.has_more,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -589,6 +628,7 @@ pub fn pull_page(details: PullDetails) -> PullPage {
|
||||
files_ref: pull_files_ref(pull),
|
||||
files: details.files.iter().filter_map(file_row).collect(),
|
||||
comments: details.comments.iter().map(comment_row).collect(),
|
||||
has_more: details.has_more,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -722,6 +762,7 @@ pub fn home_page(server_name: String, home: HomeData) -> HomePage {
|
||||
activities: home.activities.iter().map(activity_row).collect(),
|
||||
heat_cells,
|
||||
contribution_count,
|
||||
has_more: home.has_more,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1213,6 +1254,7 @@ mod tests {
|
||||
})
|
||||
.collect(),
|
||||
heatmap: Vec::new(),
|
||||
has_more: false,
|
||||
},
|
||||
);
|
||||
|
||||
@@ -1229,6 +1271,7 @@ mod tests {
|
||||
..Default::default()
|
||||
},
|
||||
comments: Vec::new(),
|
||||
has_more: false,
|
||||
});
|
||||
|
||||
assert_eq!(page.state, "closed");
|
||||
@@ -1331,6 +1374,7 @@ mod tests {
|
||||
})),
|
||||
..Default::default()
|
||||
}],
|
||||
has_more: false,
|
||||
});
|
||||
|
||||
assert!(page.issues.is_empty());
|
||||
|
||||
Reference in New Issue
Block a user