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
133
Issues
133
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
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
gargantext
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
Pipeline
#1581
canceled with stage
Changes
6
Pipelines
1
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)
import Data.Maybe (Maybe(..))
import Data.Nullable (Nullable, null, toMaybe)
import Data.String.Utils (endsWith)
import Data.Tuple (fst, snd)
import Data.Tuple.Nested ((/\))
import Effect (Effect)
import FFI.Simple ((.=))
import Reactix as R
...
...
@@ -24,7 +22,6 @@ import Toestand as T
import Gargantext.Prelude
import Gargantext.Utils.HighlightJS as HLJS
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Toestand as T2
here :: R2.Here
here = R2.here "Gargantext.Components.CodeEditor"
...
...
@@ -214,8 +211,8 @@ toolbar p = R.createElement toolbarCpt p []
toolbarCpt :: R.Component ToolbarProps
toolbarCpt = here.component "toolbar" cpt
where
cpt
props@{ controls: { codeS, codeType, error
, viewType }
, onChange } _ = do
cpt
{ controls: { codeS, codeType
, viewType }
, onChange } _ = do
codeS' <- T.useLive T.unequal codeS
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
type ViewProps =
( corpus :: NodePoly Hyperdata
, reload :: T2.ReloadS
, nodeId :: Int
, reload :: T2.ReloadS
, session :: Session
)
corpusLayoutView :: Record ViewProps -> R.Element
corpusLayoutView props = R.createElement corpusLayoutViewCpt props []
corpusLayoutViewCpt :: R.Component ViewProps
corpusLayoutViewCpt = here.component "corpusLayoutView" cpt
where
...
...
@@ -449,8 +448,6 @@ changeCode onc (JSON j) CE.Markdown _ = onc $ Markdown $ defaultMarkdown' { text
text = R2.stringify (JSON.writeImpl j) 2
type LoadProps =
( nodeId :: Int
, session :: Session
...
...
@@ -470,7 +467,7 @@ type SaveProps = (
saveCorpus :: Record SaveProps -> Aff Unit
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
loadCorpus :: Record LoadProps -> Aff CorpusData
...
...
src/Gargantext/Components/Nodes/Corpus/Dashboard.purs
View file @
b9fb7988
...
...
@@ -51,7 +51,7 @@ dashboardLayoutWithKeyCpt = here.component "dashboardLayoutWithKey" cpt
reload' <- T.useLive T.unequal reload
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
dashboardLayoutLoaded { charts
, corpusId: parentId
...
...
@@ -86,7 +86,7 @@ dashboardLayoutLoaded = R.createElement dashboardLayoutLoadedCpt
dashboardLayoutLoadedCpt :: R.Component LoadedProps
dashboardLayoutLoadedCpt = here.component "dashboardLayoutLoaded" cpt
where
cpt
props@
{ charts, corpusId, defaultListId, fields, nodeId, onChange, session } _ = do
cpt { charts, corpusId, defaultListId, fields, nodeId, onChange, session } _ = do
pure $ H.div {}
[ dashboardCodeEditor { fields
, nodeId
...
...
@@ -130,7 +130,7 @@ dashboardCodeEditor = R.createElement dashboardCodeEditorCpt
dashboardCodeEditorCpt :: R.Component CodeEditorProps
dashboardCodeEditorCpt = here.component "dashboardCodeEditor" cpt
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
fieldsS <- T.useBox fieldsWithIndex
fields' <- T.useLive T.unequal fieldsS
...
...
@@ -173,12 +173,7 @@ dashboardCodeEditorCpt = here.component "dashboardCodeEditor" cpt
onClickSave :: forall e. FTFieldsWithIndex -> e -> Effect Unit
onClickSave (FTFieldsWithIndex fields') _ = do
here.log "saving (TODO)"
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 fieldsS _ = do
...
...
src/Gargantext/Components/Nodes/Dashboard/Types.purs
View file @
b9fb7988
...
...
@@ -4,16 +4,17 @@ import Gargantext.Prelude
import Data.Eq.Generic (genericEq)
import Data.Generic.Rep (class Generic)
import Data.List as List
import Data.Maybe (Maybe(..))
import Data.Newtype (class Newtype)
import Effect.Aff (Aff)
import Simple.JSON as JSON
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.Sessions (Session, get, put)
import Gargantext.Types (NodeType(..))
import Simple.JSON as JSON
type Preferences = Maybe String
...
...
@@ -50,7 +51,7 @@ type SaveProps = ( hyperdata :: Hyperdata | LoadProps )
saveDashboard :: Record SaveProps -> Aff Unit
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
newtype DashboardData =
...
...
src/Gargantext/Components/Nodes/Types.purs
View file @
b9fb7988
...
...
@@ -8,7 +8,6 @@ import Data.List as List
import Data.Maybe (Maybe, fromMaybe)
import Data.Newtype (class Newtype)
import Data.Show.Generic (genericShow)
import Data.Tuple (Tuple)
import Foreign as F
import Simple.JSON as JSON
...
...
src/Gargantext/Utils/JSON.purs
View file @
b9fb7988
...
...
@@ -37,7 +37,7 @@ readList f = do
readAtIdx i f' = withExcept (map (ErrorAtIndex i)) (JSON.readImpl f')
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 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