Merge remote-tracking branch 'origin/monterail_vue3_migration_admin' into user-page-apollo-toast-packages

This commit is contained in:
Kamila 2024-07-25 19:30:12 +02:00
commit 2881159364
7 changed files with 118 additions and 248 deletions

View File

@ -43,56 +43,6 @@
</div>
</template>
<!--<script setup>-->
<!--import { ref, watchEffect } from 'vue'-->
<!--import { useEmit } from '@vueuse/core'-->
<!--import ContributionLinkForm from '../ContributionLink/ContributionLinkForm'-->
<!--import ContributionLinkList from '../ContributionLink/ContributionLinkList'-->
<!--import { useToggle } from 'vueuse'-->
<!--// extracting props-->
<!--const props = defineProps({-->
<!-- items: {-->
<!-- type: Array,-->
<!-- required: true,-->
<!-- },-->
<!-- count: {-->
<!-- type: Number,-->
<!-- required: true,-->
<!-- },-->
<!--})-->
<!--// extracting emits-->
<!--const emit = useEmit()-->
<!--// setting up refs-->
<!--const visible = ref(false)-->
<!--const contributionLinkData = ref({})-->
<!--const editContributionLink = ref(false)-->
<!--// setting up methods-->
<!--const closeContributionForm = () => {-->
<!-- if (visible.value) {-->
<!-- emit('bv::toggle::collapse', 'newContribution')-->
<!-- editContributionLink.value = false-->
<!-- contributionLinkData.value = {}-->
<!-- }-->
<!--}-->
<!--const editContributionLinkData = (data) => {-->
<!-- if (!visible.value) {-->
<!-- emit('bv::toggle::collapse', 'newContribution')-->
<!-- }-->
<!-- contributionLinkData.value = data-->
<!-- editContributionLink.value = true-->
<!--}-->
<!--defineExpose({-->
<!-- closeContributionForm,-->
<!-- editContributionLinkData,-->
<!--})-->
<!--</script>-->
<script>
import ContributionLinkForm from '../ContributionLink/ContributionLinkForm'
import ContributionLinkList from '../ContributionLink/ContributionLinkList'

View File

@ -116,102 +116,6 @@
</BForm>
</div>
</template>
<!--<script>-->
<!--import { createContributionLink } from '@/graphql/createContributionLink.js'-->
<!--import { updateContributionLink } from '@/graphql/updateContributionLink.js'-->
<!--export default {-->
<!-- name: 'ContributionLinkForm',-->
<!-- props: {-->
<!-- contributionLinkData: {-->
<!-- type: Object,-->
<!-- default() {-->
<!-- return {}-->
<!-- },-->
<!-- },-->
<!-- editContributionLink: { type: Boolean, required: true },-->
<!-- },-->
<!-- emits: ['close-contribution-form', 'close-contribution-link', 'get-contribution-links'],-->
<!-- data() {-->
<!-- return {-->
<!-- form: {-->
<!-- name: null,-->
<!-- memo: null,-->
<!-- amount: null,-->
<!-- validFrom: null,-->
<!-- validTo: null,-->
<!-- cycle: 'ONCE',-->
<!-- maxPerCycle: 1,-->
<!-- maxAmountPerMonth: '0',-->
<!-- },-->
<!-- min: new Date(),-->
<!-- cycle: [-->
<!-- { value: 'ONCE', text: this.$t('contributionLink.options.cycle.once') },-->
<!-- // { value: 'hourly', text: this.$t('contributionLink.options.cycle.hourly') },-->
<!-- { value: 'DAILY', text: this.$t('contributionLink.options.cycle.daily') },-->
<!-- // { value: 'weekly', text: this.$t('contributionLink.options.cycle.weekly') },-->
<!-- // { value: 'monthly', text: this.$t('contributionLink.options.cycle.monthly') },-->
<!-- // { value: 'yearly', text: this.$t('contributionLink.options.cycle.yearly') },-->
<!-- ],-->
<!-- maxPerCycle: [-->
<!-- { value: '1', text: '1 x' },-->
<!-- // { value: '2', text: '2 x' },-->
<!-- // { value: '3', text: '3 x' },-->
<!-- // { value: '4', text: '4 x' },-->
<!-- // { value: '5', text: '5 x' },-->
<!-- ],-->
<!-- }-->
<!-- },-->
<!-- computed: {-->
<!-- disabled() {-->
<!-- return true-->
<!-- },-->
<!-- },-->
<!-- watch: {-->
<!-- contributionLinkData() {-->
<!-- this.form = this.contributionLinkData-->
<!-- },-->
<!-- },-->
<!-- methods: {-->
<!-- onSubmit() {-->
<!-- if (this.form.validFrom === null)-->
<!-- return this.toastError(this.$t('contributionLink.noStartDate'))-->
<!-- if (this.form.validTo === null) return this.toastError(this.$t('contributionLink.noEndDate'))-->
<!-- const variables = {-->
<!-- ...this.form,-->
<!-- id: this.contributionLinkData.id ? this.contributionLinkData.id : null,-->
<!-- }-->
<!-- this.$apollo-->
<!-- .mutate({-->
<!-- mutation: this.editContributionLink ? updateContributionLink : createContributionLink,-->
<!-- variables: variables,-->
<!-- })-->
<!-- .then((result) => {-->
<!-- const link = this.editContributionLink-->
<!-- ? result.data.updateContributionLink.link-->
<!-- : result.data.createContributionLink.link-->
<!-- this.toastSuccess(-->
<!-- this.editContributionLink ? this.$t('contributionLink.changeSaved') : link,-->
<!-- )-->
<!-- this.onReset()-->
<!-- this.$root.$emit('bv::toggle::collapse', 'newContribution')-->
<!-- this.$emit('get-contribution-links')-->
<!-- })-->
<!-- .catch((error) => {-->
<!-- this.toastError(error.message)-->
<!-- })-->
<!-- },-->
<!-- onReset() {-->
<!-- this.$refs.contributionLinkForm.reset()-->
<!-- this.form = {}-->
<!-- this.form.validFrom = null-->
<!-- this.form.validTo = null-->
<!-- },-->
<!-- },-->
<!--}-->
<!--</script>-->
<script setup>
import { ref, watch } from 'vue'
@ -229,11 +133,7 @@ const props = defineProps({
editContributionLink: { type: Boolean, required: true },
})
const emit = defineEmits([
'bv::toggle::collapse',
'get-contribution-links',
'close-contribution-form',
])
const emit = defineEmits(['get-contribution-links', 'close-contribution-form'])
const { t } = useI18n()
@ -260,7 +160,6 @@ const cycle = ref([
const maxPerCycle = ref([{ value: '1', text: '1 x' }])
// Set client
const { mutate: contributionLinkMutation } = useMutation(
props.editContributionLink ? updateContributionLink : createContributionLink,
)

View File

@ -1,12 +1,12 @@
<template>
<div class="contribution-link-list">
<BTable :items="items" :fields="fields" striped hover stacked="lg">
<BTable :items="props.items" :fields="fields" striped hover stacked="lg">
<template #cell(delete)="data">
<BButton
variant="danger"
size="md"
class="mr-2 test-delete-link"
@click="deleteContributionLink(data.item.id, data.item.name)"
@click="handleDelete(data)"
>
<IBiTrash />
</BButton>
@ -28,7 +28,7 @@
</template>
</BTable>
<BModal ref="my-modal" ok-only hide-header-close>
<BModal id="qr-link-modal" ref="my-modal" v-model="qrLinkModal" ok-only hide-header-close>
<BCard header-tag="header" footer-tag="footer">
<template #header>
<h6 class="mb-0">{{ modalData ? modalData.name : '' }}</h6>
@ -42,90 +42,103 @@
</template>
</BCard>
</BModal>
<BModal id="delete-link-modal" v-model="deleteLinkModal" @ok="executeDelete">
<template #default>
{{ t('contributionLink.deleteNow', { name: itemToBeDeleted.name }) }}
</template>
</BModal>
</div>
</template>
<script>
<script setup>
import { ref } from 'vue'
import { useMutation } from '@vue/apollo-composable'
import { deleteContributionLink } from '@/graphql/deleteContributionLink.js'
import FigureQrCode from '../FigureQrCode'
import { useModal } from 'bootstrap-vue-next'
import { useI18n } from 'vue-i18n'
import { useAppToast } from '@/composables/useToast'
export default {
name: 'ContributionLinkList',
components: {
FigureQrCode,
const props = defineProps({
items: {
type: Array,
required: true,
},
props: {
items: { type: Array, required: true },
},
emits: [
'close-contribution-form',
'edit-contribution-link-data',
'get-contribution-links',
'get-contribution-link',
],
data() {
return {
fields: [
'name',
'memo',
'amount',
{ key: 'cycle', label: this.$t('contributionLink.cycle') },
{ key: 'maxPerCycle', label: this.$t('contributionLink.maxPerCycle') },
{
key: 'validFrom',
label: this.$t('contributionLink.validFrom'),
formatter: (value, key, item) => {
if (value) {
return this.$d(new Date(value))
}
},
},
{
key: 'validTo',
label: this.$t('contributionLink.validTo'),
formatter: (value, key, item) => {
if (value) {
return this.$d(new Date(value))
}
},
},
'delete',
'edit',
'show',
],
modalData: {},
}
},
methods: {
deleteContributionLink(id, name) {
this.$bvModal
.msgBoxConfirm(this.$t('contributionLink.deleteNow', { name: name }))
.then(async (value) => {
if (value)
await this.$apollo
.mutate({
mutation: deleteContributionLink,
variables: {
id: id,
},
})
.then(() => {
this.toastSuccess(this.$t('contributionLink.deleted'))
this.$emit('close-contribution-form')
this.$emit('get-contribution-links')
})
.catch((err) => {
this.toastError(err.message)
})
})
},
editContributionLink(row) {
this.$emit('edit-contribution-link-data', row)
},
})
showContributionLink(row) {
this.modalData = row
this.$refs['my-modal'].show()
},
const qrLinkModal = ref(false)
const { show: showQrCodeModal } = useModal('qr-link-modal')
const deleteLinkModal = ref(false)
const { show: showDeleteLinkModal } = useModal('delete-link-modal')
const emit = defineEmits([
'close-contribution-form',
'get-contribution-links',
'edit-contribution-link-data',
])
const { t, d } = useI18n()
const { toastError, toastSuccess } = useAppToast()
const modalData = ref({})
const fields = ref([
'name',
'memo',
'amount',
{ key: 'cycle', label: t('contributionLink.cycle') },
{ key: 'maxPerCycle', label: t('contributionLink.maxPerCycle') },
{
key: 'validFrom',
label: t('contributionLink.validFrom'),
formatter: (value) => (value ? d(new Date(value)) : ''),
},
{
key: 'validTo',
label: t('contributionLink.validTo'),
formatter: (value) => (value ? d(new Date(value)) : ''),
},
'delete',
'edit',
'show',
])
const { mutate: deleteContributionLinkMutation } = useMutation(deleteContributionLink)
const itemToBeDeleted = ref({})
const handleDelete = async (dataPayload) => {
itemToBeDeleted.value = { ...dataPayload.item }
showDeleteLinkModal()
}
const executeDelete = async () => {
try {
await deleteContributionLinkMutation({ id: parseInt(itemToBeDeleted.value.id) })
toastSuccess(t('contributionLink.deleted'))
emit('close-contribution-form')
emit('get-contribution-links')
itemToBeDeleted.value = {}
} catch (err) {
toastError(err.message)
}
}
const editContributionLink = (row) => {
emit('edit-contribution-link-data', row)
}
const showContributionLink = (row) => {
modalData.value = row
showQrCodeModal()
}
defineExpose({
fields,
modalData,
deleteContributionLink,
editContributionLink,
showContributionLink,
})
</script>

View File

@ -1,7 +1,7 @@
<template>
<div class="figure-qr-code">
<div class="qrbox">
<q-r-canvas :options="options" class="canvas" />
<q-r-canvas v-if="showQr" :options="qrOptions" class="canvas" />
</div>
</div>
</template>
@ -18,26 +18,26 @@ export default {
},
data() {
return {
options: {
image: null,
showQr: false,
}
},
computed: {
qrOptions() {
return {
cellSize: 8,
correctLevel: 'H',
data: this.link,
logo: {
image: null,
},
},
}
logo: { image: this.image },
}
},
},
created() {
const image = new Image()
image.src = 'img/gdd-coin.png'
image.src = '/img/gdd-coin.png'
image.onload = () => {
this.options = {
...this.options,
logo: {
image,
},
}
this.image = image
this.showQr = true
}
},
}

View File

@ -77,7 +77,7 @@
{{ $n(parseFloat(props.statistics.totalGradidoUnbookedDecayed), 'decimal') }}
{{ $t('GDD') }}
</BTd>
<BTd class="text-right"> {{ props.statistics.totalGradidoUnbookedDecayed }} </BTd>
<BTd class="text-right">{{ props.statistics.totalGradidoUnbookedDecayed }}</BTd>
</BTr>
</BTbody>
</BTableSimple>

View File

@ -5,8 +5,8 @@
<BButton
:animation="animation"
data-test="federation-communities-refresh-btn"
@click="refetch"
font-scale="2"
@click="refetch"
>
<IBiArrowClockwise />
<!-- <b-icon-->

View File

@ -16,6 +16,7 @@ set +o allexport
# enable nvm
export NVM_DIR="$HOME/.nvm" && [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
nvm use default
# NOTE: all config values will be in process.env when starting
# the services and will therefore take precedence over the .env
@ -204,6 +205,9 @@ echo 'Updating frontend' >> $UPDATE_HTML
cd $PROJECT_ROOT/frontend
# TODO maybe handle this differently?
unset NODE_ENV
nvm use
nvm install
npm i -g yarn
yarn install
yarn build
# TODO maybe handle this differently?
@ -215,12 +219,15 @@ cd $PROJECT_ROOT/admin
# TODO maybe handle this differently?
unset NODE_ENV
nvm use
nvm install
npm i -g yarn
yarn install
yarn build
# TODO maybe handle this differently?
export NODE_ENV=production
nvm use default
# Install & build dht-node
echo 'Updating dht-node' >> $UPDATE_HTML
cd $PROJECT_ROOT/dht-node
@ -241,6 +248,7 @@ yarn build
# TODO maybe handle this differently?
export NODE_ENV=production
nvm use default
# start after building all to use up less ressources
pm2 start --name gradido-backend "yarn --cwd $PROJECT_ROOT/backend start" -l $GRADIDO_LOG_PATH/pm2.backend.$TODAY.log --log-date-format 'YYYY-MM-DD HH:mm:ss.SSS'
#pm2 start --name gradido-frontend "yarn --cwd $PROJECT_ROOT/frontend start" -l $GRADIDO_LOG_PATH/pm2.frontend.$TODAY.log --log-date-format 'YYYY-MM-DD HH:mm:ss.SSS'