Skip to content

Commit

Permalink
Merge pull request #4584 from pcbailey/fix-vm-template-no-projects-bug
Browse files Browse the repository at this point in the history
Bug 1793906: Align VM templates 'no project' page with VMs
  • Loading branch information
openshift-merge-robot committed Mar 4, 2020
2 parents 19007f1 + 80fb4df commit 8b389f4
Showing 1 changed file with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import {
K8sEntityMap,
} from '@console/shared';
import { match } from 'react-router';
import { withStartGuide } from '@console/internal/components/start-guide';
import { VM_TEMPLATE_LABEL_PLURAL } from '../../constants/vm-templates';
import {
getTemplateOperatingSystems,
Expand Down Expand Up @@ -173,9 +174,9 @@ const getCreateProps = ({ namespace }: { namespace: string }) => {
};
};

const VirtualMachineTemplatesPage: React.FC<VirtualMachineTemplatesPageProps &
const WrappedVirtualMachineTemplatesPage: React.FC<VirtualMachineTemplatesPageProps &
React.ComponentProps<typeof ListPage>> = (props) => {
const { skipAccessReview } = props;
const { skipAccessReview, noProjectsAvailable } = props;
const namespace = props.match.params.ns;

const resources = [
Expand All @@ -199,10 +200,11 @@ const VirtualMachineTemplatesPage: React.FC<VirtualMachineTemplatesPageProps &

const flatten = ({ vmTemplates }) => getLoadedData(vmTemplates, []);
const createAccessReview = skipAccessReview ? null : { model: TemplateModel, namespace };
const modifiedProps = Object.assign({}, { mock: noProjectsAvailable }, props);

return (
<MultiListPage
{...props}
{...modifiedProps}
createAccessReview={createAccessReview}
createButtonText="Create Virtual Machine Template"
canCreate
Expand All @@ -218,6 +220,8 @@ const VirtualMachineTemplatesPage: React.FC<VirtualMachineTemplatesPageProps &
);
};

const VirtualMachineTemplatesPage = withStartGuide(WrappedVirtualMachineTemplatesPage);

type VMTemplateTableRowProps = {
obj: TemplateKind;
index: number;
Expand All @@ -231,6 +235,7 @@ type VMTemplateTableRowProps = {
type VirtualMachineTemplatesPageProps = {
match: match<{ ns?: string }>;
skipAccessReview?: boolean;
noProjectsAvailable?: boolean;
};

export { VirtualMachineTemplatesPage };

0 comments on commit 8b389f4

Please sign in to comment.