Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev Improvements #17

Merged
merged 9 commits into from
Nov 22, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 8,6 @@ __pycache__
*.coverage
.DS_Store
env.sh
migrations

tmp/
**/dataanalysis/dspoints/
Expand Down
2 changes: 2 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 5,8 @@ services:
image: mdillon/postgis
volumes:
- ./pgdata:/var/lib/postgresql/data
ports:
- 54320:5432

web:
build: .
Expand Down
45 changes: 43 additions & 2 deletions geoguide/client/static/src/pageEnvironment/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 10,40 @@ html, body {
}

.controlContainer {
padding-right: 10px;
padding-left: 10px;
padding-top: 10px;
padding-bottom: 10px;
pointer-events: none;
}

.controlContainer.horizontal {
width: calc(100% - 10px);
}

.control {
pointer-events: auto;
width: 32em;
background: #fff;
box-shadow: 0 1px 3px rgba(0,0,0,.15);
border: 2px solid #fff;
border-radius: 3px;
margin-bottom: 10px;
}

.control.simple {
padding: 0;
}

.control.simple .title {
padding: 0 5px;
line-height: 25px;
}

.control.simple .collapse {
margin: 1em 9px 9px 9px;
width: 30em;
}

.control .title {
margin-top: 0;
font-size: 1em;
Expand Down Expand Up @@ -70,12 89,34 @@ html, body {

#controlCharts {
max-height: 37em;
overflow-y: auto;
display: flex;
justify-content: space-around;
/*overflow-y: auto;*/
}

.custom-filters {
min-width: 10em;
width: initial;
max-width: initial;
margin-bottom: 0;
}

.custom-filters #controlCharts {
overflow-x: auto;
white-space: nowrap;
}

.chart {
height: 180px;
margin-bottom: 10px;
/* max-height: 180px;
width: 30%;
margin-bottom: 5px; */
display: inline-block;
}

.chart[hidden] {
display: none;
}

.reset {
Expand Down
30 changes: 23 additions & 7 deletions geoguide/client/static/src/pageEnvironment/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 27,25 @@ let isHeatMap = false
let isHeatMapCluster = false
let datasetData = {}
let datasetOptions = JSON.parse(document.querySelector('#dataset_json').innerHTML)
let datasetVisibleAttrs = datasetOptions.attributes.reduce((obj, i) => {
return { ...obj, [i.description]: i.visible }
}, {})
let datasetFilters = datasetOptions.headers;
let mouseTrackingCoordinates = []
let mouseTrackingMarkers = []
let chartsPerPage = 2
let chartsPerPage = 3
let currentChartIndex = 0
let mouseClusters = {}
let mousePolygons = []

modifiers.onColorModifierChange(e => {
refreshModifiers()
})

modifiers.onSizeModifierChange(e => {
refreshModifiers()
})

if (typeof(Storage) !== "undefined") {
let filename = JSON.parse(document.querySelector('#dataset_json').innerHTML).filename;
let ls;
Expand All @@ -47,7 58,7 @@ if (typeof(Storage) !== "undefined") {
"kvalue": document.getElementById("kvalue").value,
"onlyfilteredpoints": document.getElementById("onlyfilteredpoints").checked
};

} else {
ls = JSON.parse(localStorage.getItem(filename));

Expand Down Expand Up @@ -132,7 143,7 @@ const initMap = () => {
style: google.maps.MapTypeControlStyle.DROPDOWN_MENU
},
disableDefaultUI: true,
zoomControl: true,
zoomControl: false,
mapTypeControl: true,
zoomControlOptions: {
position: google.maps.ControlPosition.RIGHT_BOTTOM,
Expand Down Expand Up @@ -167,7 178,10 @@ const initMap = () => {
map.controls[google.maps.ControlPosition.TOP_RIGHT].push(heatMapDiv)

let customControlsLeftTopElement = document.getElementById('customControlsLeftTop')
map.controls[google.maps.ControlPosition.LEFT_TOP].push(customControlsLeftTopElement)
map.controls[google.maps.ControlPosition.TOP_RIGHT].push(customControlsLeftTopElement)

let customControlsBottomLeft = document.getElementById('customControlsBottomLeft')
map.controls[google.maps.ControlPosition.LEFT_BOTTOM].push(customControlsBottomLeft)

let dataset_url = document.querySelector('body').dataset['dataset']

Expand Down Expand Up @@ -349,13 363,12 @@ const getIcon = data => {

const addPoint = (data, index) => {
datasetData[data.geoguide_id] = data;

let contentString = `
<div id="infowindow${data.geoguide_id}">
<h4>Profile</h4>
<div style="max-height: 25em; overflow-y: auto; padding-bottom: 1em">
${Object.keys(data).map(key => {
if (data[key] === undefined || key === 'geoguide_id' || data[key] === '') {
if (data[key] === undefined || key === 'geoguide_id' || data[key] === '' || !datasetVisibleAttrs[key]) {
return
}

Expand All @@ -368,7 381,7 @@ const addPoint = (data, index) => {
return `<span><strong>${key}</strong>: <code>${value}</code></span><br>`
}).join('')}
</div>
<button type="button" class="btn btn-default" onclick="GeoGuide.showPotentialPoints(this)">Explore</button>
<button type="button" class="btn btn-default" onclick="GeoGuide.showPotentialPoints(this)">Highlight</button>
</div>
`

Expand Down Expand Up @@ -499,6 512,9 @@ const isDatasetReady = () => {
btnElement.removeAttribute('title')
}
}
datasetVisibleAttrs = datasetOptions.attributes.reduce((obj, i) => {
return { ...obj, [i.description]: i.visible }
}, {})
})
}
}
Expand Down
8 changes: 8 additions & 0 deletions geoguide/client/static/src/pageEnvironment/modifiers.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 46,14 @@ sizeModifierElement.addEventListener('change', e => {
sizeModifier = e.target.value
})

export const onColorModifierChange = f => {
colorModifierElement.addEventListener('change', f)
}

export const onSizeModifierChange = f => {
sizeModifierElement.addEventListener('change', f)
}

export const getColor = (data, isSelected, isIugaPoint) => {
let fillColor = normalfillColor

Expand Down
20 changes: 20 additions & 0 deletions geoguide/client/static/src/pageUpload/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 2,24 @@ import identifyLatLng from './attribute/identifyLatLng'
import identifyDatetime from './attribute/identifyDatetime'

import identifyNumberOfRows from './meta/identifyNumberOfRows'
import identifyFileName from './meta/identifyFileName'

const presentSelection = headers => {
const container = document.querySelector('#selectionAttrLabel').parentNode

const checkboxesToClean = document.querySelectorAll('.selection-attr')
if (checkboxesToClean.length > 0) checkboxesToClean.forEach(n => n.remove())

headers.forEach(h => {
let checkboxAttr = `<div class="selection-attr checkbox">
<label>
<input name="selectionAttrInputCheckbox" type="checkbox" value="${h}" checked> ${h}
</label>
</div>`
container.insertAdjacentHTML('beforeend', checkboxAttr)
})
container.removeAttribute('hidden')
}

const normalizeHeaders = headers => {
return headers.map(header => header.replace(/^"|"$/g, ''))
Expand All @@ -10,6 28,7 @@ const normalizeHeaders = headers => {
const identifyAttributes = (headers, values) => {
identifyDatetime(headers, values)
identifyLatLng(headers, values)
presentSelection(headers)
}

const identifyMeta = (contents) => {
Expand All @@ -33,6 52,7 @@ const readSingleFile = e => {
identifyAttributes(headers, values)
identifyMeta(contents)
}
identifyFileName(f)
r.readAsText(f)
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 1,7 @@
const identifyFileName = file => {
let filename = file.name.split('.')[0].split('-').join(' ')
let titleInputElement = document.getElementById('titleInputText')
titleInputElement.value = filename
}

export default identifyFileName
2 changes: 1 addition & 1 deletion geoguide/client/templates/_base.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 9,7 @@
<meta name="author" content="">
<meta name="viewport" content="width=device-width,initial-scale=1">
<!-- styles -->
<link rel="stylesheet" href="https://bootswatch.com/lumen/bootstrap.min.css">
<link rel="stylesheet" href="https://bootswatch.com/3/lumen/bootstrap.min.css">
{% block css %}{% endblock %}
</head>

Expand Down
Loading