Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
小 白蛋
Headlamp
Commits
10e1ac37
Commit
10e1ac37
authored
2 years ago
by
Joaquim Rocha
Browse files
Options
Download
Email Patches
Plain Diff
frontend: Add endpoints list to Service details
parent
d3f1dd48
test-cleanup
action-button-improvements
add-notification-page
apply-multiple-resources
autoscalers_resource_quota
backend-dependencies
bump-chocolatey-0.13.0
de-de
dependabot/npm_and_yarn/frontend/deep-object-diff-1.1.9
dependabot/npm_and_yarn/frontend/loader-utils-1.4.2
dont-wrap-header-cells
e2e-login
errcb-fix
fetch-pods-by-labels
fix-crash-in-label-selector
fix_manual_trigger_gh_action
fr-fr
go-back-through-location-stack
improve-pod-status
localefix
optimize-use-get
persist-url-params
plugin-source
port-forwarding
rc-0.13.0
render-logs-using-xterm
simple-table-details-from-url
v0.13.0
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
frontend/src/components/service/Details.tsx
+56
-25
frontend/src/components/service/Details.tsx
with
56 additions
and
25 deletions
+56
-25
frontend/src/components/service/Details.tsx
+
56
-
25
View file @
10e1ac37
...
...
@@ -3,7 +3,10 @@ import _ from 'lodash';
import
React
from
'
react
'
;
import
{
useTranslation
}
from
'
react-i18next
'
;
import
{
useParams
}
from
'
react-router-dom
'
;
import
Endpoints
from
'
../../lib/k8s/endpoints
'
;
import
Service
from
'
../../lib/k8s/service
'
;
import
{
Link
}
from
'
../common
'
;
import
Empty
from
'
../common/EmptyContent
'
;
import
{
ValueLabel
}
from
'
../common/Label
'
;
import
{
DetailsGrid
,
MetadataDictGrid
}
from
'
../common/Resource
'
;
import
{
SectionBox
}
from
'
../common/SectionBox
'
;
...
...
@@ -13,6 +16,12 @@ export default function ServiceDetails() {
const
{
namespace
,
name
}
=
useParams
<
{
namespace
:
string
;
name
:
string
}
>
();
const
{
t
}
=
useTranslation
(
'
glossary
'
);
const
[
endpoints
,
endpointsError
]
=
Endpoints
.
useList
({
namespace
});
function
getOwnedEndpoints
(
item
:
Service
)
{
return
item
?
endpoints
?.
filter
(
endpoint
=>
endpoint
.
getName
()
===
item
.
getName
())
:
null
;
}
return
(
<
DetailsGrid
resourceType
=
{
Service
}
...
...
@@ -41,31 +50,53 @@ export default function ServiceDetails() {
}
sectionsFunc
=
{
item
=>
item
&&
(
<
SectionBox
title
=
{
t
(
'
Ports
'
)
}
>
<
SimpleTable
data
=
{
item
.
spec
.
ports
}
columns
=
{
[
{
label
:
t
(
'
Protocol
'
),
datum
:
'
protocol
'
,
},
{
label
:
t
(
'
frequent|Name
'
),
datum
:
'
name
'
,
},
{
label
:
t
(
'
Ports
'
),
getter
:
({
port
,
targetPort
})
=>
(
<
React
.
Fragment
>
<
ValueLabel
>
{
port
}
</
ValueLabel
>
<
InlineIcon
icon
=
"mdi:chevron-right"
/>
<
ValueLabel
>
{
targetPort
}
</
ValueLabel
>
</
React
.
Fragment
>
),
},
]
}
/>
</
SectionBox
>
<>
<
SectionBox
title
=
{
t
(
'
Ports
'
)
}
>
<
SimpleTable
data
=
{
item
.
spec
.
ports
}
columns
=
{
[
{
label
:
t
(
'
Protocol
'
),
datum
:
'
protocol
'
,
},
{
label
:
t
(
'
frequent|Name
'
),
datum
:
'
name
'
,
},
{
label
:
t
(
'
Ports
'
),
getter
:
({
port
,
targetPort
})
=>
(
<
React
.
Fragment
>
<
ValueLabel
>
{
port
}
</
ValueLabel
>
<
InlineIcon
icon
=
"mdi:chevron-right"
/>
<
ValueLabel
>
{
targetPort
}
</
ValueLabel
>
</
React
.
Fragment
>
),
},
]
}
/>
</
SectionBox
>
<
SectionBox
title
=
{
t
(
'
Endpoints
'
)
}
>
{
endpointsError
?
(
<
Empty
color
=
"error"
>
{
endpointsError
}
</
Empty
>
)
:
(
<
SimpleTable
data
=
{
getOwnedEndpoints
(
item
)
}
columns
=
{
[
{
label
:
t
(
'
Name
'
),
getter
:
endpoint
=>
<
Link
kubeObject
=
{
endpoint
}
/>,
},
{
label
:
t
(
'
Addresses
'
),
getter
:
endpoint
=>
endpoint
.
getAddressesText
(),
cellProps
:
{
style
:
{
width
:
'
40%
'
,
maxWidth
:
'
40%
'
}
},
},
]
}
/>
)
}
</
SectionBox
>
</>
)
}
/>
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Projects
Groups
Snippets
Help