Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
purescript-gargantext
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
142
Issues
142
List
Board
Labels
Milestones
Merge Requests
4
Merge Requests
4
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gargantext
purescript-gargantext
Commits
92f7d8a9
Commit
92f7d8a9
authored
Jan 25, 2023
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/164-dev-node-write-analysis' into dev-merge
parents
cebc94e1
7003f000
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
109 additions
and
16 deletions
+109
-16
Tree.purs
src/Gargantext/Components/Forest/Tree.purs
+3
-3
Types.purs
src/Gargantext/Components/Forest/Tree/Node/Action/Types.purs
+1
-1
WriteNodesDocuments.purs
...mponents/Forest/Tree/Node/Action/WriteNodesDocuments.purs
+98
-12
Lang.purs
src/Gargantext/Components/Lang.purs
+7
-0
No files found.
src/Gargantext/Components/Forest/Tree.purs
View file @
92f7d8a9
...
...
@@ -384,8 +384,8 @@ linkNode nodeType params p@{ boxes: { errors }, session } = traverse_ f params w
handleRESTError errors eTask $ \_task -> pure unit
refreshTree p
documentsFromWriteNodes
id
p@{ boxes: { errors }, session } = do
eTask <- documentsFromWriteNodesReq session
id
documentsFromWriteNodes
params
p@{ boxes: { errors }, session } = do
eTask <- documentsFromWriteNodesReq session
params
handleRESTError errors eTask $ \_task -> pure unit
refreshTree p
...
...
@@ -411,5 +411,5 @@ performAction (MergeNode {params}) p = mergeNode params
performAction (LinkNode { nodeType, params }) p = linkNode nodeType params p
performAction RefreshTree p = refreshTree p
performAction CloseBox p = closeBox p
performAction (DocumentsFromWriteNodes
{ id }) p = documentsFromWriteNodes id
p
performAction (DocumentsFromWriteNodes
params) p = documentsFromWriteNodes params
p
performAction NoAction _ = liftEffect $ here.log "[performAction] NoAction"
src/Gargantext/Components/Forest/Tree/Node/Action/Types.purs
View file @
92f7d8a9
...
...
@@ -30,7 +30,7 @@ data Action = AddNode String GT.NodeType
| MergeNode {params :: Maybe SubTreeOut}
| LinkNode {nodeType :: Maybe GT.NodeType, params :: Maybe SubTreeOut}
| DocumentsFromWriteNodes { id :: GT.ID }
| DocumentsFromWriteNodes { id :: GT.ID
, lang :: Lang, selection :: Selection, paragraphs :: String
}
| NoAction
...
...
src/Gargantext/Components/Forest/Tree/Node/Action/WriteNodesDocuments.purs
View file @
92f7d8a9
...
...
@@ -4,10 +4,15 @@ import Gargantext.Prelude
import Data.Either (Either)
import Data.Maybe (Maybe(..))
import Data.Tuple.Nested ((/\))
import Effect.Aff (Aff)
import Gargantext.Components.App.Store (Boxes)
import Gargantext.Components.Bootstrap as B
import Gargantext.Components.Forest.Tree.Node.Action.Types (Action(..))
import Gargantext.Components.Forest.Tree.Node.Tools (panel, submitButton)
import Gargantext.Components.Lang (Lang(..))
import Gargantext.Components.ListSelection as ListSelection
import Gargantext.Components.ListSelection.Types as ListSelection
import Gargantext.Config.REST (AffRESTError, RESTError)
import Gargantext.Routes (SessionRoute(..))
import Gargantext.Sessions (Session, post)
...
...
@@ -15,6 +20,8 @@ import Gargantext.Types as GT
import Gargantext.Utils.Reactix as R2
import Reactix as R
import Reactix.DOM.HTML as H
import Toestand as T
here :: R2.Here
here = R2.here "Gargantext.Components.Forest.Tree.Node.Action.WriteNodesDocuments"
...
...
@@ -31,20 +38,99 @@ actionWriteNodesDocuments = R.createElement actionWriteNodesDocumentsCpt
actionWriteNodesDocumentsCpt :: R.Component ActionWriteNodesDocuments
actionWriteNodesDocumentsCpt = here.component "actionWriteNodesDocuments" cpt where
cpt { boxes, dispatch, id, session } _ = do
let bodies =
[ R2.row
[ H.div { className: "col-12 flex-space-around" }
[ H.div { className: "form-group" }
[ H.text "Will traverse all Write Nodes and insert them as documents into current corpus." ]
]
]
]
pure $ panel bodies (submitButton (DocumentsFromWriteNodes { id }) dispatch)
lang' /\ langBox
<- R2.useBox' EN
selection' /\ selectionBox
<- R2.useBox' ListSelection.MyListsFirst
paragraphs' /\ paragraphBox
<- R2.useBox' "7"
let bodies = [
H.div
{ className: "col-12 flex-space-around" }
[ H.h4 {}
[ H.text "Will traverse all Write Nodes and insert them as documents into current corpus." ]
]
,
-- lang
H.div
{ className: "form-group" }
[
H.div
{ className: "form-group__label" }
[
B.label_ $
"File lang"
]
,
H.div
{ className: "form-group__field" }
[
B.formSelect'
{ callback: flip T.write_ langBox
, value: lang'
, list: [ EN, FR, No_extraction, Universal ]
}
[]
]
]
,
-- paragraph
H.div
{ className: "form-group "}
[
H.div
{ className: "form-group__label" }
[
B.label_ $
"Paragraph size (sentences)"
]
,
H.div
{ className: "form-group__field" }
[
B.formInput
{ callback: flip T.write_ paragraphBox
, value: paragraphs'
}
]
]
,
--selection
H.div
{ className: "form-group" }
[
H.div
{ className: "form-group__label" }
[
B.label_ $
"List selection"
]
,
H.div
{ className: "form-group__field" }
[
ListSelection.selection
{ selection: selectionBox
, session
} []
]
]
]
pure $ panel bodies (submitButton (DocumentsFromWriteNodes { id, lang: lang', selection: selection', paragraphs: paragraphs' }) dispatch)
type Params =
( id :: GT.ID
, selection :: ListSelection.Selection
, lang :: Lang
, paragraphs :: String
)
documentsFromWriteNodesReq :: Session ->
GT.ID
-> AffRESTError GT.AsyncTaskWithType
documentsFromWriteNodesReq session
id
= do
documentsFromWriteNodesReq :: Session ->
Record Params
-> AffRESTError GT.AsyncTaskWithType
documentsFromWriteNodesReq session
params@{ id }
= do
eTask :: Either RESTError GT.AsyncTask <-
post session (NodeAPI GT.Node (Just id) "documents-from-write-nodes")
{ id }
post session (NodeAPI GT.Node (Just id) "documents-from-write-nodes")
params
pure $ (\task -> GT.AsyncTaskWithType { task, typ: GT.UpdateNode }) <$> eTask
src/Gargantext/Components/Lang.purs
View file @
92f7d8a9
...
...
@@ -4,10 +4,14 @@ import Gargantext.Prelude
import Data.Argonaut (class EncodeJson, encodeJson)
import Data.Array as A
import Data.Generic.Rep (class Generic)
import Data.Lens.Lens.Product (_1)
import Data.Maybe (Maybe(..))
import Data.Newtype (class Newtype)
import Gargantext.Utils.Reactix as R2
import Reactix as R
import Reactix.DOM.HTML as H
import Simple.JSON as JSON
import Toestand as T
here :: R2.Here
...
...
@@ -42,6 +46,9 @@ instance Read Lang where
instance EncodeJson Lang where
encodeJson a = encodeJson (show a)
instance JSON.WriteForeign Lang where
writeImpl l = JSON.writeImpl $ show l
-- Language used for the landing page
data LandingLang = LL_EN | LL_FR
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment