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:
|
on:
|
||||||
schedule:
|
schedule:
|
||||||
- cron: '10 11 * * *' # Set your preferred schedule (UTC)
|
- cron: '25 11 * * *' # Set your preferred schedule (UTC)
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
update-readme:
|
update-readme:
|
||||||
@@ -15,4 +15,4 @@ jobs:
|
|||||||
- name: Update Sponsors
|
- name: Update Sponsors
|
||||||
run: |
|
run: |
|
||||||
GH_TOKEN=${{ secrets.GITHUB_TOKEN }}
|
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
|
||||||
|
|||||||
@@ -836,146 +836,29 @@ function initializeSelectedColumns () {
|
|||||||
// --------------------------------------------------------
|
// --------------------------------------------------------
|
||||||
//Initialize Select2 Elements and make them sortable
|
//Initialize Select2 Elements and make them sortable
|
||||||
|
|
||||||
$(function () {
|
$(function () {
|
||||||
selectEl = $('.select2').select2();
|
var selectEl = $('.select2').select2();
|
||||||
|
|
||||||
selectEl.next().children().children().children().sortable({
|
selectEl.next().children().children().children().sortable({
|
||||||
containment: 'parent', stop: function (event, ui) {
|
containment: 'parent',
|
||||||
ui.item.parent().children('[title]').each(function () {
|
update: function () {
|
||||||
var title = $(this).attr('title');
|
var sortedValues = $(this).children().map(function() {
|
||||||
var original = $( 'option:contains(' + title + ')', selectEl ).first();
|
return $(this).attr('title');
|
||||||
original.detach();
|
}).get();
|
||||||
selectEl.append(original)
|
|
||||||
});
|
var sortedOptions = selectEl.find('option').sort(function(a, b) {
|
||||||
selectEl.change();
|
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
|
// General initialization
|
||||||
|
|||||||
@@ -288,7 +288,7 @@
|
|||||||
"Maintenance_Tools_Tab_Tools" : "Tools",
|
"Maintenance_Tools_Tab_Tools" : "Tools",
|
||||||
"Maintenance_Tools_Tab_BackupRestore" : "Backup / Restore",
|
"Maintenance_Tools_Tab_BackupRestore" : "Backup / Restore",
|
||||||
"Maintenance_Tools_Tab_Logging" : "Logs",
|
"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_order_columns_text" : "",
|
||||||
"Maintenance_Tool_darkmode" : "Toggle Modes (Dark/Light)",
|
"Maintenance_Tool_darkmode" : "Toggle Modes (Dark/Light)",
|
||||||
"Maintenance_Tool_drag_me" : "Drag me to reorder columns.",
|
"Maintenance_Tool_drag_me" : "Drag me to reorder columns.",
|
||||||
|
|||||||
@@ -3,9 +3,8 @@ import requests
|
|||||||
import base64
|
import base64
|
||||||
|
|
||||||
def fetch_sponsors():
|
def fetch_sponsors():
|
||||||
|
|
||||||
global headers
|
global headers
|
||||||
|
|
||||||
graphql_url = "https://api.github.com/graphql"
|
graphql_url = "https://api.github.com/graphql"
|
||||||
headers = {
|
headers = {
|
||||||
"Authorization": f"Bearer {os.environ.get('GH_TOKEN')}",
|
"Authorization": f"Bearer {os.environ.get('GH_TOKEN')}",
|
||||||
@@ -72,13 +71,20 @@ def fetch_sponsors():
|
|||||||
"monthly_price": monthly_price,
|
"monthly_price": monthly_price,
|
||||||
}
|
}
|
||||||
|
|
||||||
if created_at == sponsorship["createdAt"]:
|
# Check if the sponsorship is current or past
|
||||||
past_sponsors.append(sponsor)
|
if privacy_level == "PUBLIC":
|
||||||
else:
|
|
||||||
current_sponsors.append(sponsor)
|
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}
|
return {"current_sponsors": current_sponsors, "past_sponsors": past_sponsors}
|
||||||
|
|
||||||
|
|
||||||
def generate_sponsors_table(current_sponsors, past_sponsors):
|
def generate_sponsors_table(current_sponsors, past_sponsors):
|
||||||
current_table = "| Current Sponsors |\n|---|\n"
|
current_table = "| Current Sponsors |\n|---|\n"
|
||||||
for sponsor in current_sponsors:
|
for sponsor in current_sponsors:
|
||||||
|
|||||||
Reference in New Issue
Block a user