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
137
Issues
137
List
Board
Labels
Milestones
Merge Requests
4
Merge Requests
4
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
76e18024
Commit
76e18024
authored
Mar 16, 2018
by
Abinaya Sudhir
Browse files
Options
Browse Files
Download
Plain Diff
pulled code
parents
ac67045d
dfb784a8
Changes
9
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
661 additions
and
662 deletions
+661
-662
AddCorpusview.purs
src/AddCorpusview.purs
+10
-5
Chart.purs
src/Chart.purs
+118
-114
DocView.purs
src/DocView.purs
+142
-118
Landing.purs
src/Landing.purs
+57
-176
Login.purs
src/Login.purs
+14
-9
Navigation.purs
src/Navigation.purs
+176
-118
PageRouter.purs
src/PageRouter.purs
+26
-16
SearchForm.purs
src/SearchForm.purs
+35
-36
UserPage.purs
src/UserPage.purs
+83
-70
No files found.
src/AddCorpusview.purs
View file @
76e18024
...
@@ -30,6 +30,7 @@ import Routing.Hash.Aff (setHash)
...
@@ -30,6 +30,7 @@ import Routing.Hash.Aff (setHash)
import Thermite (PerformAction, Render, Spec, _render, cotransform, focus, foreach, modifyState, simpleSpec, withState)
import Thermite (PerformAction, Render, Spec, _render, cotransform, focus, foreach, modifyState, simpleSpec, withState)
import Unsafe.Coerce (unsafeCoerce)
import Unsafe.Coerce (unsafeCoerce)
import Landing as L
type State =
type State =
...
@@ -61,7 +62,10 @@ data Action
...
@@ -61,7 +62,10 @@ data Action
| GO
| GO
performAction :: forall eff props. PerformAction (console :: CONSOLE, ajax :: AJAX,dom::DOM | eff) State props Action
performAction :: forall eff props. PerformAction ( console :: CONSOLE
, ajax :: AJAX
, dom :: DOM
| eff ) State props Action
performAction NoOp _ _ = void do
performAction NoOp _ _ = void do
modifyState id
modifyState id
...
@@ -91,7 +95,8 @@ addcorpusviewSpec = simpleSpec performAction render
...
@@ -91,7 +95,8 @@ addcorpusviewSpec = simpleSpec performAction render
render :: Render State props Action
render :: Render State props Action
render dispatch _ state _ =
render dispatch _ state _ =
[
[
div [className "container"]
div [className "container"] [L.jumboTitle false]
, div [className "container"]
[
[
div [className "jumbotron"]
div [className "jumbotron"]
[ div [className "row"]
[ div [className "row"]
...
...
src/Chart.purs
View file @
76e18024
...
@@ -51,9 +51,9 @@ type EchartsProps eff =
...
@@ -51,9 +51,9 @@ type EchartsProps eff =
option :: Option, -- PropTypes.object.isRequired,
option :: Option, -- PropTypes.object.isRequired,
initOpts :: String, -- PropTypes.object,
initOpts :: String, -- PropTypes.object,
notMerge :: Boolean,
notMerge :: Boolean,
lazyUpdate:: Boolean,
lazyUpdate
:: Boolean,
loading :: Boolean,
loading :: Boolean,
optsLoading
::
OptsLoading, -- PropTypes.object,
optsLoading
::
OptsLoading, -- PropTypes.object,
onReady :: String, -- PropTypes.func,
onReady :: String, -- PropTypes.func,
resizable :: Boolean, -- PropTypes.bool,
resizable :: Boolean, -- PropTypes.bool,
onEvents :: String -- PropTypes.object
onEvents :: String -- PropTypes.object
...
@@ -63,7 +63,7 @@ type OptsLoading =
...
@@ -63,7 +63,7 @@ type OptsLoading =
{ text :: String,
{ text :: String,
color :: Color, --- color
color :: Color, --- color
textColor :: Color, --color
textColor :: Color, --color
maskColor:: Color, --color
maskColor
:: Color, --color
zlevel :: Int
zlevel :: Int
}
}
...
@@ -80,11 +80,11 @@ type Option =
...
@@ -80,11 +80,11 @@ type Option =
type DataZoom =
type DataZoom =
{"type":: String
{"type"
:: String
, xAxisIndex:: Int
, xAxisIndex
:: Int
, filterMode:: String
, filterMode
:: String
, start:: Int
, start
:: Int
, end:: Int
, end
:: Int
}
}
type Grid =
type Grid =
...
@@ -116,7 +116,7 @@ type Legend =
...
@@ -116,7 +116,7 @@ type Legend =
}
}
type Data =
type Data =
{
name
:: String
{
name
:: String
, icon :: String
, icon :: String
, textStyle :: {}
, textStyle :: {}
}
}
...
@@ -173,7 +173,7 @@ type AxisLabel =
...
@@ -173,7 +173,7 @@ type AxisLabel =
type Series =
type Series =
{
name
:: String
{
name
:: String
, "type" :: String
, "type" :: String
, "data" :: Array Int
, "data" :: Array Int
}
}
...
@@ -373,16 +373,20 @@ yAxisIndex = unsafeMkProps "yAxisIndex"
...
@@ -373,16 +373,20 @@ yAxisIndex = unsafeMkProps "yAxisIndex"
-- , p''
-- , p''
-- ]
-- ]
ex1
:: ReactElement
histogram
:: ReactElement
ex1
= echarts
histogram
= echarts
[ option
[ option
[ tooltip [trigger "axis"]
[ tooltip [trigger "axis"]
, grid [containLabel true]
, grid [containLabel true]
, legend [data' ["Query A", "Query B", "Query C"]]
, legend [data' ["Map terms coverage", "Favorites", "All"]]
-- , legend [data' ["Map Terms coverage", "Favorites", "All"]]
, xAxis
, xAxis
[ type' "category"
[ type' "category"
, axisTick [alignWithLabel true]
, axisTick [alignWithLabel true]
, data' ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "July", "Aug", "Sep", "Oct", "Nov", "Dec"]
, data' ["Jan" , "Feb", "Mar" , "Apr"
, "May", "Jun", "July", "Aug"
, "Sep", "Oct", "Nov" , "Dec"
]
]
]
, dataZoom [dz1,dz1,dz2,dz2]
, dataZoom [dz1,dz1,dz2,dz2]
, yAxis [ya1, ya2]
, yAxis [ya1, ya2]
...
@@ -408,22 +412,22 @@ dz2 = unsafeFromPropsArray
...
@@ -408,22 +412,22 @@ dz2 = unsafeFromPropsArray
ya1 = unsafeFromPropsArray
ya1 = unsafeFromPropsArray
[ type' "value"
[ type' "value"
, name "
Publications (by year)
"
, name "
Score metric
"
, min 0
, min 0
, position "
lef
t"
, position "
righ
t"
, axisLabel [formatter "{value}"]
, axisLabel [formatter "{value}"]
]
]
ya2 = unsafeFromPropsArray
ya2 = unsafeFromPropsArray
[ type' "value"
[ type' "value"
, name "
Score metric
"
, name "
Publications (by year)
"
, min 0
, min 0
, position "
righ
t"
, position "
lef
t"
, axisLabel [formatter "{value}"]
, axisLabel [formatter "{value}"]
]
]
sd1 = unsafeFromPropsArray
sd1 = unsafeFromPropsArray
[ name "
Query A
"
[ name "
Map terms coverage
"
, type' "line"
, type' "line"
, label [normal[showp true, position "top"]]
, label [normal[showp true, position "top"]]
, lineStyle [ normal
, lineStyle [ normal
...
@@ -432,26 +436,26 @@ sd1 = unsafeFromPropsArray
...
@@ -432,26 +436,26 @@ sd1 = unsafeFromPropsArray
, shadowBlur 10
, shadowBlur 10
, shadowOffsetY 10
, shadowOffsetY 10
]]
]]
, data' [
1, 13, 37, 35, 15, 13, 25, 21, 6, 45, 32, 2
]
, data' [
95, 80, 75, 35, 30, 50, 70, 80, 95, 95, 95, 99
]
]
]
sd
2
= unsafeFromPropsArray
sd
3
= unsafeFromPropsArray
[ name "
Query B
"
[ name "
All
"
, type' "bar"
, type' "bar"
, label [normal[showp true, position "top"]]
, label [normal[showp true, position "top"]]
, yAxisIndex 1
, yAxisIndex 1
, data' [2
2, 22, 23, 77, 24, 55, 55, 89, 98, 164, 106, 2
24]
, data' [2
01, 222, 223, 777, 244, 255, 555, 879, 938, 1364, 1806, 23
24]
]
]
sd3 = unsafeFromPropsArray
[ name "Query C"
sd2 = unsafeFromPropsArray
[ name "Favorites"
, type' "bar"
, type' "bar"
, label [normal[showp true, position "top"]]
, label [normal[showp true, position "top"]]
, yAxisIndex 1
, yAxisIndex 1
, data' [2
01, 222, 223, 777, 244, 255, 555, 879, 938, 1364, 1806, 23
24]
, data' [2
2, 22, 23, 77, 24, 55, 139, 350, 150, 164, 106, 2
24]
]
]
p'' :: ReactElement
p'' :: ReactElement
p'' = p [] []
p'' = p [] []
src/DocView.purs
View file @
76e18024
This diff is collapsed.
Click to expand it.
src/Landing.purs
View file @
76e18024
This diff is collapsed.
Click to expand it.
src/Login.purs
View file @
76e18024
...
@@ -26,6 +26,9 @@ import Thermite (PerformAction, Render, Spec, modifyState, simpleSpec)
...
@@ -26,6 +26,9 @@ import Thermite (PerformAction, Render, Spec, modifyState, simpleSpec)
import Unsafe.Coerce (unsafeCoerce)
import Unsafe.Coerce (unsafeCoerce)
-- TODO: ask for login (modal) or account creation after 15 mn when user is not logged and has made one search at least
newtype State = State
newtype State = State
{ username :: String
{ username :: String
, password :: String
, password :: String
...
@@ -49,7 +52,11 @@ data Action
...
@@ -49,7 +52,11 @@ data Action
| SetPassword String
| SetPassword String
performAction :: forall eff props. PerformAction (console :: CONSOLE, ajax :: AJAX,dom::DOM | eff) State props Action
performAction :: forall eff props. PerformAction ( console :: CONSOLE
, ajax :: AJAX
, dom :: DOM
| eff
) State props Action
performAction NoOp _ _ = void do
performAction NoOp _ _ = void do
modifyState id
modifyState id
...
@@ -150,16 +157,14 @@ getDeviseID :: forall eff. Eff (dom :: DOM | eff) (Maybe String)
...
@@ -150,16 +157,14 @@ getDeviseID :: forall eff. Eff (dom :: DOM | eff) (Maybe String)
getDeviseID = do
getDeviseID = do
w <- window
w <- window
ls <- localStorage w
ls <- localStorage w
i <- getItem "token" ls
getItem "token" ls
pure $ i
setToken :: forall e . String -> Eff (dom :: DOM | e) Unit
setToken :: forall e . String -> Eff (dom :: DOM | e) Unit
setToken s = do
setToken s = do
w <- window
w <- window
ls <- localStorage w
ls <- localStorage w
liftEff $ setItem "token" s ls
setItem "token" s ls
pure unit
...
...
src/Navigation.purs
View file @
76e18024
This diff is collapsed.
Click to expand it.
src/PageRouter.purs
View file @
76e18024
...
@@ -53,7 +53,17 @@ routing =
...
@@ -53,7 +53,17 @@ routing =
home = Home <$ lit ""
home = Home <$ lit ""
route str = lit "" *> lit str
route str = lit "" *> lit str
routeHandler :: forall e. (Maybe Routes -> Routes -> Eff ( dom :: DOM, console :: CONSOLE | e) Unit) -> Maybe Routes -> Routes -> Eff (dom :: DOM, console :: CONSOLE | e) Unit
routeHandler :: forall e. ( Maybe Routes -> Routes -> Eff
( dom :: DOM
, console :: CONSOLE
| e
) Unit
) -> Maybe Routes -> Routes -> Eff
( dom :: DOM
, console :: CONSOLE
| e
) Unit
routeHandler dispatchAction old new = do
routeHandler dispatchAction old new = do
liftEff $ log $ "change route : " <> show new
liftEff $ log $ "change route : " <> show new
w <- window
w <- window
...
...
src/SearchForm.purs
View file @
76e18024
...
@@ -6,11 +6,12 @@ import Control.Monad.Cont.Trans (lift)
...
@@ -6,11 +6,12 @@ import Control.Monad.Cont.Trans (lift)
import DOM (DOM)
import DOM (DOM)
import Network.HTTP.Affjax (AJAX)
import Network.HTTP.Affjax (AJAX)
import Prelude hiding (div)
import Prelude hiding (div)
import React.DOM (br', button, div, h3, input, text)
import React.DOM (br', button, div, h3, input, text
, i, span, img
)
import React.DOM.Props (_id, _type, className, name, onClick, onInput, placeholder, value)
import React.DOM.Props (_id, _type, className, name, onClick, onInput, placeholder, value
, aria, src, title
)
import Routing.Hash.Aff (setHash)
import Routing.Hash.Aff (setHash)
import Thermite (PerformAction, Render, Spec, modifyState, simpleSpec)
import Thermite (PerformAction, Render, Spec, modifyState, simpleSpec)
import Unsafe.Coerce (unsafeCoerce)
import Unsafe.Coerce (unsafeCoerce)
import Landing as L
type State =
type State =
{
{
...
@@ -47,43 +48,41 @@ performAction GO _ _ = void do
...
@@ -47,43 +48,41 @@ performAction GO _ _ = void do
unsafeEventValue :: forall event. event -> String
unsafeEventValue :: forall event. event -> String
unsafeEventValue e = (unsafeCoerce e).target.value
unsafeEventValue e = (unsafeCoerce e).target.value
-- TODO: case loggedIn of True -> Just Tree ; False -> Nothing
-- TODO: put the search form in the center of the page
searchSpec :: forall props eff . Spec ( console :: CONSOLE
searchSpec :: forall props eff . Spec (console::CONSOLE, ajax::AJAX, dom::DOM | eff) State props Action
, ajax :: AJAX
, dom :: DOM
| eff
) State props Action
searchSpec = simpleSpec performAction render
searchSpec = simpleSpec performAction render
where
where
render :: Render State props Action
render :: Render State props Action
render dispatch _ state _ =
render dispatch _ state _ =
[
[ div [className "container"] [L.jumboTitle false]
div [className "container"]
, div [className "container"]
[
[ div [className "jumbotron" ]
div [className "jumbotron"]
[ div [className "row" ]
[
[ div [className "col-md-10" ]
div [className "row"]
[
div [className "col-md-10"]
[ br' []
[ br' []
, br' []
, br' []
, div [className "form-group"]
, div [ className "form-group"]
[
[ input [ className "form-control"
input [className "form-control",
, _id "id_password"
_id "id_password",
, name "query"
name "query",
, placeholder "Query, URL or FILE (works best with Firefox or Chromium browsers)"
placeholder "Enter Query",
, _type "text"
_type "text",
, value state.query
value state.query,
, onInput \e -> dispatch (SetQuery (unsafeEventValue e))
onInput \e -> dispatch (SetQuery (unsafeEventValue e))
] []
] []
, br'[]
, br'[]
]
]
]
]
, div [
className "col-md-2"]
, div [
className "col-md-2"]
[ br' []
[ br' []
, br' []
, br' []
-- TODO put Gargantext logo as search button
, button [onClick \_ -> dispatch GO] [text "GO"]
, button [onClick \_ -> dispatch GO] [text "GO"]
]
]
, br' []
]
]
]
]
]
]
...
...
src/UserPage.purs
View file @
76e18024
This diff is collapsed.
Click to expand it.
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