Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions extensions/mssql/l10n/bundle.l10n.json
Original file line number Diff line number Diff line change
Expand Up @@ -2756,6 +2756,8 @@
"This server only supports SQL Authentication.": "This server only supports SQL Authentication.",
"Use SQL Authentication with a valid username and password.": "Use SQL Authentication with a valid username and password.",
"Unable to determine the server authentication type.": "Unable to determine the server authentication type.",
"Max vCores": "Max vCores",
"Select Max vCores": "Select Max vCores",
"Enter Database Name": "Enter Database Name",
"Database Description": "Database Description",
"Enter Database Description": "Enter Database Description",
Expand Down
7 changes: 5 additions & 2 deletions extensions/mssql/src/connectionconfig/azureHelpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,7 @@ export class VsCodeAzureHelper {
};
freeLimitExhaustionBehavior?: KnownFreeLimitExhaustionBehavior;
useFreeLimit?: boolean;
maxVcores?: string;
},
): Promise<Database> {
const sql = new SqlManagementClient(subscription.credential, subscription.subscriptionId, {
Expand All @@ -415,13 +416,15 @@ export class VsCodeAzureHelper {

const server = await sql.servers.get(resourceGroupName, serverName);

const skuName = options.maxVcores ? `GP_S_Gen5_${options.maxVcores}` : "GP_S_Gen5";

const freeOfferOptions = options.useFreeLimit
? {
sku: {
name: "GP_S_Gen5",
name: skuName,
tier: "GeneralPurpose",
family: "Gen5",
capacity: 2,
capacity: options.maxVcores ? Number(options.maxVcores) : 2,
},
Comment on lines +419 to 428
autoPauseDelay: 60,
minCapacity: 0.5,
Expand Down
2 changes: 2 additions & 0 deletions extensions/mssql/src/constants/locConstants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1515,6 +1515,8 @@ export class AzureSqlDatabase {
public static serverAuthTypeUnknown = l10n.t(
"Unable to determine the server authentication type.",
);
public static maxVcores = l10n.t("Max vCores");
public static selectMaxVcores = l10n.t("Select Max vCores");
}

export class FabricProvisioning {
Expand Down
14 changes: 14 additions & 0 deletions extensions/mssql/src/deployment/azureSqlDatabaseHelpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@ export async function initializeAzureSqlDatabaseState(
maintenanceConfig: "",
dataSource: "",
enableAlwaysEncrypted: false,
maxVcores: "2",
};

deploymentController.state.deploymentTypeState = state;
Expand Down Expand Up @@ -359,6 +360,7 @@ export function registerAzureSqlDatabaseReducers(
: undefined,
freeLimitExhaustionBehavior: azureSqlState.formState.freeLimitBehavior,
useFreeLimit: true,
maxVcores: azureSqlState.formState.maxVcores,
},
);

Expand Down Expand Up @@ -1321,5 +1323,17 @@ function setAzureSqlDatabaseFormComponents(
isAdvancedOption: true,
componentWidth: "350px",
}),
maxVcores: createFormItem({
propertyName: "maxVcores",
label: AzureSqlDatabase.maxVcores,
type: FormItemType.Dropdown,
options: [
{ displayName: "1", value: "1" },
{ displayName: "2", value: "2" },
{ displayName: "4", value: "4" },
],
isAdvancedOption: true,
placeholder: AzureSqlDatabase.selectMaxVcores,
}),
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ export interface AzureSqlDatabaseFormState {
collation: string;
maintenanceConfig: string;
enableAlwaysEncrypted: boolean;
maxVcores: string;
}

export interface AzureSqlDatabaseFormItemSpec
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,30 +4,13 @@
*--------------------------------------------------------------------------------------------*/

import { useCallback, useContext, useEffect, useRef, useState } from "react";
import {
Button,
Card,
Link,
Label,
makeStyles,
Radio,
RadioGroup,
Spinner,
Text,
} from "@fluentui/react-components";
import {
ArrowRight12Regular,
ErrorCircleRegular,
GiftRegular,
LockClosedRegular,
WarningFilled,
} from "@fluentui/react-icons";
import { Button, Card, Link, makeStyles, Spinner, Text } from "@fluentui/react-components";
import { ErrorCircleRegular, GiftRegular, LockClosedRegular } from "@fluentui/react-icons";
import { FormField } from "../../../common/forms/form.component";
import {
AzureSqlDatabaseContextProps,
AzureSqlDatabaseFormItemSpec,
AzureSqlDatabaseFormState,
AzureSqlDatabaseLinks,
AzureSqlDatabaseState,
AZURE_SQL_DB_COMPONENT_ORDER,
} from "../../../../sharedInterfaces/azureSqlDatabase";
Expand Down Expand Up @@ -148,7 +131,6 @@ const useStyles = makeStyles({
});

import { TagEntry } from "./azureSqlDatabaseDeploymentWizard";
import { KnownFreeLimitExhaustionBehavior } from "@azure/arm-sql";

interface AzureSqlDatabaseFormPageProps {
onValidated?: () => void;
Expand Down Expand Up @@ -185,16 +167,9 @@ export const AzureSqlDatabaseFormPage: React.FC<AzureSqlDatabaseFormPageProps> =
);
const hostIp = useAzureSqlDatabaseDeploymentSelector((s) => s.publicIp);

const [localFreeLimitBehavior, setLocalFreeLimitBehavior] = useState(
String(formState.freeLimitBehavior),
);
const [isAdvancedDrawerOpen, setIsAdvancedDrawerOpen] = useState(false);
const prevFormValidationLoadState = useRef(formValidationLoadState);

useEffect(() => {
setLocalFreeLimitBehavior(String(formState.freeLimitBehavior));
}, [formState.freeLimitBehavior]);

useEffect(() => {
const changed = prevFormValidationLoadState.current !== formValidationLoadState;
prevFormValidationLoadState.current = formValidationLoadState;
Expand Down Expand Up @@ -413,91 +388,6 @@ export const AzureSqlDatabaseFormPage: React.FC<AzureSqlDatabaseFormPageProps> =
{renderFormField("savePassword")}
</>
)}
<div className={classes.fieldContainer}>
<div style={{ flex: 1, width: "100%" }}>
<Label weight="semibold">
{locConstants.azureSqlDatabase.freeLimitBehavior}
</Label>
<RadioGroup
value={localFreeLimitBehavior}
onChange={(_e, data) => {
setLocalFreeLimitBehavior(data.value);
context.formAction({
propertyName: "freeLimitBehavior",
isAction: false,
value: data.value,
});
}}>
<div>
<Radio
value={KnownFreeLimitExhaustionBehavior.AutoPause}
label={locConstants.azureSqlDatabase.autoPauseOption}
/>
<Text
size={200}
style={{
display: "block",
color: "var(--vscode-descriptionForeground)",
marginLeft: "36px",
marginTop: "-4px",
}}>
{locConstants.azureSqlDatabase.autoPauseDescription}
</Text>
</div>
<div>
<Radio
value={KnownFreeLimitExhaustionBehavior.BillOverUsage}
label={locConstants.azureSqlDatabase.continueChargesOption}
/>
<Text
size={200}
style={{
display: "block",
color: "var(--vscode-descriptionForeground)",
marginLeft: "36px",
marginTop: "-4px",
}}>
{locConstants.azureSqlDatabase.continueChargesDescription}
</Text>
</div>
</RadioGroup>
</div>
</div>
{localFreeLimitBehavior === KnownFreeLimitExhaustionBehavior.BillOverUsage && (
<Card
style={{
display: "flex",
flexDirection: "column",
backgroundColor: "var(--colorPaletteYellowBackground1)",
borderLeft: "3px solid var(--colorPaletteYellowForeground1)",
padding: "10px 12px",
gap: "6px",
marginLeft: "2px",
}}>
<div
style={{
display: "flex",
flexDirection: "row",
alignItems: "center",
gap: "10px",
}}>
<WarningFilled
style={{
color: "var(--colorStatusWarningForeground1)",
fontSize: "20px",
flexShrink: 0,
}}
/>
<span>{locConstants.azureSqlDatabase.continueChargesWarning}</span>
</div>
<Link
className={classes.linkDiv}
href={AzureSqlDatabaseLinks.freeOffer}>
{locConstants.common.learnMore}
<ArrowRight12Regular style={{ marginTop: "2px" }} />
</Link>
</Card>
)}
{renderFormField("profileName")}
<div className={classes.fieldContainer}>
<div style={{ flex: 1, width: "100%" }}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@
*--------------------------------------------------------------------------------------------*/

import { makeStyles, tokens } from "@fluentui/react-components";
import { DocsLinkCard } from "./docsLinkCard";
import { ApiStatus } from "../../../../sharedInterfaces/webview";
import { AzureSqlDatabaseLinks } from "../../../../sharedInterfaces/azureSqlDatabase";
import { locConstants } from "../../../common/locConstants";
import { useAzureSqlDatabaseDeploymentSelector } from "../deploymentSelector";
import { DeploymentStepCard } from "../deploymentStepCard";
Expand Down Expand Up @@ -90,28 +88,6 @@ export const AzureSqlDatabaseProvisioningPage: React.FC = () => {

if (!provisionLoadState) return undefined;

const isDeploymentComplete =
provisionLoadState === ApiStatus.Loaded && connectionLoadState === ApiStatus.Loaded;

const whatsNextLinks = [
{
href: AzureSqlDatabaseLinks.connectQuerySsms,
label: locConstants.azureSqlDatabase.connectAndRunQuery,
},
{
href: AzureSqlDatabaseLinks.createQuickstart,
label: locConstants.azureSqlDatabase.seedSampleData,
},
{
href: AzureSqlDatabaseLinks.freeOffer,
label: locConstants.azureSqlDatabase.monitorUsage,
},
{
href: AzureSqlDatabaseLinks.azureSqlDocs,
label: locConstants.azureSqlDatabase.browseTutorials,
},
];

const stepStatus =
provisionLoadState !== ApiStatus.Loaded ? provisionLoadState : connectionLoadState;

Expand Down Expand Up @@ -198,12 +174,6 @@ export const AzureSqlDatabaseProvisioningPage: React.FC = () => {
)}
</div>
</DeploymentStepCard>
{isDeploymentComplete && (
<DocsLinkCard
title={locConstants.azureSqlDatabase.whatsNext}
links={whatsNextLinks}
/>
)}
</div>
</div>
);
Comment on lines 174 to 179
Expand Down
Loading
Loading