Verified Commit 80d78594 authored by Przemyslaw Kaminski's avatar Przemyslaw Kaminski

Merge branch 'dev' into 547-dev-ngrams-context-sidebar

parents 57f2c0d5 1e7423bc
...@@ -12271,6 +12271,12 @@ select.form-control { ...@@ -12271,6 +12271,12 @@ select.form-control {
height: auto; height: auto;
} }
.search-modal__results {
height: 14em;
overflow-x: hidden;
overflow-y: scroll;
}
.dropdown-menu { .dropdown-menu {
background-color: #181A1B; background-color: #181A1B;
} }
......
...@@ -12072,6 +12072,12 @@ select.form-control { ...@@ -12072,6 +12072,12 @@ select.form-control {
height: auto; height: auto;
} }
.search-modal__results {
height: 14em;
overflow-x: hidden;
overflow-y: scroll;
}
.btn-secondary, .btn-secondary,
.btn-secondary:hover, .btn-secondary:hover,
.btn-outline-secondary:not(:disabled):not(.disabled):hover, .btn-outline-secondary:not(:disabled):not(.disabled):hover,
......
...@@ -11837,4 +11837,10 @@ select.form-control { ...@@ -11837,4 +11837,10 @@ select.form-control {
height: auto; height: auto;
} }
.search-modal__results {
height: 14em;
overflow-x: hidden;
overflow-y: scroll;
}
/*# sourceMappingURL=bootstrap-greyson.css.map */ /*# sourceMappingURL=bootstrap-greyson.css.map */
...@@ -12085,4 +12085,10 @@ select.form-control { ...@@ -12085,4 +12085,10 @@ select.form-control {
height: auto; height: auto;
} }
.search-modal__results {
height: 14em;
overflow-x: hidden;
overflow-y: scroll;
}
/*# sourceMappingURL=bootstrap-herbie.css.map */ /*# sourceMappingURL=bootstrap-herbie.css.map */
...@@ -12086,4 +12086,10 @@ select.form-control { ...@@ -12086,4 +12086,10 @@ select.form-control {
height: auto; height: auto;
} }
.search-modal__results {
height: 14em;
overflow-x: hidden;
overflow-y: scroll;
}
/*# sourceMappingURL=bootstrap-monotony.css.map */ /*# sourceMappingURL=bootstrap-monotony.css.map */
{ {
"name": "Gargantext", "name": "Gargantext",
"version": "0.0.6.9.9.5.2", "version": "0.0.6.9.9.5.7",
"scripts": { "scripts": {
"generate-purs-packages-nix": "./nix/generate-purs-packages.nix", "generate-purs-packages-nix": "./nix/generate-purs-packages.nix",
"generate-psc-packages-nix": "./nix/generate-packages-json.bash", "generate-psc-packages-nix": "./nix/generate-packages-json.bash",
......
...@@ -14,7 +14,9 @@ module Gargantext.Components.Annotation.Field where ...@@ -14,7 +14,9 @@ module Gargantext.Components.Annotation.Field where
import Gargantext.Prelude import Gargantext.Prelude
import Data.Array as A import Data.Array as A
import Data.FoldableWithIndex (foldlWithIndex, foldrWithIndex)
import Data.List (List(..), (:)) import Data.List (List(..), (:))
import Data.Map (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)
...@@ -23,8 +25,8 @@ import DOM.Simple.Event as DE ...@@ -23,8 +25,8 @@ import DOM.Simple.Event as DE
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 (findNgramTermList, highlightNgrams, normNgram) import Gargantext.Core.NgramsTable.Functions (Cache, findNgramTermList, highlightNgrams, normNgram)
import Gargantext.Core.NgramsTable.Types (HighlightElement, NgramsTable, NgramsTerm(..)) import Gargantext.Core.NgramsTable.Types (HighlightElement, NgramsRepoElement(..), NgramsTable(..), NgramsTerm(..), parentMap)
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
...@@ -43,6 +45,7 @@ type Props = ...@@ -43,6 +45,7 @@ type Props =
, setTermList :: NgramsTerm -> Maybe TermList -> TermList -> Effect Unit , setTermList :: NgramsTerm -> Maybe TermList -> TermList -> Effect Unit
, text :: Maybe String , text :: Maybe String
, mode :: ModeType , mode :: ModeType
, cache :: Record Cache
) )
type MouseEvent = E.SyntheticEvent DE.MouseEvent type MouseEvent = E.SyntheticEvent DE.MouseEvent
...@@ -78,6 +81,7 @@ annotatedFieldInnerCpt = here.component "annotatedFieldInner" cpt where ...@@ -78,6 +81,7 @@ annotatedFieldInnerCpt = here.component "annotatedFieldInner" cpt where
, setTermList , setTermList
, text: fieldText , text: fieldText
, mode , mode
, cache
} _ = do } _ = do
-- | States -- | States
-- | -- |
...@@ -88,7 +92,7 @@ annotatedFieldInnerCpt = here.component "annotatedFieldInner" cpt where ...@@ -88,7 +92,7 @@ annotatedFieldInnerCpt = here.component "annotatedFieldInner" cpt where
-- | Computed -- | Computed
-- | -- |
let let
wrap :: HighlightElement -> Record RunProps wrap :: Tuple String (List (Tuple NgramsTerm TermList)) -> Record RunProps
wrap (text /\ list) wrap (text /\ list)
= { list = { list
, onSelect: onAnnotationSelect { menuRef, ngrams, redrawMenu, setTermList } , onSelect: onAnnotationSelect { menuRef, ngrams, redrawMenu, setTermList }
...@@ -110,7 +114,7 @@ annotatedFieldInnerCpt = here.component "annotatedFieldInner" cpt where ...@@ -110,7 +114,7 @@ annotatedFieldInnerCpt = here.component "annotatedFieldInner" cpt where
H.div H.div
{ className: "annotated-field-runs" } { className: "annotated-field-runs" }
((\p -> annotateRun p) <$> wrap <$> compile ngrams fieldText) ((\p -> annotateRun p) <$> wrap <$> compile cache ngrams fieldText)
AdditionMode -> AdditionMode ->
...@@ -132,10 +136,11 @@ annotatedFieldInnerCpt = here.component "annotatedFieldInner" cpt where ...@@ -132,10 +136,11 @@ annotatedFieldInnerCpt = here.component "annotatedFieldInner" cpt where
----------------------------------------------------------- -----------------------------------------------------------
compile :: compile ::
NgramsTable Record Cache
-> NgramsTable
-> Maybe String -> Maybe String
-> Array HighlightElement -> Array HighlightElement
compile ngrams = maybe [] (highlightNgrams CTabTerms ngrams) compile cache ngrams = maybe [] (highlightNgrams CTabTerms ngrams cache)
-- Runs -- Runs
......
...@@ -37,7 +37,7 @@ type AnnotationMenu = ...@@ -37,7 +37,7 @@ type AnnotationMenu =
annotationMenu :: R2.Leaf Props annotationMenu :: R2.Leaf Props
annotationMenu = R2.leaf annotationMenuCpt annotationMenu = R2.leaf annotationMenuCpt
annotationMenuCpt :: R.Component Props annotationMenuCpt :: R.Component Props
annotationMenuCpt = here.component "annotationMenu" cpt where annotationMenuCpt = here.component "main" cpt where
cpt { menuRef } _ = do cpt { menuRef } _ = do
-- Render -- Render
pure $ pure $
......
...@@ -56,6 +56,7 @@ type Store = ...@@ -56,6 +56,7 @@ type Store =
, showCorpus :: T.Box Boolean , showCorpus :: T.Box Boolean
, showLogin :: T.Box Boolean , showLogin :: T.Box Boolean
, showTree :: T.Box Boolean , showTree :: T.Box Boolean
, showSearch :: T.Box Boolean
, sidePanelLists :: T.Box (Maybe (Record ListsSP.SidePanel)) , sidePanelLists :: T.Box (Maybe (Record ListsSP.SidePanel))
, sidePanelTexts :: T.Box (Maybe (Record TextsT.SidePanel)) , sidePanelTexts :: T.Box (Maybe (Record TextsT.SidePanel))
, sidePanelState :: T.Box SidePanelState , sidePanelState :: T.Box SidePanelState
...@@ -83,6 +84,7 @@ type State = ...@@ -83,6 +84,7 @@ type State =
, showCorpus :: Boolean , showCorpus :: Boolean
, showLogin :: Boolean , showLogin :: Boolean
, showTree :: Boolean , showTree :: Boolean
, showSearch :: Boolean
, sidePanelLists :: Maybe (Record ListsSP.SidePanel) , sidePanelLists :: Maybe (Record ListsSP.SidePanel)
, sidePanelTexts :: Maybe (Record TextsT.SidePanel) , sidePanelTexts :: Maybe (Record TextsT.SidePanel)
, sidePanelState :: SidePanelState , sidePanelState :: SidePanelState
...@@ -111,6 +113,7 @@ options = ...@@ -111,6 +113,7 @@ options =
, showCorpus : false , showCorpus : false
, showLogin : false , showLogin : false
, showTree : true , showTree : true
, showSearch : false
, sidePanelLists : ListsSP.initialSidePanel , sidePanelLists : ListsSP.initialSidePanel
, sidePanelTexts : TextsT.initialSidePanel , sidePanelTexts : TextsT.initialSidePanel
, sidePanelState : InitialClosed , sidePanelState : InitialClosed
......
...@@ -174,7 +174,7 @@ docViewCpt = here.component "docView" cpt where ...@@ -174,7 +174,7 @@ docViewCpt = here.component "docView" cpt where
eTask <- DFC.create session nodeId fdata eTask <- DFC.create session nodeId fdata
handleRESTError boxes.errors eTask handleRESTError here boxes.errors eTask
\t -> liftEffect $ launchDocumentCreationProgress \t -> liftEffect $ launchDocumentCreationProgress
boxes boxes
session session
...@@ -264,7 +264,7 @@ scanDocumentCreationProgress boxes session nodeId currentTask cbk = do ...@@ -264,7 +264,7 @@ scanDocumentCreationProgress boxes session nodeId currentTask cbk = do
eTask <- DFC.createProgress session nodeId currentTask eTask <- DFC.createProgress session nodeId currentTask
handleRESTError boxes.errors eTask handleRESTError here boxes.errors eTask
\asyncProgress -> liftEffect do \asyncProgress -> liftEffect do
let let
GT.AsyncProgress { status } = asyncProgress GT.AsyncProgress { status } = asyncProgress
......
...@@ -19,7 +19,7 @@ import Gargantext.Components.Category (ratingSimpleLoader) ...@@ -19,7 +19,7 @@ import Gargantext.Components.Category (ratingSimpleLoader)
import Gargantext.Components.Document.Types (DocPath, Document(..), LoadedData, initialState) import Gargantext.Components.Document.Types (DocPath, Document(..), LoadedData, initialState)
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) import Gargantext.Core.NgramsTable.Functions (addNewNgramA, applyNgramsPatches, coreDispatch, findNgramRoot, setTermListA, computeCache)
import Gargantext.Core.NgramsTable.Types (CoreAction(..), Versioned(..), replace) import Gargantext.Core.NgramsTable.Types (CoreAction(..), Versioned(..), replace)
import Gargantext.Hooks.FirstEffect (useFirstEffect') import Gargantext.Hooks.FirstEffect (useFirstEffect')
import Gargantext.Utils ((?)) import Gargantext.Utils ((?))
...@@ -88,11 +88,14 @@ layoutCpt = here.component "layout" cpt where ...@@ -88,11 +88,14 @@ layoutCpt = here.component "layout" cpt where
ngrams = applyNgramsPatches state' initTable ngrams = applyNgramsPatches state' initTable
cache = computeCache ngrams
annotate text = AnnotatedField.annotatedField annotate text = AnnotatedField.annotatedField
{ ngrams { ngrams
, setTermList , setTermList
, text , text
, mode: mode' , mode: mode'
, cache
} }
setTermListOrAddA ngram Nothing = setTermListOrAddA ngram Nothing =
......
...@@ -381,18 +381,18 @@ performAction = performAction' where ...@@ -381,18 +381,18 @@ performAction = performAction' where
updateNode params { boxes: { errors, tasks }, nodeId: id, session } = do updateNode params { boxes: { errors, tasks }, nodeId: id, session } = do
eTask <- updateRequest params session id eTask <- updateRequest params session id
handleRESTError errors eTask $ \task -> liftEffect $ do handleRESTError here errors eTask $ \task -> liftEffect $ do
GAT.insert id task tasks GAT.insert id task tasks
here.log2 "[performAction] UpdateNode task:" task here.log2 "[performAction] UpdateNode task:" task
shareTeam username { boxes: { errors }, nodeId: id, session } = do shareTeam username { boxes: { errors }, nodeId: id, session } = do
eTask <- Share.shareReq session id $ Share.ShareTeamParams { username } eTask <- Share.shareReq session id $ Share.ShareTeamParams { username }
handleRESTError errors eTask $ \_task -> pure unit handleRESTError here errors eTask $ \_task -> pure unit
sharePublic params p@{ boxes: { errors }, session } = traverse_ f params where sharePublic params p@{ boxes: { errors }, session } = traverse_ f params where
f (SubTreeOut { in: inId, out }) = do f (SubTreeOut { in: inId, out }) = do
eTask <- Share.shareReq session inId $ Share.SharePublicParams { node_id: out } eTask <- Share.shareReq session inId $ Share.SharePublicParams { node_id: out }
handleRESTError errors eTask $ \_task -> pure unit handleRESTError here errors eTask $ \_task -> pure unit
refreshFolders p refreshFolders p
addContact params { nodeId: id, session } = addContact params { nodeId: id, session } =
...@@ -400,40 +400,40 @@ performAction = performAction' where ...@@ -400,40 +400,40 @@ performAction = performAction' where
uploadFile' nodeType fileType fileFormat lang mName contents { boxes: { errors, tasks }, nodeId: id, session } selection = do uploadFile' nodeType fileType fileFormat lang mName contents { boxes: { errors, tasks }, nodeId: id, session } selection = do
eTask <- uploadFile { contents, fileType, fileFormat, lang, id, nodeType, mName, selection, session } eTask <- uploadFile { contents, fileType, fileFormat, lang, id, nodeType, mName, selection, session }
handleRESTError errors eTask $ \task -> liftEffect $ do handleRESTError here errors eTask $ \task -> liftEffect $ do
GAT.insert id task tasks GAT.insert id task tasks
here.log2 "[performAction] UploadFile, uploaded, task:" task here.log2 "[performAction] UploadFile, uploaded, task:" task
uploadArbitraryFile' fileFormat mName blob { boxes: { errors, tasks }, nodeId: id, session } selection = do uploadArbitraryFile' fileFormat mName blob { boxes: { errors, tasks }, nodeId: id, session } selection = do
eTask <- uploadArbitraryFile session id { blob, fileFormat, mName } selection eTask <- uploadArbitraryFile session id { blob, fileFormat, mName } selection
handleRESTError errors eTask $ \task -> liftEffect $ do handleRESTError here errors eTask $ \task -> liftEffect $ do
GAT.insert id task tasks GAT.insert id task tasks
here.log2 "[performAction] UploadArbitraryFile, uploaded, task:" task here.log2 "[performAction] UploadArbitraryFile, uploaded, task:" task
moveNode params p@{ boxes: { errors }, session } = traverse_ f params where moveNode params p@{ boxes: { errors }, session } = traverse_ f params where
f (SubTreeOut { in: in', out }) = do f (SubTreeOut { in: in', out }) = do
eTask <- moveNodeReq session in' out eTask <- moveNodeReq session in' out
handleRESTError errors eTask $ \_task -> pure unit handleRESTError here errors eTask $ \_task -> pure unit
refreshFolders p refreshFolders p
mergeNode params p@{ boxes: { errors }, session } = traverse_ f params where mergeNode params p@{ boxes: { errors }, session } = traverse_ f params where
f (SubTreeOut { in: in', out }) = do f (SubTreeOut { in: in', out }) = do
eTask <- mergeNodeReq session in' out eTask <- mergeNodeReq session in' out
handleRESTError errors eTask $ \_task -> pure unit handleRESTError here errors eTask $ \_task -> pure unit
refreshFolders p refreshFolders p
linkNode nodeType params p@{ boxes: { errors }, session } = traverse_ f params where linkNode nodeType params p@{ boxes: { errors }, session } = traverse_ f params where
f (SubTreeOut { in: in', out }) = do f (SubTreeOut { in: in', out }) = do
eTask <- linkNodeReq session nodeType in' out eTask <- linkNodeReq session nodeType in' out
handleRESTError errors eTask $ \_task -> pure unit handleRESTError here errors eTask $ \_task -> pure unit
refreshFolders p refreshFolders p
renameNode name p@{ boxes: { errors }, nodeId: id, session } = do renameNode name p@{ boxes: { errors }, nodeId: id, session } = do
eTask <- rename session id $ RenameValue { text: name } eTask <- rename session id $ RenameValue { text: name }
handleRESTError errors eTask $ \_task -> pure unit handleRESTError here errors eTask $ \_task -> pure unit
refreshFolders p refreshFolders p
addNode' name nodeType p@{ boxes: { errors }, nodeId: id, session } = do addNode' name nodeType p@{ boxes: { errors }, nodeId: id, session } = do
eTask <- addNode session id $ AddNodeValue {name, nodeType} eTask <- addNode session id $ AddNodeValue {name, nodeType}
handleRESTError errors eTask $ \_task -> pure unit handleRESTError here errors eTask $ \_task -> pure unit
refreshFolders p refreshFolders p
...@@ -84,7 +84,7 @@ plus :: R2.Leaf Plus ...@@ -84,7 +84,7 @@ plus :: R2.Leaf Plus
plus = R2.leaf plusCpt plus = R2.leaf plusCpt
plusCpt :: R.Component Plus plusCpt :: R.Component Plus
plusCpt = here.component "plus" cpt where plusCpt = here.component "plus" cpt where
cpt { boxes: { backend, showLogin, pinnedTreeId} } _ = do cpt { boxes: { backend, showLogin, showSearch, pinnedTreeId} } _ = do
-- Hooks -- Hooks
{ goToRoute } <- useLinkHandler { goToRoute } <- useLinkHandler
...@@ -98,6 +98,7 @@ plusCpt = here.component "plus" cpt where ...@@ -98,6 +98,7 @@ plusCpt = here.component "plus" cpt where
-- Render -- Render
pure $ pure $
R.fragment [
H.div H.div
{ className: "forest-layout__action" } { className: "forest-layout__action" }
[ [
...@@ -154,6 +155,32 @@ plusCpt = here.component "plus" cpt where ...@@ -154,6 +155,32 @@ plusCpt = here.component "plus" cpt where
] ]
} }
] ]
,
H.div
{ className: "forest-layout__action" }
[
B.tooltipContainer
{ delayShow: 600
, position: TooltipPosition Right
, tooltipSlot:
B.span_ "Search in tree"
, defaultSlot:
B.button
{ className: "forest-layout__action__button"
, callback: \_ -> T.write_ true showSearch
, variant: ButtonVariant Light
}
[
B.icon
{ name: "search"}
,
B.wad_ [ "d-inline-block", "w-1" ]
,
H.text $ "Search"
]
}
]
]
--, H.div { "type": "", className: "fa fa-plus-circle fa-lg"} [] --, H.div { "type": "", className: "fa fa-plus-circle fa-lg"} []
--, H.div { "type": "", className: "fa fa-minus-circle fa-lg"} [] --, H.div { "type": "", className: "fa fa-minus-circle fa-lg"} []
-- TODO same as the one in the Login Modal (same CSS) -- TODO same as the one in the Login Modal (same CSS)
......
...@@ -315,78 +315,78 @@ doSearch task { boxes: { tasks }, tree: NTree (LNode {id}) _ } = liftEffect $ do ...@@ -315,78 +315,78 @@ doSearch task { boxes: { tasks }, tree: NTree (LNode {id}) _ } = liftEffect $ do
updateNode params p@{ boxes: { errors, tasks }, session, tree: (NTree (LNode {id}) _) } = do updateNode params p@{ boxes: { errors, tasks }, session, tree: (NTree (LNode {id}) _) } = do
eTask <- updateRequest params session id eTask <- updateRequest params session id
handleRESTError errors eTask $ \task -> liftEffect $ do handleRESTError here errors eTask $ \task -> liftEffect $ do
GAT.insert id task tasks GAT.insert id task tasks
here.log2 "[updateNode] UpdateNode task:" task here.log2 "[updateNode] UpdateNode task:" task
closeBox p closeBox p
renameNode name p@{ boxes: { errors }, session, tree: (NTree (LNode {id}) _) } = do renameNode name p@{ boxes: { errors }, session, tree: (NTree (LNode {id}) _) } = do
eTask <- rename session id $ RenameValue { text: name } eTask <- rename session id $ RenameValue { text: name }
handleRESTError errors eTask $ \_task -> pure unit handleRESTError here errors eTask $ \_task -> pure unit
refreshTree p refreshTree p
shareTeam username { 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 here errors eTask $ \_task -> pure unit
sharePublic params p@{ boxes: { errors, forestOpen }, session } = traverse_ f params where sharePublic params p@{ boxes: { errors, forestOpen }, session } = traverse_ f params where
f (SubTreeOut { in: inId, out }) = do f (SubTreeOut { in: inId, out }) = do
eTask <- Share.shareReq session inId $ Share.SharePublicParams { node_id: out } eTask <- Share.shareReq session inId $ Share.SharePublicParams { node_id: out }
handleRESTError errors eTask $ \_task -> do handleRESTError here errors eTask $ \_task -> do
liftEffect $ T.modify_ (openNodesInsert (mkNodeId p.session out)) forestOpen liftEffect $ T.modify_ (openNodesInsert (mkNodeId p.session out)) forestOpen
refreshTree p refreshTree p
addContact params { 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 here errors eTask $ \_task -> pure unit
addNode' name nodeType p@{ boxes: { errors, forestOpen }, session, tree: (NTree (LNode { id }) _) } = do addNode' name nodeType p@{ boxes: { errors, forestOpen }, session, tree: (NTree (LNode { id }) _) } = do
eId <- addNode session id $ AddNodeValue { name, nodeType } eId <- addNode session id $ AddNodeValue { name, nodeType }
handleRESTError errors eId $ \_id -> liftEffect $ do handleRESTError here errors eId $ \_id -> liftEffect $ do
liftEffect $ T.modify_ (openNodesInsert (mkNodeId session id)) forestOpen liftEffect $ T.modify_ (openNodesInsert (mkNodeId session id)) forestOpen
refreshTree p refreshTree p
uploadFile' nodeType fileType fileFormat lang mName contents p@{ boxes: { errors, tasks }, session, tree: (NTree (LNode { id }) _) } selection = do uploadFile' nodeType fileType fileFormat lang mName contents p@{ boxes: { errors, tasks }, session, tree: (NTree (LNode { id }) _) } selection = do
eTask <- uploadFile { contents, fileFormat, fileType, id, lang, mName, nodeType, selection, session } eTask <- uploadFile { contents, fileFormat, fileType, id, lang, mName, nodeType, selection, session }
handleRESTError errors eTask $ \task -> liftEffect $ do handleRESTError here 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
closeBox p closeBox p
uploadArbitraryFile' fileFormat mName blob p@{ boxes: { errors, tasks }, session, tree: (NTree (LNode { id }) _) } selection = do uploadArbitraryFile' fileFormat mName blob p@{ boxes: { errors, tasks }, session, tree: (NTree (LNode { id }) _) } selection = do
eTask <- uploadArbitraryFile session id { blob, fileFormat, mName } selection eTask <- uploadArbitraryFile session id { blob, fileFormat, mName } selection
handleRESTError errors eTask $ \task -> liftEffect $ do handleRESTError here errors eTask $ \task -> liftEffect $ do
GAT.insert id task tasks GAT.insert id task tasks
here.log2 "[uploadArbitraryFile'] UploadArbitraryFile, uploaded, task:" task here.log2 "[uploadArbitraryFile'] UploadArbitraryFile, uploaded, task:" task
uploadFrameCalc' lang p@{ boxes: { errors, tasks }, session, tree: (NTree (LNode { id }) _) } selection = do uploadFrameCalc' lang p@{ boxes: { errors, tasks }, session, tree: (NTree (LNode { id }) _) } selection = do
eTask <- uploadFrameCalc session id lang selection eTask <- uploadFrameCalc session id lang selection
handleRESTError errors eTask $ \task -> liftEffect $ do handleRESTError here errors eTask $ \task -> liftEffect $ do
GAT.insert id task tasks GAT.insert id task tasks
here.log2 "[performAction] UploadFrameCalc, uploaded, task:" task here.log2 "[performAction] UploadFrameCalc, uploaded, task:" task
moveNode params p@{ boxes: { errors, forestOpen }, session } = traverse_ f params where moveNode params p@{ boxes: { errors, forestOpen }, session } = traverse_ f params where
f (SubTreeOut { in: in', out }) = do f (SubTreeOut { in: in', out }) = do
eTask <- moveNodeReq session in' out eTask <- moveNodeReq session in' out
handleRESTError errors eTask $ \_task -> pure unit handleRESTError here errors eTask $ \_task -> pure unit
liftEffect $ T.modify_ (openNodesInsert (mkNodeId session out)) forestOpen liftEffect $ T.modify_ (openNodesInsert (mkNodeId session out)) forestOpen
refreshTree p refreshTree p
mergeNode params p@{ boxes: { errors }, session } = traverse_ f params where mergeNode params p@{ boxes: { errors }, session } = traverse_ f params where
f (SubTreeOut { in: in', out }) = do f (SubTreeOut { in: in', out }) = do
eTask <- mergeNodeReq session in' out eTask <- mergeNodeReq session in' out
handleRESTError errors eTask $ \_task -> pure unit handleRESTError here errors eTask $ \_task -> pure unit
refreshTree p refreshTree p
linkNode nodeType params p@{ boxes: { errors }, session } = traverse_ f params where linkNode nodeType params p@{ boxes: { errors }, session } = traverse_ f params where
f (SubTreeOut { in: in', out }) = do f (SubTreeOut { in: in', out }) = do
eTask <- linkNodeReq session nodeType in' out eTask <- linkNodeReq session nodeType in' out
handleRESTError errors eTask $ \_task -> pure unit handleRESTError here errors eTask $ \_task -> pure unit
refreshTree p refreshTree p
documentsFromWriteNodes params p@{ boxes: { errors, tasks }, session, tree: NTree (LNode { id }) _ } = do documentsFromWriteNodes params p@{ boxes: { errors, tasks }, session, tree: NTree (LNode { id }) _ } = do
eTask <- documentsFromWriteNodesReq session params eTask <- documentsFromWriteNodesReq session params
handleRESTError errors eTask $ \task -> liftEffect $ do handleRESTError here errors eTask $ \task -> liftEffect $ do
GAT.insert id task tasks GAT.insert id task tasks
pure unit pure unit
refreshTree p refreshTree p
......
...@@ -621,7 +621,7 @@ triggerSearch { onSearch, errors, session, selection, search } = ...@@ -621,7 +621,7 @@ triggerSearch { onSearch, errors, session, selection, search } =
Just id -> do Just id -> do
liftEffect $ here.log2 "[triggerSearch] searchQuery" $ searchQuery selection search liftEffect $ here.log2 "[triggerSearch] searchQuery" $ searchQuery selection search
eTask <- performSearch session id $ searchQuery selection search eTask <- performSearch session id $ searchQuery selection search
handleRESTError errors eTask $ \task -> liftEffect $ do handleRESTError here errors eTask $ \task -> liftEffect $ do
here.log2 "[triggerSearch] task" task here.log2 "[triggerSearch] task" task
onSearch task onSearch task
......
...@@ -104,7 +104,7 @@ allDatabases = [ Empty ...@@ -104,7 +104,7 @@ allDatabases = [ Empty
, HAL Nothing , HAL Nothing
, IsTex , IsTex
-- , IsTex_Advanced -- , IsTex_Advanced
, Isidore -- , Isidore
--, Web --, Web
--, News --, News
--, SocialNetworks --, SocialNetworks
......
...@@ -66,7 +66,7 @@ actionUploadCpt = here.component "actionUpload" cpt where ...@@ -66,7 +66,7 @@ actionUploadCpt = here.component "actionUpload" cpt where
cpt { nodeType: NodeList, dispatch, id, session } _ = cpt { nodeType: NodeList, dispatch, id, session } _ =
pure $ uploadTermListView { dispatch, id, nodeType: GT.NodeList, session } [] pure $ uploadTermListView { dispatch, id, nodeType: GT.NodeList, session } []
cpt props@{ nodeType: NodeFrameCalc } _ = pure $ uploadFrameCalcView props [] cpt props@{ nodeType: Calc } _ = pure $ uploadFrameCalcView props []
cpt props@{ nodeType: Annuaire, dispatch, id, session } _ = cpt props@{ nodeType: Annuaire, dispatch, id, session } _ =
pure $ uploadListView { dispatch, id, nodeType: GT.Annuaire, session } pure $ uploadListView { dispatch, id, nodeType: GT.Annuaire, session }
......
...@@ -111,11 +111,11 @@ settingsBox FolderPrivate = ...@@ -111,11 +111,11 @@ settingsBox FolderPrivate =
SettingsBox { show : true SettingsBox { show : true
, edit : false , edit : false
, doc : Documentation FolderPrivate , doc : Documentation FolderPrivate
, buttons : [ Add [ Corpus , buttons : [ Add [ Notes
, Corpus
, Calc
, Folder , Folder
, Annuaire , Annuaire
, NodeFrameWrite
, NodeFrameCalc
-- , NodeFrameNotebook -- , NodeFrameNotebook
] ]
] ]
...@@ -125,13 +125,13 @@ settingsBox Team = ...@@ -125,13 +125,13 @@ settingsBox Team =
SettingsBox { show : true SettingsBox { show : true
, edit : true , edit : true
, doc : Documentation Team , doc : Documentation Team
, buttons : [ Add [ Corpus , buttons : [ Add [ Notes
, Corpus
, Calc
, Folder , Folder
, Team
, Annuaire , Annuaire
, NodeFrameWrite
, NodeFrameCalc
-- , NodeFrameNotebook -- , NodeFrameNotebook
, Team
, FolderShared , FolderShared
, NodeFrameVisio , NodeFrameVisio
] ]
...@@ -161,11 +161,11 @@ settingsBox Folder = ...@@ -161,11 +161,11 @@ settingsBox Folder =
SettingsBox { show : true SettingsBox { show : true
, edit : true , edit : true
, doc : Documentation Folder , doc : Documentation Folder
, buttons : [ Add [ Corpus , buttons : [ Add [ Notes
, Corpus
, Calc
, Folder , Folder
, Annuaire , Annuaire
, NodeFrameWrite
, NodeFrameCalc
-- , NodeFrameNotebook -- , NodeFrameNotebook
] ]
, Move moveParameters , Move moveParameters
...@@ -177,22 +177,21 @@ settingsBox Corpus = ...@@ -177,22 +177,21 @@ settingsBox Corpus =
SettingsBox { show : true SettingsBox { show : true
, edit : true , edit : true
, doc : Documentation Corpus , doc : Documentation Corpus
, buttons : [ Upload , buttons : [ Add [ Graph
, SearchBox , Notes
, Download , NodeTexts
--, Clone
, Add [ NodeTexts
, NodeList , NodeList
, Graph , Graph
, Dashboard , Dashboard
, NodeFrameWrite
, NodeFrameCalc
, Phylo , Phylo
-- , NodeFrameNotebook -- , NodeFrameNotebook
] ]
, Link (linkParams Annuaire)
, Move moveParameters , Move moveParameters
, Upload
, SearchBox
, WriteNodesDocuments , WriteNodesDocuments
, Download
, Link (linkParams Annuaire)
, Delete , Delete
] ]
} }
...@@ -314,12 +313,12 @@ settingsBox Annuaire = ...@@ -314,12 +313,12 @@ settingsBox Annuaire =
} }
settingsBox NodeFrameWrite = settingsBox Notes =
SettingsBox { show : true SettingsBox { show : true
, edit : true , edit : true
, doc : Documentation NodeFrameWrite , doc : Documentation Notes
, buttons : [ Add [ NodeFrameWrite , buttons : [ Add [ Notes
, NodeFrameCalc , Calc
, Folder , Folder
, Corpus , Corpus
] ]
...@@ -329,13 +328,13 @@ settingsBox NodeFrameWrite = ...@@ -329,13 +328,13 @@ settingsBox NodeFrameWrite =
} }
settingsBox NodeFrameCalc = settingsBox Calc =
SettingsBox { show : true SettingsBox { show : true
, edit : true , edit : true
, doc : Documentation NodeFrameCalc , doc : Documentation Calc
, buttons : [ Upload , buttons : [ Upload
, Add [ NodeFrameCalc , Add [ Calc
, NodeFrameWrite , Notes
] ]
, Move moveFrameParameters , Move moveFrameParameters
, Delete , Delete
...@@ -346,8 +345,8 @@ settingsBox NodeFrameNotebook = ...@@ -346,8 +345,8 @@ settingsBox NodeFrameNotebook =
SettingsBox { show : true SettingsBox { show : true
, edit : true , edit : true
, doc : Documentation NodeFrameNotebook , doc : Documentation NodeFrameNotebook
, buttons : [ Add [ NodeFrameCalc , buttons : [ Add [ Calc
, NodeFrameWrite , Notes
-- , NodeFrameNotebook -- , NodeFrameNotebook
] ]
, Move moveFrameParameters , Move moveFrameParameters
...@@ -361,8 +360,8 @@ settingsBox NodeFrameVisio = ...@@ -361,8 +360,8 @@ settingsBox NodeFrameVisio =
, edit : true , edit : true
, doc : Documentation NodeFrameVisio , doc : Documentation NodeFrameVisio
, buttons : [ Add [ NodeFrameVisio , buttons : [ Add [ NodeFrameVisio
, NodeFrameWrite , Notes
, NodeFrameCalc , Calc
] ]
, Delete , Delete
] ]
...@@ -393,14 +392,14 @@ moveParameters = { subTreeParams : SubTreeParams ...@@ -393,14 +392,14 @@ moveParameters = { subTreeParams : SubTreeParams
, Team , Team
, FolderPublic , FolderPublic
, Folder , Folder
, NodeFrameWrite , Notes
, Corpus , Corpus
] ]
, valitypes: [ FolderPrivate , valitypes: [ FolderPrivate
, Team , Team
-- , FolderPublic -- , FolderPublic
, Folder , Folder
, NodeFrameWrite , Notes
, Corpus , Corpus
] ]
} }
...@@ -414,16 +413,16 @@ moveFrameParameters = { subTreeParams : SubTreeParams ...@@ -414,16 +413,16 @@ moveFrameParameters = { subTreeParams : SubTreeParams
, FolderPublic , FolderPublic
, Folder , Folder
, Corpus , Corpus
, NodeFrameWrite , Notes
, NodeFrameCalc , Calc
] ]
, valitypes: [ FolderPrivate , valitypes: [ FolderPrivate
, Team , Team
-- , FolderPublic -- , FolderPublic
, Folder , Folder
, Corpus , Corpus
, NodeFrameWrite , Notes
, NodeFrameCalc , Calc
] ]
} }
} }
......
...@@ -54,7 +54,7 @@ asyncProgressBarCpt = here.component "asyncProgressBar" cpt ...@@ -54,7 +54,7 @@ asyncProgressBarCpt = here.component "asyncProgressBar" cpt
launchAff_ $ do launchAff_ $ do
let rdata = (RX.pick props :: Record QueryProgressData) let rdata = (RX.pick props :: Record QueryProgressData)
eAsyncProgress <- queryProgress rdata eAsyncProgress <- queryProgress rdata
handleRESTError errors eAsyncProgress $ \asyncProgress -> liftEffect $ do handleRESTError here errors eAsyncProgress $ \asyncProgress -> liftEffect $ do
let GT.AsyncProgress { status } = asyncProgress let GT.AsyncProgress { status } = asyncProgress
T.write_ (min 100.0 $ GT.progressPercent asyncProgress) progress T.write_ (min 100.0 $ GT.progressPercent asyncProgress) progress
if (status == GT.IsFinished) || (status == GT.IsKilled) || (status == GT.IsFailure) then do if (status == GT.IsFinished) || (status == GT.IsKilled) || (status == GT.IsFailure) then do
......
...@@ -146,6 +146,6 @@ nodeFrameVisioCpt = here.component "nodeFrameVisio" cpt where ...@@ -146,6 +146,6 @@ nodeFrameVisioCpt = here.component "nodeFrameVisio" cpt where
hframeUrl :: NodeType -> Base -> FrameId -> String hframeUrl :: NodeType -> Base -> FrameId -> String
hframeUrl NodeFrameNotebook base frame_id = base <> "/" <> frame_id -- Temp fix : frame_id is currently the whole url created hframeUrl NodeFrameNotebook base frame_id = base <> "/" <> frame_id -- Temp fix : frame_id is currently the whole url created
hframeUrl NodeFrameCalc base frame_id = base <> "/" <> frame_id hframeUrl Calc base frame_id = base <> "/" <> frame_id
hframeUrl NodeFrameVisio base frame_id = base <> "/" <> frame_id hframeUrl NodeFrameVisio base frame_id = base <> "/" <> frame_id
hframeUrl _ base frame_id = base <> "/" <> frame_id <> "?view" -- "?both" hframeUrl _ base frame_id = base <> "/" <> frame_id <> "?view" -- "?both"
...@@ -11,6 +11,7 @@ import Data.List as L ...@@ -11,6 +11,7 @@ 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_)
...@@ -21,7 +22,7 @@ import Gargantext.Components.Bootstrap.Types (Variant(..)) ...@@ -21,7 +22,7 @@ import Gargantext.Components.Bootstrap.Types (Variant(..))
import Gargantext.Components.Nodes.Lists.SidePanel (SidePanel) import Gargantext.Components.Nodes.Lists.SidePanel (SidePanel)
import Gargantext.Components.Table as Tbl 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(..), 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.Sessions (Session)
import Gargantext.Types as GT import Gargantext.Types as GT
...@@ -326,18 +327,23 @@ renderNgramsItemCpt = here.component "renderNgramsItem" cpt ...@@ -326,18 +327,23 @@ renderNgramsItemCpt = here.component "renderNgramsItem" cpt
Nothing -> Nothing ->
span ngramsStyle span ngramsStyle
termList :: GT.TermList
termList = ngramsElement ^. _NgramsElement <<< _list termList = ngramsElement ^. _NgramsElement <<< _list
ngramsStyle :: Array DOM.Props
ngramsStyle = [termStyle termList ngramsOpacity] ngramsStyle = [termStyle termList ngramsOpacity]
ngramsEdit { ngrams: n } = Just $ dispatch $ SetParentResetChildren (Just n) (ngramsChildren n) ngramsEdit { ngrams: n } = Just $ dispatch $ SetParentResetChildren (Just n) (ngramsChildren n)
tbl :: NgramsTable
tbl = applyNgramsPatches { ngramsLocalPatch tbl = applyNgramsPatches { ngramsLocalPatch
, ngramsStagePatch: mempty , ngramsStagePatch: mempty
, ngramsValidPatch: mempty , ngramsValidPatch: mempty
, ngramsVersion: 0 } ngramsTable , ngramsVersion: 0 } ngramsTable
getNgramsChildren' :: NgramsTerm -> Array NgramsTerm getNgramsChildren' :: NgramsTerm -> Array NgramsTerm
getNgramsChildren' n = A.fromFoldable $ ngramsChildren n getNgramsChildren' n = A.fromFoldable $ ngramsChildren n
ngramsChildren :: NgramsTerm -> List NgramsTerm
ngramsChildren n = tbl ^.. ix n <<< _NgramsRepoElement <<< _children <<< folded ngramsChildren n = tbl ^.. ix n <<< _NgramsRepoElement <<< _children <<< folded
ngramsClick = ngramsClick :: { depth :: Int, ngrams :: NgramsTerm } -> Maybe (Effect Unit)
Just <<< dispatch <<< CoreAction <<< cycleTermListItem <<< view _ngrams ngramsClick p = Just $ do
traverse_ (dispatch <<< CoreAction <<< cycleTermListItem) (A.cons p.ngrams $ getNgramsChildren' p.ngrams)
-- ^ 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.
-- However this might expose bugs. One of them can be reproduced -- However this might expose bugs. One of them can be reproduced
...@@ -390,6 +396,7 @@ renderNgramsItemCpt = here.component "renderNgramsItem" cpt ...@@ -390,6 +396,7 @@ renderNgramsItemCpt = here.component "renderNgramsItem" cpt
| ngramsTransient = 0.5 | ngramsTransient = 0.5
| otherwise = 1.0 | otherwise = 1.0
cycleTermListItem :: NgramsTerm -> CoreAction
cycleTermListItem n = setTermListA n (replace termList (nextTermList termList)) cycleTermListItem n = setTermListA n (replace termList (nextTermList termList))
......
...@@ -132,7 +132,7 @@ userLayoutWithKeyCpt = here.component "userLayoutWithKey" cpt where ...@@ -132,7 +132,7 @@ userLayoutWithKeyCpt = here.component "userLayoutWithKey" cpt where
launchAff_ $ do launchAff_ $ do
let Session {userId} = session let Session {userId} = session
res <- saveUserInfo session userId ui res <- saveUserInfo session userId ui
handleRESTError errors res $ \_ -> handleRESTError here errors res $ \_ ->
liftEffect $ T2.reload reload liftEffect $ T2.reload reload
--saveContactHyperdata :: Session -> Int -> HyperdataUser -> AffRESTError Int --saveContactHyperdata :: Session -> Int -> HyperdataUser -> AffRESTError Int
......
module Gargantext.Components.Nodes.Home module Gargantext.Components.Nodes.Home
( Action(..) ( HomeAction(..)
, HomeProps , HomeProps
, State(..) , State(..)
, Tuto(..) , Tuto(..)
...@@ -18,7 +18,7 @@ module Gargantext.Components.Nodes.Home ...@@ -18,7 +18,7 @@ module Gargantext.Components.Nodes.Home
, jumboTitle , jumboTitle
, langLandingData , langLandingData
, license , license
, performAction , performHomeAction
, playTutos , playTutos
, startTutos , startTutos
, summary , summary
...@@ -36,13 +36,14 @@ import Data.Newtype (class Newtype) ...@@ -36,13 +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.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 (Sessions) import Gargantext.Sessions (Session(..), Sessions, Action(Logout), unSessions)
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
...@@ -51,6 +52,9 @@ import Reactix.DOM.HTML as H ...@@ -51,6 +52,9 @@ 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"
...@@ -61,17 +65,17 @@ derive instance Newtype State _ ...@@ -61,17 +65,17 @@ derive instance Newtype State _
initialState :: State initialState :: State
initialState = State { userName: "", password: "" } initialState = State { userName: "", password: "" }
data Action data HomeAction
= Documentation = Documentation
| Enter | Enter
| Login | Login
| SignUp | SignUp
performAction :: Action -> Effect Unit performHomeAction :: HomeAction -> Effect Unit
performAction Documentation = pure unit performHomeAction Documentation = pure unit
performAction Enter = void $ setHash "/search" performHomeAction Enter = void $ setHash "/search"
performAction Login = void $ setHash "/login" performHomeAction Login = void $ setHash "/login"
performAction SignUp = pure unit performHomeAction SignUp = pure unit
langLandingData :: LandingLang -> LandingData langLandingData :: LandingLang -> LandingData
langLandingData LL_FR = Fr.landingData langLandingData LL_FR = Fr.landingData
...@@ -226,7 +230,7 @@ tutorial :: R2.Leaf TutorialProps ...@@ -226,7 +230,7 @@ tutorial :: R2.Leaf TutorialProps
tutorial = R2.leaf tutorialCpt tutorial = R2.leaf tutorialCpt
tutorialCpt :: R.Component TutorialProps tutorialCpt :: R.Component TutorialProps
tutorialCpt = here.component "tutorial" cpt where tutorialCpt = here.component "tutorial" cpt where
cpt { sessions } _ = do cpt { boxes, sessions } _ = do
pure $ pure $
...@@ -249,6 +253,9 @@ tutorialCpt = here.component "tutorial" cpt where ...@@ -249,6 +253,9 @@ tutorialCpt = here.component "tutorial" cpt where
[ video x.id, H.h4 {} [ H.text x.title ], H.p {} [ H.text x.text ] ] [ video x.id, H.h4 {} [ H.text x.title ], H.p {} [ H.text x.text ] ]
-} -}
onSignOutClick session = void $ Sessions.change (Logout session) boxes.sessions
makeFolders :: Array Session -> Array R.Element makeFolders :: Array Session -> Array R.Element
makeFolders s = sessionToFolder <$> s makeFolders s = sessionToFolder <$> s
where where
...@@ -266,14 +273,33 @@ tutorialCpt = here.component "tutorial" cpt where ...@@ -266,14 +273,33 @@ tutorialCpt = here.component "tutorial" cpt where
B.wad B.wad
[ "d-flex", "align-items-center" ] [ "d-flex", "align-items-center" ]
[ [
B.icon B.wad
{ name: "user" } [ "text-left", "w-10/12" ]
, [
B.wad_ B.icon
[ "virtual-space", "w-1" ] { name: "user", className: "pr-1" }
,
B.span_ $
username <> "@" <> cleanBackendUrl backend
]
, ,
B.span_ $ B.wad
username <> "@" <> cleanBackendUrl backend [ "text-right", "w-2/12" ]
[
B.tooltipContainer
{ position: TooltipPosition Top
, delayShow: 600
, tooltipSlot:
B.span_ "Log out"
, defaultSlot:
B.iconButton
{ name: "sign-out"
, callback: \_ -> onSignOutClick session
, elevation: Level2
, className: "text-light"
}
}
]
] ]
] ]
, ,
...@@ -286,6 +312,7 @@ tutorialCpt = here.component "tutorial" cpt where ...@@ -286,6 +312,7 @@ tutorialCpt = here.component "tutorial" cpt where
} }
] ]
] ]
startTutos :: Array Tuto startTutos :: Array Tuto
startTutos = startTutos =
......
...@@ -24,14 +24,15 @@ import Gargantext.Components.Nodes.Corpus.Code (corpusCodeLayout) ...@@ -24,14 +24,15 @@ import Gargantext.Components.Nodes.Corpus.Code (corpusCodeLayout)
import Gargantext.Components.Nodes.Corpus.Dashboard (dashboardLayout) import Gargantext.Components.Nodes.Corpus.Dashboard (dashboardLayout)
import Gargantext.Components.Nodes.Corpus.Document as Document import Gargantext.Components.Nodes.Corpus.Document as Document
import Gargantext.Components.Nodes.Corpus.Phylo as Phylo import Gargantext.Components.Nodes.Corpus.Phylo as Phylo
import Gargantext.Components.Nodes.Graph as Graph
import Gargantext.Components.Nodes.File (fileLayout) import Gargantext.Components.Nodes.File (fileLayout)
import Gargantext.Components.Nodes.Frame as Frame import Gargantext.Components.Nodes.Frame as Frame
import Gargantext.Components.Nodes.Graph as Graph
import Gargantext.Components.Nodes.Home (homeLayout) import Gargantext.Components.Nodes.Home (homeLayout)
import Gargantext.Components.Nodes.Lists as Lists import Gargantext.Components.Nodes.Lists as Lists
import Gargantext.Components.Nodes.Texts as Texts import Gargantext.Components.Nodes.Texts as Texts
import Gargantext.Components.Tile (tileBlock) import Gargantext.Components.Tile (tileBlock)
import Gargantext.Components.TopBar as TopBar import Gargantext.Components.TopBar as TopBar
import Gargantext.Components.TreeSearch (treeSearch)
import Gargantext.Config (defaultFrontends, defaultBackends) import Gargantext.Config (defaultFrontends, defaultBackends)
import Gargantext.Context.Session as SessionContext import Gargantext.Context.Session as SessionContext
import Gargantext.Ends (Backend) import Gargantext.Ends (Backend)
...@@ -100,6 +101,8 @@ routerCpt = here.component "router" cpt where ...@@ -100,6 +101,8 @@ routerCpt = here.component "router" cpt where
{ className: "router" } { className: "router" }
[ [
login' boxes login' boxes
,
treeSearch' boxes
, ,
TopBar.component TopBar.component
{} {}
...@@ -317,11 +320,12 @@ renderRouteCpt = R.memo' $ here.component "renderRoute" cpt where ...@@ -317,11 +320,12 @@ renderRouteCpt = R.memo' $ here.component "renderRoute" cpt where
GR.Home -> home { boxes } [] GR.Home -> home { boxes } []
GR.Lists s n -> lists (sessionNodeProps s n) [] GR.Lists s n -> lists (sessionNodeProps s n) []
GR.Login -> login' boxes GR.Login -> login' boxes
GR.TreeFlat _ _ _ -> treeSearch' boxes
GR.PGraphExplorer s g -> graphExplorer (sessionNodeProps s g) [] GR.PGraphExplorer s g -> graphExplorer (sessionNodeProps s g) []
GR.PhyloExplorer s g -> phyloExplorer (sessionNodeProps s g) [] GR.PhyloExplorer s g -> phyloExplorer (sessionNodeProps s g) []
GR.RouteFile s n -> routeFile (sessionNodeProps s n) [] GR.RouteFile s n -> routeFile (sessionNodeProps s n) []
GR.RouteFrameWrite s n -> routeFrame (Record.merge { nodeType: NodeFrameWrite } $ sessionNodeProps s n) [] GR.RouteFrameWrite s n -> routeFrame (Record.merge { nodeType: Notes } $ sessionNodeProps s n) []
GR.RouteFrameCalc s n -> routeFrame (Record.merge { nodeType: NodeFrameCalc } $ sessionNodeProps s n) [] GR.RouteFrameCalc s n -> routeFrame (Record.merge { nodeType: Calc } $ sessionNodeProps s n) []
GR.RouteFrameCode s n -> routeFrame (Record.merge { nodeType: NodeFrameNotebook } $ sessionNodeProps s n) [] GR.RouteFrameCode s n -> routeFrame (Record.merge { nodeType: NodeFrameNotebook } $ sessionNodeProps s n) []
GR.RouteFrameVisio s n -> routeFrame (Record.merge { nodeType: NodeFrameVisio } $ sessionNodeProps s n) [] GR.RouteFrameVisio s n -> routeFrame (Record.merge { nodeType: NodeFrameVisio } $ sessionNodeProps s n) []
GR.Team s n -> team (sessionNodeProps s n) [] GR.Team s n -> team (sessionNodeProps s n) []
...@@ -601,6 +605,12 @@ login' { backend, sessions, showLogin: visible } = ...@@ -601,6 +605,12 @@ login' { backend, sessions, showLogin: visible } =
-------------------------------------------------------------- --------------------------------------------------------------
treeSearch' :: Boxes -> R.Element
treeSearch' { sessions, showSearch: visible } =
treeSearch { sessions, visible }
--------------------------------------------------------------
routeFile :: R2.Component SessionNodeProps routeFile :: R2.Component SessionNodeProps
routeFile = R.createElement routeFileCpt routeFile = R.createElement routeFileCpt
routeFileCpt :: R.Component SessionNodeProps routeFileCpt :: R.Component SessionNodeProps
......
module Gargantext.Components.TreeSearch where
import Gargantext.Prelude
import Data.Array (head)
import Data.Maybe (Maybe(..), fromMaybe)
import Effect (Effect)
import Gargantext.Components.Bootstrap (formSelect')
import Gargantext.Components.Bootstrap as B
import Gargantext.Components.Bootstrap.Types (ButtonVariant(..), ModalSizing(..), Position(..), TooltipPosition(..), Variant(..))
import Gargantext.Components.InputWithEnter (inputWithEnter)
import Gargantext.Config.REST (AffRESTError, logRESTError)
import Gargantext.Hooks.LinkHandler (useLinkHandler)
import Gargantext.Hooks.Loader (useLoader)
import Gargantext.Routes (AppRoute(..), appPath, nodeTypeAppRoute)
import Gargantext.Sessions (Session(..), Sessions, get, sessionId, unSessions)
import Gargantext.Sessions.Types (Session)
import Gargantext.Types (NodeID, NodeType, getIcon)
import Gargantext.Utils.Reactix as R2
import Reactix as R
import Reactix.DOM.HTML as H
import Toestand as T
here :: R2.Here
here = R2.here "Gargantext.Components.TreeSearch"
type Props = (
visible :: T.Box Boolean
, sessions :: T.Box Sessions
)
type StateProps = (
visible :: T.Box Boolean
, sessions :: Sessions
, query :: T.Box String
)
type WrapperProps = (
visible :: T.Box Boolean
, sessions :: Sessions
, session :: T.Box (Maybe Session)
, query :: T.Box String
)
type ContainerProps = ( visible :: T.Box Boolean, session :: Session, query :: String)
type RenderContainerProps = ( visible :: T.Box Boolean, session :: Session, searchData :: Array SearchData )
type RenderProps = ( visible :: T.Box Boolean
, session :: Session
, searchData :: Array SearchData
, goToRoute :: AppRoute -> Effect Unit )
type SearchData = { name :: String
, type :: NodeType
, id :: NodeID
}
treeSearch :: R2.Leaf Props
treeSearch = R2.leaf treeSearchCpt
treeSearchCpt :: R.Component Props
treeSearchCpt = here.component "treeSearch" cpt where
cpt { sessions, visible } _ = do
sessions' <- T.useLive T.unequal sessions
query <- T.useBox ""
inputRef <- R.useRef ""
pure $
B.baseModal
{ isVisibleBox: visible
, title: Just "Tree Search"
, size: MediumModalSize
, modalClassName: ""
}
[ inputWithEnter { className: "form-control"
, autoFocus: true
, onEnter: submit inputRef query
, onValueChanged: R.setRef inputRef
, onBlur: R.setRef inputRef
, type: "value"
, defaultValue: ""
, placeholder: "Search..."
}
, treeSearchState {visible, query, sessions: sessions'} ]
where
submit ref box _ = T.write_ (R.readRef ref) box
treeSearchState :: R2.Leaf StateProps
treeSearchState = R2.leaf treeSearchStateCpt
treeSearchStateCpt :: R.Component StateProps
treeSearchStateCpt = here.component "treeSearchState" cpt where
cpt { query, sessions, visible } _ = do
session <- T.useBox $ head $ unSessions sessions
pure $ treeSearchWrapper { query, visible, session, sessions}
treeSearchWrapper :: R2.Leaf WrapperProps
treeSearchWrapper = R2.leaf treeSearchWrapperCpt
treeSearchWrapperCpt :: R.Component WrapperProps
treeSearchWrapperCpt = here.component "treeSearchWrapper" cpt where
cpt { query, visible, sessions, session } _ = do
session' <- T.useLive T.unequal session
query' <- T.useLive T.unequal query
case session' of
Just s ->
pure $ R.fragment [
formSelect'
{ callback: \v -> T.write_ (Just v) session
, list: unSessions sessions
, value: s
} []
,
if query' == "" then
H.div {className: "search-modal__results"} [B.span_ "Enter your search query..."]
else
treeSearchContainer {query: query', visible, session: s}
]
Nothing -> pure $ H.div {} []
treeSearchContainer :: R2.Leaf ContainerProps
treeSearchContainer = R2.leaf treeSearchContainerCpt
treeSearchContainerCpt :: R.Component ContainerProps
treeSearchContainerCpt = here.component "treeSearchContainerCpt" cpt where
cpt {query, visible, session } _ = do
useLoader { errorHandler
, path: { session, query }
, loader: loadSearch
, render: \searchData -> treeSearchRenderContainer { visible, session, searchData }
}
where
errorHandler = logRESTError here "[treeSearchContainer]"
treeSearchRenderContainer :: R2.Leaf RenderContainerProps
treeSearchRenderContainer = R2.leaf treeSearchRenderContainerCpt
treeSearchRenderContainerCpt :: R.Component RenderContainerProps
treeSearchRenderContainerCpt = here.component "treeSearchRenderContainer" cpt where
cpt { visible, session, searchData } _ = do
{ goToRoute } <- useLinkHandler
pure $ treeSearchRender { visible, session, searchData, goToRoute }
treeSearchRender :: R2.Leaf RenderProps
treeSearchRender = R2.leaf treeSearchRenderCpt
treeSearchRenderCpt :: R.Component RenderProps
treeSearchRenderCpt = here.component "treeSearchRenderCpt" cpt where
cpt { visible, session, searchData, goToRoute } _ = do
pure $ H.div {className: "search-modal__results"} (results searchData)
where
results s = map searchResult s
where
searchResult sd = H.div
{ className: "forest-layout__action"}
[
B.tooltipContainer
{ delayShow: 600
, position: TooltipPosition Right
, tooltipSlot: B.span_ $ show $ fromMaybe Home $ nodeTypeAppRoute sd.type (sessionId session) sd.id
, defaultSlot:
B.button
{ className: "forest-layout__action__button"
, callback: \_ -> do
T.write_ false visible
goToRoute $ fromMaybe Home $ nodeTypeAppRoute sd.type (sessionId session) sd.id
, variant: ButtonVariant Light }
[
B.icon {name: getIcon sd.type true}
, B.wad_ [ "d-inline-block", "w-1" ]
, H.text sd.name
]
}
]
type LoadProps = ( session :: Session, query :: String )
loadSearch :: Record LoadProps -> AffRESTError (Array SearchData)
loadSearch { session: s, query: q} = get s $ appPath (TreeFlat (sessionId s) (sessionRoot s) q)
where sessionRoot (Session {treeId}) = treeId
...@@ -9,7 +9,7 @@ import Data.Maybe (fromMaybe) ...@@ -9,7 +9,7 @@ import Data.Maybe (fromMaybe)
import Effect (Effect) import Effect (Effect)
import Effect.Aff (Aff) import Effect.Aff (Aff)
import Effect.Class (liftEffect) import Effect.Class (liftEffect)
import Gargantext.Config.REST (RESTError) import Gargantext.Config.REST (RESTError, logRESTError)
import Gargantext.Types (AsyncEvent(..), AsyncProgress(..), AsyncTaskLog(..), AsyncTaskStatus(..), FrontendError(..)) import Gargantext.Types (AsyncEvent(..), AsyncProgress(..), AsyncTaskLog(..), AsyncTaskStatus(..), FrontendError(..))
import Gargantext.Utils.Reactix as R2 import Gargantext.Utils.Reactix as R2
import Toestand as T import Toestand as T
...@@ -18,14 +18,16 @@ here :: R2.Here ...@@ -18,14 +18,16 @@ here :: R2.Here
here = R2.here "Gargantext.Config.Utils" here = R2.here "Gargantext.Config.Utils"
handleRESTError :: forall a. handleRESTError :: forall a.
T.Box (Array FrontendError) R2.Here
-> T.Box (Array FrontendError)
-> Either RESTError a -> Either RESTError a
-> (a -> Aff Unit) -> (a -> Aff Unit)
-> Aff Unit -> Aff Unit
handleRESTError errors (Left error) _ = liftEffect $ do handleRESTError here' errors (Left error) _ = liftEffect $ do
T.modify_ (A.cons $ FRESTError { error }) errors T.modify_ (A.cons $ FRESTError { error }) errors
here.warn2 "[handleTaskError] RESTError" error logRESTError here' "[handleTaskError]" error
handleRESTError _ (Right task) handler = handler task -- here.warn2 "[handleTaskError] RESTError" error
handleRESTError _ _ (Right task) handler = handler task
handleErrorInAsyncProgress :: T.Box (Array FrontendError) handleErrorInAsyncProgress :: T.Box (Array FrontendError)
-> AsyncProgress -> AsyncProgress
......
...@@ -31,6 +31,9 @@ type AsyncProps = ...@@ -31,6 +31,9 @@ type AsyncProps =
, session :: Session , session :: Session
) )
here :: R2.Here
here = R2.here "Gargantext.Context.Progress"
asyncProgress :: R2.Component AsyncProps asyncProgress :: R2.Component AsyncProps
asyncProgress = R2.component component asyncProgress = R2.component component
component :: R.Component AsyncProps component :: R.Component AsyncProps
...@@ -49,7 +52,7 @@ component = R.hooksComponent "asyncProgressContext" cpt where ...@@ -49,7 +52,7 @@ component = R.hooksComponent "asyncProgressContext" cpt where
let rdata = (RX.pick props :: Record QueryProgressData) let rdata = (RX.pick props :: Record QueryProgressData)
eAsyncProgress <- queryProgress rdata eAsyncProgress <- queryProgress rdata
handleRESTError errors eAsyncProgress onProgress handleRESTError here errors eAsyncProgress onProgress
onProgress :: AsyncProgress -> Aff Unit onProgress :: AsyncProgress -> Aff Unit
onProgress value = liftEffect do onProgress value = liftEffect do
......
...@@ -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) import Data.FoldableWithIndex (foldlWithIndex, foldrWithIndex)
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)
...@@ -114,11 +114,11 @@ lookupRootList ngram (NgramsTable {ngrams_repo_elements: elts}) = ...@@ -114,11 +114,11 @@ lookupRootList ngram (NgramsTable {ngrams_repo_elements: elts}) =
Nothing -> Nothing Nothing -> Nothing
Just (NgramsRepoElement {list}) -> Just list -- assert root == Nothing Just (NgramsRepoElement {list}) -> Just list -- assert root == Nothing
lookupRootListWithChildren :: NgramsTerm -> NgramsTable -> Map NgramsTerm NgramsTerm -> Maybe TermList lookupRootListWithChildren :: NgramsTerm -> NgramsTable -> Record Cache -> Maybe TermList
lookupRootListWithChildren ngram table@(NgramsTable {ngrams_repo_elements: elts}) parentMap' = lookupRootListWithChildren ngram table@(NgramsTable {ngrams_repo_elements: elts}) { pm, pats } =
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 parentMap' of case Map.lookup ngram pm of
Nothing -> Nothing Nothing -> Nothing
Just parent' -> lookupRootList parent' table Just parent' -> lookupRootList parent' table
Just (NgramsRepoElement {list, root: Nothing}) -> Just list Just (NgramsRepoElement {list, root: Nothing}) -> Just list
...@@ -140,10 +140,24 @@ wordBoundaryReg2 = case R.regex ("(" <> wordBoundaryChars <> ")\\1") (R.global < ...@@ -140,10 +140,24 @@ wordBoundaryReg2 = case R.regex ("(" <> wordBoundaryChars <> ")\\1") (R.global <
Left e -> unsafePartial $ crashWith e Left e -> unsafePartial $ crashWith e
Right r -> r Right r -> r
type Cache =
( pm :: Map NgramsTerm NgramsTerm
, pats :: Array NgramsTerm )
computeCache :: NgramsTable -> Record Cache
computeCache ngrams = { pm, pats }
where
NgramsTable { ngrams_repo_elements } = ngrams
pm = parentMap ngrams_repo_elements
pats :: Array NgramsTerm
pats = A.fromFoldable $
foldrWithIndex (\term (NgramsRepoElement nre) acc -> Set.union acc $ Set.insert term nre.children) Set.empty ngrams_repo_elements
-- 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 :: CTabNgramType -> NgramsTable -> String -> Array HighlightElement highlightNgrams :: CTabNgramType -> NgramsTable -> Record Cache -> String -> Array HighlightElement
highlightNgrams ntype table@(NgramsTable {ngrams_repo_elements: elts}) input0 = highlightNgrams ntype table@(NgramsTable {ngrams_repo_elements: elts}) { pm, pats } input0 =
-- trace {pats, input0, input, ixs} \_ -> -- trace {pats, input0, input, ixs} \_ ->
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
...@@ -154,9 +168,11 @@ highlightNgrams ntype table@(NgramsTable {ngrams_repo_elements: elts}) input0 = ...@@ -154,9 +168,11 @@ highlightNgrams ntype table@(NgramsTable {ngrams_repo_elements: elts}) input0 =
undb = R.replace wordBoundaryReg2 "$1" undb = R.replace wordBoundaryReg2 "$1"
input = spR input0 input = spR input0
-- pats = A.fromFoldable (Map.keys elts) -- pats = A.fromFoldable (Map.keys elts)
pats :: Array NgramsTerm -- pats :: Array NgramsTerm
pats = A.fromFoldable $ -- pats = A.fromFoldable $
foldlWithIndex (\term acc (NgramsRepoElement nre) -> Set.union acc $ Set.insert term nre.children) Set.empty elts -- foldrWithIndex (\term (NgramsRepoElement nre) acc -> Set.union acc $ Set.insert term nre.childre
-- n) Set.empty elts
-- foldlWithIndex (\term acc (NgramsRepoElement nre) -> Set.union acc $ Set.insert term nre.children) Set.empty elts
hashStruct = SSKR.hashStruct (sp <<< ngramsTermText <$> pats) hashStruct = SSKR.hashStruct (sp <<< ngramsTermText <$> pats)
ixs = SSKR.indicesOfAnyHashStruct hashStruct (normNgramInternal ntype input) ixs = SSKR.indicesOfAnyHashStruct hashStruct (normNgramInternal ntype input)
...@@ -185,12 +201,12 @@ highlightNgrams ntype table@(NgramsTable {ngrams_repo_elements: elts}) input0 = ...@@ -185,12 +201,12 @@ highlightNgrams ntype table@(NgramsTable {ngrams_repo_elements: elts}) input0 =
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))
parentMap' :: Map NgramsTerm NgramsTerm -- parentMap' :: Map NgramsTerm NgramsTerm
parentMap' = parentMap elts -- parentMap' = parentMap elts
goAcc :: Partial => Int -> HighlightAccumulator -> Tuple NgramsTerm Int -> HighlightAccumulator goAcc :: Partial => Int -> HighlightAccumulator -> Tuple NgramsTerm Int -> HighlightAccumulator
goAcc i acc (pat /\ lpat) = goAcc i acc (pat /\ lpat) =
case lookupRootListWithChildren pat table parentMap' of case lookupRootListWithChildren pat table { pm, pats } of
Nothing -> Nothing ->
crashWith "highlightNgrams: pattern missing from table" crashWith "highlightNgrams: pattern missing from table"
Just ne_list -> Just ne_list ->
...@@ -531,7 +547,7 @@ chartsAfterSync :: forall props discard. ...@@ -531,7 +547,7 @@ chartsAfterSync :: forall props discard.
-> Aff Unit -> Aff Unit
chartsAfterSync path'@{ nodeId } errors tasks _ = do chartsAfterSync path'@{ nodeId } errors tasks _ = do
eTask <- postNgramsChartsAsync path' eTask <- postNgramsChartsAsync path'
handleRESTError errors eTask $ \task -> liftEffect $ do handleRESTError here errors eTask $ \task -> liftEffect $ do
here.log2 "[chartsAfterSync] Synchronize task" task here.log2 "[chartsAfterSync] Synchronize task" task
GAT.insert nodeId task tasks GAT.insert nodeId task tasks
......
This diff is collapsed.
...@@ -181,7 +181,7 @@ useCachedAPILoaderEffect { boxes: { errors } ...@@ -181,7 +181,7 @@ useCachedAPILoaderEffect { boxes: { errors }
-- TODO Parallelize? -- TODO Parallelize?
hr@(HashedResponse { hash }) <- GUC.cachedJson cache req hr@(HashedResponse { hash }) <- GUC.cachedJson cache req
eCacheReal <- cacheEndpoint path eCacheReal <- cacheEndpoint path
handleRESTError errors eCacheReal $ \cacheReal -> do handleRESTError here errors eCacheReal $ \cacheReal -> do
val <- if hash == cacheReal then val <- if hash == cacheReal then
pure hr pure hr
else do else do
......
...@@ -25,6 +25,7 @@ data AppRoute ...@@ -25,6 +25,7 @@ data AppRoute
| Lists SessionId Int | Lists SessionId Int
| Login | Login
| NodeTexts SessionId Int | NodeTexts SessionId Int
| TreeFlat SessionId Int String
| PGraphExplorer SessionId Int | PGraphExplorer SessionId Int
| PhyloExplorer SessionId Int | PhyloExplorer SessionId Int
| RouteFile SessionId Int | RouteFile SessionId Int
...@@ -35,37 +36,12 @@ data AppRoute ...@@ -35,37 +36,12 @@ data AppRoute
| Team SessionId Int | Team SessionId Int
| UserPage SessionId Int | UserPage SessionId Int
derive instance Eq AppRoute derive instance Eq AppRoute
data SessionRoute
= Tab TabType (Maybe Id)
| Children NodeType Offset Limit (Maybe OrderBy) (Maybe Id)
| GetNgrams NgramsGetOpts (Maybe Id)
| GetNgramsTableAll NgramsGetTableAllOpts (Maybe Id)
| GetNgramsTableVersion { listId :: ListId, tabType :: TabType } (Maybe Id)
| PutNgrams TabType (Maybe ListId) (Maybe TermList) (Maybe Id)
| PostNgramsChartsAsync (Maybe Id)
-- ^ This name is not good. In particular this URL is used both in PUT and POST.
| RecomputeNgrams (TabSubType CTabNgramType) Id ListId
| RecomputeListChart ChartType CTabNgramType Id ListId
| NodeAPI NodeType (Maybe Id) String
| TreeFirstLevel (Maybe Id) String
| GraphAPI Id String
| ListsRoute ListId
| ListDocument (Maybe ListId) (Maybe DocId)
| Search SearchOpts (Maybe Id)
| CorpusMetrics CorpusMetricOpts (Maybe Id)
| CorpusMetricsHash { listId :: ListId, tabType :: TabType } (Maybe Id)
| Chart ChartOpts (Maybe Id)
| ChartHash { chartType :: ChartType, listId :: Maybe ListId, tabType :: TabType } (Maybe Id)
-- | AnnuaireContact AnnuaireId DocId
| PhyloAPI Id
| Members
instance Show AppRoute where instance Show AppRoute where
show Home = "Home" show Home = "Home"
show Login = "Login" show Login = "Login"
show (TreeFlat s i _) = "treeflat" <> show i <> " (" <> show s <> ")"
show (ForgotPassword u) = "ForgotPassword" <> show u show (ForgotPassword u) = "ForgotPassword" <> show u
show (Folder s i) = "Folder" <> show i <> " (" <> show s <> ")" show (Folder s i) = "Folder" <> show i <> " (" <> show s <> ")"
show (FolderPrivate s i) = "FolderPrivate" <> show i <> " (" <> show s <> ")" show (FolderPrivate s i) = "FolderPrivate" <> show i <> " (" <> show s <> ")"
...@@ -94,6 +70,7 @@ instance Show AppRoute where ...@@ -94,6 +70,7 @@ instance Show AppRoute where
appPath :: AppRoute -> String appPath :: AppRoute -> String
appPath Home = "" appPath Home = ""
appPath Login = "login" appPath Login = "login"
appPath (TreeFlat _ i q) = "treeflat/" <> show i <> "?query=" <> q
appPath (ForgotPassword u) = "forgotPassword/" <> show u appPath (ForgotPassword u) = "forgotPassword/" <> show u
appPath (Folder s i) = "folder/" <> show s <> "/" <> show i appPath (Folder s i) = "folder/" <> show s <> "/" <> show i
appPath (FolderPrivate s i) = "folderPrivate/" <> show s <> "/" <> show i appPath (FolderPrivate s i) = "folderPrivate/" <> show s <> "/" <> show i
...@@ -134,12 +111,38 @@ nodeTypeAppRoute GT.NodeList s i = Just $ Lists s i ...@@ -134,12 +111,38 @@ nodeTypeAppRoute GT.NodeList s i = Just $ Lists s i
nodeTypeAppRoute GT.NodeUser s i = Just $ UserPage s i nodeTypeAppRoute GT.NodeUser s i = Just $ UserPage s i
nodeTypeAppRoute GT.Team s i = Just $ Team s i nodeTypeAppRoute GT.Team s i = Just $ Team s i
nodeTypeAppRoute GT.NodeTexts s i = Just $ NodeTexts s i nodeTypeAppRoute GT.NodeTexts s i = Just $ NodeTexts s i
nodeTypeAppRoute GT.NodeFrameWrite s i = Just $ RouteFrameWrite s i nodeTypeAppRoute GT.Notes s i = Just $ RouteFrameWrite s i
nodeTypeAppRoute GT.NodeFrameCalc s i = Just $ RouteFrameCalc s i nodeTypeAppRoute GT.Calc s i = Just $ RouteFrameCalc s i
nodeTypeAppRoute GT.NodeFrameVisio s i = Just $ RouteFrameVisio s i nodeTypeAppRoute GT.NodeFrameVisio s i = Just $ RouteFrameVisio s i
nodeTypeAppRoute _ _ _ = Nothing nodeTypeAppRoute _ _ _ = Nothing
data SessionRoute
= Tab TabType (Maybe Id)
| Children NodeType Offset Limit (Maybe OrderBy) (Maybe Id)
| GetNgrams NgramsGetOpts (Maybe Id)
| GetNgramsTableAll NgramsGetTableAllOpts (Maybe Id)
| GetNgramsTableVersion { listId :: ListId, tabType :: TabType } (Maybe Id)
| PutNgrams TabType (Maybe ListId) (Maybe TermList) (Maybe Id)
| PostNgramsChartsAsync (Maybe Id)
-- ^ This name is not good. In particular this URL is used both in PUT and POST.
| RecomputeNgrams (TabSubType CTabNgramType) Id ListId
| RecomputeListChart ChartType CTabNgramType Id ListId
| NodeAPI NodeType (Maybe Id) String
| TreeFirstLevel (Maybe Id) String
| GraphAPI Id String
| ListsRoute ListId
| ListDocument (Maybe ListId) (Maybe DocId)
| Search SearchOpts (Maybe Id)
| CorpusMetrics CorpusMetricOpts (Maybe Id)
| CorpusMetricsHash { listId :: ListId, tabType :: TabType } (Maybe Id)
| Chart ChartOpts (Maybe Id)
| ChartHash { chartType :: ChartType, listId :: Maybe ListId, tabType :: TabType } (Maybe Id)
-- | AnnuaireContact AnnuaireId DocId
| PhyloAPI Id
| Members
------------------------------------------------------ ------------------------------------------------------
type Tile = type Tile =
......
...@@ -155,9 +155,9 @@ data NodeType = Annuaire ...@@ -155,9 +155,9 @@ data NodeType = Annuaire
| Url_Document | Url_Document
-- TODO Optional Nodes -- TODO Optional Nodes
| NodeFile | NodeFile
| NodeFrameCalc | Calc
| NodeFrameNotebook | NodeFrameNotebook
| NodeFrameWrite | Notes
| NodeFrameVisio | NodeFrameVisio
| NodePublic NodeType | NodePublic NodeType
derive instance Generic NodeType _ derive instance Generic NodeType _
...@@ -197,8 +197,8 @@ instance Show NodeType where ...@@ -197,8 +197,8 @@ instance Show NodeType where
show Team = "NodeTeam" show Team = "NodeTeam"
show NodeList = "NodeList" show NodeList = "NodeList"
show NodeTexts = "NodeTexts" show NodeTexts = "NodeTexts"
show NodeFrameWrite = "NodeFrameWrite" show Notes = "Notes"
show NodeFrameCalc = "NodeFrameCalc" show Calc = "Calc"
show NodeFrameNotebook = "NodeFrameNotebook" show NodeFrameNotebook = "NodeFrameNotebook"
show NodeFrameVisio = "NodeFrameVisio" show NodeFrameVisio = "NodeFrameVisio"
show (NodePublic nt) = "NodePublic" <> show nt show (NodePublic nt) = "NodePublic" <> show nt
...@@ -227,8 +227,8 @@ instance Read NodeType where ...@@ -227,8 +227,8 @@ instance Read NodeType where
read "NodeList" = Just NodeList read "NodeList" = Just NodeList
read "NodeTexts" = Just NodeTexts read "NodeTexts" = Just NodeTexts
read "Annuaire" = Just Annuaire read "Annuaire" = Just Annuaire
read "NodeFrameWrite" = Just NodeFrameWrite read "Notes" = Just Notes
read "NodeFrameCalc" = Just NodeFrameCalc read "Calc" = Just Calc
read "NodeFrameNotebook" = Just NodeFrameNotebook read "NodeFrameNotebook" = Just NodeFrameNotebook
read "NodeFrameVisio" = Just NodeFrameVisio read "NodeFrameVisio" = Just NodeFrameVisio
read "NodeFile" = Just NodeFile read "NodeFile" = Just NodeFile
...@@ -267,9 +267,9 @@ translateFR = case _ of ...@@ -267,9 +267,9 @@ translateFR = case _ of
Url_Document -> "Document URL" Url_Document -> "Document URL"
-- --
NodeFile -> "Fichier" NodeFile -> "Fichier"
NodeFrameCalc -> "Feuilles de calcul" Calc -> "Feuilles de calcul"
NodeFrameNotebook -> "Carnet de notes" NodeFrameNotebook -> "Carnet de notes"
NodeFrameWrite -> "Éditeur de texte" Notes -> "Éditeur de texte"
NodeFrameVisio -> "Visio" NodeFrameVisio -> "Visio"
NodePublic n -> translateFR n NodePublic n -> translateFR n
...@@ -298,9 +298,9 @@ translateEN = case _ of ...@@ -298,9 +298,9 @@ translateEN = case _ of
Url_Document -> "URL document" Url_Document -> "URL document"
-- --
NodeFile -> "File" NodeFile -> "File"
NodeFrameCalc -> "Calc" Calc -> "Calc"
NodeFrameNotebook -> "Notebook" NodeFrameNotebook -> "Notebook"
NodeFrameWrite -> "Write" Notes -> "Notes"
NodeFrameVisio -> "Visio" NodeFrameVisio -> "Visio"
NodePublic n -> translateEN n NodePublic n -> translateEN n
...@@ -343,11 +343,11 @@ getIcon Annuaire false = "address-card" ...@@ -343,11 +343,11 @@ getIcon Annuaire false = "address-card"
getIcon NodeContact true = "address-card-o" getIcon NodeContact true = "address-card-o"
getIcon NodeContact false = "address-card" getIcon NodeContact false = "address-card"
getIcon NodeFrameWrite true = "file-text-o" getIcon Notes true = "file-text-o"
getIcon NodeFrameWrite false = "file-text" getIcon Notes false = "file-text"
getIcon NodeFrameCalc true = "calculator" getIcon Calc true = "calculator"
getIcon NodeFrameCalc false = "calculator" getIcon Calc false = "calculator"
getIcon NodeFrameNotebook true = "file-code-o" getIcon NodeFrameNotebook true = "file-code-o"
getIcon NodeFrameNotebook false = "code" getIcon NodeFrameNotebook false = "code"
...@@ -409,8 +409,8 @@ nodeTypePath Tree = "tree" ...@@ -409,8 +409,8 @@ nodeTypePath Tree = "tree"
nodeTypePath NodeList = "lists" nodeTypePath NodeList = "lists"
nodeTypePath NodeTexts = "texts" nodeTypePath NodeTexts = "texts"
nodeTypePath Team = "team" nodeTypePath Team = "team"
nodeTypePath NodeFrameWrite = "write" nodeTypePath Notes = "write"
nodeTypePath NodeFrameCalc = "calc" nodeTypePath Calc = "calc"
nodeTypePath NodeFrameNotebook = "code" nodeTypePath NodeFrameNotebook = "code"
nodeTypePath NodeFrameVisio = "visio" nodeTypePath NodeFrameVisio = "visio"
nodeTypePath (NodePublic nt) = nodeTypePath nt nodeTypePath (NodePublic nt) = nodeTypePath nt
......
...@@ -28,9 +28,10 @@ joinQueryStrings :: Array String -> String ...@@ -28,9 +28,10 @@ joinQueryStrings :: Array String -> String
joinQueryStrings qs = joinQueryStrings qs =
case uncons qs of case uncons qs of
Nothing -> "" Nothing -> ""
Just { head, tail } -> "?" <> head <> (joinQS tail) Just { head, tail } -> "?" <> head <> (joinTail tail)
where where
joinQS ys = joinTail :: Array String -> String
joinTail ys =
case uncons ys of case uncons ys of
Nothing -> "" Nothing -> ""
Just { tail: ys } -> "&" <> (joinWith "&" ys) Just { head: h, tail: ys } -> "&" <> h <> (joinTail ys)
...@@ -12,3 +12,4 @@ ...@@ -12,3 +12,4 @@
@import "./_legacy/_folder" @import "./_legacy/_folder"
@import "./_legacy/_corpus" @import "./_legacy/_corpus"
@import "./_legacy/_annuaire" @import "./_legacy/_annuaire"
@import "./_legacy/_search"
.search-modal
&__results
height: 14em
overflow-x: hidden
overflow-y: scroll
\ No newline at end of file
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