mirror of
https://github.com/jokob-sk/NetAlertX.git
synced 2025-12-07 09:36:05 -08:00
Sponsorship auto-generate v0.1.39 + columns fix in maintenance
This commit is contained in:
4
.github/workflows/update_sponsors.yml
vendored
4
.github/workflows/update_sponsors.yml
vendored
@@ -2,7 +2,7 @@ name: Update Sponsors
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: '10 11 * * *' # Set your preferred schedule (UTC)
|
||||
- cron: '25 11 * * *' # Set your preferred schedule (UTC)
|
||||
|
||||
jobs:
|
||||
update-readme:
|
||||
@@ -15,4 +15,4 @@ jobs:
|
||||
- name: Update Sponsors
|
||||
run: |
|
||||
GH_TOKEN=${{ secrets.GITHUB_TOKEN }}
|
||||
gh run workflow_dispatch -R $GITHUB_REPOSITORY update_sponsors_table.yml -t $GH_TOKEN
|
||||
gh run workflow_dispatch -R $GITHUB_REPOSITORY update_sponsors_table.yml
|
||||
|
||||
@@ -837,145 +837,28 @@ function initializeSelectedColumns () {
|
||||
//Initialize Select2 Elements and make them sortable
|
||||
|
||||
$(function () {
|
||||
selectEl = $('.select2').select2();
|
||||
var selectEl = $('.select2').select2();
|
||||
|
||||
selectEl.next().children().children().children().sortable({
|
||||
containment: 'parent', stop: function (event, ui) {
|
||||
ui.item.parent().children('[title]').each(function () {
|
||||
var title = $(this).attr('title');
|
||||
var original = $( 'option:contains(' + title + ')', selectEl ).first();
|
||||
original.detach();
|
||||
selectEl.append(original)
|
||||
});
|
||||
selectEl.change();
|
||||
}
|
||||
containment: 'parent',
|
||||
update: function () {
|
||||
var sortedValues = $(this).children().map(function() {
|
||||
return $(this).attr('title');
|
||||
}).get();
|
||||
|
||||
var sortedOptions = selectEl.find('option').sort(function(a, b) {
|
||||
return sortedValues.indexOf($(a).text()) - sortedValues.indexOf($(b).text());
|
||||
});
|
||||
|
||||
// Replace all options in selectEl
|
||||
selectEl.empty().append(sortedOptions);
|
||||
|
||||
// Trigger change event on Select2
|
||||
selectEl.trigger('change');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// $(function () {
|
||||
// var selectEl = $('.select2').select2();
|
||||
|
||||
// selectEl.next().children().children().children().sortable({
|
||||
// containment: 'parent',
|
||||
// stop: function (event, ui) {
|
||||
// ui.item.parent().children('[title]').each(function () {
|
||||
// var title = $(this).attr('title');
|
||||
// var original = $('option:contains(' + title + ')', selectEl).first();
|
||||
|
||||
// // Clear any previous data associated with the element
|
||||
// original.removeData();
|
||||
|
||||
// original.detach();
|
||||
// selectEl.append(original);
|
||||
// });
|
||||
|
||||
// // Trigger change event on Select2
|
||||
// selectEl.trigger('change');
|
||||
// }
|
||||
// });
|
||||
// });
|
||||
|
||||
|
||||
// $(function () {
|
||||
// var selectEl = $('.select2').select2();
|
||||
|
||||
// selectEl.next().children().children().children().sortable({
|
||||
// containment: 'parent',
|
||||
// stop: function (event, ui) {
|
||||
// // Remove all options from selectEl
|
||||
// selectEl.children().remove();
|
||||
|
||||
// // Rebuild options based on the sorted order
|
||||
// ui.item.parent().children('[title]').each(function () {
|
||||
// var title = $(this).attr('title');
|
||||
// var original = $('option:contains(' + title + ')', selectEl).first();
|
||||
|
||||
// original.removeData();
|
||||
// selectEl.append(original);
|
||||
// });
|
||||
|
||||
// // Trigger change event on Select2
|
||||
// selectEl.trigger('change');
|
||||
// }
|
||||
// });
|
||||
// });
|
||||
|
||||
// $(function () {
|
||||
// var selectEl = $('.select2').select2();
|
||||
|
||||
// selectEl.next().children().children().children().sortable({
|
||||
// containment: 'parent',
|
||||
// stop: function (event, ui) {
|
||||
// var sortedOptions = [];
|
||||
|
||||
// // Build an array of sorted option values
|
||||
// ui.item.parent().children('[title]').each(function () {
|
||||
// var title = $(this).attr('title');
|
||||
// sortedOptions.push(selectEl.find('option:contains(' + title + ')').val());
|
||||
// });
|
||||
|
||||
// // Remove all options from selectEl
|
||||
// selectEl.empty();
|
||||
|
||||
// // Rebuild options based on the sorted order
|
||||
// $.each(sortedOptions, function (index, value) {
|
||||
// var option = selectEl.find('option[value="' + value + '"]');
|
||||
// selectEl.append(option);
|
||||
// });
|
||||
|
||||
// // Trigger change event on Select2
|
||||
// selectEl.trigger('change');
|
||||
// }
|
||||
// });
|
||||
// });
|
||||
|
||||
// $(function () {
|
||||
// var selectEl = $('.select2').select2();
|
||||
|
||||
// selectEl.next().children().children().children().sortable({
|
||||
// containment: 'parent',
|
||||
// stop: function (event, ui) {
|
||||
// var sortedOptions = ui.item.parent().children('[title]').map(function () {
|
||||
// var title = $(this).attr('title');
|
||||
// return selectEl.find('option:contains(' + title + ')').prop('outerHTML');
|
||||
// }).get().join('');
|
||||
|
||||
// // Replace all options in selectEl
|
||||
// selectEl.html(sortedOptions);
|
||||
|
||||
// // Trigger change event on Select2
|
||||
// selectEl.trigger('change');
|
||||
// }
|
||||
// });
|
||||
// });
|
||||
|
||||
// $(function () {
|
||||
// var selectEl = $('.select2').select2();
|
||||
|
||||
// selectEl.next().children().children().children().sortable({
|
||||
// containment: 'parent',
|
||||
// stop: function (event, ui) {
|
||||
// var sortedOptions = selectEl.find('option').map(function () {
|
||||
// var title = $(this).text();
|
||||
// var isSelected = $(this).is(':selected');
|
||||
// var newOption = $('<option>', {
|
||||
// value: $(this).val(),
|
||||
// text: title,
|
||||
// selected: isSelected
|
||||
// });
|
||||
// return newOption.prop('outerHTML');
|
||||
// }).get().join('');
|
||||
|
||||
// // Replace all options in selectEl
|
||||
// selectEl.html(sortedOptions);
|
||||
|
||||
// // Trigger change event on Select2
|
||||
// selectEl.trigger('change');
|
||||
// }
|
||||
// });
|
||||
// });
|
||||
|
||||
|
||||
|
||||
// --------------------------------------------------------
|
||||
// General initialization
|
||||
|
||||
@@ -288,7 +288,7 @@
|
||||
"Maintenance_Tools_Tab_Tools" : "Tools",
|
||||
"Maintenance_Tools_Tab_BackupRestore" : "Backup / Restore",
|
||||
"Maintenance_Tools_Tab_Logging" : "Logs",
|
||||
"Maintenance_Tool_displayed_columns_text" : "Change the visibility and order of the columns in the <a href=\"devices.php\"><b> <i class=\"fa fa-laptop\"></i> Devices</b></a> page. (The drag-and-drop is a bit clunky, but for now workable, not a common task - will not fix for now (tried for <a href=\"https://github.com/jokob-sk/Pi.Alert/commit/94b32f0f7332879f5a7d2af05dafa2e5d5cfa5da\">like 3h</a> - happy for someone to submit a PR :) )).",
|
||||
"Maintenance_Tool_displayed_columns_text" : "Change the visibility and order of the columns in the <a href=\"devices.php\"><b> <i class=\"fa fa-laptop\"></i> Devices</b></a> page.",
|
||||
"Maintenance_Tool_order_columns_text" : "",
|
||||
"Maintenance_Tool_darkmode" : "Toggle Modes (Dark/Light)",
|
||||
"Maintenance_Tool_drag_me" : "Drag me to reorder columns.",
|
||||
|
||||
@@ -3,7 +3,6 @@ import requests
|
||||
import base64
|
||||
|
||||
def fetch_sponsors():
|
||||
|
||||
global headers
|
||||
|
||||
graphql_url = "https://api.github.com/graphql"
|
||||
@@ -72,13 +71,20 @@ def fetch_sponsors():
|
||||
"monthly_price": monthly_price,
|
||||
}
|
||||
|
||||
if created_at == sponsorship["createdAt"]:
|
||||
past_sponsors.append(sponsor)
|
||||
else:
|
||||
# Check if the sponsorship is current or past
|
||||
if privacy_level == "PUBLIC":
|
||||
current_sponsors.append(sponsor)
|
||||
else:
|
||||
past_sponsors.append(sponsor)
|
||||
|
||||
print("Current Sponsors:")
|
||||
print(current_sponsors)
|
||||
print("\nPast Sponsors:")
|
||||
print(past_sponsors)
|
||||
|
||||
return {"current_sponsors": current_sponsors, "past_sponsors": past_sponsors}
|
||||
|
||||
|
||||
def generate_sponsors_table(current_sponsors, past_sponsors):
|
||||
current_table = "| Current Sponsors |\n|---|\n"
|
||||
for sponsor in current_sponsors:
|
||||
|
||||
Reference in New Issue
Block a user