Commit f1338ec8 authored by Alexandre Delanoë's avatar Alexandre Delanoë

[FIX] Json prefix rename

parent 45409b41
...@@ -72,7 +72,10 @@ type Deletions = { pending :: Set Int, deleted :: Set Int } ...@@ -72,7 +72,10 @@ type Deletions = { pending :: Set Int, deleted :: Set Int }
initialDeletions :: Deletions initialDeletions :: Deletions
initialDeletions = { pending: mempty, deleted: mempty } initialDeletions = { pending: mempty, deleted: mempty }
newtype Pair = Pair { id :: Int, label :: String } newtype Pair =
Pair { id :: Int
, label :: String
}
derive instance genericPair :: Generic Pair _ derive instance genericPair :: Generic Pair _
...@@ -119,9 +122,9 @@ newtype Hyperdata = Hyperdata ...@@ -119,9 +122,9 @@ newtype Hyperdata = Hyperdata
{ authors :: String { authors :: String
, title :: String , title :: String
, source :: String , source :: String
, publication_year :: Int , publication_year :: Int
, publication_month :: Int , publication_month :: Int
, publication_day :: Int , publication_day :: Int
} }
--instance decodeHyperdata :: DecodeJson Hyperdata where --instance decodeHyperdata :: DecodeJson Hyperdata where
...@@ -249,9 +252,19 @@ docViewGraphCpt = R.hooksComponent "FacetsDocViewGraph" cpt ...@@ -249,9 +252,19 @@ docViewGraphCpt = R.hooksComponent "FacetsDocViewGraph" cpt
, H.button { style: buttonStyle, on: { click: performClick } } , H.button { style: buttonStyle, on: { click: performClick } }
[ H.i { className: "glyphitem glyphicon glyphicon-trash" [ H.i { className: "glyphitem glyphicon glyphicon-trash"
, style: { marginRight : "9px" } } [] , style: { marginRight : "9px" } } []
, H.text "Delete document!" ] ] ] ] ] , H.text "Delete document!"
]
]
]
]
]
type PagePath = {nodeId :: Int, listId :: Int, query :: TextQuery, params :: T.Params, session :: Session} type PagePath = { nodeId :: Int
, listId :: Int
, query :: TextQuery
, params :: T.Params
, session :: Session
}
initialPagePath :: {session :: Session, nodeId :: Int, listId :: Int, query :: TextQuery} -> PagePath initialPagePath :: {session :: Session, nodeId :: Int, listId :: Int, query :: TextQuery} -> PagePath
initialPagePath {session, nodeId, listId, query} = {session, nodeId, listId, query, params: T.initialParams} initialPagePath {session, nodeId, listId, query} = {session, nodeId, listId, query, params: T.initialParams}
...@@ -287,12 +300,12 @@ loadPage {session, nodeId, listId, query, params: {limit, offset, orderBy}} = do ...@@ -287,12 +300,12 @@ loadPage {session, nodeId, listId, query, params: {limit, offset, orderBy}} = do
convOrderBy _ = DateAsc -- TODO convOrderBy _ = DateAsc -- TODO
type PageLayoutProps = type PageLayoutProps =
( frontends :: Frontends ( frontends :: Frontends
, totalRecords :: Int , totalRecords :: Int
, deletions :: R.State Deletions , deletions :: R.State Deletions
, container :: Record T.TableContainerProps -> R.Element , container :: Record T.TableContainerProps -> R.Element
, session :: Session , session :: Session
, path :: R.State PagePath , path :: R.State PagePath
) )
type PageProps = ( documents :: Array DocumentsView | PageLayoutProps ) type PageProps = ( documents :: Array DocumentsView | PageLayoutProps )
......
...@@ -24,7 +24,7 @@ newtype RenameValue = RenameValue ...@@ -24,7 +24,7 @@ newtype RenameValue = RenameValue
instance encodeJsonRenameValue :: EncodeJson RenameValue where instance encodeJsonRenameValue :: EncodeJson RenameValue where
encodeJson (RenameValue {text}) encodeJson (RenameValue {text})
= "r_name" := text = "name" := text
~> jsonEmptyObject ~> jsonEmptyObject
------------------------------------------------------------------------ ------------------------------------------------------------------------
...@@ -149,11 +149,18 @@ sideTab (Opened SideTabData) props = ...@@ -149,11 +149,18 @@ sideTab (Opened SideTabData) props =
snd props'.selectedNodeIds $ const SigmaxT.emptyNodeIds snd props'.selectedNodeIds $ const SigmaxT.emptyNodeIds
sideTab (Opened SideTabCommunity) props =
RH.div { className: "col-md-12", id: "query" }
[ query props.frontends
props.metaData
props.session
(SigmaxT.nodesGraphMap props.graph)
props.selectedNodeIds
]
sideTab _ _ = H.div {} [] sideTab _ _ = H.div {} []
------------------------------------------- -------------------------------------------
badge :: R.State SigmaxT.NodeIds -> Record SigmaxT.Node -> R.Element badge :: R.State SigmaxT.NodeIds -> Record SigmaxT.Node -> R.Element
badge (_ /\ setNodeIds) {id, label} = badge (_ /\ setNodeIds) {id, label} =
...@@ -192,7 +199,11 @@ deleteNodes { graphId, metaData, nodes, session, termList, treeReload } = do ...@@ -192,7 +199,11 @@ deleteNodes { graphId, metaData, nodes, session, termList, treeReload } = do
Just (NTC.Versioned patch) -> do Just (NTC.Versioned patch) -> do
liftEffect $ snd treeReload $ (+) 1 liftEffect $ snd treeReload $ (+) 1
deleteNode :: TermList -> Session -> GET.MetaData -> Record SigmaxT.Node -> Aff NTC.VersionedNgramsPatches deleteNode :: TermList
-> Session
-> GET.MetaData
-> Record SigmaxT.Node
-> Aff NTC.VersionedNgramsPatches
deleteNode termList session (GET.MetaData metaData) node = NTC.putNgramsPatches coreParams versioned deleteNode termList session (GET.MetaData metaData) node = NTC.putNgramsPatches coreParams versioned
where where
nodeId :: Int nodeId :: Int
...@@ -222,7 +233,12 @@ deleteNode termList session (GET.MetaData metaData) node = NTC.putNgramsPatches ...@@ -222,7 +233,12 @@ deleteNode termList session (GET.MetaData metaData) node = NTC.putNgramsPatches
patch_list :: NTC.Replace TermList patch_list :: NTC.Replace TermList
patch_list = NTC.Replace { new: termList, old: MapTerm } patch_list = NTC.Replace { new: termList, old: MapTerm }
query :: Frontends -> GET.MetaData -> Session -> SigmaxT.NodesMap -> R.State SigmaxT.NodeIds -> R.Element query :: Frontends
-> GET.MetaData
-> Session
-> SigmaxT.NodesMap
-> R.State SigmaxT.NodeIds
-> R.Element
query _ _ _ _ (selectedNodeIds /\ _) | Set.isEmpty selectedNodeIds = RH.div {} [] query _ _ _ _ (selectedNodeIds /\ _) | Set.isEmpty selectedNodeIds = RH.div {} []
query frontends (GET.MetaData metaData) session nodesMap (selectedNodeIds /\ _) = query frontends (GET.MetaData metaData) session nodesMap (selectedNodeIds /\ _) =
query' (head metaData.corpusId) query' (head metaData.corpusId)
...@@ -255,5 +271,3 @@ query frontends (GET.MetaData metaData) session nodesMap (selectedNodeIds /\ _) ...@@ -255,5 +271,3 @@ query frontends (GET.MetaData metaData) session nodesMap (selectedNodeIds /\ _)
] ]
-} -}
...@@ -13,9 +13,9 @@ import Gargantext.Sessions (Session) ...@@ -13,9 +13,9 @@ import Gargantext.Sessions (Session)
type Props = type Props =
( frontends :: Frontends ( frontends :: Frontends
, query :: TextQuery , query :: TextQuery
, session :: Session , session :: Session
, sides :: Array GraphSideCorpus , sides :: Array GraphSideCorpus
) )
tabs :: Record Props -> R.Element tabs :: Record Props -> R.Element
......
...@@ -40,13 +40,13 @@ data SessionRoute ...@@ -40,13 +40,13 @@ data SessionRoute
| GetNgramsTableVersion { listId :: ListId, tabType :: TabType } (Maybe Id) | GetNgramsTableVersion { listId :: ListId, tabType :: TabType } (Maybe Id)
| PutNgrams TabType (Maybe ListId) (Maybe TermList) (Maybe Id) | PutNgrams TabType (Maybe ListId) (Maybe TermList) (Maybe Id)
-- ^ This name is not good. In particular this URL is used both in PUT and POST. -- ^ This name is not good. In particular this URL is used both in PUT and POST.
| RecomputeNgrams (TabSubType CTabNgramType) Id ListId | RecomputeNgrams (TabSubType CTabNgramType) Id ListId
| RecomputeListChart ChartType CTabNgramType Id ListId | RecomputeListChart ChartType CTabNgramType Id ListId
| NodeAPI NodeType (Maybe Id) String | NodeAPI NodeType (Maybe Id) String
| GraphAPI Id String | GraphAPI Id String
| ListsRoute ListId | ListsRoute ListId
| ListDocument (Maybe ListId) (Maybe Id) | ListDocument (Maybe ListId) (Maybe Id)
| Search SearchOpts (Maybe Id) | Search SearchOpts (Maybe Id)
| CorpusMetrics CorpusMetricOpts (Maybe Id) | CorpusMetrics CorpusMetricOpts (Maybe Id)
| CorpusMetricsHash { listId :: ListId, tabType :: TabType } (Maybe Id) | CorpusMetricsHash { listId :: ListId, tabType :: TabType } (Maybe Id)
| Chart ChartOpts (Maybe Id) | Chart ChartOpts (Maybe Id)
......
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