Skip to content

Commit

Permalink
Merge branch 'mitre:master' into rerun_date
Browse files Browse the repository at this point in the history
  • Loading branch information
timbrigham-oc authored Jun 7, 2024
2 parents e6be581 + 478744c commit 9960ab2
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
9 changes: 9 additions & 0 deletions src/stores/operationStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,15 @@ export const useOperationStore = defineStore("operationStore", {
console.error("Error fetching operations", error);
}
},
async getOperation($api, operationID) {
try {
const response = await $api.get(`/api/v2/operations/${operationID}`);
let operation = response.data;
this.operations[operation.id] = operation;
} catch (error) {
console.error("Error fetching operations", error);
}
},
async createOperation($api, operation) {
try {
const response = await $api.post("/api/v2/operations", operation);
Expand Down
7 changes: 4 additions & 3 deletions src/views/OperationsView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -190,13 +190,14 @@ const resetFilter = () => {
};
function selectOperation() {
//TODO: Stop updating if operation is finished
if (updateInterval) clearInterval(updateInterval);
if (operationStore.selectedOperationID === "") return;
resetFilter();
updateInterval = setInterval(async () => {
if (operationStore.selectedOperationID !== "") {
await operationStore.getOperations($api);
if (operationStore.selectedOperationID !== "" &&
operationStore.operations[operationStore.selectedOperationID].state !== "finished")
{
await operationStore.getOperation($api, operationStore.selectedOperationID);
} else {
clearInterval(updateInterval);
}
Expand Down

0 comments on commit 9960ab2

Please sign in to comment.