Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
purescript-gargantext
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Grégoire Locqueville
purescript-gargantext
Commits
b9fb7988
Commit
b9fb7988
authored
Jul 13, 2021
by
Przemyslaw Kaminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[simple-json] fix dashboard code saving
parent
c237ff21
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
13 additions
and
24 deletions
+13
-24
CodeEditor.purs
src/Gargantext/Components/CodeEditor.purs
+2
-5
Corpus.purs
src/Gargantext/Components/Nodes/Corpus.purs
+2
-5
Dashboard.purs
src/Gargantext/Components/Nodes/Corpus/Dashboard.purs
+3
-8
Types.purs
src/Gargantext/Components/Nodes/Dashboard/Types.purs
+5
-4
Types.purs
src/Gargantext/Components/Nodes/Types.purs
+0
-1
JSON.purs
src/Gargantext/Utils/JSON.purs
+1
-1
No files found.
src/Gargantext/Components/CodeEditor.purs
View file @
b9fb7988
...
@@ -9,8 +9,6 @@ import Data.Show.Generic (genericShow)
...
@@ -9,8 +9,6 @@ import Data.Show.Generic (genericShow)
import Data.Maybe (Maybe(..))
import Data.Maybe (Maybe(..))
import Data.Nullable (Nullable, null, toMaybe)
import Data.Nullable (Nullable, null, toMaybe)
import Data.String.Utils (endsWith)
import Data.String.Utils (endsWith)
import Data.Tuple (fst, snd)
import Data.Tuple.Nested ((/\))
import Effect (Effect)
import Effect (Effect)
import FFI.Simple ((.=))
import FFI.Simple ((.=))
import Reactix as R
import Reactix as R
...
@@ -24,7 +22,6 @@ import Toestand as T
...
@@ -24,7 +22,6 @@ import Toestand as T
import Gargantext.Prelude
import Gargantext.Prelude
import Gargantext.Utils.HighlightJS as HLJS
import Gargantext.Utils.HighlightJS as HLJS
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Toestand as T2
here :: R2.Here
here :: R2.Here
here = R2.here "Gargantext.Components.CodeEditor"
here = R2.here "Gargantext.Components.CodeEditor"
...
@@ -214,8 +211,8 @@ toolbar p = R.createElement toolbarCpt p []
...
@@ -214,8 +211,8 @@ toolbar p = R.createElement toolbarCpt p []
toolbarCpt :: R.Component ToolbarProps
toolbarCpt :: R.Component ToolbarProps
toolbarCpt = here.component "toolbar" cpt
toolbarCpt = here.component "toolbar" cpt
where
where
cpt
props@{ controls: { codeS, codeType, error
, viewType }
cpt
{ controls: { codeS, codeType
, viewType }
, onChange } _ = do
, onChange } _ = do
codeS' <- T.useLive T.unequal codeS
codeS' <- T.useLive T.unequal codeS
codeType' <- T.useLive T.unequal codeType
codeType' <- T.useLive T.unequal codeType
...
...
src/Gargantext/Components/Nodes/Corpus.purs
View file @
b9fb7988
...
@@ -119,14 +119,13 @@ corpusLayoutWithKeyCpt = here.component "corpusLayoutWithKey" cpt where
...
@@ -119,14 +119,13 @@ corpusLayoutWithKeyCpt = here.component "corpusLayoutWithKey" cpt where
type ViewProps =
type ViewProps =
( corpus :: NodePoly Hyperdata
( corpus :: NodePoly Hyperdata
, reload :: T2.ReloadS
, nodeId :: Int
, nodeId :: Int
, reload :: T2.ReloadS
, session :: Session
, session :: Session
)
)
corpusLayoutView :: Record ViewProps -> R.Element
corpusLayoutView :: Record ViewProps -> R.Element
corpusLayoutView props = R.createElement corpusLayoutViewCpt props []
corpusLayoutView props = R.createElement corpusLayoutViewCpt props []
corpusLayoutViewCpt :: R.Component ViewProps
corpusLayoutViewCpt :: R.Component ViewProps
corpusLayoutViewCpt = here.component "corpusLayoutView" cpt
corpusLayoutViewCpt = here.component "corpusLayoutView" cpt
where
where
...
@@ -449,8 +448,6 @@ changeCode onc (JSON j) CE.Markdown _ = onc $ Markdown $ defaultMarkdown' { text
...
@@ -449,8 +448,6 @@ changeCode onc (JSON j) CE.Markdown _ = onc $ Markdown $ defaultMarkdown' { text
text = R2.stringify (JSON.writeImpl j) 2
text = R2.stringify (JSON.writeImpl j) 2
type LoadProps =
type LoadProps =
( nodeId :: Int
( nodeId :: Int
, session :: Session
, session :: Session
...
@@ -470,7 +467,7 @@ type SaveProps = (
...
@@ -470,7 +467,7 @@ type SaveProps = (
saveCorpus :: Record SaveProps -> Aff Unit
saveCorpus :: Record SaveProps -> Aff Unit
saveCorpus {hyperdata, nodeId, session} = do
saveCorpus {hyperdata, nodeId, session} = do
id_
<- (put session (NodeAPI Corpus (Just nodeId) "") hyperdata) :: Aff Int
_id
<- (put session (NodeAPI Corpus (Just nodeId) "") hyperdata) :: Aff Int
pure unit
pure unit
loadCorpus :: Record LoadProps -> Aff CorpusData
loadCorpus :: Record LoadProps -> Aff CorpusData
...
...
src/Gargantext/Components/Nodes/Corpus/Dashboard.purs
View file @
b9fb7988
...
@@ -51,7 +51,7 @@ dashboardLayoutWithKeyCpt = here.component "dashboardLayoutWithKey" cpt
...
@@ -51,7 +51,7 @@ dashboardLayoutWithKeyCpt = here.component "dashboardLayoutWithKey" cpt
reload' <- T.useLive T.unequal reload
reload' <- T.useLive T.unequal reload
useLoader {nodeId, reload: reload', session} DT.loadDashboardWithReload $
useLoader {nodeId, reload: reload', session} DT.loadDashboardWithReload $
\(DT.DashboardData
dashboardData@{hyperdata: DT.Hyperdata h, parentId
}) -> do
\(DT.DashboardData
{ hyperdata: DT.Hyperdata h, parentId
}) -> do
let { charts, fields } = h
let { charts, fields } = h
dashboardLayoutLoaded { charts
dashboardLayoutLoaded { charts
, corpusId: parentId
, corpusId: parentId
...
@@ -86,7 +86,7 @@ dashboardLayoutLoaded = R.createElement dashboardLayoutLoadedCpt
...
@@ -86,7 +86,7 @@ dashboardLayoutLoaded = R.createElement dashboardLayoutLoadedCpt
dashboardLayoutLoadedCpt :: R.Component LoadedProps
dashboardLayoutLoadedCpt :: R.Component LoadedProps
dashboardLayoutLoadedCpt = here.component "dashboardLayoutLoaded" cpt
dashboardLayoutLoadedCpt = here.component "dashboardLayoutLoaded" cpt
where
where
cpt
props@
{ charts, corpusId, defaultListId, fields, nodeId, onChange, session } _ = do
cpt { charts, corpusId, defaultListId, fields, nodeId, onChange, session } _ = do
pure $ H.div {}
pure $ H.div {}
[ dashboardCodeEditor { fields
[ dashboardCodeEditor { fields
, nodeId
, nodeId
...
@@ -130,7 +130,7 @@ dashboardCodeEditor = R.createElement dashboardCodeEditorCpt
...
@@ -130,7 +130,7 @@ dashboardCodeEditor = R.createElement dashboardCodeEditorCpt
dashboardCodeEditorCpt :: R.Component CodeEditorProps
dashboardCodeEditorCpt :: R.Component CodeEditorProps
dashboardCodeEditorCpt = here.component "dashboardCodeEditor" cpt
dashboardCodeEditorCpt = here.component "dashboardCodeEditor" cpt
where
where
cpt
props@
{ fields: FTFieldList fields, nodeId, onChange, session } _ = do
cpt { fields: FTFieldList fields, nodeId, onChange, session } _ = do
let fieldsWithIndex = FTFieldsWithIndex $ List.mapWithIndex (\idx -> \ftField -> { idx, ftField }) fields
let fieldsWithIndex = FTFieldsWithIndex $ List.mapWithIndex (\idx -> \ftField -> { idx, ftField }) fields
fieldsS <- T.useBox fieldsWithIndex
fieldsS <- T.useBox fieldsWithIndex
fields' <- T.useLive T.unequal fieldsS
fields' <- T.useLive T.unequal fieldsS
...
@@ -173,12 +173,7 @@ dashboardCodeEditorCpt = here.component "dashboardCodeEditor" cpt
...
@@ -173,12 +173,7 @@ dashboardCodeEditorCpt = here.component "dashboardCodeEditor" cpt
onClickSave :: forall e. FTFieldsWithIndex -> e -> Effect Unit
onClickSave :: forall e. FTFieldsWithIndex -> e -> Effect Unit
onClickSave (FTFieldsWithIndex fields') _ = do
onClickSave (FTFieldsWithIndex fields') _ = do
here.log "saving (TODO)"
onChange $ FTFieldList $ (_.ftField) <$> fields'
onChange $ FTFieldList $ (_.ftField) <$> fields'
-- launchAff_ do
-- saveCorpus $ { hyperdata: Hyperdata {fields: (\(Tuple _ f) -> f) <$> fieldsS}
-- , nodeId
-- , session }
onClickAddField :: forall e. T.Box FTFieldsWithIndex -> e -> Effect Unit
onClickAddField :: forall e. T.Box FTFieldsWithIndex -> e -> Effect Unit
onClickAddField fieldsS _ = do
onClickAddField fieldsS _ = do
...
...
src/Gargantext/Components/Nodes/Dashboard/Types.purs
View file @
b9fb7988
...
@@ -4,16 +4,17 @@ import Gargantext.Prelude
...
@@ -4,16 +4,17 @@ import Gargantext.Prelude
import Data.Eq.Generic (genericEq)
import Data.Eq.Generic (genericEq)
import Data.Generic.Rep (class Generic)
import Data.Generic.Rep (class Generic)
import Data.List as List
import Data.Maybe (Maybe(..))
import Data.Maybe (Maybe(..))
import Data.Newtype (class Newtype)
import Data.Newtype (class Newtype)
import Effect.Aff (Aff)
import Effect.Aff (Aff)
import Simple.JSON as JSON
import Gargantext.Components.Nodes.Corpus.Chart.Predefined as P
import Gargantext.Components.Nodes.Corpus.Chart.Predefined as P
import Gargantext.Components.Nodes.Types (FTField, FTFieldList(..))
import Gargantext.Components.Nodes.Types (FTFieldList)
import Gargantext.Routes (SessionRoute(NodeAPI))
import Gargantext.Routes (SessionRoute(NodeAPI))
import Gargantext.Sessions (Session, get, put)
import Gargantext.Sessions (Session, get, put)
import Gargantext.Types (NodeType(..))
import Gargantext.Types (NodeType(..))
import Simple.JSON as JSON
type Preferences = Maybe String
type Preferences = Maybe String
...
@@ -50,7 +51,7 @@ type SaveProps = ( hyperdata :: Hyperdata | LoadProps )
...
@@ -50,7 +51,7 @@ type SaveProps = ( hyperdata :: Hyperdata | LoadProps )
saveDashboard :: Record SaveProps -> Aff Unit
saveDashboard :: Record SaveProps -> Aff Unit
saveDashboard {hyperdata, nodeId, session} = do
saveDashboard {hyperdata, nodeId, session} = do
id_
<- (put session (NodeAPI Node (Just nodeId) "") hyperdata) :: Aff Int
_id
<- (put session (NodeAPI Node (Just nodeId) "") hyperdata) :: Aff Int
pure unit
pure unit
newtype DashboardData =
newtype DashboardData =
...
...
src/Gargantext/Components/Nodes/Types.purs
View file @
b9fb7988
...
@@ -8,7 +8,6 @@ import Data.List as List
...
@@ -8,7 +8,6 @@ import Data.List as List
import Data.Maybe (Maybe, fromMaybe)
import Data.Maybe (Maybe, fromMaybe)
import Data.Newtype (class Newtype)
import Data.Newtype (class Newtype)
import Data.Show.Generic (genericShow)
import Data.Show.Generic (genericShow)
import Data.Tuple (Tuple)
import Foreign as F
import Foreign as F
import Simple.JSON as JSON
import Simple.JSON as JSON
...
...
src/Gargantext/Utils/JSON.purs
View file @
b9fb7988
...
@@ -37,7 +37,7 @@ readList f = do
...
@@ -37,7 +37,7 @@ readList f = do
readAtIdx i f' = withExcept (map (ErrorAtIndex i)) (JSON.readImpl f')
readAtIdx i f' = withExcept (map (ErrorAtIndex i)) (JSON.readImpl f')
writeList :: forall a. JSON.WriteForeign a => List.List a -> Foreign
writeList :: forall a. JSON.WriteForeign a => List.List a -> Foreign
writeList xs = unsafeToForeign $ JSON.writeImpl <$>
xs
writeList xs = unsafeToForeign $ JSON.writeImpl <$>
(List.toUnfoldable xs :: Array a)
readMapInt :: forall v. JSON.ReadForeign v => Foreign -> F (Map.Map Int v)
readMapInt :: forall v. JSON.ReadForeign v => Foreign -> F (Map.Map Int v)
readMapInt f = do
readMapInt f = do
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment