Commit 53df92e1 authored by Alexandre Delanoë's avatar Alexandre Delanoë

[Tree/Node] before refactoring

parent ecb9ea36
...@@ -16,6 +16,9 @@ filterWithRights (show action if user can only) ...@@ -16,6 +16,9 @@ filterWithRights (show action if user can only)
-} -}
------------------------------------------------------------------------ ------------------------------------------------------------------------
------------------------------------------------------------------------ ------------------------------------------------------------------------
data Status a = IsBeta a | IsProd a
data NodeAction = Documentation NodeType data NodeAction = Documentation NodeType
| SearchBox | SearchBox
| Download | Upload | Refresh | Config | Download | Upload | Refresh | Config
...@@ -36,7 +39,7 @@ instance eqNodeAction :: Eq NodeAction where ...@@ -36,7 +39,7 @@ instance eqNodeAction :: Eq NodeAction where
eq Delete Delete = true eq Delete Delete = true
eq Share Share = true eq Share Share = true
eq (Link x) (Link y) = true && (x == y) eq (Link x) (Link y) = true && (x == y)
eq (Add x) (Add y) = true && (x == y) eq (Add x) (Add y) = true && (x == y)
eq CopyFromCorpus CopyFromCorpus = true eq CopyFromCorpus CopyFromCorpus = true
eq Config Config = true eq Config Config = true
eq _ _ = false eq _ _ = false
...@@ -71,7 +74,6 @@ glyphiconNodeAction Config = "wrench" ...@@ -71,7 +74,6 @@ glyphiconNodeAction Config = "wrench"
glyphiconNodeAction _ = "" glyphiconNodeAction _ = ""
------------------------------------------------------------------------
------------------------------------------------------------------------ ------------------------------------------------------------------------
data SettingsBox = data SettingsBox =
SettingsBox { show :: Boolean SettingsBox { show :: Boolean
...@@ -83,14 +85,14 @@ data SettingsBox = ...@@ -83,14 +85,14 @@ data SettingsBox =
settingsBox :: NodeType -> SettingsBox settingsBox :: NodeType -> SettingsBox
settingsBox NodeUser = SettingsBox { settingsBox NodeUser = SettingsBox {
show: true show : true
, edit : false , edit : false
, doc : Documentation NodeUser , doc : Documentation NodeUser
, buttons : [ Delete ] , buttons : [ Delete ]
} }
settingsBox FolderPrivate = SettingsBox { settingsBox FolderPrivate = SettingsBox {
show: true show : true
, edit : false , edit : false
, doc : Documentation FolderPrivate , doc : Documentation FolderPrivate
, buttons : [ Add [ Corpus , buttons : [ Add [ Corpus
...@@ -101,7 +103,7 @@ settingsBox FolderPrivate = SettingsBox { ...@@ -101,7 +103,7 @@ settingsBox FolderPrivate = SettingsBox {
} }
settingsBox Team = SettingsBox { settingsBox Team = SettingsBox {
show: true show : true
, edit : true , edit : true
, doc : Documentation Team , doc : Documentation Team
, buttons : [ Add [ Corpus , buttons : [ Add [ Corpus
...@@ -112,7 +114,7 @@ settingsBox Team = SettingsBox { ...@@ -112,7 +114,7 @@ settingsBox Team = SettingsBox {
} }
settingsBox FolderShared = SettingsBox { settingsBox FolderShared = SettingsBox {
show: true show : true
, edit : true , edit : true
, doc : Documentation FolderShared , doc : Documentation FolderShared
, buttons : [ Add [Team, FolderShared] , buttons : [ Add [Team, FolderShared]
...@@ -121,7 +123,7 @@ settingsBox FolderShared = SettingsBox { ...@@ -121,7 +123,7 @@ settingsBox FolderShared = SettingsBox {
} }
settingsBox FolderPublic = SettingsBox { settingsBox FolderPublic = SettingsBox {
show: true show : true
, edit : false , edit : false
, doc : Documentation FolderPublic , doc : Documentation FolderPublic
, buttons : [ Add [ Corpus , buttons : [ Add [ Corpus
...@@ -130,91 +132,91 @@ settingsBox FolderPublic = SettingsBox { ...@@ -130,91 +132,91 @@ settingsBox FolderPublic = SettingsBox {
] ]
} }
settingsBox Folder = SettingsBox { settingsBox Folder =
show: true SettingsBox { show : true
, edit : true , edit : true
, doc : Documentation Folder , doc : Documentation Folder
, buttons : [ Add [ Corpus , buttons : [ Add [ Corpus
, Folder , Folder
, Annuaire , Annuaire
] ]
, Delete , Delete
] ]
} }
settingsBox Corpus = SettingsBox { settingsBox Corpus =
show: true SettingsBox { show : true
, edit : true , edit : true
, doc : Documentation Corpus , doc : Documentation Corpus
, buttons : [ SearchBox , buttons : [ SearchBox
, Add [ NodeList , Add [ NodeList
, Graph , Graph
, Dashboard , Dashboard
] ]
, Upload , Upload
, Download , Download
--, Share --, Share
--, Move --, Move
--, Clone --, Clone
, Link Annuaire , Link Annuaire
, Delete , Delete
] ]
} }
settingsBox Texts = SettingsBox { settingsBox Texts =
show: true SettingsBox { show : true
, edit : false , edit : false
, doc : Documentation Texts , doc : Documentation Texts
, buttons : [ Refresh , buttons : [ Refresh
, Upload , Upload
, Download , Download
-- , Delete -- , Delete
] ]
} }
settingsBox Graph = SettingsBox { settingsBox Graph =
show: true SettingsBox { show : true
, edit : false , edit : false
, doc : Documentation Graph , doc : Documentation Graph
, buttons : [ Refresh , buttons : [ Refresh
, Config , Config
, Download -- TODO as GEXF or JSON , Download -- TODO as GEXF or JSON
, Delete , Delete
] ]
} }
settingsBox NodeList = SettingsBox { settingsBox NodeList =
show: true SettingsBox { show : true
, edit : false , edit : false
, doc : Documentation NodeList , doc : Documentation NodeList
, buttons : [ Refresh , buttons : [ Refresh
, Config , Config
, Upload , Download
, CopyFromCorpus , Upload
, Download , CopyFromCorpus
-- , Delete -- , Delete
] ]
} }
settingsBox Dashboard = SettingsBox { settingsBox Dashboard =
show: true SettingsBox { show : true
, edit : false , edit : false
, doc : Documentation Dashboard , doc : Documentation Dashboard
, buttons : [] , buttons : []
} }
settingsBox Annuaire = SettingsBox { settingsBox Annuaire =
show: true SettingsBox { show : true
, edit : false , edit : false
, doc : Documentation Annuaire , doc : Documentation Annuaire
, buttons : [ Upload , buttons : [ Upload
, Delete , Delete
] ]
} }
settingsBox _ = SettingsBox { settingsBox _ =
show: false SettingsBox { show : false
, edit : false , edit : false
, doc : Documentation NodeUser , doc : Documentation NodeUser
, buttons : [] , buttons : []
} }
...@@ -395,19 +395,21 @@ nodePopupCpt = R.hooksComponent "G.C.F.T.N.B.nodePopupView" cpt ...@@ -395,19 +395,21 @@ nodePopupCpt = R.hooksComponent "G.C.F.T.N.B.nodePopupView" cpt
where where
SettingsBox {edit, doc, buttons} = settingsBox nodeType SettingsBox {edit, doc, buttons} = settingsBox nodeType
mPanelAction :: R.State (Record NodePopupS) -> Record NodePopupProps -> R.State Search -> R.Element mPanelAction :: R.State (Record NodePopupS)
-> Record NodePopupProps
-> R.State Search
-> R.Element
mPanelAction ({action: Nothing} /\ _) _ _ = H.div {} [] mPanelAction ({action: Nothing} /\ _) _ _ = H.div {} []
mPanelAction ({action: Just action} /\ _) p search = mPanelAction ({action: Just action} /\ _) p search =
panelAction { panelAction { action
action , dispatch: p.dispatch
, dispatch: p.dispatch , id: p.id
, id: p.id , name: p.name
, name: p.name , nodePopup: Just NodePopup
, nodePopup: Just NodePopup , nodeType: p.nodeType
, nodeType: p.nodeType , search
, search , session: p.session
, session: p.session }
}
searchIsTexIframe {nodeType} search@(search' /\ _) = searchIsTexIframe {nodeType} search@(search' /\ _) =
if isIsTex search'.datafield then if isIsTex search'.datafield then
...@@ -514,7 +516,7 @@ panelActionCpt = R.hooksComponent "G.C.F.T.N.B.panelAction" cpt ...@@ -514,7 +516,7 @@ panelActionCpt = R.hooksComponent "G.C.F.T.N.B.panelAction" cpt
cpt {action: Documentation GT.FolderShared} _ = do cpt {action: Documentation GT.FolderShared} _ = do
pure $ fragmentPT "Soon, you will be able to build teams folders to share your work" pure $ fragmentPT "Soon, you will be able to build teams folders to share your work"
cpt {action: Documentation x, nodeType} _ = do cpt {action: Documentation x, nodeType} _ = do
pure $ fragmentPT $ "More information on" <> show nodeType pure $ fragmentPT $ "More information on " <> show nodeType
cpt {action: Link _} _ = do cpt {action: Link _} _ = do
pure $ fragmentPT "Soon, you will be able to link the corpus with your Annuaire (and reciprocally)." pure $ fragmentPT "Soon, you will be able to link the corpus with your Annuaire (and reciprocally)."
...@@ -549,8 +551,10 @@ panelActionCpt = R.hooksComponent "G.C.F.T.N.B.panelAction" cpt ...@@ -549,8 +551,10 @@ panelActionCpt = R.hooksComponent "G.C.F.T.N.B.panelAction" cpt
] ]
cpt {action: Add xs, dispatch, id, name, nodePopup: p, nodeType} _ = do cpt {action: Add xs, dispatch, id, name, nodePopup: p, nodeType} _ = do
pure $ createNodeView {dispatch, id, name, nodeType, nodeTypes: xs} pure $ createNodeView {dispatch, id, name, nodeType, nodeTypes: xs}
cpt {action: CopyFromCorpus, dispatch, id, nodeType, session} _ = do cpt {action: CopyFromCorpus, dispatch, id, nodeType, session} _ = do
pure $ copyFromCorpusView {dispatch, id, nodeType, session} pure $ copyFromCorpusView {dispatch, id, nodeType, session}
cpt _ _ = do cpt _ _ = do
pure $ H.div {} [] pure $ H.div {} []
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment