Skip to content
Merged
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ Section Order:

### Changed

- DataTable processing refactored/improved
- Enabled global search in the campaign table
- Allow clicking on table headers to change the sorting order

Expand Down
16 changes: 4 additions & 12 deletions sovtimer/locale/django.pot
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: AA Sov Timer 3.3.2\n"
"Report-Msgid-Bugs-To: https://github.com/ppfeufer/aa-sov-timer/issues\n"
"POT-Creation-Date: 2026-01-05 22:47+0100\n"
"POT-Creation-Date: 2026-01-16 22:11+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
Expand Down Expand Up @@ -51,14 +51,6 @@ msgstr ""
msgid "Sovereignty campaigns"
msgstr ""

#: sovtimer/templates/sovtimer/dashboard.html:15 sovtimer/views.py:147
msgid "Yes"
msgstr ""

#: sovtimer/templates/sovtimer/dashboard.html:16 sovtimer/views.py:140
msgid "No"
msgstr ""

#: sovtimer/templates/sovtimer/partials/common/spinner.html:8
msgid "Loading …"
msgstr ""
Expand Down Expand Up @@ -131,14 +123,14 @@ msgstr ""
msgid "Join our team of translators!"
msgstr ""

#: sovtimer/views.py:151
#: sovtimer/views.py:148
msgid "Defenders making progress"
msgstr ""

#: sovtimer/views.py:155
#: sovtimer/views.py:152
msgid "Attackers making progress"
msgstr ""

#: sovtimer/views.py:159
#: sovtimer/views.py:156
msgid "Neither side has made any progress yet"
msgstr ""
98 changes: 47 additions & 51 deletions sovtimer/static/sovtimer/js/aa-sov-timer.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,19 +45,21 @@ $(document).ready(() => {
/**
* Remove search from column control.
*
* @param {Array} columnControl Column control.
* @param {int} index Index of the column to remove search from.
* @return {Array} Modified column control.
* @private
*/
const _removeSearchFromColumnControl = (columnControl, index = 1) => {
const cc = JSON.parse(JSON.stringify(columnControl));

if (cc[index]) {
cc[index].content = [];
}
const _removeSearchFromColumnControl = () => {
return sovtimerSettings.dataTables.columnControl.map((control, index) => index === 1 ? { ...control, content: [] } : control);
};

return cc;
/**
* Remove all controls from column control.
*
* @return {Array} Modified column control.
* @private
*/
const _removeColumnControl = () => { // eslint-disable-line no-unused-vars
return sovtimerSettings.dataTables.columnControl.map((control) => ({ ...control, content: [] }));
};

/**
Expand Down Expand Up @@ -95,16 +97,17 @@ $(document).ready(() => {
const counts = data.reduce((campaigns, item) => {
campaigns.total++;

if (
item.active_campaign === sovtimerSettings.translation.no
&& item.remaining_time_in_seconds <= sovtimerSettings.upcomingTimerThreshold // jshint ignore:line
) {
campaigns.upcoming++;
if (item.campaign_status && Object.prototype.hasOwnProperty.call(campaigns, item.campaign_status)) {
campaigns[item.campaign_status]++;
}

if (item.active_campaign === sovtimerSettings.translation.yes) {
campaigns.active++;
}
// if (item.campaign_status === 'upcoming') {
// campaigns.upcoming++;
// }
//
// if (item.campaign_status === 'active') {
// campaigns.active++;
// }

return campaigns;
}, {total: 0, upcoming: 0, active: 0});
Expand Down Expand Up @@ -132,33 +135,33 @@ $(document).ready(() => {
// Column: 0 - System
{
data: {
display: d => d.solar_system_name_html,
sort: d => d.solar_system_name,
filter: d => d.solar_system_name
display: d => d.solar_system.display,
sort: d => d.solar_system.sort,
filter: d => d.solar_system.sort
}
},
// Column: 1 - Constellation
{
data: {
display: d => d.constellation_name_html,
sort: d => d.constellation_name,
filter: d => d.constellation_name
display: d => d.constellation.display,
sort: d => d.constellation.sort,
filter: d => d.constellation.sort
}
},
// Column: 2 - Region
{
data: {
display: d => d.region_name_html,
sort: d => d.region_name,
filter: d => d.region_name
display: d => d.region.display,
sort: d => d.region.sort,
filter: d => d.region.sort
}
},
// Column: 3 - Defender
{
data: {
display: d => d.defender_name_html,
sort: d => d.defender_name,
filter: d => d.defender_name
display: d => d.defender.display,
sort: d => d.defender.sort,
filter: d => d.defender.sort
}
},
// Column: 4 - Activity Defense Multiplier
Expand All @@ -176,42 +179,35 @@ $(document).ready(() => {
// Column: 6 - Remaining Time
{
data: {
display: d => d.remaining_time,
sort: d => parseInt(d.remaining_time_in_seconds, 10),
filter: d => parseInt(d.remaining_time_in_seconds, 10)
display: d => d.remaining_time.display,
sort: d => d.remaining_time.seconds,
filter: d => d.remaining_time.seconds
}
},
// Column: 7 - Campaign Progress
{
data: {
display: d => d.campaign_progress,
sort: d => d.campaign_progress,
display: d => d.campaign_progress.display,
sort: d => d.campaign_progress.current,
filter: d => d.campaign_status
}
}
],
columnDefs: [
{
targets: [4, 5, 6, 7],
columnControl: _removeSearchFromColumnControl(sovtimerSettings.dataTables.columnControl, 1)
columnControl: _removeSearchFromColumnControl()
},
{
targets: [6, 7],
type: 'float',
width: 175
},
{target: 6, type: 'string', width: 175},
{target: 7, type: 'string', width: 175}
],
order: [[5, 'asc']],
createdRow: (row, data) => {
// Upcoming timer (< 4 hrs)
if (
data.active_campaign === sovtimerSettings.translation.no
&& data.remaining_time_in_seconds <= sovtimerSettings.upcomingTimerThreshold // jshint ignore: line
) {
$(row).addClass('aa-sovtimer-upcoming-campaign');
}

// Active timer
if (data.active_campaign === sovtimerSettings.translation.yes) {
$(row).addClass('aa-sovtimer-active-campaign');
}
// Add a class for upcoming or active campaigns
$(row).addClass(`aa-sovtimer-${data.campaign_status}-campaign`);
},
paging: false,
initComplete: () => {
Expand All @@ -226,7 +222,7 @@ $(document).ready(() => {
return {
rowIdx,
cellNode: dt.cell(rowIdx, 6).node(),
remainingSeconds: Number(rowData.remaining_time_in_seconds)
remainingSeconds: Number(rowData.remaining_time.seconds)
};
});

Expand All @@ -242,7 +238,7 @@ $(document).ready(() => {
return {
rowIdx,
cellNode: dt.cell(rowIdx, 6).node(),
remainingSeconds: Number(rowData.remaining_time_in_seconds)
remainingSeconds: Number(rowData.remaining_time.seconds)
};
});
};
Expand Down
2 changes: 1 addition & 1 deletion sovtimer/static/sovtimer/js/aa-sov-timer.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading