Skip to content

Commit

Permalink
fix(FR-382, FR-384): Handle deprecated image name fields in service l…
Browse files Browse the repository at this point in the history
…auncher and image download
  • Loading branch information
ironAiken2 committed Jan 17, 2025
1 parent 529a225 commit 2b16f2c
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 12 deletions.
12 changes: 10 additions & 2 deletions react/src/components/ImageInstallModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,17 @@ const ImageInstallModal: React.FC<ImageInstallModalInterface> = ({

const { imagesToInstall, hasInstalledImage } = mapImages();

const supportExtendedImageInfo = baiClient.supports('extended-image-info');

Check warning on line 39 in react/src/components/ImageInstallModal.tsx

View workflow job for this annotation

GitHub Actions / coverage

'supportExtendedImageInfo' is assigned a value but never used

const handleClick = () => {
onRequestClose();
const installPromises = imagesToInstall.map(async (image) => {
const imageName = image?.registry + '/' + image?.name + ':' + image?.tag;
const imageName =
image?.registry +
'/' +
(image?.namespace ?? image?.name) +
':' +
image?.tag;
let isGPURequired = false;
const imageResource = {} as { [key: string]: any };
image?.resource_limits?.forEach((resourceLimit) => {
Expand Down Expand Up @@ -163,7 +170,8 @@ const ImageInstallModal: React.FC<ImageInstallModalInterface> = ({
<List
size="small"
dataSource={imagesToInstall.map(
(image) => `${image?.registry}/${image?.name}/${image?.tag}`,
(image) =>
`${image?.registry}/${image?.namespace ?? image?.name}/${image?.tag}`,
)}
style={{
width: '100%',
Expand Down
13 changes: 8 additions & 5 deletions react/src/components/ServiceLauncherPageContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,8 @@ const ServiceLauncherPageContent: React.FC<ServiceLauncherPageContentProps> = ({
row_id
}
image_object @since(version: "23.09.9") {
name
name @deprecatedSince(version: "24.12.0")
namespace @since(version: "24.12.0")
humanized_name
tag
registry
Expand Down Expand Up @@ -256,7 +257,7 @@ const ServiceLauncherPageContent: React.FC<ServiceLauncherPageContentProps> = ({
return {
image: (isManualImageEnabled
? formInput.environments.manual?.split('@')[0]
: `${formInput.environments.image?.registry}/${formInput.environments.image?.name}:${formInput.environments.image?.tag}`) as string,
: `${formInput.environments.image?.registry}/${formInput.environments.image?.namespace ?? formInput.environments.image?.name}:${formInput.environments.image?.tag}`) as string,
architecture: (isManualImageEnabled
? formInput.environments.manual?.split('@')[1]
: formInput.environments.image?.architecture) as string,
Expand Down Expand Up @@ -420,7 +421,8 @@ const ServiceLauncherPageContent: React.FC<ServiceLauncherPageContentProps> = ({
open_to_public
model
image_object @since(version: "23.09.9") {
name
name @deprecatedSince(version: "24.12.0")
namespace @since(version: "24.12.0")
humanized_name
tag
registry
Expand Down Expand Up @@ -682,8 +684,9 @@ const ServiceLauncherPageContent: React.FC<ServiceLauncherPageContentProps> = ({
cluster_size: endpoint?.cluster_size,
openToPublic: endpoint?.open_to_public,
environments: {
environment: endpoint?.image_object?.name,
version: `${endpoint?.image_object?.registry}/${endpoint?.image_object?.name}:${endpoint?.image_object?.tag}@${endpoint?.image_object?.architecture}`,
environment:
endpoint?.image_object?.namespace ?? endpoint?.image_object?.name,
version: `${endpoint?.image_object?.registry}/${endpoint?.image_object?.namespace ?? endpoint?.image_object?.name}:${endpoint?.image_object?.tag}@${endpoint?.image_object?.architecture}`,
image: endpoint?.image_object,
},
vFolderID: endpoint?.model,
Expand Down
8 changes: 3 additions & 5 deletions react/src/pages/EndpointDetailPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -268,11 +268,9 @@ const EndpointDetailPage: React.FC<EndpointDetailPageProps> = () => {
return color;
};

const fullImageString: string = (
baiClient.supports('modify-endpoint')
? `${endpoint?.image_object?.registry}/${endpoint?.image_object?.name}:${endpoint?.image_object?.tag}@${endpoint?.image_object?.architecture}`
: endpoint?.image
) as string;
const fullImageString: string = baiClient.supports('modify-endpoint')
? `${endpoint?.image_object?.registry}/${endpoint?.image_object?.name}:${endpoint?.image_object?.tag}@${endpoint?.image_object?.architecture}`
: `${endpoint?.image}`;

const resource_opts = JSON.parse(endpoint?.resource_opts || '{}');

Expand Down

0 comments on commit 2b16f2c

Please sign in to comment.