mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -05:00
Mount HDFS Dialog: basic support (#7580)
Implemented in this PR - New base dialog for anything needing to work with the controller. This is important since going from SQL -> Controller we "should" have the right permissions but aren't guaranteed - Support for Mount HDFS via a dialog. Includes basic polling for success/failure, but have to give up after 2.5min as mounting could take hours. By then it's assumed to be successful since server-side has 2min timeout built in. Not implemented in this PR - Script as Notebook button. This should convert the inputs to a set of cells in a notebook so users can run things themselves - Updates based on PM / UX reviews. I think we'll need a round of feedback before completing this work.
This commit is contained in:
@@ -6,9 +6,10 @@
|
||||
'use strict';
|
||||
|
||||
import * as vscode from 'vscode';
|
||||
import * as azdata from 'azdata';
|
||||
import * as nls from 'vscode-nls';
|
||||
|
||||
const localize = nls.loadMessageBundle();
|
||||
import * as constants from './constants';
|
||||
|
||||
export enum Endpoint {
|
||||
gateway = 'gateway',
|
||||
@@ -210,3 +211,46 @@ export function getHealthStatusDot(healthStatus?: string): string {
|
||||
return '•';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
interface RawEndpoint {
|
||||
serviceName: string;
|
||||
description?: string;
|
||||
endpoint?: string;
|
||||
protocol?: string;
|
||||
ipAddress?: string;
|
||||
port?: number;
|
||||
}
|
||||
|
||||
export interface IEndpoint {
|
||||
serviceName: string;
|
||||
description: string;
|
||||
endpoint: string;
|
||||
protocol: string;
|
||||
}
|
||||
|
||||
export function getClusterEndpoints(serverInfo: azdata.ServerInfo): IEndpoint[] {
|
||||
let endpoints: RawEndpoint[] = serverInfo.options[constants.clusterEndpointsProperty];
|
||||
if (!endpoints || endpoints.length === 0) { return []; }
|
||||
|
||||
return endpoints.map(e => {
|
||||
// If endpoint is missing, we're on CTP bits. All endpoints from the CTP serverInfo should be treated as HTTPS
|
||||
let endpoint = e.endpoint ? e.endpoint : `https://${e.ipAddress}:${e.port}`;
|
||||
let updatedEndpoint: IEndpoint = {
|
||||
serviceName: e.serviceName,
|
||||
description: e.description,
|
||||
endpoint: endpoint,
|
||||
protocol: e.protocol
|
||||
};
|
||||
return updatedEndpoint;
|
||||
});
|
||||
}
|
||||
|
||||
export function getControllerEndpoint(serverInfo: azdata.ServerInfo): string | undefined {
|
||||
let endpoints = getClusterEndpoints(serverInfo);
|
||||
if (endpoints) {
|
||||
let index = endpoints.findIndex(ep => ep.serviceName.toLowerCase() === constants.controllerEndpointName.toLowerCase());
|
||||
if (index < 0) { return undefined; }
|
||||
return endpoints[index].endpoint;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user