Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
N
Nos Hs2023
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Språksamlingane
stadnamn
Nos Hs2023
Commits
336cb969
Commit
336cb969
authored
6 years ago
by
Esko Ikkala
Browse files
Options
Downloads
Patches
Plain Diff
Add result format options when the app is in oneColumView
parent
2dbe6f08
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/client/components/NavTabs.js
+13
-20
13 additions, 20 deletions
src/client/components/NavTabs.js
src/client/components/TopBar.js
+6
-1
6 additions, 1 deletion
src/client/components/TopBar.js
src/client/containers/MapApp.js
+89
-41
89 additions, 41 deletions
src/client/containers/MapApp.js
with
108 additions
and
62 deletions
src/client/components/NavTabs.js
+
13
−
20
View file @
336cb969
...
@@ -3,29 +3,22 @@ import PropTypes from 'prop-types';
...
@@ -3,29 +3,22 @@ import PropTypes from 'prop-types';
import
Tabs
from
'
@material-ui/core/Tabs
'
;
import
Tabs
from
'
@material-ui/core/Tabs
'
;
import
Tab
from
'
@material-ui/core/Tab
'
;
import
Tab
from
'
@material-ui/core/Tab
'
;
c
lass
NavTabs
extends
React
.
Component
{
c
onst
NavTabs
=
(
props
)
=>
{
state
=
{
const
handleChange
=
(
event
,
value
)
=
>
{
value
:
0
,
props
.
updateResultFormat
(
value
);
};
};
return
(
handleChange
=
(
event
,
value
)
=>
{
<
Tabs
value
=
{
props
.
resultFormat
}
onChange
=
{
handleChange
}
>
this
.
setState
({
value
});
<
Tab
value
=
"
table
"
label
=
"
Table
"
/>
};
<
Tab
value
=
"
map
"
label
=
"
Map
"
/>
<
Tab
value
=
"
statistics
"
label
=
"
Statistics
"
/>
render
()
{
<
/Tabs
>
const
{
value
}
=
this
.
state
;
);
return
(
};
<
Tabs
value
=
{
value
}
onChange
=
{
this
.
handleChange
}
>
<
Tab
label
=
"
Table
"
/>
<
Tab
label
=
"
Map
"
/>
<
Tab
label
=
"
Statistics
"
/>
<
/Tabs
>
);
}
}
NavTabs
.
propTypes
=
{
NavTabs
.
propTypes
=
{
resultView
:
PropTypes
.
string
,
resultFormat
:
PropTypes
.
string
.
isRequired
,
updateResultFormat
:
PropTypes
.
func
.
isRequired
};
};
export
default
NavTabs
;
export
default
NavTabs
;
This diff is collapsed.
Click to expand it.
src/client/components/TopBar.js
+
6
−
1
View file @
336cb969
...
@@ -108,7 +108,10 @@ class TopBar extends React.Component {
...
@@ -108,7 +108,10 @@ class TopBar extends React.Component {
<
img
className
=
{
classes
.
namesampoLogo
}
src
=
'
img/logos/namesampo.png
'
alt
=
'
NameSampo logo
'
/>
<
img
className
=
{
classes
.
namesampoLogo
}
src
=
'
img/logos/namesampo.png
'
alt
=
'
NameSampo logo
'
/>
{
this
.
props
.
oneColumnView
&&
{
this
.
props
.
oneColumnView
&&
<
div
className
=
{
classes
.
navTabs
}
>
<
div
className
=
{
classes
.
navTabs
}
>
<
NavTabs
/>
<
NavTabs
resultFormat
=
{
this
.
props
.
resultFormat
}
updateResultFormat
=
{
this
.
props
.
updateResultFormat
}
/
>
<
/div
>
<
/div
>
}
}
<
/Toolbar
>
<
/Toolbar
>
...
@@ -121,6 +124,8 @@ TopBar.propTypes = {
...
@@ -121,6 +124,8 @@ TopBar.propTypes = {
classes
:
PropTypes
.
object
.
isRequired
,
classes
:
PropTypes
.
object
.
isRequired
,
oneColumnView
:
PropTypes
.
bool
.
isRequired
,
oneColumnView
:
PropTypes
.
bool
.
isRequired
,
mapMode
:
PropTypes
.
string
.
isRequired
,
mapMode
:
PropTypes
.
string
.
isRequired
,
resultFormat
:
PropTypes
.
string
.
isRequired
,
updateResultFormat
:
PropTypes
.
func
.
isRequired
,
updateMapMode
:
PropTypes
.
func
.
isRequired
,
updateMapMode
:
PropTypes
.
func
.
isRequired
,
};
};
...
...
This diff is collapsed.
Click to expand it.
src/client/containers/MapApp.js
+
89
−
41
View file @
336cb969
...
@@ -76,6 +76,10 @@ const styles = theme => ({
...
@@ -76,6 +76,10 @@ const styles = theme => ({
height
:
'
50%
'
,
height
:
'
50%
'
,
borderBottom
:
'
4px solid
'
+
theme
.
palette
.
primary
.
main
,
borderBottom
:
'
4px solid
'
+
theme
.
palette
.
primary
.
main
,
},
},
fullMap
:
{
width
:
'
100%
'
,
height
:
'
100%
'
,
},
statistics
:
{
statistics
:
{
width
:
'
100%
'
,
width
:
'
100%
'
,
height
:
'
50%
'
,
height
:
'
50%
'
,
...
@@ -115,37 +119,95 @@ const styles = theme => ({
...
@@ -115,37 +119,95 @@ const styles = theme => ({
});
});
let
MapApp
=
(
props
)
=>
{
let
MapApp
=
(
props
)
=>
{
const
{
classes
,
mapMode
,
browser
}
=
props
;
const
{
classes
,
mapMode
,
resultFormat
,
browser
}
=
props
;
//error,
//error,
let
oneColumnView
=
true
;
let
oneColumnView
=
browser
.
lessThan
.
extraLarge
;
if
(
browser
.
greaterThan
.
extraLarge
)
{
oneColumnView
=
false
;
// console.log('oneColumnView', oneColumnView)
// console.log('resultFormat', resultFormat)
// console.log('mapMode', mapMode)
let
table
=
''
;
if
((
oneColumnView
&&
resultFormat
===
'
table
'
)
||
(
!
oneColumnView
))
{
table
=
(
<
div
className
=
{
oneColumnView
?
classes
.
resultTableOneColumn
:
classes
.
resultTable
}
>
<
VirtualizedTable
list
=
{
Immutable
.
List
(
props
.
results
)}
resultValues
=
{
props
.
resultValues
}
search
=
{
props
.
search
}
sortResults
=
{
props
.
sortResults
}
toggleDataset
=
{
props
.
toggleDataset
}
updateResultsFilter
=
{
props
.
updateResultsFilter
}
updateQuery
=
{
props
.
updateQuery
}
fetchResults
=
{
props
.
fetchResults
}
clearResults
=
{
props
.
clearResults
}
fetchSuggestions
=
{
props
.
fetchSuggestions
}
clearSuggestions
=
{
props
.
clearSuggestions
}
/
>
<
/div
>
);
}
}
let
map
=
''
;
let
map
=
''
;
if
(
mapMode
===
'
heatmap
'
)
{
if
((
oneColumnView
&&
resultFormat
===
'
map
'
)
||
(
!
oneColumnView
))
{
map
=
(
if
(
mapMode
===
'
heatmap
'
)
{
<
GMap
map
=
(
results
=
{
props
.
results
}
<
GMap
googleMapURL
=
"
https://maps.googleapis.com/maps/api/js?key=AIzaSyCKWw5FjhwLsfp_l2gjVAifPkT3cxGXhA4&v=3.exp&libraries=geometry,drawing,places,visualization
"
results
=
{
props
.
results
}
loadingElement
=
{
<
div
style
=
{{
height
:
`100%`
}}
/>
}
googleMapURL
=
"
https://maps.googleapis.com/maps/api/js?key=AIzaSyCKWw5FjhwLsfp_l2gjVAifPkT3cxGXhA4&v=3.exp&libraries=geometry,drawing,places,visualization
"
containerElement
=
{
<
div
style
=
{{
height
:
`100%`
}}
/>
}
loadingElement
=
{
<
div
style
=
{{
height
:
`100%`
}}
/>
}
mapElement
=
{
<
div
style
=
{{
height
:
`100%`
}}
/>
}
containerElement
=
{
<
div
style
=
{{
height
:
`100%`
}}
/>
}
/>
mapElement
=
{
<
div
style
=
{{
height
:
`100%`
}}
/>
}
/>
);
}
else
{
map
=
(
<
LeafletMap
sliderValue
=
{
100
}
results
=
{
props
.
results
}
geoJSON
=
{
props
.
geoJSON
}
geoJSONKey
=
{
props
.
geoJSONKey
}
getGeoJSON
=
{
props
.
getGeoJSON
}
mapMode
=
{
props
.
mapMode
}
/
>
);
}
}
let
statistics
=
''
;
if
((
oneColumnView
&&
resultFormat
===
'
statistics
'
)
||
(
!
oneColumnView
))
{
statistics
=
(
<
div
className
=
{
classes
.
statistics
}
>
<
Pie
data
=
{
props
.
results
}
groupBy
=
{
props
.
search
.
groupBy
}
query
=
{
props
.
search
.
query
}
/
>
<
/div
>
);
);
}
let
mainResultsView
=
''
;
if
(
oneColumnView
)
{
switch
(
props
.
resultFormat
)
{
case
'
table
'
:
{
mainResultsView
=
table
;
break
;
}
case
'
map
'
:
{
mainResultsView
=
(
<
div
className
=
{
classes
.
fullMap
}
>
{
map
}
<
/div
>
);
break
;
}
case
'
statistics
'
:
{
mainResultsView
=
statistics
;
break
;
}
}
}
else
{
}
else
{
map
=
(
mainResultsView
=
table
;
<
LeafletMap
sliderValue
=
{
100
}
results
=
{
props
.
results
}
geoJSON
=
{
props
.
geoJSON
}
geoJSONKey
=
{
props
.
geoJSONKey
}
getGeoJSON
=
{
props
.
getGeoJSON
}
mapMode
=
{
props
.
mapMode
}
/
>
);
}
}
// map = '';
// map = '';
return
(
return
(
...
@@ -154,32 +216,18 @@ let MapApp = (props) => {
...
@@ -154,32 +216,18 @@ let MapApp = (props) => {
<
TopBar
<
TopBar
oneColumnView
=
{
oneColumnView
}
oneColumnView
=
{
oneColumnView
}
mapMode
=
{
props
.
mapMode
}
mapMode
=
{
props
.
mapMode
}
resultFormat
=
{
props
.
resultFormat
}
updateMapMode
=
{
props
.
updateMapMode
}
updateMapMode
=
{
props
.
updateMapMode
}
updateResultFormat
=
{
props
.
updateResultFormat
}
/
>
/
>
<
div
className
=
{
classes
.
mainContainer
}
>
<
div
className
=
{
classes
.
mainContainer
}
>
<
div
className
=
{
oneColumnView
?
classes
.
resultTableOneColumn
:
classes
.
resultTable
}
>
{
mainResultsView
}
<
VirtualizedTable
list
=
{
Immutable
.
List
(
props
.
results
)}
resultValues
=
{
props
.
resultValues
}
search
=
{
props
.
search
}
sortResults
=
{
props
.
sortResults
}
toggleDataset
=
{
props
.
toggleDataset
}
updateResultsFilter
=
{
props
.
updateResultsFilter
}
updateQuery
=
{
props
.
updateQuery
}
fetchResults
=
{
props
.
fetchResults
}
clearResults
=
{
props
.
clearResults
}
fetchSuggestions
=
{
props
.
fetchSuggestions
}
clearSuggestions
=
{
props
.
clearSuggestions
}
/
>
<
/div
>
{
!
oneColumnView
&&
{
!
oneColumnView
&&
<
div
className
=
{
classes
.
rightColumn
}
>
<
div
className
=
{
classes
.
rightColumn
}
>
<
div
className
=
{
classes
.
map
}
>
<
div
className
=
{
classes
.
map
}
>
{
map
}
{
map
}
<
/div
>
<
/div
>
<
div
className
=
{
classes
.
statistics
}
>
{
statistics
}
<
Pie
data
=
{
props
.
results
}
groupBy
=
{
props
.
search
.
groupBy
}
query
=
{
props
.
search
.
query
}
/
>
<
/div
>
<
/div
>
<
/div
>
}
}
<
/div
>
<
/div
>
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment