mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Plugins: Add fuzzy search to plugins catalogue (#81001)
* WIP add fuzzysearch to plugins catalog * Add keywords to the plugins listing output * add fuzzy search to plugin catalog, add keywords to plugins at frontend side * refactor fuzzysearch function after review * review changes * change the version of uFuzzy library * change reduce result object in getPluginDetailsForFuzzySearch * fix yarn lock error * fix helpers tests * fix frontend searching test * fix frontend linting issues * fix tests --------- Co-authored-by: Esteban Beltran <esteban@academo.me> Co-authored-by: Giuseppe Guerra <giuseppe@guerra.in>
This commit is contained in:
@@ -143,6 +143,7 @@ func TestFinder_Find(t *testing.T) {
|
||||
{Name: "img1", Path: "img/screenshot1.png"},
|
||||
{Name: "img2", Path: "img/screenshot2.png"},
|
||||
},
|
||||
Keywords: []string{"test"},
|
||||
},
|
||||
Dependencies: plugins.Dependencies{
|
||||
GrafanaVersion: "3.x.x",
|
||||
@@ -176,40 +177,19 @@ func TestFinder_Find(t *testing.T) {
|
||||
{
|
||||
name: "Multiple plugin dirs",
|
||||
pluginDirs: []string{"../../testdata/duplicate-plugins", "../../testdata/invalid-v1-signature"},
|
||||
expectedBundles: []*plugins.FoundBundle{{
|
||||
Primary: plugins.FoundPlugin{
|
||||
JSONData: plugins.JSONData{
|
||||
ID: "test-app",
|
||||
Type: plugins.TypeDataSource,
|
||||
Name: "Parent",
|
||||
Info: plugins.Info{
|
||||
Author: plugins.InfoLink{
|
||||
Name: "Grafana Labs",
|
||||
URL: "http://grafana.com",
|
||||
},
|
||||
Description: "Parent plugin",
|
||||
Version: "1.0.0",
|
||||
Updated: "2020-10-20",
|
||||
},
|
||||
Dependencies: plugins.Dependencies{
|
||||
GrafanaVersion: "*",
|
||||
Plugins: []plugins.Dependency{},
|
||||
},
|
||||
},
|
||||
FS: mustNewStaticFSForTests(t, filepath.Join(testData, "duplicate-plugins/nested")),
|
||||
},
|
||||
Children: []*plugins.FoundPlugin{
|
||||
{
|
||||
expectedBundles: []*plugins.FoundBundle{
|
||||
{
|
||||
Primary: plugins.FoundPlugin{
|
||||
JSONData: plugins.JSONData{
|
||||
ID: "test-app",
|
||||
Type: plugins.TypeDataSource,
|
||||
Name: "Child",
|
||||
Name: "Parent",
|
||||
Info: plugins.Info{
|
||||
Author: plugins.InfoLink{
|
||||
Name: "Grafana Labs",
|
||||
URL: "http://grafana.com",
|
||||
},
|
||||
Description: "Child plugin",
|
||||
Description: "Parent plugin",
|
||||
Version: "1.0.0",
|
||||
Updated: "2020-10-20",
|
||||
},
|
||||
@@ -218,10 +198,32 @@ func TestFinder_Find(t *testing.T) {
|
||||
Plugins: []plugins.Dependency{},
|
||||
},
|
||||
},
|
||||
FS: mustNewStaticFSForTests(t, filepath.Join(testData, "duplicate-plugins/nested/nested")),
|
||||
FS: mustNewStaticFSForTests(t, filepath.Join(testData, "duplicate-plugins/nested")),
|
||||
},
|
||||
Children: []*plugins.FoundPlugin{
|
||||
{
|
||||
JSONData: plugins.JSONData{
|
||||
ID: "test-app",
|
||||
Type: plugins.TypeDataSource,
|
||||
Name: "Child",
|
||||
Info: plugins.Info{
|
||||
Author: plugins.InfoLink{
|
||||
Name: "Grafana Labs",
|
||||
URL: "http://grafana.com",
|
||||
},
|
||||
Description: "Child plugin",
|
||||
Version: "1.0.0",
|
||||
Updated: "2020-10-20",
|
||||
},
|
||||
Dependencies: plugins.Dependencies{
|
||||
GrafanaVersion: "*",
|
||||
Plugins: []plugins.Dependency{},
|
||||
},
|
||||
},
|
||||
FS: mustNewStaticFSForTests(t, filepath.Join(testData, "duplicate-plugins/nested/nested")),
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
Primary: plugins.FoundPlugin{
|
||||
JSONData: plugins.JSONData{
|
||||
|
||||
@@ -154,7 +154,8 @@ func TestLoader_Load(t *testing.T) {
|
||||
Class: plugins.ClassBundled,
|
||||
},
|
||||
},
|
||||
}, {
|
||||
},
|
||||
{
|
||||
name: "Load plugin with symbolic links",
|
||||
class: plugins.ClassExternal,
|
||||
cfg: &config.Cfg{Features: featuremgmt.WithFeatures()},
|
||||
@@ -183,8 +184,9 @@ func TestLoader_Load(t *testing.T) {
|
||||
{Path: "public/plugins/test-app/img/screenshot1.png", Name: "img1"},
|
||||
{Path: "public/plugins/test-app/img/screenshot2.png", Name: "img2"},
|
||||
},
|
||||
Version: "1.0.0",
|
||||
Updated: "2015-02-10",
|
||||
Version: "1.0.0",
|
||||
Updated: "2015-02-10",
|
||||
Keywords: []string{"test"},
|
||||
},
|
||||
Dependencies: plugins.Dependencies{
|
||||
GrafanaVersion: "3.x.x",
|
||||
@@ -212,7 +214,8 @@ func TestLoader_Load(t *testing.T) {
|
||||
Name: "Nginx Panel",
|
||||
Type: string(plugins.TypePanel),
|
||||
Role: org.RoleViewer,
|
||||
Slug: "nginx-panel"},
|
||||
Slug: "nginx-panel",
|
||||
},
|
||||
{
|
||||
Name: "Nginx Datasource",
|
||||
Type: string(plugins.TypeDataSource),
|
||||
@@ -230,7 +233,8 @@ func TestLoader_Load(t *testing.T) {
|
||||
SignatureOrg: "Grafana Labs",
|
||||
},
|
||||
},
|
||||
}, {
|
||||
},
|
||||
{
|
||||
name: "Load an unsigned plugin (development)",
|
||||
class: plugins.ClassExternal,
|
||||
cfg: &config.Cfg{
|
||||
@@ -383,7 +387,8 @@ func TestLoader_Load(t *testing.T) {
|
||||
Small: "public/img/icn-app.svg",
|
||||
Large: "public/img/icn-app.svg",
|
||||
},
|
||||
Updated: "2015-02-10",
|
||||
Updated: "2015-02-10",
|
||||
Keywords: []string{"test"},
|
||||
},
|
||||
Dependencies: plugins.Dependencies{
|
||||
GrafanaDependency: ">=8.0.0",
|
||||
|
||||
Reference in New Issue
Block a user