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
diff --git a/jenkins-docker/server/plugin-manager/css/style.css b/jenkins-docker/server/plugin-manager/css/style.css
index 2bc779f..87e26a8 100644
--- a/jenkins-docker/server/plugin-manager/css/style.css
+++ b/jenkins-docker/server/plugin-manager/css/style.css
@@ -62,3 +62,13 @@
 .navbar-form input.searchbox {
   width: 400px;
 }
+
+span.text-bg-warning {
+  background-color: RGBA(255, 193, 7, 1);
+  color: #000!important;
+}
+
+span.text-bg-primary {
+  background-color: RGBA(13, 110, 253, 1);
+  color: #fff!important;
+}
diff --git a/jenkins-docker/server/plugin-manager/index.html b/jenkins-docker/server/plugin-manager/index.html
index 7fc6602..4dbd229 100644
--- a/jenkins-docker/server/plugin-manager/index.html
+++ b/jenkins-docker/server/plugin-manager/index.html
@@ -52,14 +52,14 @@
       <table class="table table-striped">
         <thead>
           <tr>
-            <th>Plugin Name</th>
+            <th>Plugin Name | Source</th>
             <th>Version</th>
             <th>Actions</th>
           </tr>
         </thead>
         <tbody>
           <tr ng-repeat="prop in plugins.list | filter:searchPlugin">
-            <td><h4>{{prop.id}}<br/><small>{{prop.description.split('.')[0]}}</small></h4></td>
+            <td><h4>{{prop.id}} <span class="badge {{prop.css}}">{{prop.source}}</span><br/><small>{{prop.description.split('.')[0]}}</small></h4></td>
             <td>
               <p>{{prop.version}}</p>
               <div ng-if="prop.update_version">
diff --git a/jenkins-docker/server/plugin-manager/js/plugin-manager.js b/jenkins-docker/server/plugin-manager/js/plugin-manager.js
index 07b156e..c6fb6e2 100644
--- a/jenkins-docker/server/plugin-manager/js/plugin-manager.js
+++ b/jenkins-docker/server/plugin-manager/js/plugin-manager.js
@@ -60,7 +60,11 @@
                     if (!pluginNameMatches) {
                        return;
                     }
-                    var pluginName = pluginNameMatches[2];
+
+                    var isGitHub = pluginNameMatches[2].endsWith("-gh");
+                    var source =  isGitHub ? "GitHub" : "Gerrit";
+                    var css = isGitHub ? "text-bg-warning" : "text-bg-primary";
+                    var pluginName = pluginNameMatches[2].replace("-gh", "");
                     $http.get($scope.getBaseUrl() + '/job/' + plugin.name + '/lastSuccessfulBuild/artifact/bazel-bin/plugins/' + pluginName + '/' + pluginName + '.json', plugins.httpConfig)
                          .then(function successCallback(pluginResponse) {
                       var currRow = $scope.pluginIndexOf(pluginName);
@@ -79,6 +83,8 @@
                       var fileEnding = plugin.name.match(uiPluginRegex) ? '.js' : '.jar';
                       currPlugin.url = $scope.getBaseUrl() + '/job/' + plugin.name + '/lastSuccessfulBuild/artifact/bazel-bin/plugins/' + pluginName + '/' + pluginName + fileEnding;
                       currPlugin.description = pluginResponse.data.description;
+                      currPlugin.source = source;
+                      currPlugin.css = css;
 
                       if (currRow < 0) {
                         plugins.list.push(currPlugin);