Commit 2d2e2b7b authored by Przemyslaw Kaminski's avatar Przemyslaw Kaminski

[URL] toUrl/toLink with EndConfig as a parameter

This paves the way to add endConfig as a variable.
parent a934950a
...@@ -35,7 +35,7 @@ import Reactix.DOM.HTML as H ...@@ -35,7 +35,7 @@ import Reactix.DOM.HTML as H
import Unsafe.Coerce (unsafeCoerce) import Unsafe.Coerce (unsafeCoerce)
------------------------------------------------------------------------ ------------------------------------------------------------------------
import Gargantext.Prelude import Gargantext.Prelude
import Gargantext.Config (End(..), NodeType(..), OrderBy(..), Path(..), TabType, TabPostQuery(..), toUrl, toLink) import Gargantext.Config (End(..), NodeType(..), OrderBy(..), Path(..), TabType, TabPostQuery(..), toUrl, endConfigStateful, toLink)
import Gargantext.Config.REST (get, put, post, deleteWithBody, delete) import Gargantext.Config.REST (get, put, post, deleteWithBody, delete)
import Gargantext.Components.Loader2 (useLoader) import Gargantext.Components.Loader2 (useLoader)
import Gargantext.Components.Node (NodePoly(..)) import Gargantext.Components.Node (NodePoly(..))
...@@ -217,8 +217,8 @@ type PageParams = { nodeId :: Int ...@@ -217,8 +217,8 @@ type PageParams = { nodeId :: Int
loadPage :: PageParams -> Aff (Array DocumentsView) loadPage :: PageParams -> Aff (Array DocumentsView)
loadPage {nodeId, tabType, query, listId, corpusId, params: {limit, offset, orderBy}} = do loadPage {nodeId, tabType, query, listId, corpusId, params: {limit, offset, orderBy}} = do
logs "loading documents page: loadPage with Offset and limit" logs "loading documents page: loadPage with Offset and limit"
-- res <- get $ toUrl Back (Tab tabType offset limit (convOrderBy <$> orderBy)) (Just nodeId) -- res <- get $ toUrl endConfigStateful Back (Tab tabType offset limit (convOrderBy <$> orderBy)) (Just nodeId)
let url = (toUrl Back Node (Just nodeId)) <> "/table" let url = (toUrl endConfigStateful Back Node (Just nodeId)) <> "/table"
res <- post url $ TabPostQuery { res <- post url $ TabPostQuery {
offset offset
, limit , limit
...@@ -297,7 +297,7 @@ renderPage (localCategories /\ setLocalCategories) (_ /\ setTableParams) p res = ...@@ -297,7 +297,7 @@ renderPage (localCategories /\ setLocalCategories) (_ /\ setTableParams) p res =
} }
-- TODO show date: Year-Month-Day only -- TODO show date: Year-Month-Day only
, H.div { style: trashStyle cat } [ H.text (show r.date) ] , H.div { style: trashStyle cat } [ H.text (show r.date) ]
, H.a { href: toLink $ (corpusDocument corpusId) listId r._id , H.a { href: toLink endConfigStateful $ (corpusDocument corpusId) listId r._id
, style: trashStyle cat , style: trashStyle cat
, target: "_blank" , target: "_blank"
} [ H.text r.title ] } [ H.text r.title ]
...@@ -373,13 +373,13 @@ instance encodeJsonCategoryQuery :: EncodeJson CategoryQuery where ...@@ -373,13 +373,13 @@ instance encodeJsonCategoryQuery :: EncodeJson CategoryQuery where
~> jsonEmptyObject ~> jsonEmptyObject
categoryUrl :: Int -> String categoryUrl :: Int -> String
categoryUrl nodeId = toUrl Back Node (Just nodeId) <> "/category" categoryUrl nodeId = toUrl endConfigStateful Back Node (Just nodeId) <> "/category"
putCategories :: Int -> CategoryQuery -> Aff (Array Int) putCategories :: Int -> CategoryQuery -> Aff (Array Int)
putCategories nodeId = put $ categoryUrl nodeId putCategories nodeId = put $ categoryUrl nodeId
documentsUrl :: Int -> String documentsUrl :: Int -> String
documentsUrl nodeId = toUrl Back Node (Just nodeId) <> "/documents" documentsUrl nodeId = toUrl endConfigStateful Back Node (Just nodeId) <> "/documents"
deleteAllDocuments :: Int -> Aff (Array Int) deleteAllDocuments :: Int -> Aff (Array Int)
deleteAllDocuments nodeId = delete $ documentsUrl nodeId deleteAllDocuments nodeId = delete $ documentsUrl nodeId
......
...@@ -26,7 +26,7 @@ import React as React ...@@ -26,7 +26,7 @@ import React as React
import React (ReactClass, ReactElement, Children) import React (ReactClass, ReactElement, Children)
------------------------------------------------------------------------ ------------------------------------------------------------------------
import Gargantext.Prelude import Gargantext.Prelude
import Gargantext.Config (End(..), NodeType(..), OrderBy(..), Path(..), TabType, toUrl) import Gargantext.Config (End(..), NodeType(..), OrderBy(..), Path(..), TabType, toUrl, endConfigStateful)
import Gargantext.Config.REST (put, post, deleteWithBody) import Gargantext.Config.REST (put, post, deleteWithBody)
import Gargantext.Components.Loader as Loader import Gargantext.Components.Loader as Loader
import Gargantext.Components.Table as T import Gargantext.Components.Table as T
...@@ -296,7 +296,7 @@ initialPageParams {nodeId, listId, query} = {nodeId, listId, query, params: T.in ...@@ -296,7 +296,7 @@ initialPageParams {nodeId, listId, query} = {nodeId, listId, query, params: T.in
loadPage :: PageParams -> Aff (Array DocumentsView) loadPage :: PageParams -> Aff (Array DocumentsView)
loadPage {nodeId, listId, query, params: {limit, offset, orderBy}} = do loadPage {nodeId, listId, query, params: {limit, offset, orderBy}} = do
logs "loading documents page: loadPage with Offset and limit" logs "loading documents page: loadPage with Offset and limit"
let url = toUrl Back (Search { listId, offset, limit, orderBy: convOrderBy <$> orderBy }) (Just nodeId) let url = toUrl endConfigStateful Back (Search { listId, offset, limit, orderBy: convOrderBy <$> orderBy }) (Just nodeId)
SearchResults res <- post url $ SearchQuery {query} SearchResults res <- post url $ SearchQuery {query}
pure $ res2corpus <$> res.results pure $ res2corpus <$> res.results
where where
...@@ -368,7 +368,7 @@ renderPage loaderDispatch { totalRecords, dispatch, container ...@@ -368,7 +368,7 @@ renderPage loaderDispatch { totalRecords, dispatch, container
isChecked id = Set.member id documentIdsToDelete isChecked id = Set.member id documentIdsToDelete
isDeleted (DocumentsView {id}) = Set.member id documentIdsDeleted isDeleted (DocumentsView {id}) = Set.member id documentIdsDeleted
pairUrl (Pair {id,label}) pairUrl (Pair {id,label})
| id > 1 = [a [href (toUrl Front NodeContact (Just id)), target "blank"] [text label]] | id > 1 = [a [href (toUrl endConfigStateful Front NodeContact (Just id)), target "blank"] [text label]]
| otherwise = [text label] | otherwise = [text label]
comma = span [] [text ", "] comma = span [] [text ", "]
rows = (\(DocumentsView {id,score,title,source,date,pairs,delete}) -> rows = (\(DocumentsView {id,score,title,source,date,pairs,delete}) ->
...@@ -385,7 +385,7 @@ renderPage loaderDispatch { totalRecords, dispatch, container ...@@ -385,7 +385,7 @@ renderPage loaderDispatch { totalRecords, dispatch, container
] ]
-- TODO show date: Year-Month-Day only -- TODO show date: Year-Month-Day only
, div strikeIfDeleted [text date] , div strikeIfDeleted [text date]
, a (strikeIfDeleted <> [ href (toUrl Front (ListDocument (Just listId)) (Just id)) , a (strikeIfDeleted <> [ href (toUrl endConfigStateful Front (ListDocument (Just listId)) (Just id))
, target "blank"]) , target "blank"])
[ text title ] [ text title ]
, div strikeIfDeleted [text source] , div strikeIfDeleted [text source]
...@@ -426,10 +426,10 @@ instance encodeJsonDDQuery :: EncodeJson DeleteDocumentQuery where ...@@ -426,10 +426,10 @@ instance encodeJsonDDQuery :: EncodeJson DeleteDocumentQuery where
~> jsonEmptyObject ~> jsonEmptyObject
putFavorites :: Int -> FavoriteQuery -> Aff (Array Int) putFavorites :: Int -> FavoriteQuery -> Aff (Array Int)
putFavorites nodeId = put (toUrl Back Node (Just nodeId) <> "/favorites") putFavorites nodeId = put (toUrl endConfigStateful Back Node (Just nodeId) <> "/favorites")
deleteFavorites :: Int -> FavoriteQuery -> Aff (Array Int) deleteFavorites :: Int -> FavoriteQuery -> Aff (Array Int)
deleteFavorites nodeId = deleteWithBody (toUrl Back Node (Just nodeId) <> "/favorites") deleteFavorites nodeId = deleteWithBody (toUrl endConfigStateful Back Node (Just nodeId) <> "/favorites")
deleteDocuments :: Int -> DeleteDocumentQuery -> Aff (Array Int) deleteDocuments :: Int -> DeleteDocumentQuery -> Aff (Array Int)
deleteDocuments nodeId = deleteWithBody (toUrl Back Node (Just nodeId) <> "/documents") deleteDocuments nodeId = deleteWithBody (toUrl endConfigStateful Back Node (Just nodeId) <> "/documents")
...@@ -18,7 +18,7 @@ import Web.Storage.Storage (getItem, setItem, removeItem) ...@@ -18,7 +18,7 @@ import Web.Storage.Storage (getItem, setItem, removeItem)
------------------------------------------------------------------------ ------------------------------------------------------------------------
import Gargantext.Prelude import Gargantext.Prelude
import Gargantext.Config (toUrl, Path(..), End(..)) import Gargantext.Config (toUrl, endConfigStateful, Path(..), End(..))
import Gargantext.Config.REST (post) import Gargantext.Config.REST (post)
import Gargantext.Components.Modals.Modal (modalHide) import Gargantext.Components.Modals.Modal (modalHide)
import Gargantext.Components.Login.Types import Gargantext.Components.Login.Types
...@@ -214,4 +214,4 @@ setAuthData (Just (AuthData {tree_id, token})) = do ...@@ -214,4 +214,4 @@ setAuthData (Just (AuthData {tree_id, token})) = do
setItem "tree_id" (show tree_id) ls setItem "tree_id" (show tree_id) ls
postAuthRequest :: AuthRequest -> Aff AuthResponse postAuthRequest :: AuthRequest -> Aff AuthResponse
postAuthRequest = post $ toUrl Back Auth Nothing postAuthRequest = post $ toUrl endConfigStateful Back Auth Nothing
...@@ -86,7 +86,7 @@ import Partial.Unsafe (unsafePartial) ...@@ -86,7 +86,7 @@ import Partial.Unsafe (unsafePartial)
import Gargantext.Utils.KarpRabin (indicesOfAny) import Gargantext.Utils.KarpRabin (indicesOfAny)
import Gargantext.Types (TermList(..), TermSize) import Gargantext.Types (TermList(..), TermSize)
import Gargantext.Config (toUrl, End(..), Path(..), TabType, OrderBy(..), CTabNgramType(..)) import Gargantext.Config (toUrl, endConfigStateful, End(..), Path(..), TabType, OrderBy(..), CTabNgramType(..))
import Gargantext.Config.REST (get, put, post) import Gargantext.Config.REST (get, put, post)
import Gargantext.Components.Table as T import Gargantext.Components.Table as T
import Gargantext.Prelude import Gargantext.Prelude
...@@ -562,7 +562,7 @@ type CoreState s = ...@@ -562,7 +562,7 @@ type CoreState s =
postNewNgrams :: forall s. Array NgramsTerm -> Maybe TermList -> CoreParams s -> Aff Unit postNewNgrams :: forall s. Array NgramsTerm -> Maybe TermList -> CoreParams s -> Aff Unit
postNewNgrams newNgrams mayList {nodeId, listIds, tabType} = postNewNgrams newNgrams mayList {nodeId, listIds, tabType} =
when (not (A.null newNgrams)) $ do when (not (A.null newNgrams)) $ do
(_ :: Array Unit) <- post (toUrl Back (PutNgrams tabType (head listIds) mayList) $ Just nodeId) newNgrams (_ :: Array Unit) <- post (toUrl endConfigStateful Back (PutNgrams tabType (head listIds) mayList) $ Just nodeId) newNgrams
pure unit pure unit
postNewElems :: forall s. NewElems -> CoreParams s -> Aff Unit postNewElems :: forall s. NewElems -> CoreParams s -> Aff Unit
...@@ -576,7 +576,7 @@ addNewNgram ntype ngrams list = { ngramsPatches: mempty ...@@ -576,7 +576,7 @@ addNewNgram ntype ngrams list = { ngramsPatches: mempty
putNgramsPatches :: {nodeId :: Int, listIds :: Array Int, tabType :: TabType} -> Versioned NgramsPatches -> Aff (Versioned NgramsPatches) putNgramsPatches :: {nodeId :: Int, listIds :: Array Int, tabType :: TabType} -> Versioned NgramsPatches -> Aff (Versioned NgramsPatches)
putNgramsPatches {nodeId, listIds, tabType} = putNgramsPatches {nodeId, listIds, tabType} =
put (toUrl Back (PutNgrams tabType (head listIds) Nothing) $ Just nodeId) put (toUrl endConfigStateful Back (PutNgrams tabType (head listIds) Nothing) $ Just nodeId)
commitPatch :: forall s. {nodeId :: Int, listIds :: Array Int, tabType :: TabType} commitPatch :: forall s. {nodeId :: Int, listIds :: Array Int, tabType :: TabType}
-> Versioned NgramsTablePatch -> StateCoTransformer (CoreState s) Unit -> Versioned NgramsTablePatch -> StateCoTransformer (CoreState s) Unit
...@@ -593,7 +593,7 @@ commitPatch props (Versioned {version, data: tablePatch@{ngramsPatches, ngramsNe ...@@ -593,7 +593,7 @@ commitPatch props (Versioned {version, data: tablePatch@{ngramsPatches, ngramsNe
loadNgramsTable :: PageParams -> Aff VersionedNgramsTable loadNgramsTable :: PageParams -> Aff VersionedNgramsTable
loadNgramsTable { nodeId, listIds, termListFilter, termSizeFilter loadNgramsTable { nodeId, listIds, termListFilter, termSizeFilter
, searchQuery, tabType, params: {offset, limit, orderBy}} = , searchQuery, tabType, params: {offset, limit, orderBy}} =
get $ toUrl Back get $ toUrl endConfigStateful Back
(GetNgrams { tabType, offset, limit, listIds (GetNgrams { tabType, offset, limit, listIds
, orderBy: convOrderBy <$> orderBy , orderBy: convOrderBy <$> orderBy
, termListFilter, termSizeFilter , termListFilter, termSizeFilter
......
...@@ -35,7 +35,7 @@ import Web.File.FileList (FileList, item) ...@@ -35,7 +35,7 @@ import Web.File.FileList (FileList, item)
import Web.File.FileReader.Aff (readAsText) import Web.File.FileReader.Aff (readAsText)
import Gargantext.Components.Loader2 (useLoader) import Gargantext.Components.Loader2 (useLoader)
import Gargantext.Config (toUrl, End(..), NodeType(..), readNodeType) import Gargantext.Config (toUrl, endConfigStateful, End(..), NodeType(..), readNodeType)
import Gargantext.Config.REST (get, put, post, postWwwUrlencoded, delete) import Gargantext.Config.REST (get, put, post, postWwwUrlencoded, delete)
import Gargantext.Router as Router import Gargantext.Router as Router
import Gargantext.Types (class ToQuery, toQuery) import Gargantext.Types (class ToQuery, toQuery)
...@@ -227,7 +227,7 @@ nodeMainSpan d p folderOpen = R.createElement el p [] ...@@ -227,7 +227,7 @@ nodeMainSpan d p folderOpen = R.createElement el p []
pure $ H.span (dropProps droppedFile isDragOver) pure $ H.span (dropProps droppedFile isDragOver)
[ folderIcon folderOpen [ folderIcon folderOpen
, H.a { href: (toUrl Front nodeType (Just id)) , H.a { href: (toUrl endConfigStateful Front nodeType (Just id))
, style: {"margin-left": "22px"} , style: {"margin-left": "22px"}
} }
[ nodeText {isSelected: (mCorpusId mCurrentRoute) == (Just id), name} ] [ nodeText {isSelected: (mCorpusId mCurrentRoute) == (Just id), name} ]
...@@ -631,8 +631,8 @@ nodeText p = R.createElement el p [] ...@@ -631,8 +631,8 @@ nodeText p = R.createElement el p []
-- END node text -- END node text
loadNode :: ID -> Aff FTree loadNode :: ID -> Aff FTree
-- loadNode a = lift ((get <<< toUrl Back Tree <<< Just) a) -- loadNode a = lift ((get <<< toUrl endConfigStateful Back Tree <<< Just) a)
loadNode = get <<< toUrl Back Tree <<< Just loadNode = get <<< toUrl endConfigStateful Back Tree <<< Just
----- TREE CRUD Operations ----- TREE CRUD Operations
...@@ -660,13 +660,13 @@ instance encodeJsonCreateValue :: EncodeJson CreateValue where ...@@ -660,13 +660,13 @@ instance encodeJsonCreateValue :: EncodeJson CreateValue where
createNode :: ID -> CreateValue -> Aff ID createNode :: ID -> CreateValue -> Aff ID
--createNode = post $ urlPlease Back $ "new" --createNode = post $ urlPlease Back $ "new"
createNode parentId = post $ toUrl Back Node (Just parentId) createNode parentId = post $ toUrl endConfigStateful Back Node (Just parentId)
renameNode :: ID -> RenameValue -> Aff (Array ID) renameNode :: ID -> RenameValue -> Aff (Array ID)
renameNode renameNodeId = put $ toUrl Back Node (Just renameNodeId) <> "/rename" renameNode renameNodeId = put $ toUrl endConfigStateful Back Node (Just renameNodeId) <> "/rename"
deleteNode :: ID -> Aff ID deleteNode :: ID -> Aff ID
deleteNode = delete <<< toUrl Back Node <<< Just deleteNode = delete <<< toUrl endConfigStateful Back Node <<< Just
newtype FileUploadQuery = FileUploadQuery { newtype FileUploadQuery = FileUploadQuery {
fileType :: FileType fileType :: FileType
...@@ -683,15 +683,15 @@ uploadFile :: ID -> FileType -> UploadFileContents -> Aff (Array FileHash) ...@@ -683,15 +683,15 @@ uploadFile :: ID -> FileType -> UploadFileContents -> Aff (Array FileHash)
uploadFile id fileType (UploadFileContents fileContents) = postWwwUrlencoded url fileContents uploadFile id fileType (UploadFileContents fileContents) = postWwwUrlencoded url fileContents
where where
q = FileUploadQuery { fileType: fileType } q = FileUploadQuery { fileType: fileType }
url = toUrl Back Node (Just id) <> "/upload" <> Q.print (toQuery q) url = toUrl endConfigStateful Back Node (Just id) <> "/upload" <> Q.print (toQuery q)
-- UNUSED -- UNUSED
-- deleteNodes :: TODO -> Aff ID -- deleteNodes :: TODO -> Aff ID
-- deleteNodes = deleteWithBody (toUrl Back Nodes Nothing) -- deleteNodes = deleteWithBody (toUrl endConfigStateful Back Nodes Nothing)
-- UNUSED -- UNUSED
-- createNode :: TODO -> Aff ID -- createNode :: TODO -> Aff ID
-- createNode = post (toUrl Back Node Nothing) -- createNode = post (toUrl endConfigStateful Back Node Nothing)
fnTransform :: LNode -> FTree fnTransform :: LNode -> FTree
fnTransform n = NTree n [] fnTransform n = NTree n []
......
...@@ -23,6 +23,10 @@ urlPlease :: End -> String -> String ...@@ -23,6 +23,10 @@ urlPlease :: End -> String -> String
urlPlease end path = theEnd.baseUrl <> theEnd.prePath <> path urlPlease end path = theEnd.baseUrl <> theEnd.prePath <> path
where theEnd = endOf end endConfig where theEnd = endOf end endConfig
-- TODO temporary variable, to make refactoring easier
endConfigStateful :: EndConfig
endConfigStateful = endConfig
endConfig :: EndConfig endConfig :: EndConfig
endConfig = endConfig' V10 endConfig = endConfig' V10
...@@ -236,22 +240,22 @@ routesPath (R.UserPage i) = "user/" <> show i ...@@ -236,22 +240,22 @@ routesPath (R.UserPage i) = "user/" <> show i
routesPath (R.ContactPage i) = "contact/" <> show i routesPath (R.ContactPage i) = "contact/" <> show i
class Linkable a where class Linkable a where
toLink :: a -> String toLink :: EndConfig -> a -> String
instance linkableRoutes :: Linkable R.Routes where instance linkableRoutes :: Linkable R.Routes where
toLink l = endConfig.front.baseUrl <> endConfig.front.prePath <> routesPath l toLink ec l = ec.front.baseUrl <> endConfig.front.prePath <> routesPath l
class ToUrl a where class ToUrl a where
toUrl :: End -> a -> Maybe Id -> Url toUrl :: EndConfig -> End -> a -> Maybe Id -> Url
instance toUrlNodeType :: ToUrl NodeType where instance toUrlNodeType :: ToUrl NodeType where
toUrl e nt i = toUrl e (NodeAPI nt) i toUrl ec e nt i = toUrl ec e (NodeAPI nt) i
instance toUrlPath :: ToUrl Path where instance toUrlPath :: ToUrl Path where
toUrl e p i = doUrl base path params toUrl ec e p i = doUrl base path params
where where
base = endBaseUrl e endConfig base = endBaseUrl e ec
path = endPathUrl e endConfig p i path = endPathUrl e ec p i
params = "" params = ""
------------------------------------------------------------ ------------------------------------------------------------
......
...@@ -12,7 +12,7 @@ import Effect.Class (liftEffect) ...@@ -12,7 +12,7 @@ import Effect.Class (liftEffect)
import Gargantext.Components.Loader as Loader import Gargantext.Components.Loader as Loader
import Gargantext.Components.Tab as Tab import Gargantext.Components.Tab as Tab
import Gargantext.Components.Table as T import Gargantext.Components.Table as T
import Gargantext.Config (toUrl, Path(..), NodeType(..), End(..)) import Gargantext.Config (toUrl, endConfigStateful, Path(..), NodeType(..), End(..))
import Gargantext.Config.REST (get) import Gargantext.Config.REST (get)
import Gargantext.Pages.Annuaire.User.Contacts.Types (Contact(..), HyperdataContact(..), ContactWhere(..)) import Gargantext.Pages.Annuaire.User.Contacts.Types (Contact(..), HyperdataContact(..), ContactWhere(..))
import React (ReactClass, ReactElement, Children) import React (ReactClass, ReactElement, Children)
...@@ -128,7 +128,7 @@ renderPage dispatch {annuaireInfo} { currentPath: {nodeId} ...@@ -128,7 +128,7 @@ renderPage dispatch {annuaireInfo} { currentPath: {nodeId}
showRow :: Maybe Contact -> ReactElement showRow :: Maybe Contact -> ReactElement
showRow Nothing = tr [][] showRow Nothing = tr [][]
showRow (Just (Contact {id: id, hyperdata: (HyperdataContact contact) })) = tr [] [] showRow (Just (Contact {id: id, hyperdata: (HyperdataContact contact) })) = tr [] []
[ td [] [ a [ href (toUrl Front NodeUser (Just id)) ] [ [ td [] [ a [ href (toUrl endConfigStateful Front NodeUser (Just id)) ] [
text $ maybe "name" identity contact.title text $ maybe "name" identity contact.title
] ]
] ]
...@@ -151,7 +151,7 @@ renderContactCells :: Maybe Contact -> Array ReactElement ...@@ -151,7 +151,7 @@ renderContactCells :: Maybe Contact -> Array ReactElement
renderContactCells Nothing = [] renderContactCells Nothing = []
renderContactCells (Just (Contact { id, hyperdata : (HyperdataContact contact@{who: who, ou:ou} ) })) = renderContactCells (Just (Contact { id, hyperdata : (HyperdataContact contact@{who: who, ou:ou} ) })) =
[ text "" [ text ""
, a [ href (toUrl Front NodeContact (Just id)), target "blank" ] [ text $ maybe "name" identity contact.title ] , a [ href (toUrl endConfigStateful Front NodeContact (Just id)), target "blank" ] [ text $ maybe "name" identity contact.title ]
, text $ maybe "No ContactWhere" renderContactWhereOrg (head $ ou) , text $ maybe "No ContactWhere" renderContactWhereOrg (head $ ou)
, text $ maybe "No ContactWhere" renderContactWhereDept (head $ ou) , text $ maybe "No ContactWhere" renderContactWhereDept (head $ ou)
, div [className "nooverflow"] [text $ maybe "No ContactWhere" renderContactWhereRole (head $ ou)] , div [className "nooverflow"] [text $ maybe "No ContactWhere" renderContactWhereRole (head $ ou)]
...@@ -220,7 +220,7 @@ instance decodeAnnuaireTable :: DecodeJson AnnuaireTable where ...@@ -220,7 +220,7 @@ instance decodeAnnuaireTable :: DecodeJson AnnuaireTable where
------------------------------------------------------------------------ ------------------------------------------------------------------------
loadPage :: PageParams -> Aff AnnuaireTable loadPage :: PageParams -> Aff AnnuaireTable
loadPage {nodeId, params: { offset, limit, orderBy }} = loadPage {nodeId, params: { offset, limit, orderBy }} =
get $ toUrl Back (Children NodeContact offset limit Nothing {-(convOrderBy <$> orderBy)-}) get $ toUrl endConfigStateful Back (Children NodeContact offset limit Nothing {-(convOrderBy <$> orderBy)-})
(Just nodeId) (Just nodeId)
-- TODO orderBy -- TODO orderBy
-- where -- where
...@@ -230,7 +230,7 @@ loadPage {nodeId, params: { offset, limit, orderBy }} = ...@@ -230,7 +230,7 @@ loadPage {nodeId, params: { offset, limit, orderBy }} =
-- convOrderBy _ = NameAsc -- TODO -- convOrderBy _ = NameAsc -- TODO
getAnnuaireInfo :: Int -> Aff AnnuaireInfo getAnnuaireInfo :: Int -> Aff AnnuaireInfo
getAnnuaireInfo id = get $ toUrl Back Node (Just id) getAnnuaireInfo id = get $ toUrl endConfigStateful Back Node (Just id)
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
annuaireLoaderClass :: ReactClass (Loader.Props Int AnnuaireInfo) annuaireLoaderClass :: ReactClass (Loader.Props Int AnnuaireInfo)
......
...@@ -23,7 +23,7 @@ import React.DOM (div, h3, img, li, span, text, ul, text) ...@@ -23,7 +23,7 @@ import React.DOM (div, h3, img, li, span, text, ul, text)
import React.DOM.Props (_id, className, src) import React.DOM.Props (_id, className, src)
import Reactix as R import Reactix as R
import Gargantext.Prelude import Gargantext.Prelude
import Gargantext.Config (toUrl, End(..), NodeType(..), Path(..)) import Gargantext.Config (toUrl, endConfigStateful, End(..), NodeType(..), Path(..))
import Gargantext.Config.REST (get) import Gargantext.Config.REST (get)
import Gargantext.Components.Node (NodePoly(..), HyperdataList(..)) import Gargantext.Components.Node (NodePoly(..), HyperdataList(..))
import Gargantext.Components.Loader2 (useLoader) import Gargantext.Components.Loader2 (useLoader)
...@@ -167,9 +167,9 @@ layoutUser = ...@@ -167,9 +167,9 @@ layoutUser =
-- | toUrl to get data -- | toUrl to get data
getContact :: Int -> Aff ContactData getContact :: Int -> Aff ContactData
getContact id = do getContact id = do
contactNode <- get $ toUrl Back Node $ Just id contactNode <- get $ toUrl endConfigStateful Back Node $ Just id
-- TODO: we need a default list for the pairings -- TODO: we need a default list for the pairings
--defaultListIds <- get $ toUrl Back (Children NodeList 0 1 Nothing) $ Just id --defaultListIds <- get $ toUrl endConfigStateful Back (Children NodeList 0 1 Nothing) $ Just id
--case (head defaultListIds :: Maybe (NodePoly HyperdataList)) of --case (head defaultListIds :: Maybe (NodePoly HyperdataList)) of
-- Just (NodePoly { id: defaultListId }) -> -- Just (NodePoly { id: defaultListId }) ->
-- pure {contactNode, defaultListId} -- pure {contactNode, defaultListId}
......
...@@ -12,7 +12,6 @@ import Gargantext.Prelude ...@@ -12,7 +12,6 @@ import Gargantext.Prelude
import Gargantext.Components.Node (NodePoly(..), HyperdataList) import Gargantext.Components.Node (NodePoly(..), HyperdataList)
import Gargantext.Components.Loader2 (useLoader) import Gargantext.Components.Loader2 (useLoader)
import Gargantext.Components.Table as Table import Gargantext.Components.Table as Table
import Gargantext.Config (toUrl, Path(..), NodeType(..), End(..))
import Gargantext.Config.REST (get) import Gargantext.Config.REST (get)
import Gargantext.Pages.Texts.Tabs.Types (CorpusData, CorpusInfo(..)) import Gargantext.Pages.Texts.Tabs.Types (CorpusData, CorpusInfo(..))
import Gargantext.Pages.Texts.Tabs.Specs (elt) as Tabs import Gargantext.Pages.Texts.Tabs.Specs (elt) as Tabs
......
...@@ -8,7 +8,7 @@ import Data.Map (Map) ...@@ -8,7 +8,7 @@ import Data.Map (Map)
import Data.Maybe (Maybe(..), maybe) import Data.Maybe (Maybe(..), maybe)
import Data.Tuple (Tuple(..)) import Data.Tuple (Tuple(..))
import Effect.Aff (Aff) import Effect.Aff (Aff)
import Gargantext.Config -- (End(..), Path(..), TabType, toUrl) import Gargantext.Config
import Gargantext.Config.REST (get) import Gargantext.Config.REST (get)
import React (ReactClass, ReactElement, createElement) import React (ReactClass, ReactElement, createElement)
import Reactix as R import Reactix as R
...@@ -71,7 +71,7 @@ chartOptions (HistoMetrics { dates: dates', count: count'}) = Options ...@@ -71,7 +71,7 @@ chartOptions (HistoMetrics { dates: dates', count: count'}) = Options
getMetrics :: Path -> Aff HistoMetrics getMetrics :: Path -> Aff HistoMetrics
getMetrics {corpusId, tabType} = do getMetrics {corpusId, tabType} = do
ChartMetrics ms <- get $ toUrl Back (Chart {chartType: Histo, tabType: tabType}) $ Just corpusId ChartMetrics ms <- get $ toUrl endConfigStateful Back (Chart {chartType: Histo, tabType: tabType}) $ Just corpusId
pure ms."data" pure ms."data"
histoSpec :: Spec {} Path Void histoSpec :: Spec {} Path Void
......
...@@ -7,7 +7,7 @@ import Data.Map (Map) ...@@ -7,7 +7,7 @@ import Data.Map (Map)
import Data.Maybe (Maybe(..), maybe) import Data.Maybe (Maybe(..), maybe)
import Data.Tuple (Tuple(..)) import Data.Tuple (Tuple(..))
import Effect.Aff (Aff) import Effect.Aff (Aff)
import Gargantext.Config -- (End(..), Path(..), TabType, toUrl) import Gargantext.Config
import Gargantext.Config.REST (get) import Gargantext.Config.REST (get)
import React (ReactClass, ReactElement, createElement) import React (ReactClass, ReactElement, createElement)
import Reactix as R import Reactix as R
...@@ -98,7 +98,7 @@ scatterOptions metrics = Options ...@@ -98,7 +98,7 @@ scatterOptions metrics = Options
getMetrics :: Path -> Aff Loaded getMetrics :: Path -> Aff Loaded
getMetrics {corpusId, listId, limit, tabType} = do getMetrics {corpusId, listId, limit, tabType} = do
Metrics ms <- get $ toUrl Back (CorpusMetrics {listId, tabType, limit}) $ Just corpusId Metrics ms <- get $ toUrl endConfigStateful Back (CorpusMetrics {listId, tabType, limit}) $ Just corpusId
pure ms."data" pure ms."data"
......
...@@ -8,7 +8,7 @@ import Data.Maybe (Maybe(..), maybe) ...@@ -8,7 +8,7 @@ import Data.Maybe (Maybe(..), maybe)
import Data.String (take, joinWith, Pattern(..), split, length) import Data.String (take, joinWith, Pattern(..), split, length)
import Data.Tuple (Tuple(..)) import Data.Tuple (Tuple(..))
import Effect.Aff (Aff) import Effect.Aff (Aff)
import Gargantext.Config -- (End(..), Path(..), TabType, toUrl) import Gargantext.Config
import Gargantext.Config.REST (get) import Gargantext.Config.REST (get)
import React (ReactClass, ReactElement, createElement) import React (ReactClass, ReactElement, createElement)
import Reactix as R import Reactix as R
...@@ -82,7 +82,7 @@ chartOptionsPie (HistoMetrics { dates: dates', count: count'}) = Options ...@@ -82,7 +82,7 @@ chartOptionsPie (HistoMetrics { dates: dates', count: count'}) = Options
getMetrics :: Path -> Aff HistoMetrics getMetrics :: Path -> Aff HistoMetrics
getMetrics {corpusId, tabType:tabType} = do getMetrics {corpusId, tabType:tabType} = do
ChartMetrics ms <- get $ toUrl Back (Chart {chartType: ChartPie, tabType: tabType}) $ Just corpusId ChartMetrics ms <- get $ toUrl endConfigStateful Back (Chart {chartType: ChartPie, tabType: tabType}) $ Just corpusId
pure ms."data" pure ms."data"
......
...@@ -7,7 +7,7 @@ import Data.Argonaut (class DecodeJson, decodeJson, (.?)) ...@@ -7,7 +7,7 @@ import Data.Argonaut (class DecodeJson, decodeJson, (.?))
import Data.Maybe (Maybe(..), maybe) import Data.Maybe (Maybe(..), maybe)
import Data.Tuple (Tuple(..)) import Data.Tuple (Tuple(..))
import Effect.Aff (Aff) import Effect.Aff (Aff)
import Gargantext.Config -- (End(..), Path(..), TabType, toUrl) import Gargantext.Config
import Gargantext.Config.REST (get) import Gargantext.Config.REST (get)
import React (ReactClass, ReactElement, createElement) import React (ReactClass, ReactElement, createElement)
import Reactix as R import Reactix as R
...@@ -63,7 +63,7 @@ scatterOptions nodes = Options ...@@ -63,7 +63,7 @@ scatterOptions nodes = Options
getMetrics :: Path -> Aff Loaded getMetrics :: Path -> Aff Loaded
getMetrics {corpusId, listId, limit, tabType} = do getMetrics {corpusId, listId, limit, tabType} = do
Metrics ms <- get $ toUrl Back (Chart {chartType : ChartTree, tabType: tabType}) $ Just corpusId Metrics ms <- get $ toUrl endConfigStateful Back (Chart {chartType : ChartTree, tabType: tabType}) $ Just corpusId
pure ms."data" pure ms."data"
treeSpec :: Spec {} Path Void treeSpec :: Spec {} Path Void
......
...@@ -12,7 +12,7 @@ import Reactix as R ...@@ -12,7 +12,7 @@ import Reactix as R
import Thermite (PerformAction, Render, Spec, simpleSpec, cmapProps, createClass) import Thermite (PerformAction, Render, Spec, simpleSpec, cmapProps, createClass)
import Gargantext.Prelude import Gargantext.Prelude
import Gargantext.Config (toUrl, NodeType(..), End(..), TabSubType(..), TabType(..), CTabNgramType(..), CTabNgramType(..)) import Gargantext.Config (toUrl, endConfigStateful, NodeType(..), End(..), TabSubType(..), TabType(..), CTabNgramType(..), CTabNgramType(..))
import Gargantext.Config.REST (get) import Gargantext.Config.REST (get)
import Gargantext.Components.AutoUpdate (autoUpdateElt) import Gargantext.Components.AutoUpdate (autoUpdateElt)
import Gargantext.Components.Loader2 (useLoader) import Gargantext.Components.Loader2 (useLoader)
...@@ -353,7 +353,7 @@ layout = ...@@ -353,7 +353,7 @@ layout =
------------------------------------------------------------------------ ------------------------------------------------------------------------
loadDocument :: Int -> Aff NodeDocument loadDocument :: Int -> Aff NodeDocument
loadDocument = get <<< toUrl Back Node <<< Just loadDocument = get <<< toUrl endConfigStateful Back Node <<< Just
loadData :: DocPath -> Aff LoadedData loadData :: DocPath -> Aff LoadedData
loadData {nodeId, listIds, tabType} = do loadData {nodeId, listIds, tabType} = do
......
...@@ -717,7 +717,7 @@ specOld = fold [treespec treeSpec, graphspec $ simpleSpec performAction render'] ...@@ -717,7 +717,7 @@ specOld = fold [treespec treeSpec, graphspec $ simpleSpec performAction render']
getNodes :: Int -> Aff GraphData getNodes :: Int -> Aff GraphData
getNodes graphId = get $ Config.toUrl Config.Back Config.Graph $ Just graphId getNodes graphId = get $ Config.toUrl Config.endConfigStateful Config.Back Config.Graph $ Just graphId
getAuthData :: Effect (Maybe AuthData) getAuthData :: Effect (Maybe AuthData)
getAuthData = do getAuthData = do
......
...@@ -11,7 +11,7 @@ import Gargantext.Prelude ...@@ -11,7 +11,7 @@ import Gargantext.Prelude
import Gargantext.Components.Node (NodePoly(..), HyperdataList) import Gargantext.Components.Node (NodePoly(..), HyperdataList)
import Gargantext.Components.Loader2 (useLoader) import Gargantext.Components.Loader2 (useLoader)
import Gargantext.Components.Table as Table import Gargantext.Components.Table as Table
import Gargantext.Config (toUrl, Path(..), NodeType(..), End(..)) import Gargantext.Config (toUrl, endConfigStateful, Path(..), NodeType(..), End(..))
import Gargantext.Config.REST (get) import Gargantext.Config.REST (get)
import Gargantext.Pages.Lists.Tabs.Types (CorpusData, CorpusInfo(..)) import Gargantext.Pages.Lists.Tabs.Types (CorpusData, CorpusInfo(..))
import Gargantext.Pages.Lists.Tabs.Specs (elt) as Tabs import Gargantext.Pages.Lists.Tabs.Specs (elt) as Tabs
...@@ -43,9 +43,9 @@ layout = ...@@ -43,9 +43,9 @@ layout =
getCorpus :: Int -> Aff CorpusData getCorpus :: Int -> Aff CorpusData
getCorpus listId = do getCorpus listId = do
-- fetch corpus via lists parentId -- fetch corpus via lists parentId
(NodePoly {parentId: corpusId} :: NodePoly {}) <- get $ toUrl Back Corpus $ Just listId (NodePoly {parentId: corpusId} :: NodePoly {}) <- get $ toUrl endConfigStateful Back Corpus $ Just listId
corpusNode <- get $ toUrl Back Corpus $ Just corpusId corpusNode <- get $ toUrl endConfigStateful Back Corpus $ Just corpusId
defaultListIds <- get $ toUrl Back (Children NodeList 0 1 Nothing) $ Just corpusId defaultListIds <- get $ toUrl endConfigStateful Back (Children NodeList 0 1 Nothing) $ Just corpusId
case (head defaultListIds :: Maybe (NodePoly HyperdataList)) of case (head defaultListIds :: Maybe (NodePoly HyperdataList)) of
Just (NodePoly { id: defaultListId }) -> Just (NodePoly { id: defaultListId }) ->
pure {corpusId, corpusNode, defaultListId} pure {corpusId, corpusNode, defaultListId}
......
...@@ -11,7 +11,7 @@ import Gargantext.Prelude ...@@ -11,7 +11,7 @@ import Gargantext.Prelude
import Gargantext.Components.Node (NodePoly(..), HyperdataList) import Gargantext.Components.Node (NodePoly(..), HyperdataList)
import Gargantext.Components.Loader2 (useLoader) import Gargantext.Components.Loader2 (useLoader)
import Gargantext.Components.Table as Table import Gargantext.Components.Table as Table
import Gargantext.Config (toUrl, Path(..), NodeType(..), End(..)) import Gargantext.Config (toUrl, endConfigStateful, Path(..), NodeType(..), End(..))
import Gargantext.Config.REST (get) import Gargantext.Config.REST (get)
import Gargantext.Pages.Texts.Tabs.Types (CorpusData, CorpusInfo(..)) import Gargantext.Pages.Texts.Tabs.Types (CorpusData, CorpusInfo(..))
import Gargantext.Pages.Texts.Tabs.Specs (elt) as Tabs import Gargantext.Pages.Texts.Tabs.Specs (elt) as Tabs
...@@ -43,9 +43,9 @@ layout = ...@@ -43,9 +43,9 @@ layout =
getCorpus :: Int -> Aff CorpusData getCorpus :: Int -> Aff CorpusData
getCorpus textsId = do getCorpus textsId = do
-- fetch corpus via texts parentId -- fetch corpus via texts parentId
(NodePoly {parentId: corpusId} :: NodePoly {}) <- get $ toUrl Back Corpus $ Just textsId (NodePoly {parentId: corpusId} :: NodePoly {}) <- get $ toUrl endConfigStateful Back Corpus $ Just textsId
corpusNode <- get $ toUrl Back Corpus $ Just corpusId corpusNode <- get $ toUrl endConfigStateful Back Corpus $ Just corpusId
defaultListIds <- get $ toUrl Back (Children NodeList 0 1 Nothing) $ Just corpusId defaultListIds <- get $ toUrl endConfigStateful Back (Children NodeList 0 1 Nothing) $ Just corpusId
case (head defaultListIds :: Maybe (NodePoly HyperdataList)) of case (head defaultListIds :: Maybe (NodePoly HyperdataList)) of
Just (NodePoly { id: defaultListId }) -> Just (NodePoly { id: defaultListId }) ->
pure {corpusId, corpusNode, defaultListId} pure {corpusId, corpusNode, defaultListId}
......
...@@ -8,7 +8,7 @@ import Data.List (fromFoldable) ...@@ -8,7 +8,7 @@ import Data.List (fromFoldable)
import Data.Maybe (Maybe(..)) import Data.Maybe (Maybe(..))
import Data.Tuple (Tuple(..)) import Data.Tuple (Tuple(..))
import Gargantext.Config (CTabNgramType(..), End(..), Path(..), TabSubType(..), TabType(..), toUrl) import Gargantext.Config (CTabNgramType(..), End(..), Path(..), TabSubType(..), TabType(..))
import Gargantext.Pages.Texts.Tabs.Types (Props, PropsRow) import Gargantext.Pages.Texts.Tabs.Types (Props, PropsRow)
import Gargantext.Pages.Corpus.Chart.Histo (histoSpec) import Gargantext.Pages.Corpus.Chart.Histo (histoSpec)
......
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