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
166 changes: 166 additions & 0 deletions apps/appstore/src/components/UpdateAllDialog.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,166 @@
<!--
SPDX-License-Identifier: AGPL-3.0-or-later
SPDX-FileCopyrightText: 2026 Nextcloud GmbH and Nextcloud contributors
-->

<script setup lang="ts">
import type { IAppstoreApp, IAppstoreExApp } from '../apps.d.ts'

import { mdiCheck, mdiInformationOutline, mdiUpdate, mdiWeb } from '@mdi/js'
import { showError } from '@nextcloud/dialogs'
import { getLanguage, t } from '@nextcloud/l10n'
import { NcButton, NcDialog, NcIconSvgWrapper, NcLoadingIcon, NcNoteCard } from '@nextcloud/vue'
import { computed, ref } from 'vue'
import MarkdownPreview from './MarkdownPreview.vue'
import { useUpdatesStore } from '../store/updates.ts'
import logger from '../utils/logger.ts'

const props = defineProps<{
apps: (IAppstoreApp | IAppstoreExApp)[]
}>()

const emit = defineEmits<{
close: []
}>()

const store = useUpdatesStore()
const showDetails = ref('')
const isUpdating = ref(false)

const changelogText = computed(() => {
if (!showDetails.value) {
return ''
}

const app = props.apps.find((app) => app.id === showDetails.value)
if (!app || !app.releases || app.releases.length === 0) {
return ''
}

const [release] = app.releases
const localizedEntry = release.translations[getLanguage()]
return localizedEntry?.changelog ?? release.translations.en?.changelog ?? ''
})

/**
* Handle update all apps
*/
async function onUpdate() {
isUpdating.value = true
for (const app of props.apps) {
try {
await store.updateApp(app.id)
} catch (error) {
logger.error(`Failed to update app ${app.id}`, { error })
showError(t('appstore', 'Failed to update app {appName}', { appName: app.name }))
}
}
isUpdating.value = false
emit('close')
}
</script>

<template>
<NcDialog :contentClasses="$style.updateAllDialog" size="normal" :name="t('appstore', 'Update all apps')">
<p>{{ t('appstore', 'Are you sure you want to update all apps?') }}</p>
<ul>
<li v-for="app in apps" :key="app.id" :class="$style.updateAllDialog__listEntry">
<div :class="$style.updateAllDialog__listEntryContent">
<div :class="$style.updateAllDialog__listEntryHeading">
<NcIconSvgWrapper
:path="app.update ? mdiUpdate : mdiCheck"
:name="app.update ? undefined : t('appstore', 'Update done')" />
<span :class="$style.updateAllDialog__listEntryName">{{ app.name }} ({{ app.version }} → {{ app.update }})</span>
</div>
<div :class="$style.updateAllDialog__listEntryActions">
<NcButton
v-if="app.website"
:aria-label="t('appstore', 'View website')"
:title="t('appstore', 'View website')"
:href="app.website"
target="_blank"
variant="tertiary">
<template #icon>
<NcIconSvgWrapper :path="mdiWeb" />
</template>
</NcButton>
<NcButton
v-if="app.releases"
:aria-label="t('appstore', 'Show details')"
:title="t('appstore', 'Show details')"
:pressed="showDetails === app.id"
@update:pressed="showDetails = $event ? app.id : ''">
<template #icon>
<NcIconSvgWrapper :path="mdiInformationOutline" />
</template>
</NcButton>
</div>
</div>
</li>
</ul>

<NcNoteCard
:class="$style.updateAllDialog__listEntryDetails"
:heading="t('appstore', 'Details')"
type="info">
<MarkdownPreview
:minHeadingLevel="3"
:text="changelogText" />
</NcNoteCard>

<template #actions>
<NcButton variant="tertiary" @click="emit('close')">
{{ t('appstore', 'Cancel') }}
</NcButton>
<NcButton variant="primary" @click="onUpdate">
<template v-if="isUpdating" #icon>
<NcLoadingIcon />
</template>
{{ t('appstore', 'Update all') }}
</NcButton>
</template>
</NcDialog>
</template>

<style module>
.updateAllDialog {
min-height: 50vh !important;
}

.updateAllDialog__list {
display: flex;
flex-direction: row;
gap: calc(3 * var(--default-grid-baseline));
}

.updateAllDialog__listEntry {
display: flex;
flex-direction: column;
gap: calc(2 * var(--default-grid-baseline));
padding: calc(2 * var(--default-grid-baseline));
}

.updateAllDialog__listEntryHeading {
display: flex;
}

.updateAllDialog__listEntryName {
font-weight: 500;
line-height: var(--default-clickable-area);
}

.updateAllDialog__listEntryActions {
display: flex;
flex-direction: row;
gap: var(--default-grid-baseline);
}

.updateAllDialog__listEntryContent {
display: flex;
justify-content: space-between;
}

.updateAllDialog__listEntryDetails {
margin: 0;
}
</style>
1 change: 1 addition & 0 deletions apps/appstore/src/store/updates.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ export const useUpdatesStore = defineStore('updates', () => {
internalUpdateCount.value = Math.max(internalUpdateCount.value - 1, 0)
}

app.update = undefined
rebuildNavigation()
} catch (error) {
logger.error('Failed to update app', { appId, error })
Expand Down
35 changes: 33 additions & 2 deletions apps/appstore/src/views/AppstoreManage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@
-->

<script setup lang="ts">
import { mdiUpdate } from '@mdi/js'
import { t } from '@nextcloud/l10n'
import { computed } from 'vue'
import { NcIconSvgWrapper, spawnDialog } from '@nextcloud/vue'
import { computed, defineAsyncComponent } from 'vue'
import { useRoute } from 'vue-router'
import NcButton from '@nextcloud/vue/components/NcButton'
import NcEmptyContent from '@nextcloud/vue/components/NcEmptyContent'
Expand All @@ -15,10 +17,14 @@ import AppTable from '../components/AppTable/AppTable.vue'
import AppToolbar from '../components/AppToolbar.vue'
import { useFilteredApps } from '../composables/useFilteredApps.ts'
import { useAppsStore } from '../store/apps.ts'
import { useUpdatesStore } from '../store/updates.ts'
import { useUserSettingsStore } from '../store/userSettings.ts'

const UpdateAllDialog = defineAsyncComponent(() => import('../components/UpdateAllDialog.vue'))

const route = useRoute()
const store = useAppsStore()
const updatesStore = useUpdatesStore()
const userSettings = useUserSettingsStore()

const currentCategory = computed(() => route.params!.category as 'enabled' | 'installed' | 'disabled' | 'updates')
Expand All @@ -30,16 +36,36 @@ const apps = computed(() => {
} else if (currentCategory.value === 'disabled') {
return store.apps.filter((app) => app.installed && !app.active)
} else if (currentCategory.value === 'updates') {
return store.apps.filter((app) => app.update)
return store.apps.filter((app) => app.active && app.update)
}
return []
})
const visibleApps = useFilteredApps(apps)

/**
* Handle update all apps
*/
async function onUpdateAll() {
await spawnDialog(UpdateAllDialog, {
apps: visibleApps.value,
})
}
</script>

<template>
<AppToolbar />

<NcButton
v-if="currentCategory === 'updates' && updatesStore.updateCount > 0"
:class="$style.appstoreManage__updateAllButton"
variant="primary"
@click="onUpdateAll">
<template #icon>
<NcIconSvgWrapper :path="mdiUpdate" />
</template>
{{ t('appstore', 'Update all applications') }}
</NcButton>

<!-- Apps list -->
<NcEmptyContent
v-if="store.isLoadingApps"
Expand Down Expand Up @@ -69,4 +95,9 @@ const visibleApps = useFilteredApps(apps)
.appstoreManage {
margin-bottom: var(--body-container-margin);
}

.appstoreManage__updateAllButton {
margin-inline: var(--app-navigation-padding);
margin-block: calc(3 * var(--default-grid-baseline));
}
</style>
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
import{a as t}from"./index-C1xmmKTZ-CeESs0Yi.chunk.mjs";import{t as e}from"./translation-DoG5ZELJ-DGHp0fUA.chunk.mjs";import{C as m,a}from"./CommentView-BT4knYtH.chunk.mjs";import{l as p}from"./activity-CgsVnLJG.chunk.mjs";import{b as i,r as s,o as n,c,m as u}from"./Web-CVG0oWkS.chunk.mjs";import{_ as l}from"./public-C1mLBHT3.chunk.mjs";import"./index-BwhGLTdD.chunk.mjs";import"./NcModal-DyOZxq9E-DJ8lRVba.chunk.mjs";import"./logger-D3RVzcfQ-Bkys46hi.chunk.mjs";import"./createElementId-DhjFt1I9-BR-WXAA3.chunk.mjs";import"./index-B-dGqfIG.chunk.mjs";import"./TrashCanOutline-ImpP8zID.chunk.mjs";import"./mdi-BsuzcJkY.chunk.mjs";import"./pinia-Dn16KcVd.chunk.mjs";import"./PencilOutline-CVTKhaas.chunk.mjs";/* empty css */import"./NcAvatar-QYahYt2p-B6sbjze-.chunk.mjs";import"./index-BrNm47xe.chunk.mjs";import"./util-Alk1iwuj.chunk.mjs";import"./ArrowRight-CLsEMAPw.chunk.mjs";import"./colors-2YFh1g7z-Esf5_Pnk.chunk.mjs";import"./NcUserStatusIcon-CNh1vXUF-BrBSNJ0h.chunk.mjs";import"./NcDateTime.vue_vue_type_script_setup_true_lang-B4upiZjL-GKzS94MD.chunk.mjs";import"./NcUserBubble-BnaGHDoD-CXGIMXGu.chunk.mjs";import"./GetComments-DSuBVNUT.chunk.mjs";import"./index-DscLWkdM.chunk.mjs";const d=i({components:{Comment:a},mixins:[m],props:{reloadCallback:{type:Function,required:!0}},methods:{onNewComment(){try{this.reloadCallback()}catch(o){t(e("comments","Could not reload comments")),p.error("Could not reload comments",{error:o})}}}});function C(o,f,y,w,D,N){const r=s("Comment");return n(),c(r,u(o.editorData,{autoComplete:o.autoComplete,resourceType:o.resourceType,editor:!0,userData:o.userData,resourceId:o.resourceId,class:"comments-action",onNew:o.onNewComment}),null,16,["autoComplete","resourceType","userData","resourceId","onNew"])}const S=l(d,[["render",C],["__scopeId","data-v-29a1e244"]]);export{S as default};
//# sourceMappingURL=ActivityCommentAction-BqoKcCNg.chunk.mjs.map
import{a as t}from"./index-C1xmmKTZ-BlRBA4Z1.chunk.mjs";import{t as e}from"./translation-DoG5ZELJ-DGHp0fUA.chunk.mjs";import{C as m,a}from"./CommentView-B8E30FYP.chunk.mjs";import{l as p}from"./activity-CgsVnLJG.chunk.mjs";import{b as i,r as s,o as n,c,m as u}from"./Web-CVG0oWkS.chunk.mjs";import{_ as l}from"./public-C1mLBHT3.chunk.mjs";import"./index-CpKA6aNV.chunk.mjs";import"./NcModal-DyOZxq9E-BdQAvnZZ.chunk.mjs";import"./logger-D3RVzcfQ-Bkys46hi.chunk.mjs";import"./createElementId-DhjFt1I9-BR-WXAA3.chunk.mjs";import"./index-B-dGqfIG.chunk.mjs";import"./TrashCanOutline-ImpP8zID.chunk.mjs";import"./mdi-C7UShXbV.chunk.mjs";import"./pinia-Dn16KcVd.chunk.mjs";import"./PencilOutline-Dpim2F3F.chunk.mjs";/* empty css */import"./NcAvatar-QYahYt2p-Bub13UC0.chunk.mjs";import"./index-BrNm47xe.chunk.mjs";import"./util-Alk1iwuj.chunk.mjs";import"./ArrowRight-CLsEMAPw.chunk.mjs";import"./colors-2YFh1g7z-Esf5_Pnk.chunk.mjs";import"./NcUserStatusIcon-CNh1vXUF-BrBSNJ0h.chunk.mjs";import"./NcDateTime.vue_vue_type_script_setup_true_lang-B4upiZjL-DJNkT_h3.chunk.mjs";import"./NcUserBubble-BnaGHDoD-DBPIicof.chunk.mjs";import"./GetComments-DSuBVNUT.chunk.mjs";import"./index-DscLWkdM.chunk.mjs";const d=i({components:{Comment:a},mixins:[m],props:{reloadCallback:{type:Function,required:!0}},methods:{onNewComment(){try{this.reloadCallback()}catch(o){t(e("comments","Could not reload comments")),p.error("Could not reload comments",{error:o})}}}});function C(o,f,y,w,D,N){const r=s("Comment");return n(),c(r,u(o.editorData,{autoComplete:o.autoComplete,resourceType:o.resourceType,editor:!0,userData:o.userData,resourceId:o.resourceId,class:"comments-action",onNew:o.onNewComment}),null,16,["autoComplete","resourceType","userData","resourceId","onNew"])}const S=l(d,[["render",C],["__scopeId","data-v-29a1e244"]]);export{S as default};
//# sourceMappingURL=ActivityCommentAction-vWjum8WA.chunk.mjs.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
import{t as s}from"./translation-DoG5ZELJ-DGHp0fUA.chunk.mjs";import{C as p,a}from"./CommentView-BT4knYtH.chunk.mjs";import{_ as i}from"./public-C1mLBHT3.chunk.mjs";import{r as n,o as c,c as u,m as l}from"./Web-CVG0oWkS.chunk.mjs";import"./index-B-dGqfIG.chunk.mjs";import"./pinia-Dn16KcVd.chunk.mjs";import"./PencilOutline-CVTKhaas.chunk.mjs";import"./logger-D3RVzcfQ-Bkys46hi.chunk.mjs";import"./createElementId-DhjFt1I9-BR-WXAA3.chunk.mjs";import"./NcModal-DyOZxq9E-DJ8lRVba.chunk.mjs";/* empty css */import"./NcAvatar-QYahYt2p-B6sbjze-.chunk.mjs";import"./index-BrNm47xe.chunk.mjs";import"./util-Alk1iwuj.chunk.mjs";import"./ArrowRight-CLsEMAPw.chunk.mjs";import"./colors-2YFh1g7z-Esf5_Pnk.chunk.mjs";import"./NcUserStatusIcon-CNh1vXUF-BrBSNJ0h.chunk.mjs";import"./NcDateTime.vue_vue_type_script_setup_true_lang-B4upiZjL-GKzS94MD.chunk.mjs";import"./TrashCanOutline-ImpP8zID.chunk.mjs";import"./NcUserBubble-BnaGHDoD-CXGIMXGu.chunk.mjs";import"./index-C1xmmKTZ-CeESs0Yi.chunk.mjs";import"./index-BwhGLTdD.chunk.mjs";import"./mdi-BsuzcJkY.chunk.mjs";import"./activity-CgsVnLJG.chunk.mjs";import"./GetComments-DSuBVNUT.chunk.mjs";import"./index-DscLWkdM.chunk.mjs";const d={name:"ActivityCommentEntry",components:{Comment:a},mixins:[p],props:{comment:{type:Object,required:!0},reloadCallback:{type:Function,required:!0}},data(){return{commentMessage:""}},watch:{comment(){this.commentMessage=this.comment.props.message}},mounted(){this.commentMessage=this.comment.props.message},methods:{t:s}};function g(t,e,o,f,m,C){const r=n("Comment");return c(),u(r,l({ref:"comment",tag:"li"},o.comment.props,{autoComplete:t.autoComplete,resourceType:t.resourceType,message:m.commentMessage,resourceId:t.resourceId,userData:t.genMentionsData(o.comment.props.mentions),class:"comments-activity",onDelete:e[0]||(e[0]=y=>o.reloadCallback())}),null,16,["autoComplete","resourceType","message","resourceId","userData"])}const Q=i(d,[["render",g],["__scopeId","data-v-afc310f1"]]);export{Q as default};
//# sourceMappingURL=ActivityCommentEntry-Ckeq2NDx.chunk.mjs.map
import{t as s}from"./translation-DoG5ZELJ-DGHp0fUA.chunk.mjs";import{C as p,a}from"./CommentView-B8E30FYP.chunk.mjs";import{_ as i}from"./public-C1mLBHT3.chunk.mjs";import{r as n,o as c,c as u,m as l}from"./Web-CVG0oWkS.chunk.mjs";import"./index-B-dGqfIG.chunk.mjs";import"./pinia-Dn16KcVd.chunk.mjs";import"./PencilOutline-Dpim2F3F.chunk.mjs";import"./logger-D3RVzcfQ-Bkys46hi.chunk.mjs";import"./createElementId-DhjFt1I9-BR-WXAA3.chunk.mjs";import"./NcModal-DyOZxq9E-BdQAvnZZ.chunk.mjs";/* empty css */import"./NcAvatar-QYahYt2p-Bub13UC0.chunk.mjs";import"./index-BrNm47xe.chunk.mjs";import"./util-Alk1iwuj.chunk.mjs";import"./ArrowRight-CLsEMAPw.chunk.mjs";import"./colors-2YFh1g7z-Esf5_Pnk.chunk.mjs";import"./NcUserStatusIcon-CNh1vXUF-BrBSNJ0h.chunk.mjs";import"./NcDateTime.vue_vue_type_script_setup_true_lang-B4upiZjL-DJNkT_h3.chunk.mjs";import"./TrashCanOutline-ImpP8zID.chunk.mjs";import"./NcUserBubble-BnaGHDoD-DBPIicof.chunk.mjs";import"./index-C1xmmKTZ-BlRBA4Z1.chunk.mjs";import"./index-CpKA6aNV.chunk.mjs";import"./mdi-C7UShXbV.chunk.mjs";import"./activity-CgsVnLJG.chunk.mjs";import"./GetComments-DSuBVNUT.chunk.mjs";import"./index-DscLWkdM.chunk.mjs";const d={name:"ActivityCommentEntry",components:{Comment:a},mixins:[p],props:{comment:{type:Object,required:!0},reloadCallback:{type:Function,required:!0}},data(){return{commentMessage:""}},watch:{comment(){this.commentMessage=this.comment.props.message}},mounted(){this.commentMessage=this.comment.props.message},methods:{t:s}};function g(t,e,o,f,m,C){const r=n("Comment");return c(),u(r,l({ref:"comment",tag:"li"},o.comment.props,{autoComplete:t.autoComplete,resourceType:t.resourceType,message:m.commentMessage,resourceId:t.resourceId,userData:t.genMentionsData(o.comment.props.mentions),class:"comments-activity",onDelete:e[0]||(e[0]=y=>o.reloadCallback())}),null,16,["autoComplete","resourceType","message","resourceId","userData"])}const Q=i(d,[["render",g],["__scopeId","data-v-afc310f1"]]);export{Q as default};
//# sourceMappingURL=ActivityCommentEntry-CdVPVw6t.chunk.mjs.map
Loading
Loading