Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions lib/Settings/AdminSettings.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
) {
}

/**
Expand All @@ -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');
}

Expand Down
8 changes: 8 additions & 0 deletions src/components/ViewAdmin.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@
<NcNoteCard v-else-if="!modelsDownloaded" type="warning">
{{ t('recognize', 'The machine learning models still need to be downloaded.') }}
</NcNoteCard>
<NcNoteCard v-if="tagsEnabled" show-alert type="success">
{{ t('recognize', 'The systemtags app is enabled.') }}
</NcNoteCard>
<NcNoteCard v-else-if="!tagsEnabled" type="warning">
{{ t('recognize', 'The systemtags app is currently disabled. Some features of this app will not work.') }}
</NcNoteCard>
<NcNoteCard v-if="nodejs === false" type="warning">
{{ t('recognize', 'Could not execute the Node.js binary. You may need to set the path to a working binary manually.') }}
</NcNoteCard>
Expand Down Expand Up @@ -429,6 +435,7 @@ export default {
movinetJobs: null,
musicnnJobs: null,
clusterFacesJobs: null,
tagsEnabled: null,
}
},

Expand Down Expand Up @@ -456,6 +463,7 @@ export default {
},
async created() {
this.modelsDownloaded = loadState('recognize', 'modelsDownloaded')
this.tagsEnabled = loadState('recognize', 'tagsEnabled')
this.getCount()
this.getAVX()
this.getPlatform()
Expand Down
4 changes: 2 additions & 2 deletions src/model-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand All @@ -18,6 +18,6 @@ exports.downloadAll = async () => {
filter(path, entry) {
return path.includes('models')
},
}, [], resolve)
}, [], resolve),
)
}
Loading