Skip to content
This repository has been archived by the owner on Oct 1, 2018. It is now read-only.

feat(operators): add searchbar #264

Closed

Conversation

niklas-wortmann
Copy link
Member

closes #254

@codecov-io
Copy link

codecov-io commented Feb 14, 2018

Codecov Report

❗ No coverage uploaded for pull request base (master@91a3918). Click here to learn what that means.
The diff coverage is 80%.

Impacted file tree graph

@@            Coverage Diff            @@
##             master     #264   +/-   ##
=========================================
  Coverage          ?   79.64%           
=========================================
  Files             ?       17           
  Lines             ?      226           
  Branches          ?       10           
=========================================
  Hits              ?      180           
  Misses            ?       44           
  Partials          ?        2
Impacted Files Coverage Δ
src/app/operators/operators.component.ts 88.46% <80%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 91a3918...141c3e1. Read the comment docs.

@knitcodemonkey
Copy link
Contributor

It looks like there is a merge conflict here. Can you resolve that?

Copy link
Contributor

@knitcodemonkey knitcodemonkey left a comment

Choose a reason for hiding this comment

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

Accessibility-wise, this looks fine. I'll have to double check it, again, once it's merged.

@niklas-wortmann
Copy link
Member Author

thank you for your review. To be honest I would have expected several issues, but I'm totally fine with it :D

withLatestFrom,
flatMap,
map,
merge,
Copy link
Collaborator

Choose a reason for hiding this comment

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

There are imports here which are unused.

@ashwin-sureshkumar
Copy link
Collaborator

@jwo719 Also, while you filter down there is an empty space created for each of the category group that doesn't have any operators for the filtered value.

screen shot 2018-02-20 at 9 09 33 am

@btroncone
Copy link
Collaborator

Just a style preference, but I would consider removing the floating placeholder for the search bar. I'm also not sure if we need the bottom line or if we could use the below header to frame it. What do you all think?

image

<mat-nav-list *ngFor="let category of categories"
class="operator-list">
<h3 mat-subheader
class="category-subheader">{{ category }}</h3>
<h3 mat-subheader class="category-subheader" *ngIf="(groupedOperators[category] | filter: searchInput.value).length > 0">{{ category }}</h3>
Copy link
Contributor

@jotatoledo jotatoledo Feb 26, 2018

Choose a reason for hiding this comment

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

This wont have a good performance as the # of operators increase, as the filtering is run 2 times. Wouldn't it be better to make the collection of operators mapped to category reactive?

Idea:

Build from Map<category => operator[]> a Map<category => Observable<operator[]>>

Copy link
Member Author

Choose a reason for hiding this comment

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

yeah I had that idea too, but last time I was simply to supid to implement it that way. But you are definetly right, I will give it another try :D

if (!items || !filter) {
return items;
}
return items.filter(item => item.name.indexOf(filter) !== -1);
Copy link
Contributor

Choose a reason for hiding this comment

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

I don´t like the pipe approach for this case.

Having no type is a two edged blade: doesn't tight the use of the pipe with a concrete type, but you lose type check at compile time.

@jsonberry
Copy link

@btroncone agreed on removal of floating placeholder and bottom line.

A UX concern I have is that the user is required to delete characters from search in order to reset the list. I think there should be an automatic clearing of the search if an operator is selected, and/or a reset button should be available.

Perhaps we could...

  • Change placeholder to a traditional placeholder, use a color lighter than Material black, possibly a hint color
  • Remove search icon
  • Add reset button, where the search icon currently is, show only when the input is not empty

@@ -21,6 +21,7 @@ import { WalkthroughComponent } from './components/walkthrough/walkthrough.compo
import { HighlightJsDirective } from './directives/highlight-js.directive';
import { SafeUrlPipe } from './pipes/safe-url.pipe';
import { MaterialModule } from '../material/material.module';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
Copy link
Contributor

Choose a reason for hiding this comment

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

I think the import of FormsModule isn't required. At least in the refactored component ngModel hasn't been used.

BTW, could we keep a consistent import style? Maybe the one explained in the angular style guide

<form>
<mat-form-field class="full-width-form">
<mat-label>Search</mat-label>
<input matInput value="" [formControl]="searchInput">
Copy link
Contributor

Choose a reason for hiding this comment

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

Considering that this input is model driven and not template drive, could you move the value initialization of the formControl into the component? IMO is cleaner to not mix template/model driven when possible.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

UX Improvement: Add instant search to Sidebar
8 participants