Skip to content

Commit

Permalink
Fix events home table and toast life time (#1170)
Browse files Browse the repository at this point in the history
* Fix 2.11 UX issues

Signed-off-by: Kavitha Conjeevaram Mohan <mohakavi@amazon.com>

* Change toast time life

Signed-off-by: Kavitha Conjeevaram Mohan <mohakavi@amazon.com>

* update snapshots

Signed-off-by: Kavitha Conjeevaram Mohan <mohakavi@amazon.com>

---------

Signed-off-by: Kavitha Conjeevaram Mohan <mohakavi@amazon.com>
  • Loading branch information
kavithacm authored Oct 24, 2023
1 parent a2f9a00 commit a9b36fc
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 9 deletions.
4 changes: 2 additions & 2 deletions public/components/event_analytics/explorer/explorer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -826,7 +826,7 @@ export const Explorer = ({
setLiveTailName(name);
setLiveTailTabId((curSelectedTabId.current as unknown) as string);
setIsLiveTailOn(true);
setToast('Live tail On', 'success');
setToast('Live tail On', 'success', '', 'right', 2000);
setIsLiveTailPopoverOpen(false);
setLiveTimestamp(
dateMath.parse(endingTime, { roundUp: true })?.utc().format(DATE_PICKER_FORMAT) || ''
Expand All @@ -851,7 +851,7 @@ export const Explorer = ({
setIsLiveTailOn(false);
setLiveHits(0);
setIsLiveTailPopoverOpen(false);
if (isLiveTailOnRef.current) setToast('Live tail Off', 'danger');
if (isLiveTailOnRef.current) setToast('Live tail Off', 'danger', '', 'right', 2000);
};

useEffect(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ exports[`Saved query table component Renders saved query table 1`] = `
"filters": Array [
Object {
"field": "type",
"multiSelect": false,
"multiSelect": "or",
"name": "Type",
"options": Array [
Object {
Expand Down Expand Up @@ -186,7 +186,7 @@ exports[`Saved query table component Renders saved query table 1`] = `
Array [
Object {
"field": "type",
"multiSelect": false,
"multiSelect": "or",
"name": "Type",
"options": Array [
Object {
Expand Down Expand Up @@ -334,7 +334,7 @@ exports[`Saved query table component Renders saved query table 1`] = `
Array [
Object {
"field": "type",
"multiSelect": false,
"multiSelect": "or",
"name": "Type",
"options": Array [
Object {
Expand Down Expand Up @@ -386,7 +386,7 @@ exports[`Saved query table component Renders saved query table 1`] = `
config={
Object {
"field": "type",
"multiSelect": false,
"multiSelect": "or",
"name": "Type",
"options": Array [
Object {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ export function SavedQueryTable({
type: 'field_value_selection',
field: 'type',
name: 'Type',
multiSelect: false,
multiSelect: 'or',
options: FILTER_OPTIONS.map((i) => ({
value: i,
name: i,
Expand Down
12 changes: 10 additions & 2 deletions public/components/event_analytics/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,23 @@ export const EventAnalytics = ({
...props
}: EventAnalyticsProps) => {
const [toasts, setToasts] = useState<Toast[]>([]);
const [toastLifeTime, setToastLifeTime] = useState(6000);

const eventAnalyticsBreadcrumb = {
text: 'Logs',
href: '#/',
};

const setToast = (title: string, color = 'success', text?: ReactChild, side?: string) => {
const setToast = (
title: string,
color = 'success',
text?: ReactChild,
side?: string,
toastLifeTimeMs?: number
) => {
if (!text) text = '';
setToasts([...toasts, { id: new Date().toISOString(), title, text, color } as Toast]);
if (toastLifeTimeMs) setToastLifeTime(toastLifeTimeMs);
};

return (
Expand All @@ -49,7 +57,7 @@ export const EventAnalytics = ({
dismissToast={(removedToast) => {
setToasts(toasts.filter((toast) => toast.id !== removedToast.id));
}}
toastLifeTimeMs={6000}
toastLifeTimeMs={toastLifeTime}
/>
<HashRouter>
<Switch>
Expand Down

0 comments on commit a9b36fc

Please sign in to comment.