[refactoring] remove unused imports, simplify components a bit

parent 20235ac5
......@@ -29,6 +29,26 @@ let
spago bundle-app --main Main --to dist/bundle.js
'';
build-suggestions = pkgs.writeShellScriptBin "build-suggestions" ''
#!/usr/bin/env bash
set -e
echo "Installing JS Dependencies"
yarn
rm -rf ./output
echo "Compiling"
#build-purs
#spago build
#echo "Bundling"
#pulp browserify --skip-compile -t dist/bundle.js --src-path output
#browserify
# 0.15
spago bundle-app --main Main --to dist/bundle.js --purs-args "--json-errors" | jq -r '.warnings | map(select(.errorCode | test("UnusedDctorExplicitImport|UnusedDctorImport|UnusedDeclaration|UnusedExplicitImport|UnusedImport|UnusedName|UnusedTypeVar"))) | map(select(.filename | test("^.spago") | not)) | map("[\(.filename)::\(.position.startLine)] \(.message)\n \(.suggestion)") | join("\n----------\n")'
'';
build-css = pkgs.writeShellScriptBin "build-css" ''
#!/usr/bin/env bash
......@@ -121,9 +141,12 @@ pkgs.mkShell {
browserify-zephyr
build-css
build-purs
build-suggestions
build-watch
build-zephyr
build
pkgs.ijq
pkgs.jq
minify-bundle
#pkgs.closurecompiler
pkgs.esbuild
......
......@@ -43,7 +43,6 @@ to generate this file without the comments in this block.
, "foreign-object"
, "form-urlencoded"
, "formatters"
, "formula"
, "functions"
, "graphql-client"
, "heterogeneous"
......
......@@ -19,8 +19,6 @@ import Gargantext.Prelude
import DOM.Simple.Event as DE
import Data.Array as A
import Data.List (List(..), (:))
import Data.Map (Map)
import Data.Map as Map
import Data.Maybe (Maybe(..), maybe)
import Data.String.Common (joinWith)
import Data.Tuple (Tuple(..), snd)
......@@ -28,8 +26,8 @@ import Data.Tuple.Nested ((/\))
import Effect (Effect)
import Gargantext.Components.Annotation.Menu (annotationMenu, AnnotationMenu)
import Gargantext.Components.Annotation.Types (MenuType(..), ModeType(..), termClass)
import Gargantext.Core.NgramsTable.Functions (Cache, computeCache, findNgramTermList, highlightNgrams, normNgram)
import Gargantext.Core.NgramsTable.Types (HighlightElement, NgramsRepoElement(..), NgramsTable(..), NgramsTerm(..), parentMap)
import Gargantext.Core.NgramsTable.Functions (Cache, findNgramTermList, highlightNgrams, normNgram)
import Gargantext.Core.NgramsTable.Types (HighlightElement, NgramsTable, NgramsTerm(..))
import Gargantext.Types (CTabNgramType(..), TermList)
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Selection as Sel
......
......@@ -10,20 +10,17 @@ module Gargantext.Components.App.Store
) where
import Gargantext.Prelude
import Data.Maybe (Maybe(..))
import Data.Set as Set
import Data.Map (Map)
import Data.Map as Map
import Data.Maybe (Maybe(..))
import Data.Set as Set
import Gargantext.AsyncTasks as GAT
import Gargantext.Components.Lang as Lang
import Gargantext.Components.Login.Types (TreeId)
import Gargantext.Components.Nodes.Lists.SidePanel as ListsSP
import Gargantext.Components.Nodes.Lists.Types as ListsT
import Gargantext.Components.Nodes.Texts.Types as TextsT
import Gargantext.Components.Themes as Themes
import Gargantext.Ends (Backend)
import Gargantext.Prelude
import Gargantext.Routes (AppRoute(Home), Tile)
import Gargantext.Sessions (Session, Sessions)
import Gargantext.Sessions as Sessions
......@@ -36,6 +33,7 @@ import Reactix as R
import Toestand as T
import Unsafe.Coerce (unsafeCoerce)
here :: R2.Here
here = R2.here "Gargantext.Components.App.Store"
......
......@@ -2,16 +2,16 @@ module Gargantext.Components.AutoUpdate where
import Data.Maybe (Maybe(..))
import Data.Traversable (traverse_)
import React as React
import Effect (Effect)
import Effect.Timer (IntervalId, setInterval, clearInterval)
import Gargantext.Prelude
import Gargantext.Utils.Reactix as R2
import React (ReactClass, ReactElement, Children)
import React as React
import React.DOM (div')
import Effect (Effect)
import Effect.Timer (IntervalId, TimeoutId, setInterval, clearInterval, setTimeout, clearTimeout)
import Reactix as R
import Reactix.DOM.HTML as H
import Gargantext.Prelude
import Gargantext.Utils.Reactix as R2
here :: R2.Here
here = R2.here "Gargantext.Components.AutoUpdate"
......
......@@ -3,14 +3,11 @@ module Gargantext.Components.Bootstrap.FormSelect
, formSelect'
) where
import Gargantext.Prelude
import Data.Foldable (elem, intercalate)
import Data.Map as Map
import Data.Maybe (Maybe(..))
import Data.Tuple (Tuple(..))
import Effect (Effect)
import Gargantext.Components.Bootstrap.Types (ComponentStatus(..), Sizing(..))
import Gargantext.Prelude
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Show as GUS
import Reactix as R
......
-- TODO: this module should be replaced by FacetsTable
module Gargantext.Components.Category where
import Gargantext.Prelude
import Data.Array as A
import Data.Enum (fromEnum)
import Data.Generic.Rep (class Generic)
import Data.Map as Map
import Data.Maybe (Maybe(..), fromMaybe)
import Data.Tuple.Nested ((/\))
import Effect.Aff (launchAff_)
import Effect.Class (liftEffect)
import Gargantext.Components.Bootstrap as B
......@@ -17,25 +14,25 @@ import Gargantext.Components.Category.Types (Category(..), Star(..), cat2score,
import Gargantext.Components.DocsTable.Types (DocumentsView(..), LocalCategories)
import Gargantext.Components.GraphQL.Context (NodeContext)
import Gargantext.Components.GraphQL.Endpoints (getNodeContext, updateNodeContextCategory)
import Gargantext.Config.REST (AffRESTError, RESTError(..))
import Gargantext.Config.REST (AffRESTError)
import Gargantext.Hooks.Loader (useLoader)
import Gargantext.Prelude
import Gargantext.Routes (SessionRoute(NodeAPI))
import Gargantext.Sessions (Session, put)
import Gargantext.Types (NodeID, NodeType(..))
import Gargantext.Utils ((?))
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Toestand as T2
import Reactix as R
import Reactix.DOM.HTML as H
import Simple.JSON as JSON
import Toestand as T
here :: R2.Here
here = R2.here "Gargantext.Components.Category"
type RatingProps =
( chartReload :: T2.ReloadS
, nodeId :: NodeID
( nodeId :: NodeID
, row :: DocumentsView
, score :: Category
, session :: Session
......@@ -46,8 +43,7 @@ rating :: R2.Component RatingProps
rating = R.createElement ratingCpt
ratingCpt :: R.Component RatingProps
ratingCpt = here.component "rating" cpt where
cpt { chartReload
, nodeId
cpt { nodeId
, row: DocumentsView r
, score
, session
......
module Gargantext.Components.Corpus.CodeSection where
import Gargantext.Prelude
import Data.Array as A
import Data.Either (Either(..))
import Data.Eq.Generic (genericEq)
......@@ -12,7 +10,7 @@ import Data.List as List
import Data.Maybe (Maybe(..), fromMaybe)
import Data.Show.Generic (genericShow)
import Effect (Effect)
import Effect.Aff (Aff, throwError)
import Effect.Aff (throwError)
import Effect.Exception (error)
import Gargantext.Components.Bootstrap as B
import Gargantext.Components.Bootstrap.Types (ComponentStatus(..), Variant(..))
......@@ -20,14 +18,14 @@ import Gargantext.Components.CodeEditor as CE
import Gargantext.Components.InputWithEnter (inputWithEnter)
import Gargantext.Components.Node (HyperdataList, NodePoly(..))
import Gargantext.Components.Nodes.Corpus.Types (CorpusData, Hyperdata)
import Gargantext.Components.Nodes.Types (FTField, FTFieldWithIndex, FTFieldsWithIndex(..), Field(..), FieldType(..), Hash, Index, defaultHaskell', defaultJSON', defaultMarkdown', defaultPython')
import Gargantext.Components.Nodes.Types (FTField, FTFieldsWithIndex(..), Field(..), FieldType(..), Index, defaultHaskell', defaultJSON', defaultMarkdown', defaultPython')
import Gargantext.Config.REST (AffRESTError, RESTError(..))
import Gargantext.Data.Array as GDA
import Gargantext.Prelude
import Gargantext.Routes (SessionRoute(Children, NodeAPI))
import Gargantext.Sessions (Session, get, put)
import Gargantext.Types (AffETableResult, NodeType(..), ID)
import Gargantext.Utils ((?))
-- import Gargantext.Utils.Crypto as Crypto
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Toestand as T2
import Reactix as R
......@@ -35,6 +33,7 @@ import Reactix.DOM.HTML as H
import Simple.JSON as JSON
import Toestand as T
here :: R2.Here
here = R2.here "Gargantext.Components.Corpus.CodeSection"
......
......@@ -26,13 +26,12 @@ import Effect.Timer (setTimeout)
import Gargantext.Components.App.Store as Store
import Gargantext.Components.Bootstrap as B
import Gargantext.Components.Bootstrap.Types (ComponentStatus(..), ModalSizing(..), Variant(..))
import Gargantext.Components.Category (rating, ratingSimple)
import Gargantext.Components.Category.Types (Category(..), Star(..), cat2score, markCategoryChecked)
import Gargantext.Components.Category (ratingSimple)
import Gargantext.Components.Category.Types (Category(..), cat2score, markCategoryChecked)
import Gargantext.Components.DocsTable.DocumentFormCreation as DFC
import Gargantext.Components.DocsTable.Types (DocumentsView(..), Hyperdata(..), LocalCategories, Query, Response(..), Year, sampleData, showSource)
import Gargantext.Components.GraphQL.Endpoints (updateNodeContextCategory)
import Gargantext.Components.Nodes.Lists.Types as NT
import Gargantext.Components.Nodes.Texts.Types as TextsT
import Gargantext.Components.Reload (textsReloadContext)
import Gargantext.Components.Table as TT
import Gargantext.Components.Table.Types as TT
......@@ -47,7 +46,7 @@ import Gargantext.Types (ListId, NodeID, NodeType(..), OrderBy(..), SidePanelSta
import Gargantext.Types as GT
import Gargantext.Utils (sortWith, (?))
import Gargantext.Utils.CacheAPI as GUC
import Gargantext.Utils.QueryString (joinQueryStrings, mQueryParam, mQueryParamS, mQueryParamS', queryParam, queryParamS)
import Gargantext.Utils.QueryString (joinQueryStrings, mQueryParamS, mQueryParamS', queryParam, queryParamS)
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Toestand as GUT
import Gargantext.Utils.Toestand as T2
......@@ -523,8 +522,7 @@ pagePaintRaw = R.createElement pagePaintRawCpt
pagePaintRawCpt :: R.Component PagePaintRawProps
pagePaintRawCpt = here.component "pagePaintRaw" cpt where
cpt { documents
, layout: { chartReload
, frontends
, layout: { frontends
, listId
, mCorpusId
, nodeId
......@@ -536,20 +534,15 @@ pagePaintRawCpt = here.component "pagePaintRaw" cpt where
mCurrentDocId <- T.useFocused
(maybe Nothing _.mCurrentDocId)
(\val -> maybe Nothing (\sp -> Just $ sp { mCurrentDocId = val })) sidePanelTexts
mCurrentDocId' <- T.useLive T.unequal mCurrentDocId
reload <- T.useBox GUT.newReload
localCategories' <- T.useLive T.unequal localCategories
let
selected = mCurrentDocId' == Just nodeId
pure $ TT.table
{ colNames
, container: TT.defaultContainer
, params
, rows: rows { reload
, chartReload
, frontends
, listId
, localCategories: localCategories'
......@@ -564,17 +557,14 @@ pagePaintRawCpt = here.component "pagePaintRaw" cpt where
where
colNames = TT.ColumnName <$> [ "Show", "Tag", "Date", "Title", "Source", "Score" ]
wrapColElts = const identity
rows { chartReload
, frontends
rows { frontends
, listId
, localCategories
, mCorpusId
, mCurrentDocId
, nodeId
, reload
, session } =
(\documentsView -> { row: tableRow { chartReload
, documentsView
(\documentsView -> { row: tableRow { documentsView
, frontends
, listId
, localCategories
......@@ -590,8 +580,7 @@ trashClassName _ true = "page-paint-row page-paint-row--active"
trashClassName _ false = ""
type TableRowProps =
( chartReload :: T2.ReloadS
, documentsView :: DocumentsView
( documentsView :: DocumentsView
, frontends :: Frontends
, listId :: Int
, localCategories :: LocalCategories
......@@ -604,8 +593,7 @@ tableRow :: R2.Component TableRowProps
tableRow = R.createElement tableRowCpt
tableRowCpt :: R.Component TableRowProps
tableRowCpt = here.component "tableRow" cpt where
cpt { chartReload
, documentsView: dv@(DocumentsView r@{ _id, category })
cpt { documentsView: DocumentsView r@{ _id, category }
, frontends
, listId
, localCategories
......@@ -708,13 +696,13 @@ docChooserCpt = here.component "docChooser" cpt
eyeClass = selected ? "eye" $ "eye-slash"
variant = selected ? Info $ Dark
onClick selected _ = do
onClick sel _ = do
-- here.log2 "[docChooser] onClick, listId" listId
-- here.log2 "[docChooser] onClick, corpusId" corpusId
-- here.log2 "[docChooser] onClick, nodeId" nodeId
-- R2.callTrigger triggerAnnotatedDocIdChange { corpusId, listId, nodeId }
-- T2.reload tableReload
if selected then do
if sel then do
T.write_ Nothing sidePanelTexts
T.write_ Closed sidePanelState
else do
......
module Gargantext.Components.DocsTable.Types where
import Gargantext.Prelude
import Data.Eq.Generic (genericEq)
import Data.Generic.Rep (class Generic)
import Data.Map (Map)
import Data.Maybe (Maybe(..), fromMaybe)
import Data.Tuple (Tuple(..))
import Gargantext.Components.Category.Types (Category(..), Star(..), decodeCategory)
import Gargantext.Components.Category.Types (Category(..), Star, decodeCategory)
import Gargantext.Prelude
import Simple.JSON as JSON
data Action
......
......@@ -5,15 +5,9 @@ module Gargantext.Components.Document.Layout
import Gargantext.Prelude
import Data.Array as A
import Data.Lens ((^.))
import Data.Map as Map
import Data.Maybe (Maybe(..), fromMaybe, isJust, maybe)
import Data.Ord (greaterThan)
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
......@@ -27,11 +21,9 @@ import Gargantext.Components.GraphQL.Endpoints (getContextNgrams)
import Gargantext.Components.NgramsTable.AutoSync (useAutoSync)
import Gargantext.Components.Node (NodePoly(..))
import Gargantext.Core.NgramsTable.Functions (addNewNgramA, applyNgramsPatches, coreDispatch, findNgramRoot, setTermListA, computeCache)
import Gargantext.Core.NgramsTable.Types (CoreAction(..), NgramsTable(..), NgramsTerm, State, Versioned(..), replace)
import Gargantext.Hooks.FirstEffect (useFirstEffect')
import Gargantext.Core.NgramsTable.Types (CoreAction(..), NgramsTerm, Versioned(..), replace)
import Gargantext.Hooks.Loader (useLoader)
import Gargantext.Sessions (Session)
import Gargantext.Utils ((?))
import Gargantext.Utils as U
import Gargantext.Utils.Reactix as R2
import Reactix as R
......@@ -66,8 +58,8 @@ layout :: forall r. R2.OptLeaf Options Props r
layout = R2.optLeaf layoutCpt options
layoutCpt :: R.Component Props
layoutCpt = R2.hereComponent here "layout" hCpt where
hCpt hp props@{ path: path@{ listIds
, nodeId }
hCpt hp props@{ path: { listIds
, nodeId }
, session } _ = do
case A.head listIds of
Nothing -> pure $ H.div {} [ H.text "No list supplied!" ]
......@@ -105,7 +97,7 @@ layoutWithContextNgramsCpt = here.component "layoutWithContextNgrams" cpt where
-- ngrams <- T.useBox initTable
-- ngrams' <- T.useLive T.unequal ngrams
state <- T.useBox $ initialState { loaded }
state'@{ ngramsLocalPatch } <- T.useLive T.unequal state
state' <- T.useLive T.unequal state
let ngrams' = applyNgramsPatches state' initTable
-- R.useEffect' $ do
......
......@@ -26,7 +26,7 @@ import Gargantext.Components.GraphQL.Endpoints as GQLE
import Gargantext.Components.Search (Contact(..), Document(..), HyperdataRowContact(..), HyperdataRowDocument(..), SearchQuery, SearchResult(..), SearchResultTypes(..))
import Gargantext.Components.Table as T
import Gargantext.Components.Table.Types as T
import Gargantext.Config.REST (RESTError(..), AffRESTError)
import Gargantext.Config.REST (AffRESTError)
import Gargantext.Ends (url, Frontends)
import Gargantext.Hooks.Loader (useLoader)
import Gargantext.Routes (SessionRoute(Search, NodeAPI))
......
......@@ -105,15 +105,13 @@ folderViewMainCpt = here.component "folderViewMainCpt" cpt where
, session: props.session
, style: FolderChild
, text: node.name
, disabled: false
}
makeParentFolder :: TreeNode -> Maybe TreeNode -> Record FolderViewProps -> Array R.Element
makeParentFolder root (Just parent) props =
[
folder
{ disabled: disabled parent
, linkId: parent.id
{ linkId: parent.id
, linkNodeType: parent.node_type
, nodeId: root.id
, nodeType: root.node_type
......@@ -124,16 +122,13 @@ folderViewMainCpt = here.component "folderViewMainCpt" cpt where
, text: "..."
}
]
where
disabled { node_type } = if node_type == GT.FolderShared then true else false
makeParentFolder _ Nothing _ = []
sortFolders :: TreeNode-> TreeNode -> Ordering
sortFolders a b = compare a.id b.id
type FolderProps =
( disabled :: Boolean
, linkNodeType :: GT.NodeType
( linkNodeType :: GT.NodeType
, linkId :: Int
, nodeType :: GT.NodeType
, nodeId :: Int
......@@ -148,8 +143,7 @@ folder :: R2.Leaf FolderProps
folder = R2.leaf folderCpt
folderCpt :: R.Component FolderProps
folderCpt = here.component "folderCpt" cpt where
cpt props@{ disabled
, linkId
cpt props@{ linkId
, linkNodeType
, nodeId
, nodeType
......@@ -332,8 +326,8 @@ performAction = performAction' where
performAction' (AddNode name nodeType) p = addNode' name nodeType p
performAction' (UploadFile nodeType fileType fileFormat lang mName contents selection) p =
uploadFile' nodeType fileType fileFormat lang mName contents p selection
performAction' (UploadArbitraryFile fileFormat mName blob selection) p =
uploadArbitraryFile' fileFormat mName blob p selection
performAction' (UploadArbitraryFile fileFormat mName blob) p =
uploadArbitraryFile' fileFormat mName blob p
performAction' DownloadNode _ = liftEffect $ here.log "[performAction] DownloadNode"
performAction' (MoveNode {params}) p = moveNode params p
performAction' (MergeNode {params}) p = mergeNode params p
......@@ -394,8 +388,8 @@ performAction = performAction' where
handleRESTError (R2.herePrefix here "[uploadFile']") errors eTask $ \task -> liftEffect $ do
GAT.insert id task tasks
uploadArbitraryFile' fileFormat mName blob { boxes: { errors, tasks }, nodeId: id, session } selection = do
eTask <- uploadArbitraryFile session id { blob, fileFormat, mName } selection
uploadArbitraryFile' fileFormat mName blob { boxes: { errors, tasks }, nodeId: id, session } = do
eTask <- uploadArbitraryFile session id { blob, fileFormat, mName }
handleRESTError (R2.herePrefix here "[uploadArbitraryFile']") errors eTask $ \task -> liftEffect $ do
GAT.insert id task tasks
......
......@@ -3,8 +3,6 @@ module Gargantext.Components.Forest
, Props
) where
import Gargantext.Prelude
import Data.Array as A
import Data.Map (empty)
import Data.Map as Map
......@@ -14,14 +12,14 @@ import Gargantext.Components.Bootstrap as B
import Gargantext.Components.Bootstrap.Types (ButtonVariant(..), Position(..), TooltipPosition(..), Variant(..))
import Gargantext.Components.Forest.Tree (treeLoader)
import Gargantext.Ends (Frontends)
import Gargantext.Hooks.LinkHandler (useLinkHandler)
import Gargantext.Routes (AppRoute(..))
import Gargantext.Prelude
import Gargantext.Sessions (Session(..), unSessions)
import Gargantext.Utils.Reactix as R2
import Reactix as R
import Reactix.DOM.HTML as H
import Toestand as T
here :: R2.Here
here = R2.here "Gargantext.Components.Forest"
......@@ -83,9 +81,6 @@ plusCpt = here.component "plus" cpt where
cpt { } _ = do
{ backend, pinnedTreeId, showLogin, showSearch } <- Store.use
-- Hooks
{ goToRoute } <- useLinkHandler
-- Behaviors
let
click _ = do
......
module Gargantext.Components.Forest.Breadcrumb (component) where
import Prelude
import Control.Monad.Trans.Class
import Data.String (Pattern(..), split)
import Data.Array as A
import Data.Int (fromString)
import Data.List (head)
import Data.Map (Map)
import Data.Map as Map
import Data.Maybe (Maybe(..), fromMaybe)
import Effect (Effect)
import Effect.Aff (Aff, launchAff_, throwError)
import Effect.Class (class MonadEffect, liftEffect)
import Effect.Exception (error)
import Gargantext.Prelude
import Gargantext.Context.Session as SessionContext
import Data.String (Pattern(..), split)
import Gargantext.Components.App.Store (Boxes)
import Gargantext.Components.Bootstrap as B
import Gargantext.Components.GraphQL.Endpoints (getBreadcrumb)
import Gargantext.Components.GraphQL.Tree (BreadcrumbInfo, TreeNode)
import Gargantext.Components.Login.Types (TreeId, UserId)
import Gargantext.Ends (Frontends, Backend(..))
import Gargantext.Hooks.Session (useSession)
import Gargantext.Config.REST (AffRESTError)
import Gargantext.Hooks.Loader (useLoader)
import Gargantext.Routes (AppRoute(Home), appPath, nodeTypeAppRoute)
import Gargantext.Sessions
import Gargantext.Sessions.Types
import Gargantext.Types (CorpusId, FrontendError, NodeID, NodeType, SessionId)
import Gargantext.Types (NodeType, SessionId)
import Gargantext.Types as GT
import Gargantext.Utils as GU
import Gargantext.Utils.Reactix as R2
import Prelude
import Reactix as R
import Reactix.DOM.HTML as H
import URI.Query as Query
import URI.Fragment as Fragment
import Effect (Effect)
import Effect.Console (log)
import Toestand as T
import Gargantext.Config.REST (AffRESTError)
import Gargantext.Utils.Toestand as T2
import Gargantext.Hooks.Loader (useLoader)
......@@ -61,7 +41,7 @@ component :: R2.Leaf PropsBoxes
component = R2.leaf componentCpt
componentCpt :: R.Component PropsBoxes
componentCpt = here.component "breadcrumb" cpt where
cpt props@{ boxes: { session } } _ = do
cpt { boxes: { session } } _ = do
-- | States
-- |
session' <- T.useLive T.unequal session
......@@ -82,12 +62,11 @@ componentCpt = here.component "breadcrumb" cpt where
case session' of
Nothing -> pure $ H.div {} []
Just (session') -> do
Just _session'' -> do
url <- R.unsafeHooksEffect GU.href
let nodeId = fromMaybe 0 $ fromString $ getLastUrlElement url
-- breadcrumbData <- R2.useLayoutEffect1' $ getBreadcrumb session' currentNodeId
let session'' = Just session'
pure $
-- breadcrumb layout
......@@ -108,7 +87,7 @@ componentCpt = here.component "breadcrumb" cpt where
]
,
breadcrumbView { nodeId: nodeId
, session: Just session'
, session: session'
}
]
-- ,
......@@ -167,11 +146,10 @@ breadcrumbView = R2.leaf breadcrumbViewCpt
breadcrumbViewCpt :: R.Component Props
breadcrumbViewCpt = R2.hereComponent here "breadcrumbViewCpt" hCpt where
hCpt hp { nodeId, session } _ = do
let session' = session
case session' of
case session of
Nothing -> pure $ H.div {} []
Just (session') -> do
Just session' -> do
useLoader { errorHandler: Nothing
, herePrefix: hp
, loader: loadBreadcrumbData
......@@ -180,7 +158,6 @@ breadcrumbViewCpt = R2.hereComponent here "breadcrumbViewCpt" hCpt where
-- , reload: reload'
}
, render: \items -> breadcrumbViewMain { items: items
, nodeId: nodeId
, session: session'
-- , reload: reload
} []
......@@ -188,19 +165,18 @@ breadcrumbViewCpt = R2.hereComponent here "breadcrumbViewCpt" hCpt where
type BreadcrumbViewProps =
( items :: BreadcrumbInfo
, nodeId :: Int
-- , reload :: T.Box T2.Reload
, session :: Session
-- , reload :: T.Box T2.Reload
)
breadcrumbViewMain :: R2.Component BreadcrumbViewProps
breadcrumbViewMain = R.createElement breadcrumbViewMainCpt
breadcrumbViewMainCpt :: R.Component BreadcrumbViewProps
breadcrumbViewMainCpt = here.component "breadcrumbViewMainCpt" cpt where
cpt props@{ items: { parents }, session } _ = do
cpt { items: { parents }, session } _ = do
-- session' <- T.useLive T.unequal session
let items = makeBreadcrumbElements parents props
let items = makeBreadcrumbElements parents session
-- case session of
-- Nothing -> pure $ H.div {} []
......@@ -210,28 +186,22 @@ breadcrumbViewMainCpt = here.component "breadcrumbViewMainCpt" cpt where
R.fragment items
makeBreadcrumbElements :: Array TreeNode -> Record BreadcrumbViewProps -> Array R.Element
makeBreadcrumbElements items' props = makeBreadcrumbElementsMap <$> items' where
makeBreadcrumbElements :: Array TreeNode -> Session -> Array R.Element
makeBreadcrumbElements items' session = makeBreadcrumbElementsMap <$> items' where
makeBreadcrumbElementsMap :: TreeNode -> R.Element
makeBreadcrumbElementsMap node = breadcrumbItem { nodeId: node.id
, linkId: node.id
, nodeType: node.node_type
makeBreadcrumbElementsMap node = breadcrumbItem { linkId: node.id
, linkNodeType: node.node_type
, parentId: props.nodeId
, nodeType: node.node_type
, session
, text: node.name
-- , reload: props.reload
, session: props.session
-- , style: FolderUp
, text: node.name
, disabled: false
}
type BreadcrumbItemProps =
( disabled :: Boolean
, linkNodeType :: NodeType
( linkNodeType :: NodeType
, linkId :: Int
, nodeType :: NodeType
, nodeId :: Int
, parentId :: Int
-- , reload :: T.Box T2.Reload
, session :: Session
-- , style :: FolderStyle
......@@ -242,17 +212,14 @@ breadcrumbItem :: R2.Leaf BreadcrumbItemProps
breadcrumbItem = R2.leaf breadcrumbItemCpt
breadcrumbItemCpt :: R.Component BreadcrumbItemProps
breadcrumbItemCpt = here.component "breadcrumbItemCpt" cpt where
cpt props@{ nodeId
, linkId
, nodeType
, linkNodeType
, parentId
-- , reload
, session
-- , style
, text
, disabled
} _ = do
cpt { linkId
, linkNodeType
, nodeType
, session
, text
-- , reload
-- , style
} _ = do
url <- R.unsafeHooksEffect GU.href
......@@ -281,7 +248,7 @@ breadcrumbItemCpt = here.component "breadcrumbItemCpt" cpt where
then
H.text $ getUserText url
else
H.text props.text
H.text text
, H.span { className: "text-small" }
[
......@@ -308,12 +275,12 @@ breadcrumbItemCpt = here.component "breadcrumbItemCpt" cpt where
}
]
,
H.text props.text
H.text text
]
]
createNodeUrl :: Int -> Int -> NodeType -> SessionId -> String
createNodeUrl lId rootId nType sId
createNodeUrl lId _rootId nType sId
-- | rootId == lId = appPath Home
| otherwise = appPath $ getFolderPath nType sId lId
......
......@@ -345,12 +345,12 @@ uploadFile' nodeType fileType fileFormat lang mName contents p@{ boxes: { errors
here.log2 "[uploadFile'] UploadFile, uploaded, task:" task
closeBox p
uploadArbitraryFile' fileFormat mName blob p@{ boxes: { errors, tasks }, session, tree: (NTree (LNode { id }) _) } selection = do
eTask <- uploadArbitraryFile session id { blob, fileFormat, mName } selection
uploadArbitraryFile' fileFormat mName blob { boxes: { errors, tasks }, session, tree: (NTree (LNode { id }) _) } = do
eTask <- uploadArbitraryFile session id { blob, fileFormat, mName }
handleRESTError (R2.herePrefix here "[uploadArbitraryFile']") errors eTask $ \task -> liftEffect $ do
GAT.insert id task tasks
uploadFrameCalc' lang p@{ boxes: { errors, tasks }, session, tree: (NTree (LNode { id }) _) } selection = do
uploadFrameCalc' lang { boxes: { errors, tasks }, session, tree: (NTree (LNode { id }) _) } selection = do
eTask <- uploadFrameCalc session id lang selection
handleRESTError (R2.herePrefix here "[uploadFrameCalc']") errors eTask $ \task -> liftEffect $ do
GAT.insert id task tasks
......@@ -394,8 +394,8 @@ performAction (AddNode name nodeType) p = addNode' name no
performAction (UploadFrameCalc lang selection) p = uploadFrameCalc' lang p selection
performAction (UploadFile nodeType fileType fileFormat lang mName contents selection) p =
uploadFile' nodeType fileType fileFormat lang mName contents p selection
performAction (UploadArbitraryFile fileFormat mName blob selection) p =
uploadArbitraryFile' fileFormat mName blob p selection
performAction (UploadArbitraryFile fileFormat mName blob) p =
uploadArbitraryFile' fileFormat mName blob p
performAction (MoveNode {params}) p = moveNode params p
performAction (MergeNode {params}) p = mergeNode params p
performAction (LinkNode { nodeType, params }) p = linkNode nodeType params p
......
......@@ -11,13 +11,11 @@ import Data.Foldable (intercalate)
import Data.Map as Map
import Data.Maybe (Maybe(..), maybe)
import Data.String.Regex as Regex
import Data.Tuple.Nested ((/\))
import Effect (Effect)
import Effect.Aff (Aff, launchAff)
import Effect.Class (liftEffect)
import Gargantext.AsyncTasks as GAT
import Gargantext.Components.App.Store as AppStore
import Gargantext.Components.App.Store (Boxes)
import Gargantext.Components.Bootstrap as B
import Gargantext.Components.Bootstrap.Types (ComponentStatus(..), Elevation(..), TooltipEffect(..), Variant(..))
import Gargantext.Components.Corpus.CodeSection (loadCorpusWithChild)
......@@ -32,13 +30,13 @@ import Gargantext.Components.Lang (Lang(EN))
import Gargantext.Components.Nodes.Corpus.Types (CorpusData)
import Gargantext.Context.Progress (asyncContext, asyncProgress)
import Gargantext.Ends (Frontends, url)
import Gargantext.Hooks.Loader (useLoader, useLoaderEffect)
import Gargantext.Hooks.Loader (useLoader)
import Gargantext.Hooks.Version (Version, useVersion)
import Gargantext.Routes as Routes
import Gargantext.Sessions (Session, sessionId)
import Gargantext.Types (Handed(..), ID, Name)
import Gargantext.Types as GT
import Gargantext.Utils (nbsp, textEllipsisBreak, (?))
import Gargantext.Utils (nbsp, (?))
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Toestand as T2
import React.SyntheticEvent as SE
......
......@@ -34,47 +34,46 @@ setTreeOut a _ = a
-----------------------------------------------------------------------
icon :: Action -> String
icon (AddNode _ _) = glyphiconNodeAction (Add [])
icon (DeleteNode _) = glyphiconNodeAction Delete
icon (RenameNode _) = glyphiconNodeAction Config
icon (UpdateNode _) = glyphiconNodeAction ReloadWithSettings
icon (ShareTeam _) = glyphiconNodeAction Share
icon (AddContact _) = glyphiconNodeAction Share
icon (SharePublic _ ) = glyphiconNodeAction (Publish { subTreeParams : SubTreeParams {showtypes:[], valitypes:[] }})
icon (DoSearch _) = glyphiconNodeAction SearchBox
icon (UploadFile _ _ _ _ _ _ _) = glyphiconNodeAction Upload
icon (UploadArbitraryFile _ _ _ _ ) = glyphiconNodeAction Upload
icon (UploadFrameCalc _ _) = glyphiconNodeAction Upload
icon RefreshTree = glyphiconNodeAction Refresh
icon CloseBox = glyphiconNodeAction CloseNodePopover
icon DownloadNode = glyphiconNodeAction Download
icon (MoveNode _ ) = glyphiconNodeAction (Move { subTreeParams : SubTreeParams {showtypes:[], valitypes:[] }})
icon (MergeNode _ ) = glyphiconNodeAction (Merge { subTreeParams : SubTreeParams {showtypes:[], valitypes:[] }})
icon (LinkNode _ ) = glyphiconNodeAction (Link { subTreeParams : SubTreeParams {showtypes:[], valitypes:[] }})
icon (DocumentsFromWriteNodes _) = glyphiconNodeAction (WriteNodesDocuments)
icon NoAction = "hand-o-right"
icon (AddNode _ _) = glyphiconNodeAction (Add [])
icon (DeleteNode _) = glyphiconNodeAction Delete
icon (RenameNode _) = glyphiconNodeAction Config
icon (UpdateNode _) = glyphiconNodeAction ReloadWithSettings
icon (ShareTeam _) = glyphiconNodeAction Share
icon (AddContact _) = glyphiconNodeAction Share
icon (SharePublic _ ) = glyphiconNodeAction (Publish { subTreeParams : SubTreeParams {showtypes:[], valitypes:[] }})
icon (DoSearch _) = glyphiconNodeAction SearchBox
icon (UploadFile _ _ _ _ _ _ _) = glyphiconNodeAction Upload
icon (UploadArbitraryFile _ _ _) = glyphiconNodeAction Upload
icon (UploadFrameCalc _ _) = glyphiconNodeAction Upload
icon RefreshTree = glyphiconNodeAction Refresh
icon CloseBox = glyphiconNodeAction CloseNodePopover
icon DownloadNode = glyphiconNodeAction Download
icon (MoveNode _ ) = glyphiconNodeAction (Move { subTreeParams : SubTreeParams {showtypes:[], valitypes:[] }})
icon (MergeNode _ ) = glyphiconNodeAction (Merge { subTreeParams : SubTreeParams {showtypes:[], valitypes:[] }})
icon (LinkNode _ ) = glyphiconNodeAction (Link { subTreeParams : SubTreeParams {showtypes:[], valitypes:[] }})
icon (DocumentsFromWriteNodes _) = glyphiconNodeAction (WriteNodesDocuments)
icon NoAction = "hand-o-right"
-- icon _ = "hand-o-right"
text :: Action -> String
text (AddNode _ _ ) = "Add!"
text (DeleteNode _ ) = "Delete!"
text (RenameNode _ ) = "Rename!"
text (UpdateNode _ ) = "Update!"
text (ShareTeam _ ) = "Share with team!"
text (AddContact _ ) = "Add contact!"
text (SharePublic _ ) = "Publish!"
text (DoSearch _ ) = "Launch search!"
text (UploadFile _ _ _ _ _ _ _) = "Upload File!"
text (UploadArbitraryFile _ _ _ _) = "Upload arbitrary file!"
text (UploadFrameCalc _ _) = "Upload frame calc"
text RefreshTree = "Refresh Tree!"
text CloseBox = "Close Box!"
text DownloadNode = "Download!"
text (MoveNode _ ) = "Move!"
text (MergeNode _ ) = "Merge!"
text (LinkNode _ ) = "Link!"
text (DocumentsFromWriteNodes _ ) = "Documents from Write Nodes!"
text NoAction = "No Action"
text (AddNode _ _ ) = "Add!"
text (DeleteNode _ ) = "Delete!"
text (RenameNode _ ) = "Rename!"
text (UpdateNode _ ) = "Update!"
text (ShareTeam _ ) = "Share with team!"
text (AddContact _ ) = "Add contact!"
text (SharePublic _ ) = "Publish!"
text (DoSearch _ ) = "Launch search!"
text (UploadFile _ _ _ _ _ _ _) = "Upload File!"
text (UploadArbitraryFile _ _ _) = "Upload arbitrary file!"
text (UploadFrameCalc _ _) = "Upload frame calc"
text RefreshTree = "Refresh Tree!"
text CloseBox = "Close Box!"
text DownloadNode = "Download!"
text (MoveNode _ ) = "Move!"
text (MergeNode _ ) = "Merge!"
text (LinkNode _ ) = "Link!"
text (DocumentsFromWriteNodes _ ) = "Documents from Write Nodes!"
text NoAction = "No Action"
-----------------------------------------------------------------------
module Gargantext.Components.Forest.Tree.Node.Action.Add where
import Gargantext.Prelude
import Data.Array (head, length)
import Data.Either (Either(..))
import Data.Either (Either)
import Data.Generic.Rep (class Generic)
import Data.Maybe (Maybe(..), fromMaybe, isJust)
import Data.Newtype (class Newtype)
import Data.String (Pattern(..), indexOf)
import Data.Tuple.Nested ((/\))
import Effect (Effect)
import Effect.Aff (Aff, launchAff_)
import Gargantext.Components.Forest.Tree.Node.Action.Types (Action(..))
......@@ -17,6 +14,7 @@ import Gargantext.Components.Forest.Tree.Node.Tools as Tools
import Gargantext.Components.InputWithEnter (inputWithEnterWithKey)
import Gargantext.Components.Lang (Lang(..), translate)
import Gargantext.Config.REST (RESTError, AffRESTError)
import Gargantext.Prelude
import Gargantext.Routes as GR
import Gargantext.Sessions (Session, post)
import Gargantext.Types (NodeType(..), charCodeIcon)
......@@ -31,6 +29,7 @@ import Web.HTML (window)
import Web.HTML.Navigator (userAgent)
import Web.HTML.Window (navigator)
here :: R2.Here
here = R2.here "Gargantext.Components.Forest.Tree.Node.Action.Add"
......
module Gargantext.Components.Forest.Tree.Node.Action.Contact where
import Prelude
import Data.Maybe (Maybe(..))
import Effect.Aff (Aff, launchAff_)
import Formula as F
import Gargantext.Components.Forest.Tree.Node.Action.Contact.Types (AddContactParams(..))
import Gargantext.Components.Forest.Tree.Node.Action.Types (Action(..))
import Gargantext.Components.Forest.Tree.Node.Tools as Tools
......@@ -15,10 +12,12 @@ import Gargantext.Sessions (Session, post)
import Gargantext.Types (ID)
import Gargantext.Types as GT
import Gargantext.Utils.Reactix as R2
import Prelude
import Reactix as R
import Reactix.DOM.HTML as H
import Toestand as T
here :: R2.Here
here = R2.here "Gargantext.Components.Forest.Tree.Node.Action.Contact"
......@@ -63,7 +62,7 @@ textInputBoxCpt = here.component "textInputBox" cpt where
firstName <- T.useBox firstname
lastName <- T.useBox lastname
let submitF unit = do
let submitF _unit = do
f <- T.read firstName
l <- T.read lastName
launchAff_ $
......
......@@ -2,7 +2,6 @@ module Gargantext.Components.Forest.Tree.Node.Action.Download where
import Data.Generic.Rep (class Generic)
import Data.Maybe (Maybe(..))
import Data.Show.Generic (genericShow)
import Data.String.Common (toLower)
import Gargantext.Components.Forest.Tree.Node.Action.Types (Action(DownloadNode))
import Gargantext.Components.Forest.Tree.Node.Tools as Tools
......@@ -17,6 +16,7 @@ import Reactix as R
import Reactix.DOM.HTML as H
import Toestand as T
here :: R2.Here
here = R2.here "Gargantext.Components.Forest.Tree.Node.Action.Download"
......@@ -90,14 +90,12 @@ actionDownloadNodeListCpt = here.component "actionDownloadNodeList" cpt where
[ R2.select { className: "form-control"
, defaultValue: show downloadFormat'
, on: { change: onChange downloadFormat } }
[ opt NL_CSV downloadFormat
, opt NL_JSON downloadFormat ]
[ opt NL_CSV
, opt NL_JSON ]
, H.div {} [ H.text $ info downloadFormat' ]
]
where
opt t downloadFormat = H.option { value: show t } [ H.text $ show t ]
where
onClick _ = T.write_ t downloadFormat
opt t = H.option { value: show t } [ H.text $ show t ]
onChange downloadFormat e = T.write_ (readNodeListDownloadFormat $ R.unsafeEventValue e) downloadFormat
href :: NodeListDownloadFormat -> String
href t = url session $ Routes.NodeAPI GT.NodeList (Just id) (toLower $ show t)
......@@ -134,14 +132,12 @@ actionDownloadNodeTextsCpt = here.component "actionDownloadNodeTexts" cpt where
[ R2.select { className: "form-control"
, defaultValue: show downloadFormat'
, on: { change: onChange downloadFormat } }
[ opt NT_CSV downloadFormat
, opt NT_JSON downloadFormat ]
[ opt NT_CSV
, opt NT_JSON ]
, H.div {} [ H.text $ info downloadFormat' ]
]
where
opt t downloadFormat = H.option { value: show t } [ H.text $ show t ]
where
onClick _ = T.write_ t downloadFormat
opt t = H.option { value: show t } [ H.text $ show t ]
onChange downloadFormat e = T.write_ (readNodeTextsDownloadFormat $ R.unsafeEventValue e) downloadFormat
href :: NodeTextsDownloadFormat -> String
href t = url session $ Routes.NodeAPI GT.NodeTexts (Just id) ("export/" <> urlNodeTextsDownloadFormat t)
......
module Gargantext.Components.Forest.Tree.Node.Action.ManageTeam where
import Gargantext.Prelude
import Data.Array (cons, filter, null, (:))
import Data.Array (filter, null, (:))
import Data.Either (Either(..))
import Data.Maybe (Maybe(..))
import Effect.Aff (runAff_)
import Effect.Class (liftEffect)
import Gargantext.Components.Forest.Tree.Node.Tools as Tools
import Gargantext.Components.GraphQL.Endpoints (deleteTeamMembership, getTeam)
import Gargantext.Components.GraphQL.Team (Team, TeamMember)
import Gargantext.Config.REST (AffRESTError, FrontendError(EC_403__user_not_authorized))
import Gargantext.Config.REST (AffRESTError)
import Gargantext.Hooks.Loader (useLoader)
import Gargantext.Prelude
import Gargantext.Sessions (Session)
import Gargantext.Types (ID, FrontendError(FRESTError), NodeType)
import Gargantext.Types (ID, NodeType)
import Gargantext.Utils.Reactix as R2
import Reactix as R
import Reactix.DOM.HTML as H
import Toestand as T
here :: R2.Here
here = R2.here "Gargantext.Components.Forest.Tree.Node.Action.ManageTeam"
......
module Gargantext.Components.Forest.Tree.Node.Action.Search where
import Gargantext.Prelude
import Data.Array as A
import Data.Maybe (Maybe(..))
import Effect (Effect)
import Effect.Aff (Aff, launchAff)
import Gargantext.Components.App.Store (Boxes)
import Gargantext.Components.App.Store as Store
import Gargantext.Components.Forest.Tree.Node.Action.Search.SearchBar (searchBar)
import Gargantext.Components.Forest.Tree.Node.Action.Search.SearchField (defaultSearch)
import Gargantext.Components.Forest.Tree.Node.Action.Types (Action(..))
import Gargantext.Components.Forest.Tree.Node.Action.Utils (loadLanguages)
import Gargantext.Components.Lang (allLangs, Lang)
import Gargantext.Config.REST (RESTError(..), AffRESTError)
import Gargantext.Components.Lang (Lang)
import Gargantext.Hooks.Loader (useLoader)
import Gargantext.Prelude
import Gargantext.Sessions (Session)
import Gargantext.Types (ID)
import Gargantext.Types as GT
......@@ -39,7 +35,6 @@ actionSearch = R.createElement actionSearchCpt
actionSearchCpt :: R.Component Props
actionSearchCpt = R2.hereComponent here "actionSearch" hCpt where
hCpt hp props@({ session }) _ = do
{ errors } <- Store.use
useLoader { errorHandler: Nothing
, herePrefix: hp
, loader: loadLanguages
......
......@@ -4,15 +4,12 @@ module Gargantext.Components.Forest.Tree.Node.Action.Search.SearchField
import Gargantext.Prelude
import Data.Array as A
import Data.Either (Either(..))
import Data.Maybe (Maybe(..), maybe, fromMaybe)
import Data.Newtype (over)
import Data.Nullable (null)
import Data.Set as Set
import Data.String.Common (joinWith, replaceAll)
import Data.String.Pattern (Pattern(..), Replacement(..))
import Data.String.Common (joinWith)
import Data.Tuple (Tuple(..))
import DOM.Simple.Console (log, log2)
import Effect (Effect)
import Effect.Aff (launchAff_)
import Effect.Class (liftEffect)
......@@ -94,28 +91,28 @@ componentYearsCpt = here.component "componentYears" cpt where
let yearsZ = A.zip (A.range 0 (A.length years)) years
newYear <- T.useBox ""
pure $ H.div {}
((yearCpt search <$> yearsZ) <>
((yearCpt <$> yearsZ) <>
[ H.div {}
[ H.input { on: { blur: modify newYear
, change: modify newYear
, input: modify newYear } }
, H.span { className: "btn btn-primary fa fa-check"
, on: { click: clickAdd newYear search }} []
, on: { click: clickAdd newYear }} []
]
])
where
clickAdd newYear search _ = do
clickAdd newYear _ = do
newYear' <- T.read newYear
T.modify_ (\s@{ years } -> s { years = A.snoc years newYear' }) search
clickRemove idx search _ =
clickRemove idx _ =
T.modify_ (\s@{ years } -> s { years = left idx years <> right (A.length years - idx) years }) search
where
left 0 years = []
left idx years = A.take idx years
right 0 years = []
left 0 _years = []
left idx' years = A.take idx' years
right 0 _years = []
right len years = A.takeEnd (len - 1) years
modify newYear e = T.write_ (R.unsafeEventValue e) newYear
yearCpt search (Tuple idx year) =
yearCpt (Tuple idx year) =
H.div {}
[ H.span {} [ H.text year ]
, H.span { className: "btn btn-danger fa fa-times"
......@@ -341,7 +338,6 @@ dataFieldNavCpt = here.component "dataFieldNav" cpt
type DatabaseInputProps = (
databases :: Array Database
, search :: T.Box Search
, session :: Session
)
databaseInput :: R2.Component DatabaseInputProps
......@@ -350,8 +346,7 @@ databaseInputCpt :: R.Component DatabaseInputProps
databaseInputCpt = here.component "databaseInput" cpt
where
cpt { databases
, search
, session } _ = do
, search } _ = do
search' <- T.useLive T.unequal search
let db = case search'.datafield of
......@@ -427,13 +422,13 @@ pubmedInputLoadedCpt = here.component "pubmedInputLoaded" cpt where
, change: modifyPubmedAPIKey search
, input: modifyPubmedAPIKey search } } ]
where
modifyPubmedAPIKey search e = do
modifyPubmedAPIKey searchS e = do
let val = R.unsafeEventValue e
let mVal = case val of
"" -> Nothing
s -> Just s
T.modify_ (\s ->
s { pubmedApiKey = mVal }) search
s { pubmedApiKey = mVal }) searchS
type EPOInputProps = (
......@@ -488,19 +483,19 @@ epoInputLoadedCpt = here.component "epoInputLoaded" cpt where
, change: modifyEPOAPIToken search
, input: modifyEPOAPIToken search } } ]
where
modifyEPOAPIUser search e = do
modifyEPOAPIUser searchS e = do
let val = R.unsafeEventValue e
let mVal = case val of
"" -> Nothing
s -> Just s
T.modify_ (\s -> s { epoApiUser = mVal }) search
T.modify_ (\s -> s { epoApiUser = mVal }) searchS
modifyEPOAPIToken search e = do
modifyEPOAPIToken searchS e = do
let val = R.unsafeEventValue e
let mVal = case val of
"" -> Nothing
s -> Just s
T.modify_ (\s -> s { epoApiToken = mVal }) search
T.modify_ (\s -> s { epoApiToken = mVal }) searchS
type OrgInputProps =
......@@ -557,14 +552,13 @@ datafieldInputCpt :: R.Component DatafieldInputProps
datafieldInputCpt = here.component "datafieldInput" cpt where
cpt { databases, langs, search, session } _ = do
search' <- T.useLive T.unequal search
datafield <- T.useFocused (_.datafield) (\a b -> b { datafield = a }) search
iframeRef <- R.useRef null
pure $ H.div {}
[ dataFieldNav { search } []
, if isExternal search'.datafield
then databaseInput { databases, search, session } []
then databaseInput { databases, search } []
else H.div {} []
, if isPubmed search'.datafield
......@@ -756,8 +750,7 @@ searchQuery selection { databases
, epoApiUser
, epoApiToken
, node_id
, term
, years } =
, term } =
over SearchQuery (_ { databases = databases
, datafield = datafield
, lang = lang
......@@ -772,8 +765,7 @@ searchQuery selection { databases
, lang
, pubmedApiKey
, node_id
, term
, years } =
, term } =
over SearchQuery (_ { databases = databases
, datafield = datafield
, lang = lang
......@@ -808,7 +800,7 @@ queryHAL term mIMTOrgs lang years =
_ -> "en"
-- TODO: Escape double quotes
--termEscaped = "\"" <> (replaceAll (Pattern "\"") (Replacement "\\\"") term) <> "\""
termEscaped = "\"" <> term <> "\""
-- termEscaped = "\"" <> term <> "\""
termMulti = "(" <> term <> ")"
structQuery = case mIMTOrgs of
Nothing -> ""
......
module Gargantext.Components.Forest.Tree.Node.Action.Share where
import Gargantext.Prelude
import Data.Array (filter, nub)
import Data.Generic.Rep (class Generic)
import Data.Either (Either(..))
import Data.Generic.Rep (class Generic)
import Data.Maybe (Maybe(..))
import Data.Show.Generic (genericShow)
import Data.String (Pattern(..), contains, trim)
import Data.String (Pattern(..), contains)
import Data.Tuple.Nested ((/\))
import Effect.Aff (Aff, launchAff_)
import Effect.Aff (launchAff_)
import Effect.Class (liftEffect)
import Gargantext.Components.Bootstrap as B
import Gargantext.Components.Bootstrap.Types (Elevation(Level1))
import Gargantext.Components.Forest.Tree.Node.Action.Types (Action)
import Gargantext.Components.Forest.Tree.Node.Action.Types as Action
import Gargantext.Components.Forest.Tree.Node.Tools as Tools
import Gargantext.Components.Forest.Tree.Node.Tools.SubTree (subTreeView, SubTreeParamsIn)
import Gargantext.Components.InputWithAutocomplete (inputWithAutocomplete)
import Gargantext.Config.REST (AffRESTError)
import Gargantext.Hooks.Loader (useLoader)
import Gargantext.Prelude
import Gargantext.Routes as GR
import Gargantext.Sessions (Session, get, post)
import Gargantext.Types (ID)
......@@ -31,6 +29,7 @@ import Reactix.DOM.HTML as H
import Simple.JSON as JSON
import Toestand as T
here :: R2.Here
here = R2.here "Gargantext.Components.Forest.Tree.Node.Action.Share"
......
......@@ -6,7 +6,7 @@ import Gargantext.Components.Forest.Tree.Node.Action.Contact.Types (AddContactPa
import Gargantext.Components.Forest.Tree.Node.Action.Update.Types (UpdateNodeParams)
import Gargantext.Components.Forest.Tree.Node.Action.Upload.Types (FileFormat, FileType, UploadFileBlob)
import Gargantext.Components.Forest.Tree.Node.Tools.SubTree.Types (SubTreeOut)
import Gargantext.Components.Lang (Lang(..))
import Gargantext.Components.Lang (Lang)
import Gargantext.Components.ListSelection.Types (Selection)
import Gargantext.Prelude
import Gargantext.Types as GT
......@@ -17,7 +17,7 @@ data Action = AddNode String GT.NodeType
| UpdateNode UpdateNodeParams
| DoSearch GT.AsyncTaskWithType
| UploadFile GT.NodeType FileType FileFormat Lang (Maybe String) String Selection
| UploadArbitraryFile FileFormat (Maybe String) UploadFileBlob Selection
| UploadArbitraryFile FileFormat (Maybe String) UploadFileBlob
| UploadFrameCalc Lang Selection
| DownloadNode
| RefreshTree
......@@ -44,7 +44,7 @@ instance Eq Action where
eq (DoSearch at1) (DoSearch at2) = eq at1 at2
eq (UploadFile nt1 ft1 ff1 l1 s1 _ _) (UploadFile nt2 ft2 ff2 l2 s2 _ _) =
(eq nt1 nt2) && (eq ft1 ft2) && (eq ff1 ff2) && (eq l1 l2) && (eq s1 s2)
eq (UploadArbitraryFile ff1 s1 _ _) (UploadArbitraryFile ff2 s2 _ _) = (eq ff1 ff2) && (eq s1 s2)
eq (UploadArbitraryFile ff1 s1 _) (UploadArbitraryFile ff2 s2 _) = (eq ff1 ff2) && (eq s1 s2)
eq (UploadFrameCalc l1 s1) (UploadFrameCalc l2 s2) = (eq l1 l2) && (eq s1 s2)
eq DownloadNode DownloadNode = true
eq RefreshTree RefreshTree = true
......@@ -69,7 +69,7 @@ instance Show Action where
show (SharePublic _ ) = "SharePublic"
show (DoSearch _ ) = "SearchQuery"
show (UploadFile _ _ _ _ _ _ _) = "UploadFile"
show (UploadArbitraryFile _ _ _ _) = "UploadArbitraryFile"
show (UploadArbitraryFile _ _ _) = "UploadArbitraryFile"
show (UploadFrameCalc _ _ ) = "UploadFrameCalc"
show RefreshTree = "RefreshTree"
show CloseBox = "CloseBox"
......
module Gargantext.Components.Forest.Tree.Node.Action.Upload where
import Gargantext.Prelude
import Affjax.RequestBody (blob)
import Data.Array as A
import Data.Either (Either, fromRight')
import Data.Eq.Generic (genericEq)
......@@ -28,8 +25,9 @@ import Gargantext.Components.Lang (Lang(..), langReader)
import Gargantext.Components.ListSelection as ListSelection
import Gargantext.Components.ListSelection.Types (Selection(..))
import Gargantext.Components.ListSelection.Types as ListSelection
import Gargantext.Config.REST (AffRESTError, RESTError(..))
import Gargantext.Config.REST (AffRESTError, RESTError)
import Gargantext.Hooks.Loader (useLoader)
import Gargantext.Prelude
import Gargantext.Routes as GR
import Gargantext.Sessions (Session, postWwwUrlencoded, post)
import Gargantext.Types (ID, NodeType(..))
......@@ -44,6 +42,7 @@ import Toestand as T
import URI.Extra.QueryPairs as QP
import Web.File.FileReader.Aff (readAsDataURL)
here :: R2.Here
here = R2.here "Gargantext.Components.Forest.Tree.Node.Action.Upload"
......@@ -68,7 +67,7 @@ actionUploadCpt = here.component "actionUpload" cpt where
cpt props@{ nodeType: Calc } _ = pure $ uploadFrameCalcView props []
cpt props@{ nodeType: Annuaire, dispatch, id, session } _ =
cpt { nodeType: Annuaire, dispatch, id, session } _ =
pure $ uploadListView { dispatch, id, nodeType: GT.Annuaire, session }
cpt props@{ nodeType: _ } _ = pure $ actionUploadOther props []
......@@ -124,7 +123,7 @@ uploadFileViewWithLangs = R2.leaf uploadFileViewWithLangsCpt
uploadFileViewWithLangsCpt :: R.Component PropsWithLangs
uploadFileViewWithLangsCpt = here.component "uploadFileViewWithLangs" cpt
where
cpt { dispatch, id, langs, nodeType, session } _ = do
cpt { dispatch, langs, nodeType, session } _ = do
-- mFile :: R.State (Maybe UploadFile) <- R.useState' Nothing
mFile <- T.useBox (Nothing :: Maybe UploadFile)
fileType <- T.useBox CSV
......@@ -274,14 +273,14 @@ uploadButtonCpt = here.component "uploadButton" cpt
where
onClick fileFormat' fileType' mFile' lang' selection' onPendingBox e = do
onClick fileFormat' fileType' mFile' lang' selection' onPendingBox _e = do
let { blob, name } = unsafePartial $ fromJust mFile'
T.write_ true onPendingBox
here.log2 "[uploadButton] fileType" fileType'
void $ launchAff do
case fileType' of
Arbitrary ->
dispatch $ UploadArbitraryFile fileFormat' (Just name) blob selection'
dispatch $ UploadArbitraryFile fileFormat' (Just name) blob
_ -> do
contents <- case fileFormat' of
Plain -> readUFBAsText blob
......@@ -604,9 +603,8 @@ uploadFile { contents, fileFormat, lang, fileType, id, nodeType, mName, selectio
uploadArbitraryFile :: Session
-> ID
-> {blob :: UploadFileBlob, fileFormat :: FileFormat, mName :: Maybe String}
-> ListSelection.Selection
-> AffRESTError GT.AsyncTaskWithType
uploadArbitraryFile session id { fileFormat, mName, blob: UploadFileBlob blob } selection = do
uploadArbitraryFile session id { fileFormat, mName, blob: UploadFileBlob blob } = do
contents <- readAsDataURL blob
uploadArbitraryData session id fileFormat mName contents
......
module Gargantext.Components.Forest.Tree.Node.Action.WriteNodesDocuments where
import Gargantext.Prelude
import Data.Array as A
import Data.Either (Either)
import Data.Maybe (Maybe(..), fromMaybe)
import Data.Maybe (Maybe(..))
import Data.Tuple.Nested ((/\))
import Effect.Aff (Aff)
import Gargantext.Components.App.Store as Store
import Gargantext.Components.Bootstrap as B
import Gargantext.Components.Forest.Tree.Node.Action.Types (Action(..))
import Gargantext.Components.Forest.Tree.Node.Action.Utils (loadLanguages)
......@@ -15,8 +11,9 @@ import Gargantext.Components.Forest.Tree.Node.Tools as Tools
import Gargantext.Components.Lang (Lang(..))
import Gargantext.Components.ListSelection as ListSelection
import Gargantext.Components.ListSelection.Types as ListSelection
import Gargantext.Config.REST (AffRESTError, RESTError(..))
import Gargantext.Config.REST (AffRESTError, RESTError)
import Gargantext.Hooks.Loader (useLoader)
import Gargantext.Prelude
import Gargantext.Routes (SessionRoute(..))
import Gargantext.Sessions (Session, post)
import Gargantext.Types as GT
......@@ -41,7 +38,6 @@ actionWriteNodesDocuments = R.createElement actionWriteNodesDocumentsCpt
actionWriteNodesDocumentsCpt :: R.Component ActionWriteNodesDocuments
actionWriteNodesDocumentsCpt = R2.hereComponent here "actionWriteNodesDocuments" hCpt where
hCpt hp props@({ session }) _ = do
{ errors } <- Store.use
useLoader { errorHandler: Nothing
, herePrefix: hp
, loader: loadLanguages
......
......@@ -350,7 +350,7 @@ panelActionCpt = here.component "panelAction" cpt
pure $ actionManageTeam { id, nodeType, session } []
cpt { action: Merge {subTreeParams}, dispatch, id, nodeType, session } _ =
pure $ mergeNode { dispatch, id, nodeType, session, subTreeParams } []
cpt { action: Move {subTreeParams}, boxes, dispatch, id, nodeType, session } _ =
cpt { action: Move {subTreeParams}, dispatch, id, nodeType, session } _ =
pure $ moveNode { dispatch, id, nodeType, session, subTreeParams } []
cpt { action : Publish {subTreeParams}, dispatch, id, nodeType, session } _ =
pure $ Share.publishNode { dispatch, id, nodeType, session, subTreeParams } []
......
......@@ -2,11 +2,9 @@ module Gargantext.Components.Forest.Tree.Node.Settings where
import Data.Default (class Default, def)
import Data.Lens (Lens', lens, (.~))
import Data.Lens.Record (prop)
import Gargantext.Prelude (class Eq, class Show, show, (&&), (<>), (==), ($), (<<<))
import Gargantext.Components.Forest.Tree.Node.Tools.SubTree.Types (SubTreeParams(..))
import Gargantext.Types
import Type.Proxy (Proxy(..))
------------------------------------------------------------------------
------------------------------------------------------------------------
......
module Gargantext.Components.Forest.Tree.Node.Tools.ProgressBar where
import Gargantext.Prelude
import Data.Int (floor)
import Data.Maybe (Maybe(..))
import Effect (Effect)
......@@ -11,9 +9,9 @@ import Effect.Timer (clearInterval, setInterval)
import Gargantext.Components.App.Store as AppStore
import Gargantext.Config.REST (AffRESTError)
import Gargantext.Config.Utils (handleErrorInAsyncProgress, handleRESTError)
import Gargantext.Prelude
import Gargantext.Routes (SessionRoute(..))
import Gargantext.Sessions (Session, get)
import Gargantext.Types (FrontendError)
import Gargantext.Types as GT
import Gargantext.Utils.Reactix as R2
import Reactix as R
......@@ -21,6 +19,7 @@ import Reactix.DOM.HTML as H
import Record.Extra as RX
import Toestand as T
here :: R2.Here
here = R2.here "Gargantext.Components.Forest.Tree.Node.Tools.ProgressBar"
......@@ -88,7 +87,7 @@ progressIndicator p = R.createElement progressIndicatorCpt p []
progressIndicatorCpt :: R.Component ProgressIndicatorProps
progressIndicatorCpt = here.component "progressIndicator" cpt
where
cpt { barType, label, progress } _ = do
cpt { barType, progress } _ = do
progress' <- T.useLive T.unequal progress
let progressInt = floor progress'
......
module Gargantext.Components.Forest.Tree.Node.Tools.SubTree where
import Gargantext.Prelude
import Data.Array (length)
import Data.Array as A
import Data.Foldable (intercalate)
import Data.Maybe (Maybe(..))
import Data.Tuple.Nested ((/\))
import Gargantext.Components.App.Store as Store
import Gargantext.Components.Forest.Tree.Node.Action (Props, subTreeOut, setTreeOut)
import Gargantext.Components.Forest.Tree.Node.Action.Types (Action)
import Gargantext.Components.Forest.Tree.Node.Tools.FTree (FTree, LNode(..), NTree(..))
import Gargantext.Components.Forest.Tree.Node.Tools.SubTree.Types (SubTreeParams(..), SubTreeOut(..))
import Gargantext.Config.REST (AffRESTError)
import Gargantext.Hooks.Loader (useLoader)
import Gargantext.Prelude
import Gargantext.Routes as GR
import Gargantext.Sessions (Session(..), get)
import Gargantext.Types as GT
import Gargantext.Utils (textEllipsisBreak, (?))
import Gargantext.Utils ((?))
import Gargantext.Utils.Reactix as R2
import Reactix as R
import Reactix.DOM.HTML as H
import Record as Record
import Toestand as T
here :: R2.Here
here = R2.here "Gargantext.Components.Forest.Tree.Node.Tools.SubTree"
......
......@@ -2,21 +2,15 @@ module Gargantext.Components.Frame.Layout
( layout
) where
import Gargantext.Prelude
import DOM.Simple (document, querySelector)
import DOM.Simple as DOM
import Data.Maybe (Maybe(..), maybe)
import Data.Nullable (Nullable, null, toMaybe)
import Gargantext.Components.Bootstrap as B
import Gargantext.Components.Bootstrap.Types (Variant(..))
import Gargantext.Components.FolderView as FV
import Gargantext.Components.Frame.Types (Base, Hyperdata(..), FrameId)
import Gargantext.Components.Node (NodePoly(..))
import Gargantext.Prelude
import Gargantext.Types (NodeType(..))
import Gargantext.Utils.JitsiMeet as JM
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Toestand as T2
import Reactix as R
import Reactix.DOM.HTML as H
import Web.URL as WURL
......@@ -26,20 +20,15 @@ here = R2.here "Gargantext.Components.Frame.Layout"
type Props =
( frame :: NodePoly Hyperdata
, reload :: T2.ReloadS
, nodeId :: Int
, nodeType :: NodeType
)
layout :: R2.Leaf Props
layout = R2.leaf layoutCpt
layoutCpt :: R.Component Props
layoutCpt = here.component "main" cpt where
cpt { frame: NodePoly { hyperdata: h@(Hyperdata { base, frame_id }) }
, nodeId
cpt { frame: NodePoly { hyperdata: Hyperdata { base, frame_id } }
, nodeType
, reload
} _ = case nodeType of
-- Visio Node
......@@ -57,7 +46,7 @@ layoutCpt = here.component "main" cpt where
H.text $ "Wrong base url: " <> base
]
Just url ->
Just _url ->
-- pure $ nodeFrameVisio' { frame_id, reload, url }
pure $
......@@ -112,35 +101,34 @@ layoutCpt = here.component "main" cpt where
--------------------------------------------------------------
type NodeFrameVisioProps =
( frame_id :: String
, reload :: T2.ReloadS
, url :: WURL.URL
)
nodeFrameVisio :: R2.Leaf NodeFrameVisioProps
nodeFrameVisio = R2.leaf nodeFrameVisioCpt
nodeFrameVisioCpt :: R.Component NodeFrameVisioProps
nodeFrameVisioCpt = here.component "nodeFrameVisio" cpt where
cpt { frame_id
, url
} _ = do
ref <- R.useRef (null :: Nullable DOM.Element)
R.useEffect' $ do
here.log2 "[nodeFrameVisio] ref" $ R.readRef ref
here.log2 "[nodeFrameVisio] JM.api" JM._api
case toMaybe (R.readRef ref) of
Nothing -> pure unit
Just r -> do
api <- JM.jitsiMeetAPI (WURL.host url) { parentNode: r
, roomName: frame_id
, width: "100%"
, height: "100%" }
here.log2 "[nodeFrameVisio] api" api
pure $ H.div { ref, className: "jitsi-iframe" } [ ]
-- type NodeFrameVisioProps =
-- ( frame_id :: String
-- , reload :: T2.ReloadS
-- , url :: WURL.URL
-- )
-- nodeFrameVisio :: R2.Leaf NodeFrameVisioProps
-- nodeFrameVisio = R2.leaf nodeFrameVisioCpt
-- nodeFrameVisioCpt :: R.Component NodeFrameVisioProps
-- nodeFrameVisioCpt = here.component "nodeFrameVisio" cpt where
-- cpt { frame_id
-- , url
-- } _ = do
-- ref <- R.useRef (null :: Nullable DOM.Element)
-- R.useEffect' $ do
-- here.log2 "[nodeFrameVisio] ref" $ R.readRef ref
-- here.log2 "[nodeFrameVisio] JM.api" JM._api
-- case toMaybe (R.readRef ref) of
-- Nothing -> pure unit
-- Just r -> do
-- api <- JM.jitsiMeetAPI (WURL.host url) { parentNode: r
-- , roomName: frame_id
-- , width: "100%"
-- , height: "100%" }
-- here.log2 "[nodeFrameVisio] api" api
-- pure $ H.div { ref, className: "jitsi-iframe" } [ ]
--------------------------------------------------------------
......
......@@ -18,10 +18,8 @@ import Gargantext.Hooks.Loader (useLoaderEffect)
import Gargantext.Sessions (Session)
import Gargantext.Types (CTabNgramType(..), TabSubType(..), TabType(..))
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Toestand as T2
import Reactix as R
import Reactix.DOM.HTML as H
import Toestand as T
here :: R2.Here
......
module Gargantext.Components.GraphExplorer.GraphTypes where
import Gargantext.Prelude
import Data.Eq.Generic (genericEq)
import Data.Generic.Rep (class Generic)
import Data.Maybe (Maybe(..), fromJust)
import Data.Maybe (Maybe)
import Data.Newtype (class Newtype)
import Data.Ord.Generic (genericCompare)
import Data.Show.Generic (genericShow)
import Partial.Unsafe (unsafePartial)
import Gargantext.Prelude
import Record as Record
import Simple.JSON as JSON
import Type.Proxy (Proxy(..))
......
......@@ -234,17 +234,6 @@ graphViewCpt = R.memo' $ here.component "graphView" cpt where
, noverlapRef
, sigmaRef
} _ = do
-- | States
-- |
{ edgeConfluence
, edgeWeight
, graph
, nodeSize
, removedNodeIds
, selectedNodeIds
, showEdges
, transformedGraph
} <- GraphStore.use
-- edgeConfluence' <- R2.useLive' edgeConfluence
-- edgeWeight' <- R2.useLive' edgeWeight
......
......@@ -5,37 +5,30 @@ module Gargantext.Components.GraphExplorer.Resources
)
where
import Gargantext.Prelude
import DOM.Simple.Types (Element)
import Data.Either (Either(..))
import Data.Maybe (Maybe(..))
import Data.Nullable (Nullable)
import Data.Sequence as Seq
import Data.Set as Set
import Data.Traversable (traverse_)
import Data.Tuple (Tuple(..), fst, snd)
import DOM.Simple (window)
import DOM.Simple.Types (Element)
import Data.Tuple (Tuple(..))
import Effect.Class.Console as ECC
import Effect.Timer (setTimeout)
import Gargantext.Components.App.Store as AppStore
import Gargantext.Components.GraphExplorer.Store as GraphStore
import Gargantext.Components.GraphExplorer.Types as GET
import Gargantext.Components.Themes (darksterTheme)
import Gargantext.Components.Themes as Themes
import Gargantext.Hooks.Sigmax as Sigmax
import Gargantext.Hooks.Sigmax.Camera as Camera
import Gargantext.Hooks.Sigmax.Graphology as Graphology
import Gargantext.Hooks.Sigmax.ForceAtlas2 as ForceAtlas2
import Gargantext.Hooks.Sigmax.Noverlap as Noverlap
import Gargantext.Hooks.Sigmax.Sigma as Sigma
import Gargantext.Hooks.Sigmax.Types as SigmaxTypes
import Gargantext.Prelude
import Gargantext.Utils (getter)
import Gargantext.Utils.Reactix as R2
import Reactix as R
import Record (merge)
import Toestand as T
here :: R2.Here
here = R2.here "Gargantext.Components.GraphExplorer.Resources"
......@@ -72,7 +65,6 @@ drawGraphCpt = here.component "drawGraph" cpt where
, hyperdataGraph
, mouseSelectorSize
, multiSelectEnabled
, nodeSize
, selectedNodeIds
, showEdges
, startForceAtlas
......@@ -83,7 +75,6 @@ drawGraphCpt = here.component "drawGraph" cpt where
edgeWeight' <- R2.useLive' edgeWeight
forceAtlasState' <- R2.useLive' forceAtlasState
graphStage' <- R2.useLive' graphStage
nodeSize' <- R2.useLive' nodeSize
showEdges' <- R2.useLive' showEdges
startForceAtlas' <- R2.useLive' startForceAtlas
transformedGraph' <- R2.useLive' transformedGraph
......@@ -207,16 +198,11 @@ drawGraphCpt = here.component "drawGraph" cpt where
-- etc) // drawback: don't forget to modify the effect white-list
R.useEffect' $ do
let updateGraph = do
let tEdgesMap = SigmaxTypes.edgesGraphMap transformedGraph'
let tNodesMap = SigmaxTypes.nodesGraphMap transformedGraph'
let updateSigma _ = do
Sigmax.dependOnSigma (R.readRef sigmaRef) "[drawGraph (Ready)] no sigma" $ \sigma -> do
Sigmax.performDiff sigma transformedGraph'
-- Sigmax.updateEdges sigma tEdgesMap
-- Sigmax.updateNodes sigma tNodesMap
let edgesState = not $ SigmaxTypes.edgeStateHidden showEdges'
-- here.log2 "[graphCpt] edgesState" edgesState
Sigmax.setSigmaEdgesVisibility sigma { edgeConfluence: edgeConfluence'
, edgeWeight: edgeWeight'
, showEdges: showEdges' }
......@@ -345,7 +331,7 @@ type SigmaSettings =
-- not selected <=> (1-greyness)
-- selected nodes <=> special label
sigmaSettings :: Themes.Theme -> {|SigmaSettings}
sigmaSettings theme =
sigmaSettings _theme =
{ -- animationsTime : 30000.0
-- , autoRescale : true
--, autoResize : true
......
......@@ -4,7 +4,7 @@ module Gargantext.Components.GraphExplorer.Sidebar.DocList
import Gargantext.Prelude
import Data.Array (catMaybes, concat, head)
import Data.Array (catMaybes, head)
import Data.Array as A
import Data.Foldable (intercalate)
import Data.Map as Map
......@@ -15,12 +15,10 @@ import Data.Tuple.Nested ((/\))
import Effect (Effect)
import Gargantext.Components.Bootstrap as B
import Gargantext.Components.Bootstrap.Types (Variant(..))
import Gargantext.Components.FacetsTable (DocumentsView(..), Rows(..), initialPagePath, initialPageGQL, loadPage, loadPageGQL, publicationDate)
import Gargantext.Components.FacetsTable (DocumentsView(..), Rows(..), initialPageGQL, loadPageGQL, publicationDate)
import Gargantext.Components.GraphExplorer.Store as GraphStore
import Gargantext.Components.GraphExplorer.Types (CorpusId, DocId, GraphSideDoc(..), ListId)
import Gargantext.Components.GraphExplorer.Types as GET
import Gargantext.Components.RandomText (words)
import Gargantext.Components.Search (SearchQuery(..), SearchType(..))
import Gargantext.Config (defaultFrontends)
import Gargantext.Config.REST (RESTError(..))
import Gargantext.Ends (Frontends, url)
......
......@@ -7,13 +7,11 @@ module Gargantext.Components.GraphExplorer.Store
, use
) where
import Gargantext.Prelude
import Data.Maybe (Maybe(..))
import Data.Set as Set
import Gargantext.Components.GraphExplorer.Types as GET
import Gargantext.Hooks.Sigmax.ForceAtlas2 as ForceAtlas
import Gargantext.Hooks.Sigmax.Types as SigmaxT
import Gargantext.Prelude
import Gargantext.Types as GT
import Gargantext.Utils (getter)
import Gargantext.Utils.Range as Range
......@@ -23,6 +21,7 @@ import Reactix as R
import Toestand as T
import Unsafe.Coerce (unsafeCoerce)
here :: R2.Here
here = R2.here "Gargantext.Components.GraphExplorer.Store"
......
......@@ -9,7 +9,6 @@ import Data.Maybe (Maybe(..))
import Data.Set as Set
import Effect.Timer (setTimeout)
import Gargantext.Components.Bootstrap as B
import Gargantext.Components.GraphExplorer.Resources as Graph
import Gargantext.Components.GraphExplorer.Store as GraphStore
import Gargantext.Components.GraphExplorer.Toolbar.Buttons (cameraButton, centerButton, edgesToggleButton, louvainButton, pauseForceAtlasButton, pauseNoverlapButton, multiSelectEnabledButton)
import Gargantext.Components.GraphExplorer.Toolbar.RangeControl (edgeConfluenceControl, nodeSizeControl)
......@@ -101,7 +100,7 @@ controlsCpt = R.memo' $ here.component "controls" cpt where
_ -> pure unit
-- Handle case when FA is paused from outside events, eg. the automatic timer.
R.useEffect' $ Sigmax.handleForceAtlas2Pause fa2Ref forceAtlasState mFAPauseRef Graph.forceAtlas2Settings
R.useEffect' $ Sigmax.handleForceAtlas2Pause fa2Ref forceAtlasState mFAPauseRef
R.useEffect' do
-- here.log2 "[controls] noverlapState'" noverlapState'
......
module Gargantext.Components.GraphExplorer.Types where
import Gargantext.Prelude
import Data.Array ((!!), length)
import Data.Eq.Generic (genericEq)
import Data.Generic.Rep (class Generic)
......@@ -9,12 +7,13 @@ import Data.Maybe (Maybe(..), fromJust)
import Data.Newtype (class Newtype)
import Data.Ord.Generic (genericCompare)
import Data.Show.Generic (genericShow)
import Gargantext.Components.GraphExplorer.GraphTypes
import Gargantext.Hooks.Sigmax.Camera (Camera)
import Gargantext.Prelude
import Partial.Unsafe (unsafePartial)
import Record as Record
import Simple.JSON as JSON
import Gargantext.Components.GraphExplorer.GraphTypes
import Gargantext.Hooks.Sigmax.Camera (Camera(..))
import Type.Proxy (Proxy(..))
type GraphId = Int
......
......@@ -6,23 +6,20 @@ module Gargantext.Components.GraphExplorer.Utils
, takeGreatestNodeByCluster, countNodeByCluster
) where
import Gargantext.Prelude
import Data.Array as A
import Data.Foldable (maximum, minimum)
import Data.Lens (Lens', lens, over, traversed, (^.))
import Data.Int (floor, toNumber)
import Data.Maybe (Maybe(..), fromMaybe, maybe)
import Data.Newtype (wrap)
import Data.Number as DN
import Data.Sequence as Seq
import Data.Traversable (class Traversable)
import Gargantext.Components.GraphExplorer.GraphTypes as GEGT
import Gargantext.Components.GraphExplorer.Types as GET
import Gargantext.Hooks.Sigmax.Types as ST
import Gargantext.Prelude
import Gargantext.Utils (getter)
import Gargantext.Utils.Lens as GUL
import Gargantext.Utils.Seq as GUS
stEdgeToGET :: Record ST.Edge -> GEGT.Edge
stEdgeToGET { _original: GEGT.Edge original, hidden } = GEGT.Edge $ original { hidden = Just hidden }
......
module Gargantext.Components.GraphQL where
import Gargantext.Prelude
import Affjax.RequestHeader as ARH
import Control.Monad.Error.Class as Errors
import Data.Argonaut.Core as AC
import Data.Argonaut.Decode (JsonDecodeError)
import Data.Array as A
import Data.Bifunctor (lmap)
import Data.Either (Either(..))
import Data.List.Types (NonEmptyList)
import Data.Maybe (Maybe(..))
import Effect (Effect)
import Effect.Aff (Aff, throwError, error)
import Effect.Class (liftEffect)
import FFI.Simple ((.?))
import Foreign as Foreign
......@@ -21,21 +15,20 @@ import Gargantext.Components.GraphQL.Context as GQLCTX
import Gargantext.Components.GraphQL.IMT as GQLIMT
import Gargantext.Components.GraphQL.NLP as GQLNLP
import Gargantext.Components.GraphQL.Node as GQLNode
import Gargantext.Components.GraphQL.Team (Team, TeamDeleteM)
import Gargantext.Components.GraphQL.Tree (TreeFirstLevel, BreadcrumbInfo)
import Gargantext.Components.GraphQL.User (User, UserInfo, UserInfoM, UserPubmedAPIKeyM, UserEPOAPIUserM, UserEPOAPITokenM)
import Gargantext.Components.GraphQL.Team (Team, TeamDeleteM)
-- import Gargantext.Config.REST (AffRESTError, FrontendError, RESTError(..))
import Gargantext.Config.REST as REST
import Gargantext.Ends (Backend(..))
import Gargantext.Prelude
import Gargantext.Sessions (Session(..))
import Gargantext.Utils.Reactix as R2
import GraphQL.Client.Args (type (==>))
import GraphQL.Client.BaseClients.Urql (UrqlClient, createClient)
-- import GraphQL.Client.Operation (OpMutation)
import GraphQL.Client.Query (queryFullRes, queryWithDecoder, decodeGqlRes, getFullRes, queryFullRes) --, mutationJson)
import GraphQL.Client.Query (decodeGqlRes) --, mutationJson)
import GraphQL.Client.SafeQueryName (safeQueryName)
import GraphQL.Client.ToGqlString (toGqlQueryString)
import GraphQL.Client.Types (class GqlQuery, GqlRes, Client(..), class QueryClient, clientQuery, defQueryOpts, clientMutation, defMutationOpts)
import GraphQL.Client.Types (class GqlQuery, Client(..), class QueryClient, clientQuery, defQueryOpts, clientMutation, defMutationOpts)
import GraphQL.Client.Variables (class VarsTypeChecked, getVarsJson, getVarsTypeNames)
import Simple.JSON as JSON
import Type.Proxy (Proxy(..))
......@@ -61,7 +54,7 @@ gqlQuery ::
-> String
-> query
-> REST.AffRESTError returns
gqlQuery c@(Client client) queryNameUnsafe q = do
gqlQuery (Client client) queryNameUnsafe q = do
let opts = defQueryOpts client
json <- clientQuery opts client queryName (getVarsTypeNames q <> toGqlQueryString q) (getVarsJson q)
......@@ -81,7 +74,7 @@ gqlMutation ::
-> String
-> query
-> REST.AffRESTError returns
gqlMutation c@(Client client) _ queryNameUnsafe q = do
gqlMutation (Client client) _ queryNameUnsafe q = do
let opts = defMutationOpts client
json <- clientMutation opts client queryName (getVarsTypeNames q <> toGqlQueryString q) (getVarsJson q)
......
......@@ -2,22 +2,21 @@ module Gargantext.Components.GraphQL.AffjaxSimpleJSONClient
(AffjaxClient(..))
where
import Prelude
import Affjax.Web (Error(..), Response, URL, defaultRequest, printError, request)
import Affjax.RequestBody as RequestBody
import Affjax.RequestHeader (RequestHeader(..))
import Affjax.ResponseFormat as ResponseFormat
import Data.Argonaut.Core (Json)
import Data.Either (Either(..))
import Data.HTTP.Method as Method
import Data.List.NonEmpty as DLN
import Data.Maybe (Maybe(..))
import Data.MediaType.Common (applicationJSON)
import Effect.Aff (Aff, error, throwError)
import Foreign (unsafeToForeign)
import GraphQL.Client.Types (class QueryClient)
import Simple.JSON as JSON
import Affjax.Web (URL)
-- import Affjax.RequestBody as RequestBody
import Affjax.RequestHeader (RequestHeader)
-- import Affjax.ResponseFormat as ResponseFormat
-- import Data.Argonaut.Core (Json)
-- import Data.Either (Either(..))
-- import Data.HTTP.Method as Method
-- import Data.List.NonEmpty as DLN
-- import Data.Maybe (Maybe(..))
-- import Data.MediaType.Common (applicationJSON)
-- import Effect.Aff (Aff, error, throwError)
-- import Foreign (unsafeToForeign)
-- import GraphQL.Client.Types (class QueryClient)
-- import Prelude
-- import Simple.JSON as JSON
data AffjaxClient
= AffjaxClient URL (Array RequestHeader)
......
......@@ -12,18 +12,15 @@ module Gargantext.Components.GraphQL.Context
, NgramsTerms(..)
) where
import Gargantext.Prelude
import Data.Argonaut (class EncodeJson, encodeJson)
import Data.Lens (Lens', lens)
import Data.Maybe (Maybe(..), fromMaybe)
import Data.Maybe (Maybe)
import Gargantext.Prelude
import Gargantext.Utils.GraphQL as GGQL
import GraphQL.Client.Args (Args, NotNull, (=>>), class ArgGql)
import GraphQL.Client.Variable (Var(..))
import GraphQL.Client.Variables.TypeName (class VarTypeName, varTypeName)
import Gargantext.Utils.GraphQL as GGQL
import GraphQL.Client.Variables.TypeName (class VarTypeName)
import Type.Proxy (Proxy(..))
import Data.Array as A
type Context_
= ( c_id :: Int
......
module Gargantext.Components.GraphQL.Endpoints where
import Gargantext.Prelude
import Data.Array as A
import Data.Bifunctor (rmap)
import Data.Either (Either(..))
import Data.Maybe (Maybe(..))
import Data.Map as Map
import Data.Maybe (Maybe(..))
import Data.Tuple (Tuple(..))
import Effect.Aff (Aff)
import Effect.Class (liftEffect)
import Gargantext.Components.GraphQL (E, getClient, queryGql, mutationGql)
import Gargantext.Components.GraphQL (queryGql, mutationGql)
import Gargantext.Components.GraphQL.Contact (AnnuaireContact, annuaireContactQuery)
import Gargantext.Components.GraphQL.Context as GQLCTX
import Gargantext.Components.GraphQL.IMT as GQLIMT
......@@ -22,12 +19,14 @@ import Gargantext.Components.GraphQL.User (UserInfo, userInfoQuery, User, userQu
import Gargantext.Components.Lang (Lang)
import Gargantext.Config.REST (RESTError(..), AffRESTError)
import Gargantext.Core.NgramsTable.Types (NgramsTerm(..))
import Gargantext.Prelude
import Gargantext.Sessions (Session(..))
import Gargantext.Types (CorpusId, NodeType)
import Gargantext.Utils.Reactix as R2
import GraphQL.Client.Args (onlyArgs)
import GraphQL.Client.Variables (withVars)
here :: R2.Here
here = R2.here "Gargantext.Components.GraphQL.Endpoints"
......@@ -83,7 +82,6 @@ getUser session id = do
updateUserPubmedAPIKey :: Session -> Int -> String -> AffRESTError Unit
updateUserPubmedAPIKey session user_id api_key = do
client <- liftEffect $ getClient session
eRes <- mutationGql session
"update_user_pubmed_api_key"
{ update_user_pubmed_api_key: onlyArgs { user_id
......@@ -93,7 +91,6 @@ updateUserPubmedAPIKey session user_id api_key = do
updateUserEPOAPIUser :: Session -> Int -> String -> AffRESTError Unit
updateUserEPOAPIUser session user_id api_user = do
client <- liftEffect $ getClient session
eRes <- mutationGql session
"update_user_epo_api_user"
{ update_user_epo_api_user: onlyArgs { user_id
......@@ -102,7 +99,6 @@ updateUserEPOAPIUser session user_id api_user = do
updateUserEPOAPIToken :: Session -> Int -> String -> AffRESTError Unit
updateUserEPOAPIToken session user_id api_token = do
client <- liftEffect $ getClient session
eRes <- mutationGql session
"update_user_epo_api_token"
{ update_user_epo_api_token: onlyArgs { user_id
......@@ -157,7 +153,6 @@ type TeamNodeId = Int
deleteTeamMembership :: Session -> SharedFolderId -> TeamNodeId -> AffRESTError Int
deleteTeamMembership session sharedFolderId teamNodeId = do
let token = getToken session
client <- liftEffect $ getClient session
eRes <- mutationGql session
"delete_team_membership"
{ delete_team_membership: onlyArgs { token: token
......@@ -194,7 +189,6 @@ getContextsForNgrams session corpus_id ngrams_terms = do
updateNodeContextCategory :: Session -> Int -> Int -> Int -> AffRESTError Int
updateNodeContextCategory session context_id node_id category = do
client <- liftEffect $ getClient session
eRes <- mutationGql session
"update_node_context_category"
{ update_node_context_category: onlyArgs { context_id
......@@ -219,7 +213,6 @@ getLanguages session = do
getContextNgrams :: Session -> Int -> Int -> AffRESTError (Array NgramsTerm)
getContextNgrams session context_id list_id = do
client <- liftEffect $ getClient session
let query = GQLCTX.contextNgramsQuery `withVars` { context_id, list_id }
eRes <- queryGql session "get context ngrams" query
pure $ rmap (\{ context_ngrams } -> NormNgramsTerm <$> context_ngrams) eRes
......
module Gargantext.Components.GraphQL.IMT where
import Gargantext.Prelude
import Affjax.RequestBody (RequestBody(..))
import Data.Array as A
import Data.Lens (Lens', lens)
import Data.Maybe (Maybe(..), fromMaybe, maybe)
import Gargantext.Utils.GraphQL as GGQL
import Type.Proxy (Proxy(..))
......
module Gargantext.Components.GraphQL.NLP where
import Gargantext.Prelude
import Gargantext.Components.Lang (Lang, ServerType)
import GraphQL.Client.Args (Args, NotNull, (=>>))
import GraphQL.Client.Variable (Var(..))
import Gargantext.Components.Lang (Lang(..), ServerType)
import Gargantext.Utils.GraphQL as GGQL
import Type.Proxy (Proxy(..))
type LanguageProperties
= { url :: String
......
module Gargantext.Components.GraphQL.Node where
import Gargantext.Prelude
import Data.Maybe (Maybe)
import Gargantext.Utils.GraphQL as GGQL
import GraphQL.Client.Args (Args, (=>>))
import GraphQL.Client.Variable (Var(..))
import Gargantext.Utils.GraphQL as GGQL
import Type.Proxy (Proxy(..))
......
module Gargantext.Components.InputWithAutocomplete where
import Prelude
import DOM.Simple (contains)
import DOM.Simple as DOM
import DOM.Simple.Event as DE
......@@ -9,16 +7,14 @@ import Data.Maybe (Maybe(..), maybe)
import Data.Nullable (Nullable, null, toMaybe)
import Data.String as S
import Effect (Effect)
import Effect.Aff (Aff, launchAff_)
import FFI.Simple ((..))
import Gargantext.Components.Bootstrap as B
import Gargantext.Components.Bootstrap.Types (Elevation(..))
import Gargantext.Components.Forest.Tree.Node.Action.Types (Action)
import Gargantext.Utils.Reactix as R2
import Prelude
import Reactix as R
import Reactix.DOM.HTML as H
import Toestand as T
here :: R2.Here
here = R2.here "Gargantext.Components.InputWithAutocomplete"
......
module Gargantext.Components.Lang where
import Gargantext.Prelude
import Data.Argonaut (class EncodeJson, encodeJson)
import Data.Array as A
import Data.Generic.Rep (class Generic)
import Data.Lens.Lens.Product (_1)
import Data.Maybe (Maybe(..))
import Data.Newtype (class Newtype)
import Data.Show.Generic (genericShow)
import Foreign as F
import Gargantext.Prelude
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Show as GUS
import Gargantext.Utils.SimpleJSON as GJSON
......
module Gargantext.Components.ListSelection where
import Gargantext.Prelude
import Data.Array as A
import Data.Either (Either)
import Data.Maybe (Maybe(..))
import Gargantext.Components.Bootstrap as B
import Gargantext.Components.Forest.Tree.Node.Tools (formChoiceSafe)
import Gargantext.Components.ListSelection.Types (NodeSimple(..), Selection(..), selectedListIds)
import Gargantext.Config.REST (RESTError(..), AffRESTError)
import Gargantext.Config.REST (RESTError, AffRESTError)
import Gargantext.Hooks.Loader (useLoader)
import Gargantext.Prelude
import Gargantext.Routes (SessionRoute(..))
import Gargantext.Sessions (Session(..), get)
import Gargantext.Types (ID, NodeType(..), fldr)
......@@ -18,6 +16,7 @@ import Reactix as R
import Reactix.DOM.HTML as H
import Toestand as T
here :: R2.Here
here = R2.here "Gargantext.Components.ListSelection"
......@@ -55,7 +54,7 @@ selectedIdsCpt = here.component "selectedIds" cpt where
selection' <- T.useLive T.unequal selection
pure $ case selection' of
SelectedLists ids -> H.div {} [ idsSelector { selection, session } [] ]
SelectedLists _ids -> H.div {} [ idsSelector { selection, session } [] ]
_ -> H.div {} []
type IdsSelectorProps =
......@@ -126,14 +125,12 @@ listTreeChildrenCpt = R2.hereComponent here "listTreeChildren" hCpt where
, render: \loaded ->
listTreeChildrenLoaded { loaded
, render
, root
, selection
, session } [] }
type ListTreeChildrenLoadedProps =
( loaded :: Array NodeSimple
, render :: Render
, root :: ID
, selection :: T.Box Selection
, session :: Session )
......@@ -141,7 +138,7 @@ listTreeChildrenLoaded :: R2.Component ListTreeChildrenLoadedProps
listTreeChildrenLoaded = R.createElement listTreeChildrenLoadedCpt
listTreeChildrenLoadedCpt :: R.Component ListTreeChildrenLoadedProps
listTreeChildrenLoadedCpt = here.component "listTreeChildrenLoaded" cpt where
cpt { loaded, render, root, selection, session } _ = do
cpt { loaded, render, selection, session } _ = do
pure $ H.div { className: "children" } (element <$> loaded)
where
element (NodeSimple { id, name, nodeType: nodeType@Corpus }) =
......
module Gargantext.Components.LoadingSpinner where
import Data.Maybe (Maybe(..), fromMaybe)
import Data.Maybe (Maybe, fromMaybe)
import Gargantext.Prelude
import Gargantext.Utils.Reactix as R2
import Reactix as R
import Reactix.DOM.HTML as H
import Gargantext.Prelude
import Gargantext.Utils.Reactix as R2
here :: R2.Here
here = R2.here "Gargantext.Components.LoadingSpinner"
......
This diff is collapsed.
......@@ -12,7 +12,6 @@ import Data.List as L
import Data.Maybe (Maybe(..), maybe)
import Data.Set (Set)
import Data.Set as Set
import Data.Traversable (traverse_)
import Data.Tuple.Nested ((/\))
import Effect (Effect)
import Effect.Aff (Aff, launchAff_)
......@@ -24,7 +23,6 @@ import Gargantext.Components.Table as Tbl
import Gargantext.Core.NgramsTable.Functions (applyNgramsPatches, setTermListA, tablePatchHasNgrams)
import Gargantext.Core.NgramsTable.Types (Action(..), CoreAction, NgramsClick, NgramsDepth, NgramsElement, NgramsTable, NgramsTablePatch, NgramsTerm, _NgramsElement, _NgramsRepoElement, _children, _list, _ngrams, _occurrences, ngramsTermText, replace)
import Gargantext.Hooks.FirstEffect (useFirstEffect')
import Gargantext.Sessions (Session)
import Gargantext.Types as GT
import Gargantext.Utils ((?))
import Gargantext.Utils.Reactix as R2
......@@ -213,10 +211,10 @@ treeLoadedCpt = here.component "treeLoaded" cpt where
, title: "Combine and separate"
}
]
leaf = L.null ngramsChildren
className = "fa fa-chevron-" <> if open then "down" else "right"
style = if leaf then {color: "#adb5bd"} else {color: ""}
open = not leaf || false {- TODO -}
-- leaf = L.null ngramsChildren
-- className = "fa fa-chevron-" <> if open then "down" else "right"
-- style = if leaf then {color: "#adb5bd"} else {color: ""}
-- open = not leaf || false {- TODO -}
--cs = ngramsTable ^.. ix ngramsDepth.ngrams <<< _NgramsRepoElement <<< _children <<< folded
-- cs has a list is ok, the length is the number of direct children of an ngram which is generally < 10.
......@@ -239,7 +237,6 @@ type RenderNgramsItem =
, ngramsLocalPatch :: NgramsTablePatch
, ngramsSelection :: Set NgramsTerm
, ngramsTable :: NgramsTable
, session :: Session
)
renderNgramsItem :: R2.Component RenderNgramsItem
......@@ -257,7 +254,6 @@ renderNgramsItemCpt = here.component "renderNgramsItem" cpt
, ngramsLocalPatch
, ngramsSelection
, ngramsTable
, session
} _ = do
{ sidePanelLists } <- Store.use
isEditing' <- T.useLive T.unequal isEditing
......@@ -276,8 +272,7 @@ renderNgramsItemCpt = here.component "renderNgramsItem" cpt
,
ngramsContext { corpusId
, mListId
, ngrams
, session } []
, ngrams } []
,
B.wad'
[ "col-score" ] $
......@@ -362,7 +357,7 @@ renderNgramsItemCpt = here.component "renderNgramsItem" cpt
-- traverse_ (dispatch <<< CoreAction <<< cycleTermListItem) (A.cons p.ngrams $ getNgramsChildren' p.ngrams)
ngramsClick p@{ parent: Nothing } = Just $ do
here.log2 "[renderNgramsItem] unexpected empty parent for ngrams depth" p
ngramsClick p@{ parent: Just p' } = Just $ do
ngramsClick { parent: Just p' } = Just $ do
(dispatch <<< CoreAction <<< cycleTermListItem) p'
-- ^ This is the old behavior it is nicer to use since one can
-- rapidly change the ngram list without waiting for confirmation.
......@@ -447,7 +442,6 @@ type NgramsContextProps =
( corpusId :: GT.CorpusId
, mListId :: Maybe GT.ListId
, ngrams :: NgramsTerm
, session :: Session
)
ngramsContext :: R2.Component NgramsContextProps
......@@ -456,8 +450,7 @@ ngramsContextCpt :: R.Component NgramsContextProps
ngramsContextCpt = here.component "ngramsContext" cpt where
cpt { ngrams
, corpusId
, mListId
, session } _ = do
, mListId } _ = do
{ sidePanelLists, sidePanelState } <- Store.use
mCurrentNgrams <-
T.useFocused
......@@ -469,13 +462,13 @@ ngramsContextCpt = here.component "ngramsContext" cpt where
eyeClass = selected ? "eye" $ "eye-slash"
variant = selected ? Info $ Dark
onClick selected _ = do
onClick sel _ = do
-- here.log2 "[docChooser] onClick, listId" listId
-- here.log2 "[docChooser] onClick, corpusId" corpusId
-- here.log2 "[docChooser] onClick, nodeId" nodeId
-- R2.callTrigger triggerAnnotatedDocIdChange { corpusId, listId, nodeId }
-- T2.reload tableReload
if selected then do
if sel then do
T.write_ Nothing sidePanelLists
T.write_ GT.Closed sidePanelState
else do
......
module Gargantext.Components.Node
where
import Gargantext.Prelude
import Data.Eq.Generic (genericEq)
import Data.Generic.Rep (class Generic)
import Data.Maybe (Maybe(..))
import Data.Maybe (Maybe)
import Data.Newtype (class Newtype)
import Gargantext.Prelude
import Simple.JSON as JSON
type NodePolyCommon a =
( id :: Int
, typename :: Int
......
......@@ -8,14 +8,11 @@ import Data.Maybe (Maybe(..))
import Data.Show.Generic (genericShow)
import Data.Tuple.Nested ((/\))
import Effect.Aff (Aff)
import Gargantext.Components.App.Store as Store
import Gargantext.Components.DocsTable as DT
import Gargantext.Components.DocsTable.Types (Year)
import Gargantext.Components.NgramsTable as NT
import Gargantext.Core.NgramsTable.Functions as NTC
import Gargantext.Components.Nodes.Lists.SidePanel as LSidePanel
import Gargantext.Components.Nodes.Lists.Types as LTypes
import Gargantext.Components.Nodes.Texts.Types as TextsT
import Gargantext.Components.Tab as Tab
import Gargantext.Ends (Frontends)
import Gargantext.Sessions (Session)
......
......@@ -5,8 +5,6 @@ module Gargantext.Components.Nodes.Annuaire.User
where
import Gargantext.Prelude
import Data.Either (Either(..))
import Data.Lens as L
import Data.Maybe (Maybe(..), fromMaybe)
......@@ -18,13 +16,11 @@ import Gargantext.Components.GraphQL (getClient)
import Gargantext.Components.GraphQL.Endpoints (getUserInfo, getUser, updateUserPubmedAPIKey, updateUserEPOAPIUser, updateUserEPOAPIToken)
import Gargantext.Components.GraphQL.User (UserInfo, _ui_cwCity, _ui_cwCountry, _ui_cwFirstName, _ui_cwLabTeamDeptsFirst, _ui_cwLastName, _ui_cwOffice, _ui_cwOrganizationFirst, _ui_cwRole, _ui_cwTouchMail, _ui_cwTouchPhone, _ui_cwDescription)
import Gargantext.Components.InputWithEnter (inputWithEnter)
import Gargantext.Components.Nodes.Annuaire.Tabs as Tabs
import Gargantext.Components.Nodes.Annuaire.User.Contacts.Types (Contact(..), ContactData, ContactTouch(..), ContactWhere(..), ContactWho(..), HyperdataContact(..), HyperdataUser(..), _city, _country, _firstName, _labTeamDeptsJoinComma, _lastName, _mail, _office, _organizationJoinComma, _ouFirst, _phone, _role, _shared, _touch, _who, defaultContactTouch, defaultContactWhere, defaultContactWho, defaultHyperdataContact, defaultHyperdataUser)
import Gargantext.Components.Nodes.Lists.Types as LT
import Gargantext.Config.REST (AffRESTError)
import Gargantext.Config.Utils (handleRESTError)
import Gargantext.Ends (Frontends)
import Gargantext.Hooks.Loader (useLoader)
import Gargantext.Prelude
import Gargantext.Sessions (Session(..), WithSession, WithSessionContext, sessionId)
import Gargantext.Types (CorpusId, FrontendError)
import Gargantext.Utils.Reactix as R2
......@@ -36,6 +32,7 @@ import Reactix.DOM.HTML as H
import Record as Record
import Toestand as T
here :: R2.Here
here = R2.here "Gargantext.Components.Nodes.Annuaire.User"
......@@ -70,8 +67,7 @@ listElement = H.li { className: "list-group-item justify-content-between" }
-}
type LayoutNoSessionProps =
( frontends :: Frontends
, nodeId :: CorpusId
( nodeId :: CorpusId
)
type LayoutProps = WithSession LayoutNoSessionProps
......@@ -94,17 +90,14 @@ userLayoutWithKey = R2.leaf userLayoutWithKeyCpt
userLayoutWithKeyCpt :: R.Component ( key :: String | LayoutProps )
-- userLayoutWithKeyCpt = here.component "userLayoutWithKey" cpt where
userLayoutWithKeyCpt = R2.hereComponent here "userLayoutWithKey" hCpt where
hCpt hp { frontends
, nodeId
hCpt hp { nodeId
, session } _ = do
{ errors, sidePanelLists, sidePanelTexts } <- AppStore.use
{ errors } <- AppStore.use
reload <- T.useBox T2.newReload
reload' <- T.useLive T.unequal reload
let Session {userId} = session
cacheState <- T.useBox LT.CacheOn
useLoader { errorHandler: Nothing
, herePrefix: hp
, loader: getUserInfoWithReload
......@@ -184,8 +177,6 @@ pubmedSettingsLoadedCpt = here.component "pubmedSettingsLoaded" cpt where
cpt { nodeId
, mPubmedAPIKey
, session } _ = do
box <- T.useBox $ fromMaybe "" mPubmedAPIKey
isEditing <- T.useBox false
pure $ R2.row
[ R2.col 12
......
......@@ -7,14 +7,11 @@ import Data.Generic.Rep (class Generic)
import Data.Maybe (Maybe(..))
import Data.Show.Generic (genericShow)
import Data.Tuple.Nested ((/\))
import Gargantext.Components.App.Store as Store
import Gargantext.Components.DocsTable as DT
import Gargantext.Components.DocsTable.Types (Year)
import Gargantext.Components.NgramsTable as NT
import Gargantext.Core.NgramsTable.Functions as NTC
import Gargantext.Components.Nodes.Lists.SidePanel as LSidePanel
import Gargantext.Components.Nodes.Lists.Types as LTypes
import Gargantext.Components.Nodes.Texts.Types as TTypes
import Gargantext.Components.Tab as Tab
import Gargantext.Ends (Frontends)
import Gargantext.Sessions (Session)
......@@ -54,7 +51,6 @@ type TabsProps =
, frontends :: Frontends
, nodeId :: Int
, session :: Session
, sidePanel :: T.Box (Maybe (Record TTypes.SidePanel))
)
tabs :: R2.Leaf TabsProps
......@@ -67,7 +63,6 @@ tabsCpt = here.component "tabs" cpt
, frontends
, nodeId
, session
, sidePanel
} _ = do
activeTab <- T.useBox 0
yearFilter <- T.useBox (Nothing :: Maybe Year)
......
module Gargantext.Components.Nodes.Corpus.Chart.Common where
import Gargantext.Prelude
import Data.Array as A
import Data.Maybe (Maybe(..))
import Data.Tuple.Nested ((/\))
import Gargantext.Components.App.Store as Store
import Gargantext.Components.Nodes.Corpus.Chart.Types (MetricsProps, ReloadPath)
import Gargantext.Config.REST (AffRESTError)
import Gargantext.Hooks.Loader (HashedResponse, useLoader, useLoaderWithCacheAPI)
import Gargantext.Prelude
import Gargantext.Sessions (Session)
import Gargantext.Types (FrontendError(..))
import Gargantext.Utils.CacheAPI as GUC
import Gargantext.Utils.Crypto (Hash)
import Gargantext.Utils.Reactix as R2
......@@ -18,6 +14,7 @@ import Reactix as R
import Simple.JSON as JSON
import Toestand as T
here :: R2.Here
here = R2.here "Gargantext.Components.Nodes.Corpus.Chart.Common"
......@@ -41,7 +38,6 @@ metricsLoadViewCpt = R2.hereComponent here "metricsLoadView" hCpt where
, path
, reload
, session } _ = do
{ errors } <- Store.use
reload' <- T.useLive T.unequal reload
useLoader { errorHandler: Nothing
......
......@@ -12,7 +12,6 @@ import Gargantext.Components.Charts.Options.Font (itemStyle, mkTooltip, template
import Gargantext.Components.Charts.Options.Series (seriesBarD1)
import Gargantext.Components.Nodes.Corpus.Chart.Common (metricsWithCacheLoadView)
import Gargantext.Components.Nodes.Corpus.Chart.Types (MetricsProps, Path, Props, ReloadPath)
import Gargantext.Components.Nodes.Corpus.Chart.Utils as U
import Gargantext.Config.REST (AffRESTError)
import Gargantext.Hooks.Loader (HashedResponse(..))
import Gargantext.Prelude (class Eq, bind, map, pure, ($), (==))
......@@ -24,10 +23,10 @@ import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Toestand as T2
import Reactix as R
import Reactix.DOM.HTML as H
import Record.Extra as RX
import Simple.JSON as JSON
import Toestand as T
here :: R2.Here
here = R2.here "Gargantext.Components.Nodes.Corpus.Chart.Histo"
......@@ -122,9 +121,7 @@ loaded :: R2.Leaf LoadedProps
loaded = R2.leaf loadedCpt
loadedCpt :: R.Component LoadedProps
loadedCpt = here.component "loaded" cpt where
cpt p@{ path
, reload
, session } _ = do
cpt p _ = do
pure $ H.div {} [
-- U.reloadButton { reload }
-- , U.chartUpdateButton { chartType: Histo, path, reload, session }
......
......@@ -30,6 +30,7 @@ import Reactix.DOM.HTML as H
import Simple.JSON as JSON
import Toestand as T
here :: R2.Here
here = R2.here "Gargantext.Components.Nodes.Corpus.Chart.Metrics"
......@@ -132,9 +133,7 @@ loaded :: R2.Leaf LoadedProps
loaded = R2.leaf loadedCpt
loadedCpt :: R.Component LoadedProps
loadedCpt = here.component "loaded" cpt where
cpt p@{ path
, reload
, session } _ = do
cpt p _ = do
pure $ H.div {} [
{- U.reloadButton reload
, U.chartUpdateButton { chartType: Scatter, path, reload, session }
......
......@@ -30,6 +30,7 @@ import Reactix.DOM.HTML as H
import Simple.JSON as JSON
import Toestand as T
here :: R2.Here
here = R2.here "Gargantext.Components.Nodes.Corpus.Chart.Pie"
......@@ -128,9 +129,7 @@ loadedPie :: R2.Leaf LoadedProps
loadedPie = R2.leaf loadedPieCpt
loadedPieCpt :: R.Component LoadedProps
loadedPieCpt = here.component "loadedPie" cpt where
cpt p@{ path
, reload
, session } _ = do
cpt p _ = do
pure $ H.div {} [
{- U.reloadButton reload
, U.chartUpdateButton { chartType: ChartPie, path, reload, session }
......@@ -162,9 +161,7 @@ loadedBar :: R2.Leaf LoadedProps
loadedBar = R2.leaf loadedBarCpt
loadedBarCpt :: R.Component LoadedProps
loadedBarCpt = here.component "loadedBar" cpt where
cpt p@{ path
, reload
, session } _ = do
cpt p _ = do
pure $ H.div {} [
{- U.reloadButton reload
, U.chartUpdateButton { chartType: ChartBar, path, reload, session }
......
module Gargantext.Components.Nodes.Corpus.Chart.Tree where
import Gargantext.Prelude
import Data.Generic.Rep (class Generic)
import Data.Maybe (Maybe(..))
import Data.Newtype (class Newtype)
......@@ -13,6 +11,7 @@ import Gargantext.Components.Nodes.Corpus.Chart.Common (metricsWithCacheLoadView
import Gargantext.Components.Nodes.Corpus.Chart.Types (MetricsProps, Path, Props, ReloadPath)
import Gargantext.Config.REST (AffRESTError)
import Gargantext.Hooks.Loader (HashedResponse(..))
import Gargantext.Prelude
import Gargantext.Routes (SessionRoute(..))
import Gargantext.Sessions (Session, get)
import Gargantext.Types (ChartType(..))
......@@ -24,6 +23,7 @@ import Reactix.DOM.HTML as H
import Simple.JSON as JSON
import Toestand as T
here :: R2.Here
here = R2.here "Gargantext.Components.Nodes.Corpus.Chart.Tree"
......@@ -98,9 +98,7 @@ loaded :: R2.Leaf LoadedProps
loaded = R2.leaf loadedCpt
loadedCpt :: R.Component LoadedProps
loadedCpt = here.component "loaded" cpt where
cpt p@{ path
, reload
, session } _ = do
cpt p _ = do
pure $ H.div {} [
{- U.reloadButton reload
, U.chartUpdateButton { chartType: ChartTree, path, reload, session }
......
......@@ -3,7 +3,6 @@ module Gargantext.Components.Nodes.Corpus.Chart.Types where
import Data.Maybe (Maybe)
import Data.Tuple (Tuple)
import Effect (Effect)
import Gargantext.Components.App.Store (Boxes)
import Gargantext.Components.Charts.Options.Type (EChartsInstance, MouseEvent)
import Gargantext.Prelude (Unit)
import Gargantext.Sessions (Session)
......
......@@ -16,9 +16,7 @@ import Gargantext.Hooks.Loader (useLoaderEffect)
import Gargantext.Hooks.Session (useSession)
import Gargantext.Types (CTabNgramType(..), ListId, NodeID, TabSubType(..), TabType(..))
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Toestand as T2
import Reactix as R
import Toestand as T
type Props =
( listId :: ListId
......
......@@ -2,8 +2,6 @@ module Gargantext.Components.Nodes.Frame
( node
) where
import Gargantext.Prelude
import Data.Maybe (Maybe(..), isJust)
import Data.Tuple.Nested ((/\))
import Gargantext.Components.Bootstrap as B
......@@ -13,6 +11,7 @@ import Gargantext.Components.Node (NodePoly)
import Gargantext.Config.REST (AffRESTError, logRESTError)
import Gargantext.Hooks.Loader (useLoaderEffect)
import Gargantext.Hooks.Session (useSession)
import Gargantext.Prelude
import Gargantext.Routes (SessionRoute(NodeAPI))
import Gargantext.Sessions (Session, get)
import Gargantext.Types (NodeType(..))
......@@ -30,7 +29,6 @@ here = R2.here "Gargantext.Components.Nodes.Frame"
node :: R2.Leaf ( key :: String | Props )
node = R2.leaf nodeCpt
nodeCpt :: R.Component ( key :: String | Props )
nodeCpt = R2.hereComponent here "node" hCpt where
hCpt hp { nodeId
......@@ -41,16 +39,16 @@ nodeCpt = R2.hereComponent here "node" hCpt where
session <- useSession
state' /\ state <- R2.useBox' Nothing
reload' /\ reload <- R2.useBox' T2.newReload
-- reload' /\ _reload <- R2.useBox' T2.newReload
-- | Hooks
-- |
useLoaderEffect
{ errorHandler: logRESTError hp
, loader: loadframeWithReload
, loader: loadframe
, path:
{ nodeId
, reload: reload'
-- , reload: reload'
, session
}
, state
......@@ -71,8 +69,6 @@ nodeCpt = R2.hereComponent here "node" hCpt where
R2.fromMaybe state' \frame ->
layout
{ frame
, nodeId
, reload
, nodeType
}
}
......@@ -92,8 +88,8 @@ type ReloadProps =
)
-- Just to make reloading effective
loadframeWithReload :: Record ReloadProps -> AffRESTError (NodePoly Hyperdata)
loadframeWithReload { nodeId, session } = loadframe { nodeId, session }
-- loadframeWithReload :: Record ReloadProps -> AffRESTError (NodePoly Hyperdata)
-- loadframeWithReload { nodeId, session } = loadframe { nodeId, session }
loadframe :: Record LoadProps -> AffRESTError (NodePoly Hyperdata)
loadframe { nodeId, session } = get session $ NodeAPI Node (Just nodeId) ""
......@@ -36,14 +36,14 @@ import Data.Newtype (class Newtype)
import Effect (Effect)
import Gargantext.Components.App.Store (Boxes)
import Gargantext.Components.Bootstrap as B
import Gargantext.Components.Bootstrap.Types (ComponentStatus(..), Elevation(..), ModalSizing(..), Position(..), TooltipPosition(..), Variant(..))
import Gargantext.Components.Bootstrap.Types (Elevation(..), Position(..), TooltipPosition(..))
import Gargantext.Components.Data.Landing (BlockText(..), BlockTexts(..), Button(..), LandingData(..))
import Gargantext.Components.FolderView as FV
import Gargantext.Components.Lang (LandingLang(..))
import Gargantext.Components.Lang.Landing.EnUS as En
import Gargantext.Components.Lang.Landing.FrFR as Fr
import Gargantext.Config as Config
import Gargantext.Sessions (Session(..), Sessions, Action(Logout), unSessions)
import Gargantext.Sessions (Sessions, Action(Logout))
import Gargantext.Sessions as Sessions
import Gargantext.Sessions.Types (Session(..), cleanBackendUrl)
import Gargantext.Utils.Reactix as R2
......@@ -52,8 +52,6 @@ import Reactix.DOM.HTML as H
import Routing.Hash (setHash)
import Toestand as T
import Effect.Console (log)
here :: R2.Here
here = R2.here "Gargantext.Components.Nodes.Home"
......
......@@ -83,8 +83,8 @@ randomWheel :: forall b. RandomWheel b -> Effect (RandomWheel b)
randomWheel (RandomWheel {before:[], during:d, after:a}) =
pure (RandomWheel {before:[], during:d, after:a})
randomWheel (RandomWheel {before:b, during:d, after:a}) = do
RandomWheel {before:b', during:d', after:a'} <- randomArray b
randomWheel (RandomWheel {before:b, during: _d, after:a}) = do
RandomWheel {before:b', during: d', after: _a'} <- randomArray b
randomWheel $ RandomWheel {before:b', during:d', after:(a <> [d'])}
......@@ -105,8 +105,8 @@ randomArray array = unsafePartial $ do
remove :: forall a. Int -> Array a -> Array a
remove n [] = []
remove n xs = unsafePartial $ case n of
remove _n [] = []
remove n xs = unsafePartial $ case n of
0 -> fromJust $ tail xs
_ -> (take n xs) <> (drop (n+1) xs)
......
......@@ -2,10 +2,9 @@ module Gargantext.Components.Nodes.Lists where
import Gargantext.Prelude
import Data.Maybe (Maybe(..), fromMaybe, maybe)
import Data.Maybe (Maybe(..), maybe)
import Effect (Effect)
import Effect.Aff (launchAff_)
import Gargantext.Components.App.Store (Boxes)
import Gargantext.Components.Bootstrap as B
import Gargantext.Components.Corpus.CodeSection (loadCorpusWithChild)
import Gargantext.Components.GraphQL.Context as GQLCTX
......@@ -35,10 +34,8 @@ here = R2.here "Gargantext.Components.Nodes.Lists"
--------------------------------------------------------
type CommonPropsNoSession =
( boxes :: Boxes
, nodeId :: Int
( nodeId :: Int
, sessionUpdate :: Session -> Effect Unit
, sidePanel :: T.Box (Maybe (Record SidePanel))
)
type Props = WithSession CommonPropsNoSession
......@@ -59,11 +56,9 @@ listsLayoutWithKey :: R2.Component ( key :: String | Props )
listsLayoutWithKey = R.createElement listsLayoutWithKeyCpt
listsLayoutWithKeyCpt :: R.Component ( key :: String | Props )
listsLayoutWithKeyCpt = R2.hereComponent here "listsLayoutWithKey" hCpt where
hCpt hp { boxes
, nodeId
hCpt hp { nodeId
, session
, sessionUpdate
, sidePanel } _ = do
, sessionUpdate } _ = do
activeTab <- T.useBox 0
let path = { nodeId, session }
......@@ -83,13 +78,12 @@ listsLayoutWithKeyCpt = R2.hereComponent here "listsLayoutWithKey" hCpt where
in
R.fragment [
Table.tableHeaderWithRenameLayout {
cacheState
, name
, date
date
, hyperdata
, key: "listsLayoutWithKey-header-" <> (show cacheState')
, name
, nodeId: corpusId
, session
, key: "listsLayoutWithKey-header-" <> (show cacheState')
}
, Tabs.tabs {
activeTab
......@@ -117,7 +111,7 @@ sidePanelCpt :: R.Component SidePanelProps
sidePanelCpt = here.component "sidePanel" cpt
where
cpt { session
, sidePanel
, sidePanel: sp
, sidePanelState } _ = do
sidePanelState' <- T.useLive T.unequal sidePanelState
......@@ -144,7 +138,7 @@ sidePanelCpt = here.component "sidePanel" cpt
{ className: "lists-sidepanel__body" }
[
sidePanelNgramsContextView { session
, sidePanel } []
, sidePanel: sp } []
]
]
......@@ -157,8 +151,8 @@ sidePanelNgramsContextView = R.createElement sidePanelNgramsContextViewCpt
sidePanelNgramsContextViewCpt :: R.Component SidePanelNgramsContextView
sidePanelNgramsContextViewCpt = here.component "sidePanelNgramsContextView" cpt where
cpt { session
, sidePanel } _ = do
mSidePanel' <- T.useLive T.unequal sidePanel
, sidePanel: sp } _ = do
mSidePanel' <- T.useLive T.unequal sp
case mSidePanel' of
Nothing -> pure $ H.div {} []
......@@ -177,9 +171,9 @@ sidePanelNgramsContextViewCpt = here.component "sidePanelNgramsContextView" cpt
]
,
ngramsDocList { mCorpusId: sidePanel'.mCorpusId
, mListId: sidePanel'.mListId
, mNgrams: sidePanel'.mCurrentNgrams
, session } []
, mListId: sidePanel'.mListId
, mNgrams: sidePanel'.mCurrentNgrams
, session } []
]
type NgramsDocListProps =
......@@ -192,11 +186,11 @@ ngramsDocList :: R2.Component NgramsDocListProps
ngramsDocList = R.createElement ngramsDocListCpt
ngramsDocListCpt :: R.Component NgramsDocListProps
ngramsDocListCpt = R2.hereComponent here "ngramsDocList" hCpt where
hCpt hp { mCorpusId: Nothing } _ = do
hCpt _hp { mCorpusId: Nothing } _ = do
pure $ H.div {} []
hCpt hp { mListId: Nothing } _ = do
hCpt _hp { mListId: Nothing } _ = do
pure $ H.div {} []
hCpt hp { mNgrams: Nothing } _ = do
hCpt _hp { mNgrams: Nothing } _ = do
pure $ H.div {} []
hCpt hp { mCorpusId: Just corpusId
, mListId: Just listId
......@@ -209,7 +203,6 @@ ngramsDocListCpt = R2.hereComponent here "ngramsDocList" hCpt where
, render: \ctx -> ngramsDocListLoaded { contexts: ctx
, corpusId
, listId
, ngrams
, session } []
}
......@@ -226,7 +219,6 @@ type NgramsDocListLoadedProps =
( contexts :: Array GQLCTX.Context
, corpusId :: GT.CorpusId
, listId :: GT.ListId
, ngrams :: NgramsTerm
, session :: Session )
ngramsDocListLoaded :: R2.Component NgramsDocListLoadedProps
......@@ -236,7 +228,6 @@ ngramsDocListLoadedCpt = here.component "ngramsDocListLoaded" cpt where
cpt { contexts
, corpusId
, listId
, ngrams
, session } _ = do
pure $ H.div { className: "ngrams-doc-list p-2" }
[ H.ul { className: "list-group" } ((\item -> contextItem { corpusId
......
......@@ -6,7 +6,6 @@ import Data.Array as A
import Data.Maybe (Maybe(..), fromMaybe)
import Data.Tuple.Nested ((/\))
import Effect.Class (liftEffect)
import Gargantext.Components.App.Store as Store
import Gargantext.Components.NgramsTable as NT
import Gargantext.Core.NgramsTable.Functions as NTC
import Gargantext.Components.Nodes.Corpus.Chart.Metrics (metrics)
......@@ -14,7 +13,6 @@ import Gargantext.Components.Nodes.Corpus.Chart.Pie (pie, bar)
import Gargantext.Components.Nodes.Corpus.Chart.Tree (tree)
import Gargantext.Components.Nodes.Corpus.Chart.Utils (mNgramsTypeFromTabType)
import Gargantext.Components.Nodes.Corpus.Types (CorpusData)
import Gargantext.Components.Nodes.Lists.SidePanel (SidePanel)
import Gargantext.Components.Tab as Tab
import Gargantext.Components.Table.Types (Params)
import Gargantext.Core.NgramsTable.Types (PageParams)
......
module Gargantext.Components.Nodes.Lists.Types where
import Data.Generic.Rep (class Generic)
import Data.Eq.Generic (genericEq)
import Data.Maybe (Maybe(..))
import Data.Generic.Rep (class Generic)
import Data.Show.Generic (genericShow)
import Simple.JSON as JSON
import Simple.JSON.Generics as JSONG
import Gargantext.Prelude
import Gargantext.Utils.Reactix as R2
import Simple.JSON as JSON
import Simple.JSON.Generics as JSONG
here :: R2.Here
here = R2.here "Gargantext.Components.Nodes.Lists.Types"
......
......@@ -3,7 +3,7 @@ module Gargantext.Components.Nodes.Texts where
import Gargantext.Prelude
import Data.Generic.Rep (class Generic)
import Data.Maybe (Maybe(..), isJust)
import Data.Maybe (Maybe(..))
import Data.Show.Generic (genericShow)
import Data.Tuple.Nested ((/\))
import Effect.Aff (launchAff_)
......@@ -24,13 +24,12 @@ import Gargantext.Components.Nodes.Corpus.Chart.Histo (histo)
import Gargantext.Components.Nodes.Corpus.Chart.Types as CTypes
import Gargantext.Components.Nodes.Corpus.Types (CorpusData)
import Gargantext.Components.Nodes.Lists.Types as LT
import Gargantext.Components.Nodes.Texts.Types as TT
import Gargantext.Components.Nodes.Texts.Types as TextsT
import Gargantext.Components.Reload (textsReloadContext)
import Gargantext.Components.Tab as Tab
import Gargantext.Components.Table as Table
import Gargantext.Ends (Frontends)
import Gargantext.Hooks.Loader (useLoader, useLoaderEffect)
import Gargantext.Hooks.Loader (useLoader)
import Gargantext.Hooks.Session (useSession)
import Gargantext.Sessions (Session, getCacheState)
import Gargantext.Types (CTabNgramType(..), ListId, NodeID, SidePanelState(..), TabSubType(..), TabType(..))
......@@ -39,7 +38,6 @@ import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Toestand as T2
import Reactix as R
import Reactix.DOM.HTML as H
import Simple.JSON as JSON
import Toestand as T
here :: R2.Here
......@@ -103,13 +101,12 @@ textsLayoutWithKeyCpt = R2.hereComponent here "textsLayoutWithKey" hCpt where
{ className: "texts-layout" }
[
Table.tableHeaderWithRenameLayout
{ cacheState
, name
, date
{ date
, hyperdata
, key: "textsLayoutWithKey-" <> (show cacheState')
, name
, nodeId: corpusId
, session
, key: "textsLayoutWithKey-" <> (show cacheState')
}
,
tabs
......@@ -365,7 +362,6 @@ docViewLayoutRec { cacheState
, frontends
, listId
, session
, tabType
, yearFilter
} =
{ cacheState
......@@ -547,7 +543,7 @@ sideTextCpt = R2.hereComponent here "sideText" hCpt where
useLoader { errorHandler: Nothing
, herePrefix: hp
, loader: \{ path } -> loadData path
, loader: \{ path: p } -> loadData p
, path: { path }
, render: \loaded -> loadedSideText { loaded
, path
......
......@@ -109,7 +109,7 @@ data FieldType =
derive instance Generic FieldType _
instance JSON.WriteForeign FieldType where
writeImpl (Haskell { haskell }) = JSON.writeImpl { haskell, tag: "HaskellField" }
writeImpl (JSON { authors, desc, query, tag, title }) = JSON.writeImpl { authors, desc, query, tag: "JsonField", title }
writeImpl (JSON { authors, desc, query, title }) = JSON.writeImpl { authors, desc, query, tag: "JsonField", title }
writeImpl (Markdown { text }) = JSON.writeImpl { tag: "MarkdownField", text }
writeImpl (Python { python }) = JSON.writeImpl { python, tag: "PythonField" }
instance Eq FieldType where eq = genericEq
......
......@@ -3,12 +3,10 @@ module Gargantext.Components.PhyloExplorer.Config.ConfigForm
, FormData
) where
import Gargantext.Prelude
import DOM.Simple.Console (log3)
import Data.Either (Either(..))
import Data.Generic.Rep (class Generic)
import Data.Foldable (foldl, intercalate)
import Data.Generic.Rep (class Generic)
import Data.Maybe (Maybe(..))
import Data.Show.Generic (genericShow)
import Effect (Effect)
......@@ -16,10 +14,10 @@ import Gargantext.Components.Bootstrap as B
import Gargantext.Components.Bootstrap.Types (ButtonVariant(..), ComponentStatus(..), Variant(..))
import Gargantext.Components.PhyloExplorer.API (CliqueFilter(..), ReflexiveClique(..), ReflexiveTimeUnit(..))
import Gargantext.Hooks.FormValidation (VForm, useFormValidation)
import Gargantext.Components.Forest.Tree.Node.Tools (formChoiceSafe, panel)
import Gargantext.Hooks.FormValidation.Unboxed as FV
import Gargantext.Hooks.StateRecord (useStateRecord)
import Gargantext.Hooks.StateRecord.Behaviors (setter)
import Gargantext.Prelude
import Gargantext.Utils (nbsp, (?))
import Gargantext.Utils.Reactix as R2
import Reactix as R
......@@ -28,6 +26,7 @@ import Record (merge)
import Record as Record
import Record.Extra (pick)
type Props =
( callback :: Record FormData -> Effect Unit
, status :: ComponentStatus
......
......@@ -18,10 +18,8 @@ import Gargantext.Hooks.Loader (useLoaderEffect)
import Gargantext.Sessions (Session)
import Gargantext.Types (CTabNgramType(..), TabSubType(..), TabType(..))
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Toestand as T2
import Reactix as R
import Reactix.DOM.HTML as H
import Toestand as T
here :: R2.Here
......
......@@ -47,7 +47,6 @@ docListWrapperCpt = here.component "wrapper" cpt where
store <- PhyloStore.use
extractedTerms <- R2.useLive' store.extractedTerms
corpusId <- R2.useLive' store.corpusId
listId <- R2.useLive' store.listId
selectedTerm <- R2.useLive' store.selectedTerm
......
......@@ -12,7 +12,6 @@ import Data.UUID (UUID)
import Data.UUID as UUID
import Effect (Effect)
import Gargantext.Components.App.Store (Boxes)
import Gargantext.Components.Bootstrap as B
import Gargantext.Components.ErrorsView as ErrorsView
import Gargantext.Components.Forest (forestLayout)
import Gargantext.Components.Forest.Breadcrumb as Breadcrumb
......@@ -37,7 +36,6 @@ import Gargantext.Components.Tile (tileBlock)
import Gargantext.Components.TopBar as TopBar
import Gargantext.Components.TreeSearch (treeSearch)
import Gargantext.Config (defaultFrontends, defaultBackends)
import Gargantext.Config.REST (AffRESTError)
import Gargantext.Context.Session as SessionContext
import Gargantext.Ends (Backend)
import Gargantext.Hooks.Resize (ResizeType(..), useResizeHandler)
......@@ -407,8 +405,6 @@ openedSidePanelCpt = here.component "openedSidePanel" cpt where
let wrapper = H.div { className: "side-panel shadow" }
selectedNgrams <- T.useBox Nothing
case route' of
GR.Lists _s _n -> do
pure $ wrapper
......@@ -514,7 +510,7 @@ dashboard = R.createElement dashboardCpt
dashboardCpt :: R.Component SessionNodeProps
dashboardCpt = here.component "dashboard" cpt
where
cpt props@{ boxes, nodeId } _ = do
cpt props@{ nodeId } _ = do
let sessionProps = RE.pick props :: Record SessionProps
pure $ authed (Record.merge { content: \session ->
dashboardLayout { nodeId, session } [] } sessionProps) []
......@@ -610,15 +606,12 @@ lists :: R2.Component SessionNodeProps
lists = R.createElement listsCpt
listsCpt :: R.Component SessionNodeProps
listsCpt = here.component "lists" cpt where
cpt props@{ boxes
, nodeId } _ = do
cpt props@{ nodeId } _ = do
let sessionProps = RE.pick props :: Record SessionProps
pure $ authed (Record.merge { content: \session ->
Lists.listsLayout { boxes
, nodeId
Lists.listsLayout { nodeId
, session
, sessionUpdate: \_ -> pure unit
, sidePanel: boxes.sidePanelLists } [] } sessionProps) []
, sessionUpdate: \_ -> pure unit } [] } sessionProps) []
--------------------------------------------------------------
......@@ -732,8 +725,7 @@ userCpt = here.component "user" cpt where
cpt props@{ nodeId } _ = do
let sessionProps = RE.pick props :: Record SessionProps
pure $ authed (Record.merge { content: \session ->
userLayout { frontends: defaultFrontends
, nodeId
userLayout { nodeId
, session } [] } sessionProps) []
--------------------------------------------------------------
......
module Gargantext.Components.Table where
import Gargantext.Prelude
import Data.Array as A
import Data.Either (Either(..))
import Data.Foldable (intercalate)
......@@ -23,6 +21,7 @@ import Gargantext.Components.Nodes.Types (FTFieldList)
import Gargantext.Components.Search (SearchType(..))
import Gargantext.Components.Table.Types (ColumnName(..), OrderBy, OrderByDirection(..), Params, Props, TableContainerProps, columnName)
import Gargantext.Hooks.FirstEffect (useFirstEffect')
import Gargantext.Prelude
import Gargantext.Sessions.Types (Session)
import Gargantext.Types (NodeID, defaultCacheParams)
import Gargantext.Utils (setter, (?))
......@@ -32,6 +31,7 @@ import Reactix as R
import Reactix.DOM.HTML as H
import Toestand as T
here :: R2.Here
here = R2.here "Gargantext.Components.Table"
......@@ -67,23 +67,21 @@ type TableHeaderLayoutProps = (
)
type TableHeaderWithRenameLayoutProps = (
cacheState :: T.Box NT.CacheState
, session :: Session
date :: String
, hyperdata :: Hyperdata
, nodeId :: NodeID
, name :: String
, date :: String
, key :: String
, name :: String
, nodeId :: NodeID
, session :: Session
)
type TableHeaderWithRenameBoxedLayoutProps = (
cacheState :: T.Box NT.CacheState
, session :: Session
corpusInfoS :: T.Box CorpusInfo
, date :: String
, hyperdata :: Hyperdata
, nodeId :: NodeID
, name :: String
, date :: String
, corpusInfoS :: T.Box CorpusInfo
, nodeId :: NodeID
, session :: Session
)
initialParams :: Params
......@@ -92,15 +90,20 @@ initialParams = stateParams {page: 1, pageSize: PS10, orderBy: Just (DESC (Colum
tableHeaderWithRenameLayout :: R2.Leaf TableHeaderWithRenameLayoutProps
tableHeaderWithRenameLayout = R2.leaf tableHeaderWithRenameLayoutCpt
tableHeaderWithRenameLayoutCpt :: R.Component TableHeaderWithRenameLayoutProps
tableHeaderWithRenameLayoutCpt = here.component "tableHeaderWithRenameLayoutCpt" cpt
where
cpt { hyperdata: Hyperdata h, nodeId, session, cacheState, name, date } _ = do
cpt { date, hyperdata: Hyperdata h, name, nodeId, session } _ = do
let corpusInfo = getCorpusInfo h.fields
corpusInfoS <- T.useBox corpusInfo
pure $ tableHeaderWithRenameBoxedLayout {hyperdata: Hyperdata h, nodeId, session, cacheState, name, date, corpusInfoS} []
pure $
tableHeaderWithRenameBoxedLayout { corpusInfoS
, date
, hyperdata: Hyperdata h
, name
, nodeId
, session } []
tableHeaderWithRenameBoxedLayout :: R2.Component TableHeaderWithRenameBoxedLayoutProps
tableHeaderWithRenameBoxedLayout = R.createElement tableHeaderWithRenameBoxedLayoutCpt
......@@ -109,27 +112,18 @@ tableHeaderWithRenameBoxedLayoutCpt = here.component "tableHeaderWithRenameBoxed
where
cpt p@{ nodeId
, session
, cacheState
, name
, date
, corpusInfoS
} _ = do
-- | States
-- |
cacheState' <- T.useLive T.unequal cacheState
CorpusInfo {title, desc, query, authors} <- T.read corpusInfoS
{ expandTableEdition } <- AppStore.use
expandTableEdition' <- R2.useLive' expandTableEdition
-- | Hooks
-- |
topBarPortalKey <- pure $ "portal-topbar::" <> show nodeId
mTopBarHost <- R.unsafeHooksEffect $ R2.getElementById "portal-topbar"
-- | Effects
-- |
......@@ -208,13 +202,13 @@ tableHeaderWithRenameBoxedLayoutCpt = here.component "tableHeaderWithRenameBoxed
}
]
cacheText NT.CacheOn = "Cache On"
cacheText NT.CacheOff = "Cache Off"
-- cacheText NT.CacheOn = "Cache On"
-- cacheText NT.CacheOff = "Cache Off"
-- cacheClick cacheState _ = T.modify_ cacheStateToggle cacheState
cacheStateToggle NT.CacheOn = NT.CacheOff
cacheStateToggle NT.CacheOff = NT.CacheOn
-- cacheStateToggle NT.CacheOn = NT.CacheOff
-- cacheStateToggle NT.CacheOff = NT.CacheOn
onExpandTableEditionChange :: T.Change Boolean -> Effect Unit
onExpandTableEditionChange { new } = do
......
module Gargantext.Components.TopBar (component) where
import Gargantext.Prelude
import Data.Foldable (intercalate)
import Effect (Effect)
import Gargantext.Components.App.Store as AppStore
import Gargantext.Components.Bootstrap as B
import Gargantext.Components.Bootstrap.Types (ButtonVariant(..), Variant(..))
import Gargantext.Components.Lang (langSwitcher, allFeLangs)
import Gargantext.Components.Themes (themeSwitcher, allThemes)
import Gargantext.Prelude
import Gargantext.Types (Handed(..), defaultCacheParams)
import Gargantext.Utils (setter, (?), nbsp)
import Gargantext.Utils (setter, (?))
import Gargantext.Utils.Reactix as R2
import Reactix as R
import Reactix.DOM.HTML as H
import Toestand as T
here :: R2.Here
here = R2.here "Gargantext.Components.TopBar"
......@@ -26,8 +25,7 @@ componentCpt = here.component "main" cpt where
cpt _ _ = do
-- | States
-- |
{ lang
, showTree
{ showTree
, theme
} <- AppStore.use
......
......@@ -14,9 +14,7 @@ import Data.Generic.Rep (class Generic)
import Data.HTTP.Method (Method(..))
import Data.Maybe (Maybe(..))
import Data.MediaType.Common (applicationFormURLEncoded, applicationJSON, multipartFormData)
import Data.Show.Generic (genericShow)
import Data.Tuple (Tuple)
import Data.Tuple.Nested ((/\))
import Effect (Effect)
import Effect.Aff (Aff)
import Effect.Class (liftEffect)
......
......@@ -4,8 +4,6 @@ module Gargantext.Context.Progress
, asyncContext
) where
import Gargantext.Prelude
import Data.Either (Either(..))
import Data.Maybe (Maybe(..))
import Data.Tuple.Nested ((/\))
......@@ -17,14 +15,16 @@ import Gargantext.Components.App.Store as AppStore
import Gargantext.Components.Forest.Tree.Node.Tools.ProgressBar (QueryProgressData, queryProgress)
import Gargantext.Config.Utils (handleErrorInAsyncProgress, handleRESTError)
import Gargantext.Hooks.FirstEffect (useFirstEffect')
import Gargantext.Prelude
import Gargantext.Sessions (Session)
import Gargantext.Types (AsyncProgress, FrontendError)
import Gargantext.Types (AsyncProgress)
import Gargantext.Types as GT
import Gargantext.Utils.Reactix as R2
import Reactix as R
import Record.Extra as RX
import Toestand as T
type AsyncProps =
( asyncTask :: GT.AsyncTaskWithType
, nodeId :: GT.ID
......
......@@ -8,7 +8,7 @@ import Data.Array (head)
import Data.Array as A
import Data.Either (Either(..))
import Data.Foldable (foldl)
import Data.FoldableWithIndex (foldlWithIndex, foldrWithIndex)
import Data.FoldableWithIndex (foldlWithIndex)
import Data.Lens (use, view, (^?), (^.), (?=), (%~), (%=), (.~))
import Data.Lens.At (at)
import Data.Lens.Common (_Just)
......@@ -48,11 +48,9 @@ import Gargantext.Types (AsyncTask, AsyncTaskType(..), AsyncTaskWithType(..), CT
import Gargantext.Utils.Either (eitherMap)
--import Gargantext.Utils.KarpRabin (indicesOfAny)
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.String as GS
import Gargantext.Utils.Tuple as GUT
import Partial (crashWith)
import Partial.Unsafe (unsafePartial)
import Reactix as R
import Toestand as T
here :: R2.Here
......@@ -120,7 +118,7 @@ lookupRootList ngram (NgramsTable {ngrams_repo_elements: elts}) =
Just (NgramsRepoElement {list}) -> Just list -- assert root == Nothing
lookupRootListWithChildren :: NgramsTerm -> NgramsTable -> Record Cache -> Maybe TermList
lookupRootListWithChildren ngram table@(NgramsTable {ngrams_repo_elements: elts}) { pm, pats } =
lookupRootListWithChildren ngram table@(NgramsTable {ngrams_repo_elements: elts}) { pm } =
case Map.lookup ngram elts of
Nothing -> -- try to find in children
case Map.lookup ngram pm of
......@@ -168,7 +166,7 @@ computeCache ngrams contextNgrams = { contextNgrams, pm, pats }
-- TODO: while this function works well with word boundaries,
-- it inserts too many spaces.
highlightNgrams :: Record Cache -> CTabNgramType -> NgramsTable -> String -> Array HighlightElement
highlightNgrams cache@{ pm, pats } ntype table@(NgramsTable {ngrams_repo_elements: elts}) input0 =
highlightNgrams cache@{ pats } ntype table input0 =
-- trace {pats, input0, input, ixs} \_ ->
-- trace ("[highlightNgrams] " <> show { input0
-- , ixs
......@@ -220,7 +218,7 @@ highlightNgrams cache@{ pm, pats } ntype table@(NgramsTable {ngrams_repo_element
extractInputTextMatch :: Int -> Int -> String -> String
extractInputTextMatch i len input = undb $ S.take len $ S.drop (i + 1) input
extractInputTextMatch i len input' = undb $ S.take len $ S.drop (i + 1) input'
addNgramElt ng ne_list (elt /\ elt_lists) = (elt /\ ((ng /\ ne_list) : elt_lists))
......@@ -544,7 +542,7 @@ convOrderBy (T.DESC (T.ColumnName "Score")) = ScoreDesc
convOrderBy (T.ASC _) = TermAsc
convOrderBy (T.DESC _) = TermDesc
coreDispatch :: forall p s. CoreParams p -> T.Box State -> CoreDispatch
coreDispatch :: forall p. CoreParams p -> T.Box State -> CoreDispatch
coreDispatch path state (Synchronize { afterSync }) =
syncPatches path state afterSync
coreDispatch _ state (CommitPatch pt) =
......
module Gargantext.Core.NgramsTable.Types where
import Control.Monad.State (class MonadState, execState)
import Control.Monad.State (class MonadState)
import Data.Bifunctor (lmap)
import Data.Eq.Generic (genericEq)
import Data.Foldable (class Foldable, foldMap, foldl, foldr)
import Data.FoldableWithIndex (class FoldableWithIndex, foldMapWithIndex, foldlWithIndex, foldrWithIndex)
import Data.Generic.Rep (class Generic)
import Data.Lens (Iso', Lens', use, view, (%=), (%~), (.~), (?=), (^?))
import Data.Lens (Iso', Lens', (%~))
import Data.Lens.At (class At, at)
import Data.Lens.Common (_Just)
import Data.Lens.Index (class Index, ix)
......@@ -14,16 +14,14 @@ import Data.Lens.Iso.Newtype (_Newtype)
import Data.Lens.Record (prop)
import Data.List (List)
import Data.List as List
import Data.List.Types (NonEmptyList(..))
import Data.Map (Map)
import Data.Map as Map
import Data.Maybe (Maybe(..), fromJust, isJust)
import Data.Maybe (Maybe(..), isJust)
import Data.Newtype (class Newtype)
import Data.Ord.Generic (genericCompare)
import Data.Show.Generic (genericShow)
import Data.Set (Set)
import Data.Set as Set
import Data.String.Regex (Regex, regex, replace) as R
import Data.Show.Generic (genericShow)
import Data.Tuple (Tuple(..))
import Effect (Effect)
import Effect.Aff (Aff)
......@@ -35,10 +33,11 @@ import Gargantext.Prelude
import Gargantext.Sessions (Session)
import Gargantext.Types as GT
import Gargantext.Utils.SimpleJSON as USJ
import Simple.JSON as JSON
import Reactix as R
import Simple.JSON as JSON
import Type.Proxy (Proxy(..))
type Endo a = a -> a
......
......@@ -71,15 +71,15 @@ getNeighboursOfNode g n = Seq.fromFoldable $ Set.union sources targets
-- TODO algorithm
initStatus :: Graph -> Status -> Maybe Dendrogram -> Status
initStatus g s Nothing = Status {totalWeight}
initStatus g _s Nothing = Status {totalWeight}
where
totalWeight = getGraphSize g
initStatus g s (Just d) = Status {totalWeight}
initStatus g _s (Just _d) = Status {totalWeight}
where
totalWeight = getGraphSize g
generateDendrogram :: Graph -> Dendrogram -> Dendrogram
generateDendrogram g partInit =
generateDendrogram g _partInit =
if Seq.null (gEdges g) then
Dendrogram $ Map.fromFoldable $ Seq.map (\n@(Node ns) -> Tuple n (Cluster ns)) (gNodes g)
else
......
......@@ -4,17 +4,15 @@ module Gargantext.Ends
where
import Data.Array (filter)
import Data.Foldable (foldMap)
import Data.Generic.Rep (class Generic)
import Data.Eq.Generic (genericEq)
import Data.Generic.Rep (class Generic)
import Data.Maybe (Maybe(..), maybe, fromMaybe)
import Data.Newtype (class Newtype)
import Prelude (class Eq, class Show, show, ($), (/=), (<<<), (<>), (==), (<$>))
import Simple.JSON as JSON
import Gargantext.Routes as R
import Gargantext.Types (ApiVersion, ChartType(..), Limit, NodePath, NodeType(..), Offset, TabType(..), TermSize(..), nodePath, nodeTypePath, showTabType', TermList(MapTerm))
import Gargantext.Utils.QueryString (joinQueryStrings, mQueryParam, queryParam, queryParamS)
import Prelude (class Eq, class Show, show, ($), (/=), (<<<), (<>), (==), (<$>))
import Simple.JSON as JSON
-- | A means of generating a url to visit, a destination
class ToUrl conf p where
......@@ -203,7 +201,7 @@ sessionPath (R.CorpusMetricsHash { listId, tabType} i) =
qs = joinQueryStrings [ queryParam "ngrams" listId
, queryParamS "ngramsType" $ showTabType' tabType ]
-- TODO fix this url path
sessionPath (R.Chart {chartType, limit, listId, tabType} i) =
sessionPath (R.Chart {chartType, listId, tabType} i) =
sessionPath $ R.NodeAPI Corpus i $ show chartType <> qs
where
qs = joinQueryStrings [ queryParamS "ngramsType" $ showTabType' tabType
......
module Gargantext.Hooks.Loader where
import Gargantext.Prelude
import Data.Array as A
import Data.Either (Either(..))
import Data.Generic.Rep (class Generic)
......@@ -15,6 +13,7 @@ import Gargantext.Components.App.Store as Store
import Gargantext.Components.LoadingSpinner (loadingSpinner)
import Gargantext.Config.REST (RESTError, AffRESTError, logRESTError)
import Gargantext.Config.Utils (handleRESTError)
import Gargantext.Prelude
import Gargantext.Types (FrontendError(..))
import Gargantext.Utils.CacheAPI as GUC
import Gargantext.Utils.Crypto (Hash)
......@@ -23,6 +22,7 @@ import Reactix as R
import Simple.JSON as JSON
import Toestand as T
here :: R2.Here
here = R2.here "Gargantext.Hooks.Loader"
......@@ -43,13 +43,12 @@ type UseLoader path state =
useLoader :: forall path st. Eq path => Eq st
=> Record (UseLoader path st)
-> R.Hooks R.Element
useLoader props@{ errorHandler
, herePrefix
, loader
, path
, render } = do
useLoader { errorHandler
, herePrefix
, loader
, path
, render } = do
{ errors } <- Store.use
state <- T.useBox Nothing
useLoader' { errorHandler: errorHandler' errors
, loader
......
module Gargantext.Hooks.Sigmax
where
import Data.Array as A
import DOM.Simple.Types (Element)
import Data.Either (either)
import Data.Foldable (sequence_, foldl)
import Data.Map as Map
......@@ -12,12 +12,8 @@ import Data.Sequence as Seq
import Data.Set as Set
import Data.Traversable (traverse_)
import Data.Tuple (Tuple(..))
import Data.Tuple.Nested ((/\))
import DOM.Simple.Types (Element)
import Effect (Effect)
import Effect.Class.Console (error)
import Effect.Timer (TimeoutId, clearTimeout, setTimeout)
import FFI.Simple ((.=))
import Gargantext.Hooks.Sigmax.ForceAtlas2 as ForceAtlas
import Gargantext.Hooks.Sigmax.Graphology as Graphology
import Gargantext.Hooks.Sigmax.Sigma as Sigma
......@@ -26,7 +22,7 @@ import Gargantext.Utils.Console as C
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Seq as GSeq
import Gargantext.Utils.Set as GSet
import Prelude (Unit, bind, discard, flip, map, not, pure, unit, ($), (&&), (*>), (<<<), (<>), (>>=), (+), (>), negate, (/=), (==), (<$>))
import Prelude (Unit, bind, discard, flip, not, pure, unit, ($), (*>), (<<<), (<>), (>>=), (+), (>), negate, (==), (<$>))
import Reactix as R
import Toestand as T
......@@ -118,12 +114,11 @@ dependOnContainer container notFoundMsg f = do
-- | Effect for handling pausing FA via state changes. We need this because
-- | pausing can be done not only via buttons but also from the initial
-- | setTimer.
handleForceAtlas2Pause :: forall settings. R.Ref (Maybe ForceAtlas.FA2Layout)
handleForceAtlas2Pause :: R.Ref (Maybe ForceAtlas.FA2Layout)
-> T.Box ST.ForceAtlasState
-> R.Ref (Maybe TimeoutId)
-> settings
-> Effect Unit
handleForceAtlas2Pause fa2Ref forceAtlasState mFAPauseRef settings = do
handleForceAtlas2Pause fa2Ref forceAtlasState mFAPauseRef = do
let fa2_ = R.readRef fa2Ref
toggled <- T.read forceAtlasState
case fa2_ of
......@@ -286,16 +281,10 @@ sigmaDiff sigmaGraph gControls = { add, remove, update }
commonNodeIds = Set.intersection sigmaNodeIds $ Set.fromFoldable gcNodeIds
commonNodes = Seq.filter (\n -> Set.member n.id commonNodeIds) sigmaNodes
commonEdgeIds = Set.intersection sigmaEdgeIds $ Set.fromFoldable gcEdgeIds
commonEdges = Seq.filter (\e -> Set.member e.id commonEdgeIds) sigmaEdges
sigmaNodeIdsMap = Map.fromFoldable $ Seq.map (\n -> Tuple n.id n) commonNodes --sigmaNodes
sigmaEdgeIdsMap = Map.fromFoldable $ Seq.map (\e -> Tuple e.id e) commonEdges --sigmaEdges
-- updateEdges = Seq.filter (\e -> Just e /= Map.lookup e.id sigmaEdgeIdsMap) gcEdges
updateEdges = Seq.empty
-- Find nodes for which `ST.compareNodes` returns `false`, i.e. nodes differ
updateNodes = Seq.filter (\n -> (ST.compareNodes n <$> (Map.lookup n.id sigmaNodeIdsMap)) == Just false) gcNodes
-- updateEdges = Seq.empty
-- updateNodes = Seq.empty
-- DEPRECATED
......
......@@ -50,4 +50,4 @@ toCamera c = Camera { angle, ratio, x, y }
updateCamera :: CameraInstance -> Camera -> Effect Unit
updateCamera cam (Camera { angle, ratio, x, y }) = runEffectFn2 _setState cam { angle, ratio, x, y }
foreign import _setState :: forall e. EffectFn2 CameraInstance {|CameraRow} Unit
foreign import _setState :: EffectFn2 CameraInstance {|CameraRow} Unit
......@@ -2,19 +2,13 @@ module Gargantext.Hooks.Sigmax.ForceAtlas2 where
-- FFI for force atlas2: https://graphology.github.io/standard-library/layout-forceatlas2.html
import Prelude
import Data.Array as A
import Data.Sequence as Seq
import Data.Set as Set
import Data.Traversable (traverse)
import Effect (Effect)
import Effect.Timer (setTimeout)
import Effect.Uncurried (EffectFn1, EffectFn2, EffectFn3, EffectFn4, runEffectFn1, runEffectFn2, runEffectFn3, runEffectFn4)
import FFI.Simple ((..), (...), (.=))
import Effect.Uncurried (EffectFn1, EffectFn2, runEffectFn1, runEffectFn2)
import FFI.Simple ((..))
import Gargantext.Hooks.Sigmax.Graphology as Graphology
import Gargantext.Hooks.Sigmax.Types as Types
import Record as Record
import Prelude
-- | Type representing the web worker.
foreign import data FA2Layout :: Type
......
......@@ -5,18 +5,16 @@ module Gargantext.Hooks.Sigmax.Graphology where
-- serialized graph: https://graphology.github.io/serialization#format
-- to use with: Graph.from(data)
import Prelude
import Data.Array as A
import Data.Function.Uncurried (Fn2, runFn2)
import Data.Sequence as Seq
import Data.Set as Set
import Data.Traversable (traverse, traverse_)
import Effect (Effect)
import Effect.Uncurried (EffectFn1, EffectFn2, EffectFn3, EffectFn4, runEffectFn1, runEffectFn2, runEffectFn3, runEffectFn4)
import FFI.Simple ((..), (...), (.=))
import FFI.Simple ((...))
import Gargantext.Hooks.Sigmax.Types as Types
import Record as Record
import Prelude
-- | Type representing `graphology.graph`
foreign import data Graph :: Type
......@@ -56,7 +54,7 @@ removeNode :: Graph -> String -> Effect Unit
removeNode g nId = pure $ g ... "dropNode" $ [nId]
updateNode :: Graph -> Record Types.Node -> Effect Unit
-- | See Types.compareNodes
updateNode g node@{ id, borderColor, color, equilateral, hidden, highlighted, type: t } =
updateNode g { id, borderColor, color, equilateral, hidden, highlighted } =
runEffectFn3 _updateNode g id (\n -> n { borderColor = borderColor
, color = color
, equilateral = equilateral
......
......@@ -2,23 +2,16 @@ module Gargantext.Hooks.Sigmax.Louvain where
-- FFI for communities-louvain: https://graphology.github.io/standard-library/communities-louvain
import Prelude
import Data.Array as A
import Data.Map as Map
import Data.Sequence as Seq
import Data.Set as Set
import Data.Traversable (traverse)
import Data.Tuple (Tuple(..))
import Effect (Effect)
import Effect.Timer (setTimeout)
import Effect.Uncurried (EffectFn1, EffectFn2, EffectFn3, EffectFn4, runEffectFn1, runEffectFn2, runEffectFn3, runEffectFn4)
import FFI.Simple ((..), (...), (.=))
import Effect.Uncurried (EffectFn2, runEffectFn2)
import FFI.Simple ((..))
import Gargantext.Data.Louvain as DLouvain
import Gargantext.Hooks.Sigmax.Graphology as Graphology
import Gargantext.Hooks.Sigmax.Operators as Operators
import Gargantext.Hooks.Sigmax.Types as Types
import Record as Record
import Prelude
-- | Type representing the web worker.
foreign import data LouvainLayout :: Type
......
......@@ -2,19 +2,12 @@ module Gargantext.Hooks.Sigmax.Noverlap where
-- FFI for noverlap: https://graphology.github.io/standard-library/layout-noverlap.html
import Prelude
import Data.Array as A
import Data.Sequence as Seq
import Data.Set as Set
import Data.Traversable (traverse)
import Effect (Effect)
import Effect.Timer (setTimeout)
import Effect.Uncurried (EffectFn1, EffectFn2, EffectFn3, EffectFn4, runEffectFn1, runEffectFn2, runEffectFn3, runEffectFn4)
import FFI.Simple ((..), (...), (.=))
import Effect.Uncurried (EffectFn1, EffectFn2, runEffectFn1, runEffectFn2)
import FFI.Simple ((..))
import Gargantext.Hooks.Sigmax.Graphology as Graphology
import Gargantext.Hooks.Sigmax.Types as Types
import Record as Record
import Prelude
-- | Type representing the web worker.
foreign import data NoverlapLayout :: Type
......
......@@ -2,20 +2,9 @@ module Gargantext.Hooks.Sigmax.Operators where
-- FFI for operators: https://graphology.github.io/standard-library/operators
import Prelude
import Data.Array as A
import Data.Function.Uncurried (Fn1, runFn1)
import Data.Map as Map
import Data.Sequence as Seq
import Data.Set as Set
import Data.Traversable (traverse)
import Data.Tuple (Tuple(..))
import Effect (Effect)
import Gargantext.Data.Louvain as DLouvain
import Gargantext.Hooks.Sigmax.Graphology as Graphology
import Gargantext.Hooks.Sigmax.Types as Types
import Record as Record
foreign import _toUndirected :: Fn1 Graphology.Graph Graphology.Graph
......
module Gargantext.Hooks.Sigmax.Sigma where
import Prelude
import DOM.Simple.Types (Element, Window)
import Data.Array as A
import Data.Either (Either(..))
import Data.Function.Uncurried (Fn1, runFn1)
import Data.Maybe (Maybe)
import Data.Traversable (traverse_)
import Effect (Effect)
import Effect.Exception as EEx
import Effect.Timer (setTimeout)
import Effect.Uncurried (EffectFn1, EffectFn2, EffectFn3, EffectFn4, mkEffectFn1, runEffectFn1, runEffectFn2, runEffectFn3, runEffectFn4)
import FFI.Simple ((..), (...), (.=))
import Foreign.Object as Object
import Gargantext.Hooks.Sigmax.Graphology as Graphology
import Gargantext.Hooks.Sigmax.Types as Types
import Prelude
import Type.Row (class Union)
-- | Type representing a sigmajs instance
......
......@@ -2,26 +2,25 @@ module Gargantext.Hooks.Sigmax.Types where
import DOM.Simple.Types (Element)
import Data.Array as A
import Data.Generic.Rep (class Generic)
import Data.Eq.Generic (genericEq)
import Data.Generic.Rep (class Generic)
import Data.Hashable (class Hashable, hash)
import Data.Show.Generic (genericShow)
import Data.Map as Map
import Data.Maybe (Maybe(..), fromJust)
import Data.Sequence as Seq
import Data.Set as Set
import Data.Show.Generic (genericShow)
import Data.Traversable (class Traversable)
import Data.Tuple (Tuple(..))
import Effect (Effect)
import Partial.Unsafe (unsafePartial)
import Prelude (class Eq, class Show, map, ($), (&&), (==), (||), (<$>), (<), mod, not, pure, (<=))
import Record.Unsafe (unsafeGet, unsafeSet)
import Gargantext.Components.Bootstrap.Types (ComponentStatus(..))
import Gargantext.Components.GraphExplorer.GraphTypes as GEGT
import Gargantext.Data.Louvain as Louvain
import Gargantext.Types as GT
import Gargantext.Utils.Range as Range
import Partial.Unsafe (unsafePartial)
import Prelude (class Eq, class Show, ($), (&&), (==), (||), (<$>), mod, not, (<=))
import Record.Unsafe (unsafeGet, unsafeSet)
newtype Graph n e = Graph { edges :: Seq.Seq {|e}, nodes :: Seq.Seq {|n} }
......@@ -32,8 +31,9 @@ instance ( Eq (Record n)
, GT.Optional HashableNodeFields n
, GT.Optional HashableEdgeFields e) => Eq (Graph n e) where
--eq = genericEq
eq g1@(Graph { edges: e1, nodes: n1 }) g2@(Graph { edges: e2, nodes: n2 }) =
-- eq g1@(Graph { edges: e1, nodes: n1 }) g2@(Graph { edges: e2, nodes: n2 }) =
-- (Seq.length e1 == Seq.length e2) && (Seq.length n1 == Seq.length n2)
eq g1 g2 =
compareGraphEdges g1 g2 &&
compareGraphNodes g1 g2
......@@ -324,8 +324,7 @@ louvainGraph :: SGraph -> Louvain.LouvainCluster -> SGraph
louvainGraph g cluster = Graph {nodes: newNodes, edges: graphEdges g}
where
newNodes = (nodeClusterColor cluster) <$> (graphNodes g)
nm = nodesMap newNodes
newEdges = (edgeClusterColor cluster nm) <$> (graphEdges g)
-- newEdges = (edgeClusterColor cluster nm) <$> (graphEdges g)
--edgeClusterColor _cluster nm e = e { color = sourceNode.color, sourceNode = sourceNode, targetNode = targetNode }
edgeClusterColor _cluster nm e = e { color = sourceNode.color }
......@@ -333,9 +332,9 @@ edgeClusterColor _cluster nm e = e { color = sourceNode.color }
sourceNode = case Map.lookup e.source nm of
Just sn -> sn
Nothing -> e.sourceNode
targetNode = case Map.lookup e.target nm of
Just tn -> tn
Nothing -> e.targetNode
-- targetNode = case Map.lookup e.target nm of
-- Just tn -> tn
-- Nothing -> e.targetNode
nodeClusterColor cluster n = n { color = newColor }
where
......
......@@ -15,19 +15,18 @@ import Data.Map as Map
import Data.Maybe (Maybe(..), fromMaybe)
import Effect (Effect)
import Effect.Aff (Aff)
import Reactix as R
import Simple.JSON as JSON
import Toestand as T
import Web.Storage.Storage (getItem, removeItem, setItem)
import Gargantext.Prelude
import Gargantext.Components.Login.Types (AuthData(..), AuthInvalid(..), AuthRequest(..), AuthResponse(..))
import Gargantext.Components.Login.Types (AuthData(..), AuthRequest(..))
import Gargantext.Components.Nodes.Lists.Types as NT
import Gargantext.Config.REST as REST
import Gargantext.Ends (class ToUrl, Backend, toUrl)
import Gargantext.Prelude
import Gargantext.Sessions.Types (Session(..), Sessions(..), OpenNodes, NodeId, mkNodeId, sessionUrl, sessionId, empty, null, unSessions, lookup, cons, tryCons, update, remove, tryRemove)
import Gargantext.Utils.Reactix as R2
import Reactix as R
import Simple.JSON as JSON
import Toestand as T
import Web.Storage.Storage (getItem, removeItem, setItem)
type WithSession c =
( session :: Session
......@@ -62,7 +61,7 @@ act ss (Login s) =
case tryCons s ss of
Right new -> pure new
_ -> pure ss <* log2 "Cannot overwrite existing session: " (sessionId s)
act old@(Sessions ss) (Logout s) =
act old (Logout s) =
case tryRemove (sessionId s) old of
Right new -> pure $ new
_ -> pure old <* log2 "Logged out of stale session:" (sessionId s)
......
......@@ -6,8 +6,6 @@ module Gargantext.Sessions.Types
, cleanBackendUrl
) where
import Gargantext.Prelude
import Data.Array as A
import Data.Either (Either(..))
import Data.Eq.Generic (genericEq)
......@@ -28,6 +26,7 @@ import Foreign.Object as Object
import Gargantext.Components.Login.Types (TreeId, UserId)
import Gargantext.Components.Nodes.Lists.Types as NT
import Gargantext.Ends (class ToUrl, Backend(..), backendUrl, sessionPath)
import Gargantext.Prelude
import Gargantext.Routes (SessionRoute)
import Gargantext.Types (NodePath, SessionId(..), nodePath)
import Gargantext.Utils.JSON as GJSON
......@@ -135,7 +134,7 @@ remove sid (Sessions {sessions:ss}) = Sessions {sessions: Seq.filter f ss} where
f s = sid /= sessionId s
tryRemove :: SessionId -> Sessions -> Either Unit Sessions
tryRemove sid old@(Sessions ss) = ret where
tryRemove sid old = ret where
new = remove sid old
ret
| new == old = Left unit
......
module Gargantext.Utils where
import Prelude
import Data.Array as A
import Data.Char (fromCharCode)
import Data.Either (Either(..))
import Data.Foldable (class Foldable, foldr)
import Data.Foldable (class Foldable)
import Data.Lens (Lens', lens)
import Data.Maybe (Maybe(..), fromJust)
import Data.Maybe (fromJust)
import Data.Newtype (class Newtype, unwrap, wrap)
--import Data.Sequence.Ordered as OSeq
import Data.Set (Set)
import Data.Set as Set
import Data.String as S
......@@ -17,6 +14,7 @@ import Data.String.CodeUnits (singleton, slice)
import Data.Unfoldable (class Unfoldable)
import Effect (Effect)
import Partial.Unsafe (unsafePartial)
import Prelude
import Web.HTML as WHTML
import Web.HTML.Location as WHL
import Web.HTML.Window (location)
......
module Gargantext.Utils.Debug where
import Data.Array as A
import Data.Foldable (foldr)
import Data.Maybe (Maybe(..))
import Data.Ord as Ord
import Effect (Effect)
import Effect.Uncurried (EffectFn1, runEffectFn1)
import Gargantext.Prelude
foreign import _debugger :: EffectFn1 Unit Unit
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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