Commit e755e9e3 authored by Alexandre Delanoë's avatar Alexandre Delanoë

[FOREST] Search fix.

parent fbd2a276
...@@ -76,7 +76,6 @@ searchFieldComponent = R.memo (R.hooksComponent "SearchField" cpt) eqProps ...@@ -76,7 +76,6 @@ searchFieldComponent = R.memo (R.hooksComponent "SearchField" cpt) eqProps
, if isExternal s.datafield , if isExternal s.datafield
then databaseInput search props.databases then databaseInput search props.databases
else div {} [] else div {} []
, H.text $ show s.datafield
, if isHAL s.datafield , if isHAL s.datafield
then orgInput search allOrgs then orgInput search allOrgs
else div {} [] else div {} []
...@@ -221,6 +220,29 @@ dataFieldNav ({datafield} /\ setSearch) datafields = ...@@ -221,6 +220,29 @@ dataFieldNav ({datafield} /\ setSearch) datafields =
------------------------------------------------------------------------ ------------------------------------------------------------------------
databaseNav :: R.State Search
-> Array Database
-> R.Element
databaseNav ({datafield} /\ setSearch) dbs =
R.fragment [ div {className: "text-primary center"} [text "with DataField"]
, div { className: "nav nav-tabs"} (liItem <$> dbs)
, div {className:"center"} [ text $ maybe "" doc db ]
]
where
db = case datafield of
(Just (External (Just x))) -> Just x
_ -> Nothing
liItem :: Database -> R.Element
liItem df' =
div { className : "nav-item nav-link" <> if (Just $ External $ Just df') == datafield then " active" else ""
, on: { click: \_ -> setSearch $ _ { datafield = Just $ External $ Just df' } }
} [ text (show df') ]
databaseInput :: R.State Search databaseInput :: R.State Search
-> Array Database -> Array Database
-> R.Element -> R.Element
......
...@@ -71,8 +71,8 @@ data DataField = Gargantext ...@@ -71,8 +71,8 @@ data DataField = Gargantext
| Files | Files
instance showDataField :: Show DataField where instance showDataField :: Show DataField where
show Gargantext = "Interne" show Gargantext = "Gargantext"
show (External x) = "Externe " <> show x show (External x) = "External" -- <> show x
show Web = "Web" show Web = "Web"
show Files = "Files" show Files = "Files"
...@@ -83,12 +83,15 @@ instance docDataField :: Doc DataField where ...@@ -83,12 +83,15 @@ instance docDataField :: Doc DataField where
doc Files = "Zip files with formats.." doc Files = "Zip files with formats.."
-- derive instance eqDataField :: Eq DataField derive instance eqDataField :: Eq DataField
{-
instance eqDataField :: Eq DataField where instance eqDataField :: Eq DataField where
eq Gargantext Gargantext = true eq Gargantext Gargantext = true
eq (External _) (External _) = true eq (External _) (External _) = true
eq Web Web = true eq Web Web = true
eq _ _ = false eq _ _ = false
-}
------------------------------------------------------------------------ ------------------------------------------------------------------------
-- | Database search specifications -- | Database search specifications
...@@ -141,7 +144,6 @@ readDatabase _ = Nothing ...@@ -141,7 +144,6 @@ readDatabase _ = Nothing
derive instance eqDatabase :: Eq Database derive instance eqDatabase :: Eq Database
instance encodeJsonDatabase :: EncodeJson Database where instance encodeJsonDatabase :: EncodeJson Database where
encodeJson a = encodeJson (show a) encodeJson a = encodeJson (show a)
------------------------------------------------------------------------ ------------------------------------------------------------------------
......
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