Skip to content

Commit 063dd79

Browse files
author
Aasim Khan
committed
Refactor dialog modes to use 'standalone' instead of 'shell' and introduce ConnectionSubDialogDisplayType for consistency across components
1 parent 1272013 commit 063dd79

6 files changed

Lines changed: 32 additions & 46 deletions

File tree

extensions/mssql/src/reactviews/pages/AddFirewallRule/addFirewallRule.component.tsx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ import { IMssqlAzureTenant } from "../../../sharedInterfaces/azureAccountManagem
3737
import { addNewMicrosoftAccount } from "../../common/constants";
3838
import { DialogPageShell } from "../../common/dialogPageShell";
3939
import { AddFirewallRuleIcon } from "../../common/icons/addFirewallRule";
40+
import { ConnectionSubDialogDisplayType } from "../../../sharedInterfaces/connectionDialog";
4041

4142
enum IpSelectionMode {
4243
SpecificIp = "specificIp",
@@ -62,20 +63,18 @@ const useStyles = makeStyles({
6263
},
6364
});
6465

65-
export type AddFirewallRuleDialogMode = "shell" | "modal";
66-
6766
export const AddFirewallRuleDialog = ({
6867
state,
6968
addFirewallRule,
7069
closeDialog,
7170
signIntoAzure,
72-
mode = "shell",
71+
mode = "standalone",
7372
}: {
7473
state: AddFirewallRuleState;
7574
addFirewallRule: (firewallRuleSpec: FirewallRuleSpec) => void;
7675
closeDialog: () => void;
7776
signIntoAzure: () => void;
78-
mode?: AddFirewallRuleDialogMode;
77+
mode?: ConnectionSubDialogDisplayType;
7978
}) => {
8079
const styles = useStyles();
8180
const formStyles = useFormStyles();
@@ -328,7 +327,7 @@ export const AddFirewallRuleDialog = ({
328327
</div>
329328
);
330329

331-
if (mode === "shell") {
330+
if (mode === "standalone") {
332331
return (
333332
<DialogPageShell
334333
icon={<AddFirewallRuleIcon aria-label={dialogTitle} />}

extensions/mssql/src/reactviews/pages/AddFirewallRule/addFirewallRulePage.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export const AddFirewallRulePage = () => {
2828

2929
return (
3030
<AddFirewallRuleDialog
31-
mode="shell"
31+
mode="standalone"
3232
state={{
3333
serverName,
3434
message: message!,

extensions/mssql/src/reactviews/pages/ChangePassword/changePasswordDialog.tsx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import { ChangePasswordResult } from "../../../sharedInterfaces/changePassword";
2323
import { locConstants } from "../../common/locConstants";
2424
import { DialogPageShell } from "../../common/dialogPageShell";
2525
import { ChangePasswordIcon } from "../../common/icons/changePassword";
26+
import { ConnectionSubDialogDisplayType } from "../../../sharedInterfaces/connectionDialog";
2627

2728
const useStyles = makeStyles({
2829
root: {
@@ -61,20 +62,18 @@ const useStyles = makeStyles({
6162
},
6263
});
6364

64-
export type ChangePasswordDialogMode = "shell" | "modal";
65-
6665
export const ChangePasswordDialog = ({
6766
onClose,
6867
onSubmit,
6968
serverName,
7069
userName,
71-
mode = "shell",
70+
mode = "standalone",
7271
}: {
7372
onClose?: () => void;
7473
onSubmit?: (password: string) => Promise<ChangePasswordResult | undefined>;
7574
serverName?: string;
7675
userName?: string;
77-
mode?: ChangePasswordDialogMode;
76+
mode?: ConnectionSubDialogDisplayType;
7877
}) => {
7978
const styles = useStyles();
8079
const [showPassword, setShowPassword] = useState(false);
@@ -218,7 +217,7 @@ export const ChangePasswordDialog = ({
218217
);
219218
};
220219

221-
if (mode === "shell") {
220+
if (mode === "standalone") {
222221
return (
223222
<DialogPageShell
224223
icon={<ChangePasswordIcon aria-label={locConstants.changePasswordDialog.title} />}

extensions/mssql/src/reactviews/pages/ConnectionGroup/connectionGroup.component.tsx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ import {
3737
import { useState } from "react";
3838
import { KeyCode } from "../../common/keys";
3939
import { DialogPageShell } from "../../common/dialogPageShell";
40+
import { ConnectionSubDialogDisplayType } from "../../../sharedInterfaces/connectionDialog";
4041

4142
const useStyles = makeStyles({
4243
previewColor: {
@@ -86,12 +87,12 @@ export const ConnectionGroupDialog = ({
8687
state,
8788
saveConnectionGroup,
8889
closeDialog,
89-
mode = "shell",
90+
mode = "standalone",
9091
}: {
9192
state: ConnectionGroupState;
9293
saveConnectionGroup: (connectionGroupSpec: ConnectionGroupSpec) => void;
9394
closeDialog: () => void;
94-
mode?: ConnectionGroupDialogMode;
95+
mode?: ConnectionSubDialogDisplayType;
9596
}) => {
9697
const formStyles = useFormStyles();
9798
const styles = useStyles();
@@ -250,7 +251,7 @@ export const ConnectionGroupDialog = ({
250251
</form>
251252
);
252253

253-
if (mode === "shell") {
254+
if (mode === "standalone") {
254255
return (
255256
<DialogPageShell
256257
icon={<FolderAdd24Regular aria-label={dialogTitle} />}
@@ -280,5 +281,3 @@ export const ConnectionGroupDialog = ({
280281
</Dialog>
281282
);
282283
};
283-
284-
export type ConnectionGroupDialogMode = "shell" | "modal";

extensions/mssql/src/reactviews/pages/UserSurvey/userSurveyPage.tsx

Lines changed: 17 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,11 @@ const useStyles = makeStyles({
5757
gap: "10px",
5858
alignItems: "flex-start",
5959
},
60+
privacyContent: {
61+
display: "flex",
62+
flexDirection: "column",
63+
gap: "8px",
64+
},
6065
privacyIcon: {
6166
color: "var(--vscode-descriptionForeground)",
6267
flexShrink: 0,
@@ -66,10 +71,6 @@ const useStyles = makeStyles({
6671
color: "var(--vscode-descriptionForeground)",
6772
lineHeight: "1.5",
6873
},
69-
privacyDivider: {
70-
marginTop: "12px",
71-
marginBottom: "12px",
72-
},
7374
privacyExpandedText: {
7475
color: "var(--vscode-descriptionForeground)",
7576
lineHeight: "1.5",
@@ -86,7 +87,6 @@ export const UserSurveyPage = () => {
8687
const cancelButtonText = useUserSurveySelector((s) => s?.cancelButtonText);
8788
const [isSubmitDisabled, setIsSubmitDisabled] = useState(true);
8889
const [userAnswers, setUserAnswers] = useState<Answers>({});
89-
const [isPrivacyExpanded, setIsPrivacyExpanded] = useState(false);
9090

9191
const updateSubmitButtonState = () => {
9292
for (let i = 0; i < questions!.length; i++) {
@@ -172,36 +172,23 @@ export const UserSurveyPage = () => {
172172
<div className={classes.privacyNoticeCard}>
173173
<div className={classes.privacyHeader}>
174174
<Shield20Regular className={classes.privacyIcon} />
175-
<Text className={classes.privacySummary}>
176-
<Text weight="semibold">
177-
{locConstants.userFeedback.privacyNotice}
178-
</Text>{" "}
179-
- {locConstants.userFeedback.feedbackStatementShort}{" "}
175+
<div className={classes.privacyContent}>
176+
<Text className={classes.privacySummary}>
177+
<Text weight="semibold">
178+
{locConstants.userFeedback.privacyNotice}
179+
</Text>
180+
</Text>
181+
<Text className={classes.privacyExpandedText}>
182+
{locConstants.userFeedback.feedbackStatementLong}
183+
</Text>
180184
<Link
181185
onClick={() => {
182-
setIsPrivacyExpanded((current) => !current);
186+
context.openPrivacyStatement();
183187
}}>
184-
{isPrivacyExpanded
185-
? `${locConstants.userFeedback.hideFullStatement} \u2191`
186-
: `${locConstants.userFeedback.readFullStatement} \u2193`}
188+
{locConstants.userFeedback.privacyStatement}
187189
</Link>
188-
</Text>
190+
</div>
189191
</div>
190-
191-
{isPrivacyExpanded && (
192-
<>
193-
<Divider className={classes.privacyDivider} />
194-
<Text className={classes.privacyExpandedText}>
195-
{locConstants.userFeedback.feedbackStatementLong}{" "}
196-
<Link
197-
onClick={() => {
198-
context.openPrivacyStatement();
199-
}}>
200-
{locConstants.userFeedback.privacyStatement}
201-
</Link>
202-
</Text>
203-
</>
204-
)}
205192
</div>
206193
</div>
207194
</div>

extensions/mssql/src/sharedInterfaces/connectionDialog.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,3 +301,5 @@ export namespace GetSqlAnalyticsEndpointUriFromFabricRequest {
301301
"getSqlAnalyticsEndpointUriFromFabric",
302302
);
303303
}
304+
305+
export type ConnectionSubDialogDisplayType = "standalone" | "modal";

0 commit comments

Comments
 (0)