diff --git a/electron.js b/electron.js index c4b681f257..15bb950948 100644 --- a/electron.js +++ b/electron.js @@ -581,13 +581,6 @@ function menuInit () { menuParam.push({ label: 'Sudo', submenu: [ - { - label: 'Dataview', type: 'checkbox', checked: config.allowDataview, - click: () => { - setConfig({ allowDataview: !config.allowDataview }); - win.reload(); - } - }, { label: 'Graph', click: () => { send('popup', 'graph', {}); } diff --git a/src/scss/block/featured.scss b/src/scss/block/featured.scss index 093205e3fc..f8ec5c495e 100644 --- a/src/scss/block/featured.scss +++ b/src/scss/block/featured.scss @@ -53,8 +53,4 @@ .editorWrapper.noSystemBlocks { .blocks .block.blockFeatured { display: none; } -} - -html.withDataview { - .blocks .block.blockFeatured { display: flex; } } \ No newline at end of file diff --git a/src/ts/component/block/cover.tsx b/src/ts/component/block/cover.tsx index 7c2dd6439c..aac7dfe9d0 100644 --- a/src/ts/component/block/cover.tsx +++ b/src/ts/component/block/cover.tsx @@ -118,12 +118,10 @@ const BlockCover = observer(class BlockCover extends React.Component ) : ''} - {config.allowDataview ? ( -
- -
{translate('editorControlRelation')}
-
- ) : ''} +
+ +
{translate('editorControlRelation')}
+
); diff --git a/src/ts/component/editor/controls.tsx b/src/ts/component/editor/controls.tsx index b35689d2c7..634d71108b 100644 --- a/src/ts/component/editor/controls.tsx +++ b/src/ts/component/editor/controls.tsx @@ -71,12 +71,10 @@ const Controls = observer(class Controls extends React.Component { ) : ''} - {config.allowDataview ? ( -
- -
{translate('editorControlRelation')}
-
- ) : ''} +
+ +
{translate('editorControlRelation')}
+
); diff --git a/src/ts/component/menu/block/action.tsx b/src/ts/component/menu/block/action.tsx index 612de8fff4..30772a72ce 100644 --- a/src/ts/component/menu/block/action.tsx +++ b/src/ts/component/menu/block/action.tsx @@ -332,13 +332,8 @@ class MenuBlockAction extends React.Component { const { content, align } = block; const { color, bgColor } = content; - - let types = [ Constant.typeId.page ]; + const types = dbStore.getObjectTypesForSBType(I.SmartBlockType.Page).map((it: I.ObjectType) => { return it.id; }); - if (config.allowDataview) { - types = dbStore.getObjectTypesForSBType(I.SmartBlockType.Page).map((it: I.ObjectType) => { return it.id; }); - }; - setActive(item, false); if (!item.arrow) { @@ -396,13 +391,10 @@ class MenuBlockAction extends React.Component { menuParam.className = 'single'; filters = [ - { operator: I.FilterOperator.And, relationKey: 'id', condition: I.FilterCondition.In, value: types } + { operator: I.FilterOperator.And, relationKey: 'id', condition: I.FilterCondition.In, value: types }, + { operator: I.FilterOperator.And, relationKey: 'id', condition: I.FilterCondition.NotIn, value: [ Constant.typeId.page ] } ]; - if (config.allowDataview) { - filters.push({ operator: I.FilterOperator.And, relationKey: 'id', condition: I.FilterCondition.NotIn, value: [ Constant.typeId.page ] }); - }; - menuParam.data = Object.assign(menuParam.data, { placeholder: 'Find a type of object...', label: 'Your object type library', diff --git a/src/ts/component/menu/block/add.tsx b/src/ts/component/menu/block/add.tsx index 26d9143547..b3b251739c 100644 --- a/src/ts/component/menu/block/add.tsx +++ b/src/ts/component/menu/block/add.tsx @@ -332,11 +332,9 @@ const MenuBlockAdd = observer(class MenuBlockAdd extends React.Component void) { const { filter } = commonStore; const { config } = commonStore; - const filterMapper = (it: any) => { return this.filterMapper(it, config); }; const filters: any[] = [ + { operator: I.FilterOperator.And, relationKey: 'isArchived', condition: I.FilterCondition.Equal, value: false }, { operator: I.FilterOperator.And, relationKey: 'id', condition: I.FilterCondition.NotIn, value: [ blockStore.storeType, @@ -172,10 +172,6 @@ const MenuBlockMention = observer(class MenuBlockMention extends React.Component if (!config.debug.ho) { filters.push({ operator: I.FilterOperator.And, relationKey: 'isHidden', condition: I.FilterCondition.NotEqual, value: true }); }; - if (!config.allowDataview) { - filters.push({ operator: I.FilterOperator.And, relationKey: 'layout', condition: I.FilterCondition.Equal, value: I.ObjectLayout.Page }); - filters.push({ operator: I.FilterOperator.And, relationKey: 'type', condition: I.FilterCondition.NotIn, value: [ Constant.typeId.template ] }); - }; this.setState({ loading: true }); @@ -194,23 +190,12 @@ const MenuBlockMention = observer(class MenuBlockMention extends React.Component name: String(it.name || DataUtil.defaultName('page')), }; })); - this.items = this.items.filter(filterMapper); this.items.sort(DataUtil.sortByName); this.setState({ loading: false }); }); }; - filterMapper (it: any, config: any) { - if (it.isArchived) { - return false; - }; - if (!config.allowDataview && (it.layout != I.ObjectLayout.Page)) { - return false; - }; - return true; - }; - onOver (e: any, item: any) { if (!keyboard.isMouseDisabled) { this.props.setActive(item, false); diff --git a/src/ts/component/menu/block/more.tsx b/src/ts/component/menu/block/more.tsx index 9582873adf..fdce0cfce4 100644 --- a/src/ts/component/menu/block/more.tsx +++ b/src/ts/component/menu/block/more.tsx @@ -56,19 +56,17 @@ class MenuBlockMore extends React.Component { ); let sectionPage = null; - if (block && block.isPage() && config.allowDataview) { + if (block && block.isPage() && config.sudo && restr.length) { sectionPage = ( - {config.sudo && restr.length ? ( -
-
Restrictions
-
- {restr.map((item: any, i: number) => ( -
{item || 'Empty'}
- ))} -
+
+
Restrictions
+
+ {restr.map((item: any, i: number) => ( +
{item || 'Empty'}
+ ))}
- ) : ''} +
); }; @@ -184,7 +182,7 @@ class MenuBlockMore extends React.Component { redo = null; }; - if (!config.allowDataview || (object.type == Constant.typeId.page)) { + if (object.type == Constant.typeId.page) { template = null; }; @@ -271,9 +269,7 @@ class MenuBlockMore extends React.Component { }; let types = dbStore.getObjectTypesForSBType(I.SmartBlockType.Page).map((it: I.ObjectType) => { return it.id; }); - if (config.allowDataview) { - types = types.filter((it: string) => { return it != Constant.typeId.page; }); - }; + types = types.filter((it: string) => { return it != Constant.typeId.page; }); switch (item.id) { case 'turnObject': @@ -284,10 +280,6 @@ class MenuBlockMore extends React.Component { { operator: I.FilterOperator.And, relationKey: 'id', condition: I.FilterCondition.In, value: types }, ]; - if (!config.allowDataview) { - filters.push({ operator: I.FilterOperator.And, relationKey: 'id', condition: I.FilterCondition.In, value: [ Constant.typeId.page ] }); - }; - menuParam.data = Object.assign(menuParam.data, { placeholder: 'Find a type of object...', label: 'Your object type library', @@ -310,10 +302,6 @@ class MenuBlockMore extends React.Component { { operator: I.FilterOperator.And, relationKey: 'type', condition: I.FilterCondition.In, value: types } ]; - if (!config.allowDataview) { - filters.push({ operator: I.FilterOperator.And, relationKey: 'type', condition: I.FilterCondition.In, value: [ Constant.typeId.page ] }); - }; - menuParam.data = Object.assign(menuParam.data, { filters: filters, type: I.NavigationType.Move, @@ -336,10 +324,6 @@ class MenuBlockMore extends React.Component { { operator: I.FilterOperator.And, relationKey: 'type', condition: I.FilterCondition.In, value: types } ]; - if (!config.allowDataview) { - filters.push({ operator: I.FilterOperator.And, relationKey: 'type', condition: I.FilterCondition.In, value: [ Constant.typeId.page ] }); - }; - menuParam.data = Object.assign(menuParam.data, { filters: filters, type: I.NavigationType.LinkTo, diff --git a/src/ts/component/menu/search/object.tsx b/src/ts/component/menu/search/object.tsx index 6ce1e957f6..d7bbfd8adf 100644 --- a/src/ts/component/menu/search/object.tsx +++ b/src/ts/component/menu/search/object.tsx @@ -253,9 +253,6 @@ const MenuSearchObject = observer(class MenuSearchObject extends React.Component if (!config.debug.ho) { filters.push({ operator: I.FilterOperator.And, relationKey: 'isHidden', condition: I.FilterCondition.Equal, value: false }); }; - if (!config.allowDataview) { - filters.push({ operator: I.FilterOperator.And, relationKey: 'type', condition: I.FilterCondition.NotIn, value: [ Constant.typeId.template ] }); - }; if (type == I.NavigationType.Move) { filters.push({ operator: I.FilterOperator.And, relationKey: 'isReadonly', condition: I.FilterCondition.Equal, value: false }); }; @@ -302,19 +299,6 @@ const MenuSearchObject = observer(class MenuSearchObject extends React.Component if (it.id == skipId) { return false; }; - - if (!config.allowDataview) { - if (it.type == Constant.typeId.template) { - return false; - }; - if ((it.layout != I.ObjectLayout.Page) && (it.id != Constant.typeId.page)) { - return false; - }; - if ((type == I.NavigationType.Link) && ([ I.ObjectLayout.Page, I.ObjectLayout.Human, I.ObjectLayout.Task ].indexOf(it.layout) < 0)) { - return false; - }; - }; - if ((type == I.NavigationType.Move) && ([ I.ObjectLayout.Page, I.ObjectLayout.Human, I.ObjectLayout.Task, I.ObjectLayout.Dashboard ].indexOf(it.layout) < 0)) { return false; }; diff --git a/src/ts/component/page/index.tsx b/src/ts/component/page/index.tsx index 592935d578..de41af5e1d 100644 --- a/src/ts/component/page/index.tsx +++ b/src/ts/component/page/index.tsx @@ -240,9 +240,6 @@ class Page extends React.Component { if (config.debug.dm) { cn.push('dark'); }; - if (config.allowDataview) { - cn.push('withDataview'); - }; obj.attr({ class: cn.join(' ') }); }; diff --git a/src/ts/component/page/main/index.tsx b/src/ts/component/page/main/index.tsx index af0f8df98c..e822050c42 100644 --- a/src/ts/component/page/main/index.tsx +++ b/src/ts/component/page/main/index.tsx @@ -98,9 +98,7 @@ const PageMainIndex = observer(class PageMainIndex extends React.Component - {config.allowDataview ? ( - - ) : ''} + { return { ...object, layout: I.ObjectLayout.Human } }} size={56} tooltip="Your profile" onClick={this.onProfile} />
@@ -108,13 +106,9 @@ const PageMainIndex = observer(class PageMainIndex extends React.Component
- {Tabs.map((item: any, i: number) => { - if (!config.allowDataview && ([ Tab.Draft, Tab.Set ].indexOf(item.id) >= 0)) { - return null; - }; - - return - })} + {Tabs.map((item: any, i: number) => ( + + ))}
@@ -339,10 +333,7 @@ const PageMainIndex = observer(class PageMainIndex extends React.Component { return it.id; }); - - if (config.allowDataview) { - types = types.filter((it: string) => { return it != Constant.typeId.page; }); - }; + types = types.filter((it: string) => { return it != Constant.typeId.page; }); if (item.isBlock) { favorites = blockStore.getChildren(blockStore.root, blockStore.root, (it: I.Block) => { @@ -411,10 +402,6 @@ const PageMainIndex = observer(class PageMainIndex extends React.Component { return this.filterMapper(it, config); }; + const filter = (it: I.PageInfo) => { return this.filterMapper(it); }; this.setState({ loading: true }); crumbs.addPage(id); @@ -514,21 +513,8 @@ const PopupNavigation = observer(class PopupNavigation extends React.Component

{ return !it.isHidden; }) - }; - objectTypes.sort(this.sortByName); + let objectTypes = Util.objectCopy(dbStore.getObjectTypesForSBType(I.SmartBlockType.Page)); + if (!config.debug.ho) { + objectTypes = objectTypes.filter((it: I.ObjectType) => { return !it.isHidden; }) + }; + objectTypes.sort(this.sortByName); - for (let type of objectTypes) { - ret.push({ - type: I.BlockType.Page, - id: 'object' + i++, - objectTypeId: type.id, - iconEmoji: type.iconEmoji, - name: type.name || this.defaultName('page'), - description: type.description, - isObject: true, - isHidden: type.isHidden, - }); - }; - } else { - ret.push({ type: I.BlockType.Page, id: 'page', icon: 'page', lang: 'Page' }); + for (let type of objectTypes) { + ret.push({ + type: I.BlockType.Page, + id: 'object' + i++, + objectTypeId: type.id, + iconEmoji: type.iconEmoji, + name: type.name || this.defaultName('page'), + description: type.description, + isObject: true, + isHidden: type.isHidden, + }); }; return ret.map(this.menuMapperBlock); @@ -656,26 +652,24 @@ class DataUtil { const { config } = commonStore; const ret = []; - if (config.allowDataview) { - let objectTypes = dbStore.objectTypes; - if (!config.debug.ho) { - objectTypes = objectTypes.filter((it: I.ObjectType) => { return !it.isHidden; }); - }; - objectTypes.sort(this.sortByName); + let objectTypes = dbStore.objectTypes; + if (!config.debug.ho) { + objectTypes = objectTypes.filter((it: I.ObjectType) => { return !it.isHidden; }); + }; + objectTypes.sort(this.sortByName); - let i = 0; - for (let type of objectTypes) { - ret.push({ - type: I.BlockType.Page, - id: 'object' + i++, - objectTypeId: type.id, - iconEmoji: type.iconEmoji, - name: type.name || this.defaultName('page'), - description: type.description, - isObject: true, - isHidden: type.isHidden, - }); - }; + let i = 0; + for (let type of objectTypes) { + ret.push({ + type: I.BlockType.Page, + id: 'object' + i++, + objectTypeId: type.id, + iconEmoji: type.iconEmoji, + name: type.name || this.defaultName('page'), + description: type.description, + isObject: true, + isHidden: type.isHidden, + }); }; return ret.map(this.menuMapperBlock); diff --git a/src/ts/lib/dispatcher.tsx b/src/ts/lib/dispatcher.tsx index 8cf9c7f18c..c16723e1c5 100644 --- a/src/ts/lib/dispatcher.tsx +++ b/src/ts/lib/dispatcher.tsx @@ -645,12 +645,6 @@ class Dispatcher { }; blockTypeCheck (rootId: string) { - const { config } = commonStore; - - if (!config.allowDataview) { - return; - }; - const object = detailStore.get(rootId, rootId, []); let childrenIds = Util.objectCopy(blockStore.getChildrenIds(rootId, rootId)); diff --git a/src/ts/lib/mapper.tsx b/src/ts/lib/mapper.tsx index 24c4b13195..e734ada3c5 100644 --- a/src/ts/lib/mapper.tsx +++ b/src/ts/lib/mapper.tsx @@ -15,9 +15,7 @@ const Mapper = { }, AccountConfig: (obj: any): I.AccountConfig => { - return { - allowDataview: obj.getEnabledataview(), - }; + return {}; }, ObjectInfo: (obj: any): I.PageInfo => {