Skip to content

Commit 93b0e10

Browse files
committed
feat(FR-2107): add version gate for model try content button (#5497)
Resolves #5496 ([FR-2107](https://lablup.atlassian.net/browse/FR-2107)) ## Summary - Add `model-try-content-button` feature flag for manager version >= 26.0.0 - Conditionally render the "Try Content" button in ModelCardModal based on version support ## Test plan - [ ] Verify the "Try Content" button appears on manager >= 26.0.0 - [ ] Verify the "Try Content" button is hidden on manager < 26.0.0 - [ ] Verify no regression in Model Card modal functionality [FR-2107]: https://lablup.atlassian.net/browse/FR-2107?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
1 parent 132c6e5 commit 93b0e10

2 files changed

Lines changed: 24 additions & 15 deletions

File tree

react/src/components/ModelCardModal.tsx

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@
33
Copyright (c) 2015-2026 Lablup Inc. All rights reserved.
44
*/
55
import { ModelCardModalFragment$key } from '../__generated__/ModelCardModalFragment.graphql';
6-
import { useBackendAIImageMetaData } from '../hooks';
6+
import {
7+
useBackendAIImageMetaData,
8+
useSuspendedBackendaiClient,
9+
} from '../hooks';
710
import { useModelCardMetadata } from '../hooks/useModelCardMetadata';
811
import ErrorBoundaryWithNullFallback from './ErrorBoundaryWithNullFallback';
912
import { useFolderExplorerOpener } from './FolderExplorerOpener';
@@ -54,6 +57,7 @@ const ModelCardModal: React.FC<ModelCardModalProps> = ({
5457
}) => {
5558
const { t } = useTranslation();
5659
const { token } = theme.useToken();
60+
const baiClient = useSuspendedBackendaiClient();
5761

5862
const [visibleCloneModal, setVisibleCloneModal] = useState(false);
5963

@@ -137,20 +141,22 @@ const ModelCardModal: React.FC<ModelCardModalProps> = ({
137141
: '90%'
138142
}
139143
footer={[
140-
// This button is used to clone-and-create/create the model service with the content of the model card.
141-
<ErrorBoundaryWithNullFallback key="model-try-content-button">
142-
<Suspense
143-
fallback={
144-
<Tooltip title={t('modelStore.CheckingSettings')}>
145-
<Button loading disabled />
146-
</Tooltip>
147-
}
148-
>
149-
<ModelTryContentButton
150-
vfolderNode={model_card?.vfolder_node || null}
151-
/>
152-
</Suspense>
153-
</ErrorBoundaryWithNullFallback>,
144+
baiClient.supports('model-try-content-button') && (
145+
// This button is used to clone-and-create/create the model service with the content of the model card.
146+
<ErrorBoundaryWithNullFallback key="model-try-content-button">
147+
<Suspense
148+
fallback={
149+
<Tooltip title={t('modelStore.CheckingSettings')}>
150+
<Button loading disabled />
151+
</Tooltip>
152+
}
153+
>
154+
<ModelTryContentButton
155+
vfolderNode={model_card?.vfolder_node || null}
156+
/>
157+
</Suspense>
158+
</ErrorBoundaryWithNullFallback>
159+
),
154160
<Button
155161
key="clone"
156162
type="primary"

src/lib/backend.ai-client-esm.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -877,6 +877,9 @@ class Client {
877877
if (this.isManagerVersionCompatibleWith('25.18.2')) {
878878
this._features['allow-only-ro-permission-for-model-project-folder'] = true;
879879
}
880+
if (this.isManagerVersionCompatibleWith('26.1.0')) {
881+
this._features['model-try-content-button'] = true;
882+
}
880883
if (this.isManagerVersionCompatibleWith('26.1.0')) {
881884
this._features['admin-resource-group-select'] = true;
882885
}

0 commit comments

Comments
 (0)