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
45afaf45
Commit
45afaf45
authored
Apr 03, 2020
by
Przemyslaw Kaminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[graph] graph version icon (refresh) and refresh version triggering
parent
c06adcf0
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
153 additions
and
23 deletions
+153
-23
Login.css
dist/styles/Login.css
+0
-7
Login.sass
dist/styles/Login.sass
+0
-5
Tree.css
dist/styles/Tree.css
+17
-0
Tree.sass
dist/styles/Tree.sass
+11
-0
Box.purs
src/Gargantext/Components/Forest/Tree/Node/Box.purs
+99
-11
API.purs
src/Gargantext/Components/GraphExplorer/API.purs
+25
-0
index.html
src/index.html
+1
-0
No files found.
dist/styles/Login.css
View file @
45afaf45
...
@@ -159,13 +159,6 @@ li .leaf:hover a.settings {
...
@@ -159,13 +159,6 @@ li .leaf:hover a.settings {
height
:
auto
;
height
:
auto
;
}
}
.tree
{
margin-top
:
10px
;
}
.tree
.file-dropped
{
background-color
:
#d8dfe5
;
}
#graph-tree
.tree
{
#graph-tree
.tree
{
margin-top
:
27px
;
margin-top
:
27px
;
}
}
...
...
dist/styles/Login.sass
View file @
45afaf45
...
@@ -150,11 +150,6 @@ li
...
@@ -150,11 +150,6 @@ li
overflow
:
visible
overflow
:
visible
height
:
auto
height
:
auto
.tree
margin-top
:
10px
.file-dropped
background-color
:
#d8dfe5
#graph-tree
#graph-tree
.tree
.tree
margin-top
:
27px
margin-top
:
27px
...
...
dist/styles/Tree.css
0 → 100644
View file @
45afaf45
.tree
{
margin-top
:
10px
;
}
.tree
.file-dropped
{
background-color
:
#d8dfe5
;
}
.tree
.node-actions
{
padding-left
:
5px
;
}
.tree
.node-actions
.update-button.enabled
{
cursor
:
pointer
;
}
.tree
.node-actions
.update-button.disabled
{
cursor
:
wait
;
}
/*# sourceMappingURL=Tree.css.map */
dist/styles/Tree.sass
0 → 100644
View file @
45afaf45
.tree
margin-top
:
10px
.file-dropped
background-color
:
#d8dfe5
.node-actions
padding-left
:
5px
.update-button
&
.enabled
cursor
:
pointer
&
.disabled
cursor
:
wait
src/Gargantext/Components/Forest/Tree/Node/Box.purs
View file @
45afaf45
...
@@ -3,16 +3,14 @@ module Gargantext.Components.Forest.Tree.Node.Box where
...
@@ -3,16 +3,14 @@ module Gargantext.Components.Forest.Tree.Node.Box where
import Gargantext.Prelude
import Gargantext.Prelude
import Data.Maybe (Maybe(..))
import Data.Maybe (Maybe(..))
import Data.Nullable (null
, toMaybe
)
import Data.Nullable (null)
import Data.Tuple (
Tuple(..), fst, snd
)
import Data.Tuple (
fst, Tuple(..)
)
import Data.Tuple.Nested ((/\))
import Data.Tuple.Nested ((/\))
import DOM.Simple as DOM
import DOM.Simple as DOM
import DOM.Simple.Console (log2)
import Effect (Effect)
import Effect (Effect)
import Effect.Aff (Aff, launchAff)
import Effect.Aff (Aff, launchAff
, launchAff_
)
import Effect.Class (liftEffect)
import Effect.Class (liftEffect)
import Effect.Uncurried (mkEffectFn1)
import Effect.Uncurried (mkEffectFn1)
import FFI.Simple ((..))
import React.SyntheticEvent as E
import React.SyntheticEvent as E
import Reactix as R
import Reactix as R
import Reactix.DOM.HTML as H
import Reactix.DOM.HTML as H
...
@@ -27,9 +25,11 @@ import Gargantext.Components.Forest.Tree.Node.Action.Add (NodePopup(..), createN
...
@@ -27,9 +25,11 @@ import Gargantext.Components.Forest.Tree.Node.Action.Add (NodePopup(..), createN
import Gargantext.Components.Forest.Tree.Node.Action.Rename (renameBox)
import Gargantext.Components.Forest.Tree.Node.Action.Rename (renameBox)
import Gargantext.Components.Forest.Tree.Node.Action.Upload (uploadFileView, fileTypeView, uploadTermListView, copyFromCorpusView)
import Gargantext.Components.Forest.Tree.Node.Action.Upload (uploadFileView, fileTypeView, uploadTermListView, copyFromCorpusView)
import Gargantext.Components.Forest.Tree.Node.ProgressBar (asyncProgressBar)
import Gargantext.Components.Forest.Tree.Node.ProgressBar (asyncProgressBar)
import Gargantext.Components.GraphExplorer.API as GEAPI
import Gargantext.Components.Search.SearchBar (searchBar)
import Gargantext.Components.Search.SearchBar (searchBar)
import Gargantext.Components.Search.SearchField (Search, defaultSearch, isIsTex)
import Gargantext.Components.Search.SearchField (Search, defaultSearch, isIsTex)
import Gargantext.Ends (Frontends, url)
import Gargantext.Ends (Frontends, url)
import Gargantext.Hooks.Loader (useLoader)
import Gargantext.Routes (AppRoute)
import Gargantext.Routes (AppRoute)
import Gargantext.Routes as Routes
import Gargantext.Routes as Routes
import Gargantext.Sessions (Session, sessionId)
import Gargantext.Sessions (Session, sessionId)
...
@@ -88,7 +88,8 @@ nodeMainSpan p@{ dispatch, folderOpen, frontends, session } = R.createElement el
...
@@ -88,7 +88,8 @@ nodeMainSpan p@{ dispatch, folderOpen, frontends, session } = R.createElement el
, H.a { href: (url frontends (GT.NodePath (sessionId session) nodeType (Just id)))
, H.a { href: (url frontends (GT.NodePath (sessionId session) nodeType (Just id)))
}
}
[ nodeText { isSelected: (mCorpusId mCurrentRoute) == (Just id)
[ nodeText { isSelected: (mCorpusId mCurrentRoute) == (Just id)
, name: name' props} ]
, name: name' props } ]
, nodeActions { id, nodeType, session }
, fileTypeView {dispatch, droppedFile, id, isDragOver, nodeType}
, fileTypeView {dispatch, droppedFile, id, isDragOver, nodeType}
, H.div {} (map (\t -> asyncProgressBar { asyncTask: t
, H.div {} (map (\t -> asyncProgressBar { asyncTask: t
, corpusId: id
, corpusId: id
...
@@ -166,19 +167,106 @@ fldr nt open = if open
...
@@ -166,19 +167,106 @@ fldr nt open = if open
-- START node text
-- START node text
type NodeTextProps =
type NodeTextProps =
( isSelected :: Boolean
( isSelected :: Boolean
, name :: Name
, name :: Name
)
)
nodeText :: Record NodeTextProps -> R.Element
nodeText :: Record NodeTextProps -> R.Element
nodeText p = R.createElement el p []
nodeText p = R.createElement nodeTextCpt p []
nodeTextCpt :: R.Component NodeTextProps
nodeTextCpt = R.hooksComponent "G.C.F.T.N.B.nodeText" cpt
where
where
el = R.hooksComponent "NodeText" cpt
cpt { isSelected: true, name } _ = do
cpt {isSelected: true, name} _ = do
pure $ H.u {} [
pure $ H.u {} [H.b {} [H.text ("| " <> name <> " | ")]]
H.b {} [
H.text ("| " <> name <> " | ")
]
]
cpt {isSelected: false, name} _ = do
cpt {isSelected: false, name} _ = do
pure $ H.text (name <> " ")
pure $ H.text (name <> " ")
-- END node text
-- END node text
-- START nodeActions
type NodeActionsProps =
(
id :: ID
, nodeType :: GT.NodeType
, session :: Session
)
nodeActions :: Record NodeActionsProps -> R.Element
nodeActions p = R.createElement nodeActionsCpt p []
nodeActionsCpt :: R.Component NodeActionsProps
nodeActionsCpt = R.hooksComponent "G.C.F.T.N.B.nodeActions" cpt
where
cpt { id, nodeType: GT.Graph, session } _ = do
refresh <- R.useState' 0
useLoader (id /\ fst refresh) (graphVersions session) $ \gv ->
nodeActionsGraph { id, graphVersions: gv, session, triggerRefresh: triggerRefresh refresh }
cpt _ _ = do
pure $ H.div {} []
graphVersions session (graphId /\ _) =
GEAPI.graphVersions { graphId, session }
triggerRefresh (_ /\ setRefresh) _ = setRefresh $ (+) 1
type NodeActionsGraphProps =
(
id :: ID
, graphVersions :: Record GEAPI.GraphVersions
, session :: Session
, triggerRefresh :: Unit -> Effect Unit
)
nodeActionsGraph :: Record NodeActionsGraphProps -> R.Element
nodeActionsGraph p = R.createElement nodeActionsGraphCpt p []
nodeActionsGraphCpt :: R.Component NodeActionsGraphProps
nodeActionsGraphCpt = R.hooksComponent "G.C.F.T.N.B.nodeActionsGraph" cpt
where
cpt { id, graphVersions, session, triggerRefresh } _ = do
pure $ H.div { className: "node-actions" } [
if graphVersions.gv_graph == Just graphVersions.gv_repo then
H.div {} []
else
graphUpdateButton { id, session, triggerRefresh }
]
type GraphUpdateButtonProps =
(
id :: ID
, session :: Session
, triggerRefresh :: Unit -> Effect Unit
)
graphUpdateButton :: Record GraphUpdateButtonProps -> R.Element
graphUpdateButton p = R.createElement graphUpdateButtonCpt p []
graphUpdateButtonCpt :: R.Component GraphUpdateButtonProps
graphUpdateButtonCpt = R.hooksComponent "G.C.F.T.N.B.graphUpdateButton" cpt
where
cpt { id, session, triggerRefresh } _ = do
enabled <- R.useState' true
pure $ H.div { className: "update-button " <> if (fst enabled) then "enabled" else "disabled text-muted" } [
H.span { className: "fa fa-refresh"
, on: { click: onClick enabled } } []
]
where
onClick (false /\ _) _ = pure unit
onClick (true /\ setEnabled) _ = do
launchAff_ $ do
liftEffect $ setEnabled $ const false
g <- GEAPI.updateGraphVersions { graphId: id, session }
liftEffect $ setEnabled $ const true
liftEffect $ triggerRefresh unit
pure unit
-- END nodeActions
mCorpusId :: Maybe AppRoute -> Maybe Int
mCorpusId :: Maybe AppRoute -> Maybe Int
mCorpusId (Just (Routes.Corpus _ id)) = Just id
mCorpusId (Just (Routes.Corpus _ id)) = Just id
mCorpusId (Just (Routes.CorpusDocument _ id _ _)) = Just id
mCorpusId (Just (Routes.CorpusDocument _ id _ _)) = Just id
...
...
src/Gargantext/Components/GraphExplorer/API.purs
View file @
45afaf45
...
@@ -2,6 +2,7 @@ module Gargantext.Components.GraphExplorer.API where
...
@@ -2,6 +2,7 @@ module Gargantext.Components.GraphExplorer.API where
import Gargantext.Prelude
import Gargantext.Prelude
import Data.Maybe (Maybe)
import Effect (Effect)
import Effect (Effect)
import Effect.Aff (Aff, launchAff_)
import Effect.Aff (Aff, launchAff_)
...
@@ -58,3 +59,27 @@ type QueryProgressParams =
...
@@ -58,3 +59,27 @@ type QueryProgressParams =
queryProgress :: Record QueryProgressParams -> Aff GT.AsyncProgress
queryProgress :: Record QueryProgressParams -> Aff GT.AsyncProgress
queryProgress { graphId, session, taskId } = do
queryProgress { graphId, session, taskId } = do
get session $ GR.GraphAPI graphId $ "async/" <> taskId <> "/poll"
get session $ GR.GraphAPI graphId $ "async/" <> taskId <> "/poll"
type GraphVersions =
(
gv_graph :: Maybe Int
, gv_repo :: Int
)
type GraphVersionsParams =
(
graphId :: Int
, session :: Session
)
graphVersions :: Record GraphVersionsParams -> Aff (Record GraphVersions)
graphVersions { graphId, session } = get session $ GR.GraphAPI graphId $ "versions"
type UpdateGraphVersionsParams =
(
graphId :: Int
, session :: Session
)
updateGraphVersions :: Record UpdateGraphVersionsParams -> Aff GET.GraphData
updateGraphVersions { graphId, session } = post session (GR.GraphAPI graphId $ "versions") {}
src/index.html
View file @
45afaf45
...
@@ -14,6 +14,7 @@
...
@@ -14,6 +14,7 @@
<link
rel=
"stylesheet"
type=
"text/css"
href=
"styles/highlightjs-solarized-light.css"
/>
<link
rel=
"stylesheet"
type=
"text/css"
href=
"styles/highlightjs-solarized-light.css"
/>
<link
href=
"styles/Graph.css"
rel=
"stylesheet"
type=
"text/css"
/>
<link
href=
"styles/Graph.css"
rel=
"stylesheet"
type=
"text/css"
/>
<link
href=
"styles/Login.css"
rel=
"stylesheet"
type=
"text/css"
/>
<link
href=
"styles/Login.css"
rel=
"stylesheet"
type=
"text/css"
/>
<link
href=
"styles/Tree.css"
rel=
"stylesheet"
type=
"text/css"
/>
<link
href=
"styles/CodeEditor.css"
rel=
"stylesheet"
type=
"text/css"
/>
<link
href=
"styles/CodeEditor.css"
rel=
"stylesheet"
type=
"text/css"
/>
<link
href=
"styles/range-slider.css"
rel=
"stylesheet"
type=
"text/css"
/>
<link
href=
"styles/range-slider.css"
rel=
"stylesheet"
type=
"text/css"
/>
<style>
<style>
...
...
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