Conversation
|
@snide @cchaos Do you know why the tooltip is disabled when the radio group option is disabled? The tooltip behaves weirdly. When the menu is first opened, the tooltip is opened even though the user has not moused over the icon. To reproduce the problem, checkout this PR and create a new dashboard. Before saving the dashboard, click the |
|
My guess would be that it's trying to put focus into the popover and finding the first focusable element which would be the tooltip since the first radio is disabled? |
|
sounds like a good theory. How do I make it stop doing that? |
|
That's definitely what it is. I tried looking at this local but it doesn't seem to work. This is using a context menu which by nature hijacks focus and places it in the first available item within the panel. Off hand I can't think of a quick way around this other than reorganizing your form so that a disabled item isn't first (ex: moving short url before the other options). |
|
Happy to troubleshoot when I get started today (9AM PST) |
|
The short URL option can't be moved because it's dependent on the selection of choosing "snapshot". It's not available for saved objects. Could adding |
|
@cchaos that worked. I will have to create a PR in EUI to pass autoFocus down from the radio group option to the radio input |
|
The nice think about swapping them is that when the saved object option is disabled the help text is more closely coupled with the disabled option. However, when the saved object option is enabled, it's set to the default picked option, which seems odd to me that the default wouldn't be first. |
|
I guess, just to make your life easier, swap the options :). But can you make an issue in EUI that we need to be able pass more options per radio from radio group? |
💔 Build Failed |
💔 Build Failed |
💚 Build Succeeded |
|
can trigger a console error:
Steps to repro:
I think this is because url is stored on state, so when it's set to null after a refresh, it causes the object to re-render. I made some code suggestions here: c61b3ed They are:
Take what you like! Do you think it would be difficult to add a jest test to ensure saved object url copied does not include _a parameter? I made a mistake in my first suggestions code that failed to use the right url and jest tests still passed. |
| allowEmbed: boolean; | ||
| objectId?: string; | ||
| objectType: string; | ||
| getUnhashableStates: () => any[]; |
There was a problem hiding this comment.
Think you can make this object[] to be a little more specific, until we have state definitions.
| ? `Can't share as saved object until the ${this.props.objectType} has been saved.` | ||
| : undefined; | ||
| return ( | ||
| <EuiFormRow label="Generate the link as" helpText={generateLinkAsHelp}> |
There was a problem hiding this comment.
Maybe something to file in EUI, but this shows up as a clickable link which is a little strange.
| ); | ||
| }; | ||
|
|
||
| private handleShortUrlChange = async (evt: any) => { |
There was a problem hiding this comment.
Can you add a comment here to switch this to ChangeEvent<HTMLInputElement> or EuiSwitchChangeCallback once elastic/eui#1134 is fixed?
| try { | ||
| await this.createShortUrl(); | ||
| } catch (fetchError) { | ||
| this.setState( |
There was a problem hiding this comment.
I don't think this will ever be hit because there is already a try/catch inside this.ceateShortUrl. I think you can get rid of this outer one and just add useShortUrl: false inside the catch from createShortUrl
There was a problem hiding this comment.
The error was getting re-thrown. I have cleaned up the logic by moving creatingShortUrl into handleShortUrlChange so its easier to follow the logic
| const defaultUseShortUrl = false; | ||
|
|
||
| this.state = { | ||
| exportUrlAs: defaultExportUrlAs, |
There was a problem hiding this comment.
Can do:
enum ExportUrlAsType {
EXPORT_URL_AS_SAVED_OBJECT = 'savedObject',
EXPORT_URL_AS_SNAPSHOT = 'snapshot',
}
interface State {
exportUrlAs: ExportUrlAsType;
useShortUrl: boolean;
isCreatingShortUrl: boolean;
url?: string;
shortUrl?: string;
shortUrlErrorMsg?: string;
}
...
const defaultExportUrlAs = ExportUrlAsType.EXPORT_URL_AS_SNAPSHOT;
....
id: ExportUrlAsType.EXPORT_URL_AS_SNAPSHOT,
etc, etc
The existing angular implementation stored shortUrl to avoid the network overhead of creating new shortUrl every time the checkbox is selected. The network overhead does not matter much, but if the implementation of |
|
Interesting. I don't think that would need to be part of state, if we wanted to cache the results. Could just store mapping of full url to short url, look it up if available and use that instead of createShortUrl. something like: |
💚 Build Succeeded |
💚 Build Succeeded |
stacey-gammon
left a comment
There was a problem hiding this comment.
Did not pull latest code. Extra test looks good!
💔 Build Failed |
|
jenkins, test this |
💚 Build Succeeded |
* just getting the popover to open and start laying out the context menu * pass getUnhashableStates to ShareMenu * generate original and snapshot ids * move state into ShareUrlContent * start working on form * use radio group * add input for creating short URL * display URL in alert until copy functionallity gets migrated to EUI * allowEmbed prop * replace share directive with showShareContextMenu * fix button styling * add jest test for share_context_menu * use EuiCopy to copy URL, add jest test for ShareUrlContent component * clean up * display short URL create error message in form instead of with toast * switch option order so disbaled option can not be first * fix discover share functional tests * add functions required by reporting * typescript * remove empty file * fix typescript compile error * move import so jest tests work * fix Failed prop type: The proptextToCopyis marked as required inEuiCopy, but its value isundefined * move shortUrl out of react state and into Component object * getUnhashableStates type from any[] to object[] * add comment about type change once EUI issue is solved * add functional test for saved object URL sharing * remove commit
* just getting the popover to open and start laying out the context menu * pass getUnhashableStates to ShareMenu * generate original and snapshot ids * move state into ShareUrlContent * start working on form * use radio group * add input for creating short URL * display URL in alert until copy functionallity gets migrated to EUI * allowEmbed prop * replace share directive with showShareContextMenu * fix button styling * add jest test for share_context_menu * use EuiCopy to copy URL, add jest test for ShareUrlContent component * clean up * display short URL create error message in form instead of with toast * switch option order so disbaled option can not be first * fix discover share functional tests * add functions required by reporting * typescript * remove empty file * fix typescript compile error * move import so jest tests work * fix Failed prop type: The proptextToCopyis marked as required inEuiCopy, but its value isundefined * move shortUrl out of react state and into Component object * getUnhashableStates type from any[] to object[] * add comment about type change once EUI issue is solved * add functional test for saved object URL sharing * remove commit


EUI share top nav