message: Only show API group for duplicates in resource dropdown
diff: /* eslint-disable no-undef, no-unused-vars */
  import * as React from 'react';
  +import * as _ from 'lodash-es';
  import { connect } from 'react-redux';
  import * as PropTypes from 'prop-types';
  import { Map as ImmutableMap } from 'immutable';
  @@ -9,25 +10,31 @@ import * as classNames from 'classnames';
  import { Dropdown, ResourceIcon } from './utils';
  import { K8sKind, K8sResourceKindReference, referenceForModel, apiVersionForReference } from '../module/k8s';
  -const DropdownItem: React.SFC<DropdownItemProps> = ({model}) => <React.Fragment>
  +const DropdownItem: React.SFC<DropdownItemProps> = ({model, showGroup}) => <React.Fragment>
  <span className="co-type-selector__icon-wrapper">
  <ResourceIcon kind={model.kind} />
  </span>
  - {model.kind}&nbsp;<span className="text-muted">({model.apiGroup}/{model.apiVersion})</span>
  + {model.kind}
  + {showGroup && <React.Fragment>&nbsp;<small className="text-muted">&ndash; {model.apiGroup}/{model.apiVersion}</small></React.Fragment>}
  </React.Fragment>;
  const ResourceListDropdown_: React.SFC<ResourceListDropdownProps> = props => {
  const { selected, onChange, allModels, showAll, className, preferredVersions } = props;
  - const items = (allModels
  + const items = allModels
  .filter(model => {
  const preferred = (m: K8sKind) => preferredVersions.some(v => v.groupVersion === apiVersionForReference(referenceForModel(m)));
  const sameGroupKind = (m: K8sKind) => m.kind === model.kind && m.apiGroup === model.apiGroup && m.apiVersion !== model.apiVersion;
  return !allModels.find(m => sameGroupKind(m) && preferred(m));
  })
  - .sort((modelA, modelB) => modelA.kind > modelB.kind ? 1 : -1)
  - .map((model) => <DropdownItem key={referenceForModel(model)} model={model} />) as ImmutableMap<string, JSX.Element>)
  + .sort((modelA, modelB) => modelA.kind > modelB.kind ? 1 : -1);
  +
  + // Track duplicate names so we know when to show the group.
  + const kinds = _.groupBy(items.toJS(), 'kind');
  + const isDup = kind => _.size(kinds[kind]) > 1;
  + const dropdownItems = (items
  + .map((model) => <DropdownItem key={referenceForModel(model)} model={model} showGroup={isDup(model.kind)} />) as ImmutableMap<string, JSX.Element>)
  .merge(showAll
  ? ImmutableMap({all: <React.Fragment>
  <span className="co-type-selector__icon-wrapper">
  @@ -38,7 +45,7 @@ const ResourceListDropdown_: React.SFC<ResourceListDropdownProps> = props => {
  )
  .toJS() as {[s: string]: JSX.Element};
  - return <Dropdown className={classNames('co-type-selector', className)} items={items} title={items[selected]} onChange={onChange} selectedKey={selected} />;
  + return <Dropdown className={classNames('co-type-selector', className)} items={dropdownItems} title={dropdownItems[selected]} onChange={onChange} selectedKey={selected} />;
  };
  const resourceListDropdownStateToProps = ({k8s}) => ({
  @@ -69,4 +76,5 @@ export type ResourceListDropdownProps = {
  type DropdownItemProps = {
  model: K8sKind;
  + showGroup?: boolean;
  };
  