Skip to content

Commit

Permalink
[CTFE] Make custom-webpages-sk more generic
Browse files Browse the repository at this point in the history
Bug: skia:7872
Change-Id: Ic10c98703f4ab310ea9fe8ecfba9bd668da1d6ff
Reviewed-on: https://skia-review.googlesource.com/126762
Commit-Queue: Ravi Mistry <[email protected]>
Reviewed-by: Ben Wagner <[email protected]>
  • Loading branch information
rmistry authored and Skia Commit-Bot committed May 9, 2018
1 parent a8c4c7c commit 2156311
Show file tree
Hide file tree
Showing 7 changed files with 101 additions and 111 deletions.
2 changes: 1 addition & 1 deletion ct/elements.html
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@
<link rel="import" href="/res/imp/chromium-analysis-runs-sk.html" />
<link rel="import" href="/res/imp/chromium-perf-sk.html" />
<link rel="import" href="/res/imp/chromium-perf-runs-sk.html" />
<link rel="import" href="/res/imp/custom-webpages-sk.html" />
<link rel="import" href="/res/imp/drawer-sk.html" />
<link rel="import" href="/res/imp/expanding-textarea-sk.html" />
<link rel="import" href="/res/imp/lua-scripts-sk.html" />
<link rel="import" href="/res/imp/lua-script-runs-sk.html" />
<link rel="import" href="/res/imp/metrics-analysis-sk.html" />
Expand Down
10 changes: 5 additions & 5 deletions ct/res/imp/chromium-analysis-sk.html
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@
<td>PageSets Type</td>
<td>
<page-set-selector-sk id="page_sets" page-sets="{{pageSets}}"></page-set-selector-sk>
<custom-webpages-sk id="custom_webpages"></custom-webpages-sk>
<expanding-textarea-sk id="custom_webpages" display-text="Specify custom list of web pages" placeholder-text="Eg: webpage1,webpage2,webpage3"></expanding-textarea-sk>
</td>
</tr>

Expand Down Expand Up @@ -291,10 +291,10 @@
});
this.$.custom_webpages.addEventListener('click', function(e) {
// Do not display the pagesets selector if custom webpages is open.
that.$.page_sets.hidden = that.$.custom_webpages.webpagesOpened;
if (!that.$.custom_webpages.webpagesOpened) {
that.$.page_sets.hidden = that.$.custom_webpages.opened;
if (!that.$.custom_webpages.opened) {
// Clear out webpages if it is no longer open.
that.$.custom_webpages.webpages = '';
that.$.custom_webpages.value = '';
}
});
},
Expand Down Expand Up @@ -385,7 +385,7 @@
var params = {};
params["benchmark"] = this.selectedBenchmarkName;
params["page_sets"] = this.$.page_sets.selected;
params["custom_webpages"] = this.$.custom_webpages.webpages;
params["custom_webpages"] = this.$.custom_webpages.value;
params["match_stdout_txt"] = this.$.match_stdout_txt.value;
params["benchmark_args"] = this.$.benchmark_args.value;
params["browser_args"] = this.$.browser_args.value;
Expand Down
10 changes: 5 additions & 5 deletions ct/res/imp/chromium-perf-sk.html
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@
<td>PageSets Type</td>
<td>
<page-set-selector-sk id="page_sets" page-sets="{{pageSets}}"></page-set-selector-sk>
<custom-webpages-sk id="custom_webpages"></custom-webpages-sk>
<expanding-textarea-sk id="custom_webpages" display-text="Specify custom list of web pages" placeholder-text="Eg: webpage1,webpage2,webpage3"></expanding-textarea-sk>
</td>
</tr>

Expand Down Expand Up @@ -277,10 +277,10 @@
});
this.$.custom_webpages.addEventListener('click', function(e) {
// Do not display the pagesets selector if custom webpages is open.
that.$.page_sets.hidden = that.$.custom_webpages.webpagesOpened;
if (!that.$.custom_webpages.webpagesOpened) {
that.$.page_sets.hidden = that.$.custom_webpages.opened;
if (!that.$.custom_webpages.opened) {
// Clear out webpages if it is no longer open.
that.$.custom_webpages.webpages = '';
that.$.custom_webpages.value = '';
}
});
this.platformChanged();
Expand Down Expand Up @@ -376,7 +376,7 @@
params["benchmark"] = this.selectedBenchmarkName;
params["platform"] = this.$.target_platform.selected;
params["page_sets"] = this.$.page_sets.selected;
params["custom_webpages"] = this.$.custom_webpages.webpages;
params["custom_webpages"] = this.$.custom_webpages.value;
params["repeat_runs"] = this.getRepeatValue();
params["run_in_parallel"] = this.$.run_in_parallel.selected;
params["benchmark_args"] = this.$.benchmark_args.value;
Expand Down
89 changes: 0 additions & 89 deletions ct/res/imp/custom-webpages-sk.html

This file was deleted.

79 changes: 79 additions & 0 deletions ct/res/imp/expanding-textarea-sk.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
<!--
The <expanding-textarea-sk> custom element declaration. Displays a clickable
text link that expands a textarea. The value of the textarea is accessible by
callers via the value attribute.
Attributes:
value: Contains the text entered into the textarea.
displayText: The clickable text that will open/close the textarea.
placeholderText: Is used as a placeholder in the textarea.
Events:
None.
Methods:
None.
-->

<dom-module id="expanding-textarea-sk">
<style>
paper-input {
width: 20em;
}

.long-field {
width: 40em;
}
</style>
<template>
<a href="javascript:void(0);" id="expander">
<iron-icon icon="{{expanderIcon(opened)}}"></iron-icon>
{{displayText}}
</a>
<span class="long-field">
<iron-collapse id="collapser" opened="{{opened}}">
<iron-autogrow-textarea class="long-field" rows=5 max-rows=20 bind-value="{{value}}" placeholder="{{placeholderText}}">
</iron-autogrow-textarea>
</iron-collapse>
</span>
</template>
<script>
Polymer({
is: "expanding-textarea-sk",
properties: {
opened: {
type: Boolean,
value: false,
},
value: {
type: String,
notify: true,
},
displayText: {
type: String,
value: "Expand/Collapse textarea",
},
placeholderText: {
type: String,
value: "",
},
},

ready: function() {
var that = this;
this.$.expander.addEventListener('click', function(e) {
that.$.collapser.toggle();
});
},

expanderIcon: function(opened) {
if (opened) {
return "expand-less";
} else {
return "expand-more";
}
},
});
</script>

</dom-module>
12 changes: 6 additions & 6 deletions ct/res/imp/metrics-analysis-sk.html
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
<td>Source of traces</td>
<td>
<paper-input value="" id="analysis_task_id" class="medium-field" label="Analysis Task Id"></paper-input>
<custom-webpages-sk id="custom_traces" display-text="Specify custom list of traces"></custom-webpages-sk>
<expanding-textarea-sk id="custom_traces" display-text="Specify custom list of traces" placeholder-text="Eg: trace1,trace2,trace3"></expanding-textarea-sk>
</td>
</tr>

Expand Down Expand Up @@ -164,13 +164,13 @@
});
this.$.custom_traces.addEventListener('click', function(e) {
// Do not display the analysis task id field if custom traces is open.
that.$.analysis_task_id.hidden = that.$.custom_traces.webpagesOpened;
if (that.$.custom_traces.webpagesOpened) {
that.$.analysis_task_id.hidden = that.$.custom_traces.opened;
if (that.$.custom_traces.opened) {
// Clear out analysis task id if custom traces is open.
that.$.analysis_task_id.value = '';
} else {
// Clear out traces if it is no longer open.
that.$.custom_traces.webpages = '';
that.$.custom_traces.value = '';
}
});
},
Expand All @@ -185,7 +185,7 @@
this.$.metric_name.focus();
return;
}
if (!this.$.analysis_task_id.value && !this.$.custom_traces.webpages) {
if (!this.$.analysis_task_id.value && !this.$.custom_traces.value) {
sk.errorMessage("Please specify an analysis task id or custom traces");
this.$.analysis_task_id.focus();
return;
Expand Down Expand Up @@ -214,7 +214,7 @@
var params = {};
params["metric_name"] = this.$.metric_name.value;
params["analysis_task_id"] = this.$.analysis_task_id.value;
params["custom_traces"] = this.$.custom_traces.webpages;
params["custom_traces"] = this.$.custom_traces.value;
params["benchmark_args"] = this.$.benchmark_args.value;
params["desc"] = this.$.desc.value;
params["chromium_patch"] = this.$.chromium_patch.patch;
Expand Down
10 changes: 5 additions & 5 deletions ct/res/imp/pixel-diff-sk.html
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
<td>PageSets Type</td>
<td>
<page-set-selector-sk id="page_sets" page-sets="{{pageSets}}"></page-set-selector-sk>
<custom-webpages-sk id="custom_webpages"></custom-webpages-sk>
<expanding-textarea-sk id="custom_webpages" display-text="Specify custom list of web pages" placeholder-text="Eg: webpage1,webpage2,webpage3"></expanding-textarea-sk>
</td>
</tr>

Expand Down Expand Up @@ -170,10 +170,10 @@
});
this.$.custom_webpages.addEventListener('click', function(e) {
// Do not display the pagesets selector if custom webpages is open.
that.$.page_sets.hidden = that.$.custom_webpages.webpagesOpened;
if (!that.$.custom_webpages.webpagesOpened) {
that.$.page_sets.hidden = that.$.custom_webpages.opened;
if (!that.$.custom_webpages.opened) {
// Clear out webpages if it is no longer open.
that.$.custom_webpages.webpages = '';
that.$.custom_webpages.value = '';
}
});
},
Expand Down Expand Up @@ -219,7 +219,7 @@
queueTask: function() {
var params = {};
params["page_sets"] = this.$.page_sets.selected;
params["custom_webpages"] = this.$.custom_webpages.webpages;
params["custom_webpages"] = this.$.custom_webpages.value;
params["benchmark_args"] = this.$.benchmark_args.value;
params["browser_args_nopatch"] = this.$.browser_args_nopatch.value;
params["browser_args_withpatch"] = this.$.browser_args_withpatch.value;
Expand Down

0 comments on commit 2156311

Please sign in to comment.