Skip to content

Commit f485f77

Browse files
committed
implement feedback
Signed-off-by: Lukas Schaefer <lukas@lschaefer.xyz>
1 parent 6bcc676 commit f485f77

File tree

2 files changed

+25
-10
lines changed

2 files changed

+25
-10
lines changed

lib/Controller/LogController.php

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,11 @@
99

1010
use OCA\ContextChat\Logger;
1111
use OCP\AppFramework\Controller;
12-
use OCP\AppFramework\Http\Attribute\NoCSRFRequired;
12+
use OCP\AppFramework\Http;
1313

14+
use OCP\AppFramework\Http\Attribute\NoCSRFRequired;
15+
use OCP\AppFramework\Http\Response;
16+
use OCP\AppFramework\Http\TextPlainResponse;
1417
use OCP\AppFramework\Http\ZipResponse;
1518
use OCP\IRequest;
1619

@@ -25,10 +28,10 @@ public function __construct(
2528
/**
2629
* Downloads log file
2730
*
28-
* @return ZipResponse
31+
* @return Response
2932
*/
3033
#[NoCSRFRequired]
31-
public function getNextcloudLogs(): ZipResponse {
34+
public function getNextcloudLogs(): Response {
3235
$logFilepath = $this->logger->getLogFilepath();
3336
$response = new ZipResponse($this->request, 'nextcloud-logs');
3437
$filePath = $logFilepath;
@@ -39,6 +42,9 @@ public function getNextcloudLogs(): ZipResponse {
3942
$response->addResource($remoteFile, basename($filePath), $size, $time);
4043
$filePath = $logFilepath . '.' . $counter++;
4144
}
45+
if ($counter == 1) {
46+
return new TextPlainResponse('No log file found', Http::STATUS_NOT_FOUND);
47+
}
4248
return $response;
4349
}
4450
}

src/components/ViewAdmin.vue

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,16 +43,20 @@ SPDX-License-Identifier: AGPL-3.0-or-later
4343
</td>
4444
</tr>
4545
</table>
46-
<h2>{{ t('context_chat', 'Context Chat Logs') }}</h2>
47-
<NcButton :href="downloadURLNextcloudLogs">
48-
{{ t('context_chat', 'Download Nextcloud logs') }}
49-
</NcButton>
50-
<NcButton :href="downloadURLDockerLogs">
51-
{{ t('context_chat', 'Download Backend logs') }}
52-
</NcButton>
5346
<p>&nbsp;</p>
5447
<p>{{ t('context_chat', 'Eligible files for indexing: {count}', {count: stats.eligible_files_count}) }}</p>
5548
<p>{{ t('context_chat', 'Queued content update actions: {count}', {count: stats.queued_actions_count}) }}</p>
49+
</NcSettingsSection>
50+
<NcSettingsSection :name="t('context_chat', 'Logs')">
51+
<div class="horizontal-flex">
52+
<NcButton :href="downloadURLNextcloudLogs">
53+
{{ t('context_chat', 'Download the PHP App logs') }}
54+
</NcButton>
55+
<NcButton :href="downloadURLDockerLogs">
56+
{{ t('context_chat', 'Download the Ex-App Backend logs') }}
57+
</NcButton>
58+
</div>
59+
<p>&nbsp;</p>
5660
<p>
5761
<a href="https://docs.nextcloud.com/server/latest/admin_manual/ai/app_context_chat.html">{{
5862
t('context_chat', 'Official documentation')
@@ -143,4 +147,9 @@ figure[class^='icon-'] {
143147
#context_chat a:link, #context_chat a:visited, #context_chat a:hover {
144148
text-decoration: underline;
145149
}
150+
151+
.horizontal-flex {
152+
display: flex;
153+
gap: 10px;
154+
}
146155
</style>

0 commit comments

Comments
 (0)