some updates to ui homepage to align more with notion doc
This commit is contained in:
parent
19333e38b2
commit
0eeebc497b
|
@ -58,6 +58,7 @@ type OwnProps = {
|
|||
perPageOptions?: number[];
|
||||
showReports?: boolean;
|
||||
reportIdentifier?: string;
|
||||
textToShowIfEmpty?: string;
|
||||
};
|
||||
|
||||
interface dateParameters {
|
||||
|
@ -71,6 +72,7 @@ export default function ProcessInstanceListTable({
|
|||
perPageOptions,
|
||||
showReports = true,
|
||||
reportIdentifier,
|
||||
textToShowIfEmpty,
|
||||
}: OwnProps) {
|
||||
const params = useParams();
|
||||
const [searchParams] = useSearchParams();
|
||||
|
@ -753,7 +755,7 @@ export default function ProcessInstanceListTable({
|
|||
);
|
||||
};
|
||||
|
||||
if (pagination) {
|
||||
if (pagination && (!textToShowIfEmpty || pagination.total > 0)) {
|
||||
// eslint-disable-next-line prefer-const
|
||||
let { page, perPage } = getPageInfoFromSearchParams(
|
||||
searchParams,
|
||||
|
@ -780,6 +782,9 @@ export default function ProcessInstanceListTable({
|
|||
</>
|
||||
);
|
||||
}
|
||||
if (textToShowIfEmpty) {
|
||||
return <>{textToShowIfEmpty}</>;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -111,7 +111,7 @@ export default function MyOpenProcesses() {
|
|||
|
||||
const tasksComponent = () => {
|
||||
if (pagination && pagination.total < 1) {
|
||||
return null;
|
||||
return <p>No tasks waiting for you</p>;
|
||||
}
|
||||
const { page, perPage } = getPageInfoFromSearchParams(
|
||||
searchParams,
|
||||
|
@ -134,8 +134,10 @@ export default function MyOpenProcesses() {
|
|||
);
|
||||
};
|
||||
|
||||
if (pagination) {
|
||||
return tasksComponent();
|
||||
}
|
||||
return null;
|
||||
return (
|
||||
<>
|
||||
<h1>Tasks for my open processes</h1>
|
||||
{tasksComponent()}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
|
|
@ -112,7 +112,7 @@ export default function TasksWaitingForMe() {
|
|||
|
||||
const tasksComponent = () => {
|
||||
if (pagination && pagination.total < 1) {
|
||||
return null;
|
||||
return <p>No tasks waiting for you</p>;
|
||||
}
|
||||
const { page, perPage } = getPageInfoFromSearchParams(
|
||||
searchParams,
|
||||
|
@ -121,8 +121,6 @@ export default function TasksWaitingForMe() {
|
|||
'tasks_waiting_for_me'
|
||||
);
|
||||
return (
|
||||
<>
|
||||
<h1>Tasks waiting for me</h1>
|
||||
<PaginationForTable
|
||||
page={page}
|
||||
perPage={perPage}
|
||||
|
@ -131,12 +129,13 @@ export default function TasksWaitingForMe() {
|
|||
tableToDisplay={buildTable()}
|
||||
paginationQueryParamPrefix="tasks_waiting_for_me"
|
||||
/>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
if (pagination) {
|
||||
return tasksComponent();
|
||||
}
|
||||
return null;
|
||||
return (
|
||||
<>
|
||||
<h1>Tasks waiting for me</h1>
|
||||
{tasksComponent()}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
|
|
@ -113,7 +113,7 @@ export default function TasksWaitingForMyGroups() {
|
|||
|
||||
const tasksComponent = () => {
|
||||
if (pagination && pagination.total < 1) {
|
||||
return null;
|
||||
return <p>No tasks waiting for you</p>;
|
||||
}
|
||||
const { page, perPage } = getPageInfoFromSearchParams(
|
||||
searchParams,
|
||||
|
@ -122,8 +122,6 @@ export default function TasksWaitingForMyGroups() {
|
|||
paginationQueryParamPrefix
|
||||
);
|
||||
return (
|
||||
<>
|
||||
<h1>Tasks waiting for my groups</h1>
|
||||
<PaginationForTable
|
||||
page={page}
|
||||
perPage={perPage}
|
||||
|
@ -132,12 +130,13 @@ export default function TasksWaitingForMyGroups() {
|
|||
tableToDisplay={buildTable()}
|
||||
paginationQueryParamPrefix={paginationQueryParamPrefix}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
if (pagination) {
|
||||
return tasksComponent();
|
||||
}
|
||||
return null;
|
||||
return (
|
||||
<>
|
||||
<h1>Tasks waiting for my groups</h1>
|
||||
{tasksComponent()}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@ export default function CompletedInstances() {
|
|||
perPageOptions={[2, 5, 25]}
|
||||
reportIdentifier="system_report_instances_initiated_by_me"
|
||||
showReports={false}
|
||||
textToShowIfEmpty="No completed instances"
|
||||
/>
|
||||
<h1 style={{ marginTop: '1em' }}>With Tasks Completed By Me</h1>
|
||||
<ProcessInstanceListTable
|
||||
|
@ -18,6 +19,7 @@ export default function CompletedInstances() {
|
|||
perPageOptions={[2, 5, 25]}
|
||||
reportIdentifier="system_report_instances_with_tasks_completed_by_me"
|
||||
showReports={false}
|
||||
textToShowIfEmpty="No completed instances"
|
||||
/>
|
||||
<h1 style={{ marginTop: '1em' }}>With Tasks Completed By My Group</h1>
|
||||
<ProcessInstanceListTable
|
||||
|
@ -26,6 +28,7 @@ export default function CompletedInstances() {
|
|||
perPageOptions={[2, 5, 25]}
|
||||
reportIdentifier="system_report_instances_with_tasks_completed_by_my_groups"
|
||||
showReports={false}
|
||||
textToShowIfEmpty="No completed instances"
|
||||
/>
|
||||
</>
|
||||
);
|
||||
|
|
|
@ -18,12 +18,10 @@ export default function HomePageRoutes() {
|
|||
useEffect(() => {
|
||||
setErrorMessage(null);
|
||||
let newSelectedTabIndex = 0;
|
||||
if (location.pathname.match(/^\/tasks\/grouped\b/)) {
|
||||
if (location.pathname.match(/^\/tasks\/completed-instances\b/)) {
|
||||
newSelectedTabIndex = 1;
|
||||
} else if (location.pathname.match(/^\/tasks\/completed-instances\b/)) {
|
||||
newSelectedTabIndex = 2;
|
||||
} else if (location.pathname.match(/^\/tasks\/create-new-instance\b/)) {
|
||||
newSelectedTabIndex = 3;
|
||||
newSelectedTabIndex = 2;
|
||||
}
|
||||
setSelectedTabIndex(newSelectedTabIndex);
|
||||
}, [location, setErrorMessage]);
|
||||
|
@ -36,8 +34,8 @@ export default function HomePageRoutes() {
|
|||
<>
|
||||
<Tabs selectedIndex={selectedTabIndex}>
|
||||
<TabList aria-label="List of tabs">
|
||||
<Tab onClick={() => navigate('/tasks/my-tasks')}>My Tasks</Tab>
|
||||
<Tab onClick={() => navigate('/tasks/grouped')}>Grouped Tasks</Tab>
|
||||
{/* <Tab onClick={() => navigate('/tasks/my-tasks')}>My Tasks</Tab> */}
|
||||
<Tab onClick={() => navigate('/tasks/grouped')}>Tasks</Tab>
|
||||
<Tab onClick={() => navigate('/tasks/completed-instances')}>
|
||||
Completed Instances
|
||||
</Tab>
|
||||
|
@ -55,7 +53,7 @@ export default function HomePageRoutes() {
|
|||
<>
|
||||
{renderTabs()}
|
||||
<Routes>
|
||||
<Route path="/" element={<MyTasks />} />
|
||||
<Route path="/" element={<GroupedTasks />} />
|
||||
<Route path="my-tasks" element={<MyTasks />} />
|
||||
<Route path=":process_instance_id/:task_id" element={<TaskShow />} />
|
||||
<Route path="grouped" element={<GroupedTasks />} />
|
||||
|
|
Loading…
Reference in New Issue