| <!-- | |
| Copyright (C) 2019 The Android Open Source Project | |
| Licensed under the Apache License, Version 2.0 (the "License"); | |
| you may not use this file except in compliance with the License. | |
| You may obtain a copy of the License at | |
| http://www.apache.org/licenses/LICENSE-2.0 | |
| Unless required by applicable law or agreed to in writing, software | |
| distributed under the License is distributed on an "AS IS" BASIS, | |
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| See the License for the specific language governing permissions and | |
| limitations under the License. | |
| --> | |
| <dom-module id="gr-task-plugin"> | |
| <template> | |
| <style> | |
| ul { | |
| padding-left: 0.5em; | |
| margin-top: 0; | |
| } | |
| h3 { padding-left: 0.1em; } | |
| .cursor { cursor: pointer; } | |
| #tasks_header { | |
| align-items: center; | |
| background-color: #fafafa; | |
| border-top: 1px solid #ddd; | |
| display: flex; | |
| padding: 6px 1rem; | |
| } | |
| .links { | |
| color: blue; | |
| cursor: pointer; | |
| text-decoration: underline; | |
| } | |
| .no-margins { margin: 0 0 0 0; } | |
| </style> | |
| <div id="tasks" hidden$="[[!_tasks.length]]"> | |
| <div id="tasks_header" style="display: flex;"> | |
| <iron-icon | |
| icon="gr-icons:expand-less" | |
| hidden$="[[!_expand_all]]" | |
| on-tap="_switch_expand" | |
| class="cursor"> </iron-icon> | |
| <iron-icon | |
| icon="gr-icons:expand-more" | |
| hidden$="[[_expand_all]]" | |
| on-tap="_switch_expand" | |
| class="cursor"> </iron-icon> | |
| <div style="display: flex; align-items: center; column-gap: 1em;"> | |
| <h3 class="no-margins" on-tap="_switch_expand" class="cursor"> Tasks </h3> | |
| <template is="dom-if" if="[[_is_show_all(_show_all)]]"> | |
| <p class="no-margins">All ([[_all_count]]) | | |
| <span | |
| on-click="_needs_and_blocked_tap" | |
| class="links">Needs ([[_ready_count]]) + Blocked ([[_fail_count]])</span> | |
| <p> | |
| </template> | |
| <template is="dom-if" if="[[!_is_show_all(_show_all)]]"> | |
| <p class="no-margins"> <span | |
| class="links" | |
| on-click="_show_all_tap">All ([[_all_count]])</span> | |
| | Needs ([[_ready_count]]) + Blocked ([[_fail_count]])</p> | |
| </template> | |
| </div> | |
| </div> | |
| <div hidden$="[[!_expand_all]]"> | |
| <ul style="list-style-type:none;"> | |
| <gr-task-plugin-tasks | |
| tasks="[[_tasks]]" | |
| show_all$="[[_show_all]]"> </gr-task-plugin-tasks> | |
| </ul> | |
| </div> | |
| </div> | |
| </template> | |
| <script src="gr-task-plugin.js"></script> | |
| </dom-module> | |
| <dom-module id="gr-task-plugin-tasks"> | |
| <template> | |
| <template is="dom-repeat" as="task" items="[[tasks]]"> | |
| <template is="dom-if" if="[[_can_show(show_all, task)]]"> | |
| <li style="padding: 0.2em;"> | |
| <style> | |
| /* Matching colors with core code. */ | |
| .green { | |
| color: #9fcc6b; | |
| } | |
| .red { | |
| color: #FFA62F; | |
| } | |
| </style> | |
| <template is="dom-if" if="[[task.icon.id]]"> | |
| <gr-tooltip-content | |
| has-tooltip | |
| title="In Progress"> | |
| <iron-icon | |
| icon="gr-icons:hourglass" | |
| class="green" | |
| hidden$="[[!task.in_progress]]"> | |
| </iron-icon> | |
| </gr-tooltip-content> | |
| <gr-tooltip-content | |
| has-tooltip | |
| title$="[[task.icon.tooltip]]"> | |
| <iron-icon | |
| icon="[[task.icon.id]]" | |
| class$="[[task.icon.color]]"> | |
| </iron-icon> | |
| </gr-tooltip-content> | |
| </template> | |
| [[task.message]] | |
| </li> | |
| </template> | |
| <ul style="list-style-type:none; margin: 0 0 0 0; padding: 0 0 0 2em;"> | |
| <gr-task-plugin-tasks | |
| tasks="[[task.sub_tasks]]" | |
| show_all$="[[show_all]]"> </gr-task-plugin-tasks> | |
| </ul> | |
| </template> | |
| </template> | |
| <script> | |
| Polymer({ | |
| is: 'gr-task-plugin-tasks', | |
| properties: { | |
| tasks: { | |
| type: Array, | |
| notify: true, | |
| value() { return []; }, | |
| }, | |
| show_all: { | |
| type: String, | |
| notify: true, | |
| }, | |
| }, | |
| _can_show(show, task) { | |
| return show === 'true' || task.showOnFilter; | |
| }, | |
| }); | |
| </script> | |
| </dom-module> |