mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2025-07-16 05:26:11 +00:00
51 lines
1.1 KiB
Rust
51 lines
1.1 KiB
Rust
![]() |
use crate::entities::{CreateViewParams, ViewLayoutTypePB};
|
||
|
use crate::manager::Folder2Manager;
|
||
|
use crate::view_ext::gen_view_id;
|
||
|
use std::collections::HashMap;
|
||
|
|
||
|
#[cfg(feature = "test_helper")]
|
||
|
impl Folder2Manager {
|
||
|
pub async fn create_test_grid_view(
|
||
|
&self,
|
||
|
app_id: &str,
|
||
|
name: &str,
|
||
|
ext: HashMap<String, String>,
|
||
|
) -> String {
|
||
|
self
|
||
|
.create_test_view(app_id, name, ViewLayoutTypePB::Grid, ext)
|
||
|
.await
|
||
|
}
|
||
|
|
||
|
pub async fn create_test_board_view(
|
||
|
&self,
|
||
|
app_id: &str,
|
||
|
name: &str,
|
||
|
ext: HashMap<String, String>,
|
||
|
) -> String {
|
||
|
self
|
||
|
.create_test_view(app_id, name, ViewLayoutTypePB::Board, ext)
|
||
|
.await
|
||
|
}
|
||
|
|
||
|
async fn create_test_view(
|
||
|
&self,
|
||
|
app_id: &str,
|
||
|
name: &str,
|
||
|
layout: ViewLayoutTypePB,
|
||
|
ext: HashMap<String, String>,
|
||
|
) -> String {
|
||
|
let view_id = gen_view_id();
|
||
|
let params = CreateViewParams {
|
||
|
belong_to_id: app_id.to_string(),
|
||
|
name: name.to_string(),
|
||
|
desc: "".to_string(),
|
||
|
layout,
|
||
|
view_id: view_id.clone(),
|
||
|
initial_data: vec![],
|
||
|
ext,
|
||
|
};
|
||
|
self.create_view_with_params(params).await.unwrap();
|
||
|
view_id
|
||
|
}
|
||
|
}
|