Skip to content

Commit

Permalink
Bug 1907459: The Boot source is also maintained by Red Hat. is always…
Browse files Browse the repository at this point in the history
… shown
  • Loading branch information
glekner committed Dec 23, 2020
1 parent d91ca54 commit 1a4c22c
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -264,8 +264,7 @@
"Virtual Machines": "Virtual Machines",
"Virtual Machine Template": "Virtual Machine Template",
"Learn more about operating system support": "Learn more about operating system support",
"This template is {{providerParam}}. The Boot source is also maintained by Red Hat.": "This template is {{providerParam}}. The Boot source is also maintained by Red Hat.",
"This template is {{providerParam}}": "This template is {{providerParam}}",
"This template's boot source is defined by {{providerParam}}": "This template's boot source is defined by {{providerParam}}",
"The following resources will be created": "The following resources will be created",
"Virtual machine": "Virtual machine",
"A new disk has been added to support the CD-ROM boot source.": "A new disk has been added to support the CD-ROM boot source.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,7 @@ import { getNamespace, getUID } from '@console/shared';
import { isTemplateSourceError } from '../../../statuses/template/types';
import { getTemplateSourceStatus } from '../../../statuses/template/template-source-status';
import { filterTemplates } from '../../vm-templates/utils';
import {
getTemplateName,
getTemplateProvider,
isCommonTemplate,
} from '../../../selectors/vm-template/basic';
import { getTemplateName, getTemplateProvider } from '../../../selectors/vm-template/basic';
import NamespacedPage, {
NamespacedPageVariants,
} from '../../../../../dev-console/src/components/NamespacedPage';
Expand All @@ -32,6 +28,7 @@ import { formReducer, initFormState } from '../forms/create-vm-form-reducer';
import { useStorageClassConfigMap } from '../../../hooks/storage-class-config-map';
import { SUPPORT_URL } from '../../../constants/vm-templates';
import { useVmTemplatesResources } from '../hooks/use-vm-templates-resources';
import { getDescription } from '../../../selectors/selectors';

const DevConsoleCreateVmFormEmptyState: React.FC<{ templateParam: string; t: TFunction }> = ({
templateParam,
Expand Down Expand Up @@ -94,6 +91,8 @@ export const DevConsoleCreateVmForm: React.FC<RouteComponentProps> = () => {
const [createError, setCreateError] = React.useState<string>();
const [scConfigMap, scLoaded, scError] = useStorageClassConfigMap();
const template = selectedTemplate?.variants?.[0];
const provider = getTemplateProvider(t, template);
const templateDescription = getDescription(template);
const sourceStatus = getTemplateSourceStatus({
pvcs,
pods,
Expand Down Expand Up @@ -145,14 +144,19 @@ export const DevConsoleCreateVmForm: React.FC<RouteComponentProps> = () => {
</div>
</div>
<p className="co-catalog-item-details__description">
{isCommonTemplate(template)
? t(
'kubevirt-plugin~This template is {{providerParam}}. The Boot source is also maintained by Red Hat.',
{ providerParam: getTemplateProvider(t, template, true) },
)
: t('kubevirt-plugin~This template is {{providerParam}}', {
providerParam: getTemplateProvider(t, template, true),
})}
<Stack hasGutter>
{templateDescription && <StackItem>{templateDescription}</StackItem>}
{provider && (
<StackItem>
{t(
"kubevirt-plugin~This template's boot source is defined by {{providerParam}}",
{
providerParam: provider,
},
)}
</StackItem>
)}
</Stack>
</p>
<>
<hr />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import {
getTemplateKindProviderType,
getTemplateSupport,
templateProviders,
isCommonTemplate,
getTemplateParentProvider,
} from '../../../selectors/vm-template/basic';
import {
Expand All @@ -29,6 +28,7 @@ import { filterTemplates } from '../../vm-templates/utils';
import { getTemplateSourceStatus } from '../../../statuses/template/template-source-status';
import { V1alpha1DataVolume } from '../../../types/vm/disk/V1alpha1DataVolume';
import { TemplateItem } from '../../../types/template';
import { getDescription } from '../../../selectors/selectors';
import './create-vm-side-drawer.scss';

const normalizeVmTemplates = (
Expand Down Expand Up @@ -56,6 +56,7 @@ const normalizeVmTemplates = (
const flavor = getTemplateFlavorDesc(tmp, false);
const storage = getTemplateSizeRequirement(tmp, sourceStatus);
const providerType = getTemplateKindProviderType(tmp);
const templateDescription = getDescription(tmp);

const params = new URLSearchParams();
params.set('template', tmp?.metadata?.name);
Expand All @@ -78,14 +79,18 @@ const normalizeVmTemplates = (

const detailsDescription = [
{
value: isCommonTemplate(tmp)
? t(
'kubevirt-plugin~This template is {{providerParam}}. The Boot source is also maintained by Red Hat.',
{ providerParam: getTemplateProvider(t, tmp, true) },
)
: t('kubevirt-plugin~This template is {{providerParam}}', {
providerParam: getTemplateProvider(t, tmp, true),
}),
value: (
<Stack hasGutter>
{templateDescription && <StackItem>{templateDescription}</StackItem>}
{provider && (
<StackItem>
{t("kubevirt-plugin~This template's boot source is defined by {{providerParam}}", {
providerParam: provider,
})}
</StackItem>
)}
</Stack>
),
},
{
value: (
Expand Down

0 comments on commit 1a4c22c

Please sign in to comment.