Commit 1d0b4f7a authored by Alexandre Delanoë's avatar Alexandre Delanoë

Merge branch '360-dev-batch-tagging-fix' of...

Merge branch '360-dev-batch-tagging-fix' of ssh://gitlab.iscpif.fr:20022/gargantext/purescript-gargantext into dev-merge
parents ff15cac4 d1a59258
...@@ -27,7 +27,7 @@ import Effect (Effect) ...@@ -27,7 +27,7 @@ import Effect (Effect)
import Effect.Aff (Aff) import Effect.Aff (Aff)
import Gargantext.Components.App.Data (Boxes) import Gargantext.Components.App.Data (Boxes)
import Gargantext.Components.NgramsTable.Components as NTC import Gargantext.Components.NgramsTable.Components as NTC
import Gargantext.Components.NgramsTable.Core (Action(..), CoreAction(..), CoreState, Dispatch, NgramsElement(..), NgramsPatch(..), NgramsTable, NgramsTerm, PageParams, PatchMap(..), Versioned(..), VersionedNgramsTable, VersionedWithCountNgramsTable, _NgramsElement, _NgramsRepoElement, _NgramsTable, _children, _list, _ngrams, _ngrams_repo_elements, _ngrams_scores, _occurrences, _root, addNewNgramA, applyNgramsPatches, applyPatchSet, chartsAfterSync, commitPatch, convOrderBy, coreDispatch, filterTermSize, fromNgramsPatches, ngramsRepoElementToNgramsElement, ngramsTermText, normNgram, patchSetFromMap, replace, singletonNgramsTablePatch, syncResetButtons, toVersioned) import Gargantext.Components.NgramsTable.Core (Action(..), CoreAction(..), CoreState, Dispatch, NgramsElement(..), NgramsPatch(..), NgramsTable, NgramsTerm, PageParams, PatchMap(..), Versioned(..), VersionedNgramsTable, VersionedWithCountNgramsTable, _NgramsElement, _NgramsRepoElement, _NgramsTable, _children, _list, _ngrams, _ngrams_repo_elements, _ngrams_scores, _occurrences, _root, addNewNgramA, applyNgramsPatches, applyPatchSet, chartsAfterSync, commitPatch, convOrderBy, coreDispatch, filterTermSize, fromNgramsPatches, ngramsRepoElementToNgramsElement, ngramsTermText, normNgram, patchSetFromMap, replace, setTermListA, singletonNgramsTablePatch, syncResetButtons, toVersioned)
import Gargantext.Components.NgramsTable.Loader (useLoaderWithCacheAPI) import Gargantext.Components.NgramsTable.Loader (useLoaderWithCacheAPI)
import Gargantext.Components.Nodes.Lists.Types as NT import Gargantext.Components.Nodes.Lists.Types as NT
import Gargantext.Components.Table as TT import Gargantext.Components.Table as TT
...@@ -81,7 +81,10 @@ setTermListSetA ngramsTable ns new_list = ...@@ -81,7 +81,10 @@ setTermListSetA ngramsTable ns new_list =
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 (replace new_list) cur_list --patch_list = maybe mempty (replace new_list) cur_list
patch_list = case cur_list of
Nothing -> mempty
Just cl -> replace cl new_list
toMap :: forall a. Set a -> Map a Unit toMap :: forall a. Set a -> Map a Unit
toMap = unsafeCoerce toMap = unsafeCoerce
-- TODO https://github.com/purescript/purescript-ordered-collections/pull/21 -- TODO https://github.com/purescript/purescript-ordered-collections/pull/21
...@@ -119,17 +122,17 @@ tableContainerCpt { dispatch ...@@ -119,17 +122,17 @@ tableContainerCpt { dispatch
cpt props _ = do cpt props _ = do
{ searchQuery, termListFilter, termSizeFilter } <- T.useLive T.unequal path { searchQuery, termListFilter, termSizeFilter } <- T.useLive T.unequal path
pure $ H.div {className: "container-fluid"} [ pure $ H.div {className: "container-fluid"}
R2.row [ R2.row
[ H.div {className: "card col-12"} [ H.div {className: "card col-12"}
[ H.div {className: "card-header"} [ H.div {className: "card-header"}
[ [ R2.row
R2.row [ H.div {className: "col-md-2", style: {marginTop: "6px"}} [ H.div { className: "col-md-2", style: {marginTop: "6px" } }
[ H.div {} syncResetButton [ H.div {} syncResetButton
, if (not queryExactMatches || A.null props.tableBody) && searchQuery /= "" then , if (not queryExactMatches || A.null props.tableBody) && searchQuery /= "" then
-- , if (not $ Set.member (normNgram tabNgramType searchQuery) ngramsSelection) && searchQuery /= "" then -- , if (not $ Set.member (normNgram tabNgramType searchQuery) ngramsSelection) && searchQuery /= "" then
H.li { className: "list-group-item" } [ H.li { className: "list-group-item" }
H.button { className: "btn btn-primary" [ H.button { className: "btn btn-primary"
, on: { click: const $ dispatch , on: { click: const $ dispatch
$ CoreAction $ CoreAction
$ addNewNgramA $ addNewNgramA
...@@ -202,7 +205,7 @@ tableContainerCpt { dispatch ...@@ -202,7 +205,7 @@ tableContainerCpt { dispatch
-- WHY setPath f = origSetPageParams (const $ f path) -- WHY setPath f = origSetPageParams (const $ f path)
setTermListFilter x = T.modify (_ { termListFilter = x }) path setTermListFilter x = T.modify (_ { termListFilter = x }) path
setTermSizeFilter x = T.modify (_ { termSizeFilter = x }) path setTermSizeFilter x = T.modify (_ { termSizeFilter = x }) path
setSelection = dispatch <<< setTermListSetA ngramsTableCache ngramsSelection setSelection term = dispatch $ setTermListSetA ngramsTableCache ngramsSelection term
editor = H.div {} $ maybe [] edit ngramsParent editor = H.div {} $ maybe [] edit ngramsParent
where where
......
...@@ -222,7 +222,6 @@ type RenderNgramsItem = ( ...@@ -222,7 +222,6 @@ type RenderNgramsItem = (
renderNgramsItem :: R2.Component RenderNgramsItem renderNgramsItem :: R2.Component RenderNgramsItem
renderNgramsItem = R.createElement renderNgramsItemCpt renderNgramsItem = R.createElement renderNgramsItemCpt
renderNgramsItemCpt :: R.Component RenderNgramsItem renderNgramsItemCpt :: R.Component RenderNgramsItem
renderNgramsItemCpt = here.component "renderNgramsItem" cpt renderNgramsItemCpt = here.component "renderNgramsItem" cpt
where where
...@@ -265,8 +264,8 @@ renderNgramsItemCpt = here.component "renderNgramsItem" cpt ...@@ -265,8 +264,8 @@ renderNgramsItemCpt = here.component "renderNgramsItem" cpt
termList = ngramsElement ^. _NgramsElement <<< _list termList = ngramsElement ^. _NgramsElement <<< _list
ngramsStyle = [termStyle termList ngramsOpacity] ngramsStyle = [termStyle termList ngramsOpacity]
ngramsEdit = Just <<< dispatch <<< SetParentResetChildren <<< Just <<< view _ngrams ngramsEdit = Just <<< dispatch <<< SetParentResetChildren <<< Just <<< view _ngrams
ngramsClick ngramsClick =
= Just <<< dispatch <<< CoreAction <<< cycleTermListItem <<< view _ngrams Just <<< dispatch <<< CoreAction <<< cycleTermListItem <<< view _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
......
...@@ -1067,7 +1067,6 @@ type SyncResetButtonsProps = ...@@ -1067,7 +1067,6 @@ type SyncResetButtonsProps =
syncResetButtons :: Record SyncResetButtonsProps -> R.Element syncResetButtons :: Record SyncResetButtonsProps -> R.Element
syncResetButtons p = R.createElement syncResetButtonsCpt p [] syncResetButtons p = R.createElement syncResetButtonsCpt p []
syncResetButtonsCpt :: R.Component SyncResetButtonsProps syncResetButtonsCpt :: R.Component SyncResetButtonsProps
syncResetButtonsCpt = here.component "syncResetButtons" cpt syncResetButtonsCpt = here.component "syncResetButtons" cpt
where where
......
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