Skip to content
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

VSCode Extension Controller #92

Closed
wants to merge 12 commits into from
Closed

VSCode Extension Controller #92

wants to merge 12 commits into from

Conversation

trevorNgo
Copy link
Contributor

Implemented controller architecture that extracts logic from react panel.

dandua98
dandua98 previously approved these changes Feb 26, 2019
@trevorNgo trevorNgo closed this Feb 27, 2019
@trevorNgo trevorNgo reopened this Feb 27, 2019
return this.AzureCosmosDBProvider.validateCosmosDBAccountName(cosmosDBAccountName, this.usersCosmosDBSubscriptionItemCache)
.then((message) => {
if (message === undefined || message === null || message === "") {
return Promise.resolve(true);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To get undefined and null, you can use:

message  != null

But in general, it's safer to use === or !==

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Long shot, but, message is the string? Might there be some extension method like message.IsNullOrEmpty() ?
It generally looks nicer then line of a == b

Copy link
Contributor

@ngkelly3 ngkelly3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool, we should do this on the client side as well.

import { AzureAuth, SubscriptionItem } from './azure-auth/azureAuth';
import { SubscriptionError, ValidationError } from './errors';
import { FunctionProvider } from './azure-functions/functionProvider';
import { CosmosDBDeploy } from './azure-cosmosDB/cosmosDbModule';
import {ReactPanel} from './reactPanel';
export abstract class Controller {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for the purpose of stylecop - swap lines 7 & 8

private static routingMessageReceieverDelegate =
function (message: any) {
switch (message.command) {
case "alert":

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't leave just names for message.command in the code directly pls.
I'd suggest create some enum value with description of what is it for and what are the options.

  1. If it's not for private branch, and you want this code for master - don't leave commented lines of code. If line is not needed - remove it.

}

public deployFunctionApp() {
public static deployFunctionApp() {
throw Error("undefined");

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this for? and what does "undefined" mean?
If it's not implemented (yet) - either throw "not implemented" or, actually, remove this method at all until you implement it.

Every method that is added (especially public) should provide possibility to be called and should do whatever it's supposed to do.

Also, deploy function app - what app I'm supposed to deploy, is there any parameter for the app?
Or, I assume you just put wrong modifier - should it be public?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, this function will be implemented after Redmond, our focus will be on Cosmos

* Caching is used for performance; when displaying live check on keystroke to wizard
*
*/
private static async updateCosmosDBSubscriptionItemCache(subscriptionLabel : string): Promise<void> {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

General question - can you explain to yourself why every single method in this file is "static"?
I'd also be curios myself.

Copy link

@KirillShchetinin KirillShchetinin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets sync later on this.

@trevorNgo
Copy link
Contributor Author

Will close and remerge demo-redmond ->dev post-redmond

@trevorNgo trevorNgo closed this Mar 2, 2019
@dandua98 dandua98 deleted the controller branch March 11, 2019 17:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants