Move table content styling into separate element from list view

Some admin tables (for example plugins) don't have APIs that support
filtering and pagination. It is still advantageous to share styles,
so pull that out into a separate element.

Change-Id: Iad2b40d9af3cc53351973c7c456f1110424a14df
This commit is contained in:
Becky Siegel
2017-06-13 12:32:47 -07:00
parent aa4e317675
commit 0dedeaddf5
4 changed files with 83 additions and 49 deletions

View File

@@ -13,7 +13,7 @@ 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.
-->
<link rel="import" href="./gr-styled-table.html">
<link rel="import" href="../../../behaviors/base-url-behavior/base-url-behavior.html">
<link rel="import" href="../../../behaviors/gr-url-encoding-behavior.html">
<link rel="import" href="../../../bower_components/polymer/polymer.html">
@@ -47,51 +47,6 @@ limitations under the License.
nav a:first-of-type {
margin-right: .5em;
}
::content {
display: flex;
flex-direction: column;
}
::content .loading {
display: none;
}
::content #list {
border-collapse: collapse;
width: 100%;
}
::content #list tr.table {
border-bottom: 1px solid #eee;
}
::content #list td {
flex-shrink: 0;
padding: .3em .5em;
}
::content #list th {
background-color: #ddd;
border-bottom: 1px solid #eee;
font-weight: bold;
padding: .3em .5em;
text-align: left;
}
::content #list a {
color: var(--default-text-color);
text-decoration: none;
}
::content #list a:hover {
text-decoration: underline;
}
::content #list .description {
width: 70%;
}
::content #list .loadingMsg {
color: #666;
display: block;
padding: 1em var(--default-horizontal-margin);
}
::content #list .loadingMsg:not(.loading) {
display: none;
}
</style>
<div id="filterContainer">
<label>Filter:</label>
@@ -100,7 +55,9 @@ limitations under the License.
id="filter"
bind-value="{{_filter}}">
</div>
<content></content>
<gr-styled-table>
<content></content>
</gr-styled-table>
<nav>
<a id="prevArrow"
href$="[[_computeNavLink(offset, -1, itemsPerPage, filter)]]"

View File

@@ -77,8 +77,7 @@ limitations under the License.
assert.equal(url, '/admin/projects/q/filter:test');
done();
});
const e = {target: {value: 'test'}};
element._onValueChange(e);
element._filterChanged('test');
});
test('next button', done => {

View File

@@ -0,0 +1,77 @@
<!--
Copyright (C) 2017 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.
-->
<link rel="import" href="../../../bower_components/polymer/polymer.html">
<link rel="import" href="../../../styles/shared-styles.html">
<dom-module id="gr-styled-table">
<template>
<style include="shared-styles">
::content {
display: flex;
flex-direction: column;
}
::content .loading {
display: none;
}
::content #list {
border-collapse: collapse;
width: 100%;
}
::content #list tr.table {
border-bottom: 1px solid #eee;
}
::content #list td {
flex-shrink: 0;
padding: .3em .5em;
}
::content #list th {
background-color: #ddd;
border-bottom: 1px solid #eee;
font-weight: bold;
padding: .3em .5em;
text-align: left;
}
::content #list a {
color: var(--default-text-color);
text-decoration: none;
}
::content #list a:hover {
text-decoration: underline;
}
::content #list .description {
width: 70%;
}
::content #list .loadingMsg {
color: #666;
display: block;
padding: 1em var(--default-horizontal-margin);
}
::content #list .loadingMsg:not(.loading) {
display: none;
}
</style>
<content></content>
</template>
<script>
(function() {
'use strict';
Polymer({
is: 'gr-styled-table',
});
})();
</script>
</dom-module>

View File

@@ -114,6 +114,7 @@ limitations under the License.
'shared/gr-js-api-interface/gr-js-api-interface_test.html',
'shared/gr-linked-chip/gr-linked-chip_test.html',
'shared/gr-linked-text/gr-linked-text_test.html',
'shared/gr-list-view/gr-list-view_test.html',
'shared/gr-rest-api-interface/gr-rest-api-interface_test.html',
'shared/gr-rest-api-interface/gr-reviewer-updates-parser_test.html',
'shared/gr-select/gr-select_test.html',