mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-20 17:22:51 -05:00
Agent: Edit Job improvements (#2721)
* fixed right click context menu bug in jobs view * added stepInfo and edit job WIP * show jobs in job edit * added schedule description on select schedule * fetch schedules during history and show in edit job * added alerts to job histories and show in edit * made history calls async * filter menus now close when esc is pressed * fixed bug where clicking on error row wouldnt populate job details
This commit is contained in:
@@ -62,6 +62,8 @@ export class JobDialog extends AgentDialog<JobData> {
|
||||
private readonly AlertsTopLabelString: string = localize('jobDialog.alertsList', 'Alerts list');
|
||||
private readonly NewAlertButtonString: string = localize('jobDialog.newAlert', 'New Alert');
|
||||
private readonly AlertNameLabelString: string = localize('jobDialog.alertNameLabel', 'Alert Name');
|
||||
private readonly AlertEnabledLabelString: string = localize('jobDialog.alertEnabledLabel', 'Enabled');
|
||||
private readonly AlertTypeLabelString: string = localize('jobDialog.alertTypeLabel', 'Type');
|
||||
|
||||
// UI Components
|
||||
private generalTab: sqlops.window.modelviewdialog.DialogTab;
|
||||
@@ -197,6 +199,8 @@ export class JobDialog extends AgentDialog<JobData> {
|
||||
.withProperties({
|
||||
value: 'Feature Preview'
|
||||
}).component();
|
||||
let steps = this.model.jobSteps ? this.model.jobSteps : [];
|
||||
let data = this.convertStepsToData(steps);
|
||||
this.stepsTable = view.modelBuilder.table()
|
||||
.withProperties({
|
||||
columns: [
|
||||
@@ -206,8 +210,8 @@ export class JobDialog extends AgentDialog<JobData> {
|
||||
this.StepsTable_SuccessColumnString,
|
||||
this.StepsTable_FailureColumnString
|
||||
],
|
||||
data: [],
|
||||
height: 430
|
||||
data: data,
|
||||
height: 750
|
||||
}).component();
|
||||
|
||||
this.moveStepUpButton = view.modelBuilder.button()
|
||||
@@ -250,6 +254,31 @@ export class JobDialog extends AgentDialog<JobData> {
|
||||
}).component();
|
||||
|
||||
this.stepsTable.enabled = false;
|
||||
this.editStepButton.enabled = false;
|
||||
this.deleteStepButton.enabled = false;
|
||||
|
||||
this.stepsTable.onRowSelected(() => {
|
||||
// only let edit or delete steps if there's
|
||||
// one step selection
|
||||
if (this.stepsTable.selectedRows.length === 1) {
|
||||
let rowNumber = this.stepsTable.selectedRows[0];
|
||||
let stepData = steps[rowNumber];
|
||||
this.deleteStepButton.enabled = true;
|
||||
this.editStepButton.enabled = true;
|
||||
this.editStepButton.onDidClick((e) => {
|
||||
// implement edit steps
|
||||
|
||||
// let stepDialog = new JobStepDialog(this.model.ownerUri, this.nameTextBox.value, '' , 1, this.model);
|
||||
// stepDialog.openNewStepDialog();
|
||||
});
|
||||
|
||||
this.deleteStepButton.onDidClick((e) => {
|
||||
// implement delete steps
|
||||
|
||||
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
let formModel = view.modelBuilder.formContainer()
|
||||
.withFormItems([{
|
||||
@@ -271,12 +300,16 @@ export class JobDialog extends AgentDialog<JobData> {
|
||||
.withProperties({
|
||||
value: 'Feature Preview'
|
||||
}).component();
|
||||
let alerts = this.model.alerts ? this.model.alerts : [];
|
||||
let data = this.convertAlertsToData(alerts);
|
||||
this.alertsTable = view.modelBuilder.table()
|
||||
.withProperties({
|
||||
columns: [
|
||||
this.AlertNameLabelString
|
||||
this.AlertNameLabelString,
|
||||
this.AlertEnabledLabelString,
|
||||
this.AlertTypeLabelString
|
||||
],
|
||||
data: [],
|
||||
data: data,
|
||||
height: 430,
|
||||
width: 400
|
||||
}).component();
|
||||
@@ -312,10 +345,12 @@ export class JobDialog extends AgentDialog<JobData> {
|
||||
this.schedulesTable = view.modelBuilder.table()
|
||||
.withProperties({
|
||||
columns: [
|
||||
this.ScheduleNameLabelString
|
||||
PickScheduleDialog.SchedulesIDText,
|
||||
PickScheduleDialog.ScheduleNameLabelText,
|
||||
PickScheduleDialog.ScheduleDescription
|
||||
],
|
||||
data: [],
|
||||
height: 430,
|
||||
height: 750,
|
||||
width: 420
|
||||
}).component();
|
||||
|
||||
@@ -350,13 +385,11 @@ export class JobDialog extends AgentDialog<JobData> {
|
||||
}
|
||||
|
||||
private populateScheduleTable() {
|
||||
if (this.model.jobSchedules) {
|
||||
let data: any[][] = [];
|
||||
for (let i = 0; i < this.model.jobSchedules.length; ++i) {
|
||||
let schedule = this.model.jobSchedules[i];
|
||||
data[i] = [ schedule.name ];
|
||||
}
|
||||
let schedules = this.model.jobSchedules ? this.model.jobSchedules : [];
|
||||
let data = this.convertSchedulesToData(schedules);
|
||||
if (data.length > 0) {
|
||||
this.schedulesTable.data = data;
|
||||
this.schedulesTable.height = 750;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -466,6 +499,45 @@ export class JobDialog extends AgentDialog<JobData> {
|
||||
});
|
||||
}
|
||||
|
||||
private convertStepsToData(jobSteps: sqlops.AgentJobStepInfo[]): any[][] {
|
||||
let result = [];
|
||||
jobSteps.forEach(jobStep => {
|
||||
let cols = [];
|
||||
cols.push(jobStep.id);
|
||||
cols.push(jobStep.stepName);
|
||||
cols.push(jobStep.subSystem);
|
||||
cols.push(jobStep.successAction);
|
||||
cols.push(jobStep.failureAction);
|
||||
result.push(cols);
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
||||
private convertSchedulesToData(jobSchedules: sqlops.AgentJobScheduleInfo[]): any[][] {
|
||||
let result = [];
|
||||
jobSchedules.forEach(schedule => {
|
||||
let cols = [];
|
||||
cols.push(schedule.id);
|
||||
cols.push(schedule.name);
|
||||
cols.push(schedule.description);
|
||||
result.push(cols);
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
||||
private convertAlertsToData(alerts: sqlops.AgentAlertInfo[]): any[][] {
|
||||
let result = [];
|
||||
alerts.forEach(alert => {
|
||||
let cols = [];
|
||||
console.log(alert);
|
||||
cols.push(alert.name);
|
||||
cols.push(alert.isEnabled);
|
||||
cols.push(alert.alertType.toString());
|
||||
result.push(cols);
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
||||
protected updateModel() {
|
||||
this.model.name = this.nameTextBox.value;
|
||||
this.model.owner = this.ownerTextBox.value;
|
||||
|
||||
@@ -18,8 +18,11 @@ export class PickScheduleDialog {
|
||||
private readonly DialogTitle: string = localize('pickSchedule.jobSchedules', 'Job Schedules');
|
||||
private readonly OkButtonText: string = localize('pickSchedule.ok', 'OK');
|
||||
private readonly CancelButtonText: string = localize('pickSchedule.cancel', 'Cancel');
|
||||
private readonly ScheduleNameLabelText: string = localize('pickSchedule.scheduleName', 'Schedule Name');
|
||||
private readonly SchedulesLabelText: string = localize('pickSchedule.schedules', 'Schedules');
|
||||
private readonly SchedulesLabelText: string = localize('pickSchedule.availableSchedules', 'Available Schedules:');
|
||||
public static readonly ScheduleNameLabelText: string = localize('pickSchedule.scheduleName', 'Name');
|
||||
public static readonly SchedulesIDText: string = localize('pickSchedule.scheduleID','ID');
|
||||
public static readonly ScheduleDescription: string = localize('pickSchedule.description','Description');
|
||||
|
||||
|
||||
// UI Components
|
||||
private dialog: sqlops.window.modelviewdialog.Dialog;
|
||||
@@ -50,11 +53,13 @@ export class PickScheduleDialog {
|
||||
this.schedulesTable = view.modelBuilder.table()
|
||||
.withProperties({
|
||||
columns: [
|
||||
this.ScheduleNameLabelText
|
||||
PickScheduleDialog.SchedulesIDText,
|
||||
PickScheduleDialog.ScheduleNameLabelText,
|
||||
PickScheduleDialog.ScheduleDescription
|
||||
],
|
||||
data: [],
|
||||
height: '80em',
|
||||
width: '40em'
|
||||
height: 750,
|
||||
width: 430
|
||||
}).component();
|
||||
|
||||
let formModel = view.modelBuilder.formContainer()
|
||||
@@ -69,7 +74,8 @@ export class PickScheduleDialog {
|
||||
let data: any[][] = [];
|
||||
for (let i = 0; i < this.model.schedules.length; ++i) {
|
||||
let schedule = this.model.schedules[i];
|
||||
data[i] = [ schedule.name ];
|
||||
console.log(schedule);
|
||||
data[i] = [ schedule.id, schedule.name, schedule.description ];
|
||||
}
|
||||
this.schedulesTable.data = data;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user