-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
Migrate Embed Query Dialog to React #3783
Conversation
visualization.id}?api_key=${query.api_key}&${query.getParameters().toUrlParams()}`; | ||
|
||
let snapshotUrl; | ||
if (window.snapshotUrlBuilder) { |
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'm not sure what this is for, but I just followed what was in the Angular version.
<h5 className="m-t-0">IFrame Embed</h5> | ||
<div className="m-b-10"> | ||
<Text data-test="EmbedIframe" copyable code> | ||
{`<iframe src="${embedUrl}" width="720" height="391"></iframe>`} |
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.
@gabrieldutra I think it would be better to replace this with <textarea>
- so user will be able to copy it manually and it will not require ellipsis (I personally use this dialog just to get embed URL when I need to test something, so it's a case for having all the code available).
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've considered using a TextArea
too, but I thought the copy button could be a good feature. I'll check it with the TextArea
👍
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 agree with @kravets-levko that we shouldn't use an ellipsis here, but why a textarea?
Seems nice, perhaps without the Checkbox (not really necessary to make width and height disabled since it doesn't really change the behavior) or if you think it has a reason to be there, use a switch instead? |
I agree, it's not necessary - it serves as a hint for "normal" users that the current setting is default and doesn't require adjustment - "ignorable" if you will. Not a must. (A switch I think would be too distracting tho) |
My suggestions to address some common use cases with this dialog:
|
I've updated this based on your comments :), just need some final UI adjustments. @ranbena welcome to give your magic look to it already 😆 My thoughts: now that it has two sections the default look for Form Labels (Width and Height) may be confusing, so it's better with a smaller Those are my ideas, I'll update this tomorrow (technically just later today), but you can already give your comments. |
Last version looks good 👌 One thing I would change: have the copy button always visible instead of only on hover. Also, can you add a screenshot of the dialog when you try to embed with unsafe params? |
I think it looks good as well 👌👌 It's got:
|
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.
Looks great!
Just one request @gabrieldutra - change code block to border-radius: 2px
(similar to Ant components) 🙏
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.
Alternatively with <hr>
(it's sort of cool to separate stuff):
- I've updated the dialog's title: "Embed Code" -> "Embed Query", looks more related to what it is
Embed query spec
- Now that it has a Public URL separate, no need for a regex 🙂.
- With the new alert for unsafe parameters, the flow for getting the URL needs to be done differently (e.g: creating a query with safe parameters, saving the url and then changing it to have unsafe parameters). The simplest was to just remove the snapshot and moving the assertion to the Dialog. This generates a case uncovered from tests, so LMK if there's value on creating another test for the case I mentioned in the example;
CC: @rauchy
@@ -5,7 +5,7 @@ describe('Embedded Queries', () => { | |||
cy.login(); | |||
}); | |||
|
|||
it('are shared without parameters', () => { | |||
it('can be shared without parameters', () => { |
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.
Seemed a better naming to me.
With the right spacing it could be nice. I personally though would instead go with <div class="m-b-30">
<div class="code-block">
…
</div>
</div>
👍 |
👌 |
* Update Antd * Migrate Embed Query Dialog to React * Update jest ScheduleDialog snapshot * Add Alert for unsafe queries * Add CodeBlock * Add inputs to change iframe size * Undo ant update * Update share embed spec * Update styling * Change border-radius to 2px * Update margin between Public URL and IFrame Embed
What type of PR is this? (check all applicable)
Description
It was a pretty simple migration, so it seemed a good opportunity to explore Antd's Typography.
To make Typography's
<code>
better fit the current in Redash we can remove the gray background.Related Tickets & Documents
Mobile & Desktop Screenshots/Recordings (if there are UI changes)
Alert when embedding query containing text parameters
