Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
purescript-gargantext
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Grégoire Locqueville
purescript-gargantext
Commits
d2018b69
Commit
d2018b69
authored
Jul 29, 2019
by
Przemyslaw Kaminski
Committed by
James Laver
Sep 20, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[URL] toUrl/toLink with EndConfig as a parameter
This paves the way to add endConfig as a variable.
parent
5d299bfb
Changes
17
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
95 additions
and
59 deletions
+95
-59
DocsTable.purs
src/Gargantext/Components/DocsTable.purs
+23
-5
FacetsTable.purs
src/Gargantext/Components/FacetsTable.purs
+11
-5
Login.purs
src/Gargantext/Components/Login.purs
+2
-2
Core.purs
src/Gargantext/Components/NgramsTable/Core.purs
+4
-4
Tree.purs
src/Gargantext/Components/Tree.purs
+10
-11
Config.purs
src/Gargantext/Config.purs
+11
-7
Annuaire.purs
src/Gargantext/Pages/Annuaire.purs
+5
-5
Specs.purs
src/Gargantext/Pages/Annuaire/User/Contacts/Specs.purs
+3
-2
Corpus.purs
src/Gargantext/Pages/Corpus.purs
+6
-0
Histo.purs
src/Gargantext/Pages/Corpus/Chart/Histo.purs
+2
-2
Metrics.purs
src/Gargantext/Pages/Corpus/Chart/Metrics.purs
+2
-2
Pie.purs
src/Gargantext/Pages/Corpus/Chart/Pie.purs
+2
-2
Tree.purs
src/Gargantext/Pages/Corpus/Chart/Tree.purs
+2
-2
Document.purs
src/Gargantext/Pages/Corpus/Document.purs
+2
-2
Graph.purs
src/Gargantext/Pages/Corpus/Graph.purs
+2
-0
Lists.purs
src/Gargantext/Pages/Lists.purs
+4
-4
Texts.purs
src/Gargantext/Pages/Texts.purs
+4
-4
No files found.
src/Gargantext/Components/DocsTable.purs
View file @
d2018b69
...
...
@@ -23,8 +23,8 @@ import Reactix as R
import Reactix.DOM.HTML as H
------------------------------------------------------------------------
import Gargantext.Prelude
import Gargantext.Config (End(..), NodeType(..), OrderBy(..),
TabType, TabPostQuery(..), toUr
l, toLink)
import Gargantext.Config.REST (
delete, post
)
import Gargantext.Config (End(..), NodeType(..), OrderBy(..),
Path(..), TabType, TabPostQuery(..), toUrl, endConfigStatefu
l, toLink)
import Gargantext.Config.REST (
get, put, post, deleteWithBody, delete
)
import Gargantext.Components.Loader2 (useLoader)
import Gargantext.Components.Search.Types (Category(..), CategoryQuery(..), favCategory, trashCategory, decodeCategory, putCategories)
import Gargantext.Components.Table as T
...
...
@@ -211,8 +211,8 @@ type PageParams = { nodeId :: Int
loadPage :: PageParams -> Aff (Array DocumentsView)
loadPage {nodeId, tabType, query, listId, corpusId, params: {limit, offset, orderBy}} = do
logs "loading documents page: loadPage with Offset and limit"
-- res <- get $ toUrl Back (Tab tabType offset limit (convOrderBy <$> orderBy)) (Just nodeId)
let url = (toUrl Back Node (Just nodeId)) <> "/table"
-- res <- get $ toUrl
endConfigStateful
Back (Tab tabType offset limit (convOrderBy <$> orderBy)) (Just nodeId)
let url = (toUrl
endConfigStateful
Back Node (Just nodeId)) <> "/table"
res <- post url $ TabPostQuery {
offset
, limit
...
...
@@ -356,8 +356,26 @@ searchResults :: SearchQuery -> Aff Int
searchResults squery = post "http://localhost:8008/count" unit
-- TODO
newtype CategoryQuery = CategoryQuery {
nodeIds :: Array Int
, category :: Category
}
instance encodeJsonCategoryQuery :: EncodeJson CategoryQuery where
encodeJson (CategoryQuery post) =
"ntc_nodesId" := post.nodeIds
~> "ntc_category" := encodeJson post.category
~> jsonEmptyObject
categoryUrl :: Int -> String
categoryUrl nodeId = toUrl endConfigStateful Back Node (Just nodeId) <> "/category"
putCategories :: Int -> CategoryQuery -> Aff (Array Int)
putCategories nodeId = put $ categoryUrl nodeId
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 nodeId = delete $ documentsUrl nodeId
...
...
src/Gargantext/Components/FacetsTable.purs
View file @
d2018b69
...
...
@@ -19,8 +19,8 @@ import React as React
import React (ReactClass, ReactElement, Children)
------------------------------------------------------------------------
import Gargantext.Prelude
import Gargantext.Config (End(..), NodeType(..), OrderBy(..), Path(..),
toUrl, toLink
)
import Gargantext.Config.REST (post, deleteWithBody)
import Gargantext.Config (End(..), NodeType(..), OrderBy(..), Path(..),
TabType, toUrl, endConfigStateful
)
import Gargantext.Config.REST (p
ut, p
ost, deleteWithBody)
import Gargantext.Components.Loader as Loader
import Gargantext.Components.Search.Types (Category(..), CategoryQuery(..), favCategory, decodeCategory, putCategories)
import Gargantext.Components.Table as T
...
...
@@ -292,7 +292,7 @@ initialPageParams {nodeId, listId, query} = {nodeId, listId, query, params: T.in
loadPage :: PageParams -> Aff (Array DocumentsView)
loadPage {nodeId, listId, query, params: {limit, offset, orderBy}} = do
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}
pure $ res2corpus <$> res.results
where
...
...
@@ -365,7 +365,7 @@ renderPage loaderDispatch { totalRecords, dispatch, container
isChecked id = Set.member id documentIdsToDelete
isDeleted (DocumentsView {id}) = Set.member id documentIdsDeleted
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]
comma = span [] [text ", "]
rows = (\(DocumentsView {id,score,title,source,date,pairs,delete,category}) ->
...
...
@@ -413,5 +413,11 @@ instance encodeJsonDDQuery :: EncodeJson DeleteDocumentQuery where
= "documents" := post.documents
~> jsonEmptyObject
putFavorites :: Int -> FavoriteQuery -> Aff (Array Int)
putFavorites nodeId = put (toUrl endConfigStateful Back Node (Just nodeId) <> "/favorites")
deleteFavorites :: Int -> FavoriteQuery -> Aff (Array Int)
deleteFavorites nodeId = deleteWithBody (toUrl endConfigStateful Back Node (Just nodeId) <> "/favorites")
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")
src/Gargantext/Components/Login.purs
View file @
d2018b69
...
...
@@ -19,7 +19,7 @@ import Web.Storage.Storage (getItem, setItem, removeItem)
------------------------------------------------------------------------
import Gargantext.Prelude
import Gargantext.Config (toUrl, Path(..), End(..))
import Gargantext.Config (toUrl,
endConfigStateful,
Path(..), End(..))
import Gargantext.Config.REST (post)
import Gargantext.Components.Modals.Modal (modalHide)
import Gargantext.Components.Login.Types
...
...
@@ -245,4 +245,4 @@ setAuthData (Just (AuthData {tree_id, token})) = do
setItem "tree_id" (show tree_id) ls
postAuthRequest :: AuthRequest -> Aff AuthResponse
postAuthRequest = post $ toUrl Back Auth Nothing
postAuthRequest = post $ toUrl
endConfigStateful
Back Auth Nothing
src/Gargantext/Components/NgramsTable/Core.purs
View file @
d2018b69
...
...
@@ -86,7 +86,7 @@ import Partial.Unsafe (unsafePartial)
import Gargantext.Utils.KarpRabin (indicesOfAny)
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.Components.Table as T
import Gargantext.Prelude
...
...
@@ -564,7 +564,7 @@ type CoreState s =
postNewNgrams :: forall s. Array NgramsTerm -> Maybe TermList -> CoreParams s -> Aff Unit
postNewNgrams newNgrams mayList {nodeId, listIds, tabType} =
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
postNewElems :: forall s. NewElems -> CoreParams s -> Aff Unit
...
...
@@ -578,7 +578,7 @@ addNewNgram ntype ngrams list = { ngramsPatches: mempty
putNgramsPatches :: {nodeId :: Int, listIds :: Array Int, tabType :: TabType} -> Versioned NgramsPatches -> Aff (Versioned NgramsPatches)
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}
-> Versioned NgramsTablePatch -> StateCoTransformer (CoreState s) Unit
...
...
@@ -595,7 +595,7 @@ commitPatch props (Versioned {version, data: tablePatch@{ngramsPatches, ngramsNe
loadNgramsTable :: PageParams -> Aff VersionedNgramsTable
loadNgramsTable { nodeId, listIds, termListFilter, termSizeFilter
, searchQuery, tabType, params: {offset, limit, orderBy}} =
get $ toUrl Back
get $ toUrl
endConfigStateful
Back
(GetNgrams { tabType, offset, limit, listIds
, orderBy: convOrderBy <$> orderBy
, termListFilter, termSizeFilter
...
...
src/Gargantext/Components/Tree.purs
View file @
d2018b69
...
...
@@ -28,7 +28,7 @@ import Web.File.FileList (FileList, item)
import Web.File.FileReader.Aff (readAsText)
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.Router as Router
import Gargantext.Types (class ToQuery, toQuery)
...
...
@@ -230,8 +230,7 @@ nodeMainSpan d p folderOpen = R.createElement el p []
pure $ H.span (dropProps droppedFile isDragOver)
[ folderIcon folderOpen
, H.a { href: (toUrl Front nodeType (Just id))
, style: {marginLeft: "22px"}
}
, style: {marginLeft: "22px"} }
[ nodeText {isSelected: (mCorpusId mCurrentRoute) == (Just id), name} ]
, popOverIcon popupOpen
, nodePopupView d {id, name} popupOpen
...
...
@@ -633,8 +632,8 @@ nodeText p = R.createElement el p []
-- END node text
loadNode :: ID -> Aff FTree
-- loadNode a = lift ((get <<< toUrl Back Tree <<< Just) a)
loadNode = get <<< toUrl Back Tree <<< Just
-- loadNode a = lift ((get <<< toUrl
endConfigStateful
Back Tree <<< Just) a)
loadNode = get <<< toUrl
endConfigStateful
Back Tree <<< Just
----- TREE CRUD Operations
...
...
@@ -662,13 +661,13 @@ instance encodeJsonCreateValue :: EncodeJson CreateValue where
createNode :: ID -> CreateValue -> Aff ID
--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 renameNodeId = put $ toUrl Back Node (Just renameNodeId) <> "/rename"
renameNode renameNodeId = put $ toUrl
endConfigStateful
Back Node (Just renameNodeId) <> "/rename"
deleteNode :: ID -> Aff ID
deleteNode = delete <<< toUrl Back Node <<< Just
deleteNode = delete <<< toUrl
endConfigStateful
Back Node <<< Just
newtype FileUploadQuery = FileUploadQuery {
fileType :: FileType
...
...
@@ -685,15 +684,15 @@ uploadFile :: ID -> FileType -> UploadFileContents -> Aff (Array FileHash)
uploadFile id fileType (UploadFileContents fileContents) = postWwwUrlencoded url fileContents
where
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
-- deleteNodes :: TODO -> Aff ID
-- deleteNodes = deleteWithBody (toUrl Back Nodes Nothing)
-- deleteNodes = deleteWithBody (toUrl
endConfigStateful
Back Nodes Nothing)
-- UNUSED
-- createNode :: TODO -> Aff ID
-- createNode = post (toUrl Back Node Nothing)
-- createNode = post (toUrl
endConfigStateful
Back Node Nothing)
fnTransform :: LNode -> FTree
fnTransform n = NTree n []
src/Gargantext/Config.purs
View file @
d2018b69
...
...
@@ -23,6 +23,10 @@ urlPlease :: End -> String -> String
urlPlease end path = theEnd.baseUrl <> theEnd.prePath <> path
where theEnd = endOf end endConfig
-- TODO temporary variable, to make refactoring easier
endConfigStateful :: EndConfig
endConfigStateful = endConfig
endConfig :: EndConfig
endConfig = endConfig' V10
...
...
@@ -234,22 +238,22 @@ routesPath (R.UserPage i) = "user/" <> show i
routesPath (R.ContactPage i) = "contact/" <> show i
class Linkable a where
toLink :: a -> String
toLink ::
EndConfig ->
a -> String
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
toUrl :: End -> a -> Maybe Id -> Url
toUrl :: End
Config -> End
-> a -> Maybe Id -> Url
instance toUrlNodeType :: ToUrl NodeType where
toUrl e
nt i = toUrl
e (NodeAPI nt) i
toUrl e
c e nt i = toUrl ec
e (NodeAPI nt) i
instance toUrlPath :: ToUrl Path where
toUrl e p i = doUrl base path params
toUrl e
c e
p i = doUrl base path params
where
base = endBaseUrl e e
ndConfig
path = endPathUrl e e
ndConfig
p i
base = endBaseUrl e e
c
path = endPathUrl e e
c
p i
params = ""
------------------------------------------------------------
...
...
src/Gargantext/Pages/Annuaire.purs
View file @
d2018b69
...
...
@@ -12,7 +12,7 @@ import Effect.Class (liftEffect)
import Gargantext.Components.Loader as Loader
import Gargantext.Components.Tab as Tab
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.Pages.Annuaire.User.Contacts.Types (Contact(..), HyperdataContact(..), ContactWhere(..))
import React (ReactClass, ReactElement, Children)
...
...
@@ -128,7 +128,7 @@ renderPage dispatch {annuaireInfo} { currentPath: {nodeId}
showRow :: Maybe Contact -> ReactElement
showRow Nothing = 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
]
]
...
...
@@ -151,7 +151,7 @@ renderContactCells :: Maybe Contact -> Array ReactElement
renderContactCells Nothing = []
renderContactCells (Just (Contact { id, hyperdata : (HyperdataContact contact@{who: who, ou:ou} ) })) =
[ 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" renderContactWhereDept (head $ ou)
, div [className "nooverflow"] [text $ maybe "No ContactWhere" renderContactWhereRole (head $ ou)]
...
...
@@ -220,7 +220,7 @@ instance decodeAnnuaireTable :: DecodeJson AnnuaireTable where
------------------------------------------------------------------------
loadPage :: PageParams -> Aff AnnuaireTable
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)
-- TODO orderBy
-- where
...
...
@@ -230,7 +230,7 @@ loadPage {nodeId, params: { offset, limit, orderBy }} =
-- convOrderBy _ = NameAsc -- TODO
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)
...
...
src/Gargantext/Pages/Annuaire/User/Contacts/Specs.purs
View file @
d2018b69
...
...
@@ -21,6 +21,7 @@ import Thermite (Spec)
import Gargantext.Prelude
import Gargantext.Config (toUrl, End(..), NodeType(..))
import Gargantext.Config (toUrl, endConfigStateful, End(..), NodeType(..), Path(..))
import Gargantext.Config.REST (get)
import Gargantext.Components.Loader2 (useLoader)
import Gargantext.Pages.Annuaire.User.Contacts.Types
...
...
@@ -167,9 +168,9 @@ layoutUser =
-- | toUrl to get data
getContact :: Int -> Aff ContactData
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
--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
-- Just (NodePoly { id: defaultListId }) ->
-- pure {contactNode, defaultListId}
...
...
src/Gargantext/Pages/Corpus.purs
View file @
d2018b69
...
...
@@ -5,6 +5,12 @@ import Reactix.DOM.HTML as H
import Thermite (Spec)
--------------------------------------------------------
import Gargantext.Prelude
import Gargantext.Components.Node (NodePoly(..), HyperdataList)
import Gargantext.Components.Loader2 (useLoader)
import Gargantext.Components.Table as Table
import Gargantext.Config.REST (get)
import Gargantext.Pages.Texts.Tabs.Types (CorpusData, CorpusInfo(..))
import Gargantext.Pages.Texts.Tabs.Specs (elt) as Tabs
import Gargantext.Utils.Reactix as R2
------------------------------------------------------------------------
...
...
src/Gargantext/Pages/Corpus/Chart/Histo.purs
View file @
d2018b69
...
...
@@ -3,7 +3,7 @@ module Gargantext.Pages.Corpus.Chart.Histo where
import Data.Argonaut (class DecodeJson, decodeJson, (.:))
import Data.Maybe (Maybe(..))
import Effect.Aff (Aff)
import Gargantext.Config
-- (End(..), Path(..), TabType, toUrl)
import Gargantext.Config
import Gargantext.Config.REST (get)
import Reactix as R
import Thermite (Spec)
...
...
@@ -61,7 +61,7 @@ chartOptions (HistoMetrics { dates: dates', count: count'}) = Options
getMetrics :: Path -> Aff HistoMetrics
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"
histoSpec :: Spec {} Path Void
...
...
src/Gargantext/Pages/Corpus/Chart/Metrics.purs
View file @
d2018b69
...
...
@@ -6,7 +6,7 @@ import Data.Map (Map)
import Data.Maybe (Maybe(..))
import Data.Tuple (Tuple(..))
import Effect.Aff (Aff)
import Gargantext.Config
-- (End(..), Path(..), TabType, toUrl)
import Gargantext.Config
import Gargantext.Config.REST (get)
import Reactix as R
...
...
@@ -93,7 +93,7 @@ scatterOptions metrics = Options
getMetrics :: Path -> Aff Loaded
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"
...
...
src/Gargantext/Pages/Corpus/Chart/Pie.purs
View file @
d2018b69
...
...
@@ -7,7 +7,7 @@ import Data.Maybe (Maybe(..))
import Data.String (take, joinWith, Pattern(..), split, length)
import Data.Tuple (Tuple(..))
import Effect.Aff (Aff)
import Gargantext.Config
-- (End(..), Path(..), TabType, toUrl)
import Gargantext.Config
import Gargantext.Config.REST (get)
import Reactix as R
import Thermite (Spec)
...
...
@@ -77,7 +77,7 @@ chartOptionsPie (HistoMetrics { dates: dates', count: count'}) = Options
getMetrics :: Path -> Aff HistoMetrics
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"
...
...
src/Gargantext/Pages/Corpus/Chart/Tree.purs
View file @
d2018b69
...
...
@@ -3,7 +3,7 @@ module Gargantext.Pages.Corpus.Chart.Tree where
import Data.Argonaut (class DecodeJson, decodeJson, (.:))
import Data.Maybe (Maybe(..))
import Effect.Aff (Aff)
import Gargantext.Config
-- (End(..), Path(..), TabType, toUrl)
import Gargantext.Config
import Gargantext.Config.REST (get)
import Reactix as R
import Reactix.DOM.HTML as H
...
...
@@ -54,7 +54,7 @@ scatterOptions nodes = Options
getMetrics :: Path -> Aff Loaded
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"
treeSpec :: Spec {} Path Void
...
...
src/Gargantext/Pages/Corpus/Document.purs
View file @
d2018b69
...
...
@@ -12,7 +12,7 @@ import Reactix as R
import Thermite (PerformAction, Render, Spec, simpleSpec, cmapProps, createClass)
import Gargantext.Prelude
import Gargantext.Config (toUrl,
NodeType(..), End(..), TabSubType(..), Tab
Type(..), CTabNgramType(..))
import Gargantext.Config (toUrl,
endConfigStateful, NodeType(..), End(..), TabSubType(..), TabType(..), CTabNgram
Type(..), CTabNgramType(..))
import Gargantext.Config.REST (get)
import Gargantext.Components.AutoUpdate (autoUpdateElt)
import Gargantext.Components.Loader2 (useLoader)
...
...
@@ -353,7 +353,7 @@ layout =
------------------------------------------------------------------------
loadDocument :: Int -> Aff NodeDocument
loadDocument = get <<< toUrl Back Node <<< Just
loadDocument = get <<< toUrl
endConfigStateful
Back Node <<< Just
loadData :: DocPath -> Aff LoadedData
loadData {nodeId, listIds, tabType} = do
...
...
src/Gargantext/Pages/Corpus/Graph.purs
View file @
d2018b69
...
...
@@ -516,4 +516,6 @@ render d p (State {sigmaGraphData, settings, legendData}) c =
-- ]
-- ]
-- ]
getNodes :: Int -> Aff GraphData
getNodes graphId = get $ Config.toUrl Config.endConfigStateful Config.Back Config.Graph $ Just graphId
src/Gargantext/Pages/Lists.purs
View file @
d2018b69
...
...
@@ -11,7 +11,7 @@ import Gargantext.Prelude
import Gargantext.Components.Node (NodePoly(..), HyperdataList)
import Gargantext.Components.Loader2 (useLoader)
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.Pages.Lists.Tabs.Types (CorpusData, CorpusInfo(..))
import Gargantext.Pages.Lists.Tabs.Specs (elt) as Tabs
...
...
@@ -43,9 +43,9 @@ layout =
getCorpus :: Int -> Aff CorpusData
getCorpus listId = do
-- fetch corpus via lists parentId
(NodePoly {parentId: corpusId} :: NodePoly {}) <- get $ toUrl Back Corpus $ Just listId
corpusNode <- get $ toUrl Back Corpus $ Just corpusId
defaultListIds <- get $ toUrl Back (Children NodeList 0 1 Nothing) $ Just corpusId
(NodePoly {parentId: corpusId} :: NodePoly {}) <- get $ toUrl
endConfigStateful
Back Corpus $ Just listId
corpusNode <- get $ toUrl
endConfigStateful
Back Corpus $ Just corpusId
defaultListIds <- get $ toUrl
endConfigStateful
Back (Children NodeList 0 1 Nothing) $ Just corpusId
case (head defaultListIds :: Maybe (NodePoly HyperdataList)) of
Just (NodePoly { id: defaultListId }) ->
pure {corpusId, corpusNode, defaultListId}
...
...
src/Gargantext/Pages/Texts.purs
View file @
d2018b69
...
...
@@ -11,7 +11,7 @@ import Gargantext.Prelude
import Gargantext.Components.Node (NodePoly(..), HyperdataList)
import Gargantext.Components.Loader2 (useLoader)
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.Pages.Texts.Tabs.Types (CorpusData, CorpusInfo(..))
import Gargantext.Pages.Texts.Tabs.Specs (elt) as Tabs
...
...
@@ -43,9 +43,9 @@ layout =
getCorpus :: Int -> Aff CorpusData
getCorpus textsId = do
-- fetch corpus via texts parentId
(NodePoly {parentId: corpusId} :: NodePoly {}) <- get $ toUrl Back Corpus $ Just textsId
corpusNode <- get $ toUrl Back Corpus $ Just corpusId
defaultListIds <- get $ toUrl Back (Children NodeList 0 1 Nothing) $ Just corpusId
(NodePoly {parentId: corpusId} :: NodePoly {}) <- get $ toUrl
endConfigStateful
Back Corpus $ Just textsId
corpusNode <- get $ toUrl
endConfigStateful
Back Corpus $ Just corpusId
defaultListIds <- get $ toUrl
endConfigStateful
Back (Children NodeList 0 1 Nothing) $ Just corpusId
case (head defaultListIds :: Maybe (NodePoly HyperdataList)) of
Just (NodePoly { id: defaultListId }) ->
pure {corpusId, corpusNode, defaultListId}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment