Skip to content

Commit

Permalink
Remove task over api
Browse files Browse the repository at this point in the history
  • Loading branch information
EinEinfach committed Feb 7, 2025
1 parent 5e0ec74 commit 0abf945
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
2 changes: 1 addition & 1 deletion CaSSAndRA/app.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python3

#Version:0.203.1 Bug fix in resume action if a task is pre-loaded
#Version:0.204.0 Remove task over api
# package imports
import os
import sys
Expand Down
13 changes: 12 additions & 1 deletion CaSSAndRA/src/backend/comm/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ def check_cmd(self, buffer: dict) -> None:
logger.info('No valid object in api message found. Aborting')

def check_tasks_cmd(self, buffer: dict) -> None:
allowed_cmds = ['select', 'load', 'save', 'calculate']
allowed_cmds = ['select', 'load', 'save', 'calculate', 'remove']
if 'command' in buffer:
command = [buffer['command']]
command = list(set(command).intersection(allowed_cmds))
Expand All @@ -230,6 +230,9 @@ def check_tasks_cmd(self, buffer: dict) -> None:
elif command[0] == 'save':
self.command = command[0]
self.perform_tasks_save_cmd(buffer)
elif command[0] == 'remove':
self.command = command[0]
self.perform_tasks_remove_cmd(buffer)
else:
self.command = command[0]
self.perform_tasks_load_cmd(buffer)
Expand Down Expand Up @@ -424,6 +427,14 @@ def perform_tasks_save_cmd(self, buffer: dict) -> None:
except Exception as e:
logger.error('Task save over api failed.')
logger.error(str(e))

def perform_tasks_remove_cmd(self, buffer: dict) -> None:
try:
value = buffer['value']
saveddata.remove_task(tasks.saved, tasks.saved_parameters, value, current_map.name)
except Exception as e:
logger.error('Task remove over api failed')
logger.error(str(e))

def perform_tasks_load_cmd(self, buffer: dict) -> None:
if 'value' in buffer:
Expand Down
2 changes: 1 addition & 1 deletion CaSSAndRA/src/backend/data/appdata.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
logger = logging.getLogger(__name__)


version = '0.203.1'
version = '0.204.0'

# global ui messages
cmdTransmissionFailed: bool = False

0 comments on commit 0abf945

Please sign in to comment.