Skip to content

Commit 7a9656a

Browse files
committed
updated uri function
Signed-off-by: rsun19 <[email protected]>
1 parent 3122846 commit 7a9656a

File tree

5 files changed

+14
-8
lines changed

5 files changed

+14
-8
lines changed

clients/ui/frontend/.env

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@ LOGO_DARK=logo-dark-theme.svg
77
FAVICON=favicon.ico
88
PRODUCT_NAME="Model Registry"
99
KUBEFLOW_USERNAME=[email protected]
10+
COMPANY_URI=oci://kubeflow.io

clients/ui/frontend/docs/env-variables.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,5 @@ The following environment variables are used to configure the deployment and dev
1212
- The name of the product displayed in the UI.
1313
- `KUBEFLOW_USERNAME="[email protected]"`
1414
- The default username for the application. **DO NOT CHANGE THIS IF BFF IS SET IN MOCK MODE**.
15+
- `COMPANY_URI="oci://kubeflow.io"`
16+
- The company URI used for the application.

clients/ui/frontend/src/app/pages/modelRegistry/screens/__tests__/utils.spec.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,10 @@ import {
2222
filterRegisteredModels,
2323
sortModelVersionsByCreateTime,
2424
isValidHttpUrl,
25-
isRedHatRegistryUri,
2625
getCustomPropString,
26+
isCompanyUri,
2727
} from '~/app/pages/modelRegistry/screens/utils';
28+
import { COMPANY_URI } from '~/app/utilities/const';
2829

2930
describe('getLabels', () => {
3031
it('should return an empty array when customProperties is empty', () => {
@@ -457,12 +458,12 @@ describe('isValidHttpUrl', () => {
457458
});
458459
});
459460

460-
describe('isRedHatRegistryUri', () => {
461-
it('should return true for RedHat registry URI', () => {
462-
expect(isRedHatRegistryUri('oci://registry.redhat.io/test/test')).toBe(true);
461+
describe('isCompanyUri', () => {
462+
it('should return true for company registry URI', () => {
463+
expect(isCompanyUri(`${COMPANY_URI}/test/test`)).toBe(true);
463464
});
464465

465-
it('should return false for non-RedHat registry URI', () => {
466-
expect(isValidHttpUrl('http://example.com')).toBe(true);
466+
it('should return false for non-company registry URI', () => {
467+
expect(isCompanyUri(`${COMPANY_URI}1/test/test`)).toBe(false);
467468
});
468469
});

clients/ui/frontend/src/app/pages/modelRegistry/screens/utils.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import {
99
ModelVersion,
1010
RegisteredModel,
1111
} from '~/app/types';
12+
import { COMPANY_URI } from '~/app/utilities/const';
1213

1314
export type ObjectStorageFields = {
1415
endpoint: string;
@@ -198,5 +199,4 @@ export const isValidHttpUrl = (value: string): boolean => {
198199
}
199200
};
200201

201-
export const isRedHatRegistryUri = (uri: string): boolean =>
202-
uri.startsWith('oci://registry.redhat.io/');
202+
export const isCompanyUri = (uri: string): boolean => uri.startsWith(`${COMPANY_URI}/`);

clients/ui/frontend/src/app/utilities/const.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ const LOGO_LIGHT = process.env.LOGO || 'logo-light-theme.svg';
1111
const MANDATORY_NAMESPACE = process.env.MANDATORY_NAMESPACE || undefined;
1212
const URL_PREFIX = '/model-registry';
1313
const BFF_API_VERSION = 'v1';
14+
const COMPANY_URI = process.env.COMPANY_URI || 'oci://kubeflow.io';
1415

1516
export {
1617
STYLE_THEME,
@@ -23,6 +24,7 @@ export {
2324
DEPLOYMENT_MODE,
2425
BFF_API_VERSION,
2526
MANDATORY_NAMESPACE,
27+
COMPANY_URI,
2628
};
2729

2830
export const FindAdministratorOptions = [

0 commit comments

Comments
 (0)