fix placeholder text, etc
This commit is contained in:
parent
0988b371ec
commit
da98f876a0
|
@ -49,6 +49,7 @@ type OwnProps = {
|
||||||
|
|
||||||
export default function ProcessInstanceLogList({ variant }: OwnProps) {
|
export default function ProcessInstanceLogList({ variant }: OwnProps) {
|
||||||
const params = useParams();
|
const params = useParams();
|
||||||
|
const [clearAll, setClearAll] = useState<boolean>(false);
|
||||||
const [searchParams, setSearchParams] = useSearchParams();
|
const [searchParams, setSearchParams] = useSearchParams();
|
||||||
const [processInstanceLogs, setProcessInstanceLogs] = useState([]);
|
const [processInstanceLogs, setProcessInstanceLogs] = useState([]);
|
||||||
const [pagination, setPagination] = useState(null);
|
const [pagination, setPagination] = useState(null);
|
||||||
|
@ -71,6 +72,13 @@ export default function ProcessInstanceLogList({ variant }: OwnProps) {
|
||||||
const { ability } = usePermissionFetcher(permissionRequestData);
|
const { ability } = usePermissionFetcher(permissionRequestData);
|
||||||
|
|
||||||
const [showFilterOptions, setShowFilterOptions] = useState<boolean>(false);
|
const [showFilterOptions, setShowFilterOptions] = useState<boolean>(false);
|
||||||
|
const randomNumberBetween0and1 = Math.random();
|
||||||
|
|
||||||
|
let shouldDisplayClearButton = false;
|
||||||
|
if (randomNumberBetween0and1 < 0.05) {
|
||||||
|
// 5% chance of being here
|
||||||
|
shouldDisplayClearButton = true;
|
||||||
|
}
|
||||||
|
|
||||||
let processInstanceShowPageBaseUrl = `/admin/process-instances/for-me/${params.process_model_id}`;
|
let processInstanceShowPageBaseUrl = `/admin/process-instances/for-me/${params.process_model_id}`;
|
||||||
if (variant === 'all') {
|
if (variant === 'all') {
|
||||||
|
@ -357,6 +365,10 @@ export default function ProcessInstanceLogList({ variant }: OwnProps) {
|
||||||
setSearchParams(searchParams);
|
setSearchParams(searchParams);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const clearFilters = () => {
|
||||||
|
setClearAll(true);
|
||||||
|
};
|
||||||
|
|
||||||
const shouldFilterStringItem = (options: any) => {
|
const shouldFilterStringItem = (options: any) => {
|
||||||
const stringItem = options.item;
|
const stringItem = options.item;
|
||||||
let { inputValue } = options;
|
let { inputValue } = options;
|
||||||
|
@ -414,7 +426,7 @@ export default function ProcessInstanceLogList({ variant }: OwnProps) {
|
||||||
return value;
|
return value;
|
||||||
}}
|
}}
|
||||||
shouldFilterItem={shouldFilterStringItem}
|
shouldFilterItem={shouldFilterStringItem}
|
||||||
placeholder="Choose a process model"
|
placeholder="Choose a task type"
|
||||||
titleText="Task Type"
|
titleText="Task Type"
|
||||||
selectedItem={searchParams.get('task_type')}
|
selectedItem={searchParams.get('task_type')}
|
||||||
/>
|
/>
|
||||||
|
@ -431,7 +443,7 @@ export default function ProcessInstanceLogList({ variant }: OwnProps) {
|
||||||
return value;
|
return value;
|
||||||
}}
|
}}
|
||||||
shouldFilterItem={shouldFilterStringItem}
|
shouldFilterItem={shouldFilterStringItem}
|
||||||
placeholder="Choose a process model"
|
placeholder="Choose an event type"
|
||||||
titleText="Event Type"
|
titleText="Event Type"
|
||||||
selectedItem={searchParams.get('event_type')}
|
selectedItem={searchParams.get('event_type')}
|
||||||
/>
|
/>
|
||||||
|
@ -455,6 +467,15 @@ export default function ProcessInstanceLogList({ variant }: OwnProps) {
|
||||||
>
|
>
|
||||||
Reset
|
Reset
|
||||||
</Button>
|
</Button>
|
||||||
|
{shouldDisplayClearButton && (
|
||||||
|
<Button
|
||||||
|
kind=""
|
||||||
|
className="button-white-background narrow-button"
|
||||||
|
onClick={clearFilters}
|
||||||
|
>
|
||||||
|
Clear
|
||||||
|
</Button>
|
||||||
|
)}
|
||||||
</ButtonSet>
|
</ButtonSet>
|
||||||
</Column>
|
</Column>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
@ -493,6 +514,9 @@ export default function ProcessInstanceLogList({ variant }: OwnProps) {
|
||||||
};
|
};
|
||||||
|
|
||||||
const { page, perPage } = getPageInfoFromSearchParams(searchParams);
|
const { page, perPage } = getPageInfoFromSearchParams(searchParams);
|
||||||
|
if (clearAll) {
|
||||||
|
return <p>Page cleared 👍</p>;
|
||||||
|
}
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<ProcessBreadcrumb
|
<ProcessBreadcrumb
|
||||||
|
|
Loading…
Reference in New Issue