Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Debug romain #41

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions package-lock.json

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

3 changes: 2 additions & 1 deletion quasar.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,8 @@ module.exports = function (ctx) {

// Quasar plugins
plugins: [
'Notify'
'Notify',
'LocalStorage'
]
},

Expand Down
1 change: 1 addition & 0 deletions src/components/AddAssets.vue
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
:ratio="16 / 9"
:src="asset.url"
@click="asset.isSelected = !asset.isSelected"
contain
basic>
</q-img>
<div class="absolute-right q-mt-sm q-mr-sm">
Expand Down
5 changes: 5 additions & 0 deletions src/components/Camera.vue
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,11 @@ export default {
})
}
},
beforeDestroy () {
this.$refs.video.pause()
this.$refs.video.src = ''
this.$refs.video.srcObject.getTracks()[0].stop()
},
methods: {
/**
* Capture the image
Expand Down
2 changes: 1 addition & 1 deletion src/components/dialogs/AssetsManager.vue
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ input[type='file']
:key="index"
class="card col-2 q-ma-md"
>
<q-img v-if="asset.url" class="fit rounded-borders" :ratio="16 / 9" :src="asset.url" basic>
<q-img v-if="asset.url" class="fit rounded-borders" :ratio="16 / 9" :src="asset.url" contain basic>
</q-img>
<div class="erase absolute-right q-mt-sm q-mr-sm">
<q-btn
Expand Down
17 changes: 9 additions & 8 deletions src/layouts/HomeLayout.vue
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,7 @@ import DialogDeviceName from '~/components/dialogs/DeviceName'
import DialogDeviceInvitation from '~/components/dialogs/DeviceInvitation'

import Camera from '~/components/Camera'
console.log('id:')
console.log(localStorage.id)

export default {
name: 'LayoutHome',
components: {
Expand All @@ -187,7 +186,7 @@ export default {
* If route is host/assets open assets manager
*/
mounted () {
if (!localStorage.getItem('id')) {
if (!process.browser && !localStorage.getItem('id')) {
this.$router.push({
name: 'auth'
})
Expand All @@ -211,8 +210,12 @@ export default {
},
computed: {
code () {
return localStorage.getItem('username') + ':' +
localStorage.getItem('password')
if (process.browser) {
return localStorage.getItem('username') + ':' +
localStorage.getItem('password')
} else {
return ':'
}
},
users () {
return this.$store.getters['users/users']
Expand Down Expand Up @@ -285,9 +288,7 @@ export default {
* Go to auth page
**/
onLogout () {
localStorage.removeItem('id')
localStorage.removeItem('username')
localStorage.removeItem('password')
localStorage.clear()
this.$router.push({
name: 'auth'
})
Expand Down
19 changes: 19 additions & 0 deletions src/pages/TabEditor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@
<q-img
:ratio="1"
:src="item.asset.url"
contain
>
<!-- :class="'item-img class-'+ item.asset.id" -->
<div
Expand Down Expand Up @@ -124,6 +125,8 @@
class="q-ma-md bg-white"
:value="tab.name"
@input="setName"
@keyup.enter="$event.target.blur()"
@blur="onSaveTabElement('nom de l\'onglet')"
filled
/>

Expand All @@ -133,6 +136,8 @@
class="q-ma-md bg-white"
:value="tab.hexColor"
@input="setHexColor"
@keyup.enter="$event.target.blur()"
@blur="onSaveTabElement('couleur')"
filled
>
<template v-slot:append>
Expand Down Expand Up @@ -371,6 +376,18 @@ export default {
})
})
},
onSaveTabElement (message) {
let notif = message ? 'enregistrement ' + message : 'changement enregistré'
this.$store.dispatch('tabEditor/saveTabWithoutItem', (tab) => {
/* Toast message */
const path = `/tabs/${tab.get(SLUG_KEY)}`
if (this.$route.path !== path) this.$router.push(path)
this.$q.notify({
message: notif,
color: 'purple'
})
})
},
/**
* Call to remove tab
*/
Expand All @@ -396,9 +413,11 @@ export default {
},
setLanguage (language) {
this.$store.commit('tabEditor/setLanguage', this.options.indexOf(language))
this.onSaveTabElement('langue')
},
setSpeed (speed) {
this.$store.commit('tabEditor/setSpeed', this.speeds.indexOf(speed))
this.onSaveTabElement('vitesse')
},
/**
* Call to open the item dialog in new item mode
Expand Down
1 change: 0 additions & 1 deletion src/store/devices/actions.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import Parse from 'parse'

import DeviceUser, { USERNAME_KEY } from '~/models/DeviceUser'

/**
* Load devices
* @param {Context} ctx
Expand Down
43 changes: 43 additions & 0 deletions src/store/tab-editor/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,49 @@ export const loadBySlug = ({ commit, dispatch }, slug) => {
})
}

export const loadBySlugWithoutItem = ({ commit, dispatch }, slug) => {
new Parse.Query(TabModel)
.equalTo(SLUG_KEY, slug)
.equalTo('user', localStorage.id)
.first()
.then((tabModel) => {
commit('setTab', tabModel)
console.log('tab changed')
})
.catch((err) => {
commit('setError', err)
})
}

export const saveTabWithoutItem = ({ commit, dispatch, getters: { tab } }, callback) => {
tabToModel(tab)
.then((tabModel) => {
const promises = []
/**
* Save basic changes
*/
tabModel.set(NAME_KEY, tab.name)
tabModel.set(HEX_COLOR_KEY, tab.hexColor)
tabModel.set(SLUG_KEY, slugify(tab.name))
tabModel.set(SPEED_KEY, tab.speed)
tabModel.set(LANGUAGE_KEY, tab.language)

/* Save the tabmodel */
promises.push(tabModel.save())

return Promise.all(promises)
})
.then(([tabModel]) => {
return Promise.all([
dispatch('loadBySlugWithoutItem', tabModel.get(SLUG_KEY)),
callback(tabModel)
])
})
.catch((err) => {
commit('setError', err)
})
}

/**
* Load every items for the loaded tab
* @param {Context} ctx
Expand Down
1 change: 0 additions & 1 deletion src/store/tab-editor/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import {
HIDDEN_KEY as ITEM_HIDDEN_KEY,
ORDER_KEY as ITEM_ORDER_KEY
} from '~/models/TabItem'

/**
* Set something in the tab from its key
* @param {State} state
Expand Down