Commit 6dc2cbfe authored by Alexandre Delanoë's avatar Alexandre Delanoë

Revert "[graph search] some work on ngrams group search"

This reverts commit 2438ea19.
parent 005aaa67
......@@ -124,36 +124,36 @@ nodeMainSpanCpt = here.component "nodeMainSpan" cpt
, nodeType
, session } []
, fileTypeView { dispatch, droppedFile, id, isDragOver, nodeType } []
, H.div {} (map (\t -> asyncProgressBar { asyncTask: t
, barType: Pie
, errors
, nodeId: id
, onFinish: onTaskFinish id t
, session } []
) currentTasks'
)
, if nodeType == GT.NodeUser
then GV.versionView { session } []
else H.div {} []
, if showBox then
Popover.popover { arrow: false
, open: false
, onClose: \_ -> pure unit
, onOpen: \_ -> pure unit
, ref: popoverRef } [
popOverIcon
, mNodePopupView props (onPopoverClose popoverRef)
]
else H.div {} []
, nodeActions { id
, nodeType
, refresh: const $ dispatch RefreshTree
, session
} []
]
, fileTypeView { dispatch, droppedFile, id, isDragOver, nodeType } []
, H.div {} (map (\t -> asyncProgressBar { asyncTask: t
, barType: Pie
, errors
, nodeId: id
, onFinish: onTaskFinish id t
, session } []
) currentTasks'
)
, if nodeType == GT.NodeUser
then GV.versionView { session } []
else H.div {} []
, if showBox then
Popover.popover { arrow: false
, open: false
, onClose: \_ -> pure unit
, onOpen: \_ -> pure unit
, ref: popoverRef } [
popOverIcon
, mNodePopupView props (onPopoverClose popoverRef)
]
else H.div {} []
, nodeActions { id
, nodeType
, refresh: const $ dispatch RefreshTree
, session
} []
]
where
onTaskFinish id' t _ = do
GAT.finish id' t tasks
......@@ -296,6 +296,7 @@ type NodeActionsProps = ( nodeType :: GT.NodeType | NodeActionsCommon )
nodeActions :: R2.Component NodeActionsProps
nodeActions = R.createElement nodeActionsCpt
nodeActionsCpt :: R.Component NodeActionsProps
nodeActionsCpt = here.component "nodeActions" cpt where
cpt props _ = pure (child props.nodeType) where
......
......@@ -209,9 +209,9 @@ controlsCpt = here.component "controls" cpt
-- -- zoom: 0 -100 - calculate ratio
-- , RH.li {} [ multiSelectEnabledButton multiSelectEnabled ] -- toggle multi node selection
-- -- save button
-- , RH.li {} [ nodeSearch { graph: graph
-- , multiSelectEnabled: multiSelectEnabled
-- , selectedNodeIds: selectedNodeIds } ]
-- , RH.li {} [ nodeSearchControl { graph: graph
-- , multiSelectEnabled: multiSelectEnabled
-- , selectedNodeIds: selectedNodeIds } ]
-- , RH.li {} [ mouseSelectorSizeButton sigmaRef localControls.mouseSelectorSize ]
-- , RH.li {} [ cameraButton { id: graphId
-- , hyperdataGraph: hyperdataGraph
......
module Gargantext.Components.GraphExplorer.Search
( Props, nodeSearch ) where
( Props, nodeSearchControl ) where
import Prelude
import Data.Sequence as Seq
import Data.Set as Set
import Data.Tuple.Nested ((/\))
import DOM.Simple.Console (log2)
import Effect (Effect)
import Reactix as R
import Reactix.DOM.HTML as H
......@@ -31,10 +33,11 @@ searchNodes :: String -> Seq.Seq (Record SigmaxT.Node) -> Seq.Seq (Record Sigmax
searchNodes "" _ = Seq.empty
searchNodes s nodes = Seq.filter (nodeMatchesSearch s) nodes
nodeSearch :: R2.Component Props
nodeSearch = R.createElement nodeSearchCpt
nodeSearchCpt :: R.Component Props
nodeSearchCpt = here.component "nodeSearch" cpt
nodeSearchControl :: R2.Component Props
nodeSearchControl = R.createElement sizeButtonCpt
sizeButtonCpt :: R.Component Props
sizeButtonCpt = here.component "nodeSearchControl" cpt
where
cpt { graph, multiSelectEnabled, selectedNodeIds } _ = do
search <- T.useBox ""
......@@ -67,8 +70,7 @@ triggerSearch graph search multiSelectEnabled selectedNodeIds = do
let graphNodes = SigmaxT.graphNodes graph
let matching = Set.fromFoldable $ (_.id) <$> searchNodes search graphNodes
here.log2 "[triggerSearch] search" search
here.log2 "[triggerSearch] graphNodes" graphNodes
log2 "[triggerSearch] search" search
T.modify_ (\nodes ->
Set.union matching $ if multiSelectEnabled then nodes else SigmaxT.emptyNodeIds) selectedNodeIds
......@@ -8,7 +8,7 @@ import Toestand as T
import Gargantext.Prelude hiding (max,min)
import Gargantext.Components.App.Data (Boxes)
import Gargantext.Components.GraphExplorer.Search (nodeSearch)
import Gargantext.Components.GraphExplorer.Search (nodeSearchControl)
import Gargantext.Components.GraphExplorer.Sidebar.Types as GEST
import Gargantext.Components.GraphExplorer.ToggleButton as Toggle
import Gargantext.Utils.Reactix as R2
......@@ -32,9 +32,9 @@ topBarCpt = here.component "topBar" cpt where
mGraph' <- T.useLive T.unequal mGraph
let search = case mGraph' of
Just graph -> nodeSearch { graph
, multiSelectEnabled
, selectedNodeIds } []
Just graph -> nodeSearchControl { graph
, multiSelectEnabled
, selectedNodeIds } []
Nothing -> RH.div {} []
pure $ RH.form { className: "d-flex" }
......
......@@ -5,6 +5,7 @@ import Data.Generic.Rep (class Generic)
import Data.Eq.Generic (genericEq)
import Data.Maybe (Maybe(..), fromJust)
import Data.Newtype (class Newtype)
import Data.Ord
import Data.Ord.Generic (genericCompare)
import Data.Symbol (SProxy(..))
import Partial.Unsafe (unsafePartial)
......@@ -17,13 +18,12 @@ type GraphId = Int
newtype Node = Node {
attributes :: Cluster
, children :: Array String
, id_ :: String
, label :: String
, size :: Int
, type_ :: String
, x :: Number
, y :: Number
, id_ :: String
, label :: String
, size :: Int
, type_ :: String
, x :: Number
, y :: Number
}
x_coordP = SProxy :: SProxy "x_coord"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment