diff --git a/src/backend/data/data-access/RDBMS.ts b/src/backend/data/data-access/RDBMS.ts index f344deb6f..fa348b689 100644 --- a/src/backend/data/data-access/RDBMS.ts +++ b/src/backend/data/data-access/RDBMS.ts @@ -107,6 +107,10 @@ export class RDBMSDataApiService extends BaseDataAccessService `/api/data/${entity}/table`; @@ -157,6 +158,7 @@ export function useEntityDataCreationMutation(entity: string) { ENTITY_TABLE_PATH(entity), ENTITY_COUNT_PATH(entity), ENTITY_LIST_PATH(entity), + ...DATA_MUTATION_QUERY_ENDPOINTS(entity), ], smartSuccessMessage: ({ id }) => ({ message: entityCrudConfig.MUTATION_LANG.CREATE, @@ -183,6 +185,7 @@ export function useEntityDataUpdationMutation(entity: string, id: string) { ENTITY_TABLE_PATH(entity), ENTITY_DETAILS_PATH(entity, id), ENTITY_LIST_PATH(entity), + ...DATA_MUTATION_QUERY_ENDPOINTS(entity), ], successMessage: entityCrudConfig.MUTATION_LANG.EDIT, }); @@ -207,6 +210,7 @@ export function useEntityDataDeletionMutation( ENTITY_TABLE_PATH(entity), ENTITY_COUNT_PATH(entity), ENTITY_LIST_PATH(entity), + ...DATA_MUTATION_QUERY_ENDPOINTS(entity), ], onSuccessActionWithFormData: () => { if (redirectTo) { diff --git a/src/frontend/hooks/data/portal/index.ts b/src/frontend/hooks/data/portal/index.ts new file mode 100644 index 000000000..a8454a19f --- /dev/null +++ b/src/frontend/hooks/data/portal/index.ts @@ -0,0 +1 @@ +export { DATA_MUTATION_QUERY_ENDPOINTS } from "./main"; diff --git a/src/frontend/hooks/data/portal/main.ts b/src/frontend/hooks/data/portal/main.ts new file mode 100644 index 000000000..0b0ff00cd --- /dev/null +++ b/src/frontend/hooks/data/portal/main.ts @@ -0,0 +1,6 @@ +import { noop } from "shared/lib/noop"; + +export const DATA_MUTATION_QUERY_ENDPOINTS = (entity: string) => { + noop(entity); + return []; +}; diff --git a/src/frontend/views/data/Details/index.tsx b/src/frontend/views/data/Details/index.tsx index fdbe33da3..b4875da01 100644 --- a/src/frontend/views/data/Details/index.tsx +++ b/src/frontend/views/data/Details/index.tsx @@ -14,6 +14,7 @@ import { EntityDetailsView } from "./DetailsView"; import { DetailsLayout, DETAILS_LAYOUT_KEY } from "./_Layout"; import { useCanUserPerformCrudAction } from "../useCanUserPerformCrudAction"; import { DetailsCanvas } from "../Table/_WholeEntityTable/DetailsCanvas"; +import { useDetailsViewMenuItems } from "./portal"; export function EntityDetails() { const entityCrudConfig = useEntityCrudConfig(); @@ -34,8 +35,17 @@ export function EntityDetails() { permission: META_USER_PERMISSIONS.NO_PERMISSION_REQUIRED, }); + const menuItems = useDetailsViewMenuItems({ + entity, + entityId: id, + }); + return ( - + { + const menuItems: IDropDownMenuItem[] = []; + noop(entity, entityId); + return menuItems; +}; diff --git a/src/frontend/views/data/Table/useTableMenuItems.ts b/src/frontend/views/data/Table/useTableMenuItems.ts index 589ca3f7e..58c1ee3c9 100644 --- a/src/frontend/views/data/Table/useTableMenuItems.ts +++ b/src/frontend/views/data/Table/useTableMenuItems.ts @@ -18,7 +18,7 @@ export const useTableMenuItems = ( const entityCrudConfig = useEntityCrudConfig(entity); const canUserPerformCrudAction = useCanUserPerformCrudAction(entity); - const pluginTableMenuItems = usePluginTableMenuItems(entity, reference); + const pluginTableMenuItems = usePluginTableMenuItems(entity); if (entity === SLUG_LOADING_VALUE) { return []; diff --git a/src/shared/types/data.ts b/src/shared/types/data.ts index 05e63f45c..bae12ebcb 100644 --- a/src/shared/types/data.ts +++ b/src/shared/types/data.ts @@ -1,3 +1,5 @@ +import { Knex } from "knex"; + export enum FilterOperators { GREATER_THAN = "g", LESS_THAN = "l", @@ -63,6 +65,7 @@ export type IPaginatedDataState = { export type QueryFilterSchema = { operator: "and" | "or"; children: Array; + modifyQuery?: (queryBuilder: Knex.QueryBuilder) => Knex.QueryBuilder; }; export type ITableTab = {