use a black background for the view filterable table button and fixed process model show instances table w/ burnettk

This commit is contained in:
jasquat 2023-05-02 11:41:55 -04:00
parent fa2c00821d
commit ab1cc4b102
2 changed files with 18 additions and 49 deletions

View File

@ -85,7 +85,6 @@ import Filters from './Filters';
type OwnProps = { type OwnProps = {
filtersEnabled?: boolean; filtersEnabled?: boolean;
processModelFullIdentifier?: string;
paginationQueryParamPrefix?: string; paginationQueryParamPrefix?: string;
perPageOptions?: number[]; perPageOptions?: number[];
showReports?: boolean; showReports?: boolean;
@ -107,7 +106,6 @@ interface dateParameters {
export default function ProcessInstanceListTable({ export default function ProcessInstanceListTable({
filtersEnabled = true, filtersEnabled = true,
processModelFullIdentifier,
paginationQueryParamPrefix, paginationQueryParamPrefix,
perPageOptions, perPageOptions,
additionalReportFilters, additionalReportFilters,
@ -341,7 +339,6 @@ export default function ProcessInstanceListTable({
// this is the code to re-populate the widgets on the page // this is the code to re-populate the widgets on the page
// with values from the report metadata, which is derived // with values from the report metadata, which is derived
// from the searchParams (often report_hash) // from the searchParams (often report_hash)
let selectedProcessModelIdentifier = processModelFullIdentifier;
reportMetadataBodyToUse.filter_by.forEach( reportMetadataBodyToUse.filter_by.forEach(
(reportFilter: ReportFilter) => { (reportFilter: ReportFilter) => {
if (reportFilter.field_name === 'process_status') { if (reportFilter.field_name === 'process_status') {
@ -357,8 +354,15 @@ export default function ProcessInstanceListTable({
} else if (systemReportOptions.includes(reportFilter.field_name)) { } else if (systemReportOptions.includes(reportFilter.field_name)) {
setSystemReport(reportFilter.field_name); setSystemReport(reportFilter.field_name);
} else if (reportFilter.field_name === 'process_model_identifier') { } else if (reportFilter.field_name === 'process_model_identifier') {
selectedProcessModelIdentifier = if (reportFilter.field_value) {
reportFilter.field_value || undefined; processModelSelectionItemsForUseEffect.current.forEach(
(processModel: ProcessModel) => {
if (processModel.id === reportFilter.field_value) {
setProcessModelSelection(processModel);
}
}
);
}
} else if (dateParametersToAlwaysFilterBy[reportFilter.field_name]) { } else if (dateParametersToAlwaysFilterBy[reportFilter.field_name]) {
const dateFunctionToCall = const dateFunctionToCall =
dateParametersToAlwaysFilterBy[reportFilter.field_name][0]; dateParametersToAlwaysFilterBy[reportFilter.field_name][0];
@ -377,13 +381,6 @@ export default function ProcessInstanceListTable({
} }
} }
); );
processModelSelectionItemsForUseEffect.current.forEach(
(processModel: ProcessModel) => {
if (processModel.id === selectedProcessModelIdentifier) {
setProcessModelSelection(processModel);
}
}
);
if (reportMetadataBodyToUse.filter_by.length > 1) { if (reportMetadataBodyToUse.filter_by.length > 1) {
setShowFilterOptions(true); setShowFilterOptions(true);
@ -435,7 +432,6 @@ export default function ProcessInstanceListTable({
paginationQueryParamPrefix, paginationQueryParamPrefix,
perPageOptions, perPageOptions,
processInstanceApiSearchPath, processInstanceApiSearchPath,
processModelFullIdentifier,
searchParams, searchParams,
setProcessInstancesFromResult, setProcessInstancesFromResult,
stopRefreshing, stopRefreshing,
@ -1682,7 +1678,7 @@ export default function ProcessInstanceListTable({
return null; return null;
} }
let filterButtonLink = null; let filterButtonLink = null;
if (showLinkToReport) { if (showLinkToReport && processInstances.length > 0) {
filterButtonLink = ( filterButtonLink = (
<Column <Column
sm={{ span: 1, offset: 3 }} sm={{ span: 1, offset: 3 }}
@ -1691,7 +1687,6 @@ export default function ProcessInstanceListTable({
> >
<Button <Button
data-qa="process-instance-list-link" data-qa="process-instance-list-link"
kind="ghost"
renderIcon={ArrowRight} renderIcon={ArrowRight}
iconDescription="View Filterable List" iconDescription="View Filterable List"
hasIconOnly hasIconOnly

View File

@ -561,38 +561,6 @@ export default function ProcessModelShow() {
); );
}; };
const processInstanceListTableButton = () => {
if (processModel) {
return (
<Grid fullWidth condensed>
<Column sm={{ span: 3 }} md={{ span: 4 }} lg={{ span: 3 }}>
<h2>My Process Instances</h2>
</Column>
<Column
sm={{ span: 1, offset: 3 }}
md={{ span: 1, offset: 7 }}
lg={{ span: 1, offset: 15 }}
>
<Button
data-qa="process-instance-list-link"
kind="ghost"
renderIcon={ArrowRight}
iconDescription="Go to Filterable List"
hasIconOnly
size="lg"
onClick={() =>
navigate(
`/admin/process-instances?process_model_identifier=${processModel.id}`
)
}
/>
</Column>
</Grid>
);
}
return null;
};
const processModelPublishMessage = () => { const processModelPublishMessage = () => {
if (processModelPublished) { if (processModelPublished) {
const prUrl: string = processModelPublished.pr_url; const prUrl: string = processModelPublished.pr_url;
@ -683,11 +651,17 @@ export default function ProcessModelShow() {
</Stack> </Stack>
{processModelFilesSection()} {processModelFilesSection()}
<Can I="GET" a={targetUris.processInstanceListPath} ability={ability}> <Can I="GET" a={targetUris.processInstanceListPath} ability={ability}>
{processInstanceListTableButton()}
<ProcessInstanceListTable <ProcessInstanceListTable
headerElement={<h2>My Process Instances</h2>}
filtersEnabled={false} filtersEnabled={false}
showLinkToReport
variant="for-me" variant="for-me"
processModelFullIdentifier={processModel.id} additionalReportFilters={[
{
field_name: 'process_model_identifier',
field_value: processModel.id,
},
]}
perPageOptions={[2, 5, 25]} perPageOptions={[2, 5, 25]}
showReports={false} showReports={false}
/> />