HomeSeer / Plugin-SDK

Plugin development kit for the 4th major edition of the HomeSeer platform.
https://www.nuget.org/packages/HomeSeer-PluginSDK/
GNU Affero General Public License v3.0
20 stars 4 forks source link

TimeSpanView inside a GroupView is not processing properly #321

Closed homeseerwu closed 1 year ago

homeseerwu commented 1 year ago

TimeSpanView not processing properly in EventTrigger UI

Environment

HomeSeer

OS

Windows

HS Version

v4.2.16.0

Development

PSDK Version

v1.4.2.0

Language

C#

IDE

VS2019

Dev OS

Womdpws

Page

Event Trigger (custom plugin event trigger)

Problem

Description

My event trigger UX has added a TimeSpanView inside a GroupView. When I change the TimeSpanView's values via Edge browser I don't receive a callback into my event trigger plugin (no call is made to OnConfigItemUpdate()).

Walking through the browser javascript code for this page (/events.html?ref=13&subpage=event.html) I see that the viewValueChanged() function is going a div parent level too high (it assumes that the view is not in a group):

function viewValueChanged(event) { // .... skip a bunch of code.... else if (view.classList.contains('jui-timespan')) { var parentdiv = **$('div.jui-view:has(#' + viewIdEscaped + ')')[0];** var id = parentdiv.getAttribute("id"); var days = $('#' + id + '-days').val();

The above bold code assigns parentdivGroupView div element, not the actual TimeSpanView div element.

If I change the it to: var parentlist = $('div.jui-view:has(#' + viewIdEscaped + ')'); var parentdiv = parentlist[parentlist.length - 1];

It works as expected.

Screenshots

Expected Behavior

Expected to receive a callback to OnConfigItemUpdate in my event trigger class.

Steps to Reproduce

Provide steps so the HomeSeer team can reproduce the reported problem and see the same thing:

  1. Create a TriggerClass with a GroupView.
  2. Add a TimeSpanView inside the GroupView
  3. Create a new event, select your trigger class
  4. Modify the time span settings (eg, change 0 min to 5 min)
  5. Note that your OnConfigItemUpdate() is not called.

Logs

spudwebb commented 1 year ago

Tracked as HS-1747

spudwebb commented 1 year ago

This is fixed in HS4 version 4.2.16.7. Thanks for the report and the solution