123
This commit is contained in:
23
index.html
23
index.html
@@ -633,23 +633,30 @@ SELECT * FROM users LIMIT 10;"></textarea>
|
||||
}
|
||||
|
||||
// CRUD Operations
|
||||
showAddRecordModal() {
|
||||
async showAddRecordModal() {
|
||||
this.editingRecord = null;
|
||||
document.getElementById('recordModalTitle').textContent = 'Добавить запись';
|
||||
this.generateRecordForm();
|
||||
|
||||
await this.generateRecordForm();
|
||||
|
||||
document.getElementById('recordModal').classList.remove('hidden');
|
||||
}
|
||||
|
||||
editRecord(idx) {
|
||||
async editRecord(idx) {
|
||||
this.editingRecord = idx;
|
||||
document.getElementById('recordModalTitle').textContent = 'Редактировать запись';
|
||||
this.generateRecordForm();
|
||||
|
||||
await this.generateRecordForm();
|
||||
|
||||
document.getElementById('recordModal').classList.remove('hidden');
|
||||
}
|
||||
|
||||
generateRecordForm() {
|
||||
// Get columns based on current table structure
|
||||
const columns = this.getTableStructure(this.currentTable);
|
||||
async generateRecordForm() {
|
||||
if (response.status === 401) {
|
||||
this.logout();
|
||||
return [];
|
||||
}
|
||||
const columns = await this.getTableStructure(this.currentTable);
|
||||
const container = document.getElementById('recordForm');
|
||||
|
||||
container.innerHTML = columns.map(col => `
|
||||
@@ -665,7 +672,7 @@ SELECT * FROM users LIMIT 10;"></textarea>
|
||||
<p class="text-xs text-slate-500 mt-1">${col.type}</p>
|
||||
</div>
|
||||
`).join('');
|
||||
}
|
||||
}
|
||||
|
||||
async getTableStructure(tableName) {
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user