Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
purescript-gargantext
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
142
Issues
142
List
Board
Labels
Milestones
Merge Requests
4
Merge Requests
4
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gargantext
purescript-gargantext
Commits
5d55ef09
Verified
Commit
5d55ef09
authored
Jul 17, 2023
by
Przemyslaw Kaminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[ngrams] fixes to highlight
- Simplified reloads - less boxes, more pure state
parent
64a9dd42
Pipeline
#4394
failed with stage
in 0 seconds
Changes
6
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
41 additions
and
43 deletions
+41
-43
Field.purs
src/Gargantext/Components/Annotation/Field.purs
+4
-3
Layout.purs
src/Gargantext/Components/Document/Layout.purs
+33
-21
DocFocus.purs
src/Gargantext/Components/GraphExplorer/Frame/DocFocus.purs
+0
-3
Document.purs
src/Gargantext/Components/Nodes/Corpus/Document.purs
+0
-3
Texts.purs
src/Gargantext/Components/Nodes/Texts.purs
+4
-9
DocFocus.purs
src/Gargantext/Components/PhyloExplorer/Frame/DocFocus.purs
+0
-4
No files found.
src/Gargantext/Components/Annotation/Field.purs
View file @
5d55ef09
...
...
@@ -52,7 +52,8 @@ type CommonProps =
, cache :: Record Cache
)
type AnnotatedFieldProps =
( ngrams :: T.Box NgramsTable
( -- ngrams :: T.Box NgramsTable
ngrams' :: NgramsTable
| CommonProps )
type MouseEvent = E.SyntheticEvent DE.MouseEvent
...
...
@@ -65,8 +66,8 @@ annotatedField :: R2.Leaf AnnotatedFieldProps
annotatedField = R2.leaf annotatedFieldCpt
annotatedFieldCpt :: R.Component AnnotatedFieldProps
annotatedFieldCpt = here.component "annotatedField" cpt where
cpt props _ = do
ngrams' <- T.useLive T.unequal props.ngrams
cpt props
@{ ngrams' }
_ = do
--
ngrams' <- T.useLive T.unequal props.ngrams
menuRef <- R.useRef (Nothing :: Maybe (Record AnnotationMenu))
redrawMenu <- T.useBox false
...
...
src/Gargantext/Components/Document/Layout.purs
View file @
5d55ef09
...
...
@@ -13,7 +13,9 @@ import Data.Set (Set)
import Data.Set as Set
import Data.String (length)
import Data.String as String
import Data.Tuple (Tuple(..))
import Data.Tuple.Nested ((/\))
import Effect.Class (liftEffect)
import Gargantext.Components.Annotation.Field as AnnotatedField
import Gargantext.Components.Annotation.Types as AFT
import Gargantext.Components.AutoUpdate (autoUpdate)
...
...
@@ -26,7 +28,7 @@ import Gargantext.Components.NgramsTable.AutoSync (useAutoSync)
import Gargantext.Components.Node (NodePoly(..))
import Gargantext.Config.REST (logRESTError)
import Gargantext.Core.NgramsTable.Functions (addNewNgramA, applyNgramsPatches, coreDispatch, findNgramRoot, setTermListA, computeCache)
import Gargantext.Core.NgramsTable.Types (CoreAction(..), NgramsTable(..), NgramsTerm, Versioned(..), replace)
import Gargantext.Core.NgramsTable.Types (CoreAction(..), NgramsTable(..), NgramsTerm,
State,
Versioned(..), replace)
import Gargantext.Hooks.FirstEffect (useFirstEffect')
import Gargantext.Hooks.Loader (useLoader)
import Gargantext.Sessions (Session)
...
...
@@ -49,7 +51,6 @@ here = R2.here "Gargantext.Components.Document.Layout"
type Props =
( loaded :: LoadedData
, path :: DocPath
, reload :: T2.ReloadS
, session :: Session
| Options
)
...
...
@@ -69,15 +70,13 @@ layoutCpt :: R.Component Props
layoutCpt = here.component "layout" cpt where
cpt props@{ path: path@{ listIds
, nodeId }
, reload
, session } _ = do
reload' <- T.useLive T.unequal reload
case A.head listIds of
Nothing -> pure $ H.div {} [ H.text "No list supplied!" ]
Just listId ->
useLoader { errorHandler
, loader: \p -> getContextNgrams session p.contextId p.listId
, path: { contextId: nodeId, listId
, reload: reload'
}
, path: { contextId: nodeId, listId }
, render: \contextNgrams ->
layoutWithContextNgrams $ Record.merge props { contextNgrams } }
where
...
...
@@ -93,20 +92,32 @@ layoutWithContextNgramsCpt :: R.Component WithContextNgramsProps
layoutWithContextNgramsCpt = here.component "layoutWithContextNgrams" cpt where
-- Component
cpt { contextNgrams
, path
, reload
, loaded:
loaded@{ ngramsTable: Versioned { data: initTable }
, document: NodePoly { hyperdata: Document doc }
}
, path
, sideControlsSlot
} _ = do
-- | States
-- |
reload' <- T.useLive T.unequal reload
state'@{ ngramsLocalPatch } /\ state <-
R2.useBox' $ initialState { loaded }
contextNgramsS <- T.useBox contextNgrams
contextNgrams' <- T.useLive T.unequal contextNgramsS
-- ngrams <- T.useBox initTable
-- ngrams' <- T.useLive T.unequal ngrams
state <- T.useBox $ initialState { loaded }
state'@{ ngramsLocalPatch } <- T.useLive T.unequal state
let ngrams' = applyNgramsPatches state' initTable
-- R.useEffect' $ do
-- let (NgramsTable { ngrams_repo_elements: nre }) = ngrams'
-- let nre' = Map.mapMaybeWithKey (\k v -> Just { k, v }) nre
-- here.log2 "[layout] nre" $ A.fromFoldable nre'
-- here.log2 "[layout] contextNgrams" contextNgrams
-- here.log2 "[layout] contextNgrams'" contextNgrams'
-- here.log2 "[layout] state'" state'
mode' /\ mode <- R2.useBox' AFT.EditionMode
...
...
@@ -116,9 +127,6 @@ layoutWithContextNgramsCpt = here.component "layoutWithContextNgrams" cpt where
onPending' <- R2.useLive' onPending
result' <- R2.useLive' result
ngrams <- T.useBox initTable
ngrams' <- T.useLive T.unequal ngrams
-- | Computed
-- |
let
...
...
@@ -127,7 +135,7 @@ layoutWithContextNgramsCpt = here.component "layoutWithContextNgrams" cpt where
-- ngrams = applyNgramsPatches state' initTable
cache = computeCache ngrams' $ Set.fromFoldable contextNgrams
cache = computeCache ngrams' $ Set.fromFoldable contextNgrams
'
setTermListOrAddA ngram Nothing =
addNewNgramA ngram
...
...
@@ -141,14 +149,17 @@ layoutWithContextNgramsCpt = here.component "layoutWithContextNgrams" cpt where
let patch = setTermListOrAddA root mOldList termList
-- here.log2 "[setTermList] patch" patch
dispatch patch
T.write_ (applyNgramsPatches state' initTable) ngrams
-- T.write_ (applyNgramsPatches state' initTable) ngrams
case mOldList of
Nothing -> T.write_ (contextNgrams' <> [ root ]) contextNgramsS
Just _ -> pure unit
-- here.log2 "[setTermList] calling reload" reload'
T2.reload reload
--
T2.reload reload
hasAbstract = maybe false (not String.null) doc.abstract
annotate text = AnnotatedField.annotatedField
{ ngrams
{ ngrams
'
, setTermList
, text
, mode: mode'
...
...
@@ -228,7 +239,8 @@ layoutWithContextNgramsCpt = here.component "layoutWithContextNgrams" cpt where
autoUpdate
{ duration: 5000
, effect: dispatch $ Synchronize
{ afterSync: \_ -> pure unit
{ afterSync: \_ -> do
liftEffect $ here.log "[autoSync] synchronize war run"
}
}
-- @NOTE #386: revert manual for automatic sync
...
...
src/Gargantext/Components/GraphExplorer/Frame/DocFocus.purs
View file @
5d55ef09
...
...
@@ -44,8 +44,6 @@ docFocusCpt = here.component "main" cpt where
-- | States
-- |
state' /\ state <- R2.useBox' (Nothing :: Maybe LoadedData)
reload <- T.useBox T2.newReload
reload' <- T.useLive T.unequal reload
-- | Computed
-- |
...
...
@@ -92,7 +90,6 @@ docFocusCpt = here.component "main" cpt where
layout
{ loaded
, path
, reload
, session
, sideControlsSlot: Just $
H.div
...
...
src/Gargantext/Components/Nodes/Corpus/Document.purs
View file @
5d55ef09
...
...
@@ -42,8 +42,6 @@ nodeCpt = here.component "node" cpt where
session <- useSession
state' /\ state <- R2.useBox' (Nothing :: Maybe LoadedData)
reload <- T.useBox T2.newReload
reload' <- T.useLive T.unequal reload
-- | Computed
-- |
...
...
@@ -89,7 +87,6 @@ nodeCpt = here.component "node" cpt where
layout
{ loaded
, path
, reload
, session
}
}
src/Gargantext/Components/Nodes/Texts.purs
View file @
5d55ef09
...
...
@@ -556,9 +556,6 @@ sideTextCpt = here.component "sideText" cpt where
-- R.useEffect' $ do
-- here.log2 "[sideText] state'" state'
reload <- T.useBox T2.newReload
reload' <- T.useLive T.unequal reload
-- | Computed
-- |
let
...
...
@@ -585,11 +582,10 @@ sideTextCpt = here.component "sideText" cpt where
-- }
useLoader { errorHandler: logRESTError here "[sidePanelText]"
, loader: \{ path
, reload'
} -> loadData path
, path: { path
, reload'
}
, loader: \{ path
} -> loadData path
, path: { path }
, render: \loaded -> loadedSideText { loaded
, path
, reload
, session }
}
...
...
@@ -622,13 +618,12 @@ sideTextCpt = here.component "sideText" cpt where
type LoadedSideTextProps =
( loaded :: LoadedData
, path :: DocPath
, reload :: T2.ReloadS
, session :: Session )
loadedSideText :: R2.Leaf LoadedSideTextProps
loadedSideText = R2.leaf loadedSideTextCpt
loadedSideTextCpt :: R.Component LoadedSideTextProps
loadedSideTextCpt = here.component "loadedSideText" cpt where
cpt { loaded, path,
reload,
session } _ = do
cpt { loaded, path, session } _ = do
pure $ H.div { className: "graph-doc-focus" }
[ layout { loaded, path,
reload,
session } ]
[ layout { loaded, path, session } ]
src/Gargantext/Components/PhyloExplorer/Frame/DocFocus.purs
View file @
5d55ef09
...
...
@@ -45,9 +45,6 @@ docFocusCpt = here.component "main" cpt where
-- |
state' /\ state <- R2.useBox' (Nothing :: Maybe LoadedData)
reload <- T.useBox T2.newReload
reload' <- T.useLive T.unequal reload
-- | Computed
-- |
let
...
...
@@ -93,7 +90,6 @@ docFocusCpt = here.component "main" cpt where
layout
{ loaded
, path
, reload
, session
, sideControlsSlot: Just $
H.div
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment