-
Notifications
You must be signed in to change notification settings - Fork 167
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update modals and generate meaningful k8s name for images
- Loading branch information
1 parent
2c849f3
commit 10f9b48
Showing
28 changed files
with
15,027 additions
and
7,276 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
package.json | ||
jest.config.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
module.exports = { | ||
transform: { | ||
'node_modules': 'ts-jest', | ||
}, | ||
preset: 'ts-jest', | ||
testEnvironment: 'node', | ||
}; |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
// https://cloud.google.com/artifact-registry/docs/docker/names | ||
// The full name for a container image is one of the following formats: | ||
// LOCATION-docker.pkg.dev/PROJECT-ID/REPOSITORY/IMAGE | ||
// LOCATION-docker.pkg.dev/PROJECT-ID/REPOSITORY/IMAGE:TAG | ||
// LOCATION-docker.pkg.dev/PROJECT-ID/REPOSITORY/IMAGE@IMAGE-DIGEST | ||
|
||
import { parseImageURL } from '../routes/api/images/imageUtils'; | ||
|
||
test('Invalid URL: space string', () => { | ||
const url = ' '; | ||
const { fullURL, host } = parseImageURL(url); | ||
expect(fullURL).toBe(''); | ||
expect(host).toBeUndefined(); | ||
}); | ||
|
||
test('Invalid URL: no match', () => { | ||
const url = '/'; | ||
const { host, tag } = parseImageURL(url); | ||
expect(host).toBeUndefined(); | ||
expect(tag).toBeUndefined(); | ||
}); | ||
|
||
test('Invalid URL: host only', () => { | ||
const url = 'docker.io'; | ||
const { host } = parseImageURL(url); | ||
expect(host).toBe(''); | ||
}); | ||
|
||
test('Invalid URL: host and repo, no image', () => { | ||
const url = 'docker.io/opendatahub'; | ||
const { host } = parseImageURL(url); | ||
expect(host).toBe(''); | ||
}); | ||
|
||
test('Valid URL with spaces on both sides', () => { | ||
const url = ' docker.io/library/mysql:test '; | ||
const { fullURL, host, tag } = parseImageURL(url); | ||
expect(fullURL).toBe('docker.io/library/mysql:test'); | ||
expect(host).toBe('docker.io'); | ||
expect(tag).toBe('test'); | ||
}); | ||
|
||
test('Docker container URL without tag', () => { | ||
const url = 'docker.io/library/mysql'; | ||
const { host, tag } = parseImageURL(url); | ||
expect(host).toBe('docker.io'); | ||
expect(tag).toBeUndefined(); | ||
}); | ||
|
||
test('Docker container URL with tag', () => { | ||
const url = 'docker.io/library/mysql:test-tag'; | ||
const { host, tag } = parseImageURL(url); | ||
expect(host).toBe('docker.io'); | ||
expect(tag).toBe('test-tag'); | ||
}); | ||
|
||
test('OpenShift internal registry URL without tag', () => { | ||
const url = 'image-registry.openshift-image-registry.svc:5000/opendatahub/s2i-minimal-notebook'; | ||
const { host, tag } = parseImageURL(url); | ||
expect(host).toBe('image-registry.openshift-image-registry.svc:5000'); | ||
expect(tag).toBeUndefined(); | ||
}); | ||
|
||
test('OpenShift internal registry URL with tag', () => { | ||
const url = | ||
'image-registry.openshift-image-registry.svc:5000/opendatahub/s2i-minimal-notebook:v0.3.0-py36'; | ||
const { host, tag } = parseImageURL(url); | ||
expect(host).toBe('image-registry.openshift-image-registry.svc:5000'); | ||
expect(tag).toBe('v0.3.0-py36'); | ||
}); | ||
|
||
test('Quay URL with port and tag', () => { | ||
const url = 'quay.io:443/opendatahub/odh-dashboard:main-55e19fa'; | ||
const { host, tag } = parseImageURL(url); | ||
expect(host).toBe('quay.io:443'); | ||
expect(tag).toBe('main-55e19fa'); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import * as React from 'react'; | ||
import { | ||
ActionList, | ||
ActionListItem, | ||
Alert, | ||
Button, | ||
Stack, | ||
StackItem, | ||
} from '@patternfly/react-core'; | ||
|
||
type DashboardModalFooterProps = { | ||
submitLabel: string; | ||
onSubmit: () => void; | ||
onCancel: () => void; | ||
isSubmitDisabled: boolean; | ||
isCancelDisabled: boolean; | ||
alertTitle: string; | ||
error?: Error; | ||
}; | ||
|
||
const DashboardModalFooter: React.FC<DashboardModalFooterProps> = ({ | ||
submitLabel, | ||
onSubmit, | ||
onCancel, | ||
isSubmitDisabled, | ||
isCancelDisabled, | ||
error, | ||
alertTitle, | ||
}) => ( | ||
// make sure alert uses the full width | ||
<Stack hasGutter style={{ flex: 'auto' }}> | ||
{error && ( | ||
<StackItem> | ||
<Alert isInline variant="danger" title={alertTitle}> | ||
{error.message} | ||
</Alert> | ||
</StackItem> | ||
)} | ||
<StackItem> | ||
<ActionList> | ||
<ActionListItem> | ||
<Button key="submit" variant="primary" isDisabled={isSubmitDisabled} onClick={onSubmit}> | ||
{submitLabel} | ||
</Button> | ||
</ActionListItem> | ||
<ActionListItem> | ||
<Button key="cancel" variant="link" isDisabled={isCancelDisabled} onClick={onCancel}> | ||
Cancel | ||
</Button> | ||
</ActionListItem> | ||
</ActionList> | ||
</StackItem> | ||
</Stack> | ||
); | ||
|
||
export default DashboardModalFooter; |
Oops, something went wrong.