Skip to content

Commit f33bb54

Browse files
committed
refactor(FR-583): Remove compatibility before manager version 24.09 (#3906)
resolves #3236 ([FR-583](https://lablup.atlassian.net/jira/software/projects/FR/boards/21?assignee=712020%3A52c9a410-dfd2-4acd-97a6-8c6112ec8a34&selectedIssue=FR-583)) <!-- replace NNN, MMM with the GitHub issue number and the corresponding Jira issue number. --> <!-- Please precisely, concisely, and concretely describe what this PR changes, the rationale behind codes, and how it affects the users and other developers. --> This PR removes feature flag checks before manager version 24.09. The changes include: - Removed conditional rendering based on `baiClient.supports()` checks - Eliminated version compatibility checks in the backend client - Removed feature-gated UI elements that were conditionally displayed - Updated the API version to v8.20240915 for compatibility with 24.09 - Simplified logic that previously had different behavior based on manager version These changes make the codebase more maintainable by removing the need to check for feature support before using functionality, assuming that all modern deployments will support the full feature set. **Checklist:** (if applicable) - [ ] Documentation - [ ] Minium required manager version - [ ] Specific setting for review (eg., KB link, endpoint or how to setup) - [ ] Minimum requirements to check during review - [ ] Test case(s) to demonstrate the difference of before/after [FR-583]: https://lablup.atlassian.net/browse/FR-583?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
1 parent 3c5cc4a commit f33bb54

41 files changed

Lines changed: 691 additions & 1173 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

react/src/components/Chat/EndpointSelect.tsx

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import {
33
EndpointSelectQuery$data,
44
} from '../../__generated__/EndpointSelectQuery.graphql';
55
import { EndpointSelectValueQuery } from '../../__generated__/EndpointSelectValueQuery.graphql';
6-
import { useSuspendedBackendaiClient } from '../../hooks';
76
import { useLazyPaginatedQuery } from '../../hooks/usePaginatedQuery';
87
import BAILink from '../BAILink';
98
import BAISelect from '../BAISelect';
@@ -36,7 +35,6 @@ const EndpointSelect: React.FC<EndpointSelectProps> = ({
3635
...selectPropsWithoutLoading
3736
}) => {
3837
const { t } = useTranslation();
39-
const baiClient = useSuspendedBackendaiClient();
4038
const [controllableValue, setControllableValue] = useControllableValue<
4139
string | undefined
4240
>(selectPropsWithoutLoading);
@@ -114,17 +112,13 @@ const EndpointSelect: React.FC<EndpointSelectProps> = ({
114112
limit: 10,
115113
},
116114
{
117-
filter: baiClient.supports('endpoint-lifecycle-stage-filter')
118-
? [
119-
lifecycleStageFilterStr,
120-
deferredSearchStr
121-
? `name ilike "%${deferredSearchStr}%"`
122-
: undefined,
123-
]
124-
.filter(Boolean)
125-
.map((v) => `(${v})`)
126-
.join(' & ')
127-
: undefined,
115+
filter: [
116+
lifecycleStageFilterStr,
117+
deferredSearchStr ? `name ilike "%${deferredSearchStr}%"` : undefined,
118+
]
119+
.filter(Boolean)
120+
.map((v) => `(${v})`)
121+
.join(' & '),
128122
},
129123
// TODO: skip fetch when the option popover is closed
130124
{

react/src/components/ComputeSessionNodeItems/ContainerLogModal.tsx

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -99,23 +99,6 @@ const ContainerLogModal: React.FC<ContainerLogModalProps> = ({
9999
staleTime: 5000,
100100
});
101101

102-
// let queryParams: Array<string> = [];
103-
// if (session?.access_key != null) {
104-
// queryParams.push(`owner_access_key=${session.access_key}`);
105-
// }
106-
// if (baiClient.supports('per-kernel-logs') && selectedKernelId !== null) {
107-
// queryParams.push(`kernel_id=${selectedKernelId}`);
108-
// }
109-
// let queryString = `/session/${session?.row_id}/logs`;
110-
// if (queryParams.length > 0) {
111-
// queryString += `?${queryParams.join('&')}`;
112-
// }
113-
// // const url = `${baiClient._endpoint}${queryString}`
114-
115-
// const signed = baiClient.newSignedRequest('GET', queryString, null);
116-
// console.log(signed)
117-
// console.log(signed.uri);
118-
119102
const [lastLineNumbers, { resetPrevious: resetPreviousLineNumber }] =
120103
useMemoWithPrevious(() => logs?.split('\n').length || 0, [logs]);
121104

react/src/components/ComputeSessionNodeItems/SessionActionButtons.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,6 @@ const SessionActionButtons: React.FC<SessionActionButtonsProps> = (props) => {
162162
<Tooltip title={t('session.RequestContainerCommit')}>
163163
<Button
164164
disabled={
165-
!baiClient.supports('image-commit') ||
166165
!baiClient._config.enableContainerCommit ||
167166
session.type === 'system' ||
168167
!isActive(session) ||

react/src/components/ContainerRegistryEditorModal.tsx

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,7 @@ const ContainerRegistryEditorModal: React.FC<
4848
const { message, modal } = App.useApp();
4949

5050
const baiClient = useSuspendedBackendaiClient();
51-
const isSupportExtraField =
52-
baiClient.isManagerVersionCompatibleWith('24.09.3');
51+
const isSupportExtraField = baiClient.supports('extra-field');
5352

5453
const formRef = useRef<FormInstance<RegistryFormInput>>(null);
5554

@@ -451,8 +450,7 @@ const ContainerRegistryEditorModal: React.FC<
451450

452451
function useCreateContainerMutation() {
453452
const baiClient = useSuspendedBackendaiClient();
454-
const isSupportExtraField =
455-
baiClient.isManagerVersionCompatibleWith('24.09.3');
453+
const isSupportExtraField = baiClient.supports('extra-field');
456454
const [commitCreateRegistry, isInflightCreateRegistry] =
457455
useMutation<ContainerRegistryEditorModalCreateMutation>(graphql`
458456
mutation ContainerRegistryEditorModalCreateMutation(
@@ -529,8 +527,7 @@ function useCreateContainerMutation() {
529527

530528
function useModifyContainerMutation() {
531529
const baiClient = useSuspendedBackendaiClient();
532-
const isSupportExtraField =
533-
baiClient.isManagerVersionCompatibleWith('24.09.3');
530+
const isSupportExtraField = baiClient.supports('extra-field');
534531

535532
const [commitModifyRegistry, isInflightModifyRegistry] =
536533
useMutation<ContainerRegistryEditorModalModifyMutation>(graphql`

react/src/components/EndpointOwnerInfo.tsx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { EndpointOwnerInfoFragment$key } from '../__generated__/EndpointOwnerInfoFragment.graphql';
2-
import { useSuspendedBackendaiClient } from '../hooks';
32
import { QuestionCircleOutlined } from '@ant-design/icons';
43
import { Button, Tooltip, theme } from 'antd';
54
import React from 'react';
@@ -14,7 +13,6 @@ const EndpointOwnerInfo: React.FC<EndpointOwnerInfoProps> = ({
1413
}) => {
1514
const { t } = useTranslation();
1615
const { token } = theme.useToken();
17-
const baiClient = useSuspendedBackendaiClient();
1816

1917
const endpoint = useFragment(
2018
graphql`
@@ -27,8 +25,6 @@ const EndpointOwnerInfo: React.FC<EndpointOwnerInfoProps> = ({
2725
endpointFrgmt,
2826
);
2927

30-
if (!baiClient.supports('model-serving-endpoint-user-info'))
31-
return baiClient.email || '';
3228
if (endpoint?.created_user_email === endpoint?.session_owner_email)
3329
return endpoint?.session_owner_email || '';
3430
else

react/src/components/FolderInvitationResponseModal.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ const FolderInvitationResponseModal: React.FC<
2626
const { invitations } = useVFolderInvitationsValue();
2727
const { acceptInvitation, rejectInvitation } = useSetVFolderInvitations();
2828
const baiClient = useSuspendedBackendaiClient();
29-
const hasInviterEmail = baiClient.isManagerVersionCompatibleWith('25.6.0');
29+
const hasInviterEmail = baiClient.supports('invitation-inviter-email');
3030

3131
// Memoize invitations to prevent unnecessary re-renders
3232
const memoizedInvitations = React.useMemo(() => invitations, [invitations]);

react/src/components/ImageNodeSimpleTag.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,7 @@ const ImageNodeSimpleTag: React.FC<ImageNodeSimpleTagProps> = ({
5252

5353
const fullName = `${image.registry}/${image.namespace}:${image.tag}@${image.architecture}`;
5454
const legacyFullImageString = `${image.registry}/${image.name}:${image.tag}@${image.architecture}`;
55-
const isSupportBaseImageName =
56-
baiClient.isManagerVersionCompatibleWith('24.12.0');
55+
const isSupportBaseImageName = baiClient.supports('base-image-name');
5756

5857
return isSupportBaseImageName ? (
5958
<>

react/src/components/KeypairResourcePolicyInfoModal.tsx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { KeypairResourcePolicyInfoModalFragment$key } from '../__generated__/KeypairResourcePolicyInfoModalFragment.graphql';
22
import { filterEmptyItem } from '../helper';
3-
import { useSuspendedBackendaiClient } from '../hooks';
43
import AllowedVfolderHostsWithPermission from './AllowedVfolderHostsWithPermission';
54
import BAIModal, { BAIModalProps } from './BAIModal';
65
import Flex from './Flex';
@@ -39,7 +38,6 @@ const KeypairResourcePolicyInfoModal: React.FC<InfoModalProps> = ({
3938
const { styles } = useStyles();
4039
const { t } = useTranslation();
4140
const { token } = theme.useToken();
42-
const baiClient = useSuspendedBackendaiClient();
4341

4442
const resourcePolicy = useFragment(
4543
graphql`
@@ -134,19 +132,19 @@ const KeypairResourcePolicyInfoModal: React.FC<InfoModalProps> = ({
134132
label: t('session.MaxSessionLifetime'),
135133
children: resourcePolicy?.max_session_lifetime || '∞',
136134
},
137-
baiClient?.supports('max-pending-session-count') && {
135+
{
138136
label: t('resourcePolicy.MaxPendingSessionCount'),
139137
children:
140138
_.isNull(resourcePolicy?.max_pending_session_count) ||
141139
_.isUndefined(resourcePolicy?.max_pending_session_count)
142140
? '∞'
143141
: resourcePolicy?.max_pending_session_count,
144142
},
145-
baiClient?.supports('max-concurrent-sftp-sessions') && {
143+
{
146144
label: t('resourcePolicy.MaxConcurrentSFTPSessions'),
147145
children: resourcePolicy?.max_concurrent_sftp_sessions || '∞',
148146
},
149-
baiClient?.supports('max-pending-session-resource-slots') && {
147+
{
150148
label: t('resourcePolicy.MaxPendingSessionResourceSlots'),
151149
children: resourcePolicy?.max_pending_session_resource_slots ? (
152150
!_.isEmpty(

react/src/components/KeypairResourcePolicyList.tsx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import {
1212
} from '../helper';
1313
import { SIGNED_32BIT_MAX_INT } from '../helper/const-vars';
1414
import { exportCSVWithFormattingRules } from '../helper/csv-util';
15-
import { useSuspendedBackendaiClient, useUpdatableState } from '../hooks';
15+
import { useUpdatableState } from '../hooks';
1616
import { useHiddenColumnKeysSetting } from '../hooks/useHiddenColumnKeysSetting';
1717
import AllowedVfolderHostsWithPermission from './AllowedVfolderHostsWithPermission';
1818
import BAITable from './BAITable';
@@ -66,8 +66,6 @@ const KeypairResourcePolicyList: React.FC<KeypairResourcePolicyListProps> = (
6666
const [isPendingInfoModalOpen, startInfoModalOpenTransition] =
6767
useTransition();
6868

69-
const baiClient = useSuspendedBackendaiClient();
70-
7169
const { keypair_resource_policies } =
7270
useLazyLoadQuery<KeypairResourcePolicyListQuery>(
7371
graphql`
@@ -200,7 +198,7 @@ const KeypairResourcePolicyList: React.FC<KeypairResourcePolicyListProps> = (
200198
);
201199
},
202200
},
203-
baiClient?.supports('max-pending-session-count') && {
201+
{
204202
title: t('resourcePolicy.MaxPendingSessionCount'),
205203
dataIndex: 'max_pending_session_count',
206204
key: 'max_pending_session_count',
@@ -212,7 +210,7 @@ const KeypairResourcePolicyList: React.FC<KeypairResourcePolicyListProps> = (
212210
),
213211
render: (text) => (text ? text : '∞'),
214212
},
215-
baiClient?.supports('max-concurrent-sftp-sessions') && {
213+
{
216214
title: t('resourcePolicy.MaxConcurrentSFTPSessions'),
217215
dataIndex: 'max_concurrent_sftp_sessions',
218216
key: 'max_concurrent_sftp_sessions',

react/src/components/KeypairResourcePolicySettingModal.tsx

Lines changed: 17 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,6 @@ const KeypairResourcePolicySettingModal: React.FC<
6161
const [resourceSlots] = useResourceSlots();
6262
const { mergedResourceSlots } = useResourceSlotsDetails();
6363
const baiClient = useSuspendedBackendaiClient();
64-
const isDeprecatedMaxVfolderCountInKeypairResourcePolicy =
65-
baiClient?.supports(
66-
'deprecated-max-vfolder-count-in-keypair-resource-policy',
67-
);
6864

6965
const keypairResourcePolicy = useFragment(
7066
graphql`
@@ -77,7 +73,6 @@ const KeypairResourcePolicySettingModal: React.FC<
7773
max_containers_per_session
7874
idle_timeout
7975
allowed_vfolder_hosts
80-
max_vfolder_count @deprecatedSince(version: "23.09.4")
8176
max_pending_session_count @since(version: "24.03.4")
8277
max_concurrent_sftp_sessions @since(version: "24.03.4")
8378
}
@@ -220,15 +215,6 @@ const KeypairResourcePolicySettingModal: React.FC<
220215
total_resource_slots: JSON.stringify(total_resource_slots),
221216
allowed_vfolder_hosts: JSON.stringify(allowed_vfolder_hosts),
222217
};
223-
if (!isDeprecatedMaxVfolderCountInKeypairResourcePolicy) {
224-
props.max_vfolder_count = values?.max_vfolder_count;
225-
}
226-
if (!baiClient.supports('max-pending-session-count')) {
227-
delete props?.max_pending_session_count;
228-
}
229-
if (!baiClient.supports('max-concurrent-sftp-sessions')) {
230-
delete props?.max_concurrent_sftp_sessions;
231-
}
232218

233219
if (keypairResourcePolicy === null) {
234220
commitCreateKeypairResourcePolicy({
@@ -553,26 +539,24 @@ const KeypairResourcePolicySettingModal: React.FC<
553539
/>
554540
</FormItemWithUnlimited>
555541
</Col>
556-
{baiClient.supports('max-concurrent-sftp-sessions') ? (
557-
<Col
558-
xs={{ span: 12 }}
559-
md={{ span: 8 }}
560-
style={{ alignSelf: 'end' }}
542+
<Col
543+
xs={{ span: 12 }}
544+
md={{ span: 8 }}
545+
style={{ alignSelf: 'end' }}
546+
>
547+
<FormItemWithUnlimited
548+
name={'max_concurrent_sftp_sessions'}
549+
unlimitedValue={0}
550+
label={t('resourcePolicy.MaxConcurrentSFTPSessions')}
551+
style={{ margin: 0, width: '100%' }}
561552
>
562-
<FormItemWithUnlimited
563-
name={'max_concurrent_sftp_sessions'}
564-
unlimitedValue={0}
565-
label={t('resourcePolicy.MaxConcurrentSFTPSessions')}
566-
style={{ margin: 0, width: '100%' }}
567-
>
568-
<InputNumber
569-
min={0}
570-
max={SIGNED_32BIT_MAX_INT}
571-
style={{ width: '100%' }}
572-
/>
573-
</FormItemWithUnlimited>
574-
</Col>
575-
) : null}
553+
<InputNumber
554+
min={0}
555+
max={SIGNED_32BIT_MAX_INT}
556+
style={{ width: '100%' }}
557+
/>
558+
</FormItemWithUnlimited>
559+
</Col>
576560
</Row>
577561
</Card>
578562
</Form.Item>
@@ -584,11 +568,6 @@ const KeypairResourcePolicySettingModal: React.FC<
584568
>
585569
<AllowedHostNamesSelect mode="multiple" />
586570
</Form.Item>
587-
{isDeprecatedMaxVfolderCountInKeypairResourcePolicy ? undefined : (
588-
<Form.Item label={t('credential.Max#')} name="max_vfolder_count">
589-
<InputNumber min={0} max={50} />
590-
</Form.Item>
591-
)}
592571
</Card>
593572
</Form.Item>
594573
</Form>

0 commit comments

Comments
 (0)