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

Refactor surveys and add a new one #4794

Merged
merged 6 commits into from
Feb 13, 2021
Merged

Refactor surveys and add a new one #4794

merged 6 commits into from
Feb 13, 2021

Conversation

DavidKutu
Copy link

For #4726

  • Pull request represents a single change (i.e. not fixing disparate/unrelated things in a single PR).
  • Title summarizes what is changing.
  • Has a news entry file (remember to thank yourself!).
  • Appropriate comments and documentation strings in the code.
  • Has sufficient logging.
  • Has telemetry for enhancements.
  • Unit tests & system/integration tests are added/updated.
  • Test plan is updated as appropriate.
  • package-lock.json has been regenerated by running npm install (if dependencies have changed).

@DavidKutu DavidKutu requested a review from a team as a code owner February 12, 2021 22:24
private bannerLabels: string[] = [
localize.DataScienceSurveyBanner.bannerLabelYes(),
localize.DataScienceSurveyBanner.bannerLabelNo()
];
private readonly showBannerState: IPersistentState<ShowBannerWithExpiryTime>;
private readonly surveyLink: string;
private readonly showBannerState: IPersistentState<ShowBannerWithExpiryTime>[] = [];
Copy link
Contributor

Choose a reason for hiding this comment

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

Seems like this should be a map, not an array. It would reenforce that it is being set correctly.

Suggested change
private readonly showBannerState: IPersistentState<ShowBannerWithExpiryTime>[] = [];
private readonly showBannerState = new Map<BannerType, IPersistentState<ShowBannerWithExpiryTime>>();

const state = this.persistentState.createGlobalPersistentState<number>(DSSurveyStateKeys.OpenNotebookCount, 0);
await state.updateValue(state.value + 1);
return this.showBanner();
const state1 = this.persistentState.createGlobalPersistentState<number>(DSSurveyStateKeys.OpenNotebookCount, 0);
Copy link
Contributor

Choose a reason for hiding this comment

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

This seems like you could call the same function with a different string 3 times to update the state for all 3.

private updateStateAndShowBanner(val: string, banner: BannerType) {
    const state = this.persistentState.createGlobalPersistentState<number>(val, 0);
    await state.updateValue(state.value + 1);
    this.showBanner(banner);
}

Copy link
Author

Choose a reason for hiding this comment

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

yes, I'll also do that for getOpenNotebookCount and getExecutionCount

InsidersNotebookSurveyStateKeys.ExecutionCount,
0
);
await state1.updateValue(state1.value + 1);
Copy link
Contributor

Choose a reason for hiding this comment

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

That function I mentioned above would be called here.

}
break;
case BannerType.DSSurvey:
default:
Copy link
Member

Choose a reason for hiding this comment

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

Just a minor thing here. I'd break off default here and have it traceError and return false. isEnabled should always be called with a BannerType, so if you want the DSSurvey you should specifically request it. If a new BannerType is added we want someone to explicitly add a new case here, now with default it would go down the DSSurvey path if you forgot to add the case, which you don't want.

Copy link
Author

Choose a reason for hiding this comment

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

just isEnabled? or all of the switches?

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, you don't want a default like that here. Only if it has a legit default that you want to happen.

@codecov-io
Copy link

codecov-io commented Feb 12, 2021

Codecov Report

Merging #4794 (ab152f6) into main (93d6475) will decrease coverage by 2%.
The diff coverage is 66%.

@@          Coverage Diff           @@
##            main   #4794    +/-   ##
======================================
- Coverage     76%     74%    -3%     
======================================
  Files        411     410     -1     
  Lines      26963   26939    -24     
  Branches    3909    3902     -7     
======================================
- Hits       20741   20065   -676     
- Misses      4611    5304   +693     
+ Partials    1611    1570    -41     
Impacted Files Coverage Δ
src/client/common/types.ts 100% <ø> (ø)
src/client/datascience/serviceRegistry.ts 98% <ø> (-1%) ⬇️
src/client/datascience/dataScienceSurveyBanner.ts 65% <65%> (-24%) ⬇️
src/client/activation/serviceRegistry.ts 100% <100%> (ø)
src/client/datascience/notebook/introStartPage.ts 100% <100%> (ø)
src/client/datascience/shiftEnterBanner.ts 91% <100%> (ø)
...ience/variablesView/variableViewMessageListener.ts 22% <0%> (-78%) ⬇️
...ent/common/application/webviewViews/webviewView.ts 14% <0%> (-72%) ⬇️
...t/common/application/webviewPanels/webviewPanel.ts 10% <0%> (-63%) ⬇️
src/client/common/application/webviews/webview.ts 13% <0%> (-60%) ⬇️
... and 89 more

Copy link
Contributor

@rchiodo rchiodo left a comment

Choose a reason for hiding this comment

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

⏲️

@DavidKutu DavidKutu merged commit 88d1d0f into main Feb 13, 2021
@DavidKutu DavidKutu deleted the david/updateSurveys branch February 13, 2021 02:20
DavidKutu pushed a commit that referenced this pull request Feb 13, 2021
* Refactor surveys and add a new one

* add news and lint

* lint

* lint

* PR comments
DavidKutu pushed a commit that referenced this pull request Feb 16, 2021
* Refactor surveys and add a new one (#4794)

* Refactor surveys and add a new one

* add news and lint

* lint

* lint

* PR comments

* update changelog

* Fix IJupyterExtensionBanner service identifier (#4825)

Co-authored-by: Joyce Er <joyceerhuiling@gmail.com>
rchiodo pushed a commit that referenced this pull request Feb 18, 2021
* Refactor surveys and add a new one (#4794)

* Refactor surveys and add a new one

* add news and lint

* lint

* lint

* PR comments

* update changelog

* Fix IJupyterExtensionBanner service identifier (#4825)

Co-authored-by: Joyce Er <joyceerhuiling@gmail.com>
rchiodo added a commit that referenced this pull request Feb 18, 2021
* PORT Variable view icon to release branch (#4748)

* update changelog (#4752)

* Cherry pick change for icon overflow (#4753)

* Change number of icons in notebook toolbar (#4747)

* Fix icons

* Have trust command show up and nothing else if untrusted

* Add trust check to all commands

* Update based on discussion

* Update change log

* PORT - variable context (#4770)

* Add new editor context for just if native notebook is active (#4762)

* update news

Co-authored-by: Ian Huff <ianhuff@LICHYOGAIOT.northamerica.corp.microsoft.com>

* Port control enter fix to release (#4774)

* Fix ctrl+enter and alt+enter by removing the redundant command. (#4769)

* Fix ctrl+enter and alt+enter by removing the redundant command.

* Code review feedback

* Update changelog

* port .NET fix to release (#4776)

* Fix .NET interactive to always use native (#4772)

* Fix .NET interactive

* Fix tests and linter

* Update changelog

* Port kernel finder change to release (#4799)

* Fix duplicate kernel generation (#4790)

* Fix duplicate kernel generation

* Fix functional tests

* Update changelog

* Actually use stable

* PORT - Port document dispose fix to release. (#4798)

* Only clean up editors on close not on Panel dispose (#4787)

* update changelog

Co-authored-by: Ian Huff <ianhuff@LICHYOGAIOT.northamerica.corp.microsoft.com>

* Port surveys (#4804)

* Refactor surveys and add a new one (#4794)

* Refactor surveys and add a new one

* add news and lint

* lint

* lint

* PR comments

* update changelog

* Fix IJupyterExtensionBanner service identifier (#4825)

Co-authored-by: Joyce Er <joyceerhuiling@gmail.com>

* PORT - Fix for top level save and undo commands (#4851)

* Update cache ignore

* Actually ignore .so files

* Update release plan

* Put back package.json changes

* Delete news entries

Co-authored-by: Ian Huff <ianhu@microsoft.com>
Co-authored-by: David Kutugata <dakutuga@microsoft.com>
Co-authored-by: Ian Huff <ianhuff@LICHYOGAIOT.northamerica.corp.microsoft.com>
Co-authored-by: Joyce Er <joyceerhuiling@gmail.com>
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.

4 participants