Skip to content

Commit

Permalink
fix: display only active endpoints in EndpointSelect
Browse files Browse the repository at this point in the history
  • Loading branch information
yomybaby committed Sep 23, 2024
1 parent 8570e41 commit 26d226b
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions react/src/components/EndpointSelect.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { useSuspendedBackendaiClient } from '../hooks';
import { useBAIPaginationOptionState } from '../hooks/reactPaginationQueryOptions';
import {
EndpointSelectQuery,
Expand All @@ -22,14 +23,25 @@ const EndpointSelect: React.FC<EndpointSelectProps> = ({
fetchKey,
...selectProps
}) => {
const baiClient = useSuspendedBackendaiClient();
const { baiPaginationOption } = useBAIPaginationOptionState({
current: 1,
pageSize: 100,
});
const { endpoint_list } = useLazyLoadQuery<EndpointSelectQuery>(
graphql`
query EndpointSelectQuery($offset: Int!, $limit: Int!, $projectID: UUID) {
endpoint_list(offset: $offset, limit: $limit, project: $projectID) {
query EndpointSelectQuery(
$offset: Int!
$limit: Int!
$projectID: UUID
$filter: String
) {
endpoint_list(
offset: $offset
limit: $limit
project: $projectID
filter: $filter
) {
total_count
items {
name
Expand All @@ -43,6 +55,9 @@ const EndpointSelect: React.FC<EndpointSelectProps> = ({
{
limit: baiPaginationOption.limit,
offset: baiPaginationOption.offset,
filter: baiClient.supports('endpoint-lifecycle-stage-filter')
? `lifecycle_stage == "created"`
: undefined,
},
{
fetchKey: fetchKey,
Expand Down

0 comments on commit 26d226b

Please sign in to comment.