mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-17 02:51:36 -05:00
Fixes bug when opening the scheduler dialog (#6624)
Checks if the loading component is loaded before using it
This commit is contained in:
@@ -14,6 +14,7 @@ export class PickScheduleData implements IAgentDialogData {
|
|||||||
public schedules: azdata.AgentJobScheduleInfo[];
|
public schedules: azdata.AgentJobScheduleInfo[];
|
||||||
public selectedSchedule: azdata.AgentJobScheduleInfo;
|
public selectedSchedule: azdata.AgentJobScheduleInfo;
|
||||||
private jobName: string;
|
private jobName: string;
|
||||||
|
private initialized: boolean;
|
||||||
|
|
||||||
constructor(ownerUri: string, jobName: string) {
|
constructor(ownerUri: string, jobName: string) {
|
||||||
this.ownerUri = ownerUri;
|
this.ownerUri = ownerUri;
|
||||||
@@ -24,6 +25,7 @@ export class PickScheduleData implements IAgentDialogData {
|
|||||||
let agentService = await AgentUtils.getAgentService();
|
let agentService = await AgentUtils.getAgentService();
|
||||||
try {
|
try {
|
||||||
let result = await agentService.getJobSchedules(this.ownerUri);
|
let result = await agentService.getJobSchedules(this.ownerUri);
|
||||||
|
this.initialized = true;
|
||||||
if (result && result.success) {
|
if (result && result.success) {
|
||||||
this.schedules = result.schedules;
|
this.schedules = result.schedules;
|
||||||
return this.schedules;
|
return this.schedules;
|
||||||
@@ -36,4 +38,8 @@ export class PickScheduleData implements IAgentDialogData {
|
|||||||
public async save() {
|
public async save() {
|
||||||
this.selectedSchedule.jobName = this.jobName;
|
this.selectedSchedule.jobName = this.jobName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public isInitialized() {
|
||||||
|
return this.initialized;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,7 +40,9 @@ export class PickScheduleDialog {
|
|||||||
|
|
||||||
public async showDialog() {
|
public async showDialog() {
|
||||||
this.model.initialize().then((result) => {
|
this.model.initialize().then((result) => {
|
||||||
|
if (this.loadingComponent) {
|
||||||
this.loadingComponent.loading = false;
|
this.loadingComponent.loading = false;
|
||||||
|
}
|
||||||
if (this.model.schedules) {
|
if (this.model.schedules) {
|
||||||
let data: any[][] = [];
|
let data: any[][] = [];
|
||||||
for (let i = 0; i < this.model.schedules.length; ++i) {
|
for (let i = 0; i < this.model.schedules.length; ++i) {
|
||||||
@@ -80,7 +82,7 @@ export class PickScheduleDialog {
|
|||||||
}]).withLayout({ width: '100%' }).component();
|
}]).withLayout({ width: '100%' }).component();
|
||||||
|
|
||||||
this.loadingComponent = view.modelBuilder.loadingComponent().withItem(formModel).component();
|
this.loadingComponent = view.modelBuilder.loadingComponent().withItem(formModel).component();
|
||||||
this.loadingComponent.loading = true;
|
this.loadingComponent.loading = !this.model.isInitialized();
|
||||||
await view.initializeModel(this.loadingComponent);
|
await view.initializeModel(this.loadingComponent);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user