mirror of
https://github.com/anyproto/anytype-ts.git
synced 2025-06-09 09:35:02 +09:00
JS-4425: add files setting to the graph
This commit is contained in:
parent
af3730f463
commit
e24cbbc29e
5 changed files with 21 additions and 6 deletions
21
dist/workers/graph.js
vendored
21
dist/workers/graph.js
vendored
|
@ -18,11 +18,16 @@ const transformThreshold = 1;
|
|||
const transformThresholdHalf = transformThreshold / 2;
|
||||
const delayFocus = 1000;
|
||||
|
||||
const ObjectLayout = {
|
||||
const Layout = {
|
||||
Human: 1,
|
||||
Task: 2,
|
||||
File: 6,
|
||||
Image: 8,
|
||||
Audio: 15,
|
||||
Video: 16,
|
||||
Bookmark: 11,
|
||||
Participant: 19,
|
||||
Pdf: 20,
|
||||
};
|
||||
|
||||
const EdgeType = {
|
||||
|
@ -187,6 +192,12 @@ updateForces = () => {
|
|||
|
||||
updateOrphans();
|
||||
|
||||
// Filter files
|
||||
if (!settings.files) {
|
||||
const layouts = [ Layout.File, Layout.Image, Layout.Audio, Layout.Video, Layout.Pdf ];
|
||||
nodes = nodes.filter(d => !layouts.includes(d.layout) || d.forceShow);
|
||||
};
|
||||
|
||||
// Filter links
|
||||
if (!settings.link) {
|
||||
edges = edges.filter(d => d.type != EdgeType.Link);
|
||||
|
@ -251,7 +262,7 @@ updateForces = () => {
|
|||
};
|
||||
|
||||
updateSettings = (param) => {
|
||||
const updateKeys = [ 'link', 'relation', 'orphan', 'local' ];
|
||||
const updateKeys = [ 'link', 'relation', 'orphan', 'local', 'files' ];
|
||||
|
||||
let needUpdate = false;
|
||||
let needFocus = false;
|
||||
|
@ -749,15 +760,15 @@ const checkNodeInViewport = (d) => {
|
|||
};
|
||||
|
||||
const isLayoutHuman = (d) => {
|
||||
return d.layout == ObjectLayout.Human;
|
||||
return d.layout == Layout.Human;
|
||||
};
|
||||
|
||||
const isLayoutParticipant = (d) => {
|
||||
return d.layout == ObjectLayout.Participant;
|
||||
return d.layout == Layout.Participant;
|
||||
};
|
||||
|
||||
const isLayoutBookmark = (d) => {
|
||||
return d.layout == ObjectLayout.Bookmark;
|
||||
return d.layout == Layout.Bookmark;
|
||||
};
|
||||
|
||||
const getNodeById = (id) => {
|
||||
|
|
|
@ -1431,6 +1431,7 @@
|
|||
"menuGraphSettingsLinks": "Links",
|
||||
"menuGraphSettingsRelations": "Relations",
|
||||
"menuGraphSettingsUnlinkedObjects": "Unlinked Objects",
|
||||
"menuGraphSettingsFiles": "Files",
|
||||
"menuGraphSettingsLocal": "Local graph",
|
||||
|
||||
"menuHelpWhatsNew": "What's New",
|
||||
|
|
|
@ -110,6 +110,7 @@ const MenuGraphSettings = observer(class MenuGraphSettings extends React.Compone
|
|||
{ id: 'link', name: translate('menuGraphSettingsLinks') },
|
||||
{ id: 'relation', name: translate('menuGraphSettingsRelations') },
|
||||
{ id: 'orphan', name: translate('menuGraphSettingsUnlinkedObjects') },
|
||||
{ id: 'files', name: translate('menuGraphSettingsFiles') },
|
||||
]
|
||||
},
|
||||
];
|
||||
|
|
|
@ -871,7 +871,7 @@ class UtilData {
|
|||
{ operator: I.FilterOperator.And, relationKey: 'isHiddenDiscovery', condition: I.FilterCondition.NotEqual, value: true },
|
||||
{ operator: I.FilterOperator.And, relationKey: 'isArchived', condition: I.FilterCondition.NotEqual, value: true },
|
||||
{ operator: I.FilterOperator.And, relationKey: 'isDeleted', condition: I.FilterCondition.NotEqual, value: true },
|
||||
{ operator: I.FilterOperator.And, relationKey: 'layout', condition: I.FilterCondition.NotIn, value: UtilObject.getFileAndSystemLayouts() },
|
||||
{ operator: I.FilterOperator.And, relationKey: 'layout', condition: I.FilterCondition.NotIn, value: UtilObject.getSystemLayouts() },
|
||||
{ operator: I.FilterOperator.And, relationKey: 'id', condition: I.FilterCondition.NotIn, value: [ '_anytype_profile' ] },
|
||||
{ operator: I.FilterOperator.And, relationKey: 'spaceId', condition: I.FilterCondition.In, value: [ space ] },
|
||||
];
|
||||
|
|
|
@ -16,6 +16,7 @@ interface Graph {
|
|||
label: boolean;
|
||||
relation: boolean;
|
||||
link: boolean;
|
||||
files: boolean;
|
||||
local: boolean;
|
||||
filter: string;
|
||||
};
|
||||
|
@ -74,6 +75,7 @@ class CommonStore {
|
|||
marker: true,
|
||||
label: true,
|
||||
relation: true,
|
||||
files: false,
|
||||
link: true,
|
||||
local: false,
|
||||
filter: '',
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue