таблица для просмотра логов
This commit is contained in:
parent
3f9f1ff839
commit
77a159a1a8
@ -28,6 +28,7 @@
|
||||
.l3-proto-label input[type=checkbox] {
|
||||
width: auto;
|
||||
}
|
||||
.
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
@ -87,13 +88,24 @@
|
||||
<option :value="604800000">7 суток</option>
|
||||
</select>
|
||||
</label>
|
||||
<button class="action-button" @click="settingsSubmitLoggingStatistics()">Сохранить <span class="submit-spinner" v-show="submitStatus.loggingIps"></span></button>
|
||||
<button class="action-button" @click="settingsSubmitLoggingStatistics()">Сохранить <span class="submit-spinner" v-show="submitStatus.loggingStatistics"></span></button>
|
||||
</div>
|
||||
<div class="settings-set-container">
|
||||
<h2>Просмотр логов</h2>
|
||||
<button class="action-button" @click="logView()">Обновить <span class="submit-spinner" v-show="submitStatus.logView"></span></button>
|
||||
<a href="/dev/logs.csv" class="action-button" download>Скачать</a>
|
||||
<pre style="overflow-x: auto">{{ logfileContent }}</pre>
|
||||
<div v-if="logsTable.headers.length != 0" style="overflow-x: auto;">
|
||||
<table>
|
||||
<tbody>
|
||||
<tr>
|
||||
<th v-for="h in logsTable.headers">{{ h }}</th>
|
||||
</tr>
|
||||
<tr v-for="r in logsTable.rows">
|
||||
<td v-for="value in r">{{ value }}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -120,7 +132,10 @@
|
||||
maxAgeMs: 0
|
||||
}
|
||||
},
|
||||
logfileContent: "",
|
||||
logsTable: {
|
||||
headers: [],
|
||||
rows: []
|
||||
},
|
||||
|
||||
settingFetchComplete: false
|
||||
}
|
||||
@ -173,7 +188,16 @@
|
||||
|
||||
this.submitStatus.logView = true
|
||||
fetch(`/dev/logs.csv`, {method: 'GET', credentials: 'same-origin' })
|
||||
.then(async (resp) => { this.logfileContent = await resp.text() })
|
||||
.then(async (resp) => {
|
||||
let logfileContent = await resp.text()
|
||||
const lines = logfileContent.split(/\r\n|\n/)
|
||||
|
||||
// Первая строка содержит заголовки
|
||||
this.logsTable.headers = lines.shift().split('\t')
|
||||
|
||||
// Остальные строки содержат данные
|
||||
this.logsTable.rows = lines.map(line => line.split('\t'))
|
||||
})
|
||||
.catch((reason) => { alert(`Ошибка при чтении логов: ${reason}`) })
|
||||
.finally(() => { this.submitStatus.logView = false })
|
||||
},
|
||||
|
@ -84,15 +84,14 @@
|
||||
padding: 1em;
|
||||
}
|
||||
|
||||
.settings-set-container th {
|
||||
.statistics-container th {
|
||||
text-align: left;
|
||||
font-weight: normal;
|
||||
padding: 0.2em 1em 0.2em 0.2em;
|
||||
}
|
||||
.settings-set-container td {
|
||||
min-width: 10em;
|
||||
padding: 0.2em;
|
||||
}
|
||||
th { padding: 0.2em 1em 0.2em 0.2em; }
|
||||
.statistics-container td { min-width: 10em; }
|
||||
td { padding: 0.2em; }
|
||||
|
||||
.tabs-item-flex-container h2 {
|
||||
margin-top: 0;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user