Skip to content

Commit 4c0ebcf

Browse files
committed
Fix plugin name when fetching plugins built from GitHub
The plugins built from GitHub have the '-gh' in their job name, therefore the plugin name needs to have that suffix removed. Make the source visible in the output table so that the Gerrit admin can consciously know which ones are coming from the gerrit-review and are therefore Apache 2.0 and the ones coming from github, where the license could be different. Change-Id: I543572564e8dcec9956d0351b42becd25bde4a8d
1 parent 2edc92e commit 4c0ebcf

File tree

3 files changed

+19
-3
lines changed

3 files changed

+19
-3
lines changed

jenkins-docker/server/plugin-manager/css/style.css

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,3 +62,13 @@ div.top-header {
6262
.navbar-form input.searchbox {
6363
width: 400px;
6464
}
65+
66+
span.text-bg-warning {
67+
background-color: RGBA(255, 193, 7, 1);
68+
color: #000!important;
69+
}
70+
71+
span.text-bg-primary {
72+
background-color: RGBA(13, 110, 253, 1);
73+
color: #fff!important;
74+
}

jenkins-docker/server/plugin-manager/index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,14 @@
5252
<table class="table table-striped">
5353
<thead>
5454
<tr>
55-
<th>Plugin Name</th>
55+
<th>Plugin Name | Source</th>
5656
<th>Version</th>
5757
<th>Actions</th>
5858
</tr>
5959
</thead>
6060
<tbody>
6161
<tr ng-repeat="prop in plugins.list | filter:searchPlugin">
62-
<td><h4>{{prop.id}}<br/><small>{{prop.description.split('.')[0]}}</small></h4></td>
62+
<td><h4>{{prop.id}} <span class="badge {{prop.css}}">{{prop.source}}</span><br/><small>{{prop.description.split('.')[0]}}</small></h4></td>
6363
<td>
6464
<p>{{prop.version}}</p>
6565
<div ng-if="prop.update_version">

jenkins-docker/server/plugin-manager/js/plugin-manager.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,11 @@ var app = angular.module('PluginManager', []).controller(
6060
if (!pluginNameMatches) {
6161
return;
6262
}
63-
var pluginName = pluginNameMatches[2];
63+
64+
var isGitHub = pluginNameMatches[2].endsWith("-gh");
65+
var source = isGitHub ? "GitHub" : "Gerrit";
66+
var css = isGitHub ? "text-bg-warning" : "text-bg-primary";
67+
var pluginName = pluginNameMatches[2].replace("-gh", "");
6468
$http.get($scope.getBaseUrl() + '/job/' + plugin.name + '/lastSuccessfulBuild/artifact/bazel-bin/plugins/' + pluginName + '/' + pluginName + '.json', plugins.httpConfig)
6569
.then(function successCallback(pluginResponse) {
6670
var currRow = $scope.pluginIndexOf(pluginName);
@@ -79,6 +83,8 @@ var app = angular.module('PluginManager', []).controller(
7983
var fileEnding = plugin.name.match(uiPluginRegex) ? '.js' : '.jar';
8084
currPlugin.url = $scope.getBaseUrl() + '/job/' + plugin.name + '/lastSuccessfulBuild/artifact/bazel-bin/plugins/' + pluginName + '/' + pluginName + fileEnding;
8185
currPlugin.description = pluginResponse.data.description;
86+
currPlugin.source = source;
87+
currPlugin.css = css;
8288

8389
if (currRow < 0) {
8490
plugins.list.push(currPlugin);

0 commit comments

Comments
 (0)