Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(175)

Unified Diff: tracing/tracing/ui/base/tab_view.html

Issue 2653693002: [tracing] Make tab-view rerender after reset/clear
Patch Set: [tracing] Make tab-view rerender after reset/clear Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: tracing/tracing/ui/base/tab_view.html
diff --git a/tracing/tracing/ui/base/tab_view.html b/tracing/tracing/ui/base/tab_view.html
index 0818c83f91fcfb2346fb5841296fc4361fa5d561..8bc1856b7d4b9a79a008ca6b8349a3e3a9a809fa 100644
--- a/tracing/tracing/ui/base/tab_view.html
+++ b/tracing/tracing/ui/base/tab_view.html
@@ -76,23 +76,23 @@ and limit users to having one option selected at a time.
overflow: auto;
}
</style>
- <div id='tabs' hidden="[[tabsHidden]]">
+ <div id=tabs hidden="[[tabsHidden]]">
<label id=selection_description>[[label_]]</label>
- <template is=dom-repeat items=[[subViews_]]>
+ <template is=dom-repeat items="[[wrappedSubViews_]]">
<tab>
- <input type=radio name=tabs id$=[[computeRadioId_(item)]]
- on-change='onTabChanged_'
- checked$='[[isChecked_(item)]]' />
- <label for$=[[computeRadioId_(item)]]>
- <template is=dom-if if=[[item.tabIcon]]>
- <span style$='[[item.tabIcon.style]]'>[[item.tabIcon.text]]</span>
+ <input type=radio name=tabs id$="[[computeRadioId_(item.subView)]]"
+ on-change="onTabChanged_"
+ checked$="[[isChecked_(item.subView, selectedSubView_)]]" />
+ <label for$="[[computeRadioId_(item.subView)]]">
+ <template is=dom-if if="[[item.subView.tabIcon]]">
+ <span style$="[[item.subView.tabIcon.style]]">[[item.subView.tabIcon.text]]</span>
</template>
- [[item.tabLabel]]
+ [[item.subView.tabLabel]]
</label>
</tab>
</template>
</div>
- <div id='subView'></div>
+ <div id="subView"></div>
<content>
</content>
</template>
@@ -113,6 +113,10 @@ Polymer({
type: Array,
value: () => []
},
+ wrappedSubViews_: {
+ type: Array,
+ computed: 'computeWrappedSubViews_(subViews_, subViews_.splices)',
+ },
tabsHidden: {
type: Boolean,
value: false,
@@ -191,7 +195,7 @@ Polymer({
},
onTabChanged_: function(event) {
- this.selectedSubView = event.model.item;
+ this.selectedSubView = event.model.item.subView;
},
isChecked_: function(subView) {
@@ -264,6 +268,13 @@ Polymer({
// uniquify this ID by appending the tab's label with all spaces replaced
// by dashes (because spaces aren't allowed in HTML IDs).
return subView.tagName + '-' + subView.tabLabel.replace(/ /g, '-');
- }
+ },
+
+ computeWrappedSubViews_: function(subViews_) {
+ return subViews_.map((subView) => {
charliea (OOO until 10-5) 2017/01/25 21:41:41 https://developer.mozilla.org/en-US/docs/Web/JavaS
+ return { subView };
+ });
+ },
+
});
</script>
« no previous file with comments | « no previous file | tracing/tracing/ui/base/tab_view_test.html » ('j') | tracing/tracing/ui/base/tab_view_test.html » ('J')

Powered by Google App Engine
This is Rietveld 408576698