Agent Notebooks Scheduler (#6786)

* added agent notebooks, notebook history view and view materialized notebook button

* Got a basic UI running for viewing notebook history

* made some changes to make UI look good

* Added new notebook dialog

* Added new notebook Dialog

* Added create notebook dialog

* Added edit and delete notebook job

* Added some notebook history features

* Added new notebook job icons, fixed a minor bug
in openmaterializednotebookAPI and added fixed the
schedule Picker API.

* Fixed Bugs in Notebook Grid expansion

* Fixed Notebook table highlighting and
grid generation is done using code.

* fixed some UI bugs

* Added changes to reflect sqltoolservice api

* Fixed some localize keys

* Made changes in the PR and added
ability to open Template Notebooks from
notebook history view.

* Added pin and renaming to notebook history

* made some library calls async

* fixed an import bug caused by merging from master

* Validation in NotebookJobDialog

* Added entry points for scheduling notebooks
on file explorer and notebook editor

* Handled no active connections and
a small bug in collapsing grid

* fix a bug in scheduling notebook from explorer
and toolbar

* setting up agent providers from connection now

* changed modals

* Reupload edited template

* Add dialog info, solved an edit bug and localized
UI strings.

* Bug fixes in UI, notebook renaming and
editing template on fly.

* fixed a bug that failed editing notebook jobs from notebook jobs table

* Fixed a cyclic dependency, made strings const and
some other changes in the PR

* Made some cyclic dependency and some fixes from PR

* made some changes mentioned in the PR

* Changed storage database health text

* Changed the sqltoolservice version to the point to the latest build.
This commit is contained in:
Aasim Khan
2019-09-04 15:12:35 -07:00
committed by GitHub
parent 0a393400b2
commit fbb2accacb
48 changed files with 3948 additions and 149 deletions

View File

@@ -1,6 +1,6 @@
{
"downloadUrl": "https://github.com/Microsoft/sqltoolsservice/releases/download/v{#version#}/microsoft.sqltools.servicelayer-{#fileName#}",
"version": "2.0.0-release.6",
"version": "2.0.0-release.10",
"downloadFileNames": {
"Windows_86": "win-x86-netcoreapp2.2.zip",
"Windows_64": "win-x64-netcoreapp2.2.zip",

View File

@@ -87,6 +87,68 @@ export interface DeleteAgentJobStepParams {
step: azdata.AgentJobStepInfo;
}
// Notebook management parameters
export interface AgentNotebookParams {
ownerUri: string;
}
export interface AgentNotebookHistoryParams {
ownerUri: string;
jobId: string;
jobName: string;
targetDatabase: string;
}
export interface AgentNotebookMaterializedParams {
ownerUri: string;
targetDatabase: string;
notebookMaterializedId: number;
}
export interface AgentNotebookTemplateParams {
ownerUri: string;
targetDatabase: string;
jobId: string;
}
export interface CreateAgentNotebookParams {
ownerUri: string;
notebook: azdata.AgentNotebookInfo;
templateFilePath: string;
}
export interface UpdateAgentNotebookParams {
ownerUri: string;
originalNotebookName: string;
notebook: azdata.AgentJobInfo;
templateFilePath: string;
}
export interface UpdateAgentNotebookRunPinParams {
ownerUri: string;
targetDatabase: string;
agentNotebookHistory: azdata.AgentNotebookHistoryInfo;
materializedNotebookPin: boolean;
}
export interface UpdateAgentNotebookRunNameParams {
ownerUri: string;
targetDatabase: string;
agentNotebookHistory: azdata.AgentNotebookHistoryInfo;
materializedNotebookName: string;
}
export interface DeleteAgentNotebookParams {
ownerUri: string;
notebook: azdata.AgentNotebookInfo;
}
export interface DeleteAgentMaterializedNotebookParams {
ownerUri: string;
targetDatabase: string;
agentNotebookHistory: azdata.AgentNotebookHistoryInfo;
}
// Alert management parameters
export interface AgentAlertsParams {
ownerUri: string;
@@ -218,6 +280,47 @@ export namespace DeleteAgentJobStepRequest {
export const type = new RequestType<DeleteAgentJobStepParams, azdata.ResultStatus, void, void>('agent/deletejobstep');
}
// Notebooks request
export namespace AgentNotebooksRequest {
export const type = new RequestType<AgentNotebookParams, azdata.AgentNotebooksResult, void, void>('agent/notebooks');
}
export namespace AgentNotebookHistoryRequest {
export const type = new RequestType<AgentNotebookHistoryParams, azdata.AgentNotebookHistoryResult, void, void>('agent/notebookhistory');
}
export namespace AgentNotebookMaterializedRequest {
export const type = new RequestType<AgentNotebookMaterializedParams, azdata.AgentNotebookMaterializedResult, void, void>('agent/notebookmaterialized');
}
export namespace UpdateAgentNotebookRunNameRequest {
export const type = new RequestType<UpdateAgentNotebookRunNameParams, azdata.UpdateAgentNotebookResult, void, void>('agent/updatenotebookname');
}
export namespace DeleteMaterializedNotebookRequest {
export const type = new RequestType<DeleteAgentMaterializedNotebookParams, azdata.ResultStatus, void, void>('agent/deletenotebookmaterialized');
}
export namespace UpdateAgentNotebookRunPinRequest {
export const type = new RequestType<UpdateAgentNotebookRunPinParams, azdata.ResultStatus, void, void>('agent/updatenotebookpin');
}
export namespace AgentNotebookTemplateRequest {
export const type = new RequestType<AgentNotebookTemplateParams, azdata.ResultStatus, void, void>('agent/notebooktemplate');
}
export namespace CreateAgentNotebookRequest {
export const type = new RequestType<CreateAgentNotebookParams, azdata.CreateAgentNotebookResult, void, void>('agent/createnotebook');
}
export namespace DeleteAgentNotebookRequest {
export const type = new RequestType<DeleteAgentNotebookParams, azdata.ResultStatus, void, void>('agent/deletenotebook');
}
export namespace UpdateAgentNotebookRequest {
export const type = new RequestType<UpdateAgentNotebookParams, azdata.UpdateAgentNotebookResult, void, void>('agent/updatenotebook');
}
// Alerts requests
export namespace AgentAlertsRequest {
export const type = new RequestType<CreateAgentAlertParams, azdata.AgentAlertsResult, void, void>('agent/alerts');

View File

@@ -227,6 +227,151 @@ export class AgentServicesFeature extends SqlOpsFeature<undefined> {
);
};
// Notebook Management methods
const getNotebooks = (ownerUri: string): Thenable<azdata.AgentNotebooksResult> => {
let params: contracts.AgentNotebookParams = { ownerUri: ownerUri };
return client.sendRequest(contracts.AgentNotebooksRequest.type, params).then(
r => r,
e => {
client.logFailedRequest(contracts.AgentNotebooksRequest.type, e);
return Promise.resolve(undefined);
}
);
};
const getNotebookHistory = (ownerUri: string, jobID: string, jobName: string, targetDatabase: string): Thenable<azdata.AgentNotebookHistoryResult> => {
let params: contracts.AgentNotebookHistoryParams = { ownerUri: ownerUri, jobId: jobID, jobName: jobName, targetDatabase: targetDatabase };
return client.sendRequest(contracts.AgentNotebookHistoryRequest
.type, params).then(
r => r,
e => {
client.logFailedRequest(contracts.AgentNotebookHistoryRequest.type, e);
return Promise.resolve(undefined);
}
);
};
const getMaterializedNotebook = (ownerUri: string, targetDatabase: string, notebookMaterializedId: number): Thenable<azdata.AgentNotebookMaterializedResult> => {
let params: contracts.AgentNotebookMaterializedParams = { ownerUri: ownerUri, targetDatabase: targetDatabase, notebookMaterializedId: notebookMaterializedId };
return client.sendRequest(contracts.AgentNotebookMaterializedRequest
.type, params).then(
r => r,
e => {
client.logFailedRequest(contracts.AgentNotebookMaterializedRequest.type, e);
return Promise.resolve(undefined);
}
);
};
const getTemplateNotebook = (ownerUri: string, targetDatabase: string, jobId: string): Thenable<azdata.AgentNotebookTemplateResult> => {
let params: contracts.AgentNotebookTemplateParams = { ownerUri: ownerUri, targetDatabase: targetDatabase, jobId: jobId };
return client.sendRequest(contracts.AgentNotebookTemplateRequest
.type, params).then(
r => r,
e => {
client.logFailedRequest(contracts.AgentNotebookTemplateRequest.type, e);
return Promise.resolve(undefined);
}
);
};
const createNotebook = (ownerUri: string, notebookInfo: azdata.AgentNotebookInfo, templateFilePath: string): Thenable<azdata.CreateAgentNotebookResult> => {
let params: contracts.CreateAgentNotebookParams = {
ownerUri: ownerUri,
notebook: notebookInfo,
templateFilePath: templateFilePath
};
let requestType = contracts.CreateAgentNotebookRequest.type;
return client.sendRequest(requestType, params).then(
r => {
fireOnUpdated();
return r;
},
e => {
client.logFailedRequest(requestType, e);
return Promise.resolve(undefined);
}
);
};
const updateNotebook = (ownerUri: string, originalNotebookName: string, notebookInfo: azdata.AgentNotebookInfo, templateFilePath: string): Thenable<azdata.UpdateAgentNotebookResult> => {
let params: contracts.UpdateAgentNotebookParams = {
ownerUri: ownerUri,
originalNotebookName: originalNotebookName,
notebook: notebookInfo,
templateFilePath: templateFilePath
};
let requestType = contracts.UpdateAgentNotebookRequest.type;
return client.sendRequest(requestType, params).then(
r => {
fireOnUpdated();
return r;
},
e => {
client.logFailedRequest(requestType, e);
return Promise.resolve(undefined);
}
);
};
const deleteNotebook = (ownerUri: string, notebookInfo: azdata.AgentNotebookInfo): Thenable<azdata.ResultStatus> => {
let params: contracts.DeleteAgentNotebookParams = {
ownerUri: ownerUri,
notebook: notebookInfo
};
let requestType = contracts.DeleteAgentNotebookRequest.type;
return client.sendRequest(requestType, params).then(
r => {
fireOnUpdated();
return r;
},
e => {
client.logFailedRequest(requestType, e);
return Promise.resolve(undefined);
}
);
};
const deleteMaterializedNotebook = (ownerUri: string, agentNotebookHistory: azdata.AgentNotebookHistoryInfo, targetDatabase: string): Thenable<azdata.ResultStatus> => {
let params: contracts.DeleteAgentMaterializedNotebookParams = { ownerUri: ownerUri, targetDatabase: targetDatabase, agentNotebookHistory: agentNotebookHistory };
return client.sendRequest(contracts.DeleteMaterializedNotebookRequest
.type, params).then(
r => r,
e => {
client.logFailedRequest(contracts.DeleteMaterializedNotebookRequest.type, e);
return Promise.resolve(undefined);
}
);
};
const updateNotebookMaterializedName = (ownerUri: string, agentNotebookHistory: azdata.AgentNotebookHistoryInfo, targetDatabase: string, name: string): Thenable<azdata.ResultStatus> => {
let params: contracts.UpdateAgentNotebookRunNameParams = { ownerUri: ownerUri, targetDatabase: targetDatabase, agentNotebookHistory: agentNotebookHistory, materializedNotebookName: name };
return client.sendRequest(contracts.UpdateAgentNotebookRunNameRequest
.type, params).then(
r => r,
e => {
client.logFailedRequest(contracts.UpdateAgentNotebookRunNameRequest.type, e);
return Promise.resolve(undefined);
}
);
};
const updateNotebookMaterializedPin = (ownerUri: string, agentNotebookHistory: azdata.AgentNotebookHistoryInfo, targetDatabase: string, pin: boolean): Thenable<azdata.ResultStatus> => {
let params: contracts.UpdateAgentNotebookRunPinParams = { ownerUri: ownerUri, targetDatabase: targetDatabase, agentNotebookHistory: agentNotebookHistory, materializedNotebookPin: pin };
return client.sendRequest(contracts.UpdateAgentNotebookRunPinRequest
.type, params).then(
r => r,
e => {
client.logFailedRequest(contracts.UpdateAgentNotebookRunPinRequest.type, e);
return Promise.resolve(undefined);
}
);
};
// Alert management methods
let getAlerts = (ownerUri: string): Thenable<azdata.AgentAlertsResult> => {
let params: contracts.AgentAlertsParams = {
@@ -535,6 +680,16 @@ export class AgentServicesFeature extends SqlOpsFeature<undefined> {
createJobStep,
updateJobStep,
deleteJobStep,
getNotebooks,
getNotebookHistory,
getMaterializedNotebook,
getTemplateNotebook,
createNotebook,
updateNotebook,
deleteMaterializedNotebook,
updateNotebookMaterializedName,
updateNotebookMaterializedPin,
deleteNotebook,
getAlerts,
createAlert,
updateAlert,