Device Location Setting

Post general support questions here that do not specifically fall into the Linux or Windows categories.

Moderators: Developers, Moderators

xdracco
Posts: 42
Joined: Fri Aug 17, 2012 10:19 am
Location: Long Beach, CA

Device Location Setting

Post by xdracco »

Navigate to console -> management -> devices -> new

Under "General Device Options", the option Location is a dropdown with a description reads that "The physical location of the Device. This free form text can be a room, rack location, etc.". This should be a text box, not a drop down menu (see attached image).

As such, in ~/include/global_form.php, I've commented out lines 1143 - 1152:

Code: Select all

//	'location' => array(
//		'method' => 'drop_callback',
//		'friendly_name' => __('Location'),
//		'description' => __('The physical location of the Device.  This free form text can be a room, rack location, etc.'),
//		'none_value' => __('None'),
//		'sql' => 'SELECT DISTINCT location AS id, location AS name FROM host ORDER BY location',
//		'action' => 'ajax_locations',
//		'id' => '|arg1:location|',
//		'value' => '|arg1:location|',
//		),
... and replaced with the following code:

Code: Select all

	'location' => array(
		'method' => 'textbox',
		'friendly_name' => __('Location'),
		'description' => __('The physical location of the Device.  This free form text can be a room, rack location, etc.'),
		'sql' => 'SELECT DISTINCT location AS id, location AS name FROM host ORDER BY location',
		'value' => '|arg1:location|',
		'max_length' => '250',
		'size' => '60',
		),
which replaces the drop down option with a free form text box.

If I'm completely wrong about this setting, I'd appreciate if a developer would correct me. Otherwise, i'm hoping this makes it into the next update.

Thank you for making cacti!!
Attachments
Screen Shot 2019-10-08 at 6.13.48 pm.png
Screen Shot 2019-10-08 at 6.13.48 pm.png (105.8 KiB) Viewed 5686 times
The answer to life, the universe and everything is int main() { return 42; }
netniV
Cacti Guru User
Posts: 3441
Joined: Sun Aug 27, 2017 12:05 am

Re: Device Location Setting

Post by netniV »

What version of cacti?
Cacti Developer & Release Manager
The Cacti Group

Director
BV IT Solutions Ltd

+--------------------------------------------------------------------------+

Cacti Resources:
Cacti Website (including releases)
Cacti Issues
Cacti Development Releases
Cacti Development Documentation
xdracco
Posts: 42
Joined: Fri Aug 17, 2012 10:19 am
Location: Long Beach, CA

Re: Device Location Setting

Post by xdracco »

current version, 1.2.7 but this has been persistent for many versions.
The answer to life, the universe and everything is int main() { return 42; }
netniV
Cacti Guru User
Posts: 3441
Joined: Sun Aug 27, 2017 12:05 am

Re: Device Location Setting

Post by netniV »

I think this is a drop-down combo that allows you to put what you like in but also to select previous entries.
Cacti Developer & Release Manager
The Cacti Group

Director
BV IT Solutions Ltd

+--------------------------------------------------------------------------+

Cacti Resources:
Cacti Website (including releases)
Cacti Issues
Cacti Development Releases
Cacti Development Documentation
xdracco
Posts: 42
Joined: Fri Aug 17, 2012 10:19 am
Location: Long Beach, CA

Re: Device Location Setting

Post by xdracco »

not sure how this works then. if it's a dropdown, no new locations can be added and none can be deleted. If there's another section to add/delete/edit locations, please clue me in because I can't find where to edit locations.

To my knowledge, a drop down must have values must already exist.

thanks.
The answer to life, the universe and everything is int main() { return 42; }
netniV
Cacti Guru User
Posts: 3441
Joined: Sun Aug 27, 2017 12:05 am

Re: Device Location Setting

Post by netniV »

I think you have misunderstand the dfiferences between a drop down box and a drop down combo box. A drop down is fixed with predefined elements. A combo has the same features as a drop down but also allows you to freely enter text. It is up to the developer whether they accept the free text as a new entry or not (some refuse, others add).

Have you actually tried to just enter text and save it?
Cacti Developer & Release Manager
The Cacti Group

Director
BV IT Solutions Ltd

+--------------------------------------------------------------------------+

Cacti Resources:
Cacti Website (including releases)
Cacti Issues
Cacti Development Releases
Cacti Development Documentation
xdracco
Posts: 42
Joined: Fri Aug 17, 2012 10:19 am
Location: Long Beach, CA

Re: Device Location Setting

Post by xdracco »

This is a standard 'select' drop down list. no ability to enter text. i don't see datalist element when i inspect the code in browser. i do believe the datalist element is required in order to offer a drop down combo list.

correct me if i'm wrong.
The answer to life, the universe and everything is int main() { return 42; }
netniV
Cacti Guru User
Posts: 3441
Joined: Sun Aug 27, 2017 12:05 am

Re: Device Location Setting

Post by netniV »

I can enter text into that field perfectly fine.
Cacti Developer & Release Manager
The Cacti Group

Director
BV IT Solutions Ltd

+--------------------------------------------------------------------------+

Cacti Resources:
Cacti Website (including releases)
Cacti Issues
Cacti Development Releases
Cacti Development Documentation
xdracco
Posts: 42
Joined: Fri Aug 17, 2012 10:19 am
Location: Long Beach, CA

Re: Device Location Setting

Post by xdracco »

hmm. that's weird. i cannot. i'm going to install a fresh version in a sandbox.

thanks for your patience.
The answer to life, the universe and everything is int main() { return 42; }
netniV
Cacti Guru User
Posts: 3441
Joined: Sun Aug 27, 2017 12:05 am

Re: Device Location Setting

Post by netniV »

Here's a gif showing it in action.
Oct-21-2019 11-15-26.gif
Oct-21-2019 11-15-26.gif (984.52 KiB) Viewed 5284 times
Cacti Developer & Release Manager
The Cacti Group

Director
BV IT Solutions Ltd

+--------------------------------------------------------------------------+

Cacti Resources:
Cacti Website (including releases)
Cacti Issues
Cacti Development Releases
Cacti Development Documentation
xdracco
Posts: 42
Joined: Fri Aug 17, 2012 10:19 am
Location: Long Beach, CA

Re: Device Location Setting

Post by xdracco »

ok. well that was v helpful.

new installations default to the "modern" theme. I typically use the "classic" them. So I switched the new install in my sandbox to classic them and drop down combo box is broken. works just fine with the default modern theme (on fresh new install).

then on the install that I had modified the code to make it a text box, i copied over the global_form.php file from the fresh install. Switched to 'modern' theme and drop down combo works. Switched back to 'classic' them, drop down combo is broken.

i feel it's a theme issue.
The answer to life, the universe and everything is int main() { return 42; }
netniV
Cacti Guru User
Posts: 3441
Joined: Sun Aug 27, 2017 12:05 am

Re: Device Location Setting

Post by netniV »

OK, yeah that helps. In that case, I'm going to refer you to opening a github issue for the classic theme. Make sure to include as much detail as possible included the differences between the two themes actions.
Cacti Developer & Release Manager
The Cacti Group

Director
BV IT Solutions Ltd

+--------------------------------------------------------------------------+

Cacti Resources:
Cacti Website (including releases)
Cacti Issues
Cacti Development Releases
Cacti Development Documentation
xdracco
Posts: 42
Joined: Fri Aug 17, 2012 10:19 am
Location: Long Beach, CA

Re: Device Location Setting

Post by xdracco »

done. i hope the bug report is sufficient.

https://github.com/Cacti/cacti/issues/3046
The answer to life, the universe and everything is int main() { return 42; }
xdracco
Posts: 42
Joined: Fri Aug 17, 2012 10:19 am
Location: Long Beach, CA

Re: Device Location Setting

Post by xdracco »

yes, it is. or at least it's supposed to.

however, if you have classic theme enabled, it behaves like a basic drop down select menu, not a combo.
The answer to life, the universe and everything is int main() { return 42; }
netniV
Cacti Guru User
Posts: 3441
Joined: Sun Aug 27, 2017 12:05 am

Re: Device Location Setting

Post by netniV »

xdracco wrote: Mon Dec 23, 2019 10:31 am yes, it is. or at least it's supposed to.

however, if you have classic theme enabled, it behaves like a basic drop down select menu, not a combo.
That is exactly the issue. Classic theme should go really but people do still use it.
Cacti Developer & Release Manager
The Cacti Group

Director
BV IT Solutions Ltd

+--------------------------------------------------------------------------+

Cacti Resources:
Cacti Website (including releases)
Cacti Issues
Cacti Development Releases
Cacti Development Documentation
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests