mirror of
https://github.com/Unleash/unleash.git
synced 2025-02-04 00:18:01 +01:00
feat: playground try configuration mode (#7752)
This commit is contained in:
parent
6dde9082f1
commit
ecdae7fee7
@ -1,6 +1,6 @@
|
|||||||
import { type FormEventHandler, useEffect, useState, type FC } from 'react';
|
import { type FC, type FormEventHandler, useEffect, useState } from 'react';
|
||||||
import { useSearchParams } from 'react-router-dom';
|
import { useSearchParams } from 'react-router-dom';
|
||||||
import { Box, Paper, useTheme, styled, Alert } from '@mui/material';
|
import { Alert, Box, Paper, styled, useTheme } from '@mui/material';
|
||||||
import { PageContent } from 'component/common/PageContent/PageContent';
|
import { PageContent } from 'component/common/PageContent/PageContent';
|
||||||
import { PageHeader } from 'component/common/PageHeader/PageHeader';
|
import { PageHeader } from 'component/common/PageHeader/PageHeader';
|
||||||
import useToast from 'hooks/useToast';
|
import useToast from 'hooks/useToast';
|
||||||
@ -246,14 +246,27 @@ export const AdvancedPlayground: FC<{
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const trackTryConfiguration = () => {
|
||||||
|
let mode: 'default' | 'api_token' | 'change_request' = 'default';
|
||||||
|
if (token && token !== '') {
|
||||||
|
mode = 'api_token';
|
||||||
|
} else if (changeRequest) {
|
||||||
|
mode = 'change_request';
|
||||||
|
}
|
||||||
|
trackEvent('playground', {
|
||||||
|
props: {
|
||||||
|
eventType: 'try-configuration',
|
||||||
|
mode,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
const onSubmit: FormEventHandler<HTMLFormElement> = async (event) => {
|
const onSubmit: FormEventHandler<HTMLFormElement> = async (event) => {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
|
||||||
setHasFormBeenSubmitted(true);
|
setHasFormBeenSubmitted(true);
|
||||||
|
|
||||||
if (token && token !== '') {
|
trackTryConfiguration();
|
||||||
trackEvent('playground_token_input_used');
|
|
||||||
}
|
|
||||||
|
|
||||||
await evaluatePlaygroundContext(environments, projects, context, () => {
|
await evaluatePlaygroundContext(environments, projects, context, () => {
|
||||||
setURLParameters();
|
setURLParameters();
|
||||||
|
Loading…
Reference in New Issue
Block a user