Skip to content

Commit

Permalink
Align VM templates 'no project' page with VMs
Browse files Browse the repository at this point in the history
  • Loading branch information
pcbailey committed Mar 2, 2020
1 parent d4304c7 commit 665d2bc
Showing 1 changed file with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ import { menuActions } from './menu-actions';
import { TemplateSource } from './vm-template-source';

import './vm-template.scss';
import {withStartGuide} from "@console/internal/components/start-guide";

const tableColumnClass = classNames('col-lg-2', 'col-md-2', 'col-sm-4', 'col-xs-4');
const tableColumnClassHiddenOnSmall = classNames('col-lg-2', 'col-md-2', 'hidden-sm', 'hidden-xs');
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 665d2bc

Please sign in to comment.