test: add databaase event test (#2728)

* test: add tests and fix modify primary field bug

* test: add more test

* fix: tauri buiuld

* chore: disable share link button
This commit is contained in:
Nathan.fooo
2023-06-07 14:52:35 +08:00
committed by GitHub
parent 1b56538a2f
commit ce8cee5637
20 changed files with 623 additions and 343 deletions

View File

@ -16,8 +16,10 @@ class TextCellDataPersistence implements CellDataPersistence<String> {
@override
Future<Option<FlowyError>> save(String data) async {
final fut =
_cellBackendSvc.updateCell(cellContext: cellContext, data: data);
final fut = _cellBackendSvc.updateCell(
cellContext: cellContext,
data: data,
);
return fut.then((result) {
return result.fold(
(l) => none(),

View File

@ -29,7 +29,6 @@ class FieldBackendService {
Future<Either<Unit, FlowyError>> updateField({
String? name,
FieldType? fieldType,
bool? frozen,
bool? visibility,
double? width,
@ -42,10 +41,6 @@ class FieldBackendService {
payload.name = name;
}
if (fieldType != null) {
payload.fieldType = fieldType;
}
if (frozen != null) {
payload.frozen = frozen;
}

View File

@ -124,13 +124,29 @@ class _FieldOperationList extends StatelessWidget {
}
Widget _actionCell(FieldAction action) {
bool enable = true;
// If the field is primary, delete and duplicate are disabled.
if (fieldInfo.field.isPrimary) {
switch (action) {
case FieldAction.hide:
break;
case FieldAction.duplicate:
enable = false;
break;
case FieldAction.delete:
enable = false;
break;
}
}
return Flexible(
child: SizedBox(
height: GridSize.popoverItemHeight,
child: FieldActionCell(
fieldInfo: fieldInfo,
action: action,
enable: action != FieldAction.delete || !fieldInfo.field.isPrimary,
enable: enable,
),
),
);

View File

@ -72,5 +72,6 @@ class CheckboxCardCellState with _$CheckboxCardCellState {
}
bool _isSelected(String? cellData) {
// The backend use "Yes" and "No" to represent the checkbox cell data.
return cellData == "Yes";
}

View File

@ -4,7 +4,6 @@ import 'package:appflowy/generated/locale_keys.g.dart';
import 'package:appflowy/startup/startup.dart';
import 'package:appflowy/plugins/document/application/share_bloc.dart';
import 'package:appflowy/workspace/presentation/home/toast.dart';
import 'package:appflowy/workspace/presentation/widgets/dialogs.dart';
import 'package:appflowy/workspace/presentation/widgets/pop_up_action.dart';
import 'package:appflowy_backend/protobuf/flowy-document2/entities.pb.dart';
import 'package:appflowy_popover/appflowy_popover.dart';
@ -104,11 +103,11 @@ class ShareActionList extends StatelessWidget {
showMessageToast('Exported to: $exportPath');
}
break;
case ShareAction.copyLink:
NavigatorAlertDialog(
title: LocaleKeys.shareAction_workInProgress.tr(),
).show(context);
break;
// case ShareAction.copyLink:
// NavigatorAlertDialog(
// title: LocaleKeys.shareAction_workInProgress.tr(),
// ).show(context);
// break;
}
controller.close();
},
@ -118,7 +117,7 @@ class ShareActionList extends StatelessWidget {
enum ShareAction {
markdown,
copyLink,
// copyLink,
}
class ShareActionWrapper extends ActionCell {
@ -133,8 +132,8 @@ class ShareActionWrapper extends ActionCell {
switch (inner) {
case ShareAction.markdown:
return LocaleKeys.shareAction_markdown.tr();
case ShareAction.copyLink:
return LocaleKeys.shareAction_copyLink.tr();
// case ShareAction.copyLink:
// return LocaleKeys.shareAction_copyLink.tr();
}
}
}