-
Notifications
You must be signed in to change notification settings - Fork 18
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
feat: usage analytics report for project types status - ON HOLD - DO NOT MERGE!!! #315
base: main
Are you sure you want to change the base?
Conversation
if (isBAS()) { | ||
AnalyticsWrapper.createTracker(context.extensionPath); | ||
void reportProjectTypesToUsageAnalytics(basToolkitAPI); | ||
} |
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.
if (isBAS()) { | |
AnalyticsWrapper.createTracker(context.extensionPath); | |
void reportProjectTypesToUsageAnalytics(basToolkitAPI); | |
} | |
setTimeout(() => { | |
if (isBAS()) { | |
AnalyticsWrapper.createTracker(context.extensionPath); | |
void reportProjectTypesToUsageAnalytics(basToolkitAPI); | |
} | |
}); |
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.
consider to move this code up into the first "if (isBAS())" code branch.
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 can't because I need to use basToolkitAPI which is created after the first isBAS()
@@ -12,7 +18,7 @@ export enum ExtensionRunMode { | |||
unexpected = `unexpected`, | |||
} | |||
|
|||
export function shouldRunCtlServer(): boolean { | |||
export function isBAS(): boolean { |
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 function name is now confusing. it returns true in the case of "BAS", "hybrid" and "PE". the previous name was more meaningful
const devspaceInfo = await devspace.getDevspaceInfo(); | ||
const projects = await getProjectsInfo(basToolkitAPI); |
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.
these two calls are independent of each other, consider calling at the same time, e.g. Promise.all (...)
@@ -58,3 +64,34 @@ function getExtensionRunPlatform(): ExtensionRunMode { | |||
|
|||
return runPlatform; | |||
} | |||
|
|||
export async function reportProjectTypesToUsageAnalytics( |
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.
missing the function return type
) { | ||
const devspaceInfo = await devspace.getDevspaceInfo(); | ||
const projects = await getProjectsInfo(basToolkitAPI); | ||
void AnalyticsWrapper.traceProjectTypesStatus( |
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.
whether we need to report the empty data ?
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 will report only for the created projects
); | ||
} | ||
|
||
async function getProjectsInfo(basToolkitAPI: BasToolkit) { |
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.
return type is missing in function signature
async function getProjectsInfo(basToolkitAPI: BasToolkit) { | ||
try { | ||
const workspaceAPI = basToolkitAPI.workspaceAPI; | ||
const homedirProjects: string = joinPath(homedir(), "projects"); |
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.
consider to use 'workspace.workspaceFolders' instead of hardcode heuristics
undefined, | ||
homedirProjects | ||
); | ||
const projectInfoList: (ProjectData | undefined)[] = await Promise.all( |
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 verify (ProjectData | undefined)[] casting.
let projectType; | ||
switch (type) { | ||
case "com.sap.cap": | ||
projectType = "CAP"; | ||
break; | ||
case "com.sap.ui": | ||
projectType = "UI5"; | ||
break; | ||
case "com.sap.mdk": | ||
projectType = "MDK"; | ||
break; | ||
case "com.sap.fe": | ||
projectType = "FE"; | ||
break; | ||
case "com.sap.hana": | ||
projectType = "HANA"; | ||
break; | ||
case "com.sap.lcap": | ||
projectType = "LCAP"; | ||
break; | ||
default: | ||
projectType = "BASEmpty"; |
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.
why is this transformation needed? why not report the actual type received?
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.
removed
Hi, Before merging this, please validate with Xin:
|
): void { | ||
try { | ||
const eventName = AnalyticsWrapper.EVENT_TYPES.PROJECT_TYPES_STATUS; | ||
for (const type in projects) { |
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.
You can use typeName
instead of type - it is the display name of the type and remove the for and switch case-
https://github.tools.sap/LCAP/project/blob/main/packages/artifact-management-base/src/project/ProjectData.ts#L12 .
No description provided.