Skip to content

Commit

Permalink
Merge branch 'release/1.3.1' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
adufr committed Aug 30, 2020
2 parents d86517b + 7c3f44e commit 4f886e3
Show file tree
Hide file tree
Showing 10 changed files with 219 additions and 70 deletions.
22 changes: 14 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,16 @@ Le front de calendz est développé avec les frameworks et outils suivants* :

| Librairie | Version | Description |
| ---------------- | ------- | ----------------------------------------------------------------------------------------------------------------- |
| [Vue.js] | 2.6.10 | Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web. |
| [vue-cli] | 3.1.3 | Standard Tooling for Vue.js Development. |
| [vue-router] | 3.0.6 | The official router for Vue.js |
| [vuex] | 3.1.1 | Centralized State Management for Vue.js. |
| [vee-validate] | 2.2.11 | Template Based Validation Framework for Vue.js |
| [Babel] | 7.4.5 | Babel is a compiler for writing next generation JavaScript. |
| [Node-sass] | 4.12.0 | Node.js bindings to libsass. |
| [Vue.js] | 2.6.12 | Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web. |
| [vue-cli] | 3.12.1 | Standard Tooling for Vue.js Development. |
| [vue-router] | 3.4.3 | The official router for Vue.js |
| [vuex] | 3.5.1 | Centralized State Management for Vue.js. |
| [vee-validate] | 2.2.15 | Template Based Validation Framework for Vue.js |
| [Axios] | 0.20.0 | Promise based HTTP client for the browser and node.js |
| [Fullcalendar] | 4.4.2 | Full-sized drag & drop event calendar |
| [SweetAlert2] | 9.17.1 | A beautiful, responsive, highly customizable and accessible (WAI-ARIA) replacement for JavaScript's popup boxes. |
| [Babel] | 7.9.6 | Babel is a compiler for writing next generation JavaScript. |
| [Node-sass] | 4.14.1 | Node.js bindings to libsass. |
| [Bootstrap] | 4.3.1 | The most popular HTML, CSS, and JavaScript framework for developing responsive, mobile first projects on the web. |

**(Liste non exhaustive, uniquement les librairies principales sont présentées)*
Expand All @@ -38,7 +41,7 @@ Le front de calendz est développé avec les frameworks et outils suivants* :

### Pré-requis

* Installer Node 10.15.3
* Installer Node 12.18.3
* Créer un fichier `.env` à la source de ce repository contenant les valeurs suivantes (modifiables selon vos besoins)

NODE_ENV=development
Expand All @@ -57,6 +60,9 @@ Le front de calendz est développé avec les frameworks et outils suivants* :
[vue-router]: https://github.com/vuejs/vue-router
[vuex]: https://github.com/vuejs/vuex
[vee-validate]: https://github.com/baianat/vee-validate
[Axios]: https://github.com/axios/axios
[Fullcalendar]: https://github.com/fullcalendar/fullcalendar
[SweetAlert2]: https://github.com/sweetalert2/sweetalert2
[Babel]: https://github.com/babel/babel
[Node-sass]: https://github.com/sass/node-sass
[Bootstrap]: https://github.com/twbs/bootstrap
34 changes: 17 additions & 17 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"axios": "^0.20.0",
"bootstrap": "4.3.1",
"chart.js": "^2.9.3",
"date-fns": "^2.15.0",
"date-fns": "^2.16.0",
"dropzone": "^5.7.2",
"element-ui": "2.13.2",
"es6-promise": "^4.1.1",
Expand All @@ -35,7 +35,7 @@
"vue-analytics": "^5.22.1",
"vue-chartjs": "^3.5.1",
"vue-clipboard2": "^0.3.1",
"vue-flatpickr-component": "^8.1.5",
"vue-flatpickr-component": "^8.1.6",
"vue-router": "^3.4.3",
"vue2-touch-events": "^2.3.1",
"vue2-transitions": "^0.3.0",
Expand All @@ -49,10 +49,10 @@
"@vue/eslint-config-standard": "^4.0.0",
"babel-plugin-component": "^1.1.0",
"commitizen": "^4.2.1",
"cz-conventional-changelog": "^3.2.1",
"cz-conventional-changelog": "^3.3.0",
"husky": "^4.2.5",
"node-sass": "^4.14.1",
"sass-loader": "^9.0.3",
"sass-loader": "^10.0.1",
"vue-template-compiler": "^2.6.12"
},
"babel": {
Expand Down
6 changes: 6 additions & 0 deletions src/services/sysconf.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@ const SysconfService = {
.catch(err => Promise.reject(err.data))
},

toggleEditGroup: (value) => {
return ApiService.patch(`/sysconf/settings/edit-group-enabled/${value}`)
.then(res => res)
.catch(err => Promise.reject(err.data))
},

disconnectAllUsers: () => {
return ApiService.delete(`/sysconf/refresh-tokens/all`)
.then(res => res)
Expand Down
6 changes: 3 additions & 3 deletions src/services/user.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ const UserService = {
.catch(err => Promise.reject(err))
},

// change user's bts status
changeBts: (bts) => {
return ApiService.patch(`/user/bts/${bts}`)
// user self updates its profile
updateProfile: (data) => {
return ApiService.patch(`/user/profile`, data)
.then(res => res.data)
.catch(err => Promise.reject(err))
},
Expand Down
24 changes: 13 additions & 11 deletions src/store/modules/account.module.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,15 +80,16 @@ const accountModule = {
state.status = { isMigrating: false, migrationError: reason }
},

CHANGE_BTS_REQUEST: (state) => {
state.status = { isChanging: true }
UPDATE_PROFILE_REQUEST: (state) => {
state.status = { isUpdating: true }
},
CHANGE_BTS_SUCCESS: (state, bts) => {
UPDATE_PROFILE_SUCCESS: (state, data) => {
state.status = {}
state.user.bts = bts
state.user.bts = data.bts
state.user.group = data.group
},
CHANGE_BTS_FAILURE: (state, reason) => {
state.status = { changeBtsError: reason }
UPDATE_PROFILE_FAILURE: (state, reason) => {
state.status = { updateProfileError: reason }
},

CHANGE_PASSWORD_REQUEST: (state) => {
Expand Down Expand Up @@ -335,19 +336,20 @@ const accountModule = {
router.push('/login')
},

changeBts: ({ commit }, { bts }) => {
commit('CHANGE_BTS_REQUEST')
UserService.changeBts(bts)
updateProfile: ({ commit }, { bts, group }) => {
commit('UPDATE_PROFILE_REQUEST')
UserService.updateProfile({ bts, group })
.then(
res => {
commit('CHANGE_BTS_SUCCESS', bts)
commit('UPDATE_PROFILE_SUCCESS', { bts, group })
const user = JSON.parse(localStorage.user)
user.bts = bts
user.group = group
localStorage.user = JSON.stringify(user)
Vue.prototype.$notify({ type: 'success', message: `Modification effectuée avec succès !` })
},
err => {
commit('CHANGE_BTS_FAILURE', err.data.message)
commit('UPDATE_PROFILE_FAILURE', err.data.message)
Vue.prototype.$notify({ type: 'danger', message: `<b>Erreur !</b> ${err.data.message || 'Erreur inconnue...'}` })
})
},
Expand Down
43 changes: 38 additions & 5 deletions src/store/modules/sysconf.module.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ const sysconfModule = {
stats: {},
settings: {
loginEnabled: true,
registerEnabled: true
registerEnabled: true,
editGroupEnabled: false
}
},

Expand All @@ -24,15 +25,16 @@ const sysconfModule = {
state.stats = {}
state.settings = {
loginEnabled: true,
registerEnabled: true
registerEnabled: true,
editGroupEnabled: false
}
},

FETCH_SETTINGS_REQUEST: (state) => {
state.status = { isLoading: true }
},
FETCH_SETTINGS_SUCCESS: (state, { loginEnabled, registerEnabled }) => {
state.settings = { loginEnabled, registerEnabled }
FETCH_SETTINGS_SUCCESS: (state, { loginEnabled, registerEnabled, editGroupEnabled }) => {
state.settings = { loginEnabled, registerEnabled, editGroupEnabled }
state.status = {}
},
FETCH_SETTINGS_FAILURE: (state, reason) => {
Expand Down Expand Up @@ -72,6 +74,17 @@ const sysconfModule = {
state.status = { toggleRegisterError: reason }
},

TOGGLE_EDITGROUP_REQUEST: (state) => {
state.status = { isUpdatingEditGroup: true }
},
TOGGLE_EDITGROUP_SUCCESS: (state, value) => {
state.status = { isUpdatingEditGroup: false }
state.settings.editGroupEnabled = value
},
TOGGLE_EDITGROUP_FAILURE: (state, reason) => {
state.status = { toggleEditGroupError: reason }
},

DISCONNECT_USERS_REQUEST: (state) => {
state.status = { isDisconnecting: true }
},
Expand Down Expand Up @@ -104,7 +117,8 @@ const sysconfModule = {
res => {
const loginEnabled = res.data.loginEnabled || false
const registerEnabled = res.data.registerEnabled || false
commit('FETCH_SETTINGS_SUCCESS', { loginEnabled, registerEnabled })
const editGroupEnabled = res.data.editGroupEnabled || false
commit('FETCH_SETTINGS_SUCCESS', { loginEnabled, registerEnabled, editGroupEnabled })
},
err => {
commit('FETCH_SETTINGS_FAILURE', err.message)
Expand Down Expand Up @@ -161,6 +175,25 @@ const sysconfModule = {
Vue.prototype.$notify({ type: 'danger', message: `<b>Erreur !</b> ${err.message || 'Une erreur est survenue...'}` })
})
},
toggleEditGroup: ({ commit }, { value }) => {
commit('TOGGLE_EDITGROUP_REQUEST')
SysconfService.toggleEditGroup(value)
.then(
res => {
const message = value
? 'Les utilisateurs peuvent désormais modifier leur groupe !'
: 'Les utilisateurs ne peuvent désormais plus modifier leur groupe !'
const type = value
? 'success'
: 'warning'
commit('TOGGLE_EDITGROUP_SUCCESS', value)
Vue.prototype.$notify({ type, message })
},
err => {
commit('TOGGLE_EDITGROUP_FAILURE', err.message)
Vue.prototype.$notify({ type: 'danger', message: `<b>Erreur !</b> ${err.message || 'Une erreur est survenue...'}` })
})
},
disconnectAllUsers: ({ commit }) => {
commit('DISCONNECT_USERS_REQUEST')
SysconfService.disconnectAllUsers()
Expand Down
17 changes: 11 additions & 6 deletions src/views/Pages/Dashboard/Admin/DashboardAdmin.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,22 +23,25 @@
<!-- ======================================= -->
<div class="container-fluid mt--6">
<div class="row">
<div class="col-xl-3 col-md-5">
<div class="col-xl-3 col-md-6">
<toggle-register/>
</div>
<div class="col-xl-3 col-md-5">
<div class="col-xl-3 col-md-6">
<toggle-login/>
</div>
<div class="col-xl-3 col-md-5">
<div class="col-xl-3 col-md-6">
<disconnect-users/>
</div>
<div class="col-xl-3 col-md-5">
<div class="col-xl-3 col-md-6">
<migrate-users/>
</div>

<div class="col-lg-5">
<div class="col-lg-6">
<create-notifications/>
</div>
<div class="col-xl-3 col-md-6">
<toggle-edit-group/>
</div>
</div>
</div>
</div>
Expand All @@ -49,14 +52,16 @@ import ToggleRegister from './Widgets/ToggleRegister'
import DisconnectUsers from './Widgets/DisconnectUsers'
import MigrateUsers from './Widgets/MigrateUsers'
import CreateNotifications from './Widgets/CreateNotifications'
import ToggleEditGroup from './Widgets/ToggleEditGroup'
export default {
components: {
ToggleLogin,
ToggleRegister,
DisconnectUsers,
MigrateUsers,
CreateNotifications
CreateNotifications,
ToggleEditGroup
},
mounted () {
this.$store.dispatch('sysconf/fetchSettings')
Expand Down
Loading

0 comments on commit 4f886e3

Please sign in to comment.