Agent/proxy ui (#1880)

* finished basic proxy ui

* finished proxy UI and logic

* made changes to accomodate toolsservice side changes
This commit is contained in:
Aditya Bist
2018-07-14 10:43:31 -07:00
committed by Karl Burtram
parent 713c74adfd
commit 74c4b7311e
13 changed files with 225 additions and 28 deletions

View File

@@ -34,6 +34,8 @@ export interface IJobManagementService {
getProxies(connectionUri: string): Thenable<sqlops.AgentProxiesResult>;
deleteProxy(connectionUri: string, proxy: sqlops.AgentProxyInfo): Thenable<sqlops.ResultStatus>;
getCredentials(connectionUri: string): Thenable<sqlops.GetCredentialsResult>;
jobAction(connectionUri: string, jobName: string, action: string): Thenable<sqlops.ResultStatus>;
addToCache(server: string, cache: JobCacheObject);
jobCacheObjectMap: { [server: string]: JobCacheObject; };

View File

@@ -78,6 +78,12 @@ export class JobManagementService implements IJobManagementService {
});
}
public getCredentials(connectionUri: string): Thenable<sqlops.GetCredentialsResult> {
return this._runAction(connectionUri, (runner) => {
return runner.getCredentials(connectionUri);
});
}
public getJobHistory(connectionUri: string, jobID: string): Thenable<sqlops.AgentJobHistoryResult> {
return this._runAction(connectionUri, (runner) => {
return runner.getJobHistory(connectionUri, jobID);

View File

@@ -166,7 +166,11 @@ export class ProxiesViewComponent extends JobManagementView implements OnInit {
public openCreateProxyDialog() {
let ownerUri: string = this._commonService.connectionManagementService.connectionInfo.ownerUri;
this._commandService.executeCommand('agent.openProxyDialog', ownerUri);
this._jobManagementService.getCredentials(ownerUri).then((result) => {
if (result && result.credentials) {
this._commandService.executeCommand('agent.openProxyDialog', ownerUri, undefined, result.credentials);
}
});
}
private refreshJobs() {

17
src/sql/sqlops.d.ts vendored
View File

@@ -1503,6 +1503,9 @@ declare module 'sqlops' {
updateProxy(ownerUri: string, originalProxyName: string, proxyInfo: AgentProxyInfo): Thenable<UpdateAgentOperatorResult>;
deleteProxy(ownerUri: string, proxyInfo: AgentProxyInfo): Thenable<ResultStatus>;
// Credential method
getCredentials(ownerUri: string): Thenable<GetCredentialsResult>;
// Job Schedule management methods
getJobSchedules(ownerUri: string): Thenable<AgentJobSchedulesResult>;
createJobSchedule(ownerUri: string, scheduleInfo: AgentJobScheduleInfo): Thenable<CreateAgentJobScheduleResult>;
@@ -1512,6 +1515,20 @@ declare module 'sqlops' {
registerOnUpdated(handler: () => any): void;
}
// Security service interfaces ------------------------------------------------------------------------
export interface CredentialInfo {
id: number;
identity: string;
name: string;
dateLastModified: string;
createDate: string;
providerName: string;
}
export interface GetCredentialsResult extends ResultStatus {
credentials: CredentialInfo[];
}
// Task service interfaces ----------------------------------------------------------------------------
export enum TaskStatus {
notStarted = 0,

View File

@@ -604,6 +604,13 @@ export class ExtHostDataProtocol extends ExtHostDataProtocolShape {
return this._resolveProvider<sqlops.AgentServicesProvider>(handle).deleteProxy(ownerUri, proxy);
}
/**
* Gets Agent Credentials from server
*/
$getCredentials(handle: number, ownerUri: string): Thenable<sqlops.GetCredentialsResult> {
return this._resolveProvider<sqlops.AgentServicesProvider>(handle).getCredentials(ownerUri);
}
/**
* SQL Agent job data update notification
*/

View File

@@ -366,6 +366,9 @@ export class MainThreadDataProtocol implements MainThreadDataProtocolShape {
deleteProxy(connectionUri: string, proxyInfo: sqlops.AgentProxyInfo): Thenable<sqlops.ResultStatus> {
return self._proxy.$deleteProxy(handle, connectionUri, proxyInfo);
},
getCredentials(connectionUri: string): Thenable<sqlops.GetCredentialsResult> {
return self._proxy.$getCredentials(handle, connectionUri);
}
});
return undefined;

View File

@@ -372,6 +372,11 @@ export abstract class ExtHostDataProtocolShape {
* Deletes a proxy
*/
$deleteProxy(handle: number, connectionUri: string, proxy: sqlops.AgentProxyInfo): Thenable<sqlops.ResultStatus> { throw ni(); }
/**
* Get Agent Credentials list
*/
$getCredentials(handle: number, connectionUri: string): Thenable<sqlops.GetCredentialsResult> { throw ni(); }
}
/**