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 85cae43 commit 70fa7d9
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 13 deletions.
10 changes: 8 additions & 2 deletions react/src/components/ImageInstallModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,12 @@ const ImageInstallModal: React.FC<ImageInstallModalInterface> = ({
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 +168,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
2 changes: 1 addition & 1 deletion react/src/components/ServiceValidationView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ const ServiceValidationView: React.FC<ServiceValidationModalProps> = ({
ServiceLauncherFormValue
>({
mutationFn: (values) => {
const image: string = `${values.environments.image?.registry}/${values.environments.image?.name}:${values.environments.image?.tag}`;
const image: string = `${values.environments.image?.registry}/${values.environments.image?.namespace ?? values.environments.image?.name}:${values.environments.image?.tag}`;
const body: ServiceCreateType = {
name: values.serviceName,
...(baiClient.supports('replicas')
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 70fa7d9

Please sign in to comment.