[Rt-commit] rt branch, 4.6/core-rightinspector, repushed
Michel Rodriguez
michel at bestpractical.com
Mon Sep 16 08:33:44 EDT 2019
The branch 4.6/core-rightinspector was deleted and repushed:
was 99a86dcfe35ff20fb0a20281e5db93a2f0bd0442
now 1106776eefd9a0574980aeebdb910b4b02414ada
1: b0dc45582 ! 1: b2694e4f0 Cored RT::Extension::RightsInspector
@@ -151,9 +151,9 @@
+# record - generalization of principal and object since rendering
+# and whatnot can share code
+
-+my $PageLimit = 10;
-+
-+$RT::Interface::Web::WHITELISTED_COMPONENT_ARGS{'/Admin/RightsInspector/index.html'} = ['Principal', 'Object', 'Right'];
++my $PageLimit = 100;
++
++$RT::Interface::Web::WHITELISTED_COMPONENT_ARGS{'/Admin/RightsInspector.html'} = ['Principal', 'Object', 'Right'];
+
+sub CurrentUser {
+ return $HTML::Mason::Commands::session{CurrentUser};
@@ -967,53 +967,53 @@
--- /dev/null
+++ b/share/html/Admin/Tools/RightsInspector.html
@@
-+# BEGIN BPS TAGGED BLOCK {{{
-+#
-+# COPYRIGHT:
-+#
-+# This software is Copyright (c) 1996-2019 Best Practical Solutions, LLC
-+# <sales at bestpractical.com>
-+#
-+# (Except where explicitly superseded by other copyright notices)
-+#
-+#
-+# LICENSE:
-+#
-+# This work is made available to you under the terms of Version 2 of
-+# the GNU General Public License. A copy of that license should have
-+# been provided with this software, but in any event can be snarfed
-+# from www.gnu.org.
-+#
-+# This work is distributed in the hope that it will be useful, but
-+# WITHOUT ANY WARRANTY; without even the implied warranty of
-+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+# General Public License for more details.
-+#
-+# You should have received a copy of the GNU General Public License
-+# along with this program; if not, write to the Free Software
-+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-+# 02110-1301 or visit their web page on the internet at
-+# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html.
-+#
-+#
-+# CONTRIBUTION SUBMISSION POLICY:
-+#
-+# (The following paragraph is not intended to limit the rights granted
-+# to you to modify and distribute this software under the terms of
-+# the GNU General Public License and is only of importance to you if
-+# you choose to contribute your changes and enhancements to the
-+# community by submitting them to Best Practical Solutions, LLC.)
-+#
-+# By intentionally submitting any modifications, corrections or
-+# derivatives to this work, or any other work intended for use with
-+# Request Tracker, to Best Practical Solutions, LLC, you confirm that
-+# you are the copyright holder for those contributions and you grant
-+# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable,
-+# royalty-free, perpetual, license to use, copy, create derivative
-+# works based on those contributions, and sublicense and distribute
-+# those contributions and any derivatives thereof.
-+#
-+# END BPS TAGGED BLOCK }}}
++%# BEGIN BPS TAGGED BLOCK {{{
++%#
++%# COPYRIGHT:
++%#
++%# This software is Copyright (c) 1996-2019 Best Practical Solutions, LLC
++%# <sales at bestpractical.com>
++%#
++%# (Except where explicitly superseded by other copyright notices)
++%#
++%#
++%# LICENSE:
++%#
++%# This work is made available to you under the terms of Version 2 of
++%# the GNU General Public License. A copy of that license should have
++%# been provided with this software, but in any event can be snarfed
++%# from www.gnu.org.
++%#
++%# This work is distributed in the hope that it will be useful, but
++%# WITHOUT ANY WARRANTY; without even the implied warranty of
++%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++%# General Public License for more details.
++%#
++%# You should have received a copy of the GNU General Public License
++%# along with this program; if not, write to the Free Software
++%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
++%# 02110-1301 or visit their web page on the internet at
++%# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html.
++%#
++%#
++%# CONTRIBUTION SUBMISSION POLICY:
++%#
++%# (The following paragraph is not intended to limit the rights granted
++%# to you to modify and distribute this software under the terms of
++%# the GNU General Public License and is only of importance to you if
++%# you choose to contribute your changes and enhancements to the
++%# community by submitting them to Best Practical Solutions, LLC.)
++%#
++%# By intentionally submitting any modifications, corrections or
++%# derivatives to this work, or any other work intended for use with
++%# Request Tracker, to Best Practical Solutions, LLC, you confirm that
++%# you are the copyright holder for those contributions and you grant
++%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable,
++%# royalty-free, perpetual, license to use, copy, create derivative
++%# works based on those contributions, and sublicense and distribute
++%# those contributions and any derivatives thereof.
++%#
++%# END BPS TAGGED BLOCK }}}
+<& /Admin/Elements/Header, Title => loc("Rights Inspector") &>
+<& /Elements/Tabs &>
+
@@ -1060,19 +1060,16 @@
+</div>
+
+<&|/Widgets/TitleBox, title => loc("Rights Inspector") &>
-+<form action="<%RT->Config->Get('WebPath')%>/Helpers/RightsInspector/Search" id="rights-inspector">
-+ <div class="search row">
-+ <input class="col-md-3" value="<% $ARGS{Principal} %>" type="text" name="principal" placeholder="Principal">
-+ <input class="col-md-3" value="<% $ARGS{Object} %>" type="text" name="object" placeholder="Object">
-+ <input class="col-md-3" value="<% $ARGS{Right} %>" type="text" name="right" placeholder="Right">
-+ <span class="loading"><img src="<%RT->Config->Get('WebPath')%>/static/images/loading.gif" alt="<%loc('Loading')%>" title="<%loc('Loading')%>" /></span>
++<form action="<%RT->Config->Get('WebPath')%>/Helpers/RightsInspector/Search" id="rights-inspector" class="search">
++ <div class="row">
++ <input class="col-md-3 form-control" value="<% $ARGS{Principal} %>" type="text" name="principal" placeholder="Principal">
++ <input class="col-md-3 form-control" value="<% $ARGS{Object} %>" type="text" name="object" placeholder="Object">
++ <input class="col-md-3 form-control" value="<% $ARGS{Right} %>" type="text" name="right" placeholder="Right">
+ </div>
-+
-+ <script type="text/javascript" src="<%RT->Config->Get('WebPath')%>/static/js/rights-inspector.js"></script>
+
+ <div class="results">
+ </div>
-+ <span class="loading"><img src="<%RT->Config->Get('WebPath')%>/static/images/loading.gif" alt="<%loc('Loading')%>" title="<%loc('Loading')%>" /></span>
++ <& /Widgets/Spinner &>
+</form>
+</&>
+
@@ -1209,13 +1206,72 @@
+%# END BPS TAGGED BLOCK }}}
+<%INIT>
+use RT::RightsInspector;
-+
+my $results = RT::RightsInspector->Search(%ARGS);
+$r->content_type('application/json; charset=utf-8');
+RT::Interface::Web::CacheControlExpiresHeaders( Time => 'no-cache' );
+$m->out(JSON($results));
+$m->abort;
+</%INIT>
+
+diff --git a/share/html/Widgets/Spinner b/share/html/Widgets/Spinner
+new file mode 100644
+--- /dev/null
++++ b/share/html/Widgets/Spinner
+@@
++%# BEGIN BPS TAGGED BLOCK {{{
++%#
++%# COPYRIGHT:
++%#
++%# This software is Copyright (c) 1996-2019 Best Practical Solutions, LLC
++%# <sales at bestpractical.com>
++%#
++%# (Except where explicitly superseded by other copyright notices)
++%#
++%#
++%# LICENSE:
++%#
++%# This work is made available to you under the terms of Version 2 of
++%# the GNU General Public License. A copy of that license should have
++%# been provided with this software, but in any event can be snarfed
++%# from www.gnu.org.
++%#
++%# This work is distributed in the hope that it will be useful, but
++%# WITHOUT ANY WARRANTY; without even the implied warranty of
++%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++%# General Public License for more details.
++%#
++%# You should have received a copy of the GNU General Public License
++%# along with this program; if not, write to the Free Software
++%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
++%# 02110-1301 or visit their web page on the internet at
++%# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html.
++%#
++%#
++%# CONTRIBUTION SUBMISSION POLICY:
++%#
++%# (The following paragraph is not intended to limit the rights granted
++%# to you to modify and distribute this software under the terms of
++%# the GNU General Public License and is only of importance to you if
++%# you choose to contribute your changes and enhancements to the
++%# community by submitting them to Best Practical Solutions, LLC.)
++%#
++%# By intentionally submitting any modifications, corrections or
++%# derivatives to this work, or any other work intended for use with
++%# Request Tracker, to Best Practical Solutions, LLC, you confirm that
++%# you are the copyright holder for those contributions and you grant
++%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable,
++%# royalty-free, perpetual, license to use, copy, create derivative
++%# works based on those contributions, and sublicense and distribute
++%# those contributions and any derivatives thereof.
++%#
++%# END BPS TAGGED BLOCK }}}
++<div class="spinner">
++ <div class="d-flex justify-content-center">
++ <div class="spinner-border" role="status">
++ <span class="sr-only"><% loc( "Loading...") %></span>
++ </div>
++ </div>
++</div>
diff --git a/share/static/css/elevator-light/admin.css b/share/static/css/elevator-light/admin.css
--- a/share/static/css/elevator-light/admin.css
@@ -1227,24 +1283,8 @@
+
+
+
-+#rights-inspector .search .loading,
-+#rights-inspector > .loading {
++#rights-inspector .loading {
+ display: none;
-+}
-+
-+#rights-inspector .search .loading img,
-+#rights-inspector > .loading img,
-+#rights-inspector .results .revoke img {
-+ height: 1.5em;
-+ width: 1.5em;
-+}
-+
-+#rights-inspector.awaiting-first-result .search .loading {
-+ display: inline;
-+}
-+
-+#rights-inspector.continuing-load > .loading {
-+ display: inline;
+}
+
+#rights-inspector.error .results {
@@ -1257,7 +1297,11 @@
+ opacity: 0.5;
+}
+
-+#rights-inspector .results .result:nth-child(even) {
++#rights-inspector.awaiting-first-result .loading, .continuing-load .loading {
++ display: inline;
++}
++
++#rights-inspector .results .result:nth-child(even) .cell {
+ background-color: rgb(236, 246, 252);
+}
+
@@ -1295,24 +1339,31 @@
+ display: none;
+}
+
++#rights-inspector .results .result .right {
++ padding-top: .4em;
++}
++
++#rights-inspector .results .result .revoke {
++ padding-top: .3em;
++}
++
++
+#rt-help-text kbd {
+ color: #111;
+ border: 1px dashed #AAA;
+ background-color: #F6F6F6;
+ padding: 2px 3px;
+}
-+
diff --git a/share/static/js/rights-inspector.js b/share/static/js/rights-inspector.js
new file mode 100644
--- /dev/null
+++ b/share/static/js/rights-inspector.js
@@
-+jQuery(function () {
-+
++jQuery( function() {
+ var form = jQuery('form#rights-inspector');
+ var display = form.find('.results');
-+ var loading = form.find('.search .loading');
++ var spinner = form.find('.spinner');
+
+ var revoking = {};
+ var existingRequest;
@@ -1328,7 +1379,7 @@
+ }
+
+ button.addClass('ui-state-disabled').prop('disabled', true);
-+ button.after(loading.clone());
++ button.after(spinner.clone());
+ };
+
+ var displayError = function (message) {
@@ -1386,6 +1437,7 @@
+ form.removeClass('awaiting-first-result');
+ display.text('No results');
+ }
++ jQuery( '.spinner').hide();
+ }
+ },
+ error: function (xhr, reason) {
@@ -1401,6 +1453,7 @@
+ var beginSearch = function (delay) {
+ form.removeClass('continuing-load').addClass('awaiting-first-result');
+ form.find('button').addClass('ui-state-disabled').prop('disabled', true);
++ jQuery( '.spinner').show();
+
+ var serialized = form.serializeArray();
+ var search = {};
@@ -1446,7 +1499,7 @@
+ alert(response.msg);
+ }
+ else {
-+ button.closest('.revoke').text(response.msg);
++ button.closest('.revoke').removeClass('col-md-1').addClass('col-md-3').text(response.msg);
+ }
+ delete revoking[action];
+ },
@@ -1459,13 +1512,15 @@
+ });
+ });
+
-+ form.find('.search input').on('input', function () {
++ form.find('input').on('input', function () {
+ beginSearch(200);
+ });
+
+ beginSearch();
+});
+
++
++// rendering functions
+
+function render_inspector_record (record) {
+ return '<span class="record ' + cond_text( record.disabled, 'disabled') + '">'
@@ -1483,8 +1538,6 @@
+
+}
+
-+// rendering functions
-+
+function render_inspector_primary_record (primary_record) {
+ return primary_record ? '<span class="primary">Contains ' + render_inspector_record( primary_record) + '</span>'
+ : '';
@@ -1507,12 +1560,12 @@
+ var disabled_class = item.disable_revoke ? ' ui-state-disabled' : '';
+ var revoke_action = RT.Config.WebPath + '/Helpers/RightsInspector/Revoke?id=' + item.ace.id;
+
-+ return '<div class="result row">'
++ return '<div class="result form-row">'
+ + ' <div class="principal cell col-md-3">' + render_inspector_record( item.principal) + '</div>'
+ + ' <div class="object cell col-md-3">' + render_inspector_record( item.object) + '</div>'
+ + ' <div class="right cell col-md-3">' + item.right_highlighted + '</div>'
+ + ' <div class="revoke cell col-md-1">'
-+ + ' <button type="button" class="revoke-button' + disabled_class + '"'
++ + ' <button type="button" class="revoke-button button btn btn-primary' + disabled_class + '"'
+ + ' data-action="' + revoke_action + '" '
+ + disabled_state + '>Revoke</button>'
+ + ' </div>'
2: 6da494ac0 < -: ------- Improve formating with new themes
3: 99a86dcfe = 2: 1106776ee Improve look for the dark theme
More information about the rt-commit
mailing list