Skip to content

Commit

Permalink
Merge pull request #567 from noi-techpark/allow-all-publishers
Browse files Browse the repository at this point in the history
Allow all publishers
  • Loading branch information
RudiThoeni committed Apr 24, 2024
2 parents 9d5eff6 + 4ab3cc8 commit ad843cd
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 20 deletions.
7 changes: 4 additions & 3 deletions databrowser/src/components/popover/PopoverContent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ SPDX-License-Identifier: AGPL-3.0-or-later
-->

<template>
<div
class="p-4"
<PopoverContentFrame
:class="{
'cursor-pointer hover:bg-gray-50': withHover && !disabled,
'text-disabled': disabled,
Expand All @@ -23,10 +22,12 @@ SPDX-License-Identifier: AGPL-3.0-or-later
$event.stopPropagation();
"
></slot>
</div>
</PopoverContentFrame>
</template>

<script setup lang="ts">
import PopoverContentFrame from './PopoverContentFrame.vue';
withDefaults(defineProps<{ disabled?: boolean; withHover?: boolean }>(), {
disabled: false,
withHover: false,
Expand Down
11 changes: 11 additions & 0 deletions databrowser/src/components/popover/PopoverContentFrame.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!--
SPDX-FileCopyrightText: NOI Techpark <digital@noi.bz.it>
SPDX-License-Identifier: AGPL-3.0-or-later
-->

<template>
<div class="p-4">
<slot></slot>
</div>
</template>
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,28 @@ SPDX-License-Identifier: AGPL-3.0-or-later
</template>
<template #container>
<PopoverCustomPanel>
<PopoverContent class="max-w-lg">
<PopoverContentFrame class="max-w-lg">
<div>
<div
class="mb-2 mr-1 text-sm font-bold text-black md:w-auto md:text-base"
>
{{ t('components.pushData.popup.title') }}
</div>
</div>

<div v-if="publishers.length === 0" class="mb-6 flex flex-col gap-2">
<div>
{{ t('components.pushData.popup.noPublishersAvailable') }}
</div>
<div>
{{ t('components.pushData.popup.contactSupport1') }}
<a :href="`mailto:${t('contact.emailSupport')}`">
{{ t('components.pushData.popup.contactSupport2') }}
</a>
</div>
</div>

<div v-else>
<div class="mb-4">
{{ t('components.pushData.popup.selectChannel') }}
</div>
Expand Down Expand Up @@ -65,10 +79,9 @@ SPDX-License-Identifier: AGPL-3.0-or-later
</ButtonCustom>

<PushResult :push-results="pushResults" />

<LastPushInfo :id="id" :push-results="pushResults" />
</div>
</PopoverContent>
<LastPushInfo :id="id" :push-results="pushResults" />
</PopoverContentFrame>
</PopoverCustomPanel>
</template>
</PopoverCustom>
Expand All @@ -80,7 +93,7 @@ import { useI18n } from 'vue-i18n';
import ButtonCustom from '../../../../../components/button/ButtonCustom.vue';
import { computeButtonClasses } from '../../../../../components/button/styles';
import { Size, Tone, Variant } from '../../../../../components/button/types';
import PopoverContent from '../../../../../components/popover/PopoverContent.vue';
import PopoverContentFrame from '../../../../../components/popover/PopoverContentFrame.vue';
import PopoverCustom from '../../../../../components/popover/PopoverCustom.vue';
import PopoverCustomButton from '../../../../../components/popover/PopoverCustomButton.vue';
import PopoverCustomPanel from '../../../../../components/popover/PopoverCustomPanel.vue';
Expand Down
19 changes: 7 additions & 12 deletions databrowser/src/domain/publisher/usePublisher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,11 @@ const select = (
): TourismPublisher[] => {
// Unwrap data from pagination
const unwrappedData = unwrapData<OdhPublisher[]>(data);
return (
unwrappedData
.filter((publisher) => publisher.PushConfig?.length > 0)
// At the moment it should not be possible to send push notifications to the noi community app
// This exception is hardcoded here, but it should be handled in a more generic way
.filter((publisher) => publisher.Id !== 'noi-communityapp')
.map<TourismPublisher>((publisher) => ({
id: publisher.Id,
key: publisher.Key,
name: publisher.Name,
}))
);
return unwrappedData
.filter((publisher) => publisher.PushConfig?.length > 0)
.map<TourismPublisher>((publisher) => ({
id: publisher.Id,
key: publisher.Key,
name: publisher.Name,
}));
};
3 changes: 3 additions & 0 deletions databrowser/src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,9 @@
"popup": {
"buttonAfterSend": "Push-Notifications sent",
"buttonBeforeSend": "Send out the Push-Notifications",
"contactSupport1": "If you think this is an error, please contact the",
"contactSupport2": "support",
"noPublishersAvailable": "For this entry, there are no publishers available to send push.",
"pushSendImmediately": "Push-Notification is immediately sent out",
"selectChannel": "Stay connected! Select the channel you want to send the push notification to:",
"title": "Push-Notification"
Expand Down

0 comments on commit ad843cd

Please sign in to comment.