Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
H
haskell-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
Przemyslaw Kaminski
haskell-gargantext
Commits
17d5a026
Commit
17d5a026
authored
Jan 25, 2021
by
Przemyslaw Kaminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[dashboard] add 'fields' to hyperdata
parent
bea2c142
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
70 deletions
+25
-70
Public.hs
src/Gargantext/API/Public.hs
+10
-8
Corpus.hs
src/Gargantext/Database/Admin/Types/Hyperdata/Corpus.hs
+1
-61
Dashboard.hs
src/Gargantext/Database/Admin/Types/Hyperdata/Dashboard.hs
+14
-1
No files found.
src/Gargantext/API/Public.hs
View file @
17d5a026
...
...
@@ -23,23 +23,25 @@ import Data.List (replicate, null)
import
Data.Aeson
import
Data.Swagger
import
GHC.Generics
(
Generic
)
import
Servant
import
Test.QuickCheck
(
elements
)
import
Test.QuickCheck.Arbitrary
import
qualified
Data.List
as
List
import
qualified
Data.Map
as
Map
import
qualified
Data.Set
as
Set
import
Gargantext.API.Prelude
import
Gargantext.API.Node.File
import
Gargantext.Database.Query.Table.Node.Error
(
HasNodeError
(
..
))
import
Gargantext.Database.Prelude
import
Gargantext.Database.Admin.Types.Hyperdata
import
Gargantext.Database.Admin.Types.Hyperdata.CorpusField
import
Gargantext.Database.Admin.Types.Node
import
Gargantext.Database.Query.Table.NodeNode
(
selectPublicNodes
)
import
Gargantext.Core.Utils.DateUtils
(
utc2year
)
import
Gargantext.Database.Admin.Types.Hyperdata
import
Gargantext.Database.Schema.Node
-- (NodePoly(..))
import
Gargantext.Prelude
import
Servant
import
Test.QuickCheck
(
elements
)
import
Test.QuickCheck.Arbitrary
import
qualified
Data.List
as
List
import
qualified
Data.Map
as
Map
import
qualified
Data.Set
as
Set
------------------------------------------------------------------------
type
API
=
API_Home
...
...
src/Gargantext/Database/Admin/Types/Hyperdata/Corpus.hs
View file @
17d5a026
...
...
@@ -22,69 +22,9 @@ module Gargantext.Database.Admin.Types.Hyperdata.Corpus
where
import
Gargantext.Prelude
import
Gargantext.Database.Admin.Types.Hyperdata.CorpusField
import
Gargantext.Database.Admin.Types.Hyperdata.Prelude
data
CodeType
=
JSON
|
Markdown
|
Haskell
|
Python
deriving
(
Generic
,
Eq
)
instance
ToJSON
CodeType
instance
FromJSON
CodeType
instance
ToSchema
CodeType
------------------------------------------------------------------------
data
CorpusField
=
MarkdownField
{
_cf_text
::
!
Text
}
|
HaskellField
{
_cf_haskell
::
!
Text
}
|
PythonField
{
_cf_python
::
!
Text
}
|
JsonField
{
_cf_title
::
!
Text
,
_cf_desc
::
!
Text
,
_cf_query
::
!
Text
,
_cf_authors
::
!
Text
-- , _cf_resources :: ![Resource]
}
deriving
(
Generic
)
defaultCorpusField
::
CorpusField
defaultCorpusField
=
MarkdownField
"# Title"
------------------------------------------------------------------------
-- Instances
------------------------------------------------------------------------
$
(
makeLenses
''
C
orpusField
)
$
(
deriveJSON
(
unPrefix
"_cf_"
)
''
C
orpusField
)
instance
ToSchema
CorpusField
where
declareNamedSchema
proxy
=
genericDeclareNamedSchema
(
unPrefixSwagger
"_cf_"
)
proxy
&
mapped
.
schema
.
description
?~
"CorpusField"
&
mapped
.
schema
.
example
?~
toJSON
defaultCorpusField
------------------------------------------------------------------------
data
HyperdataField
a
=
HyperdataField
{
_hf_type
::
!
CodeType
,
_hf_name
::
!
Text
,
_hf_data
::
!
a
}
deriving
(
Generic
)
defaultHyperdataField
::
HyperdataField
CorpusField
defaultHyperdataField
=
HyperdataField
Markdown
"name"
defaultCorpusField
------------------------------------------------------------------------
-- Instances
------------------------------------------------------------------------
$
(
makeLenses
''
H
yperdataField
)
$
(
deriveJSON
(
unPrefix
"_hf_"
)
''
H
yperdataField
)
instance
(
Typeable
a
,
ToSchema
a
)
=>
ToSchema
(
HyperdataField
a
)
where
declareNamedSchema
proxy
=
genericDeclareNamedSchema
(
unPrefixSwagger
"_hf_"
)
proxy
&
mapped
.
schema
.
description
?~
"Hyperdata Field"
&
mapped
.
schema
.
example
?~
toJSON
defaultCorpusField
{-
declareNamedSchema =
wellNamedSchema "_hf_"
-- & mapped.schema.description ?~ "HyperdataField"
-- & mapped.schema.example ?~ toJSON defaultHyperdataField
-}
------------------------------------------------------------------------
data
HyperdataCorpus
=
HyperdataCorpus
{
_hc_fields
::
!
[
HyperdataField
CorpusField
]
}
...
...
src/Gargantext/Database/Admin/Types/Hyperdata/Dashboard.hs
View file @
17d5a026
...
...
@@ -23,18 +23,31 @@ module Gargantext.Database.Admin.Types.Hyperdata.Dashboard
import
Gargantext.Prelude
import
Gargantext.Database.Admin.Types.Hyperdata.Prelude
import
Gargantext.Database.Admin.Types.Hyperdata.CorpusField
------------------------------------------------------------------------
data
HyperdataDashboard
=
HyperdataDashboard
{
_hd_preferences
::
!
(
Maybe
Text
)
,
_hd_charts
::
!
[
Chart
]
,
_hd_fields
::
!
[
HyperdataField
CorpusField
]
}
deriving
(
Show
,
Generic
)
defaultHyperdataDashboard
::
HyperdataDashboard
defaultHyperdataDashboard
=
HyperdataDashboard
Nothing
[]
defaultHyperdataDashboard
=
HyperdataDashboard
Nothing
[]
defaultHyperdataDashboardFields
defaultHyperdataDashboardFields
::
[
HyperdataField
CorpusField
]
defaultHyperdataDashboardFields
=
[
HyperdataField
Markdown
"Corpus analysis"
(
MarkdownField
"# title
\n
## subtitle"
)
,
HyperdataField
JSON
"Metadata (Experts only)"
(
JsonField
"Title"
"Descr"
"Bool query"
"Authors"
)
]
------------------------------------------------------------------------
-- Instances
...
...
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