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
1
Merge Requests
1
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
Przemyslaw Kaminski
purescript-gargantext
Commits
f5f6efec
Commit
f5f6efec
authored
6 years ago
by
Sudhir Kumar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added code for deleting multiple documents
parent
54d7b3fe
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
9 deletions
+10
-9
Documents.purs
src/Gargantext/Pages/Corpus/Tabs/Documents.purs
+8
-8
States.purs
src/Gargantext/Pages/Corpus/Tabs/States.purs
+2
-1
No files found.
src/Gargantext/Pages/Corpus/Tabs/Documents.purs
View file @
f5f6efec
...
...
@@ -8,7 +8,7 @@ import Affjax.ResponseFormat (printResponseFormatError)
import Affjax.ResponseFormat as ResponseFormat
import Control.Monad.Cont.Trans (lift)
import Data.Argonaut (class DecodeJson, class EncodeJson, decodeJson, encodeJson, jsonEmptyObject, (.?), (:=), (~>))
import Data.Array (
take, drop
)
import Data.Array (
cons, drop, take, (:)
)
import Data.Either (Either(..))
import Data.Generic.Rep (class Generic)
import Data.Generic.Rep.Show (genericShow)
...
...
@@ -41,7 +41,7 @@ import Thermite (PerformAction, Render, Spec, defaultPerformAction, modifyState,
type State =
{ documents :: DocumentsView
, deleteRows :: Boolean
, deleteRowId :: Int
, deleteRowId ::
Array
Int
}
...
...
@@ -52,7 +52,7 @@ data Action
| Trash
performAction :: PerformAction State Props Action
performAction (SendFavorites nid)
_
_ = void $ do
performAction (SendFavorites nid)
{path : nodeId}
_ = void $ do
s' <- lift $ favorites nid (FavoriteQuery {favorites : [nid]})
case s' of
...
...
@@ -63,10 +63,10 @@ performAction (SendFavorites nid) _ _ = void $ do
performAction (DeleteDocuments nid) _ _ = void $ do
_ <- liftEffect $ log $ show nid
modifyState \state -> state {deleteRowId =
nid
, deleteRows = true}
modifyState \state -> state {deleteRowId =
( cons nid [])
, deleteRows = true}
performAction
(Trash) _
state = void $ do
s' <- lift $ deleteDocuments
state.deleteRowId (DeleteDocumentQuery {documents : [state.deleteRowId]
})
performAction
Trash {path:nodeId}
state = void $ do
s' <- lift $ deleteDocuments
nodeId (DeleteDocumentQuery {documents : state.deleteRowId
})
case s' of
Left err -> do
_ <- liftEffect $ log err
...
...
@@ -341,9 +341,9 @@ deleteFavorites nodeId reqbody= do
deleteDocuments :: Int -> DeleteDocumentQuery -> Aff (Either String Unit)
deleteDocuments
ddi
d reqbody= do
deleteDocuments
nodeI
d reqbody= do
res <- request $ defaultRequest
{ url = "http://localhost:8008/api/v1.0/annuaire/"<>show
ddid
<>"/documents"
{ url = "http://localhost:8008/api/v1.0/annuaire/"<>show
nodeId
<>"/documents"
, responseFormat = ResponseFormat.json
, method = Left DELETE
, headers = []
...
...
This diff is collapsed.
Click to expand it.
src/Gargantext/Pages/Corpus/Tabs/States.purs
View file @
f5f6efec
...
...
@@ -12,12 +12,13 @@ type State =
, activeTab :: Int
}
initialState :: State
initialState =
{ docsView :
{ documents : D.sampleData'
, deleteRows : false
, deleteRowId :
1
, deleteRowId :
[]
}
, ngramsView : {} -- N.initialState
, activeTab : 0
...
...
This diff is collapsed.
Click to expand it.
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