Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat(ImageStream): Autocomplete ISTag dropdown #4714

Merged
merged 1 commit into from Mar 20, 2020

Conversation

abhinandan13jan
Copy link
Contributor

@abhinandan13jan abhinandan13jan commented Mar 11, 2020

Fixes:
Addresses https://issues.redhat.com/browse/ODC-2430

Analysis / Root cause:
TypeAhead missing in imagestreamTag dropdown

Solution Description:
TypeAhead(autocompleteFilter) added to imagestreamTagdropdown at the child Dropdown Component

Screenshot
IS_Tag

Test coverage
Added test Suite for Deploy image. Added test for DropdownField

Browser conformation
Chrome 73

@openshift-ci-robot openshift-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Mar 11, 2020
@openshift-ci-robot openshift-ci-robot added component/core Related to console core functionality component/dev-console Related to dev-console component/shared Related to console-shared labels Mar 11, 2020
@openshift-ci-robot openshift-ci-robot added size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Mar 11, 2020
@abhinandan13jan abhinandan13jan changed the title [WIP] Is tag auto Feat(ImageStream): Autocoplete ISTag dropdown Mar 11, 2020
@openshift-ci-robot openshift-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Mar 11, 2020
@karthikjeeyar
Copy link
Contributor

@abhinandan13jan I have verified locally, works as expected
Please use the template in PR description and test case could have assertions like autocomplete property is set or not in the dropdown component.

@abhinandan13jan abhinandan13jan changed the title Feat(ImageStream): Autocoplete ISTag dropdown Feat(ImageStream): Autocomplete ISTag dropdown Mar 11, 2020
@andrewballantyne
Copy link
Contributor

/kind feature

@openshift-ci-robot openshift-ci-robot added the kind/feature Categorizes issue or PR as related to a new feature. label Mar 11, 2020
@@ -44,6 +44,7 @@ export interface DropdownFieldProps extends FieldProps {
title?: React.ReactNode;
fullWidth?: boolean;
disabled?: boolean;
autoComplete?: boolean;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are several instances in the console where an autocompleteFilter other than fuzzy is being used. I suggest we keep the DropdownField generic and accept an auto complete filter function.

Suggested change
autoComplete?: boolean;
autocompleteFilter?: (text: string, item: object, key: string) => boolean;

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated

@@ -28,6 +29,7 @@ const DropdownField: React.FC<DropdownFieldProps> = ({ label, helpText, required
<Dropdown
{...props}
id={fieldId}
autocompleteFilter={props.autoComplete ? fuzzy : undefined}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DropdownField is used in other places like builder image Tag selection. So if it is not configurable we will end up having autocomplete in all the dropdowns.

eg:
image

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated

@@ -1,5 +1,6 @@
import * as React from 'react';
import cx from 'classnames';
import * as fuzzy from 'fuzzysearch';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated

@@ -111,6 +111,7 @@ const ImageStreamTagDropdown: React.FC = () => {
label="Tag"
items={imageStreamTagList}
key={imageStream.image}
autoComplete
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Import fuzzy then:

Suggested change
autoComplete
autocompleteFilter={fuzzy}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated

@openshift-ci-robot openshift-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Mar 13, 2020
@abhinandan13jan abhinandan13jan force-pushed the is-tag-auto branch 2 times, most recently from 5bc72a3 to eae402d Compare March 16, 2020 08:33
Comment on lines 17 to 39
const deployImagePageProps: DeployImagePageProps = {
history: null,
location: {
pathname: 'deploy-image/ns/openshift?preselected-ns=openshift',
search: 'deploy-image/ns/openshift?preselected-ns=openshift',
state: null,
hash: null,
},
match: {
isExact: true,
path: 'deploy-image/ns/openshift?preselected-ns=openshift',
url: 'deploy-image/ns/openshift?preselected-ns=openshift',
params: {
ns: 'my-project',
},
},
};
const deployImagePageWrapper: ReactWrapper = mount(
<DeployImagePage {...deployImagePageProps} />,
{
wrappingComponent: ({ children }) => <Provider store={store}>{children}</Provider>,
},
);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should put this setup in beforeAll() block and declare the variables in describe block

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The props initialization is not working when put in beforeEach/beforeAll? what is wrong with the existing scoping?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All the setup for unit-tests should be done in either beforeAll or beforeEach depending on the usage. it works when put in beforeAll block.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've updated...

Comment on lines 53 to 65
const deployImageProps: DeployImageProps = {
projects: {
data: [],
loaded: false,
},
namespace: 'my-project',
};

const deployImageWrapper: ReactWrapper = mount(<DeployImage {...deployImageProps} />, {
wrappingComponent: ({ children }) => <Provider store={store}>{children}</Provider>,
});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as above

Copy link
Contributor

@sahil143 sahil143 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Mar 18, 2020
@abhinandan13jan
Copy link
Contributor Author

/test images
/test e2e-gcp-console

Comment on lines 30 to 34
path: 'deploy-image/ns/openshift?preselected-ns=openshift',
url: 'deploy-image/ns/openshift?preselected-ns=openshift',
params: {
ns: 'my-project',
},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: we can use same namespace in params and url/path

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated

@openshift-ci-robot openshift-ci-robot removed the lgtm Indicates that a PR is ready to be merged. label Mar 18, 2020
@invincibleJai
Copy link
Member

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Mar 18, 2020
@christianvogt
Copy link
Contributor

/approve

@openshift-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: abhinandan13jan, christianvogt, invincibleJai, sahil143

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Mar 20, 2020
@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-merge-robot openshift-merge-robot merged commit 238ddf7 into openshift:master Mar 20, 2020
@spadgett spadgett added this to the v4.5 milestone Mar 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. component/core Related to console core functionality component/dev-console Related to dev-console component/shared Related to console-shared kind/feature Categorizes issue or PR as related to a new feature. lgtm Indicates that a PR is ready to be merged. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

10 participants