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

gluon-config-mode-geo-location-with-map: integrate a location picker map #1484

Conversation

2tata
Copy link
Contributor

@2tata 2tata commented Jul 18, 2018

This MR is a split of #1211
Its add an osm map into the config-mode (in case the clients computer has an internet connection).

screenshot_2018-07-18_07-00-21

Issue #58

  • export zoom level to site.conf.

  • check translation.

Signed-off-by: Jan-Tarek Butt tarek@ring0.de

@CodeFetch
Copy link
Contributor

Thank you for your work. We will surely have users entering more accurate coordinates with this.
I'd prefer checking for internet access using JavaScript instead of showing a broken map.
Is there a better way for translating such long sentences?
The package description should say „manually“.

@2tata
Copy link
Contributor Author

2tata commented Jul 18, 2018

On 07/18/18 22:47, Vincent Wiemann wrote:

Thank you for your work. We will surely have users entering more accurate coordinates with this.
I'd prefer checking for internet access using JavaScript instead of showing a broken map.

The map should only shown if the clients computer has an internet connection.
With older gluons its works but on master not... I have to check the load function again.

Is there a better way for translating such long sentences?
The package description should say „manually“.

There are multiple packages in one Makefile. I was discussing with @NeoRaider about various solutions and after few try`s I was landed on this solution. Which has less redundancy code and backward compatibility for people who would preferring the current solution without map.

@2tata
Copy link
Contributor Author

2tata commented Jul 18, 2018

@CodeFetch Now the map is only visible on internet connection.

@rotanid rotanid added 0. type: enhancement The changeset is an enhancement 3. topic: package Topic: Gluon Packages labels Jul 19, 2018
@@ -6,8 +6,62 @@ PKG_VERSION:=1
include ../gluon.mk

define Package/gluon-config-mode-geo-location
TITLE:=Set geographic location of a node
TITLE:=Set geographic location of a node manualy and share it.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"manually" with two "l"

DEPENDS:=+gluon-config-mode-core +gluon-node-info
endef

define Package/gluon-config-mode-geo-location-with-map
TITLE:=Set geographic location of a node manualy and share it, optionally show a map if internet available.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"manually" with two "l"
"if internet is available" (adding the "is")

"Koordinaten. Hier hast Du die Möglichkeit, "
"die Koordinaten händisch zu hinterlegen."
#ifdef WITHMAP
"Wenn dein Computer mit dem du den Router einrichtes am Internet angeschlossen ist, "
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"den Router einrichtest eine Internetverbindung hat,"

"die Koordinaten händisch zu hinterlegen."
#ifdef WITHMAP
"Wenn dein Computer mit dem du den Router einrichtes am Internet angeschlossen ist, "
"hast du die Möglichkeit auf der unten angezeigten Karte an die stelle zu klicken wo "
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Stelle" Großschreibung
"zu klicken wo" -> "zu klicken, an der"

#ifdef WITHMAP
"Wenn dein Computer mit dem du den Router einrichtes am Internet angeschlossen ist, "
"hast du die Möglichkeit auf der unten angezeigten Karte an die stelle zu klicken wo "
"der Router Stehen wird."
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"stehen" -> Kleinschreibung

"hast du die Möglichkeit auf der unten angezeigten Karte an die stelle zu klicken wo "
"der Router Stehen wird."
#endif
"Bitte berücksichtige das, das setzen einer Position die Netzwerk Qualität verbessern kann."
Copy link
Member

@rotanid rotanid Jul 19, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"berücksichtige, dass das Setzen"
"Netzwerkqualität"

@rubo77
Copy link
Contributor

rubo77 commented Jul 20, 2018

Do I still have to include this block in my site.conf then?

config_mode = {
            geo_location = {
                    map_lon = 52.951947558,
                    map_lat = 7.844238281,
                    olurl = 'http://osm.ffnw.de/.static/ol/OpenLayers.js',
                    show_altitude = true,
            },
},

I built your branch https://github.com/2tata/gluon/ with GLUON_BRANCH: gluon-config-mode-geo-location, but there is no map visible (without the extra block in site.conf)

Do I have to include more than just the package gluon-config-mode-geo-location in my site.mk?

I think you should add a site in the docs/ section or a README to the package to explain what there is to do to include this package.

@2tata
Copy link
Contributor Author

2tata commented Jul 20, 2018 via email

@rubo77
Copy link
Contributor

rubo77 commented Jul 20, 2018

If you want to have the map inside you need to include
gluon-config-mode-geo-location-with-map.

only that one? or do I have to add gluon-config-mode-geo-location too?

besides:

    olurl = 'http://osm.ffnw.de/.static/ol/OpenLayers.js'
    show_altitude = true,

there is a comma missing here

@2tata
Copy link
Contributor Author

2tata commented Jul 20, 2018 via email

@2tata
Copy link
Contributor Author

2tata commented Jul 20, 2018

Now, there is some doc available.

gluon-config-mode-geo-location-with-map
---------------------------------------

The package ``gluon-config-mode-geo-location-with-map`` will additionally and a
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"and" ? do you mean "add" ?

---------------------------------------

The package ``gluon-config-mode-geo-location-with-map`` will additionally and a
map where users can pick a position. This map will only shown if the users
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"only shown" -> "only be shown"


The package ``gluon-config-mode-geo-location-with-map`` will additionally and a
map where users can pick a position. This map will only shown if the users
computer will have an internet connection.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"will have" -> "has"

site.conf
^^^^^^^^^

This option is valid for both typ of package.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"typ of package" -> "package variants" <-- not sure though about the meaning

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your version sounds better.

- represents the default latitude center of the location picker map.
- defaults to ``0.0``

The above 2 options will usually shown on a factory flashed Router. If a node
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"shown" -> "be shown"

- defaults to ``0.0``

The above 2 options will usually shown on a factory flashed Router. If a node
is reenter the config mode the maps center will be on the last defined
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"is reenter" -> "re-enters" --> not 100% sure though
"the maps" -> "the map's" (genitiv s in english)
"will be" -> "is" (not sure though)

local pkg_i18n = i18n 'gluon-config-mode-geo-location'
local site_i18n = i18n 'gluon-site'

local site = require 'gluon.site'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

check indentation in this file please, this line and the lines before have a different indentation

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh yes, indeed ... wrong configuration in vim..


#endif

-- show altitude if site.json retruns true or nil and uci an value. Dont show if site.json retruns false or uci nil!
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

one space too mach indentation.
"retruns" -> "returns"
"Dont" -> "Don't"


#ifdef WITHMAP

'If your PC is connected to the internet you can also click on the map displayed below. ' ..
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"can" -> "may"

"If you want the location of your node to be displayed on the map, you can "
"enter its coordinates here. "
#ifdef WITHMAP
"If your PC is connected to the internet you can also click on the map displayed below. "
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"can" -> "may" (same as before)

#endif
"Please keep in mind setting a location can also enhance the network quality."
msgstr ""
"Um Deinen Router auf der Karte anzeigen zu können, benötigen wir seine "
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please search for "Deinen" and "Du" and make it all lowercase (if it's not the beginning of the sentence)
The uppercase version isn't valid anymore and hasn't been for many years - afaik.

"Plural-Forms: nplurals=2; plural=(n != 1);\n"

msgid ""
"If you want the location of your node to be displayed on the map, you can "
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"can" -> "may" (same as above)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you just mean the second "you can"

Copy link
Contributor

@rubo77 rubo77 Jul 21, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"If you want the location of your node to be displayed on the map, you may "

and this sencence is there 2 times.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think in the first sentence should be you can and in the second you may to have a stronger suggestion on the map.

"If you want the location of your node to be displayed on the map, you can "
"enter its coordinates here. "
#ifdef WITHMAP
"If your PC is connected to the internet you can also click on the map displayed below. "
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"can" -> "may" (same as above)

msgstr "Content-Type: text/plain; charset=UTF-8"

msgid ""
"If you want the location of your node to be displayed on the map, you can "
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"can" -> "may" (same as above)

Copy link
Contributor Author

@2tata 2tata Jul 20, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see my above question.

@2tata 2tata force-pushed the gluon-config-mode-geo-location-with-map branch from 480594f to 1b07343 Compare August 4, 2018 19:56
@2tata
Copy link
Contributor Author

2tata commented Aug 4, 2018

License is missing for OSM https://www.openstreetmap.org/copyright

Fixed in 1b07343

No option for own tiles

What do you mean? You have the option to set your own URL for your layers.

(No SSL for in default JS (Chrome 68 warning Not Secure - don't know if private IP has an exception)

Fixed in 1b07343 . All external URLs are now with SSL.

JS and tiles are hosted in US -> need to add/adjust privacy policy

How, do you know that?

@2tata
Copy link
Contributor Author

2tata commented Aug 6, 2018 via email

@rubo77
Copy link
Contributor

rubo77 commented Aug 6, 2018

Mal auf Deutsch:

Irgendwie ist das immer noch nicht so richtig logisch. "Disabled" Ist auch Quatsch, wenn man dann trotzdem sagen kann: "Share your location".

  • Was passiert denn genau bei den beiden Optionen jeweils?
  • Welche 3. Option ist geplant?
  • Was ist die Alternative zur Karte?

Vielleicht finden wir noch eine Formulierung, die auf alles passt.

@2tata
Copy link
Contributor Author

2tata commented Aug 7, 2018 via email

@rubo77
Copy link
Contributor

rubo77 commented Aug 7, 2018

Selectbox drop-downs sind immer unübersichtlich!

Da das Label ja schon "Geo-Position" ist, also am besten einfach nur eine Checkbox:

  • Geo position aktivieren

Die 3. Option kann man so später in einem anderen Modul hinzufügen:

  • Position automatisch bestimmen

und 4. noch später:

  • Position automatisch an service ... senden

@rubo77
Copy link
Contributor

rubo77 commented Aug 7, 2018

If there is no 3rd module, the whole first option must be hidden completely, or what sense is there to add coordinates into the node if you don't want to share it?

@rotanid
Copy link
Member

rotanid commented Aug 7, 2018

@rubo77 you may add these coordinates so people with remote access to the node can check its location. so there is a use case for adding coordinates without sharing them.

@rubo77
Copy link
Contributor

rubo77 commented Aug 7, 2018

That sounds not like a use case (who would want that and why? if you want to give the coordinates to womeone with root access to your node, you could simply put a text file on the console).

We should keep the config mode main page really simple, that is the main strength of Gluon compared to other firmwares.

So one checkbox to enter coordinates is enough.

If there later is an extra package, that makes sense to enter coordinates but keep them secret, then we should add the suggested extra checkbox, but only then.

@rotanid
Copy link
Member

rotanid commented Aug 7, 2018

@rubo77 sure, this PR doesn't have to introduce this if it isn't possible at the moment. i just wanted to add that you and me not having the use case doesn't mean there isn't any.

@neocturne
Copy link
Member

I've only had a short look at the code so far, but I don't like using the preprocessor to conditionalize code at all. I would like to clean this up a bit before it is merged (I might take care of it this weekend).

Copy link
Member

@neocturne neocturne left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are just two comments for future PRs. I've starting cleaning up a few things in the code, but I'm not finished yet.

uci:set("gluon-node-info", location, "altitude", altitude.data)
else
uci:delete("gluon-node-info", location, "altitude")
end
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is cargo-culting from luci.model.uci. With simple-uci, uci:set(p, s, o, nil) is equivalent to uci:delete(p, s, o), so you usually don't need to check where a value is set before passing it to uci:set.

uci:delete("gluon-node-info", location, "altitude")
uci:delete("gluon-node-info", location, "latitude")
uci:delete("gluon-node-info", location, "longitude")
uci:set("gluon-node-info", location, "share_location", 0)
Copy link
Member

@neocturne neocturne Aug 14, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't use numbers where a boolean is semantically saner (this is another thing you could not do with luci.model.uci).

@neocturne
Copy link
Member

I've finished my cleanup work: #1515

@rotanid rotanid closed this Aug 30, 2018
SvenRoederer added a commit to SvenRoederer/freifunk-gluon_core that referenced this pull request Sep 29, 2019
d6fd2c33b luci-app-travelmate: update Japanese translation
0e5d670d7 luci-app-travelmate: sync translations
8a199c3e1 luci-app-travelmate: sync with release 1.1.3
bf49505ea luci-base: properly handle undefined IPv6 local-address information
852ec6e28 luci-base, luci-mod-admin-full: store backup vars in luci configuration
68bdfc029 luci-app-adblock: fix the msgid to keep the translations
dcb041e39 luci-app-mwan3: remove css from javascript in overview_status_interface
5362f6970 luci-app-mwan3: Update header name in status pages
a73687022 luci-app-mwan3: remove duplicated code section
deba02e09 luci-app-mwan3: fix source styling
1ff26f380 luci-app-mwan3: remove css styling from status_interface page
a82e588c0 luci-app-mwan3: remove css styling from overview_status_interface page
3c86c6562 luci-app-mwan3: fix stack trace if no tacking_ip is set on interface add
d098a64e2 community-profiles: potsdam - changed SSID
391a7bfc0 luci-app-travelmate: sync with release 1.1.2
b1c5a4c07 luci-app-adblock: fix frontend typo
6ffb7056f luci-app-travelmate: sync with release 1.1.0
461df8b0d luci-base: do not assume a fixed host address in delegated prefix (freifunk-gluon#1484)
de4f1c904 luci-base: rework client side IP validation types and support "hostid" type
3e1e4d5eb luci-base: fix Lua-side ip6hostid() datatype validation
c21d22c01 i18n-ru: fixed russian translation
66b93ab78 luci-app-wman3: show info if mwan3 is not global enabled
4b0347d49 luci-app-mwan3: update look and feel interface status page
83cec9277 luci-app-mwan3: do not show mwan3 status in overview if not enabled
0c3bd5c53 luci-app-mwan3: update uci track entry to use /etc/init.d/mwan3 reload
325f6d413 luci-app-nlbwmon: update Japanese translation
d06865000 luci-app-uhttpd: update Japanese translation
770033dba luci-app-shadowsocks-libev: remove deprecated option disable_sni
28aafed47 luci-app-shadowsocks-libev: add no_delay to names_options_common
e6cfe35ba luci-mod-admin-full: prevent unknown sysctl key warnings on status page
71230d2b7 luci-app-adblock: fix XHMTL Markup
eae2f37b6 timezone data: update to 2018c
69932a934 luci-app-adblock: update Japanese translation
7d2326291 luci-app-adblock: sync translations
47e0990ea luci-app-adblock: sync with adblock 3.5.0
43589ae4d Fix freifunk-gluon#1609: luci-proto-wireguard placeholder wrongfully suggests default port
4567512bd i18n-ru: fixed and updated russian translation
f11b0c000 luci-app-travelmate fixed
7133c5101 i18n-ru: fixed and updated russian translation
1cd12c449 luci.app-ddns: Update to 2.4.9-1
d74ff878e i18n-ru: fixed and updated russian translation
870c176ca luci-app-simple-adblock: bugfix for service start/stop
61cf34428 fixed dynapoint.lua, there was no translation
1fd24f3fd luci-app-vpnbypass: better service start/stop
dbdb91e96 luci-app-firewall: zh-cn: Update Simplified Chinese translation
582ce1c69 fixed dynapoint.lua, there was no translation
c38117d2a luci-app-wman3: add license header to all files
72191b7e2 luci-app-mwan3: fix diagnostics dropdown menu entry
562a3e5b7 luci-app-mwan3: fix assert if route could not select by ubus
3467df984 i18n-ru: fixed simple-adblock strin&rus translation
1295b6ca3 i18n-ru: fixed russian translation
57fe3e839 luci-app-advanced-reboot: fixed bug on devices/board names with dashes in them
3a25e1503 i18n-ru: fixed
194e42913 luci-app-voice-core and -diag: remove from repo
7edc6f03f freifunk-p2pblock / luci-app-p2pblock: remove from repo
6a8ee2620 luci-app-diag-devinfo: remove from repo
5cc9df99e luci-app-ushare: remove from repo
d0441ee87 luci-app-radvd: remove from the repo
b2754db22 luci-app-pbx(-voicemail): remove from repo
8a929a955 i18n-sync base.po changes
bb87aac85 i18n-ru: Edits on the general pattern of Russian translation
706225070 luci-mod-admin-full: fix typos on dhcp page
dc71ae010 i18n-sync changes mwan3
@2tata 2tata deleted the gluon-config-mode-geo-location-with-map branch November 1, 2020 20:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0. type: enhancement The changeset is an enhancement 3. topic: package Topic: Gluon Packages
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants