Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed download batch and added snackbar close #684

Merged
merged 1 commit into from
Nov 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 1 addition & 22 deletions frontend/src/components/Batch/BatchRuns.vue
Original file line number Diff line number Diff line change
Expand Up @@ -331,9 +331,7 @@ export default {
],
};
},
created() {
this.getAdminDashboardData();
},
created() {},
computed: {
...mapState(useBatchProcessingStore, {
batchRuns: "getBatchRuns",
Expand All @@ -342,10 +340,6 @@ export default {
},
methods: {
...mapActions(useBatchProcessingStore, ["setBatchJobs"]),
getRowClass(item) {
// Conditionally apply a class based on the item's status
return item.jobExecutionId === "104848" ? "highlight-row" : "";
},
rerunBatch(bid) {
BatchProcessingService.rerunBatch(bid).then((response) => {
if (response) {
Expand Down Expand Up @@ -400,14 +394,8 @@ export default {
},
rerunBatchSchoolReports(bid) {
this.$refs["popover-" + bid].$emit("close");
BatchProcessingService.rerunBatchSchoolReports(bid).then((response) => {
if (response) {
// this.$bvToast.toast("Running school reports for batch job #" + bid, {
// title: "SCHOOL REPORTS BATCH",
// variant: "success",
// noAutoHide: true,
// });
this.snackbarStore.showSnackbar(
"Running school reports for batch job #" + bid,
"success",
Expand All @@ -419,17 +407,8 @@ export default {
});
},
rerunBatch(bid) {
this.$refs["popover-" + bid].$emit("close");
BatchProcessingService.rerunBatch(bid).then((response) => {
if (response) {
// this.$bvToast.toast(
// "Created a new batch job based on batch #" + bid,
// {
// title: "NEW BATCH JOB STARTED",
// variant: "success",
// noAutoHide: true,
// }
// );
this.snackbarStore.showSnackbar(
"Created a new batch job based on batch #" + bid,
"success",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -383,15 +383,15 @@ export default {
if (this.getBatchRequestCrontime) {
this.snackbarStore.showSnackbar(
"Archive School Reports Process has been successfully scheduled",
5000
10000
);
} else {
this.snackbarStore.showSnackbar(
"Batch " +
response.data.batchId +
"- Archive School Reports Process submitted",
"success",
5000
10000
);
}
this.batchLoading = false;
Expand All @@ -405,7 +405,7 @@ export default {
this.snackbarStore.showSnackbar(
"An error occurred: " + error.message,
"danger",
5000
10000
);
}
},
Expand Down
6 changes: 3 additions & 3 deletions frontend/src/components/Batch/Forms/ArchiveStudentsForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -413,15 +413,15 @@ export default {
if (this.getBatchRequestCrontime) {
this.snackbarStore.showSnackbar(
"Archive student batch process has been successfully scheduled",
5000
10000
);
} else {
this.snackbarStore.showSnackbar(
"Batch " +
response.data.batchId +
"- Archive student batch process submitted",
"success",
5000
10000
);
}
this.closeDialogAndResetForm();
Expand All @@ -435,7 +435,7 @@ export default {
this.snackbarStore.showSnackbar(
"An error occurred: " + error.message,
"danger",
5000
10000
);
}
},
Expand Down
14 changes: 7 additions & 7 deletions frontend/src/components/Batch/Forms/DistrunForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -279,12 +279,12 @@ export default {
if (error.response.statusText) {
this.snackbarStore.showSnackbar(
"ERROR " + error.response.statusText,
5000
10000
);
} else {
this.snackbarStore.showSnackbar(
"ERROR " + "error with webservervice",
5000
10000
);
}
});
Expand All @@ -299,12 +299,12 @@ export default {
if (error.response.statusText) {
this.snackbarStore.showSnackbar(
"ERROR " + error.response.statusText,
5000
10000
);
} else {
this.snackbarStore.showSnackbar(
"ERROR " + "error with webservervice",
5000
10000
);
}
});
Expand Down Expand Up @@ -353,15 +353,15 @@ export default {
if (this.getBatchRequestCrontime) {
this.snackbarStore.showSnackbar(
"Credentials and Transcript Distribution Run request has been successfully scheduled",
5000
10000
);
} else {
this.snackbarStore.showSnackbar(
"Batch " +
response.data.batchId +
"- Credentials and Transcript Distribution Run request submitted",
"success",
5000
10000
);
}
}
Expand All @@ -377,7 +377,7 @@ export default {
this.snackbarStore.showSnackbar(
"An error occurred: " + error.message,
"error",
5000
10000
);
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -287,15 +287,15 @@ export default {
if (this.getBatchRequestCrontime) {
this.snackbarStore.showSnackbar(
"Year-End Credentials and Transcript Distribution Run has been successfully scheduled",
5000
10000
);
} else {
this.snackbarStore.showSnackbar(
"Batch " +
response.data.batchId +
"- Year-End Credentials and Transcript Distribution Run submitted",
"success",
5000
10000
);
}
this.closeDialogAndResetForm();
Expand All @@ -308,7 +308,7 @@ export default {
this.snackbarStore.showSnackbar(
"An error occurred: " + error.message,
"danger",
5000
10000
);
}
},
Expand Down
78 changes: 52 additions & 26 deletions frontend/src/components/Batch/Forms/DistrunUserForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
color="error"
variant="outlined"
class="m-4"
:loading="batchLoading"
>Cancel</v-btn
>
</div>
Expand Down Expand Up @@ -539,7 +540,7 @@ export default {
if (error.response.statusText) {
console.log("ERROR " + error.response.statusText, "danger");
} else {
console.log("ERROR " + "error with webservervice", "danger");
console.log("ERROR " + "error with webservice", "danger");
}
});
},
Expand All @@ -553,12 +554,14 @@ export default {
if (error.response.statusText) {
this.snackbarStore.showSnackbar(
"ERROR " + error.response.statusText,
5000
"danger",
10000
);
} else {
this.snackbarStore.showSnackbar(
"ERROR " + "error with webservervice",
5000
"ERROR " + "error with web service",
"danger",
10000
);
}
});
Expand Down Expand Up @@ -605,41 +608,64 @@ export default {
) {
requestPayload.schoolOfRecords = ["00000000"];
}
let response = await BatchProcessingService.runDISTRUNUSER(
BatchProcessingService.runDISTRUNUSER(
requestPayload,
this.getCredential,
this.getBatchRequestCrontime
);
if (response) {
this.batchLoading = false;
if (this.getBatchRequestCrontime) {
this.snackbarStore.showSnackbar(
"User distribution batch request has been successfully scheduled",
5000
);
} else {
)
.then((response) => {
if (response && this.batchLoading) {
this.batchLoading = false;
if (this.getBatchRequestCrontime) {
this.snackbarStore.showSnackbar(
"User distribution batch request has been successfully scheduled",
10000
);
} else {
this.snackbarStore.showSnackbar(
"Batch " +
response.data.batchId +
"- User distribution batch request submitted",
"success",
10000
);
}
this.setActiveTab("batchRuns");
this.closeDialogAndResetForm();
//add a wait before updating dashboard
setTimeout(() => {
this.updateDashboards();
}, 2000);
}
})
.catch((error) => {
// handle any errors here
});
setTimeout(() => {
//Close the request after 5 seconds.
if (this.batchLoading) {
this.batchLoading = false;
this.snackbarStore.showSnackbar(
"Batch " +
response.data.batchId +
"- User distribution batch request submitted",
"The user distribution batch request is currently running in the background. Click the Update button on the Batch Processing page to view the results once the job is complete.",
"success",
5000
10000
);
this.setActiveTab("batchRuns");
this.closeDialogAndResetForm();
//add a wait before updating dashboard
setTimeout(() => {
this.updateDashboards();
}, 2000);
}
}
this.setActiveTab("batchRuns");
this.closeDialogAndResetForm();
//add a wait before updating dashboard
setTimeout(() => {
this.updateDashboards();
}, 2000);
}, 10000);
} catch (error) {
// handle the error and show the notification
console.error("Error:", error);
this.snackbarStore.showSnackbar(
"An error occurred: " + error.message,
"error",
5000
10000
);
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -362,15 +362,15 @@ export default {
if (this.getBatchRequestCrontime) {
this.snackbarStore.showSnackbar(
"Graduation Algorithm request has been successfully scheduled",
5000
10000
);
} else {
this.snackbarStore.showSnackbar(
"Batch " +
response.data.batchId +
"- Graduation Algorithm request submitted",
"success",
5000
10000
);
}
Expand All @@ -385,7 +385,7 @@ export default {
this.snackbarStore.showSnackbar(
"An error occurred: " + error.message,
"danger",
5000
10000
);
this.batchLoading = false;
console.error("Error:", error);
Expand Down
6 changes: 3 additions & 3 deletions frontend/src/components/Batch/Forms/NongradDistrunForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -288,15 +288,15 @@ export default {
if (this.getBatchRequestCrontime) {
this.snackbarStore.showSnackbar(
"Non-Graduate Transcript Distribution Run has been successfully scheduled",
5000
10000
);
} else {
this.snackbarStore.showSnackbar(
"Batch " +
response.data.batchId +
"- Non-Graduate Transcript Distribution Run submitted",
"success",
5000
10000
);
}
this.closeDialogAndResetForm();
Expand All @@ -309,7 +309,7 @@ export default {
this.snackbarStore.showSnackbar(
"An error occurred: " + error.message,
"danger",
5000
10000
);
}
},
Expand Down
6 changes: 3 additions & 3 deletions frontend/src/components/Batch/Forms/PSIForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -299,15 +299,15 @@ export default {
if (this.getBatchRequestCrontime) {
this.snackbarStore.showSnackbar(
"PSI Run FTP / Paper has been successfully scheduled",
5000
10000
);
} else {
this.snackbarStore.showSnackbar(
"Batch " +
response.data.batchId +
"- PSI Run FTP / Paper submitted",
"success",
5000
10000
);
}
this.closeDialogAndResetForm();
Expand All @@ -320,7 +320,7 @@ export default {
this.snackbarStore.showSnackbar(
"An error occurred: " + error.message,
"danger",
5000
10000
);
}
},
Expand Down
Loading