Commit b15eeb79 authored by James Laver's avatar James Laver

Merge changes made to dev-backend-connection since refactor started

parents 1105cefb 78e620bf
......@@ -24,7 +24,6 @@ import Gargantext.Config.REST (post, deleteWithBody)
import Gargantext.Ends (url)
import Gargantext.Hooks.Loader (useLoader)
import Gargantext.Components.Search.Types (Category(..), CategoryQuery(..), favCategory, decodeCategory, putCategories)
import Gargantext.Components.Table as T
import Gargantext.Routes (SessionRoute(Search,NodeAPI))
import Gargantext.Sessions (Session)
......@@ -314,7 +313,6 @@ pageCpt = R.staticComponent "G.C.FacetsTable.Page" cpt
| delete = H.div { style: { textDecoration: "line-through" } }
| otherwise = H.div {}
---------------------------------------------------------
newtype DeleteDocumentQuery = DeleteDocumentQuery { documents :: Array Int }
......@@ -323,6 +321,6 @@ instance encodeJsonDDQuery :: EncodeJson DeleteDocumentQuery where
encodeJson (DeleteDocumentQuery post) =
"documents" := post.documents ~> jsonEmptyObject
deleteDocuments :: Session -> Int -> DeleteDocumentQuery -> Aff (Array Int)
deleteDocuments session nodeId = deleteWithBody to
where to = url session (NodeAPI Node (Just nodeId)) <> "/documents"
deleteDocuments :: Int -> DeleteDocumentQuery -> Aff (Array Int)
deleteDocuments nodeId = deleteWithBody (toUrl endConfigStateful Back Node (Just nodeId) <> "/documents")
......@@ -4,7 +4,7 @@ import Prelude hiding (div)
import DOM.Simple.Console (log2)
import Data.Argonaut (class DecodeJson, class EncodeJson, decodeJson, jsonEmptyObject, (.:), (:=), (~>))
import Data.Array (filter)
import Data.Array (filter, head)
import Data.Generic.Rep (class Generic)
import Data.Generic.Rep.Eq (genericEq)
import Data.Generic.Rep.Show (genericShow)
......@@ -139,8 +139,6 @@ performAction session _ ({tree: NTree (LNode {id}) _} /\ _) (UploadFile fileType
hashes <- uploadFile session id fileType contents
liftEffect $ log2 "uploaded:" hashes
------------------------------------------------------------------------
mCorpusId :: Maybe AppRoute -> Maybe Int
......@@ -279,7 +277,6 @@ childNodes session reload (true /\ _) mCurrentRoute ary = map (\ctree -> childNo
el = R.hooksComponent "ChildNodeView" cpt
cpt {tree} _ = do
treeState <- R.useState' {tree}
pure $ toHtml reload treeState session mCurrentRoute
-- END toHtml
......
......@@ -66,6 +66,7 @@ annuaireCpt = R.staticComponent "G.P.Annuaire.annuaire" cpt
headerProps = { title: name, desc: name, query: "", date, user: ""}
date = "Last update: " <> date'
style = {width: "250px", display: "inline-block"}
type PagePath = { nodeId :: Int, params :: T.Params }
type PageLayoutProps =
......@@ -98,10 +99,11 @@ page props = R.createElement pageCpt props []
pageCpt :: R.Component PageProps
pageCpt = R.staticComponent "LoadedAnnuairePage" cpt
where
cpt { session, annuairePath, pagePath, table: (AnnuaireTable {annuaireTable}) } _ = do
cpt { session, annuairePath, pagePath
, table: (AnnuaireTable {annuaireTable}) } _ = do
T.table { rows, setParams, container, colNames, totalRecords }
where
totalRecords =4361 -- TODO
totalRecords = 4361 -- TODO
rows = (\c -> {row: contactCells session c, delete: false}) <$> annuaireTable
setParams params = snd pagePath $ const {params, nodeId: fst annuairePath}
container = T.defaultContainer { title: "Annuaire" } -- TODO
......@@ -176,7 +178,9 @@ instance decodeAnnuaireTable :: DecodeJson AnnuaireTable where
decodeJson json = do
rows <- decodeJson json
pure $ AnnuaireTable { annuaireTable : rows}
------------------------------------------------------------------------
loadPage :: Session -> PagePath -> Aff AnnuaireTable
loadPage session {nodeId, params: { offset, limit, orderBy }} =
get $ url session children
......@@ -190,8 +194,6 @@ loadPage session {nodeId, params: { offset, limit, orderBy }} =
where
children = Children NodeContact offset limit Nothing {-(convOrderBy <$> orderBy)-} (Just nodeId)
------ Annuaire loading ------
getAnnuaireInfo :: Session -> Int -> Aff AnnuaireInfo
getAnnuaireInfo session id = get $ url session (NodeAPI Node (Just id))
......@@ -1074,6 +1074,14 @@ anymatch@^3.0.1:
normalize-path "^3.0.0"
picomatch "^2.0.4"
anymatch@^3.0.1:
version "3.0.3"
resolved "https://registry.yarnpkg.com/anymatch/-/anymatch-3.0.3.tgz#2fb624fe0e84bccab00afee3d0006ed310f22f09"
integrity sha512-c6IvoeBECQlMVuYUjSwimnhmztImpErfxJzWZhIQinIvQWoGOnB0dLIgifbPHQt5heS6mNlaZG16f06H3C8t1g==
dependencies:
normalize-path "^3.0.0"
picomatch "^2.0.4"
aproba@^1.0.3, aproba@^1.1.1:
version "1.2.0"
resolved "https://registry.yarnpkg.com/aproba/-/aproba-1.2.0.tgz#6802e6264efd18c790a1b0d517f0f2627bf2c94a"
......
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