Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add curated urls column to homepage #1166

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion sde_collections/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
)

Expand Down
66 changes: 59 additions & 7 deletions sde_indexing_helper/static/js/collection_list.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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: {
Expand Down Expand Up @@ -442,6 +493,7 @@ $(document).ready(function () {
null,
"Division",
"Delta URLs",
"Curated URLs",
"Workflow Status",
"Curator",
"Connector Type",
Expand Down
11 changes: 11 additions & 0 deletions sde_indexing_helper/templates/sde_collections/collection_list.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ <h2 class="title">Welcome back!</h2>
<th class="text-center noBorder url-th" style="padding-right:25px !important">Url</th>
<th class="text-center noBorder" style="padding-right:25px !important">Division</th>
<th class="text-center noBorder" style="padding-right:25px !important">Delta Urls</th>
<th class="text-center noBorder" style="padding-right:25px !important">Curated Urls</th>
<th class="text-center noBorder" style="padding-right:25px !important">Workflow Status</th>
<th class="text-center noBorder" style="padding-right:25px !important">Curator</th>
<th class="text-center noBorder" style="padding-right:25px !important">Connector Type</th>
Expand Down Expand Up @@ -64,6 +65,9 @@ <h2 class="title">Welcome back!</h2>
<!-- Empty cell for Delta Urls (no filter) -->
<td class="filterRowBottom"></td>

<!-- Empty cell for Curated Urls (no filter) -->
<td class="filterRowBottom"></td>

<!-- Dropdown filter for Workflow Status -->
<td class="filterRowBottom">
<select id="collection-dropdown-4" class="select-dropdown selectStyling">
Expand Down Expand Up @@ -153,6 +157,13 @@ <h2 class="title">Welcome back!</h2>
role="button">{{ collection.num_delta_urls|intcomma }}</a>
</td>

<!-- Curated URLs Column - Shows count and links if > 0 -->
<td class="noBorder centerAlign">
<a href=" {% if collection.num_curated_urls > 0 %} {% url 'sde_collections:delta_urls' collection.pk %} {% endif %} "
class="btn btn-sm {% if collection.num_curated_urls > 0 %}btn-primary {% else %}disabled{% endif %}candidateCount"
role="button">{{ collection.num_curated_urls|intcomma }}</a>
</td>

<!-- Workflow Status Dropdown -->
<td class="noBorder">
<div class="dropdown workflow_status_dropdown"
Expand Down
Loading