Skip to content

Commit 75f39eb

Browse files
committed
fix(AdminView): Warn about disabled systemtags app
see #1288 Signed-off-by: Marcel Klehr <mklehr@gmx.net>
1 parent 18947ec commit 75f39eb

File tree

2 files changed

+17
-6
lines changed

2 files changed

+17
-6
lines changed

lib/Settings/AdminSettings.php

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,17 @@
88
namespace OCA\Recognize\Settings;
99

1010
use OCA\Recognize\Service\SettingsService;
11+
use OCP\App\IAppManager;
1112
use OCP\AppFramework\Http\TemplateResponse;
1213
use OCP\AppFramework\Services\IInitialState;
1314
use OCP\Settings\ISettings;
1415

1516
final class AdminSettings implements ISettings {
16-
private IInitialState $initialState;
17-
private SettingsService $settingsService;
18-
19-
public function __construct(IInitialState $initialState, SettingsService $settingsService) {
20-
$this->initialState = $initialState;
21-
$this->settingsService = $settingsService;
17+
public function __construct(
18+
private IInitialState $initialState,
19+
private SettingsService $settingsService,
20+
private IAppManager $appManager,
21+
) {
2222
}
2323

2424
/**
@@ -32,6 +32,9 @@ public function getForm(): TemplateResponse {
3232
$modelsDownloaded = file_exists($modelsPath);
3333
$this->initialState->provideInitialState('modelsDownloaded', $modelsDownloaded);
3434

35+
$tagsEnabled = $this->appManager->isEnabledForAnyone('systemtags');
36+
$this->initialState->provideInitialState('tagsEnabled', $tagsEnabled);
37+
3538
return new TemplateResponse('recognize', 'admin');
3639
}
3740

src/components/ViewAdmin.vue

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,12 @@
1515
<NcNoteCard v-else-if="!modelsDownloaded" type="warning">
1616
{{ t('recognize', 'The machine learning models still need to be downloaded.') }}
1717
</NcNoteCard>
18+
<NcNoteCard v-if="tagsEnabled" show-alert type="success">
19+
{{ t('recognize', 'The systemtags app is enabled.') }}
20+
</NcNoteCard>
21+
<NcNoteCard v-else-if="!tagsEnabled" type="warning">
22+
{{ t('recognize', 'The systemtags app is currently disabled. Some features of this app will not work.') }}
23+
</NcNoteCard>
1824
<NcNoteCard v-if="nodejs === false" type="warning">
1925
{{ t('recognize', 'Could not execute the Node.js binary. You may need to set the path to a working binary manually.') }}
2026
</NcNoteCard>
@@ -429,6 +435,7 @@ export default {
429435
movinetJobs: null,
430436
musicnnJobs: null,
431437
clusterFacesJobs: null,
438+
tagsEnabled: null,
432439
}
433440
},
434441
@@ -456,6 +463,7 @@ export default {
456463
},
457464
async created() {
458465
this.modelsDownloaded = loadState('recognize', 'modelsDownloaded')
466+
this.tagsEnabled = loadState('recognize', 'tagsEnabled')
459467
this.getCount()
460468
this.getAVX()
461469
this.getPlatform()

0 commit comments

Comments
 (0)