Fix for Bug #15020 dashboard update with multiproject (#15029) (#15042)

* Fix to enable two projects showing only their data even if opening together

* Fixing a typo

* Taking in PR comments
This commit is contained in:
Udeesha Gautam
2021-04-07 18:37:42 -07:00
committed by GitHub
parent 49147305e8
commit f0558714a4
8 changed files with 76 additions and 67 deletions

View File

@@ -52,61 +52,65 @@ export class ProjectsController {
this.buildHelper = new BuildHelper();
}
public get dashboardDeployData(): (string | dataworkspace.IconCellValue)[][] {
public getDashboardDeployData(projectFile: string): (string | dataworkspace.IconCellValue)[][] {
const infoRows: (string | dataworkspace.IconCellValue)[][] = [];
let count = 0;
for (let i = this.deployInfo.length - 1; i >= 0; i--) {
let icon: azdata.IconPath;
let text: string;
if (this.deployInfo[i].status === Status.success) {
icon = IconPathHelper.success;
text = constants.Success;
} else if (this.deployInfo[i].status === Status.failed) {
icon = IconPathHelper.error;
text = constants.Failed;
} else {
icon = IconPathHelper.inProgress;
text = constants.InProgress;
}
if (this.deployInfo[i].projectFile === projectFile) {
let icon: azdata.IconPath;
let text: string;
if (this.deployInfo[i].status === Status.success) {
icon = IconPathHelper.success;
text = constants.Success;
} else if (this.deployInfo[i].status === Status.failed) {
icon = IconPathHelper.error;
text = constants.Failed;
} else {
icon = IconPathHelper.inProgress;
text = constants.InProgress;
}
let infoRow: (string | dataworkspace.IconCellValue)[] = [count.toString(),
{ text: text, icon: icon },
this.deployInfo[i].target,
this.deployInfo[i].timeToCompleteAction,
this.deployInfo[i].startDate];
infoRows.push(infoRow);
count++;
let infoRow: (string | dataworkspace.IconCellValue)[] = [count.toString(),
{ text: text, icon: icon },
this.deployInfo[i].target,
this.deployInfo[i].timeToCompleteAction,
this.deployInfo[i].startDate];
infoRows.push(infoRow);
count++;
}
}
return infoRows;
}
public get dashboardBuildData(): (string | dataworkspace.IconCellValue)[][] {
public getDashboardBuildData(projectFile: string): (string | dataworkspace.IconCellValue)[][] {
const infoRows: (string | dataworkspace.IconCellValue)[][] = [];
let count = 0;
for (let i = this.buildInfo.length - 1; i >= 0; i--) {
let icon: azdata.IconPath;
let text: string;
if (this.buildInfo[i].status === Status.success) {
icon = IconPathHelper.success;
text = constants.Success;
} else if (this.buildInfo[i].status === Status.failed) {
icon = IconPathHelper.error;
text = constants.Failed;
} else {
icon = IconPathHelper.inProgress;
text = constants.InProgress;
}
if (this.buildInfo[i].projectFile === projectFile) {
let icon: azdata.IconPath;
let text: string;
if (this.buildInfo[i].status === Status.success) {
icon = IconPathHelper.success;
text = constants.Success;
} else if (this.buildInfo[i].status === Status.failed) {
icon = IconPathHelper.error;
text = constants.Failed;
} else {
icon = IconPathHelper.inProgress;
text = constants.InProgress;
}
let infoRow: (string | dataworkspace.IconCellValue)[] = [count.toString(),
{ text: text, icon: icon },
this.buildInfo[i].target,
this.buildInfo[i].timeToCompleteAction,
this.buildInfo[i].startDate];
infoRows.push(infoRow);
count++;
let infoRow: (string | dataworkspace.IconCellValue)[] = [count.toString(),
{ text: text, icon: icon },
this.buildInfo[i].target,
this.buildInfo[i].timeToCompleteAction,
this.buildInfo[i].startDate];
infoRows.push(infoRow);
count++;
}
}
return infoRows;
@@ -176,7 +180,7 @@ export class ProjectsController {
const startTime = new Date();
const currentBuildTimeInfo = `${startTime.toLocaleDateString()} ${constants.at} ${startTime.toLocaleTimeString()}`;
let buildInfoNew = new DashboardData(Status.inProgress, project.getProjectTargetVersion(), currentBuildTimeInfo);
let buildInfoNew = new DashboardData(project.projectFilePath, Status.inProgress, project.getProjectTargetVersion(), currentBuildTimeInfo);
this.buildInfo.push(buildInfoNew);
if (this.buildInfo.length - 1 === maxTableLength) {
@@ -276,7 +280,7 @@ export class ProjectsController {
const actionStartTime = currentDate.getTime();
const currentDeployTimeInfo = `${currentDate.toLocaleDateString()} ${constants.at} ${currentDate.toLocaleTimeString()}`;
let deployInfoNew = new DashboardData(Status.inProgress, project.getProjectTargetVersion(), currentDeployTimeInfo);
let deployInfoNew = new DashboardData(project.projectFilePath, Status.inProgress, project.getProjectTargetVersion(), currentDeployTimeInfo);
this.deployInfo.push(deployInfoNew);
if (this.deployInfo.length - 1 === maxTableLength) {

View File

@@ -4,12 +4,14 @@
*--------------------------------------------------------------------------------------------*/
export class DashboardData {
public projectFile: string;
public status: Status;
public target: string;
public timeToCompleteAction: string;
public startDate: string;
constructor(status: Status, target: string, startDate: string) {
constructor(projectFile: string, status: Status, target: string, startDate: string) {
this.projectFile = projectFile;
this.status = status;
this.target = target;
this.timeToCompleteAction = '';

View File

@@ -128,7 +128,7 @@ export class SqlDatabaseProjectProvider implements dataworkspace.IProjectProvide
/**
* Gets the data to be displayed in the project dashboard
*/
get dashboardComponents(): dataworkspace.IDashboardTable[] {
getDashboardComponents(projectFile: string): dataworkspace.IDashboardTable[] {
const deployInfo: dataworkspace.IDashboardTable = {
name: constants.Deployments,
columns: [{ displayName: constants.ID, width: 100 },
@@ -136,7 +136,7 @@ export class SqlDatabaseProjectProvider implements dataworkspace.IProjectProvide
{ displayName: constants.Target, width: 250 },
{ displayName: constants.Time, width: 250 },
{ displayName: constants.Date, width: 250 }],
data: this.projectController.dashboardDeployData
data: this.projectController.getDashboardDeployData(projectFile)
};
const buildInfo: dataworkspace.IDashboardTable = {
@@ -146,7 +146,7 @@ export class SqlDatabaseProjectProvider implements dataworkspace.IProjectProvide
{ displayName: constants.Target, width: 250 },
{ displayName: constants.Time, width: 250 },
{ displayName: constants.Date, width: 250 }],
data: this.projectController.dashboardBuildData
data: this.projectController.getDashboardBuildData(projectFile)
};
return [deployInfo, buildInfo];