feat: function attribute typing
This commit is contained in:
parent
6c7c5133d6
commit
6cb6387a4b
|
@ -225,7 +225,7 @@ function resize() {
|
||||||
store.commit(MENU_ACTIVE, window.innerWidth >= 770)
|
store.commit(MENU_ACTIVE, window.innerWidth >= 770)
|
||||||
}
|
}
|
||||||
|
|
||||||
function toggleLists(namespaceId: number) {
|
function toggleLists(namespaceId: NamespaceModel['id']) {
|
||||||
listsVisible.value[namespaceId] = !listsVisible.value[namespaceId]
|
listsVisible.value[namespaceId] = !listsVisible.value[namespaceId]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -53,7 +53,7 @@ export default defineComponent({
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
updateData(checked) {
|
updateData(checked: boolean) {
|
||||||
this.checked = checked
|
this.checked = checked
|
||||||
this.$emit('update:modelValue', checked)
|
this.$emit('update:modelValue', checked)
|
||||||
this.$emit('change', checked)
|
this.$emit('change', checked)
|
||||||
|
|
|
@ -182,6 +182,7 @@ import {useI18n} from 'vue-i18n'
|
||||||
|
|
||||||
import {RIGHTS} from '@/models/constants/rights'
|
import {RIGHTS} from '@/models/constants/rights'
|
||||||
import LinkShareModel from '@/models/linkShare'
|
import LinkShareModel from '@/models/linkShare'
|
||||||
|
import type ListModel from '@/models/list'
|
||||||
|
|
||||||
import LinkShareService from '@/services/linkShare'
|
import LinkShareService from '@/services/linkShare'
|
||||||
|
|
||||||
|
@ -216,7 +217,7 @@ watch(
|
||||||
const store = useStore()
|
const store = useStore()
|
||||||
const frontendUrl = computed(() => store.state.config.frontendUrl)
|
const frontendUrl = computed(() => store.state.config.frontendUrl)
|
||||||
|
|
||||||
async function load(listId) {
|
async function load(listId: ListModel['id']) {
|
||||||
// If listId == 0 the list on the calling component wasn't already loaded, so we just bail out here
|
// If listId == 0 the list on the calling component wasn't already loaded, so we just bail out here
|
||||||
if (listId === 0) {
|
if (listId === 0) {
|
||||||
return
|
return
|
||||||
|
@ -225,7 +226,7 @@ async function load(listId) {
|
||||||
linkShares.value = await linkShareService.getAll({listId})
|
linkShares.value = await linkShareService.getAll({listId})
|
||||||
}
|
}
|
||||||
|
|
||||||
async function add(listId) {
|
async function add(listId: ListModel['id']) {
|
||||||
const newLinkShare = new LinkShareModel({
|
const newLinkShare = new LinkShareModel({
|
||||||
right: selectedRight.value,
|
right: selectedRight.value,
|
||||||
listId,
|
listId,
|
||||||
|
@ -241,7 +242,7 @@ async function add(listId) {
|
||||||
await load(listId)
|
await load(listId)
|
||||||
}
|
}
|
||||||
|
|
||||||
async function remove(listId) {
|
async function remove(listId: ListModel['id']) {
|
||||||
try {
|
try {
|
||||||
await linkShareService.delete(new LinkShareModel({
|
await linkShareService.delete(new LinkShareModel({
|
||||||
id: linkIdToDelete.value,
|
id: linkIdToDelete.value,
|
||||||
|
|
|
@ -355,7 +355,7 @@ async function toggleType(sharable) {
|
||||||
const found = ref([])
|
const found = ref([])
|
||||||
|
|
||||||
const currentUserId = computed(() => store.state.auth.info.id)
|
const currentUserId = computed(() => store.state.auth.info.id)
|
||||||
async function find(query) {
|
async function find(query: string) {
|
||||||
if (query === '') {
|
if (query === '') {
|
||||||
found.value = []
|
found.value = []
|
||||||
return
|
return
|
||||||
|
|
|
@ -142,6 +142,7 @@ import {defineComponent} from 'vue'
|
||||||
|
|
||||||
import AttachmentService from '../../../services/attachment'
|
import AttachmentService from '../../../services/attachment'
|
||||||
import AttachmentModel from '../../../models/attachment'
|
import AttachmentModel from '../../../models/attachment'
|
||||||
|
import type FileModel from '@/models/file'
|
||||||
import User from '@/components/misc/user.vue'
|
import User from '@/components/misc/user.vue'
|
||||||
import {mapState} from 'vuex'
|
import {mapState} from 'vuex'
|
||||||
|
|
||||||
|
@ -234,7 +235,7 @@ export default defineComponent({
|
||||||
|
|
||||||
this.uploadFiles(this.$refs.files.files)
|
this.uploadFiles(this.$refs.files.files)
|
||||||
},
|
},
|
||||||
uploadFiles(files) {
|
uploadFiles(files: FileModel[]) {
|
||||||
uploadFiles(this.attachmentService, this.taskId, files)
|
uploadFiles(this.attachmentService, this.taskId, files)
|
||||||
},
|
},
|
||||||
async deleteAttachment() {
|
async deleteAttachment() {
|
||||||
|
|
|
@ -163,6 +163,7 @@ import TaskCommentModel from '@/models/taskComment'
|
||||||
import {uploadFile} from '@/helpers/attachments'
|
import {uploadFile} from '@/helpers/attachments'
|
||||||
import {success} from '@/message'
|
import {success} from '@/message'
|
||||||
import {formatDateLong, formatDateSince} from '@/helpers/time/formatDate'
|
import {formatDateLong, formatDateSince} from '@/helpers/time/formatDate'
|
||||||
|
import type TaskModel from '@/models/task'
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
taskId: {
|
taskId: {
|
||||||
|
@ -214,7 +215,7 @@ function attachmentUpload(...args) {
|
||||||
|
|
||||||
const taskCommentService = shallowReactive(new TaskCommentService())
|
const taskCommentService = shallowReactive(new TaskCommentService())
|
||||||
|
|
||||||
async function loadComments(taskId) {
|
async function loadComments(taskId: TaskModel['id']) {
|
||||||
if (!enabled.value) {
|
if (!enabled.value) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -263,7 +264,7 @@ function toggleEdit(comment: TaskCommentModel) {
|
||||||
Object.assign(commentEdit, comment)
|
Object.assign(commentEdit, comment)
|
||||||
}
|
}
|
||||||
|
|
||||||
function toggleDelete(commentId) {
|
function toggleDelete(commentId: TaskCommentModel['id']) {
|
||||||
showDeleteModal.value = !showDeleteModal.value
|
showDeleteModal.value = !showDeleteModal.value
|
||||||
commentToDelete.id = commentId
|
commentToDelete.id = commentId
|
||||||
}
|
}
|
||||||
|
|
|
@ -95,7 +95,7 @@ async function removeAssignee(user: UserModel) {
|
||||||
success({message: t('task.assignee.unassignSuccess')})
|
success({message: t('task.assignee.unassignSuccess')})
|
||||||
}
|
}
|
||||||
|
|
||||||
async function findUser(query) {
|
async function findUser(query: string) {
|
||||||
if (query === '') {
|
if (query === '') {
|
||||||
clearAllFoundUsers()
|
clearAllFoundUsers()
|
||||||
return
|
return
|
||||||
|
|
|
@ -216,7 +216,7 @@ export default defineComponent({
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
async findTasks(query) {
|
async findTasks(query: string) {
|
||||||
this.query = query
|
this.query = query
|
||||||
this.foundTasks = await this.taskService.getAll({}, {s: query})
|
this.foundTasks = await this.taskService.getAll({}, {s: query})
|
||||||
},
|
},
|
||||||
|
|
|
@ -207,7 +207,7 @@ export default defineComponent({
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
undoDone(checked) {
|
undoDone(checked: boolean) {
|
||||||
this.task.done = !this.task.done
|
this.task.done = !this.task.done
|
||||||
this.markAsDone(!checked)
|
this.markAsDone(!checked)
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,15 +1,15 @@
|
||||||
import AbstractService from './abstractService'
|
import AbstractService from './abstractService'
|
||||||
|
|
||||||
export default class AccountDeleteService extends AbstractService {
|
export default class AccountDeleteService extends AbstractService {
|
||||||
request(password) {
|
request(password: string) {
|
||||||
return this.post('/user/deletion/request', {password: password})
|
return this.post('/user/deletion/request', {password})
|
||||||
}
|
}
|
||||||
|
|
||||||
confirm(token) {
|
confirm(token: string) {
|
||||||
return this.post('/user/deletion/confirm', {token: token})
|
return this.post('/user/deletion/confirm', {token})
|
||||||
}
|
}
|
||||||
|
|
||||||
cancel(password) {
|
cancel(password: string) {
|
||||||
return this.post('/user/deletion/cancel', {password: password})
|
return this.post('/user/deletion/cancel', {password})
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -22,9 +22,9 @@ export default class BackgroundUploadService extends AbstractService {
|
||||||
* @param file
|
* @param file
|
||||||
* @returns {Promise<any|never>}
|
* @returns {Promise<any|never>}
|
||||||
*/
|
*/
|
||||||
create(listId, file) {
|
create(listId: ListModel['id'], file) {
|
||||||
return this.uploadFile(
|
return this.uploadFile(
|
||||||
this.getReplacedRoute(this.paths.create, {listId: listId}),
|
this.getReplacedRoute(this.paths.create, {listId}),
|
||||||
file,
|
file,
|
||||||
'background',
|
'background',
|
||||||
)
|
)
|
||||||
|
|
|
@ -2,11 +2,11 @@ import AbstractService from './abstractService'
|
||||||
import {downloadBlob} from '../helpers/downloadBlob'
|
import {downloadBlob} from '../helpers/downloadBlob'
|
||||||
|
|
||||||
export default class DataExportService extends AbstractService {
|
export default class DataExportService extends AbstractService {
|
||||||
request(password) {
|
request(password: string) {
|
||||||
return this.post('/user/export/request', {password: password})
|
return this.post('/user/export/request', {password})
|
||||||
}
|
}
|
||||||
|
|
||||||
async download(password) {
|
async download(password: string) {
|
||||||
const clear = this.setLoading()
|
const clear = this.setLoading()
|
||||||
try {
|
try {
|
||||||
const url = await this.getBlobUrl('/user/export/download', 'POST', {password})
|
const url = await this.getBlobUrl('/user/export/download', 'POST', {password})
|
||||||
|
|
|
@ -27,7 +27,7 @@ const route = useRoute()
|
||||||
|
|
||||||
async function deleteSavedFilter() {
|
async function deleteSavedFilter() {
|
||||||
// We assume the listId in the route is the pseudolist
|
// We assume the listId in the route is the pseudolist
|
||||||
const savedFilterId = getSavedFilterIdFromListId(route.params.listId)
|
const savedFilterId = getSavedFilterIdFromListId(Number((route.params.listId as string)))
|
||||||
|
|
||||||
const filterService = new SavedFilterService()
|
const filterService = new SavedFilterService()
|
||||||
const filter = new SavedFilterModel({id: savedFilterId})
|
const filter = new SavedFilterModel({id: savedFilterId})
|
||||||
|
|
|
@ -52,11 +52,12 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, shallowRef, computed, watch } from 'vue'
|
import { ref, shallowRef, computed, watch, unref } from 'vue'
|
||||||
import { useRouter, useRoute } from 'vue-router'
|
import { useRouter, useRoute } from 'vue-router'
|
||||||
import { store } from '@/store'
|
import { store } from '@/store'
|
||||||
import { success } from '@/message'
|
import { success } from '@/message'
|
||||||
import { useI18n } from 'vue-i18n'
|
import { useI18n } from 'vue-i18n'
|
||||||
|
import type {MaybeRef} from '@vueuse/core'
|
||||||
|
|
||||||
import {default as Editor} from '@/components/input/AsyncEditor'
|
import {default as Editor} from '@/components/input/AsyncEditor'
|
||||||
import CreateEdit from '@/components/misc/create-edit.vue'
|
import CreateEdit from '@/components/misc/create-edit.vue'
|
||||||
|
@ -67,10 +68,11 @@ import SavedFilterService from '@/services/savedFilter'
|
||||||
|
|
||||||
import {objectToSnakeCase} from '@/helpers/case'
|
import {objectToSnakeCase} from '@/helpers/case'
|
||||||
import {getSavedFilterIdFromListId} from '@/helpers/savedFilter'
|
import {getSavedFilterIdFromListId} from '@/helpers/savedFilter'
|
||||||
|
import type ListModel from '@/models/list'
|
||||||
|
|
||||||
const { t } = useI18n({useScope: 'global'})
|
const { t } = useI18n({useScope: 'global'})
|
||||||
|
|
||||||
function useSavedFilter(listId) {
|
function useSavedFilter(listId: MaybeRef<ListModel['id']>) {
|
||||||
const filterService = shallowRef(new SavedFilterService())
|
const filterService = shallowRef(new SavedFilterService())
|
||||||
|
|
||||||
const filter = ref(new SavedFilterModel())
|
const filter = ref(new SavedFilterModel())
|
||||||
|
@ -82,9 +84,9 @@ function useSavedFilter(listId) {
|
||||||
})
|
})
|
||||||
|
|
||||||
// loadSavedFilter
|
// loadSavedFilter
|
||||||
watch(listId, async () => {
|
watch(() => unref(listId), async () => {
|
||||||
// We assume the listId in the route is the pseudolist
|
// We assume the listId in the route is the pseudolist
|
||||||
const savedFilterId = getSavedFilterIdFromListId(route.params.listId)
|
const savedFilterId = getSavedFilterIdFromListId(Number(route.params.listId as string))
|
||||||
|
|
||||||
filter.value = new SavedFilterModel({id: savedFilterId })
|
filter.value = new SavedFilterModel({id: savedFilterId })
|
||||||
const response = await filterService.value.get(filter.value)
|
const response = await filterService.value.get(filter.value)
|
||||||
|
@ -110,7 +112,7 @@ function useSavedFilter(listId) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
const listId = computed(() => route.params.listId)
|
const listId = computed(() => Number(route.params.listId as string))
|
||||||
|
|
||||||
const {
|
const {
|
||||||
save,
|
save,
|
||||||
|
|
|
@ -147,7 +147,7 @@ export default defineComponent({
|
||||||
loading: state => state[LOADING] && state[LOADING_MODULE] === 'labels',
|
loading: state => state[LOADING] && state[LOADING_MODULE] === 'labels',
|
||||||
}),
|
}),
|
||||||
methods: {
|
methods: {
|
||||||
deleteLabel(label) {
|
deleteLabel(label: LabelModel) {
|
||||||
this.showDeleteModal = false
|
this.showDeleteModal = false
|
||||||
this.isLabelEdit = false
|
this.isLabelEdit = false
|
||||||
return this.$store.dispatch('labels/deleteLabel', label)
|
return this.$store.dispatch('labels/deleteLabel', label)
|
||||||
|
@ -155,7 +155,7 @@ export default defineComponent({
|
||||||
editLabelSubmit() {
|
editLabelSubmit() {
|
||||||
return this.$store.dispatch('labels/updateLabel', this.labelEditLabel)
|
return this.$store.dispatch('labels/updateLabel', this.labelEditLabel)
|
||||||
},
|
},
|
||||||
editLabel(label) {
|
editLabel(label: LabelModel) {
|
||||||
if (label.createdBy.id !== this.userInfo.id) {
|
if (label.createdBy.id !== this.userInfo.id) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -177,7 +177,7 @@ export default defineComponent({
|
||||||
this.editorActive = false
|
this.editorActive = false
|
||||||
this.$nextTick(() => this.editorActive = true)
|
this.$nextTick(() => this.editorActive = true)
|
||||||
},
|
},
|
||||||
showDeleteDialoge(label) {
|
showDeleteDialoge(label: LabelModel) {
|
||||||
this.labelToDelete = label
|
this.labelToDelete = label
|
||||||
this.showDeleteModal = true
|
this.showDeleteModal = true
|
||||||
},
|
},
|
||||||
|
|
|
@ -148,8 +148,9 @@ import {ALPHABETICAL_SORT} from '@/components/list/partials/filters.vue'
|
||||||
|
|
||||||
import draggable from 'zhyswan-vuedraggable'
|
import draggable from 'zhyswan-vuedraggable'
|
||||||
import {calculateItemPosition} from '../../helpers/calculateItemPosition'
|
import {calculateItemPosition} from '../../helpers/calculateItemPosition'
|
||||||
|
import type TaskModel from '@/models/task'
|
||||||
|
|
||||||
function sortTasks(tasks) {
|
function sortTasks(tasks: TaskModel[]) {
|
||||||
if (tasks === null || tasks === []) {
|
if (tasks === null || tasks === []) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -264,7 +265,7 @@ export default defineComponent({
|
||||||
focusNewTaskInput() {
|
focusNewTaskInput() {
|
||||||
this.$refs.addTask.focusTaskInput()
|
this.$refs.addTask.focusTaskInput()
|
||||||
},
|
},
|
||||||
updateTaskList( task ) {
|
updateTaskList(task: TaskModel) {
|
||||||
if ( this.isAlphabeticalSorting ) {
|
if ( this.isAlphabeticalSorting ) {
|
||||||
// reload tasks with current filter and sorting
|
// reload tasks with current filter and sorting
|
||||||
this.loadTasks(1, undefined, undefined, true)
|
this.loadTasks(1, undefined, undefined, true)
|
||||||
|
@ -278,13 +279,13 @@ export default defineComponent({
|
||||||
|
|
||||||
this.$store.commit(HAS_TASKS, true)
|
this.$store.commit(HAS_TASKS, true)
|
||||||
},
|
},
|
||||||
editTask(id) {
|
editTask(id: TaskModel['id']) {
|
||||||
// Find the selected task and set it to the current object
|
// Find the selected task and set it to the current object
|
||||||
let theTask = this.getTaskById(id) // Somehow this does not work if we directly assign this to this.taskEditTask
|
let theTask = this.getTaskById(id) // Somehow this does not work if we directly assign this to this.taskEditTask
|
||||||
this.taskEditTask = theTask
|
this.taskEditTask = theTask
|
||||||
this.isTaskEdit = true
|
this.isTaskEdit = true
|
||||||
},
|
},
|
||||||
getTaskById(id) {
|
getTaskById(id: TaskModel['id']) {
|
||||||
for (const t in this.tasks) {
|
for (const t in this.tasks) {
|
||||||
if (this.tasks[t].id === parseInt(id)) {
|
if (this.tasks[t].id === parseInt(id)) {
|
||||||
return this.tasks[t]
|
return this.tasks[t]
|
||||||
|
@ -292,7 +293,7 @@ export default defineComponent({
|
||||||
}
|
}
|
||||||
return {} // FIXME: This should probably throw something to make it clear to the user noting was found
|
return {} // FIXME: This should probably throw something to make it clear to the user noting was found
|
||||||
},
|
},
|
||||||
updateTasks(updatedTask) {
|
updateTasks(updatedTask: TaskModel) {
|
||||||
for (const t in this.tasks) {
|
for (const t in this.tasks) {
|
||||||
if (this.tasks[t].id === updatedTask.id) {
|
if (this.tasks[t].id === updatedTask.id) {
|
||||||
this.tasks[t] = updatedTask
|
this.tasks[t] = updatedTask
|
||||||
|
|
|
@ -445,6 +445,7 @@ import {uploadFile} from '@/helpers/attachments'
|
||||||
import ChecklistSummary from '../../components/tasks/partials/checklist-summary.vue'
|
import ChecklistSummary from '../../components/tasks/partials/checklist-summary.vue'
|
||||||
import CreatedUpdated from '@/components/tasks/partials/createdUpdated.vue'
|
import CreatedUpdated from '@/components/tasks/partials/createdUpdated.vue'
|
||||||
import { setTitle } from '@/helpers/setTitle'
|
import { setTitle } from '@/helpers/setTitle'
|
||||||
|
import type ListModel from '@/models/list'
|
||||||
|
|
||||||
function scrollIntoView(el) {
|
function scrollIntoView(el) {
|
||||||
if (!el) {
|
if (!el) {
|
||||||
|
@ -584,7 +585,7 @@ export default defineComponent({
|
||||||
return uploadFile(this.taskId, ...args)
|
return uploadFile(this.taskId, ...args)
|
||||||
},
|
},
|
||||||
|
|
||||||
async loadTask(taskId) {
|
async loadTask(taskId: TaskModel['id']) {
|
||||||
if (taskId === undefined) {
|
if (taskId === undefined) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -690,7 +691,7 @@ export default defineComponent({
|
||||||
this.saveTask(true, this.toggleTaskDone)
|
this.saveTask(true, this.toggleTaskDone)
|
||||||
},
|
},
|
||||||
|
|
||||||
async changeList(list) {
|
async changeList(list: ListModel) {
|
||||||
this.$store.commit('kanban/removeTaskInBucket', this.task)
|
this.$store.commit('kanban/removeTaskInBucket', this.task)
|
||||||
this.task.listId = list.id
|
this.task.listId = list.id
|
||||||
await this.saveTask()
|
await this.saveTask()
|
||||||
|
|
|
@ -257,7 +257,7 @@ async function addUser() {
|
||||||
success({message: t('team.edit.userAddedSuccess')})
|
success({message: t('team.edit.userAddedSuccess')})
|
||||||
}
|
}
|
||||||
|
|
||||||
async function toggleUserType(member) {
|
async function toggleUserType(member: TeamMemberModel) {
|
||||||
// FIXME: direct manipulation
|
// FIXME: direct manipulation
|
||||||
member.admin = !member.admin
|
member.admin = !member.admin
|
||||||
member.teamId = teamId.value
|
member.teamId = teamId.value
|
||||||
|
|
Reference in New Issue