Skip to content

Commit

Permalink
Added Gorkem's labelling strategy to source-to-image flow along with …
Browse files Browse the repository at this point in the history
…refactoring (openshift#45)

* Initial implementation of LabelDropdown, AppDropdown and changes for create item in Dropdown

* Added actionItem to dropdown for generic use. Updated labelling strategy in source-to-image

* Initial refactoring of source-to-image, changes to dropdown and form input

* Created AppNameSelector and added it to s2i and import, fixed resource creation in import flow.

* Fix lint errors.

* Fixes based on review comments

* fix(import): remove dynamically API end point creation (#1)

* Add deployment to list of resources

* Auto select active namespace in the dropdown

* Use prettier and add type to resources
  • Loading branch information
rohitkrai03 authored and christianvogt committed May 7, 2019
1 parent 0c2ec19 commit 63aab5e
Show file tree
Hide file tree
Showing 19 changed files with 1,312 additions and 154 deletions.
3 changes: 1 addition & 2 deletions frontend/public/components/app.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -284,8 +284,7 @@ class App extends React.PureComponent {

<LazyRoute path={this._prependActivePerspective('/catalog/create-service-instance')} exact loader={() => import('./service-catalog/create-instance' /* webpackChunkName: "create-service-instance" */).then(m => m.CreateInstancePage)} />
<LazyRoute path={this._prependActivePerspective('/k8s/ns/:ns/serviceinstances/:name/create-binding')} exact loader={() => import('./service-catalog/create-binding' /* webpackChunkName: "create-binding" */).then(m => m.CreateBindingPage)} />
<LazyRoute path={this._prependActivePerspective('/catalog/instantiate-template')} exact loader={() => import('./instantiate-template' /* webpackChunkName: "instantiate-template" */).then(m => m.InstantiateTemplatePage)} />
<LazyRoute path={this._prependActivePerspective('/catalog/source-to-image')} exact loader={() => import('./source-to-image' /* webpackChunkName: "source-to-image" */).then(m => m.SourceToImagePage)} />
<LazyRoute path={this._prependActivePerspective('/catalog/source-to-image')} exact loader={() => import('../extend/devconsole/pages/SourceToImage' /* webpackChunkName: "source-to-image" */).then(m => m.SourceToImagePage)} />

<Route path={this._prependActivePerspective('/k8s/ns/:ns/alertmanagers/:name')} exact render={({match}) => <Redirect to={`/k8s/ns/${match.params.ns}/${referenceForModel(AlertmanagerModel)}/${match.params.name}`} />} />

Expand Down
28 changes: 27 additions & 1 deletion frontend/public/components/utils/dropdown.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ export class Dropdown extends DropdownMixin {

render() {
const {active, autocompleteText, selectedKey, items, title, bookmarks, keyboardHoverKey, favoriteKey} = this.state;
const {autocompleteFilter, autocompletePlaceholder, className, buttonClassName, menuClassName, storageKey, canFavorite, dropDownClassName, titlePrefix, describedBy} = this.props;
const {autocompleteFilter, autocompletePlaceholder, actionItem, className, buttonClassName, menuClassName, storageKey, canFavorite, dropDownClassName, titlePrefix, describedBy} = this.props;

const spacerBefore = this.props.spacerBefore || new Set();
const headerBefore = this.props.headerBefore || {};
Expand All @@ -318,6 +318,27 @@ export class Dropdown extends DropdownMixin {
rows.push(<DropDownRow className={klass} key={key} itemKey={key} content={content} onBookmark={storageKey && this.onBookmark} onclick={this.onClick} selected={selected} hover={hover} />);
};

const ActionRow = () => {
const { actionTitle, actionKey } = actionItem;
const selected = (actionKey === selectedKey) && !this.props.noSelection;
const hover = actionKey === keyboardHoverKey;
return (
<React.Fragment>
<DropDownRow
className={classNames({'active': selected})}
key={`${actionKey}-${actionTitle}`}
itemKey={actionKey}
content={actionTitle}
onclick={this.onClick}
selected={selected}
hover={hover} />
<li className="co-namespace-selector__divider">
<div className="dropdown-menu__divider" />
</li>
</React.Fragment>
);
};

_.each(items, (v, k) => addItem(k, v));

return <div className={classNames(className)} ref={this.dropdownElement} style={this.props.style}>
Expand Down Expand Up @@ -348,6 +369,7 @@ export class Dropdown extends DropdownMixin {
onClick={e => e.stopPropagation()} />
</div>
}
{ actionItem ? <ActionRow /> : null}
{ bookMarkRows }
{_.size(bookMarkRows) ? <li className="co-namespace-selector__divider"><div className="dropdown-menu__divider" /></li> : null}
{rows}
Expand All @@ -362,6 +384,10 @@ Dropdown.propTypes = {
autocompleteFilter: PropTypes.func,
autocompletePlaceholder: PropTypes.string,
canFavorite: PropTypes.bool,
actionItem: PropTypes.objectOf(
PropTypes.string,
PropTypes.string
),
className: PropTypes.string,
defaultBookmarks: PropTypes.objectOf(PropTypes.string),
dropDownClassName: PropTypes.string,
Expand Down

0 comments on commit 63aab5e

Please sign in to comment.