This commit is contained in:
+31
-1
@@ -154,7 +154,7 @@ function renderRows(rows, totalLoaded) {
|
||||
if (!rows.length) {
|
||||
const tr = document.createElement('tr');
|
||||
const td = document.createElement('td');
|
||||
td.colSpan = 7;
|
||||
td.colSpan = 8;
|
||||
td.className = 'empty';
|
||||
td.textContent = totalLoaded ? 'No lobbies match the selected filters' : 'No data yet';
|
||||
tr.append(td);
|
||||
@@ -192,6 +192,35 @@ function renderRows(rows, totalLoaded) {
|
||||
passPill.textContent = row.hasPassKey ? 'yes' : 'no';
|
||||
pass.append(passPill);
|
||||
|
||||
const action = document.createElement('td');
|
||||
const createTemplate = document.createElement('button');
|
||||
const template = {
|
||||
sourceLobbyId: String(row.id || ''),
|
||||
lobbyName: row.lobby || `${row.game || 'Custom game'} ${row.map || ''}`.trim(),
|
||||
serverRegion: String(row.regionId || 0),
|
||||
customGameId: String(row.customGameId || ''),
|
||||
customGameMode: String(row.customGameMode || ''),
|
||||
customMapName: String(row.map || ''),
|
||||
customMinPlayers: String(row.minPlayerCount || 1),
|
||||
customMaxPlayers: String(row.maxPlayerCount || 2),
|
||||
customGameCrc: String(row.customGameCrc || ''),
|
||||
customGameTimestamp: String(row.customGameTimestamp || ''),
|
||||
};
|
||||
createTemplate.type = 'button';
|
||||
createTemplate.className = 'template-button';
|
||||
createTemplate.textContent = 'Create template';
|
||||
createTemplate.title = 'Open the admin page and prefill lobby creation from this lobby';
|
||||
createTemplate.addEventListener('click', () => {
|
||||
try {
|
||||
sessionStorage.setItem('dokaLobbyTemplate', JSON.stringify(template));
|
||||
window.location.assign('/admin');
|
||||
} catch {
|
||||
const fallback = new URLSearchParams({ template: 'lobby', ...template });
|
||||
window.location.assign(`/admin?${fallback}`);
|
||||
}
|
||||
});
|
||||
action.append(createTemplate);
|
||||
|
||||
tr.append(
|
||||
game,
|
||||
makeCell(row.lobby),
|
||||
@@ -200,6 +229,7 @@ function renderRows(rows, totalLoaded) {
|
||||
makeCell(row.region),
|
||||
pass,
|
||||
makeCell(row.leader),
|
||||
action,
|
||||
);
|
||||
fragment.append(tr);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user