Skip to content
This repository was archived by the owner on Jan 11, 2023. It is now read-only.

Project Search (components)#3089

Merged
jasonLaster merged 2 commits into
firefox-devtools:masterfrom
jasonLaster:project-search
Jun 5, 2017
Merged

Project Search (components)#3089
jasonLaster merged 2 commits into
firefox-devtools:masterfrom
jasonLaster:project-search

Conversation

@jasonLaster
Copy link
Copy Markdown
Contributor

Associated Issue: #1108

Summary of Changes

  • starts the UI Component TextSearch
  • starts the util for searching
  • adds a bunch of stories

Copy link
Copy Markdown
Contributor

@codehag codehag left a comment

Choose a reason for hiding this comment

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

Great work! a few comments on the progress so far

}

function searchResults(sources: SourcesMap, query) {
if (false) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

this looks weird, because we will never enter this loop. should it be deleted, or updated to be meaningful?

this.props.toggleProjectSearch(false);
}

renderFileSearch() {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

should this be used in render? it looks like it has logic that was moved out of the render function

font-family: monospace
}

.project-text-search .result .line-number {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

this is getting pretty specific. maybe we could use BEM to keep this from going too far. maybe something like
.project-text-search__line-number. Also result seems like a bit of a dangerous css selector, as I can see it being used in a lot of places for different purposes.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

yeah - these are throw away styles. I think something BEM like would be better

return dom.div(
{
className: "file-result",
style: {}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

do we need style here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

oops, i'll remove it, but these are throw away as i was quickly sketching

itemHeight: 20,
autoExpand: 1,
autoExpandDepth: 1,
getParent: item => null,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

do we need item here? it seems like getParent will always return null


renderResults() {
const { results } = this.props;
return ManagedTree({
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

this is very complex, it feels like most of these callbacks belong to ManagedTree. Maybe a job for a future refactoring

}

setExpanded(item: ManagedTreeItem, isExpanded: boolean) {
setExpanded(item: Item, isExpanded: boolean) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

👍

}

renderListItem(item: ResultListItem, index: number) {
const { selectItem, selected } = this.props;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

👍

@jasonLaster jasonLaster changed the title first draft Project Search (components) Jun 5, 2017
Copy link
Copy Markdown
Contributor Author

@jasonLaster jasonLaster left a comment

Choose a reason for hiding this comment

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

a couple things are left in because the new component was sketched quickly. I assume someone will come in and clean it up

placeholder: L10N.getStr("sourceSearch.search"),
size: "big"
TextSearch({
sources
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

we should move this to a separate render function

font-family: monospace
}

.project-text-search .result .line-number {
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

yeah - these are throw away styles. I think something BEM like would be better

return dom.div(
{
className: "file-result",
style: {}
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

oops, i'll remove it, but these are throw away as i was quickly sketching

@codecov
Copy link
Copy Markdown

codecov Bot commented Jun 5, 2017

Codecov Report

Merging #3089 into master will increase coverage by 0.18%.
The diff coverage is 95%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #3089      +/-   ##
==========================================
+ Coverage   66.15%   66.33%   +0.18%     
==========================================
  Files          74       75       +1     
  Lines        2603     2620      +17     
  Branches      527      528       +1     
==========================================
+ Hits         1722     1738      +16     
- Misses        881      882       +1
Impacted Files Coverage Δ
src/components/shared/ResultList.js 100% <100%> (ø) ⬆️
src/utils/project-search.js 93.75% <93.75%> (ø)

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 92b200f...efb66b8. Read the comment docs.

@codecov
Copy link
Copy Markdown

codecov Bot commented Jun 5, 2017

Codecov Report

Merging #3089 into master will decrease coverage by 0.34%.
The diff coverage is 95%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #3089      +/-   ##
==========================================
- Coverage   66.67%   66.33%   -0.35%     
==========================================
  Files          75       75              
  Lines        2677     2620      -57     
  Branches      542      528      -14     
==========================================
- Hits         1785     1738      -47     
+ Misses        892      882      -10
Impacted Files Coverage Δ
src/components/shared/ResultList.js 100% <100%> (ø) ⬆️
src/utils/project-search.js 93.75% <93.75%> (ø)
src/actions/breakpoints.js 85.91% <0%> (-2.13%) ⬇️
src/reducers/sources.js 78.83% <0%> (-1.31%) ⬇️
src/utils/breakpoint/index.js
src/client/firefox/commands.js 20% <0%> (+0.41%) ⬆️
src/actions/sources.js 51.87% <0%> (+0.6%) ⬆️
src/reducers/breakpoints.js 90.57% <0%> (+1.54%) ⬆️
src/utils/utils.js 25% <0%> (+6.81%) ⬆️
... and 1 more

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 0329e1a...0b6cff6. Read the comment docs.

@jasonLaster jasonLaster merged commit 79932a7 into firefox-devtools:master Jun 5, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants