Skip to content

Commit

Permalink
Merge pull request #2681 from SCADA-LTS/fix/#2673_Fixed_unavailabilit…
Browse files Browse the repository at this point in the history
…y_of_acknowledge_for_active_event

#2673 Fixed unavailability of acknowledge for active event - hidden a…
  • Loading branch information
Limraj authored Aug 31, 2023
2 parents e35b3d6 + 3d10bb5 commit 496e346
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
2 changes: 1 addition & 1 deletion WebContent/WEB-INF/tags/alarmAck.tag
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<c:choose>
<c:when test="${event.acknowledged}"><tag:img png="tick_off" title="events.acknowledged" style="display:inline;"/></c:when>
<c:otherwise>
<tag:img png="tick" id="ackImg${event.id}" onclick="ackEvent(${event.id})" title="events.acknowledge" style="display:inline;"/>
<c:if test="${not event.active}"><tag:img png="tick" id="ackImg${event.id}" onclick="ackEvent(${event.id})" title="events.acknowledge" style="display:inline;"/></c:if>
<c:choose>
<c:when test="${event.silenced}">
<tag:img png="sound_mute" id="silenceImg${event.id}" onclick="toggleSilence(${event.id})" title="events.unsilence" style="display:inline;"/>
Expand Down
15 changes: 10 additions & 5 deletions src/com/serotonin/mango/web/dwr/MiscDwr.java
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,12 @@ public int acknowledgeEvent(int eventId) {
User user = Common.getUser();
MangoEvent eventService = new EventService();
if (user != null) {
eventService.ackEvent(eventId, System.currentTimeMillis(),
user.getId(), 0);
resetLastAlarmLevelChange();
EventInstance evt = eventService.getEvent(eventId);
if(evt != null && !evt.isActive()) {
eventService.ackEvent(evt.getId(), System.currentTimeMillis(),
user.getId(), 0);
resetLastAlarmLevelChange();
}
}
return eventId;
}
Expand All @@ -133,8 +136,10 @@ public void acknowledgeAllPendingEvents() {
if (user != null) {
MangoEvent eventService = new EventService();
long now = System.currentTimeMillis();
for (EventInstance evt : eventService.getPendingEvents(user.getId()))
eventService.ackEvent(evt.getId(), now, user.getId(), 0);
for (EventInstance evt : eventService.getPendingEvents(user.getId())) {
if(!evt.isActive())
eventService.ackEvent(evt.getId(), now, user.getId(), 0);
}
resetLastAlarmLevelChange();
}
}
Expand Down

0 comments on commit 496e346

Please sign in to comment.