public inbox for [email protected]  
help / color / mirror / Atom feed
[pgAdmin][RM5842]: Query history shown out of order
2+ messages / 2 participants
[nested] [flat]

* [pgAdmin][RM5842]: Query history shown out of order
@ 2020-10-23 04:36 Pradip Parkale <[email protected]>
  2020-10-23 11:47 ` Re: [pgAdmin][RM5842]: Query history shown out of order Akshay Joshi <[email protected]>
  0 siblings, 1 reply; 2+ messages in thread

From: Pradip Parkale @ 2020-10-23 04:36 UTC (permalink / raw)
  To: pgadmin-hackers

Hi Hackers,

Please find the attached patch to sort the query history in
descending order.

-- 
Thanks & Regards,
Pradip Parkale
Software Engineer | EnterpriseDB Corporation


Attachments:

  [application/octet-stream] RM5842.patch (1.2K, 3-RM5842.patch)
  download | inline diff:
diff --git a/web/pgadmin/static/js/sqleditor/history/query_history_entries.js b/web/pgadmin/static/js/sqleditor/history/query_history_entries.js
index 03ea7c46f..41d5cc310 100644
--- a/web/pgadmin/static/js/sqleditor/history/query_history_entries.js
+++ b/web/pgadmin/static/js/sqleditor/history/query_history_entries.js
@@ -235,8 +235,24 @@ export class QueryHistoryEntries {
     newItem.onClick(this.setSelectedListItem.bind(this));
     newItem.render(this.is_pgadmin_queries_shown);
 
-    if (!_.isUndefined($groupEl))
-      $groupEl.find('.query-entries').prepend(newItem.$el);
+    if (!_.isUndefined($groupEl)){
+      let entries = $groupEl.find('.query-entries').find('.list-item');
+      let i=0;
+      if(entries.length > 0)
+      {
+        while(i<entries.length){
+          if(newItem.$el.attr('data-key') > $(entries[i]).attr('data-key')) {
+            $(newItem.$el).insertBefore(entries[i]);
+            break;
+          }else{
+            $(newItem.$el).insertAfter(entries[i]);
+          }
+          i++;
+        }
+      } else{
+        $groupEl.find('.query-entries').append(newItem.$el);
+      }
+    }
     this.setSelectedListItem(newItem.$el);
   }
 


^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: [pgAdmin][RM5842]: Query history shown out of order
  2020-10-23 04:36 [pgAdmin][RM5842]: Query history shown out of order Pradip Parkale <[email protected]>
@ 2020-10-23 11:47 ` Akshay Joshi <[email protected]>
  0 siblings, 0 replies; 2+ messages in thread

From: Akshay Joshi @ 2020-10-23 11:47 UTC (permalink / raw)
  To: Pradip Parkale <[email protected]>; +Cc: pgadmin-hackers

Thanks, patch applied.

On Fri, Oct 23, 2020 at 10:06 AM Pradip Parkale <
[email protected]> wrote:

> Hi Hackers,
>
> Please find the attached patch to sort the query history in
> descending order.
>
> --
> Thanks & Regards,
> Pradip Parkale
> Software Engineer | EnterpriseDB Corporation
>


-- 
*Thanks & Regards*
*Akshay Joshi*
*pgAdmin Hacker | Sr. Software Architect*
*EDB Postgres <http://edbpostgres.com>*

*Mobile: +91 976-788-8246*


^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2020-10-23 11:47 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2020-10-23 04:36 [pgAdmin][RM5842]: Query history shown out of order Pradip Parkale <[email protected]>
2020-10-23 11:47 ` Akshay Joshi <[email protected]>

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox