Skip to content

Instantly share code, notes, and snippets.

@eriknelson
Created May 31, 2019 18:30
Show Gist options
  • Save eriknelson/20f058c9006b7174eca6cc1d4f984ac4 to your computer and use it in GitHub Desktop.
Save eriknelson/20f058c9006b7174eca6cc1d4f984ac4 to your computer and use it in GitHub Desktop.
diff --git a/src/app/plan/components/Wizard.tsx b/src/app/plan/components/Wizard.tsx
index ab861a5..b6e0d07 100644
--- a/src/app/plan/components/Wizard.tsx
+++ b/src/app/plan/components/Wizard.tsx
@@ -1,5 +1,6 @@
/** @jsx jsx */
import { jsx } from '@emotion/core';
+import { connect } from 'react-redux';
import React from 'react';
import { withFormik } from 'formik';
@@ -44,13 +45,14 @@ class WrappedWizard extends React.Component<any, any> {
});
console.log('prev.prevId == ', prev.prevId);
console.log('MigSourceStepId == ', MigSourceStepId);
- if(prev.prevId === MigSourceStepId) {
- console.log('did the thing happen?');
- planOperations.addPlan({
+
+ if (prev.prevId === MigSourceStepId) {
+ console.log('Got a match on the thing');
+ this.props.addPlan({
planName: this.props.values.planName,
sourceCluster: this.props.values.sourceCluster,
targetCluster: HostClusterName,
- namespaces: this.props.values.selectedNamespaces,
+ namespaces: this.props.values.selectedNamespaces.map(ns => ns.metadata.name),
})
}
if (curr.id === 5) {
@@ -263,4 +265,48 @@ const Wizard: any = withFormik({
displayName: 'Page One Form',
})(WrappedWizard);
-export default Wizard;
+
+const mapStateToProps = state => {
+ return {
+ connectionStatus: '',
+ planName: '',
+ sourceCluster: '',
+ targetCluster: null,
+ selectedNamespaces: [],
+ selectedStorage: '',
+ persistentVolumes: [
+ // {
+ // name: 'pv007',
+ // project: 'robot-shop',
+ // storageClass: '',
+ // size: '100 Gi',
+ // claim: 'robot-shop/mongodata',
+ // type: 'copy',
+ // details: '',
+ // id: 1,
+ // },
+ // {
+ // name: 'pv097',
+ // project: 'robot-shop',
+ // storageClass: '',
+ // size: '100 Gi',
+ // claim: 'robot-shop/mysqldata',
+ // type: 'copy',
+ // details: '',
+ // id: 2,
+ // },
+ ],
+ }
+}
+
+const mapDispatchToProps = dispatch => {
+ return {
+ addPlan: plan => dispatch(planOperations.addPlan(plan)),
+ }
+}
+
+// export default Wizard;
+
+export default connect(
+ mapStateToProps, mapDispatchToProps,
+)(Wizard)
diff --git a/src/app/plan/duck/operations.ts b/src/app/plan/duck/operations.ts
index 3f14823..990eb6d 100644
--- a/src/app/plan/duck/operations.ts
+++ b/src/app/plan/duck/operations.ts
@@ -10,7 +10,11 @@ import {
CoreNamespacedResourceKind,
} from '../../../client/resources';
-import { createMigPlan, createMigMigration, createMigPlanNoStorage } from '../../../client/resources/conversions';
+import {
+ createMigPlan,
+ createMigMigration,
+ createMigPlanNoStorage,
+} from '../../../client/resources/conversions';
/* tslint:disable */
const uuidv1 = require('uuid/v1');
diff --git a/src/client/resources/conversions.ts b/src/client/resources/conversions.ts
index 041dbfd..c7c0722 100644
--- a/src/client/resources/conversions.ts
+++ b/src/client/resources/conversions.ts
@@ -182,6 +182,11 @@ export function createMigPlanNoStorage(
namespace,
},
namespaces,
+ // TODO: Need to rip this out once we have this available
+ migStorageRef: {
+ name: 'my-s2-bucket',
+ namespace,
+ }
},
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment