Skip to content

Commit

Permalink
Merge pull request #5155 from rohitkrai03/help-topology-icon-fix
Browse files Browse the repository at this point in the history
Bug 1826933: Show helm chart icon in group label in topology
  • Loading branch information
openshift-merge-robot committed Apr 29, 2020
2 parents 495e688 + 144a37a commit 9d06fe6
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
11 changes: 8 additions & 3 deletions frontend/packages/console-shared/src/utils/icon-utils.ts
Expand Up @@ -6,9 +6,14 @@ export const getImageForCSVIcon = (icon: CSVIcon | undefined) => {
return icon ? `data:${icon.mediatype};base64,${icon.base64data}` : operatorLogo;
};

export const isIconUrl = (s: string): boolean => {
const urlRegex = /^\s*data:([a-z]+\/[a-z0-9-+.]+(;[a-z-]+=[a-z0-9-]+)?)?(;base64)?,([a-z0-9!$&',()*+;=\-._~:@/?%\s]*)\s*$/i;
return !!s.match(urlRegex);
export const isIconUrl = (url: string): boolean => {
try {
// eslint-disable-next-line no-new
new URL(url);
return true;
} catch {
return false;
}
};

export const getDefaultOperatorIcon = () => operatorLogo;
Expand Up @@ -113,7 +113,7 @@ const HelmReleaseGroup: React.FC<HelmReleaseGroupProps> = ({
paddingY={4}
kind="HelmRelease"
dragRef={dragLabelRef}
typeIconClass="icon-helm"
typeIconClass={element.getData().data.chartIcon || 'icon-helm'}
>
{element.getLabel()}
</SvgBoxedText>
Expand Down
Expand Up @@ -78,6 +78,7 @@ export const getTopologyHelmReleaseGroupItem = (
routes: null,
};
dataModel.data = {
chartIcon: helmResources?.chartIcon,
manifestResources: helmResources?.manifestResources || [],
releaseNotes,
};
Expand Down

0 comments on commit 9d06fe6

Please sign in to comment.