Skip to content

Commit

Permalink
fix link for upload os disk
Browse files Browse the repository at this point in the history
  • Loading branch information
yaacov committed Sep 23, 2020
1 parent 7abea87 commit a96ae08
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import { operatingSystemsNative } from '../../../../constants/vm-templates/os';
import { OperatingSystemRecord } from '../../../../types';
import { iGetAnnotation } from '../../../../selectors/immutable/common';
import { iGetName, iGetNamespace } from '../../selectors/immutable/selectors';
import { PVC_UPLOAD_URL } from '../../../../constants';
import { getPVCUploadURL } from '../../../../constants';
import {
BASE_IMAGE_AND_PVC_SHORT,
BASE_IMAGE_AND_PVC_MESSAGE,
Expand Down Expand Up @@ -149,18 +149,23 @@ export const OS: React.FC<OSProps> = React.memo(
};

if (!iUserTemplate && !baseImagesLoadError) {
if (baseImageFoundInCluster && pvcName) {
if (baseImageFoundInCluster && pvcName && pvcNamespace) {
osField.message = isBaseImageUploading
? BASE_IMAGE_AND_PVC_UPLOADING_SHORT
: BASE_IMAGE_AND_PVC_SHORT;
osField.longMessage = BASE_IMAGE_AND_PVC_MESSAGE;
osField.checkboxDescription = isBaseImageUploading ? BASE_IMAGE_UPLOADING_MESSAGE : '';
} else if (pvcName) {
} else if (pvcName && pvcNamespace) {
osField.message = NO_BASE_IMAGE_SHORT;
osField.longMessage = canUploadGoldenImage ? (
<>
Operating system image not available. You can either{' '}
<Link to={`${PVC_UPLOAD_URL}?${CDI_UPLOAD_OS_URL_PARAM}=${operatingSystem.id}`}>
<Link
className="co-external-link"
to={`${getPVCUploadURL(pvcNamespace)}?${CDI_UPLOAD_OS_URL_PARAM}=${
operatingSystem.id
}`}
>
upload a new disk image
</Link>{' '}
or define a boot source manually in the boot source dropdown
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,5 @@ export const WINTOOLS_CONTAINER_NAMES = {
};

export const PENDING_RESTART_LABEL = '(pending restart)';
export const PVC_UPLOAD_URL = `/k8s/ns/${TEMPLATE_VM_GOLDEN_OS_NAMESPACE}/persistentvolumeclaims/~new/upload-form`;
export const getPVCUploadURL = (pvcNamespace: string): string =>
`/k8s/ns/${pvcNamespace}/persistentvolumeclaims/~new/upload-form`;

0 comments on commit a96ae08

Please sign in to comment.