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
8 changes: 7 additions & 1 deletion lib/Settings/AdminSettings.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,20 @@
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;

class AdminSettings implements ISettings {
private IInitialState $initialState;
private SettingsService $settingsService;
private IAppManager $appManager;

public function __construct(IInitialState $initialState, SettingsService $settingsService) {
public function __construct(IInitialState $initialState, SettingsService $settingsService, IAppManager $appManager) {
$this->initialState = $initialState;
$this->settingsService = $settingsService;
$this->appManager = $appManager;
}

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

$tagsEnabled = $this->appManager->isEnabledForUser('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 @@ -62,7 +68,7 @@
:value.sync="settings['faces.batchSize']"
:label-visible="true"
:label="t('recognize', 'The number of files to process per job run (A job will be scheduled every 5 minutes; For normal operation ~500 or more, in WASM mode ~50 is recommended)')"
:title="t('recognize', 'The number of files to process per job run (A job will be scheduled every 5 minutes; For normal operation ~500 or more, in WASM mode ~50 is recommended)')"

Check failure on line 71 in src/components/ViewAdmin.vue

View workflow job for this annotation

GitHub Actions / eslint

Expected "\t" character, but found " " character
@update:value="onChange" />
</p>
</NcSettingsSection>
Expand Down Expand Up @@ -216,14 +222,14 @@
<NcSettingsSection :name="t('recognize', 'Resource usage') ">
<p>{{ t('recognize', 'By default all available CPU cores will be used which may put your system under considerable load. To avoid this, you can limit the amount of CPU Cores used. (Note: In WASM mode, currently only 1 core can be used at all times.)') }}</p>
<p>
<NcTextField :value.sync="settings['tensorflow.cores']"

Check failure on line 225 in src/components/ViewAdmin.vue

View workflow job for this annotation

GitHub Actions / eslint

Expected "\t" character, but found " " character
type="number"

Check failure on line 226 in src/components/ViewAdmin.vue

View workflow job for this annotation

GitHub Actions / eslint

Expected "\t" character, but found " " character
:min="0"

Check failure on line 227 in src/components/ViewAdmin.vue

View workflow job for this annotation

GitHub Actions / eslint

Expected "\t" character, but found " " character
:step="1"

Check failure on line 228 in src/components/ViewAdmin.vue

View workflow job for this annotation

GitHub Actions / eslint

Expected "\t" character, but found " " character
:max="32"

Check failure on line 229 in src/components/ViewAdmin.vue

View workflow job for this annotation

GitHub Actions / eslint

Expected "\t" character, but found " " character
:label="t('recognize', 'Number of CPU Cores (0 for no limit)')"

Check failure on line 230 in src/components/ViewAdmin.vue

View workflow job for this annotation

GitHub Actions / eslint

Expected "\t" character, but found " " character
:label-visible="true"

Check failure on line 231 in src/components/ViewAdmin.vue

View workflow job for this annotation

GitHub Actions / eslint

Expected "\t" character, but found " " character
@update:value="onChange" />

Check failure on line 232 in src/components/ViewAdmin.vue

View workflow job for this annotation

GitHub Actions / eslint

Expected "\t" character, but found " " character
</p>
<p>&nbsp;</p>
<p>{{ t('recognize', 'By default, recognize will only ever run one classifier process at a time. If you have a lot of resources available and want to run as many processes in parallel as possible, you can turn on concurrency here.') }}</p>
Expand Down Expand Up @@ -429,6 +435,7 @@
movinetJobs: null,
musicnnJobs: null,
clusterFacesJobs: null,
tagsEnabled: null,
}
},

Expand Down Expand Up @@ -456,6 +463,7 @@
},
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