SearchKit - Better default label for new displays
authorColeman Watts <coleman@civicrm.org>
Wed, 16 Mar 2022 15:11:21 +0000 (11:11 -0400)
committerColeman Watts <coleman@civicrm.org>
Sun, 20 Mar 2022 02:02:59 +0000 (22:02 -0400)
ext/search_kit/ang/crmSearchAdmin/crmSearchAdmin.component.js

index 9feafb75ca4106fb43ffee41e8da78e6df6926b8..c368cfc3acf1d6f5030433164f1103f5df97bd59 100644 (file)
       };
 
       this.addDisplay = function(type) {
-        var count = _.filter(ctrl.savedSearch.displays, {type: type}).length;
+        var count = _.filter(ctrl.savedSearch.displays, {type: type}).length,
+          searchLabel = ctrl.savedSearch.label || searchMeta.getEntity(ctrl.savedSearch.api_entity).title_plural;
         ctrl.savedSearch.displays.push({
           type: type,
-          label: ctrl.displayTypes[type].label + (count ? ' ' + (++count) : '')
+          label: searchLabel + ' ' + ctrl.displayTypes[type].label + ' ' + (count + 1),
         });
         $scope.selectTab('display_' + (ctrl.savedSearch.displays.length - 1));
       };