-
Notifications
You must be signed in to change notification settings - Fork 58
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Toast on CustomPanels #415
Conversation
* Panel View (legacy) - Duplicate - Rename Signed-off-by: Peter Fitzgibbons <[email protected]>
Signed-off-by: Peter Fitzgibbons <[email protected]>
Signed-off-by: Peter Fitzgibbons <[email protected]>
@@ -77,7 +77,7 @@ describe('Creating visualizations', () => { | |||
}); | |||
}); | |||
|
|||
describe('Testing panels table', () => { | |||
describe.only('Testing panels table', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel the .only
, commented code
and console.log
additions were part of cypress debugging. We can remove these.
@@ -222,17 +230,16 @@ export const CustomPanelTable = ({ | |||
'Duplicate Dashboard', | |||
'Cancel', | |||
'Duplicate', | |||
selectedCustomPanels[0].title + ' (copy)', | |||
selectedCustomPanels[0].title + ' (copy)x', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can remove the x
typo here.
services: { toasts }, | ||
} = useOpenSearchDashboards<ObservabilityAppServices>(); | ||
|
||
const setToast = (title: string, color: Color = 'success', text?, side?: string) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can remove the side parameter, if not being used.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Side is used when toast during flyout. So unless toast on right-side is OK while visualization flyout and others are active, only then could we remove it.
Side is being passed-through on OSD API
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I may be missing something here. Can you please explain how are you using/passing down the side parameter in this function?
addSamplePanels, | ||
}: Props) => { | ||
const customPanels = useSelector<CustomPanelType[]>(selectPanelList); | ||
const [isModalVisible, setIsModalVisible] = useState(false); // Modal Toggle | ||
const [modalLayout, setModalLayout] = useState(<EuiOverlayMask />); // Modal Layout | ||
const [isActionsPopoverOpen, setIsActionsPopoverOpen] = useState(false); | ||
const [selectedCustomPanels, setselectedCustomPanels] = useState<CustomPanelType[]>([]); | ||
const [selectedCustomPanels, setselectedCustomPanels$] = useState<CustomPanelType[]>([]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if the $
is expected here. I see the below reference is setselectedCustomPanels
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was debugging. Will double-check.
const newPanel = newPanelTemplate(newCustomPanelName); | ||
dispatch(createPanel(newPanel)); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we add a toast for create panel here?
From the change in panel_slice.tsx
, I see that we are not redirecting to a new panel when created. So, the user stays in home table page after the panel is created.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should be redirecting - that is the current behavior?
'Error cloning Operational Panel, please make sure you have the correct permission.', | ||
'danger' | ||
); | ||
console.log(err); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should replace console.log
with console.error
to show errors.
@@ -111,27 +134,31 @@ describe('Panels View Component', () => { | |||
window.location.assign(`#/event_analytics/explorer/${savedVisId}`); | |||
}; | |||
|
|||
const services = { toasts: { addDanger: (t) => {} } } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i added a mock here
const coreStart = coreMock.createStart(); |
@@ -0,0 +1,40 @@ | |||
import { createSlice } from '@reduxjs/toolkit'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
license header missing
@@ -137,6 +138,10 @@ export class ObservabilityPlugin | |||
const savedObjects = new SavedObjects(coreStart.http); | |||
const timestampUtils = new TimestampUtils(dslService, pplService); | |||
|
|||
const services: ObservabilityAppServices = { | |||
toasts: coreStart.notifications.toasts, | |||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is this another service and not using your coreRefs
?
also backport to main? |
Description
Apply OSD GlobalToast to CustomPanels
Issues Resolved
Check List
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.