Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
3a51374
feat(app_api): add initial state data for AppAPI UI part
andrey18106 Oct 9, 2024
475ce2e
feat(settings): migrate AppAPI ExApps management (1)
andrey18106 Oct 9, 2024
151a758
WIP: add Daemon badge in app sidebar (2)
andrey18106 Oct 11, 2024
18c9a03
WIP: use global mutation, since app_api_apps is namespaced
andrey18106 Oct 11, 2024
3d4f0f9
WIP: add missing state checks
andrey18106 Oct 11, 2024
9e694d1
WIP: minor fixes
andrey18106 Oct 11, 2024
a29e170
fix(ci): resolve eslint errors
andrey18106 Oct 14, 2024
fb4150e
fix(ci): suppress UndefinedClass for AppAPI related classes since it'…
andrey18106 Oct 14, 2024
c53f5c4
WIP: address review comments, small fixes
andrey18106 Oct 17, 2024
606a9a3
WIP: migrate to Pinia, minor fixes
andrey18106 Oct 21, 2024
d91a7fe
WIP: remove app_api_apps vuex store
andrey18106 Oct 21, 2024
67b4d3d
fix: address review comments
andrey18106 Oct 23, 2024
cac5be5
fix(ci): psalm, suppress undefined for viewApps
andrey18106 Oct 24, 2024
6be8cbd
fix(ci): fix eslint errors
andrey18106 Oct 24, 2024
41c61c3
fix: loading state reactivity
andrey18106 Oct 29, 2024
128b65e
fix(ci): eslint fix, minor correction after rebase
andrey18106 Oct 29, 2024
864376d
chore(assets): Recompile assets
nextcloud-command Oct 29, 2024
d66f0cc
chore(assets): Recompile assets
nextcloud-command Oct 29, 2024
824aa30
fix: add missing import after backport
andrey18106 Oct 29, 2024
487431f
chore(assets): Recompile assets
nextcloud-command Oct 29, 2024
0ee0e04
chore(assets): Recompile assets
nextcloud-command Oct 30, 2024
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
Prev Previous commit
Next Next commit
fix(ci): resolve eslint errors
Signed-off-by: Andrey Borysenko <[email protected]>
  • Loading branch information
andrey18106 committed Oct 30, 2024
commit a29e17001258a4f7ed9b47bea2c083b1fb150f52
14 changes: 7 additions & 7 deletions apps/settings/src/app-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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 changes: 15 additions & 8 deletions apps/settings/src/components/AppList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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 })
}),
)
},
},
}
Expand Down
2 changes: 1 addition & 1 deletion apps/settings/src/components/AppList/AppDaemonBadge.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
6 changes: 3 additions & 3 deletions apps/settings/src/components/AppList/AppItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ defineProps<{
}>()
</script>


<style scoped lang="scss">
.daemon {
padding: 20px;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
22 changes: 11 additions & 11 deletions apps/settings/src/mixins/AppManagement.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
},
Expand Down Expand Up @@ -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
},
Expand All @@ -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) {
Expand Down Expand Up @@ -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() })
Expand All @@ -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() })
Expand All @@ -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() })
Expand All @@ -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)
Expand All @@ -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() })
Expand All @@ -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) })
Expand Down
5 changes: 4 additions & 1 deletion apps/settings/src/store/app_api_apps.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 changes: 1 addition & 1 deletion apps/settings/src/store/apps.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,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
}
},
Expand Down
4 changes: 2 additions & 2 deletions apps/settings/src/store/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -36,7 +36,7 @@ export const useStore = () => {
modules: {
users,
apps,
app_api_apps,
appApiApps,
settings,
oc,
},
Expand Down
9 changes: 5 additions & 4 deletions apps/settings/src/views/AppStore.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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>

Expand Down
2 changes: 1 addition & 1 deletion apps/settings/src/views/AppStoreSidebar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down