-
Notifications
You must be signed in to change notification settings - Fork 294
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
Conversation
private bannerLabels: string[] = [ | ||
localize.DataScienceSurveyBanner.bannerLabelYes(), | ||
localize.DataScienceSurveyBanner.bannerLabelNo() | ||
]; | ||
private readonly showBannerState: IPersistentState<ShowBannerWithExpiryTime>; | ||
private readonly surveyLink: string; | ||
private readonly showBannerState: IPersistentState<ShowBannerWithExpiryTime>[] = []; |
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.
Seems like this should be a map, not an array. It would reenforce that it is being set correctly.
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); |
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 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);
}
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.
yes, I'll also do that for getOpenNotebookCount and getExecutionCount
InsidersNotebookSurveyStateKeys.ExecutionCount, | ||
0 | ||
); | ||
await state1.updateValue(state1.value + 1); |
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.
That function I mentioned above would be called here.
} | ||
break; | ||
case BannerType.DSSurvey: | ||
default: |
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.
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.
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.
just isEnabled? or all of the switches?
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.
Yeah, you don't want a default like that here. Only if it has a legit default that you want to happen.
Codecov Report
@@ 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
|
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.
⏲️
* Refactor surveys and add a new one * add news and lint * lint * lint * PR comments
* 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>
For #4726
package-lock.json
has been regenerated by runningnpm install
(if dependencies have changed).