Commit 02ebf355 authored by Przemyslaw Kaminski's avatar Przemyslaw Kaminski

Merge branch 'dev' into 311-tree-node-list-upload-file-as-json

parents 2e02f0f5 4a8401b5
Pipeline #1643 canceled with stage
# Gargantext Purescript # Gargantext with Purescript (FrontEnd instance)
## About this project ## About the project
Gargantext is a collaborative web platform for the exploration of sets GarganText is a collaborative web-decentralized-based macro-service
of unstructured documents. It combines tools from natural language platform for the exploration of unstructured texts. It combines tools
processing, text-mining, complex networks analysis and interactive data from natural language processing, text-data-mining tricks, complex
visualization to pave the way toward new kinds of interactions with your networks analysis algorithms and interactive data visualization tools to
digital corpora. pave the way toward new kinds of interactions with your digital corpora.
This repo deals with the frontend or client which needs This software is free software, developed and offered by the CNRS
a backend server running or being granted access to a Complex Systems Institute of Paris Île-de-France (ISC-PIF) and its
partners.
GarganText Project: this repo builds the
frontend for the backend server built by
[backend](https://gitlab.iscpif.fr/gargantext/haskell-gargantext). [backend](https://gitlab.iscpif.fr/gargantext/haskell-gargantext).
This software is free software, developed by the CNRS Complex Systems
Institute of Paris Île-de-France (ISC-PIF) and its partners.
## Getting set up ## Getting set up
There are two approaches to working with the build: There are two approaches to working with the build:
1. Use our docker setup 1. Use our Nix or Docker setup
2. Install our dependencies yourself 2. Install our dependencies yourself
The javascript ecosystem kind of assumes if you're on linux, you're ### With Nix setup
running on debian or ubuntu. I haven't yet managed to get garg to
build on alpine linux, for example. If you're on an oddball system, I First install [nix](https://nixos.org/guides/install-nix.html):
*strongly* recommend you just use the docker setup.
```shell
sh < (curl -L https://nixos.org/nix/install) --daemon
```
Verify the installation is complete
```shell
$ nix-env
nix-env (Nix) 2.3.12
```
To build the frontend just do:
```
nix-shell --run build
```
Just serve dist/index.html with any server and you are ready to be
connected to any backend.
### Docker setup ### With Docker setup
You will need docker and docker-compose installed. You will need docker and docker-compose installed.
......
...@@ -21,8 +21,7 @@ import Unsafe.Coerce (unsafeCoerce) ...@@ -21,8 +21,7 @@ import Unsafe.Coerce (unsafeCoerce)
foreign import eChartsClass :: ReactClass Echarts foreign import eChartsClass :: ReactClass Echarts
foreign import listenerFn1 :: forall evt. (evt -> Effect Unit) -> Effect Unit foreign import listenerFn1 :: forall evt. (evt -> Effect Unit) -> Effect Unit
-- | @XXX some eCharts "actions" not working ("select", ...) -- | https://echarts.apache.org/v4/en/api.html#echartsInstance.dispatchAction
-- | https://echarts.apache.org/en/api.html#echartsInstance.dispatchAction
foreign import dispatchAction :: forall payload. EChartsInstance -> payload -> Effect Unit foreign import dispatchAction :: forall payload. EChartsInstance -> payload -> Effect Unit
chart :: Options -> R.Element chart :: Options -> R.Element
...@@ -59,7 +58,11 @@ chartWith options = ...@@ -59,7 +58,11 @@ chartWith options =
execOnInit fn = toMaybe >>> case _ of execOnInit fn = toMaybe >>> case _ of
Nothing -> pure unit Nothing -> pure unit
Just (ref :: Record EChartRef) -> pure unit -- fn =<< ref.getEchartsInstance -- Just (ref :: Record EChartRef) -> fn =<< ref.getEchartsInstance
-- ^ this line can break for some reasons... (see Issue #312)
Just (ref :: Record EChartRef) -> do
i <- ref.getEchartsInstance
fn i
echarts :: Echarts -> R.Element echarts :: Echarts -> R.Element
echarts c = R2.buff $ unsafeCreateElementDynamic (unsafeCoerce eChartsClass) c [] echarts c = R2.buff $ unsafeCreateElementDynamic (unsafeCoerce eChartsClass) c []
...@@ -190,7 +193,7 @@ data Options = Options ...@@ -190,7 +193,7 @@ data Options = Options
-- it intends to return the `eChartsInstance` used for every -- it intends to return the `eChartsInstance` used for every
-- library actions -- library actions
-- --
-- [1] https://echarts.apache.org/en/api.html#echarts.init -- [1] https://echarts.apache.org/v4/en/api.html#echarts.init
, onInit :: Maybe (EChartsInstance -> Effect Unit) , onInit :: Maybe (EChartsInstance -> Effect Unit)
} }
......
...@@ -216,3 +216,19 @@ type EChartRef = ...@@ -216,3 +216,19 @@ type EChartRef =
( getEchartsInstance :: Effect EChartsInstance ( getEchartsInstance :: Effect EChartsInstance
-- ... -- ...
) )
----
-- | As "dispatchAction" call has a variadic arity, we can dissociate a type
-- | where the cliked item (bar, pie section, etc.) need this dispatchAction
-- | To do so, we have to trimmed its given properties to match this example [1]
-- |
-- | [1] https://echarts.apache.org/en/api.html#action.highlight
type EChartActionData =
( dataIndex :: Int
, name :: String
, seriesId :: Nullable String
, seriesIndex :: Int
, seriesName :: String
, type :: String
)
...@@ -67,7 +67,7 @@ chartOptions { onClick, onInit } (HistoMetrics { dates: dates', count: count'}) ...@@ -67,7 +67,7 @@ chartOptions { onClick, onInit } (HistoMetrics { dates: dates', count: count'})
, emphasis: { itemStyle: itemStyle { color: blue } } , emphasis: { itemStyle: itemStyle { color: blue } }
-- @XXX "select" action not working -- @XXX "select" action not working
-- , selectedMode: selectedMode Single -- , selectedMode: selectedMode Single
, select: { itemStyle: itemStyle { color: green }} -- , select: { itemStyle: itemStyle { color: green }}
} }
series = series =
......
module Gargantext.Components.Nodes.Texts where module Gargantext.Components.Nodes.Texts where
import DOM.Simple.Console (log2) import Gargantext.Prelude
import Data.Generic.Rep (class Generic) import Data.Generic.Rep (class Generic)
import Data.Maybe (Maybe(..)) import Data.Maybe (Maybe(..))
import Data.Show.Generic (genericShow) import Data.Show.Generic (genericShow)
import Data.Symbol (SProxy(..))
import Data.Tuple.Nested ((/\)) import Data.Tuple.Nested ((/\))
import Effect.Aff (launchAff_) import Effect.Aff (launchAff_)
import Gargantext.Components.Charts.Options.ECharts (dispatchAction) import Gargantext.Components.Charts.Options.ECharts (dispatchAction)
import Gargantext.Components.Charts.Options.Type (EChartsInstance) import Gargantext.Components.Charts.Options.Type (EChartsInstance, EChartActionData)
import Gargantext.Components.DocsTable as DT import Gargantext.Components.DocsTable as DT
import Gargantext.Components.DocsTable.Types (Year) import Gargantext.Components.DocsTable.Types (Year)
import Gargantext.Components.NgramsTable.Loader (clearCache) import Gargantext.Components.NgramsTable.Loader (clearCache)
...@@ -23,13 +23,11 @@ import Gargantext.Components.Tab as Tab ...@@ -23,13 +23,11 @@ import Gargantext.Components.Tab as Tab
import Gargantext.Components.Table as Table import Gargantext.Components.Table as Table
import Gargantext.Ends (Frontends) import Gargantext.Ends (Frontends)
import Gargantext.Hooks.Loader (useLoader) import Gargantext.Hooks.Loader (useLoader)
import Gargantext.Prelude
import Gargantext.Sessions (WithSession, Session, getCacheState) import Gargantext.Sessions (WithSession, Session, getCacheState)
import Gargantext.Types (CTabNgramType(..), ListId, NodeID, SidePanelState(..), TabSubType(..), TabType(..)) import Gargantext.Types (CTabNgramType(..), ListId, NodeID, SidePanelState(..), TabSubType(..), TabType(..))
import Gargantext.Utils.Reactix as R2 import Gargantext.Utils.Reactix as R2
import Reactix as R import Reactix as R
import Reactix.DOM.HTML as H import Reactix.DOM.HTML as H
import Record (set)
import Toestand as T import Toestand as T
here :: R2.Here here :: R2.Here
...@@ -170,8 +168,18 @@ tabsCpt = here.component "tabs" cpt ...@@ -170,8 +168,18 @@ tabsCpt = here.component "tabs" cpt
-- @XXX due to lack of support for "echart.select" action, -- @XXX due to lack of support for "echart.select" action,
-- have to manually rely on a set/unset selection -- have to manually rely on a set/unset selection
-- targeting the "echart.emphasis" action -- targeting the "echart.emphasis" action
let
opts' :: Record EChartActionData
opts' =
{ dataIndex : opts.dataIndex
, name : opts.name
, seriesId : opts.seriesId
, seriesIndex : opts.seriesIndex
, seriesName : opts.seriesName
, type : "highlight"
}
dispatchAction i { type: "downplay" } dispatchAction i { type: "downplay" }
dispatchAction i $ set (SProxy :: SProxy "type") "highlight" opts dispatchAction i opts'
activeTab <- T.useBox 0 activeTab <- T.useBox 0
......
...@@ -670,7 +670,7 @@ asyncTaskTypePath :: AsyncTaskType -> String ...@@ -670,7 +670,7 @@ asyncTaskTypePath :: AsyncTaskType -> String
asyncTaskTypePath AddNode = "async/nobody/" asyncTaskTypePath AddNode = "async/nobody/"
asyncTaskTypePath Form = "add/form/async/" asyncTaskTypePath Form = "add/form/async/"
asyncTaskTypePath GraphRecompute = "async/recompute/" asyncTaskTypePath GraphRecompute = "async/recompute/"
asyncTaskTypePath ListUpload = "add/form/async/" asyncTaskTypePath ListUpload = "add/form/async/nobody"
asyncTaskTypePath Query = "query/" asyncTaskTypePath Query = "query/"
asyncTaskTypePath UpdateNgramsCharts = "ngrams/async/charts/update/" asyncTaskTypePath UpdateNgramsCharts = "ngrams/async/charts/update/"
asyncTaskTypePath UpdateNode = "update/" asyncTaskTypePath UpdateNode = "update/"
......
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