#1 Fix server search feature
Merged 3 years ago by kevin. Opened 3 years ago by athoscr.
rpms/ athoscr/reg fix-search  into  master

@@ -0,0 +1,30 @@ 

+ From e25a3c266ab957f41308e30350b92fdc7a611e9f Mon Sep 17 00:00:00 2001

+ From: Athos Ribeiro <athoscr@fedoraproject.org>

+ Date: Wed, 4 Mar 2020 10:14:40 +0100

+ Subject: [PATCH] Fix row cell index for server searching feature

+ 

+ The HTML template for repositories carries the container image name in

+ the first cell of each entry in the table. This patch adjusts the JS

+ search function to fetch the image name information from that cell.

+ 

+ Signed-off-by: Athos Ribeiro <athoscr@fedoraproject.org>

+ ---

+  server/static/js/scripts.js | 2 +-

+  1 file changed, 1 insertion(+), 1 deletion(-)

+ 

+ diff --git a/server/static/js/scripts.js b/server/static/js/scripts.js

+ index 0e8dd867..d36e1624 100644

+ --- a/server/static/js/scripts.js

+ +++ b/server/static/js/scripts.js

+ @@ -23,7 +23,7 @@ function prettyDate(time){

+  function search(search_val){

+      var suche = search_val.toLowerCase();

+      var table = document.getElementById("directory");

+ -    var cellNr = 1;

+ +    var cellNr = 0;

+      var ele;

+      for (var r = 1; r < table.rows.length; r++){

+          ele = table.rows[r].cells[cellNr].innerHTML.replace(/<[^>]+>/g,"");

+ -- 

+ 2.26.2

+ 

file modified
+8 -1
@@ -25,7 +25,7 @@ 

  

  Name:       reg

  Version:    0.15.5

- Release:    5%{?dist}

+ Release:    6%{?dist}

  Summary:    Docker registry v2 command line client

  

  
@@ -40,6 +40,9 @@ 

  Source1:    reg-server.service

  Source2:    sysconfig.reg-server

  

+ # https://github.com/genuinetools/reg/pull/200

+ Patch0: fix-row-cell-index-for-server-searching-feature.patch

+ 

  BuildRequires: golang

  BuildRequires: systemd

  
@@ -110,6 +113,7 @@ 

  

  %prep

  %setup -q -n %{name}-%{version}

+ %patch0 -p1

  

  # Have to move things around because of how golang likes to search $GOPATH

  cd ../
@@ -202,6 +206,9 @@ 

  %config(noreplace) %{_sharedstatedir}/%{name}-server/templates/

  

  %changelog

+ * Sun Jun 14 2020 Athos Ribeiro <athoscr@fedoraproject.org> - 0.15.5-6

+ - Fix image search

+ 

  * Thu Apr 23 2020 Mattia Verga <mattia.verga@protonmail.com> - 0.15.5-5

  - Fix %%postun directive

  

Upstream has been a bit unresponsive lately.

This PR, also proposed upstream at https://github.com/genuinetools/reg/pull/200,

Fixes the search feature for the reg server. Which fixes https://pagure.io/ContainerSIG/container-sig/issue/35

Hi,

Did anyone have a chance to try this out? :)

It looks pretty ok to me... perhaps @cverna or @otaylor would give it a quick glance?

Looks highly plausible to me :-)

Pull-Request has been merged by kevin

3 years ago