Merge "Show project config weblink on repo access page if it exists"
This commit is contained in:
@@ -47,6 +47,15 @@ limitations under the License.
|
||||
display: inline-block;
|
||||
margin: 1em 0;
|
||||
}
|
||||
.weblink {
|
||||
margin-right: .2em;
|
||||
}
|
||||
.weblinks {
|
||||
display: none;
|
||||
}
|
||||
.weblinks.show {
|
||||
display: block;
|
||||
}
|
||||
</style>
|
||||
<style include="gr-menu-page-styles"></style>
|
||||
<main class$="[[_computeAdminClass(_isAdmin)]]">
|
||||
@@ -60,6 +69,14 @@ limitations under the License.
|
||||
[[_inheritsFrom.name]]</a>
|
||||
</h3>
|
||||
</template>
|
||||
<div class$="weblinks [[_computeWebLinkClass(_weblinks)]]">
|
||||
History:
|
||||
<template is="dom-repeat" items="[[_weblinks]]" as="link">
|
||||
<a href="[[link.url]]" class="weblink" rel="noopener" target="[[link.target]]">
|
||||
[[link.name]]
|
||||
</a>
|
||||
</template>
|
||||
</div>
|
||||
<gr-button id="editBtn"
|
||||
class$="[[_computeShowEditClass(_sections)]]"
|
||||
on-tap="_handleEdit">[[_editOrCancel(_editing)]]</gr-button>
|
||||
|
||||
@@ -94,6 +94,7 @@
|
||||
value: false,
|
||||
},
|
||||
_sections: Array,
|
||||
_weblinks: Array,
|
||||
},
|
||||
|
||||
behaviors: [
|
||||
@@ -123,6 +124,7 @@
|
||||
this._inheritsFrom = res.inherits_from;
|
||||
this._local = res.local;
|
||||
this._groups = res.groups;
|
||||
this._weblinks = res.config_web_links || [];
|
||||
return this.toSortedArray(this._local);
|
||||
}));
|
||||
|
||||
@@ -153,6 +155,10 @@
|
||||
return editing ? 'Cancel' : 'Edit';
|
||||
},
|
||||
|
||||
_computeWebLinkClass(weblinks) {
|
||||
return weblinks.length ? 'show' : '';
|
||||
},
|
||||
|
||||
_handleEditingChanged(editing, editingOld) {
|
||||
// Ignore when editing gets set initially.
|
||||
if (!editingOld || editing) { return; }
|
||||
|
||||
@@ -64,6 +64,11 @@ limitations under the License.
|
||||
name: 'Maintainers',
|
||||
},
|
||||
},
|
||||
config_web_links: [{
|
||||
name: 'gitiles',
|
||||
target: '_blank',
|
||||
url: 'https://my/site/+log/123/project.config',
|
||||
}],
|
||||
};
|
||||
const accessRes2 = {
|
||||
local: {
|
||||
@@ -147,11 +152,15 @@ limitations under the License.
|
||||
assert.deepEqual(element._sections,
|
||||
element.toSortedArray(accessRes.local));
|
||||
assert.deepEqual(element._labels, repoRes.labels);
|
||||
assert.equal(getComputedStyle(element.$$('.weblinks')).display,
|
||||
'block');
|
||||
return element._repoChanged('Another New Repo');
|
||||
})
|
||||
.then(() => {
|
||||
assert.deepEqual(element._sections,
|
||||
element.toSortedArray(accessRes2.local));
|
||||
assert.equal(getComputedStyle(element.$$('.weblinks')).display,
|
||||
'none');
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user