Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: compatibility for lifecycle filter of Endpoint #2691

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 33 additions & 27 deletions react/src/pages/EndpointListPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,18 @@ const EndpointListPage: React.FC<PropsWithChildren> = ({ children }) => {
const isPendingPaginationAndFilter =
selectedLifecycleStage !== deferredSelectedLifecycleStage ||
paginationState !== deferredPaginationState;
const lifecycleStageFilter =
deferredSelectedLifecycleStage === 'created&destroying'
? `lifecycle_stage == "created" | lifecycle_stage == "destroying"`
: `lifecycle_stage == "${deferredSelectedLifecycleStage}"`;

const [isRefetchPending, startRefetchTransition] = useTransition();
const [servicesFetchKey, updateServicesFetchKey] =
useUpdatableState('initial-fetch');
const [optimisticDeletingId, setOptimisticDeletingId] = useState<
string | null
>();

const [currentUser] = useCurrentUserInfo();

// const [selectedGeneration, setSelectedGeneration] = useState<
Expand Down Expand Up @@ -360,10 +365,9 @@ const EndpointListPage: React.FC<PropsWithChildren> = ({ children }) => {
deferredPaginationState.pageSize,
limit: deferredPaginationState.pageSize,
projectID: curProject.id,
filter:
deferredSelectedLifecycleStage === 'created&destroying'
? `lifecycle_stage == "created" | lifecycle_stage == "destroying"`
: `lifecycle_stage == "${deferredSelectedLifecycleStage}"`,
filter: baiClient.supports('endpoint-lifecycle-stage-filter')
? lifecycleStageFilter
: undefined,
},
{
fetchPolicy: 'network-only',
Expand Down Expand Up @@ -411,29 +415,31 @@ const EndpointListPage: React.FC<PropsWithChildren> = ({ children }) => {
}}
>
<Flex direction="column" align="start">
<Radio.Group
value={selectedLifecycleStage}
onChange={(e) => {
setSelectedLifecycleStage(e.target?.value);
// reset pagination state when filter changes
setPaginationState({
current: 1,
pageSize: paginationState.pageSize,
});
}}
optionType="button"
buttonStyle="solid"
options={[
{
label: 'Active',
value: 'created&destroying',
},
{
label: 'Destroyed',
value: 'destroyed',
},
]}
/>
{baiClient.supports('endpoint-lifecycle-stage-filter') && (
<Radio.Group
value={selectedLifecycleStage}
onChange={(e) => {
setSelectedLifecycleStage(e.target?.value);
// reset pagination state when filter changes
setPaginationState({
current: 1,
pageSize: paginationState.pageSize,
});
}}
optionType="button"
buttonStyle="solid"
options={[
{
label: 'Active',
value: 'created&destroying',
},
{
label: 'Destroyed',
value: 'destroyed',
},
]}
/>
)}
</Flex>
<Flex direction="row" gap={'xs'} wrap="wrap" style={{ flexShrink: 1 }}>
<Flex gap={'xs'}>
Expand Down
4 changes: 4 additions & 0 deletions src/lib/backend.ai-client-esm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -710,6 +710,10 @@ class Client {
if (this.isManagerVersionCompatibleWith('24.03.7')) {
this._features['per-kernel-logs'] = true;
}
// ignore next alpha version
if(this.isManagerVersionCompatibleWith(['24.03.10'])) {
this._features['endpoint-lifecycle-stage-filter'] = true;
}
if (this.isManagerVersionCompatibleWith('24.09')) {
this._features['extend-login-session'] = true;
}
Expand Down
Loading