Skip to content
This repository has been archived by the owner on Mar 1, 2024. It is now read-only.

Connect CreateVMWizard to network configurations #41

Merged
merged 1 commit into from
Oct 11, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions frontend/public/kubevirt/components/vm.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import React, { Component, Fragment } from 'react';

import { ListHeader, ColHead, List, ListPage, ResourceRow, DetailsPage } from './factory/okdfactory';
import { breadcrumbsForOwnerRefs, Firehose, ResourceLink, navFactory, ResourceCog, Cog } from './utils/okdutils';
import { VirtualMachineInstanceModel, VirtualMachineModel, PodModel, NamespaceModel, TemplateModel } from '../models';
import { VirtualMachineInstanceModel, VirtualMachineModel, PodModel, NamespaceModel, TemplateModel, NetworkAttachmentDefinitionModel } from '../models';
import { k8sCreate, actions } from '../module/okdk8s';
import { connect } from 'react-redux';

Expand Down Expand Up @@ -274,11 +274,13 @@ const mapDispatchToProps = () => ({
const ConnectedNewVMWizard = props => {
const namespaces = props.flatten(props.resources);
const templates = _.get(props.resources, TemplateModel.kind, {}).data;
const networkConfigs = _.get(props.resources, NetworkAttachmentDefinitionModel.kind, {}).data;

return <CreateVmWizard
onHide={props.onHide}
namespaces={namespaces}
templates={templates}
networkConfigs={networkConfigs || []}
k8sCreate={props.createVm} />;
};

Expand Down Expand Up @@ -322,10 +324,12 @@ export const VirtualMachinesPage = connect(
openNewVmWizard() {
const namespaces = getResourceKind(NamespaceModel, undefined, true, undefined, true);
const templates = getResourceKind(TemplateModel, undefined, true, undefined, true, undefined, [{key: TEMPLATE_TYPE_LABEL, operator: 'Exists' }]);
const networkConfigs = getResourceKind(NetworkAttachmentDefinitionModel, undefined, true, undefined, true);

const resources = [
namespaces,
templates
templates,
networkConfigs
];
return <Firehose resources={resources} flatten={getFlattenForKind(NamespaceModel.kind)}>
<ConnectedNewVMWizard onHide={this._onHide} createVm={k8sCreate} />
Expand Down
14 changes: 7 additions & 7 deletions frontend/public/kubevirt/models/vm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,14 @@ export const TemplateModel: K8sKind = {
};

export const NetworkAttachmentDefinitionModel: K8sKind = {
label: 'network-attachment-definition',
labelPlural: 'network-attachment-definitions',
apiVersion: 'k8s.cni.cncf.io/v1',
label: 'Network Attachment Definition',
labelPlural: 'Network Attachment Definitions',
apiVersion: 'v1',
path: 'network-attachment-definitions',
apiGroup: 'k8s.cni.cncf.io',
plural: 'network-attachment-definitions',
namespaced: false,
abbr: 'network-attachment-definitions',
kind: 'network-attachment-definitions',
id: 'network-attachment-definitions'
namespaced: true,
abbr: 'NAD',
kind: 'NetworkAttachmentDefinition',
id: 'network-attachment-definition'
};
3 changes: 2 additions & 1 deletion kubevirt/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"dependencies": {
"@patternfly/react-console": "^1.4.6",
"kubevirt-web-ui-components": "^0.1.3"
"kubevirt-web-ui-components": "^0.1.3",
"reactabular-dnd": "^8.16.0"
}
}
4 changes: 4 additions & 0 deletions kubevirt/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -691,6 +691,10 @@ react-transition-group@^2.0.0, react-transition-group@^2.2.0:
prop-types "^15.6.2"
react-lifecycles-compat "^3.0.4"

reactabular-dnd@^8.16.0:
version "8.16.0"
resolved "https://registry.yarnpkg.com/reactabular-dnd/-/reactabular-dnd-8.16.0.tgz#c66df1cfa08615978aa4eeb885747a1634dfc54a"

reactabular-table@^8.14.0:
version "8.14.0"
resolved "https://registry.yarnpkg.com/reactabular-table/-/reactabular-table-8.14.0.tgz#2ce05de47d499db91678fa9518505ea509bf3d7f"
Expand Down