-
Notifications
You must be signed in to change notification settings - Fork 286
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- fix table striping - remove observer - fix search highlighting - action, this, {{on}}, etc. - use Ui:Disclosure
- Loading branch information
Showing
14 changed files
with
97 additions
and
145 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
import { computed, get } from '@ember/object'; | ||
import { action, computed, get } from '@ember/object'; | ||
import { isEmpty } from '@ember/utils'; | ||
import Controller, { inject as controller } from '@ember/controller'; | ||
import { inject as service } from '@ember/service'; | ||
|
@@ -14,13 +14,7 @@ export default Controller.extend({ | |
showEmpty: and('initialEmpty', 'modelEmpty'), | ||
|
||
/** | ||
* Service used for storage. Storage is | ||
* needed for remembering if the user closed the warning | ||
* as it might get mildly annoying for devs to see and close | ||
* the trivial warning every time. | ||
* The default storage service is local storage however we | ||
* fall back to memory storage if local storage is disabled (For | ||
* example as a security setting in Chrome). | ||
* Storage is needed for remembering if the user closed the warning | ||
* | ||
* @property storage | ||
* @type {Service} | ||
|
@@ -30,7 +24,6 @@ export default Controller.extend({ | |
|
||
/** | ||
* Checks if the user previously closed the warning by referencing localStorage | ||
* it is a computed get/set property. | ||
* | ||
* @property isWarningClosed | ||
* @type {Boolean} | ||
|
@@ -55,18 +48,6 @@ export default Controller.extend({ | |
return this.isWarningClosed ? 31 : 56; | ||
}), | ||
|
||
actions: { | ||
/** | ||
* This action when triggered, closes the warning message for rendering times being inaccurate | ||
* and sets `isWarningClosed` value to true, thus preventing the warning from being shown further. | ||
* | ||
* @method closeWarning | ||
*/ | ||
closeWarning() { | ||
this.set('isWarningClosed', true); | ||
} | ||
}, | ||
|
||
// bound to the input field, updates the `search` property | ||
// 300ms after changing | ||
searchValue: debounceComputed('search', 300), | ||
|
@@ -79,15 +60,19 @@ export default Controller.extend({ | |
}), | ||
|
||
filtered: computed('[email protected]', 'search', function() { | ||
return get(this, 'model').filter((item) => { | ||
let search = this.escapedSearch; | ||
if (isEmpty(search)) { | ||
return true; | ||
} | ||
let regExp = new RegExp(search); | ||
return !!recursiveMatch(item, regExp); | ||
if (isEmpty(this.escapedSearch)) { | ||
return this.model; | ||
} | ||
|
||
return this.model.filter((item) => { | ||
const regExp = new RegExp(this.escapedSearch); | ||
return recursiveMatch(item, regExp); | ||
}); | ||
}), | ||
|
||
closeWarning: action(function() { | ||
this.set('isWarningClosed', true); | ||
}) | ||
}); | ||
|
||
function recursiveMatch(item, regExp) { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,41 @@ | ||
<tr | ||
style={{nodeStyle}} | ||
class="list__row js-render-profile-item" | ||
> | ||
{{#list.cell | ||
class=(concat "list__cell_main " expandedClass " js-render-main-cell") | ||
on-click=(action "toggleExpand") | ||
style=nameStyle | ||
}} | ||
<span class="list__cell-arrow"></span> | ||
<Ui::Disclosure as |disclosure|> | ||
<tr | ||
style={{this.nodeStyle}} | ||
class="list__row js-render-profile-item" | ||
> | ||
{{#list.cell | ||
class="list__cell_main js-render-main-cell" | ||
on-click=disclosure.toggle | ||
style=this.nameStyle | ||
}} | ||
{{#if this.hasChildren}} | ||
<disclosure.triangleIcon /> | ||
{{/if}} | ||
|
||
<span title={{model.name}}> | ||
<span class="js-render-profile-name">{{model.name}}</span> | ||
</span> | ||
{{/list.cell}} | ||
<span title={{@model.name}}> | ||
<span class="js-render-profile-name">{{@model.name}}</span> | ||
</span> | ||
{{/list.cell}} | ||
|
||
{{#list.cell class="list__cell_value_numeric"}} | ||
<span class="pill js-render-profile-duration"> | ||
{{ms-to-time model.duration}} | ||
</span> | ||
{{/list.cell}} | ||
{{#list.cell class="list__cell_value_numeric"}} | ||
<span class="pill js-render-profile-duration"> | ||
{{ms-to-time @model.duration}} | ||
</span> | ||
{{/list.cell}} | ||
|
||
{{#list.cell class="list__cell_value_numeric js-render-profile-timestamp"}} | ||
{{readableTime}} | ||
{{/list.cell}} | ||
</tr> | ||
{{#list.cell class="list__cell_value_numeric js-render-profile-timestamp"}} | ||
{{this.readableTime}} | ||
{{/list.cell}} | ||
</tr> | ||
|
||
{{#if isExpanded}} | ||
{{#each model.children as |child|}} | ||
{{render-item model=child target=this list=list}} | ||
{{/each}} | ||
{{/if}} | ||
{{#if disclosure.isExpanded}} | ||
{{#each @model.children as |child|}} | ||
<RenderItem | ||
@model={{child}} | ||
@target={{this}} | ||
@list={{@list}} | ||
@search={{@search}} | ||
/> | ||
{{/each}} | ||
{{/if}} | ||
</Ui::Disclosure> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { default } from 'ui/components/disclosure'; |
This file was deleted.
Oops, something went wrong.
24 changes: 16 additions & 8 deletions
24
lib/ui/app/templates/components/ui/disclosure-triangle.hbs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,16 @@ | ||
<button | ||
class="disclosure-triangle {{if @expanded "expanded" "collapsed"}}" | ||
{{on "click" @toggle}} | ||
...attributes | ||
> | ||
{{svg-jar "disclosure-triangle" width="9px" height="9px"}} | ||
</button> | ||
|
||
{{#if @toggle}} | ||
<button | ||
class="disclosure-triangle {{if @expanded "expanded" "collapsed"}}" | ||
{{on "click" @toggle}} | ||
...attributes | ||
> | ||
{{svg-jar "disclosure-triangle" width="9px" height="9px"}} | ||
</button> | ||
{{else}} | ||
<span | ||
class="disclosure-triangle {{if @expanded "expanded" "collapsed"}}" | ||
...attributes | ||
> | ||
{{svg-jar "disclosure-triangle" width="9px" height="9px"}} | ||
</span> | ||
{{/if}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{{yield (hash | ||
isExpanded=this.isExpanded | ||
toggle=this.toggle | ||
triangleIcon=(component "ui/disclosure-triangle" expanded=this.isExpanded) | ||
triangleButton=(component "ui/disclosure-triangle" expanded=this.isExpanded toggle=this.toggle) | ||
)}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters