southern-wind / wind

WiND is a Web application for managing a database of wireless nodes.
GNU Affero General Public License v3.0
7 stars 5 forks source link

Different styled lines for different link types on maps #18

Open spinza opened 8 years ago

spinza commented 8 years ago

Our members loved this about our old wind. We had different styled lines for our map based on the link type. Better links being more prominent.

Ideally the style should be configurable in the config/config.php. @MDE186 is going to look at this for us.

jammin84 commented 8 years ago

The current mapping shows it as per the node "status", but I can see the proposed method being of value also.

I also agree to these being configurable.

FYI @MDE186. its currently found in /templates/basic//scripts/javascripts/map.js

            // Color mapping for nodes
            var colors_per_type = {
                'p2p' : '#f5c70c',
                'p2p-ap' : '#f5c70c',
                'ap' : '#61d961',
                'client' : '#5858ff',
                'unlinked' : '#ff3f4f',
            };

and a bit further down the link colours.

            properties['color'] = (link['status'] == 'active')
                ?'#0099FF' //blue line link color
                :'#FF8C95'; //red

Note: WAFN use a modified red as above rather than the #ff0000 in the original code, which was chosen for its readability.

jammin84 commented 8 years ago

@spinza can you expand on what "Better links" are classified as?

I presume its not a measurement of signal quality.

spinza commented 8 years ago

Our colours were/will be based on the link protocol:

IEEE 802.11b
IEEE 802.11g
IEEE 802.11a
IEEE 802.11n
IEEE 802.11n Dual chain
IEEE 802.11ac
IEEE 802.3i (Ethernet)
IEEE 802.3u (Fast Ethernet)
IEEE 802.3ab (Gigabit Ethernet)

They will have different colours/thickness. Obviously most of these are wireless though we have some nodes connected via ethernet (that are very close to each other).

jammin84 commented 8 years ago

ahh. nice one!

JSON data for the query is /wind/index.php/map/json?node=0&filter=p2p,ap,client

you'll need to add in the link info. in the following file. includes/pages/map/map_json.php

jammin84 commented 8 years ago

hrmm .. one question. where do you record that information in WiND?

The closest I can see is "link type"

spinza commented 8 years ago

Under edit link: You have link-type, peer node, access point and protocol. It's the protocol field. Not sure if the options have been bastardised on our install?

jammin84 commented 8 years ago

ahh yes. I'd looked at a client link yesterday, whereas it only shows as an option on the AP side.

MDE186 commented 8 years ago

Made lots of progress. Question @spinza does the current ctwug database have a 'protocol' column under nodes?

spinza commented 8 years ago

@MDE186 you should design based on the database here. Specifically this: https://github.com/southern-wind/wind/blob/master/install/schema.sql#L157

Our live database is probably not 100% match to this though. But we need to fix [our live] database if you make the changes. I can't look now but our live database should have protocol on the links table.

I think we may need to fix the names to be as per the current scheme.sql though.

MDE186 commented 8 years ago

Its all good...found what I was looking for.

MDE186 commented 8 years ago

Howzit. So..I have completed the link colours. Just wanting to know if you want different link thickness's as well.

link_colours

spinza commented 8 years ago

Cool. How is that implemented? Is it a config setting?

I think a config setting based on the link protocols with thickness, colour and visibility (active/inactive) would be absolutely awesome.

On Wed, 24 Feb 2016 at 18:40 MDE186 notifications@github.com wrote:

Howzit. So..I have completed the link colours. Just wanting to know if you want different link thickness's as well.

[image: link_colours] https://cloud.githubusercontent.com/assets/8092312/13292849/1030deb6-db26-11e5-8074-25bce55f3558.png

— Reply to this email directly or view it on GitHub https://github.com/southern-wind/wind/issues/18#issuecomment-188344142.

jammin84 commented 8 years ago

looking great. I agree about a config setting .. either stored in db or the config.php file.

MDE186 commented 8 years ago

At the moment its just hard coded. I'll look at implementing it into the db and also changeable via the admin panel.

MDE186 commented 8 years ago

Sorry its taking so long...can only really work once the pregnant wife and 2yr old have gone to bed :)

jammin84 commented 8 years ago

Seriously. No stress dude.

Family first always.

spinza commented 8 years ago

:+1:

spinza commented 8 years ago

@MDE186 have you had a chance to look at this while awake at odd hours? :baby_bottle:

MDE186 commented 8 years ago

Hey,

Unfortunately not. Not sure when I'll have some extra time. I can send through the basics of what's been done? On 26 May 2016 14:16, "spin" notifications@github.com wrote:

@MDE186 https://github.com/MDE186 have you had a chance to look at this while awake at odd hours?

— You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub https://github.com/southern-wind/wind/issues/18#issuecomment-221854832

spinza commented 8 years ago

Got @MDE186 's code.

I can implement it but it's dependent on having a set protocol list in the protocols table. He has a if else if else hard coded.

I think I will change his way of doing things by adding a colour field to the protocol table so we can simply edit the colour in the database. If no colour is set it will default to the blue it uses currently.

Happy with that approach @jammin84 ?

jammin84 commented 8 years ago

Hi @spinza

Looking at the schema.sql file. It appears that there is no "protocol table", it is just a "enum" list within the table "links", so while i like the "adding a row" idea, the current db design doesn't allow for it.

There is also no admin interface in WiND for changing these either. So even changing the enum list is purely db.

I think it best if its stored in either:

id option_type data value
1 link_colours IEEE 802.11b #333
2 link_colours IEEE 802.11b #666
    $config[link_colours][IEEE 802.11b] = #333;
    $config[link_colours][IEEE 802.11b ] = #666;

Then whichever option you just compare the link type if it is in the array or default back to blue as you've mentioned

$link_protocol_color = (isset ($config['link_colours'][ $protocol_type ]) 
    ? $config['link_colours'][ $protocol_type ] 
    : $default_link_color );
spinza commented 8 years ago

Doh thought it was a table.

On Mon, 27 Jun 2016, 04:30 jammin84 notifications@github.com wrote:

Hi @spinza https://github.com/spinza

Looking at the schema.sql file. It appears that there is no "protocol table", it is just a "enum" list within the table "links", so while i like the "adding a row" idea, the current db design doesn't allow for it.

There is also no admin interface in WiND for changing these either. So even changing the enum list is purely db.

I think it best if its stored in either:

  • a new "options" table (which could also hold other future data)

id option_type data value 1 link_colours IEEE 802.11b #333 2 link_colours IEEE 802.11b #666

  • or within the "$config" array.

    $config[link_colours][IEEE 802.11b] = #333; $config[link_colours][IEEE 802.11b ] = #666;

Then whichever option you just compare the link type if it is in the array or default back to blue as you've mentioned

$link_protocol_color = (isset ($config['link_colours'][ $protocol_type ]) ? $config['link_colours'][ $protocol_type ] : $default_link_color );

— You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub https://github.com/southern-wind/wind/issues/18#issuecomment-228641904, or mute the thread https://github.com/notifications/unsubscribe/ADVuHg_vLrJ921nSRR6MSH58wJv6xwMaks5qPzWvgaJpZM4HJi4U .

MDE186 commented 8 years ago

All sounds good. @spinza I just pulled the code from the old WIND and made it work with the new. Sorry didnt get further.