Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Ingest Manager] Use EPR's Image.path if available #76434

Merged
merged 5 commits into from
Sep 9, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 38 additions & 15 deletions x-pack/plugins/ingest_manager/common/openapi/spec_oas3.json
Original file line number Diff line number Diff line change
Expand Up @@ -1425,11 +1425,13 @@
},
"icons": [
{
"src": "/package/coredns-1.0.1/img/icon.png",
"path": "/package/coredns-1.0.1/img/icon.png",
"src": "/img/icon.png",
"size": "1800x1800"
},
{
"src": "/package/coredns-1.0.1/img/icon.svg",
"path": "/package/coredns-1.0.1/img/icon.svg",
"src": "/img/icon.svg",
"size": "255x144",
"type": "image/svg+xml"
}
Expand Down Expand Up @@ -1704,7 +1706,8 @@
},
"icons": [
{
"src": "/package/endpoint/0.3.0/img/logo-endpoint-64-color.svg",
"path": "/package/endpoint/0.3.0/img/logo-endpoint-64-color.svg",
"src": "/img/logo-endpoint-64-color.svg",
"size": "16x16",
"type": "image/svg+xml"
}
Expand Down Expand Up @@ -2001,7 +2004,8 @@
"download": "/epr/aws/aws-0.0.3.tar.gz",
"icons": [
{
"src": "/package/aws/0.0.3/img/logo_aws.svg",
"path": "/package/aws/0.0.3/img/logo_aws.svg",
"src": "/img/logo_aws.svg",
"title": "logo aws",
"size": "32x32",
"type": "image/svg+xml"
Expand All @@ -2019,7 +2023,8 @@
"download": "/epr/endpoint/endpoint-0.1.0.tar.gz",
"icons": [
{
"src": "/package/endpoint/0.1.0/img/logo-endpoint-64-color.svg",
"path": "/package/endpoint/0.1.0/img/logo-endpoint-64-color.svg",
"src": "/img/logo-endpoint-64-color.svg",
"size": "16x16",
"type": "image/svg+xml"
}
Expand Down Expand Up @@ -2087,7 +2092,8 @@
"download": "/epr/log/log-0.9.0.tar.gz",
"icons": [
{
"src": "/package/log/0.9.0/img/icon.svg",
"path": "/package/log/0.9.0/img/icon.svg",
"src": "/img/icon.svg",
"type": "image/svg+xml"
}
],
Expand All @@ -2103,7 +2109,8 @@
"download": "/epr/longdocs/longdocs-1.0.4.tar.gz",
"icons": [
{
"src": "/package/longdocs/1.0.4/img/icon.svg",
"path": "/package/longdocs/1.0.4/img/icon.svg",
"src": "/img/icon.svg",
"type": "image/svg+xml"
}
],
Expand All @@ -2119,7 +2126,8 @@
"download": "/epr/metricsonly/metricsonly-2.0.1.tar.gz",
"icons": [
{
"src": "/package/metricsonly/2.0.1/img/icon.svg",
"path": "/package/metricsonly/2.0.1/img/icon.svg",
"src": "/img/icon.svg",
"type": "image/svg+xml"
}
],
Expand All @@ -2135,7 +2143,8 @@
"download": "/epr/multiversion/multiversion-1.1.0.tar.gz",
"icons": [
{
"src": "/package/multiversion/1.1.0/img/icon.svg",
"path": "/package/multiversion/1.1.0/img/icon.svg",
"src": "/img/icon.svg",
"type": "image/svg+xml"
}
],
Expand All @@ -2151,7 +2160,8 @@
"download": "/epr/mysql/mysql-0.1.0.tar.gz",
"icons": [
{
"src": "/package/mysql/0.1.0/img/logo_mysql.svg",
"path": "/package/mysql/0.1.0/img/logo_mysql.svg",
"src": "/img/logo_mysql.svg",
"title": "logo mysql",
"size": "32x32",
"type": "image/svg+xml"
Expand All @@ -2169,7 +2179,8 @@
"download": "/epr/nginx/nginx-0.1.0.tar.gz",
"icons": [
{
"src": "/package/nginx/0.1.0/img/logo_nginx.svg",
"path": "/package/nginx/0.1.0/img/logo_nginx.svg",
"src": "/img/logo_nginx.svg",
"title": "logo nginx",
"size": "32x32",
"type": "image/svg+xml"
Expand All @@ -2187,7 +2198,8 @@
"download": "/epr/redis/redis-0.1.0.tar.gz",
"icons": [
{
"src": "/package/redis/0.1.0/img/logo_redis.svg",
"path": "/package/redis/0.1.0/img/logo_redis.svg",
"src": "/img/logo_redis.svg",
"title": "logo redis",
"size": "32x32",
"type": "image/svg+xml"
Expand All @@ -2205,7 +2217,8 @@
"download": "/epr/reference/reference-1.0.0.tar.gz",
"icons": [
{
"src": "/package/reference/1.0.0/img/icon.svg",
"path": "/package/reference/1.0.0/img/icon.svg",
"src": "/img/icon.svg",
"size": "32x32",
"type": "image/svg+xml"
}
Expand All @@ -2222,7 +2235,8 @@
"download": "/epr/system/system-0.1.0.tar.gz",
"icons": [
{
"src": "/package/system/0.1.0/img/system.svg",
"path": "/package/system/0.1.0/img/system.svg",
"src": "/img/system.svg",
"title": "system",
"size": "1000x1000",
"type": "image/svg+xml"
Expand Down Expand Up @@ -3913,11 +3927,20 @@
"src": {
"type": "string"
},
"path": {
"type": "string"
},
"title": {
"type": "string"
},
"size": {
"type": "string"
},
"type": {
"type": "string"
}
},
"required": ["src"]
"required": ["src", "path"]
}
},
"icons": {
Expand Down
4 changes: 1 addition & 3 deletions x-pack/plugins/ingest_manager/common/types/models/epm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,8 @@ export interface RegistryPackage {
}

interface RegistryImage {
// https://github.com/elastic/package-registry/blob/master/util/package.go#L74
// says src is potentially missing but I couldn't find any examples
// it seems like src should be required. How can you have an image with no reference to the content?
src: string;
path: string;
title?: string;
size?: string;
type?: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export const usePackageIconType = ({
const svgIcons = (paramIcons || iconList)?.filter(
(iconDef) => iconDef.type === 'image/svg+xml'
);
const localIconSrc = Array.isArray(svgIcons) && svgIcons[0]?.src;
const localIconSrc = Array.isArray(svgIcons) && (svgIcons[0].path || svgIcons[0].src);
if (localIconSrc) {
CACHED_ICONS.set(pkgKey, toImage(localIconSrc));
setIconType(CACHED_ICONS.get(pkgKey) || '');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export function Screenshots(props: ScreenshotProps) {
set image to same width. Will need to update if size changes.
*/}
<EuiImage
url={toImage(image.src)}
url={toImage(image.path || image.src)}
alt="screenshot image preview"
size="l"
allowFullScreen
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1132,7 +1132,8 @@ export class EndpointDocGenerator {
path: '/package/endpoint/0.5.0',
icons: [
{
src: '/package/endpoint/0.5.0/img/logo-endpoint-64-color.svg',
path: '/package/endpoint/0.5.0/img/logo-endpoint-64-color.svg',
src: '/img/logo-endpoint-64-color.svg',
size: '16x16',
type: 'image/svg+xml',
},
Expand Down