-
Notifications
You must be signed in to change notification settings - Fork 53
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
Fleet Manager - createFleet #1150
base: main
Are you sure you want to change the base?
Conversation
@microsoft-github-policy-service agree company="Microsoft" |
private readonly resourceManagementClient: ResourceManagementClient; | ||
private readonly fleetClient: ContainerServiceFleetClient; | ||
private readonly featureClient: FeatureClient; | ||
// private readonly commandId: string; |
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.
what is the command id for? will it be used later?
// args.isNewResourceGroup, | ||
// args.resourceGroupName, | ||
// args.location, | ||
// args.name, |
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.
should these commented out lines be deleted?
name: string, | ||
resource: Fleet, | ||
// sessionProvider: ReadyAzureSessionProvider, | ||
// subscriptionId: string, |
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.
the client is created using the session and the subscriptionId, so I don't think that you would ever need these parameters here.
if the list of argument increases (probably, to support all the fleet options) then you should create a type to encapsulate them. That way, the function signature won't change when you add more options
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 feel this PR is still undergoing changes, testing etc.. it could be still work in progress. Please reach out if you have any questions, Thank you.
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.
It is absolutely work in progress, I'm commenting to help get to a mergeable state in a reasonable time :)
Thanks for reviewing as well @hsubramanianaks!
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.
@serbrech agreed to your point above where it has to be a type for the function parameter.
portalUrl: string; | ||
}; | ||
|
||
export interface CreateFleetParams { |
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.
isn't this the create fleet argument list?
should this be used as an argument to the createFleet func?
I'm not familiar with typescript, @Tatsinnit might be better guidance here to get to a good place.
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.
Copilot reviewed 6 out of 15 changed files in this pull request and generated 2 comments.
Files not reviewed (9)
- package.json: Language not supported
- webview-ui/src/manualTest/main.tsx: Evaluated as low risk
- src/commands/aksFleet/aksFleetManager.ts: Evaluated as low risk
- src/webview-contract/webviewTypes.ts: Evaluated as low risk
- webview-ui/src/main.tsx: Evaluated as low risk
- src/extension.ts: Evaluated as low risk
- src/commands/utils/arm.ts: Evaluated as low risk
- webview-ui/src/manualTest/createFleetTests.tsx: Evaluated as low risk
- src/panels/CreateFleetPanel.ts: Evaluated as low risk
Comments suppressed due to low confidence (8)
webview-ui/src/CreateFleet/CreateFleetInput.tsx:60
- [nitpick] The error message for the fleet name validation is too verbose. Consider simplifying it to: 'Fleet name can only contain letters, numbers, dashes, and underscores, and must start and end with a letter or number.'
The only allowed characters are letters, numbers, dashes, and underscore. The first and last character must be a letter or a number.
webview-ui/src/CreateFleet/helpers/state.ts:13
- Enum values should be in uppercase. Rename 'InProgress' to 'IN_PROGRESS'.
InProgress,
webview-ui/src/CreateFleet/helpers/state.ts:15
- Enum values should be in uppercase. Rename 'Cancelled' to 'CANCELLED'.
Cancelled,
webview-ui/src/CreateFleet/helpers/state.ts:17
- Enum values should be in uppercase. Rename 'Failed' to 'FAILED'.
Failed,
webview-ui/src/CreateFleet/helpers/state.ts:17
- Enum values should be in uppercase. Rename 'Success' to 'SUCCESS'.
Success,
webview-ui/src/CreateFleet/helpers/state.ts:83
- [nitpick] Consider adding a success message for the 'ProgressEventType.SUCCESS' case.
return { stage: Stage.Succeeded, message: null };
src/commands/utils/fleet.ts:12
- Ensure that
result.name
is not null or undefined before using it. Consider adding a check to handle the case whereresult.name
is null or undefined.
return { succeeded: true, result: result.name! };
src/webview-contract/webviewDefinitions/createFleet.ts:32
- [nitpick] The enum values 'With' and 'Without' are ambiguous. They should be renamed to 'WithHubCluster' and 'WithoutHubCluster' to make it clear what they represent.
export enum HubClusterMode { With, Without }
console.log("Location:", props.locations); | ||
validate(); | ||
setLocation(missing<string>("somewhere")); | ||
// const parameters = validate(); |
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.
The handleSubmit function contains commented-out code and incomplete logic. Consider removing the commented-out code and ensuring the form submission logic is complete.
// const parameters = validate(); | |
const parameters = validate(); if (parameters.isJust) { props.eventHandlers.onSetCreating({ parameters: parameters.value }); } |
Copilot is powered by AI, so mistakes are possible. Review output carefully before use.
case ProgressEventType.InProgress: | ||
return { stage: Stage.Creating, message: operationDescription }; | ||
case ProgressEventType.Cancelled: | ||
return { stage: Stage.Failed, message: "Fleet Creation is cancelled" }; |
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.
The error message should end with a period.
return { stage: Stage.Failed, message: "Fleet Creation is cancelled" }; | |
return { stage: Stage.Failed, message: "Fleet Creation is cancelled." }; |
Copilot is powered by AI, so mistakes are possible. Review output carefully before use.
@@ -0,0 +1,91 @@ | |||
import { |
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.
could you add comment at the top of this file to explain what state this file defines and encodes, where it's used, etc?
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.
this state.ts file is required for communication between webview and extension. webview is for user experience (UI components) and actual extension handles everything with the vscode. this file is for state management of create fleet flow.
isNewResourceGroup = false; | ||
// } else if (newResourceGroupName) { | ||
// resourceGroupName = newResourceGroupName; | ||
// isNewResourceGroup = true; |
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.
can we delete all code related to "is new resource group" and just require the resource group to be pre-created at first? we can think about this create RG flow later if necessary
this.fleetClient = getAksFleetClient(sessionProvider, this.subscriptionId); | ||
this.featureClient = getFeatureClient(sessionProvider, this.subscriptionId); | ||
// this.commandId = commandId; | ||
console.log(this.resourceManagementClient, this.featureClient, this.sessionProvider); |
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.
this console.log was added for testing purpose? can this be removed ?
try { | ||
await createFleet(this.fleetClient, resourceGroupName, name, resource); | ||
} catch (error) { | ||
console.log(error); |
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.
Please throw the error message as notification to the user. Please refer other CreateClusterPanel.ts for error handling.
Initial work from Tatsat + createFleet panel setup