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


With regards,
Apache Git Services

Reply via email to