mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Fix: Proper plugin logo loading depending on staging (#88247)
* making logos respect the staging * making it work when served from subfolders * fixing helper test
This commit is contained in:
parent
e7f05f4ff2
commit
4761326568
@ -51,7 +51,8 @@ func AddDefaultResponseHeaders(cfg *setting.Cfg) web.Handler {
|
|||||||
!strings.HasPrefix(c.Req.URL.Path, "/avatar/") &&
|
!strings.HasPrefix(c.Req.URL.Path, "/avatar/") &&
|
||||||
!strings.HasPrefix(c.Req.URL.Path, "/api/datasources/proxy/") &&
|
!strings.HasPrefix(c.Req.URL.Path, "/api/datasources/proxy/") &&
|
||||||
!strings.HasPrefix(c.Req.URL.Path, "/api/reports/render/") &&
|
!strings.HasPrefix(c.Req.URL.Path, "/api/reports/render/") &&
|
||||||
!strings.HasPrefix(c.Req.URL.Path, "/render/d-solo/") && !resourceCachable {
|
!strings.HasPrefix(c.Req.URL.Path, "/render/d-solo/") &&
|
||||||
|
!(strings.HasPrefix(c.Req.URL.Path, "/api/gnet/plugins") && strings.Contains(c.Req.URL.Path, "/logos/")) && !resourceCachable {
|
||||||
addNoCacheHeaders(c.Resp)
|
addNoCacheHeaders(c.Resp)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -190,8 +190,8 @@ describe('Plugins/Helpers', () => {
|
|||||||
id: 'alexanderzobnin-zabbix-app',
|
id: 'alexanderzobnin-zabbix-app',
|
||||||
info: {
|
info: {
|
||||||
logos: {
|
logos: {
|
||||||
large: 'https://grafana.com/api/plugins/alexanderzobnin-zabbix-app/versions/4.1.5/logos/large',
|
large: '/api/gnet/plugins/alexanderzobnin-zabbix-app/versions/4.1.5/logos/large',
|
||||||
small: 'https://grafana.com/api/plugins/alexanderzobnin-zabbix-app/versions/4.1.5/logos/small',
|
small: '/api/gnet/plugins/alexanderzobnin-zabbix-app/versions/4.1.5/logos/small',
|
||||||
},
|
},
|
||||||
keywords: ['zabbix', 'monitoring', 'dashboard'],
|
keywords: ['zabbix', 'monitoring', 'dashboard'],
|
||||||
},
|
},
|
||||||
@ -319,8 +319,8 @@ describe('Plugins/Helpers', () => {
|
|||||||
id: 'alexanderzobnin-zabbix-app',
|
id: 'alexanderzobnin-zabbix-app',
|
||||||
info: {
|
info: {
|
||||||
logos: {
|
logos: {
|
||||||
small: 'https://grafana.com/api/plugins/alexanderzobnin-zabbix-app/versions/4.1.5/logos/small',
|
small: '/api/gnet/plugins/alexanderzobnin-zabbix-app/versions/4.1.5/logos/small',
|
||||||
large: 'https://grafana.com/api/plugins/alexanderzobnin-zabbix-app/versions/4.1.5/logos/large',
|
large: '/api/gnet/plugins/alexanderzobnin-zabbix-app/versions/4.1.5/logos/large',
|
||||||
},
|
},
|
||||||
keywords: ['zabbix', 'monitoring', 'dashboard'],
|
keywords: ['zabbix', 'monitoring', 'dashboard'],
|
||||||
},
|
},
|
||||||
|
@ -126,8 +126,8 @@ export function mapRemoteToCatalog(plugin: RemotePlugin, error?: PluginError): C
|
|||||||
id,
|
id,
|
||||||
info: {
|
info: {
|
||||||
logos: {
|
logos: {
|
||||||
small: `https://grafana.com/api/plugins/${id}/versions/${version}/logos/small`,
|
small: `${config.appSubUrl}/api/gnet/plugins/${id}/versions/${version}/logos/small`,
|
||||||
large: `https://grafana.com/api/plugins/${id}/versions/${version}/logos/large`,
|
large: `${config.appSubUrl}/api/gnet/plugins/${id}/versions/${version}/logos/large`,
|
||||||
},
|
},
|
||||||
keywords,
|
keywords,
|
||||||
},
|
},
|
||||||
@ -214,8 +214,8 @@ export function mapToCatalogPlugin(local?: LocalPlugin, remote?: RemotePlugin, e
|
|||||||
|
|
||||||
if (remote) {
|
if (remote) {
|
||||||
logos = {
|
logos = {
|
||||||
small: `https://grafana.com/api/plugins/${id}/versions/${remote.version}/logos/small`,
|
small: `${config.appSubUrl}/api/gnet/plugins/${id}/versions/${remote.version}/logos/small`,
|
||||||
large: `https://grafana.com/api/plugins/${id}/versions/${remote.version}/logos/large`,
|
large: `${config.appSubUrl}/api/gnet/plugins/${id}/versions/${remote.version}/logos/large`,
|
||||||
};
|
};
|
||||||
} else if (local && local.info.logos) {
|
} else if (local && local.info.logos) {
|
||||||
logos = local.info.logos;
|
logos = local.info.logos;
|
||||||
|
Loading…
Reference in New Issue
Block a user