mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
chore: config test log
This commit is contained in:
parent
a049034110
commit
f4b206d196
4
.github/workflows/rust_test.yml
vendored
4
.github/workflows/rust_test.yml
vendored
@ -44,8 +44,8 @@ jobs:
|
||||
|
||||
- name: Run rust-lib tests
|
||||
working-directory: frontend/rust-lib
|
||||
run: cargo test --no-default-features
|
||||
run: RUST_LOG=info cargo test --no-default-features
|
||||
|
||||
- name: Run shared-lib tests
|
||||
working-directory: shared-lib
|
||||
run: cargo test --no-default-features
|
||||
run: RUST_LOG=info cargo test --no-default-features
|
4
frontend/.vscode/launch.json
vendored
4
frontend/.vscode/launch.json
vendored
@ -11,7 +11,7 @@
|
||||
"type": "dart",
|
||||
"preLaunchTask": "build_flowy_sdk",
|
||||
"env":{
|
||||
"RUST_LOG":"info",
|
||||
"RUST_LOG":"info"
|
||||
},
|
||||
"cwd": "${workspaceRoot}/app_flowy"
|
||||
},
|
||||
@ -22,7 +22,7 @@
|
||||
"type": "dart",
|
||||
"preLaunchTask": "build_flowy_sdk",
|
||||
"env":{
|
||||
"RUST_LOG":"trace",
|
||||
"RUST_LOG":"trace"
|
||||
},
|
||||
"cwd": "${workspaceRoot}/app_flowy"
|
||||
},
|
||||
|
@ -45,7 +45,7 @@ FLUTTER_FLOWY_SDK_PATH="app_flowy/packages/flowy_sdk"
|
||||
PROTOBUF_DERIVE_CACHE="../shared-lib/flowy-derive/src/derive_cache/derive_cache.rs"
|
||||
|
||||
[env.development-mac]
|
||||
RUST_LOG = "trace"
|
||||
RUST_LOG = "info"
|
||||
TARGET_OS = "macos"
|
||||
RUST_COMPILE_TARGET = "x86_64-apple-darwin"
|
||||
BUILD_FLAG = "debug"
|
||||
|
@ -1,6 +1,7 @@
|
||||
import 'package:app_flowy/startup/startup.dart';
|
||||
import 'package:app_flowy/workspace/application/grid/prelude.dart';
|
||||
import 'package:app_flowy/workspace/presentation/plugins/grid/src/widgets/cell/cell_container.dart';
|
||||
import 'package:flowy_infra/theme.dart';
|
||||
import 'package:flowy_infra_ui/flowy_infra_ui.dart';
|
||||
import 'package:flowy_infra_ui/style_widget/text.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
@ -85,18 +86,31 @@ class _CellCalendar extends StatefulWidget with FlowyOverlayDelegate {
|
||||
required VoidCallback onDismissed,
|
||||
}) async {
|
||||
_CellCalendar.remove(context);
|
||||
final window = await getWindowInfo();
|
||||
|
||||
final calendar = _CellCalendar(onSelected: onSelected, onDismissed: onDismissed);
|
||||
const size = Size(460, 400);
|
||||
FlowyOverlay.of(context).insertWithRect(
|
||||
// const size = Size(460, 400);
|
||||
// final window = await getWindowInfo();
|
||||
// FlowyOverlay.of(context).insertWithRect(
|
||||
// widget: OverlayContainer(
|
||||
// child: calendar,
|
||||
// constraints: BoxConstraints.loose(const Size(460, 400)),
|
||||
// ),
|
||||
// identifier: _CellCalendar.identifier(),
|
||||
// anchorPosition: Offset(-size.width / 2.0, -size.height / 2.0),
|
||||
// anchorSize: window.frame.size,
|
||||
// anchorDirection: AnchorDirection.center,
|
||||
// style: FlowyOverlayStyle(blur: false),
|
||||
// delegate: calendar,
|
||||
// );
|
||||
|
||||
FlowyOverlay.of(context).insertWithAnchor(
|
||||
widget: OverlayContainer(
|
||||
child: calendar,
|
||||
constraints: BoxConstraints.loose(const Size(460, 400)),
|
||||
constraints: BoxConstraints.loose(const Size(300, 320)),
|
||||
),
|
||||
identifier: _CellCalendar.identifier(),
|
||||
anchorPosition: Offset(-size.width / 2.0, -size.height / 2.0),
|
||||
anchorSize: window.frame.size,
|
||||
anchorDirection: AnchorDirection.center,
|
||||
anchorContext: context,
|
||||
anchorDirection: AnchorDirection.bottomWithCenterAligned,
|
||||
style: FlowyOverlayStyle(blur: false),
|
||||
delegate: calendar,
|
||||
);
|
||||
@ -121,12 +135,32 @@ class _CellCalendarState extends State<_CellCalendar> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final theme = context.watch<AppTheme>();
|
||||
return TableCalendar(
|
||||
firstDay: kFirstDay,
|
||||
lastDay: kLastDay,
|
||||
focusedDay: _focusedDay,
|
||||
rowHeight: 40,
|
||||
calendarFormat: _calendarFormat,
|
||||
headerStyle: const HeaderStyle(formatButtonVisible: false),
|
||||
calendarStyle: CalendarStyle(
|
||||
selectedDecoration: BoxDecoration(
|
||||
color: theme.main1,
|
||||
shape: BoxShape.circle,
|
||||
),
|
||||
todayDecoration: BoxDecoration(
|
||||
color: theme.shader4,
|
||||
shape: BoxShape.circle,
|
||||
),
|
||||
selectedTextStyle: TextStyle(
|
||||
color: theme.surface,
|
||||
fontSize: 14.0,
|
||||
),
|
||||
todayTextStyle: TextStyle(
|
||||
color: theme.surface,
|
||||
fontSize: 14.0,
|
||||
),
|
||||
),
|
||||
selectedDayPredicate: (day) {
|
||||
return isSameDay(_selectedDay, day);
|
||||
},
|
||||
|
@ -46,4 +46,4 @@ lib-infra = { path = "../../../shared-lib/lib-infra", features = ["protobuf_file
|
||||
default = []
|
||||
http_server = []
|
||||
flowy_unit_test = ["lib-ot/flowy_unit_test", "flowy-revision/flowy_unit_test"]
|
||||
dart = ["lib-infra/dart", "flowy-folder/dart"]
|
||||
dart = ["lib-infra/dart"]
|
@ -221,7 +221,7 @@ async fn handle_trash_event(
|
||||
}
|
||||
}
|
||||
|
||||
#[tracing::instrument(skip(workspace_id, trash_controller, transaction), err)]
|
||||
#[tracing::instrument(level = "debug", skip(workspace_id, trash_controller, transaction), err)]
|
||||
fn notify_apps_changed<'a>(
|
||||
workspace_id: &str,
|
||||
trash_controller: Arc<TrashController>,
|
||||
|
@ -36,7 +36,7 @@ pub(crate) async fn delete_app_handler(
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[tracing::instrument(skip(data, controller))]
|
||||
#[tracing::instrument(level = "debug", skip(data, controller))]
|
||||
pub(crate) async fn update_app_handler(
|
||||
data: Data<UpdateAppPayload>,
|
||||
controller: AppData<Arc<AppController>>,
|
||||
@ -46,7 +46,7 @@ pub(crate) async fn update_app_handler(
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[tracing::instrument(skip(data, app_controller, view_controller))]
|
||||
#[tracing::instrument(level = "debug", skip(data, app_controller, view_controller))]
|
||||
pub(crate) async fn read_app_handler(
|
||||
data: Data<AppId>,
|
||||
app_controller: AppData<Arc<AppController>>,
|
||||
|
@ -274,7 +274,7 @@ impl TrashController {
|
||||
}
|
||||
}
|
||||
|
||||
#[tracing::instrument(skip(repeated_trash), fields(n_trash))]
|
||||
#[tracing::instrument(level = "debug", skip(repeated_trash), fields(n_trash))]
|
||||
fn notify_trash_changed(repeated_trash: RepeatedTrash) {
|
||||
tracing::Span::current().record("n_trash", &repeated_trash.len());
|
||||
send_anonymous_dart_notification(FolderNotification::TrashUpdated)
|
||||
|
@ -6,7 +6,7 @@ use crate::{
|
||||
use lib_dispatch::prelude::{data_result, AppData, Data, DataResult};
|
||||
use std::sync::Arc;
|
||||
|
||||
#[tracing::instrument(skip(controller), err)]
|
||||
#[tracing::instrument(level = "debug", skip(controller), err)]
|
||||
pub(crate) async fn read_trash_handler(
|
||||
controller: AppData<Arc<TrashController>>,
|
||||
) -> DataResult<RepeatedTrash, FlowyError> {
|
||||
@ -14,7 +14,7 @@ pub(crate) async fn read_trash_handler(
|
||||
data_result(repeated_trash)
|
||||
}
|
||||
|
||||
#[tracing::instrument(skip(identifier, controller), err)]
|
||||
#[tracing::instrument(level = "debug", skip(identifier, controller), err)]
|
||||
pub(crate) async fn putback_trash_handler(
|
||||
identifier: Data<TrashId>,
|
||||
controller: AppData<Arc<TrashController>>,
|
||||
@ -23,7 +23,7 @@ pub(crate) async fn putback_trash_handler(
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[tracing::instrument(skip(identifiers, controller), err)]
|
||||
#[tracing::instrument(level = "debug", skip(identifiers, controller), err)]
|
||||
pub(crate) async fn delete_trash_handler(
|
||||
identifiers: Data<RepeatedTrashId>,
|
||||
controller: AppData<Arc<TrashController>>,
|
||||
@ -32,13 +32,13 @@ pub(crate) async fn delete_trash_handler(
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[tracing::instrument(skip(controller), err)]
|
||||
#[tracing::instrument(level = "debug", skip(controller), err)]
|
||||
pub(crate) async fn restore_all_trash_handler(controller: AppData<Arc<TrashController>>) -> Result<(), FlowyError> {
|
||||
let _ = controller.restore_all_trash().await?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[tracing::instrument(skip(controller), err)]
|
||||
#[tracing::instrument(level = "debug", skip(controller), err)]
|
||||
pub(crate) async fn delete_all_trash_handler(controller: AppData<Arc<TrashController>>) -> Result<(), FlowyError> {
|
||||
let _ = controller.delete_all_trash().await?;
|
||||
Ok(())
|
||||
|
@ -100,7 +100,7 @@ impl ViewController {
|
||||
.await
|
||||
}
|
||||
|
||||
#[tracing::instrument(skip(self, view_id), fields(view_id = %view_id.value), err)]
|
||||
#[tracing::instrument(level = "debug", skip(self, view_id), fields(view_id = %view_id.value), err)]
|
||||
pub(crate) async fn read_view(&self, view_id: ViewId) -> Result<View, FlowyError> {
|
||||
let view = self
|
||||
.persistence
|
||||
@ -224,14 +224,14 @@ impl ViewController {
|
||||
}
|
||||
|
||||
impl ViewController {
|
||||
#[tracing::instrument(skip(self), err)]
|
||||
#[tracing::instrument(level = "debug", skip(self), err)]
|
||||
async fn create_view_on_server(&self, params: CreateViewParams) -> Result<View, FlowyError> {
|
||||
let token = self.user.token()?;
|
||||
let view = self.cloud_service.create_view(&token, params).await?;
|
||||
Ok(view)
|
||||
}
|
||||
|
||||
#[tracing::instrument(skip(self), err)]
|
||||
#[tracing::instrument(level = "debug", skip(self), err)]
|
||||
fn update_view_on_server(&self, params: UpdateViewParams) -> Result<(), FlowyError> {
|
||||
let token = self.user.token()?;
|
||||
let server = self.cloud_service.clone();
|
||||
@ -247,7 +247,7 @@ impl ViewController {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[tracing::instrument(skip(self), err)]
|
||||
#[tracing::instrument(level = "debug", skip(self), err)]
|
||||
fn read_view_on_server(&self, params: ViewId) -> Result<(), FlowyError> {
|
||||
let token = self.user.token()?;
|
||||
let server = self.cloud_service.clone();
|
||||
@ -424,7 +424,12 @@ fn notify_dart(view: View, notification: FolderNotification) {
|
||||
send_dart_notification(&view.id, notification).payload(view).send();
|
||||
}
|
||||
|
||||
#[tracing::instrument(skip(belong_to_id, trash_controller, transaction), fields(view_count), err)]
|
||||
#[tracing::instrument(
|
||||
level = "debug",
|
||||
skip(belong_to_id, trash_controller, transaction),
|
||||
fields(view_count),
|
||||
err
|
||||
)]
|
||||
fn notify_views_changed<'a>(
|
||||
belong_to_id: &str,
|
||||
trash_controller: Arc<TrashController>,
|
||||
|
@ -33,7 +33,7 @@ pub(crate) async fn read_view_handler(
|
||||
data_result(view)
|
||||
}
|
||||
|
||||
#[tracing::instrument(skip(data, controller), err)]
|
||||
#[tracing::instrument(level = "debug", skip(data, controller), err)]
|
||||
pub(crate) async fn update_view_handler(
|
||||
data: Data<UpdateViewPayload>,
|
||||
controller: AppData<Arc<ViewController>>,
|
||||
@ -83,7 +83,7 @@ pub(crate) async fn close_view_handler(
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[tracing::instrument(skip(data, controller), err)]
|
||||
#[tracing::instrument(level = "debug", skip(data, controller), err)]
|
||||
pub(crate) async fn duplicate_view_handler(
|
||||
data: Data<ViewId>,
|
||||
controller: AppData<Arc<ViewController>>,
|
||||
|
@ -13,7 +13,7 @@ use flowy_folder_data_model::entities::{
|
||||
use lib_dispatch::prelude::{data_result, AppData, Data, DataResult};
|
||||
use std::{convert::TryInto, sync::Arc};
|
||||
|
||||
#[tracing::instrument(skip(data, controller), err)]
|
||||
#[tracing::instrument(level = "debug", skip(data, controller), err)]
|
||||
pub(crate) async fn create_workspace_handler(
|
||||
data: Data<CreateWorkspacePayload>,
|
||||
controller: AppData<Arc<WorkspaceController>>,
|
||||
@ -24,7 +24,7 @@ pub(crate) async fn create_workspace_handler(
|
||||
data_result(detail)
|
||||
}
|
||||
|
||||
#[tracing::instrument(skip(controller), err)]
|
||||
#[tracing::instrument(level = "debug", skip(controller), err)]
|
||||
pub(crate) async fn read_workspace_apps_handler(
|
||||
controller: AppData<Arc<WorkspaceController>>,
|
||||
) -> DataResult<RepeatedApp, FlowyError> {
|
||||
@ -32,7 +32,7 @@ pub(crate) async fn read_workspace_apps_handler(
|
||||
data_result(repeated_app)
|
||||
}
|
||||
|
||||
#[tracing::instrument(skip(data, controller), err)]
|
||||
#[tracing::instrument(level = "debug", skip(data, controller), err)]
|
||||
pub(crate) async fn open_workspace_handler(
|
||||
data: Data<WorkspaceId>,
|
||||
controller: AppData<Arc<WorkspaceController>>,
|
||||
@ -42,7 +42,7 @@ pub(crate) async fn open_workspace_handler(
|
||||
data_result(workspaces)
|
||||
}
|
||||
|
||||
#[tracing::instrument(skip(data, folder), err)]
|
||||
#[tracing::instrument(level = "debug", skip(data, folder), err)]
|
||||
pub(crate) async fn read_workspaces_handler(
|
||||
data: Data<WorkspaceId>,
|
||||
folder: AppData<Arc<FolderManager>>,
|
||||
@ -69,7 +69,7 @@ pub(crate) async fn read_workspaces_handler(
|
||||
data_result(workspaces)
|
||||
}
|
||||
|
||||
#[tracing::instrument(skip(folder), err)]
|
||||
#[tracing::instrument(level = "debug", skip(folder), err)]
|
||||
pub async fn read_cur_workspace_handler(
|
||||
folder: AppData<Arc<FolderManager>>,
|
||||
) -> DataResult<CurrentWorkspaceSetting, FlowyError> {
|
||||
|
@ -197,10 +197,11 @@ impl std::default::Default for TimeFormat {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use crate::services::field::DateTypeOption;
|
||||
use crate::services::field::FieldBuilder;
|
||||
use crate::services::row::CellDataOperation;
|
||||
use crate::services::field::{DateFormat, DateTypeOption, TimeFormat};
|
||||
use crate::services::row::{CellDataOperation, TypeOptionCellData};
|
||||
use flowy_grid_data_model::entities::FieldType;
|
||||
use strum::IntoEnumIterator;
|
||||
|
||||
#[test]
|
||||
fn date_description_invalid_input_test() {
|
||||
@ -221,33 +222,35 @@ mod tests {
|
||||
match date_format {
|
||||
DateFormat::Friendly => {
|
||||
assert_eq!(
|
||||
"Mar 14,2022 17:56".to_owned(),
|
||||
"Mar 14,2022".to_owned(),
|
||||
type_option.decode_cell_data(data("1647251762"), &field_meta)
|
||||
);
|
||||
assert_eq!(
|
||||
"Mar 14,2022 17:56".to_owned(),
|
||||
// "Mar 14,2022".to_owned(),
|
||||
"".to_owned(),
|
||||
type_option.decode_cell_data(data("Mar 14,2022 17:56"), &field_meta)
|
||||
);
|
||||
}
|
||||
DateFormat::US => {
|
||||
assert_eq!(
|
||||
"2022/03/14 17:56".to_owned(),
|
||||
"2022/03/14".to_owned(),
|
||||
type_option.decode_cell_data(data("1647251762"), &field_meta)
|
||||
);
|
||||
assert_eq!(
|
||||
"2022/03/14 17:56".to_owned(),
|
||||
// "2022/03/14".to_owned(),
|
||||
"".to_owned(),
|
||||
type_option.decode_cell_data(data("2022/03/14 17:56"), &field_meta)
|
||||
);
|
||||
}
|
||||
DateFormat::ISO => {
|
||||
assert_eq!(
|
||||
"2022-03-14 17:56".to_owned(),
|
||||
"2022-03-14".to_owned(),
|
||||
type_option.decode_cell_data(data("1647251762"), &field_meta)
|
||||
);
|
||||
}
|
||||
DateFormat::Local => {
|
||||
assert_eq!(
|
||||
"2022/03/14 17:56".to_owned(),
|
||||
"2022/03/14".to_owned(),
|
||||
type_option.decode_cell_data(data("1647251762"), &field_meta)
|
||||
);
|
||||
}
|
||||
@ -263,22 +266,16 @@ mod tests {
|
||||
type_option.time_format = time_format;
|
||||
match time_format {
|
||||
TimeFormat::TwentyFourHour => {
|
||||
assert_eq!("Mar 14,2022".to_owned(), type_option.today_from_timestamp(1647251762));
|
||||
assert_eq!(
|
||||
"Mar 14,2022 17:56".to_owned(),
|
||||
type_option.today_from_timestamp(1647251762)
|
||||
);
|
||||
assert_eq!(
|
||||
"Mar 14,2022 17:56".to_owned(),
|
||||
"Mar 14,2022".to_owned(),
|
||||
type_option.decode_cell_data(data("1647251762"), &field_meta)
|
||||
);
|
||||
}
|
||||
TimeFormat::TwelveHour => {
|
||||
assert_eq!("Mar 14,2022".to_owned(), type_option.today_from_timestamp(1647251762));
|
||||
assert_eq!(
|
||||
"Mar 14,2022 05:56:02 PM".to_owned(),
|
||||
type_option.today_from_timestamp(1647251762)
|
||||
);
|
||||
assert_eq!(
|
||||
"Mar 14,2022 05:56:02 PM".to_owned(),
|
||||
"Mar 14,2022".to_owned(),
|
||||
type_option.decode_cell_data(data("1647251762"), &field_meta)
|
||||
);
|
||||
}
|
||||
|
@ -65,53 +65,57 @@ impl CellDataOperation for RichTextTypeOption {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use crate::services::field::FieldBuilder;
|
||||
use crate::services::field::*;
|
||||
use crate::services::row::{CellDataOperation, TypeOptionCellData};
|
||||
use flowy_grid_data_model::entities::FieldType;
|
||||
|
||||
// #[test]
|
||||
// fn text_description_test() {
|
||||
// let type_option = RichTextTypeOption::default();
|
||||
//
|
||||
// // date
|
||||
// let date_time_field_meta = FieldBuilder::from_field_type(&FieldType::DateTime).build();
|
||||
// let data = TypeOptionCellData::new("1647251762", FieldType::DateTime).json();
|
||||
// assert_eq!(
|
||||
// type_option.decode_cell_data(data, &date_time_field_meta),
|
||||
// "Mar 14,2022 17:56".to_owned()
|
||||
// );
|
||||
//
|
||||
// // Single select
|
||||
// let done_option = SelectOption::new("Done");
|
||||
// let done_option_id = done_option.id.clone();
|
||||
// let single_select = SingleSelectTypeOptionBuilder::default().option(done_option);
|
||||
// let single_select_field_meta = FieldBuilder::new(single_select).build();
|
||||
// let cell_data = TypeOptionCellData::new(&done_option_id, FieldType::SingleSelect).json();
|
||||
// assert_eq!(
|
||||
// type_option.decode_cell_data(cell_data, &single_select_field_meta),
|
||||
// "Done".to_owned()
|
||||
// );
|
||||
//
|
||||
// // Multiple select
|
||||
// let google_option = SelectOption::new("Google");
|
||||
// let facebook_option = SelectOption::new("Facebook");
|
||||
// let ids = vec![google_option.id.clone(), facebook_option.id.clone()].join(SELECTION_IDS_SEPARATOR);
|
||||
// let cell_data_changeset = SelectOptionCellChangeset::from_insert(&ids).cell_data();
|
||||
// let multi_select = MultiSelectTypeOptionBuilder::default()
|
||||
// .option(google_option)
|
||||
// .option(facebook_option);
|
||||
// let multi_select_field_meta = FieldBuilder::new(multi_select).build();
|
||||
// let multi_type_option = MultiSelectTypeOption::from(&multi_select_field_meta);
|
||||
// let cell_data = multi_type_option.apply_changeset(cell_data_changeset, None).unwrap();
|
||||
// assert_eq!(
|
||||
// type_option.decode_cell_data(cell_data, &multi_select_field_meta),
|
||||
// "Google,Facebook".to_owned()
|
||||
// );
|
||||
//
|
||||
// //Number
|
||||
// let number = NumberTypeOptionBuilder::default().set_format(NumberFormat::USD);
|
||||
// let number_field_meta = FieldBuilder::new(number).build();
|
||||
// let data = TypeOptionCellData::new("18443", FieldType::Number).json();
|
||||
// assert_eq!(
|
||||
// type_option.decode_cell_data(data, &number_field_meta),
|
||||
// "$18,443".to_owned()
|
||||
// );
|
||||
// }
|
||||
#[test]
|
||||
fn text_description_test() {
|
||||
let type_option = RichTextTypeOption::default();
|
||||
|
||||
// date
|
||||
let date_time_field_meta = FieldBuilder::from_field_type(&FieldType::DateTime).build();
|
||||
let data = TypeOptionCellData::new("1647251762", FieldType::DateTime).json();
|
||||
assert_eq!(
|
||||
type_option.decode_cell_data(data, &date_time_field_meta),
|
||||
"Mar 14,2022".to_owned()
|
||||
);
|
||||
|
||||
// Single select
|
||||
let done_option = SelectOption::new("Done");
|
||||
let done_option_id = done_option.id.clone();
|
||||
let single_select = SingleSelectTypeOptionBuilder::default().option(done_option);
|
||||
let single_select_field_meta = FieldBuilder::new(single_select).build();
|
||||
let cell_data = TypeOptionCellData::new(&done_option_id, FieldType::SingleSelect).json();
|
||||
assert_eq!(
|
||||
type_option.decode_cell_data(cell_data, &single_select_field_meta),
|
||||
"Done".to_owned()
|
||||
);
|
||||
|
||||
// Multiple select
|
||||
let google_option = SelectOption::new("Google");
|
||||
let facebook_option = SelectOption::new("Facebook");
|
||||
let ids = vec![google_option.id.clone(), facebook_option.id.clone()].join(SELECTION_IDS_SEPARATOR);
|
||||
let cell_data_changeset = SelectOptionCellChangeset::from_insert(&ids).cell_data();
|
||||
let multi_select = MultiSelectTypeOptionBuilder::default()
|
||||
.option(google_option)
|
||||
.option(facebook_option);
|
||||
let multi_select_field_meta = FieldBuilder::new(multi_select).build();
|
||||
let multi_type_option = MultiSelectTypeOption::from(&multi_select_field_meta);
|
||||
let cell_data = multi_type_option.apply_changeset(cell_data_changeset, None).unwrap();
|
||||
assert_eq!(
|
||||
type_option.decode_cell_data(cell_data, &multi_select_field_meta),
|
||||
"Google,Facebook".to_owned()
|
||||
);
|
||||
|
||||
//Number
|
||||
let number = NumberTypeOptionBuilder::default().set_format(NumberFormat::USD);
|
||||
let number_field_meta = FieldBuilder::new(number).build();
|
||||
let data = TypeOptionCellData::new("18443", FieldType::Number).json();
|
||||
assert_eq!(
|
||||
type_option.decode_cell_data(data, &number_field_meta),
|
||||
"$18,443".to_owned()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -3,7 +3,7 @@ use flowy_error::FlowyError;
|
||||
use lib_dispatch::prelude::{AppData, Data};
|
||||
use std::sync::Arc;
|
||||
|
||||
#[tracing::instrument(skip(data, ws_manager))]
|
||||
#[tracing::instrument(level = "debug", skip(data, ws_manager))]
|
||||
pub async fn update_network_ty(
|
||||
data: Data<NetworkState>,
|
||||
ws_manager: AppData<Arc<FlowyWebSocketConnect>>,
|
||||
|
@ -55,8 +55,8 @@ impl FlowySDKConfig {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn log_filter(mut self, filter: &str) -> Self {
|
||||
self.log_filter = crate_log_filter(filter.to_owned());
|
||||
pub fn log_filter(mut self, level: &str) -> Self {
|
||||
self.log_filter = crate_log_filter(level.to_owned());
|
||||
self
|
||||
}
|
||||
}
|
||||
@ -69,12 +69,12 @@ fn crate_log_filter(level: String) -> String {
|
||||
filters.push(format!("flowy_user={}", level));
|
||||
filters.push(format!("flowy_text_block={}", level));
|
||||
filters.push(format!("flowy_grid={}", level));
|
||||
filters.push(format!("flowy_collaboration={}", "debug"));
|
||||
filters.push(format!("flowy_collaboration={}", "info"));
|
||||
filters.push(format!("dart_notify={}", level));
|
||||
filters.push(format!("lib_ot={}", level));
|
||||
filters.push(format!("lib_ws={}", level));
|
||||
filters.push(format!("lib_infra={}", level));
|
||||
filters.push(format!("flowy_sync={}", "debug"));
|
||||
filters.push(format!("flowy_sync={}", level));
|
||||
|
||||
filters.push(format!("dart_ffi={}", "info"));
|
||||
filters.push(format!("flowy_database={}", "info"));
|
||||
|
@ -36,7 +36,7 @@ impl std::default::Default for FlowySDKTest {
|
||||
|
||||
impl FlowySDKTest {
|
||||
pub fn new(server_config: ClientServerConfiguration) -> Self {
|
||||
let config = FlowySDKConfig::new(&root_dir(), server_config, &nanoid!(6)).log_filter("trace");
|
||||
let config = FlowySDKConfig::new(&root_dir(), server_config, &nanoid!(6)).log_filter("info");
|
||||
let sdk = std::thread::spawn(|| FlowySDK::new(config)).join().unwrap();
|
||||
std::mem::forget(sdk.dispatcher());
|
||||
Self { inner: sdk }
|
||||
|
@ -27,7 +27,7 @@ pub(crate) async fn apply_delta_handler(
|
||||
data_result(block_delta)
|
||||
}
|
||||
|
||||
#[tracing::instrument(skip(data, manager), err)]
|
||||
#[tracing::instrument(level = "debug", skip(data, manager), err)]
|
||||
pub(crate) async fn export_handler(
|
||||
data: Data<ExportPayload>,
|
||||
manager: AppData<Arc<TextBlockManager>>,
|
||||
|
@ -13,7 +13,7 @@ use lib_ot::{
|
||||
use rand::{prelude::*, Rng as WrappedRng};
|
||||
use std::{sync::Once, time::Duration};
|
||||
|
||||
const LEVEL: &str = "debug";
|
||||
const LEVEL: &str = "info";
|
||||
|
||||
#[derive(Clone, Debug, Display)]
|
||||
pub enum TestOp {
|
||||
|
@ -5,7 +5,7 @@ use lib_dispatch::prelude::*;
|
||||
use std::{convert::TryInto, sync::Arc};
|
||||
|
||||
// tracing instrument 👉🏻 https://docs.rs/tracing/0.1.26/tracing/attr.instrument.html
|
||||
#[tracing::instrument(name = "sign_in", skip(data, session), fields(email = %data.email), err)]
|
||||
#[tracing::instrument(level = "debug", name = "sign_in", skip(data, session), fields(email = %data.email), err)]
|
||||
pub async fn sign_in(
|
||||
data: Data<SignInPayload>,
|
||||
session: AppData<Arc<UserSession>>,
|
||||
@ -16,6 +16,7 @@ pub async fn sign_in(
|
||||
}
|
||||
|
||||
#[tracing::instrument(
|
||||
level = "debug",
|
||||
name = "sign_up",
|
||||
skip(data, session),
|
||||
fields(
|
||||
|
@ -6,31 +6,31 @@ use flowy_user_data_model::entities::{
|
||||
use lib_dispatch::prelude::*;
|
||||
use std::{convert::TryInto, sync::Arc};
|
||||
|
||||
#[tracing::instrument(skip(session))]
|
||||
#[tracing::instrument(level = "debug", skip(session))]
|
||||
pub async fn init_user_handler(session: AppData<Arc<UserSession>>) -> Result<(), FlowyError> {
|
||||
let _ = session.init_user().await?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[tracing::instrument(skip(session))]
|
||||
#[tracing::instrument(level = "debug", skip(session))]
|
||||
pub async fn check_user_handler(session: AppData<Arc<UserSession>>) -> DataResult<UserProfile, FlowyError> {
|
||||
let user_profile = session.check_user().await?;
|
||||
data_result(user_profile)
|
||||
}
|
||||
|
||||
#[tracing::instrument(skip(session))]
|
||||
#[tracing::instrument(level = "debug", skip(session))]
|
||||
pub async fn get_user_profile_handler(session: AppData<Arc<UserSession>>) -> DataResult<UserProfile, FlowyError> {
|
||||
let user_profile = session.user_profile().await?;
|
||||
data_result(user_profile)
|
||||
}
|
||||
|
||||
#[tracing::instrument(name = "sign_out", skip(session))]
|
||||
#[tracing::instrument(level = "debug", name = "sign_out", skip(session))]
|
||||
pub async fn sign_out(session: AppData<Arc<UserSession>>) -> Result<(), FlowyError> {
|
||||
let _ = session.sign_out().await?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[tracing::instrument(name = "update_user", skip(data, session))]
|
||||
#[tracing::instrument(level = "debug", name = "update_user", skip(data, session))]
|
||||
pub async fn update_user_handler(
|
||||
data: Data<UpdateUserPayload>,
|
||||
session: AppData<Arc<UserSession>>,
|
||||
@ -42,7 +42,7 @@ pub async fn update_user_handler(
|
||||
|
||||
const APPEARANCE_SETTING_CACHE_KEY: &str = "appearance_settings";
|
||||
|
||||
#[tracing::instrument(skip(data), err)]
|
||||
#[tracing::instrument(level = "debug", skip(data), err)]
|
||||
pub async fn set_appearance_setting(data: Data<AppearanceSettings>) -> Result<(), FlowyError> {
|
||||
let mut setting = data.into_inner();
|
||||
if setting.theme.is_empty() {
|
||||
|
@ -27,7 +27,7 @@ impl UserDB {
|
||||
return Err(ErrorCode::UserIdIsEmpty.into());
|
||||
}
|
||||
|
||||
tracing::info!("open user db {}", user_id);
|
||||
tracing::trace!("open user db {}", user_id);
|
||||
let dir = format!("{}/{}", self.db_dir, user_id);
|
||||
let db = flowy_database::init(&dir).map_err(|e| {
|
||||
log::error!("init user db failed, {:?}, user_id: {}", e, user_id);
|
||||
|
@ -94,7 +94,7 @@ mod tests {
|
||||
say("hello world");
|
||||
}
|
||||
|
||||
#[tracing::instrument(name = "say")]
|
||||
#[tracing::instrument(level = "trace", name = "say")]
|
||||
fn say(s: &str) {
|
||||
tracing::info!("{}", s);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user