mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -05:00
schedules now get added in edit job (#2915)
This commit is contained in:
@@ -26,12 +26,6 @@
|
|||||||
"outputChannels": [
|
"outputChannels": [
|
||||||
"sqlagent"
|
"sqlagent"
|
||||||
],
|
],
|
||||||
"commands": [
|
|
||||||
{
|
|
||||||
"command": "agent.openNewStepDialog",
|
|
||||||
"title": "agent.openNewStepDialog"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"dashboard.tabs": [
|
"dashboard.tabs": [
|
||||||
{
|
{
|
||||||
"id": "data-management-agent",
|
"id": "data-management-agent",
|
||||||
|
|||||||
@@ -136,8 +136,13 @@ export class JobData implements IAgentDialogData {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public addJobSchedule(schedule: sqlops.AgentJobScheduleInfo) {
|
public addJobSchedule(schedule: sqlops.AgentJobScheduleInfo) {
|
||||||
let existingSchedule = this.jobSchedules.find(item => item.name === schedule.name);
|
if (this.jobSchedules) {
|
||||||
if (!existingSchedule) {
|
let existingSchedule = this.jobSchedules.find(item => item.name === schedule.name);
|
||||||
|
if (!existingSchedule) {
|
||||||
|
this.jobSchedules.push(schedule);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.jobSchedules = [];
|
||||||
this.jobSchedules.push(schedule);
|
this.jobSchedules.push(schedule);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,9 +13,11 @@ export class PickScheduleData implements IAgentDialogData {
|
|||||||
public ownerUri: string;
|
public ownerUri: string;
|
||||||
public schedules: sqlops.AgentJobScheduleInfo[];
|
public schedules: sqlops.AgentJobScheduleInfo[];
|
||||||
public selectedSchedule: sqlops.AgentJobScheduleInfo;
|
public selectedSchedule: sqlops.AgentJobScheduleInfo;
|
||||||
|
private jobName: string;
|
||||||
|
|
||||||
constructor(ownerUri:string) {
|
constructor(ownerUri:string, jobName: string) {
|
||||||
this.ownerUri = ownerUri;
|
this.ownerUri = ownerUri;
|
||||||
|
this.jobName = jobName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async initialize() {
|
public async initialize() {
|
||||||
@@ -27,5 +29,8 @@ export class PickScheduleData implements IAgentDialogData {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public async save() {
|
public async save() {
|
||||||
|
let agentService = await AgentUtils.getAgentService();
|
||||||
|
this.selectedSchedule.jobName = this.jobName;
|
||||||
|
let result = await agentService.createJobSchedule(this.ownerUri, this.selectedSchedule);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -108,12 +108,14 @@ export class JobDialog extends AgentDialog<JobData> {
|
|||||||
// Alert tab controls
|
// Alert tab controls
|
||||||
private alertsTable: sqlops.TableComponent;
|
private alertsTable: sqlops.TableComponent;
|
||||||
private newAlertButton: sqlops.ButtonComponent;
|
private newAlertButton: sqlops.ButtonComponent;
|
||||||
|
private isEdit: boolean = false;
|
||||||
|
|
||||||
constructor(ownerUri: string, jobInfo: sqlops.AgentJobInfo = undefined) {
|
constructor(ownerUri: string, jobInfo: sqlops.AgentJobInfo = undefined) {
|
||||||
super(
|
super(
|
||||||
ownerUri,
|
ownerUri,
|
||||||
new JobData(ownerUri, jobInfo),
|
new JobData(ownerUri, jobInfo),
|
||||||
jobInfo ? JobDialog.EditDialogTitle : JobDialog.CreateDialogTitle);
|
jobInfo ? JobDialog.EditDialogTitle : JobDialog.CreateDialogTitle);
|
||||||
|
this.isEdit = jobInfo ? true : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected async initializeDialog() {
|
protected async initializeDialog() {
|
||||||
@@ -373,12 +375,12 @@ export class JobDialog extends AgentDialog<JobData> {
|
|||||||
label: this.PickScheduleButtonString,
|
label: this.PickScheduleButtonString,
|
||||||
width: 80
|
width: 80
|
||||||
}).component();
|
}).component();
|
||||||
|
|
||||||
this.pickScheduleButton.onDidClick((e)=>{
|
this.pickScheduleButton.onDidClick((e)=>{
|
||||||
let pickScheduleDialog = new PickScheduleDialog(this.model.ownerUri);
|
let pickScheduleDialog = new PickScheduleDialog(this.model.ownerUri, this.model.name);
|
||||||
pickScheduleDialog.onSuccess((dialogModel) => {
|
pickScheduleDialog.onSuccess((dialogModel) => {
|
||||||
let selectedSchedule = dialogModel.selectedSchedule;
|
let selectedSchedule = dialogModel.selectedSchedule;
|
||||||
if (selectedSchedule) {
|
if (selectedSchedule) {
|
||||||
|
selectedSchedule.jobName = this.model.name;
|
||||||
this.model.addJobSchedule(selectedSchedule);
|
this.model.addJobSchedule(selectedSchedule);
|
||||||
this.populateScheduleTable();
|
this.populateScheduleTable();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,8 +33,8 @@ export class PickScheduleDialog {
|
|||||||
private _onSuccess: vscode.EventEmitter<PickScheduleData> = new vscode.EventEmitter<PickScheduleData>();
|
private _onSuccess: vscode.EventEmitter<PickScheduleData> = new vscode.EventEmitter<PickScheduleData>();
|
||||||
public readonly onSuccess: vscode.Event<PickScheduleData> = this._onSuccess.event;
|
public readonly onSuccess: vscode.Event<PickScheduleData> = this._onSuccess.event;
|
||||||
|
|
||||||
constructor(ownerUri: string) {
|
constructor(ownerUri: string, jobName: string) {
|
||||||
this.model = new PickScheduleData(ownerUri);
|
this.model = new PickScheduleData(ownerUri, jobName);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async showDialog() {
|
public async showDialog() {
|
||||||
|
|||||||
@@ -41,12 +41,12 @@ export class MainController {
|
|||||||
let dialog = new JobDialog(ownerUri, jobInfo);
|
let dialog = new JobDialog(ownerUri, jobInfo);
|
||||||
dialog.openDialog();
|
dialog.openDialog();
|
||||||
});
|
});
|
||||||
vscode.commands.registerCommand('agent.openNewStepDialog', (ownerUri: string, server: string, jobData: JobData) => {
|
vscode.commands.registerCommand('agent.openNewStepDialog', (ownerUri: string, server: string, jobData: JobData, jobStepInfo: sqlops.AgentJobStepInfo) => {
|
||||||
let dialog = new JobStepDialog(ownerUri, server, jobData);
|
let dialog = new JobStepDialog(ownerUri, server, jobData, jobStepInfo);
|
||||||
dialog.openDialog();
|
dialog.openDialog();
|
||||||
});
|
});
|
||||||
vscode.commands.registerCommand('agent.openPickScheduleDialog', (ownerUri: string) => {
|
vscode.commands.registerCommand('agent.openPickScheduleDialog', (ownerUri: string, jobName: string) => {
|
||||||
let dialog = new PickScheduleDialog(ownerUri);
|
let dialog = new PickScheduleDialog(ownerUri, jobName);
|
||||||
dialog.showDialog();
|
dialog.showDialog();
|
||||||
});
|
});
|
||||||
vscode.commands.registerCommand('agent.openAlertDialog', (ownerUri: string, alertInfo: sqlops.AgentAlertInfo, jobs: string[]) => {
|
vscode.commands.registerCommand('agent.openAlertDialog', (ownerUri: string, alertInfo: sqlops.AgentAlertInfo, jobs: string[]) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user