Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 9f0ec14b2087f67b2dba94bf24227451f409c36b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
<!-- **************************************************************************
#
# Copyright  (c) 2004-2010 Oracle Corporation.
#
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v1.0
# which accompanies this distribution, and is available at
# http://www.eclipse.org/legal/epl-v10.html
#
# Contributors: 
#
#    Kohsuke Kawaguchi, Seiji Sogabe, Yahoo! Inc.
#        
#
#************************************************************************** --> 


<!--
  Config page
-->
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:s="/lib/form">
  <l:layout title="Update Center" permission="${app.ADMINISTER}" norefresh="true">
    <st:include page="sidepanel.jelly"/>
    <l:main-panel>
      <local:tabBar page="installed" xmlns:local="/hudson/PluginManager" />
      <table id="plugins" class="sortable pane bigtable">
        <j:choose>
          <j:when test="${empty(app.pluginManager.plugins) and empty(app.pluginManager.failedPlugins)}">
            <tr><td>
              ${%No plugins installed.}
            </td></tr>
          </j:when>
          <j:otherwise>
            <tr style="border-top: 0px;">
              <th width="32" tooltip="${%Uncheck to disable the plugin}">${%Enabled}</th>
              <th initialSortDir="down">${%Name}</th>
              <th width="32">${%Version}</th>
              <th width="32">${%Previously installed version}</th>
              <th width="32">${%Pinned}</th>
            </tr>
            <j:forEach var="p" items="${app.pluginManager.plugins}">
              <tr>
                <j:set var="state" value="${p.enabled?'true':null}"/>
                <td class="center pane" data="${state}">
                  <input type="checkbox" checked="${state}" onclick="flip(event)"
                         url="plugin/${p.shortName}"
                         original="${p.active?'true':'false'}"/>
                </td>
                <td class="pane">
                  <div>
                    <a href="${p.url}">
                      ${p.updateInfo.title?:p.longName}
                    </a>
                  </div>
                  <div class="excerpt">
                    <j:set var="indexPage" value="${p.indexPage.toString()}" />
                    <j:if test="${!empty(indexPage)}">
                      <j:include uri="${indexPage}" />
                    </j:if>
                  </div>
                </td>
                <td class="center pane" style="white-space:nowrap">
                  ${p.version}
                </td>
                <td>
                  <j:if test="${p.downgradable}">
                    <form method="post" action="${rootURL}/updateCenter/plugin/${p.shortName}/downgrade">
                      <s:submit value="${%downgradeTo(p.backupVersion)}"/>
                    </form>
                  </j:if>
                </td>
                <td class="center pane" id='unpin-${p.shortName}'>
                  <j:if test="${p.isPinned()}">
                    <input type="button" onclick="unpin(this,'${p.shortName}')" value="${%Unpin}" class="yui-button" />
                    <a href="${%wiki.url}"><img style="vertical-align:top" src="${imagesURL}/16x16/help.gif"/></a>
                  </j:if>
                </td>
              </tr>
            </j:forEach>
            <!-- failed ones -->
            <j:forEach var="p" items="${it.pluginManager.failedPlugins}">
              <tr class="hoverback">
                <td class="pane" />
                <td class="pane">
                  <h4 class="error">Failed : ${p.name}</h4>
                  <div stlyle="padding-left: 1em">
                    <pre>${p.exceptionString}</pre>
                  </div>
                </td>
                <td class="pane" />
              </tr>
            </j:forEach>
          </j:otherwise>
        </j:choose>
      </table>

      <j:if test="${it.isPluginUploaded()}">
        <div style="margin: 1em; height: 1em">
          <div class="error">
            ${%New plugins will take effect once you restart Hudson}
            <j:if test="${app.lifecycle.canRestart()}">
              <s:submit value="${%Restart Once No Jobs Are Running}" />
            </j:if>
          </div>
        </div>
      </j:if>
      <div class="warning" id="needRestart" style="display:none; margin: 1em; height: 1em">
        <form method="post" action="${rootURL}/safeRestart">
          ${%Changes will take effect when you restart Hudson}
          <j:if test="${app.lifecycle.canRestart()}">
            <s:submit value="${%Restart Once No Jobs Are Running}" />
          </j:if>
        </form>
      </div>


      <script>
        <!-- function to toggle the enable/disable state -->
        function flip(o) {
          btn = Event.element(o);

          <!-- trigger -->
          new Ajax.Request(btn.getAttribute('url')+"/make"+(btn.checked?"Enable":"Disable")+"d", {
            onFailure : function(req,o) {
              $('needRestart').innerHTML = req.responseText;
            }
          });

          updateMsg();
        }

        function updateMsg() {
          <!-- is anything changed since its original state? -->
          var e = $A($('plugins').getElementsByTagName('input')).find(function(e) {
            return String(e.checked)!=e.getAttribute('original');
          });

          $('needRestart').style.display = (e!=null?"block":"none");
        }

        updateMsg(); // set the initial state

        function unpin(button,shortName) {
          new Ajax.Request("./plugin/"+shortName+"/unpin", {
            onFailure : function(t) {
              alert('Failed to unpin:'+t.responseText);
            },
            onSuccess : function(t) {
              $('unpin-'+shortName).innerHTML = "";
            }
          });
        }
      </script>
    </l:main-panel>
  </l:layout>
</j:jelly>

Back to the top