Update and align endpoint names (#6953)

This commit is contained in:
Charles Gagnon
2019-08-26 11:39:46 -07:00
committed by GitHub
parent 877a71d673
commit eea9d13350
4 changed files with 66 additions and 61 deletions

View File

@@ -139,17 +139,10 @@ export class BdcDashboard {
this.initialized = true; this.initialized = true;
// Now that we've created the UI load data from the model in case it already had data // Now that we've created the UI load data from the model in case it already had data
this.handleEndpointsUpdate(this.model.serviceEndpoints);
this.handleBdcStatusUpdate(this.model.bdcStatus); this.handleBdcStatusUpdate(this.model.bdcStatus);
}); });
} }
private handleEndpointsUpdate(endpoints: EndpointModel[]): void {
if (!this.initialized || !endpoints) {
return;
}
}
private handleBdcStatusUpdate(bdcStatus: BdcStatusModel): void { private handleBdcStatusUpdate(bdcStatus: BdcStatusModel): void {
if (!this.initialized || !bdcStatus) { if (!this.initialized || !bdcStatus) {
return; return;

View File

@@ -10,7 +10,7 @@ import * as vscode from 'vscode';
import * as nls from 'vscode-nls'; import * as nls from 'vscode-nls';
import { BdcDashboardModel } from './bdcDashboardModel'; import { BdcDashboardModel } from './bdcDashboardModel';
import { IconPathHelper } from '../constants'; import { IconPathHelper } from '../constants';
import { getStateDisplayText, getHealthStatusDisplayText, getHealthStatusIcon, getEndpointDisplayText, getServiceNameDisplayText, Endpoint } from '../utils'; import { getStateDisplayText, getHealthStatusDisplayText, getEndpointDisplayText, getHealthStatusIcon, getServiceNameDisplayText, Endpoint } from '../utils';
import { EndpointModel, ServiceStatusModel, BdcStatusModel } from '../controller/apiGenerated'; import { EndpointModel, ServiceStatusModel, BdcStatusModel } from '../controller/apiGenerated';
const localize = nls.loadMessageBundle(); const localize = nls.loadMessageBundle();
@@ -20,7 +20,7 @@ const overviewServiceNameCellWidth = '100px';
const overviewStateCellWidth = '75px'; const overviewStateCellWidth = '75px';
const overviewHealthStatusCellWidth = '100px'; const overviewHealthStatusCellWidth = '100px';
const serviceEndpointRowServiceNameCellWidth = '125px'; const serviceEndpointRowServiceNameCellWidth = '175px';
const serviceEndpointRowEndpointCellWidth = '350px'; const serviceEndpointRowEndpointCellWidth = '350px';
const hyperlinkedEndpoints = [Endpoint.metricsui, Endpoint.logsui, Endpoint.sparkHistory, Endpoint.yarnUi]; const hyperlinkedEndpoints = [Endpoint.metricsui, Endpoint.logsui, Endpoint.sparkHistory, Endpoint.yarnUi];
@@ -246,15 +246,15 @@ function createServiceEndpointRow(modelBuilder: azdata.ModelBuilder, container:
endPointRow.addItem(nameCell, { CSSStyles: { 'width': serviceEndpointRowServiceNameCellWidth, 'min-width': serviceEndpointRowServiceNameCellWidth, 'user-select': 'text', 'text-align': 'center' } }); endPointRow.addItem(nameCell, { CSSStyles: { 'width': serviceEndpointRowServiceNameCellWidth, 'min-width': serviceEndpointRowServiceNameCellWidth, 'user-select': 'text', 'text-align': 'center' } });
if (isHyperlink) { if (isHyperlink) {
const endpointCell = modelBuilder.hyperlink() const endpointCell = modelBuilder.hyperlink()
.withProperties({ label: endpoint.endpoint, url: endpoint.endpoint, CSSStyles: { 'height': '15px', 'padding-left': '10px' } }) .withProperties({ label: endpoint.endpoint, url: endpoint.endpoint, CSSStyles: { 'height': '15px' } })
.component(); .component();
endPointRow.addItem(endpointCell, { CSSStyles: { 'width': serviceEndpointRowEndpointCellWidth, 'min-width': serviceEndpointRowEndpointCellWidth, 'color': '#0078d4', 'text-decoration': 'underline', 'overflow': 'hidden' } }); endPointRow.addItem(endpointCell, { CSSStyles: { 'width': serviceEndpointRowEndpointCellWidth, 'min-width': serviceEndpointRowEndpointCellWidth, 'color': '#0078d4', 'text-decoration': 'underline', 'overflow': 'hidden', 'padding-left': '10px' } });
} }
else { else {
const endpointCell = modelBuilder.text() const endpointCell = modelBuilder.text()
.withProperties({ value: endpoint.endpoint, CSSStyles: { 'margin-block-start': '0px', 'margin-block-end': '0px', 'user-select': 'text', 'padding-left': '10px' } }) .withProperties({ value: endpoint.endpoint, CSSStyles: { 'margin-block-start': '0px', 'margin-block-end': '0px', 'user-select': 'text' } })
.component(); .component();
endPointRow.addItem(endpointCell, { CSSStyles: { 'width': serviceEndpointRowEndpointCellWidth, 'min-width': serviceEndpointRowEndpointCellWidth, 'overflow': 'hidden' } }); endPointRow.addItem(endpointCell, { CSSStyles: { 'width': serviceEndpointRowEndpointCellWidth, 'min-width': serviceEndpointRowEndpointCellWidth, 'overflow': 'hidden', 'padding-left': '10px' } });
} }
const copyValueCell = modelBuilder.button().component(); const copyValueCell = modelBuilder.button().component();
copyValueCell.iconPath = IconPathHelper.copy; copyValueCell.iconPath = IconPathHelper.copy;

View File

@@ -112,30 +112,30 @@ export function getEndpointDisplayText(endpointName?: string, description?: stri
case Endpoint.appProxy: case Endpoint.appProxy:
return localize('endpoint.appproxy', "Application Proxy"); return localize('endpoint.appproxy', "Application Proxy");
case Endpoint.controller: case Endpoint.controller:
return localize('endpoint.controller', "Controller"); return localize('endpoint.controller', "Cluster Management Service");
case Endpoint.gateway: case Endpoint.gateway:
return localize('endpoint.gateway', "HDFS/Spark Gateway"); return localize('endpoint.gateway', "Gateway to access HDFS files, Spark");
case Endpoint.managementProxy: case Endpoint.managementProxy:
return localize('endpoint.managementproxy', "Management Proxy"); return localize('endpoint.managementproxy', "Management Proxy");
case Endpoint.mgmtproxy: case Endpoint.mgmtproxy:
return localize('endpoint.mgmtproxy', "Management Proxy"); return localize('endpoint.mgmtproxy', "Management Proxy");
case Endpoint.sqlServerMaster: case Endpoint.sqlServerMaster:
return localize('endpoint.sqlServerEndpoint', "SQL Server Master Instance"); return localize('endpoint.sqlServerEndpoint', "SQL Server Master Instance Front-End");
case Endpoint.metricsui: case Endpoint.metricsui:
return localize('endpoint.grafana', "Metrics Dashboard"); return localize('endpoint.grafana', "Metrics Dashboard");
case Endpoint.logsui: case Endpoint.logsui:
return localize('endpoint.kibana', "Log Search Dashboard"); return localize('endpoint.kibana', "Log Search Dashboard");
case Endpoint.yarnUi: case Endpoint.yarnUi:
return localize('endpoint.yarnHistory', "Spark Resource Management"); return localize('endpoint.yarnHistory', "Spark Diagnostics and Monitoring Dashboard");
case Endpoint.sparkHistory: case Endpoint.sparkHistory:
return localize('endpoint.sparkHistory', "Spark Job Monitoring"); return localize('endpoint.sparkHistory', "Spark Jobs Management and Monitoring Dashboard");
case Endpoint.webhdfs: case Endpoint.webhdfs:
return localize('endpoint.webhdfs', "HDFS File System Proxy"); return localize('endpoint.webhdfs', "HDFS File System Proxy");
case Endpoint.livy: case Endpoint.livy:
return localize('endpoint.livy', "Spark Proxy"); return localize('endpoint.livy', "Proxy for running Spark statements, jobs, applications");
default: default:
// Default is to use the description if one was given, otherwise worst case just fall back to using the // Default is to use the description if one was given, otherwise worst case just fall back to using the
// original service name // original endpoint name
return description && description.length > 0 ? description : endpointName; return description && description.length > 0 ? description : endpointName;
} }
} }

View File

@@ -54,7 +54,7 @@ export function registerServiceEndpoints(context: vscode.ExtensionContext): void
} }
endpointsArray = endpointsArray.map(e => { endpointsArray = endpointsArray.map(e => {
e.description = getFriendlyEndpointNames(e); e.description = getEndpointDisplayText(e.serviceName, e.description);
return e; return e;
}).sort((a, b) => a.endpoint.localeCompare(b.endpoint)); }).sort((a, b) => a.endpoint.localeCompare(b.endpoint));
@@ -105,44 +105,56 @@ function getCustomEndpoint(parentEndpoint: utils.IEndpoint, serviceName: string,
return null; return null;
} }
function getFriendlyEndpointNames(endpointInfo: utils.IEndpoint): string { export enum Endpoint {
let friendlyName: string = endpointInfo.description || endpointInfo.serviceName; gateway = 'gateway',
switch (endpointInfo.serviceName) { sparkHistory = 'spark-history',
case 'app-proxy': yarnUi = 'yarn-ui',
friendlyName = localize('approxy.description', "Application Proxy"); appProxy = 'app-proxy',
break; mgmtproxy = 'mgmtproxy',
case 'controller': managementProxy = 'management-proxy',
friendlyName = localize('controller.description', "Cluster Management Service"); logsui = 'logsui',
break; metricsui = 'metricsui',
case 'gateway': controller = 'controller',
friendlyName = localize('gateway.description', "HDFS and Spark"); sqlServerMaster = 'sql-server-master',
break; webhdfs = 'webhdfs',
case mgmtProxyName: livy = 'livy'
friendlyName = localize('mgmtproxy.description', "Management Proxy"); }
break;
case logsuiEndpointName: /**
friendlyName = logsuiDescription; * Gets the localized text to display for a corresponding endpoint
break; * @param serviceName The endpoint name to get the display text for
case grafanaEndpointName: * @param description The backup description to use if we don't have our own
friendlyName = grafanaDescription; */
break; function getEndpointDisplayText(endpointName?: string, description?: string): string {
case sparkHistoryEndpointName: endpointName = endpointName || '';
friendlyName = sparkHistoryDescription; switch (endpointName.toLowerCase()) {
break; case Endpoint.appProxy:
case yarnUiEndpointName: return localize('endpoint.appproxy', "Application Proxy");
friendlyName = yarnHistoryDescription; case Endpoint.controller:
break; return localize('endpoint.controller', "Cluster Management Service");
case 'sql-server-master': case Endpoint.gateway:
friendlyName = localize('sqlmaster.description', "SQL Server Master Instance Front-End"); return localize('endpoint.gateway', "Gateway to access HDFS files, Spark");
break; case Endpoint.managementProxy:
case 'webhdfs': return localize('endpoint.managementproxy', "Management Proxy");
friendlyName = localize('webhdfs.description', "HDFS File System Proxy"); case Endpoint.mgmtproxy:
break; return localize('endpoint.mgmtproxy', "Management Proxy");
case 'livy': case Endpoint.sqlServerMaster:
friendlyName = localize('livy.description', "Proxy for running Spark statements, jobs, applications"); return localize('endpoint.sqlServerEndpoint', "SQL Server Master Instance Front-End");
break; case Endpoint.metricsui:
default: return localize('endpoint.grafana', "Metrics Dashboard");
break; case Endpoint.logsui:
} return localize('endpoint.kibana', "Log Search Dashboard");
return friendlyName; case Endpoint.yarnUi:
return localize('endpoint.yarnHistory', "Spark Diagnostics and Monitoring Dashboard");
case Endpoint.sparkHistory:
return localize('endpoint.sparkHistory', "Spark Jobs Management and Monitoring Dashboard");
case Endpoint.webhdfs:
return localize('endpoint.webhdfs', "HDFS File System Proxy");
case Endpoint.livy:
return localize('endpoint.livy', "Proxy for running Spark statements, jobs, applications");
default:
// Default is to use the description if one was given, otherwise worst case just fall back to using the
// original endpoint name
return description && description.length > 0 ? description : endpointName;
}
} }