mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2024-11-25 15:06:55 +00:00
Add more logs for NPS (#1729)
This commit is contained in:
parent
f496220ed6
commit
e207f3702b
@ -278,16 +278,31 @@ export default class Explorer {
|
|||||||
const ONE_DAY_IN_MS = 86400000;
|
const ONE_DAY_IN_MS = 86400000;
|
||||||
const THREE_DAYS_IN_MS = 259200000;
|
const THREE_DAYS_IN_MS = 259200000;
|
||||||
const lastSubmitted: string = localStorage.getItem("lastSubmitted");
|
const lastSubmitted: string = localStorage.getItem("lastSubmitted");
|
||||||
|
Logger.logInfo(`NPS Survey last shown date: ${lastSubmitted}`, "Explorer/openNPSSurveyDialog");
|
||||||
|
|
||||||
if (lastSubmitted !== null) {
|
if (lastSubmitted !== null) {
|
||||||
|
Logger.logInfo(`NPS Survey last shown is not empty ${lastSubmitted}`, "Explorer/openNPSSurveyDialog");
|
||||||
|
|
||||||
let lastSubmittedDate: number = parseInt(lastSubmitted);
|
let lastSubmittedDate: number = parseInt(lastSubmitted);
|
||||||
|
Logger.logInfo(`NPS Survey last shown is parsed ${lastSubmittedDate.toString()}`, "Explorer/openNPSSurveyDialog");
|
||||||
|
|
||||||
if (isNaN(lastSubmittedDate)) {
|
if (isNaN(lastSubmittedDate)) {
|
||||||
|
Logger.logInfo(
|
||||||
|
`NPS Survey last shown is not a number ${lastSubmittedDate.toString()}`,
|
||||||
|
"Explorer/openNPSSurveyDialog",
|
||||||
|
);
|
||||||
lastSubmittedDate = 0;
|
lastSubmittedDate = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
const nowMs: number = Date.now();
|
const nowMs: number = Date.now();
|
||||||
|
Logger.logInfo(`NPS Survey current date ${nowMs.toString()}`, "Explorer/openNPSSurveyDialog");
|
||||||
|
|
||||||
const millisecsSinceLastSubmitted = nowMs - lastSubmittedDate;
|
const millisecsSinceLastSubmitted = nowMs - lastSubmittedDate;
|
||||||
if (millisecsSinceLastSubmitted < NINETY_DAYS_IN_MS) {
|
if (millisecsSinceLastSubmitted < NINETY_DAYS_IN_MS) {
|
||||||
|
Logger.logInfo(
|
||||||
|
`NPS Survey last shown is less than ninety days ${millisecsSinceLastSubmitted.toString()}`,
|
||||||
|
"Explorer/openNPSSurveyDialog",
|
||||||
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -295,6 +310,10 @@ export default class Explorer {
|
|||||||
// Try Cosmos DB subscription - survey shown to 100% of users at day 1 in Data Explorer.
|
// Try Cosmos DB subscription - survey shown to 100% of users at day 1 in Data Explorer.
|
||||||
if (userContext.isTryCosmosDBSubscription) {
|
if (userContext.isTryCosmosDBSubscription) {
|
||||||
if (isAccountNewerThanThresholdInMs(userContext.databaseAccount?.systemData?.createdAt || "", ONE_DAY_IN_MS)) {
|
if (isAccountNewerThanThresholdInMs(userContext.databaseAccount?.systemData?.createdAt || "", ONE_DAY_IN_MS)) {
|
||||||
|
Logger.logInfo(
|
||||||
|
`Displaying NPS Survey for Try Cosmos DB ${userContext.apiType}`,
|
||||||
|
"Explorer/openNPSSurveyDialog",
|
||||||
|
);
|
||||||
this.sendNPSMessage();
|
this.sendNPSMessage();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -302,6 +321,10 @@ export default class Explorer {
|
|||||||
if (
|
if (
|
||||||
!isAccountNewerThanThresholdInMs(userContext.databaseAccount?.systemData?.createdAt || "", THREE_DAYS_IN_MS)
|
!isAccountNewerThanThresholdInMs(userContext.databaseAccount?.systemData?.createdAt || "", THREE_DAYS_IN_MS)
|
||||||
) {
|
) {
|
||||||
|
Logger.logInfo(
|
||||||
|
`Displaying NPS Survey for users with existing ${userContext.apiType} account older than 3 days`,
|
||||||
|
"Explorer/openNPSSurveyDialog",
|
||||||
|
);
|
||||||
this.sendNPSMessage();
|
this.sendNPSMessage();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -309,6 +332,10 @@ export default class Explorer {
|
|||||||
|
|
||||||
private sendNPSMessage() {
|
private sendNPSMessage() {
|
||||||
sendMessage({ type: MessageTypes.DisplayNPSSurvey });
|
sendMessage({ type: MessageTypes.DisplayNPSSurvey });
|
||||||
|
Logger.logInfo(
|
||||||
|
`NPS Survey logging current date when survey is shown ${Date.now().toString()}`,
|
||||||
|
"Explorer/openNPSSurveyDialog",
|
||||||
|
);
|
||||||
localStorage.setItem("lastSubmitted", Date.now().toString());
|
localStorage.setItem("lastSubmitted", Date.now().toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -579,10 +579,9 @@ export const QueryCopilotPromptbar: React.FC<QueryCopilotPromptProps> = ({
|
|||||||
<IconButton
|
<IconButton
|
||||||
id="likeBtn"
|
id="likeBtn"
|
||||||
style={{ marginLeft: 20 }}
|
style={{ marginLeft: 20 }}
|
||||||
aria-label="like"
|
aria-label="Like"
|
||||||
role="toggle"
|
role="toggle"
|
||||||
iconProps={{ iconName: likeQuery === true ? "LikeSolid" : "Like" }}
|
iconProps={{ iconName: likeQuery === true ? "LikeSolid" : "Like" }}
|
||||||
aria-label="Like"
|
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setShowCallout(!likeQuery);
|
setShowCallout(!likeQuery);
|
||||||
setLikeQuery(!likeQuery);
|
setLikeQuery(!likeQuery);
|
||||||
@ -613,7 +612,6 @@ export const QueryCopilotPromptbar: React.FC<QueryCopilotPromptProps> = ({
|
|||||||
setShowCallout(false);
|
setShowCallout(false);
|
||||||
document.getElementById("likeStatus").innerHTML = toggleStatusValue;
|
document.getElementById("likeStatus").innerHTML = toggleStatusValue;
|
||||||
}}
|
}}
|
||||||
aria-label="Dislike"
|
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<span role="status" style={{ position: "absolute", left: "-9999px" }} id="likeStatus"></span>
|
<span role="status" style={{ position: "absolute", left: "-9999px" }} id="likeStatus"></span>
|
||||||
|
Loading…
Reference in New Issue
Block a user