mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 18:46:40 -05:00
Jobs/new step (#1734)
* added jobs view toolbar * create job command and dialog stub * add tab content and wire up the provider * fix the steps tab error * create job dialog 6/15 changes * general tab done * success action and retries completed * added failure action dropdown * add notification tab checkbox events * added AgentJobStepInfo objects in sqlops * create job dialog - 0618 update 1 * added model save function * width for controls and initial state for notification tab controls * refresh master and changes to work with latest code * fixed next and prev button positions * new step dialog ui finished * implemented parse button * fix package file * add validation and sub-items collections * hook up the step creation dialog - step 1 * merged master * fixed step issue, step can me made now
This commit is contained in:
@@ -6,7 +6,6 @@ export class AgentUtils {
|
||||
|
||||
private static _agentService: sqlops.AgentServicesProvider;
|
||||
private static _connectionService: sqlops.ConnectionProvider;
|
||||
private static _fileBrowserService: sqlops.FileBrowserProvider;
|
||||
private static _queryProvider: sqlops.QueryProvider;
|
||||
|
||||
public static async getAgentService(): Promise<sqlops.AgentServicesProvider> {
|
||||
@@ -29,15 +28,7 @@ export class AgentUtils {
|
||||
});
|
||||
}
|
||||
|
||||
public static async getFileBrowserService(ownerUri: string): Promise<sqlops.FileBrowserProvider> {
|
||||
if (!AgentUtils._fileBrowserService) {
|
||||
let currentConnection = await sqlops.connection.getCurrentConnection();
|
||||
this._fileBrowserService = sqlops.dataprotocol.getProvider<sqlops.FileBrowserProvider>(currentConnection.providerName, sqlops.DataProviderType.FileBrowserProvider);
|
||||
}
|
||||
return this._fileBrowserService;
|
||||
}
|
||||
|
||||
public static async getQueryProvider(ownerUri: string): Promise<sqlops.QueryProvider> {
|
||||
public static async getQueryProvider(): Promise<sqlops.QueryProvider> {
|
||||
if (!AgentUtils._queryProvider) {
|
||||
let currentConnection = await sqlops.connection.getCurrentConnection();
|
||||
this._queryProvider = sqlops.dataprotocol.getProvider<sqlops.QueryProvider>(currentConnection.providerName, sqlops.DataProviderType.QueryProvider);
|
||||
|
||||
@@ -46,7 +46,7 @@ export class CreateStepData {
|
||||
scriptName: this.scriptName,
|
||||
stepName: this.stepName,
|
||||
subSystem: this.subSystem,
|
||||
id: this.id,
|
||||
id: 1,
|
||||
failureAction: this.failureAction,
|
||||
successAction: this.successAction,
|
||||
failStepId: this.failStepId,
|
||||
|
||||
@@ -188,7 +188,7 @@ export class CreateJobDialog {
|
||||
}).component();
|
||||
|
||||
this.newStepButton.onDidClick((e)=>{
|
||||
let stepDialog =new CreateStepDialog(this.model.ownerUri, '', '', this.model);
|
||||
let stepDialog = new CreateStepDialog(this.model.ownerUri, '', '', 1, this.model);
|
||||
stepDialog.openNewStepDialog();
|
||||
});
|
||||
|
||||
|
||||
@@ -59,20 +59,23 @@ export class CreateStepDialog {
|
||||
|
||||
private model: CreateStepData;
|
||||
private ownerUri: string;
|
||||
private jobId: string;
|
||||
private jobName: string;
|
||||
private server: string;
|
||||
private stepId: number;
|
||||
|
||||
private jobModel: CreateJobData;
|
||||
|
||||
constructor(
|
||||
ownerUri: string,
|
||||
jobId: string,
|
||||
jobName: string,
|
||||
server: string,
|
||||
stepId: number,
|
||||
jobModel?: CreateJobData
|
||||
) {
|
||||
this.model = new CreateStepData(ownerUri);
|
||||
this.stepId = stepId;
|
||||
this.ownerUri = ownerUri;
|
||||
this.jobId = jobId;
|
||||
this.jobName = jobName;
|
||||
this.server = server;
|
||||
this.jobModel = jobModel;
|
||||
}
|
||||
@@ -82,8 +85,8 @@ export class CreateStepDialog {
|
||||
this.generalTab = sqlops.window.modelviewdialog.createTab(CreateStepDialog.GeneralTabText);
|
||||
this.advancedTab = sqlops.window.modelviewdialog.createTab(CreateStepDialog.AdvancedTabText);
|
||||
this.dialog.content = [this.generalTab, this.advancedTab];
|
||||
this.dialog.okButton.onClick(async () => await this.execute());
|
||||
this.dialog.okButton.label = CreateStepDialog.OkButtonText;
|
||||
this.dialog.okButton.onClick(() => this.execute());
|
||||
this.dialog.cancelButton.label = CreateStepDialog.CancelButtonText;
|
||||
}
|
||||
|
||||
@@ -136,6 +139,7 @@ export class CreateStepDialog {
|
||||
this.nameTextBox = view.modelBuilder.inputBox()
|
||||
.withProperties({
|
||||
}).component();
|
||||
this.nameTextBox.required = true;
|
||||
this.typeDropdown = view.modelBuilder.dropDown()
|
||||
.withProperties({
|
||||
value: CreateStepDialog.TSQLScript,
|
||||
@@ -226,7 +230,7 @@ export class CreateStepDialog {
|
||||
return runAsUserForm;
|
||||
}
|
||||
|
||||
private createAdvancedTab(fileBrowserService: sqlops.FileBrowserProvider) {
|
||||
private createAdvancedTab() {
|
||||
this.advancedTab.registerContent(async (view) => {
|
||||
this.successActionDropdown = view.modelBuilder.dropDown()
|
||||
.withProperties({
|
||||
@@ -241,7 +245,7 @@ export class CreateStepDialog {
|
||||
values: [CreateStepDialog.QuitJobReportingFailure, CreateStepDialog.NextStep, CreateStepDialog.QuitJobReportingSuccess]
|
||||
})
|
||||
.component();
|
||||
let optionsGroup = this.createTSQLOptions(view, fileBrowserService);
|
||||
let optionsGroup = this.createTSQLOptions(view);
|
||||
let viewButton = view.modelBuilder.button()
|
||||
.withProperties({ label: 'View', width: '50px' }).component();
|
||||
viewButton.enabled = false;
|
||||
@@ -340,21 +344,9 @@ export class CreateStepDialog {
|
||||
return retryFlexContainer;
|
||||
}
|
||||
|
||||
private createTSQLOptions(view, fileBrowserService: sqlops.FileBrowserProvider) {
|
||||
private createTSQLOptions(view) {
|
||||
this.outputFileBrowserButton = view.modelBuilder.button()
|
||||
.withProperties({ width: '20px', label: '...' }).component();
|
||||
this.outputFileBrowserButton.onDidClick(() => {
|
||||
fileBrowserService.openFileBrowser(this.ownerUri,
|
||||
'C:\\Program Files\\Microsoft SQL Server\\MSSQL14.MSSQLSERVER\\MSSQL\\Backup',
|
||||
['*'], false).then(result => {
|
||||
if (result) {
|
||||
console.log(result);
|
||||
Promise.resolve(result);
|
||||
} else {
|
||||
Promise.reject(false);
|
||||
}
|
||||
});
|
||||
});
|
||||
this.outputFileNameBox = view.modelBuilder.inputBox()
|
||||
.withProperties({
|
||||
width: '100px',
|
||||
@@ -403,7 +395,8 @@ export class CreateStepDialog {
|
||||
}
|
||||
|
||||
private async execute() {
|
||||
this.model.jobId = this.jobId;
|
||||
this.model.jobName = this.jobName;
|
||||
this.model.id = this.stepId;
|
||||
this.model.server = this.server;
|
||||
this.model.stepName = this.nameTextBox.value;
|
||||
this.model.subSystem = this.typeDropdown.value as string;
|
||||
@@ -417,28 +410,12 @@ export class CreateStepDialog {
|
||||
await this.model.save();
|
||||
}
|
||||
|
||||
private openFileBrowserDialog(rootNode, selectedNode) {
|
||||
}
|
||||
|
||||
private onFileBrowserOpened(handle: number, fileBrowserOpenedParams: sqlops.FileBrowserOpenedParams) {
|
||||
if (fileBrowserOpenedParams.succeeded === true
|
||||
&& fileBrowserOpenedParams.fileTree
|
||||
&& fileBrowserOpenedParams.fileTree.rootNode
|
||||
&& fileBrowserOpenedParams.fileTree.selectedNode) {
|
||||
this.openFileBrowserDialog(fileBrowserOpenedParams.fileTree.rootNode, fileBrowserOpenedParams.fileTree.selectedNode);
|
||||
}
|
||||
}
|
||||
|
||||
public async openNewStepDialog() {
|
||||
let databases = await AgentUtils.getDatabases(this.ownerUri);
|
||||
let fileBrowserService = await AgentUtils.getFileBrowserService(this.ownerUri);
|
||||
let queryProvider = await AgentUtils.getQueryProvider(this.ownerUri);
|
||||
fileBrowserService.registerOnFileBrowserOpened((response: sqlops.FileBrowserOpenedParams) => {
|
||||
this.onFileBrowserOpened(fileBrowserService.handle, response);
|
||||
});
|
||||
let queryProvider = await AgentUtils.getQueryProvider();
|
||||
this.initializeUIComponents();
|
||||
this.createGeneralTab(databases, queryProvider);
|
||||
this.createAdvancedTab(fileBrowserService);
|
||||
this.createAdvancedTab();
|
||||
sqlops.window.modelviewdialog.openDialog(this.dialog);
|
||||
}
|
||||
}
|
||||
@@ -38,8 +38,8 @@ export class MainController {
|
||||
let dialog = new CreateJobDialog(ownerUri);
|
||||
dialog.showDialog();
|
||||
});
|
||||
vscode.commands.registerCommand('agent.openNewStepDialog', (ownerUri: string, jobId: string, server: string) => {
|
||||
let dialog = new CreateStepDialog(ownerUri, jobId, server);
|
||||
vscode.commands.registerCommand('agent.openNewStepDialog', (ownerUri: string, jobId: string, server: string, stepId: number) => {
|
||||
let dialog = new CreateStepDialog(ownerUri, jobId, server, stepId);
|
||||
dialog.openNewStepDialog();
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user