-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add infra monitoring - host lists - usage events (#6536)
* feat: add usasge events * feat: add reqrest early access events
- Loading branch information
Showing
11 changed files
with
232 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
frontend/src/components/HostMetricsDetail/WaitlistFragment/WaitListFragment.styles.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
.wait-list-container { | ||
display: flex; | ||
flex-direction: column; | ||
gap: 8px; | ||
|
||
.wait-list-text { | ||
font-weight: 300; | ||
} | ||
|
||
.join-waitlist-btn { | ||
width: 160px; | ||
border-radius: 2px; | ||
background: var(--slate-500); | ||
} | ||
} |
75 changes: 75 additions & 0 deletions
75
frontend/src/components/HostMetricsDetail/WaitlistFragment/WaitlistFragment.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
import './WaitListFragment.styles.scss'; | ||
|
||
import { Color } from '@signozhq/design-tokens'; | ||
import { Button, Typography } from 'antd'; | ||
import logEvent from 'api/common/logEvent'; | ||
import { useNotifications } from 'hooks/useNotifications'; | ||
import { CheckCircle2, HandPlatter } from 'lucide-react'; | ||
import { useState } from 'react'; | ||
import { useTranslation } from 'react-i18next'; | ||
import { useSelector } from 'react-redux'; | ||
import { AppState } from 'store/reducers'; | ||
import AppReducer from 'types/reducer/app'; | ||
|
||
export default function WaitlistFragment({ | ||
entityType, | ||
}: { | ||
entityType: string; | ||
}): JSX.Element { | ||
const { user } = useSelector<AppState, AppReducer>((state) => state.app); | ||
const { t } = useTranslation(['infraMonitoring']); | ||
const { notifications } = useNotifications(); | ||
|
||
const [isSubmitting, setIsSubmitting] = useState(false); | ||
const [isSuccess, setIsSuccess] = useState(false); | ||
|
||
const handleJoinWaitlist = (): void => { | ||
if (!user || !user.email) return; | ||
|
||
setIsSubmitting(true); | ||
|
||
logEvent('Infra Monitoring: Get Early Access Clicked', { | ||
entity_type: entityType, | ||
userEmail: user.email, | ||
}) | ||
.then(() => { | ||
notifications.success({ | ||
message: t('waitlist_success_message'), | ||
}); | ||
|
||
setIsSubmitting(false); | ||
setIsSuccess(true); | ||
|
||
setTimeout(() => { | ||
setIsSuccess(false); | ||
}, 4000); | ||
}) | ||
.catch((error) => { | ||
console.error('Error logging event:', error); | ||
}); | ||
}; | ||
|
||
return ( | ||
<div className="wait-list-container"> | ||
<Typography.Text className="wait-list-text"> | ||
{t('waitlist_message')} | ||
</Typography.Text> | ||
|
||
<Button | ||
className="periscope-btn join-waitlist-btn" | ||
type="default" | ||
loading={isSubmitting} | ||
icon={ | ||
isSuccess ? ( | ||
<CheckCircle2 size={16} color={Color.BG_FOREST_500} /> | ||
) : ( | ||
<HandPlatter size={16} /> | ||
) | ||
} | ||
onClick={handleJoinWaitlist} | ||
> | ||
Get early access | ||
</Button> | ||
</div> | ||
); | ||
} |
Oops, something went wrong.