[Rt-commit] rt branch, 4.4/saved-search-links, repushed
? sunnavy
sunnavy at bestpractical.com
Tue Mar 17 16:22:36 EDT 2020
The branch 4.4/saved-search-links was deleted and repushed:
was 603a8ecfce6f031a79fe5e289ed034e5a4cdb515
now f73e5c340cc10f11fb43ab3301fca72a48ac5750
1: 57d04305b = 1: 57d04305b Sort hashes in attribute content to avoid unnecessary updates
2: 9a44c12bd = 2: 9a44c12bd Add transaction records for dashboard/savedsearch changes
3: b54749dc4 = 3: b54749dc4 Include related transactions for attribute serialization
4: 957c290eb = 4: 957c290eb Add attribute link support
5: 00aaad573 = 5: 00aaad573 Link dashboards/homepages to saved searches they include
6: 4dad4d797 = 6: 4dad4d797 Add upgrade step to link dashboards/homepages to user saved searches they have
7: d5da3e19b ! 7: 99c330d9a Add $LinkTarget param to ShowUser so we can specify the target
@@ -1,9 +1,9 @@
Author: sunnavy <sunnavy at bestpractical.com>
- Add $LinkTarget param to ShowUser to specify the target
+ Add $LinkTarget param to ShowUser so we can specify the target
- This is mainly to support to open user links in new tabs by specifying
- $LinkTarget to "_blank"
+ Thus we can open user links in new tabs by specifying $LinkTarget to
+ "_blank"
diff --git a/share/html/Elements/ShowUser b/share/html/Elements/ShowUser
--- a/share/html/Elements/ShowUser
8: 9090c90fb ! 8: dc0ebd6ce Show dependencies and confirm before deleting saved searches
@@ -1,6 +1,10 @@
Author: sunnavy <sunnavy at bestpractical.com>
- Confirm before deleting saved searches that are depended on by others
+ Show dependencies and confirm before deleting saved searches
+
+ Usually it's wrong to delete saved searches that are depended on by
+ other attributes(dashboards/homepage prefs), let's show these
+ dependencies and confirm in case the deletion is not intentional.
diff --git a/share/html/Search/Elements/EditSearches b/share/html/Search/Elements/EditSearches
--- a/share/html/Search/Elements/EditSearches
@@ -15,30 +19,44 @@
<input type="submit" class="button" name="SavedSearchCopy" value="<%loc('Save as New')%>" />
% }
@@
+ %}
+ % }
+ <br />
++
++% if ( $Object && $Object->Id && $Object->DependedOnBy->Count ) {
++<span class="label"><&|/l&>Depended on by</&>:</span>
++<a href="#" class="view-saved-search-depended-on-by-list"><% loc('View') %></a>
++<br />
++% }
++
+ <hr />
+ <span class="label"><&|/l&>Load saved search</&>:</span>
+ <& SelectSearchesForObjects, Name => 'SavedSearchLoad', Objects => \@LoadObjects, SearchType => $Type &>
+@@
</&>
</div>
+
+% if ( $Object && $Object->Id && $Object->DependedOnBy->Count ) {
-+ <div class="delete-confirm hidden">
++ <div class="delete-saved-search-confirm hidden">
+ <p>
+ <&|/l&>This search is used in these dashboards/homepages, really delete?</&>
+ </p>
-+ <ul>
-+% my $links = $Object->DependedOnBy;
-+% while ( my $link = $links->Next ) {
++ <ul class="saved-search-depended-on-by-list">
++% my $links = $Object->DependedOnBy;
++% while ( my $link = $links->Next ) {
+ <li>
-+% if ( $link->BaseObj->Name eq 'Dashboard' ) {
++% if ( $link->BaseObj->Name eq 'Dashboard' ) {
+ <a href="<% $link->BaseURI->Resolver->HREF %>" target="_blank"><% $link->BaseURI->AsString %></a>
-+% } elsif ( $link->BaseObj->ObjectType eq 'RT::System' ) {
++% } elsif ( $link->BaseObj->ObjectType eq 'RT::System' ) {
+ <% loc('Global') %>
-+% } elsif ( $link->BaseObj->ObjectType eq 'RT::User' ) {
++% } elsif ( $link->BaseObj->ObjectType eq 'RT::User' ) {
+ <% loc('User') %>: <& /Elements/ShowUser, User => $link->BaseObj->Object, LinkTarget => '_blank' &>
-+% } else {
++% } else {
+ <% $link->BaseObj->ObjectType %>: #<% $link->BaseObj->ObjectId %>
-+% }
++% }
+ </li>
-+% }
++% }
+ </ul>
+ <& /Elements/Submit, Name => 'SavedSearchDelete', Label => loc('Delete') &>
+ </div>
@@ -46,14 +64,6 @@
<%INIT>
return unless $session{'CurrentUser'}->HasRight(
Right => 'LoadSavedSearch',
-@@
- } else {
- push @results, loc('Loaded saved search "[_1]"', $SavedSearch->{'Description'} );
- }
-+ push @results, loc('This search is used in dashboards/homepages.') if $search->DependedOnBy->Count;
- }
- else {
- push @results, loc( 'Can not load saved search "[_1]"',
diff --git a/share/static/js/util.js b/share/static/js/util.js
--- a/share/static/js/util.js
@@ -68,13 +78,21 @@
+ }
+
+ jQuery("<div class='modal'></div>")
-+ .append(jQuery(this).closest('form').find('div.delete-confirm').clone(true).removeClass('hidden')).appendTo("body")
++ .append(jQuery(this).closest('form').find('.delete-saved-search-confirm').clone(true).removeClass('hidden')).appendTo("body")
+ .bind('modal:close', function(ev,modal) { modal.elm.remove(); })
+ .modal();
+ return false;
+ });
+
-+ jQuery('.delete-confirm input[name=SavedSearchDelete]').click(function() {
++ jQuery('a.view-saved-search-depended-on-by-list').click(function() {
++ jQuery("<div class='modal'></div>")
++ .append(jQuery(this).closest('form').find('.saved-search-depended-on-by-list').clone(true)).appendTo("body")
++ .bind('modal:close', function(ev,modal) { modal.elm.remove(); })
++ .modal();
++ return false;
++ });
++
++ jQuery('.delete-saved-search-confirm input[name=SavedSearchDelete]').click(function() {
+ jQuery('input[name=SavedSearchDelete].confirm').addClass('confirmed').click();
+ });
});
9: 603a8ecfc = 9: f73e5c340 Include related links for attribute serialization
More information about the rt-commit
mailing list