[v10.2.x] Plugins: Don't auto prepend app sub url to plugin asset paths (#82146)
Plugins: Don't auto prepend app sub url to plugin asset paths (#81658)
* don't prepend app sub url to paths
* simplify logo path
* fix(plugins): dynamically prepend appSubUrl for System module resolving to work
* fix(sandbox): support dynamic appSuburl prepend when loading plugin module.js
* fix tests
* update test name
* fix tests
* update fe + add some tests
* refactor(plugins): move wrangleurl to utils, rename to resolveModulePath, update usage
* chore: fix a typo
* test(plugins): add missing name to utils test
* reset test flag
---------
Co-authored-by: Jack Westbrook <jack.westbrook@gmail.com>
(cherry picked from commit 99feb928cf)
Co-authored-by: Will Browne <wbrowne@users.noreply.github.com>
This commit is contained in:
co-authored by
Will Browne
parent
147e7b0613
commit
dfb6c28197
@@ -83,8 +83,8 @@ func TestLoader_Load(t *testing.T) {
|
||||
},
|
||||
Description: "Data source for Amazon AWS monitoring service",
|
||||
Logos: plugins.Logos{
|
||||
Small: "/public/app/plugins/datasource/cloudwatch/img/amazon-web-services.png",
|
||||
Large: "/public/app/plugins/datasource/cloudwatch/img/amazon-web-services.png",
|
||||
Small: "public/app/plugins/datasource/cloudwatch/img/amazon-web-services.png",
|
||||
Large: "public/app/plugins/datasource/cloudwatch/img/amazon-web-services.png",
|
||||
},
|
||||
},
|
||||
Includes: []*plugins.Includes{
|
||||
@@ -106,9 +106,8 @@ func TestLoader_Load(t *testing.T) {
|
||||
Backend: true,
|
||||
QueryOptions: map[string]bool{"minInterval": true},
|
||||
},
|
||||
Module: "core:plugin/cloudwatch",
|
||||
BaseURL: "/public/app/plugins/datasource/cloudwatch",
|
||||
|
||||
Module: "core:plugin/cloudwatch",
|
||||
BaseURL: "public/app/plugins/datasource/cloudwatch",
|
||||
FS: mustNewStaticFSForTests(t, filepath.Join(corePluginDir, "app/plugins/datasource/cloudwatch")),
|
||||
Signature: plugins.SignatureStatusInternal,
|
||||
Class: plugins.ClassCore,
|
||||
@@ -133,8 +132,8 @@ func TestLoader_Load(t *testing.T) {
|
||||
},
|
||||
Version: "1.0.0",
|
||||
Logos: plugins.Logos{
|
||||
Small: "/public/img/icn-datasource.svg",
|
||||
Large: "/public/img/icn-datasource.svg",
|
||||
Small: "public/img/icn-datasource.svg",
|
||||
Large: "public/img/icn-datasource.svg",
|
||||
},
|
||||
Description: "Test",
|
||||
},
|
||||
@@ -146,8 +145,8 @@ func TestLoader_Load(t *testing.T) {
|
||||
Backend: true,
|
||||
State: "alpha",
|
||||
},
|
||||
Module: "/public/plugins/test-datasource/module.js",
|
||||
BaseURL: "/public/plugins/test-datasource",
|
||||
Module: "public/plugins/test-datasource/module.js",
|
||||
BaseURL: "public/plugins/test-datasource",
|
||||
FS: mustNewStaticFSForTests(t, filepath.Join(parentDir, "testdata/valid-v2-signature/plugin/")),
|
||||
Signature: "valid",
|
||||
SignatureType: plugins.SignatureTypeGrafana,
|
||||
@@ -172,8 +171,8 @@ func TestLoader_Load(t *testing.T) {
|
||||
URL: "http://test.com",
|
||||
},
|
||||
Logos: plugins.Logos{
|
||||
Small: "/public/plugins/test-app/img/logo_small.png",
|
||||
Large: "/public/plugins/test-app/img/logo_large.png",
|
||||
Small: "public/plugins/test-app/img/logo_small.png",
|
||||
Large: "public/plugins/test-app/img/logo_large.png",
|
||||
},
|
||||
Links: []plugins.InfoLink{
|
||||
{Name: "Project site", URL: "http://project.com"},
|
||||
@@ -181,8 +180,8 @@ func TestLoader_Load(t *testing.T) {
|
||||
},
|
||||
Description: "Official Grafana Test App & Dashboard bundle",
|
||||
Screenshots: []plugins.Screenshots{
|
||||
{Path: "/public/plugins/test-app/img/screenshot1.png", Name: "img1"},
|
||||
{Path: "/public/plugins/test-app/img/screenshot2.png", Name: "img2"},
|
||||
{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",
|
||||
@@ -223,8 +222,8 @@ func TestLoader_Load(t *testing.T) {
|
||||
},
|
||||
},
|
||||
Class: plugins.ClassExternal,
|
||||
Module: "/public/plugins/test-app/module.js",
|
||||
BaseURL: "/public/plugins/test-app",
|
||||
Module: "public/plugins/test-app/module.js",
|
||||
BaseURL: "public/plugins/test-app",
|
||||
FS: mustNewStaticFSForTests(t, filepath.Join(parentDir, "testdata/includes-symlinks")),
|
||||
Signature: "valid",
|
||||
SignatureType: plugins.SignatureTypeGrafana,
|
||||
@@ -251,8 +250,8 @@ func TestLoader_Load(t *testing.T) {
|
||||
URL: "https://grafana.com",
|
||||
},
|
||||
Logos: plugins.Logos{
|
||||
Small: "/public/img/icn-datasource.svg",
|
||||
Large: "/public/img/icn-datasource.svg",
|
||||
Small: "public/img/icn-datasource.svg",
|
||||
Large: "public/img/icn-datasource.svg",
|
||||
},
|
||||
Description: "Test",
|
||||
},
|
||||
@@ -264,8 +263,8 @@ func TestLoader_Load(t *testing.T) {
|
||||
State: plugins.ReleaseStateAlpha,
|
||||
},
|
||||
Class: plugins.ClassExternal,
|
||||
Module: "/public/plugins/test-datasource/module.js",
|
||||
BaseURL: "/public/plugins/test-datasource",
|
||||
Module: "public/plugins/test-datasource/module.js",
|
||||
BaseURL: "public/plugins/test-datasource",
|
||||
FS: mustNewStaticFSForTests(t, filepath.Join(parentDir, "testdata/unsigned-datasource/plugin")),
|
||||
Signature: "unsigned",
|
||||
},
|
||||
@@ -298,8 +297,8 @@ func TestLoader_Load(t *testing.T) {
|
||||
URL: "https://grafana.com",
|
||||
},
|
||||
Logos: plugins.Logos{
|
||||
Small: "/public/img/icn-datasource.svg",
|
||||
Large: "/public/img/icn-datasource.svg",
|
||||
Small: "public/img/icn-datasource.svg",
|
||||
Large: "public/img/icn-datasource.svg",
|
||||
},
|
||||
Description: "Test",
|
||||
},
|
||||
@@ -311,8 +310,8 @@ func TestLoader_Load(t *testing.T) {
|
||||
State: plugins.ReleaseStateAlpha,
|
||||
},
|
||||
Class: plugins.ClassExternal,
|
||||
Module: "/public/plugins/test-datasource/module.js",
|
||||
BaseURL: "/public/plugins/test-datasource",
|
||||
Module: "public/plugins/test-datasource/module.js",
|
||||
BaseURL: "public/plugins/test-datasource",
|
||||
FS: mustNewStaticFSForTests(t, filepath.Join(parentDir, "testdata/unsigned-datasource/plugin")),
|
||||
Signature: plugins.SignatureStatusUnsigned,
|
||||
},
|
||||
@@ -381,8 +380,8 @@ func TestLoader_Load(t *testing.T) {
|
||||
{Name: "License & Terms", URL: "http://license.com"},
|
||||
},
|
||||
Logos: plugins.Logos{
|
||||
Small: "/public/img/icn-app.svg",
|
||||
Large: "/public/img/icn-app.svg",
|
||||
Small: "public/img/icn-app.svg",
|
||||
Large: "public/img/icn-app.svg",
|
||||
},
|
||||
Updated: "2015-02-10",
|
||||
},
|
||||
@@ -401,8 +400,8 @@ func TestLoader_Load(t *testing.T) {
|
||||
FS: mustNewStaticFSForTests(t, filepath.Join(parentDir, "testdata/test-app-with-includes")),
|
||||
Class: plugins.ClassExternal,
|
||||
Signature: plugins.SignatureStatusUnsigned,
|
||||
Module: "/public/plugins/test-app/module.js",
|
||||
BaseURL: "/public/plugins/test-app",
|
||||
Module: "public/plugins/test-app/module.js",
|
||||
BaseURL: "public/plugins/test-app",
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -427,8 +426,8 @@ func TestLoader_Load(t *testing.T) {
|
||||
URL: "https://grafana.com",
|
||||
},
|
||||
Logos: plugins.Logos{
|
||||
Small: "/grafana/public/img/icn-datasource.svg",
|
||||
Large: "/grafana/public/img/icn-datasource.svg",
|
||||
Small: "public/img/icn-datasource.svg",
|
||||
Large: "public/img/icn-datasource.svg",
|
||||
},
|
||||
Description: "Test",
|
||||
},
|
||||
@@ -440,8 +439,8 @@ func TestLoader_Load(t *testing.T) {
|
||||
State: plugins.ReleaseStateAlpha,
|
||||
},
|
||||
Class: plugins.ClassExternal,
|
||||
Module: "/grafana/public/plugins/test-datasource/module.js",
|
||||
BaseURL: "/grafana/public/plugins/test-datasource",
|
||||
Module: "public/plugins/test-datasource/module.js",
|
||||
BaseURL: "public/plugins/test-datasource",
|
||||
FS: mustNewStaticFSForTests(t, filepath.Join(parentDir, "testdata/unsigned-datasource/plugin")),
|
||||
Signature: plugins.SignatureStatusUnsigned,
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user