Skip to content

Commit 33a69f1

Browse files
authored
Updating Table designer Publish dialog according to feedback. (#18259)
1 parent c95891a commit 33a69f1

File tree

4 files changed

+79
-47
lines changed

4 files changed

+79
-47
lines changed

localization/l10n/bundle.l10n.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,7 @@
179179
"Schema": "Schema",
180180
"Back to preview": "Back to preview",
181181
"Copy": "Copy",
182+
"You must review and accept the terms to proceed": "You must review and accept the terms to proceed",
182183
"Connect": "Connect",
183184
"Advanced Connection Settings": "Advanced Connection Settings",
184185
"Advanced": "Advanced",

localization/xliff/vscode-mssql.xlf

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1326,6 +1326,9 @@
13261326
<trans-unit id="++CODE++85a39ab345d672ff8ca9b9c6876f3adcacf45ee7c1e2dbd2408fd338bd55e07e">
13271327
<source xml:lang="en">Yes</source>
13281328
</trans-unit>
1329+
<trans-unit id="++CODE++72f5c8fcf386f50a0af8057b25cbd6d2cbfe99d41c859934b12e7592b60b2690">
1330+
<source xml:lang="en">You must review and accept the terms to proceed</source>
1331+
</trans-unit>
13291332
<trans-unit id="++CODE++4d665ff14f7810a8d97b139336a650d9bf37854683886f2df4679232ec55bae4">
13301333
<source xml:lang="en">Your account needs re-authentication to access {0} resources. Press Open to start the authentication process.</source>
13311334
<note>{0} is the resource</note>

src/reactviews/common/locConstants.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,9 @@ export class LocConstants {
136136
schema: l10n.t("Schema"),
137137
backToPreview: l10n.t("Back to preview"),
138138
copy: l10n.t("Copy"),
139+
youMustReviewAndAccept: l10n.t(
140+
"You must review and accept the terms to proceed",
141+
),
139142
};
140143
}
141144

src/reactviews/pages/TableDesigner/designerChangesPreviewButton.tsx

Lines changed: 72 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -226,58 +226,83 @@ export const DesignerChangesPreviewButton = () => {
226226
</>
227227
);
228228

229-
const previewLoadedSuccessDialogContents = () => (
230-
<>
231-
<DialogContent>
232-
<div className={classes.markdownContainer}>
233-
<ReactMarkdown>
234-
{metadata?.generatePreviewReportResult?.report}
235-
</ReactMarkdown>
236-
</div>
237-
<Checkbox
238-
label={
239-
locConstants.tableDesigner.designerPreviewConfirmation
240-
}
241-
checked={isConfirmationChecked}
242-
onChange={(_event, data) => {
243-
setIsConfirmationChecked(data.checked as boolean);
244-
}}
245-
/>
246-
</DialogContent>
247-
<DialogActions>
248-
<Button
249-
className={classes.updateDatabase}
250-
disabled={
251-
!(
252-
isConfirmationChecked &&
253-
metadata.apiState?.previewState === LoadState.Loaded
254-
)
255-
}
256-
appearance="primary"
257-
onClick={() => {
258-
designerContext.provider.publishChanges();
259-
}}
260-
>
261-
{locConstants.tableDesigner.updateDatabase}
262-
</Button>
263-
<DialogTrigger action="close">
229+
const previewLoadedSuccessDialogContents = () => {
230+
return (
231+
<>
232+
<DialogContent>
233+
<div className={classes.markdownContainer}>
234+
<ReactMarkdown>
235+
{metadata?.generatePreviewReportResult?.report}
236+
</ReactMarkdown>
237+
</div>
238+
<Checkbox
239+
label={
240+
locConstants.tableDesigner
241+
.designerPreviewConfirmation
242+
}
243+
required
244+
checked={isConfirmationChecked}
245+
onChange={(_event, data) => {
246+
setIsConfirmationChecked(data.checked as boolean);
247+
}}
248+
// Setting initial focus on the checkbox when it is rendered.
249+
autoFocus
250+
/**
251+
* The focus outline is not visible on the checkbox when it is focused programmatically.
252+
* This is a workaround to make the focus outline visible on the checkbox when it is focused programmatically.
253+
* This is most likely a bug in the browser.
254+
*/
255+
onFocus={(event) => {
256+
if (event.target.parentElement) {
257+
event.target.parentElement.style.outlineStyle =
258+
"solid";
259+
}
260+
}}
261+
onBlur={(event) => {
262+
if (event.target.parentElement) {
263+
event.target.parentElement.style.outline =
264+
"none";
265+
}
266+
}}
267+
/>
268+
</DialogContent>
269+
<DialogActions>
270+
{getDialogCloseButton()}
271+
<DialogTrigger action="close">
272+
<Button
273+
icon={generateScriptIcon()}
274+
iconPosition="after"
275+
className={classes.openScript}
276+
disabled={
277+
metadata.apiState?.previewState !==
278+
LoadState.Loaded
279+
}
280+
appearance="secondary"
281+
onClick={designerContext.provider.generateScript}
282+
>
283+
{locConstants.tableDesigner.generateScript}
284+
</Button>
285+
</DialogTrigger>
264286
<Button
265-
icon={generateScriptIcon()}
266-
iconPosition="after"
267-
className={classes.openScript}
268-
disabled={
269-
metadata.apiState?.previewState !== LoadState.Loaded
287+
className={classes.updateDatabase}
288+
disabled={!isConfirmationChecked}
289+
title={
290+
!isConfirmationChecked
291+
? locConstants.tableDesigner
292+
.youMustReviewAndAccept
293+
: locConstants.tableDesigner.updateDatabase
270294
}
271295
appearance="primary"
272-
onClick={designerContext.provider.generateScript}
296+
onClick={() => {
297+
designerContext.provider.publishChanges();
298+
}}
273299
>
274-
{locConstants.tableDesigner.generateScript}
300+
{locConstants.tableDesigner.updateDatabase}
275301
</Button>
276-
</DialogTrigger>
277-
{getDialogCloseButton()}
278-
</DialogActions>
279-
</>
280-
);
302+
</DialogActions>
303+
</>
304+
);
305+
};
281306

282307
const getDialogContent = () => {
283308
if (metadata?.apiState?.publishState === LoadState.Loading) {

0 commit comments

Comments
 (0)