message: fix YAML create for Operator resources
diff: import * as React from 'react';
  import { safeLoad, safeDump } from 'js-yaml';
  import { saveAs } from 'file-saver';
  +import { connect } from 'react-redux';
  import * as ace from 'brace';
  import 'brace/ext/searchbox';
  import 'brace/mode/yaml';
  import 'brace/theme/clouds';
  -import { k8sCreate, k8sUpdate, k8sKinds } from '../module/k8s';
  -import { kindObj, history, Loading, resourcePath } from './utils';
  +import { k8sCreate, k8sUpdate, referenceFor, modelFor } from '../module/k8s';
  +import { history, Loading, resourcePath } from './utils';
  import { SafetyFirst } from './safety-first';
  import { ResourceSidebar } from './sidebars/resource-sidebar';
  @@ -17,7 +18,7 @@ import { TEMPLATES } from '../yaml-templates';
  let id = 0;
  const generateObjToLoad = (kind, templateName, namespace = 'default') => {
  - const kindObj = _.get(k8sKinds, kind, {});
  + const kindObj = modelFor(kind) || {};
  const kindStr = `${kindObj.apiVersion}.${kind}`;
  const sampleObj = safeLoad(TEMPLATES[kindStr][templateName]);
  if (_.has(sampleObj.metadata, 'namespace')) {
  @@ -26,12 +27,17 @@ const generateObjToLoad = (kind, templateName, namespace = 'default') => {
  return sampleObj;
  };
  +const stateToProps = ({KINDS}) => ({
  + k8sModels: KINDS.get('kinds'),
  +});
  +
  /**
  * This component loads the entire Ace editor library (~100kB) with it.
  * Consider using `AsyncComponent` to dynamically load this component when needed.
  */
  /** @augments {React.Component<{obj?: any, create: boolean, kind: string, redirectURL?: string}>} */
  -export class EditYAML extends SafetyFirst {
  +export const EditYAML = connect(stateToProps)(
  + class EditYAML extends SafetyFirst {
  constructor(props) {
  super(props);
  this.state = {
  @@ -173,7 +179,7 @@ export class EditYAML extends SafetyFirst {
  return;
  }
  - const ko = kindObj(obj.kind);
  + const ko = this.props.k8sModels.get(referenceFor(obj)) || this.props.k8sModels.get(obj.kind);
  if (!ko) {
  this.handleError(`"${obj.kind}" is not a valid kind.`);
  @@ -242,7 +248,7 @@ export class EditYAML extends SafetyFirst {
  const {error, success, stale} = this.state;
  const {create, obj, showHeader = false} = this.props;
  const kind = obj.kind;
  - const kindObj = _.get(k8sKinds, kind, {});
  + const kindObj = this.props.k8sModels.get(referenceFor(obj)) || this.props.k8sModels.get(obj.kind) || {};
  return <div>
  {showHeader && <div className="yaml-editor-header">
  @@ -275,3 +281,4 @@ export class EditYAML extends SafetyFirst {
  </div>;
  }
  }
  +);
  