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
7c2a3b97
Verified
Commit
7c2a3b97
authored
Apr 25, 2024
by
Przemyslaw Kaminski
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev' into dev-spago-next
parents
57831848
4a302ff2
Changes
11
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
136 additions
and
23 deletions
+136
-23
Store.purs
src/Gargantext/Components/App/Store.purs
+7
-2
Breadcrumb.purs
src/Gargantext/Components/Forest/Breadcrumb.purs
+2
-0
Share.purs
src/Gargantext/Components/Forest/Tree/Node/Action/Share.purs
+32
-2
Box.purs
src/Gargantext/Components/Forest/Tree/Node/Box.purs
+1
-0
Settings.purs
src/Gargantext/Components/Forest/Tree/Node/Settings.purs
+14
-0
Login.purs
src/Gargantext/Components/Login.purs
+10
-6
LoginForm.purs
src/Gargantext/Components/Login/LoginForm.purs
+21
-6
Router.purs
src/Gargantext/Components/Router.purs
+43
-7
Ends.purs
src/Gargantext/Ends.purs
+1
-0
Router.purs
src/Gargantext/Router.purs
+1
-0
Routes.purs
src/Gargantext/Routes.purs
+4
-0
No files found.
src/Gargantext/Components/App/Store.purs
View file @
7c2a3b97
...
...
@@ -10,22 +10,24 @@ module Gargantext.Components.App.Store
) where
import Gargantext.Prelude
import Data.Map (Map)
import Data.Map as Map
import Data.Maybe (Maybe(..))
import Data.Set as Set
import Data.Tuple (Tuple)
import Gargantext.AsyncTasks as GAT
import Gargantext.Components.Lang as Lang
import Gargantext.Components.Nodes.Lists.SidePanel as ListsSP
import Gargantext.Components.Nodes.Texts.Types as TextsT
import Gargantext.Components.Themes as Themes
import Gargantext.Ends (Backend)
import Gargantext.Prelude
import Gargantext.Routes (AppRoute(Home), Tile)
import Gargantext.Sessions (Session, Sessions)
import Gargantext.Sessions as Sessions
import Gargantext.Sessions.Types (OpenNodes(..))
import Gargantext.Types (FrontendError, Handed(RightHanded), SidePanelState(..))
import Gargantext.Types (FrontendError, Handed(RightHanded),
ID,
SidePanelState(..))
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Stores as Stores
import Gargantext.Utils.Toestand as T2
...
...
@@ -45,6 +47,7 @@ type Store =
, graphVersion :: T2.ReloadS
, handed :: T.Box Handed
, lang :: T.Box Lang.LandingLang
, loginRedirect :: T.Box (Maybe (Tuple String ID))
, pinnedTreeId :: T.Box (Map String Int)
, reloadForest :: T2.ReloadS
, reloadMainPage :: T2.ReloadS
...
...
@@ -73,6 +76,7 @@ type State =
, graphVersion :: T2.Reload
, handed :: Handed
, lang :: Lang.LandingLang
, loginRedirect :: Maybe (Tuple String ID)
, pinnedTreeId :: Map String Int
, reloadForest :: T2.Reload
, reloadMainPage :: T2.Reload
...
...
@@ -102,6 +106,7 @@ options =
, graphVersion : T2.newReload
, handed : RightHanded
, lang : Lang.LL_EN
, loginRedirect : Nothing
, pinnedTreeId : Map.empty
, reloadForest : T2.newReload
, reloadMainPage : T2.newReload
...
...
src/Gargantext/Components/Forest/Breadcrumb.purs
View file @
7c2a3b97
...
...
@@ -394,3 +394,5 @@ loadBreadcrumbData { route: Home } = do
pure $ Right { parents: [] }
loadBreadcrumbData { route: Login } = do
pure $ Right { parents: [] }
loadBreadcrumbData { route: Share _t _i} = do
pure $ Right { parents: []}
src/Gargantext/Components/Forest/Tree/Node/Action/Share.purs
View file @
7c2a3b97
...
...
@@ -20,7 +20,7 @@ import Gargantext.Hooks.Loader (useLoader)
import Gargantext.Prelude
import Gargantext.Routes as GR
import Gargantext.Sessions (Session, get, post)
import Gargantext.Types (ID)
import Gargantext.Types (ID
, NodeID, NodeType
)
import Gargantext.Types as GT
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.SimpleJSON as GUSJ
...
...
@@ -145,6 +145,36 @@ publishNodeCpt = here.component "publishNode" cpt
, session
, subTreeParams
} []
-- footer
, button ]
------------------------------------------------------------------------
type ShareURL =
( nodeType :: NodeType
, id :: ID
, session :: Session)
shareURL :: R2.Component ShareURL
shareURL = R.createElement shareURLcpt
shareURLcpt :: R.Component ShareURL
shareURLcpt = R2.hereComponent here "shareURL" hCpt
where
hCpt hp {nodeType, id, session} _ = do
useLoader { errorHandler: Just errorHandler
, herePrefix: hp
, loader: loadUrl
, path: {nodeType, id, session}
, render: \url -> shareURLInner {url} [] }
errorHandler err = here.warn2 "[ShareURL] RESTError" err
shareURLInner :: R2.Component ( url :: String )
shareURLInner = R.createElement shareURLInnercpt
shareURLInnercpt :: R.Component ( url :: String )
shareURLInnercpt = here.component "shareURLInner" cpt
where
cpt { url } _ = do
pure $ Tools.panel { mError: Nothing } [ H.div {} [ H.text url ] ]
loadUrl :: { session :: Session, id :: NodeID, nodeType :: NodeType } -> AffRESTError String
loadUrl { session, id, nodeType } = get session $ GR.ShareURL id nodeType
src/Gargantext/Components/Forest/Tree/Node/Box.purs
View file @
7c2a3b97
...
...
@@ -363,6 +363,7 @@ panelActionCpt = here.component "panelAction" cpt
cpt { action: SearchBox, dispatch, id, session } _ =
pure $ actionSearch { dispatch, id: Just id, session } []
cpt { action : Share, id, session } _ = pure $ Share.shareNode { id, session } []
cpt { action: ShareURL, id, nodeType, session } _ = pure $ Share.shareURL { nodeType, id, session } []
cpt { action: Upload, dispatch, id, nodeType, session} _ =
pure $ actionUpload { dispatch, id, nodeType, session } []
cpt { action: WriteNodesDocuments, dispatch, id, session } _ =
...
...
src/Gargantext/Components/Forest/Tree/Node/Settings.purs
View file @
7c2a3b97
...
...
@@ -29,6 +29,7 @@ data NodeAction = Add (Array NodeType)
| ReloadWithSettings
| Reconstruct
| SearchBox
| ShareURL
| Share
| Upload
| WriteNodesDocuments -- https://gitlab.iscpif.fr/gargantext/purescript-gargantext/issues/331
...
...
@@ -51,6 +52,7 @@ instance Eq NodeAction where
eq Refresh Refresh = true
eq ReloadWithSettings ReloadWithSettings = true
eq SearchBox SearchBox = true
eq ShareURL ShareURL = true
eq Share Share = true
eq Upload Upload = true
eq WriteNodesDocuments WriteNodesDocuments = true
...
...
@@ -73,6 +75,7 @@ instance Show NodeAction where
show Refresh = "Refresh"
show ReloadWithSettings = "Reload (with settings)"
show SearchBox = "SearchBox"
show ShareURL = "Share URL"
show Share = "Share"
show Upload = "Upload"
show WriteNodesDocuments = "WriteNodesDocuments"
...
...
@@ -94,6 +97,7 @@ glyphiconNodeAction Reconstruct = "cogs"
glyphiconNodeAction Refresh = "refresh"
glyphiconNodeAction ReloadWithSettings = "reload-with-settings"
glyphiconNodeAction SearchBox = "search"
glyphiconNodeAction ShareURL = "share-alt"
glyphiconNodeAction Share = "user-plus"
glyphiconNodeAction Upload = "upload"
glyphiconNodeAction WriteNodesDocuments = "bars"
...
...
@@ -160,6 +164,7 @@ settingsBoxLens Corpus =
, Move moveParameters
, Upload
, SearchBox
, ShareURL
, WriteNodesDocuments
-- , Download
, Link (linkParams Annuaire)
...
...
@@ -180,6 +185,7 @@ settingsBoxLens Folder =
-- , NodeFrameNotebook
]
, Move moveParameters
, ShareURL
, Delete
]
settingsBoxLens FolderPrivate =
...
...
@@ -203,6 +209,7 @@ settingsBoxLens Graph =
, Config
, Download -- TODO as GEXF or JSON
-- , Publish publishParams
, ShareURL
, Delete
]
settingsBoxLens NodeFile =
...
...
@@ -214,6 +221,7 @@ settingsBoxLens NodeFrameNotebook =
-- , NodeFrameNotebook
]
, Move moveFrameParameters
, ShareURL
, Delete
]
settingsBoxLens NodeFrameVisio =
...
...
@@ -221,6 +229,7 @@ settingsBoxLens NodeFrameVisio =
, Notes
, Calc
]
, ShareURL
, Delete
]
settingsBoxLens NodeList =
...
...
@@ -228,6 +237,7 @@ settingsBoxLens NodeList =
, Config
, Upload
, Download
, ShareURL
, Merge {subTreeParams : SubTreeParams { showtypes: [ FolderPrivate
, FolderShared
, Team
...
...
@@ -259,6 +269,7 @@ settingsBoxLens NodeTexts =
_buttons .~ [ ReloadWithSettings
-- , Upload
, Download
, ShareURL
-- , Delete
]
settingsBoxLens NodeUser =
...
...
@@ -272,10 +283,12 @@ settingsBoxLens Notes =
, Corpus
]
, Move moveFrameParameters
, ShareURL
, Delete
]
settingsBoxLens Phylo =
_buttons .~ [ Reconstruct
, ShareURL
, Delete
]
settingsBoxLens Team =
...
...
@@ -290,6 +303,7 @@ settingsBoxLens Team =
, NodeFrameVisio
]
, Share
, ShareURL
, ManageTeam
, Delete
]
...
...
src/Gargantext/Components/Login.purs
View file @
7c2a3b97
...
...
@@ -21,20 +21,22 @@ import Data.Array (head)
import Data.Foldable (intercalate)
import Data.Maybe (Maybe(..), fromMaybe)
import Data.String as DST
import Data.Tuple (Tuple)
import Data.Tuple.Nested ((/\))
import Effect (Effect)
import Effect.Aff (Milliseconds(..), delay, launchAff_)
import Effect.Class (liftEffect)
import Gargantext.Components.Bootstrap as B
import Gargantext.Components.Bootstrap.Types (ComponentStatus(..), Elevation(..), ModalSizing(..), Position(..), TooltipPosition(..), Variant(..))
import Gargantext.Components.Login.PasswordForm as PasswordForm
import Gargantext.Components.Login.LoginForm as LoginForm
import Gargantext.Components.Login.PasswordForm as PasswordForm
import Gargantext.Components.Login.Types (FormType(..))
import Gargantext.Components.NgramsTable.Loader as NTL
import Gargantext.Ends (Backend(..))
import Gargantext.Hooks.Loader as GHL
import Gargantext.Sessions (Session(..), Sessions, Action(Logout), unSessions)
import Gargantext.Sessions as Sessions
import Gargantext.Types (ID)
import Gargantext.Utils ((?))
import Gargantext.Utils.Reactix as R2
import Reactix as R
...
...
@@ -55,6 +57,7 @@ type Props =
, backends :: Array Backend
, sessions :: T.Box Sessions
, visible :: T.Box Boolean
, loginRedirect :: T.Box (Maybe (Tuple String ID))
)
login :: R2.Leaf Props
...
...
@@ -82,7 +85,7 @@ loginContainer :: R2.Leaf Props
loginContainer = R2.leaf loginContainerCpt
loginContainerCpt :: R.Component Props
loginContainerCpt = here.component "container" cpt where
cpt props@{ sessions, visible } _ = do
cpt props@{ sessions, visible
, loginRedirect
} _ = do
-- | States
-- |
mBackend <- R2.useLive' props.backend
...
...
@@ -109,6 +112,7 @@ loginContainerCpt = here.component "container" cpt where
, formType
, sessions
, visible
, loginRedirect
}
ForgotPassword ->
PasswordForm.component
...
...
src/Gargantext/Components/Login/LoginForm.purs
View file @
7c2a3b97
...
...
@@ -6,8 +6,9 @@ import Gargantext.Prelude
import Data.Either (Either(..))
import Data.Foldable (foldl, intercalate)
import Data.Maybe (Maybe(..))
import Data.Maybe (Maybe(..)
, fromMaybe
)
import Data.String as String
import Data.Tuple (Tuple)
import Data.Tuple.Nested ((/\))
import Effect (Effect)
import Effect.Aff (Aff, launchAff_)
...
...
@@ -18,9 +19,12 @@ import Gargantext.Components.Login.Types (AuthRequest(..), FormType(..))
import Gargantext.Ends (Backend)
import Gargantext.Hooks.FormValidation (VForm, useFormValidation)
import Gargantext.Hooks.FormValidation.Unboxed as FV
import Gargantext.Hooks.LinkHandler (useLinkHandler)
import Gargantext.Hooks.StateRecord (useStateRecord)
import Gargantext.Sessions (Session, Sessions, postAuthRequest)
import Gargantext.Routes as GR
import Gargantext.Sessions (Session, Sessions, postAuthRequest, sessionId)
import Gargantext.Sessions as Sessions
import Gargantext.Types (ID, NodeType(..))
import Gargantext.Utils ((?))
import Gargantext.Utils.Reactix as R2
import Reactix as R
...
...
@@ -37,6 +41,7 @@ type Props =
, formType :: T.Box FormType
, sessions :: T.Box Sessions
, visible :: T.Box Boolean
, loginRedirect :: T.Box (Maybe (Tuple String ID))
)
component :: R2.Leaf Props
...
...
@@ -47,6 +52,7 @@ componentCpt = here.component "main" cpt where
, formType
, sessions
, visible
, loginRedirect
} _ = do
-- | States
-- |
...
...
@@ -56,6 +62,8 @@ componentCpt = here.component "main" cpt where
onPending' /\ onPending
<- R2.useBox' false
loginRedirect' <- R2.useLive' loginRedirect
-- | Hooks
-- |
{ state
...
...
@@ -65,6 +73,8 @@ componentCpt = here.component "main" cpt where
fv <- useFormValidation
{ goToRoute } <- useLinkHandler
-- | Behaviors
-- |
let
...
...
@@ -96,6 +106,11 @@ componentCpt = here.component "main" cpt where
Right session_ -> liftEffect
$ Sessions.change (Sessions.Login session_) sessions
*> T.write_ false visible
*> case loginRedirect' of
Just (nodeType /\ nodeId) -> do
T.write_ Nothing loginRedirect
goToRoute $ fromMaybe GR.Login $ GR.nodeTypeAppRoute (fromMaybe Node $ read nodeType) (sessionId session_) nodeId
Nothing -> pure unit
T.write_ false onPending
...
...
src/Gargantext/Components/Router.purs
View file @
7c2a3b97
module Gargantext.Components.Router (router) where
module Gargantext.Components.Router
( router
, shareCpt
)
where
import Gargantext.Prelude
import DOM.Simple as DOM
import Data.Array (filter, length)
import Data.Array (filter,
head,
length)
import Data.Array as A
import Data.Foldable (intercalate)
import Data.Map as M
import Data.Maybe (Maybe(..), fromMaybe, maybe)
import Data.Tuple (Tuple(..))
import Data.UUID (UUID)
import Data.UUID as UUID
import Effect (Effect)
...
...
@@ -16,7 +21,6 @@ import Gargantext.Components.ErrorsView as ErrorsView
import Gargantext.Components.Forest (forestLayout)
import Gargantext.Components.Forest.Breadcrumb as Breadcrumb
import Gargantext.Components.ForgotPassword (forgotPasswordLayout)
-- import Gargantext.Components.GraphQL.Node (Node)
import Gargantext.Components.Login (login)
import Gargantext.Components.Nodes.Annuaire (annuaireLayout)
import Gargantext.Components.Nodes.Annuaire.User (userLayout)
...
...
@@ -38,13 +42,14 @@ import Gargantext.Components.TreeSearch (treeSearch)
import Gargantext.Config (defaultFrontends, defaultBackends)
import Gargantext.Context.Session as SessionContext
import Gargantext.Ends (Backend)
import Gargantext.Hooks.LinkHandler (useLinkHandler)
import Gargantext.Hooks.Resize (ResizeType(..), useResizeHandler)
import Gargantext.Hooks.Session (useSession)
import Gargantext.Routes (AppRoute, Tile)
import Gargantext.Routes (AppRoute
(..)
, Tile)
import Gargantext.Routes as GR
import Gargantext.Sessions (Session, sessionId)
import Gargantext.Sessions (Session, sessionId
, unSessions
)
import Gargantext.Sessions as Sessions
import Gargantext.Types (CorpusId, Handed(..), ListId, NodeID, NodeType(..), SessionId, SidePanelState(..))
import Gargantext.Types (CorpusId, Handed(..), ListId, NodeID, NodeType(..), SessionId, SidePanelState(..)
, ID
)
import Gargantext.Utils ((?))
import Gargantext.Utils.Reactix (getElementById)
import Gargantext.Utils.Reactix as R2
...
...
@@ -357,6 +362,7 @@ renderRouteCpt = R.memo' $ here.component "renderRoute" cpt where
GR.NodeTexts s n -> texts (sessionNodeProps s n) []
GR.UserPage s n -> user (sessionNodeProps s n) []
GR.ForgotPassword p -> forgotPassword {boxes, params: p} []
GR.Share t n -> share {boxes, nodeType: t, nodeId: n} []
]
--------------------------------------------------------------
...
...
@@ -613,12 +619,13 @@ listsCpt = here.component "lists" cpt where
--------------------------------------------------------------
login' :: Boxes -> R.Element
login' { backend, sessions, showLogin: visible } =
login' { backend, sessions, showLogin: visible
, loginRedirect
} =
login
{ backend
, backends: A.fromFoldable defaultBackends
, sessions
, visible
, loginRedirect
}
--------------------------------------------------------------
...
...
@@ -764,3 +771,32 @@ forgotPasswordCpt = here.component "forgotPassword" cpt where
let uuid = fromMaybe "" $ M.lookup "uuid" params
pure $ forgotPasswordLayout { server, uuid } []
--------------------------------------------------------------
type ShareProps = (nodeType :: String, nodeId :: ID | Props)
share :: R2.Component ShareProps
share = R.createElement shareCpt
shareCpt :: R.Component ShareProps
shareCpt = here.component "share" cpt where
cpt { nodeType, nodeId, boxes} _ = do
{ goToRoute } <- useLinkHandler
sessions' <- T.useLive T.unequal boxes.sessions
case unSessions sessions' of
[] -> do
R.useEffect' $ T.write_ true boxes.showLogin
R.useEffect' $ T.write_ (Just (Tuple nodeType nodeId)) boxes.loginRedirect
R.useEffect' $ goToRoute Login
pure $ H.text "no session"
s -> case head s of
Just s' -> do
R.useEffect' $ goToRoute $ fromMaybe Login $ GR.nodeTypeAppRoute (fromMaybe Node $ read nodeType) (sessionId s') nodeId
pure $ H.text $ "session route: " <> (show $ fromMaybe Login $ GR.nodeTypeAppRoute (fromMaybe Node $ read nodeType) (sessionId s') nodeId)
Nothing -> do
R.useEffect' $ T.write_ true boxes.showLogin
R.useEffect' $ T.write_ (Just (Tuple nodeType nodeId)) boxes.loginRedirect
R.useEffect' $ goToRoute Login
pure $ H.text "no session"
src/Gargantext/Ends.purs
View file @
7c2a3b97
...
...
@@ -217,6 +217,7 @@ sessionPath (R.ChartHash { chartType, listId, tabType } i) =
-- sessionPath (R.NodeAPI (NodeContact s a i) i) = sessionPath $ "annuaire/" <> show a <> "/contact/" <> show i
sessionPath (R.PhyloAPI nId) = "node/" <> show nId <> "/phylo"
sessionPath R.Members = "members"
sessionPath (R.ShareURL i t) = "shareurl?type=" <> show t <> "&id=" <> show i
------- misc routing stuff
...
...
src/Gargantext/Router.purs
View file @
7c2a3b97
...
...
@@ -39,6 +39,7 @@ router = oneOf
, RouteFrameCode <$> (route "code" *> sid) <*> int
, RouteFrameVisio <$> (route "visio" *> sid) <*> int
, RouteFile <$> (route "file" *> sid) <*> int
, Share <$> (route "share" *> str) <*> int
, Home <$ lit ""
]
where
...
...
src/Gargantext/Routes.purs
View file @
7c2a3b97
...
...
@@ -40,6 +40,7 @@ data AppRoute
| Team SessionId Int
| TreeFlat SessionId Int String
| UserPage SessionId Int
| Share String Int
derive instance Eq AppRoute
...
...
@@ -70,6 +71,7 @@ instance Show AppRoute where
show (RouteFrameCode s i) = "code" <> show i <> " (" <> show s <> ")"
show (RouteFrameVisio s i) = "visio" <> show i <> " (" <> show s <> ")"
show (RouteFile s i) = "file" <> show i <> " (" <> show s <> ")"
show (Share n i) = "share" <> show n <> show i
appPath :: AppRoute -> String
...
...
@@ -99,6 +101,7 @@ appPath (RouteFrameCalc s i) = "calc/" <> show s <> "/" <> show i
appPath (RouteFrameCode s i) = "code/" <> show s <> "/" <> show i
appPath (RouteFrameVisio s i) = "visio/" <> show s <> "/" <> show i
appPath (RouteFile s i) = "file/" <> show s <> "/" <> show i
appPath (Share n i) = "share/" <> show n <> "/" <> show i
nodeTypeAppRoute :: NodeType -> SessionId -> Int -> Maybe AppRoute
nodeTypeAppRoute GT.Annuaire s i = Just $ Annuaire s i
...
...
@@ -147,6 +150,7 @@ data SessionRoute
-- | AnnuaireContact AnnuaireId DocId
| PhyloAPI Id
| Members
| ShareURL Id NodeType
------------------------------------------------------
...
...
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