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
139
Issues
139
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
gargantext
purescript-gargantext
Commits
214da83f
Commit
214da83f
authored
Nov 18, 2021
by
arturo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
>>> continue
parent
9cc0bffb
Pipeline
#2116
canceled with stage
Changes
5
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
42 additions
and
20 deletions
+42
-20
DocsTable.purs
src/Gargantext/Components/DocsTable.purs
+7
-10
DocumentFormCreation.purs
...Gargantext/Components/DocsTable/DocumentFormCreation.purs
+33
-8
Ends.purs
src/Gargantext/Ends.purs
+0
-1
Routes.purs
src/Gargantext/Routes.purs
+0
-1
Types.purs
src/Gargantext/Types.purs
+2
-0
No files found.
src/Gargantext/Components/DocsTable.purs
View file @
214da83f
...
...
@@ -6,7 +6,7 @@ import Gargantext.Prelude
import DOM.Simple.Console (log2)
import DOM.Simple.Event as DE
import Data.Array as A
import Data.Either (Either
(..)
)
import Data.Either (Either)
import Data.Generic.Rep (class Generic)
import Data.Lens ((^.))
import Data.Lens.At (at)
...
...
@@ -36,12 +36,13 @@ import Gargantext.Components.Nodes.Texts.Types as TextsT
import Gargantext.Components.Table as TT
import Gargantext.Components.Table.Types as TT
import Gargantext.Config.REST (RESTError)
import Gargantext.Config.Utils (handleRESTError)
import Gargantext.Ends (Frontends, url)
import Gargantext.Hooks.Loader (useLoader, useLoaderWithCacheAPI, HashedResponse(..))
import Gargantext.Routes (SessionRoute(NodeAPI))
import Gargantext.Routes as Routes
import Gargantext.Sessions (Session, sessionId, get, delete)
import Gargantext.Types (
FrontendError(..),
ListId, NodeID, NodeType(..), OrderBy(..), SidePanelState(..), TabSubType, TabType, TableResult, showTabType')
import Gargantext.Types (ListId, NodeID, NodeType(..), OrderBy(..), SidePanelState(..), TabSubType, TabType, TableResult, showTabType')
import Gargantext.Utils (sortWith, (?))
import Gargantext.Utils.CacheAPI as GUC
import Gargantext.Utils.QueryString (joinQueryStrings, mQueryParam, mQueryParamS, queryParam, queryParamS)
...
...
@@ -151,15 +152,11 @@ docViewCpt = here.component "docView" cpt where
liftEffect $
T.write_ true onDocumentCreationPendingBox
res
<- DFC.create session nodeId fdata
eTask
<- DFC.create session nodeId fdata
liftEffect $ case res of
Left err -> do
err' <- pure (FRESTError { error: err })
log2 "createDocumentCallback error" err
T.modify_ (A.cons $ err') boxes.errors
T.write_ false onDocumentCreationPendingBox
Right _ -> pure unit -- @WIP reload page
handleRESTError boxes.errors eTask
\t -> liftEffect do
here.log2 "[nodeDocument] NodeDocument task:" t
-- Render
pure $
...
...
src/Gargantext/Components/DocsTable/DocumentFormCreation.purs
View file @
214da83f
...
...
@@ -9,6 +9,7 @@ import Gargantext.Prelude
import DOM.Simple.Console (log3)
import Data.Either (Either(..))
import Data.Foldable (foldl, intercalate)
import Data.Maybe (Maybe(..))
import Effect (Effect)
import Effect.Aff (Aff)
import Gargantext.Components.Bootstrap as B
...
...
@@ -24,7 +25,7 @@ import Gargantext.Utils (nbsp, (?))
import Gargantext.Utils.Reactix as R2
import Reactix as R
import Reactix.DOM.HTML as H
import Record
(merge, rename)
import Record
as Record
import Record.Extra (pick)
import Type.Proxy (Proxy(..))
...
...
@@ -37,7 +38,7 @@ type Props =
type Options = ( | FormData )
options :: Record Options
options = merge {} defaultData
options =
Record.
merge {} defaultData
documentFormCreation :: forall r. R2.OptLeaf Options Props r
documentFormCreation = R2.optLeaf component options
...
...
@@ -135,7 +136,7 @@ component = R.hooksComponent "documentFormCreation" cpt where
[
B.formInput $
{ placeholder: "ex: author1, author2, …"
} `merge` bindStateKey "authors"
} `
Record.
merge` bindStateKey "authors"
,
R2.if' (fv.hasError' "authors") $
H.div { className: "form-group__error" }
...
...
@@ -163,7 +164,7 @@ component = R.hooksComponent "documentFormCreation" cpt where
[
B.formTextarea $
{ rows: 5
} `merge` bindStateKey "abstract"
} `
Record.
merge` bindStateKey "abstract"
]
]
,
...
...
@@ -208,12 +209,36 @@ documentFormValidation r = foldl append mempty rules
---------------------------------------------------
-- create ::
-- Session
-- -> GT.ID
-- -> Record FormData
-- -> Aff (Either RESTError GT.ID)
-- create session id = post session (GR.NodeDocument id) <<< r
-- where
-- r = rename (Proxy :: Proxy "source")
-- (Proxy :: Proxy "sources")
create ::
Session
-> GT.ID
-> Record FormData
-> Aff (Either RESTError GT.ID)
create session id = post session (GR.NodeDocument id) <<< r
-> Aff (Either RESTError GT.AsyncTaskWithType)
create session id =
rename
>>> post session request
>=> case _ of
Left err -> pure $ Left err
Right task -> pure $ Right $ GT.AsyncTaskWithType
{ task
, typ: GT.NodeDocument
}
where
r = rename (Proxy :: Proxy "source")
(Proxy :: Proxy "sources")
request = GR.NodeAPI GT.Node (Just id)
(GT.asyncTaskTypePath GT.NodeDocument)
rename = Record.rename
(Proxy :: Proxy "source")
(Proxy :: Proxy "sources")
src/Gargantext/Ends.purs
View file @
214da83f
...
...
@@ -196,7 +196,6 @@ sessionPath (R.ChartHash { chartType, listId, tabType } i) =
<> defaultListAddMaybe listId
-- sessionPath (R.NodeAPI (NodeContact s a i) i) = sessionPath $ "annuaire/" <> show a <> "/contact/" <> show i
sessionPath (R.NodeAPI Phylo pId p) = "phyloscape?nodeId=" <> (show $ fromMaybe 0 pId) <> p
sessionPath (R.NodeDocument id) = "node/" <> (show id) <> "/document/upload/async"
------- misc routing stuff
...
...
src/Gargantext/Routes.purs
View file @
214da83f
...
...
@@ -57,7 +57,6 @@ data SessionRoute
| CorpusMetricsHash { listId :: ListId, tabType :: TabType } (Maybe Id)
| Chart ChartOpts (Maybe Id)
| ChartHash { chartType :: ChartType, listId :: Maybe ListId, tabType :: TabType } (Maybe Id)
| NodeDocument Id
-- | AnnuaireContact AnnuaireId DocId
instance Show AppRoute where
...
...
src/Gargantext/Types.purs
View file @
214da83f
...
...
@@ -659,6 +659,7 @@ data AsyncTaskType = AddNode
| GraphRecompute
| ListUpload
| ListCSVUpload -- legacy v3 CSV upload for lists
| NodeDocument
| Query
| UpdateNgramsCharts
| UpdateNode
...
...
@@ -679,6 +680,7 @@ asyncTaskTypePath CorpusFormUpload = "add/form/async/"
asyncTaskTypePath GraphRecompute = "async/recompute/"
asyncTaskTypePath ListUpload = "add/form/async/"
asyncTaskTypePath ListCSVUpload = "csv/add/form/async/"
asyncTaskTypePath NodeDocument = "document/upload/async"
asyncTaskTypePath Query = "query/"
asyncTaskTypePath UpdateNgramsCharts = "ngrams/async/charts/update/"
asyncTaskTypePath UpdateNode = "update/"
...
...
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