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);
setReportColumnToOperateOn(null);
setShowReportColumnForm(false);
setShowReportColumnForm(false);
}
};
@ -795,9 +794,12 @@ export default function ProcessInstanceListTable({
};
const updateReportColumn = (event: any) => {
const reportColumnForEditing = reportColumnToReportColumnForEditing(
event.selectedItem
);
let reportColumnForEditing = null;
if (event.selectedItem) {
reportColumnForEditing = reportColumnToReportColumnForEditing(
event.selectedItem
);
}
setReportColumnToOperateOn(reportColumnForEditing);
};
@ -827,7 +829,29 @@ export default function ProcessInstanceListTable({
if (reportColumnFormMode === '') {
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
id="report-column-display-name"
name="report-column-display-name"
@ -844,7 +868,7 @@ export default function ProcessInstanceListTable({
}
}}
/>,
];
]);
if (reportColumnToOperateOn && reportColumnToOperateOn.filterable) {
formElements.push(
<TextInput
@ -860,27 +884,9 @@ export default function ProcessInstanceListTable({
/>
);
}
if (reportColumnFormMode === 'new') {
formElements.push(
<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"
/>
);
}
formElements.push(
<div className="vertical-spacer-to-allow-combo-box-to-expand-in-modal" />
);
const modalHeading =
reportColumnFormMode === 'new'
? 'Add Column'

View File

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