Commit 6bc4257d authored by Przemyslaw Kaminski's avatar Przemyslaw Kaminski

[refactor] some code cleanup

parent 2574713c
...@@ -44,7 +44,7 @@ let ...@@ -44,7 +44,7 @@ let
repl = pkgs.writeShellScriptBin "repl" '' repl = pkgs.writeShellScriptBin "repl" ''
#!/usr/bin/env bash #!/usr/bin/env bash
pulp repl spago repl
''; '';
test-ps = pkgs.writeShellScriptBin "test-ps" '' test-ps = pkgs.writeShellScriptBin "test-ps" ''
......
...@@ -70,7 +70,7 @@ annotatedFieldInner p = R.createElement annotatedFieldInnerCpt p [] ...@@ -70,7 +70,7 @@ annotatedFieldInner p = R.createElement annotatedFieldInnerCpt p []
annotatedFieldInnerCpt :: R.Component InnerProps annotatedFieldInnerCpt :: R.Component InnerProps
annotatedFieldInnerCpt = here.component "annotatedFieldInner" cpt where annotatedFieldInnerCpt = here.component "annotatedFieldInner" cpt where
cpt { menuRef, ngrams, redrawMenu, setTermList, text: fieldText } _ = do cpt { menuRef, ngrams, redrawMenu, setTermList, text: fieldText } _ = do
redrawMenu' <- T.useLive T.unequal redrawMenu _redrawMenu' <- T.useLive T.unequal redrawMenu
-- menu <- T.useBox (Nothing :: Maybe (Record AnnotationMenu)) -- menu <- T.useBox (Nothing :: Maybe (Record AnnotationMenu))
...@@ -109,7 +109,7 @@ onAnnotationSelect { menuRef, ngrams, redrawMenu, setTermList } Nothing event = ...@@ -109,7 +109,7 @@ onAnnotationSelect { menuRef, ngrams, redrawMenu, setTermList } Nothing event =
, redrawMenu , redrawMenu
, setTermList } , setTermList }
Nothing -> hideMenu { menuRef, redrawMenu } Nothing -> hideMenu { menuRef, redrawMenu }
onAnnotationSelect { menuRef, ngrams, redrawMenu, setTermList } (Just (Tuple ngram list)) event = do onAnnotationSelect { menuRef, redrawMenu, setTermList } (Just (Tuple ngram list)) event = do
showMenu { event showMenu { event
, getList: const (Just list) , getList: const (Just list)
, menuRef , menuRef
......
...@@ -7,7 +7,6 @@ import Data.Generic.Rep (class Generic) ...@@ -7,7 +7,6 @@ import Data.Generic.Rep (class Generic)
import Data.Eq.Generic (genericEq) import Data.Eq.Generic (genericEq)
import Data.Maybe (Maybe(..)) import Data.Maybe (Maybe(..))
import Effect (Effect) import Effect (Effect)
import Effect.Uncurried (mkEffectFn1)
import Reactix as R import Reactix as R
import Reactix.DOM.HTML as HTML import Reactix.DOM.HTML as HTML
import Toestand as T import Toestand as T
......
module Gargantext.Components.Charts.Options.Series where module Gargantext.Components.Charts.Options.Series where
import Data.Argonaut (class DecodeJson, class EncodeJson, decodeJson, encodeJson, (.:), (~>), (:=))
import Data.Argonaut.Core (jsonEmptyObject)
import Data.Array (foldl) import Data.Array (foldl)
import Data.Generic.Rep (class Generic) import Data.Generic.Rep (class Generic)
import Data.Maybe (Maybe(..), maybe) import Data.Maybe (Maybe(..), maybe)
import Data.Newtype (class Newtype) import Data.Newtype (class Newtype)
import Data.Symbol (SProxy(..)) import Data.Symbol (SProxy(..))
import Gargantext.Components.Charts.Options.Data (DataD1, DataD2) import Gargantext.Components.Charts.Options.Data (DataD1, DataD2)
import Gargantext.Components.Charts.Options.Data (DataD1, DataD2)
import Gargantext.Components.Charts.Options.Font (ItemStyle, Tooltip)
import Gargantext.Components.Charts.Options.Font (ItemStyle, Tooltip) import Gargantext.Components.Charts.Options.Font (ItemStyle, Tooltip)
import Gargantext.Components.Charts.Options.Legend (SelectedMode) import Gargantext.Components.Charts.Options.Legend (SelectedMode)
import Gargantext.Prelude
import Gargantext.Types (class Optional) import Gargantext.Types (class Optional)
import Prelude (class Eq, class Show, bind, map, pure, show, ($), (+), (<<<), (<>), eq) import Prelude (class Eq, class Show, bind, map, pure, show, ($), (+), (<<<), (<>))
import Record as Record import Record as Record
import Record.Unsafe (unsafeSet) import Record.Unsafe (unsafeSet)
import Simple.JSON as JSON import Simple.JSON as JSON
......
module Gargantext.Components.CodeEditor where module Gargantext.Components.CodeEditor where
import DOM.Simple.Types (Element)
import Data.Argonaut.Parser (jsonParser) import Data.Argonaut.Parser (jsonParser)
import Data.Either (either, Either(..)) import Data.Either (either, Either(..))
import Data.Generic.Rep (class Generic) import Data.Generic.Rep (class Generic)
...@@ -9,6 +8,7 @@ import Data.Show.Generic (genericShow) ...@@ -9,6 +8,7 @@ import Data.Show.Generic (genericShow)
import Data.Maybe (Maybe(..)) import Data.Maybe (Maybe(..))
import Data.Nullable (Nullable, null, toMaybe) import Data.Nullable (Nullable, null, toMaybe)
import Data.String.Utils (endsWith) import Data.String.Utils (endsWith)
import DOM.Simple.Types (Element)
import Effect (Effect) import Effect (Effect)
import FFI.Simple ((.=)) import FFI.Simple ((.=))
import Reactix as R import Reactix as R
...@@ -355,7 +355,7 @@ initControls code defaultCodeType = do ...@@ -355,7 +355,7 @@ initControls code defaultCodeType = do
} }
reinitControls :: Record Controls -> Code -> CodeType -> Effect Unit reinitControls :: Record Controls -> Code -> CodeType -> Effect Unit
reinitControls c@{ codeType, codeS, error } code defaultCodeType = do reinitControls { codeType, codeS, error } code defaultCodeType = do
T.write_ defaultCodeType codeType T.write_ defaultCodeType codeType
T.write_ code codeS T.write_ code codeS
T.write_ Nothing error T.write_ Nothing error
...@@ -65,7 +65,7 @@ contextMenuCpt = here.component "contextMenu" cpt ...@@ -65,7 +65,7 @@ contextMenuCpt = here.component "contextMenu" cpt
, style: position menu rect , style: position menu rect
, data: { placement: "right", toggle: "popover" } , data: { placement: "right", toggle: "popover" }
} }
elems ref menu Nothing = HTML.div elems ref _menu Nothing = HTML.div
{ ref { ref
, key: "context-menu" , key: "context-menu"
, className: "context-menu" , className: "context-menu"
...@@ -98,7 +98,7 @@ documentClickHandler onClose menu = ...@@ -98,7 +98,7 @@ documentClickHandler onClose menu =
documentScrollHandler :: Effect Unit -> Callback DE.MouseEvent documentScrollHandler :: Effect Unit -> Callback DE.MouseEvent
documentScrollHandler onClose = documentScrollHandler onClose =
R2.named "hideMenuOnScroll" $ callback $ \e -> onClose R2.named "hideMenuOnScroll" $ callback $ \_ -> onClose
position :: forall t. Record (Props t) -> DOMRect -> { left :: Number, top :: Number } position :: forall t. Record (Props t) -> DOMRect -> { left :: Number, top :: Number }
position mouse {width: menuWidth, height: menuHeight} = {left, top} position mouse {width: menuWidth, height: menuHeight} = {left, top}
......
...@@ -194,13 +194,13 @@ searchBarCpt = here.component "searchBar" cpt ...@@ -194,13 +194,13 @@ searchBarCpt = here.component "searchBar" cpt
searchButton query queryText' = searchButton query queryText' =
H.button { className: "btn btn-primary" H.button { className: "btn btn-primary"
, on: { click: \e -> T.write_ queryText' query } , on: { click: \_ -> T.write_ queryText' query }
, type: "submit" } , type: "submit" }
[ H.span {className: "fa fa-search"} [] ] [ H.span {className: "fa fa-search"} [] ]
clearButton query = clearButton query =
H.button { className: "btn btn-danger" H.button { className: "btn btn-danger"
, on: { click: \e -> T.write_ "" query } } , on: { click: \_ -> T.write_ "" query } }
[ H.span {className: "fa fa-times"} [] ] [ H.span {className: "fa fa-times"} [] ]
mock :: Boolean mock :: Boolean
...@@ -274,7 +274,7 @@ pageLayoutCpt = here.component "pageLayout" cpt where ...@@ -274,7 +274,7 @@ pageLayoutCpt = here.component "pageLayout" cpt where
let path = { listId, mCorpusId, nodeId, params, query, tabType, yearFilter: yearFilter' } let path = { listId, mCorpusId, nodeId, params, query, tabType, yearFilter: yearFilter' }
handleResponse :: HashedResponse (TableResult Response) -> Tuple Int (Array DocumentsView) handleResponse :: HashedResponse (TableResult Response) -> Tuple Int (Array DocumentsView)
handleResponse (HashedResponse { hash, value: res }) = ret handleResponse (HashedResponse { value: res }) = ret
where where
filters = filterDocs query filters = filterDocs query
......
...@@ -336,14 +336,14 @@ pageCpt = here.component "page" cpt ...@@ -336,14 +336,14 @@ pageCpt = here.component "page" cpt
let isDeleted (DocumentsView {id}) = Set.member id deletions'.deleted let isDeleted (DocumentsView {id}) = Set.member id deletions'.deleted
rows path' = case rowsLoaded of rows = case rowsLoaded of
Docs {docs} -> docRow path' <$> Seq.filter (not <<< isDeleted) docs Docs {docs} -> docRow path' <$> Seq.filter (not <<< isDeleted) docs
Contacts {contacts} -> contactRow path' <$> contacts Contacts {contacts} -> contactRow path' <$> contacts
pure $ T.table { colNames pure $ T.table { colNames
, container , container
, params , params
, rows: rows path' , rows
, syncResetButton : [ H.div {} [] ] , syncResetButton : [ H.div {} [] ]
, totalRecords , totalRecords
, wrapColElts , wrapColElts
......
...@@ -306,9 +306,9 @@ performAction = performAction' where ...@@ -306,9 +306,9 @@ performAction = performAction' where
deleteNode' nt p@{ nodeId: id, parentId: parent_id, session } = do deleteNode' nt p@{ nodeId: id, parentId: parent_id, session } = do
case nt of case nt of
NodePublic FolderPublic -> void $ deleteNode session nt id NodePublic FolderPublic -> void $ deleteNode session id
NodePublic _ -> void $ unpublishNode session (Just parent_id) id NodePublic _ -> void $ unpublishNode session (Just parent_id) id
_ -> void $ deleteNode session nt id _ -> void $ deleteNode session id
refreshFolders p refreshFolders p
doSearch task { boxes: { tasks }, nodeId: id } = liftEffect $ do doSearch task { boxes: { tasks }, nodeId: id } = liftEffect $ do
......
...@@ -3,7 +3,6 @@ module Gargantext.Components.FolderView.Box where ...@@ -3,7 +3,6 @@ module Gargantext.Components.FolderView.Box where
import Gargantext.Prelude import Gargantext.Prelude
import DOM.Simple as DOM import DOM.Simple as DOM
import Data.Maybe (Maybe(..))
import Effect (Effect) import Effect (Effect)
import Gargantext.Components.Forest.Tree.Node.Settings (SettingsBox(..), settingsBox) import Gargantext.Components.Forest.Tree.Node.Settings (SettingsBox(..), settingsBox)
import Gargantext.Components.Forest.Tree.Node.Tools (prettyNodeType) import Gargantext.Components.Forest.Tree.Node.Tools (prettyNodeType)
...@@ -13,7 +12,6 @@ import Gargantext.Utils.Glyphicon (glyphicon) ...@@ -13,7 +12,6 @@ import Gargantext.Utils.Glyphicon (glyphicon)
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
here :: R2.Here here :: R2.Here
here = R2.here "Gargantext.Components.FolderView.Box" here = R2.here "Gargantext.Components.FolderView.Box"
...@@ -30,7 +28,7 @@ nodePopupView props = R.createElement nodePopupCpt props [] ...@@ -30,7 +28,7 @@ nodePopupView props = R.createElement nodePopupCpt props []
nodePopupCpt :: R.Component NodePopupProps nodePopupCpt :: R.Component NodePopupProps
nodePopupCpt = here.component "nodePopupView" cpt where nodePopupCpt = here.component "nodePopupView" cpt where
cpt props@{ id, name, nodeType } _ = do cpt props _ = do
pure $ H.div tooltipProps pure $ H.div tooltipProps
[ H.div { className: "popup-container" } [ H.div { className: "popup-container" }
...@@ -43,7 +41,7 @@ nodePopupCpt = here.component "nodePopupView" cpt where ...@@ -43,7 +41,7 @@ nodePopupCpt = here.component "nodePopupView" cpt where
tooltipProps = { id: "node-popup-tooltip", title: "Node settings" tooltipProps = { id: "node-popup-tooltip", title: "Node settings"
, data: { toggle: "tooltip", placement: "right" } } , data: { toggle: "tooltip", placement: "right" } }
panelHeading props@{id, name, nodeType } = panelHeading props@{ nodeType } =
H.div { className: "card-header" } H.div { className: "card-header" }
[ R2.row [ R2.row
[ H.div { className: "col-4" } [ H.div { className: "col-4" }
...@@ -54,4 +52,4 @@ nodePopupCpt = here.component "nodePopupView" cpt where ...@@ -54,4 +52,4 @@ nodePopupCpt = here.component "nodePopupView" cpt where
, H.div { className: "col-1" } , H.div { className: "col-1" }
[ H.a { type: "button", on: { click: closePopover props }, title: "Close" [ H.a { type: "button", on: { click: closePopover props }, title: "Close"
, className: glyphicon "window-close" } [] ]]] where , className: glyphicon "window-close" } [] ]]] where
SettingsBox { edit, doc, buttons } = settingsBox nodeType SettingsBox _ = settingsBox nodeType
...@@ -223,13 +223,13 @@ refreshTree p@{ reloadTree } = liftEffect $ T2.reload reloadTree *> closePopover ...@@ -223,13 +223,13 @@ refreshTree p@{ reloadTree } = liftEffect $ T2.reload reloadTree *> closePopover
deleteNode' nt p@{ boxes: { forestOpen }, session, tree: (NTree (LNode {id, parent_id}) _) } = do deleteNode' nt p@{ boxes: { forestOpen }, session, tree: (NTree (LNode {id, parent_id}) _) } = do
case nt of case nt of
GT.NodePublic GT.FolderPublic -> void $ deleteNode session nt id GT.NodePublic GT.FolderPublic -> void $ deleteNode session id
GT.NodePublic _ -> void $ unpublishNode session parent_id id GT.NodePublic _ -> void $ unpublishNode session parent_id id
_ -> void $ deleteNode session nt id _ -> void $ deleteNode session id
liftEffect $ T.modify_ (openNodesDelete (mkNodeId session id)) forestOpen liftEffect $ T.modify_ (openNodesDelete (mkNodeId session id)) forestOpen
refreshTree p refreshTree p
doSearch task p@{ boxes: { tasks }, tree: NTree (LNode {id}) _ } = liftEffect $ do doSearch task { boxes: { tasks }, tree: NTree (LNode {id}) _ } = liftEffect $ do
GAT.insert id task tasks GAT.insert id task tasks
here.log2 "[doSearch] DoSearch task:" task here.log2 "[doSearch] DoSearch task:" task
...@@ -244,7 +244,7 @@ renameNode name p@{ boxes: { errors }, session, tree: (NTree (LNode {id}) _) } = ...@@ -244,7 +244,7 @@ renameNode name p@{ boxes: { errors }, session, tree: (NTree (LNode {id}) _) } =
handleRESTError errors eTask $ \_task -> pure unit handleRESTError errors eTask $ \_task -> pure unit
refreshTree p refreshTree p
shareTeam username p@{ boxes: { errors }, session, tree: (NTree (LNode {id}) _)} = do shareTeam username { boxes: { errors }, session, tree: (NTree (LNode {id}) _)} = do
eTask <- Share.shareReq session id $ Share.ShareTeamParams { username } eTask <- Share.shareReq session id $ Share.ShareTeamParams { username }
handleRESTError errors eTask $ \_task -> pure unit handleRESTError errors eTask $ \_task -> pure unit
...@@ -255,7 +255,7 @@ sharePublic params p@{ boxes: { errors, forestOpen }, session } = traverse_ f pa ...@@ -255,7 +255,7 @@ sharePublic params p@{ boxes: { errors, forestOpen }, session } = traverse_ f pa
liftEffect $ T.modify_ (openNodesInsert (mkNodeId p.session out)) forestOpen liftEffect $ T.modify_ (openNodesInsert (mkNodeId p.session out)) forestOpen
refreshTree p refreshTree p
addContact params p@{ boxes: { errors }, session, tree: (NTree (LNode {id}) _) } = do addContact params { boxes: { errors }, session, tree: (NTree (LNode {id}) _) } = do
eTask <- Contact.contactReq session id params eTask <- Contact.contactReq session id params
handleRESTError errors eTask $ \_task -> pure unit handleRESTError errors eTask $ \_task -> pure unit
...@@ -265,13 +265,13 @@ addNode' name nodeType p@{ boxes: { errors, forestOpen }, session, tree: (NTree ...@@ -265,13 +265,13 @@ addNode' name nodeType p@{ boxes: { errors, forestOpen }, session, tree: (NTree
liftEffect $ T.modify_ (openNodesInsert (mkNodeId session id)) forestOpen liftEffect $ T.modify_ (openNodesInsert (mkNodeId session id)) forestOpen
refreshTree p refreshTree p
uploadFile' nodeType fileType mName contents p@{ boxes: { errors, tasks }, session, tree: (NTree (LNode { id }) _) } = do uploadFile' nodeType fileType mName contents { boxes: { errors, tasks }, session, tree: (NTree (LNode { id }) _) } = do
eTask <- uploadFile { contents, fileType, id, mName, nodeType, session } eTask <- uploadFile { contents, fileType, id, mName, nodeType, session }
handleRESTError errors eTask $ \task -> liftEffect $ do handleRESTError errors eTask $ \task -> liftEffect $ do
GAT.insert id task tasks GAT.insert id task tasks
here.log2 "[uploadFile'] UploadFile, uploaded, task:" task here.log2 "[uploadFile'] UploadFile, uploaded, task:" task
uploadArbitraryFile' mName blob p@{ boxes: { errors, tasks }, session, tree: (NTree (LNode { id }) _) } = do uploadArbitraryFile' mName blob { boxes: { errors, tasks }, session, tree: (NTree (LNode { id }) _) } = do
eTask <- uploadArbitraryFile session id { blob, mName } eTask <- uploadArbitraryFile session id { blob, mName }
handleRESTError errors eTask $ \task -> liftEffect $ do handleRESTError errors eTask $ \task -> liftEffect $ do
GAT.insert id task tasks GAT.insert id task tasks
......
...@@ -112,7 +112,7 @@ nodeMainSpanCpt = here.component "nodeMainSpan" cpt ...@@ -112,7 +112,7 @@ nodeMainSpanCpt = here.component "nodeMainSpan" cpt
pure $ H.span (dropProps droppedFile droppedFile' isDragOver isDragOver') pure $ H.span (dropProps droppedFile droppedFile' isDragOver isDragOver')
$ reverseHanded handed' $ reverseHanded handed'
[ folderIcon { folderOpen, nodeType } [] [ folderIcon { folderOpen, nodeType } []
, chevronIcon { folderOpen, handed, isLeaf, nodeType } [] , chevronIcon { folderOpen, handed, isLeaf } []
, nodeLink { boxes , nodeLink { boxes
, folderOpen , folderOpen
, frontends , frontends
...@@ -200,14 +200,14 @@ nodeMainSpanCpt = here.component "nodeMainSpan" cpt ...@@ -200,14 +200,14 @@ nodeMainSpanCpt = here.component "nodeMainSpan" cpt
{ className: "leaf " <> (dropClass droppedFile' isDragOver') { className: "leaf " <> (dropClass droppedFile' isDragOver')
, on: { dragLeave: onDragLeave isDragOver , on: { dragLeave: onDragLeave isDragOver
, dragOver: onDragOverHandler isDragOver , dragOver: onDragOverHandler isDragOver
, drop: dropHandler droppedFile } , drop: dropHandler }
} }
where where
dropClass (Just _) _ = "file-dropped" dropClass (Just _) _ = "file-dropped"
dropClass _ true = "file-dropped" dropClass _ true = "file-dropped"
dropClass Nothing _ = "" dropClass Nothing _ = ""
dropHandler droppedFile e = do dropHandler e = do
-- prevent redirection when file is dropped -- prevent redirection when file is dropped
E.preventDefault e E.preventDefault e
E.stopPropagation e E.stopPropagation e
...@@ -247,7 +247,6 @@ type ChevronIconProps = ( ...@@ -247,7 +247,6 @@ type ChevronIconProps = (
folderOpen :: T.Box Boolean folderOpen :: T.Box Boolean
, handed :: T.Box GT.Handed , handed :: T.Box GT.Handed
, isLeaf :: Boolean , isLeaf :: Boolean
, nodeType :: GT.NodeType
) )
chevronIcon :: R2.Component ChevronIconProps chevronIcon :: R2.Component ChevronIconProps
...@@ -255,9 +254,9 @@ chevronIcon = R.createElement chevronIconCpt ...@@ -255,9 +254,9 @@ chevronIcon = R.createElement chevronIconCpt
chevronIconCpt :: R.Component ChevronIconProps chevronIconCpt :: R.Component ChevronIconProps
chevronIconCpt = here.component "chevronIcon" cpt chevronIconCpt = here.component "chevronIcon" cpt
where where
cpt { folderOpen, handed, isLeaf: true, nodeType } _ = do cpt { isLeaf: true } _ = do
pure $ H.div {} [] pure $ H.div {} []
cpt { folderOpen, handed, isLeaf: false, nodeType } _ = do cpt { folderOpen, handed, isLeaf: false } _ = do
handed' <- T.useLive T.unequal handed handed' <- T.useLive T.unequal handed
open <- T.useLive T.unequal folderOpen open <- T.useLive T.unequal folderOpen
pure $ H.a { className: "chevron-icon" pure $ H.a { className: "chevron-icon"
......
...@@ -77,8 +77,6 @@ addNodeView = R.createElement addNodeViewCpt ...@@ -77,8 +77,6 @@ addNodeView = R.createElement addNodeViewCpt
addNodeViewCpt :: R.Component CreateNodeProps addNodeViewCpt :: R.Component CreateNodeProps
addNodeViewCpt = here.component "addNodeView" cpt where addNodeViewCpt = here.component "addNodeView" cpt where
cpt { dispatch cpt { dispatch
, id
, name
, nodeTypes } _ = do , nodeTypes } _ = do
nodeName <- T.useBox "Name" nodeName <- T.useBox "Name"
nodeName' <- T.useLive T.unequal nodeName nodeName' <- T.useLive T.unequal nodeName
......
...@@ -23,8 +23,8 @@ here = R2.here "Gargantext.Components.Forest.Tree.Node.Action.Delete" ...@@ -23,8 +23,8 @@ here = R2.here "Gargantext.Components.Forest.Tree.Node.Action.Delete"
-- TODO Delete with asyncTaskWithType -- TODO Delete with asyncTaskWithType
deleteNode :: Session -> NodeType -> GT.ID -> Aff (Either RESTError GT.ID) deleteNode :: Session -> GT.ID -> Aff (Either RESTError GT.ID)
deleteNode session nt nodeId = delete session $ NodeAPI GT.Node (Just nodeId) "" deleteNode session nodeId = delete session $ NodeAPI GT.Node (Just nodeId) ""
{- {-
case nt of case nt of
......
...@@ -77,5 +77,5 @@ actionDownloadOther :: R2.Component ActionDownload ...@@ -77,5 +77,5 @@ actionDownloadOther :: R2.Component ActionDownload
actionDownloadOther = R.createElement actionDownloadOtherCpt actionDownloadOther = R.createElement actionDownloadOtherCpt
actionDownloadOtherCpt :: R.Component ActionDownload actionDownloadOtherCpt :: R.Component ActionDownload
actionDownloadOtherCpt = here.component "actionDownloadOther" cpt where actionDownloadOtherCpt = here.component "actionDownloadOther" cpt where
cpt { id, session } _ = do cpt _ _ = do
pure $ fragmentPT $ "Soon, you will be able to download your file here " pure $ fragmentPT $ "Soon, you will be able to download your file here "
...@@ -7,7 +7,6 @@ import Effect (Effect) ...@@ -7,7 +7,6 @@ import Effect (Effect)
import Effect.Aff (Aff, launchAff) import Effect.Aff (Aff, launchAff)
import Gargantext.Components.App.Data (Boxes) import Gargantext.Components.App.Data (Boxes)
import Gargantext.Components.Forest.Tree.Node.Action (Action(..)) import Gargantext.Components.Forest.Tree.Node.Action (Action(..))
import Gargantext.Components.Forest.Tree.Node.Action.Add (NodePopup)
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.Lang (allLangs) import Gargantext.Components.Lang (allLangs)
...@@ -27,7 +26,6 @@ type Props = ...@@ -27,7 +26,6 @@ type Props =
( boxes :: Boxes ( boxes :: Boxes
, dispatch :: Action -> Aff Unit , dispatch :: Action -> Aff Unit
, id :: Maybe ID , id :: Maybe ID
, nodePopup :: Maybe NodePopup
, session :: Session ) , session :: Session )
-- | Action : Search -- | Action : Search
...@@ -36,24 +34,23 @@ actionSearch = R.createElement actionSearchCpt ...@@ -36,24 +34,23 @@ actionSearch = R.createElement actionSearchCpt
actionSearchCpt :: R.Component Props actionSearchCpt :: R.Component Props
actionSearchCpt = here.component "actionSearch" cpt actionSearchCpt = here.component "actionSearch" cpt
where where
cpt { boxes: { errors }, dispatch, id, nodePopup, session } _ = do cpt { boxes: { errors }, dispatch, id, session } _ = do
search <- T.useBox $ defaultSearch { node_id = id } search <- T.useBox $ defaultSearch { node_id = id }
pure $ R.fragment [ H.p { className: "action-search" } pure $ R.fragment [ H.p { className: "action-search" }
[ H.text $ "Search and create a private " [ H.text $ "Search and create a private "
<> "corpus with the search query as corpus name." ] <> "corpus with the search query as corpus name." ]
, searchBar { errors , searchBar { errors
, langs: allLangs , langs: allLangs
, onSearch: searchOn dispatch nodePopup , onSearch: searchOn dispatch
, search , search
, session , session
} [] } []
] ]
where where
searchOn :: (Action -> Aff Unit) searchOn :: (Action -> Aff Unit)
-> Maybe NodePopup
-> GT.AsyncTaskWithType -> GT.AsyncTaskWithType
-> Effect Unit -> Effect Unit
searchOn dispatch' p task = do searchOn dispatch' task = do
_ <- launchAff $ dispatch' (DoSearch task) _ <- launchAff $ dispatch' (DoSearch task)
-- close popup -- close popup
_ <- launchAff $ dispatch' ClosePopover _ <- launchAff $ dispatch' ClosePopover
......
...@@ -9,7 +9,6 @@ import Data.Show.Generic (genericShow) ...@@ -9,7 +9,6 @@ import Data.Show.Generic (genericShow)
import Data.Maybe (Maybe(..)) import Data.Maybe (Maybe(..))
import Data.Nullable (Nullable) import Data.Nullable (Nullable)
import Data.Tuple (Tuple(..)) import Data.Tuple (Tuple(..))
import Data.Tuple.Nested ((/\))
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
...@@ -44,7 +43,6 @@ type SearchIFramesProps = ( ...@@ -44,7 +43,6 @@ type SearchIFramesProps = (
searchIframes :: R2.Component SearchIFramesProps searchIframes :: R2.Component SearchIFramesProps
searchIframes = R.createElement searchIframesCpt searchIframes = R.createElement searchIframesCpt
searchIframesCpt :: R.Component SearchIFramesProps searchIframesCpt :: R.Component SearchIFramesProps
searchIframesCpt = here.component "searchIframes" cpt searchIframesCpt = here.component "searchIframes" cpt
where where
...@@ -67,7 +65,6 @@ type IFrameProps = ( ...@@ -67,7 +65,6 @@ type IFrameProps = (
divIframe :: R2.Component IFrameProps divIframe :: R2.Component IFrameProps
divIframe = R.createElement divIframeCpt divIframe = R.createElement divIframeCpt
divIframeCpt :: R.Component IFrameProps divIframeCpt :: R.Component IFrameProps
divIframeCpt = here.component "divIframe" cpt divIframeCpt = here.component "divIframe" cpt
where where
...@@ -82,7 +79,6 @@ frameUrl Searx = "https://searx.frame.gargantext.org" -- 192.168.1.4:8080" ...@@ -82,7 +79,6 @@ frameUrl Searx = "https://searx.frame.gargantext.org" -- 192.168.1.4:8080"
iframeWith :: R2.Component IFrameProps iframeWith :: R2.Component IFrameProps
iframeWith = R.createElement iframeWithCpt iframeWith = R.createElement iframeWithCpt
iframeWithCpt :: R.Component IFrameProps iframeWithCpt :: R.Component IFrameProps
iframeWithCpt = here.component "iframeWith" cpt iframeWithCpt = here.component "iframeWith" cpt
where where
......
...@@ -7,7 +7,6 @@ import Data.Maybe (Maybe(..), maybe, fromMaybe) ...@@ -7,7 +7,6 @@ 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.Tuple.Nested ((/\))
import Effect (Effect) import Effect (Effect)
import Effect.Aff (launchAff_) import Effect.Aff (launchAff_)
import Effect.Class (liftEffect) import Effect.Class (liftEffect)
...@@ -61,7 +60,7 @@ searchFieldCpt = here.component "searchField" cpt ...@@ -61,7 +60,7 @@ searchFieldCpt = here.component "searchField" cpt
-- then -- then
-- H.div {}[] -- H.div {}[]
-- else -- else
, H.div {} [ dataFieldNav { datafields: dataFields, search } [] , H.div {} [ dataFieldNav { search } []
, if isExternal search'.datafield , if isExternal search'.datafield
then databaseInput { databases: props.databases, search } [] then databaseInput { databases: props.databases, search } []
...@@ -128,11 +127,10 @@ componentIMTCpt = here.component "componentIMT" cpt ...@@ -128,11 +127,10 @@ componentIMTCpt = here.component "componentIMT" cpt
componentCNRS :: R2.Component ComponentProps componentCNRS :: R2.Component ComponentProps
componentCNRS = R.createElement componentCNRSCpt componentCNRS = R.createElement componentCNRSCpt
componentCNRSCpt :: R.Component ComponentProps componentCNRSCpt :: R.Component ComponentProps
componentCNRSCpt = here.component "componentCNRS" cpt componentCNRSCpt = here.component "componentCNRS" cpt
where where
cpt { search } _ = do cpt _ _ = do
pure $ R.fragment [ pure $ R.fragment [
H.div {} [] H.div {} []
--, filterInput fi --, filterInput fi
...@@ -261,15 +259,14 @@ langNavCpt = here.component "langNav" cpt ...@@ -261,15 +259,14 @@ langNavCpt = here.component "langNav" cpt
------------------------------------------------------------------------ ------------------------------------------------------------------------
type DataFieldNavProps = type DataFieldNavProps =
( datafields :: Array DataField ( search :: T.Box Search )
, search :: T.Box Search )
dataFieldNav :: R2.Component DataFieldNavProps dataFieldNav :: R2.Component DataFieldNavProps
dataFieldNav = R.createElement dataFieldNavCpt dataFieldNav = R.createElement dataFieldNavCpt
dataFieldNavCpt :: R.Component DataFieldNavProps dataFieldNavCpt :: R.Component DataFieldNavProps
dataFieldNavCpt = here.component "dataFieldNav" cpt dataFieldNavCpt = here.component "dataFieldNav" cpt
where where
cpt { datafields, search } _ = do cpt { search } _ = do
search'@{ datafield } <- T.useLive T.unequal search search'@{ datafield } <- T.useLive T.unequal search
pure $ R.fragment [ H.div { className: "text-primary center"} [H.text "with DataField"] pure $ R.fragment [ H.div { className: "text-primary center"} [H.text "with DataField"]
......
...@@ -88,7 +88,7 @@ uploadFileView props = R.createElement uploadFileViewCpt props [] ...@@ -88,7 +88,7 @@ uploadFileView props = R.createElement uploadFileViewCpt props []
uploadFileViewCpt :: R.Component Props uploadFileViewCpt :: R.Component Props
uploadFileViewCpt = here.component "uploadFileView" cpt uploadFileViewCpt = here.component "uploadFileView" cpt
where where
cpt {dispatch, id, nodeType} _ = do cpt {dispatch, nodeType} _ = 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
...@@ -130,7 +130,6 @@ uploadFileViewCpt = here.component "uploadFileView" cpt ...@@ -130,7 +130,6 @@ uploadFileViewCpt = here.component "uploadFileView" cpt
let footer = H.div {} [ uploadButton { dispatch let footer = H.div {} [ uploadButton { dispatch
, fileType , fileType
, lang , lang
, id
, mFile , mFile
, nodeType , nodeType
} }
...@@ -154,7 +153,6 @@ uploadFileViewCpt = here.component "uploadFileView" cpt ...@@ -154,7 +153,6 @@ uploadFileViewCpt = here.component "uploadFileView" cpt
type UploadButtonProps = type UploadButtonProps =
( dispatch :: Action -> Aff Unit ( dispatch :: Action -> Aff Unit
, fileType :: T.Box FileType , fileType :: T.Box FileType
, id :: GT.ID
, lang :: T.Box Lang , lang :: T.Box Lang
, mFile :: T.Box (Maybe UploadFile) , mFile :: T.Box (Maybe UploadFile)
, nodeType :: GT.NodeType , nodeType :: GT.NodeType
...@@ -167,7 +165,6 @@ uploadButtonCpt = here.component "uploadButton" cpt ...@@ -167,7 +165,6 @@ uploadButtonCpt = here.component "uploadButton" cpt
where where
cpt { dispatch cpt { dispatch
, fileType , fileType
, id
, lang , lang
, mFile , mFile
, nodeType , nodeType
...@@ -186,7 +183,7 @@ uploadButtonCpt = here.component "uploadButton" cpt ...@@ -186,7 +183,7 @@ uploadButtonCpt = here.component "uploadButton" cpt
, on: {click: onClick fileType' mFile'} , on: {click: onClick fileType' mFile'}
} [ H.text "Upload" ] } [ H.text "Upload" ]
where where
onClick fileType' mFile' e = do onClick fileType' mFile' _ = do
let { blob, name } = unsafePartial $ fromJust mFile' let { blob, name } = unsafePartial $ fromJust mFile'
here.log2 "[uploadButton] fileType" fileType' here.log2 "[uploadButton] fileType" fileType'
void $ launchAff do void $ launchAff do
...@@ -225,7 +222,7 @@ fileTypeViewCpt = here.component "fileTypeView" cpt ...@@ -225,7 +222,7 @@ fileTypeViewCpt = here.component "fileTypeView" cpt
case droppedFile' of case droppedFile' of
Nothing -> pure $ H.div {} [] Nothing -> pure $ H.div {} []
Just df@(DroppedFile { blob, fileType }) -> Just df@(DroppedFile _) ->
pure $ H.div tooltipProps [ H.div { className: "card"} pure $ H.div tooltipProps [ H.div { className: "card"}
[ panelHeading [ panelHeading
, panelBody df , panelBody df
...@@ -259,12 +256,12 @@ fileTypeViewCpt = here.component "fileTypeView" cpt ...@@ -259,12 +256,12 @@ fileTypeViewCpt = here.component "fileTypeView" cpt
panelBody (DroppedFile { blob }) = panelBody (DroppedFile { blob }) =
H.div {className: "card-body"} H.div {className: "card-body"}
[ R2.select {className: "col-md-12 form-control" [ R2.select {className: "col-md-12 form-control"
, on: {change: onChange blob} , on: {change: onChange}
} }
(map renderOption [CSV, CSV_HAL, WOS]) (map renderOption [CSV, CSV_HAL, WOS])
] ]
where where
onChange blob e l = onChange e l =
T.write_ (Just $ DroppedFile $ { blob T.write_ (Just $ DroppedFile $ { blob
, fileType: read $ R.unsafeEventValue e , fileType: read $ R.unsafeEventValue e
, lang : fromMaybe EN $ read $ R.unsafeEventValue l , lang : fromMaybe EN $ read $ R.unsafeEventValue l
...@@ -464,7 +461,7 @@ uploadTermButtonCpt = here.component "uploadTermButton" cpt ...@@ -464,7 +461,7 @@ uploadTermButtonCpt = here.component "uploadTermButton" cpt
, on: { click: onClick mFile' uploadType' } , on: { click: onClick mFile' uploadType' }
} [ H.text "Upload" ] } [ H.text "Upload" ]
where where
onClick mFile' uploadType' e = do onClick mFile' uploadType' _ = do
let {name, blob} = unsafePartial $ fromJust mFile' let {name, blob} = unsafePartial $ fromJust mFile'
void $ launchAff do void $ launchAff do
contents <- readUFBAsText blob contents <- readUFBAsText blob
......
...@@ -25,7 +25,7 @@ import Gargantext.Components.Forest.Tree.Node.Settings (NodeAction(..), Settings ...@@ -25,7 +25,7 @@ import Gargantext.Components.Forest.Tree.Node.Settings (NodeAction(..), Settings
import Gargantext.Components.Forest.Tree.Node.Status (Status(..), hasStatus) import Gargantext.Components.Forest.Tree.Node.Status (Status(..), hasStatus)
import Gargantext.Components.Forest.Tree.Node.Tools (textInputBox, fragmentPT) import Gargantext.Components.Forest.Tree.Node.Tools (textInputBox, fragmentPT)
import Gargantext.Sessions (Session) import Gargantext.Sessions (Session)
import Gargantext.Types (FrontendError, ID, Name, prettyNodeType) import Gargantext.Types (ID, Name, prettyNodeType)
import Gargantext.Types as GT import Gargantext.Types as GT
import Gargantext.Utils.Glyphicon (glyphicon, glyphiconActive) import Gargantext.Utils.Glyphicon (glyphicon, glyphiconActive)
import Gargantext.Utils.Reactix as R2 import Gargantext.Utils.Reactix as R2
...@@ -83,14 +83,14 @@ nodePopupCpt = here.component "nodePopupView" cpt where ...@@ -83,14 +83,14 @@ nodePopupCpt = here.component "nodePopupView" cpt where
, H.div { className: "col-1" } , H.div { className: "col-1" }
[ H.a { type: "button", on: { click: closePopover p }, title: "Close" [ H.a { type: "button", on: { click: closePopover p }, title: "Close"
, className: glyphicon "window-close" } [] ]]] where , className: glyphicon "window-close" } [] ]]] where
SettingsBox { edit, doc, buttons } = settingsBox nodeType SettingsBox _ = settingsBox nodeType
editIcon _ true = H.div {} [] editIcon _ true = H.div {} []
editIcon isOpen false = editIcon isOpen false =
H.a { className: glyphicon "pencil", id: "rename1" H.a { className: glyphicon "pencil", id: "rename1"
, title : "Rename", on: { click: \_ -> T.write_ true isOpen } } [] , title : "Rename", on: { click: \_ -> T.write_ true isOpen } } []
panelBody :: T.Box (Maybe NodeAction) -> Record NodePopupProps -> R.Element panelBody :: T.Box (Maybe NodeAction) -> Record NodePopupProps -> R.Element
panelBody nodePopupState {dispatch: d, nodeType} = panelBody nodePopupState { nodeType } =
let (SettingsBox { edit, doc, buttons}) = settingsBox nodeType in let (SettingsBox { doc, buttons }) = settingsBox nodeType in
H.div {className: "card-body flex-space-between"} H.div {className: "card-body flex-space-between"}
$ [ H.p { className: "spacer" } [] $ [ H.p { className: "spacer" } []
, H.div { className: "flex-center" } , H.div { className: "flex-center" }
...@@ -183,26 +183,26 @@ panelAction p = R.createElement panelActionCpt p [] ...@@ -183,26 +183,26 @@ panelAction p = R.createElement panelActionCpt p []
panelActionCpt :: R.Component PanelActionProps panelActionCpt :: R.Component PanelActionProps
panelActionCpt = here.component "panelAction" cpt panelActionCpt = here.component "panelAction" cpt
where where
cpt {action: Documentation nodeType} _ = pure $ actionDoc { nodeType } [] cpt { action: Documentation nodeType} _ = pure $ actionDoc { nodeType } []
cpt {action: Download, id, nodeType, session} _ = pure $ actionDownload { id, nodeType, session } [] cpt { action: Download, id, nodeType, session} _ = pure $ actionDownload { id, nodeType, session } []
cpt {action: Upload, dispatch, id, nodeType, session} _ = pure $ actionUpload { dispatch, id, nodeType, session } [] cpt { action: Upload, dispatch, id, nodeType, session} _ = pure $ actionUpload { dispatch, id, nodeType, session } []
cpt {action: Delete, nodeType, dispatch} _ = pure $ actionDelete { dispatch, nodeType } [] cpt { action: Delete, nodeType, dispatch} _ = pure $ actionDelete { dispatch, nodeType } []
cpt {action: Add xs, dispatch, id, name, nodeType} _ = cpt { action: Add xs, dispatch, id, name, nodeType} _ =
pure $ addNodeView {dispatch, id, name, nodeType, nodeTypes: xs} [] pure $ addNodeView {dispatch, id, name, nodeType, nodeTypes: xs} []
cpt {action: Refresh , dispatch, id, nodeType, session} _ = pure $ update { dispatch, nodeType } [] cpt { action: Refresh , dispatch, nodeType } _ = pure $ update { dispatch, nodeType } []
cpt {action: Config , dispatch, id, nodeType, session} _ = cpt { action: Config, nodeType } _ =
pure $ fragmentPT $ "Config " <> show nodeType pure $ fragmentPT $ "Config " <> show nodeType
-- Functions using SubTree -- Functions using SubTree
cpt { action: Merge {subTreeParams}, boxes, dispatch, id, nodeType, session } _ = cpt { action: Merge {subTreeParams}, boxes, dispatch, id, nodeType, session } _ =
pure $ mergeNode { boxes, dispatch, id, nodeType, session, subTreeParams } [] pure $ mergeNode { boxes, dispatch, id, nodeType, session, subTreeParams } []
cpt {action: Move {subTreeParams}, boxes, dispatch, id, nodeType, session } _ = cpt { action: Move {subTreeParams}, boxes, dispatch, id, nodeType, session } _ =
pure $ moveNode { boxes, dispatch, id, nodeType, session, subTreeParams } [] pure $ moveNode { boxes, dispatch, id, nodeType, session, subTreeParams } []
cpt {action: Link {subTreeParams}, boxes, dispatch, id, nodeType, session } _ = cpt { action: Link {subTreeParams}, boxes, dispatch, id, nodeType, session } _ =
pure $ linkNode { boxes, dispatch, id, nodeType, session, subTreeParams } [] pure $ linkNode { boxes, dispatch, id, nodeType, session, subTreeParams } []
cpt {action : Share, dispatch, id, name } _ = pure $ Share.shareNode { dispatch, id } [] cpt { action : Share, dispatch, id } _ = pure $ Share.shareNode { dispatch, id } []
cpt {action : AddingContact, dispatch, id, name } _ = pure $ Contact.actionAddContact { dispatch, id } [] cpt { action : AddingContact, dispatch, id } _ = pure $ Contact.actionAddContact { dispatch, id } []
cpt {action : Publish {subTreeParams}, boxes, dispatch, id, nodeType, session } _ = cpt { action : Publish {subTreeParams}, boxes, dispatch, id, nodeType, session } _ =
pure $ Share.publishNode { boxes, dispatch, id, nodeType, session, subTreeParams } [] pure $ Share.publishNode { boxes, dispatch, id, nodeType, session, subTreeParams } []
cpt props@{action: SearchBox, boxes, id, session, dispatch, nodePopup} _ = cpt { action: SearchBox, boxes, id, session, dispatch } _ =
pure $ actionSearch { boxes, dispatch, id: (Just id), nodePopup, session } [] pure $ actionSearch { boxes, dispatch, id: (Just id), session } []
cpt _ _ = pure $ H.div {} [] cpt _ _ = pure $ H.div {} []
module Gargantext.Components.Forest.Tree.Node.Settings where module Gargantext.Components.Forest.Tree.Node.Settings where
import Data.Generic.Rep (class Generic)
import Data.Show.Generic (genericShow)
import Data.Eq.Generic (genericEq)
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 Data.Array (foldl)
import Gargantext.Types import Gargantext.Types
------------------------------------------------------------------------ ------------------------------------------------------------------------
...@@ -55,15 +51,15 @@ instance Show NodeAction where ...@@ -55,15 +51,15 @@ instance Show NodeAction where
show Download = "Download" show Download = "Download"
show Upload = "Upload" show Upload = "Upload"
show Refresh = "Refresh" show Refresh = "Refresh"
show (Move t) = "Move with subtree params" -- <> show t show (Move _) = "Move with subtree params" -- <> show t
show Clone = "Clone" show Clone = "Clone"
show Delete = "Delete" show Delete = "Delete"
show Share = "Share" show Share = "Share"
show Config = "Config" show Config = "Config"
show (Link x) = "Link to " -- <> show x show (Link _) = "Link to " -- <> show x
show (Add xs) = "Add Child" -- foldl (\a b -> a <> show b) "Add " xs show (Add _) = "Add Child" -- foldl (\a b -> a <> show b) "Add " xs
show (Merge t) = "Merge with subtree" -- <> show t show (Merge _) = "Merge with subtree" -- <> show t
show (Publish x) = "Publish" -- <> show x show (Publish _) = "Publish" -- <> show x
show AddingContact = "AddingContact" show AddingContact = "AddingContact"
show CloseNodePopover = "CloseNodePopover" show CloseNodePopover = "CloseNodePopover"
......
module Gargantext.Components.Forest.Tree.Node.Tools where module Gargantext.Components.Forest.Tree.Node.Tools where
import Data.Maybe (fromMaybe, Maybe(..)) import Data.Maybe (fromMaybe, Maybe(..))
import Data.Nullable (null)
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
...@@ -201,7 +200,6 @@ type CheckboxProps = ...@@ -201,7 +200,6 @@ type CheckboxProps =
checkbox :: R2.Leaf CheckboxProps checkbox :: R2.Leaf CheckboxProps
checkbox props = R.createElement checkboxCpt props [] checkbox props = R.createElement checkboxCpt props []
checkboxCpt :: R.Component CheckboxProps checkboxCpt :: R.Component CheckboxProps
checkboxCpt = here.component "checkbox" cpt checkboxCpt = here.component "checkbox" cpt
where where
...@@ -223,11 +221,10 @@ type CheckboxesListGroup a = ...@@ -223,11 +221,10 @@ type CheckboxesListGroup a =
checkboxesListGroup :: forall a. Ord a => Show a => R2.Component (CheckboxesListGroup a) checkboxesListGroup :: forall a. Ord a => Show a => R2.Component (CheckboxesListGroup a)
checkboxesListGroup = R.createElement checkboxesListGroupCpt checkboxesListGroup = R.createElement checkboxesListGroupCpt
checkboxesListGroupCpt :: forall a. Ord a => Show a => R.Component (CheckboxesListGroup a) checkboxesListGroupCpt :: forall a. Ord a => Show a => R.Component (CheckboxesListGroup a)
checkboxesListGroupCpt = here.component "checkboxesListGroup" cpt checkboxesListGroupCpt = here.component "checkboxesListGroup" cpt
where where
cpt { groups, options } _ = do cpt { options } _ = do
options' <- T.useLive T.unequal options options' <- T.useLive T.unequal options
let one a = let one a =
...@@ -278,8 +275,6 @@ nodeLinkCpt = here.component "nodeLink" cpt ...@@ -278,8 +275,6 @@ nodeLinkCpt = here.component "nodeLink" cpt
, nodeType , nodeType
, session , session
} _ = do } _ = do
popoverRef <- R.useRef null
pure $ pure $
H.div { className: "node-link" H.div { className: "node-link"
, on: { click } } , on: { click } }
......
module Gargantext.Components.Forest.Tree.Node.Tools.FTree where module Gargantext.Components.Forest.Tree.Node.Tools.FTree where
import Data.Array as A
import Data.Generic.Rep (class Generic) import Data.Generic.Rep (class Generic)
import Data.Eq.Generic (genericEq) import Data.Eq.Generic (genericEq)
import Data.Maybe (Maybe(..)) import Data.Maybe (Maybe(..))
import Data.Newtype (class Newtype) import Data.Newtype (class Newtype)
import Foreign as F
import Simple.JSON as JSON import Simple.JSON as JSON
import Simple.JSON.Generics as JSONG
import Gargantext.Prelude import Gargantext.Prelude
......
module Gargantext.Components.Forest.Tree.Node.Tools.Sync where module Gargantext.Components.Forest.Tree.Node.Tools.Sync where
import Gargantext.Prelude import Gargantext.Prelude
( Unit, bind, const, discard, pure, unit, ($), (<>), (==) ) ( Unit, bind, discard, pure, unit, ($), (<>), (==) )
import Effect.Aff (Aff, launchAff_) import Effect.Aff (Aff, launchAff_)
import Data.Tuple.Nested ((/\))
import Data.Maybe (Maybe(..)) import Data.Maybe (Maybe(..))
import Data.Tuple (fst)
import Effect.Class (liftEffect) import Effect.Class (liftEffect)
import Reactix.DOM.HTML as H import Reactix.DOM.HTML as H
import Reactix as R import Reactix as R
...@@ -69,7 +67,7 @@ graphUpdateButtonCpt = here.component "graphUpdateButton" cpt ...@@ -69,7 +67,7 @@ graphUpdateButtonCpt = here.component "graphUpdateButton" cpt
onClick true enabled = do onClick true enabled = do
launchAff_ $ do launchAff_ $ do
liftEffect $ T.write_ false enabled liftEffect $ T.write_ false enabled
g <- GraphAPI.updateGraphVersions { graphId: id, session } _g <- GraphAPI.updateGraphVersions { graphId: id, session }
liftEffect $ T.write_ true enabled liftEffect $ T.write_ true enabled
refresh unit refresh unit
pure unit pure unit
...@@ -86,7 +84,6 @@ type NodeActionsNodeListProps = ...@@ -86,7 +84,6 @@ type NodeActionsNodeListProps =
nodeActionsNodeList :: Record NodeActionsNodeListProps -> R.Element nodeActionsNodeList :: Record NodeActionsNodeListProps -> R.Element
nodeActionsNodeList p = R.createElement nodeActionsNodeListCpt p [] nodeActionsNodeList p = R.createElement nodeActionsNodeListCpt p []
nodeActionsNodeListCpt :: R.Component NodeActionsNodeListProps nodeActionsNodeListCpt :: R.Component NodeActionsNodeListProps
nodeActionsNodeListCpt = here.component "nodeActionsNodeList" cpt nodeActionsNodeListCpt = here.component "nodeActionsNodeList" cpt
where where
...@@ -105,11 +102,10 @@ type NodeListUpdateButtonProps = ...@@ -105,11 +102,10 @@ type NodeListUpdateButtonProps =
nodeListUpdateButton :: Record NodeListUpdateButtonProps -> R.Element nodeListUpdateButton :: Record NodeListUpdateButtonProps -> R.Element
nodeListUpdateButton p = R.createElement nodeListUpdateButtonCpt p [] nodeListUpdateButton p = R.createElement nodeListUpdateButtonCpt p []
nodeListUpdateButtonCpt :: R.Component NodeListUpdateButtonProps nodeListUpdateButtonCpt :: R.Component NodeListUpdateButtonProps
nodeListUpdateButtonCpt = here.component "nodeListUpdateButton" cpt nodeListUpdateButtonCpt = here.component "nodeListUpdateButton" cpt
where where
cpt { listId, nodeId, nodeType, session, refresh } _ = do cpt _ _ = do
-- enabled <- T.useBox true -- enabled <- T.useBox true
pure $ H.div {} [] {- { className: "update-button " pure $ H.div {} [] {- { className: "update-button "
......
...@@ -2,7 +2,7 @@ module Gargantext.Components.GraphExplorer.API where ...@@ -2,7 +2,7 @@ module Gargantext.Components.GraphExplorer.API where
import Gargantext.Prelude import Gargantext.Prelude
import Data.Either (Either(..)) import Data.Either (Either)
import Data.Maybe (Maybe) import Data.Maybe (Maybe)
import Effect.Aff (Aff) import Effect.Aff (Aff)
import Gargantext.Components.GraphExplorer.Types as GET import Gargantext.Components.GraphExplorer.Types as GET
......
...@@ -21,7 +21,6 @@ import Gargantext.Components.Forest.Tree.Node.Action.Upload (uploadArbitraryData ...@@ -21,7 +21,6 @@ import Gargantext.Components.Forest.Tree.Node.Action.Upload (uploadArbitraryData
import Gargantext.Components.GraphExplorer.API (cloneGraph) import Gargantext.Components.GraphExplorer.API (cloneGraph)
import Gargantext.Components.GraphExplorer.Types as GET import Gargantext.Components.GraphExplorer.Types as GET
import Gargantext.Components.GraphExplorer.Utils as GEU import Gargantext.Components.GraphExplorer.Utils as GEU
import Gargantext.Config.REST (RESTError)
import Gargantext.Hooks.Sigmax as Sigmax import Gargantext.Hooks.Sigmax as Sigmax
import Gargantext.Hooks.Sigmax.Sigma as Sigma import Gargantext.Hooks.Sigmax.Sigma as Sigma
import Gargantext.Sessions (Session) import Gargantext.Sessions (Session)
......
...@@ -260,7 +260,7 @@ updateTermButtonCpt = here.component "updateTermButton" cpt ...@@ -260,7 +260,7 @@ updateTermButtonCpt = here.component "updateTermButton" cpt
, rType , rType
, session , session
, text } _ = do , text } _ = do
{ removedNodeIds, sideTab, selectedNodeIds } <- GEST.focusedSidePanel sidePanelGraph { removedNodeIds, selectedNodeIds } <- GEST.focusedSidePanel sidePanelGraph
selectedNodeIds' <- T.useLive T.unequal selectedNodeIds selectedNodeIds' <- T.useLive T.unequal selectedNodeIds
pure $ if Set.isEmpty selectedNodeIds' then pure $ if Set.isEmpty selectedNodeIds' then
......
...@@ -25,8 +25,7 @@ topBar :: R2.Leaf TopBar ...@@ -25,8 +25,7 @@ topBar :: R2.Leaf TopBar
topBar p = R.createElement topBarCpt p [] topBar p = R.createElement topBarCpt p []
topBarCpt :: R.Component TopBar topBarCpt :: R.Component TopBar
topBarCpt = here.component "topBar" cpt where topBarCpt = here.component "topBar" cpt where
cpt { boxes: { showTree cpt { boxes: { sidePanelGraph
, sidePanelGraph
, sidePanelState } } _ = do , sidePanelState } } _ = do
{ mGraph, multiSelectEnabled, selectedNodeIds, showControls } <- GEST.focusedSidePanel sidePanelGraph { mGraph, multiSelectEnabled, selectedNodeIds, showControls } <- GEST.focusedSidePanel sidePanelGraph
...@@ -43,7 +42,3 @@ topBarCpt = here.component "topBar" cpt where ...@@ -43,7 +42,3 @@ topBarCpt = here.component "topBar" cpt where
, Toggle.sidebarToggleButton { state: sidePanelState } [] , Toggle.sidebarToggleButton { state: sidePanelState } []
, search , search
] ]
where
rowToggle = RH.ul { className: "navbar-nav ml-auto mr-auto" }
col = RH.li { className: "nav-item" }
spaces = RH.a { className: "nav-link" }
...@@ -72,7 +72,7 @@ chooserCpt = here.component "chooser" cpt where ...@@ -72,7 +72,7 @@ chooserCpt = here.component "chooser" cpt where
-- Shown in the chooser -- Shown in the chooser
activeConnections :: forall s. T.ReadWrite s Sessions => s -> Sessions -> Array R.Element activeConnections :: forall s. T.ReadWrite s Sessions => s -> Sessions -> Array R.Element
activeConnections sessions sessions' | Sessions.null sessions' = [] activeConnections _ sessions' | Sessions.null sessions' = []
activeConnections sessions sessions' = activeConnections sessions sessions' =
[ H.h3 {} [ H.text "Active connection(s)" ] [ H.h3 {} [ H.text "Active connection(s)" ]
, H.ul {} [ renderSessions sessions sessions' ] ] , H.ul {} [ renderSessions sessions sessions' ] ]
......
...@@ -55,7 +55,7 @@ form props = R.createElement formCpt props [] ...@@ -55,7 +55,7 @@ form props = R.createElement formCpt props []
formCpt :: forall s v. T.ReadWrite s Sessions => T.ReadWrite v Boolean formCpt :: forall s v. T.ReadWrite s Sessions => T.ReadWrite v Boolean
=> R.Component (Props s v) => R.Component (Props s v)
formCpt = here.component "form" cpt where formCpt = here.component "form" cpt where
cpt props@{ backend, sessions, visible } _ = do cpt { backend, sessions, visible } _ = do
cell <- T.useBox emptyForm cell <- T.useBox emptyForm
cursors <- useFocusedFields cell {} cursors <- useFocusedFields cell {}
pure $ R2.row pure $ R2.row
......
...@@ -80,7 +80,7 @@ setTermListSetA ngramsTable ns new_list = ...@@ -80,7 +80,7 @@ setTermListSetA ngramsTable ns new_list =
CoreAction $ CommitPatch $ fromNgramsPatches $ PatchMap $ mapWithIndex f $ toMap ns CoreAction $ CommitPatch $ fromNgramsPatches $ PatchMap $ mapWithIndex f $ toMap ns
where where
f :: NgramsTerm -> Unit -> NgramsPatch f :: NgramsTerm -> Unit -> NgramsPatch
f n unit = NgramsPatch { patch_list, patch_children: mempty } f n _unit = NgramsPatch { patch_list, patch_children: mempty }
where where
cur_list = ngramsTable ^? at n <<< _Just <<< _NgramsRepoElement <<< _list cur_list = ngramsTable ^? at n <<< _Just <<< _NgramsRepoElement <<< _list
patch_list = maybe mempty (\c -> replace c new_list) cur_list patch_list = maybe mempty (\c -> replace c new_list) cur_list
...@@ -352,7 +352,7 @@ loadedNgramsTableCpt = here.component "loadedNgramsTable" cpt where ...@@ -352,7 +352,7 @@ loadedNgramsTableCpt = here.component "loadedNgramsTable" cpt where
, performAction: performAction <<< CoreAction } , performAction: performAction <<< CoreAction }
-- autoUpdate :: Array R.Element -- autoUpdate :: Array R.Element
autoUpdate path' = if withAutoUpdate then autoUpdate = if withAutoUpdate then
[ R2.buff [ R2.buff
$ autoUpdateElt $ autoUpdateElt
{ duration: 5000 { duration: 5000
...@@ -371,7 +371,7 @@ loadedNgramsTableCpt = here.component "loadedNgramsTable" cpt where ...@@ -371,7 +371,7 @@ loadedNgramsTableCpt = here.component "loadedNgramsTable" cpt where
) =<< ngramsParent ) =<< ngramsParent
pure $ R.fragment $ pure $ R.fragment $
autoUpdate path' <> autoUpdate <>
[ H.h4 {style: {textAlign : "center"}} [ H.h4 {style: {textAlign : "center"}}
[ H.span {className: "fa fa-hand-o-down"} [] [ H.span {className: "fa fa-hand-o-down"} []
, H.text "Extracted Terms" ] , H.text "Extracted Terms" ]
......
...@@ -25,7 +25,6 @@ import Gargantext.Components.NgramsTable.Core ...@@ -25,7 +25,6 @@ import Gargantext.Components.NgramsTable.Core
( Action(..), Dispatch, NgramsElement, NgramsTable, NgramsTablePatch, NgramsTerm ( Action(..), Dispatch, NgramsElement, NgramsTable, NgramsTablePatch, NgramsTerm
, _NgramsElement, _NgramsRepoElement, _PatchMap, _children, _list , _NgramsElement, _NgramsRepoElement, _PatchMap, _children, _list
, _ngrams, _occurrences, ngramsTermText, replace, setTermListA ) , _ngrams, _occurrences, ngramsTermText, replace, setTermListA )
import Gargantext.Components.Nodes.Lists.Types as NT
import Gargantext.Components.Table as Tbl import Gargantext.Components.Table as Tbl
import Gargantext.Types as T import Gargantext.Types as T
import Gargantext.Utils.Reactix as R2 import Gargantext.Utils.Reactix as R2
...@@ -64,7 +63,7 @@ searchInputCpt = here.component "searchInput" cpt ...@@ -64,7 +63,7 @@ searchInputCpt = here.component "searchInput" cpt
] ]
removeButton = removeButton =
H.button { className: "btn btn-danger" H.button { className: "btn btn-danger"
, on: {click: \e -> T.write "" searchQuery}} , on: {click: \_ -> T.write "" searchQuery}}
[ H.span {className: "fa fa-times"} []] [ H.span {className: "fa fa-times"} []]
fieldInput searchQuery' = fieldInput searchQuery' =
......
...@@ -121,7 +121,7 @@ import Data.TraversableWithIndex (traverseWithIndex) ...@@ -121,7 +121,7 @@ import Data.TraversableWithIndex (traverseWithIndex)
import Data.Tuple (Tuple(..)) import Data.Tuple (Tuple(..))
import Data.Tuple.Nested ((/\)) import Data.Tuple.Nested ((/\))
import Effect (Effect) import Effect (Effect)
import Effect.Aff (Aff, error, launchAff_) import Effect.Aff (Aff, launchAff_)
import Effect.Class (liftEffect) import Effect.Class (liftEffect)
import Effect.Exception.Unsafe (unsafeThrow) import Effect.Exception.Unsafe (unsafeThrow)
import FFI.Simple.Functions (delay) import FFI.Simple.Functions (delay)
...@@ -503,7 +503,7 @@ highlightNgrams ntype table@(NgramsTable {ngrams_repo_elements: elts}) input0 = ...@@ -503,7 +503,7 @@ highlightNgrams ntype table@(NgramsTable {ngrams_repo_elements: elts}) input0 =
A.fromFoldable ((\(s /\ ls)-> undb s /\ ls) <$> unsafePartial (foldl goFold ((input /\ Nil) : Nil) ixs)) A.fromFoldable ((\(s /\ ls)-> undb s /\ ls) <$> unsafePartial (foldl goFold ((input /\ Nil) : Nil) ixs))
where where
spR x = " " <> R.replace wordBoundaryReg "$1$1" x <> " " spR x = " " <> R.replace wordBoundaryReg "$1$1" x <> " "
reR = R.replace wordBoundaryReg " " -- reR = R.replace wordBoundaryReg " "
db = S.replaceAll (S.Pattern " ") (S.Replacement " ") db = S.replaceAll (S.Pattern " ") (S.Replacement " ")
sp x = " " <> db x <> " " sp x = " " <> db x <> " "
undb = R.replace wordBoundaryReg2 "$1" undb = R.replace wordBoundaryReg2 "$1"
...@@ -911,7 +911,6 @@ syncPatches :: forall p s. CoreParams p -> T.Box (CoreState s) -> (Unit -> Aff U ...@@ -911,7 +911,6 @@ syncPatches :: forall p s. CoreParams p -> T.Box (CoreState s) -> (Unit -> Aff U
syncPatches props state callback = do syncPatches props state callback = do
{ ngramsLocalPatch: ngramsLocalPatch@{ ngramsPatches } { ngramsLocalPatch: ngramsLocalPatch@{ ngramsPatches }
, ngramsStagePatch , ngramsStagePatch
, ngramsValidPatch
, ngramsVersion } <- T.read state , ngramsVersion } <- T.read state
when (isEmptyNgramsTablePatch ngramsStagePatch) $ do when (isEmptyNgramsTablePatch ngramsStagePatch) $ do
let pt = Versioned { data: ngramsPatches, version: ngramsVersion } let pt = Versioned { data: ngramsPatches, version: ngramsVersion }
...@@ -970,8 +969,10 @@ commitPatch tablePatch state = do ...@@ -970,8 +969,10 @@ commitPatch tablePatch state = do
loadNgramsTable :: PageParams -> Aff (Either RESTError VersionedNgramsTable) loadNgramsTable :: PageParams -> Aff (Either RESTError VersionedNgramsTable)
loadNgramsTable loadNgramsTable
{ nodeId, listIds, termListFilter, termSizeFilter, session, scoreType { nodeId
, searchQuery, tabType, params: {offset, limit, orderBy}} , listIds
, session
, tabType }
= get session query = get session query
where where
query = GetNgramsTableAll { listIds query = GetNgramsTableAll { listIds
...@@ -988,7 +989,7 @@ loadNgramsTable ...@@ -988,7 +989,7 @@ loadNgramsTable
type NgramsListByTabType = Map TabType VersionedNgramsTable type NgramsListByTabType = Map TabType VersionedNgramsTable
loadNgramsTableAll :: PageParams -> Aff (Either RESTError NgramsListByTabType) loadNgramsTableAll :: PageParams -> Aff (Either RESTError NgramsListByTabType)
loadNgramsTableAll { nodeId, listIds, session, scoreType } = do loadNgramsTableAll { nodeId, listIds, session } = do
let let
cTagNgramTypes = cTagNgramTypes =
[ CTabTerms [ CTabTerms
......
...@@ -7,7 +7,6 @@ import Data.Generic.Rep (class Generic) ...@@ -7,7 +7,6 @@ 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.AsyncTasks as GAT
import Gargantext.Components.App.Data (Boxes) import Gargantext.Components.App.Data (Boxes)
import Gargantext.Components.DocsTable as DT import Gargantext.Components.DocsTable as DT
import Gargantext.Components.DocsTable.Types (Year) import Gargantext.Components.DocsTable.Types (Year)
...@@ -19,9 +18,8 @@ import Gargantext.Components.Nodes.Texts.Types as TTypes ...@@ -19,9 +18,8 @@ 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)
import Gargantext.Types (CTabNgramType(..), FrontendError, PTabNgramType(..), SidePanelState, TabSubType(..), TabType(..)) import Gargantext.Types (CTabNgramType(..), PTabNgramType(..), 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 import Toestand as T
......
...@@ -89,9 +89,8 @@ corpusLayoutSelectionCpt :: R.Component SelectionProps ...@@ -89,9 +89,8 @@ corpusLayoutSelectionCpt :: R.Component SelectionProps
corpusLayoutSelectionCpt = here.component "corpusLayoutSelection" cpt where corpusLayoutSelectionCpt = here.component "corpusLayoutSelection" cpt where
cpt { boxes, key, nodeId, session, state } _ = do cpt { boxes, key, nodeId, session, state } _ = do
state' <- T.useLive T.unequal state state' <- T.useLive T.unequal state
viewType <- T.read state
pure $ renderContent viewType nodeId session key boxes pure $ renderContent state' nodeId session key boxes
renderContent Folders nodeId session _ boxes = renderContent Folders nodeId session _ boxes =
FV.folderView { backFolder: true FV.folderView { backFolder: true
...@@ -202,7 +201,7 @@ fieldsCodeEditor = R.createElement fieldsCodeEditorCpt ...@@ -202,7 +201,7 @@ fieldsCodeEditor = R.createElement fieldsCodeEditorCpt
fieldsCodeEditorCpt :: R.Component FieldsCodeEditorProps fieldsCodeEditorCpt :: R.Component FieldsCodeEditorProps
fieldsCodeEditorCpt = here.component "fieldsCodeEditorCpt" cpt fieldsCodeEditorCpt = here.component "fieldsCodeEditorCpt" cpt
where where
cpt { fields, nodeId, session } _ = do cpt { fields } _ = do
(FTFieldsWithIndex fields') <- T.useLive T.unequal fields (FTFieldsWithIndex fields') <- T.useLive T.unequal fields
masterKey <- T.useBox T2.newReload masterKey <- T.useBox T2.newReload
masterKey' <- T.useLive T.unequal masterKey masterKey' <- T.useLive T.unequal masterKey
...@@ -268,7 +267,6 @@ type FieldCodeEditorProps = ...@@ -268,7 +267,6 @@ type FieldCodeEditorProps =
fieldCodeEditorWrapper :: Record FieldCodeEditorProps -> R.Element fieldCodeEditorWrapper :: Record FieldCodeEditorProps -> R.Element
fieldCodeEditorWrapper props = R.createElement fieldCodeEditorWrapperCpt props [] fieldCodeEditorWrapper props = R.createElement fieldCodeEditorWrapperCpt props []
fieldCodeEditorWrapperCpt :: R.Component FieldCodeEditorProps fieldCodeEditorWrapperCpt :: R.Component FieldCodeEditorProps
fieldCodeEditorWrapperCpt = here.component "fieldCodeEditorWrapperCpt" cpt fieldCodeEditorWrapperCpt = here.component "fieldCodeEditorWrapperCpt" cpt
where where
...@@ -324,7 +322,6 @@ type RenameableProps = ...@@ -324,7 +322,6 @@ type RenameableProps =
renameable :: Record RenameableProps -> R.Element renameable :: Record RenameableProps -> R.Element
renameable props = R.createElement renameableCpt props [] renameable props = R.createElement renameableCpt props []
renameableCpt :: R.Component RenameableProps renameableCpt :: R.Component RenameableProps
renameableCpt = here.component "renameableCpt" cpt renameableCpt = here.component "renameableCpt" cpt
where where
...@@ -420,29 +417,29 @@ fieldCodeEditorCpt = here.component "fieldCodeEditorCpt" cpt ...@@ -420,29 +417,29 @@ fieldCodeEditorCpt = here.component "fieldCodeEditorCpt" cpt
-- CE.Code is the editor code (might have been the cause of the trigger) -- CE.Code is the editor code (might have been the cause of the trigger)
changeCode :: (FieldType -> Effect Unit) -> FieldType -> CE.CodeType -> CE.Code -> Effect Unit changeCode :: (FieldType -> Effect Unit) -> FieldType -> CE.CodeType -> CE.Code -> Effect Unit
changeCode onc (Haskell hs) CE.Haskell c = onc $ Haskell $ hs { haskell = c } changeCode onc (Haskell hs) CE.Haskell c = onc $ Haskell $ hs { haskell = c }
changeCode onc (Haskell hs) CE.Python c = onc $ Python $ defaultPython' { python = c } changeCode onc (Haskell _) CE.Python c = onc $ Python $ defaultPython' { python = c }
changeCode onc (Haskell {haskell}) CE.JSON c = onc $ JSON $ defaultJSON' { desc = haskell } changeCode onc (Haskell {haskell}) CE.JSON _ = onc $ JSON $ defaultJSON' { desc = haskell }
changeCode onc (Haskell {haskell}) CE.Markdown c = onc $ Markdown $ defaultMarkdown' { text = haskell } changeCode onc (Haskell {haskell}) CE.Markdown _ = onc $ Markdown $ defaultMarkdown' { text = haskell }
changeCode onc (Python hs) CE.Python c = onc $ Python $ hs { python = c } changeCode onc (Python hs) CE.Python c = onc $ Python $ hs { python = c }
changeCode onc (Python hs) CE.Haskell c = onc $ Haskell $ defaultHaskell' { haskell = c } changeCode onc (Python _) CE.Haskell c = onc $ Haskell $ defaultHaskell' { haskell = c }
changeCode onc (Python {python}) CE.JSON c = onc $ JSON $ defaultJSON' { desc = python } changeCode onc (Python {python}) CE.JSON _ = onc $ JSON $ defaultJSON' { desc = python }
changeCode onc (Python {python}) CE.Markdown c = onc $ Markdown $ defaultMarkdown' { text = python } changeCode onc (Python {python}) CE.Markdown _ = onc $ Markdown $ defaultMarkdown' { text = python }
changeCode onc (Markdown md) CE.Haskell c = onc $ Haskell $ defaultHaskell' { haskell = c } changeCode onc (Markdown _) CE.Haskell c = onc $ Haskell $ defaultHaskell' { haskell = c }
changeCode onc (Markdown md) CE.Python c = onc $ Python $ defaultPython' { python = c } changeCode onc (Markdown _) CE.Python c = onc $ Python $ defaultPython' { python = c }
changeCode onc (Markdown md) CE.JSON c = onc $ Markdown $ defaultMarkdown' { text = c } changeCode onc (Markdown _) CE.JSON c = onc $ Markdown $ defaultMarkdown' { text = c }
changeCode onc (Markdown md) CE.Markdown c = onc $ Markdown $ md { text = c } changeCode onc (Markdown md) CE.Markdown c = onc $ Markdown $ md { text = c }
changeCode onc (JSON j@{desc}) CE.Haskell c = onc $ Haskell $ defaultHaskell' { haskell = haskell } changeCode onc (JSON j) CE.Haskell _ = onc $ Haskell $ defaultHaskell' { haskell = haskell }
where where
haskell = R2.stringify (JSON.writeImpl j) 2 haskell = R2.stringify (JSON.writeImpl j) 2
changeCode onc (JSON j@{desc}) CE.Python c = onc $ Python $ defaultPython' { python = toCode } changeCode onc (JSON j) CE.Python _ = onc $ Python $ defaultPython' { python = toCode }
where where
toCode = R2.stringify (JSON.writeImpl j) 2 toCode = R2.stringify (JSON.writeImpl j) 2
changeCode onc _ CE.JSON c = do changeCode onc _ CE.JSON c = do
case JSON.readJSON c of case JSON.readJSON c of
Left err -> here.log2 "[fieldCodeEditor'] cannot parse json" c Left err -> here.log2 "[fieldCodeEditor'] cannot parse json" c -- TODO Refactor?
Right j' -> onc $ JSON j' Right j' -> onc $ JSON j'
-- case jsonParser c of -- case jsonParser c of
-- Left err -> here.log2 "[fieldCodeEditor'] cannot parse json" c -- Left err -> here.log2 "[fieldCodeEditor'] cannot parse json" c
...@@ -549,7 +546,7 @@ type LoadWithReloadProps = ...@@ -549,7 +546,7 @@ type LoadWithReloadProps =
-- Just to make reloading effective -- Just to make reloading effective
loadCorpusWithChildAndReload :: Record LoadWithReloadProps -> Aff (Either RESTError CorpusData) loadCorpusWithChildAndReload :: Record LoadWithReloadProps -> Aff (Either RESTError CorpusData)
loadCorpusWithChildAndReload {nodeId, reload, session} = loadCorpusWithChild {nodeId, session} loadCorpusWithChildAndReload {nodeId, session} = loadCorpusWithChild {nodeId, session}
data ViewType = Code | Folders data ViewType = Code | Folders
derive instance Generic ViewType _ derive instance Generic ViewType _
......
module Gargantext.Components.Nodes.Corpus.Chart.Tree where module Gargantext.Components.Nodes.Corpus.Chart.Tree where
import Data.Either (Either(..)) import Data.Either (Either)
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)
......
...@@ -7,9 +7,8 @@ import Gargantext.Components.App.Data (Boxes) ...@@ -7,9 +7,8 @@ import Gargantext.Components.App.Data (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)
import Gargantext.Types (FrontendError, TabType) import Gargantext.Types (TabType)
import Gargantext.Utils.Toestand as T2 import Gargantext.Utils.Toestand as T2
import Toestand as T
type Path = ( type Path = (
corpusId :: Int corpusId :: Int
......
...@@ -15,7 +15,7 @@ import Gargantext.Components.Nodes.Types (FTFieldList(..), FTFieldsWithIndex(..) ...@@ -15,7 +15,7 @@ import Gargantext.Components.Nodes.Types (FTFieldList(..), FTFieldsWithIndex(..)
import Gargantext.Hooks.Loader (useLoader) import Gargantext.Hooks.Loader (useLoader)
import Gargantext.Prelude (Unit, bind, discard, pure, read, show, unit, ($), (<$>), (<>), (==)) import Gargantext.Prelude (Unit, bind, discard, pure, read, show, unit, ($), (<$>), (<>), (==))
import Gargantext.Sessions (Session, sessionId) import Gargantext.Sessions (Session, sessionId)
import Gargantext.Types (FrontendError, NodeID) import Gargantext.Types (NodeID)
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
......
...@@ -4,8 +4,6 @@ module Gargantext.Components.Nodes.Corpus.Document where ...@@ -4,8 +4,6 @@ module Gargantext.Components.Nodes.Corpus.Document where
--import Data.Argonaut.Core (stringifyWithIndent) -- DEBUG --import Data.Argonaut.Core (stringifyWithIndent) -- DEBUG
import Data.Either (Either(..)) import Data.Either (Either(..))
import Data.Maybe (Maybe(..), fromMaybe) import Data.Maybe (Maybe(..), fromMaybe)
import Data.Tuple (fst)
import Data.Tuple.Nested ((/\))
import Effect.Aff (Aff) import Effect.Aff (Aff)
import Reactix as R import Reactix as R
import Reactix.DOM.HTML as H import Reactix.DOM.HTML as H
...@@ -34,10 +32,10 @@ here :: R2.Here ...@@ -34,10 +32,10 @@ here :: R2.Here
here = R2.here "Gargantext.Components.Nodes.Corpus.Document" here = R2.here "Gargantext.Components.Nodes.Corpus.Document"
publicationDate :: Document -> String publicationDate :: Document -> String
publicationDate (Document doc@{publication_year: Nothing}) = "" publicationDate (Document {publication_year: Nothing}) = ""
publicationDate (Document doc@{publication_year: Just py, publication_month: Nothing}) = U.zeroPad 2 py publicationDate (Document {publication_year: Just py, publication_month: Nothing}) = U.zeroPad 2 py
publicationDate (Document doc@{publication_year: Just py, publication_month: Just pm, publication_day: Nothing}) = (U.zeroPad 2 py) <> "-" <> (U.zeroPad 2 pm) publicationDate (Document {publication_year: Just py, publication_month: Just pm, publication_day: Nothing}) = (U.zeroPad 2 py) <> "-" <> (U.zeroPad 2 pm)
publicationDate (Document doc@{publication_year: Just py, publication_month: Just pm, publication_day: Just pd}) = (U.zeroPad 2 py) <> "-" <> (U.zeroPad 2 pm) <> "-" <> (U.zeroPad 2 pd) publicationDate (Document {publication_year: Just py, publication_month: Just pm, publication_day: Just pd}) = (U.zeroPad 2 py) <> "-" <> (U.zeroPad 2 pm) <> "-" <> (U.zeroPad 2 pd)
docViewWrapper :: R2.Component Props docViewWrapper :: R2.Component Props
docViewWrapper = R.createElement docViewWrapperCpt docViewWrapper = R.createElement docViewWrapperCpt
...@@ -60,10 +58,10 @@ docViewCpt :: R.Component DocViewProps ...@@ -60,10 +58,10 @@ docViewCpt :: R.Component DocViewProps
docViewCpt = here.component "docView" cpt docViewCpt = here.component "docView" cpt
where where
cpt { path cpt { path
, loaded: loaded@{ ngramsTable: Versioned { data: initTable }, document } , loaded: { ngramsTable: Versioned { data: initTable }, document }
, state , state
} _children = do } _children = do
state'@{ ngramsLocalPatch, ngramsVersion: version } <- T.useLive T.unequal state state'@{ ngramsLocalPatch } <- T.useLive T.unequal state
let let
afterSync = \_ -> pure unit afterSync = \_ -> pure unit
......
...@@ -5,8 +5,6 @@ import Gargantext.Prelude ...@@ -5,8 +5,6 @@ import Gargantext.Prelude
-- import Gargantext.Utils.Toestand as T2 -- import Gargantext.Utils.Toestand as T2
-- import Toestand as T -- import Toestand as T
import Data.Tuple.Nested ((/\))
import Effect (Effect)
import Gargantext.Sessions (Session) import Gargantext.Sessions (Session)
import Gargantext.Types (NodeID) import Gargantext.Types (NodeID)
import Gargantext.Utils.Reactix as R2 import Gargantext.Utils.Reactix as R2
...@@ -20,7 +18,6 @@ type Props = ( nodeId :: NodeID, session :: Session ) ...@@ -20,7 +18,6 @@ type Props = ( nodeId :: NodeID, session :: Session )
phyloLayout :: R2.Component Props phyloLayout :: R2.Component Props
phyloLayout = R.createElement phyloLayoutCpt phyloLayout = R.createElement phyloLayoutCpt
phyloLayoutCpt :: R.Component Props phyloLayoutCpt :: R.Component Props
phyloLayoutCpt = here.component "phyloLayout" cpt where phyloLayoutCpt = here.component "phyloLayout" cpt where
cpt { nodeId, session } content = do cpt { nodeId, session } content = do
......
module Gargantext.Components.Nodes.Corpus.Types where module Gargantext.Components.Nodes.Corpus.Types where
import Data.Argonaut (class DecodeJson, class EncodeJson, decodeJson, (.:), (:=), (~>), jsonEmptyObject)
import Data.Eq.Generic (genericEq) import Data.Eq.Generic (genericEq)
import Data.Generic.Rep (class Generic) import Data.Generic.Rep (class Generic)
import Data.List as List import Data.List as List
import Data.Maybe (Maybe(..)) import Data.Maybe (Maybe(..))
import Data.Newtype (class Newtype) import Data.Newtype (class Newtype)
import Gargantext.Components.Node (NodePoly) import Gargantext.Components.Node (NodePoly)
import Gargantext.Components.Nodes.Types (FTField, Field(..), FieldType(..), FTField, FTFieldList(..), isJSON) import Gargantext.Components.Nodes.Types (Field(..), FieldType(..), FTFieldList(..), isJSON)
import Gargantext.Prelude import Gargantext.Prelude
import Reactix as R
import Record as Record import Record as Record
import Simple.JSON as JSON import Simple.JSON as JSON
import Toestand as T
newtype Hyperdata = newtype Hyperdata =
Hyperdata { fields :: FTFieldList } Hyperdata { fields :: FTFieldList }
......
module Gargantext.Components.Nodes.File where module Gargantext.Components.Nodes.File where
import Data.Generic.Rep (class Generic) import Data.Generic.Rep (class Generic)
import Data.Either (Either(..)) import Data.Either (Either)
import Data.Eq.Generic (genericEq) import Data.Eq.Generic (genericEq)
import Data.Maybe (Maybe(..)) import Data.Maybe (Maybe(..))
import Data.Newtype (class Newtype) import Data.Newtype (class Newtype)
......
module Gargantext.Components.Nodes.Lists.Tabs where module Gargantext.Components.Nodes.Lists.Tabs where
import Gargantext.Components.Nodes.Lists.Types
import Data.Array as A 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.AsyncTasks as GAT
import Gargantext.Components.App.Data (Boxes) import Gargantext.Components.App.Data (Boxes)
import Gargantext.Components.NgramsTable as NT import Gargantext.Components.NgramsTable as NT
import Gargantext.Components.NgramsTable.Core as NTC import Gargantext.Components.NgramsTable.Core as NTC
...@@ -15,10 +12,11 @@ import Gargantext.Components.Nodes.Corpus.Chart.Pie (pie, bar) ...@@ -15,10 +12,11 @@ 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.Types hiding (here)
import Gargantext.Components.Tab as Tab import Gargantext.Components.Tab as Tab
import Gargantext.Prelude (bind, pure, unit, ($), (<>)) import Gargantext.Prelude (bind, pure, unit, ($), (<>))
import Gargantext.Sessions (Session) import Gargantext.Sessions (Session)
import Gargantext.Types (CTabNgramType(..), FrontendError, Mode(..), TabSubType(..), TabType(..), modeTabType) import Gargantext.Types (CTabNgramType(..), Mode(..), TabSubType(..), TabType(..), modeTabType)
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
...@@ -71,7 +69,7 @@ ngramsViewCpt = here.component "ngramsView" cpt where ...@@ -71,7 +69,7 @@ ngramsViewCpt = here.component "ngramsView" cpt where
chartsReload <- T.useBox T2.newReload chartsReload <- T.useBox T2.newReload
path <- T.useBox $ NTC.initialPageParams props.session initialPath.corpusId [initialPath.listId] initialPath.tabType path <- T.useBox $ NTC.initialPageParams props.session initialPath.corpusId [initialPath.listId] initialPath.tabType
{ listIds, nodeId, params, tabType } <- T.useLive T.unequal path { listIds, nodeId, params } <- T.useLive T.unequal path
let path' = { let path' = {
corpusId: nodeId corpusId: nodeId
, limit: params.limit , limit: params.limit
...@@ -102,7 +100,7 @@ ngramsViewCpt = here.component "ngramsView" cpt where ...@@ -102,7 +100,7 @@ ngramsViewCpt = here.component "ngramsView" cpt where
where where
afterSync chartsReload _ = do afterSync chartsReload _ = do
case mNgramsType of case mNgramsType of
Just ngramsType -> do Just _ -> do
-- NOTE: No need to recompute chart, after ngrams are sync this -- NOTE: No need to recompute chart, after ngrams are sync this
-- should be recomputed already -- should be recomputed already
-- We just refresh it -- We just refresh it
...@@ -120,7 +118,7 @@ ngramsViewCpt = here.component "ngramsView" cpt where ...@@ -120,7 +118,7 @@ ngramsViewCpt = here.component "ngramsView" cpt where
, tabType , tabType
} }
charts params CTabTerms = [ charts _params CTabTerms = [
H.div {className: "row"} H.div {className: "row"}
[ H.div {className: "col-12 d-flex justify-content-center"} [ H.div {className: "col-12 d-flex justify-content-center"}
[ H.img { src: "images/Gargantextuel-212x300.jpg" [ H.img { src: "images/Gargantextuel-212x300.jpg"
......
...@@ -381,10 +381,10 @@ type SidePanelProps = ( ...@@ -381,10 +381,10 @@ type SidePanelProps = (
, sidePanel :: T.Box (Maybe (Record TT.SidePanel)) , sidePanel :: T.Box (Maybe (Record TT.SidePanel))
) )
sidePanel :: R2.Component SidePanelProps textsSidePanel :: R2.Component SidePanelProps
sidePanel = R.createElement sidePanelCpt textsSidePanel = R.createElement textsSidePanelCpt
sidePanelCpt :: R.Component SidePanelProps textsSidePanelCpt :: R.Component SidePanelProps
sidePanelCpt = here.component "sidePanel" cpt textsSidePanelCpt = here.component "sidePanel" cpt
where where
cpt { boxes: { sidePanelState } cpt { boxes: { sidePanelState }
, session , session
...@@ -465,7 +465,6 @@ type SidePanelDocView = ( ...@@ -465,7 +465,6 @@ type SidePanelDocView = (
sidePanelDocView :: R2.Component SidePanelDocView sidePanelDocView :: R2.Component SidePanelDocView
sidePanelDocView = R.createElement sidePanelDocViewCpt sidePanelDocView = R.createElement sidePanelDocViewCpt
sidePanelDocViewCpt :: R.Component SidePanelDocView sidePanelDocViewCpt :: R.Component SidePanelDocView
sidePanelDocViewCpt = here.component "sidePanelDocView" cpt sidePanelDocViewCpt = here.component "sidePanelDocView" cpt
where where
......
...@@ -2,7 +2,6 @@ module Gargantext.Components.Nodes.Texts.SidePanelToggleButton ...@@ -2,7 +2,6 @@ module Gargantext.Components.Nodes.Texts.SidePanelToggleButton
( Props, sidePanelToggleButton ( Props, sidePanelToggleButton
) where ) where
import Data.Tuple.Nested ((/\))
import Prelude import Prelude
import Reactix as R import Reactix as R
import Reactix.DOM.HTML as H import Reactix.DOM.HTML as H
......
module Gargantext.Components.Renameable where module Gargantext.Components.Renameable where
import Data.Tuple (Tuple(..), fst, snd)
import Data.Tuple.Nested ((/\))
import Effect (Effect) import Effect (Effect)
import Reactix as R import Reactix as R
import Reactix.DOM.HTML as H import Reactix.DOM.HTML as H
...@@ -24,7 +22,6 @@ type RenameableProps = ...@@ -24,7 +22,6 @@ type RenameableProps =
renameable :: R2.Component RenameableProps renameable :: R2.Component RenameableProps
renameable = R.createElement renameableCpt renameable = R.createElement renameableCpt
renameableCpt :: R.Component RenameableProps renameableCpt :: R.Component RenameableProps
renameableCpt = here.component "renameableCpt" cpt renameableCpt = here.component "renameableCpt" cpt
where where
...@@ -54,11 +51,10 @@ type RenameableTextProps = ...@@ -54,11 +51,10 @@ type RenameableTextProps =
renameableText :: R2.Component RenameableTextProps renameableText :: R2.Component RenameableTextProps
renameableText = R.createElement renameableTextCpt renameableText = R.createElement renameableTextCpt
renameableTextCpt :: R.Component RenameableTextProps renameableTextCpt :: R.Component RenameableTextProps
renameableTextCpt = here.component "renameableText" cpt renameableTextCpt = here.component "renameableText" cpt
where where
cpt props@{ isEditing, state } _ = do cpt props@{ isEditing } _ = do
isEditing' <- T.useLive T.unequal isEditing isEditing' <- T.useLive T.unequal isEditing
pure $ if isEditing' then pure $ if isEditing' then
...@@ -69,11 +65,10 @@ renameableTextCpt = here.component "renameableText" cpt ...@@ -69,11 +65,10 @@ renameableTextCpt = here.component "renameableText" cpt
notEditing :: R2.Component RenameableTextProps notEditing :: R2.Component RenameableTextProps
notEditing = R.createElement notEditingCpt notEditing = R.createElement notEditingCpt
notEditingCpt :: R.Component RenameableTextProps notEditingCpt :: R.Component RenameableTextProps
notEditingCpt = here.component "notEditing" cpt notEditingCpt = here.component "notEditing" cpt
where where
cpt props@{ isEditing, state } _ = do cpt { isEditing, state } _ = do
state' <- T.useLive T.unequal state state' <- T.useLive T.unequal state
pure $ H.div { className: "input-group" } pure $ H.div { className: "input-group" }
...@@ -90,11 +85,10 @@ notEditingCpt = here.component "notEditing" cpt ...@@ -90,11 +85,10 @@ notEditingCpt = here.component "notEditing" cpt
editing :: R2.Component RenameableTextProps editing :: R2.Component RenameableTextProps
editing = R.createElement editingCpt editing = R.createElement editingCpt
editingCpt :: R.Component RenameableTextProps editingCpt :: R.Component RenameableTextProps
editingCpt = here.component "editing" cpt editingCpt = here.component "editing" cpt
where where
cpt props@{ isEditing, onRename, state } _ = do cpt { isEditing, onRename, state } _ = do
state' <- T.useLive T.unequal state state' <- T.useLive T.unequal state
pure $ H.div { className: "input-group" } pure $ H.div { className: "input-group" }
......
...@@ -232,7 +232,7 @@ openedSidePanelCpt = here.component "openedSidePanel" cpt where ...@@ -232,7 +232,7 @@ openedSidePanelCpt = here.component "openedSidePanel" cpt where
} [] ] } [] ]
GR.Texts _s _n -> do GR.Texts _s _n -> do
pure $ wrapper pure $ wrapper
[ Texts.sidePanel { boxes [ Texts.textsSidePanel { boxes
, session , session
, sidePanel: sidePanelTexts } [] ] , sidePanel: sidePanelTexts } [] ]
_ -> pure $ wrapper [] _ -> pure $ wrapper []
......
...@@ -160,7 +160,7 @@ type FilterRowsParams = ...@@ -160,7 +160,7 @@ type FilterRowsParams =
) )
filterRows :: forall a. Record FilterRowsParams -> Seq.Seq a -> Seq.Seq a filterRows :: forall a. Record FilterRowsParams -> Seq.Seq a -> Seq.Seq a
filterRows { params: { limit, offset, orderBy } } rs = newRs filterRows { params: { limit, offset } } rs = newRs
where where
newRs = Seq.take limit $ Seq.drop offset $ rs newRs = Seq.take limit $ Seq.drop offset $ rs
......
...@@ -163,7 +163,7 @@ menuButton = R.createElement menuButtonCpt ...@@ -163,7 +163,7 @@ menuButton = R.createElement menuButtonCpt
menuButtonCpt :: R.Component MenuButtonProps menuButtonCpt :: R.Component MenuButtonProps
menuButtonCpt = here.component "menuButton" cpt menuButtonCpt = here.component "menuButton" cpt
where where
cpt { element: LiNav { title, href, icon, text }, show } _ = do cpt { element: LiNav { icon, text, title }, show } _ = do
pure $ H.a { className: "dropdown-toggle navbar-text" pure $ H.a { className: "dropdown-toggle navbar-text"
-- , data: {toggle: "dropdown"} -- , data: {toggle: "dropdown"}
, title , title
......
...@@ -21,7 +21,6 @@ import Gargantext.Utils.Crypto (Hash) ...@@ -21,7 +21,6 @@ import Gargantext.Utils.Crypto (Hash)
import Gargantext.Utils.Reactix as R2 import Gargantext.Utils.Reactix as R2
import Reactix as R import Reactix as R
import Simple.JSON as JSON import Simple.JSON as JSON
import Toestand (Box)
import Toestand as T import Toestand as T
here :: R2.Here here :: R2.Here
......
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