mirror of
https://github.com/IT4Change/gradido.git
synced 2026-02-06 09:56:05 +00:00
add auto polling in frontend for contributions list, default off
This commit is contained in:
parent
2c9e4d5bde
commit
7c991efbb8
@ -29,13 +29,14 @@
|
||||
</div>
|
||||
</template>
|
||||
<script setup>
|
||||
import { ref, computed, watch, watchEffect, onMounted } from 'vue'
|
||||
import { ref, computed } from 'vue'
|
||||
import ContributionListItem from '@/components/Contributions/ContributionListItem.vue'
|
||||
import { listContributions, listAllContributions } from '@/graphql/contributions.graphql'
|
||||
import { useQuery } from '@vue/apollo-composable'
|
||||
import { PAGE_SIZE } from '@/constants'
|
||||
import { useAppToast } from '@/composables/useToast'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import CONFIG from '@/config'
|
||||
|
||||
const props = defineProps({
|
||||
allContribution: {
|
||||
@ -56,6 +57,7 @@ const { t } = useI18n()
|
||||
|
||||
// constants
|
||||
const pageSize = PAGE_SIZE
|
||||
const pollInterval = CONFIG.AUTO_POLL_INTERVAL || undefined
|
||||
|
||||
// refs
|
||||
const currentPage = ref(1)
|
||||
@ -78,7 +80,7 @@ const { result, loading, refetch } = useQuery(
|
||||
}
|
||||
: undefined,
|
||||
}),
|
||||
{ fetchPolicy: 'cache-and-network' },
|
||||
{ fetchPolicy: 'cache-and-network', pollInterval },
|
||||
)
|
||||
|
||||
// events
|
||||
@ -94,7 +96,7 @@ const contributionCount = computed(() => {
|
||||
return contributionListResult.value?.contributionCount || 0
|
||||
})
|
||||
const items = computed(() => {
|
||||
return contributionListResult.value?.contributionList || []
|
||||
return [...(contributionListResult.value?.contributionList || [])]
|
||||
})
|
||||
const isPaginationVisible = computed(() => {
|
||||
return contributionCount.value > pageSize
|
||||
|
||||
@ -230,6 +230,13 @@ watch(
|
||||
{ immediate: true },
|
||||
)
|
||||
|
||||
watch(
|
||||
() => props.contributionStatus,
|
||||
() => {
|
||||
localStatus.value = props.contributionStatus
|
||||
},
|
||||
)
|
||||
|
||||
const statusMapping = {
|
||||
CONFIRMED: { variant: 'success', icon: 'check' },
|
||||
DELETED: { variant: 'danger', icon: 'trash' },
|
||||
|
||||
@ -40,6 +40,7 @@ if (process.env.FRONTEND_HOSTING === 'nodejs') {
|
||||
const features = {
|
||||
GMS_ACTIVE: process.env.GMS_ACTIVE === 'true',
|
||||
HUMHUB_ACTIVE: process.env.HUMHUB_ACTIVE === 'true',
|
||||
AUTO_POLL_INTERVAL: Number.parseInt(process.env.AUTO_POLL_INTERVAL) ?? 0,
|
||||
}
|
||||
|
||||
const environment = {
|
||||
|
||||
@ -42,6 +42,13 @@ module.exports = Joi.object({
|
||||
.default('http://0.0.0.0/admin/authenticate?token=')
|
||||
.required(),
|
||||
|
||||
AUTO_POLL_INTERVAL: Joi.number()
|
||||
.integer()
|
||||
.min(0)
|
||||
.max(600000)
|
||||
.description('Auto Polling for new data in ms. 0 = disabled = default. Experimental!')
|
||||
.default(0),
|
||||
|
||||
COMMUNITY_REGISTER_URL: Joi.string()
|
||||
.uri({ scheme: ['http', 'https'] })
|
||||
.description('URL for Register a new Account in frontend.')
|
||||
|
||||
@ -97,6 +97,7 @@ export default defineConfig(async ({ command }) => {
|
||||
autoInstall: true,
|
||||
}),
|
||||
EnvironmentPlugin({
|
||||
AUTO_POLL_INTERVAL: CONFIG.AUTO_POLL_INTERVAL,
|
||||
GMS_ACTIVE: CONFIG.GMS_ACTIVE,
|
||||
HUMHUB_ACTIVE: CONFIG.HUMHUB_ACTIVE,
|
||||
DEFAULT_PUBLISHER_ID: null,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user