[refactoring] remove unused imports, simplify components a bit

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