admin: add apps section

Signed-off-by: Varun Patil <radialapps@gmail.com>
pull/767/head
Varun Patil 2023-08-03 10:02:21 -07:00
parent 62eea6c4e1
commit 28634a3f30
3 changed files with 71 additions and 4 deletions

View File

@ -2,7 +2,15 @@
<div class="outer" v-if="loaded"> <div class="outer" v-if="loaded">
<XLoadingIcon class="loading-icon" v-show="loading" /> <XLoadingIcon class="loading-icon" v-show="loading" />
<component v-for="c in components" :key="c.__name" :is="c" :status="status" :config="config" @update="update" /> <component
v-for="c in components"
:key="c.__name"
:is="c"
:status="status"
:config="config"
:sconfig="sconfig"
@update="update"
/>
</div> </div>
</template> </template>
@ -14,17 +22,20 @@ import { showError } from '@nextcloud/dialogs';
import { API } from '../../services/API'; import { API } from '../../services/API';
import * as utils from '../../services/Utils'; import * as utils from '../../services/Utils';
import staticConfig from '../../services/static-config';
import Exif from './sections/Exif.vue'; import Exif from './sections/Exif.vue';
import Indexing from './sections/Indexing.vue'; import Indexing from './sections/Indexing.vue';
import FileSupport from './sections/FileSupport.vue'; import FileSupport from './sections/FileSupport.vue';
import Performance from './sections/Performance.vue'; import Performance from './sections/Performance.vue';
import Apps from './sections/Apps.vue';
import Places from './sections/Places.vue'; import Places from './sections/Places.vue';
import Video from './sections/Video.vue'; import Video from './sections/Video.vue';
import VideoTranscoder from './sections/VideoTranscoder.vue'; import VideoTranscoder from './sections/VideoTranscoder.vue';
import VideoAccel from './sections/VideoAccel.vue'; import VideoAccel from './sections/VideoAccel.vue';
import { ISystemConfig, ISystemStatus } from './AdminTypes'; import type { ISystemConfig, ISystemStatus } from './AdminTypes';
import type { IConfig } from '../../types';
export default defineComponent({ export default defineComponent({
name: 'Admin', name: 'Admin',
@ -35,13 +46,15 @@ export default defineComponent({
status: null as ISystemStatus | null, status: null as ISystemStatus | null,
config: null as ISystemConfig | null, config: null as ISystemConfig | null,
sconfig: null as IConfig | null,
components: [Exif, Indexing, FileSupport, Performance, Places, Video, VideoTranscoder, VideoAccel], components: [Exif, Indexing, FileSupport, Performance, Apps, Places, Video, VideoTranscoder, VideoAccel],
}), }),
mounted() { mounted() {
this.refreshSystemConfig(); this.refreshSystemConfig();
this.refreshStatus(); this.refreshStatus();
this.refreshStaticConfig();
}, },
methods: { methods: {
@ -70,6 +83,17 @@ export default defineComponent({
} }
}, },
async refreshStaticConfig() {
try {
this.loading++;
this.sconfig = await staticConfig.getAll();
} catch (e) {
showError(JSON.stringify(e));
} finally {
this.loading--;
}
},
async update(key: keyof ISystemConfig, value: any = null) { async update(key: keyof ISystemConfig, value: any = null) {
if (!this.config?.hasOwnProperty(key)) { if (!this.config?.hasOwnProperty(key)) {
console.error('Unknown setting', key); console.error('Unknown setting', key);

View File

@ -1,5 +1,6 @@
import { defineComponent, PropType } from 'vue'; import { defineComponent, PropType } from 'vue';
import { ISystemStatus, ISystemConfig, IBinaryStatus } from './AdminTypes'; import type { ISystemStatus, ISystemConfig, IBinaryStatus } from './AdminTypes';
import type { IConfig } from '../../types';
import axios from '@nextcloud/axios'; import axios from '@nextcloud/axios';
const NcCheckboxRadioSwitch = () => import('@nextcloud/vue/dist/Components/NcCheckboxRadioSwitch'); const NcCheckboxRadioSwitch = () => import('@nextcloud/vue/dist/Components/NcCheckboxRadioSwitch');
@ -26,6 +27,10 @@ export default defineComponent({
type: Object as PropType<ISystemConfig>, type: Object as PropType<ISystemConfig>,
required: true, required: true,
}, },
sconfig: {
type: Object as PropType<IConfig>,
required: true,
},
}, },
methods: { methods: {

View File

@ -0,0 +1,38 @@
<template>
<div class="admin-section">
<h2>{{ t('memories', 'Recommended Apps') }}</h2>
<NcNoteCard :type="sconfig.albums_enabled ? 'success' : 'warning'">
{{
sconfig.albums_enabled
? t('memories', 'Albums support is enabled.')
: t('memories', 'Albums are disabled because the Photos app is not available.')
}}
</NcNoteCard>
<NcNoteCard :type="sconfig.recognize_enabled ? 'success' : 'warning'">
{{
sconfig.recognize_enabled
? t('memories', 'Recognize is installed and enabled.')
: t(
'memories',
'Recognize is not installed. Some features like face recognition and object tagging may be unavailable.'
)
}}
</NcNoteCard>
<NcNoteCard v-if="sconfig.facerecognition_installed" type="success">
{{ t('memories', 'Face Recognition is installed and enabled') }}
</NcNoteCard>
</div>
</template>
<script lang="ts">
import { defineComponent } from 'vue';
import AdminMixin from '../AdminMixin';
export default defineComponent({
name: 'Apps',
mixins: [AdminMixin],
});
</script>