[ 
https://issues.apache.org/jira/browse/AMBARI-24551?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16643399#comment-16643399
 ] 

ASF GitHub Bot commented on AMBARI-24551:
-----------------------------------------

aBabiichuk commented on a change in pull request #5: [AMBARI-24551] [Log Search 
UI] get rid of redundant requests after undoing or redoing several history steps
URL: https://github.com/apache/ambari-logsearch/pull/5#discussion_r223692185
 
 

 ##########
 File path: ambari-logsearch-web/src/app/services/history-manager.service.ts
 ##########
 @@ -209,18 +190,14 @@ export class HistoryManagerService {
    * @returns {ListItem[]}
    */
   get redoItems(): ListItem[] {
-    const allItems = this.activeHistory.slice().reverse();
+    const allItems = [...this.activeHistory].reverse();
     let startIndex = allItems.findIndex((item: ListItem): boolean => {
-        return item.value.previousChangeId === this.currentHistoryItemId && 
!item.value.isUndoOrRedo;
-      }),
-      endIndex = allItems.slice(startIndex + 1).findIndex((item: ListItem): 
boolean => item.value.isUndoOrRedo);
+      return item.value.previousChangeId === this.currentHistoryItemId;
+    });
     if (startIndex === -1) {
       startIndex = allItems.length;
     }
-    if (endIndex === -1) {
 
 Review comment:
   This isUndoOrRedo/endIndex logic shouldn't be removed here. It's needed to 
handle the situation when after some undoing/redoing user goes on with 
non-historical filters changes, so there's nothing to redo. Sorry for my 
omission in previous comment.
   P.S. Getting rid of hasNoPendingUndoOrRedo looks OK to me.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> [Log Search UI] get rid of redundant requests after undoing or redoing 
> several history steps
> --------------------------------------------------------------------------------------------
>
>                 Key: AMBARI-24551
>                 URL: https://issues.apache.org/jira/browse/AMBARI-24551
>             Project: Ambari
>          Issue Type: Bug
>          Components: ambari-logsearch, logsearch
>    Affects Versions: 2.7.1
>            Reporter: Istvan Tobias
>            Assignee: Istvan Tobias
>            Priority: Minor
>              Labels: pull-request-available
>             Fix For: 2.7.2
>
>   Original Estimate: 4h
>          Time Spent: 2h 50m
>  Remaining Estimate: 1h 10m
>
> After undoing or redoing more than one history items several redundant API 
> requests are sent. This occurs because changes for several filter controls 
> are applied step-by-step, and each control change generates new request.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to