do not error when removing columns from instance column filters w/ burnettk

This commit is contained in:
jasquat 2022-12-30 13:59:52 -05:00
parent 840d2f0937
commit bd96844caa
2 changed files with 35 additions and 29 deletions

View File

@ -774,7 +774,6 @@ export default function ProcessInstanceListTable({
setReportMetadata(reportMetadataCopy); setReportMetadata(reportMetadataCopy);
setReportColumnToOperateOn(null); setReportColumnToOperateOn(null);
setShowReportColumnForm(false); setShowReportColumnForm(false);
setShowReportColumnForm(false);
} }
}; };
@ -795,9 +794,12 @@ export default function ProcessInstanceListTable({
}; };
const updateReportColumn = (event: any) => { const updateReportColumn = (event: any) => {
const reportColumnForEditing = reportColumnToReportColumnForEditing( let reportColumnForEditing = null;
event.selectedItem if (event.selectedItem) {
); reportColumnForEditing = reportColumnToReportColumnForEditing(
event.selectedItem
);
}
setReportColumnToOperateOn(reportColumnForEditing); setReportColumnToOperateOn(reportColumnForEditing);
}; };
@ -827,7 +829,29 @@ export default function ProcessInstanceListTable({
if (reportColumnFormMode === '') { if (reportColumnFormMode === '') {
return null; return null;
} }
const formElements = [ const formElements = [];
if (reportColumnFormMode === 'new') {
formElements.push(
<ComboBox
onChange={updateReportColumn}
id="report-column-selection"
data-qa="report-column-selection"
data-modal-primary-focus
items={availableReportColumns}
itemToString={(reportColumn: ReportColumn) => {
if (reportColumn) {
return reportColumn.accessor;
}
return null;
}}
shouldFilterItem={shouldFilterReportColumn}
placeholder="Choose a column to show"
titleText="Column"
selectedItem={reportColumnToOperateOn}
/>
);
}
formElements.push([
<TextInput <TextInput
id="report-column-display-name" id="report-column-display-name"
name="report-column-display-name" name="report-column-display-name"
@ -844,7 +868,7 @@ export default function ProcessInstanceListTable({
} }
}} }}
/>, />,
]; ]);
if (reportColumnToOperateOn && reportColumnToOperateOn.filterable) { if (reportColumnToOperateOn && reportColumnToOperateOn.filterable) {
formElements.push( formElements.push(
<TextInput <TextInput
@ -860,27 +884,9 @@ export default function ProcessInstanceListTable({
/> />
); );
} }
if (reportColumnFormMode === 'new') { formElements.push(
formElements.push( <div className="vertical-spacer-to-allow-combo-box-to-expand-in-modal" />
<ComboBox );
onChange={updateReportColumn}
className="combo-box-in-modal"
id="report-column-selection"
data-qa="report-column-selection"
data-modal-primary-focus
items={availableReportColumns}
itemToString={(reportColumn: ReportColumn) => {
if (reportColumn) {
return reportColumn.accessor;
}
return null;
}}
shouldFilterItem={shouldFilterReportColumn}
placeholder="Choose a column to show"
titleText="Column"
/>
);
}
const modalHeading = const modalHeading =
reportColumnFormMode === 'new' reportColumnFormMode === 'new'
? 'Add Column' ? 'Add Column'

View File

@ -355,8 +355,8 @@ svg.notification-icon {
word-break: normal; word-break: normal;
} }
.combo-box-in-modal { .vertical-spacer-to-allow-combo-box-to-expand-in-modal {
height: 300px; height: 250px;
} }
.cds--btn.narrow-button { .cds--btn.narrow-button {