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