Browse Source

fix(ci): resolve eslint errors

Signed-off-by: Andrey Borysenko <andrey18106x@gmail.com>
pull/48665/head
Andrey Borysenko 1 year ago
parent
commit
46e643b72a
No known key found for this signature in database GPG Key ID: 934CB29F9F59B0D1
  1. 14
      apps/settings/src/app-types.ts
  2. 23
      apps/settings/src/components/AppList.vue
  3. 2
      apps/settings/src/components/AppList/AppDaemonBadge.vue
  4. 6
      apps/settings/src/components/AppList/AppItem.vue
  5. 1
      apps/settings/src/components/AppStoreSidebar/AppDeployDaemonTab.vue
  6. 6
      apps/settings/src/components/AppStoreSidebar/AppDetailsTab.vue
  7. 22
      apps/settings/src/mixins/AppManagement.js
  8. 5
      apps/settings/src/store/app_api_apps.js
  9. 2
      apps/settings/src/store/apps.js
  10. 4
      apps/settings/src/store/index.js
  11. 9
      apps/settings/src/views/AppStore.vue
  12. 2
      apps/settings/src/views/AppStoreSidebar.vue

14
apps/settings/src/app-types.ts

@ -53,13 +53,6 @@ export interface IAppstoreApp {
releases?: IAppstoreAppRelease[]
}
export interface IAppstoreExApp extends IAppstoreApp {
daemon: IDeployDaemon,
status: IExAppStatus,
error: string,
app_api: boolean,
}
export interface IComputeDevice {
id: string,
label: string,
@ -90,3 +83,10 @@ export interface IExAppStatus {
init_start_time: number,
type: string,
}
export interface IAppstoreExApp extends IAppstoreApp {
daemon: IDeployDaemon,
status: IExAppStatus,
error: string,
app_api: boolean,
}

23
apps/settings/src/components/AppList.vue

@ -168,7 +168,10 @@ export default {
return this.apps.filter(app => app.update).length
},
loading() {
return this.$store.getters.loading('list')
if (!this.$store.getters['appApiApps/isAppApiEnabled']) {
return this.$store.getters.loading('list')
}
return this.$store.getters.loading('list') || this.$store.getters['appApiApps/loading']('list')
},
hasPendingUpdate() {
return this.apps.filter(app => app.update).length > 0
@ -177,7 +180,9 @@ export default {
return this.hasPendingUpdate && this.useListView
},
apps() {
const apps = this.$store.getters.getAllApps
// Exclude ExApps from the list if AppAPI is disabled
const exApps = this.$store.getters.isAppApiEnabled ? this.$store.getters['appApiApps/getAllApps'] : []
const apps = [...this.$store.getters.getAllApps, ...exApps]
.filter(app => app.name.toLowerCase().search(this.search.toLowerCase()) !== -1)
.sort(function(a, b) {
const sortStringA = '' + (a.active ? 0 : 1) + (a.update ? 0 : 1) + a.name
@ -304,12 +309,14 @@ export default {
const limit = pLimit(1)
this.apps
.filter(app => app.update)
.map((app) => limit(() => {
if (app?.app_api) {
this.$store.dispatch('app_api_apps/updateApp', { appId: app.id })
}
this.update(app.id)
}))
.map(app => limit(() => {
let type = 'updateApp'
if (app?.app_api) {
type = 'app_api_apps/updateApp'
}
this.$store.dispatch(type, { appId: app.id })
}),
)
},
},
}

2
apps/settings/src/components/AppList/AppDaemonBadge.vue

@ -16,7 +16,7 @@ import NcIconSvgWrapper from '@nextcloud/vue/dist/Components/NcIconSvgWrapper.js
import { mdiFileChart } from '@mdi/js'
import type { IDeployDaemon } from '../../app-types.ts'
const props = defineProps<{
defineProps<{
daemon?: IDeployDaemon
}>()
</script>

6
apps/settings/src/components/AppList/AppItem.vue

@ -16,9 +16,9 @@
:headers="getDataItemHeaders(`app-table-col-icon`)">
<div v-if="(listView && !app.preview && !app?.app_api) || (!listView && !screenshotLoaded && !app?.app_api)" class="icon-settings-dark" />
<NcIconSvgWrapper v-else-if="(listView && app?.app_api && !app.preview) || (!listView && !screenshotLoaded && app?.app_api)"
:path="mdiCogOutline()"
:size="listView ? 24 : 48"
style="min-width: auto; min-height: auto; height: 100%;"/>
:path="mdiCogOutline()"
:size="listView ? 24 : 48"
style="min-width: auto; min-height: auto; height: 100%;" />
<svg v-else-if="listView && app.preview && !app?.app_api"
width="32"

1
apps/settings/src/components/AppStoreSidebar/AppDeployDaemonTab.vue

@ -34,7 +34,6 @@ defineProps<{
}>()
</script>
<style scoped lang="scss">
.daemon {
padding: 20px;

6
apps/settings/src/components/AppStoreSidebar/AppDetailsTab.vue

@ -79,9 +79,9 @@
@click="forceEnable(app.id)">
</div>
<NcCheckboxRadioSwitch v-if="app.canUnInstall"
:checked="removeData"
:disabled="installing || isLoading || !defaultDeployDaemonAccessible"
@update:checked="toggleRemoveData">
:checked="removeData"
:disabled="installing || isLoading || !defaultDeployDaemonAccessible"
@update:checked="toggleRemoveData">
{{ t('settings', 'Delete data on remove') }}
</NcCheckboxRadioSwitch>
</div>

22
apps/settings/src/mixins/AppManagement.js

@ -13,13 +13,13 @@ export default {
},
installing() {
if (this.app?.app_api) {
return this.app && this.$store.getters['app_api_apps/loading']('install')
return this.app && this.$store.getters['appApiApps/loading']('install')
}
return this.$store.getters.loading('install')
},
isLoading() {
if (this.app?.app_api) {
return this.app && this.$store.getters['app_api_apps/loading'](this.app.id)
return this.app && this.$store.getters['appApiApps/loading'](this.app.id)
}
return this.app && this.$store.getters.loading(this.app.id)
},
@ -108,9 +108,9 @@ export default {
return true
}
if (this.app?.daemon?.accepts_deploy_id === 'docker-install') {
return this.$store.getters['app_api_apps/getDaemonAccessible'] === true
return this.$store.getters['appApiApps/getDaemonAccessible'] === true
}
return this.$store.getters['app_api_apps/getDaemonAccessible']
return this.$store.getters['appApiApps/getDaemonAccessible']
}
return true
},
@ -136,7 +136,7 @@ export default {
if (this.app?.app_api) {
return false
}
return this.app.groups.length || this.groupCheckedAppsData;
return this.app.groups.length || this.groupCheckedAppsData
},
setGroupLimit() {
if (this.app?.app_api) {
@ -179,7 +179,7 @@ export default {
forceEnable(appId) {
let type = 'forceEnableApp'
if (this.app?.app_api) {
type = 'app_api_apps/forceEnableApp'
type = 'appApiApps/forceEnableApp'
}
this.$store.dispatch(type, { appId, groups: [] })
.then((response) => { rebuildNavigation() })
@ -188,7 +188,7 @@ export default {
enable(appId) {
let type = 'enableApp'
if (this.app?.app_api) {
type = 'app_api_apps/enableApp'
type = 'appApiApps/enableApp'
}
this.$store.dispatch(type, { appId, groups: [] })
.then((response) => { rebuildNavigation() })
@ -197,7 +197,7 @@ export default {
disable(appId) {
let type = 'disableApp'
if (this.app?.app_api) {
type = 'app_api_apps/disableApp'
type = 'appApiApps/disableApp'
}
this.$store.dispatch(type, { appId })
.then((response) => { rebuildNavigation() })
@ -207,7 +207,7 @@ export default {
let type = 'uninstallApp'
let payload = { appId }
if (this.app?.app_api) {
type = 'app_api_apps/uninstallApp'
type = 'appApiApps/uninstallApp'
payload = { appId, removeData }
}
this.$store.dispatch(type, payload)
@ -217,7 +217,7 @@ export default {
install(appId) {
let type = 'enableApp'
if (this.app?.app_api) {
type = 'app_api_apps/enableApp'
type = 'appApiApps/enableApp'
}
this.$store.dispatch(type, { appId })
.then((response) => { rebuildNavigation() })
@ -226,7 +226,7 @@ export default {
update(appId) {
let type = 'updateApp'
if (this.app?.app_api) {
type = 'app_api_apps/updateApp'
type = 'appApiApps/updateApp'
}
this.$store.dispatch(type, { appId })
.catch((error) => { showError(error) })

5
apps/settings/src/store/app_api_apps.js

@ -392,5 +392,8 @@ const actions = {
export default {
namespaced: true, // we will use AppAPI store module explicitly, since methods names are the same, we need to scope it
state, mutations, getters, actions
state,
mutations,
getters,
actions,
}

2
apps/settings/src/store/apps.js

@ -102,7 +102,7 @@ const mutations = {
state.apps.find(app => app.id === appId).installed = false
state.apps.find(app => app.id === appId).canUnInstall = false
state.apps.find(app => app.id === appId).canInstall = true
if (app.id === 'app_api') {
if (appId === 'app_api') {
state.appApiEnabled = false
}
},

4
apps/settings/src/store/index.js

@ -7,7 +7,7 @@ import Vue from 'vue'
import Vuex, { Store } from 'vuex'
import users from './users.js'
import apps from './apps.js'
import app_api_apps from './app_api_apps.js'
import appApiApps from './app_api_apps.js'
import settings from './users-settings.js'
import oc from './oc.js'
import { showError } from '@nextcloud/dialogs'
@ -36,7 +36,7 @@ export const useStore = () => {
modules: {
users,
apps,
app_api_apps,
appApiApps,
settings,
oc,
},

9
apps/settings/src/views/AppStore.vue

@ -59,17 +59,18 @@ onBeforeMount(() => {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
(instance?.proxy as any).$store.dispatch('getCategories', { shouldRefetchCategories: true });
// eslint-disable-next-line @typescript-eslint/no-explicit-any
(instance?.proxy as any).$store.dispatch('getAllApps');
(instance?.proxy as any).$store.dispatch('getAllApps')
// eslint-disable-next-line @typescript-eslint/no-explicit-any
if ((instance?.proxy as any).$store.getters.isAppApiEnabled) {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
(instance?.proxy as any).$store.dispatch('app_api_apps/getAllApps');
(instance?.proxy as any).$store.dispatch('appApiApps/getAllApps');
// eslint-disable-next-line @typescript-eslint/no-explicit-any
(instance?.proxy as any).$store.dispatch('app_api_apps/updateAppsStatus');
(instance?.proxy as any).$store.dispatch('appApiApps/updateAppsStatus')
}
})
onBeforeUnmount(() => {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
clearInterval((instance?.proxy as any).$store.getters('app_api_apps/getStatusUpdater'));
clearInterval((instance?.proxy as any).$store.getters('appApiApps/getStatusUpdater'))
})
</script>

2
apps/settings/src/views/AppStoreSidebar.vue

@ -65,7 +65,7 @@ const legacyStore = useStore()
const appId = computed(() => route.params.id ?? '')
const app = computed(() => {
if (legacyStore.getters.isAppApiEnabled) {
const exApp = legacyStore.getters['app_api_apps/getAllApps']
const exApp = legacyStore.getters['appApiApps/getAllApps']
.find((app) => app.id === appId.value) ?? null
if (exApp) {
return exApp

Loading…
Cancel
Save