Commit cf37cb01 authored by Przemyslaw Kaminski's avatar Przemyslaw Kaminski

Imports cleanup, I'll hate myself for this

parent 69650032
...@@ -12,11 +12,7 @@ ...@@ -12,11 +12,7 @@
module Gargantext.Components.Annotation.AnnotatedField where module Gargantext.Components.Annotation.AnnotatedField where
import Prelude import Prelude
import Data.Lens ((^?), _Just) import Data.Maybe ( Maybe(..), maybe )
import Data.Lens.At (at)
import Data.Maybe ( Maybe(..), maybe, maybe' )
import Data.String.Regex as R
import Data.String as S
import Data.Tuple ( Tuple(..) ) import Data.Tuple ( Tuple(..) )
import Data.Tuple.Nested ( (/\) ) import Data.Tuple.Nested ( (/\) )
import DOM.Simple.Event as DE import DOM.Simple.Event as DE
...@@ -29,7 +25,7 @@ import Reactix.SyntheticEvent as E ...@@ -29,7 +25,7 @@ import Reactix.SyntheticEvent as E
import Gargantext.Config (CTabNgramType(..)) import Gargantext.Config (CTabNgramType(..))
import Gargantext.Types ( TermList ) import Gargantext.Types ( TermList )
import Gargantext.Components.Annotation.Utils ( termBootstrapClass ) import Gargantext.Components.Annotation.Utils ( termBootstrapClass )
import Gargantext.Components.NgramsTable.Core ( NgramsTerm, NgramsTable(..), _NgramsElement, _list, highlightNgrams, findNgramTermList ) import Gargantext.Components.NgramsTable.Core ( NgramsTerm, NgramsTable(..), highlightNgrams, findNgramTermList )
import Gargantext.Components.Annotation.Menu ( AnnotationMenu, annotationMenu, MenuType(..) ) import Gargantext.Components.Annotation.Menu ( AnnotationMenu, annotationMenu, MenuType(..) )
import Gargantext.Utils.Reactix as R2 import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Selection as Sel import Gargantext.Utils.Selection as Sel
......
...@@ -9,14 +9,12 @@ import Effect ( Effect ) ...@@ -9,14 +9,12 @@ import Effect ( Effect )
import Effect.Uncurried ( mkEffectFn1 ) import Effect.Uncurried ( mkEffectFn1 )
import Reactix as R import Reactix as R
import Reactix.DOM.HTML as HTML import Reactix.DOM.HTML as HTML
import Reactix.SyntheticEvent as E
import Gargantext.Types ( TermList(..), termListName ) import Gargantext.Types ( TermList(..), termListName )
import Gargantext.Components.Annotation.Utils ( termBootstrapClass ) import Gargantext.Components.Annotation.Utils ( termBootstrapClass )
import Gargantext.Components.ContextMenu.ContextMenu as CM import Gargantext.Components.ContextMenu.ContextMenu as CM
import Gargantext.Utils.Reactix as R2 import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Selection (Selection, selectionToString)
data MenuType = NewNgram | SetTermListItem data MenuType = NewNgram | SetTermListItem
......
...@@ -2,16 +2,14 @@ module Gargantext.Components.Charts.Options.ECharts where ...@@ -2,16 +2,14 @@ module Gargantext.Components.Charts.Options.ECharts where
import Prelude import Prelude
import Data.String (take)
import CSS (italic) import CSS (italic)
import CSS.Common (normal) import CSS.Common (normal)
import Data.Array (length)
import Gargantext.Components.Charts.Options.Color (transparent, violet, black) import Gargantext.Components.Charts.Options.Color (transparent, violet, black)
import Gargantext.Components.Charts.Options.Data (DataLegend, DataAxis, dataSerie) import Gargantext.Components.Charts.Options.Data (DataLegend, dataSerie)
import Gargantext.Components.Charts.Options.Font (IconOptions(..), Shape(..), TextStyle, chartFontStyle, chartFontWeight, icon, mkTooltip, Tooltip, ToolBox, mkToolBox) import Gargantext.Components.Charts.Options.Font (IconOptions(..), Shape(..), TextStyle, chartFontStyle, chartFontWeight, icon, mkTooltip, Tooltip, mkToolBox)
import Gargantext.Components.Charts.Options.Legend (legendType, LegendMode(..), PlainOrScroll(..), selectedMode, Orientation(..), orient) import Gargantext.Components.Charts.Options.Legend (legendType, LegendMode(..), PlainOrScroll(..), selectedMode, Orientation(..), orient)
import Gargantext.Components.Charts.Options.Position (Align(..), LeftRelativePosition(..), TopRelativePosition(..), numberPosition, percentPosition, relativePosition) import Gargantext.Components.Charts.Options.Position (Align(..), LeftRelativePosition(..), TopRelativePosition(..), numberPosition, percentPosition, relativePosition)
import Gargantext.Components.Charts.Options.Series (Series, SeriesName, Chart(..), seriesPieD1) import Gargantext.Components.Charts.Options.Series (Series, seriesPieD1)
import Gargantext.Components.Charts.Options.Type (DataZoom, Echarts, Legend, Option, Title, XAxis, YAxis, xAxis, yAxis) import Gargantext.Components.Charts.Options.Type (DataZoom, Echarts, Legend, Option, Title, XAxis, YAxis, xAxis, yAxis)
import React (unsafeCreateElementDynamic) import React (unsafeCreateElementDynamic)
import React as R import React as R
......
...@@ -13,7 +13,7 @@ module Gargantext.Components.Charts.Options.Legend ...@@ -13,7 +13,7 @@ module Gargantext.Components.Charts.Options.Legend
import Prelude (class Show, show, (<<<)) import Prelude (class Show, show, (<<<))
import Data.Generic.Rep import Data.Generic.Rep (class Generic)
import Data.Generic.Rep.Show import Data.Generic.Rep.Show
import Data.String (toLower) import Data.String (toLower)
import Unsafe.Coerce (unsafeCoerce) import Unsafe.Coerce (unsafeCoerce)
......
...@@ -3,7 +3,7 @@ module Gargantext.Components.Charts.Options.Type where ...@@ -3,7 +3,7 @@ module Gargantext.Components.Charts.Options.Type where
import Prelude import Prelude
import Gargantext.Components.Charts.Options.Color (Color) import Gargantext.Components.Charts.Options.Color (Color)
import Gargantext.Components.Charts.Options.Data (DataLegend, DataAxis) import Gargantext.Components.Charts.Options.Data (DataLegend)
import Gargantext.Components.Charts.Options.Font (TextStyle, Tooltip, ToolBox) import Gargantext.Components.Charts.Options.Font (TextStyle, Tooltip, ToolBox)
import Gargantext.Components.Charts.Options.Legend (LegendType, Orient, SelectedMode) import Gargantext.Components.Charts.Options.Legend (LegendType, Orient, SelectedMode)
import Gargantext.Components.Charts.Options.Position (LeftRelativePosition, Position, TopRelativePosition) import Gargantext.Components.Charts.Options.Position (LeftRelativePosition, Position, TopRelativePosition)
......
...@@ -5,24 +5,19 @@ module Gargantext.Components.ContextMenu.ContextMenu where ...@@ -5,24 +5,19 @@ module Gargantext.Components.ContextMenu.ContextMenu where
import Prelude hiding (div) import Prelude hiding (div)
import Data.Maybe ( Maybe(..) ) import Data.Maybe ( Maybe(..) )
import Data.Nullable ( Nullable, null, toMaybe ) import Data.Nullable ( Nullable, null, toMaybe )
import Data.Tuple ( Tuple(..) )
import Data.Tuple.Nested ( (/\) ) import Data.Tuple.Nested ( (/\) )
import Data.Traversable ( traverse_ ) import Data.Traversable ( traverse_ )
import DOM.Simple as DOM import DOM.Simple as DOM
import DOM.Simple.Console
import DOM.Simple.Event as DE import DOM.Simple.Event as DE
import DOM.Simple.EventListener ( Callback, callback ) import DOM.Simple.EventListener ( Callback, callback )
import DOM.Simple.Element as Element import DOM.Simple.Element as Element
import DOM.Simple.Window ( window ) import DOM.Simple.Window ( window )
import DOM.Simple.Document ( document ) import DOM.Simple.Document ( document )
import DOM.Simple.Document as Document
import DOM.Simple.Types ( DOMRect ) import DOM.Simple.Types ( DOMRect )
import Effect (Effect) import Effect (Effect)
import Effect.Uncurried ( mkEffectFn1 )
import FFI.Simple ( (...), (..), delay ) import FFI.Simple ( (...), (..), delay )
import Reactix as R import Reactix as R
import Reactix.DOM.HTML as HTML import Reactix.DOM.HTML as HTML
import Reactix.SyntheticEvent as E
import Gargantext.Utils.Reactix as R2 import Gargantext.Utils.Reactix as R2
......
...@@ -4,21 +4,6 @@ module Gargantext.Component.ContextMenu.SimpleItem where ...@@ -4,21 +4,6 @@ module Gargantext.Component.ContextMenu.SimpleItem where
-- (MenuProps, Action(..), separator) where -- (MenuProps, Action(..), separator) where
import Prelude hiding (div) import Prelude hiding (div)
import Effect (Effect)
import Data.String (joinWith)
import React
( class ReactComponentSpec
, ReactClass, ReactElement, ReactClassConstructor, Children
, component, createElement )
import React.DOM (a, div, li, ul')
import React.DOM as DOM -- for Props
import React.DOM.Props (className, onContextMenu, onMouseOut, onBlur)
import Thermite
( Render, PerformAction
, simpleSpec, modifyState_
, createReactSpec, defaultRender
, _render )
import Gargantext.Utils.React (WithChildren, wrap)
-- separator :: ReactElement -- separator :: ReactElement
-- separator = div [ className "context-menu-separator" ] [] -- separator = div [ className "context-menu-separator" ] []
......
...@@ -3,22 +3,15 @@ ...@@ -3,22 +3,15 @@
-- has not been ported to this module yet. -- has not been ported to this module yet.
module Gargantext.Components.FacetsTable where module Gargantext.Components.FacetsTable where
import Affjax (defaultRequest, request)
import Affjax.RequestBody (RequestBody(..))
import Affjax.ResponseFormat (printResponseFormatError)
import Affjax.ResponseFormat as ResponseFormat
import Control.Monad.Cont.Trans (lift) import Control.Monad.Cont.Trans (lift)
import Data.Argonaut (class DecodeJson, class EncodeJson, decodeJson, encodeJson, jsonEmptyObject, (.?), (:=), (~>)) import Data.Argonaut (class DecodeJson, class EncodeJson, decodeJson, encodeJson, jsonEmptyObject, (.?), (:=), (~>))
import Data.Array (drop, take, (:), filter, (!!)) import Data.Array (filter, (!!))
import Data.Either (Either(..))
import Data.Foldable (intercalate) import Data.Foldable (intercalate)
import Data.Generic.Rep (class Generic) import Data.Generic.Rep (class Generic)
import Data.Generic.Rep.Show (genericShow) import Data.Generic.Rep.Show (genericShow)
import Data.HTTP.Method (Method(..)) import Data.Maybe (Maybe(..))
import Data.Maybe (Maybe(..), maybe)
import Data.Set (Set) import Data.Set (Set)
import Data.Set as Set import Data.Set as Set
import Data.Tuple (Tuple(..))
import Effect (Effect) import Effect (Effect)
import Effect.Aff (Aff) import Effect.Aff (Aff)
import Effect.Class (liftEffect) import Effect.Class (liftEffect)
...@@ -26,16 +19,16 @@ import React as React ...@@ -26,16 +19,16 @@ import React as React
import React (ReactClass, ReactElement, Children) import React (ReactClass, ReactElement, Children)
------------------------------------------------------------------------ ------------------------------------------------------------------------
import Gargantext.Prelude import Gargantext.Prelude
import Gargantext.Config (End(..), NodeType(..), OrderBy(..), Path(..), TabType, toUrl, toLink) import Gargantext.Config (End(..), NodeType(..), OrderBy(..), Path(..), toUrl, toLink)
import Gargantext.Config.REST (put, post, deleteWithBody) import Gargantext.Config.REST (post, deleteWithBody)
import Gargantext.Components.Loader as Loader import Gargantext.Components.Loader as Loader
import Gargantext.Components.Search.Types (Category(..), CategoryQuery(..), favCategory, trashCategory, decodeCategory, putCategories) import Gargantext.Components.Search.Types (Category(..), CategoryQuery(..), favCategory, decodeCategory, putCategories)
import Gargantext.Components.Table as T import Gargantext.Components.Table as T
import Gargantext.Router as Router import Gargantext.Router as Router
import Gargantext.Utils (toggleSet) import Gargantext.Utils (toggleSet)
import Gargantext.Utils.DecodeMaybe ((.|)) import Gargantext.Utils.DecodeMaybe ((.|))
import React.DOM (a, br', button, div, i, input, p, text, span) import React.DOM (a, br', button, div, i, input, p, text, span)
import React.DOM.Props (_type, className, href, onClick, placeholder, style, checked, target) import React.DOM.Props (_type, className, href, onClick, style, checked, target)
import Thermite (PerformAction, Render, Spec, defaultPerformAction, modifyState_, simpleSpec, hideState) import Thermite (PerformAction, Render, Spec, defaultPerformAction, modifyState_, simpleSpec, hideState)
------------------------------------------------------------------------ ------------------------------------------------------------------------
......
...@@ -5,28 +5,11 @@ module Gargantext.Components.Graph ...@@ -5,28 +5,11 @@ module Gargantext.Components.Graph
-- ) -- )
where where
import Prelude import Prelude
import Control.Monad.Except.Trans import Data.Nullable (null)
import Data.Array as A
import Data.Bitraversable (bitraverse)
import Data.Either (Either(..), either)
import Data.Maybe (Maybe(..), maybe)
import Data.Nullable (Nullable, null)
import Data.Sequence as Seq
import Data.Sequence (Seq)
import Data.Traversable (for, for_, traverse, traverse_)
import DOM.Simple.Types (Element)
import DOM.Simple.Console (log, log2)
import Effect (Effect)
import FFI.Simple (delay)
import Reactix as R import Reactix as R
import Reactix.DOM.HTML as RH import Reactix.DOM.HTML as RH
import Gargantext.Utils.Reactix as R2
import Gargantext.Types (class Optional)
import Gargantext.Hooks.Sigmax import Gargantext.Hooks.Sigmax
import Gargantext.Hooks.Sigmax.Types as Sigmax import Gargantext.Hooks.Sigmax.Types as Sigmax
import Gargantext.Hooks.Sigmax.Sigma (SigmaOpts)
import Gargantext.Hooks.Sigmax.Sigma as Sigma
import Gargantext.Hooks.Sigmax.Sigmajs
type OnProps = () type OnProps = ()
......
...@@ -5,8 +5,7 @@ module Gargantext.Components.GraphExplorer.Legend ...@@ -5,8 +5,7 @@ module Gargantext.Components.GraphExplorer.Legend
import Prelude hiding (map) import Prelude hiding (map)
import Data.Sequence (Seq) import Data.Sequence (Seq)
import Data.Sequence as Seq import Data.Traversable (foldMap)
import Data.Traversable (foldMap, traverseDefault)
import Reactix as R import Reactix as R
import Reactix.DOM.HTML as RH import Reactix.DOM.HTML as RH
import Gargantext.Components.GraphExplorer.Types (Cluster(..), MetaData(..), Edge(..), GraphData(..), Legend(..), Node(..), getLegendData, intColor) import Gargantext.Components.GraphExplorer.Types (Cluster(..), MetaData(..), Edge(..), GraphData(..), Legend(..), Node(..), getLegendData, intColor)
......
...@@ -5,7 +5,6 @@ module Gargantext.Components.GraphExplorer.RangeControl ...@@ -5,7 +5,6 @@ module Gargantext.Components.GraphExplorer.RangeControl
, nodeSizeControl , nodeSizeControl
) where ) where
import Global (readFloat)
import Prelude import Prelude
import Data.Tuple.Nested ((/\)) import Data.Tuple.Nested ((/\))
import Reactix as R import Reactix as R
...@@ -13,7 +12,6 @@ import Reactix.DOM.HTML as H ...@@ -13,7 +12,6 @@ import Reactix.DOM.HTML as H
import Gargantext.Components.RangeSlider as RS import Gargantext.Components.RangeSlider as RS
import Gargantext.Utils.Range as Range import Gargantext.Utils.Range as Range
import Gargantext.Utils.Reactix as R2
type Props = ( type Props = (
caption :: String caption :: String
......
...@@ -4,16 +4,12 @@ import Prelude ...@@ -4,16 +4,12 @@ import Prelude
import Partial.Unsafe (unsafePartial) import Partial.Unsafe (unsafePartial)
import Data.Argonaut (class DecodeJson, decodeJson, (.?)) import Data.Argonaut (class DecodeJson, decodeJson, (.?))
import Data.Array (concat, fromFoldable, group, sort, take, (!!), length) import Data.Array ((!!), length)
import Data.Maybe (Maybe(..), maybe, fromJust) import Data.Maybe (Maybe(..), fromJust)
import Data.Newtype (class Newtype) import Data.Newtype (class Newtype)
import Data.Set (Set)
import Data.Set as Set
import Reactix as R import Reactix as R
import Thermite (PerformAction, Spec) import Thermite (PerformAction)
import Gargantext.Components.Login.Types (TreeId)
import Gargantext.Components.Graph as Graph
newtype Node = Node newtype Node = Node
{ id_ :: String { id_ :: String
......
...@@ -9,7 +9,6 @@ module Gargantext.Components.NgramsTable ...@@ -9,7 +9,6 @@ module Gargantext.Components.NgramsTable
) )
where where
import Control.Monad.Cont.Trans (lift)
import Data.Array as A import Data.Array as A
import Data.Lens (to, view, (%~), (.~), (^.), (^..)) import Data.Lens (to, view, (%~), (.~), (^.), (^..))
import Data.Lens.Common (_Just) import Data.Lens.Common (_Just)
...@@ -31,7 +30,6 @@ import React.DOM (a, button, div, h2, i, input, li, option, p, select, span, tab ...@@ -31,7 +30,6 @@ import React.DOM (a, button, div, h2, i, input, li, option, p, select, span, tab
import React.DOM.Props (_id, _type, checked, className, name, onChange, onClick, onInput, placeholder, style, value) import React.DOM.Props (_id, _type, checked, className, name, onChange, onClick, onInput, placeholder, style, value)
import React.DOM.Props as DOM import React.DOM.Props as DOM
import Thermite (PerformAction, Render, Spec, defaultPerformAction, modifyState_, simpleSpec, createClass) import Thermite (PerformAction, Render, Spec, defaultPerformAction, modifyState_, simpleSpec, createClass)
import Unsafe.Coerce (unsafeCoerce)
import Gargantext.Types (TermList(..), readTermList, readTermSize, termLists, termSizes) import Gargantext.Types (TermList(..), readTermList, readTermSize, termLists, termSizes)
import Gargantext.Config (OrderBy(..), TabType, CTabNgramType(..)) import Gargantext.Config (OrderBy(..), TabType, CTabNgramType(..))
......
...@@ -49,7 +49,7 @@ import Control.Monad.Cont.Trans (lift) ...@@ -49,7 +49,7 @@ import Control.Monad.Cont.Trans (lift)
import Data.Array (head) import Data.Array (head)
import Data.Array as A import Data.Array as A
import Data.Argonaut ( class DecodeJson, decodeJson, class EncodeJson, encodeJson import Data.Argonaut ( class DecodeJson, decodeJson, class EncodeJson, encodeJson
, jsonEmptyObject, (:=), (~>), (.?), (.??) ) , jsonEmptyObject, (:=), (~>), (.:), (.:!) )
import Data.Either (Either(..)) import Data.Either (Either(..))
import Data.Foldable (class Foldable, foldMap, foldl, foldr) import Data.Foldable (class Foldable, foldMap, foldl, foldr)
import Data.FoldableWithIndex (class FoldableWithIndex, foldMapWithIndex, foldlWithIndex, foldrWithIndex) import Data.FoldableWithIndex (class FoldableWithIndex, foldMapWithIndex, foldlWithIndex, foldrWithIndex)
...@@ -71,8 +71,8 @@ import Data.TraversableWithIndex (class TraversableWithIndex, traverseWithIndex) ...@@ -71,8 +71,8 @@ import Data.TraversableWithIndex (class TraversableWithIndex, traverseWithIndex)
import Data.Set (Set) import Data.Set (Set)
import Data.Set as Set import Data.Set as Set
import Data.String as S import Data.String as S
import Data.String.Regex as R import Data.String.Regex (Regex, regex, replace) as R
import Data.String.Regex.Flags as R import Data.String.Regex.Flags (global, multiline) as R
import Data.Symbol (SProxy(..)) import Data.Symbol (SProxy(..))
import Data.Tuple (Tuple(..)) import Data.Tuple (Tuple(..))
-- import Debug.Trace -- import Debug.Trace
...@@ -156,12 +156,12 @@ _NgramsElement = _Newtype ...@@ -156,12 +156,12 @@ _NgramsElement = _Newtype
instance decodeJsonNgramsElement :: DecodeJson NgramsElement where instance decodeJsonNgramsElement :: DecodeJson NgramsElement where
decodeJson json = do decodeJson json = do
obj <- decodeJson json obj <- decodeJson json
ngrams <- obj .? "ngrams" ngrams <- obj .: "ngrams"
list <- obj .? "list" list <- obj .: "list"
occurrences <- obj .? "occurrences" occurrences <- obj .: "occurrences"
parent <- obj .?? "parent" parent <- obj .:! "parent"
root <- obj .?? "root" root <- obj .:! "root"
children' <- obj .? "children" children' <- obj .: "children"
let children = Set.fromFoldable (children' :: Array NgramsTerm) let children = Set.fromFoldable (children' :: Array NgramsTerm)
pure $ NgramsElement {ngrams, list, occurrences, parent, root, children} pure $ NgramsElement {ngrams, list, occurrences, parent, root, children}
...@@ -182,8 +182,8 @@ instance encodeJsonVersioned :: EncodeJson a => EncodeJson (Versioned a) where ...@@ -182,8 +182,8 @@ instance encodeJsonVersioned :: EncodeJson a => EncodeJson (Versioned a) where
instance decodeJsonVersioned :: DecodeJson a => DecodeJson (Versioned a) where instance decodeJsonVersioned :: DecodeJson a => DecodeJson (Versioned a) where
decodeJson json = do decodeJson json = do
obj <- decodeJson json obj <- decodeJson json
version <- obj .? "version" version <- obj .: "version"
data_ <- obj .? "data" data_ <- obj .: "data"
pure $ Versioned {version, data: data_} pure $ Versioned {version, data: data_}
-- type NgramsTable = Array (NTree NgramsElement) -- type NgramsTable = Array (NTree NgramsElement)
...@@ -214,10 +214,12 @@ instance decodeJsonNgramsTable :: DecodeJson NgramsTable where ...@@ -214,10 +214,12 @@ instance decodeJsonNgramsTable :: DecodeJson NgramsTable where
wordBoundaryChars :: String wordBoundaryChars :: String
wordBoundaryChars = "[ .,;:!?'\\{}()]" wordBoundaryChars = "[ .,;:!?'\\{}()]"
wordBoundaryReg :: R.Regex
wordBoundaryReg = case R.regex ("(" <> wordBoundaryChars <> ")") (R.global <> R.multiline) of wordBoundaryReg = case R.regex ("(" <> wordBoundaryChars <> ")") (R.global <> R.multiline) of
Left e -> unsafePartial $ crashWith e Left e -> unsafePartial $ crashWith e
Right r -> r Right r -> r
wordBoundaryReg2 :: R.Regex
wordBoundaryReg2 = case R.regex ("(" <> wordBoundaryChars <> ")\\1") (R.global <> R.multiline) of wordBoundaryReg2 = case R.regex ("(" <> wordBoundaryChars <> ")\\1") (R.global <> R.multiline) of
Left e -> unsafePartial $ crashWith e Left e -> unsafePartial $ crashWith e
Right r -> r Right r -> r
...@@ -327,8 +329,8 @@ instance encodeJsonReplace :: EncodeJson a => EncodeJson (Replace a) where ...@@ -327,8 +329,8 @@ instance encodeJsonReplace :: EncodeJson a => EncodeJson (Replace a) where
instance decodeJsonReplace :: (DecodeJson a, Eq a) => DecodeJson (Replace a) where instance decodeJsonReplace :: (DecodeJson a, Eq a) => DecodeJson (Replace a) where
decodeJson json = do decodeJson json = do
obj <- decodeJson json obj <- decodeJson json
mold <- obj .?? "old" mold <- obj .:! "old"
mnew <- obj .?? "new" mnew <- obj .:! "new"
case Tuple mold mnew of case Tuple mold mnew of
Tuple (Just old) (Just new) -> pure $ replace old new Tuple (Just old) (Just new) -> pure $ replace old new
Tuple Nothing Nothing -> pure Keep Tuple Nothing Nothing -> pure Keep
...@@ -361,8 +363,8 @@ instance decodeJsonPatchSet :: (Ord a, DecodeJson a) => DecodeJson (PatchSet a) ...@@ -361,8 +363,8 @@ instance decodeJsonPatchSet :: (Ord a, DecodeJson a) => DecodeJson (PatchSet a)
decodeJson json = do decodeJson json = do
-- TODO handle empty fields -- TODO handle empty fields
obj <- decodeJson json obj <- decodeJson json
rem <- mkSet <$> (obj .? "rem") rem <- mkSet <$> (obj .: "rem")
add <- mkSet <$> (obj .? "add") add <- mkSet <$> (obj .: "add")
pure $ PatchSet { rem, add } pure $ PatchSet { rem, add }
where where
mkSet :: forall b. Ord b => Array b -> Set b mkSet :: forall b. Ord b => Array b -> Set b
...@@ -401,8 +403,8 @@ instance decodeJsonNgramsPatch :: DecodeJson NgramsPatch where ...@@ -401,8 +403,8 @@ instance decodeJsonNgramsPatch :: DecodeJson NgramsPatch where
decodeJson json = do decodeJson json = do
obj <- decodeJson json obj <- decodeJson json
-- TODO handle empty fields -- TODO handle empty fields
patch_list <- obj .? "patch_list" patch_list <- obj .: "patch_list"
patch_children <- obj .? "patch_children" patch_children <- obj .: "patch_children"
pure $ NgramsPatch { patch_list, patch_children } pure $ NgramsPatch { patch_list, patch_children }
applyNgramsPatch :: NgramsPatch -> NgramsElement -> NgramsElement applyNgramsPatch :: NgramsPatch -> NgramsElement -> NgramsElement
...@@ -601,6 +603,7 @@ loadNgramsTable { nodeId, listIds, termListFilter, termSizeFilter ...@@ -601,6 +603,7 @@ loadNgramsTable { nodeId, listIds, termListFilter, termSizeFilter
}) })
(Just nodeId) (Just nodeId)
convOrderBy :: T.OrderByDirection T.ColumnName -> OrderBy
convOrderBy (T.ASC (T.ColumnName "Score (Occurrences)")) = ScoreAsc convOrderBy (T.ASC (T.ColumnName "Score (Occurrences)")) = ScoreAsc
convOrderBy (T.DESC (T.ColumnName "Score (Occurrences)")) = ScoreDesc convOrderBy (T.DESC (T.ColumnName "Score (Occurrences)")) = ScoreDesc
convOrderBy (T.ASC _) = TermAsc convOrderBy (T.ASC _) = TermAsc
......
...@@ -4,7 +4,7 @@ import Prelude ...@@ -4,7 +4,7 @@ import Prelude
import Effect.Class (liftEffect) import Effect.Class (liftEffect)
import Effect.Aff (Aff) import Effect.Aff (Aff)
import Data.Argonaut (class DecodeJson) import Data.Argonaut (class DecodeJson)
import DOM.Simple.Console import DOM.Simple.Console (log2)
import Gargantext.Types (toQuery) import Gargantext.Types (toQuery)
import Gargantext.Components.Search.Types (SearchQuery) import Gargantext.Components.Search.Types (SearchQuery)
import Gargantext.Config.REST (post) import Gargantext.Config.REST (post)
......
...@@ -2,24 +2,15 @@ module Gargantext.Components.Search.SearchField ...@@ -2,24 +2,15 @@ module Gargantext.Components.Search.SearchField
( Search, Props, searchField, searchFieldComponent )where ( Search, Props, searchField, searchFieldComponent )where
import Prelude hiding (div) import Prelude hiding (div)
import Data.Map as Map import Data.Maybe ( Maybe(..), maybe )
import Data.Maybe ( Maybe(..), maybe, maybe' ) import Data.Tuple ( fst )
import Data.Nullable (Nullable, null)
import Data.Traversable ( traverse_ )
import Data.Tuple ( Tuple(..), fst )
import Data.Tuple.Nested ( (/\) ) import Data.Tuple.Nested ( (/\) )
import DOM.Simple as DOM
import DOM.Simple.Console
import DOM.Simple.Element as Element
import DOM.Simple.Event as DE
import Effect ( Effect )
import Effect.Uncurried (mkEffectFn1) import Effect.Uncurried (mkEffectFn1)
import FFI.Simple ((..)) import FFI.Simple ((..))
import Reactix as R import Reactix as R
import Reactix.DOM.HTML as HTML
import Reactix.DOM.HTML (text, button, div, input, option, form, span, ul, li, a) import Reactix.DOM.HTML (text, button, div, input, option, form, span, ul, li, a)
import Reactix.SyntheticEvent as E
import Gargantext.Components.Search.Types import Gargantext.Components.Search.Types (Database)
select = R.createElement "select" select = R.createElement "select"
...@@ -64,15 +55,15 @@ databaseInput (db /\ setDB) dbs = ...@@ -64,15 +55,15 @@ databaseInput (db /\ setDB) dbs =
, ul {className: "dropdown-menu", role: "menu"} (liItem <$> dbs) , ul {className: "dropdown-menu", role: "menu"} (liItem <$> dbs)
] ]
where where
liItem db = li { onClick } [ a {href: "#"} [text (show db) ] ] liItem db' = li { onClick } [ a {href: "#"} [text (show db') ] ]
where where
onClick = mkEffectFn1 $ \_ -> setDB $ const $ Just db onClick = mkEffectFn1 $ \_ -> setDB $ const $ Just db'
dropdownBtnProps = { id: "search-dropdown" dropdownBtnProps = { id: "search-dropdown"
, className: "btn btn-default dropdown-toggle" , className: "btn btn-default dropdown-toggle"
, type: "button" , type: "button"
, data: {toggle: "dropdown"} , data: {toggle: "dropdown"}
} }
dropdownBtn (Just db) = button dropdownBtnProps [ span {} [ text (show db) ] ] dropdownBtn (Just db') = button dropdownBtnProps [ span {} [ text (show db') ] ]
dropdownBtn (Nothing) = button dropdownBtnProps [ span {} [ text "-" ] ] dropdownBtn (Nothing) = button dropdownBtnProps [ span {} [ text "-" ] ]
searchInput :: R.State String -> R.Element searchInput :: R.State String -> R.Element
......
module Gargantext.Components.Search.Types where module Gargantext.Components.Search.Types where
import Control.Monad.Cont.Trans (lift)
import Data.Argonaut (class EncodeJson, jsonEmptyObject, (:=), (~>), encodeJson) import Data.Argonaut (class EncodeJson, jsonEmptyObject, (:=), (~>), encodeJson)
import Data.Array (head)
import Data.Generic.Rep (class Generic) import Data.Generic.Rep (class Generic)
import Data.Generic.Rep.Eq (genericEq) import Data.Generic.Rep.Eq (genericEq)
import Data.Generic.Rep.Show (genericShow) import Data.Generic.Rep.Show (genericShow)
...@@ -11,15 +9,11 @@ import Data.Newtype (class Newtype) ...@@ -11,15 +9,11 @@ import Data.Newtype (class Newtype)
import Data.Tuple (Tuple) import Data.Tuple (Tuple)
import Data.Tuple.Nested ((/\)) import Data.Tuple.Nested ((/\))
import Effect.Aff (Aff) import Effect.Aff (Aff)
import Effect.Class (liftEffect)
import Routing.Hash (setHash)
import Thermite (PerformAction, modifyState)
import Gargantext.Prelude import Gargantext.Prelude
import Gargantext.Types (class ToQuery) import Gargantext.Types (class ToQuery)
import Gargantext.Config (End(..), NodeType(..), Path(..), toUrl) import Gargantext.Config (End(..), NodeType(..), toUrl)
import Gargantext.Config.REST (post, put) import Gargantext.Config.REST (put)
import Gargantext.Components.Modals.Modal (modalHide)
import Gargantext.Utils (id) import Gargantext.Utils (id)
import URI.Extra.QueryPairs as QP import URI.Extra.QueryPairs as QP
......
...@@ -2,7 +2,6 @@ module Gargantext.Components.Table where ...@@ -2,7 +2,6 @@ module Gargantext.Components.Table where
import Data.Array (filter) import Data.Array (filter)
import Data.Maybe (Maybe(..), maybe) import Data.Maybe (Maybe(..), maybe)
import Data.Either (Either(..))
import Data.Generic.Rep (class Generic) import Data.Generic.Rep (class Generic)
import Data.Generic.Rep.Show (genericShow) import Data.Generic.Rep.Show (genericShow)
import Effect (Effect) import Effect (Effect)
...@@ -11,7 +10,6 @@ import React (ReactElement, ReactClass, Children, createElement) ...@@ -11,7 +10,6 @@ import React (ReactElement, ReactClass, Children, createElement)
import React.DOM (a, b, b', p, i, h3, hr, div, option, select, span, table, tbody, td, text, th, thead, tr) import React.DOM (a, b, b', p, i, h3, hr, div, option, select, span, table, tbody, td, text, th, thead, tr)
import React.DOM.Props (className, href, onChange, onClick, scope, selected, value, defaultValue, style) import React.DOM.Props (className, href, onChange, onClick, scope, selected, value, defaultValue, style)
import Thermite (PerformAction, Render, Spec, modifyState_, simpleSpec, StateCoTransformer, createClass) import Thermite (PerformAction, Render, Spec, modifyState_, simpleSpec, StateCoTransformer, createClass)
import Unsafe.Coerce (unsafeCoerce)
import Gargantext.Prelude import Gargantext.Prelude
import Gargantext.Utils.Reactix as R2 import Gargantext.Utils.Reactix as R2
......
module Gargantext.Pages.Corpus.Chart.Histo where module Gargantext.Pages.Corpus.Chart.Histo where
import Data.Argonaut (class DecodeJson, decodeJson, (.?)) import Data.Argonaut (class DecodeJson, decodeJson, (.?))
import Data.Array (foldl) import Data.Maybe (Maybe(..))
import Data.Int (toNumber)
import Data.Map as Map
import Data.Map (Map)
import Data.Maybe (Maybe(..), maybe)
import Data.Tuple (Tuple(..))
import Effect.Aff (Aff) import Effect.Aff (Aff)
import Gargantext.Config -- (End(..), Path(..), TabType, toUrl) import Gargantext.Config -- (End(..), Path(..), TabType, toUrl)
import Gargantext.Config.REST (get) import Gargantext.Config.REST (get)
import React (ReactClass, ReactElement, createElement)
import Reactix as R import Reactix as R
import Reactix.DOM.HTML as H
import Thermite (Spec) import Thermite (Spec)
import Gargantext.Prelude import Gargantext.Prelude
import Gargantext.Types (TermList(..))
import Gargantext.Components.Loader as Loader
import Gargantext.Components.Loader2 (useLoader) import Gargantext.Components.Loader2 (useLoader)
import Gargantext.Components.Charts.Options.ECharts import Gargantext.Components.Charts.Options.ECharts
import Gargantext.Components.Charts.Options.Type
import Gargantext.Components.Charts.Options.Series import Gargantext.Components.Charts.Options.Series
import Gargantext.Components.Charts.Options.Color import Gargantext.Components.Charts.Options.Color
import Gargantext.Components.Charts.Options.Font import Gargantext.Components.Charts.Options.Font
......
module Gargantext.Pages.Corpus.Chart.Metrics where module Gargantext.Pages.Corpus.Chart.Metrics where
import Data.Argonaut (class DecodeJson, decodeJson, (.?)) import Data.Argonaut (class DecodeJson, decodeJson, (.?))
import Data.Array (foldl)
import Data.Map as Map import Data.Map as Map
import Data.Map (Map) import Data.Map (Map)
import Data.Maybe (Maybe(..), maybe) import Data.Maybe (Maybe(..))
import Data.Tuple (Tuple(..)) import Data.Tuple (Tuple(..))
import Effect.Aff (Aff) import Effect.Aff (Aff)
import Gargantext.Config -- (End(..), Path(..), TabType, toUrl) import Gargantext.Config -- (End(..), Path(..), TabType, toUrl)
import Gargantext.Config.REST (get) import Gargantext.Config.REST (get)
import React (ReactClass, ReactElement, createElement)
import Reactix as R import Reactix as R
import Reactix.DOM.HTML as H
import Thermite (Spec)
import Gargantext.Prelude import Gargantext.Prelude
import Gargantext.Types (TermList(..)) import Gargantext.Types (TermList(..))
import Gargantext.Components.Loader2 (useLoader) import Gargantext.Components.Loader2 (useLoader)
import Gargantext.Components.Loader as Loader
import Gargantext.Components.Charts.Options.ECharts import Gargantext.Components.Charts.Options.ECharts
import Gargantext.Components.Charts.Options.Type import Gargantext.Components.Charts.Options.Type
import Gargantext.Components.Charts.Options.Series import Gargantext.Components.Charts.Options.Series
......
module Gargantext.Pages.Corpus.Chart.Pie where module Gargantext.Pages.Corpus.Chart.Pie where
import Data.Argonaut (class DecodeJson, decodeJson, (.?)) import Data.Argonaut (class DecodeJson, decodeJson, (.?))
import Data.Array (foldl, zip, filter) import Data.Array (zip, filter)
import Data.Array as A import Data.Array as A
import Data.Int (toNumber) import Data.Maybe (Maybe(..))
import Data.Maybe (Maybe(..), maybe)
import Data.String (take, joinWith, Pattern(..), split, length) import Data.String (take, joinWith, Pattern(..), split, length)
import Data.Tuple (Tuple(..)) import Data.Tuple (Tuple(..))
import Effect.Aff (Aff) import Effect.Aff (Aff)
import Gargantext.Config -- (End(..), Path(..), TabType, toUrl) import Gargantext.Config -- (End(..), Path(..), TabType, toUrl)
import Gargantext.Config.REST (get) import Gargantext.Config.REST (get)
import React (ReactClass, ReactElement, createElement)
import Reactix as R import Reactix as R
import Reactix.DOM.HTML as H
import Thermite (Spec) import Thermite (Spec)
import Gargantext.Prelude import Gargantext.Prelude
import Gargantext.Types (TermList(..))
import Gargantext.Components.Loader2 (useLoader) import Gargantext.Components.Loader2 (useLoader)
import Gargantext.Components.Charts.Options.ECharts import Gargantext.Components.Charts.Options.ECharts
import Gargantext.Components.Charts.Options.Type import Gargantext.Components.Charts.Options.Series (seriesBarD1, seriesPieD1)
import Gargantext.Components.Charts.Options.Series import Gargantext.Components.Charts.Options.Color (blue)
import Gargantext.Components.Charts.Options.Color
import Gargantext.Components.Charts.Options.Font import Gargantext.Components.Charts.Options.Font
import Gargantext.Components.Charts.Options.Data import Gargantext.Components.Charts.Options.Data (dataSerie)
import Gargantext.Utils.Reactix as R2 import Gargantext.Utils.Reactix as R2
import Gargantext.Pages.Corpus.Chart.Utils as U import Gargantext.Pages.Corpus.Chart.Utils as U
......
module Gargantext.Pages.Corpus.Chart.Tree where module Gargantext.Pages.Corpus.Chart.Tree where
import Data.Array (foldl)
import Data.Map as Map
import Data.Map (Map)
import Data.Argonaut (class DecodeJson, decodeJson, (.?)) import Data.Argonaut (class DecodeJson, decodeJson, (.?))
import Data.Maybe (Maybe(..), maybe) import Data.Maybe (Maybe(..))
import Data.Tuple (Tuple(..))
import Effect.Aff (Aff) import Effect.Aff (Aff)
import Gargantext.Config -- (End(..), Path(..), TabType, toUrl) import Gargantext.Config -- (End(..), Path(..), TabType, toUrl)
import Gargantext.Config.REST (get) import Gargantext.Config.REST (get)
import React (ReactClass, ReactElement, createElement)
import Reactix as R import Reactix as R
import Reactix.DOM.HTML as H import Reactix.DOM.HTML as H
import Thermite (Spec) import Thermite (Spec)
import Gargantext.Prelude import Gargantext.Prelude
import Gargantext.Types (TermList(..))
import Gargantext.Components.Loader2 (useLoader) import Gargantext.Components.Loader2 (useLoader)
import Gargantext.Components.Charts.Options.ECharts import Gargantext.Components.Charts.Options.ECharts
import Gargantext.Components.Charts.Options.Type
import Gargantext.Components.Charts.Options.Series import Gargantext.Components.Charts.Options.Series
import Gargantext.Components.Charts.Options.Color
import Gargantext.Components.Charts.Options.Font import Gargantext.Components.Charts.Options.Font
import Gargantext.Components.Charts.Options.Data
import Gargantext.Utils.Reactix as R2 import Gargantext.Utils.Reactix as R2
import Gargantext.Pages.Corpus.Chart.Utils as U import Gargantext.Pages.Corpus.Chart.Utils as U
......
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