-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
New interface for displaying and editing pipeline configuration.
- Loading branch information
1 parent
f5cfaad
commit cf9eebf
Showing
26 changed files
with
1,962 additions
and
246 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import BoxForm, { newBoxInitialData } from './BoxForm'; | ||
export { newBoxInitialData }; | ||
export default BoxForm; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import { injectIntl, FormattedMessage } from 'react-intl'; | ||
import { Table } from 'react-bootstrap'; | ||
import { defaultMemoize } from 'reselect'; | ||
|
||
import BoxesTableRow from './BoxesTableRow'; | ||
import { arrayToObject } from '../../../helpers/common'; | ||
|
||
const prepareSelectionIndex = defaultMemoize( | ||
selections => | ||
selections && | ||
arrayToObject( | ||
selections, | ||
x => x, | ||
() => true | ||
) | ||
); | ||
|
||
const BoxesTable = ({ | ||
boxes, | ||
variables = null, | ||
secondarySelections = null, | ||
selectedVariable = null, | ||
removeBox = null, | ||
intl: { locale }, | ||
...rowProps | ||
}) => { | ||
const selectionIndex = secondarySelections && prepareSelectionIndex(secondarySelections); | ||
const variable = selectedVariable && variables && variables.find(v => v.name === selectedVariable); | ||
return ( | ||
<Table className={boxes.length > 0 ? 'tbody-hover' : ''} size="sm"> | ||
<thead> | ||
<tr> | ||
<th> | ||
<FormattedMessage id="app.pipelines.boxesTable.name" defaultMessage="Name" /> | ||
</th> | ||
<th> | ||
<FormattedMessage id="app.pipelines.boxesTable.boxType" defaultMessage="Box Type" /> | ||
</th> | ||
<th colSpan={2}> | ||
<FormattedMessage id="app.pipelines.boxesTable.port" defaultMessage="Port" /> | ||
</th> | ||
<th> | ||
<FormattedMessage id="app.pipelines.boxesTable.portType" defaultMessage="Data Type" /> | ||
</th> | ||
<th> | ||
<FormattedMessage id="app.pipelines.boxesTable.variable" defaultMessage="Variable" /> | ||
</th> | ||
<th /> | ||
{removeBox && <th />} | ||
</tr> | ||
</thead> | ||
|
||
{boxes | ||
.sort((a, b) => a.name.localeCompare(b.name, locale)) | ||
.map(box => ( | ||
<BoxesTableRow | ||
key={box.name} | ||
box={box} | ||
variables={variables} | ||
selectedVariable={variable} | ||
secondarySelections={selectionIndex} | ||
removeBox={removeBox} | ||
{...rowProps} | ||
/> | ||
))} | ||
|
||
{boxes.length === 0 && ( | ||
<tbody> | ||
<tr> | ||
<td colSpan={7} className="text-center text-muted small"> | ||
<em> | ||
<FormattedMessage | ||
id="app.pipelines.boxesTable.noBoxes" | ||
defaultMessage="There are no boxes in the pipeline." | ||
/> | ||
</em> | ||
</td> | ||
</tr> | ||
</tbody> | ||
)} | ||
</Table> | ||
); | ||
}; | ||
|
||
BoxesTable.propTypes = { | ||
boxes: PropTypes.array.isRequired, | ||
variables: PropTypes.array, | ||
removeBox: PropTypes.func, | ||
secondarySelections: PropTypes.array, | ||
selectedVariable: PropTypes.string, | ||
intl: PropTypes.shape({ locale: PropTypes.string.isRequired }).isRequired, | ||
}; | ||
|
||
export default injectIntl(BoxesTable); |
Oops, something went wrong.