Compare commits
3 commits
bd7d412b97
...
f9d9923acf
| Author | SHA1 | Date | |
|---|---|---|---|
| f9d9923acf | |||
| eee2a1df65 | |||
| d65de5e8ce |
6 changed files with 124 additions and 3 deletions
10
CHANGELOG.md
10
CHANGELOG.md
|
|
@ -5,6 +5,16 @@ All notable changes to WuttaFarm will be documented in this file.
|
||||||
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
|
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
|
||||||
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
|
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
|
## v0.11.0 (2026-03-15)
|
||||||
|
|
||||||
|
### Feat
|
||||||
|
|
||||||
|
- show basic map for "fixed" assets
|
||||||
|
|
||||||
|
### Fix
|
||||||
|
|
||||||
|
- include LogQuantity changes when viewing Log revision
|
||||||
|
|
||||||
## v0.10.0 (2026-03-11)
|
## v0.10.0 (2026-03-11)
|
||||||
|
|
||||||
### Feat
|
### Feat
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ build-backend = "hatchling.build"
|
||||||
|
|
||||||
[project]
|
[project]
|
||||||
name = "WuttaFarm"
|
name = "WuttaFarm"
|
||||||
version = "0.10.0"
|
version = "0.11.0"
|
||||||
description = "Web app to integrate with and extend farmOS"
|
description = "Web app to integrate with and extend farmOS"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
authors = [
|
authors = [
|
||||||
|
|
@ -34,7 +34,7 @@ dependencies = [
|
||||||
"pyramid_exclog",
|
"pyramid_exclog",
|
||||||
"uvicorn[standard]",
|
"uvicorn[standard]",
|
||||||
"WuttaSync",
|
"WuttaSync",
|
||||||
"WuttaWeb[continuum]>=0.29.2",
|
"WuttaWeb[continuum]>=0.29.3",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,5 +10,74 @@
|
||||||
</b-notification>
|
</b-notification>
|
||||||
% endif
|
% endif
|
||||||
|
|
||||||
|
<div style="display: flex; margin-right: 0.5rem;">
|
||||||
|
|
||||||
|
## main form
|
||||||
|
<div style="flex-grow: 1;">
|
||||||
${parent.page_content()}
|
${parent.page_content()}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
## location map
|
||||||
|
% if map_polygon:
|
||||||
|
<div ref="map" style="flex-grow: 2; height: 500px;" />
|
||||||
|
% endif
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</%def>
|
||||||
|
|
||||||
|
<%def name="modify_vue_vars()">
|
||||||
|
${parent.modify_vue_vars()}
|
||||||
|
% if map_polygon:
|
||||||
|
<script>
|
||||||
|
|
||||||
|
ThisPageData.map = null
|
||||||
|
|
||||||
|
ThisPage.mounted = function() {
|
||||||
|
|
||||||
|
this.map = new maplibregl.Map({
|
||||||
|
container: this.$refs.map,
|
||||||
|
style: 'https://tiles.openfreemap.org/styles/liberty',
|
||||||
|
center: ${json.dumps(map_center)|n},
|
||||||
|
zoom: 16,
|
||||||
|
})
|
||||||
|
|
||||||
|
this.map.on('load', () => {
|
||||||
|
|
||||||
|
this.map.addSource('assetGeometry', {
|
||||||
|
'type': 'geojson',
|
||||||
|
'data': {
|
||||||
|
'type': 'Feature',
|
||||||
|
'geometry': {
|
||||||
|
'type': 'Polygon',
|
||||||
|
'coordinates': ${json.dumps(map_polygon)|n},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
this.map.addLayer({
|
||||||
|
'id': 'assetGeometry',
|
||||||
|
'source': 'assetGeometry',
|
||||||
|
'type': 'line',
|
||||||
|
'paint': {
|
||||||
|
'line-color': 'orange',
|
||||||
|
'line-width': 2,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
this.map.fitBounds(${json.dumps(map_bounds)|n}, {
|
||||||
|
linear: true,
|
||||||
|
})
|
||||||
|
|
||||||
|
this.map.addControl(new maplibregl.FullscreenControl())
|
||||||
|
this.map.addControl(new maplibregl.NavigationControl(), 'top-left')
|
||||||
|
this.map.addControl(new maplibregl.ScaleControl({
|
||||||
|
maxWidth: 80,
|
||||||
|
unit: 'imperial',
|
||||||
|
}))
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
</script>
|
||||||
|
% endif
|
||||||
</%def>
|
</%def>
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,16 @@
|
||||||
<%inherit file="wuttaweb:templates/base.mako" />
|
<%inherit file="wuttaweb:templates/base.mako" />
|
||||||
<%namespace file="/wuttafarm-components.mako" import="make_wuttafarm_components" />
|
<%namespace file="/wuttafarm-components.mako" import="make_wuttafarm_components" />
|
||||||
|
|
||||||
|
<%def name="head_tags()">
|
||||||
|
${parent.head_tags()}
|
||||||
|
|
||||||
|
## TODO: this likely does not belong in the base template, and should be
|
||||||
|
## included per template where actually needed. but this is easier for now.
|
||||||
|
<script src="https://unpkg.com/maplibre-gl@latest/dist/maplibre-gl.js"></script>
|
||||||
|
<link rel="stylesheet" href="https://unpkg.com/maplibre-gl@latest/dist/maplibre-gl.css" />
|
||||||
|
|
||||||
|
</%def>
|
||||||
|
|
||||||
<%def name="index_title_controls()">
|
<%def name="index_title_controls()">
|
||||||
${parent.index_title_controls()}
|
${parent.index_title_controls()}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,7 @@
|
||||||
Master view for Assets
|
Master view for Assets
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
import re
|
||||||
from collections import OrderedDict
|
from collections import OrderedDict
|
||||||
|
|
||||||
from webhelpers2.html import tags
|
from webhelpers2.html import tags
|
||||||
|
|
@ -359,6 +360,36 @@ class AssetMasterView(WuttaFarmMasterView):
|
||||||
|
|
||||||
return buttons
|
return buttons
|
||||||
|
|
||||||
|
def get_template_context(self, context):
|
||||||
|
context = super().get_template_context(context)
|
||||||
|
|
||||||
|
if self.viewing:
|
||||||
|
asset = context["instance"]
|
||||||
|
|
||||||
|
# add location geometry if applicable
|
||||||
|
if asset.is_fixed and asset.farmos_uuid and not self.app.is_standalone():
|
||||||
|
|
||||||
|
# TODO: eventually sync GIS data, avoid this API call?
|
||||||
|
client = get_farmos_client_for_user(self.request)
|
||||||
|
result = client.asset.get_id(asset.asset_type, asset.farmos_uuid)
|
||||||
|
geometry = result["data"]["attributes"]["intrinsic_geometry"]
|
||||||
|
|
||||||
|
context["map_center"] = [geometry["lon"], geometry["lat"]]
|
||||||
|
|
||||||
|
context["map_bounds"] = [
|
||||||
|
[geometry["left"], geometry["bottom"]],
|
||||||
|
[geometry["right"], geometry["top"]],
|
||||||
|
]
|
||||||
|
|
||||||
|
if match := re.match(
|
||||||
|
r"^POLYGON \(\((?P<points>[^\)]+)\)\)$", geometry["value"]
|
||||||
|
):
|
||||||
|
points = match.group("points").split(", ")
|
||||||
|
points = [[float(pt) for pt in pair.split(" ")] for pair in points]
|
||||||
|
context["map_polygon"] = [points]
|
||||||
|
|
||||||
|
return context
|
||||||
|
|
||||||
def get_version_joins(self):
|
def get_version_joins(self):
|
||||||
"""
|
"""
|
||||||
We override this to declare the relationship between the
|
We override this to declare the relationship between the
|
||||||
|
|
|
||||||
|
|
@ -491,6 +491,7 @@ class LogMasterView(WuttaFarmMasterView):
|
||||||
return super().get_version_joins() + [
|
return super().get_version_joins() + [
|
||||||
model.Log,
|
model.Log,
|
||||||
(model.LogAsset, "log_uuid", "uuid"),
|
(model.LogAsset, "log_uuid", "uuid"),
|
||||||
|
(model.LogQuantity, "log_uuid", "uuid"),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue