wip commit

This commit is contained in:
2026-01-23 22:55:20 +03:00
parent 5ccc16d1b8
commit f3be92d1f9

View File

@@ -145,9 +145,67 @@ function getRowKey(rowData) {
const STORAGE_KEYS = {
credentials: 'turborfq_credentials',
columns: 'turborfq_columns'
columns: 'turborfq_columns',
lastTable: 'turborfq_lastTable',
tableState: 'turborfq_tableState'
};
// Сохранить состояние таблицы (фильтры, страница)
function saveTableState() {
if (!currentSchema || !currentTable || !table) return;
const tableKey = `${currentSchema}.${currentTable}`;
const headerFilters = table.getHeaderFilters ? table.getHeaderFilters() : [];
const page = table.getPage ? table.getPage() : 1;
let allStates = {};
try {
const saved = localStorage.getItem(STORAGE_KEYS.tableState);
if (saved) allStates = JSON.parse(saved);
} catch (e) {}
allStates[tableKey] = {
filters: headerFilters.filter(f => f.value),
page: page
};
localStorage.setItem(STORAGE_KEYS.tableState, JSON.stringify(allStates));
}
// Загрузить состояние таблицы
function loadTableState() {
if (!currentSchema || !currentTable) return null;
const tableKey = `${currentSchema}.${currentTable}`;
try {
const saved = localStorage.getItem(STORAGE_KEYS.tableState);
if (saved) {
const allStates = JSON.parse(saved);
return allStates[tableKey] || null;
}
} catch (e) {}
return null;
}
// Сохранить последнюю открытую таблицу
function saveLastTable() {
if (!currentSchema || !currentTable) return;
localStorage.setItem(STORAGE_KEYS.lastTable, JSON.stringify({
schema: currentSchema,
table: currentTable
}));
}
// Загрузить последнюю таблицу
function loadLastTable() {
try {
const saved = localStorage.getItem(STORAGE_KEYS.lastTable);
if (saved) return JSON.parse(saved);
} catch (e) {}
return null;
}
// Показать основной интерфейс
function showApp(username) {
document.getElementById('loginScreen').style.display = 'none';
@@ -501,14 +559,17 @@ function showColumnManager() {
// selectTable
async function selectTable(schema, tableName) {
console.log('🔄 SELECTTABLE ВЫЗВАН - ВЕРСИЯ 3.0:', schema, '.', tableName);
async function selectTable(schema, tableName, restoreState = false) {
console.log('🔄 SELECTTABLE ВЫЗВАН:', schema, '.', tableName);
currentSchema = schema;
currentTable = tableName;
selectedRowsDataGlobal.clear();
updateSelectionCounter();
// Сохраняем последнюю открытую таблицу
saveLastTable();
if (enterHandler) {
document.removeEventListener('keydown', enterHandler);
enterHandler = null;