Merge "Only link to plugin URL if a plugin URL exists"
diff --git a/polygerrit-ui/app/elements/admin/gr-plugin-list/gr-plugin-list.html b/polygerrit-ui/app/elements/admin/gr-plugin-list/gr-plugin-list.html
index 7d12e96..57cc771 100644
--- a/polygerrit-ui/app/elements/admin/gr-plugin-list/gr-plugin-list.html
+++ b/polygerrit-ui/app/elements/admin/gr-plugin-list/gr-plugin-list.html
@@ -45,7 +45,12 @@
<template is="dom-repeat" items="[[_shownPlugins]]">
<tr class="table">
<td class="name">
- <a href$="[[_computePluginUrl(item.index_url)]]">[[item.id]]</a>
+ <template is="dom-if" if="[[item.index_url]]">
+ <a href$="[[_computePluginUrl(item.index_url)]]">[[item.id]]</a>
+ </template>
+ <template is="dom-if" if="[[!item.index_url]]">
+ [[item.id]]
+ </template>
</td>
<td class="version">[[item.version]]</td>
<td class="status">[[_status(item)]]</td>
diff --git a/polygerrit-ui/app/elements/admin/gr-plugin-list/gr-plugin-list_test.html b/polygerrit-ui/app/elements/admin/gr-plugin-list/gr-plugin-list_test.html
index 52f1a22..fea8069 100644
--- a/polygerrit-ui/app/elements/admin/gr-plugin-list/gr-plugin-list_test.html
+++ b/polygerrit-ui/app/elements/admin/gr-plugin-list/gr-plugin-list_test.html
@@ -35,12 +35,16 @@
<script>
let counter;
const pluginGenerator = () => {
- return {
+ const plugin = {
id: `test${++counter}`,
- index_url: `plugins/test${counter}/`,
version: '3.0-SNAPSHOT',
disabled: false,
};
+
+ if (counter !== 2) {
+ plugin.index_url = `plugins/test${counter}/`;
+ }
+ return plugin;
};
suite('gr-plugin-list tests', () => {
@@ -82,6 +86,17 @@
});
});
+ test('with and without urls', done => {
+ flush(() => {
+ const names = Polymer.dom(element.root).querySelectorAll('.name');
+ assert.isOk(names[1].querySelector('a'));
+ assert.equal(names[1].querySelector('a').innerText, 'test1');
+ assert.isNotOk(names[2].querySelector('a'));
+ assert.equal(names[2].innerText, 'test2');
+ done();
+ });
+ });
+
test('_shownPlugins', () => {
assert.equal(element._shownPlugins.length, 25);
});