Add All imports menu item for users with Administer QUeues
authorEileen McNaughton <emcnaughton@wikimedia.org>
Mon, 12 Jun 2023 22:32:23 +0000 (10:32 +1200)
committerEileen McNaughton <emcnaughton@wikimedia.org>
Mon, 12 Jun 2023 22:32:23 +0000 (10:32 +1200)
This adds the (only just added) search display for 'all imports' to the menu, but
only for users with 'Administer Queues' - for other users they would only see
their own imports, so it would duplicate 'my imports'.

This is useful for site admins etc trying to understand issues their users might be having
with imports.

Note the extension needs to be enabled

ext/civiimport/Managed/UserJobSearches.mgd.php
ext/civiimport/ang/afsearchAllImports.aff.html [new file with mode: 0644]
ext/civiimport/ang/afsearchAllImports.aff.json [new file with mode: 0644]

index 8a9551b236d168ec20eb8b8a4a73c229f8651f70..a78260f3918d50417afe010f6061e893f1b23808 100644 (file)
@@ -172,7 +172,7 @@ return [
     'params' => [
       'version' => 4,
       'values' => [
-        'name' => 'Imports',
+        'name' => 'all_imports',
         'label' => 'Imports',
         'form_values' => NULL,
         'mapping_id' => NULL,
@@ -211,4 +211,76 @@ return [
       ],
     ],
   ],
+  [
+    'name' => 'SavedSearch_Import_Templates_SearchDisplay_AllImports',
+    'entity' => 'SearchDisplay',
+    'cleanup' => 'always',
+    'update' => 'unmodified',
+    'params' => [
+      'version' => 4,
+      'values' => [
+        'name' => 'all_imports',
+        'label' => E::ts('All Imports'),
+        'saved_search_id.name' => 'all_imports',
+        'type' => 'table',
+        'settings' => [
+          'description' => E::ts('All import jobs'),
+          'sort' => [],
+          'limit' => 50,
+          'pager' => [],
+          'placeholder' => 5,
+          'columns' => [
+            [
+              'type' => 'field',
+              'key' => 'id',
+              'dataType' => 'Integer',
+              'label' => E::ts('ID'),
+              'sortable' => TRUE,
+            ],
+            [
+              'type' => 'field',
+              'key' => 'created_id.display_name',
+              'dataType' => 'String',
+              'label' => E::ts('Created By'),
+              'sortable' => TRUE,
+            ],
+            [
+              'type' => 'field',
+              'key' => 'name',
+              'dataType' => 'String',
+              'label' => E::ts('Import Name'),
+              'sortable' => TRUE,
+              'link' => [
+                'path' => 'civicrm/import/contribution?reset=1&template_id=[id]',
+                'entity' => '',
+                'action' => '',
+                'join' => '',
+                'target' => '',
+              ],
+            ],
+            [
+              'type' => 'field',
+              'key' => 'created_date',
+              'dataType' => 'Timestamp',
+              'label' => E::ts('Created Date'),
+              'sortable' => TRUE,
+            ],
+            [
+              'type' => 'field',
+              'key' => 'job_type:label',
+              'dataType' => 'String',
+              'label' => E::ts('Type'),
+              'sortable' => TRUE,
+            ],
+          ],
+          'actions' => TRUE,
+          'classes' => [
+            'table',
+            'table-striped',
+          ],
+        ],
+        'acl_bypass' => FALSE,
+      ],
+    ],
+  ],
 ];
diff --git a/ext/civiimport/ang/afsearchAllImports.aff.html b/ext/civiimport/ang/afsearchAllImports.aff.html
new file mode 100644 (file)
index 0000000..58cde45
--- /dev/null
@@ -0,0 +1,3 @@
+<div af-fieldset="">
+  <crm-search-display-table search-name="all_imports" display-name="all_imports"></crm-search-display-table>
+</div>
diff --git a/ext/civiimport/ang/afsearchAllImports.aff.json b/ext/civiimport/ang/afsearchAllImports.aff.json
new file mode 100644 (file)
index 0000000..92f44df
--- /dev/null
@@ -0,0 +1,23 @@
+{
+    "type": "search",
+    "requires": [],
+    "entity_type": null,
+    "join_entity": null,
+    "title": "All Imports",
+    "description": "",
+    "is_dashlet": false,
+    "is_public": false,
+    "is_token": false,
+    "contact_summary": null,
+    "summary_contact_type": null,
+    "icon": "fa-list-alt",
+    "server_route": "civicrm/imports/all-imports",
+    "permission": "administer queues",
+    "redirect": null,
+    "create_submission": false,
+    "navigation": {
+        "parent": "Reports",
+        "label": "All imports",
+        "weight": 17
+    }
+}