Skip to content

Commit 31e23b7

Browse files
author
Sergiu Miclea
committed
Links to replica in endpoint details page
The 'USED IN REPLICAS/MIGRATIONS' field found in the endpoint details page, now contains links to each replica / migration.
1 parent 737e207 commit 31e23b7

1 file changed

Lines changed: 20 additions & 1 deletion

File tree

  • src/components/organisms/EndpointDetailsContent

src/components/organisms/EndpointDetailsContent/index.jsx

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,11 @@ const LoadingWrapper = styled.div`
7474
width: 100%;
7575
margin: 32px 0 64px 0;
7676
`
77+
const Link = styled.a`
78+
color: ${Palette.primary};
79+
text-decoration: none;
80+
cursor: pointer;
81+
`
7782

7883
type Props = {
7984
item: ?Endpoint,
@@ -165,6 +170,20 @@ class EndpointDetailsContent extends React.Component<Props> {
165170
return <CopyValue data-test-id={dataTestId ? `edContent-${dataTestId}` : undefined} value={value} maxWidth="90%" />
166171
}
167172

173+
renderUsage(items: MainItem[]) {
174+
return items.map((item, i) => (
175+
<span>
176+
<Link
177+
key={item.id}
178+
href={`#/${item.type}/${item.id}`}
179+
>
180+
{item.instances.join(', ')}
181+
</Link>
182+
{i < items.length - 1 ? ', ' : ''}
183+
</span>
184+
))
185+
}
186+
168187
render() {
169188
this.renderedKeys = {}
170189
const { type, name, description, created_at } = this.props.item || {}
@@ -192,7 +211,7 @@ class EndpointDetailsContent extends React.Component<Props> {
192211
</Field>
193212
<Field>
194213
<Label>Used in replicas/migrations ({usage.length})</Label>
195-
{usage.length > 0 ? <CopyMultilineValue value={usage.map(i => i.instances.join(', ')).join(', ')} /> : <Value>-</Value>}
214+
{usage.length > 0 ? this.renderUsage(usage) : <Value>-</Value>}
196215
</Field>
197216
{this.renderConnectionInfoLoading()}
198217
{this.renderConnectionInfo(this.props.connectionInfo)}

0 commit comments

Comments
 (0)