console: add tracking events for import from openapi

## Description 🔖

closes https://hasurahq.atlassian.net/browse/GS-323

This PR add a couple of hooks to properly track import from OpenAPI feature.

This is needed because we tried to track the events using "Target Text" but it doesn't seem to work.

<img width="959" alt="image" src="https://user-images.githubusercontent.com/5709409/209819331-25245f4b-5ec9-4f84-8a0b-daa4133db540.png">

[GS-323]: https://hasurahq.atlassian.net/browse/GS-323?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7406
Co-authored-by: Sooraj <8408875+soorajshankar@users.noreply.github.com>
GitOrigin-RevId: ac6c3da1b2c9c9fbf3ca7363595e34e93ef19d1e
This commit is contained in:
Daniele Cammareri 2023-01-10 10:27:48 +01:00 committed by hasura-bot
parent 99fb6ac22f
commit 0d9575a88a
2 changed files with 10 additions and 3 deletions

View File

@ -146,9 +146,14 @@ const ActionEditor: React.FC<ActionEditorProps> = ({
isProConsole(window.__env) &&
(isImportFromOASEnabled ? (
<div className="mb-xs">
<Button icon={<FaMagic />} onClick={onOpenActionGenerator}>
Import from OpenAPI
</Button>
<Analytics
name="action-tab-btn-import-action-from-openapi"
passHtmlAttributesToChildren
>
<Button icon={<FaMagic />} onClick={onOpenActionGenerator}>
Import from OpenAPI
</Button>
</Analytics>
</div>
) : (
<FeatureFlagToast

View File

@ -30,6 +30,8 @@ export const OasGeneratorModal = (props: OasGeneratorModalProps) => {
onClose={onClose}
callToDeny="Cancel"
callToAction="Generate Action"
onSubmitAnalyticsName="action-tab-btn-generate-import-action-from-openapi"
onCancelAnalyticsName="action-tab-btn-cancel-import-action-from-openapi"
disabled={!values}
/>
}