From e63fd587c81fd8fc2596fd097a1bf613480233f2 Mon Sep 17 00:00:00 2001 From: dpschen Date: Sun, 14 Nov 2021 15:56:52 +0000 Subject: [PATCH] feat: use script setup for filter views (#951) Co-authored-by: Dominik Pschenitschni Reviewed-on: https://kolaente.dev/vikunja/frontend/pulls/951 Reviewed-by: konrad Co-authored-by: dpschen Co-committed-by: dpschen --- src/components/list/partials/filters.vue | 6 +- src/router/index.js | 30 +++-- src/views/filters/FilterDelete.vue | 40 ++++++ src/views/filters/FilterEdit.vue | 127 ++++++++++++++++++ .../{CreateSavedFilter.vue => FilterNew.vue} | 60 +++------ src/views/filters/settings/delete.vue | 39 ------ src/views/filters/settings/edit.vue | 117 ---------------- 7 files changed, 210 insertions(+), 209 deletions(-) create mode 100644 src/views/filters/FilterDelete.vue create mode 100644 src/views/filters/FilterEdit.vue rename src/views/filters/{CreateSavedFilter.vue => FilterNew.vue} (66%) delete mode 100644 src/views/filters/settings/delete.vue delete mode 100644 src/views/filters/settings/edit.vue diff --git a/src/components/list/partials/filters.vue b/src/components/list/partials/filters.vue index 95a849d2..039061ac 100644 --- a/src/components/list/partials/filters.vue +++ b/src/components/list/partials/filters.vue @@ -189,6 +189,8 @@ import ListService from '@/services/list' import NamespaceService from '@/services/namespace' import EditLabels from '@/components/tasks/partials/editLabels.vue' +import {objectToSnakeCase} from '@/helpers/case' + // FIXME: merge with DEFAULT_PARAMS in taskList.js const DEFAULT_PARAMS = { sort_by: [], @@ -261,7 +263,9 @@ export default { watch: { modelValue: { handler(value) { - this.params = value + // FIXME: filters should only be converted to snake case in + // the last moment + this.params = objectToSnakeCase(value) this.prepareFilters() }, immediate: true, diff --git a/src/router/index.js b/src/router/index.js index 378e9f97..1670185d 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -35,15 +35,17 @@ import ListSettingDuplicate from '../views/list/settings/duplicate' import ListSettingShare from '../views/list/settings/share' import ListSettingDelete from '../views/list/settings/delete' import ListSettingArchive from '../views/list/settings/archive' -import FilterSettingEdit from '../views/filters/settings/edit' -import FilterSettingDelete from '../views/filters/settings/delete' + // Namespace Settings import NamespaceSettingEdit from '../views/namespaces/settings/edit' import NamespaceSettingShare from '../views/namespaces/settings/share' import NamespaceSettingArchive from '../views/namespaces/settings/archive' import NamespaceSettingDelete from '../views/namespaces/settings/delete' + // Saved Filters -import CreateSavedFilter from '../views/filters/CreateSavedFilter' +import FilterNew from '@/views/filters/FilterNew' +import FilterEdit from '@/views/filters/FilterEdit' +import FilterDelete from '@/views/filters/FilterDelete' const PasswordResetComponent = () => import('../views/user/PasswordReset') const GetPasswordResetComponent = () => import('../views/user/RequestPasswordReset') @@ -279,14 +281,14 @@ const router = createRouter({ path: '/lists/:listId/settings/edit', name: 'filter.settings.edit', components: { - popup: FilterSettingEdit, + popup: FilterEdit, }, }, { path: '/lists/:listId/settings/delete', name: 'filter.settings.delete', components: { - popup: FilterSettingDelete, + popup: FilterDelete, }, }, { @@ -337,12 +339,12 @@ const router = createRouter({ { path: '/lists/:listId/settings/edit', name: 'filter.list.settings.edit', - component: FilterSettingEdit, + component: FilterEdit, }, { path: '/lists/:listId/settings/delete', name: 'filter.list.settings.delete', - component: FilterSettingDelete, + component: FilterDelete, }, ], }, @@ -389,12 +391,12 @@ const router = createRouter({ { path: '/lists/:listId/settings/edit', name: 'filter.gantt.settings.edit', - component: FilterSettingEdit, + component: FilterEdit, }, { path: '/lists/:listId/settings/delete', name: 'filter.gantt.settings.delete', - component: FilterSettingDelete, + component: FilterDelete, }, ], }, @@ -436,12 +438,12 @@ const router = createRouter({ { path: '/lists/:listId/settings/edit', name: 'filter.table.settings.edit', - component: FilterSettingEdit, + component: FilterEdit, }, { path: '/lists/:listId/settings/delete', name: 'filter.table.settings.delete', - component: FilterSettingDelete, + component: FilterDelete, }, ], }, @@ -488,12 +490,12 @@ const router = createRouter({ { path: '/lists/:listId/settings/edit', name: 'filter.kanban.settings.edit', - component: FilterSettingEdit, + component: FilterEdit, }, { path: '/lists/:listId/settings/delete', name: 'filter.kanban.settings.delete', - component: FilterSettingDelete, + component: FilterDelete, }, ], }, @@ -542,7 +544,7 @@ const router = createRouter({ path: '/filters/new', name: 'filters.create', components: { - popup: CreateSavedFilter, + popup: FilterNew, }, }, { diff --git a/src/views/filters/FilterDelete.vue b/src/views/filters/FilterDelete.vue new file mode 100644 index 00000000..b0cba2ba --- /dev/null +++ b/src/views/filters/FilterDelete.vue @@ -0,0 +1,40 @@ + + + diff --git a/src/views/filters/FilterEdit.vue b/src/views/filters/FilterEdit.vue new file mode 100644 index 00000000..d7de1c85 --- /dev/null +++ b/src/views/filters/FilterEdit.vue @@ -0,0 +1,127 @@ + + + diff --git a/src/views/filters/CreateSavedFilter.vue b/src/views/filters/FilterNew.vue similarity index 66% rename from src/views/filters/CreateSavedFilter.vue rename to src/views/filters/FilterNew.vue index 43296fe2..418beb0e 100644 --- a/src/views/filters/CreateSavedFilter.vue +++ b/src/views/filters/FilterNew.vue @@ -26,20 +26,20 @@
- - diff --git a/src/views/filters/settings/delete.vue b/src/views/filters/settings/delete.vue deleted file mode 100644 index 07172382..00000000 --- a/src/views/filters/settings/delete.vue +++ /dev/null @@ -1,39 +0,0 @@ - - - diff --git a/src/views/filters/settings/edit.vue b/src/views/filters/settings/edit.vue deleted file mode 100644 index 2ee4e094..00000000 --- a/src/views/filters/settings/edit.vue +++ /dev/null @@ -1,117 +0,0 @@ - - -