|
1 | 1 | import React, { Component } from 'react'; |
2 | 2 | import './tagModal.scss'; |
3 | 3 | import { Button } from '@patternfly/react-core/dist/dynamic/components/Button'; |
4 | | -import { Modal } from '@patternfly/react-core/dist/dynamic/components/Modal'; |
| 4 | +import { Modal, ModalBody, ModalFooter, ModalHeader } from '@patternfly/react-core/dist/dynamic/components/Modal'; |
5 | 5 | import { Tab } from '@patternfly/react-core/dist/dynamic/components/Tabs'; |
6 | 6 | import { TabTitleText } from '@patternfly/react-core/dist/dynamic/components/Tabs'; |
7 | 7 | import { Tabs } from '@patternfly/react-core/dist/dynamic/components/Tabs'; |
@@ -117,61 +117,65 @@ class TagModal extends Component< |
117 | 117 | {...props} |
118 | 118 | className={classNames('ins-c-tag-modal', className)} |
119 | 119 | isOpen={isOpen} |
120 | | - title={title || `Tags for ${systemName}`} |
121 | 120 | onClose={() => toggleModal(undefined, false)} |
122 | 121 | variant="medium" |
123 | | - {...(onApply && { |
124 | | - actions: [ |
125 | | - <Button |
126 | | - key="confirm" |
127 | | - variant="primary" |
128 | | - isDisabled={ |
129 | | - isTabbed ? Object.values(selected || {}).every((values) => !values || values?.length === 0) : !selected || selected?.length === 0 |
130 | | - } |
131 | | - onClick={(e) => { |
132 | | - onApply(); |
133 | | - toggleModal(e, true); |
134 | | - }} |
135 | | - > |
136 | | - Apply {isTabbed ? 'selected' : 'tags'} |
137 | | - </Button>, |
138 | | - <Button key="cancel" variant="link" onClick={(e) => toggleModal(e, false)}> |
139 | | - Cancel |
140 | | - </Button>, |
141 | | - ], |
142 | | - })} |
143 | 122 | > |
144 | | - {isTabbed ? ( |
145 | | - <Tabs activeKey={this.state.activeTabKey} onSelect={this.handleTabClick}> |
146 | | - {tabNames.map((item, key) => ( |
147 | | - <Tab key={key} eventKey={key} title={<TabTitleText>All {item}</TabTitleText>}> |
148 | | - {this.renderTable( |
149 | | - rows?.[key] as IRow[], |
150 | | - columns?.[key] as ICell[], |
151 | | - (pagination as TableWithFilterPagination[])?.[key], |
152 | | - (loaded as boolean[])?.[key], |
153 | | - (filters as ConditionalFilterItem[][])?.[key], |
154 | | - (selected as IRow[][])?.[key], |
155 | | - (onSelect as unknown as ((selected?: IRow[]) => void)[])?.[key], |
156 | | - (onUpdateData as unknown as ((pagination: TableWithFilterPagination) => number)[])?.[key], |
157 | | - (bulkSelect as BulkSelectProps[])?.[key] |
158 | | - )} |
159 | | - </Tab> |
160 | | - ))} |
161 | | - </Tabs> |
162 | | - ) : ( |
163 | | - this.renderTable( |
164 | | - rows, |
165 | | - columns as ICell[], |
166 | | - pagination as TableWithFilterPagination, |
167 | | - loaded as boolean, |
168 | | - filters as ConditionalFilterItem[], |
169 | | - selected as IRow[], |
170 | | - onSelect as TableWithFilterProps['onSelect'], |
171 | | - onUpdateData as TableWithFilterProps['onUpdateData'], |
172 | | - bulkSelect as BulkSelectProps |
173 | | - ) |
174 | | - )} |
| 123 | + <ModalHeader title={title || `Tags for ${systemName}`} /> |
| 124 | + <ModalBody> |
| 125 | + {isTabbed ? ( |
| 126 | + <Tabs activeKey={this.state.activeTabKey} onSelect={this.handleTabClick}> |
| 127 | + {tabNames.map((item, key) => ( |
| 128 | + <Tab key={key} eventKey={key} title={<TabTitleText>All {item}</TabTitleText>}> |
| 129 | + {this.renderTable( |
| 130 | + rows?.[key] as IRow[], |
| 131 | + columns?.[key] as ICell[], |
| 132 | + (pagination as TableWithFilterPagination[])?.[key], |
| 133 | + (loaded as boolean[])?.[key], |
| 134 | + (filters as ConditionalFilterItem[][])?.[key], |
| 135 | + (selected as IRow[][])?.[key], |
| 136 | + (onSelect as unknown as ((selected?: IRow[]) => void)[])?.[key], |
| 137 | + (onUpdateData as unknown as ((pagination: TableWithFilterPagination) => number)[])?.[key], |
| 138 | + (bulkSelect as BulkSelectProps[])?.[key] |
| 139 | + )} |
| 140 | + </Tab> |
| 141 | + ))} |
| 142 | + </Tabs> |
| 143 | + ) : ( |
| 144 | + this.renderTable( |
| 145 | + rows, |
| 146 | + columns as ICell[], |
| 147 | + pagination as TableWithFilterPagination, |
| 148 | + loaded as boolean, |
| 149 | + filters as ConditionalFilterItem[], |
| 150 | + selected as IRow[], |
| 151 | + onSelect as TableWithFilterProps['onSelect'], |
| 152 | + onUpdateData as TableWithFilterProps['onUpdateData'], |
| 153 | + bulkSelect as BulkSelectProps |
| 154 | + ) |
| 155 | + )} |
| 156 | + </ModalBody> |
| 157 | + <ModalFooter> |
| 158 | + {onApply && ( |
| 159 | + <> |
| 160 | + <Button |
| 161 | + key="confirm" |
| 162 | + variant="primary" |
| 163 | + isDisabled={ |
| 164 | + isTabbed ? Object.values(selected || {}).every((values) => !values || values?.length === 0) : !selected || selected?.length === 0 |
| 165 | + } |
| 166 | + onClick={(e) => { |
| 167 | + onApply(); |
| 168 | + toggleModal(e, true); |
| 169 | + }} |
| 170 | + > |
| 171 | + Apply {isTabbed ? 'selected' : 'tags'} |
| 172 | + </Button> |
| 173 | + <Button key="cancel" variant="link" onClick={(e) => toggleModal(e, false)}> |
| 174 | + Cancel |
| 175 | + </Button> |
| 176 | + </> |
| 177 | + )} |
| 178 | + </ModalFooter> |
175 | 179 | </Modal> |
176 | 180 | ); |
177 | 181 | } |
|
0 commit comments