mirror of
https://github.com/ansible/awx.git
synced 2026-01-09 23:12:08 -03:30
Merge pull request #10239 from mabashian/disable-pendo
Only initialize pendo if the key is available SUMMARY Don't bootstrap/init pendo if the key is missing or empty string Reviewed-by: Jake McDermott <yo@jakemcdermott.me> Reviewed-by: Tiago Góes <tiago.goes2009@gmail.com>
This commit is contained in:
commit
d6c5a23e05
@ -22,7 +22,7 @@ describe('<AppContainer />', () => {
|
||||
RootAPI.readAssetVariables.mockResolvedValue({
|
||||
data: {
|
||||
BRAND_NAME: 'AWX',
|
||||
PENDO_API_KEY: '',
|
||||
PENDO_API_KEY: 'some-pendo-key',
|
||||
},
|
||||
});
|
||||
MeAPI.read.mockResolvedValue({ data: { results: [{}] } });
|
||||
@ -37,7 +37,7 @@ describe('<AppContainer />', () => {
|
||||
test('expected content is rendered', async () => {
|
||||
const routeConfig = [
|
||||
{
|
||||
groupTitle: 'Group One',
|
||||
groupTitle: <span>Group One</span>,
|
||||
groupId: 'group_one',
|
||||
routes: [
|
||||
{ title: 'Foo', path: '/foo' },
|
||||
@ -45,7 +45,7 @@ describe('<AppContainer />', () => {
|
||||
],
|
||||
},
|
||||
{
|
||||
groupTitle: 'Group Two',
|
||||
groupTitle: <span>Group Two</span>,
|
||||
groupId: 'group_two',
|
||||
routes: [{ title: 'Fiz', path: '/fiz' }],
|
||||
},
|
||||
@ -95,7 +95,36 @@ describe('<AppContainer />', () => {
|
||||
expect(global.pendo.initialize).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
|
||||
test('expected content is rendered', async () => {
|
||||
test('Pendo not initialized when key is missing', async () => {
|
||||
RootAPI.readAssetVariables.mockResolvedValue({
|
||||
data: {
|
||||
BRAND_NAME: 'AWX',
|
||||
PENDO_API_KEY: '',
|
||||
},
|
||||
});
|
||||
let wrapper;
|
||||
await act(async () => {
|
||||
wrapper = mountWithContexts(<AppContainer />, {
|
||||
context: {
|
||||
config: {
|
||||
analytics_status: 'detailed',
|
||||
ansible_version: null,
|
||||
custom_virtualenvs: [],
|
||||
version: '9000',
|
||||
me: { is_superuser: true },
|
||||
toJSON: () => '/config/',
|
||||
license_info: {
|
||||
valid_key: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
});
|
||||
wrapper.update();
|
||||
expect(global.pendo.initialize).toHaveBeenCalledTimes(0);
|
||||
});
|
||||
|
||||
test('Pendo not initialized when status is analytics off', async () => {
|
||||
let wrapper;
|
||||
await act(async () => {
|
||||
wrapper = mountWithContexts(<AppContainer />, {
|
||||
|
||||
@ -53,13 +53,15 @@ async function issuePendoIdentity(config) {
|
||||
const {
|
||||
data: { PENDO_API_KEY },
|
||||
} = await RootAPI.readAssetVariables();
|
||||
bootstrapPendo(PENDO_API_KEY);
|
||||
const pendoOptions = buildPendoOptions(config, PENDO_API_KEY);
|
||||
const pendoOptionsWithRole = await buildPendoOptionsRole(
|
||||
pendoOptions,
|
||||
config
|
||||
);
|
||||
window.pendo.initialize(pendoOptionsWithRole);
|
||||
if (PENDO_API_KEY && PENDO_API_KEY !== '') {
|
||||
bootstrapPendo(PENDO_API_KEY);
|
||||
const pendoOptions = buildPendoOptions(config, PENDO_API_KEY);
|
||||
const pendoOptionsWithRole = await buildPendoOptionsRole(
|
||||
pendoOptions,
|
||||
config
|
||||
);
|
||||
window.pendo.initialize(pendoOptionsWithRole);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user