Skip to content

Commit

Permalink
Pass showAlertsTab in props to editor-form
Browse files Browse the repository at this point in the history
Signed-off-by: Neha Gokhale <[email protected]>
  • Loading branch information
nmgokhale committed Oct 17, 2023
1 parent 3369a85 commit aec9365
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ class EditorForm extends React.Component {
this.state = {
showFieldPicker: false
};
this.showAlertsTab = props.controller ? get(props.controller.getPropertiesConfig(), "showAlertsTab", true) : true;

this.genPanel = this.genPanel.bind(this);
this.genUIContent = this.genUIContent.bind(this);
Expand Down Expand Up @@ -88,7 +87,7 @@ class EditorForm extends React.Component {
}

_getMessageCountForCategory(tab) {
if (!this.showAlertsTab) {
if (!this.props.showAlertsTab) {
return null;
}
if (tab.group === ALERT_TAB_GROUP) {
Expand Down Expand Up @@ -613,7 +612,7 @@ class EditorForm extends React.Component {

render() {
let uiItems = this.props.controller.getUiItems();
if (this.showAlertsTab && !isEmpty(this.messages) && uiItems[0].itemType === "primaryTabs" && uiItems[0].tabs && uiItems[0].tabs.length > 1) {
if (this.props.showAlertsTab && !isEmpty(this.messages) && uiItems[0].itemType === "primaryTabs" && uiItems[0].tabs && uiItems[0].tabs.length > 1) {
// create a new copy for uiItems object so that alerts are not added multiple times
uiItems = cloneDeep(uiItems);
uiItems[0].tabs.unshift(this.genAlertsTab(this.messages)); // add alerts tab to the beginning of the tabs array
Expand Down Expand Up @@ -672,6 +671,7 @@ EditorForm.propTypes = {
customPanels: PropTypes.array,
rightFlyout: PropTypes.bool,
categoryView: PropTypes.oneOf([CATEGORY_VIEW.ACCORDIONS, CATEGORY_VIEW.TABS]),
showAlertsTab: PropTypes.bool,
activeTab: PropTypes.string, // set by redux
setActiveTab: PropTypes.func, // set by redux
messages: PropTypes.array // set by redux
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -517,6 +517,7 @@ class PropertiesMain extends React.Component {
customPanels={this.props.customPanels}
rightFlyout={this.props.propertiesConfig.rightFlyout}
categoryView={this.props.propertiesConfig.categoryView}
showAlertsTab={(typeof this.props.propertiesConfig.showAlertsTab !== "undefined") ? this.props.propertiesConfig.showAlertsTab : true}
/>);

if (this.props.propertiesConfig.containerType === "Editing") {
Expand Down

0 comments on commit aec9365

Please sign in to comment.