message: Removee modelFor code from _saveChanges function. Connect to redux to use k8s.getIn for model.
diff: import * as React from 'react';
  import * as _ from 'lodash-es';
  import * as PropTypes from 'prop-types';
  +import { connect } from 'react-redux';
  -import { modelFor, k8sPatch, k8sGet } from '../module/k8s';
  +import { k8sPatch, k8sGet, referenceFor } from '../module/k8s';
  import { PromiseComponent, NameValueEditorPair, LoadingBox, AsyncComponent, ResourceIcon } from './utils';
  import { ConfigMapModel, SecretModel } from '../models';
  @@ -44,7 +45,12 @@ export const envVarsToArray = (initialPairObjects) => {
  return [getPairsFromObject(initialPairObjects)];
  };
  -export class EnvironmentPage extends PromiseComponent {
  +const stateToProps = ({k8s}, {obj}) => ({
  + model: k8s.getIn(['RESOURCES', 'models', referenceFor(obj)]) || k8s.getIn(['RESOURCES', 'models', obj.kind]),
  +});
  +
  +export const EnvironmentPage = connect(stateToProps)(
  + class EnvironmentPage extends PromiseComponent {
  /**
  * Set initial state and decide which kind of env we are setting up
  *
  @@ -184,13 +190,10 @@ export class EnvironmentPage extends PromiseComponent {
  * @param e
  */
  _saveChanges(e) {
  - const {envPath, rawEnvData, obj} = this.props;
  + const {envPath, rawEnvData, obj, model} = this.props;
  const {currentEnvVars} = this.state;
  e.preventDefault();
  - // Convert any blank values to null
  - const kind = modelFor(obj.kind);
  -
  const patch = currentEnvVars.map((finalPairsForContainer, i) => {
  let op = 'add';
  const path = _.isArray(rawEnvData) ? `/${envPath.join('/')}/${i}/env` : `/${envPath.join('/')}/env`;
  @@ -205,7 +208,7 @@ export class EnvironmentPage extends PromiseComponent {
  }
  return {path, op, value: this._envVarsToNameVal(finalPairsForContainer)};
  });
  - const promise = k8sPatch(kind, obj, patch);
  + const promise = k8sPatch(model, obj, patch);
  this.handlePromise(promise).then((res) => {
  const newEnvData = _.get(res, envPath);
  this.setState({
  @@ -249,7 +252,7 @@ export class EnvironmentPage extends PromiseComponent {
  </div>
  </div>;
  }
  -}
  + });
  EnvironmentPage.propTypes = {
  obj: PropTypes.object.isRequired,
  rawEnvData: PropTypes.oneOfType([PropTypes.object, PropTypes.array]).isRequired,
  