diff --git a/lib/Settings/AdminSettings.php b/lib/Settings/AdminSettings.php index e8166610a..83f8a7657 100644 --- a/lib/Settings/AdminSettings.php +++ b/lib/Settings/AdminSettings.php @@ -8,17 +8,17 @@ namespace OCA\Recognize\Settings; use OCA\Recognize\Service\SettingsService; +use OCP\App\IAppManager; use OCP\AppFramework\Http\TemplateResponse; use OCP\AppFramework\Services\IInitialState; use OCP\Settings\ISettings; final class AdminSettings implements ISettings { - private IInitialState $initialState; - private SettingsService $settingsService; - - public function __construct(IInitialState $initialState, SettingsService $settingsService) { - $this->initialState = $initialState; - $this->settingsService = $settingsService; + public function __construct( + private IInitialState $initialState, + private SettingsService $settingsService, + private IAppManager $appManager, + ) { } /** @@ -32,6 +32,9 @@ public function getForm(): TemplateResponse { $modelsDownloaded = file_exists($modelsPath); $this->initialState->provideInitialState('modelsDownloaded', $modelsDownloaded); + $tagsEnabled = $this->appManager->isEnabledForAnyone('systemtags'); + $this->initialState->provideInitialState('tagsEnabled', $tagsEnabled); + return new TemplateResponse('recognize', 'admin'); } diff --git a/src/components/ViewAdmin.vue b/src/components/ViewAdmin.vue index 3a35e94fb..53afacabb 100644 --- a/src/components/ViewAdmin.vue +++ b/src/components/ViewAdmin.vue @@ -15,6 +15,12 @@ {{ t('recognize', 'The machine learning models still need to be downloaded.') }} + + {{ t('recognize', 'The systemtags app is enabled.') }} + + + {{ t('recognize', 'The systemtags app is currently disabled. Some features of this app will not work.') }} + {{ t('recognize', 'Could not execute the Node.js binary. You may need to set the path to a working binary manually.') }} @@ -429,6 +435,7 @@ export default { movinetJobs: null, musicnnJobs: null, clusterFacesJobs: null, + tagsEnabled: null, } }, @@ -456,6 +463,7 @@ export default { }, async created() { this.modelsDownloaded = loadState('recognize', 'modelsDownloaded') + this.tagsEnabled = loadState('recognize', 'tagsEnabled') this.getCount() this.getAVX() this.getPlatform() diff --git a/src/model-manager.js b/src/model-manager.js index fe20c27ab..c96945e08 100644 --- a/src/model-manager.js +++ b/src/model-manager.js @@ -8,7 +8,7 @@ exports.downloadAll = async () => { await download( `https://github.com/nextcloud/recognize/archive/${ref}.tar.gz`, path.resolve(__dirname, '..'), - { filename: 'recognize.tar.gz' } + { filename: 'recognize.tar.gz' }, ) await new Promise(resolve => tar.x({ @@ -18,6 +18,6 @@ exports.downloadAll = async () => { filter(path, entry) { return path.includes('models') }, - }, [], resolve) + }, [], resolve), ) }