Switched deprecated data in declarative table to be dataValues (#16381)

* Controller overview datavalues

* Miaa OV datavalues

* data values PG OV

* data values PG OV p2

* data values PG health

* datavalues miaa OV p2
This commit is contained in:
nasc17
2021-07-21 10:06:27 -07:00
committed by GitHub
parent 2bc6a881bd
commit 3b0fff63d4
4 changed files with 48 additions and 15 deletions

View File

@@ -68,7 +68,7 @@ export class ControllerDashboardOverviewPage extends DashboardPage {
this._arcResourcesLoadingComponent = this.modelView.modelBuilder.loadingComponent().component(); this._arcResourcesLoadingComponent = this.modelView.modelBuilder.loadingComponent().component();
this._arcResourcesTable = this.modelView.modelBuilder.declarativeTable().withProperties<azdata.DeclarativeTableProperties>({ this._arcResourcesTable = this.modelView.modelBuilder.declarativeTable().withProperties<azdata.DeclarativeTableProperties>({
data: [], dataValues: [],
columns: [ columns: [
{ {
displayName: '', displayName: '',
@@ -224,7 +224,7 @@ export class ControllerDashboardOverviewPage extends DashboardPage {
this.controllerProperties.instanceNamespace = config?.metadata.namespace || this.controllerProperties.instanceNamespace; this.controllerProperties.instanceNamespace = config?.metadata.namespace || this.controllerProperties.instanceNamespace;
this.refreshDisplayedProperties(); this.refreshDisplayedProperties();
this._arcResourcesTable.data = this._controllerModel.registrations let registrations: (string | azdata.ImageComponent | azdata.HyperlinkComponent)[][] = this._controllerModel.registrations
.filter(r => r.instanceType !== ResourceType.dataControllers) .filter(r => r.instanceType !== ResourceType.dataControllers)
.map(r => { .map(r => {
const iconPath = getResourceTypeIcon(r.instanceType ?? ''); const iconPath = getResourceTypeIcon(r.instanceType ?? '');
@@ -249,6 +249,13 @@ export class ControllerDashboardOverviewPage extends DashboardPage {
return [imageComponent, nameComponent, resourceTypeToDisplayName(r.instanceType), r.state]; return [imageComponent, nameComponent, resourceTypeToDisplayName(r.instanceType), r.state];
}); });
let registrationsData = registrations.map(r => {
return r.map((value): azdata.DeclarativeTableCellValue => {
return { value: value };
});
});
this._arcResourcesTable.setDataValues(registrationsData);
this._arcResourcesLoadingComponent.loading = !this._controllerModel.registrationsLastUpdated; this._arcResourcesLoadingComponent.loading = !this._controllerModel.registrationsLastUpdated;
} }

View File

@@ -132,7 +132,7 @@ export class MiaaDashboardOverviewPage extends DashboardPage {
rowCssStyles: cssStyles.tableRow rowCssStyles: cssStyles.tableRow
} }
], ],
data: [] dataValues: []
}).component(); }).component();
this._databasesMessage = this.modelView.modelBuilder.text() this._databasesMessage = this.modelView.modelBuilder.text()
@@ -198,9 +198,9 @@ export class MiaaDashboardOverviewPage extends DashboardPage {
rowCssStyles: cssStyles.tableRow rowCssStyles: cssStyles.tableRow
} }
], ],
data: [ dataValues: [
[loc.kibanaDashboard, this._kibanaLoading, loc.kibanaDashboardDescription], [{ value: loc.kibanaDashboard }, { value: this._kibanaLoading }, { value: loc.kibanaDashboardDescription }],
[loc.grafanaDashboard, this._grafanaLoading, loc.grafanaDashboardDescription]] [{ value: loc.grafanaDashboard }, { value: this._grafanaLoading }, { value: loc.grafanaDashboardDescription }]]
}).component(); }).component();
rootContainer.addItem(endpointsTable); rootContainer.addItem(endpointsTable);
@@ -366,7 +366,13 @@ export class MiaaDashboardOverviewPage extends DashboardPage {
// If we were able to get the databases it means we have a good connection so update the username too // If we were able to get the databases it means we have a good connection so update the username too
this._instanceProperties.miaaAdmin = this._miaaModel.username || this._instanceProperties.miaaAdmin; this._instanceProperties.miaaAdmin = this._miaaModel.username || this._instanceProperties.miaaAdmin;
this.refreshDisplayedProperties(); this.refreshDisplayedProperties();
this._databasesTable.data = this._miaaModel.databases.map(d => [d.name, getDatabaseStateDisplayText(d.status)]); let databaseDisplayText = this._miaaModel.databases.map(d => [d.name, getDatabaseStateDisplayText(d.status)]);
let databasesTextValues = databaseDisplayText.map(d => {
return d.map((value): azdata.DeclarativeTableCellValue => {
return { value: value };
});
});
this._databasesTable.setDataValues(databasesTextValues);
this._databasesTableLoading.loading = false; this._databasesTableLoading.loading = false;
if (this._miaaModel.databasesLastUpdated) { if (this._miaaModel.databasesLastUpdated) {

View File

@@ -139,9 +139,9 @@ export class PostgresOverviewPage extends DashboardPage {
rowCssStyles: cssStyles.tableRow rowCssStyles: cssStyles.tableRow
} }
], ],
data: [ dataValues: [
[loc.kibanaDashboard, this.kibanaLoading, loc.kibanaDashboardDescription], [{ value: loc.kibanaDashboard }, { value: this.kibanaLoading }, { value: loc.kibanaDashboardDescription }],
[loc.grafanaDashboard, this.grafanaLoading, loc.grafanaDashboardDescription]] [{ value: loc.grafanaDashboard }, { value: this.grafanaLoading }, { value: loc.grafanaDashboardDescription }]]
}).component(); }).component();
content.addItem(endpointsTable); content.addItem(endpointsTable);
@@ -151,6 +151,8 @@ export class PostgresOverviewPage extends DashboardPage {
CSSStyles: titleCSS CSSStyles: titleCSS
}).component()); }).component());
this.podStatusTable = this.modelView.modelBuilder.declarativeTable().withProps({ this.podStatusTable = this.modelView.modelBuilder.declarativeTable().withProps({
width: '100%', width: '100%',
columns: [ columns: [
@@ -185,7 +187,7 @@ export class PostgresOverviewPage extends DashboardPage {
rowCssStyles: cssStyles.tableRow rowCssStyles: cssStyles.tableRow
} }
], ],
data: [this.podStatusData.map(p => [p.podName, p.type, p.status])] dataValues: this.createPodStatusDataValues()
}).component(); }).component();
@@ -389,6 +391,15 @@ export class PostgresOverviewPage extends DashboardPage {
return podModels; return podModels;
} }
private createPodStatusDataValues(): azdata.DeclarativeTableCellValue[][] {
let podDataValue: (string | azdata.Component)[][] = this.podStatusData.map(p => [p.podName, p.type, p.status]);
return podDataValue.map(p => {
return p.map((value): azdata.DeclarativeTableCellValue => {
return { value: value };
});
});
}
private refreshDashboardLinks(): void { private refreshDashboardLinks(): void {
if (this._postgresModel.config) { if (this._postgresModel.config) {
const kibanaUrl = this._postgresModel.config.status.logSearchDashboard ?? ''; const kibanaUrl = this._postgresModel.config.status.logSearchDashboard ?? '';
@@ -406,7 +417,7 @@ export class PostgresOverviewPage extends DashboardPage {
private refreshServerNodes(): void { private refreshServerNodes(): void {
if (this._postgresModel.config) { if (this._postgresModel.config) {
this.podStatusData = this.getPodStatus(); this.podStatusData = this.getPodStatus();
this.podStatusTable.data = this.podStatusData.map(p => [p.podName, p.type, p.status]); this.podStatusTable.setDataValues(this.createPodStatusDataValues());
this.serverGroupNodesLoading.loading = false; this.serverGroupNodesLoading.loading = false;
} }
} }

View File

@@ -12,7 +12,7 @@ import { PostgresModel } from '../../../models/postgresModel';
export type PodHealthModel = { export type PodHealthModel = {
condition: string, condition: string,
details?: azdata.Component, details: azdata.Component,
lastUpdate: string lastUpdate: string
}; };
@@ -119,7 +119,7 @@ export class PostgresResourceHealthPage extends DashboardPage {
rowCssStyles: cssStyles.tableRow rowCssStyles: cssStyles.tableRow
} }
], ],
data: [this.coordinatorData.map(p => [p.condition, p.details, p.lastUpdate])] dataValues: this.createPodConditionsDataValues(this.coordinatorData)
}).component(); }).component();
this.podDropDown = this.modelView.modelBuilder.dropDown().withProps({ width: '150px' }).component(); this.podDropDown = this.modelView.modelBuilder.dropDown().withProps({ width: '150px' }).component();
@@ -234,11 +234,20 @@ export class PostgresResourceHealthPage extends DashboardPage {
this.podConditionsTableIndexes.set(p.name, indexes); this.podConditionsTableIndexes.set(p.name, indexes);
}); });
this.podConditionsTable.data = this.podsData.map(p => [p.condition, p.details, p.lastUpdate]); this.podConditionsTable.setDataValues(this.createPodConditionsDataValues(this.podsData));
return podNames; return podNames;
} }
private createPodConditionsDataValues(podInfo: PodHealthModel[]): azdata.DeclarativeTableCellValue[][] {
let podDataValues: (string | azdata.Component)[][] = podInfo.map(p => [p.condition, p.details, p.lastUpdate]);
return podDataValues.map(p => {
return p.map((value): azdata.DeclarativeTableCellValue => {
return { value: value };
});
});
}
private findPodIssues(): string[] { private findPodIssues(): string[] {
const podStatus = this._postgresModel.config?.status.podsStatus; const podStatus = this._postgresModel.config?.status.podsStatus;
let issueCount = 0; let issueCount = 0;