Browse Source

Add Toast notifications

master
Joshua Rubingh 5 months ago
parent
commit
69b2776cad
  1. 3
      components/app/list/item.vue
  2. 1
      components/apps/deleteButton.vue
  3. 1
      components/contributors/deleteButton.vue
  4. 3
      components/researchStudies/list.vue
  5. 10
      locales/en.js
  6. 13
      nuxt.config.js
  7. 3
      package.json
  8. 4
      pages/researchStudies/_studyId/apps/windows-vdi/index.vue
  9. 3
      pages/researchStudies/_studyId/contributors/invite.vue
  10. 5
      pages/researchStudies/create.vue
  11. 19516
      yarn.lock

3
components/app/list/item.vue

@ -9,6 +9,7 @@ @@ -9,6 +9,7 @@
:href="app.login ? app.login : ''"
:target="app.login ? '_blank' : ''"
:disabled="!app.available"
style="height: 100%"
>
<v-avatar>
<v-img :src="app.src" :alt="`${app.name}`" height="100" width="100" />
@ -43,4 +44,4 @@ export default { @@ -43,4 +44,4 @@ export default {
float: left;
margin: 1rem;
}
</style>
</style>

1
components/apps/deleteButton.vue

@ -62,6 +62,7 @@ export default { @@ -62,6 +62,7 @@ export default {
onResponse() {
this.vm.dialog = false
this.vm.$nuxt.refresh()
this.vm.$toast.success(this.vm.$t('page.researchStudies.studyId.apps.index.deleted'))
},
}),
}

1
components/contributors/deleteButton.vue

@ -70,6 +70,7 @@ export default { @@ -70,6 +70,7 @@ export default {
onResponse() {
this.vm.dialog = false
this.vm.$nuxt.refresh()
this.vm.$toast.success(this.vm.$t('page.researchStudies.studyId.contributors.contributorId.deleted'))
},
}),
}

3
components/researchStudies/list.vue

@ -13,7 +13,6 @@ @@ -13,7 +13,6 @@
</v-card-title>
<v-data-table
multi-sort
hide-default-footer
:headers="headers"
:items="studies"
:search="search"
@ -110,4 +109,4 @@ export default { @@ -110,4 +109,4 @@ export default {
},
},
}
</script>
</script>

10
locales/en.js

@ -17,7 +17,8 @@ export default { @@ -17,7 +17,8 @@ export default {
privacyStatement: {
title: 'Privacy statement',
text: 'On the other hand, we denounce with righteous indignation and dislike men who are so beguiled and demoralized by the charms of pleasure of the moment, so blinded by desire, that they cannot foresee the pain and trouble that are bound to ensue; and equal blame belongs to those who fail in their duty through weakness of will, which is the same as saying through shrinking from toil and pain. These cases are perfectly simple and easy to distinguish. In a free hour, when our power of choice is untrammeled and when nothing prevents our being able to do what we like best, every pleasure is to be welcomed and every pain avoided. But in certain circumstances and owing to the claims of duty or the obligations of business it will frequently occur that pleasures have to be repudiated and annoyances accepted. The wise man therefore always holds in these matters to this principle of selection: he rejects pleasures to secure other greater pleasures, or else he endures pains to avoid worse pains.',
}
},
success: 'Study {study_name} is created',
},
studyId: {
index: {
@ -45,7 +46,9 @@ export default { @@ -45,7 +46,9 @@ export default {
text: 'Are you sure you want to remove the {app_name} app for researcher {researcher_name}?',
ok: 'Yes',
cancel: 'No'
}
},
created: 'The app {app_name} has been created',
deleted: 'The app has been deleted',
}
},
contributors: {
@ -90,7 +93,8 @@ export default { @@ -90,7 +93,8 @@ export default {
},
edit: {
title: 'Edit contributor',
}
},
deleted: 'The contributor is deleted'
},
},
overview : {

13
nuxt.config.js

@ -55,8 +55,21 @@ export default { @@ -55,8 +55,21 @@ export default {
'@nuxtjs/proxy',
'@nuxtjs/i18n',
'@nuxtjs/sentry',
'@nuxtjs/toast',
],
toast: {
position: 'top-right',
duration : 10000,
iconPack : 'mdi',
action : {
icon: 'close',
onClick : (e, toastObject) => {
toastObject.goAway(0);
}
},
},
i18n: {
locales: [
{

3
package.json

@ -21,6 +21,7 @@ @@ -21,6 +21,7 @@
"@nuxtjs/axios": "^5.13.6",
"@nuxtjs/i18n": "^7.0.3",
"@nuxtjs/sentry": "^5.1.4",
"@nuxtjs/toast": "^3.3.1",
"ajv-i18n": "^4.1.0",
"core-js": "^3.15.1",
"nuxt": "^2.15.7",
@ -51,4 +52,4 @@ @@ -51,4 +52,4 @@
"require-extension-hooks-babel": "^1.0.0",
"require-extension-hooks-vue": "^3.0.0"
}
}
}

4
pages/researchStudies/_studyId/apps/windows-vdi/index.vue

@ -177,6 +177,10 @@ export default { @@ -177,6 +177,10 @@ export default {
},
onResponse(response) {
this.vm.$nuxt.refresh()
this.vm.$toast.success(
this.vm.$t('page.researchStudies.studyId.apps.index.created', {app_name : response.data.display_name})
)
},
}),
}

3
pages/researchStudies/_studyId/contributors/invite.vue

@ -97,11 +97,12 @@ export default { @@ -97,11 +97,12 @@ export default {
},
required: ['first_name', 'last_name', 'email', 'role'],
},
onResponse() {
onResponse(response) {
const studyId = this.vm.$route.params.studyId
this.vm.$router.push(
this.vm.localePath(`/researchStudies/${studyId}/contributors`)
)
this.vm.$toast.success(response.data.message)
},
}),
}

5
pages/researchStudies/create.vue

@ -146,6 +146,9 @@ export default { @@ -146,6 +146,9 @@ export default {
required: ['name', 'code', 'field'],
},
onResponse(response) {
this.vm.$toast.success(
this.vm.$t('page.researchStudies.create.success',{study_name : response.data.name})
)
this.vm.$router.push(
this.vm.localePath(`/researchStudies/${response.data.id}/`)
)
@ -172,4 +175,4 @@ export default { @@ -172,4 +175,4 @@ export default {
#fileInput {
display: none;
}
</style>
</style>

19516
yarn.lock

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save