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