mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
feat: update view properties
This commit is contained in:
parent
23ccfa54b5
commit
74831964a6
@ -17,9 +17,9 @@ extension SvgViewType on View {
|
||||
|
||||
String _imageNameForViewType(ViewType type) {
|
||||
switch (type) {
|
||||
case ViewType.QuillDocument:
|
||||
case ViewType.RichText:
|
||||
return "file_icon";
|
||||
case ViewType.Kanban:
|
||||
case ViewType.Plugin:
|
||||
return "file_icon";
|
||||
default:
|
||||
return "file_icon";
|
||||
|
@ -6,9 +6,9 @@ import 'package:flowy_sdk/protobuf/flowy-folder-data-model/view.pb.dart';
|
||||
extension ToHomeStackContext on View {
|
||||
HomeStackContext stackContext() {
|
||||
switch (viewType) {
|
||||
case ViewType.QuillDocument:
|
||||
case ViewType.RichText:
|
||||
return DocumentStackContext(view: this);
|
||||
case ViewType.Kanban:
|
||||
case ViewType.Plugin:
|
||||
return DocumentStackContext(view: this);
|
||||
default:
|
||||
return BlankStackContext();
|
||||
@ -19,9 +19,9 @@ extension ToHomeStackContext on View {
|
||||
extension ToHomeStackType on View {
|
||||
HomeStackType stackType() {
|
||||
switch (viewType) {
|
||||
case ViewType.QuillDocument:
|
||||
case ViewType.RichText:
|
||||
return HomeStackType.document;
|
||||
case ViewType.Kanban:
|
||||
case ViewType.PlainText:
|
||||
return HomeStackType.kanban;
|
||||
default:
|
||||
return HomeStackType.blank;
|
||||
@ -32,9 +32,9 @@ extension ToHomeStackType on View {
|
||||
extension ViewTypeExtension on ViewType {
|
||||
String displayName() {
|
||||
switch (this) {
|
||||
case ViewType.QuillDocument:
|
||||
case ViewType.RichText:
|
||||
return "Doc";
|
||||
case ViewType.Kanban:
|
||||
case ViewType.Plugin:
|
||||
return "Kanban";
|
||||
default:
|
||||
return "";
|
||||
@ -43,9 +43,9 @@ extension ViewTypeExtension on ViewType {
|
||||
|
||||
bool enable() {
|
||||
switch (this) {
|
||||
case ViewType.QuillDocument:
|
||||
case ViewType.RichText:
|
||||
return true;
|
||||
case ViewType.Kanban:
|
||||
case ViewType.Plugin:
|
||||
return false;
|
||||
default:
|
||||
return false;
|
||||
|
@ -20,7 +20,7 @@ class View extends $pb.GeneratedMessage {
|
||||
..aOS(2, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'belongToId')
|
||||
..aOS(3, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'name')
|
||||
..aOS(4, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'desc')
|
||||
..e<ViewType>(5, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'viewType', $pb.PbFieldType.OE, defaultOrMaker: ViewType.Blank, valueOf: ViewType.valueOf, enumValues: ViewType.values)
|
||||
..e<ViewType>(5, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'viewType', $pb.PbFieldType.OE, defaultOrMaker: ViewType.RichText, valueOf: ViewType.valueOf, enumValues: ViewType.values)
|
||||
..aInt64(6, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'version')
|
||||
..aOM<RepeatedView>(7, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'belongings', subBuilder: RepeatedView.create)
|
||||
..aInt64(8, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'modifiedTime')
|
||||
@ -232,7 +232,8 @@ class CreateViewPayload extends $pb.GeneratedMessage {
|
||||
..aOS(2, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'name')
|
||||
..aOS(3, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'desc')
|
||||
..aOS(4, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'thumbnail')
|
||||
..e<ViewType>(5, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'viewType', $pb.PbFieldType.OE, defaultOrMaker: ViewType.Blank, valueOf: ViewType.valueOf, enumValues: ViewType.values)
|
||||
..e<ViewType>(5, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'viewType', $pb.PbFieldType.OE, defaultOrMaker: ViewType.RichText, valueOf: ViewType.valueOf, enumValues: ViewType.values)
|
||||
..aOS(6, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'ext')
|
||||
..hasRequiredFields = false
|
||||
;
|
||||
|
||||
@ -243,6 +244,7 @@ class CreateViewPayload extends $pb.GeneratedMessage {
|
||||
$core.String? desc,
|
||||
$core.String? thumbnail,
|
||||
ViewType? viewType,
|
||||
$core.String? ext,
|
||||
}) {
|
||||
final _result = create();
|
||||
if (belongToId != null) {
|
||||
@ -260,6 +262,9 @@ class CreateViewPayload extends $pb.GeneratedMessage {
|
||||
if (viewType != null) {
|
||||
_result.viewType = viewType;
|
||||
}
|
||||
if (ext != null) {
|
||||
_result.ext = ext;
|
||||
}
|
||||
return _result;
|
||||
}
|
||||
factory CreateViewPayload.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r);
|
||||
@ -330,6 +335,15 @@ class CreateViewPayload extends $pb.GeneratedMessage {
|
||||
$core.bool hasViewType() => $_has(4);
|
||||
@$pb.TagNumber(5)
|
||||
void clearViewType() => clearField(5);
|
||||
|
||||
@$pb.TagNumber(6)
|
||||
$core.String get ext => $_getSZ(5);
|
||||
@$pb.TagNumber(6)
|
||||
set ext($core.String v) { $_setString(5, v); }
|
||||
@$pb.TagNumber(6)
|
||||
$core.bool hasExt() => $_has(5);
|
||||
@$pb.TagNumber(6)
|
||||
void clearExt() => clearField(6);
|
||||
}
|
||||
|
||||
class CreateViewParams extends $pb.GeneratedMessage {
|
||||
@ -338,8 +352,8 @@ class CreateViewParams extends $pb.GeneratedMessage {
|
||||
..aOS(2, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'name')
|
||||
..aOS(3, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'desc')
|
||||
..aOS(4, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'thumbnail')
|
||||
..e<ViewType>(5, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'viewType', $pb.PbFieldType.OE, defaultOrMaker: ViewType.Blank, valueOf: ViewType.valueOf, enumValues: ViewType.values)
|
||||
..aOS(6, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'viewData')
|
||||
..e<ViewType>(5, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'viewType', $pb.PbFieldType.OE, defaultOrMaker: ViewType.RichText, valueOf: ViewType.valueOf, enumValues: ViewType.values)
|
||||
..aOS(6, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'ext')
|
||||
..aOS(7, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'viewId')
|
||||
..hasRequiredFields = false
|
||||
;
|
||||
@ -351,7 +365,7 @@ class CreateViewParams extends $pb.GeneratedMessage {
|
||||
$core.String? desc,
|
||||
$core.String? thumbnail,
|
||||
ViewType? viewType,
|
||||
$core.String? viewData,
|
||||
$core.String? ext,
|
||||
$core.String? viewId,
|
||||
}) {
|
||||
final _result = create();
|
||||
@ -370,8 +384,8 @@ class CreateViewParams extends $pb.GeneratedMessage {
|
||||
if (viewType != null) {
|
||||
_result.viewType = viewType;
|
||||
}
|
||||
if (viewData != null) {
|
||||
_result.viewData = viewData;
|
||||
if (ext != null) {
|
||||
_result.ext = ext;
|
||||
}
|
||||
if (viewId != null) {
|
||||
_result.viewId = viewId;
|
||||
@ -445,13 +459,13 @@ class CreateViewParams extends $pb.GeneratedMessage {
|
||||
void clearViewType() => clearField(5);
|
||||
|
||||
@$pb.TagNumber(6)
|
||||
$core.String get viewData => $_getSZ(5);
|
||||
$core.String get ext => $_getSZ(5);
|
||||
@$pb.TagNumber(6)
|
||||
set viewData($core.String v) { $_setString(5, v); }
|
||||
set ext($core.String v) { $_setString(5, v); }
|
||||
@$pb.TagNumber(6)
|
||||
$core.bool hasViewData() => $_has(5);
|
||||
$core.bool hasExt() => $_has(5);
|
||||
@$pb.TagNumber(6)
|
||||
void clearViewData() => clearField(6);
|
||||
void clearExt() => clearField(6);
|
||||
|
||||
@$pb.TagNumber(7)
|
||||
$core.String get viewId => $_getSZ(6);
|
||||
|
@ -10,14 +10,12 @@ import 'dart:core' as $core;
|
||||
import 'package:protobuf/protobuf.dart' as $pb;
|
||||
|
||||
class ViewType extends $pb.ProtobufEnum {
|
||||
static const ViewType Blank = ViewType._(0, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'Blank');
|
||||
static const ViewType QuillDocument = ViewType._(1, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'QuillDocument');
|
||||
static const ViewType Kanban = ViewType._(2, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'Kanban');
|
||||
static const ViewType RichText = ViewType._(0, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'RichText');
|
||||
static const ViewType PlainText = ViewType._(1, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'PlainText');
|
||||
|
||||
static const $core.List<ViewType> values = <ViewType> [
|
||||
Blank,
|
||||
QuillDocument,
|
||||
Kanban,
|
||||
RichText,
|
||||
PlainText,
|
||||
];
|
||||
|
||||
static final $core.Map<$core.int, ViewType> _byValue = $pb.ProtobufEnum.initByValue(values);
|
||||
|
@ -12,14 +12,13 @@ import 'dart:typed_data' as $typed_data;
|
||||
const ViewType$json = const {
|
||||
'1': 'ViewType',
|
||||
'2': const [
|
||||
const {'1': 'Blank', '2': 0},
|
||||
const {'1': 'QuillDocument', '2': 1},
|
||||
const {'1': 'Kanban', '2': 2},
|
||||
const {'1': 'RichText', '2': 0},
|
||||
const {'1': 'PlainText', '2': 1},
|
||||
],
|
||||
};
|
||||
|
||||
/// Descriptor for `ViewType`. Decode as a `google.protobuf.EnumDescriptorProto`.
|
||||
final $typed_data.Uint8List viewTypeDescriptor = $convert.base64Decode('CghWaWV3VHlwZRIJCgVCbGFuaxAAEhEKDVF1aWxsRG9jdW1lbnQQARIKCgZLYW5iYW4QAg==');
|
||||
final $typed_data.Uint8List viewTypeDescriptor = $convert.base64Decode('CghWaWV3VHlwZRIMCghSaWNoVGV4dBAAEg0KCVBsYWluVGV4dBAB');
|
||||
@$core.Deprecated('Use viewDescriptor instead')
|
||||
const View$json = const {
|
||||
'1': 'View',
|
||||
@ -57,6 +56,7 @@ const CreateViewPayload$json = const {
|
||||
const {'1': 'desc', '3': 3, '4': 1, '5': 9, '10': 'desc'},
|
||||
const {'1': 'thumbnail', '3': 4, '4': 1, '5': 9, '9': 0, '10': 'thumbnail'},
|
||||
const {'1': 'view_type', '3': 5, '4': 1, '5': 14, '6': '.ViewType', '10': 'viewType'},
|
||||
const {'1': 'ext', '3': 6, '4': 1, '5': 9, '10': 'ext'},
|
||||
],
|
||||
'8': const [
|
||||
const {'1': 'one_of_thumbnail'},
|
||||
@ -64,7 +64,7 @@ const CreateViewPayload$json = const {
|
||||
};
|
||||
|
||||
/// Descriptor for `CreateViewPayload`. Decode as a `google.protobuf.DescriptorProto`.
|
||||
final $typed_data.Uint8List createViewPayloadDescriptor = $convert.base64Decode('ChFDcmVhdGVWaWV3UGF5bG9hZBIgCgxiZWxvbmdfdG9faWQYASABKAlSCmJlbG9uZ1RvSWQSEgoEbmFtZRgCIAEoCVIEbmFtZRISCgRkZXNjGAMgASgJUgRkZXNjEh4KCXRodW1ibmFpbBgEIAEoCUgAUgl0aHVtYm5haWwSJgoJdmlld190eXBlGAUgASgOMgkuVmlld1R5cGVSCHZpZXdUeXBlQhIKEG9uZV9vZl90aHVtYm5haWw=');
|
||||
final $typed_data.Uint8List createViewPayloadDescriptor = $convert.base64Decode('ChFDcmVhdGVWaWV3UGF5bG9hZBIgCgxiZWxvbmdfdG9faWQYASABKAlSCmJlbG9uZ1RvSWQSEgoEbmFtZRgCIAEoCVIEbmFtZRISCgRkZXNjGAMgASgJUgRkZXNjEh4KCXRodW1ibmFpbBgEIAEoCUgAUgl0aHVtYm5haWwSJgoJdmlld190eXBlGAUgASgOMgkuVmlld1R5cGVSCHZpZXdUeXBlEhAKA2V4dBgGIAEoCVIDZXh0QhIKEG9uZV9vZl90aHVtYm5haWw=');
|
||||
@$core.Deprecated('Use createViewParamsDescriptor instead')
|
||||
const CreateViewParams$json = const {
|
||||
'1': 'CreateViewParams',
|
||||
@ -74,13 +74,13 @@ const CreateViewParams$json = const {
|
||||
const {'1': 'desc', '3': 3, '4': 1, '5': 9, '10': 'desc'},
|
||||
const {'1': 'thumbnail', '3': 4, '4': 1, '5': 9, '10': 'thumbnail'},
|
||||
const {'1': 'view_type', '3': 5, '4': 1, '5': 14, '6': '.ViewType', '10': 'viewType'},
|
||||
const {'1': 'view_data', '3': 6, '4': 1, '5': 9, '10': 'viewData'},
|
||||
const {'1': 'ext', '3': 6, '4': 1, '5': 9, '10': 'ext'},
|
||||
const {'1': 'view_id', '3': 7, '4': 1, '5': 9, '10': 'viewId'},
|
||||
],
|
||||
};
|
||||
|
||||
/// Descriptor for `CreateViewParams`. Decode as a `google.protobuf.DescriptorProto`.
|
||||
final $typed_data.Uint8List createViewParamsDescriptor = $convert.base64Decode('ChBDcmVhdGVWaWV3UGFyYW1zEiAKDGJlbG9uZ190b19pZBgBIAEoCVIKYmVsb25nVG9JZBISCgRuYW1lGAIgASgJUgRuYW1lEhIKBGRlc2MYAyABKAlSBGRlc2MSHAoJdGh1bWJuYWlsGAQgASgJUgl0aHVtYm5haWwSJgoJdmlld190eXBlGAUgASgOMgkuVmlld1R5cGVSCHZpZXdUeXBlEhsKCXZpZXdfZGF0YRgGIAEoCVIIdmlld0RhdGESFwoHdmlld19pZBgHIAEoCVIGdmlld0lk');
|
||||
final $typed_data.Uint8List createViewParamsDescriptor = $convert.base64Decode('ChBDcmVhdGVWaWV3UGFyYW1zEiAKDGJlbG9uZ190b19pZBgBIAEoCVIKYmVsb25nVG9JZBISCgRuYW1lGAIgASgJUgRuYW1lEhIKBGRlc2MYAyABKAlSBGRlc2MSHAoJdGh1bWJuYWlsGAQgASgJUgl0aHVtYm5haWwSJgoJdmlld190eXBlGAUgASgOMgkuVmlld1R5cGVSCHZpZXdUeXBlEhAKA2V4dBgGIAEoCVIDZXh0EhcKB3ZpZXdfaWQYByABKAlSBnZpZXdJZA==');
|
||||
@$core.Deprecated('Use viewIdDescriptor instead')
|
||||
const ViewId$json = const {
|
||||
'1': 'ViewId',
|
||||
|
@ -81,9 +81,10 @@ impl BlockManager {
|
||||
})
|
||||
}
|
||||
|
||||
pub async fn reset_with_revisions<T: AsRef<str>>(&self, doc_id: T, revisions: RepeatedRevision) -> FlowyResult<()> {
|
||||
pub async fn create_block<T: AsRef<str>>(&self, doc_id: T, revisions: RepeatedRevision) -> FlowyResult<()> {
|
||||
let doc_id = doc_id.as_ref().to_owned();
|
||||
let db_pool = self.block_user.db_pool()?;
|
||||
// Maybe we could save the block to disk without creating the RevisionManager
|
||||
let rev_manager = self.make_rev_manager(&doc_id, db_pool)?;
|
||||
let _ = rev_manager.reset_object(revisions).await?;
|
||||
Ok(())
|
||||
|
@ -8,6 +8,7 @@ use lazy_static::lazy_static;
|
||||
use flowy_collaboration::{client_folder::FolderPad, entities::ws_data::ServerRevisionWSData};
|
||||
use flowy_document::BlockManager;
|
||||
|
||||
use flowy_collaboration::entities::revision::{RepeatedRevision, Revision};
|
||||
use std::{collections::HashMap, convert::TryInto, fmt::Formatter, sync::Arc};
|
||||
use tokio::sync::RwLock as TokioRwLock;
|
||||
|
||||
@ -201,9 +202,10 @@ impl DefaultFolderBuilder {
|
||||
initial_delta().to_json()
|
||||
};
|
||||
view_controller.set_latest_view(view);
|
||||
let _ = view_controller
|
||||
.create_view_document_content(&view.id, view_data)
|
||||
.await?;
|
||||
let delta_data = Bytes::from(view_data);
|
||||
let repeated_revision: RepeatedRevision =
|
||||
Revision::initial_revision(user_id, &view.id, delta_data).into();
|
||||
let _ = view_controller.create_view(&view.id, repeated_revision).await?;
|
||||
}
|
||||
}
|
||||
let folder = FolderPad::new(vec![workspace.clone()], vec![])?;
|
||||
|
@ -127,9 +127,8 @@ pub(crate) struct ViewTable {
|
||||
impl ViewTable {
|
||||
pub fn new(view: View) -> Self {
|
||||
let view_type = match view.view_type {
|
||||
ViewType::Kanban => ViewTableType::Kanban,
|
||||
ViewType::QuillDocument => ViewTableType::QuillDocument,
|
||||
ViewType::Blank => ViewTableType::QuillDocument,
|
||||
ViewType::RichText => ViewTableType::RichText,
|
||||
ViewType::PlainText => ViewTableType::Text,
|
||||
};
|
||||
|
||||
ViewTable {
|
||||
@ -151,8 +150,8 @@ impl ViewTable {
|
||||
impl std::convert::From<ViewTable> for View {
|
||||
fn from(table: ViewTable) -> Self {
|
||||
let view_type = match table.view_type {
|
||||
ViewTableType::QuillDocument => ViewType::QuillDocument,
|
||||
ViewTableType::Kanban => ViewType::Kanban,
|
||||
ViewTableType::RichText => ViewType::RichText,
|
||||
ViewTableType::Text => ViewType::PlainText,
|
||||
};
|
||||
|
||||
View {
|
||||
@ -217,24 +216,24 @@ impl ViewChangeset {
|
||||
#[repr(i32)]
|
||||
#[sql_type = "Integer"]
|
||||
pub enum ViewTableType {
|
||||
QuillDocument = 0,
|
||||
Kanban = 1,
|
||||
RichText = 0,
|
||||
Text = 1,
|
||||
}
|
||||
|
||||
impl std::default::Default for ViewTableType {
|
||||
fn default() -> Self {
|
||||
ViewTableType::QuillDocument
|
||||
ViewTableType::RichText
|
||||
}
|
||||
}
|
||||
|
||||
impl std::convert::From<i32> for ViewTableType {
|
||||
fn from(value: i32) -> Self {
|
||||
match value {
|
||||
0 => ViewTableType::QuillDocument,
|
||||
1 => ViewTableType::Kanban,
|
||||
0 => ViewTableType::RichText,
|
||||
1 => ViewTableType::Text,
|
||||
o => {
|
||||
log::error!("Unsupported view type {}, fallback to ViewType::Docs", o);
|
||||
ViewTableType::QuillDocument
|
||||
ViewTableType::Text
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -24,6 +24,7 @@ use crate::{
|
||||
use flowy_database::kv::KV;
|
||||
use flowy_document::BlockManager;
|
||||
use flowy_folder_data_model::entities::share::{ExportData, ExportParams};
|
||||
use flowy_folder_data_model::entities::view::ViewType;
|
||||
use lib_infra::uuid_string;
|
||||
|
||||
const LATEST_VIEW_ID: &str = "latest_view_id";
|
||||
@ -61,43 +62,33 @@ impl ViewController {
|
||||
|
||||
#[tracing::instrument(level = "trace", skip(self, params), fields(name = %params.name), err)]
|
||||
pub(crate) async fn create_view_from_params(&self, params: CreateViewParams) -> Result<View, FlowyError> {
|
||||
let view_data = if params.view_data.is_empty() {
|
||||
let view_data = if params.ext.is_empty() {
|
||||
initial_delta_string()
|
||||
} else {
|
||||
params.view_data.clone()
|
||||
params.ext.clone()
|
||||
};
|
||||
|
||||
let delta_data = Bytes::from(view_data);
|
||||
let user_id = self.user.user_id()?;
|
||||
let repeated_revision: RepeatedRevision =
|
||||
Revision::initial_revision(&user_id, ¶ms.view_id, delta_data).into();
|
||||
let _ = self
|
||||
.block_manager
|
||||
.reset_with_revisions(¶ms.view_id, repeated_revision)
|
||||
.await?;
|
||||
let _ = self.create_view(¶ms.view_id, repeated_revision).await?;
|
||||
let view = self.create_view_on_server(params).await?;
|
||||
let _ = self.create_view_on_local(view.clone()).await?;
|
||||
|
||||
Ok(view)
|
||||
}
|
||||
|
||||
#[tracing::instrument(level = "debug", skip(self, view_id, view_data), err)]
|
||||
pub(crate) async fn create_view_document_content(
|
||||
#[tracing::instrument(level = "debug", skip(self, view_id, view_type, repeated_revision), err)]
|
||||
pub(crate) async fn create_view(
|
||||
&self,
|
||||
view_id: &str,
|
||||
view_data: String,
|
||||
repeated_revision: RepeatedRevision,
|
||||
view_type: ViewType,
|
||||
) -> Result<(), FlowyError> {
|
||||
if view_data.is_empty() {
|
||||
if repeated_revision.is_empty() {
|
||||
return Err(FlowyError::internal().context("The content of the view should not be empty"));
|
||||
}
|
||||
|
||||
let delta_data = Bytes::from(view_data);
|
||||
let user_id = self.user.user_id()?;
|
||||
let repeated_revision: RepeatedRevision = Revision::initial_revision(&user_id, view_id, delta_data).into();
|
||||
let _ = self
|
||||
.block_manager
|
||||
.reset_with_revisions(view_id, repeated_revision)
|
||||
.await?;
|
||||
let _ = self.block_manager.create_block(view_id, repeated_revision).await?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@ -185,7 +176,7 @@ impl ViewController {
|
||||
desc: view.desc.clone(),
|
||||
thumbnail: "".to_owned(),
|
||||
view_type: view.view_type.clone(),
|
||||
view_data: document_json,
|
||||
ext: document_json,
|
||||
view_id: uuid_string(),
|
||||
};
|
||||
|
||||
|
@ -68,14 +68,7 @@ impl FolderTest {
|
||||
let _ = sdk.init_user().await;
|
||||
let mut workspace = create_workspace(&sdk, "FolderWorkspace", "Folder test workspace").await;
|
||||
let mut app = create_app(&sdk, &workspace.id, "Folder App", "Folder test app").await;
|
||||
let view = create_view(
|
||||
&sdk,
|
||||
&app.id,
|
||||
"Folder View",
|
||||
"Folder test view",
|
||||
ViewType::QuillDocument,
|
||||
)
|
||||
.await;
|
||||
let view = create_view(&sdk, &app.id, "Folder View", "Folder test view", ViewType::RichText).await;
|
||||
app.belongings = RepeatedView {
|
||||
items: vec![view.clone()],
|
||||
};
|
||||
@ -153,7 +146,7 @@ impl FolderTest {
|
||||
}
|
||||
|
||||
FolderScript::CreateView { name, desc } => {
|
||||
let view = create_view(sdk, &self.app.id, &name, &desc, ViewType::QuillDocument).await;
|
||||
let view = create_view(sdk, &self.app.id, &name, &desc, ViewType::RichText).await;
|
||||
self.view = view;
|
||||
}
|
||||
FolderScript::AssertView(view) => {
|
||||
|
@ -88,7 +88,7 @@ async fn create_view(sdk: &FlowySDKTest, app_id: &str) -> View {
|
||||
name: "View A".to_string(),
|
||||
desc: "".to_string(),
|
||||
thumbnail: Some("http://1.png".to_string()),
|
||||
view_type: ViewType::QuillDocument,
|
||||
view_type: ViewType::RichText,
|
||||
};
|
||||
|
||||
let view = FolderEventBuilder::new(sdk.clone())
|
||||
|
@ -4,7 +4,7 @@ use crate::{
|
||||
impl_def_and_def_mut,
|
||||
parser::{
|
||||
app::AppIdentify,
|
||||
view::{ViewDesc, ViewIdentify, ViewName, ViewThumbnail},
|
||||
view::{ViewDesc, ViewExtensionData, ViewIdentify, ViewName, ViewThumbnail},
|
||||
},
|
||||
};
|
||||
use flowy_derive::{ProtoBuf, ProtoBuf_Enum};
|
||||
@ -66,26 +66,24 @@ impl std::convert::From<View> for Trash {
|
||||
|
||||
#[derive(Eq, PartialEq, Debug, ProtoBuf_Enum, Clone, Serialize)]
|
||||
pub enum ViewType {
|
||||
Blank = 0,
|
||||
QuillDocument = 1,
|
||||
Kanban = 2,
|
||||
RichText = 0,
|
||||
PlainText = 1,
|
||||
}
|
||||
|
||||
impl std::default::Default for ViewType {
|
||||
fn default() -> Self {
|
||||
ViewType::QuillDocument
|
||||
ViewType::PlainText
|
||||
}
|
||||
}
|
||||
|
||||
impl std::convert::From<i32> for ViewType {
|
||||
fn from(val: i32) -> Self {
|
||||
match val {
|
||||
0 => ViewType::Blank,
|
||||
1 => ViewType::QuillDocument,
|
||||
2 => ViewType::Kanban,
|
||||
0 => ViewType::RichText,
|
||||
1 => ViewType::PlainText,
|
||||
_ => {
|
||||
log::error!("Invalid view type: {}", val);
|
||||
ViewType::Blank
|
||||
ViewType::PlainText
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -107,6 +105,9 @@ pub struct CreateViewPayload {
|
||||
|
||||
#[pb(index = 5)]
|
||||
pub view_type: ViewType,
|
||||
|
||||
#[pb(index = 6)]
|
||||
pub ext: String,
|
||||
}
|
||||
|
||||
#[derive(Default, ProtoBuf, Debug, Clone)]
|
||||
@ -126,9 +127,8 @@ pub struct CreateViewParams {
|
||||
#[pb(index = 5)]
|
||||
pub view_type: ViewType,
|
||||
|
||||
// ViewType::Doc -> Delta string
|
||||
#[pb(index = 6)]
|
||||
pub view_data: String,
|
||||
pub ext: String,
|
||||
|
||||
#[pb(index = 7)]
|
||||
pub view_id: String,
|
||||
@ -141,7 +141,7 @@ impl CreateViewParams {
|
||||
desc: String,
|
||||
view_type: ViewType,
|
||||
thumbnail: String,
|
||||
view_data: String,
|
||||
ext: String,
|
||||
view_id: String,
|
||||
) -> Self {
|
||||
Self {
|
||||
@ -150,7 +150,7 @@ impl CreateViewParams {
|
||||
desc,
|
||||
thumbnail,
|
||||
view_type,
|
||||
view_data,
|
||||
ext,
|
||||
view_id,
|
||||
}
|
||||
}
|
||||
@ -162,8 +162,8 @@ impl TryInto<CreateViewParams> for CreateViewPayload {
|
||||
fn try_into(self) -> Result<CreateViewParams, Self::Error> {
|
||||
let name = ViewName::parse(self.name)?.0;
|
||||
let belong_to_id = AppIdentify::parse(self.belong_to_id)?.0;
|
||||
let view_data = "".to_string();
|
||||
let view_id = uuid::Uuid::new_v4().to_string();
|
||||
let ext = ViewExtensionData::parse(self.ext)?.0;
|
||||
let thumbnail = match self.thumbnail {
|
||||
None => "".to_string(),
|
||||
Some(thumbnail) => ViewThumbnail::parse(thumbnail)?.0,
|
||||
@ -175,7 +175,7 @@ impl TryInto<CreateViewParams> for CreateViewPayload {
|
||||
self.desc,
|
||||
self.view_type,
|
||||
thumbnail,
|
||||
view_data,
|
||||
ext,
|
||||
view_id,
|
||||
))
|
||||
}
|
||||
@ -290,32 +290,27 @@ impl<'de> Deserialize<'de> for ViewType {
|
||||
impl<'de> Visitor<'de> for ViewTypeVisitor {
|
||||
type Value = ViewType;
|
||||
fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
|
||||
formatter.write_str("QuillDocument, Kanban, Blank")
|
||||
formatter.write_str("Plugin, RichText")
|
||||
}
|
||||
|
||||
fn visit_str<E>(self, s: &str) -> Result<Self::Value, E>
|
||||
where
|
||||
E: de::Error,
|
||||
{
|
||||
let mut view_type = None;
|
||||
let view_type;
|
||||
match s {
|
||||
"Doc" => {
|
||||
view_type = Some(ViewType::QuillDocument);
|
||||
"Doc" | "RichText" => {
|
||||
// Rename ViewType::Doc to ViewType::RichText, So we need to migrate the ViewType manually.
|
||||
view_type = ViewType::RichText;
|
||||
}
|
||||
"QuillDocument" => {
|
||||
view_type = Some(ViewType::QuillDocument);
|
||||
}
|
||||
"Kanban" => {
|
||||
view_type = Some(ViewType::Kanban);
|
||||
}
|
||||
"Blank" => {
|
||||
view_type = Some(ViewType::Blank);
|
||||
"Plugin" => {
|
||||
view_type = ViewType::PlainText;
|
||||
}
|
||||
unknown => {
|
||||
return Err(de::Error::invalid_value(Unexpected::Str(unknown), &self));
|
||||
}
|
||||
}
|
||||
Ok(view_type.unwrap())
|
||||
Ok(view_type)
|
||||
}
|
||||
}
|
||||
deserializer.deserialize_any(ViewTypeVisitor())
|
||||
|
@ -1,11 +1,13 @@
|
||||
mod delta_data;
|
||||
mod view_desc;
|
||||
mod view_ext;
|
||||
mod view_id;
|
||||
mod view_name;
|
||||
mod view_thumbnail;
|
||||
|
||||
pub use delta_data::*;
|
||||
pub use view_desc::*;
|
||||
pub use view_ext::*;
|
||||
pub use view_id::*;
|
||||
pub use view_name::*;
|
||||
pub use view_thumbnail::*;
|
||||
|
@ -0,0 +1,16 @@
|
||||
use crate::errors::ErrorCode;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct ViewExtensionData(pub String);
|
||||
|
||||
impl ViewExtensionData {
|
||||
pub fn parse(s: String) -> Result<ViewExtensionData, ErrorCode> {
|
||||
Ok(Self(s))
|
||||
}
|
||||
}
|
||||
|
||||
impl AsRef<str> for ViewExtensionData {
|
||||
fn as_ref(&self) -> &str {
|
||||
&self.0
|
||||
}
|
||||
}
|
@ -162,7 +162,7 @@ impl View {
|
||||
self.view_type
|
||||
}
|
||||
pub fn clear_view_type(&mut self) {
|
||||
self.view_type = ViewType::Blank;
|
||||
self.view_type = ViewType::RichText;
|
||||
}
|
||||
|
||||
// Param is passed by value, moved
|
||||
@ -326,7 +326,7 @@ impl ::protobuf::Message for View {
|
||||
if !self.desc.is_empty() {
|
||||
my_size += ::protobuf::rt::string_size(4, &self.desc);
|
||||
}
|
||||
if self.view_type != ViewType::Blank {
|
||||
if self.view_type != ViewType::RichText {
|
||||
my_size += ::protobuf::rt::enum_size(5, self.view_type);
|
||||
}
|
||||
if self.version != 0 {
|
||||
@ -360,7 +360,7 @@ impl ::protobuf::Message for View {
|
||||
if !self.desc.is_empty() {
|
||||
os.write_string(4, &self.desc)?;
|
||||
}
|
||||
if self.view_type != ViewType::Blank {
|
||||
if self.view_type != ViewType::RichText {
|
||||
os.write_enum(5, ::protobuf::ProtobufEnum::value(&self.view_type))?;
|
||||
}
|
||||
if self.version != 0 {
|
||||
@ -480,7 +480,7 @@ impl ::protobuf::Clear for View {
|
||||
self.belong_to_id.clear();
|
||||
self.name.clear();
|
||||
self.desc.clear();
|
||||
self.view_type = ViewType::Blank;
|
||||
self.view_type = ViewType::RichText;
|
||||
self.version = 0;
|
||||
self.belongings.clear();
|
||||
self.modified_time = 0;
|
||||
@ -674,6 +674,7 @@ pub struct CreateViewPayload {
|
||||
pub name: ::std::string::String,
|
||||
pub desc: ::std::string::String,
|
||||
pub view_type: ViewType,
|
||||
pub ext: ::std::string::String,
|
||||
// message oneof groups
|
||||
pub one_of_thumbnail: ::std::option::Option<CreateViewPayload_oneof_one_of_thumbnail>,
|
||||
// special fields
|
||||
@ -831,13 +832,39 @@ impl CreateViewPayload {
|
||||
self.view_type
|
||||
}
|
||||
pub fn clear_view_type(&mut self) {
|
||||
self.view_type = ViewType::Blank;
|
||||
self.view_type = ViewType::RichText;
|
||||
}
|
||||
|
||||
// Param is passed by value, moved
|
||||
pub fn set_view_type(&mut self, v: ViewType) {
|
||||
self.view_type = v;
|
||||
}
|
||||
|
||||
// string ext = 6;
|
||||
|
||||
|
||||
pub fn get_ext(&self) -> &str {
|
||||
&self.ext
|
||||
}
|
||||
pub fn clear_ext(&mut self) {
|
||||
self.ext.clear();
|
||||
}
|
||||
|
||||
// Param is passed by value, moved
|
||||
pub fn set_ext(&mut self, v: ::std::string::String) {
|
||||
self.ext = v;
|
||||
}
|
||||
|
||||
// Mutable pointer to the field.
|
||||
// If field is not initialized, it is initialized with default value first.
|
||||
pub fn mut_ext(&mut self) -> &mut ::std::string::String {
|
||||
&mut self.ext
|
||||
}
|
||||
|
||||
// Take field
|
||||
pub fn take_ext(&mut self) -> ::std::string::String {
|
||||
::std::mem::replace(&mut self.ext, ::std::string::String::new())
|
||||
}
|
||||
}
|
||||
|
||||
impl ::protobuf::Message for CreateViewPayload {
|
||||
@ -867,6 +894,9 @@ impl ::protobuf::Message for CreateViewPayload {
|
||||
5 => {
|
||||
::protobuf::rt::read_proto3_enum_with_unknown_fields_into(wire_type, is, &mut self.view_type, 5, &mut self.unknown_fields)?
|
||||
},
|
||||
6 => {
|
||||
::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.ext)?;
|
||||
},
|
||||
_ => {
|
||||
::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?;
|
||||
},
|
||||
@ -888,9 +918,12 @@ impl ::protobuf::Message for CreateViewPayload {
|
||||
if !self.desc.is_empty() {
|
||||
my_size += ::protobuf::rt::string_size(3, &self.desc);
|
||||
}
|
||||
if self.view_type != ViewType::Blank {
|
||||
if self.view_type != ViewType::RichText {
|
||||
my_size += ::protobuf::rt::enum_size(5, self.view_type);
|
||||
}
|
||||
if !self.ext.is_empty() {
|
||||
my_size += ::protobuf::rt::string_size(6, &self.ext);
|
||||
}
|
||||
if let ::std::option::Option::Some(ref v) = self.one_of_thumbnail {
|
||||
match v {
|
||||
&CreateViewPayload_oneof_one_of_thumbnail::thumbnail(ref v) => {
|
||||
@ -913,9 +946,12 @@ impl ::protobuf::Message for CreateViewPayload {
|
||||
if !self.desc.is_empty() {
|
||||
os.write_string(3, &self.desc)?;
|
||||
}
|
||||
if self.view_type != ViewType::Blank {
|
||||
if self.view_type != ViewType::RichText {
|
||||
os.write_enum(5, ::protobuf::ProtobufEnum::value(&self.view_type))?;
|
||||
}
|
||||
if !self.ext.is_empty() {
|
||||
os.write_string(6, &self.ext)?;
|
||||
}
|
||||
if let ::std::option::Option::Some(ref v) = self.one_of_thumbnail {
|
||||
match v {
|
||||
&CreateViewPayload_oneof_one_of_thumbnail::thumbnail(ref v) => {
|
||||
@ -986,6 +1022,11 @@ impl ::protobuf::Message for CreateViewPayload {
|
||||
|m: &CreateViewPayload| { &m.view_type },
|
||||
|m: &mut CreateViewPayload| { &mut m.view_type },
|
||||
));
|
||||
fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>(
|
||||
"ext",
|
||||
|m: &CreateViewPayload| { &m.ext },
|
||||
|m: &mut CreateViewPayload| { &mut m.ext },
|
||||
));
|
||||
::protobuf::reflect::MessageDescriptor::new_pb_name::<CreateViewPayload>(
|
||||
"CreateViewPayload",
|
||||
fields,
|
||||
@ -1006,7 +1047,8 @@ impl ::protobuf::Clear for CreateViewPayload {
|
||||
self.name.clear();
|
||||
self.desc.clear();
|
||||
self.one_of_thumbnail = ::std::option::Option::None;
|
||||
self.view_type = ViewType::Blank;
|
||||
self.view_type = ViewType::RichText;
|
||||
self.ext.clear();
|
||||
self.unknown_fields.clear();
|
||||
}
|
||||
}
|
||||
@ -1031,7 +1073,7 @@ pub struct CreateViewParams {
|
||||
pub desc: ::std::string::String,
|
||||
pub thumbnail: ::std::string::String,
|
||||
pub view_type: ViewType,
|
||||
pub view_data: ::std::string::String,
|
||||
pub ext: ::std::string::String,
|
||||
pub view_id: ::std::string::String,
|
||||
// special fields
|
||||
pub unknown_fields: ::protobuf::UnknownFields,
|
||||
@ -1160,7 +1202,7 @@ impl CreateViewParams {
|
||||
self.view_type
|
||||
}
|
||||
pub fn clear_view_type(&mut self) {
|
||||
self.view_type = ViewType::Blank;
|
||||
self.view_type = ViewType::RichText;
|
||||
}
|
||||
|
||||
// Param is passed by value, moved
|
||||
@ -1168,30 +1210,30 @@ impl CreateViewParams {
|
||||
self.view_type = v;
|
||||
}
|
||||
|
||||
// string view_data = 6;
|
||||
// string ext = 6;
|
||||
|
||||
|
||||
pub fn get_view_data(&self) -> &str {
|
||||
&self.view_data
|
||||
pub fn get_ext(&self) -> &str {
|
||||
&self.ext
|
||||
}
|
||||
pub fn clear_view_data(&mut self) {
|
||||
self.view_data.clear();
|
||||
pub fn clear_ext(&mut self) {
|
||||
self.ext.clear();
|
||||
}
|
||||
|
||||
// Param is passed by value, moved
|
||||
pub fn set_view_data(&mut self, v: ::std::string::String) {
|
||||
self.view_data = v;
|
||||
pub fn set_ext(&mut self, v: ::std::string::String) {
|
||||
self.ext = v;
|
||||
}
|
||||
|
||||
// Mutable pointer to the field.
|
||||
// If field is not initialized, it is initialized with default value first.
|
||||
pub fn mut_view_data(&mut self) -> &mut ::std::string::String {
|
||||
&mut self.view_data
|
||||
pub fn mut_ext(&mut self) -> &mut ::std::string::String {
|
||||
&mut self.ext
|
||||
}
|
||||
|
||||
// Take field
|
||||
pub fn take_view_data(&mut self) -> ::std::string::String {
|
||||
::std::mem::replace(&mut self.view_data, ::std::string::String::new())
|
||||
pub fn take_ext(&mut self) -> ::std::string::String {
|
||||
::std::mem::replace(&mut self.ext, ::std::string::String::new())
|
||||
}
|
||||
|
||||
// string view_id = 7;
|
||||
@ -1246,7 +1288,7 @@ impl ::protobuf::Message for CreateViewParams {
|
||||
::protobuf::rt::read_proto3_enum_with_unknown_fields_into(wire_type, is, &mut self.view_type, 5, &mut self.unknown_fields)?
|
||||
},
|
||||
6 => {
|
||||
::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.view_data)?;
|
||||
::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.ext)?;
|
||||
},
|
||||
7 => {
|
||||
::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.view_id)?;
|
||||
@ -1275,11 +1317,11 @@ impl ::protobuf::Message for CreateViewParams {
|
||||
if !self.thumbnail.is_empty() {
|
||||
my_size += ::protobuf::rt::string_size(4, &self.thumbnail);
|
||||
}
|
||||
if self.view_type != ViewType::Blank {
|
||||
if self.view_type != ViewType::RichText {
|
||||
my_size += ::protobuf::rt::enum_size(5, self.view_type);
|
||||
}
|
||||
if !self.view_data.is_empty() {
|
||||
my_size += ::protobuf::rt::string_size(6, &self.view_data);
|
||||
if !self.ext.is_empty() {
|
||||
my_size += ::protobuf::rt::string_size(6, &self.ext);
|
||||
}
|
||||
if !self.view_id.is_empty() {
|
||||
my_size += ::protobuf::rt::string_size(7, &self.view_id);
|
||||
@ -1302,11 +1344,11 @@ impl ::protobuf::Message for CreateViewParams {
|
||||
if !self.thumbnail.is_empty() {
|
||||
os.write_string(4, &self.thumbnail)?;
|
||||
}
|
||||
if self.view_type != ViewType::Blank {
|
||||
if self.view_type != ViewType::RichText {
|
||||
os.write_enum(5, ::protobuf::ProtobufEnum::value(&self.view_type))?;
|
||||
}
|
||||
if !self.view_data.is_empty() {
|
||||
os.write_string(6, &self.view_data)?;
|
||||
if !self.ext.is_empty() {
|
||||
os.write_string(6, &self.ext)?;
|
||||
}
|
||||
if !self.view_id.is_empty() {
|
||||
os.write_string(7, &self.view_id)?;
|
||||
@ -1375,9 +1417,9 @@ impl ::protobuf::Message for CreateViewParams {
|
||||
|m: &mut CreateViewParams| { &mut m.view_type },
|
||||
));
|
||||
fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>(
|
||||
"view_data",
|
||||
|m: &CreateViewParams| { &m.view_data },
|
||||
|m: &mut CreateViewParams| { &mut m.view_data },
|
||||
"ext",
|
||||
|m: &CreateViewParams| { &m.ext },
|
||||
|m: &mut CreateViewParams| { &mut m.ext },
|
||||
));
|
||||
fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>(
|
||||
"view_id",
|
||||
@ -1404,8 +1446,8 @@ impl ::protobuf::Clear for CreateViewParams {
|
||||
self.name.clear();
|
||||
self.desc.clear();
|
||||
self.thumbnail.clear();
|
||||
self.view_type = ViewType::Blank;
|
||||
self.view_data.clear();
|
||||
self.view_type = ViewType::RichText;
|
||||
self.ext.clear();
|
||||
self.view_id.clear();
|
||||
self.unknown_fields.clear();
|
||||
}
|
||||
@ -2548,9 +2590,8 @@ impl ::protobuf::reflect::ProtobufValue for UpdateViewParams {
|
||||
|
||||
#[derive(Clone,PartialEq,Eq,Debug,Hash)]
|
||||
pub enum ViewType {
|
||||
Blank = 0,
|
||||
QuillDocument = 1,
|
||||
Kanban = 2,
|
||||
RichText = 0,
|
||||
PlainText = 1,
|
||||
}
|
||||
|
||||
impl ::protobuf::ProtobufEnum for ViewType {
|
||||
@ -2560,18 +2601,16 @@ impl ::protobuf::ProtobufEnum for ViewType {
|
||||
|
||||
fn from_i32(value: i32) -> ::std::option::Option<ViewType> {
|
||||
match value {
|
||||
0 => ::std::option::Option::Some(ViewType::Blank),
|
||||
1 => ::std::option::Option::Some(ViewType::QuillDocument),
|
||||
2 => ::std::option::Option::Some(ViewType::Kanban),
|
||||
0 => ::std::option::Option::Some(ViewType::RichText),
|
||||
1 => ::std::option::Option::Some(ViewType::PlainText),
|
||||
_ => ::std::option::Option::None
|
||||
}
|
||||
}
|
||||
|
||||
fn values() -> &'static [Self] {
|
||||
static values: &'static [ViewType] = &[
|
||||
ViewType::Blank,
|
||||
ViewType::QuillDocument,
|
||||
ViewType::Kanban,
|
||||
ViewType::RichText,
|
||||
ViewType::PlainText,
|
||||
];
|
||||
values
|
||||
}
|
||||
@ -2589,7 +2628,7 @@ impl ::std::marker::Copy for ViewType {
|
||||
|
||||
impl ::std::default::Default for ViewType {
|
||||
fn default() -> Self {
|
||||
ViewType::Blank
|
||||
ViewType::RichText
|
||||
}
|
||||
}
|
||||
|
||||
@ -2608,29 +2647,29 @@ static file_descriptor_proto_data: &'static [u8] = b"\
|
||||
gings\x18\x07\x20\x01(\x0b2\r.RepeatedViewR\nbelongings\x12#\n\rmodified\
|
||||
_time\x18\x08\x20\x01(\x03R\x0cmodifiedTime\x12\x1f\n\x0bcreate_time\x18\
|
||||
\t\x20\x01(\x03R\ncreateTime\"+\n\x0cRepeatedView\x12\x1b\n\x05items\x18\
|
||||
\x01\x20\x03(\x0b2\x05.ViewR\x05items\"\xb9\x01\n\x11CreateViewPayload\
|
||||
\x01\x20\x03(\x0b2\x05.ViewR\x05items\"\xcb\x01\n\x11CreateViewPayload\
|
||||
\x12\x20\n\x0cbelong_to_id\x18\x01\x20\x01(\tR\nbelongToId\x12\x12\n\x04\
|
||||
name\x18\x02\x20\x01(\tR\x04name\x12\x12\n\x04desc\x18\x03\x20\x01(\tR\
|
||||
\x04desc\x12\x1e\n\tthumbnail\x18\x04\x20\x01(\tH\0R\tthumbnail\x12&\n\t\
|
||||
view_type\x18\x05\x20\x01(\x0e2\t.ViewTypeR\x08viewTypeB\x12\n\x10one_of\
|
||||
_thumbnail\"\xd8\x01\n\x10CreateViewParams\x12\x20\n\x0cbelong_to_id\x18\
|
||||
\x01\x20\x01(\tR\nbelongToId\x12\x12\n\x04name\x18\x02\x20\x01(\tR\x04na\
|
||||
me\x12\x12\n\x04desc\x18\x03\x20\x01(\tR\x04desc\x12\x1c\n\tthumbnail\
|
||||
\x18\x04\x20\x01(\tR\tthumbnail\x12&\n\tview_type\x18\x05\x20\x01(\x0e2\
|
||||
\t.ViewTypeR\x08viewType\x12\x1b\n\tview_data\x18\x06\x20\x01(\tR\x08vie\
|
||||
wData\x12\x17\n\x07view_id\x18\x07\x20\x01(\tR\x06viewId\"\x1e\n\x06View\
|
||||
Id\x12\x14\n\x05value\x18\x01\x20\x01(\tR\x05value\"&\n\x0eRepeatedViewI\
|
||||
d\x12\x14\n\x05items\x18\x01\x20\x03(\tR\x05items\"\xaa\x01\n\x11UpdateV\
|
||||
iewPayload\x12\x17\n\x07view_id\x18\x01\x20\x01(\tR\x06viewId\x12\x14\n\
|
||||
\x04name\x18\x02\x20\x01(\tH\0R\x04name\x12\x14\n\x04desc\x18\x03\x20\
|
||||
\x01(\tH\x01R\x04desc\x12\x1e\n\tthumbnail\x18\x04\x20\x01(\tH\x02R\tthu\
|
||||
mbnailB\r\n\x0bone_of_nameB\r\n\x0bone_of_descB\x12\n\x10one_of_thumbnai\
|
||||
l\"\xa9\x01\n\x10UpdateViewParams\x12\x17\n\x07view_id\x18\x01\x20\x01(\
|
||||
\tR\x06viewId\x12\x14\n\x04name\x18\x02\x20\x01(\tH\0R\x04name\x12\x14\n\
|
||||
\x04desc\x18\x03\x20\x01(\tH\x01R\x04desc\x12\x1e\n\tthumbnail\x18\x04\
|
||||
\x20\x01(\tH\x02R\tthumbnailB\r\n\x0bone_of_nameB\r\n\x0bone_of_descB\
|
||||
\x12\n\x10one_of_thumbnail*4\n\x08ViewType\x12\t\n\x05Blank\x10\0\x12\
|
||||
\x11\n\rQuillDocument\x10\x01\x12\n\n\x06Kanban\x10\x02b\x06proto3\
|
||||
view_type\x18\x05\x20\x01(\x0e2\t.ViewTypeR\x08viewType\x12\x10\n\x03ext\
|
||||
\x18\x06\x20\x01(\tR\x03extB\x12\n\x10one_of_thumbnail\"\xcd\x01\n\x10Cr\
|
||||
eateViewParams\x12\x20\n\x0cbelong_to_id\x18\x01\x20\x01(\tR\nbelongToId\
|
||||
\x12\x12\n\x04name\x18\x02\x20\x01(\tR\x04name\x12\x12\n\x04desc\x18\x03\
|
||||
\x20\x01(\tR\x04desc\x12\x1c\n\tthumbnail\x18\x04\x20\x01(\tR\tthumbnail\
|
||||
\x12&\n\tview_type\x18\x05\x20\x01(\x0e2\t.ViewTypeR\x08viewType\x12\x10\
|
||||
\n\x03ext\x18\x06\x20\x01(\tR\x03ext\x12\x17\n\x07view_id\x18\x07\x20\
|
||||
\x01(\tR\x06viewId\"\x1e\n\x06ViewId\x12\x14\n\x05value\x18\x01\x20\x01(\
|
||||
\tR\x05value\"&\n\x0eRepeatedViewId\x12\x14\n\x05items\x18\x01\x20\x03(\
|
||||
\tR\x05items\"\xaa\x01\n\x11UpdateViewPayload\x12\x17\n\x07view_id\x18\
|
||||
\x01\x20\x01(\tR\x06viewId\x12\x14\n\x04name\x18\x02\x20\x01(\tH\0R\x04n\
|
||||
ame\x12\x14\n\x04desc\x18\x03\x20\x01(\tH\x01R\x04desc\x12\x1e\n\tthumbn\
|
||||
ail\x18\x04\x20\x01(\tH\x02R\tthumbnailB\r\n\x0bone_of_nameB\r\n\x0bone_\
|
||||
of_descB\x12\n\x10one_of_thumbnail\"\xa9\x01\n\x10UpdateViewParams\x12\
|
||||
\x17\n\x07view_id\x18\x01\x20\x01(\tR\x06viewId\x12\x14\n\x04name\x18\
|
||||
\x02\x20\x01(\tH\0R\x04name\x12\x14\n\x04desc\x18\x03\x20\x01(\tH\x01R\
|
||||
\x04desc\x12\x1e\n\tthumbnail\x18\x04\x20\x01(\tH\x02R\tthumbnailB\r\n\
|
||||
\x0bone_of_nameB\r\n\x0bone_of_descB\x12\n\x10one_of_thumbnail*'\n\x08Vi\
|
||||
ewType\x12\x0c\n\x08RichText\x10\0\x12\r\n\tPlainText\x10\x01b\x06proto3\
|
||||
";
|
||||
|
||||
static file_descriptor_proto_lazy: ::protobuf::rt::LazyV2<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::rt::LazyV2::INIT;
|
||||
|
@ -20,6 +20,7 @@ message CreateViewPayload {
|
||||
string desc = 3;
|
||||
oneof one_of_thumbnail { string thumbnail = 4; };
|
||||
ViewType view_type = 5;
|
||||
string ext = 6;
|
||||
}
|
||||
message CreateViewParams {
|
||||
string belong_to_id = 1;
|
||||
@ -27,7 +28,7 @@ message CreateViewParams {
|
||||
string desc = 3;
|
||||
string thumbnail = 4;
|
||||
ViewType view_type = 5;
|
||||
string view_data = 6;
|
||||
string ext = 6;
|
||||
string view_id = 7;
|
||||
}
|
||||
message ViewId {
|
||||
@ -49,7 +50,6 @@ message UpdateViewParams {
|
||||
oneof one_of_thumbnail { string thumbnail = 4; };
|
||||
}
|
||||
enum ViewType {
|
||||
Blank = 0;
|
||||
QuillDocument = 1;
|
||||
Kanban = 2;
|
||||
RichText = 0;
|
||||
PlainText = 1;
|
||||
}
|
||||
|
@ -49,7 +49,7 @@ fn create_default_view(app_id: String, time: chrono::DateTime<Utc>) -> View {
|
||||
let view_id = uuid::Uuid::new_v4();
|
||||
let name = "Read me".to_string();
|
||||
let desc = "".to_string();
|
||||
let view_type = ViewType::QuillDocument;
|
||||
let view_type = ViewType::RichText;
|
||||
|
||||
View {
|
||||
id: view_id.to_string(),
|
||||
|
Loading…
Reference in New Issue
Block a user