Skip to content

Commit dab8e6b

Browse files
agatha197yomybaby
authored andcommitted
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 9d9b5eb commit dab8e6b

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
@@ -1,5 +1,8 @@
11
import { ModelCardModalFragment$key } from '../__generated__/ModelCardModalFragment.graphql';
2-
import { useBackendAIImageMetaData } from '../hooks';
2+
import {
3+
useBackendAIImageMetaData,
4+
useSuspendedBackendaiClient,
5+
} from '../hooks';
36
import { useModelCardMetadata } from '../hooks/useModelCardMetadata';
47
import ErrorBoundaryWithNullFallback from './ErrorBoundaryWithNullFallback';
58
import { useFolderExplorerOpener } from './FolderExplorerOpener';
@@ -50,6 +53,7 @@ const ModelCardModal: React.FC<ModelCardModalProps> = ({
5053
}) => {
5154
const { t } = useTranslation();
5255
const { token } = theme.useToken();
56+
const baiClient = useSuspendedBackendaiClient();
5357

5458
const [visibleCloneModal, setVisibleCloneModal] = useState(false);
5559

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

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -841,6 +841,9 @@ class Client {
841841
if (this.isManagerVersionCompatibleWith('25.18.2')) {
842842
this._features['allow-only-ro-permission-for-model-project-folder'] = true;
843843
}
844+
if (this.isManagerVersionCompatibleWith('26.1.0')) {
845+
this._features['model-try-content-button'] = true;
846+
}
844847
if (this.isManagerVersionCompatibleWith('26.1.0')) {
845848
this._features['admin-resource-group-select'] = true;
846849
}

0 commit comments

Comments
 (0)