-
- Downloads
List actions endpoint (#29055)
* List all actions
previously `api/action` required `?model-id=<model-id>`. This caused the
FE to DOS the backend looping over each action. On stats I found 350 or
so sequential requests, with app-db saturation leading to requests
taking from 400ms near the beginning to 7seconds near the end.
This makes `model-id` option and now returns actions on all models the
user can see.
```
❯ http GET "localhost:3000/api/action" Cookie:$SESSION -pb
[
{
"archived": false,
"creator": {...},
"creator_id": 1,
"database_id": 3,
"dataset_query": {...},
"id": 1,
"model_id": 1,
"name": "source = foo",
"parameter_mappings": null,
"parameters": [...],
...
}
...
]
```
* update frontend for action picker to support single action list endpoint
* list actions tests
* update actions e2e tests
* Return empty vector if no results
Running tests locally might return some extra actions not asserted on in
the tests. And there you might expect a 200. But CI runs with an empty
database and returns no response so you get a 204. Quite annoying and
there's no good way to expect a "2xx" status code at the moment. So just
return the empty vector so it's always a 200 code.
* update actions endpoint unit test mocks
* Simplify logic a little
* docstring tweak
* schema with better error message
* update mocks to accept optional modelId
* simplify sorting and grouping
* make sort case-insensitive
* simplify action api test mocks
---------
Co-authored-by:
Ryan Laurie <iethree@gmail.com>
Showing
- e2e/test/scenarios/dashboard/actions-on-dashboards.cy.spec.js 3 additions, 2 deletions...test/scenarios/dashboard/actions-on-dashboards.cy.spec.js
- frontend/src/metabase/actions/components/ActionViz/ActionDashcardSettings.unit.spec.tsx 1 addition, 2 deletions...components/ActionViz/ActionDashcardSettings.unit.spec.tsx
- frontend/src/metabase/actions/containers/ActionCreatorModal/ActionCreatorModal.unit.spec.tsx 2 additions, 2 deletions...iners/ActionCreatorModal/ActionCreatorModal.unit.spec.tsx
- frontend/src/metabase/actions/containers/ActionPicker/ActionPicker.tsx 18 additions, 14 deletions...metabase/actions/containers/ActionPicker/ActionPicker.tsx
- frontend/src/metabase/actions/containers/ActionPicker/types.ts 5 additions, 0 deletions...end/src/metabase/actions/containers/ActionPicker/types.ts
- frontend/src/metabase/actions/containers/ActionPicker/utils.ts 19 additions, 0 deletions...end/src/metabase/actions/containers/ActionPicker/utils.ts
- frontend/src/metabase/actions/containers/ActionPicker/utils.unit.spec.ts 25 additions, 0 deletions...tabase/actions/containers/ActionPicker/utils.unit.spec.ts
- frontend/src/metabase/models/containers/ModelDetailPage/ModelDetailPage.unit.spec.tsx 2 additions, 2 deletions.../containers/ModelDetailPage/ModelDetailPage.unit.spec.tsx
- frontend/test/__support__/server-mocks/action.ts 25 additions, 13 deletionsfrontend/test/__support__/server-mocks/action.ts
- src/metabase/api/action.clj 28 additions, 10 deletionssrc/metabase/api/action.clj
- test/metabase/api/action_test.clj 27 additions, 10 deletionstest/metabase/api/action_test.clj
Loading
Please register or sign in to comment