mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-17 02:51:36 -05:00
Agent: Added loading component to schedule list (#5992)
* added loading component to schedule list * changed thenable to await * throw error
This commit is contained in:
@@ -20,11 +20,16 @@ export class PickScheduleData implements IAgentDialogData {
|
|||||||
this.jobName = jobName;
|
this.jobName = jobName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async initialize() {
|
public async initialize(): Promise<azdata.AgentJobScheduleInfo[]> {
|
||||||
let agentService = await AgentUtils.getAgentService();
|
let agentService = await AgentUtils.getAgentService();
|
||||||
|
try {
|
||||||
let result = await agentService.getJobSchedules(this.ownerUri);
|
let result = await agentService.getJobSchedules(this.ownerUri);
|
||||||
if (result && result.success) {
|
if (result && result.success) {
|
||||||
this.schedules = result.schedules;
|
this.schedules = result.schedules;
|
||||||
|
return this.schedules;
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
throw error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ export class PickScheduleDialog {
|
|||||||
// UI Components
|
// UI Components
|
||||||
private dialog: azdata.window.Dialog;
|
private dialog: azdata.window.Dialog;
|
||||||
private schedulesTable: azdata.TableComponent;
|
private schedulesTable: azdata.TableComponent;
|
||||||
|
private loadingComponent: azdata.LoadingComponent;
|
||||||
|
|
||||||
private model: PickScheduleData;
|
private model: PickScheduleData;
|
||||||
|
|
||||||
@@ -38,7 +39,17 @@ export class PickScheduleDialog {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public async showDialog() {
|
public async showDialog() {
|
||||||
await this.model.initialize();
|
this.model.initialize().then((result) => {
|
||||||
|
this.loadingComponent.loading = false;
|
||||||
|
if (this.model.schedules) {
|
||||||
|
let data: any[][] = [];
|
||||||
|
for (let i = 0; i < this.model.schedules.length; ++i) {
|
||||||
|
let schedule = this.model.schedules[i];
|
||||||
|
data[i] = [schedule.id, schedule.name, schedule.description];
|
||||||
|
}
|
||||||
|
this.schedulesTable.data = data;
|
||||||
|
}
|
||||||
|
});
|
||||||
this.dialog = azdata.window.createModelViewDialog(this.DialogTitle);
|
this.dialog = azdata.window.createModelViewDialog(this.DialogTitle);
|
||||||
this.initializeContent();
|
this.initializeContent();
|
||||||
this.dialog.okButton.onClick(async () => await this.execute());
|
this.dialog.okButton.onClick(async () => await this.execute());
|
||||||
@@ -68,16 +79,9 @@ export class PickScheduleDialog {
|
|||||||
title: this.SchedulesLabelText
|
title: this.SchedulesLabelText
|
||||||
}]).withLayout({ width: '100%' }).component();
|
}]).withLayout({ width: '100%' }).component();
|
||||||
|
|
||||||
await view.initializeModel(formModel);
|
this.loadingComponent = view.modelBuilder.loadingComponent().withItem(formModel).component();
|
||||||
|
this.loadingComponent.loading = true;
|
||||||
if (this.model.schedules) {
|
await view.initializeModel(this.loadingComponent);
|
||||||
let data: any[][] = [];
|
|
||||||
for (let i = 0; i < this.model.schedules.length; ++i) {
|
|
||||||
let schedule = this.model.schedules[i];
|
|
||||||
data[i] = [schedule.id, schedule.name, schedule.description];
|
|
||||||
}
|
|
||||||
this.schedulesTable.data = data;
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user