Bugzilla – Attachment 132266 Details for
Bug 29787
Add plugin version to plugin search results
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 29787: Add plugin version to plugin search results
Bug-29787-Add-plugin-version-to-plugin-search-resu.patch (text/plain), 5.55 KB, created by
Katrin Fischer
on 2022-03-26 23:53:23 UTC
(
hide
)
Description:
Bug 29787: Add plugin version to plugin search results
Filename:
MIME Type:
Creator:
Katrin Fischer
Created:
2022-03-26 23:53:23 UTC
Size:
5.55 KB
patch
obsolete
>From f3ed6cf1b9a6b136b11f692cd07b0d4c9cee53d3 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Mon, 10 Jan 2022 09:03:26 -0300 >Subject: [PATCH] Bug 29787: Add plugin version to plugin search results > >This patch adds a new column to plugins search results: 'Latest >version'. > >It takes the tag_name in both GitHub and GitLab cases and passes it to >the template. > >To test: >1. Have this on your koha-conf.xml file: > > <plugin_repos> > <repo> > <name>ByWater Solutions</name> > <org_name>bywatersolutions</org_name> > <service>github</service> > </repo> > <repo> > <name>Theke Solutions</name> > <org_name>thekesolutions</org_name> > <service>gitlab</service> > </repo> > <repo> > <name>PTFS Europe</name> > <org_name>ptfs-europe</org_name> > <service>github</service> > </repo> > </plugin_repos> > >2. Restart all services: > $ restart_all >3. Search for the term 'barclaycard' >=> SUCCESS: You get results from PTFS Europe (Github) >=> FAIL: They don't include plugin version >4. Search for the term 'innreach' >=> SUCCESS: You get results from Theke (Gitlab) >=> FAIL: They don't include plugin version >5. Apply this patch >6. Repeat 2-4 >=> SUCCESS: Results show up >=> SUCCESS: Results include the plugin version >7. Sign off :-D > >Signed-off-by: Owen Leonard <oleonard@myacpl.org> > >Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> >--- > .../prog/en/modules/plugins/plugins-home.tt | 2 ++ > plugins/plugins-home.pl | 19 ++++++++++++------- > 2 files changed, 14 insertions(+), 7 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/plugins/plugins-home.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/plugins/plugins-home.tt >index 08e78a0c2a..715c91a033 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/plugins/plugins-home.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/plugins/plugins-home.tt >@@ -77,6 +77,7 @@ > <th>Name</th> > <th>Description</th> > <th>Organization</th> >+ <th>Latest version</th> > <th> </th> > </tr> > </thead> >@@ -86,6 +87,7 @@ > <td><a href="[% sr.result.html_url | url %]" target="_new">[% sr.result.name | html %]</a></td> > <td>[% sr.result.description | html %]</td> > <td>[% sr.repo.name | html %]</td> >+ <td>[% sr.result.tag_name | html %]</td> > <td><a class="btn btn-default btn-sm btn-install-plugin" href="/cgi-bin/koha/plugins/plugins-upload.pl?op=Upload&uploadfile=[% sr.result.install_name | uri %]&uploadlocation=[% sr.result.install_url | uri %]"><i class="fa fa-download"></i> Install</a></td> > </tr> > [% END %] >diff --git a/plugins/plugins-home.pl b/plugins/plugins-home.pl >index da892ba1f2..c67156222d 100755 >--- a/plugins/plugins-home.pl >+++ b/plugins/plugins-home.pl >@@ -77,11 +77,13 @@ if ($plugins_enabled) { > foreach my $result ( @{ $response->{items} } ) { > next unless $result->{name} =~ /^koha-plugin-/; > my $releases = $result->{url} . "/releases/latest"; >- my $release = from_json( get($releases) ); >+ my $release = from_json( get($releases) ); >+ my $tag_name = $release->{tag_name}; > for my $asset ( @{$release->{assets}} ) { > if ($asset->{browser_download_url} =~ m/\.kpz$/) { > $result->{install_name} = $asset->{name}; >- $result->{install_url} = $asset->{browser_download_url}; >+ $result->{install_url} = $asset->{browser_download_url}; >+ $result->{tag_name} = $tag_name; > } > } > push( @results, { repo => $r, result => $result } ); >@@ -100,12 +102,14 @@ if ($plugins_enabled) { > my @releases = @{ from_json( get($releases_url) ) }; > > if ( scalar @releases > 0 ) { >+ > # Pick the first one, the latest release >- my $latest = $releases[0]; >- my $name = $latest->{name}; >- my @links = @{$latest->{assets}->{links}}; >- my $url = $links[0]->{direct_asset_url}; >- my @parts = split( '/', $url); >+ my $latest = $releases[0]; >+ my $name = $latest->{name}; >+ my $tag_name = $latest->{tag_name}; >+ my @links = @{ $latest->{assets}->{links} }; >+ my $url = $links[0]->{direct_asset_url}; >+ my @parts = split( '/', $url ); > my $filename = $parts[-1]; > next unless $url =~ m/\.kpz$/; > my $result = { >@@ -114,6 +118,7 @@ if ($plugins_enabled) { > install_url => $url, > html_url => $web_url, > name => $name, >+ tag_name => $tag_name, > }; > push @results, { repo => $r, result => $result }; > } >-- >2.30.2
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 29787
:
129250
|
129649
| 132266