"Add to plan" context menu telemetry
This commit is contained in:
Родитель
d194e3ccf7
Коммит
bc2a62f4e6
|
@ -31,6 +31,7 @@ export class PortfolioPlanActionsService {
|
||||||
|
|
||||||
if (plans.entries.length === 0) {
|
if (plans.entries.length === 0) {
|
||||||
// Don't show any items if there are no plans created yet.
|
// Don't show any items if there are no plans created yet.
|
||||||
|
PortfolioTelemetry.getInstance().TrackAction("AddToPlanAction/NoPlansFoundInDirectory");
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -67,6 +68,12 @@ export class PortfolioPlanActionsService {
|
||||||
}
|
}
|
||||||
|
|
||||||
private openAllPlansDialog(workItemIds: number[], directory: PortfolioPlanningDirectory): void {
|
private openAllPlansDialog(workItemIds: number[], directory: PortfolioPlanningDirectory): void {
|
||||||
|
const telemetryService = PortfolioTelemetry.getInstance();
|
||||||
|
const telemetryData = {
|
||||||
|
["WorkItemCount"]: workItemIds.length
|
||||||
|
};
|
||||||
|
PortfolioTelemetry.getInstance().TrackAction("AddToPlanAction/openAllPlansDialog", telemetryData);
|
||||||
|
|
||||||
let onOkClickHandler: () => Promise<void> = null;
|
let onOkClickHandler: () => Promise<void> = null;
|
||||||
|
|
||||||
const dialogInput: IDialogInputData = {
|
const dialogInput: IDialogInputData = {
|
||||||
|
@ -74,7 +81,8 @@ export class PortfolioPlanActionsService {
|
||||||
directory,
|
directory,
|
||||||
setOnOkClickHandler: (onOkClickHandlerInstance: () => Promise<void>) => {
|
setOnOkClickHandler: (onOkClickHandlerInstance: () => Promise<void>) => {
|
||||||
onOkClickHandler = onOkClickHandlerInstance;
|
onOkClickHandler = onOkClickHandlerInstance;
|
||||||
}
|
},
|
||||||
|
telemetryService
|
||||||
};
|
};
|
||||||
|
|
||||||
VSS.getService(VSS.ServiceIds.Dialog).then((hostDialogService: IHostDialogService) => {
|
VSS.getService(VSS.ServiceIds.Dialog).then((hostDialogService: IHostDialogService) => {
|
||||||
|
@ -151,6 +159,12 @@ export class PortfolioPlanActionsService {
|
||||||
}
|
}
|
||||||
|
|
||||||
private async addWorkItemIdsToPlan(planId: string, workItemIds: number[]): Promise<void> {
|
private async addWorkItemIdsToPlan(planId: string, workItemIds: number[]): Promise<void> {
|
||||||
|
const telemetryData = {
|
||||||
|
["PlanId"]: planId,
|
||||||
|
["WorkItemCount"]: workItemIds.length
|
||||||
|
};
|
||||||
|
PortfolioTelemetry.getInstance().TrackAction("AddToPlanAction/addWorkItemIdsToPlan", telemetryData);
|
||||||
|
|
||||||
const plan = await PortfolioPlanningDataService.getInstance().AddWorkItemsToPlan(planId, workItemIds);
|
const plan = await PortfolioPlanningDataService.getInstance().AddWorkItemsToPlan(planId, workItemIds);
|
||||||
|
|
||||||
if (!plan) {
|
if (!plan) {
|
||||||
|
|
|
@ -401,20 +401,31 @@ export class PortfolioPlanningDataService {
|
||||||
return totalThatWillBeDeleted;
|
return totalThatWillBeDeleted;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async AddWorkItemsToPlan(planId: string, workItemIds: number[]): Promise<PortfolioPlanning> {
|
public async AddWorkItemsToPlan(
|
||||||
|
planId: string,
|
||||||
|
workItemIds: number[],
|
||||||
|
telemetryService?: PortfolioTelemetry
|
||||||
|
): Promise<PortfolioPlanning> {
|
||||||
|
if (!telemetryService) {
|
||||||
|
telemetryService = PortfolioTelemetry.getInstance();
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
console.log(`AddWorkItemsToPlan. WorkItemIds: ${workItemIds.join(", ")}. Plan: ${planId}`);
|
console.log(`AddWorkItemsToPlan. WorkItemIds: ${workItemIds.join(", ")}. Plan: ${planId}`);
|
||||||
|
|
||||||
|
const telemetryData = {
|
||||||
|
["PlanId"]: planId,
|
||||||
|
["WorkItemCount"]: workItemIds.length
|
||||||
|
};
|
||||||
|
telemetryService.TrackAction("PortfolioPlanningDataService/AddWorkItemsToPlan", telemetryData);
|
||||||
|
|
||||||
if (workItemIds.length === 0) {
|
if (workItemIds.length === 0) {
|
||||||
// No-op.
|
// No-op.
|
||||||
const props = {
|
const props = {
|
||||||
["PlanId"]: planId
|
["PlanId"]: planId
|
||||||
};
|
};
|
||||||
|
|
||||||
PortfolioTelemetry.getInstance().TrackAction(
|
telemetryService.TrackAction("PortfolioPlanningDataService/AddWorkItemsToPlan/NoOp", props);
|
||||||
"PortfolioPlanningDataService/AddWorkItemsToPlan/NoOp",
|
|
||||||
props
|
|
||||||
);
|
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -427,10 +438,7 @@ export class PortfolioPlanningDataService {
|
||||||
["WorkItemIds"]: workItemIds
|
["WorkItemIds"]: workItemIds
|
||||||
};
|
};
|
||||||
|
|
||||||
PortfolioTelemetry.getInstance().TrackAction(
|
telemetryService.TrackAction("PortfolioPlanningDataService/AddWorkItemsToPlan/NoPlanFound", props);
|
||||||
"PortfolioPlanningDataService/AddWorkItemsToPlan/NoPlanFound",
|
|
||||||
props
|
|
||||||
);
|
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -452,7 +460,7 @@ export class PortfolioPlanningDataService {
|
||||||
["WorkItemIds"]: workItemIds
|
["WorkItemIds"]: workItemIds
|
||||||
};
|
};
|
||||||
|
|
||||||
PortfolioTelemetry.getInstance().TrackAction(
|
telemetryService.TrackAction(
|
||||||
"PortfolioPlanningDataService/AddWorkItemsToPlan/WorkItemProjectIdsNoResults",
|
"PortfolioPlanningDataService/AddWorkItemsToPlan/WorkItemProjectIdsNoResults",
|
||||||
props
|
props
|
||||||
);
|
);
|
||||||
|
@ -554,7 +562,7 @@ export class PortfolioPlanningDataService {
|
||||||
["WorkItemType"]: workItemTypeKey
|
["WorkItemType"]: workItemTypeKey
|
||||||
};
|
};
|
||||||
|
|
||||||
PortfolioTelemetry.getInstance().TrackAction(
|
telemetryService.TrackAction(
|
||||||
"PortfolioPlanningDataService/AddWorkItemsToPlan/WorkItemTypeNotSupported",
|
"PortfolioPlanningDataService/AddWorkItemsToPlan/WorkItemTypeNotSupported",
|
||||||
props
|
props
|
||||||
);
|
);
|
||||||
|
@ -609,7 +617,7 @@ export class PortfolioPlanningDataService {
|
||||||
["WorkItemType"]: workItemTypeKey
|
["WorkItemType"]: workItemTypeKey
|
||||||
};
|
};
|
||||||
|
|
||||||
PortfolioTelemetry.getInstance().TrackAction(
|
telemetryService.TrackAction(
|
||||||
"PortfolioPlanningDataService/AddWorkItemsToPlan/WorkItemTypeNotSupported",
|
"PortfolioPlanningDataService/AddWorkItemsToPlan/WorkItemTypeNotSupported",
|
||||||
props
|
props
|
||||||
);
|
);
|
||||||
|
@ -621,7 +629,7 @@ export class PortfolioPlanningDataService {
|
||||||
["ProjectId"]: projectIdKey
|
["ProjectId"]: projectIdKey
|
||||||
};
|
};
|
||||||
|
|
||||||
PortfolioTelemetry.getInstance().TrackAction(
|
telemetryService.TrackAction(
|
||||||
"PortfolioPlanningDataService/AddWorkItemsToPlan/MissingProjectConfiguration",
|
"PortfolioPlanningDataService/AddWorkItemsToPlan/MissingProjectConfiguration",
|
||||||
props
|
props
|
||||||
);
|
);
|
||||||
|
@ -632,7 +640,7 @@ export class PortfolioPlanningDataService {
|
||||||
["WorkItemId"]: newWorkItemId
|
["WorkItemId"]: newWorkItemId
|
||||||
};
|
};
|
||||||
|
|
||||||
PortfolioTelemetry.getInstance().TrackAction(
|
telemetryService.TrackAction(
|
||||||
"PortfolioPlanningDataService/AddWorkItemsToPlan/MissingProjectIdForNewWorkItemId",
|
"PortfolioPlanningDataService/AddWorkItemsToPlan/MissingProjectIdForNewWorkItemId",
|
||||||
props
|
props
|
||||||
);
|
);
|
||||||
|
@ -642,7 +650,7 @@ export class PortfolioPlanningDataService {
|
||||||
// Persist plan changes
|
// Persist plan changes
|
||||||
return await this.UpdatePortfolioPlan(plan);
|
return await this.UpdatePortfolioPlan(plan);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
PortfolioTelemetry.getInstance().TrackException(error);
|
telemetryService.TrackException(error);
|
||||||
console.log(error);
|
console.log(error);
|
||||||
return Promise.reject(error);
|
return Promise.reject(error);
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,6 +33,7 @@ export interface IDialogInputData {
|
||||||
workItemIds: number[];
|
workItemIds: number[];
|
||||||
directory: PortfolioPlanningDirectory;
|
directory: PortfolioPlanningDirectory;
|
||||||
setOnOkClickHandler: (onOkClickHandler: () => IPromise<void>) => void;
|
setOnOkClickHandler: (onOkClickHandler: () => IPromise<void>) => void;
|
||||||
|
telemetryService: PortfolioTelemetry;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ISelectPlanComponentProps {
|
export interface ISelectPlanComponentProps {
|
||||||
|
@ -93,8 +94,19 @@ class SelectPlanComponent extends React.Component<ISelectPlanComponentProps, ISe
|
||||||
if (this.selection.value && this.selection.value[0]) {
|
if (this.selection.value && this.selection.value[0]) {
|
||||||
const planSelected = this.indexToPlan[this.selection.value[0].beginIndex];
|
const planSelected = this.indexToPlan[this.selection.value[0].beginIndex];
|
||||||
const workItemIds = this.props.inputData.workItemIds;
|
const workItemIds = this.props.inputData.workItemIds;
|
||||||
|
const telemetryService = this.props.inputData.telemetryService;
|
||||||
|
|
||||||
const plan = await PortfolioPlanningDataService.getInstance().AddWorkItemsToPlan(planSelected, workItemIds);
|
const telemetryData = {
|
||||||
|
["PlanId"]: planSelected,
|
||||||
|
["WorkItemCount"]: workItemIds.length
|
||||||
|
};
|
||||||
|
telemetryService.TrackAction("SelectPlanDialog/onOkClicked", telemetryData);
|
||||||
|
|
||||||
|
const plan = await PortfolioPlanningDataService.getInstance().AddWorkItemsToPlan(
|
||||||
|
planSelected,
|
||||||
|
workItemIds,
|
||||||
|
telemetryService
|
||||||
|
);
|
||||||
if (!plan) {
|
if (!plan) {
|
||||||
// TODO Error scenario handling - e.g. plan doesn't exist.
|
// TODO Error scenario handling - e.g. plan doesn't exist.
|
||||||
// Something went wrong. A valid plan should have been returned.
|
// Something went wrong. A valid plan should have been returned.
|
||||||
|
|
Загрузка…
Ссылка в новой задаче