forked from vikunja/frontend
Add settings lookup to add-task
Enable specification of List ID for list-search Add default list to user settings Add default setting Update settings UI for default list
This commit is contained in:
parent
b005d023c9
commit
a9728f774d
|
@ -73,10 +73,14 @@ export default {
|
||||||
this.labelTaskService = new LabelTaskService()
|
this.labelTaskService = new LabelTaskService()
|
||||||
},
|
},
|
||||||
beforeMount() {
|
beforeMount() {
|
||||||
console.log(this.listId)
|
// If the parent provides the ID alway use that be falling back to the one
|
||||||
|
// stored in settings. If neither are avliable then hide the component.
|
||||||
if (this.listId !== undefined) {
|
if (this.listId !== undefined) {
|
||||||
this.listIdForNewTask = this.listId
|
this.listIdForNewTask = this.listId
|
||||||
this.validListIdAvailable = true
|
this.validListIdAvailable = true
|
||||||
|
} else if(this.$store.state.auth.settings.defaultListID !== undefined) {
|
||||||
|
this.listIdForNewTask = this.$store.state.auth.settings.defaultListID
|
||||||
|
this.validListIdAvailable = true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
|
|
@ -35,9 +35,18 @@ export default {
|
||||||
components: {
|
components: {
|
||||||
Multiselect,
|
Multiselect,
|
||||||
},
|
},
|
||||||
|
props: {
|
||||||
|
listId: {
|
||||||
|
type: Number,
|
||||||
|
required: false,
|
||||||
|
},
|
||||||
|
},
|
||||||
beforeMount() {
|
beforeMount() {
|
||||||
this.listSerivce = new ListService()
|
this.listSerivce = new ListService()
|
||||||
this.list = new ListModel()
|
this.list = new ListModel()
|
||||||
|
if (this.listId !== undefined) {
|
||||||
|
this.getListById()
|
||||||
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
findLists(query) {
|
findLists(query) {
|
||||||
|
@ -54,6 +63,15 @@ export default {
|
||||||
this.error(e, this)
|
this.error(e, this)
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
getListById() {
|
||||||
|
this.listService.get({id: this.listId})
|
||||||
|
.then(response => {
|
||||||
|
this.$set(this, 'foundLists', response)
|
||||||
|
})
|
||||||
|
.catch(e => {
|
||||||
|
this.error(e, this)
|
||||||
|
})
|
||||||
|
},
|
||||||
clearAll() {
|
clearAll() {
|
||||||
this.$set(this, 'foundLists', [])
|
this.$set(this, 'foundLists', [])
|
||||||
},
|
},
|
||||||
|
|
|
@ -9,6 +9,7 @@ export default class UserSettingsModel extends AbstractModel {
|
||||||
discoverableByName: false,
|
discoverableByName: false,
|
||||||
discoverableByEmail: false,
|
discoverableByEmail: false,
|
||||||
overdueTasksRemindersEnabled: true,
|
overdueTasksRemindersEnabled: true,
|
||||||
|
defaultListID: 1,
|
||||||
weekStart: 0,
|
weekStart: 0,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,11 @@
|
||||||
import {HTTPFactory} from '@/http-common'
|
import { HTTPFactory } from '@/http-common'
|
||||||
import {ERROR_MESSAGE, LOADING} from '../mutation-types'
|
import { ERROR_MESSAGE, LOADING } from '../mutation-types'
|
||||||
import UserModel from '../../models/user'
|
import UserModel from '../../models/user'
|
||||||
|
|
||||||
const defaultSettings = settings => {
|
const defaultSettings = settings => {
|
||||||
|
if (typeof settings.defaultListID === 'undefined' || settings.defaultListID === '') {
|
||||||
|
settings.defaultListID = 1
|
||||||
|
}
|
||||||
if (typeof settings.weekStart === 'undefined' || settings.weekStart === '') {
|
if (typeof settings.weekStart === 'undefined' || settings.weekStart === '') {
|
||||||
settings.weekStart = 0
|
settings.weekStart = 0
|
||||||
}
|
}
|
||||||
|
@ -57,7 +60,7 @@ export default {
|
||||||
// Logs a user in with a set of credentials.
|
// Logs a user in with a set of credentials.
|
||||||
login(ctx, credentials) {
|
login(ctx, credentials) {
|
||||||
const HTTP = HTTPFactory()
|
const HTTP = HTTPFactory()
|
||||||
ctx.commit(LOADING, true, {root: true})
|
ctx.commit(LOADING, true, { root: true })
|
||||||
|
|
||||||
// Delete an eventually preexisting old token
|
// Delete an eventually preexisting old token
|
||||||
localStorage.removeItem('token')
|
localStorage.removeItem('token')
|
||||||
|
@ -92,13 +95,13 @@ export default {
|
||||||
if (e.response.status === 401) {
|
if (e.response.status === 401) {
|
||||||
errorMsg = 'Wrong username or password.'
|
errorMsg = 'Wrong username or password.'
|
||||||
}
|
}
|
||||||
ctx.commit(ERROR_MESSAGE, errorMsg, {root: true})
|
ctx.commit(ERROR_MESSAGE, errorMsg, { root: true })
|
||||||
}
|
}
|
||||||
|
|
||||||
return Promise.reject()
|
return Promise.reject()
|
||||||
})
|
})
|
||||||
.finally(() => {
|
.finally(() => {
|
||||||
ctx.commit(LOADING, false, {root: true})
|
ctx.commit(LOADING, false, { root: true })
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
// Registers a new user and logs them in.
|
// Registers a new user and logs them in.
|
||||||
|
@ -115,18 +118,18 @@ export default {
|
||||||
})
|
})
|
||||||
.catch(e => {
|
.catch(e => {
|
||||||
if (e.response && e.response.data && e.response.data.message) {
|
if (e.response && e.response.data && e.response.data.message) {
|
||||||
ctx.commit(ERROR_MESSAGE, e.response.data.message, {root: true})
|
ctx.commit(ERROR_MESSAGE, e.response.data.message, { root: true })
|
||||||
}
|
}
|
||||||
|
|
||||||
return Promise.reject(e)
|
return Promise.reject(e)
|
||||||
})
|
})
|
||||||
.finally(() => {
|
.finally(() => {
|
||||||
ctx.commit(LOADING, false, {root: true})
|
ctx.commit(LOADING, false, { root: true })
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
openIdAuth(ctx, {provider, code}) {
|
openIdAuth(ctx, { provider, code }) {
|
||||||
const HTTP = HTTPFactory()
|
const HTTP = HTTPFactory()
|
||||||
ctx.commit(LOADING, true, {root: true})
|
ctx.commit(LOADING, true, { root: true })
|
||||||
|
|
||||||
const data = {
|
const data = {
|
||||||
code: code,
|
code: code,
|
||||||
|
@ -150,15 +153,15 @@ export default {
|
||||||
if (e.response.status === 401) {
|
if (e.response.status === 401) {
|
||||||
errorMsg = 'Wrong username or password.'
|
errorMsg = 'Wrong username or password.'
|
||||||
}
|
}
|
||||||
ctx.commit(ERROR_MESSAGE, errorMsg, {root: true})
|
ctx.commit(ERROR_MESSAGE, errorMsg, { root: true })
|
||||||
}
|
}
|
||||||
return Promise.reject()
|
return Promise.reject()
|
||||||
})
|
})
|
||||||
.finally(() => {
|
.finally(() => {
|
||||||
ctx.commit(LOADING, false, {root: true})
|
ctx.commit(LOADING, false, { root: true })
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
linkShareAuth(ctx, {hash, password}) {
|
linkShareAuth(ctx, { hash, password }) {
|
||||||
const HTTP = HTTPFactory()
|
const HTTP = HTTPFactory()
|
||||||
return HTTP.post('/shares/' + hash + '/auth', {
|
return HTTP.post('/shares/' + hash + '/auth', {
|
||||||
password: password,
|
password: password,
|
||||||
|
|
|
@ -132,6 +132,16 @@
|
||||||
Play a sound when marking tasks as done
|
Play a sound when marking tasks as done
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="field">
|
||||||
|
<label class="is-flex is-align-items-center">
|
||||||
|
<span>
|
||||||
|
Default list for new tasks is
|
||||||
|
</span>
|
||||||
|
<div class="ml-2">
|
||||||
|
<list-search @selected="changeList" :listId="settings.defaultListID" ref="defaultList"/>
|
||||||
|
</div>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
<div class="field">
|
<div class="field">
|
||||||
<label class="is-flex is-align-items-center">
|
<label class="is-flex is-align-items-center">
|
||||||
<span>
|
<span>
|
||||||
|
@ -262,6 +272,7 @@ import TotpModel from '../../models/totp'
|
||||||
import TotpService from '../../services/totp'
|
import TotpService from '../../services/totp'
|
||||||
import UserSettingsService from '../../services/userSettings'
|
import UserSettingsService from '../../services/userSettings'
|
||||||
import UserSettingsModel from '../../models/userSettings'
|
import UserSettingsModel from '../../models/userSettings'
|
||||||
|
import ListSearch from '../../components/tasks/partials/listSearch'
|
||||||
import {playSoundWhenDoneKey} from '@/helpers/playPop'
|
import {playSoundWhenDoneKey} from '@/helpers/playPop'
|
||||||
|
|
||||||
import {mapState} from 'vuex'
|
import {mapState} from 'vuex'
|
||||||
|
@ -295,6 +306,7 @@ export default {
|
||||||
},
|
},
|
||||||
components: {
|
components: {
|
||||||
AvatarSettings,
|
AvatarSettings,
|
||||||
|
ListSearch,
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
this.passwordUpdateService = new PasswordUpdateService()
|
this.passwordUpdateService = new PasswordUpdateService()
|
||||||
|
@ -420,6 +432,9 @@ export default {
|
||||||
copy(text) {
|
copy(text) {
|
||||||
copy(text)
|
copy(text)
|
||||||
},
|
},
|
||||||
|
changeList(list) {
|
||||||
|
this.settings.defaultListID = list.id
|
||||||
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user