From 21a921a020a98457eb7de0cfaecf3dfe28b7e97b Mon Sep 17 00:00:00 2001 From: Dhanur Sharma Date: Thu, 19 Dec 2024 15:11:47 +0530 Subject: [PATCH] column addition work in progress --- sde_collections/views.py | 2 +- .../static/js/collection_list.js | 66 +++++++++++++++++-- .../sde_collections/collection_list.html | 11 ++++ 3 files changed, 71 insertions(+), 8 deletions(-) diff --git a/sde_collections/views.py b/sde_collections/views.py index 8b3f1727..673705d9 100644 --- a/sde_collections/views.py +++ b/sde_collections/views.py @@ -71,7 +71,7 @@ def get_queryset(self): super() .get_queryset() .filter(delete=False) - .annotate(num_delta_urls=models.Count("delta_urls")) + .annotate(num_delta_urls=models.Count("delta_urls"), num_curated_urls=models.Count("curated_urls")) .order_by("-num_delta_urls") ) diff --git a/sde_indexing_helper/static/js/collection_list.js b/sde_indexing_helper/static/js/collection_list.js index 7500bad1..0cd5d8d7 100644 --- a/sde_indexing_helper/static/js/collection_list.js +++ b/sde_indexing_helper/static/js/collection_list.js @@ -4,13 +4,14 @@ const COLUMNS = { URL: 1, DIVISION: 2, DELTA_URLS: 3, - WORKFLOW_STATUS: 4, - CURATOR: 5, - CONNECTOR_TYPE: 6, - REINDEXING_STATUS: 7, - WORKFLOW_STATUS_RAW: 8, - CURATOR_ID: 9, - REINDEXING_STATUS_RAW: 10 + CURATED_URLS: 4, + WORKFLOW_STATUS: 5, + CURATOR: 6, + CONNECTOR_TYPE: 7, + REINDEXING_STATUS: 8, + WORKFLOW_STATUS_RAW: 9, + CURATOR_ID: 10, + REINDEXING_STATUS_RAW: 11 }; var uniqueId; //used for logic related to contents on column customization modal @@ -178,6 +179,56 @@ let table = $("#collection_table").DataTable({ targets: [COLUMNS.DELTA_URLS], type: "num-fmt", }, + { + searchPanes: { + options: [ + { + label: "0 URLs", + value: function (rowData, rowIdx) { + return $(rowData[COLUMNS.CURATED_URLS]).text() == 0; + }, + }, + { + label: "1 solo URL", + value: function (rowData, rowIdx) { + return $(rowData[COLUMNS.CURATED_URLS]).text() == 1; + }, + }, + { + label: "1 to 100 URLs", + value: function (rowData, rowIdx) { + return $(rowData[COLUMNS.CURATED_URLS]).text() <= 100 && $(rowData[COLUMNS.CURATED_URLS]).text() > 1; + }, + }, + { + label: "100 to 1,000 URLs", + value: function (rowData, rowIdx) { + return $(rowData[COLUMNS.CURATED_URLS]).text() <= 1000 && $(rowData[COLUMNS.CURATED_URLS]).text() > 100; + }, + }, + { + label: "1,000 to 10,000 URLs", + value: function (rowData, rowIdx) { + return $(rowData[COLUMNS.CURATED_URLS]).text() <= 10000 && $(rowData[COLUMNS.CURATED_URLS]).text() > 1000; + }, + }, + { + label: "10,000 to 100,000 URLs", + value: function (rowData, rowIdx) { + return $(rowData[COLUMNS.CURATED_URLS]).text() <= 100000 && $(rowData[COLUMNS.CURATED_URLS]).text() > 10000; + }, + }, + { + label: "Over 100,000 URLs", + value: function (rowData, rowIdx) { + return $(rowData[COLUMNS.CURATED_URLS]).text() > 100000; + }, + }, + ], + }, + targets: [COLUMNS.CURATED_URLS], + type: "num-fmt", + }, // hide the data panes { searchPanes: { @@ -442,6 +493,7 @@ $(document).ready(function () { null, "Division", "Delta URLs", + "Curated URLs", "Workflow Status", "Curator", "Connector Type", diff --git a/sde_indexing_helper/templates/sde_collections/collection_list.html b/sde_indexing_helper/templates/sde_collections/collection_list.html index 49515454..8953606e 100644 --- a/sde_indexing_helper/templates/sde_collections/collection_list.html +++ b/sde_indexing_helper/templates/sde_collections/collection_list.html @@ -24,6 +24,7 @@

Welcome back!

Url Division Delta Urls + Curated Urls Workflow Status Curator Connector Type @@ -64,6 +65,9 @@

Welcome back!

+ + +