This commit is contained in:
Gaurav Kumar
2025-11-06 18:44:11 +05:30
parent d8ad061ad7
commit 5a89e7bc96
2 changed files with 32 additions and 1 deletions

View File

@@ -1156,6 +1156,9 @@
<button class="btn btn-danger" (click)="stopJob()" *ngIf="schedulerJob.status !== 'STOPPED'">
<clr-icon shape="stop"></clr-icon> Stop Job
</button>
<button class="btn btn-primary" (click)="restartJob()" *ngIf="schedulerJob.status === 'STOPPED'">
<clr-icon shape="play"></clr-icon> Restart Job
</button>
</div>
</div>

View File

@@ -1603,7 +1603,7 @@ export class Data_lakeComponent implements OnInit {
name: this.selectedSchedulerItem.name,
status: 'RUNNING',
description: `Scheduled job for ${this.selectedSchedulerItem.name}`,
jobType: 'SYNC',
jobType: 'DATALAKE',
lakeid: this.selectedSchedulerItem.id
};
@@ -1676,6 +1676,34 @@ export class Data_lakeComponent implements OnInit {
);
}
// Method to restart a stopped job
restartJob() {
if (!this.schedulerJob || !this.schedulerJob.id) {
this.toastr.error('No job selected');
return;
}
// To restart a job, we need to create a new job with the same parameters
const jobData = {
name: this.schedulerJob.name,
status: 'RUNNING',
description: this.schedulerJob.description,
jobType: this.schedulerJob.jobType,
lakeid: this.schedulerJob.lakeid
};
this.schedulerService.createJob(jobData).subscribe(
(job: any) => {
this.schedulerJob = job;
this.toastr.success('Job restarted successfully');
},
(error) => {
console.error('Error restarting job:', error);
this.toastr.error('Failed to restart job');
}
);
}
// Method to close scheduler modal
closeSchedulerModal() {
this.showSchedulerModal = false;