fix(m162-rebase): M161 合入后三处越线文件回到 400 行内
rebase 到 0241f79(M161)之后,两侧各加了几行,这三个文件同时越过 400 行硬线 (guards.yml::file-size 会红)。处理原则:**不删语义、只搬位置**。 - `app-iced/src/pages/content/parts.rs` 410 → **240**:把状态层(loading / empty / failed / offline / centered / status_body)搬到新文件 `pages/content/parts/status.rs`(200 行)。 状态层本来就是「一屏只有一个」的独立东西,拆开后 parts.rs 只剩筛选条、列表、图标与排序文案。 - `presenter/src/dto/events.rs` 402 → **399**:`CoreEvent::ContentDetail` 的文档由 4 行压成 1 行 (字段说明一个不少,`project` 是请求时选中的 id 这句保留)。 - `presenter/src/state.rs` 404 → **400**:把 `ContentFailed` / `ContentDetail` 两个事件的落地 搬进 `state/content.rs`(`apply_content_failure` / `apply_content_detail`),state.rs 只剩 一行投递——与既有的 `apply_content` 同一个形状。 `state/content.rs` 58 → 64(两个新方法),仍在 400 内。语义零改动:只是投递点换文件。
This commit is contained in:
1 parent
47ed270293
commit
c319f9dbfd
5 files changed
+228
-186
No files matched your search
@@ -139,10 +139,7 @@ pub enum CoreEvent {
|
||||
ContentResults(Box<ContentResults>),
|
||||
/// 内容库检索失败(M109;M162 起带大类):没网 / 站点 5xx / 缺密钥要能分开画
|
||||
ContentFailed(Box<crate::dto::ContentFailure>),
|
||||
/// 内容库项目详情 + 版本列表(M162):选中项目后单独一条通道。
|
||||
///
|
||||
/// `project` 是**请求时选中的那个 id**:迟到的结果要靠它判「还算不算当前这次」
|
||||
/// (用户可能已经切到别的项目了)。
|
||||
/// 内容库项目详情 + 版本列表(M162):`project` 是**请求时**选中的 id,迟到结果靠它判。
|
||||
ContentDetail {
|
||||
/// 请求时选中的项目 id
|
||||
project: String,
|
||||
|
||||
@@ -296,15 +296,11 @@ impl AppState {
|
||||
// M113: import/export
|
||||
CoreEvent::Pack(event) => self.pack.apply(*event),
|
||||
CoreEvent::ContentResults(results) => self.apply_content(*results),
|
||||
CoreEvent::ContentFailed(failure) => {
|
||||
self.content.pending = false;
|
||||
self.content.failed = Some(*failure);
|
||||
CoreEvent::ContentFailed(failure) => self.apply_content_failure(*failure),
|
||||
// M162:详情/版本列表(判断逻辑在 `state/content.rs`,这里只有一行投递)
|
||||
CoreEvent::ContentDetail { project, result } => {
|
||||
self.apply_content_detail(&project, *result);
|
||||
}
|
||||
// M162:详情/版本列表(选中项才拉;迟到结果按项目 id 丢)
|
||||
CoreEvent::ContentDetail { project, result } => match *result {
|
||||
Ok(detail) => self.content.apply_detail(&project, detail),
|
||||
Err(failure) => self.content.fail_detail(&project, failure),
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
//! 从 `state.rs` 拆出(那个文件重新合流 M105 之后贴着 400 行上限)。放在 `impl AppState` 的
|
||||
//! **另一个 impl 块**里,路径与可见性都不变:`apply_core` 直接调 `self.apply_content(..)`。
|
||||
|
||||
use crate::dto::{ContentQuery, ContentResults};
|
||||
use crate::dto::{ContentDetail, ContentFailure, ContentQuery, ContentResults};
|
||||
|
||||
use super::AppState;
|
||||
|
||||
@@ -31,6 +31,25 @@ impl AppState {
|
||||
}
|
||||
}
|
||||
|
||||
/// 检索失败落地(M162 起带大类):清掉「在飞」并记下失败。
|
||||
pub(super) fn apply_content_failure(&mut self, failure: ContentFailure) {
|
||||
self.content.pending = false;
|
||||
self.content.failed = Some(failure);
|
||||
}
|
||||
|
||||
/// 详情事件落地(M162):`Ok` 走 `apply_detail`、`Err` 走 `fail_detail`,两者都按
|
||||
/// **请求时的项目 id** 判迟到(用户可能已经切到别的项目了)。
|
||||
pub(super) fn apply_content_detail(
|
||||
&mut self,
|
||||
project: &str,
|
||||
result: Result<ContentDetail, ContentFailure>,
|
||||
) {
|
||||
match result {
|
||||
Ok(detail) => self.content.apply_detail(project, detail),
|
||||
Err(failure) => self.content.fail_detail(project, failure),
|
||||
}
|
||||
}
|
||||
|
||||
/// 记下新的检索条件并进入「请求在飞」态(指令由调用方随后 dispatch)。
|
||||
pub fn set_content_query(&mut self, query: ContentQuery) {
|
||||
self.content.pending = true;
|
||||
|
||||
Reference in new issue
Block a user