Skip to content

Commit be0b052

Browse files
feat(FeedSourceTableRow): show labels of feed source
1 parent 3121b7f commit be0b052

File tree

5 files changed

+31
-6
lines changed

5 files changed

+31
-6
lines changed
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ const getComplementaryColor = (cssHex, strength) => {
1111
}
1212

1313
export default function Label (props) {
14-
const { name, color } = props
14+
const { name, color, small } = props
1515

1616
return (
1717
<span
18-
className='feedLabel'
18+
className={`feedLabel ${small ? 'small' : ''}`}
1919
style={{
2020
backgroundColor: color,
2121
color: getComplementaryColor(color, 45),

lib/manager/components/FeedSourceTableRow.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import {abbreviate, isValidZipFile} from '../../common/util/util'
2525
import ConfirmModal from '../../common/components/ConfirmModal'
2626
import SelectFileModal from '../../common/components/SelectFileModal'
2727
import WatchButton from '../../common/containers/WatchButton'
28-
28+
import FeedLabel from '../../common/components/FeedLabel'
2929
import type {Props as ContainerProps} from '../containers/FeedSourceTableRow'
3030
import type {Feed, ValidationSummary} from '../../types'
3131
import type {
@@ -266,6 +266,15 @@ class FeedInfo extends PureComponent<{ feedSource: Feed }> {
266266
<Icon type={feedSource.isPublic ? 'globe' : 'lock'} />
267267
{feedSource.isPublic ? 'Public' : 'Private'}
268268
</Col>
269+
{feedSource.labels.length > 0 &&
270+
<Col xs={12}>
271+
<div className='feedSourceLabelRow'>
272+
<Icon type={'tag'} />
273+
<div className='feedLabelContainer'>
274+
{feedSource.labels.map(label => <FeedLabel small key={label.id} {...label} />)}
275+
</div>
276+
</div>
277+
</Col>}
269278
</Row>
270279
</div>
271280
)

lib/manager/components/ProjectViewer.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ import WatchButton from '../../common/containers/WatchButton'
2727
import {getComponentMessages, getConfigProperty, isModuleEnabled} from '../../common/util/config'
2828
import DeploymentsPanel from '../containers/DeploymentsPanel'
2929
import FeedSourceTable from '../containers/FeedSourceTable'
30-
import Label from '../../common/components/Label'
30+
import Label from '../../common/components/FeedLabel'
3131
import type {Props as ContainerProps} from '../containers/ActiveProjectViewer'
3232
import type {Feed, Project} from '../../types'
3333
import type {ManagerUserState} from '../../types/reducers'

lib/style.css

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,8 +147,14 @@ td.feed-source-info {
147147
.feedLabelContainer {
148148
display: grid;
149149
grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
150-
gap: 10px;
150+
grid-gap: 5px;
151151
grid-auto-flow: dense;
152+
width: 100%;
153+
}
154+
.feedSourceLabelRow {
155+
display: inline-flex;
156+
width: 100%;
157+
align-items: baseline;
152158
}
153159
.feedLabel {
154160
display: inline-block;
@@ -163,6 +169,9 @@ td.feed-source-info {
163169

164170
padding: 5px;
165171
}
172+
.feedLabel.small {
173+
padding: 2.5px;
174+
}
166175

167176
/* Feed transformation substitution styling */
168177
.substitution-row td {

lib/types/index.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import {
77
FETCH_FREQUENCIES,
88
RETRIEVAL_METHODS
99
} from '../common/constants'
10-
1110
import type UserPermissions from '../common/user/UserPermissions'
1211

1312
type InputType =
@@ -385,6 +384,7 @@ export type Feed = {
385384
id: string,
386385
isCreating?: boolean,
387386
isPublic: boolean,
387+
labels: Array<Label>,
388388
lastFetched?: ?number,
389389
lastUpdated?: number,
390390
latestValidation?: ValidationSummary,
@@ -522,6 +522,13 @@ export type FeedVersion = {|
522522
version: number
523523
|}
524524

525+
export type Label = {
526+
color: string,
527+
description: string,
528+
id: string,
529+
name: string
530+
}
531+
525532
// TODO: Remove this eslint rule once https://github.com/babel/babel-eslint/pull/584
526533
// is merged in.
527534
/* eslint-enable no-use-before-define */

0 commit comments

Comments
 (0)