multi: fix analytics for on-prem

This commit fixes some more analytics calls happening in the on-prem
frontend.
This commit is contained in:
Gianluca Zuccarelli 2025-07-01 16:03:13 +01:00 committed by Klara Simickova
parent 2ce62d4ef0
commit 2f765a1d4b
3 changed files with 38 additions and 21 deletions

View file

@ -57,11 +57,13 @@ export const BuildImagesButton = ({ children }: BuildImagesButtonPropTypes) => {
),
},
});
analytics.track(`${AMPLITUDE_MODULE_NAME} - Image Requested`, {
module: AMPLITUDE_MODULE_NAME,
trigger: 'synchronize images',
account_id: userData?.identity.internal?.account_id || 'Not found',
});
if (!process.env.IS_ON_PREMISE) {
analytics.track(`${AMPLITUDE_MODULE_NAME} - Image Requested`, {
module: AMPLITUDE_MODULE_NAME,
trigger: 'synchronize images',
account_id: userData?.identity.internal?.account_id || 'Not found',
});
}
}
};
const [isOpen, setIsOpen] = useState(false);

View file

@ -163,13 +163,15 @@ export const AwsDetails = ({ compose }: AwsDetailsPropTypes) => {
clickTip="Copied"
variant="inline-compact"
onClick={() => {
analytics.track(`${AMPLITUDE_MODULE_NAME} - Copy UUID`, {
module: AMPLITUDE_MODULE_NAME,
link_name: compose.id,
current_path: window.location.pathname,
account_id:
userData?.identity.internal?.account_id || 'Not found',
});
if (!process.env.IS_ON_PREMISE) {
analytics.track(`${AMPLITUDE_MODULE_NAME} - Copy UUID`, {
module: AMPLITUDE_MODULE_NAME,
link_name: compose.id,
current_path: window.location.pathname,
account_id:
userData?.identity.internal?.account_id || 'Not found',
});
}
}}
>
{compose.id}
@ -203,16 +205,18 @@ export const AwsDetails = ({ compose }: AwsDetailsPropTypes) => {
// https://docs.aws.amazon.com/signin/latest/userguide/sign-in-urls-defined.html
href={`https://${options.share_with_accounts[0]}.signin.aws.amazon.com/console/`}
onClick={() => {
analytics.track(`${AMPLITUDE_MODULE_NAME} - Link Clicked`, {
module: AMPLITUDE_MODULE_NAME,
if (!process.env.IS_ON_PREMISE) {
analytics.track(`${AMPLITUDE_MODULE_NAME} - Link Clicked`, {
module: AMPLITUDE_MODULE_NAME,
link_name: options.share_with_accounts
? options.share_with_accounts[0]
: '',
current_path: window.location.pathname,
account_id:
userData?.identity.internal?.account_id || 'Not found',
});
link_name: options.share_with_accounts
? options.share_with_accounts[0]
: '',
current_path: window.location.pathname,
account_id:
userData?.identity.internal?.account_id || 'Not found',
});
}
}}
>
{options.share_with_accounts[0]}

View file

@ -94,6 +94,7 @@ export type wizardState = {
shareMethod: AwsShareMethod;
source: V1ListSourceResponseItem | undefined;
sourceId?: string | undefined;
region?: string | undefined;
};
azure: {
shareMethod: AzureShareMethod;
@ -189,6 +190,7 @@ export const initialState: wizardState = {
accountId: '',
shareMethod: 'sources',
source: undefined,
region: 'us-east-1',
},
azure: {
shareMethod: 'sources',
@ -312,6 +314,10 @@ export const selectAwsShareMethod = (state: RootState) => {
return state.wizard.aws.shareMethod;
};
export const selectAwsRegion = (state: RootState) => {
return state.wizard.aws.region;
};
export const selectAzureTenantId = (state: RootState) => {
return state.wizard.azure.tenantId;
};
@ -534,10 +540,14 @@ export const wizardSlice = createSlice({
changeAwsSourceId: (state, action: PayloadAction<string | undefined>) => {
state.aws.sourceId = action.payload;
},
changeAwsRegion: (state, action: PayloadAction<string | undefined>) => {
state.aws.region = action.payload;
},
reinitializeAws: (state) => {
state.aws.accountId = '';
state.aws.shareMethod = 'sources';
state.aws.source = undefined;
state.aws.region = 'us-east-1';
},
changeAzureTenantId: (state, action: PayloadAction<string>) => {
state.azure.tenantId = action.payload;
@ -1136,6 +1146,7 @@ export const {
changeAwsAccountId,
changeAwsShareMethod,
changeAwsSourceId,
changeAwsRegion,
reinitializeAws,
changeAzureTenantId,
changeAzureShareMethod,