diff options
Diffstat (limited to 'apps/updatenotification/src')
5 files changed, 43 insertions, 16 deletions
diff --git a/apps/updatenotification/src/components/AppChangelogDialog.vue b/apps/updatenotification/src/components/AppChangelogDialog.vue index 4cd38498747..0fb7432843c 100644 --- a/apps/updatenotification/src/components/AppChangelogDialog.vue +++ b/apps/updatenotification/src/components/AppChangelogDialog.vue @@ -19,7 +19,7 @@ import { generateOcsUrl } from '@nextcloud/router' import { ref, watchEffect } from 'vue' import axios from '@nextcloud/axios' -import NcDialog from '@nextcloud/vue/dist/Components/NcDialog.js' +import NcDialog from '@nextcloud/vue/components/NcDialog' import Markdown from './Markdown.vue' const props = withDefaults( diff --git a/apps/updatenotification/src/components/UpdateNotification.vue b/apps/updatenotification/src/components/UpdateNotification.vue index 6df59ce2ef6..94c58dbdfd9 100644 --- a/apps/updatenotification/src/components/UpdateNotification.vue +++ b/apps/updatenotification/src/components/UpdateNotification.vue @@ -167,18 +167,18 @@ import { getLoggerBuilder } from '@nextcloud/logger' import { generateUrl, getRootUrl, generateOcsUrl } from '@nextcloud/router' import axios from '@nextcloud/axios' -import NcActions from '@nextcloud/vue/dist/Components/NcActions.js' -import NcActionButton from '@nextcloud/vue/dist/Components/NcActionButton.js' -import NcActionCaption from '@nextcloud/vue/dist/Components/NcActionCaption.js' -import NcActionLink from '@nextcloud/vue/dist/Components/NcActionLink.js' -import NcNoteCard from '@nextcloud/vue/dist/Components/NcNoteCard.js' -import NcSelect from '@nextcloud/vue/dist/Components/NcSelect.js' -import NcSettingsSection from '@nextcloud/vue/dist/Components/NcSettingsSection.js' +import NcActions from '@nextcloud/vue/components/NcActions' +import NcActionButton from '@nextcloud/vue/components/NcActionButton' +import NcActionCaption from '@nextcloud/vue/components/NcActionCaption' +import NcActionLink from '@nextcloud/vue/components/NcActionLink' +import NcNoteCard from '@nextcloud/vue/components/NcNoteCard' +import NcSelect from '@nextcloud/vue/components/NcSelect' +import NcSettingsSection from '@nextcloud/vue/components/NcSettingsSection' import IconChevronDown from 'vue-material-design-icons/ChevronDown.vue' import IconCloudCheckVariant from 'vue-material-design-icons/CloudCheckVariant.vue' import IconLink from 'vue-material-design-icons/Link.vue' import IconNewBox from 'vue-material-design-icons/NewBox.vue' -import IconPencil from 'vue-material-design-icons/Pencil.vue' +import IconPencil from 'vue-material-design-icons/PencilOutline.vue' import IconSourceBranch from 'vue-material-design-icons/SourceBranch.vue' import IconStar from 'vue-material-design-icons/Star.vue' import IconWeatherNight from 'vue-material-design-icons/WeatherNight.vue' @@ -357,10 +357,10 @@ export default { this.missingAppUpdates = data.ocs.data.missing this.isListFetched = true this.appStoreFailed = false - }).catch(({ data }) => { + }).catch(({ response }) => { this.availableAppUpdates = [] this.missingAppUpdates = [] - this.appStoreDisabled = data.ocs.data.appstore_disabled + this.appStoreDisabled = response.data.ocs.data.appstore_disabled this.isListFetched = true this.appStoreFailed = true }) diff --git a/apps/updatenotification/src/init.ts b/apps/updatenotification/src/init.ts index ebfbf68996a..d82272bf4b2 100644 --- a/apps/updatenotification/src/init.ts +++ b/apps/updatenotification/src/init.ts @@ -2,13 +2,15 @@ * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later */ +import type { INavigationEntry } from '../../../core/src/types/navigation' + import { subscribe } from '@nextcloud/event-bus' import { loadState } from '@nextcloud/initial-state' import { generateOcsUrl } from '@nextcloud/router' import Vue, { defineAsyncComponent } from 'vue' import axios from '@nextcloud/axios' -const navigationEntries = loadState('core', 'apps', {}) +const navigationEntries = loadState<INavigationEntry[]>('core', 'apps', []) const DialogVue = defineAsyncComponent(() => import('./components/AppChangelogDialog.vue')) @@ -39,8 +41,9 @@ function showDialog(appId: string, version?: string) { dialog.$destroy?.() resolve(dismissed) - if (dismissed && appId in navigationEntries) { - window.location = navigationEntries[appId].href + const app = navigationEntries.find(({ app }) => app === appId) + if (dismissed && app !== undefined) { + window.location.href = app.href } } }, diff --git a/apps/updatenotification/src/update-notification-legacy.ts b/apps/updatenotification/src/update-notification-legacy.ts new file mode 100644 index 00000000000..5809c1761dc --- /dev/null +++ b/apps/updatenotification/src/update-notification-legacy.ts @@ -0,0 +1,24 @@ +/** + * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors + * SPDX-License-Identifier: AGPL-3.0-or-later + */ + +import { showInfo } from '@nextcloud/dialogs' +import { loadState } from '@nextcloud/initial-state' +import { t } from '@nextcloud/l10n' + +interface IUpdateNotificationState { + updateLink: string + updateVersion: string +} + +/** + * This only gets loaded if an update is available and the notifications app is not enabled for the user. + */ +window.addEventListener('DOMContentLoaded', function() { + const { updateLink, updateVersion } = loadState<IUpdateNotificationState>('updatenotification', 'updateState') + const text = t('core', '{version} is available. Get more information on how to update.', { version: updateVersion }) + + // On click open the update link in a new tab + showInfo(text, { onClick: () => window.open(updateLink, '_blank') }) +}) diff --git a/apps/updatenotification/src/views/App.vue b/apps/updatenotification/src/views/App.vue index cd4fa282dfe..8bf1d86dfe2 100644 --- a/apps/updatenotification/src/views/App.vue +++ b/apps/updatenotification/src/views/App.vue @@ -19,8 +19,8 @@ import { translate as t } from '@nextcloud/l10n' import { loadState } from '@nextcloud/initial-state' -import NcAppContent from '@nextcloud/vue/dist/Components/NcAppContent.js' -import NcContent from '@nextcloud/vue/dist/Components/NcContent.js' +import NcAppContent from '@nextcloud/vue/components/NcAppContent' +import NcContent from '@nextcloud/vue/components/NcContent' import Markdown from '../components/Markdown.vue' const { |