@@ -81,6 +81,7 @@ var app = angular.module('PluginManager', []).controller(
8181                      currPlugin . sha1  =  plugin . sha1 ; 
8282                      var  uiPluginRegex  =  / ( u i - p l u g i n - ) ( .* ) - b a z e l .* / ; 
8383                      var  fileEnding  =  plugin . name . match ( uiPluginRegex )  ? '.js'  : '.jar' ; 
84+                       currPlugin . jobUrl  =  $scope . getBaseUrl ( )  +  '/job/'  +  plugin . name ; 
8485                      currPlugin . url  =  $scope . getBaseUrl ( )  +  '/job/'  +  plugin . name  +  '/lastSuccessfulBuild/artifact/bazel-bin/plugins/'  +  pluginName  +  '/'  +  pluginName  +  fileEnding ; 
8586                      currPlugin . description  =  pluginResponse . data . description ; 
8687                      currPlugin . source  =  source ; 
@@ -98,13 +99,49 @@ var app = angular.module('PluginManager', []).controller(
9899                    } ) ; 
99100                  } ) ; 
100101                } ,  function  errorCallback ( response )  { 
102+                   console . error ( 'Failed to fetch plugin build data for '  +  pluginId ,  response ) ; 
101103                } ) ; 
102104      } 
103105
104106      plugins . login  =  function  ( )  { 
105107        $window . location . href  =  'https://gerrit-ci.gerritforge.com/securityRealm/commenceLogin?from=%2F' ; 
106108      } ; 
107109
110+       $scope . showRepoStatus  =  function ( e ,  pluginId ,  pluginJobUrl )  { 
111+         setTimeout ( function ( )  { 
112+           $http . get ( pluginJobUrl  +  '/lastSuccessfulBuild/api/json' ,  plugins . httpConfig ) 
113+             . then ( 
114+               function  successCallback ( response )  { 
115+                 var  repoStatusPopup  =  document . getElementById ( 'repo-status-popup-'  +  pluginId ) ; 
116+                 var  repoStatusPopupAnchor  =  document . getElementById ( 'repo-status-popup-a-'  +  pluginId ) ; 
117+                 if  ( ! repoStatusPopup )  return ; 
118+ 
119+                 var  scmAction  =  response . data . actions . filter ( function ( action )  { 
120+                   return  action . _class  ==  "hudson.plugins.git.util.BuildData" ; 
121+                 } ) ; 
122+                 if  ( ! scmAction  ||  scmAction . length  ==  0 )  return ; 
123+ 
124+                 var  sourceUrl  =  scmAction [ 0 ] . remoteUrls . filter ( function ( url )  { 
125+                       return  url . indexOf ( "gerrit.googlesource.com/a/gerrit" )  ===  - 1 ; 
126+                     } ) ; 
127+                 if  ( ! sourceUrl  ||  sourceUrl . length  ==  0 )  return ; 
128+ 
129+                 repoStatusPopup . style . display  =  'block' ; 
130+                 repoStatusPopupAnchor . href  =  sourceUrl [ 0 ] . replace ( "/a" ,  "" ) ; 
131+               } ,  function  errorCallback ( response )  { } 
132+             ) ; 
133+         } ,  500 ) ; 
134+       } ; 
135+ 
136+       $scope . hideRepoStatus  =  function ( pluginId )  { 
137+         var  repoStatusPopup  =  document . getElementById ( 'repo-status-popup-'  +  pluginId ) ; 
138+         if  ( repoStatusPopup )  { 
139+           setTimeout ( function ( )  { 
140+             repoStatusPopup . style . display  =  'none' ; 
141+           } ,  1000 ) ; 
142+         } 
143+       } ; 
144+ 
108145      $scope . refreshAvailable ( ) ; 
109146    } ) ; 
110147
0 commit comments