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
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
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
Grégoire Locqueville
purescript-gargantext
Commits
9e8bb43a
Unverified
Commit
9e8bb43a
authored
Feb 12, 2019
by
Nicolas Pouillard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix PutNgrams
parent
680f2a2e
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
8 deletions
+11
-8
NgramsTable.purs
src/Gargantext/Components/NgramsTable.purs
+10
-7
Config.purs
src/Gargantext/Config.purs
+1
-1
No files found.
src/Gargantext/Components/NgramsTable.purs
View file @
9e8bb43a
...
...
@@ -16,6 +16,7 @@ module Gargantext.Components.NgramsTable
import Control.Monad.State (class MonadState, execState)
import Control.Monad.Cont.Trans (lift)
import Data.Array (head)
import Data.Argonaut ( Json, class DecodeJson, decodeJson, class EncodeJson, encodeJson
, jsonEmptyObject, fromObject, (:=), (~>), (.?), (.??) )
import Data.Either (Either(..))
...
...
@@ -485,10 +486,12 @@ tableContainer {searchQuery, dispatch, ngramsParent, ngramsChildren, ngramsTable
]
]
putTable :: {nodeId :: Int, listId :: Maybe Int, tabType :: TabType} -> Versioned NgramsTablePatch -> Aff (Versioned NgramsTablePatch)
putTable {nodeId, listId, tabType} = put (toUrl Back (PutNgrams tabType listId) $ Just nodeId)
putTable :: {nodeId :: Int, listIds :: Array Int, tabType :: TabType} -> Versioned NgramsTablePatch -> Aff (Versioned NgramsTablePatch)
putTable {nodeId, listIds, tabType} =
put (toUrl Back (PutNgrams tabType (head listIds)) $ Just nodeId)
commitPatch :: {nodeId :: Int, listId :: Maybe Int, tabType :: TabType} -> Versioned NgramsTablePatch -> StateCoTransformer State Unit
commitPatch :: {nodeId :: Int, listIds :: Array Int, tabType :: TabType}
-> Versioned NgramsTablePatch -> StateCoTransformer State Unit
commitPatch props pt@(Versioned {data: tablePatch}) = do
Versioned {version: newVersion, data: newPatch} <- lift $ putTable props pt
modifyState_ $ \s ->
...
...
@@ -515,8 +518,8 @@ ngramsTableSpec = simpleSpec performAction render
modifyState_ $ setParentResetChildren p
performAction (ToggleChild b c) _ _ =
modifyState_ $ _ngramsChildren <<< at c %~ toggleMap b
performAction (SetTermListItem n pl) {path: {nodeId, tabType}} {ngramsVersion} =
commitPatch {nodeId, listId, tabType} (Versioned {version: ngramsVersion, data: pt})
performAction (SetTermListItem n pl) {path: {nodeId,
listIds,
tabType}} {ngramsVersion} =
commitPatch {nodeId, listId
s
, tabType} (Versioned {version: ngramsVersion, data: pt})
where
listId = Just 10 -- List.head listIds
pe = NgramsPatch { patch_list: pl, patch_children: mempty }
...
...
@@ -524,13 +527,13 @@ ngramsTableSpec = simpleSpec performAction render
performAction AddTermChildren _ {ngramsParent: Nothing} =
-- impossible but harmless
pure unit
performAction AddTermChildren {path: {nodeId, tabType}}
performAction AddTermChildren {path: {nodeId,
listIds,
tabType}}
{ ngramsParent: Just parent
, ngramsChildren
, ngramsVersion
} = do
modifyState_ $ setParentResetChildren Nothing
commitPatch {nodeId, listId, tabType} (Versioned {version: ngramsVersion, data: pt})
commitPatch {nodeId, listId
s
, tabType} (Versioned {version: ngramsVersion, data: pt})
where
listId = Just 10 -- List.head listIds
pc = patchSetFromMap ngramsChildren
...
...
src/Gargantext/Config.purs
View file @
9e8bb43a
...
...
@@ -204,7 +204,7 @@ data Path
| Tab TabType Offset Limit (Maybe OrderBy)
| Children NodeType Offset Limit (Maybe OrderBy)
| GetNgrams TabType Offset Limit (Array ListId) (Maybe TermList)
| PutNgrams TabType (Maybe
TermList
)
| PutNgrams TabType (Maybe
ListId
)
| NodeAPI NodeType
| Search { {-id :: Int
, query :: Array String
...
...
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