Commit 994d62b0 authored by Alexandre Delanoë's avatar Alexandre Delanoë

[PHYLO] Tree node url.

parent 9982eb4c
...@@ -528,7 +528,9 @@ toHtml d s@(NTree (LNode {id, name, nodeType}) ary) n = R.createElement el {} [] ...@@ -528,7 +528,9 @@ toHtml d s@(NTree (LNode {id, name, nodeType}) ary) n = R.createElement el {} []
mainSpan nodeState folderOpen droppedFile isDragOver = mainSpan nodeState folderOpen droppedFile isDragOver =
H.span (dropProps droppedFile isDragOver) H.span (dropProps droppedFile isDragOver)
[ folderIcon folderOpen [ folderIcon folderOpen
, H.a { href: (toUrl Front nodeType (Just id)) , H.a { href: if nodeType == Phylo then (toUrl Static nodeType (Just id))
else (toUrl Front nodeType (Just id))
, target : if nodeType == Phylo then "blank" else ""
, style: {"margin-left": "22px"} , style: {"margin-left": "22px"}
, onClick: mkEffectFn1 $ (\e -> d $ CurrentNode id) , onClick: mkEffectFn1 $ (\e -> d $ CurrentNode id)
} }
......
...@@ -31,7 +31,9 @@ endConfig = endConfig' V10 ...@@ -31,7 +31,9 @@ endConfig = endConfig' V10
endConfig' :: ApiVersion -> EndConfig endConfig' :: ApiVersion -> EndConfig
endConfig' v = { front : frontRelative endConfig' v = { front : frontRelative
, back : backLocal v } , back : backLocal v
, static : staticRelative
}
-- , back : backDemo v } -- , back : backDemo v }
------------------------------------------------------------------------ ------------------------------------------------------------------------
...@@ -40,6 +42,11 @@ frontRelative = { baseUrl: "" ...@@ -40,6 +42,11 @@ frontRelative = { baseUrl: ""
, prePath: "/#/" , prePath: "/#/"
} }
staticRelative :: Config
staticRelative = { baseUrl: ""
, prePath : "/"
}
frontCaddy :: Config frontCaddy :: Config
frontCaddy = { baseUrl: "http://localhost:2015" frontCaddy = { baseUrl: "http://localhost:2015"
, prePath: "/#/" , prePath: "/#/"
...@@ -85,6 +92,7 @@ backProd v = { baseUrl: "https://gargantext.org" ...@@ -85,6 +92,7 @@ backProd v = { baseUrl: "https://gargantext.org"
type EndConfig = { front :: Config type EndConfig = { front :: Config
, back :: Config , back :: Config
, static :: Config
} }
type Config = { baseUrl :: String type Config = { baseUrl :: String
...@@ -100,9 +108,10 @@ type Url = String ...@@ -100,9 +108,10 @@ type Url = String
doUrl :: UrlBase -> UrlPath -> UrlParam -> Url doUrl :: UrlBase -> UrlPath -> UrlParam -> Url
doUrl b p ps = b <> p <> ps doUrl b p ps = b <> p <> ps
endOf :: forall cfg. End -> { front :: cfg, back :: cfg } -> cfg endOf :: forall cfg. End -> { front :: cfg, back :: cfg, static :: cfg } -> cfg
endOf Back = _.back endOf Back = _.back
endOf Front = _.front endOf Front = _.front
endOf Static = _.static
endBaseUrl :: End -> EndConfig -> UrlBase endBaseUrl :: End -> EndConfig -> UrlBase
endBaseUrl end c = (endOf end c).baseUrl endBaseUrl end c = (endOf end c).baseUrl
...@@ -139,6 +148,7 @@ pathUrl c (Tab t o l s) i = ...@@ -139,6 +148,7 @@ pathUrl c (Tab t o l s) i =
pathUrl c (Children n o l s) i = pathUrl c (Children n o l s) i =
pathUrl c (NodeAPI Node) i <> pathUrl c (NodeAPI Node) i <>
"/" <> "children?type=" <> show n <> offsetUrl o <> limitUrl l <> orderUrl s "/" <> "children?type=" <> show n <> offsetUrl o <> limitUrl l <> orderUrl s
pathUrl c (NodeAPI Phylo) pId = "phyloscape?nodeId=" <> (show $ maybe 0 identity pId)
pathUrl c (GetNgrams pathUrl c (GetNgrams
{ tabType: t { tabType: t
, offset: o , offset: o
...@@ -164,7 +174,6 @@ pathUrl c (GetNgrams ...@@ -164,7 +174,6 @@ pathUrl c (GetNgrams
base = case t of base = case t of
TabCorpus _ -> pathUrl c (NodeAPI Node) i TabCorpus _ -> pathUrl c (NodeAPI Node) i
_ -> pathUrl c (NodeAPI Url_Document) i _ -> pathUrl c (NodeAPI Url_Document) i
pathUrl c (ListDocument lId) dId = pathUrl c (ListDocument lId) dId =
pathUrl c (NodeAPI NodeList) lId <> "/document/" <> (show $ maybe 0 identity dId) pathUrl c (NodeAPI NodeList) lId <> "/document/" <> (show $ maybe 0 identity dId)
...@@ -245,6 +254,8 @@ data NodeType = NodeUser ...@@ -245,6 +254,8 @@ data NodeType = NodeUser
| Tree | Tree
| NodeList | NodeList
derive instance eqNodeType :: Eq NodeType
instance showNodeType :: Show NodeType where instance showNodeType :: Show NodeType where
show NodeUser = "NodeUser" show NodeUser = "NodeUser"
show Annuaire = "Annuaire" show Annuaire = "Annuaire"
...@@ -363,7 +374,7 @@ instance showChartType :: Show ChartType ...@@ -363,7 +374,7 @@ instance showChartType :: Show ChartType
show ChartPie = "pie" show ChartPie = "pie"
show ChartTree = "tree" show ChartTree = "tree"
data End = Back | Front data End = Back | Front | Static
type Id = Int type Id = Int
type Limit = Int type Limit = Int
......
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