mirror of
https://github.com/ansible/awx.git
synced 2026-01-12 18:40:01 -03:30
updates product name in About modal
This commit is contained in:
parent
3f44c5d18b
commit
fb91c8fba1
@ -1,4 +1,5 @@
|
||||
{
|
||||
"BRAND_NAME": "Ansible AWX",
|
||||
"COMPONENT_NAME": "",
|
||||
"PENDO_API_KEY": ""
|
||||
}
|
||||
|
||||
@ -5,9 +5,14 @@ import { AboutModal } from '@patternfly/react-core';
|
||||
import useBrandName from 'hooks/useBrandName';
|
||||
|
||||
function About({ version, isOpen, onClose }) {
|
||||
const brandName = useBrandName();
|
||||
const {
|
||||
current: { brandName, componentName },
|
||||
} = useBrandName();
|
||||
const createSpeechBubble = () => {
|
||||
let text = `${brandName.current} ${version}`;
|
||||
let text =
|
||||
componentName !== ''
|
||||
? `${brandName} ${componentName} ${version}`
|
||||
: `${brandName} ${version}`;
|
||||
let top = '';
|
||||
let bottom = '';
|
||||
|
||||
@ -31,7 +36,7 @@ function About({ version, isOpen, onClose }) {
|
||||
<AboutModal
|
||||
isOpen={isOpen}
|
||||
onClose={onClose}
|
||||
productName={brandName.current}
|
||||
productName={brandName}
|
||||
trademark={`${copyright} ${new Date().getFullYear()} ${redHatInc}`}
|
||||
brandImageSrc="/static/media/logo-header.svg"
|
||||
brandImageAlt={t`Brand Image`}
|
||||
|
||||
@ -5,7 +5,7 @@ import About from './About';
|
||||
jest.mock('../../hooks/useBrandName', () => ({
|
||||
__esModule: true,
|
||||
default: () => ({
|
||||
current: 'AWX',
|
||||
current: { brandName: 'AWX', componentName: '' },
|
||||
}),
|
||||
}));
|
||||
|
||||
|
||||
@ -22,6 +22,7 @@ describe('<AppContainer />', () => {
|
||||
RootAPI.readAssetVariables.mockResolvedValue({
|
||||
data: {
|
||||
BRAND_NAME: 'AWX',
|
||||
COMPONENT_NAME: '',
|
||||
PENDO_API_KEY: 'some-pendo-key',
|
||||
},
|
||||
});
|
||||
@ -99,6 +100,7 @@ describe('<AppContainer />', () => {
|
||||
RootAPI.readAssetVariables.mockResolvedValue({
|
||||
data: {
|
||||
BRAND_NAME: 'AWX',
|
||||
COMPONENT_NAME: '',
|
||||
PENDO_API_KEY: '',
|
||||
},
|
||||
});
|
||||
|
||||
@ -2,18 +2,18 @@ import { useEffect, useRef } from 'react';
|
||||
import { RootAPI } from 'api';
|
||||
|
||||
export default function useBrandName() {
|
||||
const brandName = useRef('');
|
||||
const platform = useRef({});
|
||||
|
||||
useEffect(() => {
|
||||
async function fetchBrandName() {
|
||||
const {
|
||||
data: { BRAND_NAME },
|
||||
data: { BRAND_NAME, COMPONENT_NAME },
|
||||
} = await RootAPI.readAssetVariables();
|
||||
|
||||
brandName.current = BRAND_NAME;
|
||||
platform.current.brandName = BRAND_NAME;
|
||||
platform.current.componentName = COMPONENT_NAME || '';
|
||||
}
|
||||
fetchBrandName();
|
||||
}, []);
|
||||
|
||||
return brandName;
|
||||
return platform;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user