Device Location Setting

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

Moderators: Moderators, Developers

Post Reply
Author
Message
xdracco
Posts: 38
Joined: Fri Aug 17, 2012 10:19 am
Location: Long Beach, CA

Device Location Setting

#1 Post by xdracco » Tue Oct 08, 2019 8:16 pm

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 1017 times
The answer to life, the universe and everything is int main() { return 42; }


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

Re: Device Location Setting

#3 Post by xdracco » Sun Oct 13, 2019 10:42 am

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: 3061
Joined: Sun Aug 27, 2017 12:05 am

Re: Device Location Setting

#4 Post by netniV » Sun Oct 13, 2019 2:18 pm

I think this is a drop-down combo that allows you to put what you like in but also to select previous entries.

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

Re: Device Location Setting

#5 Post by xdracco » Fri Oct 18, 2019 10:33 am

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: 3061
Joined: Sun Aug 27, 2017 12:05 am

Re: Device Location Setting

#6 Post by netniV » Sun Oct 20, 2019 6:20 am

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?

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

Re: Device Location Setting

#7 Post by xdracco » Sun Oct 20, 2019 10:39 am

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: 3061
Joined: Sun Aug 27, 2017 12:05 am

Re: Device Location Setting

#8 Post by netniV » Sun Oct 20, 2019 5:40 pm

I can enter text into that field perfectly fine.

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

Re: Device Location Setting

#9 Post by xdracco » Sun Oct 20, 2019 8:10 pm

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: 3061
Joined: Sun Aug 27, 2017 12:05 am

Re: Device Location Setting

#10 Post by netniV » Mon Oct 21, 2019 5:16 am

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 615 times

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

Re: Device Location Setting

#11 Post by xdracco » Mon Oct 21, 2019 9:05 pm

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: 3061
Joined: Sun Aug 27, 2017 12:05 am

Re: Device Location Setting

#12 Post by netniV » Tue Oct 22, 2019 6:24 am

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.

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

Re: Device Location Setting

#13 Post by xdracco » Tue Oct 22, 2019 10:31 am

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; }

Post Reply