Skip to content

Commit

Permalink
on-prem: target env icons
Browse files Browse the repository at this point in the history
Including an image in the on prem version inside cockpit is not
trivial. We need a bit of a workaround to get the various target icons
showing on the on-prem version in cockpit.
  • Loading branch information
kingsleyzissou committed Jan 20, 2025
1 parent f08e683 commit ba3bf8a
Show file tree
Hide file tree
Showing 7 changed files with 127 additions and 4 deletions.
4 changes: 4 additions & 0 deletions cockpit/webpack.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@ module.exports = {
test: /\.scss$/,
use: [MiniCssExtractPlugin.loader, 'css-loader', 'sass-loader'],
},
{
test: /\.(png|jpe?g|gif|svg)$/i,
type: 'asset/resource', // Handles image files
},
],
},
};
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ import {
} from '@patternfly/react-core';
import { HelpIcon } from '@patternfly/react-icons';

import awsIcon from '../../../../assets/aws.svg';
import gcpIcon from '../../../../assets/google-cloud-short.svg';
import azureIcon from '../../../../assets/microsoft-azure-short.svg';
import oracleIcon from '../../../../assets/oracle-short.svg';
import { useGetArchitecturesQuery } from '../../../../store/backendApi';
import { useAppSelector, useAppDispatch } from '../../../../store/hooks';
import { ImageTypes } from '../../../../store/imageBuilderApi';
Expand Down Expand Up @@ -102,7 +106,11 @@ const TargetEnvironment = () => {
icon={
<img
className="provider-icon"
src={'/apps/frontend-assets/partners-icons/aws.svg'}
src={
process.env.IS_ON_PREMISE
? awsIcon
: '/apps/frontend-assets/partners-icons/aws.svg'
}
alt="Amazon Web Services logo"
/>
}
Expand All @@ -125,7 +133,9 @@ const TargetEnvironment = () => {
<img
className="provider-icon"
src={
'/apps/frontend-assets/partners-icons/google-cloud-short.svg'
process.env.IS_ON_PREMISE
? gcpIcon
: '/apps/frontend-assets/partners-icons/google-cloud-short.svg'
}
alt="Google Cloud Platform logo"
/>
Expand All @@ -149,7 +159,9 @@ const TargetEnvironment = () => {
<img
className="provider-icon"
src={
'/apps/frontend-assets/partners-icons/microsoft-azure-short.svg'
process.env.IS_ON_PREMISE
? azureIcon
: '/apps/frontend-assets/partners-icons/microsoft-azure-short.svg'
}
alt="Microsoft Azure logo"
/>
Expand All @@ -172,7 +184,11 @@ const TargetEnvironment = () => {
icon={
<img
className="provider-icon"
src={'/apps/frontend-assets/partners-icons/oracle-short.svg'}
src={
process.env.IS_ON_PREMISE
? oracleIcon
: '/apps/frontend-assets/partners-icons/oracle-short.svg'
}
alt="Oracle Cloud Infrastructure logo"
/>
}
Expand Down
38 changes: 38 additions & 0 deletions src/assets/aws.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 23 additions & 0 deletions src/assets/google-cloud-short.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions src/assets/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// this is a bit hacky, but we need it
// to be able to import the images
declare module '*.svg' {
const value: string;
export default value;
}
23 changes: 23 additions & 0 deletions src/assets/microsoft-azure-short.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 13 additions & 0 deletions src/assets/oracle-short.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit ba3bf8a

Please sign in to comment.