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
142
Issues
142
List
Board
Labels
Milestones
Merge Requests
4
Merge Requests
4
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
ef521e75
Commit
ef521e75
authored
Jun 29, 2020
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[FEAT] Framing : front + back
parent
1a198895
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
218 additions
and
36 deletions
+218
-36
App.purs
src/Gargantext/Components/App.purs
+19
-18
Merge.purs
src/Gargantext/Components/Forest/Tree/Node/Action/Merge.purs
+1
-1
Settings.purs
src/Gargantext/Components/Forest/Tree/Node/Settings.purs
+38
-3
Tools.purs
src/Gargantext/Components/Forest/Tree/Node/Tools.purs
+3
-2
Dashboard.purs
src/Gargantext/Components/Nodes/Corpus/Dashboard.purs
+2
-4
Types.purs
src/Gargantext/Components/Nodes/Dashboard/Types.purs
+4
-5
Frame.purs
src/Gargantext/Components/Nodes/Frame.purs
+119
-0
Router.purs
src/Gargantext/Router.purs
+6
-3
Routes.purs
src/Gargantext/Routes.purs
+9
-0
Types.purs
src/Gargantext/Types.purs
+17
-0
No files found.
src/Gargantext/Components/App.purs
View file @
ef521e75
...
...
@@ -20,6 +20,7 @@ import Gargantext.Components.Login (login)
import Gargantext.Components.Nodes.Annuaire (annuaireLayout)
import Gargantext.Components.Nodes.Annuaire.User.Contacts (annuaireUserLayout, userLayout)
import Gargantext.Components.Nodes.Corpus (corpusLayout)
import Gargantext.Components.Nodes.Frame (frameLayout)
import Gargantext.Components.Nodes.Corpus.Dashboard (dashboardLayout)
import Gargantext.Components.Nodes.Corpus.Document (documentLayout)
import Gargantext.Components.Nodes.Home (homeLayout)
...
...
@@ -72,20 +73,21 @@ appCpt = R.hooksComponent "G.C.App.app" cpt where
Home -> forested $ homeLayout LL_EN
Login -> login { sessions, backends, visible: showLogin }
--Folder sid _ -> withSession sid $ \_ -> forested (folder {})
Folder sid nodeId -> withSession sid $ \session -> forested $ corpusLayout { key: show nodeId, nodeId, session }
Folder sid nodeId
-> withSession sid $ \session -> forested $ corpusLayout { key: show nodeId, nodeId, session }
FolderPrivate sid nodeId -> withSession sid $ \session -> forested $ corpusLayout { key: show nodeId, nodeId, session }
FolderPublic sid nodeId -> withSession sid $ \session -> forested $ corpusLayout { key: show nodeId, nodeId, session }
FolderShared sid nodeId -> withSession sid $ \session -> forested $ corpusLayout { key: show nodeId, nodeId, session }
Team sid nodeId -> withSession sid $ \session -> forested $ corpusLayout { key: show nodeId, nodeId, session }
Corpus sid nodeId -> withSession sid $ \session -> forested $ corpusLayout { key: show nodeId, nodeId, session }
Texts sid nodeId -> withSession sid $ \session -> forested $ textsLayout { nodeId, session, frontends }
Lists sid nodeId -> withSession sid $ \session -> forested $ listsLayout { nodeId, session }
Dashboard sid nodeId -> withSession sid $ \session -> forested $ dashboardLayout { nodeId, session }
Annuaire sid nodeId -> withSession sid $ \session -> forested $ annuaireLayout { frontends, nodeId, session }
UserPage sid nodeId -> withSession sid $ \session -> forested $ userLayout { frontends, nodeId, session }
ContactPage sid aId nodeId -> withSession sid $ \session -> forested $ annuaireUserLayout { annuaireId: aId, frontends, nodeId, session }
CorpusDocument sid corpusId listId nodeId ->
withSession sid $ \session -> forested $ documentLayout { nodeId, listId, session, corpusId: Just corpusId }
FolderPublic sid nodeId -> withSession sid $ \session -> forested $ corpusLayout { key: show nodeId, nodeId, session }
FolderShared sid nodeId -> withSession sid $ \session -> forested $ corpusLayout { key: show nodeId, nodeId, session }
Team sid nodeId -> withSession sid $ \session -> forested $ corpusLayout { key: show nodeId, nodeId, session }
RouteFrameWrite sid nodeId -> withSession sid $ \session -> forested $ frameLayout { key: show nodeId, nodeId, session }
RouteFrameCalc sid nodeId -> withSession sid $ \session -> forested $ frameLayout { key: show nodeId, nodeId, session }
Corpus sid nodeId -> withSession sid $ \session -> forested $ corpusLayout { key: show nodeId, nodeId, session }
Texts sid nodeId -> withSession sid $ \session -> forested $ textsLayout { nodeId, session, frontends }
Lists sid nodeId -> withSession sid $ \session -> forested $ listsLayout { nodeId, session }
Dashboard sid nodeId -> withSession sid $ \session -> forested $ dashboardLayout { nodeId, session }
Annuaire sid nodeId -> withSession sid $ \session -> forested $ annuaireLayout { frontends, nodeId, session }
UserPage sid nodeId -> withSession sid $ \session -> forested $ userLayout { frontends, nodeId, session }
ContactPage sid aId nodeId -> withSession sid $ \session -> forested $ annuaireUserLayout { annuaireId: aId, frontends, nodeId, session }
CorpusDocument sid corpusId listId nodeId -> withSession sid $ \session -> forested $ documentLayout { nodeId, listId, session, corpusId: Just corpusId }
Document sid listId nodeId ->
withSession sid $
\session -> forested $ documentLayout { nodeId, listId, session, corpusId: Nothing }
...
...
@@ -102,12 +104,11 @@ appCpt = R.hooksComponent "G.C.App.app" cpt where
, treeReload }
type ForestLayoutProps =
(
child :: R.Element
( child :: R.Element
, frontends :: Frontends
, reload :: R.State Int
, route :: AppRoute
, sessions :: Sessions
, reload
:: R.State Int
, route
:: AppRoute
, sessions
:: Sessions
, showLogin :: R2.Setter Boolean
)
...
...
src/Gargantext/Components/Forest/Tree/Node/Action/Merge.purs
View file @
ef521e75
...
...
@@ -5,7 +5,7 @@ import Data.Maybe (Maybe(..))
import Data.Tuple.Nested ((/\))
import Effect.Aff (Aff)
import Gargantext.Components.Forest.Tree.Node.Action (Action(..))
import Gargantext.Components.Forest.Tree.Node.Tools (submitButton, panel, checkbox, checkboxes
, divider
)
import Gargantext.Components.Forest.Tree.Node.Tools (submitButton, panel, checkbox, checkboxes)
import Gargantext.Components.Forest.Tree.Node.Tools.SubTree (subTreeView, SubTreeParamsIn)
import Gargantext.Prelude
import Gargantext.Routes (SessionRoute(..))
...
...
src/Gargantext/Components/Forest/Tree/Node/Settings.purs
View file @
ef521e75
...
...
@@ -89,7 +89,9 @@ settingsBox NodeUser =
SettingsBox { show : true
, edit : false
, doc : Documentation NodeUser
, buttons : [ Delete ]
, buttons : [ Delete
-- , Add [FolderPublic]
]
}
settingsBox FolderPrivate =
...
...
@@ -99,6 +101,8 @@ settingsBox FolderPrivate =
, buttons : [ Add [ Corpus
, Folder
, Annuaire
, NodeFrameWrite
, NodeFrameCalc
]
]
}
...
...
@@ -110,9 +114,12 @@ settingsBox Team =
, buttons : [ Add [ Corpus
, Folder
, Annuaire
, NodeFrameWrite
, NodeFrameCalc
]
, Share
, Delete]
, Delete
]
}
settingsBox FolderShared =
...
...
@@ -131,7 +138,8 @@ settingsBox FolderPublic =
, buttons : [ Add [ Corpus
, Folder
]
]
-- , Delete
]
}
settingsBox Folder =
...
...
@@ -141,6 +149,8 @@ settingsBox Folder =
, buttons : [ Add [ Corpus
, Folder
, Annuaire
, NodeFrameWrite
, NodeFrameCalc
]
, Move moveParameters
, Delete
...
...
@@ -154,6 +164,8 @@ settingsBox Corpus =
, buttons : [ Add [ NodeList
, Graph
, Dashboard
, NodeFrameWrite
, NodeFrameCalc
]
, SearchBox
, Upload
...
...
@@ -229,6 +241,29 @@ settingsBox Annuaire =
]
}
settingsBox NodeFrameWrite =
SettingsBox { show : true
, edit : true
, doc : Documentation NodeFrameWrite
, buttons : [ Add [ NodeFrameWrite
, NodeFrameCalc
]
]
}
settingsBox NodeFrameCalc =
SettingsBox { show : true
, edit : true
, doc : Documentation NodeFrameCalc
, buttons : [ Add [ NodeFrameCalc
, NodeFrameWrite
]
]
}
settingsBox _ =
SettingsBox { show : false
, edit : false
...
...
src/Gargantext/Components/Forest/Tree/Node/Tools.purs
View file @
ef521e75
...
...
@@ -263,6 +263,7 @@ nodeTextCpt = R.hooksComponent "G.C.F.T.N.B.nodeText" cpt
------------------------------------------------------------------------
divider :: R.Element
divider = H.div {className:"divider"} []
src/Gargantext/Components/Nodes/Corpus/Dashboard.purs
View file @
ef521e75
...
...
@@ -53,8 +53,7 @@ dashboardLayoutCpt = R.hooksComponent "G.C.N.C.D.dashboardLayout" cpt
liftEffect $ setReload $ (+) 1
type LoadedProps =
(
charts :: Array P.PredefinedChart
( charts :: Array P.PredefinedChart
, corpusId :: NodeID
, defaultListId :: Int
, key :: String
...
...
@@ -91,8 +90,7 @@ dashboardLayoutLoadedCpt = R.hooksComponent "G.C.N.C.D.dashboardLayoutLoaded" cp
onRemove _ = onChange $ fromMaybe charts $ A.deleteAt idx charts
type PredefinedChartProps =
(
chart :: P.PredefinedChart
( chart :: P.PredefinedChart
, corpusId :: NodeID
, defaultListId :: Int
, onChange :: P.PredefinedChart -> Effect Unit
...
...
src/Gargantext/Components/Nodes/Dashboard/Types.purs
View file @
ef521e75
...
...
@@ -13,9 +13,8 @@ type Preferences = Maybe String
newtype Hyperdata =
Hyperdata
{
charts :: Array P.PredefinedChart
, preferences :: Preferences
{ charts :: Array P.PredefinedChart
, preferences :: Preferences
}
instance decodeHyperdata :: DecodeJson Hyperdata where
decodeJson json = do
...
...
@@ -52,8 +51,8 @@ saveDashboard {hyperdata, nodeId, session} = do
id_ <- (put session (NodeAPI Node (Just nodeId) "") hyperdata) :: Aff Int
pure unit
type DashboardData =
{
id :: Int
type DashboardData =
{
id :: Int
, hyperdata :: Hyperdata
, parentId :: Int
}
src/Gargantext/Components/Nodes/Frame.purs
0 → 100644
View file @
ef521e75
module Gargantext.Components.Nodes.Frame where
import Data.Maybe (Maybe(..))
import Data.Tuple (fst)
import Effect.Aff (Aff)
import Gargantext.Components.Node (NodePoly(..))
import Gargantext.Hooks.Loader (useLoader)
import Gargantext.Prelude
import Gargantext.Routes (SessionRoute(NodeAPI))
import Gargantext.Sessions (Session, get)
import Gargantext.Types (NodeType(..))
import Reactix as R
import Reactix.DOM.HTML as H
import Data.Argonaut as Argonaut
import Data.Generic.Rep (class Generic)
import Data.Generic.Rep.Show (genericShow)
--import Gargantext.Utils.Argonaut (genericSumDecodeJson, genericSumEncodeJson, genericEnumDecodeJson, genericEnumEncodeJson)
import Gargantext.Utils.Argonaut (genericSumEncodeJson)
import Data.Argonaut (decodeJson, (.:))
data Hyperdata =
Hyperdata { base :: String
, frame_id :: String
}
derive instance eqHyperdata :: Eq Hyperdata
derive instance genericHyperdata :: Generic Hyperdata _
instance showHyperdata :: Show Hyperdata where
show = genericShow
instance decodeJsonHyperdata :: Argonaut.DecodeJson Hyperdata where
-- TODO
-- decodeJson = genericSumDecodeJson
decodeJson json = do
obj <- decodeJson json
base <- obj .: "base"
frame_id <- obj .: "frame_id"
pure $ Hyperdata {base, frame_id}
instance encodeJsonHyperdata :: Argonaut.EncodeJson Hyperdata where
encodeJson = genericSumEncodeJson
type Props =
( nodeId :: Int
, session :: Session
)
type Reload = R.State Int
type KeyProps =
( key :: String
| Props
)
frameLayout :: Record KeyProps -> R.Element
frameLayout props = R.createElement frameLayoutCpt props []
frameLayoutCpt :: R.Component KeyProps
frameLayoutCpt = R.hooksComponent "G.C.N.C.writeLayout" cpt
where
cpt {nodeId, session} _ = do
reload <- R.useState' 0
useLoader {nodeId, reload: fst reload, session} loadframeWithReload $
\frame -> frameLayoutView {frame, nodeId, reload, session}
type ViewProps =
( frame :: NodePoly Hyperdata
, reload :: Reload
| Props
)
data FrameType = Calc | Write
type Base = String
type FrameId = String
hframe :: FrameType -> String
hframe ft = "https://" <> hframe' ft <> ".frame.gargantext.org/test"
where
hframe' Calc = "calc"
hframe' Write = "write"
hframeUrl :: Base -> FrameId -> String
hframeUrl base frame_id = base <> "/" <> frame_id <> "?both"
frameLayoutView :: Record ViewProps -> R.Element
frameLayoutView props = R.createElement frameLayoutViewCpt props []
frameLayoutViewCpt :: R.Component ViewProps
frameLayoutViewCpt = R.hooksComponent "G.C.N.C.frameLayoutView" cpt
where
cpt {frame: (NodePoly {hyperdata: Hyperdata {base, frame_id}}), nodeId, reload, session} _ = do
pure $ H.div { className : "istex-search" }
[ H.iframe { src: hframeUrl base frame_id
, width: "100%"
, height: "100%"
-- , ref: "https://write.frame.gargantext.org/test"
} []
]
type LoadProps =
( nodeId :: Int
, session :: Session
)
loadframe' :: Record LoadProps -> Aff (NodePoly Hyperdata)
loadframe' {nodeId, session} = get session $ NodeAPI Node (Just nodeId) ""
-- Just to make reloading effective
loadframeWithReload :: {reload :: Int | LoadProps} -> Aff (NodePoly Hyperdata)
loadframeWithReload {nodeId, session} = loadframe' {nodeId, session}
src/Gargantext/Router.purs
View file @
ef521e75
...
...
@@ -11,9 +11,9 @@ router :: Match AppRoute
router = oneOf
[ Login <$ route "login"
, Folder <$> (route "folder" *> sid) <*> int
, FolderPrivate <$> (route "folderPrivate" *> sid) <*> int
, FolderPublic <$> (route "folderPublic" *> sid) <*> int
, FolderShared <$> (route "folderShared" *> sid) <*> int
, FolderPrivate <$> (route "folderPrivate" *> sid) <*> int
, FolderPublic <$> (route "folderPublic" *> sid) <*> int
, FolderShared <$> (route "folderShared" *> sid) <*> int
, Team <$> (route "team" *> sid) <*> int
, CorpusDocument <$> (route "corpus" *> sid) <*> int
<*> (lit "list" *> int)
...
...
@@ -29,6 +29,9 @@ router = oneOf
<*> (lit "contact" *> int)
, Annuaire <$> (route "annuaire" *> sid) <*> int
, UserPage <$> (route "user" *> sid) <*> int
, RouteFrameWrite <$> (route "write" *> sid) <*> int
, RouteFrameCalc <$> (route "calc" *> sid) <*> int
, Home <$ lit ""
]
where
...
...
src/Gargantext/Routes.purs
View file @
ef521e75
...
...
@@ -23,6 +23,9 @@ data AppRoute
| Annuaire SessionId Int
| UserPage SessionId Int
| ContactPage SessionId Int Int
| RouteFrameWrite SessionId Int
| RouteFrameCalc SessionId Int
derive instance eqAppRoute :: Eq AppRoute
...
...
@@ -66,6 +69,9 @@ instance showAppRoute :: Show AppRoute where
show (Annuaire s i) = "Annuaire" <> show i <> " (" <> show s <> ")"
show (UserPage s i) = "User" <> show i <> " (" <> show s <> ")"
show (ContactPage s a i) = "Contact" <> show a <> "::" <> show i <> " (" <> show s <> ")"
show (RouteFrameWrite s i) = "write" <> show i <> " (" <> show s <> ")"
show (RouteFrameCalc s i) = "calc" <> show i <> " (" <> show s <> ")"
appPath :: AppRoute -> String
appPath Home = ""
...
...
@@ -85,3 +91,6 @@ appPath (Lists s i) = "lists/" <> show s <> "/" <> show i
appPath (Annuaire s i) = "annuaire/" <> show s <> "/" <> show i
appPath (UserPage s i) = "user/" <> show s <> "/" <> show i
appPath (ContactPage s a i) = "annuaire/" <> show s <> "/" <> show a <> "/contact/" <> show i
appPath (RouteFrameWrite s i) = "write/" <> show s <> "/" <> show i
appPath (RouteFrameCalc s i) = "calc/" <> show s <> "/" <> show i
src/Gargantext/Types.purs
View file @
ef521e75
...
...
@@ -151,6 +151,9 @@ data NodeType = NodeUser
| Tree
| NodeList
| Texts
-- TODO Optional Nodes
| NodeFrameWrite
| NodeFrameCalc
derive instance eqNodeType :: Eq NodeType
...
...
@@ -177,6 +180,9 @@ instance showNodeType :: Show NodeType where
show Team = "NodeTeam"
show NodeList = "NodeList"
show Texts = "NodeTexts"
show NodeFrameWrite = "NodeFrameWrite"
show NodeFrameCalc = "NodeFrameCalc"
instance readNodeType :: Read NodeType where
read "NodeUser" = Just NodeUser
...
...
@@ -199,6 +205,8 @@ instance readNodeType :: Read NodeType where
read "NodeList" = Just NodeList
read "NodeTexts" = Just Texts
read "Annuaire" = Just Annuaire
read "NodeFrameWrite" = Just NodeFrameWrite
read "NodeFrameCalc" = Just NodeFrameCalc
read _ = Nothing
...
...
@@ -237,6 +245,12 @@ fldr Annuaire false = "fa fa-address-card"
fldr NodeContact true = "fa fa-address-card-o"
fldr NodeContact false = "fa fa-address-card"
fldr NodeFrameWrite true = "fa fa-file-word-o"
fldr NodeFrameWrite false = "fa fa-file-word-o"
fldr NodeFrameCalc true = "fa fa-file-excel-o"
fldr NodeFrameCalc false = "fa fa-file-excel-o"
fldr _ false = "fa fa-folder-o"
fldr _ true = "fa fa-folder-open"
...
...
@@ -280,6 +294,9 @@ nodeTypePath Tree = "tree"
nodeTypePath NodeList = "lists"
nodeTypePath Texts = "texts"
nodeTypePath Team = "team"
nodeTypePath NodeFrameWrite = "write"
nodeTypePath NodeFrameCalc = "calc"
------------------------------------------------------------
type ListId = Int
...
...
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