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";
}