mirror of
https://github.com/status-im/spiff-arena.git
synced 2025-01-14 12:14:46 +00:00
allow specifying the default per page value for the tasklisttable instead of hardcoding it for everyone
This commit is contained in:
parent
fc22425ea2
commit
24bfea9799
@ -17,54 +17,56 @@ import CustomForm from './CustomForm';
|
|||||||
import InstructionsForEndUser from './InstructionsForEndUser';
|
import InstructionsForEndUser from './InstructionsForEndUser';
|
||||||
import DateAndTimeService from '../services/DateAndTimeService';
|
import DateAndTimeService from '../services/DateAndTimeService';
|
||||||
|
|
||||||
const PER_PAGE_FOR_TASKS_ON_HOME_PAGE = 5;
|
|
||||||
|
|
||||||
type OwnProps = {
|
type OwnProps = {
|
||||||
apiPath: string;
|
apiPath: string;
|
||||||
tableTitle?: string;
|
|
||||||
tableDescription?: string;
|
|
||||||
additionalParams?: string;
|
additionalParams?: string;
|
||||||
paginationQueryParamPrefix?: string;
|
|
||||||
paginationClassName?: string;
|
|
||||||
autoReload?: boolean;
|
autoReload?: boolean;
|
||||||
showStartedBy?: boolean;
|
canCompleteAllTasks?: boolean;
|
||||||
showWaitingOn?: boolean;
|
defaultPerPage?: number;
|
||||||
textToShowIfEmpty?: string;
|
hideIfNoTasks?: boolean;
|
||||||
|
paginationClassName?: string;
|
||||||
|
paginationQueryParamPrefix?: string;
|
||||||
shouldPaginateTable?: boolean;
|
shouldPaginateTable?: boolean;
|
||||||
showProcessId?: boolean;
|
showActionsColumn?: boolean;
|
||||||
showProcessModelIdentifier?: boolean;
|
showCompletedBy?: boolean;
|
||||||
showTableDescriptionAsTooltip?: boolean;
|
|
||||||
showDateStarted?: boolean;
|
showDateStarted?: boolean;
|
||||||
showLastUpdated?: boolean;
|
showLastUpdated?: boolean;
|
||||||
hideIfNoTasks?: boolean;
|
showProcessId?: boolean;
|
||||||
canCompleteAllTasks?: boolean;
|
showProcessModelIdentifier?: boolean;
|
||||||
showActionsColumn?: boolean;
|
showStartedBy?: boolean;
|
||||||
|
showTableDescriptionAsTooltip?: boolean;
|
||||||
showViewFormDataButton?: boolean;
|
showViewFormDataButton?: boolean;
|
||||||
showCompletedBy?: boolean;
|
showWaitingOn?: boolean;
|
||||||
|
tableDescription?: string;
|
||||||
|
tableTitle?: string;
|
||||||
|
textToShowIfEmpty?: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
export default function TaskListTable({
|
export default function TaskListTable({
|
||||||
apiPath,
|
apiPath,
|
||||||
tableTitle,
|
|
||||||
tableDescription,
|
|
||||||
additionalParams,
|
additionalParams,
|
||||||
paginationQueryParamPrefix,
|
|
||||||
paginationClassName,
|
|
||||||
textToShowIfEmpty,
|
|
||||||
autoReload = false,
|
autoReload = false,
|
||||||
showStartedBy = true,
|
canCompleteAllTasks = false,
|
||||||
showWaitingOn = true,
|
defaultPerPage = 5,
|
||||||
|
hideIfNoTasks = false,
|
||||||
|
paginationClassName,
|
||||||
|
paginationQueryParamPrefix,
|
||||||
shouldPaginateTable = true,
|
shouldPaginateTable = true,
|
||||||
showProcessId = true,
|
showActionsColumn = true,
|
||||||
showProcessModelIdentifier = true,
|
showCompletedBy = false,
|
||||||
showTableDescriptionAsTooltip = false,
|
|
||||||
showDateStarted = true,
|
showDateStarted = true,
|
||||||
showLastUpdated = true,
|
showLastUpdated = true,
|
||||||
hideIfNoTasks = false,
|
showProcessId = true,
|
||||||
canCompleteAllTasks = false,
|
showProcessModelIdentifier = true,
|
||||||
showActionsColumn = true,
|
showStartedBy = true,
|
||||||
|
showTableDescriptionAsTooltip = false,
|
||||||
showViewFormDataButton = false,
|
showViewFormDataButton = false,
|
||||||
showCompletedBy = false,
|
showWaitingOn = true,
|
||||||
|
tableDescription,
|
||||||
|
tableTitle,
|
||||||
|
textToShowIfEmpty,
|
||||||
}: OwnProps) {
|
}: OwnProps) {
|
||||||
const [searchParams] = useSearchParams();
|
const [searchParams] = useSearchParams();
|
||||||
const [tasks, setTasks] = useState<ProcessInstanceTask[] | null>(null);
|
const [tasks, setTasks] = useState<ProcessInstanceTask[] | null>(null);
|
||||||
@ -80,7 +82,7 @@ export default function TaskListTable({
|
|||||||
const getTasks = () => {
|
const getTasks = () => {
|
||||||
const { page, perPage } = getPageInfoFromSearchParams(
|
const { page, perPage } = getPageInfoFromSearchParams(
|
||||||
searchParams,
|
searchParams,
|
||||||
PER_PAGE_FOR_TASKS_ON_HOME_PAGE,
|
defaultPerPage,
|
||||||
undefined,
|
undefined,
|
||||||
paginationQueryParamPrefix
|
paginationQueryParamPrefix
|
||||||
);
|
);
|
||||||
@ -107,11 +109,12 @@ export default function TaskListTable({
|
|||||||
}
|
}
|
||||||
return undefined;
|
return undefined;
|
||||||
}, [
|
}, [
|
||||||
searchParams,
|
|
||||||
additionalParams,
|
additionalParams,
|
||||||
apiPath,
|
apiPath,
|
||||||
paginationQueryParamPrefix,
|
|
||||||
autoReload,
|
autoReload,
|
||||||
|
defaultPerPage,
|
||||||
|
paginationQueryParamPrefix,
|
||||||
|
searchParams,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const getWaitingForTableCellComponent = (
|
const getWaitingForTableCellComponent = (
|
||||||
@ -405,7 +408,7 @@ export default function TaskListTable({
|
|||||||
}
|
}
|
||||||
const { page, perPage } = getPageInfoFromSearchParams(
|
const { page, perPage } = getPageInfoFromSearchParams(
|
||||||
searchParams,
|
searchParams,
|
||||||
PER_PAGE_FOR_TASKS_ON_HOME_PAGE,
|
defaultPerPage,
|
||||||
undefined,
|
undefined,
|
||||||
paginationQueryParamPrefix
|
paginationQueryParamPrefix
|
||||||
);
|
);
|
||||||
@ -417,7 +420,7 @@ export default function TaskListTable({
|
|||||||
<PaginationForTable
|
<PaginationForTable
|
||||||
page={page}
|
page={page}
|
||||||
perPage={perPage}
|
perPage={perPage}
|
||||||
perPageOptions={[2, PER_PAGE_FOR_TASKS_ON_HOME_PAGE, 25]}
|
perPageOptions={[2, defaultPerPage, 25]}
|
||||||
pagination={pagination}
|
pagination={pagination}
|
||||||
tableToDisplay={buildTable()}
|
tableToDisplay={buildTable()}
|
||||||
paginationQueryParamPrefix={paginationQueryParamPrefix}
|
paginationQueryParamPrefix={paginationQueryParamPrefix}
|
||||||
|
@ -1515,6 +1515,7 @@ export default function ProcessInstanceShow({ variant }: OwnProps) {
|
|||||||
showWaitingOn={false}
|
showWaitingOn={false}
|
||||||
canCompleteAllTasks={false}
|
canCompleteAllTasks={false}
|
||||||
showViewFormDataButton
|
showViewFormDataButton
|
||||||
|
defaultPerPage={20}
|
||||||
/>
|
/>
|
||||||
) : null}
|
) : null}
|
||||||
</TabPanel>
|
</TabPanel>
|
||||||
@ -1534,6 +1535,7 @@ export default function ProcessInstanceShow({ variant }: OwnProps) {
|
|||||||
canCompleteAllTasks={false}
|
canCompleteAllTasks={false}
|
||||||
showCompletedBy
|
showCompletedBy
|
||||||
showActionsColumn={false}
|
showActionsColumn={false}
|
||||||
|
defaultPerPage={20}
|
||||||
/>
|
/>
|
||||||
) : null}
|
) : null}
|
||||||
</TabPanel>
|
</TabPanel>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user