<commit_before><!--
 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 * Copyright (c) 2013, 6WIND S.A. All rights reserved.                 *
 *                                                                     *
 * This file is part of the Jenkins Lockable Resources Plugin and is   *
 * published under the MIT license.                                    *
 *                                                                     *
 * See the "LICENSE.txt" file for more information.                    *
 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 -->
<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define"
	xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form"
	xmlns:i="jelly:fmt" xmlns:p="/lib/hudson/project">

	<l:layout title="${it.displayName}">
		<l:main-panel>
			<h1>${%Lockable Resources}</h1>
			<table class="pane" style="width: 50%;">
				<tbody>
					<tr>
						<td class="pane-header">Resource</td>
						<td class="pane-header">Status</td>
						<td class="pane-header">Labels</td>
						<td class="pane-header">Action</td>
					</tr>
<script>
function find_resource_name(element) {
	var row = element.up('tr');
	var resourceName = row.getAttribute('data-resource-name');
	return resourceName;
}
</script>
<j:forEach var="resource" items="${it.resources}" indexVar="i">
<script>
function unlock_resource_${i}(button) {
	var resourceName = find_resource_name(button);
	window.location.assign("unlock?resource=" + resourceName);
}
function reserve_resource_${i}(button) {
	var resourceName = find_resource_name(button);
	window.location.assign("reserve?resource=" + resourceName);
}
function unreserve_resource_${i}(button) {
	var resourceName = find_resource_name(button);
	window.location.assign("unreserve?resource=" + resourceName);
}
function reset_resource_${i}(button) {
	var resourceName = find_resource_name(button);
	window.location.assign("reset?resource=" + resourceName);
}
</script>
					<tr data-resource-name="${resource.name}">
						<td class="pane">
							<strong>${resource.name}</strong><br/>
							<em>${resource.description}</em>
						</td>
<j:if test="${resource.locked}">
						<td class="pane" style="color: red;">
							<strong>LOCKED</strong> by
							<a href="${rootURL}/${resource.build.url}">
								${resource.build.fullDisplayName}
							</a>
						</td>
						<td class="pane">${resource.labels}</td>
						<td class="pane">
<j:if test="${h.hasPermission(it.UNLOCK)}">
							<button onClick="unlock_resource_${i}(this);">Unlock</button>
</j:if>
						</td>
</j:if>
<j:if test="${!resource.locked}">
	<j:if test="${resource.reservedBy != null}">
						<td class="pane" style="color: red;">
							<strong>RESERVED</strong> by <strong>${resource.reservedBy}</strong>
						</td>
						<td class="pane">${resource.labels}</td>
						<td class="pane">
		<j:if test="${h.hasPermission(it.RESERVE)}">
			<j:if test="${it.UserName == resource.reservedBy or h.hasPermission(app.ADMINISTER)}">
							<button onClick="unreserve_resource_${i}(this);">UnReserve</button>
			</j:if>
		</j:if>
						</td>
	</j:if>
	<j:if test="${resource.reservedBy == null}">
		<j:if test="${resource.queued}">
						<td class="pane" style="color: yellow;">
							QUEUED by "${resource.queueItemProject} ${resource.queueItemId}"
						</td>
						<td class="pane">${resource.labels}</td>
						<td class="pane">
			<j:if test="${h.hasPermission(it.UNLOCK)}">
							<button onClick="reset_resource_${i}(this);">ResetResource</button>
			</j:if>
						</td>
		</j:if>
		<j:if test="${!resource.queued}">
						<td class="pane" style="color: green;">
							<strong>FREE</strong>
						</td>
						<td class="pane">${resource.labels}</td>
						<td class="pane">
			<j:if test="${h.hasPermission(it.RESERVE) and it.UserName != null}">
								<button onClick="reserve_resource_${i}(this);">Reserve</button>
			</j:if>
						</td>
		</j:if>
	</j:if>
</j:if>
					</tr>
</j:forEach>
				</tbody>
			</table>
<j:if test="${it.getNumberOfAllLabels() != 0}">
			<h3>Labels</h3>
			<table class="pane" style="width: 50%;">
				<tbody>
					<tr>
						<td class="pane-header">Label</td>
						<td class="pane-header">Free resources</td>
					</tr>
<j:forEach var="label" items="${it.getAllLabels()}">
					<tr>
	<j:choose>
		<j:when test="${it.getFreeResourceAmount(label) == 0}">
						<td class="pane" style="color: red;">${label}</td>
						<td class="pane" style="color: red;">0</td>
		</j:when>
		<j:when test="${it.getFreeResourceAmount(label) == 1}">
						<td class="pane" style="color: darkorange;">${label}</td>
						<td class="pane" style="color: darkorange;">1</td>
		</j:when>
		<j:otherwise>
						<td class="pane" style="color: green;">${label}</td>
						<td class="pane" style="color: green;">${it.getFreeResourceAmount(label)}</td>
		</j:otherwise>
	</j:choose>
					</tr>
</j:forEach>
				</tbody>
			</table>
</j:if>

		</l:main-panel>
	</l:layout>
</j:jelly>
<commit_msg>Make overview page use all available space<commit_after><!--
  Copyright 2013, 6WIND S.A. All rights reserved.
  Copyright 2019, TobiX

  This file is part of the Jenkins Lockable Resources Plugin and is
  published under the MIT license.

  See the "LICENSE.txt" file for more information.
 -->
<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core" xmlns:l="/lib/layout">
  <script>
    function find_resource_name(element) {
      var row = element.up('tr');
      var resourceName = row.getAttribute('data-resource-name');
      return resourceName;
    }
    function resource_action(button, action) {
      window.location.assign(action + "?resource=" + find_resource_name(button));
    }
  </script>

  <l:layout title="${it.displayName}" type="one-column">
    <l:main-panel>
      <h1>${%Lockable Resources}</h1>
      <table class="pane" style="width: auto;">
        <tbody>
          <tr>
            <td class="pane-header">Resource</td>
            <td class="pane-header">Status</td>
            <td class="pane-header">Labels</td>
            <td class="pane-header">Action</td>
          </tr>
          <j:forEach var="resource" items="${it.resources}" indexVar="i">
            <script>
            </script>
            <tr data-resource-name="${resource.name}">
              <td class="pane">
                <strong>${resource.name}</strong>
                <br/>
                <em>${resource.description}</em>
              </td>
              <j:if test="${resource.locked}">
                <td class="pane" style="color: red;">
                  <strong>LOCKED</strong>
                  by
                  <a href="${rootURL}/${resource.build.url}">
                    ${resource.build.fullDisplayName}
                  </a>
                </td>
                <td class="pane">${resource.labels}</td>
                <td class="pane">
                  <j:if test="${h.hasPermission(it.UNLOCK)}">
                    <button onClick="resource_action(this, 'unlock');">Unlock</button>
                  </j:if>
                </td>
              </j:if>
              <j:if test="${!resource.locked}">
                <j:if test="${resource.reservedBy != null}">
                  <td class="pane" style="color: red;">
                    <strong>RESERVED</strong>
                    by
                    <strong>${resource.reservedBy}</strong>
                  </td>
                  <td class="pane">${resource.labels}</td>
                  <td class="pane">
                    <j:if test="${h.hasPermission(it.RESERVE)}">
                      <j:if
                        test="${it.UserName == resource.reservedBy or h.hasPermission(app.ADMINISTER)}">
                        <button onClick="resource_action(this, 'unreserve');">UnReserve</button>
                      </j:if>
                    </j:if>
                  </td>
                </j:if>
                <j:if test="${resource.reservedBy == null}">
                  <j:if test="${resource.queued}">
                    <td class="pane" style="color: yellow;">
                      QUEUED by "${resource.queueItemProject} ${resource.queueItemId}"
                    </td>
                    <td class="pane">${resource.labels}</td>
                    <td class="pane">
                      <j:if test="${h.hasPermission(it.UNLOCK)}">
                        <button onClick="resource_action(this, 'reset');">ResetResource</button>
                      </j:if>
                    </td>
                  </j:if>
                  <j:if test="${!resource.queued}">
                    <td class="pane" style="color: green;">
                      <strong>FREE</strong>
                    </td>
                    <td class="pane">${resource.labels}</td>
                    <td class="pane">
                      <j:if test="${h.hasPermission(it.RESERVE) and it.UserName != null}">
                        <button onClick="resource_action(this, 'reserve');">Reserve</button>
                      </j:if>
                    </td>
                  </j:if>
                </j:if>
              </j:if>
            </tr>
          </j:forEach>
        </tbody>
      </table>
      <j:if test="${it.getNumberOfAllLabels() != 0}">
        <h3>Labels</h3>
        <table class="pane" style="width: auto;">
          <tbody>
            <tr>
              <td class="pane-header">Label</td>
              <td class="pane-header">Free resources</td>
            </tr>
            <j:forEach var="label" items="${it.getAllLabels()}">
              <tr>
                <j:choose>
                  <j:when test="${it.getFreeResourceAmount(label) == 0}">
                    <td class="pane" style="color: red;">${label}</td>
                    <td class="pane" style="color: red;">0</td>
                  </j:when>
                  <j:when test="${it.getFreeResourceAmount(label) == 1}">
                    <td class="pane" style="color: darkorange;">${label}</td>
                    <td class="pane" style="color: darkorange;">1</td>
                  </j:when>
                  <j:otherwise>
                    <td class="pane" style="color: green;">${label}</td>
                    <td class="pane" style="color: green;">${it.getFreeResourceAmount(label)}</td>
                  </j:otherwise>
                </j:choose>
              </tr>
            </j:forEach>
          </tbody>
        </table>
      </j:if>
    </l:main-panel>
  </l:layout>
</j:jelly>

{'fraction_non_alphanumeric': 0.19019161449440333, 'fraction_numerical': 0.003414911781445646, 'mean_word_length': 2.0453495089543616, 'pattern_counts': {'":': 0, '<': 285, '<?xml version=': 0, '>': 285, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 10}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 19, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '23478', 'n_tokens_mistral': 3757, 'n_tokens_neox': 3267, 'n_words': 562}