Rename "Project" to "Repo" in some visual labels

Despite the size of this commit, the change is cosmetic. While renaming
the "Project" key in the change metadata is straightforward, renaming
the change list column header involves work in multiple components. This
is because the headers to be shown are defined inside the change table
behavior and are used by multiple other components. Consequently, the
label is renamed in users of that behavior and tests are updated.

Also remove a redundant test, rename change table methods for
consistency, and update labels in notification settings.

Bug: Issue 7755
Change-Id: I174c3fa203725f63b79dec86280263d6299f73cf
This commit is contained in:
Wyatt Allen
2018-07-26 12:02:41 -07:00
parent 79972960f1
commit 06a7d0ef5b
10 changed files with 42 additions and 60 deletions

View File

@@ -30,7 +30,7 @@ limitations under the License.
'Status',
'Owner',
'Assignee',
'Project',
'Repo',
'Branch',
'Updated',
'Size',

View File

@@ -63,7 +63,7 @@ limitations under the License.
'Status',
'Owner',
'Assignee',
'Project',
'Repo',
'Branch',
'Updated',
'Size',
@@ -74,7 +74,7 @@ limitations under the License.
'Subject',
'Status',
'Assignee',
'Project',
'Repo',
'Branch',
'Size',
];
@@ -83,13 +83,13 @@ limitations under the License.
});
test('isColumnHidden', () => {
const columnToCheck = 'Project';
const columnToCheck = 'Repo';
let columnsToDisplay = [
'Subject',
'Status',
'Owner',
'Assignee',
'Project',
'Repo',
'Branch',
'Updated',
'Size',

View File

@@ -169,21 +169,21 @@ limitations under the License.
<span class="placeholder">--</span>
</template>
</td>
<td class="cell project"
hidden$="[[isColumnHidden('Project', visibleChangeTableColumns)]]">
<a class="fullProject" href$="[[_computeProjectURL(change)]]">
[[_computeProjectDisplay(change)]]
<td class="cell repo"
hidden$="[[isColumnHidden('Repo', visibleChangeTableColumns)]]">
<a class="fullRepo" href$="[[_computeRepoUrl(change)]]">
[[_computeRepoDisplay(change)]]
</a>
<a
class="truncatedProject"
href$="[[_computeProjectURL(change)]]"
title$="[[_computeProjectDisplay(change)]]">
[[_computeProjectDisplay(change, 'true')]]
class="truncatedRepo"
href$="[[_computeRepoUrl(change)]]"
title$="[[_computeRepoDisplay(change)]]">
[[_computeRepoDisplay(change, 'true')]]
</a>
</td>
<td class="cell branch"
hidden$="[[isColumnHidden('Branch', visibleChangeTableColumns)]]">
<a href$="[[_computeProjectBranchURL(change)]]">
<a href$="[[_computeRepoBranchURL(change)]]">
[[change.branch]]
</a>
<template is="dom-if" if="[[change.topic]]">

View File

@@ -131,12 +131,12 @@
return '';
},
_computeProjectURL(change) {
_computeRepoUrl(change) {
return Gerrit.Nav.getUrlForProjectChanges(change.project, true,
change.internalHost);
},
_computeProjectBranchURL(change) {
_computeRepoBranchURL(change) {
return Gerrit.Nav.getUrlForBranch(change.branch, change.project, null,
change.internalHost);
},
@@ -155,7 +155,7 @@
* truncated. If this value is truthy, the name will be truncated.
* @return {string}
*/
_computeProjectDisplay(change, truncate) {
_computeRepoDisplay(change, truncate) {
if (!change || !change.project) { return ''; }
let str = '';
if (change.internalHost) { str += change.internalHost + '/'; }

View File

@@ -125,7 +125,7 @@ limitations under the License.
'Status',
'Owner',
'Assignee',
'Project',
'Repo',
'Branch',
'Updated',
'Size',
@@ -135,31 +135,13 @@ limitations under the License.
for (const column of element.columnNames) {
const elementClass = '.' + column.toLowerCase();
assert.isOk(element.$$(elementClass),
`Expect ${elementClass} element to be found`);
assert.isFalse(element.$$(elementClass).hidden);
}
});
test('no hidden columns', () => {
element.visibleChangeTableColumns = [
'Subject',
'Status',
'Owner',
'Assignee',
'Project',
'Branch',
'Updated',
'Size',
];
flushAsynchronousOperations();
for (const column of element.columnNames) {
const elementClass = '.' + column.toLowerCase();
assert.isFalse(element.$$(elementClass).hidden);
}
});
test('project column hidden', () => {
test('repo column hidden', () => {
element.visibleChangeTableColumns = [
'Subject',
'Status',
@@ -174,7 +156,7 @@ limitations under the License.
for (const column of element.columnNames) {
const elementClass = '.' + column.toLowerCase();
if (column === 'Project') {
if (column === 'Repo') {
assert.isTrue(element.$$(elementClass).hidden);
} else {
assert.isFalse(element.$$(elementClass).hidden);
@@ -274,17 +256,17 @@ limitations under the License.
[change.topic, change.internalHost]);
});
test('_computeProjectDisplay', () => {
test('_computeRepoDisplay', () => {
const change = {
project: 'a/test/repo',
internalHost: 'host',
};
assert.equal(element._computeProjectDisplay(change), 'host/a/test/repo');
assert.equal(element._computeProjectDisplay(change, true),
assert.equal(element._computeRepoDisplay(change), 'host/a/test/repo');
assert.equal(element._computeRepoDisplay(change, true),
'host/…/test/repo');
delete change.internalHost;
assert.equal(element._computeProjectDisplay(change), 'a/test/repo');
assert.equal(element._computeProjectDisplay(change, true),
assert.equal(element._computeRepoDisplay(change), 'a/test/repo');
assert.equal(element._computeRepoDisplay(change, true),
'…/test/repo');
});
});

View File

@@ -310,7 +310,7 @@ limitations under the License.
'Status',
'Owner',
'Assignee',
'Project',
'Repo',
'Branch',
'Updated',
'Size',
@@ -349,10 +349,10 @@ limitations under the License.
flushAsynchronousOperations();
});
test('all columns except project visible', () => {
test('all columns except repo visible', () => {
for (const column of element.changeTableColumns) {
const elementClass = '.' + column.toLowerCase();
if (column === 'Project') {
if (column === 'Repo') {
assert.isTrue(element.$$(elementClass).hidden);
} else {
assert.isFalse(element.$$(elementClass).hidden);

View File

@@ -192,7 +192,7 @@ limitations under the License.
</section>
</template>
<section>
<span class="title">Project</span>
<span class="title">Repo</span>
<span class="value">
<a href$="[[_computeProjectURL(change.project)]]">
<gr-limited-text limit="40" text="[[change.project]]"></gr-limited-text>

View File

@@ -47,7 +47,7 @@ limitations under the License.
'Status',
'Owner',
'Assignee',
'Project',
'Repo',
'Branch',
'Updated',
];
@@ -90,7 +90,7 @@ limitations under the License.
'Status',
'Owner',
'Assignee',
'Project',
'Repo',
'Branch',
'Updated',
]);
@@ -151,7 +151,7 @@ limitations under the License.
'Status',
'Owner',
'Assignee',
'Project',
'Repo',
'Branch',
'Updated',
]);
@@ -163,7 +163,7 @@ limitations under the License.
'Status',
'Owner',
'Assignee',
'Project',
'Repo',
'Branch',
'Updated',
'Size',

View File

@@ -49,7 +49,7 @@ limitations under the License.
<table id="watchedProjects">
<thead>
<tr>
<th class="projectHeader">Project</th>
<th>Repo</th>
<template is="dom-repeat" items="[[_getTypes()]]">
<th class="notifType">[[item.name]]</th>
</template>
@@ -98,7 +98,7 @@ limitations under the License.
id="newProject"
query="[[_query]]"
threshold="1"
placeholder="Project"></gr-autocomplete>
placeholder="Repo"></gr-autocomplete>
</th>
<th colspan$="[[_getTypeCount()]]">
<input

View File

@@ -116,7 +116,7 @@ limitations under the License.
.updated,
.size,
.status,
.project {
.repo {
white-space: nowrap;
}
.star {
@@ -136,7 +136,7 @@ limitations under the License.
.topHeader .label {
border: none;
}
.truncatedProject {
.truncatedRepo {
display: none;
}
@media only screen and (max-width: 150em) {
@@ -147,10 +147,10 @@ limitations under the License.
max-width: 18rem;
text-overflow: ellipsis;
}
.truncatedProject {
.truncatedRepo {
display: inline-block;
}
.fullProject {
.fullRepo {
display: none;
}
}
@@ -186,7 +186,7 @@ limitations under the License.
.topHeader,
.leftPadding,
.status,
.project,
.repo,
.branch,
.updated,
.label,