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
d30854cd
Commit
d30854cd
authored
Jan 03, 2023
by
Karen Konou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Node Calc upload] Update upload functions
parent
82d630c7
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
25 additions
and
18 deletions
+25
-18
Tree.purs
src/Gargantext/Components/Forest/Tree.purs
+3
-3
Action.purs
src/Gargantext/Components/Forest/Tree/Node/Action.purs
+2
-2
Types.purs
src/Gargantext/Components/Forest/Tree/Node/Action/Types.purs
+3
-3
Upload.purs
...Gargantext/Components/Forest/Tree/Node/Action/Upload.purs
+17
-10
No files found.
src/Gargantext/Components/Forest/Tree.purs
View file @
d30854cd
...
...
@@ -359,8 +359,8 @@ uploadArbitraryFile' fileFormat mName blob p@{ boxes: { errors, tasks }, session
GAT.insert id task tasks
here.log2 "[uploadArbitraryFile'] UploadArbitraryFile, uploaded, task:" task
uploadFrameCalc'
p@{ boxes: { errors, tasks }, session, tree: (NTree (LNode { id }) _) }
= do
eTask <- uploadFrameCalc session id
uploadFrameCalc'
lang p@{ boxes: { errors, tasks }, session, tree: (NTree (LNode { id }) _) } selection
= do
eTask <- uploadFrameCalc session id
lang selection
handleRESTError errors eTask $ \task -> liftEffect $ do
GAT.insert id task tasks
here.log2 "[performAction] UploadFrameCalc, uploaded, task:" task
...
...
@@ -400,7 +400,7 @@ performAction (ShareTeam username) p = shareTeam userna
performAction (SharePublic { params }) p = sharePublic params p
performAction (AddContact params) p = addContact params p
performAction (AddNode name nodeType) p = addNode' name nodeType p
performAction
UploadFrameCalc p = uploadFrameCalc' p
performAction
(UploadFrameCalc lang selection) p = uploadFrameCalc' lang p selection
performAction (UploadFile nodeType fileType fileFormat lang mName contents selection) p =
uploadFile' nodeType fileType fileFormat lang mName contents p selection
performAction (UploadArbitraryFile fileFormat mName blob selection) p =
...
...
src/Gargantext/Components/Forest/Tree/Node/Action.purs
View file @
d30854cd
...
...
@@ -44,7 +44,7 @@ icon (SharePublic _ ) = glyphiconNodeAction (Publish { subTreePara
icon (DoSearch _) = glyphiconNodeAction SearchBox
icon (UploadFile _ _ _ _ _ _ _) = glyphiconNodeAction Upload
icon (UploadArbitraryFile _ _ _ _ ) = glyphiconNodeAction Upload
icon
UploadFrameCalc
= glyphiconNodeAction Upload
icon
(UploadFrameCalc _ _)
= glyphiconNodeAction Upload
icon RefreshTree = glyphiconNodeAction Refresh
icon CloseBox = glyphiconNodeAction CloseNodePopover
icon DownloadNode = glyphiconNodeAction Download
...
...
@@ -68,7 +68,7 @@ text (SharePublic _ ) = "Publish !"
text (DoSearch _ ) = "Launch search !"
text (UploadFile _ _ _ _ _ _ _) = "Upload File !"
text (UploadArbitraryFile _ _ _ _) = "Upload arbitrary file !"
text
UploadFrameCalc
= "Upload frame calc"
text
(UploadFrameCalc _ _)
= "Upload frame calc"
text RefreshTree = "Refresh Tree !"
text CloseBox = "Close Box !"
text DownloadNode = "Download !"
...
...
src/Gargantext/Components/Forest/Tree/Node/Action/Types.purs
View file @
d30854cd
...
...
@@ -18,7 +18,7 @@ data Action = AddNode String GT.NodeType
| DoSearch GT.AsyncTaskWithType
| UploadFile GT.NodeType FileType FileFormat Lang (Maybe String) String Selection
| UploadArbitraryFile FileFormat (Maybe String) UploadFileBlob Selection
| UploadFrameCalc
| UploadFrameCalc
Lang Selection
| DownloadNode
| RefreshTree
| CloseBox
...
...
@@ -45,7 +45,7 @@ instance Eq Action where
eq (UploadFile nt1 ft1 ff1 l1 s1 _ _) (UploadFile nt2 ft2 ff2 l2 s2 _ _) =
(eq nt1 nt2) && (eq ft1 ft2) && (eq ff1 ff2) && (eq l1 l2) && (eq s1 s2)
eq (UploadArbitraryFile ff1 s1 _ _) (UploadArbitraryFile ff2 s2 _ _) = (eq ff1 ff2) && (eq s1 s2)
eq
UploadFrameCalc UploadFrameCalc = true
eq
(UploadFrameCalc l1 s1) (UploadFrameCalc l2 s2) = (eq l1 l2) && (eq s1 s2)
eq DownloadNode DownloadNode = true
eq RefreshTree RefreshTree = true
eq CloseBox CloseBox = true
...
...
@@ -70,7 +70,7 @@ instance Show Action where
show (DoSearch _ ) = "SearchQuery"
show (UploadFile _ _ _ _ _ _ _) = "UploadFile"
show (UploadArbitraryFile _ _ _ _) = "UploadArbitraryFile"
show
UploadFrameCalc
= "UploadFrameCalc"
show
(UploadFrameCalc _ _ )
= "UploadFrameCalc"
show RefreshTree = "RefreshTree"
show CloseBox = "CloseBox"
show DownloadNode = "Download"
...
...
src/Gargantext/Components/Forest/Tree/Node/Action/Upload.purs
View file @
d30854cd
...
...
@@ -710,10 +710,10 @@ uploadFrameCalcViewCpt :: R.Component Props
uploadFrameCalcViewCpt = here.component "uploadFrameCalcView" cpt
where
cpt { dispatch, session } _ = do
lang /\ langBox
lang
'
/\ langBox
<- R2.useBox' EN
selection
<-
T.useBox
ListSelection.MyListsFirst
selection
' /\ selectionBox
<-
R2.useBox'
ListSelection.MyListsFirst
let bodies = [
H.div
...
...
@@ -738,7 +738,7 @@ uploadFrameCalcViewCpt = here.component "uploadFrameCalcView" cpt
[
B.formSelect'
{ callback: flip T.write_ langBox
, value: lang
, value: lang
'
, list: [ EN, FR, No_extraction, Universal ]
}
[]
...
...
@@ -760,7 +760,7 @@ uploadFrameCalcViewCpt = here.component "uploadFrameCalcView" cpt
{ className: "form-group__field" }
[
ListSelection.selection
{ selection
{ selection
: selectionBox
, session
} []
]
...
...
@@ -769,22 +769,29 @@ uploadFrameCalcViewCpt = here.component "uploadFrameCalcView" cpt
let footer = H.div {}
[ H.button { className: "btn btn-primary"
, on: { click: onClick } }
, on: { click: onClick
lang' selection'
} }
[ H.text "Upload!" ]
]
pure $ panel bodies footer
where
onClick _ = do
onClick
lang' selection'
_ = do
void $ launchAff do
dispatch
UploadFrameCalc
dispatch
$ UploadFrameCalc lang' selection'
uploadFrameCalc :: Session
-> ID
-> Lang
-> ListSelection.Selection
-> AffRESTError GT.AsyncTaskWithType
uploadFrameCalc session id = do
uploadFrameCalc session id
lang selection
= do
let p = GR.NodeAPI GT.Node (Just id) $ GT.asyncTaskTypePath GT.UploadFrameCalc
let body = [
Tuple "_wf_lang" (Just $ show lang)
, Tuple "_wf_selection" (Just $ show selection)
]
eTask <- post
session p ([] :: Array String)
eTask <- post
WwwUrlencoded session p body
pure $ (\task -> GT.AsyncTaskWithType { task, typ: GT.UploadFrameCalc }) <$> eTask
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