Commit c37cc12f authored by Przemyslaw Kaminski's avatar Przemyslaw Kaminski

Merge branch 'dev' into dev-ngrams-table-cache-in-local-storage

parents 63b87cae 2d431463
This diff is collapsed.
{
"name": "Gargantext",
"version": "0.0.1.91.3",
"version": "0.0.1.91.7",
"scripts": {
"rebase-set": "spago package-set-upgrade && spago psc-package-insdhall",
"rebuild-set": "spago psc-package-insdhall",
......
This diff is collapsed.
let upstream =
./packages-0.13.8-20200822.dhall
https://github.com/purescript/package-sets/releases/download/psc-0.13.8-20201021/packages.dhall
let overrides =
{ thermite =
......
......@@ -12,10 +12,10 @@
module Gargantext.Components.Annotation.AnnotatedField where
import Prelude
import Data.Maybe ( Maybe(..), maybe, isJust, isNothing )
import Data.Maybe ( Maybe(..), maybe )
import Data.Tuple ( Tuple(..) )
import Data.Tuple.Nested ( (/\) )
import DOM.Simple.Console (log, log2)
import DOM.Simple.Console (log2)
import DOM.Simple.Event as DE
import Effect ( Effect )
import Reactix as R
......@@ -27,7 +27,6 @@ import Gargantext.Components.Annotation.Utils ( termBootstrapClass )
import Gargantext.Components.NgramsTable.Core (NgramsTable, NgramsTerm, findNgramTermList, highlightNgrams, normNgram)
import Gargantext.Components.Annotation.Menu ( AnnotationMenu, annotationMenu, MenuType(..) )
import Gargantext.Utils.Selection as Sel
import Gargantext.Utils.Reactix as R2
thisModule :: String
thisModule = "Gargantext.Components.Annotation.AnnotatedField"
......@@ -58,11 +57,11 @@ annotatedFieldComponent = R.hooksComponentWithModule thisModule "annotatedField"
onSelect :: String -> Maybe TermList -> MouseEvent -> Effect Unit
onSelect text' Nothing event = do
log2 "[onSelect] text'" text'
--log2 "[onSelect] text'" text'
maybeShowMenu setMenu menuRef setTermList ngrams event
onSelect text' (Just list) event = do
log2 "[onSelect] text'" text'
log2 "[onSelect] list" list
--log2 "[onSelect] text'" text'
--log2 "[onSelect] list" (show list)
let x = E.clientX event
y = E.clientY event
setList t = do
......@@ -77,8 +76,8 @@ annotatedFieldComponent = R.hooksComponentWithModule thisModule "annotatedField"
, onClose: \_ -> R.setRef menuRef Nothing
, setList
}
--setMenu (const $ menu)
R.setRef menuRef menu
setMenu $ const menu
mapCompile (Tuple t l) = {text: t, list: l, onSelect}
compiled = map mapCompile $ compile ngrams text
......@@ -105,8 +104,8 @@ addMenuCpt = R.hooksComponentWithModule thisModule "addMenu" cpt
R.useEffect' $ do
let m = R.readRef menuRef
log2 "[addMenu] menuRef" m
log2 "[addMenu] mMenu" mMenu
--log2 "[addMenu] menuRef" m
--log2 "[addMenu] mMenu" mMenu
setmMenu $ const m
pure $ case mMenu of
......@@ -116,7 +115,7 @@ addMenuCpt = R.hooksComponentWithModule thisModule "addMenu" cpt
-- forall e. IsMouseEvent e => R.Setter (Maybe AnnotationMenu) -> R.Setter ? -> ? -> e -> Effect Unit
maybeShowMenu setMenu menuRef setTermList ngrams event = do
s <- Sel.getSelection
log2 "[maybeShowMenu] s" s
--log2 "[maybeShowMenu] s" s
case s of
Just sel -> do
case Sel.selectionToString sel of
......@@ -128,11 +127,11 @@ maybeShowMenu setMenu menuRef setTermList ngrams event = do
list = findNgramTermList ngrams n
setList t = do
setTermList n list t
--setMenu (const Nothing)
R.setRef menuRef Nothing
--setMenu (const Nothing)
E.preventDefault event
range <- Sel.getRange sel 0
log2 "[maybeShowMenu] selection range" $ Sel.rangeToTuple range
--log2 "[maybeShowMenu] selection range" $ Sel.rangeToTuple range
let menu = Just {
x
, y
......@@ -141,8 +140,8 @@ maybeShowMenu setMenu menuRef setTermList ngrams event = do
, onClose: \_ -> R.setRef menuRef Nothing
, setList
}
--setMenu (const $ menu)
R.setRef menuRef menu
setMenu $ const $ menu
Nothing -> pure unit
-- Nothing -> do
-- R.setRef menuRef Nothing
......
......@@ -121,8 +121,9 @@ appCpt = R.hooksComponentWithModule thisModule "app" cpt where
--, treeReload
}
RouteFile sid nodeId -> withSession sid $ \session -> forested $ fileLayout { nodeId, session }
RouteFrameCalc sid nodeId -> withSession sid $ \session -> forested $ frameLayout { nodeId, session }
RouteFrameWrite sid nodeId -> withSession sid $ \session -> forested $ frameLayout { nodeId, session }
RouteFrameCalc sid nodeId -> withSession sid $ \session -> forested $ frameLayout { nodeId, session, nodeType: GT.NodeFrameCalc }
RouteFrameCode sid nodeId -> withSession sid $ \session -> forested $ frameLayout { nodeId, session, nodeType: GT.NodeFrameCode }
RouteFrameWrite sid nodeId -> withSession sid $ \session -> forested $ frameLayout { nodeId, session, nodeType: GT.NodeFrameWrite}
Team sid nodeId -> withSession sid $ \session -> forested $ corpusLayout { nodeId, session }
Texts sid nodeId -> withSession sid $ \session -> forested $ textsLayout { frontends, nodeId, session, sessionUpdate }
UserPage sid nodeId -> withSession sid $ \session -> forested $ userLayout { asyncTasks, frontends, nodeId, session }
......
This diff is collapsed.
......@@ -126,6 +126,7 @@ settingsBox Team =
, Annuaire
, NodeFrameWrite
, NodeFrameCalc
, NodeFrameCode
]
, Share
, Delete
......@@ -316,6 +317,22 @@ settingsBox NodeFrameCalc =
]
}
settingsBox NodeFrameCode =
SettingsBox { show : true
, edit : true
, doc : Documentation NodeFrameCode
, buttons : [ Add [ NodeFrameCalc
, NodeFrameWrite
, NodeFrameCode
]
, Move moveFrameParameters
, Delete
]
}
settingsBox NodeFile =
SettingsBox { show: true
......
......@@ -235,7 +235,7 @@ sigmaSettings =
, defaultHoverLabelBGColor: "#fff"
, defaultHoverLabelColor: "#000"
, defaultLabelColor: "#000" -- labels text color
, defaultLabelSize: 8.0 -- (old tina: showLabelsIfZoom)
, defaultLabelSize: 15.0 -- (old tina: showLabelsIfZoom)
, defaultNodeBorderColor : "#000" -- <- if nodeBorderColor = 'default'
, defaultNodeColor: "#FFF"
, doubleClickEnabled: false -- indicates whether or not the graph can be zoomed on double-click
......
This diff is collapsed.
......@@ -17,7 +17,12 @@ import Reactix as R
import Reactix.DOM.HTML as H
import Gargantext.Prelude
import Gargantext.Components.NgramsTable.Core (Action(..), Dispatch, NgramsElement, NgramsPatch(..), NgramsTable, NgramsTablePatch, NgramsTerm, Replace, _NgramsElement, _NgramsRepoElement, _PatchMap, _children, _list, _ngrams, _occurrences, ngramsTermText, replace, singletonNgramsTablePatch)
import Gargantext.Components.NgramsTable.Core ( Action(..), Dispatch, NgramsElement, NgramsPatch(..)
, NgramsTable, NgramsTablePatch, NgramsTerm, Replace
, _NgramsElement, _NgramsRepoElement, _PatchMap, _children
, _list, _ngrams, _occurrences, ngramsTermText, replace
, singletonNgramsTablePatch, setTermListA
)
import Gargantext.Components.Table as Tbl
import Gargantext.Types as T
import Gargantext.Utils.Reactix as R2
......@@ -207,7 +212,7 @@ renderNgramsItemCpt = R.hooksComponentWithModule thisModule "renderNgramsItem" c
ngramsStyle = [termStyle termList ngramsOpacity]
ngramsEdit = Just <<< dispatch <<< SetParentResetChildren <<< Just <<< view _ngrams
ngramsClick
= Just <<< dispatch <<< cycleTermListItem <<< view _ngrams
= Just <<< dispatch <<< CoreAction <<< cycleTermListItem <<< view _ngrams
-- ^ This is the old behavior it is nicer to use since one can
-- rapidly change the ngram list without waiting for confirmation.
-- However this might expose bugs. One of them can be reproduced
......@@ -226,7 +231,7 @@ renderNgramsItemCpt = R.hooksComponentWithModule thisModule "renderNgramsItem" c
in
H.input { checked: chkd
, className: "checkbox"
, on: { change: const $ dispatch $
, on: { change: const $ dispatch $ CoreAction $
setTermListA ngrams (replace termList termList'') }
, readOnly: ngramsTransient
, type: "checkbox" }
......@@ -245,13 +250,6 @@ termStyle T.StopTerm opacity = DOM.style { color: "red", opacity
, textDecoration: "line-through" }
termStyle T.CandidateTerm opacity = DOM.style { color: "black", opacity }
setTermListA :: NgramsTerm -> Replace T.TermList -> Action
setTermListA n patch_list =
CommitPatch $
singletonNgramsTablePatch n $
NgramsPatch { patch_list, patch_children: mempty }
tablePatchHasNgrams :: NgramsTablePatch -> NgramsTerm -> Boolean
tablePatchHasNgrams ngramsTablePatch ngrams =
isJust $ ngramsTablePatch.ngramsPatches ^. _PatchMap <<< at ngrams
......
......@@ -91,13 +91,14 @@ annuaireCpt = R.hooksComponentWithModule thisModule "annuaire" cpt
cpt {session, path, info: info@(AnnuaireInfo {name, date: date'}), frontends} _ = do
pagePath <- R.useState' $ initialPagePath (fst path)
cacheState <- R.useState' NT.CacheOn
cacheState <- R.useState' NT.CacheOff
pure $ R.fragment
[ T.tableHeaderLayout { afterCacheStateChange: \_ -> launchAff_ $ clearCache unit
, cacheState
, date
, desc: name
, key: "annuaire-" <> (show $ fst cacheState)
, query: ""
, title: name
, user: "" }
......
......@@ -26,7 +26,6 @@ import Gargantext.Prelude (Unit, bind, const, discard, pure, show, unit, ($), (+
import Gargantext.Routes as Routes
import Gargantext.Sessions (Session, get, put, sessionId)
import Gargantext.Types (NodeType(..))
import Gargantext.Utils.Reactix as R2
thisModule :: String
thisModule = "Gargantext.Components.Nodes.Annuaire.User.Contacts"
......
......@@ -18,7 +18,6 @@ import Gargantext.Components.Nodes.Lists.Types as NTypes
import Gargantext.Ends (Frontends)
import Gargantext.Sessions (Session)
import Gargantext.Types (TabType(..), TabSubType(..), CTabNgramType(..), PTabNgramType(..))
import Gargantext.Utils.Reactix as R2
thisModule :: String
thisModule = "Gargantext.Components.Nodes.Annuaire.User.Contacts.Tabs"
......@@ -78,11 +77,17 @@ tabsCpt = R.hooksComponentWithModule thisModule "tabs" cpt
chart = mempty
totalRecords = 4736 -- TODO
docs = DT.docViewLayout
{ frontends, session, nodeId, chart, totalRecords
, tabType: TabPairing TabDocs
, listId: defaultListId
{ cacheState
, chart
, corpusId: Nothing
, showSearch: true }
, frontends
, listId: defaultListId
, nodeId
, session
, showSearch: true
, tabType: TabPairing TabDocs
, totalRecords
}
type NgramsViewTabsProps = (
......
......@@ -427,7 +427,7 @@ loadCorpus {nodeId, session} = do
loadCorpusWithChild :: Record LoadProps -> Aff CorpusData
loadCorpusWithChild {nodeId:childId, session} = do
loadCorpusWithChild { nodeId: childId, session } = do
-- fetch corpus via lists parentId
(NodePoly {parentId: corpusId} :: NodePoly {}) <- get session $ listNodeRoute childId ""
corpusNode <- get session $ corpusNodeRoute corpusId ""
......@@ -435,7 +435,7 @@ loadCorpusWithChild {nodeId:childId, session} = do
:: forall a. DecodeJson a => AffTableResult (NodePoly a)
case (A.head defaultListIds.docs :: Maybe (NodePoly HyperdataList)) of
Just (NodePoly { id: defaultListId }) ->
pure {corpusId, corpusNode, defaultListId}
pure { corpusId, corpusNode, defaultListId }
Nothing ->
throwError $ error "Missing default list"
where
......
......@@ -88,9 +88,9 @@ dashboardLayoutLoadedCpt = R.hooksComponentWithModule thisModule "dashboardLayou
where
cpt props@{ charts, corpusId, defaultListId, onChange, session } _ = do
pure $
H.div {} ([
H.h1 {} [ H.text "DashBoard" ]
] <> chartsEls <> [addNew])
H.div {} ([ H.h1 {} [ H.text "Board" ]
, H.p {} [ H.text "Summary of all your charts here" ]
] <> chartsEls <> [addNew])
where
addNew = H.div { className: "row" } [
H.span { className: "btn btn-default"
......
This diff is collapsed.
......@@ -8,6 +8,7 @@ import Data.Generic.Rep (class Generic)
import Data.Generic.Rep.Eq (genericEq)
import Data.Generic.Rep.Show (genericShow)
import Data.Maybe (Maybe(..))
import Gargantext.Components.Node (NodePoly)
import Gargantext.Prelude
......
This diff is collapsed.
module Gargantext.Components.Nodes.Lists where
import Data.Tuple (fst)
import Effect (Effect)
import Effect.Aff (launchAff_)
import Reactix as R
......@@ -59,15 +60,16 @@ listsLayoutWithKeyCpt = R.hooksComponentWithModule thisModule "listsLayoutWithKe
useLoader path loadCorpusWithChild $
\corpusData@{ corpusId, corpusNode: NodePoly poly, defaultListId } ->
let { date, hyperdata : Hyperdata h, name } = poly
CorpusInfo {desc,query,authors} = getCorpusInfo h.fields
in
let { date, hyperdata : Hyperdata h, name } = poly
CorpusInfo { authors, desc, query } = getCorpusInfo h.fields
in
R.fragment [
Table.tableHeaderLayout {
afterCacheStateChange
, cacheState
, date
, desc
, key: "listsLayoutWithKey-header-" <> (show $ fst cacheState)
, query
, title: "Corpus " <> name
, user: authors }
......@@ -76,6 +78,7 @@ listsLayoutWithKeyCpt = R.hooksComponentWithModule thisModule "listsLayoutWithKe
, cacheState
, corpusData
, corpusId
, key: "listsLayoutWithKey-tabs-" <> (show $ fst cacheState)
, session }
]
where
......
......@@ -5,6 +5,7 @@ import Data.Argonaut.Decode.Error (JsonDecodeError(..))
import Data.Either (Either(..))
import Data.Generic.Rep (class Generic)
import Data.Generic.Rep.Eq (genericEq)
import Data.Generic.Rep.Show (genericShow)
import Gargantext.Prelude
......@@ -26,3 +27,5 @@ instance decodeJsonCacheState :: DecodeJson CacheState where
instance encodeJsonCacheState :: EncodeJson CacheState where
encodeJson CacheOn = encodeJson "CacheOn"
encodeJson CacheOff = encodeJson "CacheOff"
instance showCacheState :: Show CacheState where
show = genericShow
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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