Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor enhancements #314

Merged
merged 4 commits into from
Jul 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -36,25 +36,30 @@

<!-- The first row will show grouping -->
<local:thead roles="${agentGrantedRoles}" showPattern="true"/>
<tr name="[USER:anonymous]" class="highlight-row">
<local:userRow sid="anonymous" title="${%Anonymous}" type="${it.strategy.SLAVE}" permissionType="USER" typedescription="User" noremove="true"/>
</tr>
<tr name="[GROUP:authenticated]" class="highlight-row">
<local:userRow sid="authenticated" title="authenticated" type="${it.strategy.SLAVE}" permissionType="GROUP" typedescription="Group" noremove="true"/>
</tr>
<j:forEach var="entry" items="${agentSIDs}">
<j:if test="${entry.sid != 'authenticated' or entry.type.toString() != 'GROUP'}">
<tr name="[${entry.type}:${entry.sid}]" class="permission-row highlight-row" data-descriptor-url="${descriptorPath}">
<local:userRow sid="${entry.sid}" title="${entry.sid}" permissionType="${entry.type.toString()}" typedescription="${entry.type.getDescription()}" type="${it.strategy.SLAVE}"/>
</tr>
</j:if>
</j:forEach>
<tr name="__unused__" id="newAgentRowTemplate" style="display:none" class="permission-row highlight-row" data-descriptor-url="${descriptorPath}">
<local:userRow title="{{USER}}" type="${it.strategy.SLAVE}" typedescription="{{USERGROUP}}"/>
</tr>
<tbody>
<tr name="[USER:anonymous]" class="highlight-row">
<local:userRow sid="anonymous" title="${%Anonymous}" type="${it.strategy.SLAVE}" permissionType="USER" typedescription="User" noremove="true"/>
</tr>
<tr name="[GROUP:authenticated]" class="highlight-row">
<local:userRow sid="authenticated" title="authenticated" type="${it.strategy.SLAVE}" permissionType="GROUP" typedescription="Group" noremove="true"/>
</tr>
<j:forEach var="entry" items="${agentSIDs}">
<j:if test="${entry.sid != 'authenticated' or entry.type.toString() != 'GROUP'}">
<tr name="[${entry.type}:${entry.sid}]" class="permission-row highlight-row" data-descriptor-url="${descriptorPath}">
<local:userRow sid="${entry.sid}" title="${entry.sid}" permissionType="${entry.type.toString()}" typedescription="${entry.type.getDescription()}" type="${it.strategy.SLAVE}"/>
</tr>
</j:if>
</j:forEach>
</tbody>
<local:tfoot roles="${agentGrantedRoles}" sids="${agentSIDs}"/>
</table>

<template id="newAgentRowTemplate">
<tr class="permission-row highlight-row" data-descriptor-url="${descriptorPath}">
<local:userRow title="{{USER}}" type="${it.strategy.SLAVE}" typedescription="{{USERGROUP}}"/>
</tr>
</template>

<l:isAdmin>
<br/>
<local:addButtons sids="${agentSIDs}" tableid="${tableid}" id="newAgentRowTemplate" roles="${agentGrantedRoles}" highlighter="agentTableHighlighter"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,26 +44,31 @@

<!-- The first row will show grouping -->
<local:thead roles="${globalGrantedRoles}" showPattern="false"/>
<tr name="[USER:anonymous]" class="highlight-row">
<local:userRow sid="anonymous" title="${%Anonymous}" type="${it.strategy.GLOBAL}" permissionType="USER" typedescription="User" noremove="true"/>
</tr>
<tr name="[GROUP:authenticated]" class="highlight-row">
<local:userRow sid="authenticated" title="authenticated" type="${it.strategy.GLOBAL}" permissionType="GROUP" typedescription="Group" noremove="true"/>
</tr>
<j:forEach var="entry" items="${globalSIDs}">
<j:if test="${entry.sid != 'authenticated' or entry.type.toString() != 'GROUP'}">
<tr name="[${entry.type}:${entry.sid}]" class="permission-row highlight-row" data-descriptor-url="${descriptorPath}">
<local:userRow sid="${entry.sid}" title="${entry.sid}" permissionType="${entry.type.toString()}" typedescription="${entry.type.getDescription()}" type="${it.strategy.GLOBAL}"/>
</tr>
</j:if>
</j:forEach>
<tr name="__unused__" id="newGlobalRowTemplate" style="display:none" class="permission-row highlight-row" data-descriptor-url="${descriptorPath}">
<local:userRow title="{{USER}}" type="${it.strategy.GLOBAL}" typedescription="{{USERGROUP}}"/>
</tr>
<tbody>
<tr name="[USER:anonymous]" class="highlight-row">
<local:userRow sid="anonymous" title="${%Anonymous}" type="${it.strategy.GLOBAL}" permissionType="USER" typedescription="User" noremove="true"/>
</tr>
<tr name="[GROUP:authenticated]" class="highlight-row">
<local:userRow sid="authenticated" title="authenticated" type="${it.strategy.GLOBAL}" permissionType="GROUP" typedescription="Group" noremove="true"/>
</tr>
<j:forEach var="entry" items="${globalSIDs}">
<j:if test="${entry.sid != 'authenticated' or entry.type.toString() != 'GROUP'}">
<tr name="[${entry.type}:${entry.sid}]" class="permission-row highlight-row" data-descriptor-url="${descriptorPath}">
<local:userRow sid="${entry.sid}" title="${entry.sid}" permissionType="${entry.type.toString()}" typedescription="${entry.type.getDescription()}" type="${it.strategy.GLOBAL}"/>
</tr>
</j:if>
</j:forEach>
</tbody>
<local:tfoot roles="${globalGrantedRoles}" sids="${globalSIDs}"/>
</table>

<l:isAdmin>
<template id="newGlobalRowTemplate">
<tr class="permission-row highlight-row" data-descriptor-url="${descriptorPath}">
<local:userRow title="{{USER}}" type="${it.strategy.GLOBAL}" typedescription="{{USERGROUP}}"/>
</tr>
</template>

<l:isAdmin>
<br/>
<local:addButtons sids="${globalSIDs}" tableid="${tableid}" id="newGlobalRowTemplate" roles="${globalGrantedRoles}" highlighter="globalTableHighlighter"/>
</l:isAdmin>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,25 +44,30 @@

<!-- The first row will show grouping -->
<local:thead roles="${itemGrantedRoles}" showPattern="true"/>
<tr name="[USER:anonymous]" class="highlight-row">
<local:userRow sid="anonymous" title="${%Anonymous}" type="${it.strategy.PROJECT}" permissionType="USER" typedescription="User" noremove="true"/>
</tr>
<tr name="[GROUP:authenticated]" class="highlight-row">
<local:userRow sid="authenticated" title="authenticated" type="${it.strategy.PROJECT}" permissionType="GROUP" typedescription="Group" noremove="true"/>
</tr>
<j:forEach var="entry" items="${projectSIDs}">
<j:if test="${entry.sid != 'authenticated' or entry.type.toString() != 'GROUP'}">
<tr name="[${entry.type}:${entry.sid}]" class="permission-row highlight-row" data-descriptor-url="${descriptorPath}">
<local:userRow sid="${entry.sid}" title="${entry.sid}" permissionType="${entry.type.toString()}" typedescription="${entry.type.getDescription()}" type="${it.strategy.PROJECT}"/>
</tr>
</j:if>
</j:forEach>
<tr name="__unused__" id="newItemRowTemplate" style="display:none" class="permission-row highlight-row" data-descriptor-url="${descriptorPath}">
<local:userRow title="{{USER}}" type="${it.strategy.PROJECT}" typedescription="{{USERGROUP}}"/>
</tr>
<tbody>
<tr name="[USER:anonymous]" class="highlight-row">
<local:userRow sid="anonymous" title="${%Anonymous}" type="${it.strategy.PROJECT}" permissionType="USER" typedescription="User" noremove="true"/>
</tr>
<tr name="[GROUP:authenticated]" class="highlight-row">
<local:userRow sid="authenticated" title="authenticated" type="${it.strategy.PROJECT}" permissionType="GROUP" typedescription="Group" noremove="true"/>
</tr>
<j:forEach var="entry" items="${projectSIDs}">
<j:if test="${entry.sid != 'authenticated' or entry.type.toString() != 'GROUP'}">
<tr name="[${entry.type}:${entry.sid}]" class="permission-row highlight-row" data-descriptor-url="${descriptorPath}">
<local:userRow sid="${entry.sid}" title="${entry.sid}" permissionType="${entry.type.toString()}" typedescription="${entry.type.getDescription()}" type="${it.strategy.PROJECT}"/>
</tr>
</j:if>
</j:forEach>
</tbody>
<local:tfoot roles="${itemGrantedRoles}" sids="${projectSIDs}"/>
</table>

<template id="newItemRowTemplate">
<tr class="permission-row highlight-row" data-descriptor-url="${descriptorPath}">
<local:userRow title="{{USER}}" type="${it.strategy.PROJECT}" typedescription="{{USERGROUP}}"/>
</tr>
</template>

<l:isAdmin>
<br/>
<local:addButtons sids="${projectSIDs}" tableid="${tableid}" id="newItemRowTemplate" roles="${itemGrantedRoles}" highlighter="itemTableHighlighter"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,16 @@
project="${false}"/>
</tr>
</j:forEach>
<tr id="newAgentRoleTemplate" style="display:none" class="permission-row highlight-row">
<local:roleRow title="{{ROLE}}" pattern="{{PATTERN}}" global="${false}" type="${it.strategy.SLAVE}" />
</tr>
</tbody>
<local:tfoot permissionGroups="${agentGroups}" strategy="${it.strategy.SLAVE}" roles="${agentGrantedRoles}" showPattern="true"/>
</table>

<template id="newAgentRoleTemplate">
<tr class="permission-row highlight-row">
<local:roleRow title="{{ROLE}}" pattern="{{PATTERN}}" global="${false}" type="${it.strategy.SLAVE}" />
</tr>
</template>

<l:isAdmin>
<br/>
<f:entry title="${%Role to add}">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,16 @@
<local:roleRow title="${role.key.name}" role="${role.key}" global="${true}" type="${it.strategy.GLOBAL}" />
</tr>
</j:forEach>
<tr id="newGlobalRoleTemplate" style="display:none" class="permission-row highlight-row">
<local:roleRow title="{{ROLE}}" global="${true}" type="${it.strategy.GLOBAL}" />
</tr>
</tbody>
<local:tfoot permissionGroups="${globalPermissionGroups}" strategy="${it.strategy.GLOBAL}" roles="${globalGrantedRoles}" showPattern="false"/>
</table>

<template id="newGlobalRoleTemplate">
<tr class="permission-row highlight-row">
<local:roleRow title="{{ROLE}}" global="${true}" type="${it.strategy.GLOBAL}" />
</tr>
</template>

<l:isAdmin>
<br />
<f:entry title="${%Role to add}">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,16 @@
project="${true}"/>
</tr>
</j:forEach>
<tr id="newItemRoleTemplate" style="display:none" class="permission-row highlight-row">
<local:roleRow title="{{ROLE}}" global="${false}" pattern="{{PATTERN}}" type="${it.strategy.PROJECT}" />
</tr>
</tbody>
<local:tfoot permissionGroups="${itemPermissionGroups}" strategy="${it.strategy.PROJECT}" roles="${itemGrantedRoles}" showPattern="true"/>
</table>

<template id="newItemRoleTemplate">
<tr class="permission-row highlight-row">
<local:roleRow title="{{ROLE}}" global="${false}" pattern="{{PATTERN}}" type="${it.strategy.PROJECT}" />
</tr>
</template>

<l:isAdmin>
<br />
<f:entry title="${%Role to add}">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<l:tasks>
<l:task href="${rootURL}/manage/role-strategy/" icon="symbol-finger-print-outline plugin-ionicons-api" title="${%Manage Roles}"/>
<l:task href="${rootURL}/manage/role-strategy/assign-roles" icon="symbol-people-outline plugin-ionicons-api" title="${%Assign Roles}"/>
<l:task href="${rootURL}/manage/role-strategy/list-macros" icon="symbol-extension-puzzle-outline plugin-ionicons-api" title="${%Role Stategy Macros}"/>
<l:task href="${rootURL}/manage/role-strategy/list-macros" icon="symbol-extension-puzzle-outline plugin-ionicons-api" title="${%Role Strategy Macros}"/>
</l:tasks>
</l:side-panel>
</j:jelly>
34 changes: 25 additions & 9 deletions src/main/webapp/js/table.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,14 @@
*/

function getPreviousSiblings(elem, filter) {
var sibs = [];
let sibs = [];
while (elem = elem.previousSibling) {
if (elem.nodeType === 3) continue; // text node
sibs.push(elem);
}
return sibs;
}

class TableHighlighter {

constructor(id, decalx) {
Expand All @@ -42,19 +43,34 @@ class TableHighlighter {
};

scan(tr) {
let element = tr
let descendants = element.getElementsByTagName('input');
for (let td of descendants) {
if (td.nextSibling != null) {
td.nextSibling.addEventListener('mouseover', this.highlight);
td.nextSibling.addEventListener('mouseout', this.highlight);
}
let descendants = tr.getElementsByTagName('input');
for (let input of descendants) {
let td = input.closest('td');
td.addEventListener('mouseover', this.highlight);
td.addEventListener('mouseout', this.highlight);
}
let stopNodes = tr.querySelectorAll("div.rsp-remove");
let lastStop = stopNodes[stopNodes.length - 1];
if (lastStop != null) {
let td = lastStop.closest('td');
td.addEventListener('mouseover', this.highlightRowOnly);
td.addEventListener('mouseout', this.highlightRowOnly);
}
};

highlightRowOnly = e => {
let enable = e.type === 'mouseover';
let tr = findAncestor(e.target, "TR")
if (enable) {
tr.classList.add('highlighted');
} else {
tr.classList.remove('highlighted');
}
}

highlight = e => {
let enable = e.type === 'mouseover';
let td = findAncestor(Event.element(e), "TD")
let td = findAncestor(e.target, "TD")
let tr = td.parentNode;
let trs = this.table.querySelectorAll('tr.highlight-row');
let position = getPreviousSiblings(td).length;
Expand Down
Loading