Fix tg actions

This commit is contained in:
phil 2024-04-01 03:41:48 +05:30
parent 3ca56f22a6
commit 8b7081df67
2 changed files with 13 additions and 32 deletions

View file

@ -16,7 +16,8 @@ from gisaf.models.authentication import (
)
from gisaf.models.category import Category, CategoryRead
from gisaf.models.geo_models_base import GeoModel, PlottableModel
from gisaf.models.info import (ActionParam, ActionResult, ActionResults, ActionsResults, ActionsStore, FormFieldInput, LegendItem,
from gisaf.models.info import (ActionParam, ActionsResults, ActionsStore,
FormFieldInput, LegendItem,
ModelAction, ModelInfo,
DataProvider, ModelValue, PlotParams,
TagActions)
@ -37,7 +38,7 @@ from gisaf.custom_store_base import BaseStore
from gisaf.redis_tools import store as redis_store
from gisaf.models.info import FeatureInfo
from gisaf.live_utils import get_live_feature_info
from gisaf.plugins import manager as plugin_manager, NoSuchAction
from gisaf.plugins import manager as plugin_manager
from gisaf.utils import gisTypeSymbolMap
logger = logging.getLogger(__name__)
@ -390,7 +391,7 @@ async def get_actions() -> list[ActionsStore]:
# actionsPlugins = List(ActionsStore)
return plugin_manager.actionsStores
@api.post('/execTagAction/{action}')
@api.post('/execTagActions')
async def execute_tag_action(
user: Annotated[UserRead, Depends(get_current_active_user)],
stores: list[str],
@ -405,14 +406,9 @@ async def execute_tag_action(
if not params:
params = [None] * len(actionNames)
for name in actionNames:
try:
## Give the request from context to execute action, along with the parameters
## FIXME: formFields/names?
breakpoint()
resp = await plugin_manager.execute_action(
user, features, name, params, form_fields=formFields)
response.actionResults.append(resp)
except NoSuchAction:
logger.warn(f'Unknown action {name}')
response.actionResults.append(ActionResult(message=f'No such action: {name}'))
## Give the request from context to execute action, along with the parameters
## FIXME: formFields/names?
resp = await plugin_manager.execute_action(
user, features, name, params, form_fields=formFields)
response.actionResults.append(resp)
return response