in src/PortfolioPlanning/Common/Components/ODataTest.tsx [113:178]
public HandleTestExtensionStorage(event) {
PortfolioPlanningDataService.getInstance()
.GetAllPortfolioPlans()
.then(allPlans => {
console.log("INITIAL STATE:");
console.log(JSON.stringify(allPlans, null, " "));
PortfolioPlanningDataService.getInstance()
.AddPortfolioPlan("new plan name", "new plan description", undefined)
.then(newPlanCreated => {
console.log("Plan created");
console.log(JSON.stringify(newPlanCreated, null, " "));
PortfolioPlanningDataService.getInstance()
.GetAllPortfolioPlans()
.then(allPlans => {
console.log("Second state:");
console.log(JSON.stringify(allPlans, null, " "));
PortfolioPlanningDataService.getInstance()
.GetPortfolioPlanById(newPlanCreated.id)
.then(planRetrieved => {
console.log("retrieved plan");
console.log(JSON.stringify(planRetrieved, null, " "));
// Update plan to include information for two projects.
const WorkItemTypeData: { [workItemType: string]: WorkItemType } = {};
WorkItemTypeData["epic"] = {
workItemType: "Epic",
backlogLevelName: "Epics",
iconProps: {
name: "icon_bug",
color: "OCOCOC",
url: "test"
}
};
const Items1: { [workItemId: number]: PortfolioItem } = {};
Items1[5251] = { workItemId: 5251, workItemType: "Epic" };
Items1[5250] = { workItemId: 5250, workItemType: "Epic" };
planRetrieved.projects["FBED1309-56DB-44DB-9006-24AD73EEE785"] = {
ProjectId: "FBED1309-56DB-44DB-9006-24AD73EEE785",
RequirementWorkItemType: "User Story",
EffortODataColumnName: "StoryPoints",
EffortWorkItemFieldRefName: "Microsoft.VSTS.Scheduling.StoryPoints",
Items: Items1,
WorkItemTypeData
};
const Items2: { [workItemId: number]: PortfolioItem } = {};
Items2[5249] = { workItemId: 5249, workItemType: "Epic" };
planRetrieved.projects["6974D8FE-08C8-4123-AD1D-FB830A098DFB"] = {
ProjectId: "6974D8FE-08C8-4123-AD1D-FB830A098DFB",
RequirementWorkItemType: "User Story",
EffortODataColumnName: "StoryPoints",
EffortWorkItemFieldRefName: "Microsoft.VSTS.Scheduling.StoryPoints",
Items: Items2,
WorkItemTypeData
};
});
});
});
});
}